@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/MenuItem/MenuItem.js
CHANGED
|
@@ -1,20 +1,4 @@
|
|
|
1
|
+
import { __makeTemplateObject } from "tslib";
|
|
1
2
|
import styled from "styled-components";
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
&[aria-selected="true"] {
|
|
6
|
-
background: var(--accent400);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/** DEP: this is just for MultiselectMui? */
|
|
10
|
-
&.Mui-focused,
|
|
11
|
-
&[data-focus="true"] {
|
|
12
|
-
background: var(--accent300);
|
|
13
|
-
color: white;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
&:not([disabled]):hover {
|
|
17
|
-
cursor: pointer;
|
|
18
|
-
background: var(--accent300);
|
|
19
|
-
}
|
|
20
|
-
`;
|
|
3
|
+
export var MenuItem = styled.li(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: 8px 16px;\n\n &[aria-selected=\"true\"] {\n background: var(--accent400);\n }\n\n /** DEP: this is just for MultiselectMui? */\n &.Mui-focused,\n &[data-focus=\"true\"] {\n background: var(--accent300);\n color: white;\n }\n\n &:not([disabled]):hover {\n cursor: pointer;\n background: var(--accent300);\n }\n"], ["\n padding: 8px 16px;\n\n &[aria-selected=\"true\"] {\n background: var(--accent400);\n }\n\n /** DEP: this is just for MultiselectMui? */\n &.Mui-focused,\n &[data-focus=\"true\"] {\n background: var(--accent300);\n color: white;\n }\n\n &:not([disabled]):hover {\n cursor: pointer;\n background: var(--accent300);\n }\n"])));
|
|
4
|
+
var templateObject_1;
|
package/Meta/Meta.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
export
|
|
3
|
-
|
|
2
|
+
export var Meta = function (_a) {
|
|
3
|
+
var zoom = _a.zoom;
|
|
4
|
+
return (_jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1, maximum-scale=1".concat(zoom ? "" : ", user-scalable=0") }));
|
|
4
5
|
};
|
package/NoJs/NoJs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
export
|
|
2
|
+
export var NoJs = function (_props) {
|
|
3
3
|
return (_jsx("script", { id: "no-js", dangerouslySetInnerHTML: {
|
|
4
|
-
__html:
|
|
4
|
+
__html: "document.querySelector(\"html\").className=document.querySelector(\"html\").className.replace(/no-js/,\"\") + \"js\";",
|
|
5
5
|
} }));
|
|
6
6
|
};
|
|
@@ -1,42 +1,16 @@
|
|
|
1
|
+
import { __assign, __makeTemplateObject } from "tslib";
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import styled from "styled-components";
|
|
3
4
|
import { CgArrowRightR as IconArrowRight, CgArrowLeftR as IconArrowLeft, } from "react-icons/cg";
|
|
4
5
|
import { ensureInt } from "@koine/utils";
|
|
5
|
-
|
|
6
|
-
display:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
text-decoration: none;
|
|
14
|
-
}
|
|
15
|
-
`;
|
|
16
|
-
const item = `
|
|
17
|
-
display: block;
|
|
18
|
-
padding: 5px 10px;
|
|
19
|
-
`;
|
|
20
|
-
const ItemCurrent = styled.span `
|
|
21
|
-
${item}
|
|
22
|
-
background: var(--accent400);
|
|
23
|
-
border-radius: 2px;
|
|
24
|
-
`;
|
|
25
|
-
const ItemLink = styled.a `
|
|
26
|
-
${item}
|
|
27
|
-
|
|
28
|
-
${(props) => (props.prev ? "color: var(--grey100);" : "")}
|
|
29
|
-
`;
|
|
30
|
-
const DotsSeparator = styled.span `
|
|
31
|
-
color: var(--grey100);
|
|
32
|
-
`;
|
|
33
|
-
const arrow = `display: flex; font-size: 20px;`;
|
|
34
|
-
const ItemPrev = styled.a `
|
|
35
|
-
${arrow}
|
|
36
|
-
`;
|
|
37
|
-
const ItemNext = styled.a `
|
|
38
|
-
${arrow}
|
|
39
|
-
`;
|
|
6
|
+
var Root = styled.nav(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 20px 0 40px;\n font-weight: 600;\n\n & a {\n text-decoration: none;\n }\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 20px 0 40px;\n font-weight: 600;\n\n & a {\n text-decoration: none;\n }\n"])));
|
|
7
|
+
var item = "\n display: block;\n padding: 5px 10px;\n";
|
|
8
|
+
var ItemCurrent = styled.span(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n background: var(--accent400);\n border-radius: 2px;\n"], ["\n ", "\n background: var(--accent400);\n border-radius: 2px;\n"])), item);
|
|
9
|
+
var ItemLink = styled.a(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n\n ", "\n"], ["\n ", "\n\n ", "\n"])), item, function (props) { return (props.prev ? "color: var(--grey100);" : ""); });
|
|
10
|
+
var DotsSeparator = styled.span(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n color: var(--grey100);\n"], ["\n color: var(--grey100);\n"])));
|
|
11
|
+
var arrow = "display: flex; font-size: 20px;";
|
|
12
|
+
var ItemPrev = styled.a(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), arrow);
|
|
13
|
+
var ItemNext = styled.a(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), arrow);
|
|
40
14
|
/*
|
|
41
15
|
* Possible outcomes:
|
|
42
16
|
* [1] 2 3 ... 78 >
|
|
@@ -45,7 +19,8 @@ const ItemNext = styled.a `
|
|
|
45
19
|
* < 1 ... 75 76 [77] 78 >
|
|
46
20
|
* < 1 ... 76 77 [78]
|
|
47
21
|
*/
|
|
48
|
-
export
|
|
22
|
+
export var KoinePaginationNav = function (_a) {
|
|
23
|
+
var total = _a.total, perPage = _a.perPage, currentPage = _a.currentPage, baseUrl = _a.baseUrl, _b = _a.showOffset, showOffset = _b === void 0 ? 2 : _b, _c = _a.currentUrl, currentUrl = _c === void 0 ? "/" : _c, _d = _a.Link, Link = _d === void 0 ? "a" : _d;
|
|
49
24
|
total = ensureInt(total);
|
|
50
25
|
currentPage = ensureInt(currentPage);
|
|
51
26
|
perPage = ensureInt(perPage);
|
|
@@ -56,15 +31,15 @@ export const KoinePaginationNav = ({ total, perPage, currentPage, baseUrl, showO
|
|
|
56
31
|
if (total < perPage) {
|
|
57
32
|
return null;
|
|
58
33
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
34
|
+
var firstPage = 1;
|
|
35
|
+
var lastPage = Math.ceil(total / perPage);
|
|
36
|
+
var prevPage = currentPage - 1 > firstPage ? currentPage - 1 : "";
|
|
37
|
+
var nextPage = currentPage + 1 < lastPage ? currentPage + 1 : lastPage;
|
|
38
|
+
var prevArrow = currentPage > firstPage;
|
|
39
|
+
var nextArrow = currentPage < lastPage;
|
|
40
|
+
var pages = [];
|
|
66
41
|
// fill the pages before the current
|
|
67
|
-
for (
|
|
42
|
+
for (var i = currentPage - showOffset; i < currentPage; i++) {
|
|
68
43
|
if (i > 1) {
|
|
69
44
|
pages.push(i);
|
|
70
45
|
}
|
|
@@ -72,12 +47,15 @@ export const KoinePaginationNav = ({ total, perPage, currentPage, baseUrl, showO
|
|
|
72
47
|
// add the current
|
|
73
48
|
pages.push(currentPage);
|
|
74
49
|
// fill the pages after the current
|
|
75
|
-
for (
|
|
50
|
+
for (var i = currentPage + 1; i < currentPage + 1 + showOffset; i++) {
|
|
76
51
|
if (i < lastPage) {
|
|
77
52
|
pages.push(i);
|
|
78
53
|
}
|
|
79
54
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return (_jsxs(Root, { children: [prevArrow && (_jsx(ItemPrev, { as: Link, href:
|
|
55
|
+
var prevDots = pages[0] > firstPage + 1;
|
|
56
|
+
var nextDots = pages[pages.length - 1] < lastPage - 1;
|
|
57
|
+
return (_jsxs(Root, { children: [prevArrow && (_jsx(ItemPrev, __assign({ as: Link, href: "".concat(baseUrl, "/").concat(prevPage) }, { children: _jsx(IconArrowLeft, {}) }))), firstPage !== currentPage && (_jsx(ItemLink, __assign({ as: Link, href: "".concat(baseUrl), prev: true }, { children: firstPage }))), prevDots && _jsx(DotsSeparator, { children: "..." }), pages.map(function (page) {
|
|
58
|
+
return page === currentPage ? (_jsx(ItemCurrent, { children: page }, page)) : (_jsx(ItemLink, __assign({ as: Link, href: "".concat(baseUrl, "/").concat(page), prev: page < currentPage, next: page > currentPage }, { children: page }), "pagination-".concat(page)));
|
|
59
|
+
}), nextDots && _jsx(DotsSeparator, { children: "..." }), lastPage !== currentPage && (_jsx(ItemLink, __assign({ as: Link, href: "".concat(baseUrl, "/").concat(lastPage), next: true }, { children: lastPage }))), nextArrow && (_jsx(ItemNext, __assign({ as: Link, href: "".concat(baseUrl, "/").concat(nextPage) }, { children: _jsx(IconArrowRight, {}) })))] }));
|
|
83
60
|
};
|
|
61
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { __assign, __makeTemplateObject } from "tslib";
|
|
1
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import styled from "styled-components";
|
|
3
4
|
import { AnimatePresence, m } from "framer-motion";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return (_jsx(AnimatePresence, { exitBeforeEnter: true, initial: true, children: _jsx(Root, { children: _jsx(Inner, { initial: { opacity: 0, x: -100 }, animate: { opacity: 1, x: 0 }, exit: { opacity: 0, x: 100 }, transition: { type: "linear", staggerChildren: 0.3 }, children: children }) }) }));
|
|
5
|
+
var Root = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n // overflow: hidden;\n"], ["\n // overflow: hidden;\n"])));
|
|
6
|
+
var Inner = styled(m.div)(templateObject_2 || (templateObject_2 = __makeTemplateObject([""], [""])));
|
|
7
|
+
export var PaginationResults = function (_a) {
|
|
8
|
+
var children = _a.children;
|
|
9
|
+
return (_jsx(AnimatePresence, __assign({ exitBeforeEnter: true, initial: true }, { children: _jsx(Root, { children: _jsx(Inner, __assign({ initial: { opacity: 0, x: -100 }, animate: { opacity: 1, x: 0 }, exit: { opacity: 0, x: 100 }, transition: { type: "linear", staggerChildren: 0.3 } }, { children: children })) }) })));
|
|
10
10
|
};
|
|
11
|
+
var templateObject_1, templateObject_2;
|
package/Pill/Pill.js
CHANGED
|
@@ -1,37 +1,7 @@
|
|
|
1
|
+
import { __makeTemplateObject } from "tslib";
|
|
1
2
|
import styled from "styled-components";
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
text-decoration: none;
|
|
8
|
-
font-size: 13px;
|
|
9
|
-
font-weight: 600;
|
|
10
|
-
`;
|
|
11
|
-
export const PillGreyLight = styled(Pill) `
|
|
12
|
-
background: var(--grey800);
|
|
13
|
-
color: var(--grey100);
|
|
14
|
-
|
|
15
|
-
&:hover {
|
|
16
|
-
color: white;
|
|
17
|
-
background: var(--grey300);
|
|
18
|
-
}
|
|
19
|
-
`;
|
|
20
|
-
export const PillAccentLight = styled(Pill) `
|
|
21
|
-
background: var(--accent400);
|
|
22
|
-
color: var(--grey100);
|
|
23
|
-
|
|
24
|
-
&:hover {
|
|
25
|
-
color: #fff;
|
|
26
|
-
background: var(--accent300);
|
|
27
|
-
}
|
|
28
|
-
`;
|
|
29
|
-
export const PillAccentLightOutlined = styled(Pill) `
|
|
30
|
-
border: 1px solid var(--accent300);
|
|
31
|
-
color: var(--accent200);
|
|
32
|
-
|
|
33
|
-
&:hover {
|
|
34
|
-
color: #fff;
|
|
35
|
-
background: var(--accent300);
|
|
36
|
-
}
|
|
37
|
-
`;
|
|
3
|
+
export var Pill = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: inline-block;\n padding: 5px 10px;\n margin: 0 0.5em 0.5em 0;\n border-radius: 2px;\n text-decoration: none;\n font-size: 13px;\n font-weight: 600;\n"], ["\n display: inline-block;\n padding: 5px 10px;\n margin: 0 0.5em 0.5em 0;\n border-radius: 2px;\n text-decoration: none;\n font-size: 13px;\n font-weight: 600;\n"])));
|
|
4
|
+
export var PillGreyLight = styled(Pill)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background: var(--grey800);\n color: var(--grey100);\n\n &:hover {\n color: white;\n background: var(--grey300);\n }\n"], ["\n background: var(--grey800);\n color: var(--grey100);\n\n &:hover {\n color: white;\n background: var(--grey300);\n }\n"])));
|
|
5
|
+
export var PillAccentLight = styled(Pill)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n background: var(--accent400);\n color: var(--grey100);\n\n &:hover {\n color: #fff;\n background: var(--accent300);\n }\n"], ["\n background: var(--accent400);\n color: var(--grey100);\n\n &:hover {\n color: #fff;\n background: var(--accent300);\n }\n"])));
|
|
6
|
+
export var PillAccentLightOutlined = styled(Pill)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n border: 1px solid var(--accent300);\n color: var(--accent200);\n\n &:hover {\n color: #fff;\n background: var(--accent300);\n }\n"], ["\n border: 1px solid var(--accent300);\n color: var(--accent200);\n\n &:hover {\n color: #fff;\n background: var(--accent300);\n }\n"])));
|
|
7
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -1,36 +1,15 @@
|
|
|
1
|
+
import { __assign, __makeTemplateObject, __rest } from "tslib";
|
|
1
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import styled, { keyframes } from "styled-components";
|
|
3
|
-
|
|
4
|
-
0% {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
100% {
|
|
8
|
-
transform: rotate(360deg);
|
|
9
|
-
}
|
|
10
|
-
`;
|
|
11
|
-
const animationCircle = keyframes `
|
|
12
|
-
0% {
|
|
13
|
-
stroke-dasharray: 1px, 200px;
|
|
14
|
-
stroke-dashoffset: 0;
|
|
15
|
-
}
|
|
16
|
-
50% {
|
|
17
|
-
stroke-dasharray: 100px, 200px;
|
|
18
|
-
stroke-dashoffset: -15px;
|
|
19
|
-
}
|
|
20
|
-
100% {
|
|
21
|
-
stroke-dasharray: 100px, 200px;
|
|
22
|
-
stroke-dashoffset: -125px;
|
|
23
|
-
}
|
|
24
|
-
`;
|
|
25
|
-
const ProgressCircularSvg = styled.svg `
|
|
26
|
-
animation: ${animationRotation} 1.5s linear infinite;
|
|
27
|
-
`;
|
|
28
|
-
const ProgressCircularCircle = styled.circle `
|
|
29
|
-
animation: ${animationCircle} 1.5s linear infinite;
|
|
30
|
-
`;
|
|
4
|
+
var animationRotation = keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n"], ["\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n"])));
|
|
5
|
+
var animationCircle = keyframes(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n 0% {\n stroke-dasharray: 1px, 200px;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 100px, 200px;\n stroke-dashoffset: -15px;\n }\n 100% {\n stroke-dasharray: 100px, 200px;\n stroke-dashoffset: -125px;\n }\n"], ["\n 0% {\n stroke-dasharray: 1px, 200px;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 100px, 200px;\n stroke-dashoffset: -15px;\n }\n 100% {\n stroke-dasharray: 100px, 200px;\n stroke-dashoffset: -125px;\n }\n"])));
|
|
6
|
+
var ProgressCircularSvg = styled.svg(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n animation: ", " 1.5s linear infinite;\n"], ["\n animation: ", " 1.5s linear infinite;\n"])), animationRotation);
|
|
7
|
+
var ProgressCircularCircle = styled.circle(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n animation: ", " 1.5s linear infinite;\n"], ["\n animation: ", " 1.5s linear infinite;\n"])), animationCircle);
|
|
31
8
|
/**
|
|
32
9
|
* @see https://mui.com/components/progress/
|
|
33
10
|
*/
|
|
34
|
-
export
|
|
35
|
-
|
|
11
|
+
export var ProgressCircular = function (_a) {
|
|
12
|
+
var _b = _a.size, size = _b === void 0 ? "1em" : _b, _c = _a.thickness, thickness = _c === void 0 ? 1 : _c, _d = _a.color, color = _d === void 0 ? "currentColor" : _d, props = __rest(_a, ["size", "thickness", "color"]);
|
|
13
|
+
return (_jsx(ProgressCircularSvg, __assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 44 44", style: { width: size, height: size } }, props, { children: _jsx(ProgressCircularCircle, { cx: "22", cy: "22", r: "20", fill: "none", strokeWidth: thickness, style: { stroke: color } }) })));
|
|
36
14
|
};
|
|
15
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -1,24 +1,15 @@
|
|
|
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 { m } from "framer-motion";
|
|
4
|
-
|
|
5
|
-
position:
|
|
6
|
-
overflow: hidden;
|
|
7
|
-
display: block;
|
|
8
|
-
height: 4px;
|
|
9
|
-
`;
|
|
10
|
-
const ProgressLinearFg = styled(m.span) `
|
|
11
|
-
position: absolute;
|
|
12
|
-
top: 0;
|
|
13
|
-
bottom: 0;
|
|
14
|
-
left: 0;
|
|
15
|
-
width: 100%;
|
|
16
|
-
`;
|
|
5
|
+
var ProgressLinearBg = styled.span(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n overflow: hidden;\n display: block;\n height: 4px;\n"], ["\n position: relative;\n overflow: hidden;\n display: block;\n height: 4px;\n"])));
|
|
6
|
+
var ProgressLinearFg = styled(m.span)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n"], ["\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n"])));
|
|
17
7
|
/**
|
|
18
8
|
* @see https://mui.com/components/progress/#linear
|
|
19
9
|
*/
|
|
20
|
-
export
|
|
21
|
-
|
|
10
|
+
export var ProgressLinear = function (_a) {
|
|
11
|
+
var _b = _a.done, done = _b === void 0 ? false : _b, _c = _a.height, height = _c === void 0 ? "2px" : _c, _d = _a.bg, bg = _d === void 0 ? "transparent" : _d, _e = _a.fg, fg = _e === void 0 ? "currentColor" : _e, props = __rest(_a, ["done", "height", "bg", "fg"]);
|
|
12
|
+
return (_jsx(ProgressLinearBg, __assign({ style: { height: height, background: bg } }, props, { children: _jsx(ProgressLinearFg, { style: { height: height, background: fg }, initial: {
|
|
22
13
|
x: "-100%",
|
|
23
14
|
}, animate: {
|
|
24
15
|
x: done ? "-100%" : "0%",
|
|
@@ -28,5 +19,6 @@ export const ProgressLinear = ({ done = false, height = "2px", bg = "transparent
|
|
|
28
19
|
repeat: Infinity,
|
|
29
20
|
repeatType: "reverse",
|
|
30
21
|
duration: 2,
|
|
31
|
-
} }) }));
|
|
22
|
+
} }) })));
|
|
32
23
|
};
|
|
24
|
+
var templateObject_1, templateObject_2;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __assign, __makeTemplateObject } from "tslib";
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { useEffect } from "react";
|
|
3
4
|
import styled from "styled-components";
|
|
@@ -5,36 +6,19 @@ import { m } from "framer-motion";
|
|
|
5
6
|
import { ProgressCircular } from "./ProgressCircular";
|
|
6
7
|
import { ProgressLinear } from "./ProgressLinear";
|
|
7
8
|
import { useHeader } from "../Header";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
right: 0;
|
|
14
|
-
bottom: 0;
|
|
15
|
-
pointer-events: none;
|
|
16
|
-
cursor: wait;
|
|
17
|
-
`;
|
|
18
|
-
const ProgressOverlayCenterer = styled.div `
|
|
19
|
-
position: absolute;
|
|
20
|
-
top: 0;
|
|
21
|
-
left: 0;
|
|
22
|
-
right: 0;
|
|
23
|
-
bottom: 0;
|
|
24
|
-
display: flex;
|
|
25
|
-
align-items: center;
|
|
26
|
-
justify-content: center;
|
|
27
|
-
background: var(--progress-overlay-bg);
|
|
28
|
-
`;
|
|
29
|
-
export const ProgressOverlay = ({ running }) => {
|
|
30
|
-
const [, , headerHeight] = useHeader();
|
|
9
|
+
var ProgressOverlayWrap = styled(m.div)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n z-index: 10000;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n cursor: wait;\n"], ["\n z-index: 10000;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n cursor: wait;\n"])));
|
|
10
|
+
var ProgressOverlayCenterer = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: var(--progress-overlay-bg);\n"], ["\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: var(--progress-overlay-bg);\n"])));
|
|
11
|
+
export var ProgressOverlay = function (_a) {
|
|
12
|
+
var running = _a.running;
|
|
13
|
+
var _b = useHeader(), headerHeight = _b[2];
|
|
31
14
|
// const [progress, setProgress] = useState(0);
|
|
32
|
-
useEffect(()
|
|
15
|
+
useEffect(function () {
|
|
33
16
|
document.body.style.cursor = running ? "wait" : "";
|
|
34
17
|
}, [running]);
|
|
35
|
-
return (_jsxs(ProgressOverlayWrap, { animate: {
|
|
18
|
+
return (_jsxs(ProgressOverlayWrap, __assign({ animate: {
|
|
36
19
|
opacity: running ? 1 : 0,
|
|
37
|
-
}, initial: { opacity: 0 }, transition: { type: "easeInOut" }, children: [_jsx(ProgressLinear, { bg: "var(--accent400)", fg: "var(--accent300)", done: !running }), _jsx(ProgressOverlayCenterer, { style: {
|
|
20
|
+
}, initial: { opacity: 0 }, transition: { type: "easeInOut" } }, { children: [_jsx(ProgressLinear, { bg: "var(--accent400)", fg: "var(--accent300)", done: !running }), _jsx(ProgressOverlayCenterer, __assign({ style: {
|
|
38
21
|
top: headerHeight + "px",
|
|
39
|
-
}, children: _jsx(ProgressCircular, { size: "50px", color: "var(--accent300)" }) })] }));
|
|
22
|
+
} }, { children: _jsx(ProgressCircular, { size: "50px", color: "var(--accent300)" }) }))] })));
|
|
40
23
|
};
|
|
24
|
+
var templateObject_1, templateObject_2;
|
package/Rating/Rating.js
CHANGED
|
@@ -1,49 +1,28 @@
|
|
|
1
|
+
import { __assign, __makeTemplateObject, __rest } from "tslib";
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { useCallback, useEffect, /* useId, */ useState } from "react";
|
|
3
4
|
import styled from "styled-components";
|
|
4
5
|
import { useId } from "../hooks/useId";
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export const RatingStar = ({ value, colorBg = "#FFD84C", colorStroke = "#947813", size, ...props }) => {
|
|
11
|
-
const id = useId();
|
|
12
|
-
return (_jsxs(RatingStarRoot, { viewBox: "0 0 16 16", "data-value": value, width: size + "px", height: size + "px", ...props, children: [_jsx("defs", { children: _jsxs("linearGradient", { id: id, x1: "0", y1: "0", x2: "1", y2: "0", children: [_jsx("stop", { offset: "0", stopColor: colorBg }), _jsx("stop", { offset: value, stopColor: colorBg }), _jsx("stop", { offset: value, stopColor: "rgba(255, 255, 255, 0)" })] }) }), _jsx("path", { stroke: colorStroke, strokeWidth: "0.5", fill: `url(#${id})`, d: "M3.612 15.443c-.386.198-.824-.149-.746-.592l.83-4.73L.173 6.765c-.329-.314-.158-.888.283-.95l4.898-.696L7.538.792c.197-.39.73-.39.927 0l2.184 4.327 4.898.696c.441.062.612.636.283.95l-3.523 3.356.83 4.73c.078.443-.36.79-.746.592L8 13.187l-4.389 2.256z" })] }));
|
|
6
|
+
export var RatingStarRoot = styled.svg(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: inline-block;\n vertical-align: middle;\n margin-right: 1px;\n"], ["\n display: inline-block;\n vertical-align: middle;\n margin-right: 1px;\n"])));
|
|
7
|
+
export var RatingStar = function (_a) {
|
|
8
|
+
var value = _a.value, _b = _a.colorBg, colorBg = _b === void 0 ? "#FFD84C" : _b, _c = _a.colorStroke, colorStroke = _c === void 0 ? "#947813" : _c, size = _a.size, props = __rest(_a, ["value", "colorBg", "colorStroke", "size"]);
|
|
9
|
+
var id = useId();
|
|
10
|
+
return (_jsxs(RatingStarRoot, __assign({ viewBox: "0 0 16 16", "data-value": value, width: size + "px", height: size + "px" }, props, { children: [_jsx("defs", { children: _jsxs("linearGradient", __assign({ id: id, x1: "0", y1: "0", x2: "1", y2: "0" }, { children: [_jsx("stop", { offset: "0", stopColor: colorBg }), _jsx("stop", { offset: value, stopColor: colorBg }), _jsx("stop", { offset: value, stopColor: "rgba(255, 255, 255, 0)" })] })) }), _jsx("path", { stroke: colorStroke, strokeWidth: "0.5", fill: "url(#".concat(id, ")"), d: "M3.612 15.443c-.386.198-.824-.149-.746-.592l.83-4.73L.173 6.765c-.329-.314-.158-.888.283-.95l4.898-.696L7.538.792c.197-.39.73-.39.927 0l2.184 4.327 4.898.696c.441.062.612.636.283.95l-3.523 3.356.83 4.73c.078.443-.36.79-.746.592L8 13.187l-4.389 2.256z" })] })));
|
|
13
11
|
};
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
display: none;
|
|
29
|
-
`;
|
|
30
|
-
export const RatingRoot = styled.div `
|
|
31
|
-
display: flex;
|
|
32
|
-
align-items: center;
|
|
33
|
-
|
|
34
|
-
&:hover ${RatingValue} {
|
|
35
|
-
display: inline-block;
|
|
36
|
-
}
|
|
37
|
-
`;
|
|
38
|
-
export const Rating = ({ value = 0, count, min = 0, max = 5, showDetails = true, colorBg, colorStroke, starSize = 16, }) => {
|
|
39
|
-
const id = useId();
|
|
40
|
-
const [currentValue /* , _setCurrentValue */] = useState(value);
|
|
41
|
-
const [stars, setStars] = useState([]);
|
|
42
|
-
const getStars = useCallback((activeCount) => {
|
|
43
|
-
const stars = [];
|
|
44
|
-
for (let currentStar = min + 1; currentStar < max + 1; currentStar++) {
|
|
45
|
-
let starValue;
|
|
46
|
-
const roundedActiveCount = Math.floor(activeCount);
|
|
12
|
+
export var RatingDetails = styled.span(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding-left: 0.5em;\n font-size: 12px;\n color: var(--grey100);\n\n &:before {\n content: \"(\";\n }\n &:after {\n content: \")\";\n }\n"], ["\n padding-left: 0.5em;\n font-size: 12px;\n color: var(--grey100);\n\n &:before {\n content: \"(\";\n }\n &:after {\n content: \")\";\n }\n"])));
|
|
13
|
+
export var RatingCount = styled.span(templateObject_3 || (templateObject_3 = __makeTemplateObject([""], [""])));
|
|
14
|
+
export var RatingValue = styled.span(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: none;\n"], ["\n display: none;\n"])));
|
|
15
|
+
export var RatingRoot = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n\n &:hover ", " {\n display: inline-block;\n }\n"], ["\n display: flex;\n align-items: center;\n\n &:hover ", " {\n display: inline-block;\n }\n"])), RatingValue);
|
|
16
|
+
export var Rating = function (_a) {
|
|
17
|
+
var _b = _a.value, value = _b === void 0 ? 0 : _b, count = _a.count, _c = _a.min, min = _c === void 0 ? 0 : _c, _d = _a.max, max = _d === void 0 ? 5 : _d, _e = _a.showDetails, showDetails = _e === void 0 ? true : _e, colorBg = _a.colorBg, colorStroke = _a.colorStroke, _f = _a.starSize, starSize = _f === void 0 ? 16 : _f;
|
|
18
|
+
var id = useId();
|
|
19
|
+
var currentValue = useState(value)[0] /* , _setCurrentValue */;
|
|
20
|
+
var _g = useState([]), stars = _g[0], setStars = _g[1];
|
|
21
|
+
var getStars = useCallback(function (activeCount) {
|
|
22
|
+
var stars = [];
|
|
23
|
+
for (var currentStar = min + 1; currentStar < max + 1; currentStar++) {
|
|
24
|
+
var starValue = void 0;
|
|
25
|
+
var roundedActiveCount = Math.floor(activeCount);
|
|
47
26
|
// we have a rating of 3.4, when we get to the 4th star:
|
|
48
27
|
if (roundedActiveCount === currentStar - 1) {
|
|
49
28
|
starValue = 1 - (currentStar - activeCount);
|
|
@@ -58,7 +37,7 @@ export const Rating = ({ value = 0, count, min = 0, max = 5, showDetails = true,
|
|
|
58
37
|
}
|
|
59
38
|
return stars;
|
|
60
39
|
}, [min, max]);
|
|
61
|
-
useEffect(()
|
|
40
|
+
useEffect(function () {
|
|
62
41
|
setStars(getStars(currentValue));
|
|
63
42
|
}, [currentValue, getStars]);
|
|
64
43
|
// function updateStars(index) {
|
|
@@ -83,9 +62,10 @@ export const Rating = ({ value = 0, count, min = 0, max = 5, showDetails = true,
|
|
|
83
62
|
// onChange(value);
|
|
84
63
|
// }
|
|
85
64
|
// }, [onChange];
|
|
86
|
-
return (_jsxs(RatingRoot, { children: [stars.map((star, idx)
|
|
65
|
+
return (_jsxs(RatingRoot, { children: [stars.map(function (star, idx) { return (_jsx(RatingStar, { idx: idx, dataIdx: idx, size: starSize,
|
|
87
66
|
// onMouseOver={handleMouseOver}
|
|
88
67
|
// onMouseLeave={handleMouseLeave}
|
|
89
68
|
// onClick={handleClick}
|
|
90
|
-
value: star.value, colorBg: colorBg, colorStroke: colorStroke }, id + idx))), " ", showDetails && count && (_jsxs(RatingDetails, { children: [_jsx(RatingCount, { children: count }), _jsx(RatingValue, { children:
|
|
69
|
+
value: star.value, colorBg: colorBg, colorStroke: colorStroke }, id + idx)); }), " ", showDetails && count && (_jsxs(RatingDetails, { children: [_jsx(RatingCount, { children: count }), _jsx(RatingValue, { children: " - ".concat(value) })] }))] }));
|
|
91
70
|
};
|
|
71
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
package/Rating/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "./Rating";
|
|
2
|
-
|
|
2
|
+
var RATING_WORDS = {
|
|
3
3
|
0: "Worst",
|
|
4
4
|
1: "Bad",
|
|
5
5
|
2: "Mediocre",
|
|
@@ -8,9 +8,10 @@ const RATING_WORDS = {
|
|
|
8
8
|
4.5: "Excellent",
|
|
9
9
|
5: "Best",
|
|
10
10
|
};
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
export var getRatingWord = function (value, precision) {
|
|
12
|
+
if (precision === void 0) { precision = 0.5; }
|
|
13
|
+
var buffer = 0;
|
|
14
|
+
var word;
|
|
14
15
|
while (buffer < value) {
|
|
15
16
|
// @ts-expect-error can't remember
|
|
16
17
|
word = RATING_WORDS[buffer];
|
|
@@ -18,8 +19,8 @@ export const getRatingWord = (value, precision = 0.5) => {
|
|
|
18
19
|
}
|
|
19
20
|
return word;
|
|
20
21
|
};
|
|
21
|
-
export
|
|
22
|
-
|
|
22
|
+
export var getRatingValue = function (value) {
|
|
23
|
+
var converted = convertRange(value, [0, 5], [0, 10]);
|
|
23
24
|
if (converted % 1 === 0) {
|
|
24
25
|
return converted;
|
|
25
26
|
}
|
|
@@ -31,15 +32,18 @@ export const getRatingValue = (value) => {
|
|
|
31
32
|
export function convertRange(value, r1, r2) {
|
|
32
33
|
return ((value - r1[0]) * (r2[1] - r2[0])) / (r1[1] - r1[0]) + r2[0];
|
|
33
34
|
}
|
|
34
|
-
export
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
export var deriveRating = function (title, date, minValue, maxValue, minQuantity) {
|
|
36
|
+
if (minValue === void 0) { minValue = 3.8; }
|
|
37
|
+
if (maxValue === void 0) { maxValue = 5; }
|
|
38
|
+
if (minQuantity === void 0) { minQuantity = 9; }
|
|
39
|
+
var entityTime = date.getTime();
|
|
40
|
+
var nowTime = new Date().getTime();
|
|
41
|
+
var length = title.length;
|
|
42
|
+
var value = Number(convertRange(length, [0, 90], [minValue, maxValue]).toFixed(2));
|
|
43
|
+
var timeDifference = convertRange(nowTime - entityTime, [0, 10000000000000], [minQuantity, 999999]);
|
|
44
|
+
var count = Math.round(timeDifference / length);
|
|
41
45
|
return {
|
|
42
|
-
value,
|
|
43
|
-
count,
|
|
46
|
+
value: value,
|
|
47
|
+
count: count,
|
|
44
48
|
};
|
|
45
49
|
};
|
package/Select/components.js
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
|
+
import { __assign, __makeTemplateObject, __rest } from "tslib";
|
|
1
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import { forwardRef } from "react";
|
|
3
4
|
import styled from "styled-components";
|
|
4
5
|
import { m } from "framer-motion";
|
|
5
6
|
import { BsBoxArrowInDown as IconCollapse } from "react-icons/bs";
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
width: 2em;
|
|
11
|
-
|
|
12
|
-
&:not([disabled]) {
|
|
13
|
-
cursor: pointer;
|
|
14
|
-
}
|
|
15
|
-
`;
|
|
16
|
-
export const SelectArrow = forwardRef(function SelectArrow({ isOpen, ...props }, ref) {
|
|
17
|
-
return (_jsx(SelectArrowStyled, { animate: { rotate: isOpen ? 180 : 0 }, ref: ref, ...props, children: _jsx(IconCollapse, {}) }));
|
|
7
|
+
export var SelectArrowStyled = styled(m.span)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 2em;\n\n &:not([disabled]) {\n cursor: pointer;\n }\n"], ["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 2em;\n\n &:not([disabled]) {\n cursor: pointer;\n }\n"])));
|
|
8
|
+
export var SelectArrow = forwardRef(function SelectArrow(_a, ref) {
|
|
9
|
+
var isOpen = _a.isOpen, props = __rest(_a, ["isOpen"]);
|
|
10
|
+
return (_jsx(SelectArrowStyled, __assign({ animate: { rotate: isOpen ? 180 : 0 }, ref: ref }, props, { children: _jsx(IconCollapse, {}) })));
|
|
18
11
|
});
|
|
12
|
+
var templateObject_1;
|
package/Sidebar/Sidebar.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __assign, __makeTemplateObject } from "tslib";
|
|
1
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { useCallback, useState } from "react";
|
|
3
4
|
import styled from "styled-components";
|
|
@@ -6,43 +7,17 @@ import { CgCloseR as IconClose } from "react-icons/cg";
|
|
|
6
7
|
import { max, min } from "../styles/media";
|
|
7
8
|
import { IconButtonFab } from "../Buttons";
|
|
8
9
|
import { useHeader } from "../Header";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
padding: var(--gutter-half);
|
|
20
|
-
transform: ${p.$open ? `translateX(0)` : `translateX(100%)`};
|
|
21
|
-
transition: transform .18s ease-in-out, box-shadow .18s ease-in-out;
|
|
22
|
-
background: white;
|
|
23
|
-
box-shadow: ${p.$open ? `0 0 0 100vh rgba(0, 0, 0, .3)` : `0 0 100vh rgba(0, 0, 0, 0)`};
|
|
24
|
-
will-change: transform, box-shadow;
|
|
25
|
-
pointer-events: ${p.$open ? "all" : "none"}
|
|
26
|
-
}`}
|
|
27
|
-
`;
|
|
28
|
-
const SidebarToggle = styled.span `
|
|
29
|
-
z-index: 21;
|
|
30
|
-
position: fixed;
|
|
31
|
-
right: var(--gutter-half);
|
|
32
|
-
bottom: var(--gutter-half);
|
|
33
|
-
${min.md} {
|
|
34
|
-
display: none;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
path {
|
|
38
|
-
stroke: currentColor;
|
|
39
|
-
}
|
|
40
|
-
`;
|
|
41
|
-
export const Sidebar = ({ children }) => {
|
|
42
|
-
const [open, setOpen] = useState(false);
|
|
43
|
-
const [, , headerHeight] = useHeader();
|
|
44
|
-
const handleClickToggle = useCallback(() => {
|
|
45
|
-
setOpen((prevOpen) => !prevOpen);
|
|
10
|
+
var SidebarWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (p) {
|
|
11
|
+
return "".concat(max.md, " {\n z-index: 20;\n display: flex;\n flex-direction: column;\n position: fixed;\n right: 0;\n left: var(--gutter-half);\n top: ").concat(p.$top || 0, "px;\n bottom: 0;\n padding: var(--gutter-half);\n transform: ").concat(p.$open ? "translateX(0)" : "translateX(100%)", ";\n transition: transform .18s ease-in-out, box-shadow .18s ease-in-out;\n background: white;\n box-shadow: ").concat(p.$open ? "0 0 0 100vh rgba(0, 0, 0, .3)" : "0 0 100vh rgba(0, 0, 0, 0)", ";\n will-change: transform, box-shadow;\n pointer-events: ").concat(p.$open ? "all" : "none", "\n }");
|
|
12
|
+
});
|
|
13
|
+
var SidebarToggle = styled.span(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n z-index: 21;\n position: fixed;\n right: var(--gutter-half);\n bottom: var(--gutter-half);\n ", " {\n display: none;\n }\n\n path {\n stroke: currentColor;\n }\n"], ["\n z-index: 21;\n position: fixed;\n right: var(--gutter-half);\n bottom: var(--gutter-half);\n ", " {\n display: none;\n }\n\n path {\n stroke: currentColor;\n }\n"])), min.md);
|
|
14
|
+
export var Sidebar = function (_a) {
|
|
15
|
+
var children = _a.children;
|
|
16
|
+
var _b = useState(false), open = _b[0], setOpen = _b[1];
|
|
17
|
+
var _c = useHeader(), headerHeight = _c[2];
|
|
18
|
+
var handleClickToggle = useCallback(function () {
|
|
19
|
+
setOpen(function (prevOpen) { return !prevOpen; });
|
|
46
20
|
}, []);
|
|
47
|
-
return (_jsxs(_Fragment, { children: [_jsx(SidebarToggle, { onClick: handleClickToggle, children: _jsx(IconButtonFab, { "$variant": "contained", children: open ? _jsx(IconClose, {}) : _jsx(IconOpen, {}) }) }), _jsx(SidebarWrapper, { "$open": open, "$top": headerHeight, children: children })] }));
|
|
21
|
+
return (_jsxs(_Fragment, { children: [_jsx(SidebarToggle, __assign({ onClick: handleClickToggle }, { children: _jsx(IconButtonFab, __assign({ "$variant": "contained" }, { children: open ? _jsx(IconClose, {}) : _jsx(IconOpen, {}) })) })), _jsx(SidebarWrapper, __assign({ "$open": open, "$top": headerHeight }, { children: children }))] }));
|
|
48
22
|
};
|
|
23
|
+
var templateObject_1, templateObject_2;
|