@koine/react 1.0.5 → 1.0.8

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.
Files changed (159) hide show
  1. package/Alert/Alert.js +18 -0
  2. package/Alert/index.js +1 -0
  3. package/Animations/Reveal.js +17 -0
  4. package/Animations/Underline.js +15 -0
  5. package/Animations/index.js +3 -0
  6. package/Animations/useReveal.js +70 -0
  7. package/Autocomplete/AutocompleteDownshift.js +158 -0
  8. package/Autocomplete/AutocompleteDownshiftMultiselect.js +353 -0
  9. package/Autocomplete/AutocompleteMui.js +172 -0
  10. package/Autocomplete/AutocompleteReach.js +112 -0
  11. package/Autocomplete/components.js +89 -0
  12. package/Autocomplete/helpers.js +28 -0
  13. package/Autocomplete/index.js +3 -0
  14. package/Bg/BgColor.js +33 -0
  15. package/Bg/BgPhoto.js +59 -0
  16. package/Bg/BgSvg.js +15 -0
  17. package/Bg/index.js +3 -0
  18. package/Breadcrumbs/Breadcrumbs.js +70 -0
  19. package/Breadcrumbs/index.js +1 -0
  20. package/Buttons/Button.js +79 -0
  21. package/Buttons/ButtonComposite.d.ts +1 -1
  22. package/Buttons/ButtonComposite.js +53 -0
  23. package/Buttons/ButtonFab.js +8 -0
  24. package/Buttons/ButtonLink.js +16 -0
  25. package/Buttons/IconButton.js +19 -0
  26. package/Buttons/index.js +5 -0
  27. package/Calendar/CalendarDaygridCell.js +52 -0
  28. package/Calendar/CalendarDaygridNav.js +23 -0
  29. package/Calendar/CalendarDaygridTable.js +49 -0
  30. package/Calendar/CalendarLegend.js +12 -0
  31. package/Calendar/calendar-api-google.js +97 -0
  32. package/Calendar/index.js +6 -0
  33. package/Calendar/types.js +1 -0
  34. package/Calendar/useCalendar.js +166 -0
  35. package/Calendar/utils.js +197 -0
  36. package/Carousel/Carousel.js +378 -0
  37. package/Carousel/CarouselCss.js +39 -0
  38. package/Carousel/index.js +1 -0
  39. package/Collapsable/Collapsable.js +132 -0
  40. package/Collapsable/index.js +1 -0
  41. package/Debug/Debug.js +21 -0
  42. package/Debug/index.js +1 -0
  43. package/Dialog/Dialog.js +93 -0
  44. package/Dialog/index.js +1 -0
  45. package/Editor/Editor--tiptap.js +21 -0
  46. package/Editor/components.d.ts +1 -2
  47. package/Editor/components.js +28 -0
  48. package/Editor/index.js +1 -0
  49. package/Favicon/FaviconTags.js +14 -0
  50. package/Favicon/index.js +1 -0
  51. package/Forms/Checkbox/Checkbox.js +24 -0
  52. package/Forms/Checkbox/index.js +1 -0
  53. package/Forms/Feedback/Feedback.js +10 -0
  54. package/Forms/Feedback/index.js +1 -0
  55. package/Forms/Field/Field.js +61 -0
  56. package/Forms/Field/FieldControl.js +45 -0
  57. package/Forms/Field/FieldHint.js +6 -0
  58. package/Forms/Field/index.js +2 -0
  59. package/Forms/Form/Form.js +64 -0
  60. package/Forms/Form/index.js +1 -0
  61. package/Forms/Input/Input.js +25 -0
  62. package/Forms/Input/index.js +1 -0
  63. package/Forms/InputGroup/InputGroup.js +42 -0
  64. package/Forms/InputGroup/index.js +1 -0
  65. package/Forms/Label/Label.js +24 -0
  66. package/Forms/Label/index.js +1 -0
  67. package/Forms/Password/Password.js +32 -0
  68. package/Forms/Password/index.js +1 -0
  69. package/Forms/Radio/Radio.js +31 -0
  70. package/Forms/Radio/index.js +1 -0
  71. package/Forms/Switch/Switch.js +50 -0
  72. package/Forms/Switch/index.js +1 -0
  73. package/Forms/Textarea/Textarea.js +15 -0
  74. package/Forms/Textarea/TextareaRich.js +44 -0
  75. package/Forms/Textarea/index.js +2 -0
  76. package/Forms/Toggle/Toggle.js +79 -0
  77. package/Forms/Toggle/index.js +1 -0
  78. package/Forms/Toggle/useToggle.js +143 -0
  79. package/Forms/antispam.js +56 -0
  80. package/Forms/helpers.js +44 -0
  81. package/Forms/index.js +17 -0
  82. package/Forms/styles.js +60 -0
  83. package/Gauge/Gauge.js +102 -0
  84. package/Grid/Grid.js +79 -0
  85. package/Grid/index.js +1 -0
  86. package/Hamburger/Hamburger.js +55 -0
  87. package/Hamburger/index.js +1 -0
  88. package/Header/index.js +1 -0
  89. package/Header/useHeader.js +30 -0
  90. package/Hidden/Hidden.js +14 -0
  91. package/Hidden/index.js +1 -0
  92. package/Img/Img.js +34 -0
  93. package/Img/index.js +1 -0
  94. package/Link/Link.js +2 -0
  95. package/Link/LinkBlank.d.ts +1 -1
  96. package/Link/LinkBlank.js +28 -0
  97. package/Link/index.js +2 -0
  98. package/Menu/Menu.js +11 -0
  99. package/Menu/index.js +1 -0
  100. package/MenuItem/MenuItem.js +20 -0
  101. package/MenuItem/index.js +1 -0
  102. package/Meta/Meta.js +4 -0
  103. package/Meta/index.js +1 -0
  104. package/NoJs/NoJs.js +6 -0
  105. package/NoJs/index.js +1 -0
  106. package/Pagination/PaginationNav.js +87 -0
  107. package/Pagination/PaginationResults.js +10 -0
  108. package/Pagination/index.js +2 -0
  109. package/Pill/Pill.js +37 -0
  110. package/Pill/index.js +1 -0
  111. package/Progress/ProgressCircular.js +38 -0
  112. package/Progress/ProgressLinear.js +34 -0
  113. package/Progress/ProgressOverlay.js +40 -0
  114. package/Progress/index.js +3 -0
  115. package/Rating/Rating.js +93 -0
  116. package/Rating/index.js +45 -0
  117. package/Select/SelectDownshift.js +38 -0
  118. package/Select/components.js +20 -0
  119. package/Select/index.js +3 -0
  120. package/Sidebar/Sidebar.js +48 -0
  121. package/Sidebar/index.js +1 -0
  122. package/Spacing/Spacing.js +47 -0
  123. package/Spacing/index.js +1 -0
  124. package/Sticky/Sticky.js +220 -0
  125. package/Sticky/StickyCss.js +6 -0
  126. package/Sticky/index.js +1 -0
  127. package/Tabs/Tabs.js +67 -0
  128. package/Tabs/index.js +1 -0
  129. package/Typography/CopyPasteVisible.js +6 -0
  130. package/Typography/Native.js +47 -0
  131. package/Typography/ReadMore.js +71 -0
  132. package/Typography/TextLoop.js +45 -0
  133. package/Typography/TypeStairs.js +46 -0
  134. package/Typography/index.js +5 -0
  135. package/helpers/index.js +19 -0
  136. package/hooks/index.js +5 -0
  137. package/hooks/useDateLocale.js +30 -0
  138. package/hooks/useFocus.js +11 -0
  139. package/hooks/usePrevious.js +8 -0
  140. package/hooks/useTraceUpdate.js +20 -0
  141. package/hooks/useWindowSize.js +13 -0
  142. package/index.js +36 -0
  143. package/index.umd.js +232 -239
  144. package/package.json +15 -9
  145. package/styles/Body.js +17 -0
  146. package/styles/Global.js +50 -0
  147. package/styles/classed.js +11 -0
  148. package/styles/index.js +7 -0
  149. package/styles/media.js +150 -0
  150. package/styles/spacing.d.ts +6 -6
  151. package/styles/spacing.js +46 -0
  152. package/styles/styled.d.ts +2 -2
  153. package/styles/styled.js +27 -0
  154. package/styles/theme--vanilla.js +53 -0
  155. package/styles/theme.d.ts +0 -7
  156. package/styles/theme.js +38 -0
  157. package/types.js +1 -0
  158. package/typings.d.ts +21 -0
  159. package/index.esm.js +0 -9456
