dendelion-ui 0.0.1

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.
Files changed (66) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +5 -0
  3. package/dist/dendelion-ui.cjs.js +5 -0
  4. package/dist/dendelion-ui.es.js +452 -0
  5. package/dist/dendelion-ui.umd.js +5 -0
  6. package/dist/types/components/button/Button.vue.d.ts +22 -0
  7. package/dist/types/components/button/index.d.ts +2 -0
  8. package/dist/types/components/button/interface.d.ts +8 -0
  9. package/dist/types/components/card/Card.vue.d.ts +23 -0
  10. package/dist/types/components/card/CardBody.vue.d.ts +17 -0
  11. package/dist/types/components/card/CardTitle.vue.d.ts +10 -0
  12. package/dist/types/components/card/index.d.ts +4 -0
  13. package/dist/types/components/card/interface.d.ts +8 -0
  14. package/dist/types/components/container/Container.vue.d.ts +21 -0
  15. package/dist/types/components/container/index.d.ts +2 -0
  16. package/dist/types/components/container/interface.d.ts +4 -0
  17. package/dist/types/components/modal/Modal.vue.d.ts +31 -0
  18. package/dist/types/components/modal/index.d.ts +2 -0
  19. package/dist/types/components/modal/interface.d.ts +6 -0
  20. package/dist/types/components/stepper/Step.vue.d.ts +18 -0
  21. package/dist/types/components/stepper/StepList.vue.d.ts +17 -0
  22. package/dist/types/components/stepper/StepPanel.vue.d.ts +22 -0
  23. package/dist/types/components/stepper/StepPanels.vue.d.ts +20 -0
  24. package/dist/types/components/stepper/Stepper.vue.d.ts +26 -0
  25. package/dist/types/components/stepper/index.d.ts +6 -0
  26. package/dist/types/components/stepper/interface.d.ts +3 -0
  27. package/dist/types/components/table/Table.vue.d.ts +11 -0
  28. package/dist/types/components/table/index.d.ts +2 -0
  29. package/dist/types/components/table/interface.d.ts +24 -0
  30. package/dist/types/components.d.ts +6 -0
  31. package/dist/types/index.d.ts +4 -0
  32. package/dist/types/types/color.d.ts +25 -0
  33. package/dist/types/types/index.d.ts +2 -0
  34. package/dist/types/types/size.d.ts +12 -0
  35. package/dist/vite.svg +1 -0
  36. package/package.json +72 -0
  37. package/src/components/button/Button.vue +24 -0
  38. package/src/components/button/index.ts +2 -0
  39. package/src/components/button/interface.ts +10 -0
  40. package/src/components/card/Card.vue +25 -0
  41. package/src/components/card/CardBody.vue +9 -0
  42. package/src/components/card/CardTitle.vue +18 -0
  43. package/src/components/card/index.ts +4 -0
  44. package/src/components/card/interface.ts +9 -0
  45. package/src/components/container/Container.vue +21 -0
  46. package/src/components/container/index.ts +2 -0
  47. package/src/components/container/interface.ts +5 -0
  48. package/src/components/modal/Modal.vue +36 -0
  49. package/src/components/modal/index.ts +2 -0
  50. package/src/components/modal/interface.ts +8 -0
  51. package/src/components/stepper/Step.vue +35 -0
  52. package/src/components/stepper/StepList.vue +8 -0
  53. package/src/components/stepper/StepPanel.vue +30 -0
  54. package/src/components/stepper/StepPanels.vue +17 -0
  55. package/src/components/stepper/Stepper.vue +33 -0
  56. package/src/components/stepper/index.ts +6 -0
  57. package/src/components/stepper/interface.ts +4 -0
  58. package/src/components/table/Table.vue +27 -0
  59. package/src/components/table/index.ts +2 -0
  60. package/src/components/table/interface.ts +28 -0
  61. package/src/components.ts +6 -0
  62. package/src/index.ts +91 -0
  63. package/src/shims-vue.d.ts +12 -0
  64. package/src/types/color.ts +72 -0
  65. package/src/types/index.ts +2 -0
  66. package/src/types/size.ts +32 -0
