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