cisse-vue-ui 0.1.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/README.md +15 -0
- package/dist/BadgeType.vue_vue_type_script_setup_true_lang-CJb63H1I.cjs +145 -0
- package/dist/BadgeType.vue_vue_type_script_setup_true_lang-CJb63H1I.cjs.map +1 -0
- package/dist/BadgeType.vue_vue_type_script_setup_true_lang-CnB5eNEM.js +146 -0
- package/dist/BadgeType.vue_vue_type_script_setup_true_lang-CnB5eNEM.js.map +1 -0
- package/dist/NotificationList.vue_vue_type_script_setup_true_lang-B2hjbMm4.js +351 -0
- package/dist/NotificationList.vue_vue_type_script_setup_true_lang-B2hjbMm4.js.map +1 -0
- package/dist/NotificationList.vue_vue_type_script_setup_true_lang-Ci3zIvrv.cjs +350 -0
- package/dist/NotificationList.vue_vue_type_script_setup_true_lang-Ci3zIvrv.cjs.map +1 -0
- package/dist/SearchInput.vue_vue_type_script_setup_true_lang-Be73hShP.cjs +234 -0
- package/dist/SearchInput.vue_vue_type_script_setup_true_lang-Be73hShP.cjs.map +1 -0
- package/dist/SearchInput.vue_vue_type_script_setup_true_lang-DjT2qdcp.js +235 -0
- package/dist/SearchInput.vue_vue_type_script_setup_true_lang-DjT2qdcp.js.map +1 -0
- package/dist/TableAction.vue_vue_type_script_setup_true_lang-BHskhVhK.js +540 -0
- package/dist/TableAction.vue_vue_type_script_setup_true_lang-BHskhVhK.js.map +1 -0
- package/dist/TableAction.vue_vue_type_script_setup_true_lang-CojbKn7E.cjs +539 -0
- package/dist/TableAction.vue_vue_type_script_setup_true_lang-CojbKn7E.cjs.map +1 -0
- package/dist/components/core/AutocompleteComponent.vue.d.ts +19 -0
- package/dist/components/core/CardComponent.vue.d.ts +24 -0
- package/dist/components/core/MenuItem.vue.d.ts +6 -0
- package/dist/components/core/StatusBadge.vue.d.ts +21 -0
- package/dist/components/core/TableAction.vue.d.ts +8 -0
- package/dist/components/core/TableComponent.vue.d.ts +40 -0
- package/dist/components/core/index.cjs +11 -0
- package/dist/components/core/index.cjs.map +1 -0
- package/dist/components/core/index.d.ts +6 -0
- package/dist/components/core/index.js +11 -0
- package/dist/components/core/index.js.map +1 -0
- package/dist/components/feedback/LoadingSpinner.vue.d.ts +7 -0
- package/dist/components/feedback/Modal.vue.d.ts +32 -0
- package/dist/components/feedback/NotificationComponent.vue.d.ts +12 -0
- package/dist/components/feedback/NotificationList.vue.d.ts +12 -0
- package/dist/components/feedback/PaginationControls.vue.d.ts +21 -0
- package/dist/components/feedback/index.cjs +9 -0
- package/dist/components/feedback/index.cjs.map +1 -0
- package/dist/components/feedback/index.d.ts +5 -0
- package/dist/components/feedback/index.js +9 -0
- package/dist/components/feedback/index.js.map +1 -0
- package/dist/components/form/FormGroup.vue.d.ts +30 -0
- package/dist/components/form/FormHelp.vue.d.ts +21 -0
- package/dist/components/form/FormInput.vue.d.ts +13 -0
- package/dist/components/form/FormLabel.vue.d.ts +21 -0
- package/dist/components/form/FormSelect.vue.d.ts +26 -0
- package/dist/components/form/SearchInput.vue.d.ts +12 -0
- package/dist/components/form/index.cjs +10 -0
- package/dist/components/form/index.cjs.map +1 -0
- package/dist/components/form/index.d.ts +6 -0
- package/dist/components/form/index.js +10 -0
- package/dist/components/form/index.js.map +1 -0
- package/dist/components/index.cjs +29 -0
- package/dist/components/index.cjs.map +1 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +29 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/type/BadgeType.vue.d.ts +11 -0
- package/dist/components/type/BooleanType.vue.d.ts +11 -0
- package/dist/components/type/DateType.vue.d.ts +10 -0
- package/dist/components/type/NumberType.vue.d.ts +9 -0
- package/dist/components/type/TextType.vue.d.ts +8 -0
- package/dist/components/type/index.cjs +9 -0
- package/dist/components/type/index.cjs.map +1 -0
- package/dist/components/type/index.d.ts +5 -0
- package/dist/components/type/index.js +9 -0
- package/dist/components/type/index.js.map +1 -0
- package/dist/composables/index.cjs +7 -0
- package/dist/composables/index.cjs.map +1 -0
- package/dist/composables/index.d.ts +3 -0
- package/dist/composables/index.js +7 -0
- package/dist/composables/index.js.map +1 -0
- package/dist/composables/useDarkMode.d.ts +14 -0
- package/dist/composables/useExportCSV.d.ts +10 -0
- package/dist/composables/useNotifications.d.ts +27 -0
- package/dist/index-BoCtJCg0.cjs +32 -0
- package/dist/index-BoCtJCg0.cjs.map +1 -0
- package/dist/index-CGhDI10m.js +33 -0
- package/dist/index-CGhDI10m.js.map +1 -0
- package/dist/index.cjs +49 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.d.ts +24 -0
- package/dist/types/components.d.ts +18 -0
- package/dist/types/form.d.ts +27 -0
- package/dist/types/index.cjs +2 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/notification.d.ts +12 -0
- package/dist/types/property.d.ts +34 -0
- package/dist/useExportCSV-B9o9lJ3D.js +130 -0
- package/dist/useExportCSV-B9o9lJ3D.js.map +1 -0
- package/dist/useExportCSV-BPC_hd25.cjs +129 -0
- package/dist/useExportCSV-BPC_hd25.cjs.map +1 -0
- package/package.json +131 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Composable for exporting data to CSV format
|
|
3
|
+
*/
|
|
4
|
+
export declare function useExportCSV(): {
|
|
5
|
+
exportToCSV: <T extends Record<string, unknown>>(data: T[], columns: {
|
|
6
|
+
key: keyof T;
|
|
7
|
+
label: string;
|
|
8
|
+
}[], filename?: string) => void;
|
|
9
|
+
escapeCSV: (value: unknown) => string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { NotificationType, NotificationOptions } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Composable for managing notifications/toasts
|
|
4
|
+
* Standalone implementation without Pinia dependency
|
|
5
|
+
*/
|
|
6
|
+
export declare function useNotifications(): {
|
|
7
|
+
notifications: Readonly<import('vue').Ref<readonly {
|
|
8
|
+
readonly id?: string | undefined;
|
|
9
|
+
readonly type: NotificationType;
|
|
10
|
+
readonly message: string;
|
|
11
|
+
readonly title?: string | null | undefined;
|
|
12
|
+
readonly duration?: number | undefined;
|
|
13
|
+
}[], readonly {
|
|
14
|
+
readonly id?: string | undefined;
|
|
15
|
+
readonly type: NotificationType;
|
|
16
|
+
readonly message: string;
|
|
17
|
+
readonly title?: string | null | undefined;
|
|
18
|
+
readonly duration?: number | undefined;
|
|
19
|
+
}[]>>;
|
|
20
|
+
notify: (type: NotificationType, message: string, options?: NotificationOptions) => string;
|
|
21
|
+
success: (message: string, options?: NotificationOptions) => string;
|
|
22
|
+
warning: (message: string, options?: NotificationOptions) => string;
|
|
23
|
+
error: (message: string, options?: NotificationOptions) => string;
|
|
24
|
+
info: (message: string, options?: NotificationOptions) => string;
|
|
25
|
+
remove: (id: string) => void;
|
|
26
|
+
clear: () => void;
|
|
27
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const TableAction_vue_vue_type_script_setup_true_lang = require("./TableAction.vue_vue_type_script_setup_true_lang-CojbKn7E.cjs");
|
|
3
|
+
const BadgeType_vue_vue_type_script_setup_true_lang = require("./BadgeType.vue_vue_type_script_setup_true_lang-CJb63H1I.cjs");
|
|
4
|
+
const SearchInput_vue_vue_type_script_setup_true_lang = require("./SearchInput.vue_vue_type_script_setup_true_lang-Be73hShP.cjs");
|
|
5
|
+
const NotificationList_vue_vue_type_script_setup_true_lang = require("./NotificationList.vue_vue_type_script_setup_true_lang-Ci3zIvrv.cjs");
|
|
6
|
+
const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
7
|
+
__proto__: null,
|
|
8
|
+
AutocompleteComponent: TableAction_vue_vue_type_script_setup_true_lang._sfc_main$2,
|
|
9
|
+
BadgeType: BadgeType_vue_vue_type_script_setup_true_lang._sfc_main$5,
|
|
10
|
+
BooleanType: BadgeType_vue_vue_type_script_setup_true_lang._sfc_main$4,
|
|
11
|
+
CardComponent: TableAction_vue_vue_type_script_setup_true_lang._sfc_main,
|
|
12
|
+
DateType: BadgeType_vue_vue_type_script_setup_true_lang._sfc_main$3,
|
|
13
|
+
FormGroup: SearchInput_vue_vue_type_script_setup_true_lang._sfc_main$4,
|
|
14
|
+
FormHelp: SearchInput_vue_vue_type_script_setup_true_lang._sfc_main$1,
|
|
15
|
+
FormInput: SearchInput_vue_vue_type_script_setup_true_lang._sfc_main$2,
|
|
16
|
+
FormLabel: SearchInput_vue_vue_type_script_setup_true_lang._sfc_main,
|
|
17
|
+
FormSelect: SearchInput_vue_vue_type_script_setup_true_lang._sfc_main$3,
|
|
18
|
+
LoadingSpinner: NotificationList_vue_vue_type_script_setup_true_lang._sfc_main,
|
|
19
|
+
MenuItem: TableAction_vue_vue_type_script_setup_true_lang._sfc_main$3,
|
|
20
|
+
Modal: NotificationList_vue_vue_type_script_setup_true_lang._sfc_main$1,
|
|
21
|
+
NotificationComponent: NotificationList_vue_vue_type_script_setup_true_lang._sfc_main$3,
|
|
22
|
+
NotificationList: NotificationList_vue_vue_type_script_setup_true_lang._sfc_main$4,
|
|
23
|
+
NumberType: BadgeType_vue_vue_type_script_setup_true_lang._sfc_main$2,
|
|
24
|
+
PaginationControls: NotificationList_vue_vue_type_script_setup_true_lang._sfc_main$2,
|
|
25
|
+
SearchInput: SearchInput_vue_vue_type_script_setup_true_lang._sfc_main$5,
|
|
26
|
+
StatusBadge: BadgeType_vue_vue_type_script_setup_true_lang._sfc_main,
|
|
27
|
+
TableAction: TableAction_vue_vue_type_script_setup_true_lang._sfc_main$4,
|
|
28
|
+
TableComponent: TableAction_vue_vue_type_script_setup_true_lang._sfc_main$1,
|
|
29
|
+
TextType: BadgeType_vue_vue_type_script_setup_true_lang._sfc_main$1
|
|
30
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
31
|
+
exports.components = components;
|
|
32
|
+
//# sourceMappingURL=index-BoCtJCg0.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-BoCtJCg0.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { b as _sfc_main, _ as _sfc_main$3, c as _sfc_main$b, d as _sfc_main$j, a as _sfc_main$k } from "./TableAction.vue_vue_type_script_setup_true_lang-BHskhVhK.js";
|
|
2
|
+
import { e as _sfc_main$1, d as _sfc_main$2, c as _sfc_main$4, b as _sfc_main$f, _ as _sfc_main$i, a as _sfc_main$l } from "./BadgeType.vue_vue_type_script_setup_true_lang-CnB5eNEM.js";
|
|
3
|
+
import { d as _sfc_main$5, a as _sfc_main$6, b as _sfc_main$7, _ as _sfc_main$8, c as _sfc_main$9, e as _sfc_main$h } from "./SearchInput.vue_vue_type_script_setup_true_lang-DjT2qdcp.js";
|
|
4
|
+
import { _ as _sfc_main$a, a as _sfc_main$c, c as _sfc_main$d, d as _sfc_main$e, b as _sfc_main$g } from "./NotificationList.vue_vue_type_script_setup_true_lang-B2hjbMm4.js";
|
|
5
|
+
const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6
|
+
__proto__: null,
|
|
7
|
+
AutocompleteComponent: _sfc_main,
|
|
8
|
+
BadgeType: _sfc_main$1,
|
|
9
|
+
BooleanType: _sfc_main$2,
|
|
10
|
+
CardComponent: _sfc_main$3,
|
|
11
|
+
DateType: _sfc_main$4,
|
|
12
|
+
FormGroup: _sfc_main$5,
|
|
13
|
+
FormHelp: _sfc_main$6,
|
|
14
|
+
FormInput: _sfc_main$7,
|
|
15
|
+
FormLabel: _sfc_main$8,
|
|
16
|
+
FormSelect: _sfc_main$9,
|
|
17
|
+
LoadingSpinner: _sfc_main$a,
|
|
18
|
+
MenuItem: _sfc_main$b,
|
|
19
|
+
Modal: _sfc_main$c,
|
|
20
|
+
NotificationComponent: _sfc_main$d,
|
|
21
|
+
NotificationList: _sfc_main$e,
|
|
22
|
+
NumberType: _sfc_main$f,
|
|
23
|
+
PaginationControls: _sfc_main$g,
|
|
24
|
+
SearchInput: _sfc_main$h,
|
|
25
|
+
StatusBadge: _sfc_main$i,
|
|
26
|
+
TableAction: _sfc_main$j,
|
|
27
|
+
TableComponent: _sfc_main$k,
|
|
28
|
+
TextType: _sfc_main$l
|
|
29
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
30
|
+
export {
|
|
31
|
+
components as c
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=index-CGhDI10m.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-CGhDI10m.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const TableAction_vue_vue_type_script_setup_true_lang = require("./TableAction.vue_vue_type_script_setup_true_lang-CojbKn7E.cjs");
|
|
4
|
+
const BadgeType_vue_vue_type_script_setup_true_lang = require("./BadgeType.vue_vue_type_script_setup_true_lang-CJb63H1I.cjs");
|
|
5
|
+
const SearchInput_vue_vue_type_script_setup_true_lang = require("./SearchInput.vue_vue_type_script_setup_true_lang-Be73hShP.cjs");
|
|
6
|
+
const NotificationList_vue_vue_type_script_setup_true_lang = require("./NotificationList.vue_vue_type_script_setup_true_lang-Ci3zIvrv.cjs");
|
|
7
|
+
const useExportCSV = require("./useExportCSV-BPC_hd25.cjs");
|
|
8
|
+
const components_index = require("./index-BoCtJCg0.cjs");
|
|
9
|
+
const VueTailwindUI = {
|
|
10
|
+
install(app, options = {}) {
|
|
11
|
+
const { prefix = "", components: selectedComponents } = options;
|
|
12
|
+
const allComponents = components_index.components;
|
|
13
|
+
const componentsToRegister = selectedComponents ? Object.fromEntries(
|
|
14
|
+
Object.entries(allComponents).filter(
|
|
15
|
+
([name]) => selectedComponents.includes(name)
|
|
16
|
+
)
|
|
17
|
+
) : allComponents;
|
|
18
|
+
for (const [name, component] of Object.entries(componentsToRegister)) {
|
|
19
|
+
app.component(`${prefix}${name}`, component);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
exports.AutocompleteComponent = TableAction_vue_vue_type_script_setup_true_lang._sfc_main$2;
|
|
24
|
+
exports.CardComponent = TableAction_vue_vue_type_script_setup_true_lang._sfc_main;
|
|
25
|
+
exports.MenuItem = TableAction_vue_vue_type_script_setup_true_lang._sfc_main$3;
|
|
26
|
+
exports.TableAction = TableAction_vue_vue_type_script_setup_true_lang._sfc_main$4;
|
|
27
|
+
exports.TableComponent = TableAction_vue_vue_type_script_setup_true_lang._sfc_main$1;
|
|
28
|
+
exports.BadgeType = BadgeType_vue_vue_type_script_setup_true_lang._sfc_main$5;
|
|
29
|
+
exports.BooleanType = BadgeType_vue_vue_type_script_setup_true_lang._sfc_main$4;
|
|
30
|
+
exports.DateType = BadgeType_vue_vue_type_script_setup_true_lang._sfc_main$3;
|
|
31
|
+
exports.NumberType = BadgeType_vue_vue_type_script_setup_true_lang._sfc_main$2;
|
|
32
|
+
exports.StatusBadge = BadgeType_vue_vue_type_script_setup_true_lang._sfc_main;
|
|
33
|
+
exports.TextType = BadgeType_vue_vue_type_script_setup_true_lang._sfc_main$1;
|
|
34
|
+
exports.FormGroup = SearchInput_vue_vue_type_script_setup_true_lang._sfc_main$4;
|
|
35
|
+
exports.FormHelp = SearchInput_vue_vue_type_script_setup_true_lang._sfc_main$1;
|
|
36
|
+
exports.FormInput = SearchInput_vue_vue_type_script_setup_true_lang._sfc_main$2;
|
|
37
|
+
exports.FormLabel = SearchInput_vue_vue_type_script_setup_true_lang._sfc_main;
|
|
38
|
+
exports.FormSelect = SearchInput_vue_vue_type_script_setup_true_lang._sfc_main$3;
|
|
39
|
+
exports.SearchInput = SearchInput_vue_vue_type_script_setup_true_lang._sfc_main$5;
|
|
40
|
+
exports.LoadingSpinner = NotificationList_vue_vue_type_script_setup_true_lang._sfc_main;
|
|
41
|
+
exports.Modal = NotificationList_vue_vue_type_script_setup_true_lang._sfc_main$1;
|
|
42
|
+
exports.NotificationComponent = NotificationList_vue_vue_type_script_setup_true_lang._sfc_main$3;
|
|
43
|
+
exports.NotificationList = NotificationList_vue_vue_type_script_setup_true_lang._sfc_main$4;
|
|
44
|
+
exports.PaginationControls = NotificationList_vue_vue_type_script_setup_true_lang._sfc_main$2;
|
|
45
|
+
exports.useDarkMode = useExportCSV.useDarkMode;
|
|
46
|
+
exports.useExportCSV = useExportCSV.useExportCSV;
|
|
47
|
+
exports.useNotifications = useExportCSV.useNotifications;
|
|
48
|
+
exports.VueTailwindUI = VueTailwindUI;
|
|
49
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/plugin.ts"],"sourcesContent":["import type { App, Plugin, Component } from 'vue'\nimport * as components from './components'\n\nexport interface PluginOptions {\n /** Optional prefix for component names (e.g., 'Ui' makes CardComponent -> UiCardComponent) */\n prefix?: string\n /** List of specific components to register. If not provided, all components are registered */\n components?: string[]\n}\n\n/**\n * Vue plugin for global component registration\n *\n * @example\n * // Register all components\n * app.use(VueTailwindUI)\n *\n * @example\n * // Register with prefix\n * app.use(VueTailwindUI, { prefix: 'Ui' })\n *\n * @example\n * // Register specific components only\n * app.use(VueTailwindUI, { components: ['CardComponent', 'TableComponent'] })\n */\nconst VueTailwindUI: Plugin = {\n install(app: App, options: PluginOptions = {}) {\n const { prefix = '', components: selectedComponents } = options\n\n const allComponents = components as Record<string, Component>\n\n const componentsToRegister = selectedComponents\n ? Object.fromEntries(\n Object.entries(allComponents).filter(([name]) =>\n selectedComponents.includes(name),\n ),\n )\n : allComponents\n\n for (const [name, component] of Object.entries(componentsToRegister)) {\n app.component(`${prefix}${name}`, component)\n }\n },\n}\n\nexport default VueTailwindUI\n"],"names":["components"],"mappings":";;;;;;;;AAyBA,MAAM,gBAAwB;AAAA,EAC5B,QAAQ,KAAU,UAAyB,IAAI;AAC7C,UAAM,EAAE,SAAS,IAAI,YAAY,uBAAuB;AAExD,UAAM,gBAAgBA,iBAAAA;AAEtB,UAAM,uBAAuB,qBACzB,OAAO;AAAA,MACL,OAAO,QAAQ,aAAa,EAAE;AAAA,QAAO,CAAC,CAAC,IAAI,MACzC,mBAAmB,SAAS,IAAI;AAAA,MAAA;AAAA,IAClC,IAEF;AAEJ,eAAW,CAAC,MAAM,SAAS,KAAK,OAAO,QAAQ,oBAAoB,GAAG;AACpE,UAAI,UAAU,GAAG,MAAM,GAAG,IAAI,IAAI,SAAS;AAAA,IAC7C;AAAA,EACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { b, _, c, d, a } from "./TableAction.vue_vue_type_script_setup_true_lang-BHskhVhK.js";
|
|
2
|
+
import { e, d as d2, c as c2, b as b2, _ as _2, a as a2 } from "./BadgeType.vue_vue_type_script_setup_true_lang-CnB5eNEM.js";
|
|
3
|
+
import { d as d3, a as a3, b as b3, _ as _3, c as c3, e as e2 } from "./SearchInput.vue_vue_type_script_setup_true_lang-DjT2qdcp.js";
|
|
4
|
+
import { _ as _4, a as a4, c as c4, d as d4, b as b4 } from "./NotificationList.vue_vue_type_script_setup_true_lang-B2hjbMm4.js";
|
|
5
|
+
import { a as a5, b as b5, u } from "./useExportCSV-B9o9lJ3D.js";
|
|
6
|
+
import { c as components } from "./index-CGhDI10m.js";
|
|
7
|
+
const VueTailwindUI = {
|
|
8
|
+
install(app, options = {}) {
|
|
9
|
+
const { prefix = "", components: selectedComponents } = options;
|
|
10
|
+
const allComponents = components;
|
|
11
|
+
const componentsToRegister = selectedComponents ? Object.fromEntries(
|
|
12
|
+
Object.entries(allComponents).filter(
|
|
13
|
+
([name]) => selectedComponents.includes(name)
|
|
14
|
+
)
|
|
15
|
+
) : allComponents;
|
|
16
|
+
for (const [name, component] of Object.entries(componentsToRegister)) {
|
|
17
|
+
app.component(`${prefix}${name}`, component);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
b as AutocompleteComponent,
|
|
23
|
+
e as BadgeType,
|
|
24
|
+
d2 as BooleanType,
|
|
25
|
+
_ as CardComponent,
|
|
26
|
+
c2 as DateType,
|
|
27
|
+
d3 as FormGroup,
|
|
28
|
+
a3 as FormHelp,
|
|
29
|
+
b3 as FormInput,
|
|
30
|
+
_3 as FormLabel,
|
|
31
|
+
c3 as FormSelect,
|
|
32
|
+
_4 as LoadingSpinner,
|
|
33
|
+
c as MenuItem,
|
|
34
|
+
a4 as Modal,
|
|
35
|
+
c4 as NotificationComponent,
|
|
36
|
+
d4 as NotificationList,
|
|
37
|
+
b2 as NumberType,
|
|
38
|
+
b4 as PaginationControls,
|
|
39
|
+
e2 as SearchInput,
|
|
40
|
+
_2 as StatusBadge,
|
|
41
|
+
d as TableAction,
|
|
42
|
+
a as TableComponent,
|
|
43
|
+
a2 as TextType,
|
|
44
|
+
VueTailwindUI,
|
|
45
|
+
a5 as useDarkMode,
|
|
46
|
+
b5 as useExportCSV,
|
|
47
|
+
u as useNotifications
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/plugin.ts"],"sourcesContent":["import type { App, Plugin, Component } from 'vue'\nimport * as components from './components'\n\nexport interface PluginOptions {\n /** Optional prefix for component names (e.g., 'Ui' makes CardComponent -> UiCardComponent) */\n prefix?: string\n /** List of specific components to register. If not provided, all components are registered */\n components?: string[]\n}\n\n/**\n * Vue plugin for global component registration\n *\n * @example\n * // Register all components\n * app.use(VueTailwindUI)\n *\n * @example\n * // Register with prefix\n * app.use(VueTailwindUI, { prefix: 'Ui' })\n *\n * @example\n * // Register specific components only\n * app.use(VueTailwindUI, { components: ['CardComponent', 'TableComponent'] })\n */\nconst VueTailwindUI: Plugin = {\n install(app: App, options: PluginOptions = {}) {\n const { prefix = '', components: selectedComponents } = options\n\n const allComponents = components as Record<string, Component>\n\n const componentsToRegister = selectedComponents\n ? Object.fromEntries(\n Object.entries(allComponents).filter(([name]) =>\n selectedComponents.includes(name),\n ),\n )\n : allComponents\n\n for (const [name, component] of Object.entries(componentsToRegister)) {\n app.component(`${prefix}${name}`, component)\n }\n },\n}\n\nexport default VueTailwindUI\n"],"names":[],"mappings":";;;;;;AAyBA,MAAM,gBAAwB;AAAA,EAC5B,QAAQ,KAAU,UAAyB,IAAI;AAC7C,UAAM,EAAE,SAAS,IAAI,YAAY,uBAAuB;AAExD,UAAM,gBAAgB;AAEtB,UAAM,uBAAuB,qBACzB,OAAO;AAAA,MACL,OAAO,QAAQ,aAAa,EAAE;AAAA,QAAO,CAAC,CAAC,IAAI,MACzC,mBAAmB,SAAS,IAAI;AAAA,MAAA;AAAA,IAClC,IAEF;AAEJ,eAAW,CAAC,MAAM,SAAS,KAAK,OAAO,QAAQ,oBAAoB,GAAG;AACpE,UAAI,UAAU,GAAG,MAAM,GAAG,IAAI,IAAI,SAAS;AAAA,IAC7C;AAAA,EACF;AACF;"}
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Plugin } from 'vue';
|
|
2
|
+
export interface PluginOptions {
|
|
3
|
+
/** Optional prefix for component names (e.g., 'Ui' makes CardComponent -> UiCardComponent) */
|
|
4
|
+
prefix?: string;
|
|
5
|
+
/** List of specific components to register. If not provided, all components are registered */
|
|
6
|
+
components?: string[];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Vue plugin for global component registration
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* // Register all components
|
|
13
|
+
* app.use(VueTailwindUI)
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // Register with prefix
|
|
17
|
+
* app.use(VueTailwindUI, { prefix: 'Ui' })
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* // Register specific components only
|
|
21
|
+
* app.use(VueTailwindUI, { components: ['CardComponent', 'TableComponent'] })
|
|
22
|
+
*/
|
|
23
|
+
declare const VueTailwindUI: Plugin;
|
|
24
|
+
export default VueTailwindUI;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type StatusBadgeVariant = 'default' | 'success' | 'error' | 'warning' | 'info' | 'blue' | 'orange' | 'green' | 'red' | 'yellow' | 'purple' | 'pink' | 'gray';
|
|
2
|
+
export type TableActionColor = 'info' | 'warning' | 'success' | 'error';
|
|
3
|
+
export type ModalSize = 'sm' | 'default' | 'lg' | 'xl' | 'full';
|
|
4
|
+
export type SpinnerSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
export interface MenuItemProps {
|
|
6
|
+
label: string;
|
|
7
|
+
icon: string;
|
|
8
|
+
link: string;
|
|
9
|
+
notification?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface PaginationProps {
|
|
12
|
+
currentPage: number;
|
|
13
|
+
totalPages: number;
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
pageSize?: number;
|
|
16
|
+
pageSizeOptions?: number[];
|
|
17
|
+
showPageSize?: boolean;
|
|
18
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface InputProps {
|
|
2
|
+
type?: string;
|
|
3
|
+
value?: string;
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
invalid?: boolean;
|
|
7
|
+
id?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface SelectOption {
|
|
11
|
+
value: string | number | boolean | null;
|
|
12
|
+
label: string;
|
|
13
|
+
hidden?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface SelectProps extends InputProps {
|
|
16
|
+
options?: SelectOption[];
|
|
17
|
+
}
|
|
18
|
+
export interface FormGroupProps extends InputProps, SelectProps {
|
|
19
|
+
label?: string;
|
|
20
|
+
cols?: number;
|
|
21
|
+
hidden?: boolean;
|
|
22
|
+
error?: string | boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface AutocompleteOption {
|
|
25
|
+
value: string;
|
|
26
|
+
label: string;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type NotificationType = 'success' | 'warning' | 'error' | 'info';
|
|
2
|
+
export interface Notification {
|
|
3
|
+
id?: string;
|
|
4
|
+
type: NotificationType;
|
|
5
|
+
message: string;
|
|
6
|
+
title?: string | null;
|
|
7
|
+
duration?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface NotificationOptions {
|
|
10
|
+
duration?: number;
|
|
11
|
+
title?: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Table column property definition
|
|
3
|
+
*
|
|
4
|
+
* This interface defines how table columns are configured and rendered.
|
|
5
|
+
* The `type` field automatically loads the corresponding type component.
|
|
6
|
+
*
|
|
7
|
+
* Built-in types:
|
|
8
|
+
* - 'text': Default text display (TextType.vue)
|
|
9
|
+
* - 'number': Formatted number display (NumberType.vue)
|
|
10
|
+
* - 'date': Formatted date display (DateType.vue)
|
|
11
|
+
* - 'boolean': Yes/No with icons (BooleanType.vue)
|
|
12
|
+
* - 'badge': Badge display (BadgeType.vue)
|
|
13
|
+
*/
|
|
14
|
+
export interface Property {
|
|
15
|
+
/** Column key - corresponds to the data field name */
|
|
16
|
+
name: string;
|
|
17
|
+
/** Display label for the column header */
|
|
18
|
+
label?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Column type for automatic rendering (default: 'text')
|
|
21
|
+
* Built-in: 'text' | 'number' | 'date' | 'badge' | 'boolean'
|
|
22
|
+
*/
|
|
23
|
+
type?: 'text' | 'number' | 'date' | 'badge' | 'boolean' | string;
|
|
24
|
+
/** Whether the column is sortable (default: false) */
|
|
25
|
+
sortable?: boolean;
|
|
26
|
+
/** Whether to hide the column (default: false) */
|
|
27
|
+
hidden?: boolean;
|
|
28
|
+
/** Text alignment in the column (default: 'left') */
|
|
29
|
+
align?: 'left' | 'center' | 'right';
|
|
30
|
+
/** Optional Tailwind CSS classes to apply to column cells */
|
|
31
|
+
className?: string;
|
|
32
|
+
/** Whether the column is the main/primary column (default: false) */
|
|
33
|
+
main?: boolean;
|
|
34
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { ref, readonly, watch, onMounted } from "vue";
|
|
2
|
+
function useNotifications() {
|
|
3
|
+
const notifications = ref([]);
|
|
4
|
+
let idCounter = 0;
|
|
5
|
+
const generateId = () => `notification-${++idCounter}-${Date.now()}`;
|
|
6
|
+
const notify = (type, message, options = {}) => {
|
|
7
|
+
const id = generateId();
|
|
8
|
+
const notification = {
|
|
9
|
+
id,
|
|
10
|
+
type,
|
|
11
|
+
message,
|
|
12
|
+
title: options.title ?? null,
|
|
13
|
+
duration: options.duration ?? 5e3
|
|
14
|
+
};
|
|
15
|
+
notifications.value.push(notification);
|
|
16
|
+
if (notification.duration && notification.duration > 0) {
|
|
17
|
+
setTimeout(() => remove(id), notification.duration);
|
|
18
|
+
}
|
|
19
|
+
return id;
|
|
20
|
+
};
|
|
21
|
+
const success = (message, options) => notify("success", message, options);
|
|
22
|
+
const warning = (message, options) => notify("warning", message, options);
|
|
23
|
+
const error = (message, options) => notify("error", message, options);
|
|
24
|
+
const info = (message, options) => notify("info", message, options);
|
|
25
|
+
const remove = (id) => {
|
|
26
|
+
notifications.value = notifications.value.filter((n) => n.id !== id);
|
|
27
|
+
};
|
|
28
|
+
const clear = () => {
|
|
29
|
+
notifications.value = [];
|
|
30
|
+
};
|
|
31
|
+
return {
|
|
32
|
+
notifications: readonly(notifications),
|
|
33
|
+
notify,
|
|
34
|
+
success,
|
|
35
|
+
warning,
|
|
36
|
+
error,
|
|
37
|
+
info,
|
|
38
|
+
remove,
|
|
39
|
+
clear
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function useDarkMode(options = {}) {
|
|
43
|
+
const {
|
|
44
|
+
selector = "html",
|
|
45
|
+
attribute = "class",
|
|
46
|
+
storageKey = "dark-mode",
|
|
47
|
+
defaultValue = false
|
|
48
|
+
} = options;
|
|
49
|
+
const isDark = ref(defaultValue);
|
|
50
|
+
const getInitialValue = () => {
|
|
51
|
+
if (typeof window === "undefined") return defaultValue;
|
|
52
|
+
const stored = localStorage.getItem(storageKey);
|
|
53
|
+
if (stored !== null) {
|
|
54
|
+
return stored === "true";
|
|
55
|
+
}
|
|
56
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
57
|
+
};
|
|
58
|
+
const updateDOM = (dark) => {
|
|
59
|
+
if (typeof document === "undefined") return;
|
|
60
|
+
const element = document.querySelector(selector);
|
|
61
|
+
if (!element) return;
|
|
62
|
+
if (attribute === "class") {
|
|
63
|
+
element.classList.toggle("dark", dark);
|
|
64
|
+
} else {
|
|
65
|
+
element.setAttribute(attribute, dark ? "dark" : "light");
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const toggle = () => {
|
|
69
|
+
isDark.value = !isDark.value;
|
|
70
|
+
};
|
|
71
|
+
const set = (value) => {
|
|
72
|
+
isDark.value = value;
|
|
73
|
+
};
|
|
74
|
+
watch(isDark, (newValue) => {
|
|
75
|
+
updateDOM(newValue);
|
|
76
|
+
if (typeof localStorage !== "undefined") {
|
|
77
|
+
localStorage.setItem(storageKey, String(newValue));
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
onMounted(() => {
|
|
81
|
+
isDark.value = getInitialValue();
|
|
82
|
+
updateDOM(isDark.value);
|
|
83
|
+
});
|
|
84
|
+
return {
|
|
85
|
+
isDark,
|
|
86
|
+
toggle,
|
|
87
|
+
set
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function useExportCSV() {
|
|
91
|
+
const escapeCSV = (value) => {
|
|
92
|
+
if (value === null || value === void 0) return "";
|
|
93
|
+
const str = String(value);
|
|
94
|
+
if (str.includes(",") || str.includes('"') || str.includes("\n")) {
|
|
95
|
+
return `"${str.replace(/"/g, '""')}"`;
|
|
96
|
+
}
|
|
97
|
+
return str;
|
|
98
|
+
};
|
|
99
|
+
const exportToCSV = (data, columns, filename = "export.csv") => {
|
|
100
|
+
if (!data || data.length === 0) {
|
|
101
|
+
console.warn("No data to export");
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const headers = columns.map((col) => escapeCSV(col.label)).join(",");
|
|
105
|
+
const rows = data.map(
|
|
106
|
+
(item) => columns.map((col) => escapeCSV(item[col.key])).join(",")
|
|
107
|
+
);
|
|
108
|
+
const csv = [headers, ...rows].join("\n");
|
|
109
|
+
const blob = new Blob([csv], { type: "text/csv;charset=utf-8;" });
|
|
110
|
+
const url = URL.createObjectURL(blob);
|
|
111
|
+
const link = document.createElement("a");
|
|
112
|
+
link.setAttribute("href", url);
|
|
113
|
+
link.setAttribute("download", filename);
|
|
114
|
+
link.style.visibility = "hidden";
|
|
115
|
+
document.body.appendChild(link);
|
|
116
|
+
link.click();
|
|
117
|
+
document.body.removeChild(link);
|
|
118
|
+
URL.revokeObjectURL(url);
|
|
119
|
+
};
|
|
120
|
+
return {
|
|
121
|
+
exportToCSV,
|
|
122
|
+
escapeCSV
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
export {
|
|
126
|
+
useDarkMode as a,
|
|
127
|
+
useExportCSV as b,
|
|
128
|
+
useNotifications as u
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=useExportCSV-B9o9lJ3D.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useExportCSV-B9o9lJ3D.js","sources":["../src/composables/useNotifications.ts","../src/composables/useDarkMode.ts","../src/composables/useExportCSV.ts"],"sourcesContent":["import { ref, readonly } from 'vue'\nimport type { Notification, NotificationType, NotificationOptions } from '@/types'\n\n/**\n * Composable for managing notifications/toasts\n * Standalone implementation without Pinia dependency\n */\nexport function useNotifications() {\n const notifications = ref<Notification[]>([])\n let idCounter = 0\n\n const generateId = () => `notification-${++idCounter}-${Date.now()}`\n\n const notify = (\n type: NotificationType,\n message: string,\n options: NotificationOptions = {},\n ): string => {\n const id = generateId()\n const notification: Notification = {\n id,\n type,\n message,\n title: options.title ?? null,\n duration: options.duration ?? 5000,\n }\n\n notifications.value.push(notification)\n\n if (notification.duration && notification.duration > 0) {\n setTimeout(() => remove(id), notification.duration)\n }\n\n return id\n }\n\n const success = (message: string, options?: NotificationOptions) =>\n notify('success', message, options)\n\n const warning = (message: string, options?: NotificationOptions) =>\n notify('warning', message, options)\n\n const error = (message: string, options?: NotificationOptions) =>\n notify('error', message, options)\n\n const info = (message: string, options?: NotificationOptions) =>\n notify('info', message, options)\n\n const remove = (id: string) => {\n notifications.value = notifications.value.filter((n) => n.id !== id)\n }\n\n const clear = () => {\n notifications.value = []\n }\n\n return {\n notifications: readonly(notifications),\n notify,\n success,\n warning,\n error,\n info,\n remove,\n clear,\n }\n}\n","import { ref, watch, onMounted } from 'vue'\n\nexport interface DarkModeOptions {\n selector?: string\n attribute?: string\n storageKey?: string\n defaultValue?: boolean\n}\n\n/**\n * Composable for managing dark mode state\n */\nexport function useDarkMode(options: DarkModeOptions = {}) {\n const {\n selector = 'html',\n attribute = 'class',\n storageKey = 'dark-mode',\n defaultValue = false,\n } = options\n\n const isDark = ref(defaultValue)\n\n const getInitialValue = (): boolean => {\n if (typeof window === 'undefined') return defaultValue\n\n const stored = localStorage.getItem(storageKey)\n if (stored !== null) {\n return stored === 'true'\n }\n\n return window.matchMedia('(prefers-color-scheme: dark)').matches\n }\n\n const updateDOM = (dark: boolean) => {\n if (typeof document === 'undefined') return\n\n const element = document.querySelector(selector)\n if (!element) return\n\n if (attribute === 'class') {\n element.classList.toggle('dark', dark)\n } else {\n element.setAttribute(attribute, dark ? 'dark' : 'light')\n }\n }\n\n const toggle = () => {\n isDark.value = !isDark.value\n }\n\n const set = (value: boolean) => {\n isDark.value = value\n }\n\n watch(isDark, (newValue) => {\n updateDOM(newValue)\n if (typeof localStorage !== 'undefined') {\n localStorage.setItem(storageKey, String(newValue))\n }\n })\n\n onMounted(() => {\n isDark.value = getInitialValue()\n updateDOM(isDark.value)\n })\n\n return {\n isDark,\n toggle,\n set,\n }\n}\n","/**\n * Composable for exporting data to CSV format\n */\nexport function useExportCSV() {\n const escapeCSV = (value: unknown): string => {\n if (value === null || value === undefined) return ''\n const str = String(value)\n if (str.includes(',') || str.includes('\"') || str.includes('\\n')) {\n return `\"${str.replace(/\"/g, '\"\"')}\"`\n }\n return str\n }\n\n const exportToCSV = <T extends Record<string, unknown>>(\n data: T[],\n columns: { key: keyof T; label: string }[],\n filename: string = 'export.csv',\n ) => {\n if (!data || data.length === 0) {\n console.warn('No data to export')\n return\n }\n\n // Create header row\n const headers = columns.map((col) => escapeCSV(col.label)).join(',')\n\n // Create data rows\n const rows = data.map((item) =>\n columns.map((col) => escapeCSV(item[col.key])).join(','),\n )\n\n // Combine header and rows\n const csv = [headers, ...rows].join('\\n')\n\n // Create and trigger download\n const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' })\n const url = URL.createObjectURL(blob)\n const link = document.createElement('a')\n link.setAttribute('href', url)\n link.setAttribute('download', filename)\n link.style.visibility = 'hidden'\n document.body.appendChild(link)\n link.click()\n document.body.removeChild(link)\n URL.revokeObjectURL(url)\n }\n\n return {\n exportToCSV,\n escapeCSV,\n }\n}\n"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const vue = require("vue");
|
|
3
|
+
function useNotifications() {
|
|
4
|
+
const notifications = vue.ref([]);
|
|
5
|
+
let idCounter = 0;
|
|
6
|
+
const generateId = () => `notification-${++idCounter}-${Date.now()}`;
|
|
7
|
+
const notify = (type, message, options = {}) => {
|
|
8
|
+
const id = generateId();
|
|
9
|
+
const notification = {
|
|
10
|
+
id,
|
|
11
|
+
type,
|
|
12
|
+
message,
|
|
13
|
+
title: options.title ?? null,
|
|
14
|
+
duration: options.duration ?? 5e3
|
|
15
|
+
};
|
|
16
|
+
notifications.value.push(notification);
|
|
17
|
+
if (notification.duration && notification.duration > 0) {
|
|
18
|
+
setTimeout(() => remove(id), notification.duration);
|
|
19
|
+
}
|
|
20
|
+
return id;
|
|
21
|
+
};
|
|
22
|
+
const success = (message, options) => notify("success", message, options);
|
|
23
|
+
const warning = (message, options) => notify("warning", message, options);
|
|
24
|
+
const error = (message, options) => notify("error", message, options);
|
|
25
|
+
const info = (message, options) => notify("info", message, options);
|
|
26
|
+
const remove = (id) => {
|
|
27
|
+
notifications.value = notifications.value.filter((n) => n.id !== id);
|
|
28
|
+
};
|
|
29
|
+
const clear = () => {
|
|
30
|
+
notifications.value = [];
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
notifications: vue.readonly(notifications),
|
|
34
|
+
notify,
|
|
35
|
+
success,
|
|
36
|
+
warning,
|
|
37
|
+
error,
|
|
38
|
+
info,
|
|
39
|
+
remove,
|
|
40
|
+
clear
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function useDarkMode(options = {}) {
|
|
44
|
+
const {
|
|
45
|
+
selector = "html",
|
|
46
|
+
attribute = "class",
|
|
47
|
+
storageKey = "dark-mode",
|
|
48
|
+
defaultValue = false
|
|
49
|
+
} = options;
|
|
50
|
+
const isDark = vue.ref(defaultValue);
|
|
51
|
+
const getInitialValue = () => {
|
|
52
|
+
if (typeof window === "undefined") return defaultValue;
|
|
53
|
+
const stored = localStorage.getItem(storageKey);
|
|
54
|
+
if (stored !== null) {
|
|
55
|
+
return stored === "true";
|
|
56
|
+
}
|
|
57
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
58
|
+
};
|
|
59
|
+
const updateDOM = (dark) => {
|
|
60
|
+
if (typeof document === "undefined") return;
|
|
61
|
+
const element = document.querySelector(selector);
|
|
62
|
+
if (!element) return;
|
|
63
|
+
if (attribute === "class") {
|
|
64
|
+
element.classList.toggle("dark", dark);
|
|
65
|
+
} else {
|
|
66
|
+
element.setAttribute(attribute, dark ? "dark" : "light");
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const toggle = () => {
|
|
70
|
+
isDark.value = !isDark.value;
|
|
71
|
+
};
|
|
72
|
+
const set = (value) => {
|
|
73
|
+
isDark.value = value;
|
|
74
|
+
};
|
|
75
|
+
vue.watch(isDark, (newValue) => {
|
|
76
|
+
updateDOM(newValue);
|
|
77
|
+
if (typeof localStorage !== "undefined") {
|
|
78
|
+
localStorage.setItem(storageKey, String(newValue));
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
vue.onMounted(() => {
|
|
82
|
+
isDark.value = getInitialValue();
|
|
83
|
+
updateDOM(isDark.value);
|
|
84
|
+
});
|
|
85
|
+
return {
|
|
86
|
+
isDark,
|
|
87
|
+
toggle,
|
|
88
|
+
set
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function useExportCSV() {
|
|
92
|
+
const escapeCSV = (value) => {
|
|
93
|
+
if (value === null || value === void 0) return "";
|
|
94
|
+
const str = String(value);
|
|
95
|
+
if (str.includes(",") || str.includes('"') || str.includes("\n")) {
|
|
96
|
+
return `"${str.replace(/"/g, '""')}"`;
|
|
97
|
+
}
|
|
98
|
+
return str;
|
|
99
|
+
};
|
|
100
|
+
const exportToCSV = (data, columns, filename = "export.csv") => {
|
|
101
|
+
if (!data || data.length === 0) {
|
|
102
|
+
console.warn("No data to export");
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const headers = columns.map((col) => escapeCSV(col.label)).join(",");
|
|
106
|
+
const rows = data.map(
|
|
107
|
+
(item) => columns.map((col) => escapeCSV(item[col.key])).join(",")
|
|
108
|
+
);
|
|
109
|
+
const csv = [headers, ...rows].join("\n");
|
|
110
|
+
const blob = new Blob([csv], { type: "text/csv;charset=utf-8;" });
|
|
111
|
+
const url = URL.createObjectURL(blob);
|
|
112
|
+
const link = document.createElement("a");
|
|
113
|
+
link.setAttribute("href", url);
|
|
114
|
+
link.setAttribute("download", filename);
|
|
115
|
+
link.style.visibility = "hidden";
|
|
116
|
+
document.body.appendChild(link);
|
|
117
|
+
link.click();
|
|
118
|
+
document.body.removeChild(link);
|
|
119
|
+
URL.revokeObjectURL(url);
|
|
120
|
+
};
|
|
121
|
+
return {
|
|
122
|
+
exportToCSV,
|
|
123
|
+
escapeCSV
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
exports.useDarkMode = useDarkMode;
|
|
127
|
+
exports.useExportCSV = useExportCSV;
|
|
128
|
+
exports.useNotifications = useNotifications;
|
|
129
|
+
//# sourceMappingURL=useExportCSV-BPC_hd25.cjs.map
|