dirdoc-ui 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/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # dirdoc_ui
2
+
@@ -0,0 +1,67 @@
1
+ 'use strict';
2
+
3
+ var vue = require('vue');
4
+
5
+ var DButton = vue.defineComponent({
6
+ name: 'DButton',
7
+ props: {
8
+ label: {
9
+ type: String,
10
+ required: false,
11
+ default: ''
12
+ },
13
+ type: {
14
+ type: String,
15
+ default: 'button'
16
+ },
17
+ variant: {
18
+ type: String,
19
+ default: 'primary'
20
+ },
21
+ disabled: {
22
+ type: Boolean,
23
+ default: false
24
+ },
25
+ icon: {
26
+ type: [String, Object, Function],
27
+ default: null
28
+ },
29
+ },
30
+ emits: ['click'],
31
+ setup(props, ctx) {
32
+ const { slots, emit } = ctx;
33
+ const base = 'flex items-center justify-center focus:outline-none';
34
+ const variants = {
35
+ primary: 'bg-blue hover:bg-blue-700',
36
+ secondary: 'bg-gray-200 text-gray-800 hover:bg-gray-300',
37
+ };
38
+ function onClick(e) {
39
+ if (props.disabled)
40
+ return;
41
+ emit('click', e);
42
+ }
43
+ return () => {
44
+ const children = slots.default ? slots.default() : props.label;
45
+ if (props.icon) {
46
+ return vue.h('a', {
47
+ type: props.type,
48
+ class: `${base} ${variants[props.variant]} ${props.disabled ? '' : ''} focus:outline-none`,
49
+ disabled: props.disabled,
50
+ onClick
51
+ }, [
52
+ typeof props.icon === 'string' ? vue.h('i', { class: props.icon + ' mdi' }) : vue.h(props.icon),
53
+ children
54
+ ]);
55
+ }
56
+ return vue.h('a', {
57
+ type: props.type,
58
+ class: `${base} ${variants[props.variant]} ${props.disabled ? 'opacity-50' : ''}`,
59
+ disabled: props.disabled,
60
+ onClick
61
+ }, children);
62
+ };
63
+ }
64
+ });
65
+
66
+ exports.DButton = DButton;
67
+ //# sourceMappingURL=index.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/components/DButton/DButton.tsx"],"sourcesContent":["import { defineComponent, h, PropType, SetupContext, VNode } from 'vue'\n\nexport default defineComponent({\n name: 'DButton',\n props: {\n label: {\n type: String as PropType<string>,\n required: false,\n default: ''\n },\n type: {\n type: String as PropType<'button' | 'submit' | 'a'>,\n default: 'button'\n },\n variant: {\n type: String as PropType<'primary' | 'secondary'>,\n default: 'primary'\n },\n disabled: {\n type: Boolean as PropType<boolean>,\n default: false\n },\n icon: {\n type: [String, Object, Function] as PropType<string | object | (() => VNode) | VNode | null>,\n default: null\n },\n },\n emits: ['click'],\n setup(props: Record<string, any>, ctx: SetupContext) {\n const { slots, emit } = ctx\n const base = 'flex items-center justify-center focus:outline-none'\n\n const variants: Record<string, string> = {\n primary: 'bg-blue hover:bg-blue-700',\n secondary: 'bg-gray-200 text-gray-800 hover:bg-gray-300',\n }\n\n function onClick(e: MouseEvent) {\n if (props.disabled) return\n emit('click', e)\n }\n\n return (): VNode => {\n const children = slots.default ? slots.default() : props.label\n if (props.icon) {\n return h(\n 'a',\n {\n type: props.type,\n class: `${base} ${variants[props.variant]} ${props.disabled ? '' : ''} focus:outline-none`,\n disabled: props.disabled,\n onClick\n },\n [\n typeof props.icon === 'string' ? h('i', { class: props.icon + ' mdi' }, ) : h(props.icon),\n children\n ]\n )\n }\n \n return h(\n 'a',\n {\n type: props.type,\n class: `${base} ${variants[props.variant]} ${props.disabled ? 'opacity-50' : ''}`,\n disabled: props.disabled,\n onClick\n },\n children\n )\n }\n }\n})\n"],"names":["defineComponent","h"],"mappings":";;;;AAEA,cAAeA,mBAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,SAAS;AACf,IAAA,KAAK,EAAE;AACL,QAAA,KAAK,EAAE;AACL,YAAA,IAAI,EAAE,MAA0B;AAChC,YAAA,QAAQ,EAAE,KAAK;AACf,YAAA,OAAO,EAAE;AACV,SAAA;AACD,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,MAA6C;AACn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,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,GAAGA,KAAC,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,GAAG,MAAM,EAAE,CAAG,GAAGA,KAAC,CAAC,KAAK,CAAC,IAAI,CAAC;oBACzF;AACD,iBAAA,CACF;YACH;YAEA,OAAOA,KAAC,CACN,GAAG,EACH;gBACE,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,KAAK,EAAE,GAAG,IAAI,CAAA,CAAA,EAAI,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA,CAAA,EAAI,KAAK,CAAC,QAAQ,GAAG,YAAY,GAAG,EAAE,CAAA,CAAE;gBACjF,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB;aACD,EACD,QAAQ,CACT;AACH,QAAA,CAAC;IACH;AACD,CAAA,CAAC;;;;"}
@@ -0,0 +1,18 @@
1
+ import * as vue from 'vue';
2
+ import { VNode } from 'vue';
3
+
4
+ declare const _default: vue.DefineComponent<{
5
+ [x: string]: /*elided*/ any;
6
+ }, () => VNode, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, "click", vue.PublicProps, Readonly<{
7
+ [x: string]: /*elided*/ any;
8
+ }> & Readonly<{}>, {
9
+ label: string;
10
+ type: "button" | "submit" | "a";
11
+ variant: "primary" | "secondary";
12
+ disabled: boolean;
13
+ icon: string | object | (() => VNode) | VNode<vue.RendererNode, vue.RendererElement, {
14
+ [key: string]: any;
15
+ }> | null;
16
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
17
+
18
+ export { _default as DButton };
@@ -0,0 +1,65 @@
1
+ import { defineComponent, h } from 'vue';
2
+
3
+ var DButton = defineComponent({
4
+ name: 'DButton',
5
+ props: {
6
+ label: {
7
+ type: String,
8
+ required: false,
9
+ default: ''
10
+ },
11
+ type: {
12
+ type: String,
13
+ default: 'button'
14
+ },
15
+ variant: {
16
+ type: String,
17
+ default: 'primary'
18
+ },
19
+ disabled: {
20
+ type: Boolean,
21
+ default: false
22
+ },
23
+ icon: {
24
+ type: [String, Object, Function],
25
+ default: null
26
+ },
27
+ },
28
+ emits: ['click'],
29
+ setup(props, ctx) {
30
+ const { slots, emit } = ctx;
31
+ const base = 'flex items-center justify-center focus:outline-none';
32
+ const variants = {
33
+ primary: 'bg-blue hover:bg-blue-700',
34
+ secondary: 'bg-gray-200 text-gray-800 hover:bg-gray-300',
35
+ };
36
+ function onClick(e) {
37
+ if (props.disabled)
38
+ return;
39
+ emit('click', e);
40
+ }
41
+ return () => {
42
+ const children = slots.default ? slots.default() : props.label;
43
+ if (props.icon) {
44
+ return h('a', {
45
+ type: props.type,
46
+ class: `${base} ${variants[props.variant]} ${props.disabled ? '' : ''} focus:outline-none`,
47
+ disabled: props.disabled,
48
+ onClick
49
+ }, [
50
+ typeof props.icon === 'string' ? h('i', { class: props.icon + ' mdi' }) : h(props.icon),
51
+ children
52
+ ]);
53
+ }
54
+ return h('a', {
55
+ type: props.type,
56
+ class: `${base} ${variants[props.variant]} ${props.disabled ? 'opacity-50' : ''}`,
57
+ disabled: props.disabled,
58
+ onClick
59
+ }, children);
60
+ };
61
+ }
62
+ });
63
+
64
+ export { DButton };
65
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../src/components/DButton/DButton.tsx"],"sourcesContent":["import { defineComponent, h, PropType, SetupContext, VNode } from 'vue'\n\nexport default defineComponent({\n name: 'DButton',\n props: {\n label: {\n type: String as PropType<string>,\n required: false,\n default: ''\n },\n type: {\n type: String as PropType<'button' | 'submit' | 'a'>,\n default: 'button'\n },\n variant: {\n type: String as PropType<'primary' | 'secondary'>,\n default: 'primary'\n },\n disabled: {\n type: Boolean as PropType<boolean>,\n default: false\n },\n icon: {\n type: [String, Object, Function] as PropType<string | object | (() => VNode) | VNode | null>,\n default: null\n },\n },\n emits: ['click'],\n setup(props: Record<string, any>, ctx: SetupContext) {\n const { slots, emit } = ctx\n const base = 'flex items-center justify-center focus:outline-none'\n\n const variants: Record<string, string> = {\n primary: 'bg-blue hover:bg-blue-700',\n secondary: 'bg-gray-200 text-gray-800 hover:bg-gray-300',\n }\n\n function onClick(e: MouseEvent) {\n if (props.disabled) return\n emit('click', e)\n }\n\n return (): VNode => {\n const children = slots.default ? slots.default() : props.label\n if (props.icon) {\n return h(\n 'a',\n {\n type: props.type,\n class: `${base} ${variants[props.variant]} ${props.disabled ? '' : ''} focus:outline-none`,\n disabled: props.disabled,\n onClick\n },\n [\n typeof props.icon === 'string' ? h('i', { class: props.icon + ' mdi' }, ) : h(props.icon),\n children\n ]\n )\n }\n \n return h(\n 'a',\n {\n type: props.type,\n class: `${base} ${variants[props.variant]} ${props.disabled ? 'opacity-50' : ''}`,\n disabled: props.disabled,\n onClick\n },\n children\n )\n }\n }\n})\n"],"names":[],"mappings":";;AAEA,cAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,SAAS;AACf,IAAA,KAAK,EAAE;AACL,QAAA,KAAK,EAAE;AACL,YAAA,IAAI,EAAE,MAA0B;AAChC,YAAA,QAAQ,EAAE,KAAK;AACf,YAAA,OAAO,EAAE;AACV,SAAA;AACD,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,MAA6C;AACnD,YAAA,OAAO,EAAE;AACV,SAAA;AACD,QAAA,OAAO,EAAE;AACP,YAAA,IAAI,EAAE,MAA2C;AACjD,YAAA,OAAO,EAAE;AACV,SAAA;AACD,QAAA,QAAQ,EAAE;AACR,YAAA,IAAI,EAAE,OAA4B;AAClC,YAAA,OAAO,EAAE;AACV,SAAA;AACD,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAA6D;AAC5F,YAAA,OAAO,EAAE;AACV,SAAA;AACF,KAAA;IACD,KAAK,EAAE,CAAC,OAAO,CAAC;IAChB,KAAK,CAAC,KAA0B,EAAE,GAAiB,E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,CAAE;gBACjF,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB;aACD,EACD,QAAQ,CACT;AACH,QAAA,CAAC;IACH;AACD,CAAA,CAAC;;;;"}
@@ -0,0 +1,15 @@
1
+ import { VNode } from 'vue';
2
+ declare const _default: import("vue").DefineComponent<{
3
+ [x: string]: /*elided*/ any;
4
+ }, () => VNode, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, "click", import("vue").PublicProps, Readonly<{
5
+ [x: string]: /*elided*/ any;
6
+ }> & Readonly<{}>, {
7
+ label: string;
8
+ type: "button" | "submit" | "a";
9
+ variant: "primary" | "secondary";
10
+ disabled: boolean;
11
+ icon: string | object | (() => VNode) | VNode<import("vue").RendererNode, import("vue").RendererElement, {
12
+ [key: string]: any;
13
+ }> | null;
14
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
15
+ export default _default;
@@ -0,0 +1 @@
1
+ export { default as DButton } from './DButton';
@@ -0,0 +1,2 @@
1
+ export { DButton } from './components/DButton';
2
+ export type {} from './components/DButton';
@@ -0,0 +1 @@
1
+ export declare function noop(): void;
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "dirdoc-ui",
3
+ "version": "1.0.0",
4
+ "main": "dist/index.cjs.js",
5
+ "module": "dist/index.esm.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "clean": "rm -rf dist",
9
+ "build": "npm run clean && rollup -c",
10
+ "test": "jest"
11
+ },
12
+ "keywords": [],
13
+ "author": "",
14
+ "license": "ISC",
15
+ "dependencies": {
16
+ "tailwindcss": "^4.2.2"
17
+ },
18
+ "devDependencies": {
19
+ "jest": "^27.0.6",
20
+ "@types/bun": "latest",
21
+ "rollup": "4.61.1",
22
+ "rollup-plugin-dts": "6.4.1",
23
+ "rollup-plugin-typescript2": "^0.37.0",
24
+ "@rollup/plugin-node-resolve": "^16.0.3",
25
+ "@rollup/plugin-commonjs": "^29.0.3",
26
+ "typescript": "^6.0.3",
27
+ "vue": "^3.5.35",
28
+ "tslib": "^2.8.1"
29
+ },
30
+ "type": "module",
31
+ "exports": {
32
+ ".": {
33
+ "import": "./dist/index.esm.js",
34
+ "require": "./dist/index.cjs.js",
35
+ "types": "./dist/index.d.ts"
36
+ },
37
+ "./*": "./dist/*"
38
+ },
39
+ "peerDependencies": {
40
+ "vue": "^3.2 || ^4",
41
+ "typescript": "^4.9 || ^5"
42
+ },
43
+ "files": [
44
+ "dist"
45
+ ]
46
+ }