@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.
Files changed (110) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/SimpleGrid/SimpleGrid.d.ts +17 -0
  3. package/dist/SimpleGrid/SimpleGrid.js +73 -0
  4. package/dist/SimpleGrid/SimpleGrid.js.map +1 -0
  5. package/dist/SimpleGrid/index.d.ts +2 -0
  6. package/dist/SimpleGrid/index.js +16 -0
  7. package/dist/SimpleGrid/index.js.map +1 -0
  8. package/dist/SimpleGrid/styles.js +99 -0
  9. package/dist/SimpleGrid/styles.js.map +1 -0
  10. package/dist/TimePicker/PeriodPicker/PeriodPicker.js +112 -0
  11. package/dist/TimePicker/PeriodPicker/PeriodPicker.js.map +1 -0
  12. package/dist/TimePicker/PeriodPicker/index.js +21 -0
  13. package/dist/TimePicker/PeriodPicker/index.js.map +1 -0
  14. package/dist/TimePicker/PeriodPicker/styles.js +32 -0
  15. package/dist/TimePicker/PeriodPicker/styles.js.map +1 -0
  16. package/dist/TimePicker/TimePicker.d.ts +140 -0
  17. package/dist/TimePicker/TimePicker.js +748 -0
  18. package/dist/TimePicker/TimePicker.js.map +1 -0
  19. package/dist/TimePicker/UnitTimePicker/UnitTimePicker.js +243 -0
  20. package/dist/TimePicker/UnitTimePicker/UnitTimePicker.js.map +1 -0
  21. package/dist/TimePicker/UnitTimePicker/index.js +21 -0
  22. package/dist/TimePicker/UnitTimePicker/index.js.map +1 -0
  23. package/dist/TimePicker/UnitTimePicker/styles.js +75 -0
  24. package/dist/TimePicker/UnitTimePicker/styles.js.map +1 -0
  25. package/dist/TimePicker/enums.js +43 -0
  26. package/dist/TimePicker/enums.js.map +1 -0
  27. package/dist/TimePicker/index.d.ts +2 -0
  28. package/dist/TimePicker/index.js +16 -0
  29. package/dist/TimePicker/index.js.map +1 -0
  30. package/dist/TimePicker/styles.js +134 -0
  31. package/dist/TimePicker/styles.js.map +1 -0
  32. package/dist/TimePicker/timePickerConverter.js +90 -0
  33. package/dist/TimePicker/timePickerConverter.js.map +1 -0
  34. package/dist/TimePicker/timePickerFormatter.js +81 -0
  35. package/dist/TimePicker/timePickerFormatter.js.map +1 -0
  36. package/dist/TimePicker/timePickerUtils.js +39 -0
  37. package/dist/TimePicker/timePickerUtils.js.map +1 -0
  38. package/dist/legacy/SimpleGrid/SimpleGrid.d.ts +17 -0
  39. package/dist/legacy/SimpleGrid/SimpleGrid.js +59 -0
  40. package/dist/legacy/SimpleGrid/SimpleGrid.js.map +1 -0
  41. package/dist/legacy/SimpleGrid/index.d.ts +2 -0
  42. package/dist/legacy/SimpleGrid/index.js +2 -0
  43. package/dist/legacy/SimpleGrid/index.js.map +1 -0
  44. package/dist/legacy/SimpleGrid/styles.js +81 -0
  45. package/dist/legacy/SimpleGrid/styles.js.map +1 -0
  46. package/dist/legacy/TimePicker/PeriodPicker/PeriodPicker.js +78 -0
  47. package/dist/legacy/TimePicker/PeriodPicker/PeriodPicker.js.map +1 -0
  48. package/dist/legacy/TimePicker/PeriodPicker/index.js +7 -0
  49. package/dist/legacy/TimePicker/PeriodPicker/index.js.map +1 -0
  50. package/dist/legacy/TimePicker/PeriodPicker/styles.js +24 -0
  51. package/dist/legacy/TimePicker/PeriodPicker/styles.js.map +1 -0
  52. package/dist/legacy/TimePicker/TimePicker.d.ts +140 -0
  53. package/dist/legacy/TimePicker/TimePicker.js +696 -0
  54. package/dist/legacy/TimePicker/TimePicker.js.map +1 -0
  55. package/dist/legacy/TimePicker/UnitTimePicker/UnitTimePicker.js +206 -0
  56. package/dist/legacy/TimePicker/UnitTimePicker/UnitTimePicker.js.map +1 -0
  57. package/dist/legacy/TimePicker/UnitTimePicker/index.js +7 -0
  58. package/dist/legacy/TimePicker/UnitTimePicker/index.js.map +1 -0
  59. package/dist/legacy/TimePicker/UnitTimePicker/styles.js +58 -0
  60. package/dist/legacy/TimePicker/UnitTimePicker/styles.js.map +1 -0
  61. package/dist/legacy/TimePicker/enums.js +33 -0
  62. package/dist/legacy/TimePicker/enums.js.map +1 -0
  63. package/dist/legacy/TimePicker/index.d.ts +2 -0
  64. package/dist/legacy/TimePicker/index.js +2 -0
  65. package/dist/legacy/TimePicker/index.js.map +1 -0
  66. package/dist/legacy/TimePicker/styles.js +117 -0
  67. package/dist/legacy/TimePicker/styles.js.map +1 -0
  68. package/dist/legacy/TimePicker/timePickerConverter.js +71 -0
  69. package/dist/legacy/TimePicker/timePickerConverter.js.map +1 -0
  70. package/dist/legacy/TimePicker/timePickerFormatter.js +66 -0
  71. package/dist/legacy/TimePicker/timePickerFormatter.js.map +1 -0
  72. package/dist/legacy/TimePicker/timePickerUtils.js +29 -0
  73. package/dist/legacy/TimePicker/timePickerUtils.js.map +1 -0
  74. package/dist/modern/SimpleGrid/SimpleGrid.d.ts +17 -0
  75. package/dist/modern/SimpleGrid/SimpleGrid.js +60 -0
  76. package/dist/modern/SimpleGrid/SimpleGrid.js.map +1 -0
  77. package/dist/modern/SimpleGrid/index.d.ts +2 -0
  78. package/dist/modern/SimpleGrid/index.js +2 -0
  79. package/dist/modern/SimpleGrid/index.js.map +1 -0
  80. package/dist/modern/SimpleGrid/styles.js +68 -0
  81. package/dist/modern/SimpleGrid/styles.js.map +1 -0
  82. package/dist/modern/TimePicker/PeriodPicker/PeriodPicker.js +75 -0
  83. package/dist/modern/TimePicker/PeriodPicker/PeriodPicker.js.map +1 -0
  84. package/dist/modern/TimePicker/PeriodPicker/index.js +7 -0
  85. package/dist/modern/TimePicker/PeriodPicker/index.js.map +1 -0
  86. package/dist/modern/TimePicker/PeriodPicker/styles.js +22 -0
  87. package/dist/modern/TimePicker/PeriodPicker/styles.js.map +1 -0
  88. package/dist/modern/TimePicker/TimePicker.d.ts +140 -0
  89. package/dist/modern/TimePicker/TimePicker.js +659 -0
  90. package/dist/modern/TimePicker/TimePicker.js.map +1 -0
  91. package/dist/modern/TimePicker/UnitTimePicker/UnitTimePicker.js +191 -0
  92. package/dist/modern/TimePicker/UnitTimePicker/UnitTimePicker.js.map +1 -0
  93. package/dist/modern/TimePicker/UnitTimePicker/index.js +7 -0
  94. package/dist/modern/TimePicker/UnitTimePicker/index.js.map +1 -0
  95. package/dist/modern/TimePicker/UnitTimePicker/styles.js +49 -0
  96. package/dist/modern/TimePicker/UnitTimePicker/styles.js.map +1 -0
  97. package/dist/modern/TimePicker/enums.js +32 -0
  98. package/dist/modern/TimePicker/enums.js.map +1 -0
  99. package/dist/modern/TimePicker/index.d.ts +2 -0
  100. package/dist/modern/TimePicker/index.js +2 -0
  101. package/dist/modern/TimePicker/index.js.map +1 -0
  102. package/dist/modern/TimePicker/styles.js +108 -0
  103. package/dist/modern/TimePicker/styles.js.map +1 -0
  104. package/dist/modern/TimePicker/timePickerConverter.js +66 -0
  105. package/dist/modern/TimePicker/timePickerConverter.js.map +1 -0
  106. package/dist/modern/TimePicker/timePickerFormatter.js +65 -0
  107. package/dist/modern/TimePicker/timePickerFormatter.js.map +1 -0
  108. package/dist/modern/TimePicker/timePickerUtils.js +27 -0
  109. package/dist/modern/TimePicker/timePickerUtils.js.map +1 -0
  110. package/package.json +4 -4
