@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
|
@@ -8,7 +8,7 @@ export declare type UseToggleProps = Omit<FormControl, "value"> & {
|
|
|
8
8
|
options?: Option[];
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
|
-
* This hook is meant to
|
|
11
|
+
* This hook is meant to power Checkboxes, Switches and checkbox-like Radios
|
|
12
12
|
* components, it works in fact in two modes:
|
|
13
13
|
*
|
|
14
14
|
* 1: behaviour as standard checkbox
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { __assign, __rest } from "tslib";
|
|
1
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { useCallback, useMemo } from "react";
|
|
3
4
|
import { useWatch } from "react-hook-form";
|
|
4
5
|
import { InputInvisible } from "../styles";
|
|
5
6
|
/**
|
|
6
|
-
* This hook is meant to
|
|
7
|
+
* This hook is meant to power Checkboxes, Switches and checkbox-like Radios
|
|
7
8
|
* components, it works in fact in two modes:
|
|
8
9
|
*
|
|
9
10
|
* 1: behaviour as standard checkbox
|
|
@@ -32,25 +33,25 @@ import { InputInvisible } from "../styles";
|
|
|
32
33
|
* an array of options with the shape of `Option`
|
|
33
34
|
*/
|
|
34
35
|
export function useToggle(props, ref) {
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
var name = props.name, control = props.control, register = props.register, label = props.label, options = props.options, propValue = props.value, restProps = __rest(props, ["name", "control", "register", "label", "options", "value"]);
|
|
37
|
+
var id = restProps.id, valueTrue = restProps.valueTrue, valueFalse = restProps.valueFalse,
|
|
37
38
|
// defaultChecked,
|
|
38
39
|
// defaultValue,
|
|
39
40
|
// eslint-disable-next-line prefer-const
|
|
40
|
-
|
|
41
|
+
remainingInputProps = __rest(restProps, ["id", "valueTrue", "valueFalse"]);
|
|
41
42
|
// use options data convention to pass on the true/false values
|
|
42
43
|
if (options) {
|
|
43
44
|
valueTrue = options
|
|
44
|
-
.filter((opt)
|
|
45
|
+
.filter(function (opt) { return opt.value === "true"; })[0]
|
|
45
46
|
.label.toString();
|
|
46
47
|
valueFalse = options
|
|
47
|
-
.filter((opt)
|
|
48
|
+
.filter(function (opt) { return opt.value === "false"; })[0]
|
|
48
49
|
.label.toString();
|
|
49
50
|
}
|
|
50
|
-
id =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
id = "switch-".concat(name);
|
|
52
|
+
var idTrue = "".concat(id, "-true");
|
|
53
|
+
var idFalse = "".concat(id, "-false");
|
|
54
|
+
var isRadio = !!(valueTrue && valueFalse);
|
|
54
55
|
// // manage default values for both toggle modes
|
|
55
56
|
// defaultChecked = isUndefined(defaultChecked) ? false : defaultChecked;
|
|
56
57
|
// // TODO: maybe throw an error if the defaultValue that arrives here is not
|
|
@@ -61,9 +62,9 @@ export function useToggle(props, ref) {
|
|
|
61
62
|
// : valueFalse;
|
|
62
63
|
// get the value either from the uncontrolled watched input or from the given
|
|
63
64
|
// prop to control the component
|
|
64
|
-
|
|
65
|
-
name,
|
|
66
|
-
control,
|
|
65
|
+
var value = useWatch({
|
|
66
|
+
name: name,
|
|
67
|
+
control: control,
|
|
67
68
|
// defaultValue: isRadio ? defaultValue : defaultChecked,
|
|
68
69
|
});
|
|
69
70
|
if (propValue) {
|
|
@@ -73,14 +74,14 @@ export function useToggle(props, ref) {
|
|
|
73
74
|
// a `register` function, then check if we have a `control` object or just
|
|
74
75
|
// rely on the `name` prop and `ref`, they probably would be passed alongside
|
|
75
76
|
// an `onChange` prop that is spreaded on the inputs
|
|
76
|
-
|
|
77
|
+
var inputProps = useMemo(function () {
|
|
77
78
|
return register
|
|
78
79
|
? register(name)
|
|
79
80
|
: control
|
|
80
81
|
? control.register(name)
|
|
81
82
|
: {
|
|
82
|
-
name,
|
|
83
|
-
ref,
|
|
83
|
+
name: name,
|
|
84
|
+
ref: ref,
|
|
84
85
|
};
|
|
85
86
|
}, [register, control, name, ref]);
|
|
86
87
|
/**
|
|
@@ -89,15 +90,15 @@ export function useToggle(props, ref) {
|
|
|
89
90
|
* Fake the spacebar keyboard behaviour on the radio mode of the checkbox.
|
|
90
91
|
* Without this *only* the arrow keys would change the checkbox state
|
|
91
92
|
*/
|
|
92
|
-
|
|
93
|
+
var handleKeyDown = useCallback(function (event) {
|
|
93
94
|
if (event.key === " ") {
|
|
94
95
|
event.preventDefault();
|
|
95
96
|
event.stopPropagation();
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
var firstInput = event.target;
|
|
98
|
+
var next = firstInput.nextElementSibling;
|
|
99
|
+
var prev = firstInput.previousElementSibling;
|
|
100
|
+
var secondInput = (next === null || next === void 0 ? void 0 : next.tagName) === "INPUT" ? next : prev;
|
|
101
|
+
var target = firstInput;
|
|
101
102
|
if (firstInput.checked) {
|
|
102
103
|
target = secondInput;
|
|
103
104
|
}
|
|
@@ -113,7 +114,7 @@ export function useToggle(props, ref) {
|
|
|
113
114
|
}, [valueTrue]);
|
|
114
115
|
// collect all the return values that are dependent on the current value
|
|
115
116
|
// of the input
|
|
116
|
-
|
|
117
|
+
var valueDependentProps = useMemo(function () { return ({
|
|
117
118
|
rootProps: {
|
|
118
119
|
htmlFor: isRadio
|
|
119
120
|
? !value || value === valueFalse
|
|
@@ -122,9 +123,11 @@ export function useToggle(props, ref) {
|
|
|
122
123
|
: id,
|
|
123
124
|
},
|
|
124
125
|
label: label ? label : value,
|
|
125
|
-
value,
|
|
126
|
-
}), [value, valueFalse, isRadio, id, idTrue, idFalse, label]);
|
|
127
|
-
|
|
126
|
+
value: value,
|
|
127
|
+
}); }, [value, valueFalse, isRadio, id, idTrue, idFalse, label]);
|
|
128
|
+
var Inputs = useMemo(function () {
|
|
129
|
+
return isRadio ? (_jsxs(_Fragment, { children: [_jsx(InputInvisible, __assign({ id: idFalse }, inputProps, remainingInputProps, { onKeyDown: handleKeyDown, type: "radio", value: valueFalse })), _jsx(InputInvisible, __assign({ id: idTrue }, inputProps, remainingInputProps, { onKeyDown: handleKeyDown, type: "radio", value: valueTrue }))] })) : (_jsx(InputInvisible, __assign({ id: id, type: "checkbox" }, inputProps, remainingInputProps)));
|
|
130
|
+
}, [
|
|
128
131
|
inputProps,
|
|
129
132
|
remainingInputProps,
|
|
130
133
|
handleKeyDown,
|
|
@@ -138,8 +141,5 @@ export function useToggle(props, ref) {
|
|
|
138
141
|
// defaultValue,
|
|
139
142
|
]);
|
|
140
143
|
// console.log("useToggle: render", value);
|
|
141
|
-
return {
|
|
142
|
-
...valueDependentProps,
|
|
143
|
-
Inputs,
|
|
144
|
-
};
|
|
144
|
+
return __assign(__assign({}, valueDependentProps), { Inputs: Inputs });
|
|
145
145
|
}
|
package/Forms/antispam.js
CHANGED
|
@@ -10,19 +10,19 @@ import { encode, decode, isUndefined } from "@koine/utils";
|
|
|
10
10
|
* form data not created by user input.
|
|
11
11
|
*/
|
|
12
12
|
export function encodeForm(validationRules) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
for (
|
|
16
|
-
if (!
|
|
17
|
-
|
|
18
|
-
encoded[encodedName] = validationRules[
|
|
19
|
-
encodedNames[
|
|
13
|
+
var encoded = {};
|
|
14
|
+
var encodedNames = {};
|
|
15
|
+
for (var name_1 in validationRules) {
|
|
16
|
+
if (!name_1.startsWith("_")) {
|
|
17
|
+
var encodedName = encode(name_1);
|
|
18
|
+
encoded[encodedName] = validationRules[name_1];
|
|
19
|
+
encodedNames[name_1] = encodedName;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
// we need `.required()` to correctly infer the type @see
|
|
23
23
|
// https://github.com/jquense/yup/issues/946
|
|
24
|
-
|
|
25
|
-
return { encodedSchema, encodedNames };
|
|
24
|
+
var encodedSchema = object(encoded).required();
|
|
25
|
+
return { encodedSchema: encodedSchema, encodedNames: encodedNames };
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* Decode form data
|
|
@@ -34,9 +34,9 @@ export function encodeForm(validationRules) {
|
|
|
34
34
|
* which are considered programmatic form data not created by user input.
|
|
35
35
|
*/
|
|
36
36
|
export function decodeForm(formData) {
|
|
37
|
-
|
|
38
|
-
for (
|
|
39
|
-
|
|
37
|
+
var json = {};
|
|
38
|
+
for (var encodedName in formData) {
|
|
39
|
+
var decodedName = decode(encodedName);
|
|
40
40
|
// always add underscore prefixed names as they are treated as internal
|
|
41
41
|
// private inputs outside of the honeypot system, normalise them here removing
|
|
42
42
|
// the underscore prefix
|
package/Forms/helpers.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isString, matchSorter } from "@koine/utils";
|
|
2
|
-
export
|
|
3
|
-
|
|
2
|
+
export var normaliseOptions = function (options) {
|
|
3
|
+
if (options === void 0) { options = []; }
|
|
4
|
+
return options.map(function (option) {
|
|
4
5
|
return isString(option)
|
|
5
6
|
? {
|
|
6
7
|
label: option,
|
|
@@ -21,14 +22,14 @@ export function defaultOptionsFilterFn(options, inputValue) {
|
|
|
21
22
|
export function triggerOnChange(onChange, name, value) {
|
|
22
23
|
// @ts-expect-error nevermind
|
|
23
24
|
if (onChange)
|
|
24
|
-
onChange({ target: { name, value } });
|
|
25
|
+
onChange({ target: { name: name, value: value } });
|
|
25
26
|
}
|
|
26
27
|
/**
|
|
27
28
|
* @see https://hustle.bizongo.in/simulate-react-on-change-on-controlled-components-baa336920e04
|
|
28
29
|
* @deprecated
|
|
29
30
|
*/
|
|
30
31
|
export function triggerChange(input, value) {
|
|
31
|
-
|
|
32
|
+
var obj = window.Object;
|
|
32
33
|
if (!obj) {
|
|
33
34
|
// if (process.env["NODE_ENV"] !== "production") {
|
|
34
35
|
// console.warn("triggerChange: window.Object does not exists, bailing.");
|
|
@@ -36,9 +37,9 @@ export function triggerChange(input, value) {
|
|
|
36
37
|
return;
|
|
37
38
|
}
|
|
38
39
|
// @ts-expect-error nevermind
|
|
39
|
-
|
|
40
|
+
var nativeInputValueSetter = obj.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value").set;
|
|
40
41
|
// @ts-expect-error nevermind
|
|
41
42
|
nativeInputValueSetter.call(input, value);
|
|
42
|
-
|
|
43
|
+
var inputEvent = new Event("input", { bubbles: true });
|
|
43
44
|
input.dispatchEvent(inputEvent);
|
|
44
45
|
}
|
package/Forms/styles.js
CHANGED
|
@@ -1,60 +1,29 @@
|
|
|
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 { stateFocus } from "../styles/styled";
|
|
4
5
|
import { ProgressLinear } from "../Progress/ProgressLinear";
|
|
5
6
|
import { invisible } from "../styles/styled";
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
`;
|
|
9
|
-
export const InputHoneypot = styled(InputInvisible).attrs({
|
|
7
|
+
export var InputInvisible = styled.input(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), invisible);
|
|
8
|
+
export var InputHoneypot = styled(InputInvisible).attrs({
|
|
10
9
|
type: "text",
|
|
11
10
|
autoComplete: "new-password",
|
|
12
11
|
tabIndex: -1,
|
|
13
|
-
})
|
|
14
|
-
export
|
|
15
|
-
position: absolute;
|
|
16
|
-
bottom: 0;
|
|
17
|
-
left: 0;
|
|
18
|
-
width: 100%;
|
|
19
|
-
`;
|
|
12
|
+
})(templateObject_2 || (templateObject_2 = __makeTemplateObject([""], [""])));
|
|
13
|
+
export var InputProgress = styled(function (p) { return (_jsx(ProgressLinear, __assign({ fg: "var(--accent300)", bg: "var(--accent400)" }, p))); })(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: absolute;\n bottom: 0;\n left: 0;\n width: 100%;\n"], ["\n position: absolute;\n bottom: 0;\n left: 0;\n width: 100%;\n"])));
|
|
20
14
|
/**
|
|
21
15
|
* Remove the default light blue background on autofilled inputs. To be used as
|
|
22
16
|
* a function that outputs a CSS string.
|
|
23
17
|
*
|
|
24
18
|
* @see https://stackoverflow.com/a/62624824/1938970
|
|
25
19
|
*/
|
|
26
|
-
export
|
|
27
|
-
&:-webkit-autofill,
|
|
28
|
-
&:-webkit-autofill:hover,
|
|
29
|
-
&:-webkit-autofill:focus,
|
|
30
|
-
&:-webkit-autofill:active {
|
|
31
|
-
-webkit-background-clip: text;
|
|
32
|
-
}
|
|
33
|
-
`;
|
|
20
|
+
export var inputResetAutofill = "\n &:-webkit-autofill,\n &:-webkit-autofill:hover,\n &:-webkit-autofill:focus,\n &:-webkit-autofill:active {\n -webkit-background-clip: text;\n }\n";
|
|
34
21
|
/* FIXME: find a nice way to override this styling from implementation */
|
|
35
22
|
// border-bottom: 1px solid var(--forms-border-color);
|
|
36
23
|
// border: 0;
|
|
37
|
-
export
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
export
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
export const inputReset = `
|
|
44
|
-
width: 100%;
|
|
45
|
-
min-height: 44px;
|
|
46
|
-
${inputBorder}
|
|
47
|
-
${inputPadding}
|
|
48
|
-
`;
|
|
49
|
-
export const inputBase = `
|
|
50
|
-
${inputReset}
|
|
51
|
-
${inputResetAutofill}
|
|
52
|
-
background: transparent;
|
|
53
|
-
`;
|
|
54
|
-
export const inputFocus = `
|
|
55
|
-
&:focus {
|
|
56
|
-
outline: 0px;
|
|
57
|
-
appearance: none;
|
|
58
|
-
${stateFocus}
|
|
59
|
-
}
|
|
60
|
-
`;
|
|
24
|
+
export var inputBorder = "\n border: 1px solid var(--forms-border-color);\n";
|
|
25
|
+
export var inputPadding = "\n padding: var(--forms-gutter-y) var(--forms-gutter-x);\n";
|
|
26
|
+
export var inputReset = "\n width: 100%;\n min-height: 44px;\n ".concat(inputBorder, "\n ").concat(inputPadding, "\n");
|
|
27
|
+
export var inputBase = "\n ".concat(inputReset, "\n ").concat(inputResetAutofill, "\n background: transparent;\n");
|
|
28
|
+
export var inputFocus = "\n &:focus {\n outline: 0px;\n appearance: none;\n ".concat(stateFocus, "\n }\n");
|
|
29
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
package/Gauge/Gauge.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// import styled, { keyframes } from "styled-components";
|
|
2
2
|
// import { m } from "framer-motion";
|
|
3
|
-
export
|
|
3
|
+
export var Gauge = function (_props) { return null; };
|
|
4
4
|
// export type GaugeProps = {
|
|
5
5
|
// /** In percentage */
|
|
6
6
|
// value: number;
|
package/Grid/Grid.js
CHANGED
|
@@ -1,60 +1,33 @@
|
|
|
1
|
+
import { __makeTemplateObject } from "tslib";
|
|
1
2
|
import styled from "styled-components";
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
margin: 0 auto;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
padding: 0 ${(p) => p.theme.gutter[p.$gutter || GRID_GUTTER_DEFAULT]}px;
|
|
12
|
-
`;
|
|
13
|
-
export const Row = styled.div `
|
|
14
|
-
margin: 0 -${(p) => p.theme.gutter[p.$gutter || GRID_GUTTER_DEFAULT]}px;
|
|
15
|
-
display: flex;
|
|
16
|
-
${(p) => (p.$noWrap ? "overflow: auto;" : "flex-wrap: wrap;")}
|
|
17
|
-
${(p) => (p.$valign ? `align-items: ${p.$valign}` : "")};
|
|
18
|
-
${(p) => p.$reverse &&
|
|
19
|
-
`@media (${p.$reverse.split(":")[0]}-width: ${p.$reverse.split(":")[1]}px) {
|
|
20
|
-
flex-direction: row-reverse;
|
|
21
|
-
}`}
|
|
22
|
-
`;
|
|
23
|
-
export const Col = styled.div `
|
|
24
|
-
padding: 0 ${(p) => p.theme.gutter[p.$gutter || GRID_GUTTER_DEFAULT]}px;
|
|
25
|
-
display: ${(p) => (p.$flex ? "flex" : "block")};
|
|
26
|
-
${(p) => (p.$valign ? "align-items: " + p.$valign : "")};
|
|
27
|
-
${(p) => getColCss(p)};
|
|
28
|
-
`;
|
|
3
|
+
export var GRID_COLUMNS = 12;
|
|
4
|
+
export var GRID_GUTTER_DEFAULT = "half";
|
|
5
|
+
export var Container = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n max-width: ", "px;\n margin: 0 auto;\n padding: 0 ", "px;\n ", "\n"], ["\n max-width: ", "px;\n margin: 0 auto;\n padding: 0 ", "px;\n ", "\n"])), function (p) { return p.theme.breakpoints[p.size]; }, function (p) { return p.theme.gutter[p.$gutter || GRID_GUTTER_DEFAULT]; }, function (p) { return (p.clamp ? "overflow: hidden;" : ""); });
|
|
6
|
+
export var ContainerFluid = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding: 0 ", "px;\n"], ["\n padding: 0 ", "px;\n"])), function (p) { return p.theme.gutter[p.$gutter || GRID_GUTTER_DEFAULT]; });
|
|
7
|
+
export var Row = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n margin: 0 -", "px;\n display: flex;\n ", "\n ", ";\n ", "\n"], ["\n margin: 0 -", "px;\n display: flex;\n ", "\n ", ";\n ", "\n"])), function (p) { return p.theme.gutter[p.$gutter || GRID_GUTTER_DEFAULT]; }, function (p) { return (p.$noWrap ? "overflow: auto;" : "flex-wrap: wrap;"); }, function (p) { return (p.$valign ? "align-items: ".concat(p.$valign) : ""); }, function (p) {
|
|
8
|
+
return p.$reverse &&
|
|
9
|
+
"@media (".concat(p.$reverse.split(":")[0], "-width: ").concat(p.$reverse.split(":")[1], "px) {\n flex-direction: row-reverse;\n }");
|
|
10
|
+
});
|
|
11
|
+
export var Col = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n padding: 0 ", "px;\n display: ", ";\n ", ";\n ", ";\n"], ["\n padding: 0 ", "px;\n display: ", ";\n ", ";\n ", ";\n"])), function (p) { return p.theme.gutter[p.$gutter || GRID_GUTTER_DEFAULT]; }, function (p) { return (p.$flex ? "flex" : "block"); }, function (p) { return (p.$valign ? "align-items: " + p.$valign : ""); }, function (p) { return getColCss(p); });
|
|
29
12
|
function getColWidth(breakpoints, breakpoint, value) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
min-width: ${width}%;
|
|
34
|
-
flex: 0 0 ${width}%;
|
|
35
|
-
`;
|
|
13
|
+
var breakpointValue = breakpoints[breakpoint] + "px";
|
|
14
|
+
var width = (value * 100) / GRID_COLUMNS;
|
|
15
|
+
var cssValue = "\n min-width: ".concat(width, "%;\n flex: 0 0 ").concat(width, "%;\n");
|
|
36
16
|
if (breakpoint === Object.keys(breakpoints)[0]) {
|
|
37
17
|
return cssValue;
|
|
38
18
|
}
|
|
39
|
-
return
|
|
40
|
-
@media (min-width: ${breakpointValue}){
|
|
41
|
-
${cssValue}
|
|
42
|
-
}`;
|
|
19
|
+
return "\n @media (min-width: ".concat(breakpointValue, "){\n ").concat(cssValue, "\n }");
|
|
43
20
|
}
|
|
44
21
|
function getColCss(props) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
22
|
+
var $auto = props.$auto, $offset = props.$offset, $width = props.$width;
|
|
23
|
+
var breakpoints = props.theme.breakpoints;
|
|
24
|
+
var css = "";
|
|
48
25
|
if ($offset) {
|
|
49
|
-
|
|
50
|
-
for (
|
|
26
|
+
var offsets = $offset.split(",");
|
|
27
|
+
for (var i = 0; i <= offsets.length; i++) {
|
|
51
28
|
if (offsets[i]) {
|
|
52
|
-
|
|
53
|
-
css +=
|
|
54
|
-
@media(min-width: ${breakpoints[offsetBreakpoint]}px){
|
|
55
|
-
margin-left: ${(100 * offsetSize) / GRID_COLUMNS}%;
|
|
56
|
-
}
|
|
57
|
-
`;
|
|
29
|
+
var _a = offsets[i].split(":"), offsetBreakpoint = _a[0], offsetSize = _a[1];
|
|
30
|
+
css += " \n @media(min-width: ".concat(breakpoints[offsetBreakpoint], "px){\n margin-left: ").concat((100 * offsetSize) / GRID_COLUMNS, "%;\n }\n ");
|
|
58
31
|
}
|
|
59
32
|
}
|
|
60
33
|
}
|
|
@@ -62,11 +35,11 @@ function getColCss(props) {
|
|
|
62
35
|
// do nothing, width is set explicitly
|
|
63
36
|
}
|
|
64
37
|
else if ($auto) {
|
|
65
|
-
css +=
|
|
38
|
+
css += "flex: 0 0 auto; width: auto; max-width: none;";
|
|
66
39
|
}
|
|
67
40
|
else {
|
|
68
|
-
for (
|
|
69
|
-
|
|
41
|
+
for (var breakpoint in breakpoints) {
|
|
42
|
+
var value = props[breakpoint];
|
|
70
43
|
if (typeof value !== "undefined") {
|
|
71
44
|
css += getColWidth(breakpoints, breakpoint, value);
|
|
72
45
|
}
|
|
@@ -77,3 +50,4 @@ function getColCss(props) {
|
|
|
77
50
|
}
|
|
78
51
|
return css;
|
|
79
52
|
}
|
|
53
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
package/Hamburger/Hamburger.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __assign, __makeTemplateObject, __rest } from "tslib";
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
/**
|
|
3
4
|
* @file
|
|
@@ -5,60 +6,47 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
5
6
|
* Simplified from https://github.com/luukdv/hamburger-react
|
|
6
7
|
*/
|
|
7
8
|
import styled from "styled-components";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const time = 0.4;
|
|
31
|
-
const easing = "cubic-bezier(0, 0, 0, 1)";
|
|
32
|
-
const transition = `${time}s ${easing}`;
|
|
33
|
-
const burgerStyles = {
|
|
9
|
+
var HamburgerLabel = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n top: 30px;\n font-size: ", ";\n text-transform: uppercase;\n left: 7px;\n letter-spacing: 3px;\n"], ["\n position: absolute;\n top: 30px;\n font-size: ", ";\n text-transform: uppercase;\n left: 7px;\n letter-spacing: 3px;\n"])), function (_a) {
|
|
10
|
+
var $toggled = _a.$toggled;
|
|
11
|
+
return ($toggled ? "0" : "9px");
|
|
12
|
+
});
|
|
13
|
+
var area = 48;
|
|
14
|
+
var lines = 3;
|
|
15
|
+
var width = 32;
|
|
16
|
+
var room = Math.round((area - width) / 2);
|
|
17
|
+
var barHeightRaw = width / 12;
|
|
18
|
+
var barHeight = Math.round(barHeightRaw);
|
|
19
|
+
var space = 0.5;
|
|
20
|
+
var marginRaw = width / (lines * (space + (lines === 3 ? 1 : 1.25)));
|
|
21
|
+
var margin = Math.round(marginRaw);
|
|
22
|
+
var height = barHeight * lines + margin * (lines - 1);
|
|
23
|
+
var topOffset = Math.round((area - height) / 2);
|
|
24
|
+
var translate = 4.6325;
|
|
25
|
+
var deviation = (barHeightRaw - barHeight + (marginRaw - margin)) / (lines === 3 ? 1 : 2);
|
|
26
|
+
var move = parseFloat((width / translate - deviation / (4 / 3)).toFixed(2));
|
|
27
|
+
var time = 0.4;
|
|
28
|
+
var easing = "cubic-bezier(0, 0, 0, 1)";
|
|
29
|
+
var transition = "".concat(time, "s ").concat(easing);
|
|
30
|
+
var burgerStyles = {
|
|
34
31
|
marginRight: "-8px",
|
|
35
32
|
position: "relative",
|
|
36
|
-
width:
|
|
37
|
-
height:
|
|
33
|
+
width: "".concat(area, "px"),
|
|
34
|
+
height: "".concat(area, "px"),
|
|
38
35
|
userSelect: "none",
|
|
39
36
|
outline: "0px",
|
|
40
37
|
cursor: "pointer",
|
|
41
|
-
transition,
|
|
38
|
+
transition: transition,
|
|
42
39
|
};
|
|
43
|
-
|
|
40
|
+
var barStyles = {
|
|
44
41
|
position: "absolute",
|
|
45
|
-
width:
|
|
46
|
-
height:
|
|
47
|
-
left:
|
|
42
|
+
width: "".concat(width, "px"),
|
|
43
|
+
height: "".concat(barHeight, "px"),
|
|
44
|
+
left: "".concat(room, "px"),
|
|
48
45
|
background: "currentColor",
|
|
49
|
-
transition,
|
|
46
|
+
transition: transition,
|
|
50
47
|
};
|
|
51
|
-
export
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
transform: `${toggled ? `rotate(90deg)` : "none"}`,
|
|
55
|
-
}, tabIndex: 0, ...props, children: [_jsx("div", { style: {
|
|
56
|
-
...barStyles,
|
|
57
|
-
top: `${topOffset}px`,
|
|
58
|
-
transform: `${toggled ? `rotate(-45deg) translate(0px, ${move}px)` : "none"}`,
|
|
59
|
-
} }), _jsx("div", { style: {
|
|
60
|
-
...barStyles,
|
|
61
|
-
top: `${topOffset + barHeight + margin}px`,
|
|
62
|
-
transform: `${toggled ? `rotate(45deg) translate(0, -${move}px)` : "none"}`,
|
|
63
|
-
} }), _jsx(HamburgerLabel, { "$toggled": toggled, children: "Menu" })] }));
|
|
48
|
+
export var Hamburger = function (_a) {
|
|
49
|
+
var toggled = _a.toggled, props = __rest(_a, ["toggled"]);
|
|
50
|
+
return (_jsxs("div", __assign({ style: __assign(__assign({}, burgerStyles), { transform: "".concat(toggled ? "rotate(90deg)" : "none") }), tabIndex: 0 }, props, { children: [_jsx("div", { style: __assign(__assign({}, barStyles), { top: "".concat(topOffset, "px"), transform: "".concat(toggled ? "rotate(-45deg) translate(0px, ".concat(move, "px)") : "none") }) }), _jsx("div", { style: __assign(__assign({}, barStyles), { top: "".concat(topOffset + barHeight + margin, "px"), transform: "".concat(toggled ? "rotate(45deg) translate(0, -".concat(move, "px)") : "none") }) }), _jsx(HamburgerLabel, __assign({ "$toggled": toggled }, { children: "Menu" }))] })));
|
|
64
51
|
};
|
|
52
|
+
var templateObject_1;
|
package/Header/useHeader.js
CHANGED
|
@@ -2,21 +2,21 @@ import { useEffect, useState } from "react";
|
|
|
2
2
|
import { useScrollPosition } from "../hooks/useScrollPosition";
|
|
3
3
|
import { useTheme } from "../styles/theme";
|
|
4
4
|
import { useMedia } from "../styles/media";
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
useScrollPosition((currentPosition)
|
|
14
|
-
|
|
5
|
+
export var useHeader = function () {
|
|
6
|
+
var _a = useState(false), isSticky = _a[0], setIsSticky = _a[1];
|
|
7
|
+
var themed = useTheme().header;
|
|
8
|
+
var isDesktopLayout = useMedia("min:".concat(themed.breakpoint));
|
|
9
|
+
var valueIdx = isDesktopLayout ? 1 : 0;
|
|
10
|
+
var _b = useState(themed.height[valueIdx]), headerHeight = _b[0], setHeaderHeight = _b[1];
|
|
11
|
+
var _c = useState(themed.height[valueIdx]), placeholderHeight = _c[0], setPlaceholderHeight = _c[1];
|
|
12
|
+
var _d = useState(themed.logoWidth[valueIdx]), logoWidth = _d[0], setLogoWidth = _d[1];
|
|
13
|
+
useScrollPosition(function (currentPosition) {
|
|
14
|
+
var isPastThreshold = currentPosition.y * -1 > 40;
|
|
15
15
|
if (isSticky !== isPastThreshold)
|
|
16
16
|
setIsSticky(isPastThreshold);
|
|
17
17
|
}, [isSticky]);
|
|
18
|
-
useEffect(()
|
|
19
|
-
|
|
18
|
+
useEffect(function () {
|
|
19
|
+
var valueIdx = isDesktopLayout ? 1 : 0;
|
|
20
20
|
setPlaceholderHeight(themed.height[valueIdx]);
|
|
21
21
|
setHeaderHeight(isSticky ? themed.heightSticky[valueIdx] : themed.height[valueIdx]);
|
|
22
22
|
setLogoWidth(isSticky ? themed.logoWidthSticky[valueIdx] : themed.logoWidth[valueIdx]);
|
package/Hidden/Hidden.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
+
import { __makeTemplateObject } from "tslib";
|
|
1
2
|
import styled from "styled-components";
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
display: none
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
@media (max-width: ${p.theme.breakpoints[p.$max]}px) {
|
|
11
|
-
display: none;
|
|
12
|
-
}`
|
|
13
|
-
: ""}`}
|
|
14
|
-
`;
|
|
3
|
+
export var Hidden = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (p) {
|
|
4
|
+
return "".concat(p.$min
|
|
5
|
+
? "\n @media (min-width: ".concat(p.theme.breakpoints[p.$min], "px) {\n display: none;\n }")
|
|
6
|
+
: "", " ").concat(p.$max
|
|
7
|
+
? "\n @media (max-width: ".concat(p.theme.breakpoints[p.$max], "px) {\n display: none;\n }")
|
|
8
|
+
: "");
|
|
9
|
+
});
|
|
10
|
+
var templateObject_1;
|
package/Img/sc/bare.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { __makeTemplateObject } from "tslib";
|
|
1
2
|
import styled from "styled-components";
|
|
2
3
|
// export type KoineImgProps = {
|
|
3
4
|
// /** @default "cover" */
|
|
4
5
|
// $fit?: "cover" | "contain";
|
|
5
6
|
// };
|
|
6
|
-
export
|
|
7
|
+
export var KoineImg = styled.img(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
|
|
8
|
+
var templateObject_1;
|
|
7
9
|
// export const KoineImg = styled.img<KoineImgProps>`
|
|
8
10
|
// object-fit: ${(p) => p.$fit || "cover"};
|
|
9
11
|
// `;
|
package/Link/Link.js
CHANGED
package/Link/LinkBlank.js
CHANGED
|
@@ -1,26 +1,17 @@
|
|
|
1
|
+
import { __assign, __makeTemplateObject, __rest } 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 { MdLaunch as IconOutboundLink } from "react-icons/md";
|
|
4
5
|
import { max } from "../styles/media";
|
|
5
|
-
export
|
|
6
|
+
export var LinkBlankA = styled.a.attrs({
|
|
6
7
|
target: "_blank",
|
|
7
8
|
rel: "noopener",
|
|
8
|
-
})
|
|
9
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
|
|
9
10
|
// TODO: use `touch` class on <html> instead of relying on screenwidth,
|
|
10
11
|
// probably implement a lean Modernizr like thing with react-helmet
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
line-height: inherit;
|
|
16
|
-
vertical-align: middle;
|
|
17
|
-
width: 0px;
|
|
18
|
-
transition: width 0.1s ease-in-out;
|
|
19
|
-
${max.sm} {
|
|
20
|
-
width: 20px;
|
|
21
|
-
opacity: 0.8;
|
|
22
|
-
}
|
|
23
|
-
`;
|
|
24
|
-
export const LinkBlank = ({ children, target, rel, ...props }) => {
|
|
25
|
-
return (_jsxs(LinkBlankA, { ...props, children: [children, _jsx(LinkBlankIcon, {})] }));
|
|
12
|
+
export var LinkBlankIcon = styled(IconOutboundLink)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n color: var(---grey100);\n font-size: inherit;\n margin-left: 3px;\n line-height: inherit;\n vertical-align: middle;\n width: 0px;\n transition: width 0.1s ease-in-out;\n ", " {\n width: 20px;\n opacity: 0.8;\n }\n"], ["\n color: var(---grey100);\n font-size: inherit;\n margin-left: 3px;\n line-height: inherit;\n vertical-align: middle;\n width: 0px;\n transition: width 0.1s ease-in-out;\n ", " {\n width: 20px;\n opacity: 0.8;\n }\n"])), max.sm);
|
|
13
|
+
export var LinkBlank = function (_a) {
|
|
14
|
+
var children = _a.children, target = _a.target, rel = _a.rel, props = __rest(_a, ["children", "target", "rel"]);
|
|
15
|
+
return (_jsxs(LinkBlankA, __assign({}, props, { children: [children, _jsx(LinkBlankIcon, {})] })));
|
|
26
16
|
};
|
|
17
|
+
var templateObject_1, templateObject_2;
|