@quantabit/modal-sdk 1.0.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 QuantaBit Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # @quantabit/modal-sdk
2
+
3
+ > Universal modal, dialog, drawer, and bottom-sheet components
4
+
5
+ ## Components
6
+
7
+ - **Modal** — Centered popup with backdrop blur
8
+ - **ConfirmDialog** — Confirm/Cancel with danger/warning variants
9
+ - **Drawer** — Side panel (left/right/top/bottom)
10
+ - **BottomSheet** — Mobile-friendly bottom drawer
11
+ - **useModal** — Hook with open/close/toggle
12
+ - **modal.confirm()** — Imperative confirm dialog
13
+
14
+ ```jsx
15
+ import { Modal, ConfirmDialog, Drawer, useModal } from '@quantabit/modal-sdk';
16
+
17
+ const { visible, open, close } = useModal();
18
+ <Modal visible={visible} onClose={close} title="Settings">Content</Modal>
19
+ <ConfirmDialog visible={v} onConfirm={del} variant="danger" title="Delete?" />
20
+ <Drawer visible={v} placement="right" title="Details">...</Drawer>
21
+ ```
22
+
23
+ ## License
24
+ MIT © QuantaBit Team
25
+
26
+
27
+
28
+ ---
29
+
30
+ ## 🌐 Brand & Links
31
+ - Official Mainnet: [QuantaBit Chain](https://qbitchain.io/)
32
+ - Developer Platform: [Developer Platform](https://developer.quantabit.io/)
33
+ - Open Platform: [Open Platform](https://open.quantabit.io/)
34
+ - Payment Platform: [Pay Platform](https://pay.qbitwallet.io/)
35
+ - Feedback: [Feedback](https://xwin.live/qbit)
package/dist/index.cjs ADDED
@@ -0,0 +1,124 @@
1
+ 'use strict';
2
+
3
+ var react = require('react');
4
+
5
+ function Modal() {
6
+ return null;
7
+ }
8
+ function ConfirmDialog() {
9
+ return null;
10
+ }
11
+ function Drawer() {
12
+ return null;
13
+ }
14
+ function BottomSheet() {
15
+ return null;
16
+ }
17
+
18
+ function useModal(defaultVisible = false) {
19
+ const [visible, setVisible] = react.useState(defaultVisible);
20
+ const [data, setData] = react.useState(null);
21
+ const open = react.useCallback(d => {
22
+ setData(d || null);
23
+ setVisible(true);
24
+ }, []);
25
+ const close = react.useCallback(() => {
26
+ setVisible(false);
27
+ setData(null);
28
+ }, []);
29
+ const toggle = react.useCallback(() => setVisible(v => !v), []);
30
+ return {
31
+ visible,
32
+ data,
33
+ open,
34
+ close,
35
+ toggle
36
+ };
37
+ }
38
+
39
+ /**
40
+ * 命令式 Modal API
41
+ * modal.confirm({ title, description, onConfirm })
42
+ * modal.alert({ title, description })
43
+ */
44
+ let _listeners = [];
45
+ const modal = {
46
+ _dispatch(data) {
47
+ _listeners.forEach(fn => fn(data));
48
+ },
49
+ subscribe(fn) {
50
+ _listeners.push(fn);
51
+ return () => {
52
+ _listeners = _listeners.filter(l => l !== fn);
53
+ };
54
+ },
55
+ confirm(options = {}) {
56
+ return new Promise(resolve => {
57
+ modal._dispatch({
58
+ type: 'confirm',
59
+ ...options,
60
+ resolve
61
+ });
62
+ });
63
+ },
64
+ alert(options = {}) {
65
+ return new Promise(resolve => {
66
+ modal._dispatch({
67
+ type: 'alert',
68
+ ...options,
69
+ resolve
70
+ });
71
+ });
72
+ }
73
+ };
74
+
75
+ const SUPPORTED_LANGUAGES = ['en', 'zh', 'ja', 'ko'];
76
+ const messages = {
77
+ en: {
78
+ "modal.confirm": "Confirm",
79
+ "modal.cancel": "Cancel",
80
+ "modal.close": "Close",
81
+ "modal.ok": "OK"
82
+ },
83
+ zh: {
84
+ "modal.confirm": "确认",
85
+ "modal.cancel": "取消",
86
+ "modal.close": "关闭",
87
+ "modal.ok": "好的"
88
+ },
89
+ ja: {
90
+ "modal.confirm": "確認",
91
+ "modal.cancel": "キャンセル",
92
+ "modal.close": "閉じる",
93
+ "modal.ok": "OK"
94
+ },
95
+ ko: {
96
+ "modal.confirm": "확인",
97
+ "modal.cancel": "취소",
98
+ "modal.close": "닫기",
99
+ "modal.ok": "확인"
100
+ }
101
+ };
102
+ let currentLang = 'en';
103
+ function setLanguage(l) {
104
+ if (SUPPORTED_LANGUAGES.includes(l)) currentLang = l;
105
+ }
106
+ function getLanguage() {
107
+ return currentLang;
108
+ }
109
+ function t(k) {
110
+ return messages[currentLang]?.[k] || messages.en?.[k] || k;
111
+ }
112
+
113
+ exports.BottomSheet = BottomSheet;
114
+ exports.ConfirmDialog = ConfirmDialog;
115
+ exports.Drawer = Drawer;
116
+ exports.Modal = Modal;
117
+ exports.SUPPORTED_LANGUAGES = SUPPORTED_LANGUAGES;
118
+ exports.getLanguage = getLanguage;
119
+ exports.messages = messages;
120
+ exports.modal = modal;
121
+ exports.setLanguage = setLanguage;
122
+ exports.t = t;
123
+ exports.useModal = useModal;
124
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../src/components/Modal.jsx","../src/hooks/useModal.js","../src/core/api.js","../src/i18n/index.js"],"sourcesContent":["import React from 'react';\n\nexport function Modal() { return null; }\nexport function ConfirmDialog() { return null; }\nexport function Drawer() { return null; }\nexport function BottomSheet() { return null; }\nexport default Modal;\n","import { useState, useCallback } from 'react';\nexport function useModal(defaultVisible = false) {\n const [visible, setVisible] = useState(defaultVisible);\n const [data, setData] = useState(null);\n const open = useCallback((d) => { setData(d || null); setVisible(true); }, []);\n const close = useCallback(() => { setVisible(false); setData(null); }, []);\n const toggle = useCallback(() => setVisible(v => !v), []);\n return { visible, data, open, close, toggle };\n}\n","/**\n * 命令式 Modal API\n * modal.confirm({ title, description, onConfirm })\n * modal.alert({ title, description })\n */\nlet _listeners = [];\nexport const modal = {\n _dispatch(data) { _listeners.forEach(fn => fn(data)); },\n subscribe(fn) { _listeners.push(fn); return () => { _listeners = _listeners.filter(l => l !== fn); }; },\n confirm(options = {}) {\n return new Promise((resolve) => {\n modal._dispatch({ type: 'confirm', ...options, resolve });\n });\n },\n alert(options = {}) {\n return new Promise((resolve) => {\n modal._dispatch({ type: 'alert', ...options, resolve });\n });\n },\n};\n","export const SUPPORTED_LANGUAGES = ['en', 'zh', 'ja', 'ko'];\nexport const messages = {\n en: {\n \"modal.confirm\": \"Confirm\",\n \"modal.cancel\": \"Cancel\",\n \"modal.close\": \"Close\",\n \"modal.ok\": \"OK\"\n},\n zh: {\n \"modal.confirm\": \"确认\",\n \"modal.cancel\": \"取消\",\n \"modal.close\": \"关闭\",\n \"modal.ok\": \"好的\"\n},\n ja: {\n \"modal.confirm\": \"確認\",\n \"modal.cancel\": \"キャンセル\",\n \"modal.close\": \"閉じる\",\n \"modal.ok\": \"OK\"\n},\n ko: {\n \"modal.confirm\": \"확인\",\n \"modal.cancel\": \"취소\",\n \"modal.close\": \"닫기\",\n \"modal.ok\": \"확인\"\n}\n};\nlet currentLang = 'en';\nexport function setLanguage(l) { if (SUPPORTED_LANGUAGES.includes(l)) currentLang = l; }\nexport function getLanguage() { return currentLang; }\nexport function t(k) { return messages[currentLang]?.[k] || messages.en?.[k] || k; }\n"],"names":["Modal","ConfirmDialog","Drawer","BottomSheet","useModal","defaultVisible","visible","setVisible","useState","data","setData","open","useCallback","d","close","toggle","v","_listeners","modal","_dispatch","forEach","fn","subscribe","push","filter","l","confirm","options","Promise","resolve","type","alert","SUPPORTED_LANGUAGES","messages","en","zh","ja","ko","currentLang","setLanguage","includes","getLanguage","t","k"],"mappings":";;;;AAEO,SAASA,KAAKA,GAAG;AAAE,EAAA,OAAO,IAAI;AAAE;AAChC,SAASC,aAAaA,GAAG;AAAE,EAAA,OAAO,IAAI;AAAE;AACxC,SAASC,MAAMA,GAAG;AAAE,EAAA,OAAO,IAAI;AAAE;AACjC,SAASC,WAAWA,GAAG;AAAE,EAAA,OAAO,IAAI;AAAE;;ACJtC,SAASC,QAAQA,CAACC,cAAc,GAAG,KAAK,EAAE;EAC/C,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGC,cAAQ,CAACH,cAAc,CAAC;EACtD,MAAM,CAACI,IAAI,EAAEC,OAAO,CAAC,GAAGF,cAAQ,CAAC,IAAI,CAAC;AACtC,EAAA,MAAMG,IAAI,GAAGC,iBAAW,CAAEC,CAAC,IAAK;AAAEH,IAAAA,OAAO,CAACG,CAAC,IAAI,IAAI,CAAC;IAAEN,UAAU,CAAC,IAAI,CAAC;EAAE,CAAC,EAAE,EAAE,CAAC;AAC9E,EAAA,MAAMO,KAAK,GAAGF,iBAAW,CAAC,MAAM;IAAEL,UAAU,CAAC,KAAK,CAAC;IAAEG,OAAO,CAAC,IAAI,CAAC;EAAE,CAAC,EAAE,EAAE,CAAC;AAC1E,EAAA,MAAMK,MAAM,GAAGH,iBAAW,CAAC,MAAML,UAAU,CAACS,CAAC,IAAI,CAACA,CAAC,CAAC,EAAE,EAAE,CAAC;EACzD,OAAO;IAAEV,OAAO;IAAEG,IAAI;IAAEE,IAAI;IAAEG,KAAK;AAAEC,IAAAA;GAAQ;AAC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ACJ,IAAA,eAAe,EAAE,IAAI;AACrB,IAAA,cAAc,EAAE,IAAI;AACpB,IAAA,aAAa,EAAE,IAAI;AACnB,IAAA,UAAU,EAAE;GACb;AACCC,EAAAA,EAAE,EAAE;AACJ,IAAA,eAAe,EAAE,IAAI;AACrB,IAAA,cAAc,EAAE,OAAO;AACvB,IAAA,aAAa,EAAE,KAAK;AACpB,IAAA,UAAU,EAAE;GACb;AACCC,EAAAA,EAAE,EAAE;AACJ,IAAA,eAAe,EAAE,IAAI;AACrB,IAAA,cAAc,EAAE,IAAI;AACpB,IAAA,aAAa,EAAE,IAAI;AACnB,IAAA,UAAU,EAAE;AACd;AACA;AACA,IAAIC,WAAW,GAAG,IAAI;AACf,SAASC,WAAWA,CAACd,CAAC,EAAE;EAAE,IAAIO,mBAAmB,CAACQ,QAAQ,CAACf,CAAC,CAAC,EAAEa,WAAW,GAAGb,CAAC;AAAE;AAChF,SAASgB,WAAWA,GAAG;AAAE,EAAA,OAAOH,WAAW;AAAE;AAC7C,SAASI,CAACA,CAACC,CAAC,EAAE;AAAE,EAAA,OAAOV,QAAQ,CAACK,WAAW,CAAC,GAAGK,CAAC,CAAC,IAAIV,QAAQ,CAACC,EAAE,GAAGS,CAAC,CAAC,IAAIA,CAAC;AAAE;;;;;;;;;;;;;;"}
@@ -0,0 +1,112 @@
1
+ import { useState, useCallback } from 'react';
2
+
3
+ function Modal() {
4
+ return null;
5
+ }
6
+ function ConfirmDialog() {
7
+ return null;
8
+ }
9
+ function Drawer() {
10
+ return null;
11
+ }
12
+ function BottomSheet() {
13
+ return null;
14
+ }
15
+
16
+ function useModal(defaultVisible = false) {
17
+ const [visible, setVisible] = useState(defaultVisible);
18
+ const [data, setData] = useState(null);
19
+ const open = useCallback(d => {
20
+ setData(d || null);
21
+ setVisible(true);
22
+ }, []);
23
+ const close = useCallback(() => {
24
+ setVisible(false);
25
+ setData(null);
26
+ }, []);
27
+ const toggle = useCallback(() => setVisible(v => !v), []);
28
+ return {
29
+ visible,
30
+ data,
31
+ open,
32
+ close,
33
+ toggle
34
+ };
35
+ }
36
+
37
+ /**
38
+ * 命令式 Modal API
39
+ * modal.confirm({ title, description, onConfirm })
40
+ * modal.alert({ title, description })
41
+ */
42
+ let _listeners = [];
43
+ const modal = {
44
+ _dispatch(data) {
45
+ _listeners.forEach(fn => fn(data));
46
+ },
47
+ subscribe(fn) {
48
+ _listeners.push(fn);
49
+ return () => {
50
+ _listeners = _listeners.filter(l => l !== fn);
51
+ };
52
+ },
53
+ confirm(options = {}) {
54
+ return new Promise(resolve => {
55
+ modal._dispatch({
56
+ type: 'confirm',
57
+ ...options,
58
+ resolve
59
+ });
60
+ });
61
+ },
62
+ alert(options = {}) {
63
+ return new Promise(resolve => {
64
+ modal._dispatch({
65
+ type: 'alert',
66
+ ...options,
67
+ resolve
68
+ });
69
+ });
70
+ }
71
+ };
72
+
73
+ const SUPPORTED_LANGUAGES = ['en', 'zh', 'ja', 'ko'];
74
+ const messages = {
75
+ en: {
76
+ "modal.confirm": "Confirm",
77
+ "modal.cancel": "Cancel",
78
+ "modal.close": "Close",
79
+ "modal.ok": "OK"
80
+ },
81
+ zh: {
82
+ "modal.confirm": "确认",
83
+ "modal.cancel": "取消",
84
+ "modal.close": "关闭",
85
+ "modal.ok": "好的"
86
+ },
87
+ ja: {
88
+ "modal.confirm": "確認",
89
+ "modal.cancel": "キャンセル",
90
+ "modal.close": "閉じる",
91
+ "modal.ok": "OK"
92
+ },
93
+ ko: {
94
+ "modal.confirm": "확인",
95
+ "modal.cancel": "취소",
96
+ "modal.close": "닫기",
97
+ "modal.ok": "확인"
98
+ }
99
+ };
100
+ let currentLang = 'en';
101
+ function setLanguage(l) {
102
+ if (SUPPORTED_LANGUAGES.includes(l)) currentLang = l;
103
+ }
104
+ function getLanguage() {
105
+ return currentLang;
106
+ }
107
+ function t(k) {
108
+ return messages[currentLang]?.[k] || messages.en?.[k] || k;
109
+ }
110
+
111
+ export { BottomSheet, ConfirmDialog, Drawer, Modal, SUPPORTED_LANGUAGES, getLanguage, messages, modal, setLanguage, t, useModal };
112
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../src/components/Modal.jsx","../src/hooks/useModal.js","../src/core/api.js","../src/i18n/index.js"],"sourcesContent":["import React from 'react';\n\nexport function Modal() { return null; }\nexport function ConfirmDialog() { return null; }\nexport function Drawer() { return null; }\nexport function BottomSheet() { return null; }\nexport default Modal;\n","import { useState, useCallback } from 'react';\nexport function useModal(defaultVisible = false) {\n const [visible, setVisible] = useState(defaultVisible);\n const [data, setData] = useState(null);\n const open = useCallback((d) => { setData(d || null); setVisible(true); }, []);\n const close = useCallback(() => { setVisible(false); setData(null); }, []);\n const toggle = useCallback(() => setVisible(v => !v), []);\n return { visible, data, open, close, toggle };\n}\n","/**\n * 命令式 Modal API\n * modal.confirm({ title, description, onConfirm })\n * modal.alert({ title, description })\n */\nlet _listeners = [];\nexport const modal = {\n _dispatch(data) { _listeners.forEach(fn => fn(data)); },\n subscribe(fn) { _listeners.push(fn); return () => { _listeners = _listeners.filter(l => l !== fn); }; },\n confirm(options = {}) {\n return new Promise((resolve) => {\n modal._dispatch({ type: 'confirm', ...options, resolve });\n });\n },\n alert(options = {}) {\n return new Promise((resolve) => {\n modal._dispatch({ type: 'alert', ...options, resolve });\n });\n },\n};\n","export const SUPPORTED_LANGUAGES = ['en', 'zh', 'ja', 'ko'];\nexport const messages = {\n en: {\n \"modal.confirm\": \"Confirm\",\n \"modal.cancel\": \"Cancel\",\n \"modal.close\": \"Close\",\n \"modal.ok\": \"OK\"\n},\n zh: {\n \"modal.confirm\": \"确认\",\n \"modal.cancel\": \"取消\",\n \"modal.close\": \"关闭\",\n \"modal.ok\": \"好的\"\n},\n ja: {\n \"modal.confirm\": \"確認\",\n \"modal.cancel\": \"キャンセル\",\n \"modal.close\": \"閉じる\",\n \"modal.ok\": \"OK\"\n},\n ko: {\n \"modal.confirm\": \"확인\",\n \"modal.cancel\": \"취소\",\n \"modal.close\": \"닫기\",\n \"modal.ok\": \"확인\"\n}\n};\nlet currentLang = 'en';\nexport function setLanguage(l) { if (SUPPORTED_LANGUAGES.includes(l)) currentLang = l; }\nexport function getLanguage() { return currentLang; }\nexport function t(k) { return messages[currentLang]?.[k] || messages.en?.[k] || k; }\n"],"names":["Modal","ConfirmDialog","Drawer","BottomSheet","useModal","defaultVisible","visible","setVisible","useState","data","setData","open","useCallback","d","close","toggle","v","_listeners","modal","_dispatch","forEach","fn","subscribe","push","filter","l","confirm","options","Promise","resolve","type","alert","SUPPORTED_LANGUAGES","messages","en","zh","ja","ko","currentLang","setLanguage","includes","getLanguage","t","k"],"mappings":";;AAEO,SAASA,KAAKA,GAAG;AAAE,EAAA,OAAO,IAAI;AAAE;AAChC,SAASC,aAAaA,GAAG;AAAE,EAAA,OAAO,IAAI;AAAE;AACxC,SAASC,MAAMA,GAAG;AAAE,EAAA,OAAO,IAAI;AAAE;AACjC,SAASC,WAAWA,GAAG;AAAE,EAAA,OAAO,IAAI;AAAE;;ACJtC,SAASC,QAAQA,CAACC,cAAc,GAAG,KAAK,EAAE;EAC/C,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGC,QAAQ,CAACH,cAAc,CAAC;EACtD,MAAM,CAACI,IAAI,EAAEC,OAAO,CAAC,GAAGF,QAAQ,CAAC,IAAI,CAAC;AACtC,EAAA,MAAMG,IAAI,GAAGC,WAAW,CAAEC,CAAC,IAAK;AAAEH,IAAAA,OAAO,CAACG,CAAC,IAAI,IAAI,CAAC;IAAEN,UAAU,CAAC,IAAI,CAAC;EAAE,CAAC,EAAE,EAAE,CAAC;AAC9E,EAAA,MAAMO,KAAK,GAAGF,WAAW,CAAC,MAAM;IAAEL,UAAU,CAAC,KAAK,CAAC;IAAEG,OAAO,CAAC,IAAI,CAAC;EAAE,CAAC,EAAE,EAAE,CAAC;AAC1E,EAAA,MAAMK,MAAM,GAAGH,WAAW,CAAC,MAAML,UAAU,CAACS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AA,eAAe,EAAE,SAAS;AAC1B,IAAA,cAAc,EAAE,QAAQ;AACxB,IAAA,aAAa,EAAE,OAAO;AACtB,IAAA,UAAU,EAAE;GACb;AACCC,EAAAA,EAAE,EAAE;AACJ,IAAA,eAAe,EAAE,IAAI;AACrB,IAAA,cAAc,EAAE,IAAI;AACpB,IAAA,aAAa,EAAE,IAAI;AACnB,IAAA,UAAU,EAAE;GACb;AACCC,EAAAA,EAAE,EAAE;AACJ,IAAA,eAAe,EAAE,IAAI;AACrB,IAAA,cAAc,EAAE,OAAO;AACvB,IAAA,aAAa,EAAE,KAAK;AACpB,IAAA,UAAU,EAAE;GACb;AACCC,EAAAA,EAAE,EAAE;AACJ,IAAA,eAAe,EAAE,IAAI;AACrB,IAAA,cAAc,EAAE,IAAI;AACpB,IAAA,aAAa,EAAE,IAAI;AACnB,IAAA,UAAU,EAAE;AACd;AACA;AACA,IAAIC,WAAW,GAAG,IAAI;AACf,SAASC,WAAWA,CAACd,CAAC,EAAE;EAAE,IAAIO,mBAAmB,CAACQ,QAAQ,CAACf,CAAC,CAAC,EAAEa,WAAW,GAAGb,CAAC;AAAE;AAChF,SAASgB,WAAWA,GAAG;AAAE,EAAA,OAAOH,WAAW;AAAE;AAC7C,SAASI,CAACA,CAACC,CAAC,EAAE;AAAE,EAAA,OAAOV,QAAQ,CAACK,WAAW,CAAC,GAAGK,CAAC,CAAC,IAAIV,QAAQ,CAACC,EAAE,GAAGS,CAAC,CAAC,IAAIA,CAAC;AAAE;;;;"}
@@ -0,0 +1,2 @@
1
+ @keyframes qm-fade-in{0%{opacity:0}to{opacity:1}}@keyframes qm-scale-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes qm-slide-right{0%{transform:translateX(100%)}to{transform:translateX(0)}}@keyframes qm-slide-left{0%{transform:translateX(-100%)}to{transform:translateX(0)}}@keyframes qm-slide-top{0%{transform:translateY(-100%)}to{transform:translateY(0)}}@keyframes qm-slide-bottom{0%{transform:translateY(100%)}to{transform:translateY(0)}}.qm-drawer,.qm-modal{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}
2
+ /*# sourceMappingURL=styles.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["modal.css"],"names":[],"mappings":"AAAA,sBAAsB,GAAK,SAAS,CAAC,GAAG,SAAS,CAAC,CAClD,uBAAuB,GAAK,SAAS,CAAC,oBAAqB,CAAC,GAAG,SAAS,CAAC,kBAAkB,CAAC,CAC5F,0BAA0B,GAAK,0BAA0B,CAAC,GAAG,uBAAuB,CAAC,CACrF,yBAAyB,GAAK,2BAA2B,CAAC,GAAG,uBAAuB,CAAC,CACrF,wBAAwB,GAAK,2BAA2B,CAAC,GAAG,uBAAuB,CAAC,CACpF,2BAA2B,GAAK,0BAA0B,CAAC,GAAG,uBAAuB,CAAC,CAEtF,qBAAW,uEAAyE","file":"styles.css","sourcesContent":["@keyframes qm-fade-in{from{opacity:0}to{opacity:1}}\n@keyframes qm-scale-in{from{opacity:0;transform:scale(0.95)}to{opacity:1;transform:scale(1)}}\n@keyframes qm-slide-right{from{transform:translateX(100%)}to{transform:translateX(0)}}\n@keyframes qm-slide-left{from{transform:translateX(-100%)}to{transform:translateX(0)}}\n@keyframes qm-slide-top{from{transform:translateY(-100%)}to{transform:translateY(0)}}\n@keyframes qm-slide-bottom{from{transform:translateY(100%)}to{transform:translateY(0)}}\n.qm-modal{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif}\n.qm-drawer{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif}\n"]}
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@quantabit/modal-sdk",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "description": "Universal modal/dialog/drawer/bottom-sheet components",
6
+ "main": "dist/index.cjs",
7
+ "module": "dist/index.esm.js",
8
+ "types": "types/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./types/index.d.ts",
12
+ "import": "./dist/index.esm.js",
13
+ "require": "./dist/index.cjs"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "types",
19
+ "README.md",
20
+ "LICENSE"
21
+ ],
22
+ "scripts": {
23
+ "build": "rollup -c",
24
+ "dev": "rollup -c -w",
25
+ "test": "jest --passWithNoTests",
26
+ "prepublishOnly": "npm run build"
27
+ },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/quantabit-chain/qbit-sdk.git",
31
+ "directory": "packages/modal-sdk"
32
+ },
33
+ "homepage": "https://github.com/quantabit-chain/qbit-sdk/tree/main/packages/modal-sdk",
34
+ "bugs": {
35
+ "url": "https://github.com/quantabit-chain/qbit-sdk/issues"
36
+ },
37
+ "keywords": [
38
+ "modal",
39
+ "dialog",
40
+ "drawer",
41
+ "bottom-sheet",
42
+ "react"
43
+ ],
44
+ "author": "QuantaBit Team",
45
+ "license": "MIT",
46
+ "engines": {
47
+ "node": ">=18.0.0"
48
+ },
49
+ "peerDependencies": {
50
+ "react": ">=17.0.0",
51
+ "react-dom": ">=17.0.0"
52
+ },
53
+ "dependencies": {
54
+ "@quantabit/sdk-config": "^1.0.6"
55
+ },
56
+ "publishConfig": {
57
+ "access": "public"
58
+ },
59
+ "sideEffects": [
60
+ "*.css"
61
+ ],
62
+ "qbit": {
63
+ "privacy": {
64
+ "level": "functional",
65
+ "dataCollection": "Feature-related data for personalization. Requires user consent.",
66
+ "gdprCompliant": true,
67
+ "ccpaCompliant": true
68
+ }
69
+ }
70
+ }
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @quantabit/modal-sdk TypeScript Type Definitions
3
+ *
4
+ * Auto-generated type stubs. Enhance with specific types as the SDK matures.
5
+ */
6
+
7
+ import { FC, ReactNode } from 'react';
8
+
9
+ // ============ Components ============
10
+
11
+ export interface ModalProps {
12
+ className?: string;
13
+ style?: React.CSSProperties;
14
+ [key: string]: any;
15
+ }
16
+
17
+ export declare const Modal: FC<ModalProps>;
18
+
19
+ export interface ConfirmDialogProps {
20
+ className?: string;
21
+ style?: React.CSSProperties;
22
+ [key: string]: any;
23
+ }
24
+
25
+ export declare const ConfirmDialog: FC<ConfirmDialogProps>;
26
+
27
+ export interface DrawerProps {
28
+ className?: string;
29
+ style?: React.CSSProperties;
30
+ [key: string]: any;
31
+ }
32
+
33
+ export declare const Drawer: FC<DrawerProps>;
34
+
35
+ export interface BottomSheetProps {
36
+ className?: string;
37
+ style?: React.CSSProperties;
38
+ [key: string]: any;
39
+ }
40
+
41
+ export declare const BottomSheet: FC<BottomSheetProps>;
42
+
43
+ // ============ Hooks ============
44
+
45
+ export interface UseModalReturn {
46
+ data: any;
47
+ loading: boolean;
48
+ error: string | null;
49
+ [key: string]: any;
50
+ }
51
+
52
+ export declare function useModal(...args: any[]): UseModalReturn;
53
+
54
+ // ============ Functions & Utilities ============
55
+
56
+ export declare function modal(...args: any[]): any;
57
+ export declare const messages: Record<string, Record<string, string>>;
58
+ export declare const SUPPORTED_LANGUAGES: string[];
59
+ export declare function setLanguage(lang: string): void;
60
+ export declare function getLanguage(): string;
61
+ export declare function t(key: string, params?: Record<string, any>): string;
62
+