@@ -0,0 +1,4 @@
1
+ export type ContainerProps = {
2
+ container?: boolean;
3
+ padding?: boolean;
4
+ };
@@ -0,0 +1,31 @@
1
+ import { ModalProps } from './interface';
2
+ declare function __VLS_template(): {
3
+ attrs: Partial<{}>;
4
+ slots: {
5
+ default?(_: {}): any;
6
+ };
7
+ refs: {
8
+ modal: HTMLDialogElement;
9
+ };
10
+ rootEl: HTMLDialogElement;
11
+ };
12
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
13
+ declare const __VLS_component: import("vue").DefineComponent<ModalProps, {
14
+ showModal: () => void;
15
+ closeModal: () => void;
16
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
17
+ close: (...args: any[]) => void;
18
+ }, string, import("vue").PublicProps, Readonly<ModalProps> & Readonly<{
19
+ onClose?: ((...args: any[]) => any) | undefined;
20
+ }>, {
21
+ closeButton: boolean;
22
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {
23
+ modal: HTMLDialogElement;
24
+ }, HTMLDialogElement>;
25
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
26
+ export default _default;
27
+ type __VLS_WithTemplateSlots<T, S> = T & {
28
+ new (): {
29
+ $slots: S;
30
+ };
31
+ };
@@ -0,0 +1,2 @@
1
+ export { default as Modal } from './Modal.vue';
2
+ export type { ModalProps } from './interface';
@@ -0,0 +1,6 @@
1
+ export type ModalProps = {
2
+ closeButton?: boolean;
3
+ };
4
+ export interface Modal {
5
+ showModal: () => void;
6
+ }
@@ -0,0 +1,18 @@
1
+ import { StepperProps } from './interface';
2
+ declare function __VLS_template(): {
3
+ attrs: Partial<{}>;
4
+ slots: {
5
+ default?(_: {}): any;
6
+ };
7
+ refs: {};
8
+ rootEl: HTMLLIElement;
9
+ };
10
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
11
+ declare const __VLS_component: import("vue").DefineComponent<StepperProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<StepperProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLLIElement>;
12
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
13
+ export default _default;
14
+ type __VLS_WithTemplateSlots<T, S> = T & {
15
+ new (): {
16
+ $slots: S;
17
+ };
18
+ };
@@ -0,0 +1,17 @@
1
+ declare function __VLS_template(): {
2
+ attrs: Partial<{}>;
3
+ slots: {
4
+ default?(_: {}): any;
5
+ };
6
+ refs: {};
7
+ rootEl: HTMLUListElement;
8
+ };
9
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
10
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, HTMLUListElement>;
11
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
12
+ export default _default;
13
+ type __VLS_WithTemplateSlots<T, S> = T & {
14
+ new (): {
15
+ $slots: S;
16
+ };
17
+ };
@@ -0,0 +1,22 @@
1
+ import { StepperProps } from './interface';
2
+ declare function __VLS_template(): {
3
+ attrs: Partial<{}>;
4
+ slots: {
5
+ default?(_: {
6
+ activateCallback: (index: number) => void;
7
+ }): any;
8
+ };
9
+ refs: {};
10
+ rootEl: any;
11
+ };
12
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
13
+ declare const __VLS_component: import("vue").DefineComponent<StepperProps, {
14
+ activateCallback: (index: number) => void;
15
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<StepperProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
17
+ export default _default;
18
+ type __VLS_WithTemplateSlots<T, S> = T & {
19
+ new (): {
20
+ $slots: S;
21
+ };
22
+ };
@@ -0,0 +1,20 @@
1
+ import { type Ref } from 'vue';
2
+ declare function __VLS_template(): {
3
+ attrs: Partial<{}>;
4
+ slots: {
5
+ default?(_: {
6
+ currentStep: Ref<string, string>;
7
+ }): any;
8
+ };
9
+ refs: {};
10
+ rootEl: any;
11
+ };
12
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
13
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
14
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
15
+ export default _default;
16
+ type __VLS_WithTemplateSlots<T, S> = T & {
17
+ new (): {
18
+ $slots: S;
19
+ };
20
+ };
@@ -0,0 +1,26 @@
1
+ import { StepperProps } from './interface';
2
+ declare function __VLS_template(): {
3
+ attrs: Partial<{}>;
4
+ slots: {
5
+ default?(_: {
6
+ updateValue: (value: string) => void;
7
+ }): any;
8
+ };
9
+ refs: {};
10
+ rootEl: any;
11
+ };
12
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
13
+ declare const __VLS_component: import("vue").DefineComponent<StepperProps, {
14
+ updateValue: (value: string) => void;
15
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
16
+ "update:value": (...args: any[]) => void;
17
+ }, string, import("vue").PublicProps, Readonly<StepperProps> & Readonly<{
18
+ "onUpdate:value"?: ((...args: any[]) => any) | undefined;
19
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
21
+ export default _default;
22
+ type __VLS_WithTemplateSlots<T, S> = T & {
23
+ new (): {
24
+ $slots: S;
25
+ };
26
+ };
@@ -0,0 +1,6 @@
1
+ export { default as Stepper } from './Stepper.vue';
2
+ export { default as Step } from './Step.vue';
3
+ export { default as StepList } from './StepList.vue';
4
+ export { default as StepPanels } from './StepPanels.vue';
5
+ export { default as StepPanel } from './StepPanel.vue';
6
+ export type { StepperProps } from './interface';
@@ -0,0 +1,3 @@
1
+ export type StepperProps = {
2
+ value: string;
3
+ };
@@ -0,0 +1,11 @@
1
+ import { TableProps } from './interface';
2
+ import { Size } from '@/types';
3
+ declare const _default: import("vue").DefineComponent<TableProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TableProps> & Readonly<{}>, {
4
+ size: Size;
5
+ zebra: boolean;
6
+ pinRows: boolean;
7
+ pinCols: boolean;
8
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {
9
+ table: HTMLTableElement;
10
+ }, HTMLTableElement>;
11
+ export default _default;
@@ -0,0 +1,2 @@
1
+ export { default as Table } from './Table.vue';
2
+ export type { TableProps } from './interface';
@@ -0,0 +1,24 @@
1
+ import { Size } from "@/types";
2
+ export type TableProps = {
3
+ zebra?: boolean;
4
+ pinRows?: boolean;
5
+ pinCols?: boolean;
6
+ size: Size;
7
+ columns: Column[];
8
+ dataSource: Record<string, unknown>[];
9
+ ajax?: (params: object) => Promise<object>;
10
+ };
11
+ export type Column = {
12
+ title: string;
13
+ data: string;
14
+ render?: (text: string, record?: Record<string, unknown>) => string;
15
+ extraClasses?: ExtraClasses;
16
+ };
17
+ export type ExtraClasses = {
18
+ header?: string[];
19
+ cell?: CellClasses;
20
+ };
21
+ export type CellClasses = {
22
+ index: number;
23
+ classes: string[];
24
+ };
@@ -0,0 +1,6 @@
1
+ export * from './components/button';
2
+ export * from './components/card';
3
+ export * from './components/container';
4
+ export * from './components/table';
5
+ export * from './components/stepper';
6
+ export * from './components/modal';
@@ -0,0 +1,4 @@
1
+ export * from './components';
2
+ export * from './types/index';
3
+ declare const dendelionSafeList: string[];
4
+ export { dendelionSafeList };
@@ -0,0 +1,25 @@
1
+ export declare enum Color {
2
+ Primary = 0,
3
+ PrimaryContent = 1,
4
+ Secondary = 2,
5
+ SecondaryContent = 3,
6
+ Accent = 4,
7
+ AccentContent = 5,
8
+ Neutral = 6,
9
+ NeutralContent = 7,
10
+ Base100 = 8,
11
+ Base200 = 9,
12
+ Base300 = 10,
13
+ BaseContent = 11,
14
+ Info = 12,
15
+ InfoContent = 13,
16
+ Success = 14,
17
+ SuccessContent = 15,
18
+ Warning = 16,
19
+ WarningContent = 17,
20
+ Error = 18,
21
+ ErrorContent = 19
22
+ }
23
+ export declare class ColorUtils {
24
+ static toClassName(color: Color): string;
25
+ }
@@ -0,0 +1,2 @@
1
+ export * from './color';
2
+ export * from './size';
@@ -0,0 +1,12 @@
1
+ export declare enum Size {
2
+ XS = 0,
3
+ SM = 1,
4
+ MD = 2,
5
+ LG = 3,
6
+ XL = 4,
7
+ TWOXL = 5,
8
+ THREEXL = 6
9
+ }
10
+ export declare class SizeUtils {
11
+ static toClassName(size: Size): string;
12
+ }
package/dist/vite.svg ADDED
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
package/package.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "dendelion-ui",
3
+ "private": false,
4
+ "description": "Simpel component library using Tailwind css and DaisyUI",
5
+ "version": "0.0.1",
6
+ "author": "ThatzOkay",
7
+ "license": "MIT",
8
+ "homepage": "https://github.com/ThatzOkay/DendelionUI#readme",
9
+ "repository": {
10
+ "url": "git+https://github.com/ThatzOkay/DendelionUI.git",
11
+ "type": "git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/ThatzOkay/DendelionUI/issues"
15
+ },
16
+ "keywords": [
17
+ "Tailwind",
18
+ "DaisyUI",
19
+ "Vue",
20
+ "Component",
21
+ "Library"
22
+ ],
23
+ "type": "module",
24
+ "files": [
25
+ "dist",
26
+ "src"
27
+ ],
28
+ "main": "./dist/apldendelion-uiayer.umd.js",
29
+ "module": "./dist/dendelion-ui.es.js",
30
+ "typings": "./dist/types/index.d.ts",
31
+ "types": "./dist/types/index.d.ts",
32
+ "exports": {
33
+ ".": {
34
+ "types": "./dist/types/index.d.ts",
35
+ "import": "./dist/dendelion-ui.es.js",
36
+ "require": "./dist/dendelion-ui.umd.js"
37
+ }
38
+ },
39
+ "scripts": {
40
+ "dev": "cross-env MODE=demo npm run vite",
41
+ "vite": "vite",
42
+ "clean": "rimraf dist",
43
+ "build": "npm run clean && npm run build:lib && npm run build:tsc",
44
+ "build:lib": "cross-env MODE=lib vite build",
45
+ "build:tsc": "vue-tsc --emitDeclarationOnly",
46
+ "build:demo": "cross-env MODE=demo vite build",
47
+ "docs:dev": "vitepress dev docs",
48
+ "docs:build": "vitepress build docs",
49
+ "docs:preview": "vitepress preview docs",
50
+ "lint": "eslint ",
51
+ "lint:fix": "eslint --fix ",
52
+ "preview": "vite preview"
53
+ },
54
+ "dependencies": {
55
+ "classnames": "^2.5.1",
56
+ "vue": "^3.5.13"
57
+ },
58
+ "devDependencies": {
59
+ "@vitejs/plugin-vue": "^5.2.1",
60
+ "@vue/tsconfig": "^0.7.0",
61
+ "cross-env": "^7.0.3",
62
+ "daisyui": "^4.12.23",
63
+ "eslint": "^9.17.0",
64
+ "eslint-plugin-vue": "^9.32.0",
65
+ "fluid-tailwind": "^1.0.4",
66
+ "rimraf": "^6.0.1",
67
+ "typescript": "~5.6.2",
68
+ "typescript-eslint": "^8.19.1",
69
+ "vite": "^6.0.5",
70
+ "vue-tsc": "^2.2.0"
71
+ }
72
+ }
@@ -0,0 +1,24 @@
1
+ <template>
2
+ <button v-on:click="click" :class="classes" :type="type">
3
+ <span class="loading loading-spinner loading-md absolute hidden group-[.is-loading]:block"></span>
4
+ <span class="group-[.is-loading]:text-transparent"><slot /></span>
5
+ </button>
6
+ </template>
7
+
8
+ <script setup lang="ts">
9
+ import { Color, ColorUtils } from '@/types/color';
10
+ import { ButtonProps } from './interface';
11
+ import classNames from 'classnames';
12
+ import { ref } from 'vue';
13
+
14
+ const props = withDefaults(defineProps<ButtonProps>(), {
15
+ type: 'button',
16
+ color: Color.Neutral
17
+ })
18
+
19
+ const classes = ref(classNames('btn',
20
+ 'group',
21
+ `btn-${ColorUtils.toClassName(props.color)}`,
22
+ props.loading ? 'is-loading' : '',
23
+ ))
24
+ </script>
@@ -0,0 +1,2 @@
1
+ export { default as Button } from './Button.vue';
2
+ export type { ButtonProps, Type } from './interface';
@@ -0,0 +1,10 @@
1
+ import { Color } from "@/types/color";
2
+
3
+ export type Type = 'button' | 'submit' | 'reset';
4
+
5
+ export type ButtonProps = {
6
+ type?: Type,
7
+ loading?: boolean,
8
+ color?: Color,
9
+ click?: () => void,
10
+ };
@@ -0,0 +1,25 @@
1
+ <template>
2
+ <div :class="classes" >
3
+ <slot></slot>
4
+ </div>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import classNames from 'classnames';
9
+ import { ref } from 'vue';
10
+ import { CardProps } from './interface';
11
+ import { Color } from '@/types';
12
+
13
+ const props = withDefaults(defineProps<CardProps>(), {
14
+ backgroundColor: Color.Primary,
15
+ shadow: false,
16
+ fullWidth: false,
17
+ });
18
+
19
+ const classes = ref(classNames('card',
20
+ `bg-${props.backgroundColor}`,
21
+ props.shadow ? 'shadow-lg' : '',
22
+ props.fullWidth ? 'w-full' : '',
23
+ props.rounded && !props.roundedSize ? 'rounded' : props.roundedSize ? `rounded-${props.roundedSize}` : '',
24
+ ));
25
+ </script>
@@ -0,0 +1,9 @@
1
+ <template>
2
+ <div class="card-body">
3
+ <slot></slot>
4
+ </div>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+
9
+ </script>
@@ -0,0 +1,18 @@
1
+ <template>
2
+ <component :is="is" class="card-title">
3
+ {{ text }}
4
+ </component>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import type { Component } from 'vue';
9
+
10
+ withDefaults(defineProps<{
11
+ is?: string | object | Component,
12
+ text: string
13
+ }>(), {
14
+ is: 'h1',
15
+ text: ''
16
+ })
17
+ </script>
18
+
@@ -0,0 +1,4 @@
1
+ export { default as Card } from './Card.vue';
2
+ export { default as CardBody } from './CardBody.vue';
3
+ export { default as CardTitle } from './CardTitle.vue';
4
+ export type { CardProps } from './interface';
@@ -0,0 +1,9 @@
1
+ import { Color, Size } from "@/types";
2
+
3
+ export type CardProps = {
4
+ backgroundColor?: Color,
5
+ shadow?: boolean,
6
+ fullWidth?: boolean,
7
+ rounded?: boolean,
8
+ roundedSize?: Size
9
+ };
@@ -0,0 +1,21 @@
1
+ <template>
2
+ <div :class="classes">
3
+ <slot></slot>
4
+ </div>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import { ref } from 'vue';
9
+ import { ContainerProps } from './interface';
10
+
11
+
12
+ const props = withDefaults(defineProps<ContainerProps>(), {
13
+ container: true,
14
+ padding: true
15
+ });
16
+
17
+ const classes = ref([
18
+ props.container ? 'container' : '', //To disable the max width in some cases
19
+ props.padding ? 'p-6' : ''
20
+ ]);
21
+ </script>
@@ -0,0 +1,2 @@
1
+ export { default as Container } from './Container.vue';
2
+ export type { ContainerProps } from './interface';
@@ -0,0 +1,5 @@
1
+
2
+ export type ContainerProps = {
3
+ container?: boolean,
4
+ padding?: boolean
5
+ };
@@ -0,0 +1,36 @@
1
+ <template>
2
+ <dialog ref="modal" class="modal" aria-modal="true" aria-hidden="true" role="dialog" @close="(e) => emit('close', e)" >
3
+ <div className="modal-box">
4
+ <form v-if="closeButton" method="dialog">
5
+ <button className="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">✕</button>
6
+ </form>
7
+ <slot></slot>
8
+ </div>
9
+ </dialog>
10
+ </template>
11
+
12
+ <script setup lang="ts">
13
+ import { ref } from 'vue';
14
+ import { ModalProps } from './interface';
15
+
16
+ const modal = ref<HTMLDialogElement | null>(null);
17
+
18
+ const emit = defineEmits(['close']);
19
+
20
+ withDefaults(defineProps<ModalProps>(), {
21
+ closeButton: true,
22
+ })
23
+
24
+ const showModal = () => {
25
+ modal.value?.showModal();
26
+ }
27
+
28
+ const closeModal = () => {
29
+ modal.value?.close();
30
+ }
31
+
32
+ defineExpose({
33
+ showModal,
34
+ closeModal
35
+ })
36
+ </script>
@@ -0,0 +1,2 @@
1
+ export {default as Modal} from './Modal.vue';
2
+ export type {ModalProps} from './interface';
@@ -0,0 +1,8 @@
1
+
2
+ export type ModalProps = {
3
+ closeButton?: boolean;
4
+ }
5
+
6
+ export interface Modal {
7
+ showModal: () => void;
8
+ }
@@ -0,0 +1,35 @@
1
+ <template>
2
+ <li class="step" :class="activeClass">
3
+ <slot></slot>
4
+ </li>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import { inject, onMounted, ref, watch, type Ref } from 'vue';
9
+ import { StepperProps } from './interface';
10
+
11
+ const props = defineProps<StepperProps>()
12
+
13
+ const stepper = inject<{
14
+ value: Ref<string>
15
+ updateValue: (value: string) => void
16
+ }>("stepper");
17
+
18
+ const activeClass = ref('');
19
+
20
+ watch(() => stepper?.value.value, (value) => {
21
+ if (value && props.value) {
22
+ activeClass.value = Number(value) >= Number(props.value) ? 'step-primary' : '';
23
+ }
24
+ })
25
+
26
+ onMounted(() => {
27
+ if (stepper) {
28
+ activeClass.value = stepper.value.value === props.value ? 'step-primary' : '';
29
+ if (Number(stepper.value.value) >= Number(props.value)) {
30
+ activeClass.value = 'step-primary';
31
+ }
32
+ }
33
+ })
34
+
35
+ </script>
@@ -0,0 +1,8 @@
1
+ <template>
2
+ <ul class="steps">
3
+ <slot></slot>
4
+ </ul>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ </script>
@@ -0,0 +1,30 @@
1
+ <template>
2
+ <div v-if="value === stepperValue">
3
+ <slot :activateCallback="activateCallback"></slot>
4
+ </div>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import { computed, inject, type Ref } from 'vue';
9
+ import { StepperProps } from './interface';
10
+
11
+ defineProps<StepperProps>()
12
+
13
+ const stepperValue = computed(() => stepper?.value.value)
14
+
15
+ const stepper = inject<{
16
+ value: Ref<string>
17
+ updateValue: (value: string) => void
18
+ }>("stepper");
19
+
20
+ const activateCallback = (index: number) => {
21
+ if (stepper) {
22
+ stepper.updateValue(index.toString())
23
+ }
24
+ }
25
+
26
+
27
+ defineExpose({
28
+ activateCallback
29
+ })
30
+ </script>
@@ -0,0 +1,17 @@
1
+ <template>
2
+ <Transition name="fade" mode="out-in">
3
+ <div v-if="stepper?.value">
4
+ <slot :currentStep="stepper?.value"></slot>
5
+ </div>
6
+ </Transition>
7
+ </template>
8
+
9
+
10
+ <script setup lang="ts">
11
+ import { inject, type Ref } from 'vue';
12
+
13
+ const stepper = inject<{
14
+ value: Ref<string>;
15
+ updateValue: (value: string) => void;
16
+ }>('stepper');
17
+ </script>