@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/Spacing/Spacing.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
+
import { __assign, __makeTemplateObject, __rest, __spreadArray } from "tslib";
|
|
1
2
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import styled from "styled-components";
|
|
3
4
|
import { isUndefined } from "@koine/utils";
|
|
4
5
|
import { spacingTop, spacingBottom, } from "../styles/spacing";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const [size, factor, property, devices] = raw.split(":");
|
|
11
|
-
const factorArg = isUndefined(factor) ? undefined : parseFloat(factor);
|
|
12
|
-
const devicesArg = devices?.split(",");
|
|
6
|
+
var Root = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n ", "\n"], ["\n ", "\n ", "\n"])), function (p) { return p.$top && spacingTop.call.apply(spacingTop, __spreadArray([p.theme], p.$top, false)); }, function (p) { return p.$bottom && spacingBottom.call.apply(spacingBottom, __spreadArray([p.theme], p.$bottom, false)); });
|
|
7
|
+
var extractDirectionArgs = function (raw) {
|
|
8
|
+
var _a = raw.split(":"), size = _a[0], factor = _a[1], property = _a[2], devices = _a[3];
|
|
9
|
+
var factorArg = isUndefined(factor) ? undefined : parseFloat(factor);
|
|
10
|
+
var devicesArg = devices === null || devices === void 0 ? void 0 : devices.split(",");
|
|
13
11
|
return [size, factorArg, property, devicesArg];
|
|
14
12
|
};
|
|
15
13
|
/**
|
|
@@ -24,9 +22,10 @@ const extractDirectionArgs = (raw) => {
|
|
|
24
22
|
* <Spacing top="sm:2:padding:tablet,desktop" />
|
|
25
23
|
* ```
|
|
26
24
|
*/
|
|
27
|
-
export
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
export var Spacing = function (_a) {
|
|
26
|
+
var top = _a.top, bottom = _a.bottom, vertical = _a.vertical, props = __rest(_a, ["top", "bottom", "vertical"]);
|
|
27
|
+
var $top;
|
|
28
|
+
var $bottom;
|
|
30
29
|
if (top) {
|
|
31
30
|
$top = extractDirectionArgs(top);
|
|
32
31
|
}
|
|
@@ -41,5 +40,6 @@ export const Spacing = ({ top, bottom, vertical, ...props }) => {
|
|
|
41
40
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
42
41
|
return _jsx(_Fragment, { children: props.children });
|
|
43
42
|
}
|
|
44
|
-
return _jsx(Root, { "$top": $top, "$bottom": $bottom,
|
|
43
|
+
return _jsx(Root, __assign({ "$top": $top, "$bottom": $bottom }, props));
|
|
45
44
|
};
|
|
45
|
+
var templateObject_1;
|
package/Sticky/Sticky.js
CHANGED
package/Sticky/StickyCss.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { __assign, __rest } from "tslib";
|
|
1
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
export
|
|
3
|
-
|
|
3
|
+
export var StickyCss = function (_a) {
|
|
4
|
+
var top = _a.top, props = __rest(_a, ["top"]);
|
|
5
|
+
return _jsx("div", __assign({ style: { position: "sticky", top: 100 } }, props));
|
|
4
6
|
};
|
package/Tabs/TabsMui.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __assign, __rest } from "tslib";
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { forwardRef } from "react";
|
|
3
4
|
import TabsUnstyled from "@mui/base/TabsUnstyled";
|
|
@@ -5,15 +6,16 @@ import TabsListUnstyled from "@mui/base/TabsListUnstyled";
|
|
|
5
6
|
import TabUnstyled, { useTab } from "@mui/base/TabUnstyled";
|
|
6
7
|
import TabPanelUnstyled from "@mui/base/TabPanelUnstyled";
|
|
7
8
|
import { extendComponent, } from "../helpers";
|
|
8
|
-
export
|
|
9
|
-
export
|
|
9
|
+
export var Root = TabsUnstyled;
|
|
10
|
+
export var List = TabsListUnstyled;
|
|
10
11
|
// export const Tab = TabUnstyled as unknown as Props["Tab"];
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
export var Indicator = "span";
|
|
13
|
+
export var Panel = TabPanelUnstyled;
|
|
14
|
+
export var Tab = forwardRef(function Tab(_a, ref) {
|
|
15
|
+
var children = _a.children, component = _a.component, componentsProps = _a.componentsProps, components = _a.components, Indicator = _a.Indicator, props = __rest(_a, ["children", "component", "componentsProps", "components", "Indicator"]);
|
|
16
|
+
var _b = useTab(__assign(__assign({}, props), { ref: ref })), active = _b.active, disabled = _b.disabled, selected = _b.selected;
|
|
17
|
+
var indicatorProps = { active: active, disabled: disabled, selected: selected };
|
|
18
|
+
return (_jsxs(TabUnstyled /* ref={ref} */, __assign({}, props, { children: [children, Indicator && _jsx(Indicator, __assign({}, indicatorProps))] })));
|
|
17
19
|
});
|
|
18
20
|
/**
|
|
19
21
|
*
|
|
@@ -31,13 +33,14 @@ export const Tab = forwardRef(function Tab({ children, component, componentsProp
|
|
|
31
33
|
*
|
|
32
34
|
* FIXME: it actually works even without forwardRef, check if we do need it
|
|
33
35
|
*/
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
var TabsWithRef = forwardRef(function Tabs(_a, ref) {
|
|
37
|
+
var _Root = _a.Root, _List = _a.List, _Tab = _a.Tab, _Indicator = _a.Indicator, _Panel = _a.Panel, props = __rest(_a, ["Root", "List", "Tab", "Indicator", "Panel"]);
|
|
38
|
+
return _jsx(Root, __assign({}, props, { ref: ref }));
|
|
36
39
|
});
|
|
37
|
-
export
|
|
38
|
-
Root,
|
|
39
|
-
List,
|
|
40
|
-
Tab,
|
|
41
|
-
Indicator,
|
|
42
|
-
Panel,
|
|
40
|
+
export var KoineTabs = extendComponent(TabsWithRef, {
|
|
41
|
+
Root: Root,
|
|
42
|
+
List: List,
|
|
43
|
+
Tab: Tab,
|
|
44
|
+
Indicator: Indicator,
|
|
45
|
+
Panel: Panel,
|
|
43
46
|
});
|
package/Tabs/tw/bare.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
+
import { __makeTemplateObject } from "tslib";
|
|
1
2
|
import { classed, extendComponent } from "../../helpers";
|
|
2
3
|
// import type { ComponentsProps } from "../TabsMui";
|
|
3
4
|
import * as _ from "../TabsMui";
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
Root,
|
|
11
|
-
List,
|
|
12
|
-
Tab,
|
|
13
|
-
Indicator,
|
|
14
|
-
Panel,
|
|
5
|
+
export var Root = classed(_.Root)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["< class=\"tabs"], ["< class=\"tabs"])));
|
|
6
|
+
export var List = classed(_.List)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["< class=\"tabsList flex"], ["< class=\"tabsList flex"])));
|
|
7
|
+
export var Tab = classed(_.Tab)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["< class=\"tabsTab inline-flex items-center justify-center [-webkit-tap-highlight-color:transparent] appearance-none select-none"], ["< class=\"tabsTab inline-flex items-center justify-center [-webkit-tap-highlight-color:transparent] appearance-none select-none"])));
|
|
8
|
+
export var Indicator = classed(_.Indicator)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["< class=\"tabsIndicator"], ["< class=\"tabsIndicator"])));
|
|
9
|
+
export var Panel = classed(_.Panel)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["< class=\"tabsPanel"], ["< class=\"tabsPanel"])));
|
|
10
|
+
export var KoineTabs = extendComponent(_.KoineTabs, {
|
|
11
|
+
Root: Root,
|
|
12
|
+
List: List,
|
|
13
|
+
Tab: Tab,
|
|
14
|
+
Indicator: Indicator,
|
|
15
|
+
Panel: Panel,
|
|
15
16
|
});
|
|
17
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
package/Tabs/tw/material.js
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
+
import { __makeTemplateObject } from "tslib";
|
|
1
2
|
import { classed, extendComponent } from "../../helpers";
|
|
2
3
|
import { KoineTabs as _ } from "./bare";
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
export const KoineTabs = extendComponent(_, {
|
|
9
|
-
Root,
|
|
10
|
-
List,
|
|
11
|
-
Tab,
|
|
12
|
-
Indicator,
|
|
13
|
-
Panel,
|
|
4
|
+
export var Root = classed(_.Root)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["< class=\""], ["< class=\""])));
|
|
5
|
+
export var List = classed(_.List)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["< class=\"border-b-gray-200 border-b border-solid"], ["< class=\"border-b-gray-200 border-b border-solid"])));
|
|
6
|
+
export var Tab = classed(_.Tab)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["< class=\"flex-col relative py-3 px-4 uppercase"], ["< class=\"flex-col relative py-3 px-4 uppercase"]))); // ${p => p.selected ? "text-cyan-600" : ""}
|
|
7
|
+
export var Indicator = classed(_.Indicator)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["< class=\"absolute bottom-0 w-full h-[2px] ", ""], ["< class=\"absolute bottom-0 w-full h-[2px] ", ""])), function (p) {
|
|
8
|
+
return p.selected ? "bg-current" : "";
|
|
14
9
|
});
|
|
10
|
+
export var Panel = classed(_.Panel)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["< class=\"tabsPanel"], ["< class=\"tabsPanel"])));
|
|
11
|
+
export var KoineTabs = extendComponent(_, {
|
|
12
|
+
Root: Root,
|
|
13
|
+
List: List,
|
|
14
|
+
Tab: Tab,
|
|
15
|
+
Indicator: Indicator,
|
|
16
|
+
Panel: Panel,
|
|
17
|
+
});
|
|
18
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
package/Tabs/useTabs.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { useCallback, /* useId, */ useMemo } from "react";
|
|
2
2
|
import { unstable_useControlled as useControlled } from "@mui/utils";
|
|
3
3
|
import { useId } from "../hooks/useId";
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export var useTabs = function (props) {
|
|
5
|
+
var valueProp = props.value, defaultValue = props.defaultValue, onChange = props.onChange, orientation = props.orientation, direction = props.direction, selectionFollowsFocus = props.selectionFollowsFocus;
|
|
6
|
+
var _a = useControlled({
|
|
7
7
|
controlled: valueProp,
|
|
8
8
|
default: defaultValue,
|
|
9
9
|
name: "Tabs",
|
|
10
10
|
state: "value",
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
}), value = _a[0], setValue = _a[1];
|
|
12
|
+
var idPrefix = useId();
|
|
13
|
+
var onSelected = useCallback(function (e, newValue) {
|
|
14
14
|
setValue(newValue);
|
|
15
15
|
if (onChange) {
|
|
16
16
|
onChange(e, newValue);
|
|
17
17
|
}
|
|
18
18
|
}, [onChange, setValue]);
|
|
19
|
-
|
|
19
|
+
var getRootProps = function () {
|
|
20
20
|
return {};
|
|
21
21
|
};
|
|
22
|
-
|
|
22
|
+
var tabsContextValue = useMemo(function () {
|
|
23
23
|
return {
|
|
24
|
-
idPrefix,
|
|
25
|
-
value,
|
|
26
|
-
onSelected,
|
|
27
|
-
orientation,
|
|
28
|
-
direction,
|
|
29
|
-
selectionFollowsFocus,
|
|
24
|
+
idPrefix: idPrefix,
|
|
25
|
+
value: value,
|
|
26
|
+
onSelected: onSelected,
|
|
27
|
+
orientation: orientation,
|
|
28
|
+
direction: direction,
|
|
29
|
+
selectionFollowsFocus: selectionFollowsFocus,
|
|
30
30
|
};
|
|
31
31
|
}, [
|
|
32
32
|
idPrefix,
|
|
@@ -37,8 +37,8 @@ export const useTabs = (props) => {
|
|
|
37
37
|
selectionFollowsFocus,
|
|
38
38
|
]);
|
|
39
39
|
return {
|
|
40
|
-
getRootProps,
|
|
41
|
-
tabsContextValue,
|
|
40
|
+
getRootProps: getRootProps,
|
|
41
|
+
tabsContextValue: tabsContextValue,
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
44
|
export default useTabs;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
+
import { __makeTemplateObject } from "tslib";
|
|
1
2
|
import styled from "styled-components";
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
opacity: 0;
|
|
5
|
-
font-size: 0;
|
|
6
|
-
`;
|
|
3
|
+
export var CopyPasteVisible = styled.span(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: transparent;\n opacity: 0;\n font-size: 0;\n"], ["\n color: transparent;\n opacity: 0;\n font-size: 0;\n"])));
|
|
4
|
+
var templateObject_1;
|
package/Typography/Native.js
CHANGED
|
@@ -1,47 +1,14 @@
|
|
|
1
|
+
import { __makeTemplateObject } from "tslib";
|
|
1
2
|
import styled from "styled-components";
|
|
2
3
|
import { min } from "../styles/media";
|
|
3
|
-
export
|
|
4
|
-
margin: 0 0
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
margin: 0 0
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
`;
|
|
15
|
-
export const h2 = `
|
|
16
|
-
margin: 0 0 1em 0;
|
|
17
|
-
font-size: 24px;
|
|
18
|
-
font-weight: 800;
|
|
19
|
-
line-height: var(--headingsLineHeight);
|
|
20
|
-
`;
|
|
21
|
-
export const h3 = `
|
|
22
|
-
margin: 0 0 1em 0;
|
|
23
|
-
font-size: 20px;
|
|
24
|
-
font-weight: 600;
|
|
25
|
-
line-height: var(--headingsLineHeight);
|
|
26
|
-
`;
|
|
27
|
-
export const h4 = `
|
|
28
|
-
margin: 0 0 1em 0;
|
|
29
|
-
font-size: 13px;
|
|
30
|
-
font-weight: 600;
|
|
31
|
-
line-height: var(--headingsLineHeight);
|
|
32
|
-
`;
|
|
33
|
-
export const P = styled.div `
|
|
34
|
-
${p}
|
|
35
|
-
`;
|
|
36
|
-
export const H1 = styled.div `
|
|
37
|
-
${h1}
|
|
38
|
-
`;
|
|
39
|
-
export const H2 = styled.div `
|
|
40
|
-
${h2}
|
|
41
|
-
`;
|
|
42
|
-
export const H3 = styled.div `
|
|
43
|
-
${h3}
|
|
44
|
-
`;
|
|
45
|
-
export const H4 = styled.div `
|
|
46
|
-
${h4}
|
|
47
|
-
`;
|
|
4
|
+
export var p = "\n margin: 0 0 1em 0;\n";
|
|
5
|
+
export var h1 = "\n margin: 0 0 10px 0;\n font-size: 30px;\n font-weight: 800;\n line-height: var(--headingsLineHeight);\n ".concat(min.md, " {\n font-size: 50px;\n }\n");
|
|
6
|
+
export var h2 = "\n margin: 0 0 1em 0;\n font-size: 24px;\n font-weight: 800;\n line-height: var(--headingsLineHeight);\n";
|
|
7
|
+
export var h3 = "\n margin: 0 0 1em 0;\n font-size: 20px;\n font-weight: 600;\n line-height: var(--headingsLineHeight);\n";
|
|
8
|
+
export var h4 = "\n margin: 0 0 1em 0;\n font-size: 13px;\n font-weight: 600;\n line-height: var(--headingsLineHeight);\n";
|
|
9
|
+
export var P = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), p);
|
|
10
|
+
export var H1 = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), h1);
|
|
11
|
+
export var H2 = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), h2);
|
|
12
|
+
export var H3 = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), h3);
|
|
13
|
+
export var H4 = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), h4);
|
|
14
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
package/Typography/ReadMore.js
CHANGED
|
@@ -1,60 +1,33 @@
|
|
|
1
|
+
import { __assign, __makeTemplateObject, __rest } from "tslib";
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { useState, useRef, useMemo } from "react";
|
|
3
4
|
import styled from "styled-components";
|
|
4
5
|
import { m, useSpring } from "framer-motion";
|
|
5
6
|
// import { CgArrowsExpandDownRight as IconExpand } from "react-icons/cg";
|
|
6
7
|
import { useIsomorphicLayoutEffect } from "../hooks";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
`;
|
|
26
|
-
const Btn = styled.span `
|
|
27
|
-
padding: 0 10px 0 10px;
|
|
28
|
-
line-height: ${(p) => (p.$lineHeight ? p.$lineHeight : "inherit")};
|
|
29
|
-
background: var(--bodyBg);
|
|
30
|
-
color: var(--grey600);
|
|
31
|
-
white-space: nowrap;
|
|
32
|
-
font-size: ${(p) => p.$fontSize}px;
|
|
33
|
-
cursor: pointer;
|
|
34
|
-
`;
|
|
35
|
-
const BtnIcon = styled.span `
|
|
36
|
-
display: inline-block;
|
|
37
|
-
margin: 0 0 0 4px;
|
|
38
|
-
transition: transform 0.18s ease-in-out;
|
|
39
|
-
${(p) => (p.$expanded ? "transform: rotate(180deg);" : "")};
|
|
40
|
-
font-size: ${(p) => p.$fontSize}px;
|
|
41
|
-
`;
|
|
42
|
-
export const ReadMore = ({ lines = 3, lineHeight = 1.6, fontSize = 14, bg = "var(--bodyBg)", expand = "Expand", collapse = "Collapse", ...props }) => {
|
|
43
|
-
const defaultMaxHeight = lines * (lineHeight * fontSize);
|
|
44
|
-
const [expanded, setExpanded] = useState(false);
|
|
45
|
-
const [maxHeight, setMaxHeight] = useState(defaultMaxHeight);
|
|
46
|
-
const [fullHeight, setFullHeight] = useState(0);
|
|
47
|
-
const [exceeds, setExceeds] = useState(false);
|
|
48
|
-
const content = useRef(null);
|
|
49
|
-
const height = useSpring(defaultMaxHeight);
|
|
50
|
-
const styles = useMemo(() => (exceeds ? { height, overflow: "hidden" } : {}), [exceeds, height]);
|
|
51
|
-
const handleExpandClick = () => {
|
|
52
|
-
setExpanded((prevExpanded) => !prevExpanded);
|
|
8
|
+
var Root = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
|
|
9
|
+
var Content = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n & p:first-child {\n margin-top: 0;\n }\n"], ["\n & p:first-child {\n margin-top: 0;\n }\n"])));
|
|
10
|
+
var BtnWrap = styled.span(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n justify-content: flex-end;\n transition: transform 0.18s ease-in-out;\n text-align: right;\n transform: translateY(", ");\n opacity: ", ";\n"], ["\n display: flex;\n justify-content: flex-end;\n transition: transform 0.18s ease-in-out;\n text-align: right;\n transform: translateY(", ");\n opacity: ", ";\n"])), function (p) { return (p.$expanded ? "0" : "-100%"); }, function (p) { return (p.$expanded ? 0 : 1); });
|
|
11
|
+
var BtnFader = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: 30%;\n transition: transform 0.18s ease-in-out;\n background: linear-gradient(45deg, transparent 50%, ", " 70%);\n"], ["\n width: 30%;\n transition: transform 0.18s ease-in-out;\n background: linear-gradient(45deg, transparent 50%, ", " 70%);\n"])), function (p) { return p.$bg; });
|
|
12
|
+
var Btn = styled.span(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n padding: 0 10px 0 10px;\n line-height: ", ";\n background: var(--bodyBg);\n color: var(--grey600);\n white-space: nowrap;\n font-size: ", "px;\n cursor: pointer;\n"], ["\n padding: 0 10px 0 10px;\n line-height: ", ";\n background: var(--bodyBg);\n color: var(--grey600);\n white-space: nowrap;\n font-size: ", "px;\n cursor: pointer;\n"])), function (p) { return (p.$lineHeight ? p.$lineHeight : "inherit"); }, function (p) { return p.$fontSize; });
|
|
13
|
+
var BtnIcon = styled.span(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: inline-block;\n margin: 0 0 0 4px;\n transition: transform 0.18s ease-in-out;\n ", ";\n font-size: ", "px;\n"], ["\n display: inline-block;\n margin: 0 0 0 4px;\n transition: transform 0.18s ease-in-out;\n ", ";\n font-size: ", "px;\n"])), function (p) { return (p.$expanded ? "transform: rotate(180deg);" : ""); }, function (p) { return p.$fontSize; });
|
|
14
|
+
export var ReadMore = function (_a) {
|
|
15
|
+
var _b = _a.lines, lines = _b === void 0 ? 3 : _b, _c = _a.lineHeight, lineHeight = _c === void 0 ? 1.6 : _c, _d = _a.fontSize, fontSize = _d === void 0 ? 14 : _d, _e = _a.bg, bg = _e === void 0 ? "var(--bodyBg)" : _e, _f = _a.expand, expand = _f === void 0 ? "Expand" : _f, _g = _a.collapse, collapse = _g === void 0 ? "Collapse" : _g, props = __rest(_a, ["lines", "lineHeight", "fontSize", "bg", "expand", "collapse"]);
|
|
16
|
+
var defaultMaxHeight = lines * (lineHeight * fontSize);
|
|
17
|
+
var _h = useState(false), expanded = _h[0], setExpanded = _h[1];
|
|
18
|
+
var _j = useState(defaultMaxHeight), maxHeight = _j[0], setMaxHeight = _j[1];
|
|
19
|
+
var _k = useState(0), fullHeight = _k[0], setFullHeight = _k[1];
|
|
20
|
+
var _l = useState(false), exceeds = _l[0], setExceeds = _l[1];
|
|
21
|
+
var content = useRef(null);
|
|
22
|
+
var height = useSpring(defaultMaxHeight);
|
|
23
|
+
var styles = useMemo(function () { return (exceeds ? { height: height, overflow: "hidden" } : {}); }, [exceeds, height]);
|
|
24
|
+
var handleExpandClick = function () {
|
|
25
|
+
setExpanded(function (prevExpanded) { return !prevExpanded; });
|
|
53
26
|
};
|
|
54
|
-
useIsomorphicLayoutEffect(()
|
|
27
|
+
useIsomorphicLayoutEffect(function () {
|
|
55
28
|
if (content.current) {
|
|
56
|
-
|
|
57
|
-
|
|
29
|
+
var elementHeight = content.current.offsetHeight;
|
|
30
|
+
var newExceeds = elementHeight > maxHeight;
|
|
58
31
|
if (!newExceeds) {
|
|
59
32
|
setMaxHeight(elementHeight);
|
|
60
33
|
}
|
|
@@ -62,8 +35,9 @@ export const ReadMore = ({ lines = 3, lineHeight = 1.6, fontSize = 14, bg = "var
|
|
|
62
35
|
setFullHeight(elementHeight);
|
|
63
36
|
}
|
|
64
37
|
}, [content, maxHeight]);
|
|
65
|
-
useIsomorphicLayoutEffect(()
|
|
38
|
+
useIsomorphicLayoutEffect(function () {
|
|
66
39
|
height.set(expanded ? fullHeight : maxHeight);
|
|
67
40
|
}, [expanded, height, fullHeight, maxHeight]);
|
|
68
|
-
return (_jsxs(Root, { children: [_jsx(m.div, { style: styles, children: _jsx(Content, { ref: content,
|
|
41
|
+
return (_jsxs(Root, { children: [_jsx(m.div, __assign({ style: styles }, { children: _jsx(Content, __assign({ ref: content }, props)) })), exceeds && (_jsxs(BtnWrap, __assign({ "$expanded": expanded }, { children: [_jsx(BtnFader, { "$bg": bg }), _jsxs(Btn, __assign({ "$fontSize": fontSize, "$lineHeight": lineHeight, onClick: handleExpandClick, "aria-expanded": expanded, "aria-label": expanded ? collapse : expand }, { children: [expanded ? collapse : expand, _jsx(BtnIcon, { "$expanded": expanded })] }))] })))] }));
|
|
69
42
|
};
|
|
43
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
package/Typography/TextLoop.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import { __assign, __rest } from "tslib";
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { useEffect, useRef, useState } from "react";
|
|
3
4
|
import { m, AnimatePresence } from "framer-motion";
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export var TextLoopPiece = function (_a) {
|
|
6
|
+
var _b = _a.text, text = _b === void 0 ? "" : _b, _c = _a.style, style = _c === void 0 ? {} : _c, _d = _a.className, className = _d === void 0 ? "" : _d, _e = _a.direction, direction = _e === void 0 ? "up" : _e, _f = _a.inline, inline = _f === void 0 ? true : _f, _g = _a.noOverflow, noOverflow = _g === void 0 ? true : _g, _h = _a.delay, delay = _h === void 0 ? 400 : _h;
|
|
7
|
+
var placeholderRef = useRef(null);
|
|
8
|
+
var _j = useState({ data: "", key: "" }), content = _j[0], setContent = _j[1];
|
|
9
|
+
var _k = useState(inline ? 0 : "auto"), width = _k[0], setWidth = _k[1];
|
|
10
|
+
useEffect(function () {
|
|
11
|
+
var timeoutId = setTimeout(function () {
|
|
10
12
|
if (!placeholderRef.current)
|
|
11
13
|
return;
|
|
12
14
|
placeholderRef.current.innerHTML = text + "";
|
|
@@ -14,15 +16,9 @@ export const TextLoopPiece = ({ text = "", style = {}, className = "", direction
|
|
|
14
16
|
setWidth(placeholderRef.current.offsetWidth);
|
|
15
17
|
setContent({ data: text + "", key: new Date() + "" });
|
|
16
18
|
}, delay);
|
|
17
|
-
return ()
|
|
19
|
+
return function () { return clearTimeout(timeoutId); };
|
|
18
20
|
}, [text, delay, inline]);
|
|
19
|
-
return (_jsxs("div", { className: className, style: {
|
|
20
|
-
...style,
|
|
21
|
-
position: "relative",
|
|
22
|
-
display: inline ? "inline-block" : "block",
|
|
23
|
-
width,
|
|
24
|
-
whiteSpace: inline ? "nowrap" : "normal",
|
|
25
|
-
}, children: [_jsx("span", { ref: placeholderRef, style: { visibility: "hidden" } }), _jsx("div", { style: {
|
|
21
|
+
return (_jsxs("div", __assign({ className: className, style: __assign(__assign({}, style), { position: "relative", display: inline ? "inline-block" : "block", width: width, whiteSpace: inline ? "nowrap" : "normal" }) }, { children: [_jsx("span", { ref: placeholderRef, style: { visibility: "hidden" } }), _jsx("div", __assign({ style: {
|
|
26
22
|
overflow: noOverflow ? "hidden" : "visible",
|
|
27
23
|
display: "block",
|
|
28
24
|
position: "absolute",
|
|
@@ -30,20 +26,21 @@ export const TextLoopPiece = ({ text = "", style = {}, className = "", direction
|
|
|
30
26
|
left: 0,
|
|
31
27
|
height: "100%",
|
|
32
28
|
width: "100%",
|
|
33
|
-
}, children: _jsx(AnimatePresence, { children: _jsx(m.div, { style: { position: "absolute" }, initial: {
|
|
29
|
+
} }, { children: _jsx(AnimatePresence, { children: _jsx(m.div, __assign({ style: { position: "absolute" }, initial: {
|
|
34
30
|
opacity: 0,
|
|
35
31
|
y: direction === "down" ? "-100%" : "100%",
|
|
36
32
|
}, animate: { opacity: 1, y: 0 }, exit: {
|
|
37
33
|
opacity: 0,
|
|
38
34
|
y: direction === "down" ? "100%" : "-100%",
|
|
39
|
-
}, children: content.data }, content.key) }) })] }));
|
|
35
|
+
} }, { children: content.data }), content.key) }) }))] })));
|
|
40
36
|
};
|
|
41
|
-
export
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
export var TextLoop = function (_a) {
|
|
38
|
+
var texts = _a.texts, _b = _a.interval, interval = _b === void 0 ? 3000 : _b, props = __rest(_a, ["texts", "interval"]);
|
|
39
|
+
var _c = useState(0), index = _c[0], setIndex = _c[1];
|
|
40
|
+
useEffect(function () {
|
|
41
|
+
var intervalId = setInterval(function () { return setIndex(function (index) { return index + 1; }); }, interval // every 3 seconds
|
|
45
42
|
);
|
|
46
|
-
return ()
|
|
43
|
+
return function () { return clearTimeout(intervalId); };
|
|
47
44
|
}, [interval]);
|
|
48
|
-
return _jsx(TextLoopPiece, {
|
|
45
|
+
return _jsx(TextLoopPiece, __assign({}, props, { text: texts[index % texts.length] }));
|
|
49
46
|
};
|
package/Typography/TypeStairs.js
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
3
|
import { forwardRef } from "react";
|
|
3
|
-
export
|
|
4
|
+
export var TypeStairs = forwardRef(function (_a, ref) {
|
|
5
|
+
var children = _a.children, limit = _a.limit;
|
|
4
6
|
// split in rows or just use one row if there is no limit
|
|
5
|
-
|
|
6
|
-
return rows.length > 1 ? (_jsx(_Fragment, { children: rows.map((row, rowIndex)
|
|
7
|
-
return (_jsxs("span", { children: [renderRow(row, rowIndex, ref), rowIndex !== rows.length - 1 && _jsx("br", {})] },
|
|
7
|
+
var rows = limit ? splitTextIntoRows(children, limit) : [children];
|
|
8
|
+
return rows.length > 1 ? (_jsx(_Fragment, { children: rows.map(function (row, rowIndex) {
|
|
9
|
+
return (_jsxs("span", { children: [renderRow(row, rowIndex, ref), rowIndex !== rows.length - 1 && _jsx("br", {})] }, "row-".concat(rowIndex)));
|
|
8
10
|
}) })) : (renderRow(rows[0], 0, ref));
|
|
9
11
|
});
|
|
10
12
|
/**
|
|
11
13
|
* every number chars find a space and break, then restart the gradient weight
|
|
12
14
|
* @see https://stackoverflow.com/a/25770787
|
|
13
15
|
*/
|
|
14
|
-
function splitTextIntoRows(input
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
function splitTextIntoRows(input, limit) {
|
|
17
|
+
if (input === void 0) { input = ""; }
|
|
18
|
+
if (limit === void 0) { limit = 18; }
|
|
19
|
+
var rows = [];
|
|
20
|
+
var arr = input.split(" ");
|
|
21
|
+
var currow = arr[0];
|
|
22
|
+
var rowlen = currow.length;
|
|
23
|
+
for (var i = 1; i < arr.length; i++) {
|
|
24
|
+
var word = arr[i];
|
|
21
25
|
rowlen += word.length + 1;
|
|
22
26
|
if (rowlen <= limit) {
|
|
23
27
|
currow += " " + word;
|
|
@@ -32,15 +36,15 @@ function splitTextIntoRows(input = "", limit = 18) {
|
|
|
32
36
|
return rows;
|
|
33
37
|
}
|
|
34
38
|
function renderRow(row, rowIndex, ref) {
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
var letters = row.split("");
|
|
40
|
+
var fontWeightIdx = 1;
|
|
37
41
|
// const fontWeight = Math.min(fontWeightIdx * 100, 800);
|
|
38
|
-
return (_jsx(_Fragment, { children: letters.map((letter, letterIndex)
|
|
39
|
-
|
|
42
|
+
return (_jsx(_Fragment, { children: letters.map(function (letter, letterIndex) {
|
|
43
|
+
var fontWeight = Math.min(fontWeightIdx * 100, 800);
|
|
40
44
|
// don't waste a fontWeight for a white space
|
|
41
45
|
if (letter !== " ") {
|
|
42
46
|
fontWeightIdx++;
|
|
43
47
|
}
|
|
44
|
-
return (_jsx("span", { style: { fontWeight }, ref: ref, children: letter },
|
|
48
|
+
return (_jsx("span", __assign({ style: { fontWeight: fontWeight }, ref: ref }, { children: letter }), "letter-".concat(rowIndex, "-").concat(letterIndex)));
|
|
45
49
|
}) }));
|
|
46
50
|
}
|
package/helpers/classed.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
1
2
|
import { createElement, forwardRef } from "react";
|
|
2
3
|
/**
|
|
3
4
|
* This utility allows to extend a component a là `styled-components` but for
|
|
@@ -15,12 +16,17 @@ import { createElement, forwardRef } from "react";
|
|
|
15
16
|
*/
|
|
16
17
|
export function classed(component) {
|
|
17
18
|
// @ts-expect-error nevermind for now...
|
|
18
|
-
|
|
19
|
-
return function (strings
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
var type = component.type || component;
|
|
20
|
+
return function (strings) {
|
|
21
|
+
var args = [];
|
|
22
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
23
|
+
args[_i - 1] = arguments[_i];
|
|
24
|
+
}
|
|
25
|
+
var WrappedComponent = forwardRef(function (props, ref) {
|
|
26
|
+
var _a;
|
|
27
|
+
var argResolved = args
|
|
28
|
+
.map(function (arg, index) {
|
|
29
|
+
var result = "";
|
|
24
30
|
if (typeof arg === "function") {
|
|
25
31
|
result = arg(props);
|
|
26
32
|
}
|
|
@@ -30,12 +36,12 @@ export function classed(component) {
|
|
|
30
36
|
return strings[index] + result;
|
|
31
37
|
})
|
|
32
38
|
.join("");
|
|
33
|
-
|
|
34
|
-
|
|
39
|
+
var isNativeHtmlElement = typeof type === "string";
|
|
40
|
+
var propsToForward = isNativeHtmlElement
|
|
35
41
|
? {}
|
|
36
42
|
: props;
|
|
37
43
|
if (isNativeHtmlElement) {
|
|
38
|
-
for (
|
|
44
|
+
for (var key in props) {
|
|
39
45
|
// like styled-components `transient` props
|
|
40
46
|
if (!key.startsWith("$")) {
|
|
41
47
|
// FIXME: for react 18 we need: @ts-expect-error
|
|
@@ -44,19 +50,16 @@ export function classed(component) {
|
|
|
44
50
|
}
|
|
45
51
|
}
|
|
46
52
|
// get the tagged function string outcome
|
|
47
|
-
|
|
53
|
+
var className = argResolved || strings[0];
|
|
48
54
|
// check if we need to clean it or not from the optional structure `< class="..."`
|
|
49
|
-
className = className.match(/class="([^"]*)/)
|
|
55
|
+
className = ((_a = className.match(/class="([^"]*)/)) === null || _a === void 0 ? void 0 : _a[1]) || className;
|
|
50
56
|
// add the custom classes from props
|
|
51
|
-
className += props
|
|
52
|
-
return createElement(type, {
|
|
53
|
-
// ...props,
|
|
54
|
-
...propsToForward,
|
|
57
|
+
className += (props === null || props === void 0 ? void 0 : props.className) ? " " + (props === null || props === void 0 ? void 0 : props.className) : "";
|
|
58
|
+
return createElement(type, __assign(__assign({}, propsToForward), {
|
|
55
59
|
// only add ot props if it is not an empty string
|
|
56
|
-
className: className || undefined,
|
|
60
|
+
className: className || undefined,
|
|
57
61
|
// add ref to props
|
|
58
|
-
ref
|
|
59
|
-
});
|
|
62
|
+
ref: ref }));
|
|
60
63
|
});
|
|
61
64
|
// FIXME: not sure if this is needed
|
|
62
65
|
// WrappedComponent.displayName = type.toString();
|