@koine/react 2.0.0-beta.10 → 2.0.0-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/package.json +11 -11
  2. package/Alert/Alert.js +0 -33
  3. package/Alert/Alert.stories.js +0 -39
  4. package/Alert/index.js +0 -6
  5. package/Animations/Reveal.js +0 -53
  6. package/Animations/Underline.js +0 -26
  7. package/Animations/index.js +0 -8
  8. package/Animations/useReveal.js +0 -83
  9. package/Autocomplete/AutocompleteDownshift.js +0 -167
  10. package/Autocomplete/AutocompleteDownshiftMultiselect.js +0 -362
  11. package/Autocomplete/AutocompleteMui.js +0 -183
  12. package/Autocomplete/AutocompleteReach.js +0 -121
  13. package/Autocomplete/components.js +0 -132
  14. package/Autocomplete/helpers.js +0 -34
  15. package/Autocomplete/index.js +0 -15
  16. package/Bg/BgColor.js +0 -64
  17. package/Bg/BgPhoto.js +0 -82
  18. package/Bg/BgSvg.js +0 -31
  19. package/Bg/index.js +0 -8
  20. package/Breadcrumbs/Breadcrumbs.js +0 -103
  21. package/Breadcrumbs/index.js +0 -6
  22. package/Buttons/Button.js +0 -106
  23. package/Buttons/ButtonComposite.js +0 -116
  24. package/Buttons/ButtonFab.js +0 -27
  25. package/Buttons/ButtonLink.js +0 -29
  26. package/Buttons/IconButton.js +0 -41
  27. package/Buttons/index.js +0 -10
  28. package/Calendar/CalendarDaygridCell.js +0 -105
  29. package/Calendar/CalendarDaygridNav.js +0 -63
  30. package/Calendar/CalendarDaygridTable.js +0 -126
  31. package/Calendar/CalendarLegend.js +0 -39
  32. package/Calendar/calendar-api-google.js +0 -110
  33. package/Calendar/index.js +0 -11
  34. package/Calendar/types.js +0 -4
  35. package/Calendar/useCalendar.js +0 -235
  36. package/Calendar/utils.js +0 -252
  37. package/Carousel/Carousel.js +0 -387
  38. package/Carousel/CarouselCss.js +0 -64
  39. package/Carousel/index.js +0 -6
  40. package/Collapsable/Collapsable.js +0 -11
  41. package/Collapsable/CollapsableReach.js +0 -251
  42. package/Collapsable/index.js +0 -7
  43. package/Debug/Debug.js +0 -34
  44. package/Debug/index.js +0 -6
  45. package/Details/Details.js +0 -117
  46. package/Details/Details.stories.js +0 -39
  47. package/Details/index.js +0 -6
  48. package/Dialog/DialogMui.js +0 -143
  49. package/Dialog/DialogMui.stories.js +0 -38
  50. package/Dialog/css/bare.js +0 -55
  51. package/Dialog/css/index.stories.js +0 -93
  52. package/Dialog/index.js +0 -11
  53. package/Dialog/m/bare.js +0 -125
  54. package/Dialog/m/basic.js +0 -50
  55. package/Dialog/m/index.js +0 -14
  56. package/Dialog/sc/bare.js +0 -83
  57. package/Dialog/sc/framer.js +0 -26
  58. package/Dialog/sc/framerMaterial.js +0 -26
  59. package/Dialog/sc/index.stories.js +0 -75
  60. package/Dialog/sc/material.js +0 -78
  61. package/Dialog/tw/bare.js +0 -55
  62. package/Dialog/tw/elegant.js +0 -54
  63. package/Dialog/tw/framer.js +0 -26
  64. package/Dialog/tw/framerMaterial.js +0 -26
  65. package/Dialog/tw/index.stories.js +0 -113
  66. package/Dialog/tw/material.js +0 -54
  67. package/Editor/Editor--tiptap.js +0 -72
  68. package/Editor/components.js +0 -59
  69. package/Editor/index.js +0 -6
  70. package/FaviconTags.js +0 -73
  71. package/Form/Form.js +0 -130
  72. package/Form/index.js +0 -6
  73. package/Form/sc/bare.js +0 -55
  74. package/Forms/Checkbox/Checkbox.js +0 -62
  75. package/Forms/Checkbox/index.js +0 -6
  76. package/Forms/Feedback/Feedback.js +0 -25
  77. package/Forms/Feedback/index.js +0 -6
  78. package/Forms/Field/Field.js +0 -75
  79. package/Forms/Field/FieldControl.js +0 -69
  80. package/Forms/Field/FieldHint.js +0 -17
  81. package/Forms/Field/index.js +0 -7
  82. package/Forms/Input/Input.js +0 -67
  83. package/Forms/Input/index.js +0 -6
  84. package/Forms/InputGroup/InputGroup.js +0 -85
  85. package/Forms/InputGroup/index.js +0 -6
  86. package/Forms/Label/Label.js +0 -46
  87. package/Forms/Label/index.js +0 -6
  88. package/Forms/Password/Password.js +0 -72
  89. package/Forms/Password/index.js +0 -6
  90. package/Forms/Radio/Radio.js +0 -68
  91. package/Forms/Radio/index.js +0 -6
  92. package/Forms/Switch/Switch.js +0 -80
  93. package/Forms/Switch/index.js +0 -6
  94. package/Forms/Textarea/Textarea.js +0 -45
  95. package/Forms/Textarea/TextareaRich.js +0 -58
  96. package/Forms/Textarea/index.js +0 -7
  97. package/Forms/Toggle/Toggle-tailwind.js +0 -99
  98. package/Forms/Toggle/Toggle.js +0 -175
  99. package/Forms/Toggle/index.js +0 -6
  100. package/Forms/Toggle/useToggle-tailwind.js +0 -202
  101. package/Forms/Toggle/useToggle.js +0 -145
  102. package/Forms/antispam.js +0 -59
  103. package/Forms/helpers.js +0 -72
  104. package/Forms/index.js +0 -19
  105. package/Forms/styles.js +0 -94
  106. package/Gauge/Gauge.js +0 -111
  107. package/Grid/Grid.js +0 -106
  108. package/Grid/index.js +0 -6
  109. package/Hamburger/Hamburger.js +0 -90
  110. package/Hamburger/index.js +0 -6
  111. package/Header/index.js +0 -6
  112. package/Header/useHeader.js +0 -54
  113. package/Hidden/Hidden.js +0 -21
  114. package/Hidden/index.js +0 -6
  115. package/Img/index.js +0 -6
  116. package/Img/sc/bare.js +0 -43
  117. package/Img/types.js +0 -6
  118. package/Link/Link.js +0 -13
  119. package/Link/LinkBlank.js +0 -52
  120. package/Link/index.js +0 -7
  121. package/Menu/Menu.js +0 -22
  122. package/Menu/MenuMui.js +0 -165
  123. package/Menu/index.js +0 -6
  124. package/MenuItem/MenuItem.js +0 -31
  125. package/MenuItem/MenuItemMui.js +0 -32
  126. package/MenuItem/index.js +0 -6
  127. package/MenuItem/useMenuItem.js +0 -96
  128. package/Meta/Meta.js +0 -26
  129. package/Meta/index.js +0 -12
  130. package/NoJs/NoJs.js +0 -28
  131. package/NoJs/index.js +0 -12
  132. package/Pagination/PaginationNav.js +0 -126
  133. package/Pagination/PaginationResults.js +0 -45
  134. package/Pagination/index.js +0 -7
  135. package/Pill/Pill.js +0 -62
  136. package/Pill/index.js +0 -6
  137. package/Progress/ProgressCircular.js +0 -62
  138. package/Progress/ProgressLinear.js +0 -53
  139. package/Progress/ProgressOverlay.js +0 -75
  140. package/Progress/index.js +0 -8
  141. package/Rating/Rating.js +0 -188
  142. package/Rating/index.js +0 -85
  143. package/Select/SelectDownshift.js +0 -47
  144. package/Select/components.js +0 -44
  145. package/Select/index.js +0 -13
  146. package/Sidebar/Sidebar.js +0 -74
  147. package/Sidebar/index.js +0 -6
  148. package/Spacing/Spacing.js +0 -55
  149. package/Spacing/index.js +0 -6
  150. package/Sticky/Sticky.js +0 -228
  151. package/Sticky/StickyCss.js +0 -20
  152. package/Sticky/index.js +0 -19
  153. package/Tabs/TabsMui.js +0 -91
  154. package/Tabs/TabsMui.stories.js +0 -38
  155. package/Tabs/index.js +0 -6
  156. package/Tabs/sc/bare.js +0 -86
  157. package/Tabs/sc/index.stories.js +0 -1
  158. package/Tabs/tw/bare.js +0 -45
  159. package/Tabs/tw/index.stories.js +0 -46
  160. package/Tabs/tw/material.js +0 -44
  161. package/Tabs/useTabs.js +0 -66
  162. package/Typography/CopyPasteVisible.js +0 -17
  163. package/Typography/Native.js +0 -90
  164. package/Typography/ReadMore.js +0 -125
  165. package/Typography/TextLoop.js +0 -108
  166. package/Typography/TypeStairs.js +0 -71
  167. package/Typography/index.js +0 -10
  168. package/css/index.js +0 -33
  169. package/helpers/classed.js +0 -66
  170. package/helpers/classed.stories.js +0 -140
  171. package/helpers/createUseMediaQueryWidth.js +0 -193
  172. package/helpers/extend-component.js +0 -32
  173. package/helpers/index.js +0 -9
  174. package/helpers/mergeRefs.js +0 -30
  175. package/hooks/index.js +0 -92
  176. package/hooks/types.js +0 -6
  177. package/hooks/useAsyncFn.js +0 -56
  178. package/hooks/useDateLocale.js +0 -51
  179. package/hooks/useFirstMountState.js +0 -28
  180. package/hooks/useFixedOffset.js +0 -67
  181. package/hooks/useFocus.js +0 -30
  182. package/hooks/useInterval.js +0 -44
  183. package/hooks/useIsomorphicLayoutEffect.js +0 -23
  184. package/hooks/useKeyUp.js +0 -40
  185. package/hooks/useMeasure.js +0 -189
  186. package/hooks/useMountedState.js +0 -31
  187. package/hooks/useNavigateAway.js +0 -69
  188. package/hooks/usePrevious.js +0 -33
  189. package/hooks/usePreviousRef.js +0 -27
  190. package/hooks/useScrollPosition.js +0 -83
  191. package/hooks/useScrollThreshold.js +0 -52
  192. package/hooks/useScrollTo.js +0 -39
  193. package/hooks/useSmoothScroll.js +0 -49
  194. package/hooks/useSpinDelay.js +0 -59
  195. package/hooks/useTraceUpdate.js +0 -39
  196. package/hooks/useUpdateEffect.js +0 -30
  197. package/hooks/useWindowSize.js +0 -43
  198. package/index.js +0 -10
  199. package/m/MotionProvider.js +0 -27
  200. package/m/index.js +0 -10
  201. package/m/lite.js +0 -12
  202. package/m/max.js +0 -12
  203. package/sc/index.js +0 -49
  204. package/scm/index.js +0 -40
  205. package/shared/index.js +0 -13
  206. package/styles/Body.js +0 -28
  207. package/styles/Global.js +0 -55
  208. package/styles/index.js +0 -142
  209. package/styles/media.js +0 -139
  210. package/styles/spacing.js +0 -70
  211. package/styles/styled.js +0 -58
  212. package/styles/theme--vanilla.js +0 -82
  213. package/styles/theme.js +0 -49
  214. package/tw/index.js +0 -33
  215. package/twm/index.js +0 -33
  216. package/types.js +0 -4
