@akanjs/ui 0.0.149 → 0.0.151
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/BottomSheet.d.ts +13 -0
- package/Button.d.ts +9 -0
- package/ClientSide.d.ts +6 -0
- package/Copy.d.ts +6 -0
- package/CsrImage.d.ts +11 -0
- package/Data/CardList.d.ts +36 -0
- package/Data/Dashboard.d.ts +15 -0
- package/Data/Insight.d.ts +8 -0
- package/Data/Item.d.ts +74 -0
- package/Data/ListContainer.d.ts +38 -0
- package/Data/Pagination.d.ts +6 -0
- package/Data/QueryMaker.d.ts +9 -0
- package/Data/TableList.d.ts +26 -0
- package/Data/index.d.ts +10 -0
- package/Data/index_.d.ts +8 -0
- package/DatePicker.d.ts +38 -0
- package/Dialog/Action.d.ts +5 -0
- package/Dialog/Close.d.ts +5 -0
- package/Dialog/Content.d.ts +6 -0
- package/Dialog/Modal.d.ts +8 -0
- package/Dialog/Provider.d.ts +7 -0
- package/Dialog/Title.d.ts +5 -0
- package/Dialog/Trigger.d.ts +5 -0
- package/Dialog/context.d.ts +10 -0
- package/Dialog/index.d.ts +9 -0
- package/DragAction.d.ts +24 -0
- package/DraggableList.d.ts +25 -0
- package/Dropdown.d.ts +10 -0
- package/Empty.d.ts +9 -0
- package/Field.d.ts +404 -0
- package/FontFace.d.ts +6 -0
- package/Image.d.ts +17 -0
- package/InfiniteScroll.d.ts +10 -0
- package/Input.d.ts +85 -0
- package/KeyboardAvoiding.d.ts +7 -0
- package/Layout/BottomAction.d.ts +5 -0
- package/Layout/BottomInset.d.ts +6 -0
- package/Layout/BottomTab.d.ts +14 -0
- package/Layout/Header.d.ts +7 -0
- package/Layout/LeftSider.d.ts +8 -0
- package/Layout/Navbar.d.ts +11 -0
- package/Layout/RightSider.d.ts +9 -0
- package/Layout/Sider.d.ts +6 -0
- package/Layout/Template.d.ts +5 -0
- package/Layout/TopLeftAction.d.ts +5 -0
- package/Layout/Unit.d.ts +6 -0
- package/Layout/View.d.ts +5 -0
- package/Layout/Zone.d.ts +5 -0
- package/Layout/index.d.ts +14 -0
- package/Link/Back.d.ts +6 -0
- package/Link/Close.d.ts +6 -0
- package/Link/CsrLink.d.ts +2 -0
- package/Link/NextLink.d.ts +2 -0
- package/Link/index.d.ts +8 -0
- package/Link/types.d.ts +22 -0
- package/Load/Edit.d.ts +4 -0
- package/Load/Edit_Client.d.ts +25 -0
- package/Load/Page.d.ts +10 -0
- package/Load/PageCSR.d.ts +11 -0
- package/Load/Pagination.d.ts +8 -0
- package/Load/Units.d.ts +34 -0
- package/Load/View.d.ts +17 -0
- package/Load/index.d.ts +8 -0
- package/Load/index_.d.ts +3 -0
- package/Loading/Area.d.ts +1 -0
- package/Loading/Button.d.ts +7 -0
- package/Loading/Input.d.ts +7 -0
- package/Loading/ProgressBar.d.ts +6 -0
- package/Loading/Skeleton.d.ts +7 -0
- package/Loading/Spin.d.ts +7 -0
- package/Loading/index.d.ts +8 -0
- package/Menu.d.ts +26 -0
- package/Modal.d.ts +23 -0
- package/Model/Edit.d.ts +15 -0
- package/Model/EditModal.d.ts +33 -0
- package/Model/EditWrapper.d.ts +11 -0
- package/Model/LoadInit.d.ts +10 -0
- package/Model/New.d.ts +15 -0
- package/Model/NewWrapper.d.ts +12 -0
- package/Model/NewWrapper_Client.d.ts +12 -0
- package/Model/Remove.d.ts +10 -0
- package/Model/RemoveWrapper.d.ts +11 -0
- package/Model/SureToRemove.d.ts +10 -0
- package/Model/View.d.ts +19 -0
- package/Model/ViewEditModal.d.ts +11 -0
- package/Model/ViewModal.d.ts +13 -0
- package/Model/ViewWrapper.d.ts +11 -0
- package/Model/index.d.ts +15 -0
- package/Model/index_.d.ts +13 -0
- package/More.d.ts +12 -0
- package/ObjectId.d.ts +5 -0
- package/Pagination.d.ts +14 -0
- package/Popconfirm.d.ts +18 -0
- package/Portal.d.ts +6 -0
- package/Radio.d.ts +19 -0
- package/RecentTime.d.ts +7 -0
- package/Refresh.d.ts +7 -0
- package/ScreenNavigator.d.ts +18 -0
- package/Select.d.ts +29 -0
- package/Signal/Arg.d.ts +75 -0
- package/Signal/Doc.d.ts +19 -0
- package/Signal/GraphQL.d.ts +32 -0
- package/Signal/Listener.d.ts +9 -0
- package/Signal/Message.d.ts +27 -0
- package/Signal/Object.d.ts +19 -0
- package/Signal/PubSub.d.ts +26 -0
- package/Signal/Request.d.ts +8 -0
- package/Signal/Response.d.ts +16 -0
- package/Signal/RestApi.d.ts +40 -0
- package/Signal/WebSocket.d.ts +9 -0
- package/Signal/index.d.ts +20 -0
- package/System/CSR.d.ts +31 -0
- package/System/Client.d.ts +48 -0
- package/System/Common.d.ts +66 -0
- package/System/DevModeToggle.d.ts +1 -0
- package/System/Gtag.d.ts +3 -0
- package/System/HealthCheck.d.ts +5 -0
- package/System/Messages.d.ts +1 -0
- package/System/Reconnect.d.ts +6 -0
- package/System/Root.d.ts +5 -0
- package/System/SSR.d.ts +26 -0
- package/System/SelectLanguage.d.ts +5 -0
- package/System/ThemeToggle.d.ts +1 -0
- package/System/index.d.ts +11 -0
- package/Tab/Menu.d.ts +11 -0
- package/Tab/Menus.d.ts +5 -0
- package/Tab/Panel.d.ts +7 -0
- package/Tab/Provider.d.ts +6 -0
- package/Tab/context.d.ts +9 -0
- package/Tab/index.d.ts +7 -0
- package/Table.d.ts +26 -0
- package/ToggleSelect.d.ts +31 -0
- package/Unauthorized.d.ts +9 -0
- package/cjs/BottomSheet.js +113 -0
- package/cjs/Button.js +69 -0
- package/cjs/ClientSide.js +26 -0
- package/cjs/Copy.js +37 -0
- package/cjs/CsrImage.js +50 -0
- package/cjs/Data/CardList.js +119 -0
- package/cjs/Data/Dashboard.js +54 -0
- package/cjs/Data/Insight.js +38 -0
- package/cjs/Data/Item.js +204 -0
- package/cjs/Data/ListContainer.js +251 -0
- package/cjs/Data/Pagination.js +64 -0
- package/cjs/Data/QueryMaker.js +304 -0
- package/cjs/Data/TableList.js +139 -0
- package/cjs/Data/index.js +33 -0
- package/cjs/Data/index_.js +49 -0
- package/cjs/DatePicker.js +173 -0
- package/cjs/Dialog/Action.js +32 -0
- package/cjs/Dialog/Close.js +38 -0
- package/cjs/Dialog/Content.js +27 -0
- package/cjs/Dialog/Modal.js +155 -0
- package/cjs/Dialog/Provider.js +46 -0
- package/cjs/Dialog/Title.js +32 -0
- package/cjs/Dialog/Trigger.js +38 -0
- package/cjs/Dialog/context.js +32 -0
- package/cjs/Dialog/index.js +36 -0
- package/cjs/DragAction.js +111 -0
- package/cjs/DraggableList.js +141 -0
- package/cjs/Dropdown.js +64 -0
- package/cjs/Empty.js +50 -0
- package/cjs/Field.js +1109 -0
- package/cjs/FontFace.js +77 -0
- package/cjs/Image.js +61 -0
- package/cjs/InfiniteScroll.js +65 -0
- package/cjs/Input.js +440 -0
- package/cjs/KeyboardAvoiding.js +65 -0
- package/cjs/Layout/BottomAction.js +26 -0
- package/cjs/Layout/BottomInset.js +53 -0
- package/cjs/Layout/BottomTab.js +56 -0
- package/cjs/Layout/Header.js +52 -0
- package/cjs/Layout/LeftSider.js +49 -0
- package/cjs/Layout/Navbar.js +51 -0
- package/cjs/Layout/RightSider.js +52 -0
- package/cjs/Layout/Sider.js +39 -0
- package/cjs/Layout/Template.js +26 -0
- package/cjs/Layout/TopLeftAction.js +39 -0
- package/cjs/Layout/Unit.js +27 -0
- package/cjs/Layout/View.js +26 -0
- package/cjs/Layout/Zone.js +26 -0
- package/cjs/Layout/index.js +48 -0
- package/cjs/Link/Back.js +27 -0
- package/cjs/Link/Close.js +36 -0
- package/cjs/Link/CsrLink.js +49 -0
- package/cjs/Link/NextLink.js +71 -0
- package/cjs/Link/index.js +47 -0
- package/cjs/Link/types.js +15 -0
- package/cjs/Load/Edit.js +42 -0
- package/cjs/Load/Edit_Client.js +93 -0
- package/cjs/Load/Page.js +35 -0
- package/cjs/Load/PageCSR.js +67 -0
- package/cjs/Load/Pagination.js +89 -0
- package/cjs/Load/Units.js +232 -0
- package/cjs/Load/View.js +88 -0
- package/cjs/Load/index.js +42 -0
- package/cjs/Load/index_.js +39 -0
- package/cjs/Loading/Area.js +25 -0
- package/cjs/Loading/Button.js +33 -0
- package/cjs/Loading/Input.js +33 -0
- package/cjs/Loading/ProgressBar.js +29 -0
- package/cjs/Loading/Skeleton.js +27 -0
- package/cjs/Loading/Spin.js +27 -0
- package/cjs/Loading/index.js +29 -0
- package/cjs/Menu.js +215 -0
- package/cjs/Modal.js +75 -0
- package/cjs/Model/Edit.js +61 -0
- package/cjs/Model/EditModal.js +255 -0
- package/cjs/Model/EditWrapper.js +48 -0
- package/cjs/Model/LoadInit.js +27 -0
- package/cjs/Model/New.js +61 -0
- package/cjs/Model/NewWrapper.js +28 -0
- package/cjs/Model/NewWrapper_Client.js +66 -0
- package/cjs/Model/Remove.js +86 -0
- package/cjs/Model/RemoveWrapper.js +48 -0
- package/cjs/Model/SureToRemove.js +109 -0
- package/cjs/Model/View.js +44 -0
- package/cjs/Model/ViewEditModal.js +118 -0
- package/cjs/Model/ViewModal.js +92 -0
- package/cjs/Model/ViewWrapper.js +48 -0
- package/cjs/Model/index.js +38 -0
- package/cjs/Model/index_.js +58 -0
- package/cjs/More.js +67 -0
- package/cjs/ObjectId.js +37 -0
- package/cjs/Pagination.js +110 -0
- package/cjs/Popconfirm.js +116 -0
- package/cjs/Portal.js +27 -0
- package/cjs/Radio.js +53 -0
- package/cjs/RecentTime.js +86 -0
- package/cjs/Refresh.js +45 -0
- package/cjs/ScreenNavigator.js +121 -0
- package/cjs/Select.js +262 -0
- package/cjs/Signal/Arg.js +237 -0
- package/cjs/Signal/Doc.js +181 -0
- package/cjs/Signal/GraphQL.js +177 -0
- package/cjs/Signal/Listener.js +59 -0
- package/cjs/Signal/Message.js +190 -0
- package/cjs/Signal/Object.js +95 -0
- package/cjs/Signal/PubSub.js +191 -0
- package/cjs/Signal/Request.js +38 -0
- package/cjs/Signal/Response.js +53 -0
- package/cjs/Signal/RestApi.js +255 -0
- package/cjs/Signal/WebSocket.js +68 -0
- package/cjs/Signal/index.js +42 -0
- package/cjs/System/CSR.js +376 -0
- package/cjs/System/Client.js +200 -0
- package/cjs/System/Common.js +64 -0
- package/cjs/System/DevModeToggle.js +38 -0
- package/cjs/System/Gtag.js +67 -0
- package/cjs/System/HealthCheck.js +60 -0
- package/cjs/System/Messages.js +170 -0
- package/cjs/System/Reconnect.js +64 -0
- package/cjs/System/Root.js +30 -0
- package/cjs/System/SSR.js +144 -0
- package/cjs/System/SelectLanguage.js +58 -0
- package/cjs/System/ThemeToggle.js +40 -0
- package/cjs/System/index.js +55 -0
- package/cjs/Tab/Menu.js +70 -0
- package/cjs/{src/index.js → Tab/Menus.js} +8 -5
- package/cjs/Tab/Panel.js +42 -0
- package/cjs/Tab/Provider.js +31 -0
- package/cjs/Tab/context.js +30 -0
- package/cjs/Tab/index.js +32 -0
- package/cjs/Table.js +85 -0
- package/cjs/ToggleSelect.js +118 -0
- package/cjs/Unauthorized.js +50 -0
- package/cjs/index.js +88 -2
- package/esm/BottomSheet.js +84 -0
- package/esm/Button.js +40 -0
- package/esm/ClientSide.js +7 -0
- package/esm/Copy.js +18 -0
- package/esm/CsrImage.js +31 -0
- package/esm/Data/CardList.js +90 -0
- package/esm/Data/Dashboard.js +35 -0
- package/esm/Data/Insight.js +19 -0
- package/esm/Data/Item.js +175 -0
- package/esm/Data/ListContainer.js +228 -0
- package/esm/Data/Pagination.js +45 -0
- package/esm/Data/QueryMaker.js +293 -0
- package/esm/Data/TableList.js +110 -0
- package/esm/Data/index.js +14 -0
- package/esm/Data/index_.js +20 -0
- package/esm/DatePicker.js +144 -0
- package/esm/Dialog/Action.js +13 -0
- package/esm/Dialog/Close.js +19 -0
- package/esm/Dialog/Content.js +8 -0
- package/esm/Dialog/Modal.js +126 -0
- package/esm/Dialog/Provider.js +17 -0
- package/esm/Dialog/Title.js +13 -0
- package/esm/Dialog/Trigger.js +19 -0
- package/esm/Dialog/context.js +13 -0
- package/esm/Dialog/index.js +17 -0
- package/esm/DragAction.js +92 -0
- package/esm/DraggableList.js +112 -0
- package/esm/Dropdown.js +45 -0
- package/esm/Empty.js +21 -0
- package/esm/Field.js +1090 -0
- package/esm/FontFace.js +58 -0
- package/esm/Image.js +32 -0
- package/esm/InfiniteScroll.js +46 -0
- package/esm/Input.js +415 -0
- package/esm/KeyboardAvoiding.js +46 -0
- package/esm/Layout/BottomAction.js +7 -0
- package/esm/Layout/BottomInset.js +34 -0
- package/esm/Layout/BottomTab.js +37 -0
- package/esm/Layout/Header.js +33 -0
- package/esm/Layout/LeftSider.js +30 -0
- package/esm/Layout/Navbar.js +22 -0
- package/esm/Layout/RightSider.js +33 -0
- package/esm/Layout/Sider.js +20 -0
- package/esm/Layout/Template.js +7 -0
- package/esm/Layout/TopLeftAction.js +20 -0
- package/esm/Layout/Unit.js +8 -0
- package/esm/Layout/View.js +7 -0
- package/esm/Layout/Zone.js +7 -0
- package/esm/Layout/index.js +29 -0
- package/esm/Link/Back.js +8 -0
- package/esm/Link/Close.js +17 -0
- package/esm/Link/CsrLink.js +30 -0
- package/esm/Link/NextLink.js +42 -0
- package/esm/Link/index.js +18 -0
- package/esm/Link/types.js +0 -0
- package/esm/Load/Edit.js +13 -0
- package/esm/Load/Edit_Client.js +74 -0
- package/esm/Load/Page.js +16 -0
- package/esm/Load/PageCSR.js +48 -0
- package/esm/Load/Pagination.js +70 -0
- package/esm/Load/Units.js +213 -0
- package/esm/Load/View.js +69 -0
- package/esm/Load/index.js +13 -0
- package/esm/Load/index_.js +10 -0
- package/esm/Loading/Area.js +6 -0
- package/esm/Loading/Button.js +14 -0
- package/esm/Loading/Input.js +14 -0
- package/esm/Loading/ProgressBar.js +10 -0
- package/esm/Loading/Skeleton.js +8 -0
- package/esm/Loading/Spin.js +8 -0
- package/esm/Loading/index.js +10 -0
- package/esm/Menu.js +196 -0
- package/esm/Modal.js +46 -0
- package/esm/Model/Edit.js +32 -0
- package/esm/Model/EditModal.js +226 -0
- package/esm/Model/EditWrapper.js +29 -0
- package/esm/Model/LoadInit.js +8 -0
- package/esm/Model/New.js +32 -0
- package/esm/Model/NewWrapper.js +9 -0
- package/esm/Model/NewWrapper_Client.js +47 -0
- package/esm/Model/Remove.js +67 -0
- package/esm/Model/RemoveWrapper.js +29 -0
- package/esm/Model/SureToRemove.js +90 -0
- package/esm/Model/View.js +25 -0
- package/esm/Model/ViewEditModal.js +89 -0
- package/esm/Model/ViewModal.js +63 -0
- package/esm/Model/ViewWrapper.js +29 -0
- package/esm/Model/index.js +33 -0
- package/esm/Model/index_.js +29 -0
- package/esm/More.js +38 -0
- package/esm/ObjectId.js +18 -0
- package/esm/Pagination.js +91 -0
- package/esm/Popconfirm.js +87 -0
- package/esm/Portal.js +8 -0
- package/esm/Radio.js +34 -0
- package/esm/RecentTime.js +57 -0
- package/esm/Refresh.js +16 -0
- package/esm/ScreenNavigator.js +102 -0
- package/esm/Select.js +243 -0
- package/esm/Signal/Arg.js +208 -0
- package/esm/Signal/Doc.js +152 -0
- package/esm/Signal/GraphQL.js +156 -0
- package/esm/Signal/Listener.js +40 -0
- package/esm/Signal/Message.js +161 -0
- package/esm/Signal/Object.js +76 -0
- package/esm/Signal/PubSub.js +162 -0
- package/esm/Signal/Request.js +19 -0
- package/esm/Signal/Response.js +34 -0
- package/esm/Signal/RestApi.js +234 -0
- package/esm/Signal/WebSocket.js +39 -0
- package/esm/Signal/index.js +13 -0
- package/esm/System/CSR.js +357 -0
- package/esm/System/Client.js +191 -0
- package/esm/System/Common.js +45 -0
- package/esm/System/DevModeToggle.js +19 -0
- package/esm/System/Gtag.js +48 -0
- package/esm/System/HealthCheck.js +41 -0
- package/esm/System/Messages.js +156 -0
- package/esm/System/Reconnect.js +45 -0
- package/esm/System/Root.js +11 -0
- package/esm/System/SSR.js +125 -0
- package/esm/System/SelectLanguage.js +39 -0
- package/esm/System/ThemeToggle.js +21 -0
- package/esm/System/index.js +26 -0
- package/esm/Tab/Menu.js +51 -0
- package/esm/Tab/Menus.js +7 -0
- package/esm/Tab/Panel.js +23 -0
- package/esm/Tab/Provider.js +12 -0
- package/esm/Tab/context.js +11 -0
- package/esm/Tab/index.js +13 -0
- package/esm/Table.js +56 -0
- package/esm/ToggleSelect.js +99 -0
- package/esm/Unauthorized.js +21 -0
- package/esm/index.js +84 -1
- package/index.d.ts +41 -1
- package/package.json +23 -2
- package/esm/src/index.js +0 -4
- package/src/index.d.ts +0 -1
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var DragAction_exports = {};
|
|
20
|
+
__export(DragAction_exports, {
|
|
21
|
+
DragAction: () => DragAction
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(DragAction_exports);
|
|
24
|
+
var import_client = require("@akanjs/client");
|
|
25
|
+
var import_react = require("@use-gesture/react");
|
|
26
|
+
var import_react2 = require("react");
|
|
27
|
+
var import_react_spring = require("react-spring");
|
|
28
|
+
const DragActionContext = (0, import_react2.createContext)({
|
|
29
|
+
bind: () => ({}),
|
|
30
|
+
x: new import_react_spring.SpringValue(0),
|
|
31
|
+
y: new import_react_spring.SpringValue(0),
|
|
32
|
+
leftOpacity: new import_react_spring.SpringValue(0),
|
|
33
|
+
leftWidth: new import_react_spring.SpringValue(0),
|
|
34
|
+
rightOpacity: new import_react_spring.SpringValue(0),
|
|
35
|
+
rightWidth: new import_react_spring.SpringValue(0)
|
|
36
|
+
});
|
|
37
|
+
const DragAction = ({ className, children, onClick, onLeft, onRight }) => {
|
|
38
|
+
const action = (0, import_react2.useRef)(null);
|
|
39
|
+
const [{ x, y, leftOpacity, leftWidth, rightOpacity, rightWidth }, api] = (0, import_react_spring.useSpring)(() => ({
|
|
40
|
+
x: 0,
|
|
41
|
+
y: 0,
|
|
42
|
+
leftOpacity: 0,
|
|
43
|
+
leftWidth: 0,
|
|
44
|
+
rightOpacity: 0,
|
|
45
|
+
rightWidth: 0
|
|
46
|
+
}));
|
|
47
|
+
const ref = (0, import_react2.useRef)(null);
|
|
48
|
+
const bind = (0, import_react.useGesture)(
|
|
49
|
+
{
|
|
50
|
+
onClick: () => {
|
|
51
|
+
if (!action.current)
|
|
52
|
+
onClick?.();
|
|
53
|
+
action.current = null;
|
|
54
|
+
},
|
|
55
|
+
onDrag: ({ down, movement: [mx], event }) => {
|
|
56
|
+
if (!ref.current)
|
|
57
|
+
return;
|
|
58
|
+
void api.start({
|
|
59
|
+
x: down ? mx : 0,
|
|
60
|
+
leftOpacity: mx > 0 && down ? mx / ref.current.clientWidth : 0,
|
|
61
|
+
leftWidth: mx > 0 && down ? Math.min(mx, ref.current.clientWidth) : 0,
|
|
62
|
+
rightOpacity: mx < 0 && down ? -mx / ref.current.clientWidth : 0,
|
|
63
|
+
rightWidth: mx < 0 && down ? Math.min(-mx, ref.current.clientWidth) : 0
|
|
64
|
+
});
|
|
65
|
+
action.current = mx > 0 ? "left" : mx < 0 ? "right" : null;
|
|
66
|
+
},
|
|
67
|
+
onDragEnd: ({ movement: [mx] }) => {
|
|
68
|
+
if (!ref.current)
|
|
69
|
+
return;
|
|
70
|
+
void api.start({ x: 0, leftOpacity: 0, leftWidth: 0, rightOpacity: 0, rightWidth: 0 });
|
|
71
|
+
if (mx > ref.current.clientWidth / 2 && onLeft)
|
|
72
|
+
onLeft();
|
|
73
|
+
if (mx < -ref.current.clientWidth / 2 && onRight)
|
|
74
|
+
onRight();
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
{ drag: { axis: "x" } }
|
|
78
|
+
);
|
|
79
|
+
return /* @__PURE__ */ React.createElement(DragActionContext.Provider, { value: { bind, x, y, leftOpacity, leftWidth, rightOpacity, rightWidth, onClick } }, /* @__PURE__ */ React.createElement("div", { ref, className: (0, import_client.clsx)("relative overflow-x-hidden", className) }, children));
|
|
80
|
+
};
|
|
81
|
+
const Body = ({ children }) => {
|
|
82
|
+
const { bind, x, onClick } = (0, import_react2.useContext)(DragActionContext);
|
|
83
|
+
return /* @__PURE__ */ React.createElement(import_react_spring.animated.div, { className: "cursor-pointer", ...bind(), style: { x, touchAction: "pan-y" } }, children);
|
|
84
|
+
};
|
|
85
|
+
DragAction.Body = Body;
|
|
86
|
+
const Left = ({ children }) => {
|
|
87
|
+
const { bind, leftOpacity, leftWidth } = (0, import_react2.useContext)(DragActionContext);
|
|
88
|
+
return /* @__PURE__ */ React.createElement(
|
|
89
|
+
import_react_spring.animated.div,
|
|
90
|
+
{
|
|
91
|
+
...bind(),
|
|
92
|
+
style: { touchAction: "pan-y", opacity: leftOpacity, width: leftWidth },
|
|
93
|
+
className: "absolute inset-y-0 left-0 flex items-center justify-center"
|
|
94
|
+
},
|
|
95
|
+
children
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
DragAction.Left = Left;
|
|
99
|
+
const Right = ({ children }) => {
|
|
100
|
+
const { bind, rightOpacity, rightWidth } = (0, import_react2.useContext)(DragActionContext);
|
|
101
|
+
return /* @__PURE__ */ React.createElement(
|
|
102
|
+
import_react_spring.animated.div,
|
|
103
|
+
{
|
|
104
|
+
...bind(),
|
|
105
|
+
style: { opacity: rightOpacity, width: rightWidth },
|
|
106
|
+
className: "absolute inset-y-0 right-0 flex items-center justify-center"
|
|
107
|
+
},
|
|
108
|
+
children
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
DragAction.Right = Right;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var DraggableList_exports = {};
|
|
30
|
+
__export(DraggableList_exports, {
|
|
31
|
+
DraggableList: () => DraggableList
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(DraggableList_exports);
|
|
34
|
+
var import_client = require("@akanjs/client");
|
|
35
|
+
var import_web = require("@react-spring/web");
|
|
36
|
+
var import_react = require("@use-gesture/react");
|
|
37
|
+
var import_lodash = __toESM(require("lodash.clamp"));
|
|
38
|
+
var import_lodash_move = __toESM(require("lodash-move"));
|
|
39
|
+
var import_react2 = require("react");
|
|
40
|
+
const dragListContext = (0, import_react2.createContext)({});
|
|
41
|
+
const useDragList = () => (0, import_react2.useContext)(dragListContext);
|
|
42
|
+
const DragList = ({ className, mode = "vertical", children, onChange }) => {
|
|
43
|
+
const refs = (0, import_react2.useRef)([]);
|
|
44
|
+
const order = (0, import_react2.useRef)(children.map((_, index) => index));
|
|
45
|
+
const clientLengths = (0, import_react2.useRef)(children.map((_, index) => 0));
|
|
46
|
+
const centerLengths = (0, import_react2.useRef)(children.map((_, index) => 0));
|
|
47
|
+
const accLengths = (0, import_react2.useRef)(children.map((_, index) => 0));
|
|
48
|
+
const [springs, api] = (0, import_web.useSprings)(
|
|
49
|
+
children.length,
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
51
|
+
fn(
|
|
52
|
+
order.current,
|
|
53
|
+
new Array(children.length).fill(0),
|
|
54
|
+
new Array(children.length).fill(0)
|
|
55
|
+
)
|
|
56
|
+
);
|
|
57
|
+
const bind = (0, import_react.useGesture)({
|
|
58
|
+
onDragStart: () => {
|
|
59
|
+
order.current = children.map((_, index) => index);
|
|
60
|
+
clientLengths.current = refs.current.map(
|
|
61
|
+
(ref) => mode === "vertical" ? ref?.clientHeight ?? 0 : ref?.clientWidth ?? 0
|
|
62
|
+
);
|
|
63
|
+
centerLengths.current = clientLengths.current.map(
|
|
64
|
+
(length, idx) => clientLengths.current.slice(0, idx).reduce((acc, cur) => acc + cur, 0) + length / 2
|
|
65
|
+
);
|
|
66
|
+
accLengths.current = clientLengths.current.map(
|
|
67
|
+
(length, idx) => clientLengths.current.slice(0, idx).reduce((acc, cur) => acc + cur, 0)
|
|
68
|
+
);
|
|
69
|
+
},
|
|
70
|
+
onDrag: ({ event, args: [originalIndex], active, movement: [x, y] }) => {
|
|
71
|
+
const originIdx = originalIndex;
|
|
72
|
+
const movement = mode === "vertical" ? y : x;
|
|
73
|
+
const dragLength = centerLengths.current[originIdx] + movement;
|
|
74
|
+
const centerIdx = accLengths.current.findIndex(
|
|
75
|
+
(length, idx) => dragLength < accLengths.current[idx + 1] || idx === centerLengths.current.length - 1
|
|
76
|
+
);
|
|
77
|
+
const curRow = (0, import_lodash.default)(centerIdx, 0, children.length - 1);
|
|
78
|
+
const newOrder = (0, import_lodash_move.default)(order.current, originIdx, curRow);
|
|
79
|
+
const newClientHeights = (0, import_lodash_move.default)([...clientLengths.current], originIdx, curRow);
|
|
80
|
+
void api.start(fn(newOrder, clientLengths.current, newClientHeights, active, originIdx, movement));
|
|
81
|
+
if (!active) {
|
|
82
|
+
const draggedValue = children[originIdx].props.value;
|
|
83
|
+
void api.start(fn(order.current, clientLengths.current, newClientHeights, active, originIdx, movement, true));
|
|
84
|
+
onChange(
|
|
85
|
+
children.map((_, index) => children[newOrder[index]].props.value),
|
|
86
|
+
draggedValue,
|
|
87
|
+
{ originalIdx: originIdx, newIdx: curRow, idxChanged: originalIndex !== curRow }
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
return /* @__PURE__ */ React.createElement("div", { className: (0, import_client.clsx)(`flex gap-0`, { "flex-col": mode === "vertical" }, className) }, springs.map(({ zIndex, shadow, movement, scale }, i) => /* @__PURE__ */ React.createElement(
|
|
93
|
+
import_web.animated.div,
|
|
94
|
+
{
|
|
95
|
+
ref: (el) => {
|
|
96
|
+
refs.current[i] = el;
|
|
97
|
+
},
|
|
98
|
+
key: i,
|
|
99
|
+
style: {
|
|
100
|
+
zIndex,
|
|
101
|
+
boxShadow: shadow.to((s) => `rgba(0, 0, 0, 0.15) 0px ${s}px ${2 * s}px 0px`),
|
|
102
|
+
scale,
|
|
103
|
+
...mode === "vertical" ? { y: movement } : { x: movement }
|
|
104
|
+
// cursor: "grab",
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
/* @__PURE__ */ React.createElement(dragListContext.Provider, { value: { bind: () => bind(i) } }, children[i])
|
|
108
|
+
)));
|
|
109
|
+
};
|
|
110
|
+
DragList.Cursor = ({ className, children }) => {
|
|
111
|
+
const { bind } = useDragList();
|
|
112
|
+
return /* @__PURE__ */ React.createElement(
|
|
113
|
+
"div",
|
|
114
|
+
{
|
|
115
|
+
className: (0, import_client.clsx)("cursor-grab duration-200 hover:scale-[1.01] hover:opacity-70 hover:shadow-xl", className),
|
|
116
|
+
...bind()
|
|
117
|
+
},
|
|
118
|
+
children
|
|
119
|
+
);
|
|
120
|
+
};
|
|
121
|
+
const Item = ({ value, children }) => {
|
|
122
|
+
return children;
|
|
123
|
+
};
|
|
124
|
+
DragList.Item = Item;
|
|
125
|
+
const fn = (order, heights, newHeights, active = false, originalIndex = 0, movement = 0, finished = false) => (index) => {
|
|
126
|
+
return active && index === originalIndex ? {
|
|
127
|
+
movement,
|
|
128
|
+
scale: 1.01,
|
|
129
|
+
zIndex: 1,
|
|
130
|
+
// shadow: 15,
|
|
131
|
+
immediate: (key) => key === "zIndex",
|
|
132
|
+
config: (key) => key === "y" ? import_web.config.stiff : import_web.config.default
|
|
133
|
+
} : {
|
|
134
|
+
movement: index === originalIndex ? newHeights.slice(0, order.indexOf(index)).reduce((a, b) => a + b, 0) - heights.slice(0, index).reduce((a, b) => a + b, 0) : order.indexOf(index) === index ? 0 : order.indexOf(index) > index ? heights[originalIndex] : -heights[originalIndex],
|
|
135
|
+
scale: 1,
|
|
136
|
+
zIndex: 0,
|
|
137
|
+
shadow: 0,
|
|
138
|
+
immediate: finished
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
const DraggableList = DragList;
|
package/cjs/Dropdown.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var Dropdown_exports = {};
|
|
20
|
+
__export(Dropdown_exports, {
|
|
21
|
+
Dropdown: () => Dropdown
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(Dropdown_exports);
|
|
24
|
+
var import_client = require("@akanjs/client");
|
|
25
|
+
var import_react = require("react");
|
|
26
|
+
const Dropdown = ({ value, content, className, buttonClassName, dropdownClassName }) => {
|
|
27
|
+
const [opened, setOpened] = (0, import_react.useState)(false);
|
|
28
|
+
return /* @__PURE__ */ React.createElement(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
onClick: () => {
|
|
32
|
+
setOpened(true);
|
|
33
|
+
},
|
|
34
|
+
className: (0, import_client.clsx)("dropdown dropdown-end", className)
|
|
35
|
+
},
|
|
36
|
+
/* @__PURE__ */ React.createElement(
|
|
37
|
+
"label",
|
|
38
|
+
{
|
|
39
|
+
tabIndex: 0,
|
|
40
|
+
className: (0, import_client.clsx)("btn flex", buttonClassName),
|
|
41
|
+
onClick: () => {
|
|
42
|
+
setOpened(true);
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
value
|
|
46
|
+
),
|
|
47
|
+
/* @__PURE__ */ React.createElement(
|
|
48
|
+
"ul",
|
|
49
|
+
{
|
|
50
|
+
tabIndex: 0,
|
|
51
|
+
onClick: () => {
|
|
52
|
+
if (opened)
|
|
53
|
+
setOpened(false);
|
|
54
|
+
},
|
|
55
|
+
className: (0, import_client.clsx)(
|
|
56
|
+
"md:scrollbar-thin md:scrollbar-thumb-rounded-md md:scrollbar-thumb-gray-300 md:scrollbar-track-transparent bg-base-100 z-[100] grid max-h-52 gap-2 overflow-auto rounded-md pr-3 whitespace-nowrap shadow-sm",
|
|
57
|
+
opened ? "dropdown-content size-fit p-1" : "size-0 overflow-hidden",
|
|
58
|
+
dropdownClassName
|
|
59
|
+
)
|
|
60
|
+
},
|
|
61
|
+
content
|
|
62
|
+
)
|
|
63
|
+
);
|
|
64
|
+
};
|
package/cjs/Empty.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var Empty_exports = {};
|
|
29
|
+
__export(Empty_exports, {
|
|
30
|
+
Empty: () => Empty
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(Empty_exports);
|
|
33
|
+
var import_client = require("@akanjs/client");
|
|
34
|
+
var import_next = require("@akanjs/next");
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_ai = require("react-icons/ai");
|
|
37
|
+
const Empty = ({ className = "", description, children, minHeight = 300 }) => {
|
|
38
|
+
const { l } = (0, import_next.usePage)();
|
|
39
|
+
return /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
className: (0, import_client.clsx)(
|
|
43
|
+
`min-h-[${minHeight}px] text-base-content/30 flex flex-col items-center justify-center gap-3 pt-6 pb-3`,
|
|
44
|
+
className
|
|
45
|
+
)
|
|
46
|
+
},
|
|
47
|
+
/* @__PURE__ */ import_react.default.createElement(import_ai.AiOutlineMeh, { className: "scale-150 text-4xl" }),
|
|
48
|
+
/* @__PURE__ */ import_react.default.createElement("p", null, description ?? l("util.noData"))
|
|
49
|
+
), children);
|
|
50
|
+
};
|