@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
package/Alert/Alert.js
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
padding: 1em;
|
|
9
|
-
background-color: rgba(0, 0, 0, 0.05);
|
|
10
|
-
/* border: 1px solid var(--grey700); */
|
|
11
|
-
/* background: pink; */
|
|
12
|
-
/* color: red; */
|
|
13
|
-
`;
|
|
14
|
-
export const Alert = ({ $danger, children, ...props }) => {
|
|
15
|
-
return (_jsx(AlertRoot, { "$danger": $danger, ...props, children: _jsx(AlertInner, { children: children }) }));
|
|
4
|
+
var AlertRoot = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-size: 12px;\n ", "\n"], ["\n font-size: 12px;\n ", "\n"])), function (p) { return (p.$danger ? "color: var(--danger)" : ""); });
|
|
5
|
+
var AlertInner = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding: 1em;\n background-color: rgba(0, 0, 0, 0.05);\n /* border: 1px solid var(--grey700); */\n /* background: pink; */\n /* color: red; */\n"], ["\n padding: 1em;\n background-color: rgba(0, 0, 0, 0.05);\n /* border: 1px solid var(--grey700); */\n /* background: pink; */\n /* color: red; */\n"])));
|
|
6
|
+
export var Alert = function (_a) {
|
|
7
|
+
var $danger = _a.$danger, children = _a.children, props = __rest(_a, ["$danger", "children"]);
|
|
8
|
+
return (_jsx(AlertRoot, __assign({ "$danger": $danger }, props, { children: _jsx(AlertInner, { children: children }) })));
|
|
16
9
|
};
|
|
10
|
+
var templateObject_1, templateObject_2;
|
package/Animations/Reveal.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
+
import { __assign, __rest } from "tslib";
|
|
1
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import { motion, useViewportScroll, useTransform, useSpring, useReducedMotion, } from "framer-motion";
|
|
3
4
|
import { useReveal } from "./useReveal";
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
export var Reveal = function (_a) {
|
|
6
|
+
var children = _a.children, direction = _a.direction, offsetStartY = _a.offsetStartY, offsetEndY = _a.offsetEndY, offsetStartX = _a.offsetStartX, props = __rest(_a, ["children", "direction", "offsetStartY", "offsetEndY", "offsetStartX"]);
|
|
7
|
+
var effectOptions = { direction: direction, offsetStartY: offsetStartY, offsetEndY: offsetEndY, offsetStartX: offsetStartX };
|
|
8
|
+
var prefersReducedMotion = useReducedMotion();
|
|
9
|
+
var _b = useReveal(effectOptions), ref = _b.ref, startY = _b.startY, endY = _b.endY, startX = _b.startX;
|
|
10
|
+
var scrollYProgress = useViewportScroll().scrollYProgress;
|
|
11
|
+
var xRange = useTransform(scrollYProgress, [startY, endY], [startX, 0]);
|
|
12
|
+
var opacityRange = useTransform(scrollYProgress, [startY, endY], [0, 1]);
|
|
13
|
+
var x = useSpring(xRange, { stiffness: 400, damping: 90 });
|
|
14
|
+
var opacity = useSpring(opacityRange);
|
|
13
15
|
// console.log("start, end", startY, endY)
|
|
14
|
-
return (_jsx(motion.div, {
|
|
16
|
+
return (_jsx(motion.div, __assign({}, props, { ref: ref, style: prefersReducedMotion ? {} : { x: x, opacity: opacity } }, { children: children })));
|
|
15
17
|
};
|
package/Animations/Underline.js
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
|
+
import { __makeTemplateObject } from "tslib";
|
|
1
2
|
import styled from "styled-components";
|
|
2
3
|
import { m } from "framer-motion";
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
position: absolute;
|
|
6
|
-
top: 50%;
|
|
7
|
-
left: 15%;
|
|
8
|
-
right: 15%;
|
|
9
|
-
height: 20px;
|
|
10
|
-
margin-top: -10px;
|
|
11
|
-
z-index: 0;
|
|
12
|
-
pointer-events: none;
|
|
13
|
-
background: var(--accent400);
|
|
14
|
-
transform: skewY(-5deg);
|
|
15
|
-
`;
|
|
4
|
+
export var UnderlineSkewed = styled(m.i)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: block;\n position: absolute;\n top: 50%;\n left: 15%;\n right: 15%;\n height: 20px;\n margin-top: -10px;\n z-index: 0;\n pointer-events: none;\n background: var(--accent400);\n transform: skewY(-5deg);\n"], ["\n display: block;\n position: absolute;\n top: 50%;\n left: 15%;\n right: 15%;\n height: 20px;\n margin-top: -10px;\n z-index: 0;\n pointer-events: none;\n background: var(--accent400);\n transform: skewY(-5deg);\n"])));
|
|
5
|
+
var templateObject_1;
|
package/Animations/useReveal.js
CHANGED
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
import { useRef, useState, useEffect } from "react";
|
|
2
|
-
export function useReveal(
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
export function useReveal(_a) {
|
|
3
|
+
var _b = _a.direction, direction = _b === void 0 ? "left" : _b, _c = _a.offsetStartY, offsetStartY = _c === void 0 ? -2 : _c, _d = _a.offsetEndY, offsetEndY = _d === void 0 ? 0 : _d, _e = _a.offsetStartX, offsetStartX = _e === void 0 ? "all" : _e;
|
|
4
|
+
var ref = useRef(null);
|
|
5
|
+
var _f = useState(0), startY = _f[0], setStartY = _f[1];
|
|
6
|
+
var _g = useState(0), endY = _g[0], setEndY = _g[1];
|
|
7
|
+
var _h = useState(0), startX = _h[0], setStartX = _h[1];
|
|
8
|
+
useEffect(function () {
|
|
8
9
|
if (!ref.current) {
|
|
9
10
|
return;
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
+
var rect = ref.current.getBoundingClientRect();
|
|
12
13
|
// scroll position from top of the window
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
var scrollTop = window.scrollY || document.documentElement.scrollTop;
|
|
15
|
+
var elementHeight = rect.height;
|
|
15
16
|
// rect.top is the distance from the currently visible viewport to the top
|
|
16
17
|
// of the given element
|
|
17
18
|
// so distanceTop is the distance between the top edge of the window and the
|
|
18
19
|
// top edge of the given element
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
var elementTop = rect.top;
|
|
21
|
+
var distanceTop = elementTop + scrollTop;
|
|
22
|
+
var offsetTop = offsetStartY ? elementHeight * offsetStartY : 0;
|
|
23
|
+
var offsetBottom = offsetEndY ? elementHeight * offsetEndY : offsetTop;
|
|
23
24
|
// the distance of the element from the top divided by the full height
|
|
24
25
|
// of the window gives back the start position of the given element in
|
|
25
26
|
// a scale from 0 to 1
|
|
26
|
-
|
|
27
|
+
var startY = (distanceTop + offsetTop) / document.body.clientHeight;
|
|
27
28
|
// same for the end, we just add the given element height to the first value
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
var endY = (distanceTop + elementHeight + offsetBottom) / document.body.clientHeight;
|
|
30
|
+
var startX;
|
|
30
31
|
if (offsetStartX === "all") {
|
|
31
32
|
startX = direction === "left" ? -rect.right : rect.left;
|
|
32
33
|
}
|
|
@@ -51,7 +52,7 @@ export function useReveal({ direction = "left", offsetStartY = -2, offsetEndY =
|
|
|
51
52
|
offsetStartX,
|
|
52
53
|
direction,
|
|
53
54
|
]);
|
|
54
|
-
return { ref, startY, endY, startX };
|
|
55
|
+
return { ref: ref, startY: startY, endY: endY, startX: startX };
|
|
55
56
|
}
|
|
56
57
|
// function addMarker(top: string, color = "red", position = "absolute") {
|
|
57
58
|
// const div = document.createElement("div");
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __assign, __awaiter, __generator, __rest } from "tslib";
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import {
|
|
3
4
|
// forwardRef,
|
|
@@ -60,13 +61,14 @@ import { InputProgress } from "../Forms/styles";
|
|
|
60
61
|
// },
|
|
61
62
|
// ref
|
|
62
63
|
// ) {
|
|
63
|
-
export
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
export var Autocomplete = function (_a) {
|
|
65
|
+
var creatable = _a.creatable, multiple = _a.multiple, autoComplete = _a.autoComplete, loadOptions = _a.loadOptions, _b = _a.options, defaultOptions = _b === void 0 ? [] : _b, defaultValue = _a.defaultValue, controlledValue = _a.value, defaultInputValue = _a.defaultInputValue, label = _a.label, placeholder = _a.placeholder, register = _a.register, setValue = _a.setValue,
|
|
66
|
+
// trigger,
|
|
67
|
+
name = _a.name, onChange = _a.onChange, $ref = _a.$ref, children = _a.children, props = __rest(_a, ["creatable", "multiple", "autoComplete", "loadOptions", "options", "defaultValue", "value", "defaultInputValue", "label", "placeholder", "register", "setValue", "name", "onChange", "$ref", "children"]);
|
|
68
|
+
var defaultOptionsMemo = useMemo(function () { return normaliseOptions(defaultOptions); }, [defaultOptions]);
|
|
69
|
+
var _c = useState(defaultOptionsMemo), options = _c[0], setOptions = _c[1];
|
|
70
|
+
var _d = useState(false), loading = _d[0], setLoading = _d[1];
|
|
71
|
+
var _e = useAutocomplete({
|
|
70
72
|
id: "Autocomplete",
|
|
71
73
|
multiple: multiple ? true : undefined,
|
|
72
74
|
freeSolo: creatable ? true : undefined,
|
|
@@ -80,43 +82,53 @@ name, onChange, $ref, children, ...props }) => {
|
|
|
80
82
|
// ourselves
|
|
81
83
|
// inputValue: defaultInputValue,
|
|
82
84
|
// @ts-expect-error FIXME: how?
|
|
83
|
-
defaultValue,
|
|
85
|
+
defaultValue: defaultValue,
|
|
84
86
|
// @ts-expect-error FIXME: how?
|
|
85
87
|
value: controlledValue,
|
|
86
88
|
// defaultValue: useMemo(
|
|
87
89
|
// () => normaliseAutocompleteValue(defaultValue, multiple),
|
|
88
90
|
// [defaultValue]
|
|
89
91
|
// ),
|
|
90
|
-
options: useMemo(()
|
|
92
|
+
options: useMemo(function () { return (loadOptions ? options : defaultOptions); }, [loadOptions, options, defaultOptions]),
|
|
91
93
|
// update input change only if we are searching as you type, @see
|
|
92
94
|
// https://mui.com/components/autocomplete/#search-as-you-type
|
|
93
|
-
onInputChange: useCallback(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
95
|
+
onInputChange: useCallback(function (_event, inputValue) { return __awaiter(void 0, void 0, void 0, function () {
|
|
96
|
+
var newOptions, e_1;
|
|
97
|
+
return __generator(this, function (_a) {
|
|
98
|
+
switch (_a.label) {
|
|
99
|
+
case 0:
|
|
100
|
+
if (!loadOptions) {
|
|
101
|
+
return [2 /*return*/];
|
|
102
|
+
}
|
|
103
|
+
if (!inputValue) return [3 /*break*/, 6];
|
|
104
|
+
setLoading(true);
|
|
105
|
+
_a.label = 1;
|
|
106
|
+
case 1:
|
|
107
|
+
_a.trys.push([1, 3, 4, 5]);
|
|
108
|
+
return [4 /*yield*/, loadOptions(inputValue)];
|
|
109
|
+
case 2:
|
|
110
|
+
newOptions = _a.sent();
|
|
111
|
+
setOptions(newOptions);
|
|
112
|
+
return [3 /*break*/, 5];
|
|
113
|
+
case 3:
|
|
114
|
+
e_1 = _a.sent();
|
|
115
|
+
console.warn(e_1);
|
|
116
|
+
return [3 /*break*/, 5];
|
|
117
|
+
case 4:
|
|
118
|
+
setLoading(false);
|
|
119
|
+
return [7 /*endfinally*/];
|
|
120
|
+
case 5: return [3 /*break*/, 7];
|
|
121
|
+
case 6:
|
|
122
|
+
setOptions(options);
|
|
123
|
+
_a.label = 7;
|
|
124
|
+
case 7: return [2 /*return*/];
|
|
102
125
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
finally {
|
|
107
|
-
setLoading(false);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
setOptions(options);
|
|
112
|
-
// TODO: clear like behaviour?
|
|
113
|
-
// triggerChange({ value: "", label: "" });
|
|
114
|
-
}
|
|
115
|
-
}, [loadOptions, options]),
|
|
126
|
+
});
|
|
127
|
+
}); }, [loadOptions, options]),
|
|
116
128
|
// TODO: check if we need this, probably, and check how to structure the
|
|
117
129
|
// callback, here we get the actual input event
|
|
118
|
-
onChange: (event, newValue)
|
|
119
|
-
|
|
130
|
+
onChange: function (event, newValue) {
|
|
131
|
+
var value = normaliseAutocompleteValue(newValue, multiple);
|
|
120
132
|
// @ts-expect-error FIXME: how?
|
|
121
133
|
if (onChange)
|
|
122
134
|
onChange(newValue);
|
|
@@ -125,22 +137,22 @@ name, onChange, $ref, children, ...props }) => {
|
|
|
125
137
|
// triggerOnChange(onChange, name, value);
|
|
126
138
|
},
|
|
127
139
|
// support both freeSolo free text and full option structure
|
|
128
|
-
isOptionEqualToValue: (option, value)
|
|
129
|
-
|
|
130
|
-
|
|
140
|
+
isOptionEqualToValue: function (option, value) {
|
|
141
|
+
var optValue = isString(option) ? option : option.value;
|
|
142
|
+
var valValue = isString(value) ? value : value.value;
|
|
131
143
|
return optValue === valValue;
|
|
132
144
|
},
|
|
133
|
-
getOptionLabel: (option)
|
|
145
|
+
getOptionLabel: function (option) {
|
|
134
146
|
// @ts-expect-error TODO: I don't get this error
|
|
135
147
|
return isString(option) ? option : option.label || "";
|
|
136
148
|
},
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
149
|
+
}), getRootProps = _e.getRootProps, getInputLabelProps = _e.getInputLabelProps, getInputProps = _e.getInputProps, getTagProps = _e.getTagProps, getListboxProps = _e.getListboxProps, getOptionProps = _e.getOptionProps, getPopupIndicatorProps = _e.getPopupIndicatorProps, groupedOptions = _e.groupedOptions, stateValue = _e.value, setAnchorEl = _e.setAnchorEl, popupOpen = _e.popupOpen, focused = _e.focused;
|
|
150
|
+
var value = typeof controlledValue !== "undefined" ? controlledValue : stateValue;
|
|
151
|
+
var inputProps = function () {
|
|
152
|
+
var autocompleteProps = getInputProps();
|
|
141
153
|
// here we merge the mui's `useAutocomplete` props with the react-hook-form's
|
|
142
154
|
// `register` props
|
|
143
|
-
|
|
155
|
+
var registerProps = register
|
|
144
156
|
? register(name, {
|
|
145
157
|
// @ts-expect-error FIXME: can't remember
|
|
146
158
|
ref: autocompleteProps.ref.current,
|
|
@@ -149,14 +161,7 @@ name, onChange, $ref, children, ...props }) => {
|
|
|
149
161
|
value: normaliseAutocompleteValue(value, multiple),
|
|
150
162
|
})
|
|
151
163
|
: {};
|
|
152
|
-
return {
|
|
153
|
-
...registerProps,
|
|
154
|
-
...autocompleteProps,
|
|
155
|
-
// onChange: (event: FormEvent<HTMLInputElement>) => {
|
|
156
|
-
// registerProps.onChange(event);
|
|
157
|
-
// autocompleteProps?.onChange(event);
|
|
158
|
-
// },
|
|
159
|
-
};
|
|
164
|
+
return __assign(__assign({}, registerProps), autocompleteProps);
|
|
160
165
|
};
|
|
161
166
|
// to focus the input on error this works too
|
|
162
167
|
// @see https://react-hook-form.com/faqs#question12 but probably it is
|
|
@@ -166,12 +171,12 @@ name, onChange, $ref, children, ...props }) => {
|
|
|
166
171
|
// inputProps.ref.current.focus();
|
|
167
172
|
// }
|
|
168
173
|
// }, [errors, name, inputProps.ref]);
|
|
169
|
-
return (_jsxs(AutocompleteRoot, { children: [label && (_jsx(AutocompleteLabel, {
|
|
170
|
-
value.map((valueItem, index)
|
|
171
|
-
|
|
172
|
-
return (_jsxs(AutocompleteItem, {
|
|
174
|
+
return (_jsxs(AutocompleteRoot, { children: [label && (_jsx(AutocompleteLabel, __assign({}, getInputLabelProps(), { children: label }))), _jsxs(AutocompleteWrap, __assign({}, getRootProps(), { "data-focus": focused }, { children: [_jsxs(AutocompleteInner, __assign({ ref: setAnchorEl }, { children: [multiple &&
|
|
175
|
+
value.map(function (valueItem, index) {
|
|
176
|
+
var _a = getTagProps({ index: index }), onDelete = _a.onDelete, key = _a.key, tagProps = __rest(_a, ["onDelete", "key"]);
|
|
177
|
+
return (_jsxs(AutocompleteItem, __assign({}, tagProps, { children: [_jsx(AutocompleteItemLabel, { children: isString(valueItem)
|
|
173
178
|
? valueItem
|
|
174
|
-
: valueItem.Label || valueItem.label }), _jsx(AutocompleteItemRemove, { onClick: onDelete, children: "\u2715" })] }, key));
|
|
175
|
-
}), _jsx(AutocompleteInput, {
|
|
179
|
+
: valueItem.Label || valueItem.label }), _jsx(AutocompleteItemRemove, __assign({ onClick: onDelete }, { children: "\u2715" }))] }), key));
|
|
180
|
+
}), _jsx(AutocompleteInput, __assign({}, inputProps(), { placeholder: placeholder }))] })), !!options.length && (_jsx(AutocompleteInputArrow, __assign({}, getPopupIndicatorProps(), { isOpen: popupOpen }))), loading && _jsx(InputProgress, {})] })), groupedOptions.length ? (_jsx(AutocompleteMenu, __assign({}, getListboxProps(), { children: groupedOptions.map(function (option, index) { return (_jsx(AutocompleteMenuItem, __assign({}, getOptionProps({ option: option, index: index }), { children: isString(option) ? option : option.Label || option.label }), index)); }) }))) : null, children] }));
|
|
176
181
|
// });
|
|
177
182
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __makeTemplateObject } from "tslib";
|
|
1
2
|
import styled from "styled-components";
|
|
2
3
|
import { Label } from "../Forms/Label/Label";
|
|
3
4
|
import { InputWrap, InputMain } from "../Forms/Input/Input";
|
|
@@ -7,83 +8,27 @@ import { MenuItem } from "../MenuItem/MenuItem";
|
|
|
7
8
|
import { btnStyleReset } from "../Buttons";
|
|
8
9
|
import { inputReset } from "../Forms/styles";
|
|
9
10
|
import { ellipsis } from "../styles/styled";
|
|
10
|
-
|
|
11
|
+
var AUTOCOMPLETE_ITEM_GUTTER = 3;
|
|
11
12
|
/**
|
|
12
13
|
* Space between one selected item and the other
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
flex-wrap: wrap;
|
|
26
|
-
margin: -${AUTOCOMPLETE_ITEM_SPACER}px;
|
|
27
|
-
margin-right: 0;
|
|
28
|
-
`;
|
|
29
|
-
export const AutocompleteItem = styled.span `
|
|
30
|
-
position: relative;
|
|
31
|
-
display: inline-flex;
|
|
32
|
-
margin: ${AUTOCOMPLETE_ITEM_GUTTER}px;
|
|
33
|
-
max-width: calc(100% - 6px);
|
|
34
|
-
user-select: none;
|
|
35
|
-
align-items: center;
|
|
36
|
-
padding: 0 ${AUTOCOMPLETE_ITEM_REMOVE_WIDTH}px 0 ${AUTOCOMPLETE_ITEM_GUTTER}px;
|
|
37
|
-
font-size: 80%;
|
|
38
|
-
background: var(--accent400);
|
|
39
|
-
|
|
40
|
-
&:hover {
|
|
41
|
-
background: var(--accent300);
|
|
42
|
-
color: white;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
&:focus {
|
|
46
|
-
outline: 0px;
|
|
47
|
-
background: var(--grey700);
|
|
48
|
-
}
|
|
49
|
-
`;
|
|
50
|
-
export const AutocompleteItemLabel = styled.span `
|
|
51
|
-
padding: 0 ${AUTOCOMPLETE_ITEM_GUTTER}px;
|
|
52
|
-
${ellipsis}
|
|
53
|
-
`;
|
|
54
|
-
export const AutocompleteItemRemove = styled.span `
|
|
55
|
-
${btnStyleReset}
|
|
56
|
-
position: absolute;
|
|
57
|
-
top: 0;
|
|
58
|
-
right: 0;
|
|
59
|
-
width: ${AUTOCOMPLETE_ITEM_REMOVE_WIDTH}px;
|
|
60
|
-
border: 0;
|
|
61
|
-
height: 100%;
|
|
62
|
-
color: inherit;
|
|
63
|
-
line-height: 1;
|
|
64
|
-
`;
|
|
65
|
-
export const AutocompleteInputWrap = styled.div `
|
|
66
|
-
display: flex;
|
|
67
|
-
flex: 1;
|
|
68
|
-
`;
|
|
69
|
-
export const AutocompleteInput = styled.input `
|
|
70
|
-
flex-grow: 1;
|
|
71
|
-
width: 0;
|
|
72
|
-
min-width: 30px;
|
|
73
|
-
border: 0;
|
|
74
|
-
padding: 0 ${AUTOCOMPLETE_ITEM_SPACER}px;
|
|
75
|
-
text-overflow: ellipsis;
|
|
76
|
-
background: transparent;
|
|
77
|
-
|
|
78
|
-
&:focus {
|
|
79
|
-
outline: none;
|
|
80
|
-
}
|
|
81
|
-
`;
|
|
15
|
+
var AUTOCOMPLETE_ITEM_SPACER = 6;
|
|
16
|
+
var AUTOCOMPLETE_ITEM_REMOVE_WIDTH = 20;
|
|
17
|
+
export var AutocompleteRoot = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n"], ["\n position: relative;\n"])));
|
|
18
|
+
export var AutocompleteLabel = styled(Label)(templateObject_2 || (templateObject_2 = __makeTemplateObject([""], [""])));
|
|
19
|
+
export var AutocompleteWrap = styled(InputWrap)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), inputReset);
|
|
20
|
+
export var AutocompleteInner = styled(InputMain)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: inline-flex;\n flex-wrap: wrap;\n margin: -", "px;\n margin-right: 0;\n"], ["\n display: inline-flex;\n flex-wrap: wrap;\n margin: -", "px;\n margin-right: 0;\n"])), AUTOCOMPLETE_ITEM_SPACER);
|
|
21
|
+
export var AutocompleteItem = styled.span(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n position: relative;\n display: inline-flex;\n margin: ", "px;\n max-width: calc(100% - 6px);\n user-select: none;\n align-items: center;\n padding: 0 ", "px 0 ", "px;\n font-size: 80%;\n background: var(--accent400);\n\n &:hover {\n background: var(--accent300);\n color: white;\n }\n\n &:focus {\n outline: 0px;\n background: var(--grey700);\n }\n"], ["\n position: relative;\n display: inline-flex;\n margin: ", "px;\n max-width: calc(100% - 6px);\n user-select: none;\n align-items: center;\n padding: 0 ", "px 0 ", "px;\n font-size: 80%;\n background: var(--accent400);\n\n &:hover {\n background: var(--accent300);\n color: white;\n }\n\n &:focus {\n outline: 0px;\n background: var(--grey700);\n }\n"])), AUTOCOMPLETE_ITEM_GUTTER, AUTOCOMPLETE_ITEM_REMOVE_WIDTH, AUTOCOMPLETE_ITEM_GUTTER);
|
|
22
|
+
export var AutocompleteItemLabel = styled.span(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n padding: 0 ", "px;\n ", "\n"], ["\n padding: 0 ", "px;\n ", "\n"])), AUTOCOMPLETE_ITEM_GUTTER, ellipsis);
|
|
23
|
+
export var AutocompleteItemRemove = styled.span(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n ", "\n position: absolute;\n top: 0;\n right: 0;\n width: ", "px;\n border: 0;\n height: 100%;\n color: inherit;\n line-height: 1;\n"], ["\n ", "\n position: absolute;\n top: 0;\n right: 0;\n width: ", "px;\n border: 0;\n height: 100%;\n color: inherit;\n line-height: 1;\n"])), btnStyleReset, AUTOCOMPLETE_ITEM_REMOVE_WIDTH);
|
|
24
|
+
export var AutocompleteInputWrap = styled.div(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n display: flex;\n flex: 1;\n"], ["\n display: flex;\n flex: 1;\n"])));
|
|
25
|
+
export var AutocompleteInput = styled.input(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n flex-grow: 1;\n width: 0;\n min-width: 30px;\n border: 0;\n padding: 0 ", "px;\n text-overflow: ellipsis;\n background: transparent;\n\n &:focus {\n outline: none;\n }\n"], ["\n flex-grow: 1;\n width: 0;\n min-width: 30px;\n border: 0;\n padding: 0 ", "px;\n text-overflow: ellipsis;\n background: transparent;\n\n &:focus {\n outline: none;\n }\n"])), AUTOCOMPLETE_ITEM_SPACER);
|
|
82
26
|
/**
|
|
83
27
|
* This cannot be a button otherwise on `Enter` the form would submit instead
|
|
84
28
|
* of opening the dropdown or adding the selection. There are too many events
|
|
85
29
|
* to prevent if we were using a standard HTML `<button>`
|
|
86
30
|
*/
|
|
87
|
-
export
|
|
88
|
-
export
|
|
89
|
-
export
|
|
31
|
+
export var AutocompleteInputArrow = styled(SelectArrow)(templateObject_10 || (templateObject_10 = __makeTemplateObject([""], [""])));
|
|
32
|
+
export var AutocompleteMenu = styled(Menu)(templateObject_11 || (templateObject_11 = __makeTemplateObject([""], [""])));
|
|
33
|
+
export var AutocompleteMenuItem = styled(MenuItem)(templateObject_12 || (templateObject_12 = __makeTemplateObject([""], [""])));
|
|
34
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12;
|
package/Autocomplete/helpers.js
CHANGED
|
@@ -19,7 +19,7 @@ export function normaliseAutocompleteValue(value, asArray) {
|
|
|
19
19
|
return asArray ? [value] : value;
|
|
20
20
|
}
|
|
21
21
|
if (isArray(value)) {
|
|
22
|
-
|
|
22
|
+
var values = value.map(function (valueItem) {
|
|
23
23
|
return isString(valueItem) ? valueItem : valueItem.value;
|
|
24
24
|
});
|
|
25
25
|
return asArray ? values : values.join(",");
|
package/Bg/BgColor.js
CHANGED
|
@@ -1,31 +1,21 @@
|
|
|
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 { overlay } from "../styles";
|
|
4
5
|
import { Container } from "../Grid";
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
${(p) => `
|
|
16
|
-
${overlay}
|
|
17
|
-
transform: ${p.$transform};
|
|
18
|
-
background: ${p.$bg};
|
|
19
|
-
`}
|
|
20
|
-
}
|
|
21
|
-
`;
|
|
22
|
-
export const BgContainer = ({ color, skewY = 0, rotate = 0, scaleY = 1, // 0.85,
|
|
23
|
-
scaleX = 1, // 4,
|
|
24
|
-
perspective = 0, //100,
|
|
25
|
-
...containerProps }) => {
|
|
26
|
-
let $transform = "";
|
|
6
|
+
export var BgColor = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background: ", ";\n"], ["\n background: ", ";\n"])), function (p) { return p.$bg; });
|
|
7
|
+
export var BgColorSkewed = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: relative;\n /* overflow: hidden; */\n\n &:before {\n z-index: -1;\n content: \"\";\n ", "\n }\n"], ["\n position: relative;\n /* overflow: hidden; */\n\n &:before {\n z-index: -1;\n content: \"\";\n ", "\n }\n"])), function (p) { return "\n ".concat(overlay, "\n transform: ").concat(p.$transform, ";\n background: ").concat(p.$bg, ";\n "); });
|
|
8
|
+
export var BgContainer = function (_a) {
|
|
9
|
+
var color = _a.color, _b = _a.skewY, skewY = _b === void 0 ? 0 : _b, _c = _a.rotate, rotate = _c === void 0 ? 0 : _c, _d = _a.scaleY, scaleY = _d === void 0 ? 1 : _d, // 0.85,
|
|
10
|
+
_e = _a.scaleX, // 0.85,
|
|
11
|
+
scaleX = _e === void 0 ? 1 : _e, // 4,
|
|
12
|
+
_f = _a.perspective, // 4,
|
|
13
|
+
perspective = _f === void 0 ? 0 : _f, //100,
|
|
14
|
+
containerProps = __rest(_a, ["color", "skewY", "rotate", "scaleY", "scaleX", "perspective"]);
|
|
15
|
+
var $transform = "";
|
|
27
16
|
if (skewY || rotate) {
|
|
28
|
-
$transform =
|
|
17
|
+
$transform = "perspective(".concat(perspective, "vw) rotateY(").concat(rotate, "deg) skewY(").concat(skewY, "deg) scaleY(").concat(scaleY, ") scaleX(").concat(scaleX, ")");
|
|
29
18
|
}
|
|
30
|
-
return $transform ? (_jsx(BgColorSkewed, { "$bg": color, "$transform": $transform, children: _jsx(Container, { style: { position: "relative" },
|
|
19
|
+
return $transform ? (_jsx(BgColorSkewed, __assign({ "$bg": color, "$transform": $transform }, { children: _jsx(Container, __assign({ style: { position: "relative" } }, containerProps)) }))) : (_jsx(BgColor, __assign({ "$bg": color }, { children: _jsx(Container, __assign({}, containerProps)) })));
|
|
31
20
|
};
|
|
21
|
+
var templateObject_1, templateObject_2;
|
package/Bg/BgPhoto.js
CHANGED
|
@@ -1,59 +1,16 @@
|
|
|
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 { Container } from "../Grid";
|
|
4
5
|
import { Hidden } from "../Hidden";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
background-repeat: no-repeat;
|
|
15
|
-
background-position: top left;
|
|
16
|
-
background-size: contain;
|
|
17
|
-
filter: hue-rotate(-36deg);
|
|
18
|
-
opacity: 0.8;
|
|
19
|
-
`;
|
|
20
|
-
const BgPhotoMask = styled(Container) `
|
|
21
|
-
position: relative;
|
|
22
|
-
min-height: 100%;
|
|
23
|
-
|
|
24
|
-
&:before {
|
|
25
|
-
content: "";
|
|
26
|
-
position: absolute;
|
|
27
|
-
top: 0;
|
|
28
|
-
height: 100%;
|
|
29
|
-
right: calc(100% - ${(p) => p.$overlap + 2}px);
|
|
30
|
-
width: ${(p) => {
|
|
31
|
-
const containerSizePx = p.theme.breakpoints[p.containerSize];
|
|
32
|
-
return `calc(((100vw - ${containerSizePx}px) / 2) + ${p.$overlap + 2}px)`;
|
|
33
|
-
}};
|
|
34
|
-
background: linear-gradient(
|
|
35
|
-
90deg,
|
|
36
|
-
rgba(var(--bodyBg-rgb, 0)) 0%,
|
|
37
|
-
rgba(var(--bodyBg-rgb, 1)) 100%
|
|
38
|
-
),
|
|
39
|
-
linear-gradient(
|
|
40
|
-
60deg,
|
|
41
|
-
rgba(var(--bodyBg-rgb, 0)) 0%,
|
|
42
|
-
rgba(var(--bodyBg-rgb, 1)) 70%
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
&:after {
|
|
47
|
-
content: "";
|
|
48
|
-
position: absolute;
|
|
49
|
-
top: 0;
|
|
50
|
-
height: 100%;
|
|
51
|
-
left: ${(p) => p.$overlap + 1}px;
|
|
52
|
-
width: 100vw;
|
|
53
|
-
background: var(--bodyBg);
|
|
54
|
-
}
|
|
55
|
-
`;
|
|
56
|
-
export const BgPhoto = ({ src, containerSize = "xl", $overlap = 0, }) => {
|
|
57
|
-
const styledProps = { containerSize, $overlap };
|
|
58
|
-
return (_jsx(BgPhotoWrap, { style: { backgroundImage: `url(${src})` }, "$max": "xxl", children: _jsx(BgPhotoMask, { size: containerSize, ...styledProps }) }));
|
|
6
|
+
var BgPhotoWrap = styled(Hidden)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n z-index: -10;\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n overflow: hidden;\n pointer-events: none;\n background-repeat: no-repeat;\n background-position: top left;\n background-size: contain;\n filter: hue-rotate(-36deg);\n opacity: 0.8;\n"], ["\n z-index: -10;\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n overflow: hidden;\n pointer-events: none;\n background-repeat: no-repeat;\n background-position: top left;\n background-size: contain;\n filter: hue-rotate(-36deg);\n opacity: 0.8;\n"])));
|
|
7
|
+
var BgPhotoMask = styled(Container)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: relative;\n min-height: 100%;\n\n &:before {\n content: \"\";\n position: absolute;\n top: 0;\n height: 100%;\n right: calc(100% - ", "px);\n width: ", ";\n background: linear-gradient(\n 90deg,\n rgba(var(--bodyBg-rgb, 0)) 0%,\n rgba(var(--bodyBg-rgb, 1)) 100%\n ),\n linear-gradient(\n 60deg,\n rgba(var(--bodyBg-rgb, 0)) 0%,\n rgba(var(--bodyBg-rgb, 1)) 70%\n );\n }\n\n &:after {\n content: \"\";\n position: absolute;\n top: 0;\n height: 100%;\n left: ", "px;\n width: 100vw;\n background: var(--bodyBg);\n }\n"], ["\n position: relative;\n min-height: 100%;\n\n &:before {\n content: \"\";\n position: absolute;\n top: 0;\n height: 100%;\n right: calc(100% - ", "px);\n width: ", ";\n background: linear-gradient(\n 90deg,\n rgba(var(--bodyBg-rgb, 0)) 0%,\n rgba(var(--bodyBg-rgb, 1)) 100%\n ),\n linear-gradient(\n 60deg,\n rgba(var(--bodyBg-rgb, 0)) 0%,\n rgba(var(--bodyBg-rgb, 1)) 70%\n );\n }\n\n &:after {\n content: \"\";\n position: absolute;\n top: 0;\n height: 100%;\n left: ", "px;\n width: 100vw;\n background: var(--bodyBg);\n }\n"])), function (p) { return p.$overlap + 2; }, function (p) {
|
|
8
|
+
var containerSizePx = p.theme.breakpoints[p.containerSize];
|
|
9
|
+
return "calc(((100vw - ".concat(containerSizePx, "px) / 2) + ").concat(p.$overlap + 2, "px)");
|
|
10
|
+
}, function (p) { return p.$overlap + 1; });
|
|
11
|
+
export var BgPhoto = function (_a) {
|
|
12
|
+
var src = _a.src, _b = _a.containerSize, containerSize = _b === void 0 ? "xl" : _b, _c = _a.$overlap, $overlap = _c === void 0 ? 0 : _c;
|
|
13
|
+
var styledProps = { containerSize: containerSize, $overlap: $overlap };
|
|
14
|
+
return (_jsx(BgPhotoWrap, __assign({ style: { backgroundImage: "url(".concat(src, ")") }, "$max": "xxl" }, { children: _jsx(BgPhotoMask, __assign({ size: containerSize }, styledProps)) })));
|
|
59
15
|
};
|
|
16
|
+
var templateObject_1, templateObject_2;
|
package/Bg/BgSvg.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
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
|
-
position: fixed;
|
|
5
|
-
z-index: -2;
|
|
6
|
-
bottom: 0;
|
|
7
|
-
transform: rotate(180deg);
|
|
8
|
-
opacity: 0.9;
|
|
9
|
-
`;
|
|
4
|
+
var Root = styled.svg(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: fixed;\n z-index: -2;\n bottom: 0;\n transform: rotate(180deg);\n opacity: 0.9;\n"], ["\n position: fixed;\n z-index: -2;\n bottom: 0;\n transform: rotate(180deg);\n opacity: 0.9;\n"])));
|
|
10
5
|
/**
|
|
11
6
|
* Centered triangle shape
|
|
12
7
|
*/
|
|
13
|
-
export
|
|
14
|
-
|
|
8
|
+
export var BgSvg = function (_a) {
|
|
9
|
+
var color = _a.color;
|
|
10
|
+
return (_jsx(Root, __assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1200 120", preserveAspectRatio: "none" }, { children: _jsx("path", { d: "M1200 0L0 0 598.97 114.72 1200 0z", fill: color }) })));
|
|
15
11
|
};
|
|
12
|
+
var templateObject_1;
|