@nobak/design-system 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +73 -0
- package/README.md +142 -0
- package/lib/assets/icons.js +67 -0
- package/lib/components/AccountOverview/AccountOverview.js +122 -0
- package/lib/components/AdminPanel.js +58 -0
- package/lib/components/AssetExchange/AssetExchange.js +189 -0
- package/lib/components/AuthenticationFlow.js +216 -0
- package/lib/components/ConversationInterface/ConversationInterface.js +232 -0
- package/lib/components/DevFooter.js +38 -0
- package/lib/components/DevMenu.js +35 -0
- package/lib/components/DevSidebar.js +28 -0
- package/lib/components/DigitalDisplay.js +83 -0
- package/lib/components/Footer.js +45 -0
- package/lib/components/HeroContainer.js +10 -0
- package/lib/components/IntentRecognition/IntentRecognition.js +174 -0
- package/lib/components/Logo.js +259 -0
- package/lib/components/MenuBar.js +56 -0
- package/lib/components/NetworkSettings.js +223 -0
- package/lib/components/RecoverySetup/RecoverySetup.js +354 -0
- package/lib/components/RisingSun.js +122 -0
- package/lib/components/Symbol.js +226 -0
- package/lib/components/TransactionComposer/TransactionComposer.js +258 -0
- package/lib/components/TransactionConfirmation.js +184 -0
- package/lib/components/WalletMenu.js +33 -0
- package/lib/components/console/code/CodeBlock.js +150 -0
- package/lib/components/console/code/index.js +9 -0
- package/lib/components/console/data/DataTable.js +245 -0
- package/lib/components/console/data/MetricCard.js +79 -0
- package/lib/components/console/data/index.js +11 -0
- package/lib/components/console/documentation/index.js +10 -0
- package/lib/components/console/forms/APIKeyGenerator.js +261 -0
- package/lib/components/console/forms/SearchBar.js +210 -0
- package/lib/components/console/forms/index.js +10 -0
- package/lib/components/console/index.js +29 -0
- package/lib/components/console/layout/ConsoleCard.js +82 -0
- package/lib/components/console/layout/ConsoleLayout.js +86 -0
- package/lib/components/console/layout/index.js +10 -0
- package/lib/components/console/monitoring/StatusIndicator.js +128 -0
- package/lib/components/console/monitoring/index.js +9 -0
- package/lib/components/console/navigation/DevFooter.js +38 -0
- package/lib/components/console/navigation/DevMenu.js +35 -0
- package/lib/components/console/navigation/DevSidebar.js +28 -0
- package/lib/components/console/navigation/index.js +11 -0
- package/lib/components/console/settings/index.js +10 -0
- package/lib/components/index.js +12 -0
- package/lib/design/ColorPicker.stories.js +9 -0
- package/lib/design/HSLTool-V1.js +345 -0
- package/lib/design/HSLTool-V2.js +475 -0
- package/lib/design/HSLTool-V3.js +543 -0
- package/lib/design/HSLTool-V4.js +1139 -0
- package/lib/design/HSLTool.js +374 -0
- package/lib/design/OKLCHColorPicker.stories.js +24 -0
- package/lib/design/OKLCHTool.js +1014 -0
- package/lib/index.js +4 -0
- package/lib/shared/components/Avatar/Avatar.js +18 -0
- package/lib/shared/components/Avatar/index.js +1 -0
- package/lib/shared/components/Badge/Badge.js +34 -0
- package/lib/shared/components/Badge/index.js +1 -0
- package/lib/shared/components/Breadcrumb/Breadcrumb.js +13 -0
- package/lib/shared/components/Breadcrumb/index.js +1 -0
- package/lib/shared/components/Button/Button.js +184 -0
- package/lib/shared/components/Button/index.js +1 -0
- package/lib/shared/components/Calendar/Calendar.js +155 -0
- package/lib/shared/components/Calendar/CalendarDay.js +251 -0
- package/lib/shared/components/Calendar/CalendarHeader.js +88 -0
- package/lib/shared/components/Calendar/CalendarMonth.js +106 -0
- package/lib/shared/components/Calendar/CalendarWeek.js +267 -0
- package/lib/shared/components/Calendar/constants.js +73 -0
- package/lib/shared/components/Calendar/index.js +3 -0
- package/lib/shared/components/Calendar/types.d.js +0 -0
- package/lib/shared/components/Cartel/Cartel.js +44 -0
- package/lib/shared/components/Cartel/index.js +1 -0
- package/lib/shared/components/Cell/Cell.js +105 -0
- package/lib/shared/components/Cell/index.js +1 -0
- package/lib/shared/components/Checkbox/Checkbox.js +27 -0
- package/lib/shared/components/Checkbox/index.js +1 -0
- package/lib/shared/components/Clock/Clock.js +6 -0
- package/lib/shared/components/Clock/index.js +1 -0
- package/lib/shared/components/ColorChecker/ColorChecker.js +89 -0
- package/lib/shared/components/ColorChecker/index.js +2 -0
- package/lib/shared/components/ColorChecker/utils.js +159 -0
- package/lib/shared/components/Command/Command.js +95 -0
- package/lib/shared/components/Command/index.js +1 -0
- package/lib/shared/components/Container/Container.js +18 -0
- package/lib/shared/components/Container/index.js +1 -0
- package/lib/shared/components/Cover/Cover.js +17 -0
- package/lib/shared/components/Cover/index.js +1 -0
- package/lib/shared/components/DatePicker/DatePicker.js +52 -0
- package/lib/shared/components/DatePicker/components/Calendar.js +125 -0
- package/lib/shared/components/DatePicker/components/CalendarDay.js +23 -0
- package/lib/shared/components/DatePicker/components/DateWrapper.js +15 -0
- package/lib/shared/components/DatePicker/components/index.js +2 -0
- package/lib/shared/components/DatePicker/index.js +1 -0
- package/lib/shared/components/DateTime/DateTime.js +51 -0
- package/lib/shared/components/DateTime/index.js +1 -0
- package/lib/shared/components/Debug/Debug.js +12 -0
- package/lib/shared/components/Debug/index.js +1 -0
- package/lib/shared/components/Disclosure/Disclosure.js +31 -0
- package/lib/shared/components/Disclosure/index.js +1 -0
- package/lib/shared/components/Dropdown/Dropdown.js +91 -0
- package/lib/shared/components/Dropdown/index.js +1 -0
- package/lib/shared/components/EmptyState/EmptyState.js +40 -0
- package/lib/shared/components/EmptyState/index.js +1 -0
- package/lib/shared/components/Form/Form.js +41 -0
- package/lib/shared/components/Form/components/DynamicForm.js +66 -0
- package/lib/shared/components/Form/components/StepperForm.js +266 -0
- package/lib/shared/components/Form/components/index.js +2 -0
- package/lib/shared/components/Form/context/Form.js +164 -0
- package/lib/shared/components/Form/context/index.js +1 -0
- package/lib/shared/components/Form/index.js +1 -0
- package/lib/shared/components/Form/types.d.js +1 -0
- package/lib/shared/components/Form/utils/index.js +31 -0
- package/lib/shared/components/GroupItems/GroupItems.js +17 -0
- package/lib/shared/components/GroupItems/index.js +1 -0
- package/lib/shared/components/Header/Header.js +26 -0
- package/lib/shared/components/Header/index.js +1 -0
- package/lib/shared/components/Heading/Heading.js +5 -0
- package/lib/shared/components/Heading/index.js +1 -0
- package/lib/shared/components/Icon/Icon.js +28 -0
- package/lib/shared/components/Icon/index.js +1 -0
- package/lib/shared/components/Identicons/Identicons.js +6 -0
- package/lib/shared/components/Identicons/index.d.js +0 -0
- package/lib/shared/components/Identicons/index.js +1 -0
- package/lib/shared/components/Image/Image.js +22 -0
- package/lib/shared/components/Image/index.js +1 -0
- package/lib/shared/components/Input/Input.js +201 -0
- package/lib/shared/components/Input/components/CheckBoxInput.js +81 -0
- package/lib/shared/components/Input/components/DateInput.js +89 -0
- package/lib/shared/components/Input/components/DefaultInput.js +102 -0
- package/lib/shared/components/Input/components/FileReaderInput.js +88 -0
- package/lib/shared/components/Input/components/NumberInput.js +141 -0
- package/lib/shared/components/Input/components/PickerInput.js +122 -0
- package/lib/shared/components/Input/components/RCInput.js +112 -0
- package/lib/shared/components/Input/components/Radiobox/RadioboxBasic.js +56 -0
- package/lib/shared/components/Input/components/Radiobox/RadioboxCard.js +27 -0
- package/lib/shared/components/Input/components/Radiobox/RadioboxFull.js +44 -0
- package/lib/shared/components/Input/components/Radiobox/index.js +3 -0
- package/lib/shared/components/Input/components/RadioboxInput.js +102 -0
- package/lib/shared/components/Input/components/SelectInput.js +70 -0
- package/lib/shared/components/Input/components/TextAreaInput.js +67 -0
- package/lib/shared/components/Input/components/TextInput.js +139 -0
- package/lib/shared/components/Input/components/TimeInput.js +37 -0
- package/lib/shared/components/Input/components/UploadFileInput.js +123 -0
- package/lib/shared/components/Input/components/index.js +13 -0
- package/lib/shared/components/Input/components/types.d.js +0 -0
- package/lib/shared/components/Input/index.js +1 -0
- package/lib/shared/components/Input/types.d.js +0 -0
- package/lib/shared/components/Layout/Layout.js +13 -0
- package/lib/shared/components/Layout/index.js +1 -0
- package/lib/shared/components/List/List.js +30 -0
- package/lib/shared/components/List/index.js +1 -0
- package/lib/shared/components/Loader/Loader.js +27 -0
- package/lib/shared/components/Loader/index.js +1 -0
- package/lib/shared/components/Modal/Modal.js +102 -0
- package/lib/shared/components/Modal/index.js +1 -0
- package/lib/shared/components/Notification/Notification.js +39 -0
- package/lib/shared/components/Notification/index.js +1 -0
- package/lib/shared/components/Person/Person.js +81 -0
- package/lib/shared/components/Person/index.js +1 -0
- package/lib/shared/components/Popover/Popover.js +39 -0
- package/lib/shared/components/Popover/index.js +1 -0
- package/lib/shared/components/QRCode/QRCode.js +329 -0
- package/lib/shared/components/QRCode/index.js +1 -0
- package/lib/shared/components/RadioGroup/RadioGroup.js +35 -0
- package/lib/shared/components/RadioGroup/components/DefaultGroup.js +71 -0
- package/lib/shared/components/RadioGroup/components/VerticalGroup.js +83 -0
- package/lib/shared/components/RadioGroup/components/index.js +2 -0
- package/lib/shared/components/RadioGroup/index.js +1 -0
- package/lib/shared/components/Search/Search.js +12 -0
- package/lib/shared/components/Search/index.js +1 -0
- package/lib/shared/components/Select/Select.js +90 -0
- package/lib/shared/components/Select/index.js +1 -0
- package/lib/shared/components/Sidebar/Sidebar.js +42 -0
- package/lib/shared/components/Sidebar/index.js +1 -0
- package/lib/shared/components/SlideOver/SlideOver.js +81 -0
- package/lib/shared/components/SlideOver/index.js +1 -0
- package/lib/shared/components/Slider/Slider.js +80 -0
- package/lib/shared/components/Slider/index.js +1 -0
- package/lib/shared/components/Stepper/Stepper.js +32 -0
- package/lib/shared/components/Stepper/index.js +1 -0
- package/lib/shared/components/Steps/Steps.js +53 -0
- package/lib/shared/components/Steps/index.js +1 -0
- package/lib/shared/components/Switch/Switch.js +26 -0
- package/lib/shared/components/Switch/index.js +1 -0
- package/lib/shared/components/Tab/Tab.js +59 -0
- package/lib/shared/components/Tab/index.js +1 -0
- package/lib/shared/components/Table/Table.js +47 -0
- package/lib/shared/components/Table/index.js +1 -0
- package/lib/shared/components/Text/Text.js +11 -0
- package/lib/shared/components/Text/index.js +1 -0
- package/lib/shared/components/TextList/TextList.js +15 -0
- package/lib/shared/components/TextList/index.js +1 -0
- package/lib/shared/components/TimePicker/TimePicker.js +161 -0
- package/lib/shared/components/TimePicker/index.js +1 -0
- package/lib/shared/components/Tooltip/Tooltip.js +13 -0
- package/lib/shared/components/Tooltip/index.js +1 -0
- package/lib/shared/components/Uploader/Uploader.js +63 -0
- package/lib/shared/components/Uploader/index.js +1 -0
- package/lib/shared/components/Video/Video.js +20 -0
- package/lib/shared/components/Video/index.js +1 -0
- package/lib/shared/components/index.d.js +0 -0
- package/lib/shared/components/index.js +50 -0
- package/lib/shared/elements/Color/ColorPallet.js +20 -0
- package/lib/shared/elements/Color/index.js +1 -0
- package/lib/shared/elements/Text.js +37 -0
- package/lib/shared/elements/index.js +1 -0
- package/lib/shared/helpers/FakeLink.js +8 -0
- package/lib/shared/helpers/constants.js +359 -0
- package/lib/shared/helpers/index.js +2 -0
- package/lib/shared/helpers/isEqual.js +56 -0
- package/lib/shared/index.d.js +0 -0
- package/lib/shared/index.js +1 -0
- package/lib/shared/stories/components/Avatar.stories.js +17 -0
- package/lib/shared/stories/components/Badge.stories.dev.js +37 -0
- package/lib/shared/stories/components/Button.stories.js +553 -0
- package/lib/shared/stories/components/Calendar.stories.js +62 -0
- package/lib/shared/stories/components/Cartel.stories.js +32 -0
- package/lib/shared/stories/components/Checkbox.stories.js +15 -0
- package/lib/shared/stories/components/ColorChecker.stories.dev.js +16 -0
- package/lib/shared/stories/components/DateTime.stories.js +27 -0
- package/lib/shared/stories/components/Disclosure.stories.js +30 -0
- package/lib/shared/stories/components/Dropdown.stories.js +39 -0
- package/lib/shared/stories/components/Form/Default.stories.js +201 -0
- package/lib/shared/stories/components/Form/DummyForm.stories.js +48 -0
- package/lib/shared/stories/components/Form/DynamicForm.stories.js +155 -0
- package/lib/shared/stories/components/Form/StepperForm.stories.js +138 -0
- package/lib/shared/stories/components/Form/ValidateForm.stories.js +70 -0
- package/lib/shared/stories/components/Form/Validation.stories.js +184 -0
- package/lib/shared/stories/components/GroupItems.stories.js +23 -0
- package/lib/shared/stories/components/Header.stories.js +29 -0
- package/lib/shared/stories/components/Heading.stories.js +27 -0
- package/lib/shared/stories/components/Icon.stories.js +22 -0
- package/lib/shared/stories/components/Image.stories.js +23 -0
- package/lib/shared/stories/components/Input/Checkbox.stories.js +45 -0
- package/lib/shared/stories/components/Input/DatePicker.stories.js +23 -0
- package/lib/shared/stories/components/Input/Defaut.stories.js +24 -0
- package/lib/shared/stories/components/Input/Number.stories.js +24 -0
- package/lib/shared/stories/components/Input/RCI.stories.js +59 -0
- package/lib/shared/stories/components/Input/Radiobox.stories.dev.js +28 -0
- package/lib/shared/stories/components/Input/Select.stories.dev.js +27 -0
- package/lib/shared/stories/components/Input/SelectMultiple.stories.dev.js +510 -0
- package/lib/shared/stories/components/Input/Textarea.stories.js +24 -0
- package/lib/shared/stories/components/List.stories.js +34 -0
- package/lib/shared/stories/components/Loader.stories.js +15 -0
- package/lib/shared/stories/components/Modal.stories.js +50 -0
- package/lib/shared/stories/components/Notification.stories.js +22 -0
- package/lib/shared/stories/components/Person.stories.js +41 -0
- package/lib/shared/stories/components/Picker.stories.js +15 -0
- package/lib/shared/stories/components/Popover.stories.js +36 -0
- package/lib/shared/stories/components/QRCode.stories.js +20 -0
- package/lib/shared/stories/components/RadioGroup.stories.js +56 -0
- package/lib/shared/stories/components/Select.stories.js +50 -0
- package/lib/shared/stories/components/Sidebar.stories.js +35 -0
- package/lib/shared/stories/components/Slider.stories.dev.js +48 -0
- package/lib/shared/stories/components/Stepper/Stepper.stories.js +38 -0
- package/lib/shared/stories/components/Steps.stories.js +15 -0
- package/lib/shared/stories/components/Switch.stories.js +15 -0
- package/lib/shared/stories/components/Tab.stories.js +15 -0
- package/lib/shared/stories/components/Table.stories.js +95 -0
- package/lib/shared/stories/components/TextList.stories.js +23 -0
- package/lib/shared/stories/components/Tooltip.stories.dev.js +40 -0
- package/lib/shared/stories/elements/Color.stories.js +269 -0
- package/lib/shared/stories/elements/Text.stories.js +45 -0
- package/lib/shared/types/index.js +1 -0
- package/lib/stories/Foundation/BrandIdentity.prod.stories.js +510 -0
- package/lib/stories/Foundation/Logo.stories.js +19 -0
- package/lib/stories/Foundation/RisingSun.stories.js +16 -0
- package/lib/stories/Foundation/Shadows.stories.js +601 -0
- package/lib/stories/Foundation/Symbol.stories.js +18 -0
- package/lib/stories/HeroContainer.stories.js +18 -0
- package/lib/styles/accessibilityTokens.js +72 -0
- package/lib/styles/borderWidth.js +10 -0
- package/lib/styles/colors.js +303 -0
- package/lib/styles/elevation.js +240 -0
- package/lib/styles/icons.js +218 -0
- package/lib/styles/index.js +29 -0
- package/lib/styles/motion.js +668 -0
- package/lib/styles/opacity.js +10 -0
- package/lib/styles/radius.js +11 -0
- package/lib/styles/sizing.js +35 -0
- package/lib/styles/space.js +24 -0
- package/lib/styles/theme/darkTheme.js +471 -0
- package/lib/styles/theme/index.js +44 -0
- package/lib/styles/theme/lightTheme.js +480 -0
- package/lib/styles/theme/themeTypes.js +1 -0
- package/lib/styles/theme/themeUtils.js +63 -0
- package/lib/styles/typography-advanced.js +510 -0
- package/lib/styles/typography.js +1419 -0
- package/lib/styles/zIndex.js +19 -0
- package/lib/tokens/borders.js +161 -0
- package/lib/tokens/colors.js +426 -0
- package/lib/tokens/components.js +499 -0
- package/lib/tokens/index.js +84 -0
- package/lib/tokens/lighting.js +384 -0
- package/lib/tokens/motion.js +284 -0
- package/lib/tokens/semantic.js +367 -0
- package/lib/tokens/shadows.js +114 -0
- package/lib/tokens/spacing.js +189 -0
- package/lib/tokens/typography.js +268 -0
- package/package.json +176 -0
- package/styles/generated-tokens.css +677 -0
- package/styles/index.css +2 -0
- package/styles/main.css +610 -0
- package/tailwind.config.js +64 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
7
|
+
import { useCalendar } from '@h6s/calendar';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { format } from 'date-fns';
|
|
10
|
+
import { timesOfDay } from "./constants";
|
|
11
|
+
import clsx from 'clsx';
|
|
12
|
+
// import { ChevronLeftIcon, ChevronRightIcon } from '@heroicons/react/solid';
|
|
13
|
+
import { configResponsive, useResponsive } from 'ahooks';
|
|
14
|
+
import { DateTime } from 'luxon';
|
|
15
|
+
import { CalendarHeader } from "./CalendarHeader";
|
|
16
|
+
configResponsive({
|
|
17
|
+
sm: 0,
|
|
18
|
+
md: 768,
|
|
19
|
+
lg: 1024,
|
|
20
|
+
xl: 1280,
|
|
21
|
+
'2xl': 1536
|
|
22
|
+
});
|
|
23
|
+
var SubHeaderMobileDay = function SubHeaderMobileDay(_ref) {
|
|
24
|
+
var containerNav = _ref.containerNav,
|
|
25
|
+
headers = _ref.headers,
|
|
26
|
+
navigation = _ref.navigation,
|
|
27
|
+
cursorDate = _ref.cursorDate;
|
|
28
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
29
|
+
ref: containerNav,
|
|
30
|
+
className: "sticky top-0 z-10 grid flex-none grid-cols-7 bg-neutral-800 text-xs text-neutral-500 shadow ring-1 ring-black ring-opacity-5 md:hidden"
|
|
31
|
+
}, headers.weekDays.map(function (_ref2) {
|
|
32
|
+
var key = _ref2.key,
|
|
33
|
+
value = _ref2.value;
|
|
34
|
+
var isToday = format(value, 'Y-MM-dd') === format(+new Date(), 'Y-MM-dd');
|
|
35
|
+
var isSelected = format(cursorDate, 'Y-MM-dd') === format(value, 'Y-MM-dd') ? true : false;
|
|
36
|
+
var buttonStyle = clsx('mt-3 flex h-8 w-8 items-center justify-center rounded-full text-base font-semibold rounded-full', isToday && isSelected && 'bg-secondary-400 text-white', isToday && !isSelected && 'text-secondary-400', isSelected && 'bg-neutral-900 text-white', !isSelected && 'text-neutral-900');
|
|
37
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
38
|
+
type: "button",
|
|
39
|
+
className: "flex flex-col items-center pt-3 pb-1.5",
|
|
40
|
+
onClick: function onClick() {
|
|
41
|
+
return navigation.setDate(value);
|
|
42
|
+
},
|
|
43
|
+
key: key
|
|
44
|
+
}, /*#__PURE__*/React.createElement("span", null, format(value, 'EEEEE')), /*#__PURE__*/React.createElement("span", {
|
|
45
|
+
className: buttonStyle
|
|
46
|
+
}, format(value, 'd')));
|
|
47
|
+
}));
|
|
48
|
+
};
|
|
49
|
+
export var DayView = function DayView(_ref3) {
|
|
50
|
+
var headers = _ref3.headers,
|
|
51
|
+
body = _ref3.body,
|
|
52
|
+
navigation = _ref3.navigation,
|
|
53
|
+
cursorDate = _ref3.cursorDate,
|
|
54
|
+
activeView = _ref3.activeView,
|
|
55
|
+
events = _ref3.events,
|
|
56
|
+
view = _ref3.view;
|
|
57
|
+
var container = React.useRef(null);
|
|
58
|
+
var containerNav = React.useRef(null);
|
|
59
|
+
var containerOffset = React.useRef(null);
|
|
60
|
+
var responsive = useResponsive();
|
|
61
|
+
var sm = responsive.sm,
|
|
62
|
+
md = responsive.md;
|
|
63
|
+
React.useEffect(function () {
|
|
64
|
+
var _container$current, _containerNav$current, _containerOffset$curr;
|
|
65
|
+
var currentMinute = new Date().getHours() * 60;
|
|
66
|
+
if (typeof ((_container$current = container.current) === null || _container$current === void 0 ? void 0 : _container$current.scrollHeight) === 'number' && typeof ((_containerNav$current = containerNav.current) === null || _containerNav$current === void 0 ? void 0 : _containerNav$current.offsetHeight) === 'number' && typeof ((_containerOffset$curr = containerOffset.current) === null || _containerOffset$curr === void 0 ? void 0 : _containerOffset$curr.offsetHeight) === 'number') {
|
|
67
|
+
var x = container.current.scrollHeight - containerNav.current.offsetHeight - containerOffset.current.offsetHeight;
|
|
68
|
+
window.scrollTo(0, x * currentMinute / 1440);
|
|
69
|
+
}
|
|
70
|
+
}, []);
|
|
71
|
+
var eventsOnDate = events.filter(function (event) {
|
|
72
|
+
return format(cursorDate, 'DDD') === format(new Date(event.timestamp * 1000), 'DDD') ? true : false;
|
|
73
|
+
});
|
|
74
|
+
React.useEffect(function () {
|
|
75
|
+
if (sm && !md) {
|
|
76
|
+
view.showWeekView();
|
|
77
|
+
} else if (md) {
|
|
78
|
+
view.showMonthView();
|
|
79
|
+
}
|
|
80
|
+
}, [responsive]);
|
|
81
|
+
React.useEffect(function () {
|
|
82
|
+
window.scrollTo(0, 0);
|
|
83
|
+
}, []);
|
|
84
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
85
|
+
className: "flex flex-auto overflow-hidden bg-neutral-50"
|
|
86
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
87
|
+
ref: container,
|
|
88
|
+
className: "flex flex-auto flex-col overflow-auto"
|
|
89
|
+
}, /*#__PURE__*/React.createElement(SubHeaderMobileDay, {
|
|
90
|
+
containerNav: containerNav,
|
|
91
|
+
headers: headers,
|
|
92
|
+
navigation: navigation,
|
|
93
|
+
cursorDate: cursorDate
|
|
94
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
95
|
+
className: "flex w-full flex-auto"
|
|
96
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
97
|
+
className: "w-14 flex-none bg-neutral-50 ring-1 ring-neutral-100"
|
|
98
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
99
|
+
className: "grid flex-auto grid-cols-1 grid-rows-1"
|
|
100
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
101
|
+
className: "col-start-1 col-end-2 row-start-1 grid divide-y divide-neutral-100",
|
|
102
|
+
style: {
|
|
103
|
+
gridTemplateRows: 'repeat(48, minmax(3.5rem, 1fr))'
|
|
104
|
+
}
|
|
105
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
106
|
+
ref: containerOffset,
|
|
107
|
+
className: "row-end-1 h-7"
|
|
108
|
+
}), timesOfDay.map(function (_ref4) {
|
|
109
|
+
var time = _ref4.time;
|
|
110
|
+
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
111
|
+
key: Math.random()
|
|
112
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
113
|
+
className: "sticky left-0 -mt-2.5 -ml-14 w-14 pr-2 text-right text-xs leading-5 text-neutral-400"
|
|
114
|
+
}, time)), /*#__PURE__*/React.createElement("div", null));
|
|
115
|
+
}), /*#__PURE__*/React.createElement("div", null)), /*#__PURE__*/React.createElement("ol", {
|
|
116
|
+
className: "col-start-1 col-end-2 row-start-1 grid grid-cols-1",
|
|
117
|
+
style: {
|
|
118
|
+
gridTemplateRows: '1.75rem repeat(288, minmax(0, 1fr)) auto'
|
|
119
|
+
}
|
|
120
|
+
}, eventsOnDate.length > 0 && eventsOnDate.map(function (event) {
|
|
121
|
+
var start = DateTime.fromSeconds(parseInt(event.timestamp)),
|
|
122
|
+
end = DateTime.fromSeconds(parseInt(event.timestamp) + parseInt(event.duration));
|
|
123
|
+
var start_time = (parseInt(start.toFormat('HH')) * 60 + parseInt(start.toFormat('mm'))) / 5 + 2;
|
|
124
|
+
var startTime = start.toFormat('HH:mm'),
|
|
125
|
+
endTime = end.toFormat('HH:mm');
|
|
126
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
127
|
+
className: "relative mt-px flex",
|
|
128
|
+
style: {
|
|
129
|
+
gridRow: "".concat(start_time, " / span ").concat(event.duration / 60 / 5)
|
|
130
|
+
},
|
|
131
|
+
key: event.name
|
|
132
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
133
|
+
href: "#",
|
|
134
|
+
className: "group absolute inset-1 flex flex-col overflow-y-auto rounded-lg bg-blue-50 p-2 text-xs leading-5 hover:bg-blue-100"
|
|
135
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
136
|
+
className: "order-1 font-semibold text-blue-700"
|
|
137
|
+
}, event.name), /*#__PURE__*/React.createElement("p", {
|
|
138
|
+
className: "text-blue-500 group-hover:text-blue-700"
|
|
139
|
+
}, /*#__PURE__*/React.createElement("time", {
|
|
140
|
+
dateTime: "2022-01-22T06:00"
|
|
141
|
+
}))));
|
|
142
|
+
}))))), /*#__PURE__*/React.createElement("div", {
|
|
143
|
+
className: "hidden w-1/2 max-w-md flex-none border-l border-neutral-100 py-10 px-8 md:block"
|
|
144
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
145
|
+
className: "flex items-center text-center text-neutral-900"
|
|
146
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
147
|
+
type: "button",
|
|
148
|
+
onClick: function onClick() {
|
|
149
|
+
return navigation.toPrev();
|
|
150
|
+
},
|
|
151
|
+
className: "-m-1.5 flex flex-none items-center justify-center p-1.5 text-neutral-400 hover:text-neutral-500"
|
|
152
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
153
|
+
className: "sr-only"
|
|
154
|
+
}, "Previous month")), /*#__PURE__*/React.createElement("div", {
|
|
155
|
+
className: "flex-auto font-semibold"
|
|
156
|
+
}, format(cursorDate, 'MMMM Y')), /*#__PURE__*/React.createElement("button", {
|
|
157
|
+
type: "button",
|
|
158
|
+
onClick: function onClick() {
|
|
159
|
+
return navigation.toNext();
|
|
160
|
+
},
|
|
161
|
+
className: "-m-1.5 flex flex-none items-center justify-center p-1.5 text-neutral-400 hover:text-neutral-500"
|
|
162
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
163
|
+
className: "sr-only"
|
|
164
|
+
}, "Next month"))), /*#__PURE__*/React.createElement("div", {
|
|
165
|
+
className: "mt-6 grid grid-cols-7 text-center text-xs leading-6 text-neutral-500"
|
|
166
|
+
}, headers.weekDays.map(function (_ref5) {
|
|
167
|
+
var key = _ref5.key,
|
|
168
|
+
value = _ref5.value;
|
|
169
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
170
|
+
key: key
|
|
171
|
+
}, format(value, 'EEEEE'));
|
|
172
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
173
|
+
className: "isolate mt-2 grid grid-cols-7 gap-px rounded-lg bg-neutral-200 text-sm shadow ring-1 ring-neutral-200"
|
|
174
|
+
}, body.value.map(function (_ref6) {
|
|
175
|
+
var key = _ref6.key,
|
|
176
|
+
weeks = _ref6.value;
|
|
177
|
+
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
178
|
+
key: key
|
|
179
|
+
}, weeks.map(function (_ref7) {
|
|
180
|
+
var key = _ref7.key,
|
|
181
|
+
day = _ref7.value,
|
|
182
|
+
date = _ref7.date,
|
|
183
|
+
isCurrentDate = _ref7.isCurrentDate,
|
|
184
|
+
isCurrentMonth = _ref7.isCurrentMonth;
|
|
185
|
+
var isSelected = format(cursorDate, 'Y-MM-dd') === format(day, 'Y-MM-dd') ? true : false;
|
|
186
|
+
var dayStyle = clsx('flex flex-col items-center pt-[10px] pb-[10px]', 'hover:bg-primary-400 hover:transition-opacity duration-300 ease-out focus:z-10', isCurrentMonth ? 'bg-neutral-100' : 'bg-neutral-50', (isSelected || isCurrentDate) && 'font-semibold', isSelected && 'text-neutral-50', !isSelected && isCurrentMonth && !isCurrentDate && 'text-neutral-900', !isSelected && !isCurrentMonth && !isCurrentDate && 'text-neutral-400', isCurrentDate && !isSelected && 'text-primary-400', body.value[0]['value'][0]['value'] === day && 'rounded-tl-lg', body.value[0]['value'][6]['value'] === day && 'rounded-tr-lg', body.value[body.value.length - 1]['value'][0]['value'] === day && 'rounded-bl-lg', body.value[body.value.length - 1]['value'][6]['value'] === day && 'rounded-br-lg');
|
|
187
|
+
var buttonStyle = clsx('flex h-[32px] w-[32px] p-2 items-center justify-center rounded-full', isSelected && isCurrentDate && 'bg-primary-400', isSelected && !isCurrentDate && 'bg-neutral-900 transition-opacity duration-100');
|
|
188
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
189
|
+
key: key,
|
|
190
|
+
type: "button",
|
|
191
|
+
className: dayStyle,
|
|
192
|
+
onClick: function onClick() {
|
|
193
|
+
return navigation.setDate(day);
|
|
194
|
+
}
|
|
195
|
+
}, /*#__PURE__*/React.createElement("time", {
|
|
196
|
+
dateTime: format(day, 'dd'),
|
|
197
|
+
className: buttonStyle
|
|
198
|
+
}, format(day, 'dd')));
|
|
199
|
+
}));
|
|
200
|
+
})))));
|
|
201
|
+
};
|
|
202
|
+
export var CalendarDay = function CalendarDay(_ref8) {
|
|
203
|
+
var _ref8$events = _ref8.events,
|
|
204
|
+
events = _ref8$events === void 0 ? [] : _ref8$events,
|
|
205
|
+
CTA = _ref8.CTA;
|
|
206
|
+
var _React$useState = React.useState('month'),
|
|
207
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
208
|
+
activeView = _React$useState2[0],
|
|
209
|
+
changeView = _React$useState2[1];
|
|
210
|
+
var _useCalendar = useCalendar(),
|
|
211
|
+
cursorDate = _useCalendar.cursorDate,
|
|
212
|
+
headers = _useCalendar.headers,
|
|
213
|
+
body = _useCalendar.body,
|
|
214
|
+
view = _useCalendar.view,
|
|
215
|
+
navigation = _useCalendar.navigation;
|
|
216
|
+
var setView = function setView(option) {
|
|
217
|
+
changeView(option);
|
|
218
|
+
switch (option) {
|
|
219
|
+
case 'month':
|
|
220
|
+
return view.showMonthView();
|
|
221
|
+
case 'day':
|
|
222
|
+
return view.showMonthView();
|
|
223
|
+
case 'week':
|
|
224
|
+
return view.showWeekView();
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
// React.useEffect, populate events, watch [view]
|
|
229
|
+
var eventsOnDate = events.filter(function (event) {
|
|
230
|
+
return format(cursorDate, 'DDD') === format(new Date(event.timestamp * 1000), 'DDD') ? true : false;
|
|
231
|
+
});
|
|
232
|
+
var bodyStyle = clsx(activeView === 'month' && 'flex flex-col', (activeView === 'week' || activeView === 'day') && 'flex flex-col h-screen');
|
|
233
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
234
|
+
className: bodyStyle
|
|
235
|
+
}, /*#__PURE__*/React.createElement(CalendarHeader, {
|
|
236
|
+
activeView: activeView,
|
|
237
|
+
setView: setView,
|
|
238
|
+
view: view,
|
|
239
|
+
CTA: CTA,
|
|
240
|
+
cursorDate: cursorDate,
|
|
241
|
+
navigation: navigation
|
|
242
|
+
}), /*#__PURE__*/React.createElement(DayView, {
|
|
243
|
+
headers: headers,
|
|
244
|
+
body: body,
|
|
245
|
+
events: events,
|
|
246
|
+
activeView: activeView,
|
|
247
|
+
navigation: navigation,
|
|
248
|
+
cursorDate: cursorDate,
|
|
249
|
+
view: view
|
|
250
|
+
})));
|
|
251
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { format } from 'date-fns';
|
|
3
|
+
// import { ChevronLeftIcon, ChevronRightIcon } from '@heroicons/react/solid';
|
|
4
|
+
import { Dropdown } from "../Dropdown";
|
|
5
|
+
export var CalendarHeader = function CalendarHeader(_ref) {
|
|
6
|
+
var activeView = _ref.activeView,
|
|
7
|
+
setView = _ref.setView,
|
|
8
|
+
view = _ref.view,
|
|
9
|
+
cursorDate = _ref.cursorDate,
|
|
10
|
+
CTA = _ref.CTA,
|
|
11
|
+
navigation = _ref.navigation;
|
|
12
|
+
var userNavigation = [{
|
|
13
|
+
text: 'Month',
|
|
14
|
+
type: 'button',
|
|
15
|
+
action: function action() {
|
|
16
|
+
return setView('month');
|
|
17
|
+
}
|
|
18
|
+
}, {
|
|
19
|
+
text: 'Day',
|
|
20
|
+
type: 'button',
|
|
21
|
+
action: function action() {
|
|
22
|
+
return setView('day');
|
|
23
|
+
}
|
|
24
|
+
}, {
|
|
25
|
+
text: 'Week',
|
|
26
|
+
type: 'button',
|
|
27
|
+
action: function action() {
|
|
28
|
+
return setView('week');
|
|
29
|
+
}
|
|
30
|
+
}];
|
|
31
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("header", {
|
|
32
|
+
className: "relative flex items-center justify-between pt-[16px] pb-[24px] sm:px-6 lg:px-8 lg:flex-none"
|
|
33
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
34
|
+
className: "text-lg font-semibold text-neutral-900"
|
|
35
|
+
}, activeView === 'day' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("h1", {
|
|
36
|
+
className: "text-lg font-semibold leading-6 text-neutral-900"
|
|
37
|
+
}, /*#__PURE__*/React.createElement("time", {
|
|
38
|
+
dateTime: "2022-01-22",
|
|
39
|
+
className: "sm:hidden"
|
|
40
|
+
}, format(cursorDate, 'MMM d, Y')), /*#__PURE__*/React.createElement("time", {
|
|
41
|
+
dateTime: "2022-01-22",
|
|
42
|
+
className: "hidden sm:inline"
|
|
43
|
+
}, format(cursorDate, 'MMMM d, Y'))), /*#__PURE__*/React.createElement("p", {
|
|
44
|
+
className: "mt-1 text-sm text-neutral-500"
|
|
45
|
+
}, format(cursorDate, 'eeee'))) : /*#__PURE__*/React.createElement("time", {
|
|
46
|
+
dateTime: format(cursorDate, 'Y-MMMM')
|
|
47
|
+
}, format(cursorDate, 'MMMM Y'))), /*#__PURE__*/React.createElement("div", {
|
|
48
|
+
className: "flex items-center space-x-[16px]"
|
|
49
|
+
}, /*#__PURE__*/React.createElement("div", null, CTA), /*#__PURE__*/React.createElement("div", {
|
|
50
|
+
className: "flex items-center rounded-md shadow-sm md:items-stretch text-button-tiny h-[28px]"
|
|
51
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
52
|
+
type: "button",
|
|
53
|
+
className: "flex items-center justify-center rounded-l-md border border-r-0 border-neutral-400 bg-neutral-50 py-2 pl-3 pr-4 text-neutral-400 hover:text-neutral-500 focus:relative md:w-9 md:px-2 md:hover:bg-neutral-50",
|
|
54
|
+
onClick: function onClick() {
|
|
55
|
+
return navigation.toPrev();
|
|
56
|
+
}
|
|
57
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
58
|
+
className: "sr-only"
|
|
59
|
+
}, "Previous month")), /*#__PURE__*/React.createElement("button", {
|
|
60
|
+
type: "button",
|
|
61
|
+
className: "hidden border-t border-b border-neutral-400 bg-neutral-50 px-3.5 text-sm font-medium text-neutral-700 hover:bg-neutral-50 hover:text-neutral-400 focus:relative md:block",
|
|
62
|
+
onClick: function onClick() {
|
|
63
|
+
return navigation.setToday();
|
|
64
|
+
}
|
|
65
|
+
}, "Today"), /*#__PURE__*/React.createElement("span", {
|
|
66
|
+
className: "relative -mx-px h-5 w-px bg-neutral-300 md:hidden"
|
|
67
|
+
}), /*#__PURE__*/React.createElement("button", {
|
|
68
|
+
type: "button",
|
|
69
|
+
className: "flex items-center justify-center rounded-r-md border border-l-0 border-neutral-400 bg-neutral-50 py-2 pl-4 pr-3 text-neutral-400 hover:text-neutral-500 focus:relative md:w-9 md:px-2 md:hover:bg-neutral-50",
|
|
70
|
+
onClick: function onClick() {
|
|
71
|
+
return navigation.toNext();
|
|
72
|
+
}
|
|
73
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
74
|
+
className: "sr-only"
|
|
75
|
+
}, "Next month"))), /*#__PURE__*/React.createElement("div", {
|
|
76
|
+
className: "md:flex md:items-center"
|
|
77
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
78
|
+
className: "right-0 origin-top-right"
|
|
79
|
+
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
80
|
+
items: userNavigation,
|
|
81
|
+
button: {
|
|
82
|
+
icon: 'dots',
|
|
83
|
+
name: activeView,
|
|
84
|
+
size: 'tiny',
|
|
85
|
+
variant: 'outline'
|
|
86
|
+
}
|
|
87
|
+
}))))));
|
|
88
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { format } from 'date-fns';
|
|
3
|
+
import { DateTime } from 'luxon';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
export var MonthDesktop = function MonthDesktop(_ref) {
|
|
6
|
+
var weeks = _ref.weeks,
|
|
7
|
+
events = _ref.events,
|
|
8
|
+
body = _ref.body,
|
|
9
|
+
activeDate = _ref.activeDate,
|
|
10
|
+
openModal = _ref.openModal,
|
|
11
|
+
navigation = _ref.navigation;
|
|
12
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, weeks.map(function (_ref2) {
|
|
13
|
+
var key = _ref2.key,
|
|
14
|
+
day = _ref2.value,
|
|
15
|
+
date = _ref2.date,
|
|
16
|
+
isCurrentDate = _ref2.isCurrentDate,
|
|
17
|
+
isCurrentMonth = _ref2.isCurrentMonth;
|
|
18
|
+
var eventsOnDate = events.filter(function (event) {
|
|
19
|
+
return format(day, 'DDD') === format(new Date(event.timestamp * 1000), 'DDD') ? true : false;
|
|
20
|
+
});
|
|
21
|
+
var isSelected = format(activeDate, 'Y-MM-dd') === format(day, 'Y-MM-dd') ? true : false;
|
|
22
|
+
var buttonStyle = clsx('flex h-6 w-6 items-center justify-center rounded-full font-semibold', isCurrentDate && isSelected && 'bg-secondary-400 text-neutral-800', isCurrentDate && !isSelected && 'text-secondary-400', isSelected && 'bg-primary-400 text-neutral-800');
|
|
23
|
+
var topLeft = body.value[0]['value'][0]['value'] === day;
|
|
24
|
+
var topRight = body.value[0]['value'][6]['value'] === day;
|
|
25
|
+
var botLeft = body.value[body.value.length - 1]['value'][0]['value'] === day;
|
|
26
|
+
var botRight = body.value[body.value.length - 1]['value'][6]['value'] === day;
|
|
27
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
28
|
+
key: format(day, 'Y-MM-dd'),
|
|
29
|
+
className: clsx(isCurrentMonth ? 'bg-neutral-100' : 'bg-neutral-50 text-neutral-500', topLeft && 'rounded-tl-[20px]', topRight && 'rounded-tr-[20px]', botLeft && 'rounded-bl-[20px]', botRight && 'rounded-br-[20px]', 'relative py-2 px-3')
|
|
30
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
31
|
+
onClick: function onClick() {
|
|
32
|
+
return navigation.setDate(day);
|
|
33
|
+
}
|
|
34
|
+
}, /*#__PURE__*/React.createElement("time", {
|
|
35
|
+
dateTime: format(day, 'y-M-d'),
|
|
36
|
+
className: buttonStyle
|
|
37
|
+
}, format(day, 'dd'))), eventsOnDate.length > 0 && /*#__PURE__*/React.createElement("ol", {
|
|
38
|
+
className: "mt-2"
|
|
39
|
+
}, eventsOnDate.slice(0, 2).map(function (event) {
|
|
40
|
+
var dt = DateTime.fromSeconds(Number(event.timestamp));
|
|
41
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
42
|
+
key: event.id,
|
|
43
|
+
onClick: function onClick() {
|
|
44
|
+
return openModal({
|
|
45
|
+
type: 'event',
|
|
46
|
+
content: event,
|
|
47
|
+
padding: 'none',
|
|
48
|
+
overflow: true
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
className: "cursor-pointer"
|
|
52
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
53
|
+
href: event.href,
|
|
54
|
+
className: "group flex"
|
|
55
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
56
|
+
className: "flex-auto truncate font-medium text-neutral-900 group-hover:text-secondary-400"
|
|
57
|
+
}, event.name), /*#__PURE__*/React.createElement("time", {
|
|
58
|
+
dateTime: "".concat(('0' + dt.hour).slice(-2), ":").concat(('0' + dt.minute).slice(-2)),
|
|
59
|
+
className: "ml-3 hidden flex-none text-neutral-500 group-hover:text-secondary-400 md:block"
|
|
60
|
+
}, "".concat(('0' + dt.hour).slice(-2), ":").concat(('0' + dt.minute).slice(-2)))));
|
|
61
|
+
}), eventsOnDate.length > 2 && /*#__PURE__*/React.createElement("li", {
|
|
62
|
+
className: "text-neutral-500"
|
|
63
|
+
}, "+ ", eventsOnDate.length - 2, " more")));
|
|
64
|
+
}));
|
|
65
|
+
};
|
|
66
|
+
export var MonthMobile = function MonthMobile(_ref3) {
|
|
67
|
+
var weeks = _ref3.weeks,
|
|
68
|
+
events = _ref3.events,
|
|
69
|
+
activeDate = _ref3.activeDate,
|
|
70
|
+
openModal = _ref3.openModal,
|
|
71
|
+
navigation = _ref3.navigation;
|
|
72
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, weeks.map(function (_ref4) {
|
|
73
|
+
var key = _ref4.key,
|
|
74
|
+
day = _ref4.value,
|
|
75
|
+
date = _ref4.date,
|
|
76
|
+
isCurrentDate = _ref4.isCurrentDate,
|
|
77
|
+
isCurrentMonth = _ref4.isCurrentMonth;
|
|
78
|
+
var eventsOnDate = events.filter(function (event) {
|
|
79
|
+
var eventTime = new Date(event.timestamp * 1000);
|
|
80
|
+
return format(day, 'DDD') === format(eventTime, 'DDD') ? true : false;
|
|
81
|
+
});
|
|
82
|
+
var isSelected = format(activeDate, 'Y-MM-dd') === format(day, 'Y-MM-dd') ? true : false;
|
|
83
|
+
var dayStyle = clsx(isCurrentMonth ? 'bg-neutral-100' : 'bg-neutral-50', (isSelected || isCurrentDate) && 'font-semibold', isSelected && 'text-neutral-800', !isSelected && isCurrentDate && 'text-primary-400', !isSelected && isCurrentMonth && !isCurrentDate && 'text-neutral-900', !isSelected && !isCurrentMonth && !isCurrentDate && 'text-neutral-500', 'flex h-14 flex-col py-2 px-3 hover:bg-neutral-100 focus:z-20');
|
|
84
|
+
var eventStyle = clsx(isSelected && 'flex h-6 w-6 items-center justify-center rounded-full', isSelected && isCurrentDate && 'bg-primary-400', isSelected && !isCurrentDate && 'bg-secondary-400', 'ml-auto');
|
|
85
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
86
|
+
key: date,
|
|
87
|
+
type: "button",
|
|
88
|
+
onClick: function onClick() {
|
|
89
|
+
return navigation.setDate(day);
|
|
90
|
+
},
|
|
91
|
+
className: dayStyle
|
|
92
|
+
}, /*#__PURE__*/React.createElement("time", {
|
|
93
|
+
dateTime: format(day, 'd'),
|
|
94
|
+
className: eventStyle
|
|
95
|
+
}, format(day, 'dd')), /*#__PURE__*/React.createElement("p", {
|
|
96
|
+
className: "sr-only"
|
|
97
|
+
}, eventsOnDate.length, " events"), eventsOnDate.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
98
|
+
className: "-mx-0.5 mt-auto flex flex-wrap-reverse"
|
|
99
|
+
}, eventsOnDate.map(function (event) {
|
|
100
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
101
|
+
key: event.id,
|
|
102
|
+
className: "mx-0.5 mb-1 h-1.5 w-1.5 rounded-full bg-neutral-400"
|
|
103
|
+
});
|
|
104
|
+
})));
|
|
105
|
+
}));
|
|
106
|
+
};
|