@@ -1,251 +0,0 @@
1
- /**
2
- * @file
3
- *
4
- * Maybe do a simplified version following this example:
5
- * https://codesandbox.io/s/framer-motion-accordion-qx958?file=/src/Example.tsx
6
- */ // import { forwardRef, useCallback, useEffect, useId, useRef, useState } from "react";
7
- // import styled from "styled-components";
8
- // import { MotionProps, m } from "framer-motion";
9
- // import {
10
- // Disclosure,
11
- // DisclosureButton,
12
- // DisclosurePanel,
13
- // } from "@reach/disclosure";
14
- // import { BsBoxArrowInDown as IconCollapse } from "react-icons/bs";
15
- // import { btnStyleReset } from "../Buttons";
16
- // import { useWindowSize } from "../hooks/useWindowSize";
17
- // import { InputInvisible } from "../Forms/styles";
18
- // export type CollapsableStyledProps = {
19
- // $expanded?: boolean;
20
- // };
21
- // /**
22
- // * `overflow-anchor: none;` keeps the same scrolling position
23
- // * @see https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Accordion/Accordion.js#L54
24
- // */
25
- // export const CollapsableRoot = styled(Disclosure)`
26
- // overflow-anchor: none;
27
- // `;
28
- // export const CollapsableHeadRoot = styled(m.label).attrs(
29
- // (props: Pick<CollapsableHeadProps, "id">) => ({
30
- // htmlFor: `${props.id}-input`,
31
- // })
32
- // )<Pick<CollapsableStyledProps, "$expanded">>`
33
- // ${btnStyleReset}
34
- // width: 100%;
35
- // padding: 0;
36
- // text-align: left;
37
- // display: flex;
38
- // justify-content: space-between;
39
- // align-items: center;
40
- // cursor: pointer;
41
- // `;
42
- // export const CollapsableHeadSpace = styled.div`
43
- // flex: 1;
44
- // padding-left: 20px;
45
- // `;
46
- // export const CollapsableHeadAction = styled.div`
47
- // padding-left: 20px;
48
- // `;
49
- // export const CollaspableHeadLine = styled(m.div)`
50
- // width: 0%;
51
- // height: 1px;
52
- // background: #bbb;
53
- // `;
54
- // export const collapsableHeadLineMotion = {
55
- // hover: {
56
- // width: "100%",
57
- // transition: {
58
- // duration: 0.4,
59
- // },
60
- // },
61
- // };
62
- // export const CollapsableHeadText = styled.div``;
63
- // export const CollapsableHeadIcon = styled(m.div)``;
64
- // export type CollapsableHeadProps = React.PropsWithChildren<
65
- // Pick<CollapsableStyledProps, "$expanded"> &
66
- // CollapsableComponents & {
67
- // id: CollapsableProps["id"];
68
- // onClick: (...args: any) => any;
69
- // }
70
- // >;
71
- // export const CollapsableHead = ({
72
- // $expanded,
73
- // id,
74
- // onClick,
75
- // HeadRoot = CollapsableHeadRoot,
76
- // HeadAction = CollapsableHeadAction,
77
- // HeadIcon = CollapsableHeadIcon,
78
- // children,
79
- // }: CollapsableHeadProps) => {
80
- // return (
81
- // <DisclosureButton
82
- // onClick={onClick}
83
- // // tabIndex={0}
84
- // // role="tab"
85
- // initial="rest"
86
- // whileHover="hover"
87
- // $expanded={$expanded}
88
- // as={HeadRoot}
89
- // id={id}
90
- // >
91
- // <CollapsableHeadText>{children}</CollapsableHeadText>
92
- // <CollapsableHeadSpace>
93
- // <CollaspableHeadLine
94
- // variants={collapsableHeadLineMotion}
95
- // animate={$expanded ? "hover" : ""}
96
- // />
97
- // </CollapsableHeadSpace>
98
- // {HeadAction && (
99
- // <HeadAction>
100
- // {HeadIcon && (
101
- // <HeadIcon animate={{ rotate: $expanded ? 180 : 0 }}>
102
- // <IconCollapse />
103
- // </HeadIcon>
104
- // )}
105
- // </HeadAction>
106
- // )}
107
- // </DisclosureButton>
108
- // );
109
- // };
110
- // export const CollapsableInput = styled(InputInvisible).attrs({
111
- // type: "checkbox",
112
- // })``;
113
- // export const CollasableBodyWrap = styled(
114
- // DisclosurePanel
115
- // )<CollapsableStyledProps>`
116
- // /* this is because @reach adds the "hidden" attribute */
117
- // &[hidden] {
118
- // display: block;
119
- // }
120
- // `;
121
- // export const CollapsableBodyRoot = styled(m.div)`
122
- // .no-js & {
123
- // transition: margin-top 0.2s ease;
124
- // }
125
- // .no-js ${CollapsableInput}:checked + ${CollasableBodyWrap} & {
126
- // margin-top: 0 !important;
127
- // opacity: 1 !important;
128
- // }
129
- // `;
130
- // export type CollapsableBodyProps = MotionProps &
131
- // Pick<CollapsableStyledProps, "$expanded"> & {
132
- // children?: React.ReactNode;
133
- // style?: React.CSSProperties;
134
- // };
135
- // export const CollapsableBody = forwardRef<HTMLDivElement, CollapsableBodyProps>(
136
- // function CollapsableBody(props, ref) {
137
- // return <CollapsableBodyRoot ref={ref} {...props} />;
138
- // }
139
- // );
140
- // export type CollapsableComponents = {
141
- // HeadRoot?: typeof CollapsableHeadRoot;
142
- // HeadAction?: null | typeof CollapsableHeadAction | React.FC<any>;
143
- // HeadIcon?: null | typeof CollapsableHeadIcon | React.FC<any>;
144
- // };
145
- // export type CollapsableProps = React.ComponentPropsWithoutRef<"div"> & {
146
- // id?: string;
147
- // expanded?: boolean;
148
- // /** Used to trigger a recalculation effect */
149
- // recalc?: any;
150
- // onChange?: () => any;
151
- // head: null | React.ReactNode;
152
- // body: React.ReactNode;
153
- // /** Amount of milliseconds after which the component collapses */
154
- // // autoCollapse?: number;
155
- // components?: CollapsableComponents;
156
- // /** @default "Expand" */
157
- // ariaExpand?: string;
158
- // /** @default "Collapse" */
159
- // ariaCollapse?: string;
160
- // };
161
- // export const Collapsable = ({
162
- // expanded: propExpanded,
163
- // recalc,
164
- // onChange,
165
- // id,
166
- // head,
167
- // body,
168
- // // autoCollapse,
169
- // components = {},
170
- // ariaExpand = "Expand",
171
- // ariaCollapse = "Collapse",
172
- // ...props
173
- // }: CollapsableProps) => {
174
- // const isControlled = typeof propExpanded !== "undefined";
175
- // const [stateExpanded, setStateExpanded] = useState(propExpanded);
176
- // const [height, setHeight] = useState(0);
177
- // const hash = id ? `#${id}` : "";
178
- // const winSize = useWindowSize();
179
- // const expanded = isControlled ? propExpanded : stateExpanded;
180
- // const [overflow, setOverflow] = useState(expanded ? "unset" : "hidden");
181
- // const content = useRef<HTMLDivElement>(null);
182
- // const defaultId = useId();
183
- // id = id || defaultId;
184
- // const handleClick = useCallback(() => {
185
- // if (hash) {
186
- // window.history.replaceState(
187
- // null,
188
- // "",
189
- // expanded ? window.location.pathname + window.location.search : hash
190
- // );
191
- // }
192
- // if (onChange) {
193
- // onChange();
194
- // }
195
- // if (!isControlled) {
196
- // setStateExpanded((prevExpanded) => !prevExpanded);
197
- // }
198
- // }, [expanded, hash, onChange, isControlled]);
199
- // const handleAnimationStart = useCallback(() => {
200
- // setOverflow("hidden");
201
- // }, []);
202
- // const handleAnimationComplete = useCallback(() => {
203
- // setOverflow(expanded ? "unset" : "hidden");
204
- // }, [expanded]);
205
- // useEffect(() => {
206
- // if (content.current) {
207
- // setHeight(Math.ceil(content.current.offsetHeight));
208
- // }
209
- // }, [winSize, recalc]);
210
- // // deeplink on mount
211
- // useEffect(() => {
212
- // if (!isControlled && hash && window.location.hash === hash) {
213
- // setStateExpanded(true);
214
- // }
215
- // }, [hash, isControlled]);
216
- // return (
217
- // <CollapsableRoot id={id} {...props} open={expanded || false}>
218
- // {head !== null && (
219
- // <CollapsableHead
220
- // id={id}
221
- // $expanded={expanded}
222
- // onClick={handleClick}
223
- // {...components}
224
- // >
225
- // {head}
226
- // </CollapsableHead>
227
- // )}
228
- // <CollapsableInput id={`${id}-input`} />
229
- // <CollasableBodyWrap $expanded={expanded} style={{ overflow }}>
230
- // <CollapsableBody
231
- // ref={content}
232
- // $expanded={expanded}
233
- // // aria-expanded={expanded}
234
- // // aria-label={expanded ? ariaCollapse : ariaExpand}
235
- // style={{
236
- // pointerEvents: expanded ? "all" : "none",
237
- // }}
238
- // onAnimationStart={handleAnimationStart}
239
- // onAnimationComplete={handleAnimationComplete}
240
- // animate={{
241
- // marginTop: expanded ? 0 : height ? `-${height}px` : "-100vh",
242
- // opacity: expanded ? 1 : 0.4,
243
- // }}
244
- // >
245
- // {body}
246
- // </CollapsableBody>
247
- // </CollasableBodyWrap>
248
- // </CollapsableRoot>
249
- // );
250
- // };
251
- "use strict";
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- const _export_star = require("@swc/helpers/_/_export_star");
6
- _export_star._(require("./Collapsable"), exports);
7
- // export * from "./CollapsableReach";
package/Debug/Debug.js DELETED
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "Debug", {
6
- enumerable: true,
7
- get: function() {
8
- return Debug;
9
- }
10
- });
11
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
- const _jsxruntime = require("react/jsx-runtime");
13
- const _styledcomponents = /*#__PURE__*/ _interop_require_default._(require("styled-components"));
14
- const Root = _styledcomponents.default.div`
15
- background: #f4f4f4;
16
- border: 1px solid #ddd;
17
- border-left: 3px solid #f36d33;
18
- color: #666;
19
- page-break-inside: avoid;
20
- font-family: monospace;
21
- font-size: small;
22
- line-height: 1.6;
23
- margin-bottom: 1.6em;
24
- max-width: 100%;
25
- overflow: auto;
26
- padding: 1em 1.5em;
27
- display: block;
28
- word-wrap: break-word;
29
- `;
30
- const Debug = ({ data })=>{
31
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(Root, {
32
- children: JSON.stringify(data, undefined, 2)
33
- });
34
- };
package/Debug/index.js DELETED
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- const _export_star = require("@swc/helpers/_/_export_star");
6
- _export_star._(require("./Debug"), exports);
@@ -1,117 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- Root: function() {
13
- return Root;
14
- },
15
- Summary: function() {
16
- return Summary;
17
- },
18
- Body: function() {
19
- return Body;
20
- },
21
- Content: function() {
22
- return Content;
23
- },
24
- KoineDetails: function() {
25
- return KoineDetails;
26
- }
27
- });
28
- const _jsxruntime = require("react/jsx-runtime");
29
- const _react = require("react");
30
- const _helpers = require("../helpers");
31
- const _useWindowSize = require("../hooks/useWindowSize");
32
- const Root = "details";
33
- const Summary = "summary";
34
- const Body = "div";
35
- const Content = "div";
36
- /**
37
- * FIXME: it actually works even without forwardRef, check if we do need it
38
- *
39
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details
40
- */ const DetailsWithRef = /*#__PURE__*/ (0, _react.forwardRef)(function Details({ id, open: propOpen, recalc, summary, children, Root: _Root, Summary: _Summary, Body: _Body, Content: _Content, onChange, ...props }, ref) {
41
- const isControlled = typeof propOpen !== "undefined";
42
- const [stateOpen, setStateOpen] = (0, _react.useState)(propOpen);
43
- const [, /* height */ setHeight] = (0, _react.useState)(0);
44
- const hash = id ? `#${id}` : "";
45
- const winSize = (0, _useWindowSize.useWindowSize)();
46
- const open = isControlled ? propOpen : stateOpen;
47
- const [overflow /* setOverflow */ ] = (0, _react.useState)(open ? "unset" : "hidden");
48
- const content = (0, _react.useRef)(null);
49
- const defaultId = (0, _react.useId)();
50
- id = id || defaultId;
51
- const handleClick = (0, _react.useCallback)(()=>{
52
- if (hash) {
53
- window.history.replaceState(null, "", open ? window.location.pathname + window.location.search : hash);
54
- }
55
- if (onChange) {
56
- onChange();
57
- }
58
- if (!isControlled) {
59
- setStateOpen((prevOpen)=>!prevOpen);
60
- }
61
- }, [
62
- open,
63
- hash,
64
- onChange,
65
- isControlled
66
- ]);
67
- (0, _react.useEffect)(()=>{
68
- if (content.current) {
69
- setHeight(Math.ceil(content.current.offsetHeight));
70
- }
71
- }, [
72
- winSize,
73
- recalc
74
- ]);
75
- // deeplink on mount
76
- (0, _react.useEffect)(()=>{
77
- if (!isControlled && hash && window.location.hash === hash) {
78
- setStateOpen(true);
79
- }
80
- }, [
81
- hash,
82
- isControlled
83
- ]);
84
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(Root, {
85
- ...props,
86
- open: open || false,
87
- children: [
88
- /*#__PURE__*/ (0, _jsxruntime.jsx)(Summary, {
89
- $open: open,
90
- onClick: handleClick,
91
- children: summary || " "
92
- }),
93
- /*#__PURE__*/ (0, _jsxruntime.jsx)(Body, {
94
- $open: open,
95
- style: {
96
- overflow
97
- },
98
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(Content, {
99
- // ref={content}
100
- $open: open,
101
- // aria-expanded={open}
102
- // aria-label={open ? ariaCollapse : ariaExpand}
103
- style: {
104
- pointerEvents: open ? "all" : "none"
105
- },
106
- children: children
107
- })
108
- })
109
- ]
110
- });
111
- });
112
- const KoineDetails = (0, _helpers.extendComponent)(DetailsWithRef, {
113
- Root,
114
- Summary,
115
- Body,
116
- Content
117
- }); // export default Details;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- default: function() {
13
- return _default;
14
- },
15
- Bare: function() {
16
- return Bare;
17
- }
18
- });
19
- const _jsxruntime = require("react/jsx-runtime");
20
- const _stories = require("@koine/stories");
21
- const _Details = require("./Details");
22
- const _default = {
23
- component: _Details.KoineDetails,
24
- title: "Base/Details",
25
- ..._stories.storyDetailsMeta
26
- };
27
- const BareTemplate = (args)=>{
28
- // return <StoryDetails {...args} Details={KoineDetails} />;
29
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_stories.StoryDetails, {
30
- ...args,
31
- Details: _Details.KoineDetails
32
- });
33
- // return <div><Details {...args} /></div>;
34
- };
35
- const Bare = BareTemplate.bind({});
36
- Bare.args = {
37
- summary: "Details summary",
38
- children: "Medium"
39
- };
package/Details/index.js DELETED
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- const _export_star = require("@swc/helpers/_/_export_star");
6
- _export_star._(require("./Details"), exports);
@@ -1,143 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- Root: function() {
13
- return Root;
14
- },
15
- Backdrop: function() {
16
- return Backdrop;
17
- },
18
- Container: function() {
19
- return Container;
20
- },
21
- Paper: function() {
22
- return Paper;
23
- },
24
- Close: function() {
25
- return Close;
26
- },
27
- Header: function() {
28
- return Header;
29
- },
30
- Body: function() {
31
- return Body;
32
- },
33
- KoineDialog: function() {
34
- return KoineDialog;
35
- }
36
- });
37
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
38
- const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
39
- const _jsxruntime = require("react/jsx-runtime");
40
- const _Modal = /*#__PURE__*/ _interop_require_default._(require("@mui/base/Modal"));
41
- const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
42
- const _md = require("react-icons/md");
43
- const _helpers = require("../helpers");
44
- const Root = _Modal.default;
45
- const Backdrop = "div";
46
- const Container = "div";
47
- const Paper = "div";
48
- const Close = "button";
49
- const Header = "div";
50
- const Body = "div";
51
- // const Dialog = ({
52
- // children,
53
- // title,
54
- // $scrollPaper,
55
- // Root: _Root,
56
- // Backdrop: _Backdrop,
57
- // Container: _Container,
58
- // Paper: _Paper,
59
- // Close: _Close,
60
- // Header: _Header,
61
- // Body: _Body,
62
- // ...props
63
- // }: KoineDialogProps) => (
64
- // <Root components={{ Backdrop }} onBackdropClick={props.onClose} {...props}>
65
- // <Container $scrollPaper={$scrollPaper}>
66
- // <Paper aria-label={title || ""} $scrollPaper={$scrollPaper}>
67
- // {title && <Header>{title}</Header>}
68
- // <Close onClick={props.onClose}>
69
- // <IconClose />
70
- // </Close>
71
- // <Body>{children}</Body>
72
- // </Paper>
73
- // </Container>
74
- // </Root>
75
- // );
76
- /**
77
- *
78
- * Main differences from [Mui Dialog](https://mui.com/material-ui/react-dialog):
79
- *
80
- * - By default uses `scroll="body"` instead of paper.
81
- * - Optionally uses `framer-motion` for animations
82
- * - Uses backdrop blur by default
83
- *
84
- * FIXME: it actually works even without forwardRef, check if we do need it
85
- */ const DialogWithRef = /*#__PURE__*/ (0, _react.forwardRef)(function Dialog({ children, title, $scrollPaper, Root: _Root, Backdrop: _Backdrop, Container: _Container, Paper: _Paper, Close: _Close, Header: _Header, Body: _Body, onClose, ...props }, ref) {
86
- // click handling is taken from
87
- // @see https://github.com/mui/material-ui/blob/c758b6c0b30f0831110458a746690b33147c45df/packages/mui-material/src/Dialog/Dialog.js#L205-L226
88
- const backdropClick = (0, _react.useRef)();
89
- const handleMouseDown = (event)=>{
90
- // We don't want to close the dialog when clicking the dialog content.
91
- // Make sure the event starts and ends on the same DOM element.
92
- backdropClick.current = event.target === event.currentTarget;
93
- };
94
- const handleBackdropClick = (event)=>{
95
- // Ignore the events not coming from the "backdrop".
96
- if (!backdropClick.current) {
97
- return;
98
- }
99
- backdropClick.current = null;
100
- // if (onBackdropClick) onBackdropClick(event);
101
- if (onClose) {
102
- onClose(event, "backdropClick");
103
- }
104
- };
105
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(Root, {
106
- slots: {
107
- backdrop: Backdrop
108
- },
109
- onClick: handleBackdropClick,
110
- onClose: onClose,
111
- ref: ref,
112
- ...props,
113
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(Container, {
114
- $scrollPaper: $scrollPaper,
115
- onMouseDown: handleMouseDown,
116
- children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(Paper, {
117
- "aria-label": title || "",
118
- $scrollPaper: $scrollPaper,
119
- children: [
120
- title && /*#__PURE__*/ (0, _jsxruntime.jsx)(Header, {
121
- children: title
122
- }),
123
- /*#__PURE__*/ (0, _jsxruntime.jsx)(Close, {
124
- onClick: onClose,
125
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_md.MdClear, {})
126
- }),
127
- /*#__PURE__*/ (0, _jsxruntime.jsx)(Body, {
128
- children: children
129
- })
130
- ]
131
- })
132
- })
133
- });
134
- });
135
- const KoineDialog = (0, _helpers.extendComponent)(DialogWithRef, {
136
- Root,
137
- Backdrop,
138
- Container,
139
- Paper,
140
- Close,
141
- Header,
142
- Body
143
- }); // export default Dialog;
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- default: function() {
13
- return _default;
14
- },
15
- Bare: function() {
16
- return Bare;
17
- }
18
- });
19
- const _jsxruntime = require("react/jsx-runtime");
20
- const _stories = require("@koine/stories");
21
- const _DialogMui = require("./DialogMui");
22
- const _default = {
23
- component: _DialogMui.KoineDialog,
24
- title: "Base/Dialog"
25
- };
26
- const BareTemplate = (args)=>{
27
- // return <StoryDialog {...args} Dialog={KoineDialog} />;
28
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_stories.StoryDialog, {
29
- ...args,
30
- Dialog: _DialogMui.KoineDialog
31
- });
32
- // return <div><Dialog {...args} /></div>;
33
- };
34
- const Bare = BareTemplate.bind({});
35
- Bare.args = {
36
- title: "Dialog title",
37
- children: _stories.LoremIpsum
38
- };