@koine/react 2.0.0-beta.10 → 2.0.0-beta.11
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/package.json +11 -11
- package/Alert/Alert.js +0 -33
- package/Alert/Alert.stories.js +0 -39
- package/Alert/index.js +0 -6
- package/Animations/Reveal.js +0 -53
- package/Animations/Underline.js +0 -26
- package/Animations/index.js +0 -8
- package/Animations/useReveal.js +0 -83
- package/Autocomplete/AutocompleteDownshift.js +0 -167
- package/Autocomplete/AutocompleteDownshiftMultiselect.js +0 -362
- package/Autocomplete/AutocompleteMui.js +0 -183
- package/Autocomplete/AutocompleteReach.js +0 -121
- package/Autocomplete/components.js +0 -132
- package/Autocomplete/helpers.js +0 -34
- package/Autocomplete/index.js +0 -15
- package/Bg/BgColor.js +0 -64
- package/Bg/BgPhoto.js +0 -82
- package/Bg/BgSvg.js +0 -31
- package/Bg/index.js +0 -8
- package/Breadcrumbs/Breadcrumbs.js +0 -103
- package/Breadcrumbs/index.js +0 -6
- package/Buttons/Button.js +0 -106
- package/Buttons/ButtonComposite.js +0 -116
- package/Buttons/ButtonFab.js +0 -27
- package/Buttons/ButtonLink.js +0 -29
- package/Buttons/IconButton.js +0 -41
- package/Buttons/index.js +0 -10
- package/Calendar/CalendarDaygridCell.js +0 -105
- package/Calendar/CalendarDaygridNav.js +0 -63
- package/Calendar/CalendarDaygridTable.js +0 -126
- package/Calendar/CalendarLegend.js +0 -39
- package/Calendar/calendar-api-google.js +0 -110
- package/Calendar/index.js +0 -11
- package/Calendar/types.js +0 -4
- package/Calendar/useCalendar.js +0 -235
- package/Calendar/utils.js +0 -252
- package/Carousel/Carousel.js +0 -387
- package/Carousel/CarouselCss.js +0 -64
- package/Carousel/index.js +0 -6
- package/Collapsable/Collapsable.js +0 -11
- package/Collapsable/CollapsableReach.js +0 -251
- package/Collapsable/index.js +0 -7
- package/Debug/Debug.js +0 -34
- package/Debug/index.js +0 -6
- package/Details/Details.js +0 -117
- package/Details/Details.stories.js +0 -39
- package/Details/index.js +0 -6
- package/Dialog/DialogMui.js +0 -143
- package/Dialog/DialogMui.stories.js +0 -38
- package/Dialog/css/bare.js +0 -55
- package/Dialog/css/index.stories.js +0 -93
- package/Dialog/index.js +0 -11
- package/Dialog/m/bare.js +0 -125
- package/Dialog/m/basic.js +0 -50
- package/Dialog/m/index.js +0 -14
- package/Dialog/sc/bare.js +0 -83
- package/Dialog/sc/framer.js +0 -26
- package/Dialog/sc/framerMaterial.js +0 -26
- package/Dialog/sc/index.stories.js +0 -75
- package/Dialog/sc/material.js +0 -78
- package/Dialog/tw/bare.js +0 -55
- package/Dialog/tw/elegant.js +0 -54
- package/Dialog/tw/framer.js +0 -26
- package/Dialog/tw/framerMaterial.js +0 -26
- package/Dialog/tw/index.stories.js +0 -113
- package/Dialog/tw/material.js +0 -54
- package/Editor/Editor--tiptap.js +0 -72
- package/Editor/components.js +0 -59
- package/Editor/index.js +0 -6
- package/FaviconTags.js +0 -73
- package/Form/Form.js +0 -130
- package/Form/index.js +0 -6
- package/Form/sc/bare.js +0 -55
- package/Forms/Checkbox/Checkbox.js +0 -62
- package/Forms/Checkbox/index.js +0 -6
- package/Forms/Feedback/Feedback.js +0 -25
- package/Forms/Feedback/index.js +0 -6
- package/Forms/Field/Field.js +0 -75
- package/Forms/Field/FieldControl.js +0 -69
- package/Forms/Field/FieldHint.js +0 -17
- package/Forms/Field/index.js +0 -7
- package/Forms/Input/Input.js +0 -67
- package/Forms/Input/index.js +0 -6
- package/Forms/InputGroup/InputGroup.js +0 -85
- package/Forms/InputGroup/index.js +0 -6
- package/Forms/Label/Label.js +0 -46
- package/Forms/Label/index.js +0 -6
- package/Forms/Password/Password.js +0 -72
- package/Forms/Password/index.js +0 -6
- package/Forms/Radio/Radio.js +0 -68
- package/Forms/Radio/index.js +0 -6
- package/Forms/Switch/Switch.js +0 -80
- package/Forms/Switch/index.js +0 -6
- package/Forms/Textarea/Textarea.js +0 -45
- package/Forms/Textarea/TextareaRich.js +0 -58
- package/Forms/Textarea/index.js +0 -7
- package/Forms/Toggle/Toggle-tailwind.js +0 -99
- package/Forms/Toggle/Toggle.js +0 -175
- package/Forms/Toggle/index.js +0 -6
- package/Forms/Toggle/useToggle-tailwind.js +0 -202
- package/Forms/Toggle/useToggle.js +0 -145
- package/Forms/antispam.js +0 -59
- package/Forms/helpers.js +0 -72
- package/Forms/index.js +0 -19
- package/Forms/styles.js +0 -94
- package/Gauge/Gauge.js +0 -111
- package/Grid/Grid.js +0 -106
- package/Grid/index.js +0 -6
- package/Hamburger/Hamburger.js +0 -90
- package/Hamburger/index.js +0 -6
- package/Header/index.js +0 -6
- package/Header/useHeader.js +0 -54
- package/Hidden/Hidden.js +0 -21
- package/Hidden/index.js +0 -6
- package/Img/index.js +0 -6
- package/Img/sc/bare.js +0 -43
- package/Img/types.js +0 -6
- package/Link/Link.js +0 -13
- package/Link/LinkBlank.js +0 -52
- package/Link/index.js +0 -7
- package/Menu/Menu.js +0 -22
- package/Menu/MenuMui.js +0 -165
- package/Menu/index.js +0 -6
- package/MenuItem/MenuItem.js +0 -31
- package/MenuItem/MenuItemMui.js +0 -32
- package/MenuItem/index.js +0 -6
- package/MenuItem/useMenuItem.js +0 -96
- package/Meta/Meta.js +0 -26
- package/Meta/index.js +0 -12
- package/NoJs/NoJs.js +0 -28
- package/NoJs/index.js +0 -12
- package/Pagination/PaginationNav.js +0 -126
- package/Pagination/PaginationResults.js +0 -45
- package/Pagination/index.js +0 -7
- package/Pill/Pill.js +0 -62
- package/Pill/index.js +0 -6
- package/Progress/ProgressCircular.js +0 -62
- package/Progress/ProgressLinear.js +0 -53
- package/Progress/ProgressOverlay.js +0 -75
- package/Progress/index.js +0 -8
- package/Rating/Rating.js +0 -188
- package/Rating/index.js +0 -85
- package/Select/SelectDownshift.js +0 -47
- package/Select/components.js +0 -44
- package/Select/index.js +0 -13
- package/Sidebar/Sidebar.js +0 -74
- package/Sidebar/index.js +0 -6
- package/Spacing/Spacing.js +0 -55
- package/Spacing/index.js +0 -6
- package/Sticky/Sticky.js +0 -228
- package/Sticky/StickyCss.js +0 -20
- package/Sticky/index.js +0 -19
- package/Tabs/TabsMui.js +0 -91
- package/Tabs/TabsMui.stories.js +0 -38
- package/Tabs/index.js +0 -6
- package/Tabs/sc/bare.js +0 -86
- package/Tabs/sc/index.stories.js +0 -1
- package/Tabs/tw/bare.js +0 -45
- package/Tabs/tw/index.stories.js +0 -46
- package/Tabs/tw/material.js +0 -44
- package/Tabs/useTabs.js +0 -66
- package/Typography/CopyPasteVisible.js +0 -17
- package/Typography/Native.js +0 -90
- package/Typography/ReadMore.js +0 -125
- package/Typography/TextLoop.js +0 -108
- package/Typography/TypeStairs.js +0 -71
- package/Typography/index.js +0 -10
- package/css/index.js +0 -33
- package/helpers/classed.js +0 -66
- package/helpers/classed.stories.js +0 -140
- package/helpers/createUseMediaQueryWidth.js +0 -193
- package/helpers/extend-component.js +0 -32
- package/helpers/index.js +0 -9
- package/helpers/mergeRefs.js +0 -30
- package/hooks/index.js +0 -92
- package/hooks/types.js +0 -6
- package/hooks/useAsyncFn.js +0 -56
- package/hooks/useDateLocale.js +0 -51
- package/hooks/useFirstMountState.js +0 -28
- package/hooks/useFixedOffset.js +0 -67
- package/hooks/useFocus.js +0 -30
- package/hooks/useInterval.js +0 -44
- package/hooks/useIsomorphicLayoutEffect.js +0 -23
- package/hooks/useKeyUp.js +0 -40
- package/hooks/useMeasure.js +0 -189
- package/hooks/useMountedState.js +0 -31
- package/hooks/useNavigateAway.js +0 -69
- package/hooks/usePrevious.js +0 -33
- package/hooks/usePreviousRef.js +0 -27
- package/hooks/useScrollPosition.js +0 -83
- package/hooks/useScrollThreshold.js +0 -52
- package/hooks/useScrollTo.js +0 -39
- package/hooks/useSmoothScroll.js +0 -49
- package/hooks/useSpinDelay.js +0 -59
- package/hooks/useTraceUpdate.js +0 -39
- package/hooks/useUpdateEffect.js +0 -30
- package/hooks/useWindowSize.js +0 -43
- package/index.js +0 -10
- package/m/MotionProvider.js +0 -27
- package/m/index.js +0 -10
- package/m/lite.js +0 -12
- package/m/max.js +0 -12
- package/sc/index.js +0 -49
- package/scm/index.js +0 -40
- package/shared/index.js +0 -13
- package/styles/Body.js +0 -28
- package/styles/Global.js +0 -55
- package/styles/index.js +0 -142
- package/styles/media.js +0 -139
- package/styles/spacing.js +0 -70
- package/styles/styled.js +0 -58
- package/styles/theme--vanilla.js +0 -82
- package/styles/theme.js +0 -49
- package/tw/index.js +0 -33
- package/twm/index.js +0 -33
- package/types.js +0 -4
package/package.json
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"name": "@koine/react",
|
|
3
3
|
"sideEffects": false,
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@koine/dom": "2.0.0-beta.
|
|
6
|
-
"@koine/utils": "2.0.0-beta.
|
|
5
|
+
"@koine/dom": "2.0.0-beta.11",
|
|
6
|
+
"@koine/utils": "2.0.0-beta.11"
|
|
7
7
|
},
|
|
8
8
|
"peerDependenciesMeta": {
|
|
9
9
|
"@hookform/resolvers": {
|
|
@@ -51,22 +51,22 @@
|
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"@kuus/yup": "1.0.0-beta.7",
|
|
54
|
-
"@mui/base": "5.0.0-beta.
|
|
55
|
-
"@mui/utils": "^5.
|
|
56
|
-
"@tiptap/react": "2.0.
|
|
57
|
-
"@tiptap/starter-kit": "2.0.
|
|
54
|
+
"@mui/base": "5.0.0-beta.9",
|
|
55
|
+
"@mui/utils": "^5.14.3",
|
|
56
|
+
"@tiptap/react": "^2.0.4",
|
|
57
|
+
"@tiptap/starter-kit": "^2.0.4",
|
|
58
58
|
"date-fns": "^2.30.0",
|
|
59
|
-
"framer-motion": "^10.
|
|
59
|
+
"framer-motion": "^10.15.0",
|
|
60
60
|
"react": "^18.2.0",
|
|
61
|
-
"react-hook-form": "^7.45.
|
|
61
|
+
"react-hook-form": "^7.45.2",
|
|
62
62
|
"react-icons": "^4.10.1",
|
|
63
63
|
"react-swipeable": "^7.0.1",
|
|
64
64
|
"styled-components": "^5.3.11",
|
|
65
|
-
"tslib": "^2.
|
|
66
|
-
"type-fest": "^
|
|
65
|
+
"tslib": "^2.6.1",
|
|
66
|
+
"type-fest": "^4.1.0"
|
|
67
67
|
},
|
|
68
68
|
"module": "./index.mjs",
|
|
69
69
|
"main": "./index.js",
|
|
70
70
|
"types": "./index.d.ts",
|
|
71
|
-
"version": "2.0.0-beta.
|
|
71
|
+
"version": "2.0.0-beta.11"
|
|
72
72
|
}
|
package/Alert/Alert.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "Alert", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return Alert;
|
|
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 AlertRoot = _styledcomponents.default.div`
|
|
15
|
-
font-size: 12px;
|
|
16
|
-
${(p)=>p.$danger ? `color: var(--danger)` : ""}
|
|
17
|
-
`;
|
|
18
|
-
const AlertInner = _styledcomponents.default.div`
|
|
19
|
-
padding: 1em;
|
|
20
|
-
background-color: rgba(0, 0, 0, 0.05);
|
|
21
|
-
/* border: 1px solid var(--grey700); */
|
|
22
|
-
/* background: pink; */
|
|
23
|
-
/* color: red; */
|
|
24
|
-
`;
|
|
25
|
-
const Alert = ({ $danger, children, ...props })=>{
|
|
26
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(AlertRoot, {
|
|
27
|
-
$danger: $danger,
|
|
28
|
-
...props,
|
|
29
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(AlertInner, {
|
|
30
|
-
children: children
|
|
31
|
-
})
|
|
32
|
-
});
|
|
33
|
-
};
|
package/Alert/Alert.stories.js
DELETED
|
@@ -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
|
-
danger: function() {
|
|
19
|
-
return danger;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const _jsxruntime = require("react/jsx-runtime");
|
|
23
|
-
const _Alert = require("./Alert");
|
|
24
|
-
const _default = {
|
|
25
|
-
component: _Alert.Alert,
|
|
26
|
-
title: "Base/Alert"
|
|
27
|
-
};
|
|
28
|
-
const Template = (args)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_Alert.Alert, {
|
|
29
|
-
...args
|
|
30
|
-
});
|
|
31
|
-
const bare = Template.bind({});
|
|
32
|
-
bare.args = {
|
|
33
|
-
children: "An alert message"
|
|
34
|
-
};
|
|
35
|
-
const danger = Template.bind({});
|
|
36
|
-
danger.args = {
|
|
37
|
-
children: "A dangerous message",
|
|
38
|
-
$danger: true
|
|
39
|
-
};
|
package/Alert/index.js
DELETED
package/Animations/Reveal.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "Reveal", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return Reveal;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _jsxruntime = require("react/jsx-runtime");
|
|
12
|
-
const _framermotion = require("framer-motion");
|
|
13
|
-
const _useReveal = require("./useReveal");
|
|
14
|
-
const Reveal = ({ children, direction, offsetStartY, offsetEndY, offsetStartX, ...props })=>{
|
|
15
|
-
const effectOptions = {
|
|
16
|
-
direction,
|
|
17
|
-
offsetStartY,
|
|
18
|
-
offsetEndY,
|
|
19
|
-
offsetStartX
|
|
20
|
-
};
|
|
21
|
-
const prefersReducedMotion = (0, _framermotion.useReducedMotion)();
|
|
22
|
-
const { ref, startY, endY, startX } = (0, _useReveal.useReveal)(effectOptions);
|
|
23
|
-
const { scrollYProgress } = (0, _framermotion.useViewportScroll)();
|
|
24
|
-
const xRange = (0, _framermotion.useTransform)(scrollYProgress, [
|
|
25
|
-
startY,
|
|
26
|
-
endY
|
|
27
|
-
], [
|
|
28
|
-
startX,
|
|
29
|
-
0
|
|
30
|
-
]);
|
|
31
|
-
const opacityRange = (0, _framermotion.useTransform)(scrollYProgress, [
|
|
32
|
-
startY,
|
|
33
|
-
endY
|
|
34
|
-
], [
|
|
35
|
-
0,
|
|
36
|
-
1
|
|
37
|
-
]);
|
|
38
|
-
const x = (0, _framermotion.useSpring)(xRange, {
|
|
39
|
-
stiffness: 400,
|
|
40
|
-
damping: 90
|
|
41
|
-
});
|
|
42
|
-
const opacity = (0, _framermotion.useSpring)(opacityRange);
|
|
43
|
-
// console.log("start, end", startY, endY)
|
|
44
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_framermotion.motion.div, {
|
|
45
|
-
...props,
|
|
46
|
-
ref: ref,
|
|
47
|
-
style: prefersReducedMotion ? {} : {
|
|
48
|
-
x,
|
|
49
|
-
opacity
|
|
50
|
-
},
|
|
51
|
-
children: children
|
|
52
|
-
});
|
|
53
|
-
};
|
package/Animations/Underline.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "UnderlineSkewed", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return UnderlineSkewed;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
12
|
-
const _framermotion = require("framer-motion");
|
|
13
|
-
const _styledcomponents = /*#__PURE__*/ _interop_require_default._(require("styled-components"));
|
|
14
|
-
const UnderlineSkewed = (0, _styledcomponents.default)(_framermotion.m.i)`
|
|
15
|
-
display: block;
|
|
16
|
-
position: absolute;
|
|
17
|
-
top: 50%;
|
|
18
|
-
left: 15%;
|
|
19
|
-
right: 15%;
|
|
20
|
-
height: 20px;
|
|
21
|
-
margin-top: -10px;
|
|
22
|
-
z-index: 0;
|
|
23
|
-
pointer-events: none;
|
|
24
|
-
background: var(--accent400);
|
|
25
|
-
transform: skewY(-5deg);
|
|
26
|
-
`;
|
package/Animations/index.js
DELETED
|
@@ -1,8 +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("./Reveal"), exports);
|
|
7
|
-
_export_star._(require("./Underline"), exports);
|
|
8
|
-
_export_star._(require("./useReveal"), exports);
|
package/Animations/useReveal.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "useReveal", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return useReveal;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _react = require("react");
|
|
12
|
-
function useReveal({ direction = "left", offsetStartY = -2, offsetEndY = 0, offsetStartX = "all" }) {
|
|
13
|
-
const ref = (0, _react.useRef)(null);
|
|
14
|
-
const [startY, setStartY] = (0, _react.useState)(0);
|
|
15
|
-
const [endY, setEndY] = (0, _react.useState)(0);
|
|
16
|
-
const [startX, setStartX] = (0, _react.useState)(0);
|
|
17
|
-
(0, _react.useEffect)(()=>{
|
|
18
|
-
if (!ref.current) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
const rect = ref.current.getBoundingClientRect();
|
|
22
|
-
// scroll position from top of the window
|
|
23
|
-
const scrollTop = window.scrollY || document.documentElement.scrollTop;
|
|
24
|
-
const elementHeight = rect.height;
|
|
25
|
-
// rect.top is the distance from the currently visible viewport to the top
|
|
26
|
-
// of the given element
|
|
27
|
-
// so distanceTop is the distance between the top edge of the window and the
|
|
28
|
-
// top edge of the given element
|
|
29
|
-
const elementTop = rect.top;
|
|
30
|
-
const distanceTop = elementTop + scrollTop;
|
|
31
|
-
const offsetTop = offsetStartY ? elementHeight * offsetStartY : 0;
|
|
32
|
-
const offsetBottom = offsetEndY ? elementHeight * offsetEndY : offsetTop;
|
|
33
|
-
// the distance of the element from the top divided by the full height
|
|
34
|
-
// of the window gives back the start position of the given element in
|
|
35
|
-
// a scale from 0 to 1
|
|
36
|
-
const startY = (distanceTop + offsetTop) / document.body.clientHeight;
|
|
37
|
-
// same for the end, we just add the given element height to the first value
|
|
38
|
-
const endY = (distanceTop + elementHeight + offsetBottom) / document.body.clientHeight;
|
|
39
|
-
let startX;
|
|
40
|
-
if (offsetStartX === "all") {
|
|
41
|
-
startX = direction === "left" ? -rect.right : rect.left;
|
|
42
|
-
} else {
|
|
43
|
-
startX = rect.width * offsetStartX;
|
|
44
|
-
startX = direction === "left" ? -startX : startX;
|
|
45
|
-
}
|
|
46
|
-
// addMarker(startY + "px");
|
|
47
|
-
// addMarker(endY + "px");
|
|
48
|
-
// console.log("start", startY, "end", endY, "startX", startX)
|
|
49
|
-
setStartY(startY);
|
|
50
|
-
setEndY(endY);
|
|
51
|
-
setStartX(startX);
|
|
52
|
-
// addMarker(startY * 100 + "%", "blue", "fixed");
|
|
53
|
-
// addMarker(endY * 100 + "%", "blue", "fixed");
|
|
54
|
-
}, [
|
|
55
|
-
setStartY,
|
|
56
|
-
setEndY,
|
|
57
|
-
setStartX,
|
|
58
|
-
offsetStartY,
|
|
59
|
-
offsetEndY,
|
|
60
|
-
offsetStartX,
|
|
61
|
-
direction
|
|
62
|
-
]);
|
|
63
|
-
return {
|
|
64
|
-
ref,
|
|
65
|
-
startY,
|
|
66
|
-
endY,
|
|
67
|
-
startX
|
|
68
|
-
};
|
|
69
|
-
} // function addMarker(top: string, color = "red", position = "absolute") {
|
|
70
|
-
// const div = document.createElement("div");
|
|
71
|
-
// div.setAttribute(
|
|
72
|
-
// "style",
|
|
73
|
-
// `
|
|
74
|
-
// position: ${position};
|
|
75
|
-
// top: ${top};
|
|
76
|
-
// left: 0;
|
|
77
|
-
// right: 0;
|
|
78
|
-
// height: 1px;
|
|
79
|
-
// background: ${color};
|
|
80
|
-
// `
|
|
81
|
-
// );
|
|
82
|
-
// document.body.appendChild(div);
|
|
83
|
-
// }
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
// TODO: remove, just use mui version...
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "Autocomplete", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function() {
|
|
9
|
-
return Autocomplete;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
const Autocomplete = null; // import {
|
|
13
|
-
// forwardRef,
|
|
14
|
-
// useCallback,
|
|
15
|
-
// useState,
|
|
16
|
-
// ForwardedRef,
|
|
17
|
-
// ReactNode,
|
|
18
|
-
// ComponentPropsWithRef,
|
|
19
|
-
// CSSProperties,
|
|
20
|
-
// } from "react";
|
|
21
|
-
// import { useCombobox } from "downshift";
|
|
22
|
-
// import type { SetRequired } from "@koine/utils";
|
|
23
|
-
// // import debounce from "lodash.debounce";
|
|
24
|
-
// import {
|
|
25
|
-
// AutocompleteRoot,
|
|
26
|
-
// AutocompleteLabel,
|
|
27
|
-
// AutocompleteInputWrap,
|
|
28
|
-
// AutocompleteInput,
|
|
29
|
-
// AutocompleteInputArrow,
|
|
30
|
-
// AutocompleteMenu,
|
|
31
|
-
// AutocompleteMenuItem,
|
|
32
|
-
// } from "./components";
|
|
33
|
-
// import { defaultOptionsFilterFn, triggerOnChange } from "../Forms/helpers";
|
|
34
|
-
// import { InputProgress } from "../Forms/styles";
|
|
35
|
-
// export type AutocompleteOption = Option;
|
|
36
|
-
// export type AutocompleteValue = null | AutocompleteOption;
|
|
37
|
-
// export type AutocompleteProps = SetRequired<
|
|
38
|
-
// Omit<ComponentPropsWithRef<"input">, "onSelect">,
|
|
39
|
-
// "onChange" | "name"
|
|
40
|
-
// > & {
|
|
41
|
-
// freeSolo?: boolean;
|
|
42
|
-
// onSelect?: (option?: AutocompleteValue) => any;
|
|
43
|
-
// options?: AutocompleteOption[];
|
|
44
|
-
// loadOptions: (query?: string) => Promise<AutocompleteOption[]>;
|
|
45
|
-
// label?: string | ReactNode;
|
|
46
|
-
// className?: string;
|
|
47
|
-
// style?: CSSProperties;
|
|
48
|
-
// $ref: ForwardedRef<HTMLInputElement>;
|
|
49
|
-
// };
|
|
50
|
-
// export const Autocomplete = forwardRef<HTMLInputElement, AutocompleteProps>(
|
|
51
|
-
// function Autocomplete(
|
|
52
|
-
// {
|
|
53
|
-
// freeSolo,
|
|
54
|
-
// onSelect,
|
|
55
|
-
// options = [],
|
|
56
|
-
// label,
|
|
57
|
-
// name,
|
|
58
|
-
// value,
|
|
59
|
-
// onChange,
|
|
60
|
-
// loadOptions,
|
|
61
|
-
// className,
|
|
62
|
-
// style,
|
|
63
|
-
// $ref,
|
|
64
|
-
// ...props
|
|
65
|
-
// },
|
|
66
|
-
// ref
|
|
67
|
-
// ) {
|
|
68
|
-
// const [items, setItems] = useState(options);
|
|
69
|
-
// const [loading, setLoading] = useState(false);
|
|
70
|
-
// const triggerChange = useCallback(
|
|
71
|
-
// (selectedItem?: AutocompleteValue, inputValue?: string) => {
|
|
72
|
-
// const value = freeSolo ? inputValue : selectedItem?.value;
|
|
73
|
-
// triggerOnChange(onChange, name, value || "");
|
|
74
|
-
// if (onSelect) onSelect(selectedItem);
|
|
75
|
-
// },
|
|
76
|
-
// [onChange, onSelect, name, freeSolo]
|
|
77
|
-
// );
|
|
78
|
-
// const handleInputValueChange = useCallback(
|
|
79
|
-
// async ({ inputValue }) => {
|
|
80
|
-
// if (inputValue) {
|
|
81
|
-
// if (loadOptions) {
|
|
82
|
-
// setLoading(true);
|
|
83
|
-
// try {
|
|
84
|
-
// const newOptions = await loadOptions(inputValue);
|
|
85
|
-
// setItems(newOptions);
|
|
86
|
-
// } catch (e) {}
|
|
87
|
-
// setLoading(false);
|
|
88
|
-
// } else {
|
|
89
|
-
// setItems(defaultOptionsFilterFn(options, inputValue));
|
|
90
|
-
// }
|
|
91
|
-
// } else {
|
|
92
|
-
// setItems(options);
|
|
93
|
-
// // clear like behaviour
|
|
94
|
-
// triggerChange({ value: "", label: "" });
|
|
95
|
-
// }
|
|
96
|
-
// },
|
|
97
|
-
// [loadOptions, triggerChange]
|
|
98
|
-
// );
|
|
99
|
-
// const {
|
|
100
|
-
// isOpen,
|
|
101
|
-
// // selectedItem,
|
|
102
|
-
// getToggleButtonProps,
|
|
103
|
-
// getLabelProps,
|
|
104
|
-
// getMenuProps,
|
|
105
|
-
// getInputProps,
|
|
106
|
-
// getComboboxProps,
|
|
107
|
-
// highlightedIndex,
|
|
108
|
-
// getItemProps,
|
|
109
|
-
// openMenu,
|
|
110
|
-
// } = useCombobox<null | AutocompleteOption>({
|
|
111
|
-
// id: `Autocomplete-${name}`,
|
|
112
|
-
// items,
|
|
113
|
-
// // initialInputValue: value,
|
|
114
|
-
// onSelectedItemChange: ({ selectedItem, inputValue }) => {
|
|
115
|
-
// triggerChange(selectedItem, inputValue);
|
|
116
|
-
// },
|
|
117
|
-
// // itemToString: (item) => (item ? item.label || item.value : ""),
|
|
118
|
-
// onInputValueChange: handleInputValueChange,
|
|
119
|
-
// });
|
|
120
|
-
// // const debouncedInputValueChangeHandler = useCallback(
|
|
121
|
-
// // debounce(handleInputValueChange, 200),
|
|
122
|
-
// // [handleInputValueChange]
|
|
123
|
-
// // );
|
|
124
|
-
// return (
|
|
125
|
-
// <AutocompleteRoot className={className} style={style}>
|
|
126
|
-
// {label && (
|
|
127
|
-
// <AutocompleteLabel {...getLabelProps()}>{label}</AutocompleteLabel>
|
|
128
|
-
// )}
|
|
129
|
-
// <AutocompleteInputWrap {...getComboboxProps()}>
|
|
130
|
-
// <AutocompleteInput
|
|
131
|
-
// {...getInputProps({
|
|
132
|
-
// onFocus: openMenu,
|
|
133
|
-
// onClick: openMenu,
|
|
134
|
-
// ref: $ref || ref,
|
|
135
|
-
// // itemRef: ref,
|
|
136
|
-
// })}
|
|
137
|
-
// {...props}
|
|
138
|
-
// />
|
|
139
|
-
// {!!items.length && (
|
|
140
|
-
// <AutocompleteInputArrow
|
|
141
|
-
// {...getToggleButtonProps()}
|
|
142
|
-
// aria-label={"toggle menu"}
|
|
143
|
-
// />
|
|
144
|
-
// )}
|
|
145
|
-
// {loading && <InputProgress />}
|
|
146
|
-
// </AutocompleteInputWrap>
|
|
147
|
-
// <AutocompleteMenu {...getMenuProps()}>
|
|
148
|
-
// {isOpen &&
|
|
149
|
-
// items
|
|
150
|
-
// // .filter(item => !inputValue || item.includes(inputValue))
|
|
151
|
-
// .map(
|
|
152
|
-
// (item, index) =>
|
|
153
|
-
// item && (
|
|
154
|
-
// <AutocompleteMenuItem
|
|
155
|
-
// $active={highlightedIndex === index}
|
|
156
|
-
// key={`${item.value}${index}`}
|
|
157
|
-
// {...getItemProps({ item, index })}
|
|
158
|
-
// >
|
|
159
|
-
// {item.label}
|
|
160
|
-
// </AutocompleteMenuItem>
|
|
161
|
-
// )
|
|
162
|
-
// )}
|
|
163
|
-
// </AutocompleteMenu>
|
|
164
|
-
// </AutocompleteRoot>
|
|
165
|
-
// );
|
|
166
|
-
// }
|
|
167
|
-
// );
|