mautourco-components 0.2.5 → 0.2.7
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/README.md +190 -190
- package/dist/components/atoms/Avatar/Avatar.d.ts +14 -14
- package/dist/components/atoms/Avatar/Avatar.js +31 -31
- package/dist/components/atoms/Button/Button.css +320 -320
- package/dist/components/atoms/Button/Button.d.ts +27 -27
- package/dist/components/atoms/Button/Button.js +35 -35
- package/dist/components/atoms/Checkbox/Checkbox.d.ts +13 -13
- package/dist/components/atoms/Checkbox/Checkbox.js +39 -39
- package/dist/components/atoms/Icon/Icon.d.ts +10 -10
- package/dist/components/atoms/Icon/Icon.js +123 -123
- package/dist/components/atoms/Icon/icons/ArrivalIcon.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/ArrivalIcon.js +31 -31
- package/dist/components/atoms/Icon/icons/BuildingIcon.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/BuildingIcon.js +36 -36
- package/dist/components/atoms/Icon/icons/CalendarIcon.d.ts +12 -12
- package/dist/components/atoms/Icon/icons/CalendarIcon.js +41 -41
- package/dist/components/atoms/Icon/icons/CalendarOutlineIcon.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/CalendarOutlineIcon.js +36 -36
- package/dist/components/atoms/Icon/icons/CarIcon.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/CarIcon.js +30 -30
- package/dist/components/atoms/Icon/icons/Check.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/Check.js +30 -30
- package/dist/components/atoms/Icon/icons/CheckCircleIcon.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/CheckCircleIcon.js +30 -30
- package/dist/components/atoms/Icon/icons/Chevron.d.ts +9 -9
- package/dist/components/atoms/Icon/icons/Chevron.js +54 -54
- package/dist/components/atoms/Icon/icons/ChevronDownIcon.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/ChevronDownIcon.js +30 -30
- package/dist/components/atoms/Icon/icons/Close.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/Close.js +30 -30
- package/dist/components/atoms/Icon/icons/DeleteIcon.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/DeleteIcon.js +30 -30
- package/dist/components/atoms/Icon/icons/DepartureIcon.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/DepartureIcon.js +30 -30
- package/dist/components/atoms/Icon/icons/EyeIcon.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/EyeIcon.js +30 -30
- package/dist/components/atoms/Icon/icons/FacebookIcon.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/FacebookIcon.js +36 -36
- package/dist/components/atoms/Icon/icons/HomeIcon.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/HomeIcon.js +25 -25
- package/dist/components/atoms/Icon/icons/InfoIcon.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/InfoIcon.js +30 -30
- package/dist/components/atoms/Icon/icons/LinkedInIcon.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/LinkedInIcon.js +36 -36
- package/dist/components/atoms/Icon/icons/MapPinIcon.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/MapPinIcon.js +30 -30
- package/dist/components/atoms/Icon/icons/MautoucoLogo.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/MautoucoLogo.js +37 -37
- package/dist/components/atoms/Icon/icons/MenuIcon.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/MenuIcon.js +37 -37
- package/dist/components/atoms/Icon/icons/MinusIcon.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/MinusIcon.js +25 -25
- package/dist/components/atoms/Icon/icons/MoreIcon.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/MoreIcon.js +30 -30
- package/dist/components/atoms/Icon/icons/PlaneIcon.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/PlaneIcon.js +36 -36
- package/dist/components/atoms/Icon/icons/PlusIcon.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/PlusIcon.js +25 -25
- package/dist/components/atoms/Icon/icons/Search.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/Search.js +30 -30
- package/dist/components/atoms/Icon/icons/Settings.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/Settings.js +30 -30
- package/dist/components/atoms/Icon/icons/ShipIcon.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/ShipIcon.js +36 -36
- package/dist/components/atoms/Icon/icons/StrollerIcon.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/StrollerIcon.js +30 -30
- package/dist/components/atoms/Icon/icons/TwitterIcon.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/TwitterIcon.js +36 -36
- package/dist/components/atoms/Icon/icons/User.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/User.js +30 -30
- package/dist/components/atoms/Icon/icons/UserIcon.d.ts +12 -12
- package/dist/components/atoms/Icon/icons/UserIcon.js +41 -41
- package/dist/components/atoms/Icon/icons/Youtube.d.ts +8 -8
- package/dist/components/atoms/Icon/icons/Youtube.js +36 -36
- package/dist/components/atoms/Illustration/Illustration.d.ts +14 -14
- package/dist/components/atoms/Illustration/Illustration.js +33 -33
- package/dist/components/atoms/Illustration/illustrations.d.ts +51 -51
- package/dist/components/atoms/Illustration/illustrations.js +97 -97
- package/dist/components/atoms/Inputs/DropdownInput/DropdownInput.d.ts +12 -12
- package/dist/components/atoms/Inputs/DropdownInput/DropdownInput.js +53 -53
- package/dist/components/atoms/Inputs/Input/Input.d.ts +15 -15
- package/dist/components/atoms/Inputs/Input/Input.js +27 -27
- package/dist/components/atoms/Inputs/Textarea/Textarea.d.ts +14 -14
- package/dist/components/atoms/Inputs/Textarea/Textarea.js +15 -15
- package/dist/components/atoms/Link/Link.d.ts +44 -44
- package/dist/components/atoms/Link/Link.js +76 -76
- package/dist/components/atoms/RatingStar/RatingStar.d.ts +40 -40
- package/dist/components/atoms/RatingStar/RatingStar.js +54 -54
- package/dist/components/atoms/SegmentedButton/SegmentedButton.d.ts +27 -27
- package/dist/components/atoms/SegmentedButton/SegmentedButton.js +49 -49
- package/dist/components/atoms/SelectedValue/SelectedValue.d.ts +11 -11
- package/dist/components/atoms/SelectedValue/SelectedValue.js +29 -29
- package/dist/components/atoms/Slider/Slider.d.ts +52 -52
- package/dist/components/atoms/Slider/Slider.js +30 -30
- package/dist/components/atoms/Spinner/Spinner.d.ts +9 -9
- package/dist/components/atoms/Spinner/Spinner.js +38 -38
- package/dist/components/atoms/Spinner/variants/ButtonSpinner.d.ts +8 -8
- package/dist/components/atoms/Spinner/variants/ButtonSpinner.js +19 -19
- package/dist/components/atoms/Spinner/variants/LoadingSpinner.d.ts +7 -7
- package/dist/components/atoms/Spinner/variants/LoadingSpinner.js +7 -7
- package/dist/components/atoms/Tab/Tab.css +266 -266
- package/dist/components/atoms/Tab/Tab.d.ts +22 -22
- package/dist/components/atoms/Tab/Tab.js +54 -54
- package/dist/components/atoms/Typography/Typography.d.ts +24 -24
- package/dist/components/atoms/Typography/Typography.js +100 -100
- package/dist/components/molecules/Calendar/CalendarInput.d.ts +34 -34
- package/dist/components/molecules/Calendar/CalendarInput.js +49 -49
- package/dist/components/molecules/Calendar/DateTime.d.ts +25 -25
- package/dist/components/molecules/Calendar/DateTime.js +106 -106
- package/dist/components/molecules/Calendar/TimePicker.d.ts +16 -16
- package/dist/components/molecules/Calendar/TimePicker.js +91 -91
- package/dist/components/molecules/LocationDropdown/LocationDropdown.d.ts +34 -34
- package/dist/components/molecules/LocationDropdown/LocationDropdown.js +120 -120
- package/dist/components/molecules/LocationDropdown/index.d.ts +2 -2
- package/dist/components/molecules/LocationDropdown/index.js +1 -1
- package/dist/components/molecules/MultiSelectDropdown/MultiSelectDropdown.d.ts +29 -29
- package/dist/components/molecules/MultiSelectDropdown/MultiSelectDropdown.js +106 -106
- package/dist/components/molecules/RatingTab/RatingTab.d.ts +39 -39
- package/dist/components/molecules/RatingTab/RatingTab.js +41 -41
- package/dist/components/molecules/TabGroup/TabGroup.d.ts +17 -17
- package/dist/components/molecules/TabGroup/TabGroup.js +30 -30
- package/dist/components/molecules/UserCard/UserCard.d.ts +20 -20
- package/dist/components/molecules/UserCard/UserCard.js +57 -57
- package/dist/components/organisms/CardContainer/CardContainer.d.ts +37 -37
- package/dist/components/organisms/CardContainer/CardContainer.js +27 -27
- package/dist/components/organisms/DateTimePicker/DateTimePicker.d.ts +15 -15
- package/dist/components/organisms/DateTimePicker/DateTimePicker.js +66 -66
- package/dist/components/organisms/Dialog/Dialog.d.ts +103 -103
- package/dist/components/organisms/Dialog/Dialog.js +162 -162
- package/dist/components/organisms/Footer/Footer.d.ts +38 -38
- package/dist/components/organisms/Footer/Footer.js +74 -74
- package/dist/components/organisms/PaxSelector/PaxSelector.d.ts +63 -63
- package/dist/components/organisms/PaxSelector/PaxSelector.js +402 -402
- package/dist/components/organisms/RoundTrip/RoundTrip.d.ts +54 -54
- package/dist/components/organisms/RoundTrip/RoundTrip.js +179 -179
- package/dist/components/organisms/RoundTrip/index.d.ts +2 -2
- package/dist/components/organisms/RoundTrip/index.js +1 -1
- package/dist/components/organisms/SearchBarTransfer/SearchBarTransfer.d.ts +35 -35
- package/dist/components/organisms/SearchBarTransfer/SearchBarTransfer.js +192 -192
- package/dist/components/organisms/SearchBarTransfer/index.d.ts +2 -2
- package/dist/components/organisms/SearchBarTransfer/index.js +1 -1
- package/dist/components/organisms/TopNavigation/DesktopNav.d.ts +33 -33
- package/dist/components/organisms/TopNavigation/DesktopNav.js +32 -32
- package/dist/components/organisms/TopNavigation/MobileNav.d.ts +32 -32
- package/dist/components/organisms/TopNavigation/MobileNav.js +45 -45
- package/dist/components/organisms/TopNavigation/TopNavigation.d.ts +33 -33
- package/dist/components/organisms/TopNavigation/TopNavigation.js +20 -20
- package/dist/components/organisms/TransferLine/TransferLine.d.ts +53 -53
- package/dist/components/organisms/TransferLine/TransferLine.js +179 -179
- package/dist/components/ui/button.d.ts +10 -10
- package/dist/components/ui/button.js +56 -56
- package/dist/components/ui/calendar.d.ts +8 -8
- package/dist/components/ui/calendar.js +87 -87
- package/dist/components/ui/popover.d.ts +7 -7
- package/dist/components/ui/popover.js +42 -42
- package/dist/hooks/useMobile.d.ts +5 -5
- package/dist/hooks/useMobile.js +26 -26
- package/dist/index.d.ts +49 -49
- package/dist/index.js +46 -46
- package/dist/lib/utils.d.ts +7 -7
- package/dist/lib/utils.js +13 -13
- package/dist/styles/components/avatar.css +122 -122
- package/dist/styles/components/calendar.css +140 -140
- package/dist/styles/components/checkbox.css +206 -206
- package/dist/styles/components/dropdown.css +269 -269
- package/dist/styles/components/forms.css +209 -209
- package/dist/styles/components/illustration.css +123 -123
- package/dist/styles/components/molecule/calendarInput.css +133 -133
- package/dist/styles/components/molecule/dateTime.css +126 -126
- package/dist/styles/components/molecule/location-dropdown.css +132 -132
- package/dist/styles/components/molecule/timePicker.css +122 -122
- package/dist/styles/components/multiselect-dropdown.css +286 -286
- package/dist/styles/components/organism/card-container.css +148 -148
- package/dist/styles/components/organism/dialog.css +168 -168
- package/dist/styles/components/organism/footer.css +119 -119
- package/dist/styles/components/organism/pax-selector.css +617 -617
- package/dist/styles/components/organism/round-trip.css +139 -139
- package/dist/styles/components/organism/search-bar-transfer.css +158 -161
- package/dist/styles/components/organism/topnavigation.css +142 -142
- package/dist/styles/components/organism/transfer-line.css +138 -138
- package/dist/styles/components/rating-star.css +145 -145
- package/dist/styles/components/rating-tab.css +179 -179
- package/dist/styles/components/scrollbar.css +155 -155
- package/dist/styles/components/segmented-button.css +214 -214
- package/dist/styles/components/selected-value.css +175 -175
- package/dist/styles/components/slider.css +182 -182
- package/dist/styles/components/typography.css +245 -245
- package/dist/styles/tokens/tokens.css +119 -119
- package/dist/styles/tokens/tokens.d.ts +3108 -3108
- package/dist/styles/tokens/tokens.js +2652 -2652
- package/package.json +103 -103
- package/src/components/atoms/Avatar/Avatar.tsx +60 -60
- package/src/components/atoms/Button/Button.css +200 -200
- package/src/components/atoms/Button/Button.tsx +82 -82
- package/src/components/atoms/Checkbox/Checkbox.tsx +83 -83
- package/src/components/atoms/Icon/Icon.tsx +163 -163
- package/src/components/atoms/Icon/icons/ArrivalIcon.tsx +52 -52
- package/src/components/atoms/Icon/icons/BuildingIcon.tsx +50 -50
- package/src/components/atoms/Icon/icons/CalendarIcon.tsx +63 -63
- package/src/components/atoms/Icon/icons/CalendarOutlineIcon.tsx +50 -50
- package/src/components/atoms/Icon/icons/CarIcon.tsx +44 -44
- package/src/components/atoms/Icon/icons/Check.tsx +36 -36
- package/src/components/atoms/Icon/icons/CheckCircleIcon.tsx +48 -48
- package/src/components/atoms/Icon/icons/Chevron.tsx +73 -73
- package/src/components/atoms/Icon/icons/ChevronDownIcon.tsx +46 -46
- package/src/components/atoms/Icon/icons/Close.tsx +39 -39
- package/src/components/atoms/Icon/icons/DeleteIcon.tsx +44 -44
- package/src/components/atoms/Icon/icons/DepartureIcon.tsx +50 -50
- package/src/components/atoms/Icon/icons/EyeIcon.tsx +44 -44
- package/src/components/atoms/Icon/icons/FacebookIcon.tsx +50 -50
- package/src/components/atoms/Icon/icons/HomeIcon.tsx +52 -52
- package/src/components/atoms/Icon/icons/InfoIcon.tsx +44 -44
- package/src/components/atoms/Icon/icons/LinkedInIcon.tsx +50 -50
- package/src/components/atoms/Icon/icons/MapPinIcon.tsx +44 -44
- package/src/components/atoms/Icon/icons/MautoucoLogo.tsx +93 -93
- package/src/components/atoms/Icon/icons/MenuIcon.tsx +49 -49
- package/src/components/atoms/Icon/icons/MinusIcon.tsx +45 -45
- package/src/components/atoms/Icon/icons/MoreIcon.tsx +44 -44
- package/src/components/atoms/Icon/icons/PlaneIcon.tsx +50 -50
- package/src/components/atoms/Icon/icons/PlusIcon.tsx +45 -45
- package/src/components/atoms/Icon/icons/Search.tsx +37 -37
- package/src/components/atoms/Icon/icons/Settings.tsx +38 -38
- package/src/components/atoms/Icon/icons/ShipIcon.tsx +50 -50
- package/src/components/atoms/Icon/icons/StrollerIcon.tsx +44 -44
- package/src/components/atoms/Icon/icons/TwitterIcon.tsx +50 -50
- package/src/components/atoms/Icon/icons/User.tsx +37 -37
- package/src/components/atoms/Icon/icons/UserIcon.tsx +63 -63
- package/src/components/atoms/Icon/icons/Youtube.tsx +50 -50
- package/src/components/atoms/Illustration/Illustration.tsx +28 -28
- package/src/components/atoms/Illustration/illustrations.ts +116 -116
- package/src/components/atoms/Inputs/DropdownInput/DropdownInput.tsx +96 -96
- package/src/components/atoms/Inputs/Textarea/Textarea.tsx +51 -51
- package/src/components/atoms/Link/Link.tsx +168 -168
- package/src/components/atoms/RatingStar/RatingStar.tsx +114 -114
- package/src/components/atoms/SegmentedButton/SegmentedButton.tsx +94 -94
- package/src/components/atoms/SelectedValue/SelectedValue.tsx +59 -59
- package/src/components/atoms/Slider/Slider.tsx +95 -95
- package/src/components/atoms/Spinner/Spinner.tsx +56 -56
- package/src/components/atoms/Spinner/variants/ButtonSpinner.tsx +37 -37
- package/src/components/atoms/Spinner/variants/LoadingSpinner.tsx +22 -22
- package/src/components/atoms/Tab/Tab.css +147 -147
- package/src/components/atoms/Tab/Tab.tsx +96 -96
- package/src/components/atoms/Typography/Typography.tsx +153 -153
- package/src/components/molecules/Calendar/CalendarInput.tsx +135 -135
- package/src/components/molecules/Calendar/DateTime.tsx +172 -172
- package/src/components/molecules/Calendar/TimePicker.tsx +174 -174
- package/src/components/molecules/LocationDropdown/LocationDropdown.tsx +234 -234
- package/src/components/molecules/LocationDropdown/index.ts +2 -2
- package/src/components/molecules/RatingTab/RatingTab.tsx +96 -96
- package/src/components/molecules/TabGroup/TabGroup.tsx +60 -60
- package/src/components/molecules/UserCard/UserCard.stories.tsx +36 -36
- package/src/components/molecules/UserCard/UserCard.tsx +173 -173
- package/src/components/organisms/CardContainer/CardContainer.tsx +66 -66
- package/src/components/organisms/DateTimePicker/DateTimePicker.tsx +110 -110
- package/src/components/organisms/Dialog/Dialog.tsx +352 -352
- package/src/components/organisms/Footer/Footer.tsx +290 -290
- package/src/components/organisms/PaxSelector/PaxSelector.tsx +979 -979
- package/src/components/organisms/RoundTrip/RoundTrip.tsx +335 -335
- package/src/components/organisms/RoundTrip/index.ts +2 -2
- package/src/components/organisms/SearchBarTransfer/SearchBarTransfer.tsx +388 -388
- package/src/components/organisms/SearchBarTransfer/index.ts +2 -2
- package/src/components/organisms/TopNavigation/DesktopNav.tsx +133 -133
- package/src/components/organisms/TopNavigation/MobileNav.tsx +212 -212
- package/src/components/organisms/TopNavigation/TopNavigation.tsx +45 -45
- package/src/components/organisms/TransferLine/TransferLine.tsx +369 -369
- package/src/components/ui/button.tsx +60 -60
- package/src/components/ui/calendar.tsx +246 -246
- package/src/components/ui/popover.tsx +46 -46
- package/src/styles/components/avatar.css +58 -58
- package/src/styles/components/calendar.css +85 -85
- package/src/styles/components/checkbox.css +130 -130
- package/src/styles/components/dropdown.css +214 -214
- package/src/styles/components/forms.css +147 -147
- package/src/styles/components/illustration.css +7 -7
- package/src/styles/components/molecule/calendarInput.css +156 -156
- package/src/styles/components/molecule/dateTime.css +14 -14
- package/src/styles/components/molecule/location-dropdown.css +204 -204
- package/src/styles/components/molecule/timePicker.css +78 -78
- package/src/styles/components/multiselect-dropdown.css +230 -230
- package/src/styles/components/organism/card-container.css +49 -49
- package/src/styles/components/organism/dialog.css +241 -241
- package/src/styles/components/organism/footer.css +113 -113
- package/src/styles/components/organism/pax-selector.css +702 -702
- package/src/styles/components/organism/round-trip.css +55 -55
- package/src/styles/components/organism/search-bar-transfer.css +128 -127
- package/src/styles/components/organism/topnavigation.css +161 -161
- package/src/styles/components/organism/transfer-line.css +86 -86
- package/src/styles/components/rating-star.css +39 -39
- package/src/styles/components/rating-tab.css +83 -83
- package/src/styles/components/scrollbar.css +63 -63
- package/src/styles/components/segmented-button.css +134 -134
- package/src/styles/components/selected-value.css +80 -80
- package/src/styles/components/slider.css +86 -86
- package/src/styles/components/typography.css +251 -251
- package/src/styles/fonts.css +50 -0
- package/src/styles/tokens/tokens.css +119 -119
- package/src/styles/tokens/tokens.js +12 -6
|
@@ -1,106 +1,106 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { useState, useEffect } from "react";
|
|
14
|
-
import { Calendar } from "../../ui/calendar";
|
|
15
|
-
import { Button } from "../../ui/button";
|
|
16
|
-
import TimePicker from "./TimePicker";
|
|
17
|
-
import Icon from "../../atoms/Icon/Icon";
|
|
18
|
-
var DateTime = function (_a) {
|
|
19
|
-
var _b, _c, _d;
|
|
20
|
-
var _e = _a.mode, mode = _e === void 0 ? "both" : _e, _f = _a.selectionMode, selectionMode = _f === void 0 ? "range" : _f, _g = _a.numberOfMonths, numberOfMonths = _g === void 0 ? 2 : _g, _h = _a.disableBeforeToday, disableBeforeToday = _h === void 0 ? true : _h, _j = _a.disableToday, disableToday = _j === void 0 ? false : _j, defaultDateRange = _a.defaultDateRange, defaultTime = _a.defaultTime, onChange = _a.onChange;
|
|
21
|
-
var _k = useState(defaultDateRange), dateRange = _k[0], setDateRange = _k[1];
|
|
22
|
-
var _l = useState((_b = defaultTime === null || defaultTime === void 0 ? void 0 : defaultTime.hour) !== null && _b !== void 0 ? _b : "12"), hours = _l[0], setHours = _l[1];
|
|
23
|
-
var _m = useState((_c = defaultTime === null || defaultTime === void 0 ? void 0 : defaultTime.minute) !== null && _c !== void 0 ? _c : "00"), minutes = _m[0], setMinutes = _m[1];
|
|
24
|
-
var _o = useState((_d = defaultTime === null || defaultTime === void 0 ? void 0 : defaultTime.meridiem) !== null && _d !== void 0 ? _d : "AM"), amPm = _o[0], setAmPm = _o[1];
|
|
25
|
-
// notify parent when date or time changes
|
|
26
|
-
useEffect(function () {
|
|
27
|
-
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
28
|
-
dateRange: dateRange !== null && dateRange !== void 0 ? dateRange : undefined,
|
|
29
|
-
time: mode === "calendar" ? undefined : { hour: hours, minute: minutes, meridiem: amPm },
|
|
30
|
-
});
|
|
31
|
-
}, [dateRange, hours, minutes, amPm, onChange, mode]);
|
|
32
|
-
var handleSelect = function (val) {
|
|
33
|
-
if (!val) {
|
|
34
|
-
setDateRange(undefined);
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
if (val instanceof Date) {
|
|
38
|
-
setDateRange({ from: val, to: val });
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
if (Array.isArray(val)) {
|
|
42
|
-
var sorted = val.slice().sort(function (a, b) { return +a - +b; });
|
|
43
|
-
setDateRange({ from: sorted[0], to: sorted[sorted.length - 1] });
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
setDateRange(val);
|
|
47
|
-
};
|
|
48
|
-
var resetTime = function () {
|
|
49
|
-
setHours("12");
|
|
50
|
-
setMinutes("00");
|
|
51
|
-
setAmPm("AM");
|
|
52
|
-
};
|
|
53
|
-
var clearSelection = function () {
|
|
54
|
-
setDateRange(undefined);
|
|
55
|
-
resetTime();
|
|
56
|
-
};
|
|
57
|
-
var selectToday = function () {
|
|
58
|
-
var today = new Date();
|
|
59
|
-
today.setHours(0, 0, 0, 0);
|
|
60
|
-
setDateRange({ from: today, to: today });
|
|
61
|
-
};
|
|
62
|
-
var calendarMode = selectionMode === "single" ? "single" : "range";
|
|
63
|
-
var buildDisabled = function () {
|
|
64
|
-
var disabled = [];
|
|
65
|
-
if (disableBeforeToday) {
|
|
66
|
-
var today = new Date();
|
|
67
|
-
today.setHours(0, 0, 0, 0);
|
|
68
|
-
disabled.push({ before: today });
|
|
69
|
-
}
|
|
70
|
-
if (disableToday) {
|
|
71
|
-
var today = new Date();
|
|
72
|
-
today.setHours(0, 0, 0, 0);
|
|
73
|
-
disabled.push(today);
|
|
74
|
-
}
|
|
75
|
-
return disabled.length ? disabled : undefined;
|
|
76
|
-
};
|
|
77
|
-
var disabledDays = buildDisabled();
|
|
78
|
-
return (_jsxs("div", __assign({ className: "calendar--dropdown" }, { children: [mode !== "time" && (function () {
|
|
79
|
-
var calendarProps = {
|
|
80
|
-
mode: calendarMode,
|
|
81
|
-
selected: dateRange,
|
|
82
|
-
onSelect: handleSelect,
|
|
83
|
-
weekStartsOn: 1,
|
|
84
|
-
showOutsideDays: false,
|
|
85
|
-
numberOfMonths: numberOfMonths,
|
|
86
|
-
disabled: disabledDays,
|
|
87
|
-
className: "p-0",
|
|
88
|
-
formatters: {
|
|
89
|
-
formatWeekdayName: function (weekday, options) {
|
|
90
|
-
var _a;
|
|
91
|
-
return weekday
|
|
92
|
-
.toLocaleDateString((_a = options === null || options === void 0 ? void 0 : options.locale) === null || _a === void 0 ? void 0 : _a.code, { weekday: "short" })
|
|
93
|
-
.toUpperCase();
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
};
|
|
97
|
-
return _jsx(Calendar, __assign({}, calendarProps));
|
|
98
|
-
})(), mode !== "calendar" && (_jsx("div", __assign({ className: "".concat(mode === "both" ? "calendar--time_container_separated" : "") }, { children: _jsx(TimePicker, { label: "Time", hour: hours, minute: minutes, meridiem: amPm, onChange: function (h, m, mm) {
|
|
99
|
-
var hh = String(Math.max(0, Math.min(12, Number(h || 0)))).padStart(2, "0");
|
|
100
|
-
var mmn = String(Math.max(0, Math.min(59, Number(m || 0)))).padStart(2, "0");
|
|
101
|
-
setHours(hh);
|
|
102
|
-
setMinutes(mmn);
|
|
103
|
-
setAmPm(mm);
|
|
104
|
-
} }) }))), mode !== "time" && (_jsxs("div", __assign({ className: "calendar--footer" }, { children: [_jsxs(Button, __assign({ variant: "ghost", size: "sm", onClick: selectToday, type: "button", className: "calendar--footer--button", disabled: disableToday }, { children: [_jsx(Icon, { name: "calendar-outline", size: "sm" }), "Today"] })), _jsx(Button, __assign({ variant: "ghost", size: "sm", onClick: clearSelection, type: "button", className: "calendar--footer--button" }, { children: "Clear" }))] })))] })));
|
|
105
|
-
};
|
|
106
|
-
export default DateTime;
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { useState, useEffect } from "react";
|
|
14
|
+
import { Calendar } from "../../ui/calendar";
|
|
15
|
+
import { Button } from "../../ui/button";
|
|
16
|
+
import TimePicker from "./TimePicker";
|
|
17
|
+
import Icon from "../../atoms/Icon/Icon";
|
|
18
|
+
var DateTime = function (_a) {
|
|
19
|
+
var _b, _c, _d;
|
|
20
|
+
var _e = _a.mode, mode = _e === void 0 ? "both" : _e, _f = _a.selectionMode, selectionMode = _f === void 0 ? "range" : _f, _g = _a.numberOfMonths, numberOfMonths = _g === void 0 ? 2 : _g, _h = _a.disableBeforeToday, disableBeforeToday = _h === void 0 ? true : _h, _j = _a.disableToday, disableToday = _j === void 0 ? false : _j, defaultDateRange = _a.defaultDateRange, defaultTime = _a.defaultTime, onChange = _a.onChange;
|
|
21
|
+
var _k = useState(defaultDateRange), dateRange = _k[0], setDateRange = _k[1];
|
|
22
|
+
var _l = useState((_b = defaultTime === null || defaultTime === void 0 ? void 0 : defaultTime.hour) !== null && _b !== void 0 ? _b : "12"), hours = _l[0], setHours = _l[1];
|
|
23
|
+
var _m = useState((_c = defaultTime === null || defaultTime === void 0 ? void 0 : defaultTime.minute) !== null && _c !== void 0 ? _c : "00"), minutes = _m[0], setMinutes = _m[1];
|
|
24
|
+
var _o = useState((_d = defaultTime === null || defaultTime === void 0 ? void 0 : defaultTime.meridiem) !== null && _d !== void 0 ? _d : "AM"), amPm = _o[0], setAmPm = _o[1];
|
|
25
|
+
// notify parent when date or time changes
|
|
26
|
+
useEffect(function () {
|
|
27
|
+
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
28
|
+
dateRange: dateRange !== null && dateRange !== void 0 ? dateRange : undefined,
|
|
29
|
+
time: mode === "calendar" ? undefined : { hour: hours, minute: minutes, meridiem: amPm },
|
|
30
|
+
});
|
|
31
|
+
}, [dateRange, hours, minutes, amPm, onChange, mode]);
|
|
32
|
+
var handleSelect = function (val) {
|
|
33
|
+
if (!val) {
|
|
34
|
+
setDateRange(undefined);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (val instanceof Date) {
|
|
38
|
+
setDateRange({ from: val, to: val });
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (Array.isArray(val)) {
|
|
42
|
+
var sorted = val.slice().sort(function (a, b) { return +a - +b; });
|
|
43
|
+
setDateRange({ from: sorted[0], to: sorted[sorted.length - 1] });
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
setDateRange(val);
|
|
47
|
+
};
|
|
48
|
+
var resetTime = function () {
|
|
49
|
+
setHours("12");
|
|
50
|
+
setMinutes("00");
|
|
51
|
+
setAmPm("AM");
|
|
52
|
+
};
|
|
53
|
+
var clearSelection = function () {
|
|
54
|
+
setDateRange(undefined);
|
|
55
|
+
resetTime();
|
|
56
|
+
};
|
|
57
|
+
var selectToday = function () {
|
|
58
|
+
var today = new Date();
|
|
59
|
+
today.setHours(0, 0, 0, 0);
|
|
60
|
+
setDateRange({ from: today, to: today });
|
|
61
|
+
};
|
|
62
|
+
var calendarMode = selectionMode === "single" ? "single" : "range";
|
|
63
|
+
var buildDisabled = function () {
|
|
64
|
+
var disabled = [];
|
|
65
|
+
if (disableBeforeToday) {
|
|
66
|
+
var today = new Date();
|
|
67
|
+
today.setHours(0, 0, 0, 0);
|
|
68
|
+
disabled.push({ before: today });
|
|
69
|
+
}
|
|
70
|
+
if (disableToday) {
|
|
71
|
+
var today = new Date();
|
|
72
|
+
today.setHours(0, 0, 0, 0);
|
|
73
|
+
disabled.push(today);
|
|
74
|
+
}
|
|
75
|
+
return disabled.length ? disabled : undefined;
|
|
76
|
+
};
|
|
77
|
+
var disabledDays = buildDisabled();
|
|
78
|
+
return (_jsxs("div", __assign({ className: "calendar--dropdown" }, { children: [mode !== "time" && (function () {
|
|
79
|
+
var calendarProps = {
|
|
80
|
+
mode: calendarMode,
|
|
81
|
+
selected: dateRange,
|
|
82
|
+
onSelect: handleSelect,
|
|
83
|
+
weekStartsOn: 1,
|
|
84
|
+
showOutsideDays: false,
|
|
85
|
+
numberOfMonths: numberOfMonths,
|
|
86
|
+
disabled: disabledDays,
|
|
87
|
+
className: "p-0",
|
|
88
|
+
formatters: {
|
|
89
|
+
formatWeekdayName: function (weekday, options) {
|
|
90
|
+
var _a;
|
|
91
|
+
return weekday
|
|
92
|
+
.toLocaleDateString((_a = options === null || options === void 0 ? void 0 : options.locale) === null || _a === void 0 ? void 0 : _a.code, { weekday: "short" })
|
|
93
|
+
.toUpperCase();
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
return _jsx(Calendar, __assign({}, calendarProps));
|
|
98
|
+
})(), mode !== "calendar" && (_jsx("div", __assign({ className: "".concat(mode === "both" ? "calendar--time_container_separated" : "") }, { children: _jsx(TimePicker, { label: "Time", hour: hours, minute: minutes, meridiem: amPm, onChange: function (h, m, mm) {
|
|
99
|
+
var hh = String(Math.max(0, Math.min(12, Number(h || 0)))).padStart(2, "0");
|
|
100
|
+
var mmn = String(Math.max(0, Math.min(59, Number(m || 0)))).padStart(2, "0");
|
|
101
|
+
setHours(hh);
|
|
102
|
+
setMinutes(mmn);
|
|
103
|
+
setAmPm(mm);
|
|
104
|
+
} }) }))), mode !== "time" && (_jsxs("div", __assign({ className: "calendar--footer" }, { children: [_jsxs(Button, __assign({ variant: "ghost", size: "sm", onClick: selectToday, type: "button", className: "calendar--footer--button", disabled: disableToday }, { children: [_jsx(Icon, { name: "calendar-outline", size: "sm" }), "Today"] })), _jsx(Button, __assign({ variant: "ghost", size: "sm", onClick: clearSelection, type: "button", className: "calendar--footer--button" }, { children: "Clear" }))] })))] })));
|
|
105
|
+
};
|
|
106
|
+
export default DateTime;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export interface TimePickerProps {
|
|
3
|
-
label?: string;
|
|
4
|
-
hour?: string;
|
|
5
|
-
minute?: string;
|
|
6
|
-
meridiem?: "AM" | "PM";
|
|
7
|
-
state?: "default" | "active" | "typing" | "disabled" | "success" | "error";
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
errorMessage?: string;
|
|
10
|
-
successMessage?: string;
|
|
11
|
-
onChange?: (hour: string, minute: string, meridiem: "AM" | "PM") => void;
|
|
12
|
-
onFocus?: () => void;
|
|
13
|
-
onBlur?: () => void;
|
|
14
|
-
}
|
|
15
|
-
declare const TimePicker: React.FC<TimePickerProps>;
|
|
16
|
-
export default TimePicker;
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface TimePickerProps {
|
|
3
|
+
label?: string;
|
|
4
|
+
hour?: string;
|
|
5
|
+
minute?: string;
|
|
6
|
+
meridiem?: "AM" | "PM";
|
|
7
|
+
state?: "default" | "active" | "typing" | "disabled" | "success" | "error";
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
errorMessage?: string;
|
|
10
|
+
successMessage?: string;
|
|
11
|
+
onChange?: (hour: string, minute: string, meridiem: "AM" | "PM") => void;
|
|
12
|
+
onFocus?: () => void;
|
|
13
|
+
onBlur?: () => void;
|
|
14
|
+
}
|
|
15
|
+
declare const TimePicker: React.FC<TimePickerProps>;
|
|
16
|
+
export default TimePicker;
|
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { useState, useEffect } from "react";
|
|
14
|
-
var clampTwoDigits = function (val) {
|
|
15
|
-
return val.replace(/\D/g, "").slice(-2);
|
|
16
|
-
};
|
|
17
|
-
var TimePicker = function (_a) {
|
|
18
|
-
var _b = _a.label, label = _b === void 0 ? "Time" : _b, _c = _a.hour, hour = _c === void 0 ? "" : _c, _d = _a.minute, minute = _d === void 0 ? "" : _d, _e = _a.meridiem, meridiem = _e === void 0 ? "AM" : _e, _f = _a.state, state = _f === void 0 ? "default" : _f, _g = _a.disabled, disabled = _g === void 0 ? false : _g, onChange = _a.onChange, onFocus = _a.onFocus, onBlur = _a.onBlur;
|
|
19
|
-
var _h = useState(hour), localHour = _h[0], setLocalHour = _h[1];
|
|
20
|
-
var _j = useState(minute), localMinute = _j[0], setLocalMinute = _j[1];
|
|
21
|
-
var _k = useState(meridiem), localMeridiem = _k[0], setLocalMeridiem = _k[1];
|
|
22
|
-
var _l = useState(false), isFocused = _l[0], setIsFocused = _l[1];
|
|
23
|
-
var _m = useState(false), isTyping = _m[0], setIsTyping = _m[1];
|
|
24
|
-
// Keep local state in sync when parent props change (e.g. Clear button)
|
|
25
|
-
useEffect(function () {
|
|
26
|
-
if (hour !== localHour)
|
|
27
|
-
setLocalHour(hour);
|
|
28
|
-
}, [hour]);
|
|
29
|
-
useEffect(function () {
|
|
30
|
-
if (minute !== localMinute)
|
|
31
|
-
setLocalMinute(minute);
|
|
32
|
-
}, [minute]);
|
|
33
|
-
useEffect(function () {
|
|
34
|
-
if (meridiem !== localMeridiem)
|
|
35
|
-
setLocalMeridiem(meridiem);
|
|
36
|
-
}, [meridiem]);
|
|
37
|
-
var finalState = disabled ? "disabled" : state;
|
|
38
|
-
var displayState = isFocused && isTyping ? "typing" : isFocused ? "active" : finalState;
|
|
39
|
-
var emitChange = function (h, m, mm) {
|
|
40
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(h, m, mm);
|
|
41
|
-
};
|
|
42
|
-
var handleHourChange = function (e) {
|
|
43
|
-
var raw = clampTwoDigits(e.target.value);
|
|
44
|
-
if (raw === "") {
|
|
45
|
-
setLocalHour("");
|
|
46
|
-
setIsTyping(true);
|
|
47
|
-
emitChange("", localMinute, localMeridiem);
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
var num = Number(raw || 0);
|
|
51
|
-
if (num > 12)
|
|
52
|
-
num = 12;
|
|
53
|
-
var val = String(num).padStart(2, "0");
|
|
54
|
-
setLocalHour(val);
|
|
55
|
-
setIsTyping(true);
|
|
56
|
-
emitChange(val, localMinute, localMeridiem);
|
|
57
|
-
};
|
|
58
|
-
var handleMinuteChange = function (e) {
|
|
59
|
-
var raw = clampTwoDigits(e.target.value);
|
|
60
|
-
if (raw === "") {
|
|
61
|
-
setLocalMinute("");
|
|
62
|
-
setIsTyping(true);
|
|
63
|
-
emitChange(localHour, "", localMeridiem);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
var num = Number(raw || 0);
|
|
67
|
-
if (num > 59)
|
|
68
|
-
num = 59;
|
|
69
|
-
var val = String(num).padStart(2, "0");
|
|
70
|
-
setLocalMinute(val);
|
|
71
|
-
setIsTyping(true);
|
|
72
|
-
emitChange(localHour, val, localMeridiem);
|
|
73
|
-
};
|
|
74
|
-
var handleMeridiemClick = function (value) {
|
|
75
|
-
if (disabled)
|
|
76
|
-
return;
|
|
77
|
-
setLocalMeridiem(value);
|
|
78
|
-
emitChange(localHour, localMinute, value);
|
|
79
|
-
};
|
|
80
|
-
var handleFocus = function () {
|
|
81
|
-
setIsFocused(true);
|
|
82
|
-
onFocus === null || onFocus === void 0 ? void 0 : onFocus();
|
|
83
|
-
};
|
|
84
|
-
var handleBlur = function () {
|
|
85
|
-
setIsFocused(false);
|
|
86
|
-
setIsTyping(false);
|
|
87
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
88
|
-
};
|
|
89
|
-
return (_jsxs("div", __assign({ className: "time-picker-wrapper", "data-state": displayState }, { children: [label && _jsx("div", __assign({ className: "time-picker__div" }, { children: label })), _jsxs("div", __assign({ className: "time-picker time-picker--".concat(displayState) }, { children: [_jsx("input", { className: "time-picker__input", type: "text", inputMode: "numeric", pattern: "[0-9]*", value: localHour, placeholder: "00", onChange: handleHourChange, onFocus: handleFocus, onBlur: handleBlur, disabled: disabled, "aria-label": "Hour", "data-unit": "hour" }), _jsx("div", __assign({ className: "time-picker__colon" }, { children: ":" })), _jsx("input", { className: "time-picker__input", type: "text", inputMode: "numeric", pattern: "[0-9]*", value: localMinute, placeholder: "00", onChange: handleMinuteChange, onFocus: handleFocus, onBlur: handleBlur, disabled: disabled, "aria-label": "Minute", "data-unit": "minute" }), _jsxs("div", __assign({ className: "time-picker__am-pm", role: "tablist", "aria-label": "AM/PM selector" }, { children: [_jsx("button", __assign({ type: "button", className: "time-picker__seg time-picker__seg--left ".concat(localMeridiem === "AM" ? "time-picker__seg--selected" : ""), onClick: function () { return handleMeridiemClick("AM"); }, disabled: disabled, "aria-pressed": localMeridiem === "AM" }, { children: "AM" })), _jsx("button", __assign({ type: "button", className: "time-picker__seg time-picker__seg--right ".concat(localMeridiem === "PM" ? "time-picker__seg--selected" : ""), onClick: function () { return handleMeridiemClick("PM"); }, disabled: disabled, "aria-pressed": localMeridiem === "PM" }, { children: "PM" }))] }))] }))] })));
|
|
90
|
-
};
|
|
91
|
-
export default TimePicker;
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { useState, useEffect } from "react";
|
|
14
|
+
var clampTwoDigits = function (val) {
|
|
15
|
+
return val.replace(/\D/g, "").slice(-2);
|
|
16
|
+
};
|
|
17
|
+
var TimePicker = function (_a) {
|
|
18
|
+
var _b = _a.label, label = _b === void 0 ? "Time" : _b, _c = _a.hour, hour = _c === void 0 ? "" : _c, _d = _a.minute, minute = _d === void 0 ? "" : _d, _e = _a.meridiem, meridiem = _e === void 0 ? "AM" : _e, _f = _a.state, state = _f === void 0 ? "default" : _f, _g = _a.disabled, disabled = _g === void 0 ? false : _g, onChange = _a.onChange, onFocus = _a.onFocus, onBlur = _a.onBlur;
|
|
19
|
+
var _h = useState(hour), localHour = _h[0], setLocalHour = _h[1];
|
|
20
|
+
var _j = useState(minute), localMinute = _j[0], setLocalMinute = _j[1];
|
|
21
|
+
var _k = useState(meridiem), localMeridiem = _k[0], setLocalMeridiem = _k[1];
|
|
22
|
+
var _l = useState(false), isFocused = _l[0], setIsFocused = _l[1];
|
|
23
|
+
var _m = useState(false), isTyping = _m[0], setIsTyping = _m[1];
|
|
24
|
+
// Keep local state in sync when parent props change (e.g. Clear button)
|
|
25
|
+
useEffect(function () {
|
|
26
|
+
if (hour !== localHour)
|
|
27
|
+
setLocalHour(hour);
|
|
28
|
+
}, [hour]);
|
|
29
|
+
useEffect(function () {
|
|
30
|
+
if (minute !== localMinute)
|
|
31
|
+
setLocalMinute(minute);
|
|
32
|
+
}, [minute]);
|
|
33
|
+
useEffect(function () {
|
|
34
|
+
if (meridiem !== localMeridiem)
|
|
35
|
+
setLocalMeridiem(meridiem);
|
|
36
|
+
}, [meridiem]);
|
|
37
|
+
var finalState = disabled ? "disabled" : state;
|
|
38
|
+
var displayState = isFocused && isTyping ? "typing" : isFocused ? "active" : finalState;
|
|
39
|
+
var emitChange = function (h, m, mm) {
|
|
40
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(h, m, mm);
|
|
41
|
+
};
|
|
42
|
+
var handleHourChange = function (e) {
|
|
43
|
+
var raw = clampTwoDigits(e.target.value);
|
|
44
|
+
if (raw === "") {
|
|
45
|
+
setLocalHour("");
|
|
46
|
+
setIsTyping(true);
|
|
47
|
+
emitChange("", localMinute, localMeridiem);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
var num = Number(raw || 0);
|
|
51
|
+
if (num > 12)
|
|
52
|
+
num = 12;
|
|
53
|
+
var val = String(num).padStart(2, "0");
|
|
54
|
+
setLocalHour(val);
|
|
55
|
+
setIsTyping(true);
|
|
56
|
+
emitChange(val, localMinute, localMeridiem);
|
|
57
|
+
};
|
|
58
|
+
var handleMinuteChange = function (e) {
|
|
59
|
+
var raw = clampTwoDigits(e.target.value);
|
|
60
|
+
if (raw === "") {
|
|
61
|
+
setLocalMinute("");
|
|
62
|
+
setIsTyping(true);
|
|
63
|
+
emitChange(localHour, "", localMeridiem);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
var num = Number(raw || 0);
|
|
67
|
+
if (num > 59)
|
|
68
|
+
num = 59;
|
|
69
|
+
var val = String(num).padStart(2, "0");
|
|
70
|
+
setLocalMinute(val);
|
|
71
|
+
setIsTyping(true);
|
|
72
|
+
emitChange(localHour, val, localMeridiem);
|
|
73
|
+
};
|
|
74
|
+
var handleMeridiemClick = function (value) {
|
|
75
|
+
if (disabled)
|
|
76
|
+
return;
|
|
77
|
+
setLocalMeridiem(value);
|
|
78
|
+
emitChange(localHour, localMinute, value);
|
|
79
|
+
};
|
|
80
|
+
var handleFocus = function () {
|
|
81
|
+
setIsFocused(true);
|
|
82
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus();
|
|
83
|
+
};
|
|
84
|
+
var handleBlur = function () {
|
|
85
|
+
setIsFocused(false);
|
|
86
|
+
setIsTyping(false);
|
|
87
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
88
|
+
};
|
|
89
|
+
return (_jsxs("div", __assign({ className: "time-picker-wrapper", "data-state": displayState }, { children: [label && _jsx("div", __assign({ className: "time-picker__div" }, { children: label })), _jsxs("div", __assign({ className: "time-picker time-picker--".concat(displayState) }, { children: [_jsx("input", { className: "time-picker__input", type: "text", inputMode: "numeric", pattern: "[0-9]*", value: localHour, placeholder: "00", onChange: handleHourChange, onFocus: handleFocus, onBlur: handleBlur, disabled: disabled, "aria-label": "Hour", "data-unit": "hour" }), _jsx("div", __assign({ className: "time-picker__colon" }, { children: ":" })), _jsx("input", { className: "time-picker__input", type: "text", inputMode: "numeric", pattern: "[0-9]*", value: localMinute, placeholder: "00", onChange: handleMinuteChange, onFocus: handleFocus, onBlur: handleBlur, disabled: disabled, "aria-label": "Minute", "data-unit": "minute" }), _jsxs("div", __assign({ className: "time-picker__am-pm", role: "tablist", "aria-label": "AM/PM selector" }, { children: [_jsx("button", __assign({ type: "button", className: "time-picker__seg time-picker__seg--left ".concat(localMeridiem === "AM" ? "time-picker__seg--selected" : ""), onClick: function () { return handleMeridiemClick("AM"); }, disabled: disabled, "aria-pressed": localMeridiem === "AM" }, { children: "AM" })), _jsx("button", __assign({ type: "button", className: "time-picker__seg time-picker__seg--right ".concat(localMeridiem === "PM" ? "time-picker__seg--selected" : ""), onClick: function () { return handleMeridiemClick("PM"); }, disabled: disabled, "aria-pressed": localMeridiem === "PM" }, { children: "PM" }))] }))] }))] })));
|
|
90
|
+
};
|
|
91
|
+
export default TimePicker;
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import '../../../styles/components/molecule/location-dropdown.css';
|
|
3
|
-
export interface LocationOption {
|
|
4
|
-
id: string | number;
|
|
5
|
-
label: string;
|
|
6
|
-
type: 'airport' | 'port' | 'accommodation';
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export interface LocationGroup {
|
|
10
|
-
id: string;
|
|
11
|
-
label: string;
|
|
12
|
-
options: LocationOption[];
|
|
13
|
-
}
|
|
14
|
-
export interface LocationData {
|
|
15
|
-
id: string | number;
|
|
16
|
-
locationName: string;
|
|
17
|
-
}
|
|
18
|
-
export interface LocationDropdownProps {
|
|
19
|
-
options?: LocationOption[];
|
|
20
|
-
groups?: LocationGroup[];
|
|
21
|
-
selectedValue?: string | number | null;
|
|
22
|
-
placeholder?: string;
|
|
23
|
-
label?: string;
|
|
24
|
-
onSelectionChange: (location: LocationData | null) => void;
|
|
25
|
-
disabled?: boolean;
|
|
26
|
-
error?: boolean;
|
|
27
|
-
className?: string;
|
|
28
|
-
type?: 'airport-port' | 'accommodation' | 'pickup-dropoff';
|
|
29
|
-
maxHeight?: number;
|
|
30
|
-
direction?: 'pickup' | 'dropoff';
|
|
31
|
-
showGroupTitles?: boolean;
|
|
32
|
-
}
|
|
33
|
-
declare const LocationDropdown: React.FC<LocationDropdownProps>;
|
|
34
|
-
export default LocationDropdown;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '../../../styles/components/molecule/location-dropdown.css';
|
|
3
|
+
export interface LocationOption {
|
|
4
|
+
id: string | number;
|
|
5
|
+
label: string;
|
|
6
|
+
type: 'airport' | 'port' | 'accommodation';
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface LocationGroup {
|
|
10
|
+
id: string;
|
|
11
|
+
label: string;
|
|
12
|
+
options: LocationOption[];
|
|
13
|
+
}
|
|
14
|
+
export interface LocationData {
|
|
15
|
+
id: string | number;
|
|
16
|
+
locationName: string;
|
|
17
|
+
}
|
|
18
|
+
export interface LocationDropdownProps {
|
|
19
|
+
options?: LocationOption[];
|
|
20
|
+
groups?: LocationGroup[];
|
|
21
|
+
selectedValue?: string | number | null;
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
label?: string;
|
|
24
|
+
onSelectionChange: (location: LocationData | null) => void;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
error?: boolean;
|
|
27
|
+
className?: string;
|
|
28
|
+
type?: 'airport-port' | 'accommodation' | 'pickup-dropoff';
|
|
29
|
+
maxHeight?: number;
|
|
30
|
+
direction?: 'pickup' | 'dropoff';
|
|
31
|
+
showGroupTitles?: boolean;
|
|
32
|
+
}
|
|
33
|
+
declare const LocationDropdown: React.FC<LocationDropdownProps>;
|
|
34
|
+
export default LocationDropdown;
|