@mailstep/design-system 0.7.21 → 0.7.22-beta.1

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 (60) hide show
  1. package/package.json +1 -1
  2. package/ui/Blocks/CommonGrid/styles.js +1 -1
  3. package/ui/Blocks/Scheduler/Scheduler.d.ts +3 -0
  4. package/ui/Blocks/Scheduler/Scheduler.js +27 -0
  5. package/ui/Blocks/Scheduler/components/CurrentTimeMarker/hooks/useCurrentTime.d.ts +5 -0
  6. package/ui/Blocks/Scheduler/components/CurrentTimeMarker/hooks/useCurrentTime.js +17 -0
  7. package/ui/Blocks/Scheduler/components/CurrentTimeMarker/index.d.ts +2 -0
  8. package/ui/Blocks/Scheduler/components/CurrentTimeMarker/index.js +9 -0
  9. package/ui/Blocks/Scheduler/components/CurrentTimeMarker/styles.d.ts +5 -0
  10. package/ui/Blocks/Scheduler/components/CurrentTimeMarker/styles.js +13 -0
  11. package/ui/Blocks/Scheduler/components/DateChanger/index.d.ts +14 -0
  12. package/ui/Blocks/Scheduler/components/DateChanger/index.js +19 -0
  13. package/ui/Blocks/Scheduler/components/DateChanger/styles.d.ts +4 -0
  14. package/ui/Blocks/Scheduler/components/DateChanger/styles.js +11 -0
  15. package/ui/Blocks/Scheduler/components/Groups/index.d.ts +7 -0
  16. package/ui/Blocks/Scheduler/components/Groups/index.js +6 -0
  17. package/ui/Blocks/Scheduler/components/Groups/styles.d.ts +6 -0
  18. package/ui/Blocks/Scheduler/components/Groups/styles.js +16 -0
  19. package/ui/Blocks/Scheduler/components/TimeSlots/hooks/useRangeSelection.d.ts +12 -0
  20. package/ui/Blocks/Scheduler/components/TimeSlots/hooks/useRangeSelection.js +47 -0
  21. package/ui/Blocks/Scheduler/components/TimeSlots/hooks/useScroll.d.ts +6 -0
  22. package/ui/Blocks/Scheduler/components/TimeSlots/hooks/useScroll.js +16 -0
  23. package/ui/Blocks/Scheduler/components/TimeSlots/index.d.ts +13 -0
  24. package/ui/Blocks/Scheduler/components/TimeSlots/index.js +29 -0
  25. package/ui/Blocks/Scheduler/components/TimeSlots/styles.d.ts +14 -0
  26. package/ui/Blocks/Scheduler/components/TimeSlots/styles.js +33 -0
  27. package/ui/Blocks/Scheduler/hooks/useChangeDate.d.ts +15 -0
  28. package/ui/Blocks/Scheduler/hooks/useChangeDate.js +34 -0
  29. package/ui/Blocks/Scheduler/index.d.ts +2 -0
  30. package/ui/Blocks/Scheduler/index.js +1 -0
  31. package/ui/Blocks/Scheduler/stories/Scheduler.stories.d.ts +7 -0
  32. package/ui/Blocks/Scheduler/stories/Scheduler.stories.js +35 -0
  33. package/ui/Blocks/Scheduler/styles.d.ts +1 -0
  34. package/ui/Blocks/Scheduler/styles.js +7 -0
  35. package/ui/Blocks/Scheduler/types.d.ts +29 -0
  36. package/ui/Blocks/Scheduler/types.js +1 -0
  37. package/ui/Blocks/Scheduler/utils/constants.d.ts +6 -0
  38. package/ui/Blocks/Scheduler/utils/constants.js +6 -0
  39. package/ui/Blocks/Scheduler/utils/convertDateToTime.d.ts +1 -0
  40. package/ui/Blocks/Scheduler/utils/convertDateToTime.js +5 -0
  41. package/ui/Blocks/Scheduler/utils/convertIndexToISOString.d.ts +1 -0
  42. package/ui/Blocks/Scheduler/utils/convertIndexToISOString.js +9 -0
  43. package/ui/Blocks/Scheduler/utils/formatDate.d.ts +1 -0
  44. package/ui/Blocks/Scheduler/utils/formatDate.js +4 -0
  45. package/ui/Blocks/Scheduler/utils/generateTimeArray.d.ts +1 -0
  46. package/ui/Blocks/Scheduler/utils/generateTimeArray.js +16 -0
  47. package/ui/Blocks/Scheduler/utils/getClosestStep.d.ts +1 -0
  48. package/ui/Blocks/Scheduler/utils/getClosestStep.js +9 -0
  49. package/ui/Blocks/Scheduler/utils/getMinutesFromString.d.ts +1 -0
  50. package/ui/Blocks/Scheduler/utils/getMinutesFromString.js +3 -0
  51. package/ui/Blocks/Scheduler/utils/getMinutesFromTime.d.ts +1 -0
  52. package/ui/Blocks/Scheduler/utils/getMinutesFromTime.js +4 -0
  53. package/ui/Blocks/Scheduler/utils/isActiveTime.d.ts +8 -0
  54. package/ui/Blocks/Scheduler/utils/isActiveTime.js +10 -0
  55. package/ui/Blocks/Scheduler/utils/isToday.d.ts +1 -0
  56. package/ui/Blocks/Scheduler/utils/isToday.js +4 -0
  57. package/ui/index.d.ts +3 -1
  58. package/ui/index.es.js +25623 -21576
  59. package/ui/index.js +3 -1
  60. package/ui/index.umd.js +781 -629