@@ -0,0 +1,71 @@
1
+ import "core-js/modules/es.object.keys.js";
2
+ import "core-js/modules/es.symbol.js";
3
+ import "core-js/modules/es.array.filter.js";
4
+ import "core-js/modules/es.object.to-string.js";
5
+ import "core-js/modules/es.object.get-own-property-descriptor.js";
6
+ import "core-js/modules/web.dom-collections.for-each.js";
7
+ import "core-js/modules/es.object.get-own-property-descriptors.js";
8
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
+
10
+ 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; }
11
+
12
+ 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; }
13
+
14
+ import { isUnitTimeInValidRange } from "./timePickerUtils";
15
+ import { TimeFormat, PeriodPickerOptions, TimePickerUnits } from "./enums";
16
+ /**
17
+ * Gets hours for the passed time format.
18
+ * e.g. 20hours in 12h format is set to 8
19
+ * @param {Number} hours - current hours
20
+ * @param {String} timeFormat - AM/PM
21
+ *
22
+ * @returns {Number} - hours in the correct format
23
+ */
24
+
25
+ var getHoursForTimeFormat = function getHoursForTimeFormat(hours, timeFormat) {
26
+ if (timeFormat === TimeFormat.H12) {
27
+ if (hours == null || hours === 0) {
28
+ return TimePickerUnits.HOUR_12.max;
29
+ }
30
+
31
+ if (isUnitTimeInValidRange(hours, TimePickerUnits.HOUR_12.type)) {
32
+ return hours;
33
+ }
34
+
35
+ if (isUnitTimeInValidRange(hours, TimePickerUnits.HOUR_24.type)) {
36
+ return hours - TimePickerUnits.HOUR_12.max;
37
+ }
38
+ }
39
+
40
+ return hours;
41
+ };
42
+ /**
43
+ * Gets the time in 24h format
44
+ * e.g. 08:00:00:PM in 12h format is set to 20:00:00
45
+ * @param {Object} time - object with hours, minutes, seconds and period
46
+ * @param {String} timeFormat - AM/PM
47
+ *
48
+ * @returns {Object} - time object (hours, minutes, seconds and period) with the hours set
49
+ * into the correct format
50
+ */
51
+
52
+
53
+ var getTimeWithFormat24 = function getTimeWithFormat24(time, timeFormat) {
54
+ var hours = time.hours,
55
+ period = time.period;
56
+
57
+ var timeIn24Format = _objectSpread({}, time);
58
+
59
+ if (timeFormat === TimeFormat.H12) {
60
+ if (period === PeriodPickerOptions.AM && hours === TimePickerUnits.HOUR_12.max) {
61
+ timeIn24Format.hours = TimePickerUnits.HOUR_24.min;
62
+ } else if (period === PeriodPickerOptions.PM && hours < TimePickerUnits.HOUR_12.max) {
63
+ timeIn24Format.hours = hours + TimePickerUnits.HOUR_12.max;
64
+ }
65
+ }
66
+
67
+ return timeIn24Format;
68
+ };
69
+
70
+ export { getHoursForTimeFormat, getTimeWithFormat24 };
71
+ //# sourceMappingURL=timePickerConverter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/TimePicker/timePickerConverter.js"],"names":["isUnitTimeInValidRange","TimeFormat","PeriodPickerOptions","TimePickerUnits","getHoursForTimeFormat","hours","timeFormat","H12","HOUR_12","max","type","HOUR_24","getTimeWithFormat24","time","period","timeIn24Format","AM","min","PM"],"mappings":";;;;;;;;;;;;;AAAA,SAASA,sBAAT,QAAuC,mBAAvC;AACA,SAASC,UAAT,EAAqBC,mBAArB,EAA0CC,eAA1C,QAAiE,SAAjE;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,IAAMC,qBAAqB,GAAG,SAAxBA,qBAAwB,CAACC,KAAD,EAAQC,UAAR,EAAuB;AACnD,MAAIA,UAAU,KAAKL,UAAU,CAACM,GAA9B,EAAmC;AACjC,QAAIF,KAAK,IAAI,IAAT,IAAiBA,KAAK,KAAK,CAA/B,EAAkC;AAChC,aAAOF,eAAe,CAACK,OAAhB,CAAwBC,GAA/B;AACD;;AACD,QAAIT,sBAAsB,CAACK,KAAD,EAAQF,eAAe,CAACK,OAAhB,CAAwBE,IAAhC,CAA1B,EAAiE;AAC/D,aAAOL,KAAP;AACD;;AACD,QAAIL,sBAAsB,CAACK,KAAD,EAAQF,eAAe,CAACQ,OAAhB,CAAwBD,IAAhC,CAA1B,EAAiE;AAC/D,aAAOL,KAAK,GAAGF,eAAe,CAACK,OAAhB,CAAwBC,GAAvC;AACD;AACF;;AACD,SAAOJ,KAAP;AACD,CAbD;AAeA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,IAAMO,mBAAmB,GAAG,SAAtBA,mBAAsB,CAACC,IAAD,EAAOP,UAAP,EAAsB;AAChD,MAAQD,KAAR,GAA0BQ,IAA1B,CAAQR,KAAR;AAAA,MAAeS,MAAf,GAA0BD,IAA1B,CAAeC,MAAf;;AACA,MAAMC,cAAc,qBAAQF,IAAR,CAApB;;AACA,MAAIP,UAAU,KAAKL,UAAU,CAACM,GAA9B,EAAmC;AACjC,QAAIO,MAAM,KAAKZ,mBAAmB,CAACc,EAA/B,IAAqCX,KAAK,KAAKF,eAAe,CAACK,OAAhB,CAAwBC,GAA3E,EAAgF;AAC9EM,MAAAA,cAAc,CAACV,KAAf,GAAuBF,eAAe,CAACQ,OAAhB,CAAwBM,GAA/C;AACD,KAFD,MAEO,IAAIH,MAAM,KAAKZ,mBAAmB,CAACgB,EAA/B,IAAqCb,KAAK,GAAGF,eAAe,CAACK,OAAhB,CAAwBC,GAAzE,EAA8E;AACnFM,MAAAA,cAAc,CAACV,KAAf,GAAuBA,KAAK,GAAGF,eAAe,CAACK,OAAhB,CAAwBC,GAAvD;AACD;AACF;;AACD,SAAOM,cAAP;AACD,CAXD;;AAaA,SAASX,qBAAT,EAAgCQ,mBAAhC","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,66 @@
1
+ import "core-js/modules/es.object.to-string.js";
2
+ import "core-js/modules/es.regexp.to-string.js";
3
+ import "core-js/modules/es.array.concat.js";
4
+ import { TimeFormat, PeriodPickerOptions } from "./enums";
5
+ import { getHoursForTimeFormat } from "./timePickerConverter";
6
+ /**
7
+ * Pads the unit time values so that they always have two digits
8
+ * @param {Number} value - unit time value
9
+ * @returns The unit time value with two digits
10
+ */
11
+
12
+ var padTime = function padTime(value) {
13
+ if (value == null || value === "" || value < 0) {
14
+ return value === null || value === void 0 ? void 0 : value.toString();
15
+ }
16
+
17
+ if (value < 10 && value.toString().length === 1) {
18
+ return "0".concat(value.toString());
19
+ }
20
+
21
+ return value.toString();
22
+ };
23
+ /**
24
+ * Gets the time format for a given locale
25
+ * @param {String} locale - locale
26
+ * @returns {TimeFormat} the time format for the given locale (12 or 24)
27
+ */
28
+
29
+
30
+ var getTimeFormatForLocale = function getTimeFormatForLocale(locale) {
31
+ var options = {
32
+ hour: "numeric"
33
+ };
34
+ var dateTimeFormat = new Intl.DateTimeFormat(locale, options);
35
+ var isInHour12Format = dateTimeFormat.resolvedOptions().hour12;
36
+ return isInHour12Format ? TimeFormat.H12 : TimeFormat.H24;
37
+ };
38
+ /**
39
+ * Formats the time to be rendered
40
+ * @param {Object} time - time object to be rendered
41
+ * @param {Number} time.hours - hours
42
+ * @param {Number} time.minutes - minutes
43
+ * @param {Number} time.seconds - seconds
44
+ * @param {String} time.period - period (am/pm). It is undefined when the time is to be shown in 24h format
45
+ *
46
+ * @returns {String} formatted time
47
+ */
48
+
49
+
50
+ var getFormattedTime = function getFormattedTime(time, timeFormat) {
51
+ var hours = time.hours,
52
+ minutes = time.minutes,
53
+ seconds = time.seconds,
54
+ period = time.period;
55
+ var isInHour12Format = timeFormat === TimeFormat.H12 || timeFormat == null && period != null;
56
+
57
+ if (isInHour12Format) {
58
+ var p = period !== null && period !== void 0 ? period : hours > 12 ? PeriodPickerOptions.PM : PeriodPickerOptions.AM;
59
+ return "".concat(padTime(getHoursForTimeFormat(hours, TimeFormat.H12)), ":").concat(padTime(minutes), ":").concat(padTime(seconds), " ").concat(p);
60
+ }
61
+
62
+ return "".concat(padTime(hours), ":").concat(padTime(minutes), ":").concat(padTime(seconds));
63
+ };
64
+
65
+ export { padTime, getFormattedTime, getTimeFormatForLocale };
66
+ //# sourceMappingURL=timePickerFormatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/TimePicker/timePickerFormatter.js"],"names":["TimeFormat","PeriodPickerOptions","getHoursForTimeFormat","padTime","value","toString","length","getTimeFormatForLocale","locale","options","hour","dateTimeFormat","Intl","DateTimeFormat","isInHour12Format","resolvedOptions","hour12","H12","H24","getFormattedTime","time","timeFormat","hours","minutes","seconds","period","p","PM","AM"],"mappings":";;;AAAA,SAASA,UAAT,EAAqBC,mBAArB,QAAgD,SAAhD;AACA,SAASC,qBAAT,QAAsC,uBAAtC;AAEA;AACA;AACA;AACA;AACA;;AACA,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAACC,KAAD,EAAW;AACzB,MAAIA,KAAK,IAAI,IAAT,IAAiBA,KAAK,KAAK,EAA3B,IAAiCA,KAA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GAAarB,mBAAmB,CAAC0B,EAAjC,GAAsC1B,mBAAmB,CAAC2B,EAA/E;AACA,qBAAUzB,OAAO,CAACD,qBAAqB,CAACoB,KAAD,EAAQtB,UAAU,CAACiB,GAAnB,CAAtB,CAAjB,cAAmEd,OAAO,CAACoB,OAAD,CAA1E,cAAuFpB,OAAO,CAC5FqB,OAD4F,CAA9F,cAEKE,CAFL;AAGD;;AAED,mBAAUvB,OAAO,CAACmB,KAAD,CAAjB,cAA4BnB,OAAO,CAACoB,OAAD,CAAnC,cAAgDpB,OAAO,CAACqB,OAAD,CAAvD;AACD,CAbD;;AAeA,SAASrB,OAAT,EAAkBgB,gBAAlB,EAAoCZ,sBAApC","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,29 @@
1
+ import "core-js/modules/es.array.concat.js";
2
+ import { PeriodPickerOptions, TimePickerUnits } from "./enums";
3
+ /**
4
+ * Gets the period(am/pm) for a given time
5
+ * @param {Date} date - Date to get the period from. The default date is the current one.
6
+ * @returns {String} - AM or PM
7
+ */
8
+
9
+ var getPeriodForDate = function getPeriodForDate() {
10
+ var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();
11
+ var hours = date.getHours();
12
+ return hours < 12 ? PeriodPickerOptions.AM : PeriodPickerOptions.PM;
13
+ };
14
+ /**
15
+ * Checks if the unit time value is inside the acceptable range
16
+ *
17
+ * @param {Number} value - unit time value
18
+ * @param {String} type - unit time type. One of the TimePickerUnits types.
19
+ */
20
+
21
+
22
+ var isUnitTimeInValidRange = function isUnitTimeInValidRange(value, type) {
23
+ var timeUnit = TimePickerUnits[type];
24
+ console.log("type = ".concat(type, ", timeUnit: ").concat(timeUnit));
25
+ return value !== "" && value >= timeUnit.min && value <= timeUnit.max;
26
+ };
27
+
28
+ export { getPeriodForDate, isUnitTimeInValidRange };
29
+ //# sourceMappingURL=timePickerUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/TimePicker/timePickerUtils.js"],"names":["PeriodPickerOptions","TimePickerUnits","getPeriodForDate","date","Date","hours","getHours","AM","PM","isUnitTimeInValidRange","value","type","timeUnit","console","log","min","max"],"mappings":";AAAA,SAASA,mBAAT,EAA8BC,eAA9B,QAAqD,SAArD;AAEA;AACA;AACA;AACA;AACA;;AACA,IAAMC,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,GAAaL,mBAAmB,CAACO,EAAjC,GAAsCP,mBAAmB,CAACQ,EAAjE;AACD,CAHD;AAKA;AACA;AACA;AACA;AACA;AACA;;;AACA,IAAMC,sBAAsB,GAAG,SAAzBA,sBAAyB,CAACC,KAAD,EAAQC,IAAR,EAAiB;AAC9C,MAAMC,QAAQ,GAAGX,eAAe,CAACU,IAAD,CAAhC;AACAE,EAAAA,OAAO,CAACC,GAAR,kBAAsBH,IAAtB,yBAAyCC,QAAzC;AACA,SAAOF,KAAK,KAAK,EAAV,IAAgBA,KAAK,IAAIE,QAAQ,CAACG,GAAlC,IAAyCL,KAAK,IAAIE,QAAQ,CAACI,GAAlE;AACD,CAJD;;AAMA,SAASd,gBAAT,EAA2BO,sBAA3B","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,60 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ const _excluded = ["children", "breakpoints", "spacing", "cols"];
4
+ import React from "react";
5
+ import PropTypes from "prop-types";
6
+ import useStyles from "./styles";
7
+
8
+ const SimpleGrid = _ref => {
9
+ let {
10
+ children,
11
+ breakpoints,
12
+ spacing = "sm",
13
+ cols
14
+ } = _ref,
15
+ others = _objectWithoutProperties(_ref, _excluded);
16
+
17
+ const classes = useStyles({
18
+ breakpoints,
19
+ cols,
20
+ spacing
21
+ })();
22
+ return /*#__PURE__*/React.createElement("div", _extends({
23
+ className: classes.container
24
+ }, others), children);
25
+ };
26
+
27
+ process.env.NODE_ENV !== "production" ? SimpleGrid.propTypes = {
28
+ /**
29
+ * -
30
+ */
31
+ children: PropTypes.node,
32
+
33
+ /**
34
+ * Spacing with pre-defined values according the values defined in the theme
35
+ */
36
+ spacing: PropTypes.oneOf(["sm", "md", "lg", "xl"]),
37
+
38
+ /**
39
+ * Provide an array to define responsive behavior:
40
+ *
41
+ * maxWidth or minWidth: max-width or min-width at which media query will work
42
+ *
43
+ * cols: number of columns per row at given max-width
44
+ *
45
+ * spacing: optional spacing at given max-width, if not provided spacing from component prop will be used instead
46
+ */
47
+ breakpoints: PropTypes.arrayOf(PropTypes.shape({
48
+ maxWidth: PropTypes.number,
49
+ minWidth: PropTypes.number,
50
+ cols: PropTypes.number,
51
+ spacing: PropTypes.oneOf(["sm", "md", "lg", "xl"])
52
+ })),
53
+
54
+ /**
55
+ * Number of how many columns the content will be displayed
56
+ */
57
+ cols: PropTypes.number
58
+ } : void 0;
59
+ export default SimpleGrid;
60
+ //# 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,MAAMC,UAAU,GAAG,QAAgE;AAAA,MAA/D;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,WAAZ;AAAyBC,IAAAA,OAAO,GAAG,IAAnC;AAAyCC,IAAAA;AAAzC,GAA+D;AAAA,MAAbC,MAAa;;AACjF,QAAMC,OAAO,GAAGP,SAAS,CAAC;AAAEG,IAAAA,WAAF;AAAeE,IAAAA,IAAf;AAAqBD,IAAAA;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,2 @@
1
+ export { default } from "./SimpleGrid";
2
+ export * from "./SimpleGrid";
@@ -0,0 +1,2 @@
1
+ export { default } from "./SimpleGrid";
2
+ //# sourceMappingURL=index.js.map
@@ -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,68 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+
3
+ 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; }
4
+
5
+ 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; }
6
+
7
+ import "core-js/modules/web.dom-collections.iterator.js";
8
+ import { makeStyles } from "@material-ui/core";
9
+
10
+ function size(props) {
11
+ if (typeof props.size === "number") {
12
+ return props.size;
13
+ }
14
+
15
+ return props.sizes[props.size] || props.size || props.sizes.md;
16
+ }
17
+
18
+ function getSortedBreakpoints(theme, breakpoints) {
19
+ if (breakpoints.length === 0) {
20
+ return breakpoints;
21
+ }
22
+
23
+ const property = "maxWidth" in breakpoints[0] ? "maxWidth" : "minWidth";
24
+ const sorted = [...breakpoints].sort((a, b) => size({
25
+ size: b[property],
26
+ sizes: theme.breakpoints
27
+ }) - size({
28
+ size: a[property],
29
+ sizes: theme.breakpoints
30
+ }));
31
+ return property === "minWidth" ? sorted.reverse() : sorted;
32
+ }
33
+
34
+ const styles = props => makeStyles(theme => {
35
+ const {
36
+ breakpoints,
37
+ spacing,
38
+ cols
39
+ } = props;
40
+ let gridBreakpoints = null;
41
+
42
+ if (breakpoints) {
43
+ gridBreakpoints = getSortedBreakpoints(theme, breakpoints).reduce((acc, breakpoint) => {
44
+ const property = "maxWidth" in breakpoint ? "max-width" : "min-width";
45
+ const breakpointSize = size({
46
+ size: property === "max-width" ? breakpoint.maxWidth : breakpoint.minWidth,
47
+ sizes: theme.breakpoints
48
+ });
49
+ acc[`@media (${property}: ${breakpointSize + (property === "max-width" ? 0 : 1)}px)`] = {
50
+ gridTemplateColumns: `repeat(${breakpoint.cols}, minmax(0, 1fr))`,
51
+ gap: theme.hv.spacing[spacing]
52
+ };
53
+ return acc;
54
+ }, {});
55
+ }
56
+
57
+ return {
58
+ container: _objectSpread({
59
+ boxSizing: "border-box",
60
+ display: "grid",
61
+ gridTemplateColumns: `repeat(${cols}, minmax(0, 1fr))`,
62
+ gap: theme.hv.spacing[spacing]
63
+ }, gridBreakpoints)
64
+ };
65
+ });
66
+
67
+ export default styles;
68
+ //# 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,QAAME,QAAQ,GAAG,cAAcF,WAAW,CAAC,CAAD,CAAzB,GAA+B,UAA/B,GAA4C,UAA7D;AACA,QAAMG,MAAM,GAAG,CA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AEtFS,QAAAA,GAAG,EAAEpB,KAAK,CAACqB,EAAN,CAASX,OAAT,CAAiBA,OAAjB;AAFiF,OAAxF;AAKA,aAAOI,GAAP;AACD,KAbiB,EAaf,EAbe,CAAlB;AAcD;;AAED,SAAO;AACLQ,IAAAA,SAAS;AACPC,MAAAA,SAAS,EAAE,YADJ;AAEPC,MAAAA,OAAO,EAAE,MAFF;AAGPL,MAAAA,mBAAmB,EAAG,UAASR,IAAK,mBAH7B;AAIPS,MAAAA,GAAG,EAAEpB,KAAK,CAACqB,EAAN,CAASX,OAAT,CAAiBA,OAAjB;AAJE,OAKJE,eALI;AADJ,GAAP;AASD,CA7BS,CADZ;;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,75 @@
1
+ import "core-js/modules/web.dom-collections.iterator.js";
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
+ const PeriodPicker = props => {
10
+ const {
11
+ classes,
12
+ period,
13
+ onChangePeriod
14
+ } = props;
15
+ const [currentPeriod, setCurrentPeriod] = useState(period !== null && period !== void 0 ? period : PeriodPickerOptions.AM);
16
+ /**
17
+ * Gets the new value for the period
18
+ * @returns the new value for the period
19
+ * @memberof UnitTimePicker
20
+ */
21
+
22
+ const selectDifferentPeriod = () => {
23
+ return currentPeriod === PeriodPickerOptions.AM ? PeriodPickerOptions.PM : PeriodPickerOptions.AM;
24
+ };
25
+ /**
26
+ * Handles the period change
27
+ * @memberof PeriodPicker
28
+ */
29
+
30
+
31
+ const handleChangePeriod = () => {
32
+ const newPeriod = selectDifferentPeriod();
33
+ setCurrentPeriod(newPeriod);
34
+ onChangePeriod(newPeriod);
35
+ };
36
+ /**
37
+ * Renders the PeriodPicker
38
+ * @memberof UnitTimePicker
39
+ */
40
+
41
+
42
+ return /*#__PURE__*/React.createElement("div", {
43
+ className: classes.periodContainer
44
+ }, /*#__PURE__*/React.createElement(UpIcon, {
45
+ className: classes.icon,
46
+ onClick: handleChangePeriod
47
+ }), /*#__PURE__*/React.createElement(HvToggleButton, {
48
+ className: classes.periodToggle,
49
+ selected: currentPeriod === PeriodPickerOptions.PM,
50
+ onClick: handleChangePeriod
51
+ }, currentPeriod), /*#__PURE__*/React.createElement(DownIcon, {
52
+ className: clsx(classes.icon, classes.subtractIcon),
53
+ onClick: handleChangePeriod
54
+ }));
55
+ }; // }
56
+
57
+
58
+ process.env.NODE_ENV !== "production" ? PeriodPicker.propTypes = {
59
+ /**
60
+ * A Jss Object used to override or extend the styles applied to the input/popper
61
+ */
62
+ classes: PropTypes.instanceOf(Object).isRequired,
63
+
64
+ /**
65
+ * Callback function called when the period value changes
66
+ */
67
+ onChangePeriod: PropTypes.func.isRequired,
68
+
69
+ /**
70
+ * Default period value
71
+ */
72
+ period: PropTypes.oneOf([PeriodPickerOptions.AM, PeriodPickerOptions.PM])
73
+ } : void 0;
74
+ export default PeriodPicker;
75
+ //# sourceMappingURL=PeriodPicker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/TimePicker/PeriodPicker/PeriodPicker.js"],"names":["React","useState","PropTypes","clsx","DropUpXS","UpIcon","DropDownXS","DownIcon","HvToggleButton","PeriodPickerOptions","PeriodPicker","props","classes","period","onChangePeriod","currentPeriod","setCurrentPeriod","AM","selectDifferentPeriod","PM","handleChangePeriod","newPeriod","periodContainer","icon","periodToggle","subtractIcon","propTypes","instanceOf","Object","isRequired","func","oneOf"],"mappings":";AAAA,OAAOA,KAAP,IAAgBC,QAAhB,QAAgC,OAAhC;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,IAAP,MAAiB,MAAjB;AACA,SAASC,QAAQ,IAAIC,MAArB,EAA6BC,UAAU,IAAIC,QAA3C,QAA2D,mCAA3D;AACA,SAASC,cAAT,QAA+B,OAA/B;AACA,SAASC,mBAAT,QAAoC,UAApC;;AAEA,MAAMC,YAAY,GAAIC,KAAD,IAAW;AAC9B,QAAM;AAAEC,IAAAA,OAAF;AAAWC,IAAAA,MAAX;AAAmBC,IAAAA;AAAnB,MAAsCH,KAA5C;AACA,QAAM,CAACI,aAAD,EAAgBC,gBAAhB,IAAoCf,QAAQ,CAACY,MAAD,aAACA,MAAD,cAACA,MAAD,GAAWJ,mBAAmB,CA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AAmB,CAACU,EAA7C,CAAhB;AAZe,CAAzB;AAeA,eAAeT,YAAf","sourcesContent":["import React, { useState } from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\nimport { DropUpXS as UpIcon, DropDownXS as DownIcon } from \"@hitachivantara/uikit-react-icons\";\nimport { HvToggleButton } from \"../..\";\nimport { PeriodPickerOptions } from \"../enums\";\n\nconst PeriodPicker = (props) => {\n const { classes, period, onChangePeriod } = props;\n const [currentPeriod, setCurrentPeriod] = useState(period ?? PeriodPickerOptions.AM);\n\n /**\n * Gets the new value for the period\n * @returns the new value for the period\n * @memberof UnitTimePicker\n */\n const selectDifferentPeriod = () => {\n return currentPeriod === PeriodPickerOptions.AM\n ? PeriodPickerOptions.PM\n : PeriodPickerOptions.AM;\n };\n\n /**\n * Handles the period change\n * @memberof PeriodPicker\n */\n const handleChangePeriod = () => {\n const newPeriod = selectDifferentPeriod();\n setCurrentPeriod(newPeriod);\n onChangePeriod(newPeriod);\n };\n\n /**\n * Renders the PeriodPicker\n * @memberof UnitTimePicker\n */\n return (\n <div className={classes.periodContainer}>\n <UpIcon className={classes.icon} onClick={handleChangePeriod} />\n <HvToggleButton\n className={classes.periodToggle}\n selected={currentPeriod === PeriodPickerOptions.PM}\n onClick={handleChangePeriod}\n >\n {currentPeriod}\n </HvToggleButton>\n <DownIcon className={clsx(classes.icon, classes.subtractIcon)} onClick={handleChangePeriod} />\n </div>\n );\n};\n// }\n\nPeriodPicker.propTypes = {\n /**\n * A Jss Object used to override or extend the styles applied to the input/popper\n */\n classes: PropTypes.instanceOf(Object).isRequired,\n /**\n * Callback function called when the period value changes\n */\n onChangePeriod: PropTypes.func.isRequired,\n /**\n * Default period value\n */\n period: PropTypes.oneOf([PeriodPickerOptions.AM, PeriodPickerOptions.PM]),\n};\n\nexport default PeriodPicker;\n"],"file":"PeriodPicker.js"}
@@ -0,0 +1,7 @@
1
+ import withStyles from "@material-ui/core/styles/withStyles";
2
+ import styles from "./styles";
3
+ import PeriodPicker from "./PeriodPicker";
4
+ export default withStyles(styles, {
5
+ name: "HvTimePickerPeriodPicker"
6
+ })(PeriodPicker);
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/TimePicker/PeriodPicker/index.js"],"names":["withStyles","styles","PeriodPicker","name"],"mappings":"AAAA,OAAOA,UAAP,MAAuB,qCAAvB;AACA,OAAOC,MAAP,MAAmB,UAAnB;AACA,OAAOC,YAAP,MAAyB,gBAAzB;AAEA,eAAeF,UAAU,CAACC,MAAD,EAAS;AAAEE,EAAAA,IAAI,EAAE;AAAR,CAAT,CAAV,CAAyDD,YAAzD,CAAf","sourcesContent":["import withStyles from \"@material-ui/core/styles/withStyles\";\nimport styles from \"./styles\";\nimport PeriodPicker from \"./PeriodPicker\";\n\nexport default withStyles(styles, { name: \"HvTimePickerPeriodPicker\" })(PeriodPicker);\n"],"file":"index.js"}
@@ -0,0 +1,22 @@
1
+ const styles = theme => ({
2
+ periodContainer: {
3
+ display: "flex",
4
+ flexDirection: "column",
5
+ justifyContent: "center",
6
+ alignItems: "center",
7
+ marginLeft: 8
8
+ },
9
+ periodToggle: {
10
+ height: "40px",
11
+ width: "40px"
12
+ },
13
+ icon: {
14
+ cursor: "pointer"
15
+ },
16
+ subtractIcon: {
17
+ marginTop: `${theme.hv.spacing.xs}px`
18
+ }
19
+ });
20
+
21
+ export default styles;
22
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/TimePicker/PeriodPicker/styles.js"],"names":["styles","theme","periodContainer","display","flexDirection","justifyContent","alignItems","marginLeft","periodToggle","height","width","icon","cursor","subtractIcon","marginTop","hv","spacing","xs"],"mappings":"AAAA,MAAMA,MAAM,GAAIC,KAAD,KAAY;AACzBC,EAAAA,eAAe,EAAE;AACfC,IAAAA,OAAO,EAAE,MADM;AAEfC,IAAAA,aAAa,EAAE,QAFA;AAGfC,IAAAA,cAAc,EAAE,QAHD;AAIfC,IAAAA,UAAU,EAAE,QAJG;AAKfC,IAAAA,UAAU,EAAE;AALG,GADQ;AAQzBC,EAAAA,YAAY,EAAE;AACZC,IAAAA,MAAM,EAAE,MADI;AAEZC,IAAAA,KAAK,EAAE;AAFK,GARW;AAYzBC,EAAAA,IAAI,EAAE;AACJC,IAAAA,MAAM,EAAE;AADJ,GAZmB;AAezBC,EAAAA,YAAY,EAAE;AACZC,IAAAA,SAAS,EAAG,GAAEb,KAAK,CAACc,EAAN,CAASC,OAAT,CAAiBC,EAAG;AADtB;AAfW,CAAZ,CAAf;;AAoBA,eAAejB,MAAf","sourcesContent":["const styles = (theme) => ({\n periodContainer: {\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"center\",\n alignItems: \"center\",\n marginLeft: 8,\n },\n periodToggle: {\n height: \"40px\",\n width: \"40px\",\n },\n icon: {\n cursor: \"pointer\",\n },\n subtractIcon: {\n marginTop: `${theme.hv.spacing.xs}px`,\n },\n});\n\nexport default styles;\n"],"file":"styles.js"}
@@ -0,0 +1,140 @@
1
+ import { StandardProps } from "@material-ui/core";
2
+ import { HvFormElementProps, HvBaseDropdownProps } from "..";
3
+
4
+ export type HvTimePickerClassKey =
5
+ | "root"
6
+ | "input"
7
+ | "label"
8
+ | "timePopperContainer"
9
+ | "separator"
10
+ | "periodContainer"
11
+ | "formElementRoot"
12
+ | "dropdownPlaceholder"
13
+ | "iconBaseRoot"
14
+ | "error"
15
+ | "labelContainer"
16
+ | "description"
17
+ | "dropdownHeaderInvalid"
18
+ | "dropdownPlaceholderDisabled"
19
+ | "dropdownHeaderOpen";
20
+
21
+ export interface HvTimePickerValue {
22
+ hours: number;
23
+ minutes: number;
24
+ seconds: number;
25
+ period?: "AM" | "PM";
26
+ }
27
+ export interface HvTimePickerProps
28
+ extends StandardProps<
29
+ HvFormElementProps,
30
+ HvTimePickerClassKey,
31
+ "onChange" | "value" | "defaultValue" | "readOnly"
32
+ > {
33
+ /**
34
+ * Id to be applied to the form element root node.
35
+ */
36
+ id?: string;
37
+
38
+ /**
39
+ * Current value of the form element.
40
+ */
41
+ value?: HvTimePickerValue | null | undefined;
42
+ /**
43
+ * When uncontrolled, defines the initial value.
44
+ */
45
+ defaultValue?: HvTimePickerValue | null | undefined;
46
+
47
+ /**
48
+ * The placeholder value when no time is selected.
49
+ */
50
+ placeholder?: string;
51
+
52
+ /**
53
+ * The placeholder of the hours input.
54
+ */
55
+ hoursPlaceholder?: string;
56
+ /**
57
+ * The placeholder of the minutes input.
58
+ */
59
+ minutesPlaceholder?: string;
60
+ /**
61
+ * The placeholder of the seconds input.
62
+ */
63
+ secondsPlaceholder?: string;
64
+
65
+ /**
66
+ * If the time should be presented in 12 or 24 hour format.
67
+ * If undefined, the component will use a format according to the passed locale.
68
+ * If defined, it will "override" the default value given by the locale
69
+ */
70
+ timeFormat?: "12" | "24" | 12 | 24 | undefined;
71
+ /**
72
+ * Locale that will provide the time format(12 or 24 hour format)
73
+ * It is "overwritten" by the timeFormat prop
74
+ */
75
+ locale?: string;
76
+
77
+ /**
78
+ * Allow starting with an empty value by not defaulting to the current time.
79
+ * This should become the default behavior when the component is promoted to core.
80
+ */
81
+ disableDefaultValue?: boolean;
82
+
83
+ /**
84
+ * Default value for the hours picker
85
+ * @deprecated use defaultValue instead
86
+ */
87
+ hours?: number;
88
+ /**
89
+ * Default value for the minutes picker
90
+ * @deprecated use defaultValue instead
91
+ */
92
+ minutes?: number;
93
+ /**
94
+ * Default value for the seconds picker
95
+ * @deprecated use defaultValue instead
96
+ */
97
+ seconds?: number;
98
+ /**
99
+ * Default value for the period picker
100
+ * @deprecated use defaultValue instead
101
+ */
102
+ period?: "AM" | "PM";
103
+
104
+ /**
105
+ * Callback function to be triggered when the input value is changed.
106
+ * It is invoked with a object param with the following props:
107
+ * - hours (in a 24h format)
108
+ * - minutes
109
+ * - seconds
110
+ * - period
111
+ *
112
+ * It is always invoked with the hours in a 24h format
113
+ */
114
+ onChange?: (timeIn24Format: HvTimePickerValue) => void;
115
+
116
+ /**
117
+ * Callback called when dropdown changes the expanded state.
118
+ *
119
+ * @param {object} event The event source of the callback.
120
+ * @param {boolean} open If the dropdown new state is open (`true`) or closed (`false`).
121
+ */
122
+ onToggle?: (event: Event, open: boolean) => void;
123
+
124
+ /**
125
+ * Disable the portal behavior. The children stay within it's parent DOM hierarchy.
126
+ */
127
+ disablePortal?: boolean;
128
+
129
+ /**
130
+ * Sets if the calendar container should follow the date picker input out of the screen or stay visible.
131
+ */
132
+ escapeWithReference?: boolean;
133
+
134
+ /**
135
+ * Extra properties to be passed to the timepicker dropdown.
136
+ */
137
+ dropdownProps?: HvBaseDropdownProps;
138
+ }
139
+
140
+ export default function HvTimePicker(props: HvTimePickerProps): JSX.Element | null;