package/Gauge/Gauge.js ADDED
@@ -0,0 +1,102 @@
1
+ // import styled, { keyframes } from "styled-components";
2
+ // import { m } from "framer-motion";
3
+ export const Gauge = (_props) => null;
4
+ // export type GaugeProps = {
5
+ // /** In percentage */
6
+ // value: number;
7
+ // };
8
+ // export const Gauge = ({
9
+ // value,
10
+ // counter = true,
11
+ // stroke,
12
+ // // emptyStroke = "#e2e2e2",
13
+ // emptyStroke = stroke,
14
+ // emptyStrokeOpacity = 0.25,
15
+ // // emptyStrokeOpacity = 1,
16
+ // duration = 3,
17
+ // delay = 0.5,
18
+ // size = 100,
19
+ // strokeWidth = 6,
20
+ // }) => {
21
+ // const radius = 45;
22
+ // const circumference = Math.ceil(2 * Math.PI * radius);
23
+ // const fillPercents = Math.abs(
24
+ // Math.ceil((circumference / 100) * (value - 100))
25
+ // );
26
+ // const transition = {
27
+ // duration: duration,
28
+ // delay: delay,
29
+ // ease: "easeIn",
30
+ // };
31
+ // const variants = {
32
+ // hidden: {
33
+ // strokeDashoffset: circumference,
34
+ // transition,
35
+ // },
36
+ // show: {
37
+ // strokeDashoffset: fillPercents,
38
+ // transition,
39
+ // },
40
+ // };
41
+ // return (
42
+ // <>
43
+ // <Flex justifyContent="center" alignItems="center">
44
+ // {counter && (
45
+ // <Box
46
+ // position="absolute"
47
+ // fontSize={size >= 100 ? 6 : 3}
48
+ // fontWeight={2}
49
+ // color="text500"
50
+ // >
51
+ // <Counter valueTo={value} totalDuration={duration + delay} />%
52
+ // </Box>
53
+ // )}
54
+ // <Box height={size}>
55
+ // <svg
56
+ // viewBox="0 0 100 100"
57
+ // version="1.1"
58
+ // xmlns="http://www.w3.org/2000/svg"
59
+ // width={size}
60
+ // height={size}
61
+ // >
62
+ // <circle
63
+ // cx="50"
64
+ // cy="50"
65
+ // r={radius}
66
+ // className="circle"
67
+ // strokeWidth={strokeWidth}
68
+ // stroke={emptyStroke}
69
+ // strokeOpacity={emptyStrokeOpacity}
70
+ // fill="transparent"
71
+ // />
72
+ // </svg>
73
+ // <svg
74
+ // viewBox="0 0 100 100"
75
+ // width={size}
76
+ // height={size}
77
+ // style={{
78
+ // position: "absolute",
79
+ // transform: "rotate(-90deg)",
80
+ // overflow: "visible",
81
+ // marginLeft: -size,
82
+ // }}
83
+ // >
84
+ // <m.circle
85
+ // cx="50"
86
+ // cy="50"
87
+ // r={radius}
88
+ // strokeWidth={strokeWidth}
89
+ // stroke={stroke}
90
+ // fill="transparent"
91
+ // strokeDashoffset={fillPercents}
92
+ // strokeDasharray={circumference}
93
+ // variants={variants}
94
+ // initial="hidden"
95
+ // animate={"show"}
96
+ // />
97
+ // </svg>
98
+ // </Box>
99
+ // </Flex>
100
+ // </>
101
+ // );
102
+ // };
package/Grid/Grid.js ADDED
@@ -0,0 +1,79 @@
1
+ import styled from "styled-components";
2
+ export const GRID_COLUMNS = 12;
3
+ export const GRID_GUTTER_DEFAULT = "half";
4
+ export const Container = styled.div `
5
+ max-width: ${(p) => p.theme.breakpoints[p.size]}px;
6
+ margin: 0 auto;
7
+ padding: 0 ${(p) => p.theme.gutter[p.$gutter || GRID_GUTTER_DEFAULT]}px;
8
+ ${(p) => (p.clamp ? "overflow: hidden;" : "")}
9
+ `;
10
+ export const ContainerFluid = styled.div `
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
+ `;
29
+ function getColWidth(breakpoints, breakpoint, value) {
30
+ const breakpointValue = breakpoints[breakpoint] + "px";
31
+ const width = (value * 100) / GRID_COLUMNS;
32
+ const cssValue = `
33
+ min-width: ${width}%;
34
+ flex: 0 0 ${width}%;
35
+ `;
36
+ if (breakpoint === Object.keys(breakpoints)[0]) {
37
+ return cssValue;
38
+ }
39
+ return `
40
+ @media (min-width: ${breakpointValue}){
41
+ ${cssValue}
42
+ }`;
43
+ }
44
+ function getColCss(props) {
45
+ const { $auto, $offset, $width } = props;
46
+ const { breakpoints } = props.theme;
47
+ let css = "";
48
+ if ($offset) {
49
+ const offsets = $offset.split(",");
50
+ for (let i = 0; i <= offsets.length; i++) {
51
+ if (offsets[i]) {
52
+ const [offsetBreakpoint, offsetSize] = offsets[i].split(":");
53
+ css += `
54
+ @media(min-width: ${breakpoints[offsetBreakpoint]}px){
55
+ margin-left: ${(100 * offsetSize) / GRID_COLUMNS}%;
56
+ }
57
+ `;
58
+ }
59
+ }
60
+ }
61
+ if ($width) {
62
+ // do nothing, width is set explicitly
63
+ }
64
+ else if ($auto) {
65
+ css += `flex: 0 0 auto; width: auto; max-width: none;`;
66
+ }
67
+ else {
68
+ for (const breakpoint in breakpoints) {
69
+ const value = props[breakpoint];
70
+ if (typeof value !== "undefined") {
71
+ css += getColWidth(breakpoints, breakpoint, value);
72
+ }
73
+ else if (breakpoint === "xs") {
74
+ css += getColWidth(breakpoints, breakpoint, 12);
75
+ }
76
+ }
77
+ }
78
+ return css;
79
+ }
package/Grid/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./Grid";
@@ -0,0 +1,55 @@
1
+ import { __rest } from "tslib";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ /**
4
+ * @file
5
+ *
6
+ * Simplified from https://github.com/luukdv/hamburger-react
7
+ */
8
+ import styled from "styled-components";
9
+ const HamburgerLabel = styled.div `
10
+ position: absolute;
11
+ top: 30px;
12
+ font-size: ${({ $toggled }) => ($toggled ? "0" : "9px")};
13
+ text-transform: uppercase;
14
+ left: 7px;
15
+ letter-spacing: 3px;
16
+ `;
17
+ const area = 48;
18
+ const lines = 3;
19
+ const width = 32;
20
+ const room = Math.round((area - width) / 2);
21
+ const barHeightRaw = width / 12;
22
+ const barHeight = Math.round(barHeightRaw);
23
+ const space = 0.5;
24
+ const marginRaw = width / (lines * (space + (lines === 3 ? 1 : 1.25)));
25
+ const margin = Math.round(marginRaw);
26
+ const height = barHeight * lines + margin * (lines - 1);
27
+ const topOffset = Math.round((area - height) / 2);
28
+ const translate = 4.6325;
29
+ const deviation = (barHeightRaw - barHeight + (marginRaw - margin)) / (lines === 3 ? 1 : 2);
30
+ const move = parseFloat((width / translate - deviation / (4 / 3)).toFixed(2));
31
+ const time = 0.4;
32
+ const easing = "cubic-bezier(0, 0, 0, 1)";
33
+ const transition = `${time}s ${easing}`;
34
+ const burgerStyles = {
35
+ marginRight: "-8px",
36
+ position: "relative",
37
+ width: `${area}px`,
38
+ height: `${area}px`,
39
+ userSelect: "none",
40
+ outline: "0px",
41
+ cursor: "pointer",
42
+ transition,
43
+ };
44
+ const barStyles = {
45
+ position: "absolute",
46
+ width: `${width}px`,
47
+ height: `${barHeight}px`,
48
+ left: `${room}px`,
49
+ background: "currentColor",
50
+ transition,
51
+ };
52
+ export const Hamburger = (_a) => {
53
+ var { toggled } = _a, props = __rest(_a, ["toggled"]);
54
+ return (_jsxs("div", Object.assign({ style: Object.assign(Object.assign({}, burgerStyles), { transform: `${toggled ? `rotate(90deg)` : "none"}` }), tabIndex: 0 }, props, { children: [_jsx("div", { style: Object.assign(Object.assign({}, barStyles), { top: `${topOffset}px`, transform: `${toggled ? `rotate(-45deg) translate(0px, ${move}px)` : "none"}` }) }), _jsx("div", { style: Object.assign(Object.assign({}, barStyles), { top: `${topOffset + barHeight + margin}px`, transform: `${toggled ? `rotate(45deg) translate(0, -${move}px)` : "none"}` }) }), _jsx(HamburgerLabel, Object.assign({ "$toggled": toggled }, { children: "Menu" }))] })));
55
+ };
@@ -0,0 +1 @@
1
+ export * from "./Hamburger";
@@ -0,0 +1 @@
1
+ export * from "./useHeader";
@@ -0,0 +1,30 @@
1
+ import { useEffect, useState } from "react";
2
+ import { useScrollPosition } from "@n8tb1t/use-scroll-position";
3
+ import { useTheme } from "../styles/theme";
4
+ import { useMedia } from "../styles/media";
5
+ export const useHeader = () => {
6
+ const [isSticky, setIsSticky] = useState(false);
7
+ const { header: themed } = useTheme();
8
+ const isDesktopLayout = useMedia(`min:${themed.breakpoint}`);
9
+ const valueIdx = isDesktopLayout ? 1 : 0;
10
+ const [headerHeight, setHeaderHeight] = useState(themed.height[valueIdx]);
11
+ const [placeholderHeight, setPlaceholderHeight] = useState(themed.height[valueIdx]);
12
+ const [logoWidth, setLogoWidth] = useState(themed.logoWidth[valueIdx]);
13
+ useScrollPosition(({ currPos }) => {
14
+ const isPastThreshold = currPos.y * -1 > 40;
15
+ if (isSticky !== isPastThreshold)
16
+ setIsSticky(isPastThreshold);
17
+ }, [isSticky]);
18
+ useEffect(() => {
19
+ const valueIdx = isDesktopLayout ? 1 : 0;
20
+ setPlaceholderHeight(themed.height[valueIdx]);
21
+ setHeaderHeight(isSticky ? themed.heightSticky[valueIdx] : themed.height[valueIdx]);
22
+ setLogoWidth(isSticky ? themed.logoWidthSticky[valueIdx] : themed.logoWidth[valueIdx]);
23
+ }, [themed, isSticky, isDesktopLayout]);
24
+ return [
25
+ isSticky,
26
+ placeholderHeight,
27
+ headerHeight,
28
+ logoWidth,
29
+ ];
30
+ };
@@ -0,0 +1,14 @@
1
+ import styled from "styled-components";
2
+ export const Hidden = styled.div `
3
+ ${(p) => `${p.$min
4
+ ? `
5
+ @media (min-width: ${p.theme.breakpoints[p.$min]}px) {
6
+ display: none;
7
+ }`
8
+ : ""} ${p.$max
9
+ ? `
10
+ @media (max-width: ${p.theme.breakpoints[p.$max]}px) {
11
+ display: none;
12
+ }`
13
+ : ""}`}
14
+ `;
@@ -0,0 +1 @@
1
+ export * from "./Hidden";
package/Img/Img.js ADDED
@@ -0,0 +1,34 @@
1
+ import styled from "styled-components";
2
+ // export type KoineImgProps = {
3
+ // /** @default "cover" */
4
+ // $fit?: "cover" | "contain";
5
+ // };
6
+ export const KoineImg = styled.img ``;
7
+ // /**
8
+ // * Replacement core component for native `<img />`
9
+ // *
10
+ // * Features:
11
+ // * - lazy load
12
+ // * - proportion cage
13
+ // */
14
+ // export const Img = ({
15
+ // className,
16
+ // style = {},
17
+ // lazyProps,
18
+ // ...props
19
+ // }: ImgProps) => {
20
+ // let { width, height, src } = props;
21
+ // width = width ? `${width}px` : "100%";
22
+ // height = height ? `${height}px` : "100%";
23
+ // const imgProps = { width, height, src };
24
+ // return (
25
+ // <ImgRoot style={{ width, height, ...style }} className={className}>
26
+ // <LazyLoad {...lazyProps}>
27
+ // <ImgNative {...imgProps} />
28
+ // </LazyLoad>
29
+ // <noscript>
30
+ // <img {...imgProps} />
31
+ // </noscript>
32
+ // </ImgRoot>
33
+ // );
34
+ // };
package/Img/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./Img";
package/Link/Link.js ADDED
@@ -0,0 +1,2 @@
1
+ import styled from "styled-components";
2
+ export const KoineLink = styled.a ``;
@@ -4,5 +4,5 @@ export declare const LinkBlankA: import("styled-components").StyledComponent<"a"
4
4
  target: "_blank";