@@ -0,0 +1,9 @@
1
+ import { stepInMinutes } from './constants';
2
+ export var convertIndexToISOString = function (index) {
3
+ var totalMinutes = stepInMinutes * index;
4
+ var hours = Math.floor(totalMinutes / 60);
5
+ var minutes = totalMinutes % 60;
6
+ var today = new Date();
7
+ today.setHours(hours, minutes, 0, 0);
8
+ return today.toISOString();
9
+ };
@@ -0,0 +1 @@
1
+ export declare const formatDate: (date: Date, locale?: string) => string;
@@ -0,0 +1,4 @@
1
+ export var formatDate = function (date, locale) {
2
+ if (locale === void 0) { locale = 'en-GB'; }
3
+ return date.toLocaleDateString(locale, { day: '2-digit', month: 'long', year: 'numeric' });
4
+ };
@@ -0,0 +1 @@
1
+ export declare const generateTimeArray: () => string[];
@@ -0,0 +1,16 @@
1
+ import { stepInMinutes } from './constants';
2
+ export var generateTimeArray = function () {
3
+ var times = [];
4
+ var hours = 0;
5
+ var minutes = 0;
6
+ while (hours < 24 || (hours === 24 && minutes === 0)) {
7
+ var time = "".concat(String(hours).padStart(2, '0'), ":").concat(String(minutes).padStart(2, '0'));
8
+ times.push(time);
9
+ minutes += stepInMinutes;
10
+ if (minutes === 60) {
11
+ minutes = 0;
12
+ hours += 1;
13
+ }
14
+ }
15
+ return times;
16
+ };
@@ -0,0 +1 @@
1
+ export declare const getClosestStep: (date: string) => string;
@@ -0,0 +1,9 @@
1
+ import { stepInMinutes } from './constants';
2
+ import { getMinutesFromString } from './getMinutesFromString';
3
+ export var getClosestStep = function (date) {
4
+ var totalMinutes = getMinutesFromString(date);
5
+ var closestStep = Math.round(totalMinutes / stepInMinutes) * stepInMinutes;
6
+ var hours = Math.floor(closestStep / 60);
7
+ var minutes = closestStep % 60;
8
+ return "".concat(String(hours).padStart(2, '0'), ":").concat(String(minutes).padStart(2, '0'));
9
+ };
@@ -0,0 +1 @@
1
+ export declare const getMinutesFromString: (date: string) => number;
@@ -0,0 +1,3 @@
1
+ import { convertDateToTime } from './convertDateToTime';
2
+ import { getMinutesFromTime } from './getMinutesFromTime';
3
+ export var getMinutesFromString = function (date) { return getMinutesFromTime(convertDateToTime(new Date(date))); };
@@ -0,0 +1 @@
1
+ export declare const getMinutesFromTime: (time: string) => number;
@@ -0,0 +1,4 @@
1
+ export var getMinutesFromTime = function (time) {
2
+ var _a = time.split(':').map(Number), hours = _a[0], minutes = _a[1];
3
+ return hours * 60 + minutes;
4
+ };
@@ -0,0 +1,8 @@
1
+ import { ActiveHours } from '../types';
2
+ type Props = {
3
+ activeHours?: ActiveHours;
4
+ time: string;
5
+ };
6
+ type FuncType = (props: Props) => boolean;
7
+ export declare const isActiveTime: FuncType;
8
+ export {};
@@ -0,0 +1,10 @@
1
+ import { getMinutesFromTime } from './getMinutesFromTime';
2
+ export var isActiveTime = function (_a) {
3
+ var activeHours = _a.activeHours, time = _a.time;
4
+ if (!activeHours)
5
+ return true;
6
+ var startMinutes = getMinutesFromTime(activeHours.start);
7
+ var endMinutes = getMinutesFromTime(activeHours.end);
8
+ var timeInMinutes = getMinutesFromTime(time);
9
+ return timeInMinutes >= startMinutes && timeInMinutes <= endMinutes;
10
+ };
@@ -0,0 +1 @@
1
+ export declare const isToday: (date: Date) => boolean;
@@ -0,0 +1,4 @@
1
+ export var isToday = function (date) {
2
+ var today = new Date();
3
+ return date.getDate() === today.getDate() && date.getMonth() === today.getMonth() && date.getFullYear() === today.getFullYear();
4
+ };
package/ui/index.d.ts CHANGED
@@ -6,6 +6,7 @@ import LightBox from './Blocks/LightBox';
6
6
  import LoginPage from './Blocks/LoginPage';
