@koine/react 1.0.11 → 1.0.12
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/Alert/Alert.js +7 -13
- package/Animations/Reveal.js +12 -10
- package/Animations/Underline.js +3 -13
- package/Animations/useReveal.js +18 -17
- package/Autocomplete/AutocompleteDownshift.js +1 -1
- package/Autocomplete/AutocompleteDownshiftMultiselect.js +1 -1
- package/Autocomplete/AutocompleteMui.js +61 -56
- package/Autocomplete/AutocompleteReach.js +1 -1
- package/Autocomplete/components.js +17 -72
- package/Autocomplete/helpers.js +1 -1
- package/Bg/BgColor.js +14 -24
- package/Bg/BgPhoto.js +11 -54
- package/Bg/BgSvg.js +6 -9
- package/Breadcrumbs/Breadcrumbs.js +14 -54
- package/Buttons/Button.js +8 -73
- package/Buttons/ButtonComposite.js +20 -41
- package/Buttons/ButtonFab.js +4 -6
- package/Buttons/ButtonLink.js +7 -6
- package/Buttons/IconButton.js +5 -17
- package/Calendar/CalendarDaygridCell.js +20 -14
- package/Calendar/CalendarDaygridNav.js +10 -9
- package/Calendar/CalendarDaygridTable.js +32 -30
- package/Calendar/CalendarLegend.js +7 -2
- package/Calendar/calendar-api-google.js +101 -68
- package/Calendar/useCalendar.js +114 -113
- package/Calendar/utils.js +73 -74
- package/Carousel/Carousel.js +1 -1
- package/Carousel/CarouselCss.js +12 -26
- package/Collapsable/Collapsable.js +1 -1
- package/Debug/Debug.js +5 -17
- package/Details/Details.js +30 -27
- package/Dialog/DialogMui.js +22 -20
- package/Dialog/css/bare.js +17 -15
- package/Dialog/m/bare.js +17 -13
- package/Dialog/m/basic.js +2 -2
- package/Dialog/m/index.js +4 -4
- package/Dialog/sc/bare.js +25 -43
- package/Dialog/sc/framer.js +6 -6
- package/Dialog/sc/framerMaterial.js +6 -6
- package/Dialog/sc/material.js +17 -37
- package/Dialog/tw/bare.js +25 -19
- package/Dialog/tw/elegant.js +17 -15
- package/Dialog/tw/framer.js +6 -6
- package/Dialog/tw/framerMaterial.js +6 -6
- package/Dialog/tw/material.js +17 -15
- package/Editor/Editor--tiptap.js +14 -11
- package/Editor/components.js +6 -24
- package/Favicon/FaviconTags.js +2 -1
- package/Form/Form.js +30 -28
- package/Form/sc/bare.js +9 -18
- package/Forms/Checkbox/Checkbox.js +9 -15
- package/Forms/Feedback/Feedback.js +6 -7
- package/Forms/Field/Field.js +15 -26
- package/Forms/Field/FieldControl.js +19 -15
- package/Forms/Field/FieldHint.js +3 -5
- package/Forms/Input/Input.js +10 -16
- package/Forms/InputGroup/InputGroup.js +9 -36
- package/Forms/Label/Label.js +5 -23
- package/Forms/Password/Password.js +10 -23
- package/Forms/Radio/Radio.js +15 -18
- package/Forms/Switch/Switch.js +9 -39
- package/Forms/Textarea/Textarea.js +6 -7
- package/Forms/Textarea/TextareaRich.js +10 -24
- package/Forms/Toggle/Toggle.js +19 -67
- package/Forms/Toggle/useToggle.js +29 -29
- package/Forms/antispam.js +12 -12
- package/Forms/helpers.js +7 -6
- package/Forms/styles.js +12 -43
- package/Gauge/Gauge.js +1 -1
- package/Grid/Grid.js +25 -51
- package/Hamburger/Hamburger.js +35 -47
- package/Header/useHeader.js +12 -12
- package/Hidden/Hidden.js +9 -13
- package/Img/sc/bare.js +3 -1
- package/Link/Link.js +3 -1
- package/Link/LinkBlank.js +8 -17
- package/Menu/Menu.js +3 -10
- package/MenuItem/MenuItem.js +3 -19
- package/Meta/Meta.js +3 -2
- package/NoJs/NoJs.js +2 -2
- package/Pagination/PaginationNav.js +26 -48
- package/Pagination/PaginationResults.js +7 -6
- package/Pill/Pill.js +6 -36
- package/Progress/ProgressCircular.js +9 -30
- package/Progress/ProgressLinear.js +8 -16
- package/Progress/ProgressOverlay.js +11 -27
- package/Rating/Rating.js +24 -44
- package/Rating/index.js +19 -15
- package/Select/SelectDownshift.js +1 -1
- package/Select/components.js +6 -12
- package/Sidebar/Sidebar.js +13 -38
- package/Spacing/Spacing.js +12 -12
- package/Sticky/Sticky.js +1 -1
- package/Sticky/StickyCss.js +4 -2
- package/Tabs/TabsMui.js +19 -16
- package/Tabs/tw/bare.js +13 -11
- package/Tabs/tw/material.js +15 -11
- package/Tabs/useTabs.js +16 -16
- package/Typography/CopyPasteVisible.js +3 -5
- package/Typography/Native.js +12 -45
- package/Typography/ReadMore.js +25 -51
- package/Typography/TextLoop.js +19 -22
- package/Typography/TypeStairs.js +20 -16
- package/helpers/classed.js +21 -18
- package/helpers/extend-component.js +6 -6
- package/hooks/useAsyncFn.js +18 -11
- package/hooks/useDateLocale.js +22 -13
- package/hooks/useEffectOnce.js +1 -1
- package/hooks/useFirstMountState.js +1 -1
- package/hooks/useFocus.js +3 -3
- package/hooks/useId.js +3 -2
- package/hooks/useIsomorphicLayoutEffect.js +1 -1
- package/hooks/useMount.js +2 -2
- package/hooks/useMountedState.js +4 -4
- package/hooks/usePrevious.js +2 -2
- package/hooks/useScrollPosition.js +20 -15
- package/hooks/useScrollTo.js +7 -5
- package/hooks/useTraceUpdate.js +4 -3
- package/hooks/useUpdateEffect.js +3 -3
- package/hooks/useWindowSize.js +3 -3
- package/m/MotionProvider.js +4 -2
- package/node/Alert/Alert.js +9 -16
- package/node/Alert/index.js +1 -1
- package/node/Animations/Reveal.js +15 -13
- package/node/Animations/Underline.js +5 -16
- package/node/Animations/index.js +1 -1
- package/node/Animations/useReveal.js +19 -18
- package/node/Autocomplete/AutocompleteMui.js +69 -64
- package/node/Autocomplete/components.js +26 -82
- package/node/Autocomplete/helpers.js +2 -2
- package/node/Bg/BgColor.js +18 -29
- package/node/Bg/BgPhoto.js +15 -59
- package/node/Bg/BgSvg.js +8 -12
- package/node/Bg/index.js +1 -1
- package/node/Breadcrumbs/Breadcrumbs.js +20 -61
- package/node/Breadcrumbs/index.js +1 -1
- package/node/Buttons/Button.js +10 -76
- package/node/Buttons/ButtonComposite.js +23 -45
- package/node/Buttons/ButtonFab.js +6 -9
- package/node/Buttons/ButtonLink.js +10 -10
- package/node/Buttons/IconButton.js +7 -20
- package/node/Buttons/index.js +1 -1
- package/node/Calendar/CalendarDaygridCell.js +24 -18
- package/node/Calendar/CalendarDaygridNav.js +14 -13
- package/node/Calendar/CalendarDaygridTable.js +39 -38
- package/node/Calendar/CalendarLegend.js +8 -3
- package/node/Calendar/calendar-api-google.js +105 -73
- package/node/Calendar/index.js +1 -1
- package/node/Calendar/useCalendar.js +117 -116
- package/node/Calendar/utils.js +82 -84
- package/node/Carousel/CarouselCss.js +17 -32
- package/node/Carousel/index.js +1 -1
- package/node/Collapsable/index.js +1 -1
- package/node/Debug/Debug.js +7 -20
- package/node/Debug/index.js +1 -1
- package/node/Details/Details.js +24 -22
- package/node/Details/index.js +1 -1
- package/node/Dialog/DialogMui.js +12 -11
- package/node/Dialog/css/bare.js +11 -10
- package/node/Dialog/m/bare.js +18 -14
- package/node/Dialog/m/basic.js +1 -1
- package/node/Dialog/m/index.js +4 -4
- package/node/Dialog/sc/bare.js +22 -41
- package/node/Dialog/sc/framer.js +5 -5
- package/node/Dialog/sc/framerMaterial.js +5 -5
- package/node/Dialog/sc/material.js +12 -33
- package/node/Dialog/tw/bare.js +19 -14
- package/node/Dialog/tw/elegant.js +11 -9
- package/node/Dialog/tw/framer.js +5 -5
- package/node/Dialog/tw/framerMaterial.js +5 -5
- package/node/Dialog/tw/material.js +11 -9
- package/node/Editor/Editor--tiptap.js +19 -17
- package/node/Editor/components.js +9 -28
- package/node/Editor/index.js +1 -1
- package/node/Favicon/FaviconTags.js +3 -2
- package/node/Favicon/index.js +1 -1
- package/node/Form/Form.js +20 -18
- package/node/Form/index.js +1 -1
- package/node/Form/sc/bare.js +12 -22
- package/node/Forms/Checkbox/Checkbox.js +13 -20
- package/node/Forms/Checkbox/index.js +1 -1
- package/node/Forms/Feedback/Feedback.js +8 -10
- package/node/Forms/Feedback/index.js +1 -1
- package/node/Forms/Field/Field.js +18 -30
- package/node/Forms/Field/FieldControl.js +26 -22
- package/node/Forms/Field/FieldHint.js +4 -7
- package/node/Forms/Field/index.js +1 -1
- package/node/Forms/Input/Input.js +15 -22
- package/node/Forms/Input/index.js +1 -1
- package/node/Forms/InputGroup/InputGroup.js +14 -42
- package/node/Forms/InputGroup/index.js +1 -1
- package/node/Forms/Label/Label.js +6 -25
- package/node/Forms/Label/index.js +1 -1
- package/node/Forms/Password/Password.js +16 -30
- package/node/Forms/Password/index.js +1 -1
- package/node/Forms/Radio/Radio.js +21 -25
- package/node/Forms/Radio/index.js +1 -1
- package/node/Forms/Switch/Switch.js +15 -46
- package/node/Forms/Switch/index.js +1 -1
- package/node/Forms/Textarea/Textarea.js +11 -13
- package/node/Forms/Textarea/TextareaRich.js +16 -31
- package/node/Forms/Textarea/index.js +1 -1
- package/node/Forms/Toggle/Toggle.js +23 -72
- package/node/Forms/Toggle/index.js +1 -1
- package/node/Forms/Toggle/useToggle.js +33 -33
- package/node/Forms/antispam.js +14 -14
- package/node/Forms/helpers.js +8 -7
- package/node/Forms/index.js +1 -1
- package/node/Forms/styles.js +16 -48
- package/node/Gauge/Gauge.js +1 -1
- package/node/Grid/Grid.js +24 -51
- package/node/Grid/index.js +1 -1
- package/node/Hamburger/Hamburger.js +37 -50
- package/node/Hamburger/index.js +1 -1
- package/node/Header/index.js +1 -1
- package/node/Header/useHeader.js +16 -16
- package/node/Hidden/Hidden.js +10 -15
- package/node/Hidden/index.js +1 -1
- package/node/Img/index.js +1 -1
- package/node/Img/sc/bare.js +4 -3
- package/node/Link/Link.js +4 -3
- package/node/Link/LinkBlank.js +11 -21
- package/node/Link/index.js +1 -1
- package/node/Menu/Menu.js +4 -12
- package/node/Menu/index.js +1 -1
- package/node/MenuItem/MenuItem.js +4 -21
- package/node/MenuItem/index.js +1 -1
- package/node/Meta/Meta.js +4 -3
- package/node/Meta/index.js +1 -1
- package/node/NoJs/NoJs.js +3 -3
- package/node/NoJs/index.js +1 -1
- package/node/Pagination/PaginationNav.js +30 -53
- package/node/Pagination/PaginationResults.js +10 -10
- package/node/Pagination/index.js +1 -1
- package/node/Pill/Pill.js +7 -38
- package/node/Pill/index.js +1 -1
- package/node/Progress/ProgressCircular.js +11 -33
- package/node/Progress/ProgressLinear.js +11 -20
- package/node/Progress/ProgressOverlay.js +18 -35
- package/node/Progress/index.js +1 -1
- package/node/Rating/Rating.js +28 -49
- package/node/Rating/index.js +20 -16
- package/node/Select/components.js +11 -18
- package/node/Sidebar/Sidebar.js +21 -47
- package/node/Sidebar/index.js +1 -1
- package/node/Spacing/Spacing.js +16 -17
- package/node/Spacing/index.js +1 -1
- package/node/Sticky/StickyCss.js +5 -3
- package/node/Sticky/index.js +1 -1
- package/node/Tabs/TabsMui.js +16 -14
- package/node/Tabs/index.js +1 -1
- package/node/Tabs/tw/bare.js +9 -8
- package/node/Tabs/tw/material.js +11 -7
- package/node/Tabs/useTabs.js +19 -19
- package/node/Typography/CopyPasteVisible.js +4 -7
- package/node/Typography/Native.js +14 -48
- package/node/Typography/ReadMore.js +30 -57
- package/node/Typography/TextLoop.js +22 -25
- package/node/Typography/TypeStairs.js +22 -18
- package/node/Typography/index.js +1 -1
- package/node/css/index.js +1 -1
- package/node/helpers/classed.js +22 -19
- package/node/helpers/extend-component.js +7 -7
- package/node/helpers/index.js +1 -1
- package/node/hooks/index.js +1 -1
- package/node/hooks/useAsyncFn.js +20 -13
- package/node/hooks/useDateLocale.js +23 -37
- package/node/hooks/useEffectOnce.js +2 -2
- package/node/hooks/useFirstMountState.js +2 -2
- package/node/hooks/useFocus.js +4 -4
- package/node/hooks/useId.js +4 -3
- package/node/hooks/useIsomorphicLayoutEffect.js +2 -2
- package/node/hooks/useMount.js +3 -3
- package/node/hooks/useMountedState.js +5 -5
- package/node/hooks/usePrevious.js +3 -3
- package/node/hooks/useScrollPosition.js +23 -18
- package/node/hooks/useScrollTo.js +9 -7
- package/node/hooks/useTraceUpdate.js +5 -4
- package/node/hooks/useUpdateEffect.js +5 -5
- package/node/hooks/useWindowSize.js +4 -4
- package/node/index.js +1 -1
- package/node/m/MotionProvider.js +6 -4
- package/node/m/index.js +1 -1
- package/node/m/lite.js +1 -1
- package/node/m/max.js +1 -1
- package/node/sc/index.js +1 -1
- package/node/scm/index.js +1 -1
- package/node/shared/index.js +1 -1
- package/node/styles/Body.js +5 -10
- package/node/styles/Global.js +5 -37
- package/node/styles/index.js +1 -1
- package/node/styles/media.js +42 -38
- package/node/styles/spacing.js +15 -16
- package/node/styles/styled.js +7 -21
- package/node/styles/theme--vanilla.js +21 -19
- package/node/styles/theme.js +9 -9
- package/node/tw/index.js +1 -1
- package/node/twm/index.js +1 -1
- package/package.json +3 -2
- package/styles/Body.js +4 -8
- package/styles/Global.js +4 -36
- package/styles/media.js +41 -36
- package/styles/spacing.js +15 -16
- package/styles/styled.js +7 -21
- package/styles/theme--vanilla.js +20 -18
- package/styles/theme.js +11 -11
package/node/Buttons/Button.js
CHANGED
|
@@ -1,83 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.KoineButton = exports.btnStyleOutlined = exports.btnStyleContained = exports.btnStyleBase = exports.btnStyleReset = exports.btnStyleUndo = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var styled_components_1 = tslib_1.__importStar(require("styled-components"));
|
|
6
|
+
var styled_1 = require("../styles/styled");
|
|
7
7
|
/**
|
|
8
8
|
* Prevent 300ms delay with `touch-action` performance optimization,
|
|
9
9
|
* @see https://twitter.com/argyleink/status/1405881231695302659
|
|
10
10
|
*/
|
|
11
|
-
exports.btnStyleUndo = (0, styled_components_1.css)
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
color: var(--bodyColor);
|
|
19
|
-
`;
|
|
20
|
-
exports.btnStyleReset = (0, styled_components_1.css) `
|
|
21
|
-
display: inline-flex;
|
|
22
|
-
align-items: center;
|
|
23
|
-
justify-content: center;
|
|
24
|
-
background: transparent;
|
|
25
|
-
border-width: 1px;
|
|
26
|
-
border-style: solid;
|
|
27
|
-
border-color: transparent;
|
|
28
|
-
cursor: pointer;
|
|
29
|
-
${exports.btnStyleUndo}
|
|
30
|
-
|
|
31
|
-
&[disabled] {
|
|
32
|
-
cursor: default;
|
|
33
|
-
opacity: 0.7;
|
|
34
|
-
}
|
|
35
|
-
`;
|
|
36
|
-
exports.btnStyleBase = (0, styled_components_1.css) `
|
|
37
|
-
${exports.btnStyleReset}
|
|
38
|
-
|
|
39
|
-
min-width: ${(p) => (p.$noGutter ? "0" : "150px")};
|
|
40
|
-
padding: ${(p) => (p.$noGutter ? "0" : "10px 30px")};
|
|
41
|
-
border-radius: 0;
|
|
42
|
-
text-align: center;
|
|
43
|
-
text-transform: uppercase;
|
|
44
|
-
font-weight: 600;
|
|
45
|
-
${(p) => p.$block && `width: 100%; display: flex;`}
|
|
46
|
-
|
|
47
|
-
&:focus,
|
|
48
|
-
&:active,
|
|
49
|
-
&:visited {
|
|
50
|
-
${styled_1.stateFocus}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/* This targets icons within a button */
|
|
54
|
-
& svg {
|
|
55
|
-
margin: 0 1em 0 0;
|
|
56
|
-
font-size: 1.25em;
|
|
57
|
-
}
|
|
58
|
-
`;
|
|
59
|
-
exports.btnStyleContained = (0, styled_components_1.css) `
|
|
60
|
-
color: white;
|
|
61
|
-
background: var(--accent200);
|
|
62
|
-
border-color: var(--accent200);
|
|
63
|
-
|
|
64
|
-
&:hover:not([disabled]) {
|
|
65
|
-
background: var(--accent300);
|
|
66
|
-
border-color: var(--accent300);
|
|
67
|
-
}
|
|
68
|
-
`;
|
|
69
|
-
exports.btnStyleOutlined = (0, styled_components_1.css) `
|
|
70
|
-
color: var(--accent200);
|
|
71
|
-
border-color: var(--accent200);
|
|
72
|
-
|
|
73
|
-
&:hover:not([disabled]) {
|
|
74
|
-
background: var(--accent300);
|
|
75
|
-
border-color: var(--accent300);
|
|
76
|
-
color: white;
|
|
77
|
-
}
|
|
78
|
-
`;
|
|
79
|
-
exports.KoineButton = styled_components_1.default.button `
|
|
80
|
-
${exports.btnStyleBase}
|
|
81
|
-
${(p) => p.$variant === "outlined" && exports.btnStyleOutlined}
|
|
82
|
-
${(p) => p.$variant === "contained" && exports.btnStyleContained}
|
|
83
|
-
`;
|
|
11
|
+
exports.btnStyleUndo = (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n appearance: none;\n -webkit-appearance: none;\n -webkit-touch-callout: none;\n user-select: none;\n touch-action: manipulation;\n outline: 0px;\n color: var(--bodyColor);\n"], ["\n appearance: none;\n -webkit-appearance: none;\n -webkit-touch-callout: none;\n user-select: none;\n touch-action: manipulation;\n outline: 0px;\n color: var(--bodyColor);\n"])));
|
|
12
|
+
exports.btnStyleReset = (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n background: transparent;\n border-width: 1px;\n border-style: solid;\n border-color: transparent;\n cursor: pointer;\n ", "\n\n &[disabled] {\n cursor: default;\n opacity: 0.7;\n }\n"], ["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n background: transparent;\n border-width: 1px;\n border-style: solid;\n border-color: transparent;\n cursor: pointer;\n ", "\n\n &[disabled] {\n cursor: default;\n opacity: 0.7;\n }\n"])), exports.btnStyleUndo);
|
|
13
|
+
exports.btnStyleBase = (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n ", "\n\n min-width: ", ";\n padding: ", ";\n border-radius: 0;\n text-align: center;\n text-transform: uppercase;\n font-weight: 600;\n ", "\n\n &:focus,\n &:active,\n &:visited {\n ", "\n }\n\n /* This targets icons within a button */\n & svg {\n margin: 0 1em 0 0;\n font-size: 1.25em;\n }\n"], ["\n ", "\n\n min-width: ", ";\n padding: ", ";\n border-radius: 0;\n text-align: center;\n text-transform: uppercase;\n font-weight: 600;\n ", "\n\n &:focus,\n &:active,\n &:visited {\n ", "\n }\n\n /* This targets icons within a button */\n & svg {\n margin: 0 1em 0 0;\n font-size: 1.25em;\n }\n"])), exports.btnStyleReset, function (p) { return (p.$noGutter ? "0" : "150px"); }, function (p) { return (p.$noGutter ? "0" : "10px 30px"); }, function (p) { return p.$block && "width: 100%; display: flex;"; }, styled_1.stateFocus);
|
|
14
|
+
exports.btnStyleContained = (0, styled_components_1.css)(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n color: white;\n background: var(--accent200);\n border-color: var(--accent200);\n\n &:hover:not([disabled]) {\n background: var(--accent300);\n border-color: var(--accent300);\n }\n"], ["\n color: white;\n background: var(--accent200);\n border-color: var(--accent200);\n\n &:hover:not([disabled]) {\n background: var(--accent300);\n border-color: var(--accent300);\n }\n"])));
|
|
15
|
+
exports.btnStyleOutlined = (0, styled_components_1.css)(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n color: var(--accent200);\n border-color: var(--accent200);\n\n &:hover:not([disabled]) {\n background: var(--accent300);\n border-color: var(--accent300);\n color: white;\n }\n"], ["\n color: var(--accent200);\n border-color: var(--accent200);\n\n &:hover:not([disabled]) {\n background: var(--accent300);\n border-color: var(--accent300);\n color: white;\n }\n"])));
|
|
16
|
+
exports.KoineButton = styled_components_1.default.button(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject(["\n ", "\n ", "\n ", "\n"], ["\n ", "\n ", "\n ", "\n"])), exports.btnStyleBase, function (p) { return p.$variant === "outlined" && exports.btnStyleOutlined; }, function (p) { return p.$variant === "contained" && exports.btnStyleContained; });
|
|
17
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
@@ -1,54 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.KoineButtonComposite = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
font-size:
|
|
14
|
-
margin:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const Main = styled_components_1.default.span `
|
|
25
|
-
display: block;
|
|
26
|
-
font-size: 0.9em;
|
|
27
|
-
|
|
28
|
-
&:last-child {
|
|
29
|
-
margin-top: ${(p) => (p.$reverse && !p.$icon ? "0.5em" : "0")};
|
|
30
|
-
}
|
|
31
|
-
`;
|
|
32
|
-
const Sub = styled_components_1.default.span `
|
|
33
|
-
display: block;
|
|
34
|
-
text-transform: none;
|
|
35
|
-
font-size: 0.7em;
|
|
36
|
-
font-weight: 500;
|
|
37
|
-
|
|
38
|
-
${Main} + & {
|
|
39
|
-
margin-top: ${(p) => (p.$reverse && !p.$icon ? "0.5em" : "0")};
|
|
40
|
-
}
|
|
41
|
-
`;
|
|
42
|
-
const Text = styled_components_1.default.span ``;
|
|
43
|
-
const Inner = (0, react_1.memo)(({ textMain, textSub, text, $reverse, $icon, }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [$reverse ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [textSub && ((0, jsx_runtime_1.jsx)(Sub, { "$icon": $icon, "$reverse": $reverse, children: textSub })), textMain && ((0, jsx_runtime_1.jsx)(Main, { "$icon": $icon, "$reverse": $reverse, children: textMain }))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [textMain && ((0, jsx_runtime_1.jsx)(Main, { "$icon": $icon, "$reverse": $reverse, children: textMain })), textSub && ((0, jsx_runtime_1.jsx)(Sub, { "$icon": $icon, "$reverse": $reverse, children: textSub }))] })), text && (0, jsx_runtime_1.jsx)(Text, { children: text })] })));
|
|
44
|
-
const KoineButtonComposite = ({ Icon, iconProps = {}, textMain, textSub, textReverse, text, Button = "button", ButtonLink = "a", ...props }) => {
|
|
45
|
-
const Btn = props.href ? ButtonLink : Button;
|
|
46
|
-
const styledProps = {
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var react_1 = require("react");
|
|
7
|
+
var styled_components_1 = tslib_1.__importDefault(require("styled-components"));
|
|
8
|
+
var Root = styled_components_1.default.span(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n ", "\n min-width: 0;\n\n & svg {\n font-size: 2em !important;\n margin: 0 0.33em 0 0 !important;\n }\n"], ["\n ", "\n min-width: 0;\n\n & svg {\n font-size: 2em !important;\n margin: 0 0.33em 0 0 !important;\n }\n"])), function (p) {
|
|
9
|
+
return p.$icon ? "display: flex;" : "display: inline-block; text-align: left;";
|
|
10
|
+
});
|
|
11
|
+
var ButtonCompositeIcon = styled_components_1.default.svg(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n float: left;\n"], ["\n float: left;\n"])));
|
|
12
|
+
var BesidesIcon = styled_components_1.default.span(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n text-align: left;\n line-height: 1.2;\n"], ["\n text-align: left;\n line-height: 1.2;\n"])));
|
|
13
|
+
var Main = styled_components_1.default.span(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n display: block;\n font-size: 0.9em;\n\n &:last-child {\n margin-top: ", ";\n }\n"], ["\n display: block;\n font-size: 0.9em;\n\n &:last-child {\n margin-top: ", ";\n }\n"])), function (p) { return (p.$reverse && !p.$icon ? "0.5em" : "0"); });
|
|
14
|
+
var Sub = styled_components_1.default.span(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n display: block;\n text-transform: none;\n font-size: 0.7em;\n font-weight: 500;\n\n ", " + & {\n margin-top: ", ";\n }\n"], ["\n display: block;\n text-transform: none;\n font-size: 0.7em;\n font-weight: 500;\n\n ", " + & {\n margin-top: ", ";\n }\n"])), Main, function (p) { return (p.$reverse && !p.$icon ? "0.5em" : "0"); });
|
|
15
|
+
var Text = styled_components_1.default.span(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject([""], [""])));
|
|
16
|
+
var Inner = (0, react_1.memo)(function (_a) {
|
|
17
|
+
var textMain = _a.textMain, textSub = _a.textSub, text = _a.text, $reverse = _a.$reverse, $icon = _a.$icon;
|
|
18
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [$reverse ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [textSub && ((0, jsx_runtime_1.jsx)(Sub, tslib_1.__assign({ "$icon": $icon, "$reverse": $reverse }, { children: textSub }))), textMain && ((0, jsx_runtime_1.jsx)(Main, tslib_1.__assign({ "$icon": $icon, "$reverse": $reverse }, { children: textMain })))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [textMain && ((0, jsx_runtime_1.jsx)(Main, tslib_1.__assign({ "$icon": $icon, "$reverse": $reverse }, { children: textMain }))), textSub && ((0, jsx_runtime_1.jsx)(Sub, tslib_1.__assign({ "$icon": $icon, "$reverse": $reverse }, { children: textSub })))] })), text && (0, jsx_runtime_1.jsx)(Text, { children: text })] }));
|
|
19
|
+
});
|
|
20
|
+
var KoineButtonComposite = function (_a) {
|
|
21
|
+
var Icon = _a.Icon, _b = _a.iconProps, iconProps = _b === void 0 ? {} : _b, textMain = _a.textMain, textSub = _a.textSub, textReverse = _a.textReverse, text = _a.text, _c = _a.Button, Button = _c === void 0 ? "button" : _c, _d = _a.ButtonLink, ButtonLink = _d === void 0 ? "a" : _d, props = tslib_1.__rest(_a, ["Icon", "iconProps", "textMain", "textSub", "textReverse", "text", "Button", "ButtonLink"]);
|
|
22
|
+
var Btn = props.href ? ButtonLink : Button;
|
|
23
|
+
var styledProps = {
|
|
47
24
|
$icon: !!Icon,
|
|
48
25
|
$reverse: textReverse,
|
|
49
26
|
$twoLines: !!(textMain && textSub && !Icon),
|
|
50
27
|
};
|
|
51
|
-
|
|
52
|
-
return ((0, jsx_runtime_1.jsxs)(Root, { as: Btn,
|
|
28
|
+
var innerProps = tslib_1.__assign({ textMain: textMain, textSub: textSub, text: text }, styledProps);
|
|
29
|
+
return ((0, jsx_runtime_1.jsxs)(Root, tslib_1.__assign({ as: Btn }, props, styledProps, { children: [Icon && (0, jsx_runtime_1.jsx)(ButtonCompositeIcon, tslib_1.__assign({ as: Icon }, iconProps)), Icon ? ((0, jsx_runtime_1.jsx)(BesidesIcon, tslib_1.__assign({}, styledProps, { children: (0, jsx_runtime_1.jsx)(Inner, tslib_1.__assign({}, innerProps)) }))) : ((0, jsx_runtime_1.jsx)(Inner, tslib_1.__assign({}, innerProps)))] })));
|
|
53
30
|
};
|
|
54
31
|
exports.KoineButtonComposite = KoineButtonComposite;
|
|
32
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IconButtonFab = exports.buttonFab = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
exports.buttonFab = (0, styled_components_1.css)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
exports.IconButtonFab = (0, styled_components_1.default)(IconButton_1.IconButton) `
|
|
11
|
-
${exports.buttonFab}
|
|
12
|
-
`;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var styled_components_1 = tslib_1.__importStar(require("styled-components"));
|
|
6
|
+
var IconButton_1 = require("./IconButton");
|
|
7
|
+
exports.buttonFab = (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n box-shadow: 3px 3px 6px -4px rgb(0, 0, 0, 0.5);\n"], ["\n box-shadow: 3px 3px 6px -4px rgb(0, 0, 0, 0.5);\n"])));
|
|
8
|
+
exports.IconButtonFab = (0, styled_components_1.default)(IconButton_1.IconButton)(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), exports.buttonFab);
|
|
9
|
+
var templateObject_1, templateObject_2;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.KoineButtonLink = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return isRelative ? ((0, jsx_runtime_1.jsx)(Root, { href: href, ...props, as: Link })) : ((0, jsx_runtime_1.jsx)(Root, { href: href, ...props, as: "a" }));
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var styled_components_1 = tslib_1.__importDefault(require("styled-components"));
|
|
7
|
+
var Button_1 = require("./Button");
|
|
8
|
+
var Root = (0, styled_components_1.default)(Button_1.KoineButton)(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n text-decoration: none;\n"], ["\n text-decoration: none;\n"])));
|
|
9
|
+
var KoineButtonLink = function (_a) {
|
|
10
|
+
var href = _a.href, _b = _a.Link, Link = _b === void 0 ? "a" : _b, props = tslib_1.__rest(_a, ["href", "Link"]);
|
|
11
|
+
var isRelative = href && href.startsWith("/");
|
|
12
|
+
return isRelative ? ((0, jsx_runtime_1.jsx)(Root, tslib_1.__assign({ href: href }, props, { as: Link }))) : ((0, jsx_runtime_1.jsx)(Root, tslib_1.__assign({ href: href }, props, { as: "a" })));
|
|
14
13
|
};
|
|
15
14
|
exports.KoineButtonLink = KoineButtonLink;
|
|
15
|
+
var templateObject_1;
|
|
@@ -1,23 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IconButton = exports.iconBtnStyleBase = exports.iconBtnStyleReset = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
exports.iconBtnStyleReset = (0, styled_components_1.css)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
width: 44px;
|
|
12
|
-
height: 44px;
|
|
13
|
-
border-radius: 100%;
|
|
14
|
-
${Button_1.btnStyleReset}
|
|
15
|
-
`;
|
|
16
|
-
exports.iconBtnStyleBase = (0, styled_components_1.css) `
|
|
17
|
-
${exports.iconBtnStyleReset}
|
|
18
|
-
`;
|
|
19
|
-
exports.IconButton = styled_components_1.default.button `
|
|
20
|
-
${exports.iconBtnStyleBase}
|
|
21
|
-
${(p) => p.$variant === "outlined" && Button_1.btnStyleOutlined}
|
|
22
|
-
${(p) => p.$variant === "contained" && Button_1.btnStyleContained}
|
|
23
|
-
`;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var styled_components_1 = tslib_1.__importStar(require("styled-components"));
|
|
6
|
+
var Button_1 = require("./Button");
|
|
7
|
+
exports.iconBtnStyleReset = (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 44px;\n height: 44px;\n border-radius: 100%;\n ", "\n"], ["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 44px;\n height: 44px;\n border-radius: 100%;\n ", "\n"])), Button_1.btnStyleReset);
|
|
8
|
+
exports.iconBtnStyleBase = (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), exports.iconBtnStyleReset);
|
|
9
|
+
exports.IconButton = styled_components_1.default.button(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n ", "\n ", "\n ", "\n"], ["\n ", "\n ", "\n ", "\n"])), exports.iconBtnStyleBase, function (p) { return p.$variant === "outlined" && Button_1.btnStyleOutlined; }, function (p) { return p.$variant === "contained" && Button_1.btnStyleContained; });
|
|
10
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
package/node/Buttons/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./Button"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./ButtonComposite"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./ButtonFab"), exports);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CalendarDaygridCell = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var react_1 = require("react");
|
|
7
|
+
var md_1 = require("react-icons/md");
|
|
8
|
+
var utils_1 = require("./utils");
|
|
8
9
|
/**
|
|
9
10
|
* Style for button within a event cell
|
|
10
11
|
*
|
|
@@ -13,43 +14,48 @@ const utils_1 = require("./utils");
|
|
|
13
14
|
* on multiple lines, but that would mean that we loose the ability to interweave
|
|
14
15
|
* single-day events among the spaces left by wider multi-days events.
|
|
15
16
|
*/
|
|
16
|
-
|
|
17
|
+
var styleBtn = {
|
|
17
18
|
overflow: "hidden",
|
|
18
19
|
whiteSpace: "nowrap",
|
|
19
20
|
textOverflow: "ellipsis",
|
|
20
21
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
var CalendarDaygridCell = function (_a) {
|
|
23
|
+
var eventClicked = _a.eventClicked, setEventClicked = _a.setEventClicked,
|
|
24
|
+
// eventHovered,
|
|
25
|
+
setEventHovered = _a.setEventHovered, view = _a.view, maxEvents = _a.maxEvents, events = _a.events, calendarsMap = _a.calendarsMap, _b = _a.Cell, Cell = _b === void 0 ? "div" : _b, _c = _a.CellOverflow, CellOverflow = _c === void 0 ? "div" : _c, _d = _a.CellEvent, CellEvent = _d === void 0 ? "div" : _d, _e = _a.CellEventBtn, CellEventBtn = _e === void 0 ? "div" : _e, _f = _a.CellEventTitle, CellEventTitle = _f === void 0 ? "span" : _f, _g = _a.CellEventStart, CellEventStart = _g === void 0 ? "span" : _g;
|
|
26
|
+
var _h = (0, react_1.useState)(false), isExpanded = _h[0], expand = _h[1];
|
|
27
|
+
var eventsWithoutPlaceholders = events.filter(function (event) { return !event.placeholder; });
|
|
28
|
+
return ((0, jsx_runtime_1.jsx)(Cell, { children: events.map(function (event, i) {
|
|
27
29
|
if (i === maxEvents && !isExpanded) {
|
|
28
|
-
return ((0, jsx_runtime_1.jsxs)(CellOverflow, { onClick: ()
|
|
30
|
+
return ((0, jsx_runtime_1.jsxs)(CellOverflow, tslib_1.__assign({ onClick: function () { return expand(true); } }, { children: [(0, jsx_runtime_1.jsx)(md_1.MdAdd, {}), eventsWithoutPlaceholders.length - maxEvents] }), "overflowMessage" + i));
|
|
29
31
|
}
|
|
30
32
|
if (i > maxEvents && !isExpanded)
|
|
31
33
|
return null;
|
|
32
34
|
if (event.placeholder) {
|
|
33
|
-
return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: (0, jsx_runtime_1.jsx)(CellEvent, { "$placeholder": true, children: (0, jsx_runtime_1.jsx)(CellEventBtn, { "aria-hidden": "true", style: { visibility: "hidden" }, "$placeholder": true, children: (0, jsx_runtime_1.jsx)(CellEventTitle, { children: "\u00A0" }) }) }) }, event.key));
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: (0, jsx_runtime_1.jsx)(CellEvent, tslib_1.__assign({ "$placeholder": true }, { children: (0, jsx_runtime_1.jsx)(CellEventBtn, tslib_1.__assign({ "aria-hidden": "true", style: { visibility: "hidden" }, "$placeholder": true }, { children: (0, jsx_runtime_1.jsx)(CellEventTitle, { children: "\u00A0" }) })) })) }, event.key));
|
|
34
36
|
}
|
|
35
|
-
|
|
37
|
+
var styleEvent = {
|
|
36
38
|
zIndex: event.firstOfMulti ? 1 : 0,
|
|
37
39
|
position: "relative",
|
|
38
|
-
width: event.firstOfMulti ?
|
|
40
|
+
width: event.firstOfMulti ? "".concat(100 * event.width, "%") : "100%",
|
|
39
41
|
};
|
|
40
42
|
if (!calendarsMap[event.calendar.id].on) {
|
|
41
43
|
// @ts-expect-error nevermind
|
|
42
44
|
styleBtn.display = "none";
|
|
43
45
|
}
|
|
44
|
-
|
|
46
|
+
var styledProps = {
|
|
45
47
|
$view: view,
|
|
46
|
-
$selected: eventClicked
|
|
48
|
+
$selected: (eventClicked === null || eventClicked === void 0 ? void 0 : eventClicked.uid) === event.uid,
|
|
47
49
|
$past: event.isPast,
|
|
48
50
|
$color: event.color,
|
|
49
51
|
$isOutOfRange: event.$isOutOfRange,
|
|
50
52
|
$isToday: event.$isToday,
|
|
51
53
|
};
|
|
52
|
-
return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: (0, jsx_runtime_1.jsx)(CellEvent, { style: styleEvent,
|
|
54
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: (0, jsx_runtime_1.jsx)(CellEvent, tslib_1.__assign({ style: styleEvent }, styledProps, { children: (0, jsx_runtime_1.jsx)(CellEventBtn, tslib_1.__assign({ role: "button", style: styleBtn }, styledProps, { onClick: function () {
|
|
55
|
+
return setEventClicked(function (prev) {
|
|
56
|
+
return (prev === null || prev === void 0 ? void 0 : prev.uid) === event.uid ? null : event;
|
|
57
|
+
});
|
|
58
|
+
}, onMouseEnter: function () { return setEventHovered(event); }, onMouseLeave: function () { return setEventHovered(null); } }, { children: event.allDay ? ((0, jsx_runtime_1.jsx)(CellEventTitle, { children: event.title })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(CellEventStart, { children: (0, utils_1.getDisplayTime)(event.start) }), (0, jsx_runtime_1.jsx)(CellEventTitle, { children: event.title })] })) })) })) }, event.key));
|
|
53
59
|
}) }));
|
|
54
60
|
};
|
|
55
61
|
exports.CalendarDaygridCell = CalendarDaygridCell;
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.KoineCalendarDaygridNav = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var format_1 = tslib_1.__importDefault(require("date-fns/format"));
|
|
7
|
+
var useDateLocale_1 = require("../hooks/useDateLocale");
|
|
8
|
+
var KoineCalendarDaygridNav = function (_a) {
|
|
9
|
+
var range = _a.range, view = _a.view, todayInView = _a.todayInView, handlePrev = _a.handlePrev, handleNext = _a.handleNext, handleToday = _a.handleToday, handleView = _a.handleView, localeCode = _a.locale, _b = _a.NavRoot, NavRoot = _b === void 0 ? "nav" : _b, _c = _a.NavTitle, NavTitle = _c === void 0 ? "div" : _c, _d = _a.NavBtns, NavBtns = _d === void 0 ? "div" : _d, _e = _a.NavBtnPrev, NavBtnPrev = _e === void 0 ? "button" : _e, _f = _a.NavBtnNext, NavBtnNext = _f === void 0 ? "button" : _f, _g = _a.NavBtnToday, NavBtnToday = _g === void 0 ? "button" : _g, _h = _a.NavBtnViewMonth, NavBtnViewMonth = _h === void 0 ? "button" : _h, _j = _a.NavBtnViewWeek, NavBtnViewWeek = _j === void 0 ? "button" : _j;
|
|
10
|
+
var start = range[0], end = range[1];
|
|
11
|
+
var locale = (0, useDateLocale_1.useDateLocale)(localeCode);
|
|
12
|
+
var opts = { locale: locale };
|
|
13
|
+
var formatted = "";
|
|
13
14
|
if (view === "month") {
|
|
14
15
|
formatted = (0, format_1.default)(start, "MMMM yyyy", opts);
|
|
15
16
|
}
|
|
16
17
|
if (view === "week") {
|
|
17
|
-
|
|
18
|
+
var inSameMonth = start.getMonth() === end.getMonth();
|
|
18
19
|
if (inSameMonth) {
|
|
19
|
-
formatted = (0, format_1.default)(start, "# MMMM yyyy", opts).replace("#",
|
|
20
|
+
formatted = (0, format_1.default)(start, "# MMMM yyyy", opts).replace("#", "".concat(start.getDate(), "-").concat(end.getDate()));
|
|
20
21
|
}
|
|
21
22
|
else {
|
|
22
|
-
formatted =
|
|
23
|
+
formatted = "".concat((0, format_1.default)(start, "d MMMM", opts), " - ").concat((0, format_1.default)(end, "d MMMM yyyy", opts));
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
|
-
return ((0, jsx_runtime_1.jsxs)(NavRoot, { children: [(0, jsx_runtime_1.jsxs)(NavBtns, { children: [(0, jsx_runtime_1.jsx)(NavBtnPrev, { onClick: handlePrev }), (0, jsx_runtime_1.jsx)(NavBtnNext, { onClick: handleNext }), (0, jsx_runtime_1.jsx)(NavBtnToday, { onClick: handleToday, disabled: todayInView }), (0, jsx_runtime_1.jsx)(NavBtnViewMonth, { onClick: ()
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)(NavRoot, { children: [(0, jsx_runtime_1.jsxs)(NavBtns, { children: [(0, jsx_runtime_1.jsx)(NavBtnPrev, { onClick: handlePrev }), (0, jsx_runtime_1.jsx)(NavBtnNext, { onClick: handleNext }), (0, jsx_runtime_1.jsx)(NavBtnToday, { onClick: handleToday, disabled: todayInView }), (0, jsx_runtime_1.jsx)(NavBtnViewMonth, { onClick: function () { return handleView("month"); }, disabled: view === "month" }), (0, jsx_runtime_1.jsx)(NavBtnViewWeek, { onClick: function () { return handleView("week"); }, disabled: view === "week" })] }), (0, jsx_runtime_1.jsx)(NavTitle, { range: range, formatted: formatted })] }));
|
|
26
27
|
};
|
|
27
28
|
exports.KoineCalendarDaygridNav = KoineCalendarDaygridNav;
|
|
@@ -1,60 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.KoineCalendarDaygridTable = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var react_1 = require("react");
|
|
7
|
+
var eachWeekOfInterval_1 = tslib_1.__importDefault(require("date-fns/eachWeekOfInterval"));
|
|
8
|
+
var react_swipeable_1 = require("react-swipeable");
|
|
9
|
+
var hooks_1 = require("../hooks");
|
|
10
|
+
var utils_1 = require("./utils");
|
|
11
|
+
var CalendarDaygridCell_1 = require("./CalendarDaygridCell");
|
|
12
12
|
function getView(range) {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
var start = range[0], end = range[1];
|
|
14
|
+
var weeks = (0, eachWeekOfInterval_1.default)({ start: start, end: end }, { weekStartsOn: 1 });
|
|
15
15
|
return {
|
|
16
16
|
month: start.getMonth(),
|
|
17
|
-
weeks,
|
|
17
|
+
weeks: weeks,
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
var KoineCalendarDaygridTable = function (_a) {
|
|
21
|
+
var localeCode = _a.locale, handlePrev = _a.handlePrev, handleNext = _a.handleNext, events = _a.events, dayLabels = _a.dayLabels, view = _a.view, range = _a.range, eventClicked = _a.eventClicked, setEventClicked = _a.setEventClicked, eventHovered = _a.eventHovered, setEventHovered = _a.setEventHovered, _b = _a.calendarsMap, calendarsMap = _b === void 0 ? {} : _b, _c = _a.maxEvents, maxEvents = _c === void 0 ? 5 : _c, _d = _a.Table, Table = _d === void 0 ? "table" : _d, _e = _a.TableHead, TableHead = _e === void 0 ? "thead" : _e, _f = _a.TableHeadCell, TableHeadCell = _f === void 0 ? "th" : _f, _g = _a.TableBody, TableBody = _g === void 0 ? "tbody" : _g, _h = _a.TableBodyRow, TableBodyRow = _h === void 0 ? "tr" : _h, _j = _a.TableBodyCell, TableBodyCell = _j === void 0 ? "td" : _j, _k = _a.TableBodyCellDate, TableBodyCellDate = _k === void 0 ? "div" : _k, Cell = _a.Cell, CellOverflow = _a.CellOverflow, CellEvent = _a.CellEvent, CellEventBtn = _a.CellEventBtn, CellEventTitle = _a.CellEventTitle, CellEventStart = _a.CellEventStart;
|
|
22
|
+
var restKoine = {
|
|
23
|
+
Cell: Cell,
|
|
24
|
+
CellOverflow: CellOverflow,
|
|
25
|
+
CellEvent: CellEvent,
|
|
26
|
+
CellEventBtn: CellEventBtn,
|
|
27
|
+
CellEventTitle: CellEventTitle,
|
|
28
|
+
CellEventStart: CellEventStart,
|
|
28
29
|
};
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
var _l = (0, react_1.useState)(dayLabels || [0, 1, 2, 3, 4, 5, 6]), days = _l[0], setDays = _l[1];
|
|
31
|
+
var _m = (0, react_1.useState)([]), weeksEvents = _m[0], setWeeksEvents = _m[1];
|
|
31
32
|
// const [days, setDays] = useState(dayLabels || [...Array(7).keys()]);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
var locale = (0, hooks_1.useDateLocale)(localeCode);
|
|
34
|
+
var _o = (0, react_1.useMemo)(function () { return getView(range); }, [range]), month = _o.month, weeks = _o.weeks;
|
|
35
|
+
var swipeableHandlers = (0, react_swipeable_1.useSwipeable)({
|
|
35
36
|
onSwipedLeft: handleNext,
|
|
36
37
|
onSwipedRight: handlePrev,
|
|
37
38
|
});
|
|
38
|
-
(0, react_1.useEffect)(()
|
|
39
|
+
(0, react_1.useEffect)(function () {
|
|
39
40
|
setWeeksEvents((0, utils_1.processEventsInView)(events, view, month, weeks));
|
|
40
41
|
}, [events, view, month, weeks]);
|
|
41
|
-
(0, react_1.useEffect)(()
|
|
42
|
+
(0, react_1.useEffect)(function () {
|
|
42
43
|
if (locale && locale.localize && !dayLabels) {
|
|
43
44
|
setDays([1, 2, 3, 4, 5, 6, 0].map(
|
|
44
45
|
// @ts-expect-error nevermind
|
|
45
|
-
(i)
|
|
46
|
+
function (i) { return locale.localize.day(i, { width: "abbreviated" }); }));
|
|
46
47
|
}
|
|
47
48
|
}, [locale, dayLabels]);
|
|
48
|
-
return ((0, jsx_runtime_1.jsxs)(Table, {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
49
|
+
return ((0, jsx_runtime_1.jsxs)(Table, tslib_1.__assign({}, swipeableHandlers, { children: [(0, jsx_runtime_1.jsx)(TableHead, { children: (0, jsx_runtime_1.jsx)("tr", { children: days.map(function (day) { return ((0, jsx_runtime_1.jsx)(TableHeadCell, tslib_1.__assign({ scope: "column" }, { children: day }), day)); }) }) }), (0, jsx_runtime_1.jsx)(TableBody, { children: weeksEvents.map(function (week, i) { return ((0, jsx_runtime_1.jsx)(TableBodyRow, tslib_1.__assign({}, week.props, { children: week.days.map(function (day) { return ((0, jsx_runtime_1.jsxs)(TableBodyCell, tslib_1.__assign({}, day.props, { children: [(0, jsx_runtime_1.jsx)(TableBodyCellDate, tslib_1.__assign({}, day.props, { children: day.label })), day.events.length > 0 && ((0, jsx_runtime_1.jsx)(CalendarDaygridCell_1.CalendarDaygridCell, tslib_1.__assign({}, {
|
|
50
|
+
eventClicked: eventClicked,
|
|
51
|
+
setEventClicked: setEventClicked,
|
|
52
|
+
eventHovered: eventHovered,
|
|
53
|
+
setEventHovered: setEventHovered,
|
|
54
|
+
view: view,
|
|
55
|
+
maxEvents: maxEvents,
|
|
56
|
+
events: day.events,
|
|
57
|
+
timestamp: day.timestamp,
|
|
58
|
+
calendarsMap: calendarsMap,
|
|
59
|
+
}, restKoine)))] }))); }) }))); }) })] })));
|
|
59
60
|
};
|
|
60
61
|
exports.KoineCalendarDaygridTable = KoineCalendarDaygridTable;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.KoineCalendarLegend = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var KoineCalendarLegend = function (_a) {
|
|
6
7
|
// const sorted = Object.entries(calendarsMap).sort((a, b) => {
|
|
7
8
|
// const { name: nameA } = a[1];
|
|
8
9
|
// const { name: nameB } = b[1];
|
|
@@ -10,6 +11,10 @@ const KoineCalendarLegend = ({ calendarsMap = {}, toggleCalendarVisibility, Lege
|
|
|
10
11
|
// else if (nameA > nameB) return 1;
|
|
11
12
|
// else return 0;
|
|
12
13
|
// });
|
|
13
|
-
|
|
14
|
+
var _b = _a.calendarsMap, calendarsMap = _b === void 0 ? {} : _b, toggleCalendarVisibility = _a.toggleCalendarVisibility, _c = _a.LegendItem, LegendItem = _c === void 0 ? "div" : _c, _d = _a.LegendItemStatus, LegendItemStatus = _d === void 0 ? "span" : _d, _e = _a.LegendItemLabel, LegendItemLabel = _e === void 0 ? "span" : _e, _f = _a.LegendItemEvents, LegendItemEvents = _f === void 0 ? "span" : _f;
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: Object.entries(calendarsMap).map(function (_a) {
|
|
16
|
+
var id = _a[0], calendar = _a[1];
|
|
17
|
+
return ((0, jsx_runtime_1.jsxs)(LegendItem, tslib_1.__assign({ onClick: function () { return toggleCalendarVisibility(id); }, "$color": calendar.color, "$empty": calendar.events === 0, disabled: calendar.events === 0 }, { children: [(0, jsx_runtime_1.jsx)(LegendItemStatus, { children: calendar.on ? "\u2b24" : "\u2b58" }), (0, jsx_runtime_1.jsx)(LegendItemLabel, { children: calendar.name }), (0, jsx_runtime_1.jsx)(LegendItemEvents, { children: calendar.events })] }), "CalendarLegend." + id));
|
|
18
|
+
}) }));
|
|
14
19
|
};
|
|
15
20
|
exports.KoineCalendarLegend = KoineCalendarLegend;
|