5
5
  rel: "noopener";
6
6
  }, "rel" | "target">;
7
- export declare const LinkBlankIcon: import("styled-components").StyledComponent<import("@react-icons/all-files/lib").IconType, import("styled-components").DefaultTheme, {}, never>;
7
+ export declare const LinkBlankIcon: import("styled-components").StyledComponent<import("react-icons/lib").IconType, import("styled-components").DefaultTheme, {}, never>;
8
8
  export declare const LinkBlank: React.FC<LinkBlankProps>;
@@ -0,0 +1,28 @@
1
+ import { __rest } from "tslib";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import styled from "styled-components";
4
+ import { MdLaunch as IconOutboundLink } from "react-icons/md";
5
+ import { max } from "../styles/media";
6
+ export const LinkBlankA = styled.a.attrs({
7
+ target: "_blank",
8
+ rel: "noopener",
9
+ }) ``;
10
+ // TODO: use `touch` class on <html> instead of relying on screenwidth,
11
+ // probably implement a lean Modernizr like thing with react-helmet
12
+ export const LinkBlankIcon = styled(IconOutboundLink) `
13
+ color: var(---grey100);
14
+ font-size: inherit;
15
+ margin-left: 3px;
16
+ line-height: inherit;
17
+ vertical-align: middle;
18
+ width: 0px;
19
+ transition: width 0.1s ease-in-out;
20
+ ${max.sm} {
21
+ width: 20px;
22
+ opacity: 0.8;
23
+ }
24
+ `;
25
+ export const LinkBlank = (_a) => {
26
+ var { children, target, rel } = _a, props = __rest(_a, ["children", "target", "rel"]);
27
+ return (_jsxs(LinkBlankA, Object.assign({}, props, { children: [children, _jsx(LinkBlankIcon, {})] })));
28
+ };
package/Link/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./Link";
2
+ export * from "./LinkBlank";
package/Menu/Menu.js ADDED
@@ -0,0 +1,11 @@
1
+ import styled from "styled-components";
2
+ export const Menu = styled.ul `
3
+ z-index: 3;
4
+ position: absolute;
5
+ list-style-type: none;
6
+ margin: 0;
7
+ padding: 0;
8
+ background: #fff;
9
+ width: 100%;
10
+ box-shadow: var(--shadow);
11
+ `;
package/Menu/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./Menu";
@@ -0,0 +1,20 @@
1
+ import styled from "styled-components";
2
+ export const MenuItem = styled.li `
3
+ padding: 8px 16px;
4
+
5
+ &[aria-selected="true"] {
6
+ background: var(--accent400);
7
+ }
8
+
9
+ /** DEP: this is just for MultiselectMui? */
10
+ &.Mui-focused,
11
+ &[data-focus="true"] {
12
+ background: var(--accent300);
13
+ color: white;
14
+ }
15
+
16
+ &:not([disabled]):hover {
17
+ cursor: pointer;
18
+ background: var(--accent300);
19
+ }
20
+ `;
@@ -0,0 +1 @@
1
+ export * from "./MenuItem";
package/Meta/Meta.js ADDED
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export const Meta = ({ zoom }) => {
3
+ return (_jsx("meta", { name: "viewport", content: `width=device-width, initial-scale=1, maximum-scale=1${zoom ? "" : ", user-scalable=0"}` }));
4
+ };
package/Meta/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./Meta";
package/NoJs/NoJs.js ADDED
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export const NoJs = (_props) => {
3
+ return (_jsx("script", { id: "no-js", dangerouslySetInnerHTML: {
4
+ __html: `document.querySelector("html").className=document.querySelector("html").className.replace(/no-js/,"") + "js";`,
5
+ } }));
6
+ };
package/NoJs/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./NoJs";
@@ -0,0 +1,87 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import styled from "styled-components";
3
+ import { CgArrowRightR as IconArrowRight, CgArrowLeftR as IconArrowLeft, } from "react-icons/cg";
4
+ import { ensureInt } from "@koine/utils";
5
+ const Root = styled.nav `
6
+ display: flex;
7
+ align-items: center;
8
+ justify-content: center;
9
+ padding: 20px 0 40px;
10
+ font-weight: 600;
11
+
12
+ & a {
13
+ text-decoration: none;
14
+ }
15
+ `;
16
+ const item = `
17
+ display: block;
18
+ padding: 5px 10px;
19
+ `;
20
+ const ItemCurrent = styled.span `
21
+ ${item}
22
+ background: var(--accent400);
23
+ border-radius: 2px;
24
+ `;
25
+ const ItemLink = styled.a `
26
+ ${item}
27
+
28
+ ${(props) => (props.prev ? "color: var(--grey100);" : "")}
29
+ `;
30
+ const DotsSeparator = styled.span `
31
+ color: var(--grey100);
32
+ `;
33
+ const arrow = `display: flex; font-size: 20px;`;
34
+ const ItemPrev = styled.a `
35
+ ${arrow}
36
+ `;
37
+ const ItemNext = styled.a `
38
+ ${arrow}
39
+ `;
40
+ /*
41
+ * Possible outcomes:
42
+ * [1] 2 3 ... 78 >
43
+ * < 1 2 [3] 4 5 ... 78 >
44
+ * < 1 ... 6 7 [8] 9 10 ... 78 >
45
+ * < 1 ... 75 76 [77] 78 >
46
+ * < 1 ... 76 77 [78]
47
+ */
48
+ export const KoinePaginationNav = ({ total, perPage, currentPage, baseUrl, showOffset = 2, Koine = {
49
+ Link: "a",
50
+ currentUrl: "/",
51
+ }, }) => {
52
+ const { Link, currentUrl } = Koine;
53
+ total = ensureInt(total);
54
+ currentPage = ensureInt(currentPage);
55
+ perPage = ensureInt(perPage);
56
+ // page 0 means 1
57
+ currentPage = currentPage || 1;
58
+ baseUrl = baseUrl || currentUrl;
59
+ // don't output anything if pagination is not needed
60
+ if (total < perPage) {
61
+ return null;
62
+ }
63
+ const firstPage = 1;
64
+ const lastPage = Math.ceil(total / perPage);
65
+ const prevPage = currentPage - 1 > firstPage ? currentPage - 1 : "";
66
+ const nextPage = currentPage + 1 < lastPage ? currentPage + 1 : lastPage;
67
+ const prevArrow = currentPage > firstPage;
68
+ const nextArrow = currentPage < lastPage;
69
+ const pages = [];
70
+ // fill the pages before the current
71
+ for (let i = currentPage - showOffset; i < currentPage; i++) {
72
+ if (i > 1) {
73
+ pages.push(i);
74
+ }
75
+ }
76
+ // add the current
77
+ pages.push(currentPage);
78
+ // fill the pages after the current
79
+ for (let i = currentPage + 1; i < currentPage + 1 + showOffset; i++) {
80
+ if (i < lastPage) {
81
+ pages.push(i);
82
+ }
83
+ }
84
+ const prevDots = pages[0] > firstPage + 1;
85
+ const nextDots = pages[pages.length - 1] < lastPage - 1;
86
+ return (_jsxs(Root, { children: [prevArrow && (_jsx(ItemPrev, Object.assign({ as: Link, href: `${baseUrl}/${prevPage}` }, { children: _jsx(IconArrowLeft, {}) }))), firstPage !== currentPage && (_jsx(ItemLink, Object.assign({ as: Link, href: `${baseUrl}`, prev: true }, { children: firstPage }))), prevDots && _jsx(DotsSeparator, { children: "..." }), pages.map((page) => page === currentPage ? (_jsx(ItemCurrent, { children: page }, page)) : (_jsx(ItemLink, Object.assign({ as: Link, href: `${baseUrl}/${page}`, prev: page < currentPage, next: page > currentPage }, { children: page }), `pagination-${page}`))), nextDots && _jsx(DotsSeparator, { children: "..." }), lastPage !== currentPage && (_jsx(ItemLink, Object.assign({ as: Link, href: `${baseUrl}/${lastPage}`, next: true }, { children: lastPage }))), nextArrow && (_jsx(ItemNext, Object.assign({ as: Link, href: `${baseUrl}/${nextPage}` }, { children: _jsx(IconArrowRight, {}) })))] }));
87
+ };
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import styled from "styled-components";
3
+ import { AnimatePresence, m } from "framer-motion";
4
+ const Root = styled.div `
5
+ // overflow: hidden;
6
+ `;
7
+ const Inner = styled(m.div) ``;
8
+ export const PaginationResults = ({ children, }) => {
9
+ return (_jsx(AnimatePresence, Object.assign({ exitBeforeEnter: true, initial: true }, { children: _jsx(Root, { children: _jsx(Inner, Object.assign({ initial: { opacity: 0, x: -100 }, animate: { opacity: 1, x: 0 }, exit: { opacity: 0, x: 100 }, transition: { type: "linear", staggerChildren: 0.3 } }, { children: children })) }) })));
10
+ };
@@ -0,0 +1,2 @@
1
+ export * from "./PaginationNav";
2
+ export * from "./PaginationResults";
package/Pill/Pill.js ADDED
@@ -0,0 +1,37 @@
1
+ import styled from "styled-components";
2
+ export const Pill = styled.div `
3
+ display: inline-block;
4
+ padding: 5px 10px;
5
+ margin: 0 0.5em 0.5em 0;
6
+ border-radius: 2px;
7
+ text-decoration: none;
8
+ font-size: 13px;
9
+ font-weight: 600;
10
+ `;
11
+ export const PillGreyLight = styled(Pill) `
12
+ background: var(--grey800);
13
+ color: var(--grey100);
14
+
15
+ &:hover {
16
+ color: white;
17
+ background: var(--grey300);
18
+ }
19
+ `;
20
+ export const PillAccentLight = styled(Pill) `
21
+ background: var(--accent400);
22
+ color: var(--grey100);
23
+
24
+ &:hover {
25
+ color: #fff;
26
+ background: var(--accent300);
27
+ }
28
+ `;
29
+ export const PillAccentLightOutlined = styled(Pill) `
30
+ border: 1px solid var(--accent300);
31
+ color: var(--accent200);
32
+
33
+ &:hover {
34
+ color: #fff;
35
+ background: var(--accent300);
36
+ }
37
+ `;
package/Pill/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./Pill";
@@ -0,0 +1,38 @@
1
+ import { __rest } from "tslib";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import styled, { keyframes } from "styled-components";
4
+ const animationRotation = keyframes `
5
+ 0% {
6
+ transform: rotate(0deg);
7
+ }
8
+ 100% {
9
+ transform: rotate(360deg);
10
+ }
11
+ `;
12
+ const animationCircle = keyframes `
13
+ 0% {
14
+ stroke-dasharray: 1px, 200px;
15
+ stroke-dashoffset: 0;
16
+ }
17
+ 50% {
18
+ stroke-dasharray: 100px, 200px;
19
+ stroke-dashoffset: -15px;
20
+ }
21
+ 100% {
22
+ stroke-dasharray: 100px, 200px;
23
+ stroke-dashoffset: -125px;
24
+ }
25
+ `;
26
+ const ProgressCircularSvg = styled.svg `
27
+ animation: ${animationRotation} 1.5s linear infinite;
28
+ `;
29
+ const ProgressCircularCircle = styled.circle `
30
+ animation: ${animationCircle} 1.5s linear infinite;
31
+ `;
32
+ /**
33
+ * @see https://mui.com/components/progress/
34
+ */
35
+ export const ProgressCircular = (_a) => {
36
+ var { size = "1em", thickness = 1, color = "currentColor" } = _a, props = __rest(_a, ["size", "thickness", "color"]);
37
+ return (_jsx(ProgressCircularSvg, Object.assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 44 44", style: { width: size, height: size } }, props, { children: _jsx(ProgressCircularCircle, { cx: "22", cy: "22", r: "20", fill: "none", strokeWidth: thickness, style: { stroke: color } }) })));
38
+ };
@@ -0,0 +1,34 @@
1
+ import { __rest } from "tslib";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import styled from "styled-components";
4
+ import { m } from "framer-motion";
5
+ const ProgressLinearBg = styled.span `
6
+ position: relative;
7
+ overflow: hidden;
8
+ display: block;
9
+ height: 4px;
10
+ `;
11
+ const ProgressLinearFg = styled(m.span) `
12
+ position: absolute;
13
+ top: 0;
14
+ bottom: 0;
15
+ left: 0;
16
+ width: 100%;
17
+ `;
18
+ /**
19
+ * @see https://mui.com/components/progress/#linear
20
+ */
21
+ export const ProgressLinear = (_a) => {
22
+ var { done = false, height = "2px", bg = "transparent", fg = "currentColor" } = _a, props = __rest(_a, ["done", "height", "bg", "fg"]);
23
+ return (_jsx(ProgressLinearBg, Object.assign({ style: { height, background: bg } }, props, { children: _jsx(ProgressLinearFg, { style: { height, background: fg }, initial: {
24
+ x: "-100%",
25
+ }, animate: {
26
+ x: done ? "-100%" : "0%",
27
+ }, transition: done
28
+ ? {}
29
+ : {
30
+ repeat: Infinity,
31
+ repeatType: "reverse",
32
+ duration: 2,
33
+ } }) })));
34
+ };