7
7
  import Modal from './Blocks/Modal';
8
8
  import Popover from './Blocks/Popover';
9
+ import Scheduler from './Blocks/Scheduler';
9
10
  import SideMenu from './Blocks/SideMenu';
10
11
  import Stepper from './Blocks/Stepper';
11
12
  import Tabs from './Blocks/Tabs';
@@ -44,10 +45,11 @@ import RadioButton from './Forms/RadioButton';
44
45
  import TextArea from './Forms/TextArea';
45
46
  import ThemeProvider from './ThemeProvider';
46
47
  import utils from './utils';
47
- export { DropdownSelect, DatePicker, CommonGrid, Popover, SingleSelect, MultiSelect, Select, Card, CornerDialog, ImageList, LightBox, Modal, Tabs, Alert, Avatar, Badge, BorderedBox, Button, Dropdown, ErrorMessage, Icon, Image, Label, Line, Link, Logo, Pagination, Portal, ProgressBar, SimpleLink, SpaceAround, Spinner, Tag, Toast, Toggle, Typography, Checkbox, Input, RadioButton, ThemeProvider, utils, TextArea, LoginPage, LanguageSwitch, SideMenu, Stepper };
48
+ export { DropdownSelect, DatePicker, CommonGrid, Popover, SingleSelect, MultiSelect, Select, Card, CornerDialog, ImageList, LightBox, Modal, Tabs, Alert, Avatar, Badge, BorderedBox, Button, Dropdown, ErrorMessage, Icon, Image, Label, Line, Link, Logo, Pagination, Portal, ProgressBar, SimpleLink, SpaceAround, Spinner, Tag, Toast, Toggle, Typography, Checkbox, Input, RadioButton, ThemeProvider, utils, TextArea, LoginPage, LanguageSwitch, SideMenu, Stepper, Scheduler };
48
49
  export * from './Blocks/CornerDialog';
49
50
  export * from './Blocks/ImageList';
50
51
  export * from './Blocks/LightBox';
52
+ export * from './Blocks/Scheduler';
51
53
  export * from './Blocks/Modal';
52
54
  export * from './Blocks/Tabs';
53
55
  export * from './Elements/Alert';