plugin-ui-for-kzt 0.0.17 → 0.0.18

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 (71) hide show
  1. package/dist/components/BaseBadge/BaseBadge.vue.d.ts +49 -0
  2. package/dist/components/BaseBadge/BaseBadgeGroup.vue.d.ts +30 -0
  3. package/dist/components/BaseButton/BaseButton.vue.d.ts +1 -1
  4. package/dist/components/BaseCalendar/BaseCalendar.vue.d.ts +1 -1
  5. package/dist/components/BaseCheckbox/BaseCheckbox.vue.d.ts +1 -1
  6. package/dist/components/BaseChips/BaseChips.vue.d.ts +1 -1
  7. package/dist/components/BaseDropdown/BaseDropdown.vue.d.ts +1 -1
  8. package/dist/components/BaseInput/BaseInput.vue.d.ts +2 -2
  9. package/dist/components/BaseInputCalendar/BaseInputCalendar.vue.d.ts +3 -3
  10. package/dist/components/BaseInputCurrency/BaseInputCurrency.vue.d.ts +2 -2
  11. package/dist/components/BaseInputEmail/BaseInputEmail.vue.d.ts +2 -2
  12. package/dist/components/BaseInputPhone/BaseInputPhone.vue.d.ts +2 -2
  13. package/dist/components/BaseModal/BaseModal.vue.d.ts +4 -0
  14. package/dist/components/BaseOpenedListItem/BaseOpenedListItem.vue.d.ts +1 -1
  15. package/dist/components/BasePagination/BasePagination.vue.d.ts +1 -1
  16. package/dist/components/BaseRadio/BaseRadio.vue.d.ts +1 -1
  17. package/dist/components/BaseSegmentedButtons/BaseSegmentedButtons.vue.d.ts +2 -2
  18. package/dist/components/BaseSelect/BaseSelect.vue.d.ts +2 -2
  19. package/dist/components/BaseTag/BaseTag.vue.d.ts +61 -0
  20. package/dist/components/BaseTextarea/BaseTextarea.vue.d.ts +1 -1
  21. package/dist/components/BaseToggle/BaseToggle.vue.d.ts +1 -1
  22. package/dist/components/BaseTooltip/BaseTooltip.vue.d.ts +1 -1
  23. package/dist/components/BaseUpload/BaseUpload.vue.d.ts +31 -0
  24. package/dist/components/{Modal/Modal.vue.d.ts → BaseUpload/ImageModal.vue.d.ts} +2 -10
  25. package/dist/components/Toaster/Toaster.vue.d.ts +1 -1
  26. package/dist/composables/useModal.d.ts +7 -0
  27. package/dist/index.d.ts +7 -3
  28. package/dist/index.js +1 -1
  29. package/dist/plugins/modalPlugin.d.ts +0 -13
  30. package/dist/sprite.svg +1 -1
  31. package/dist/store/modal.d.ts +154 -9
  32. package/example/App.vue +123 -311
  33. package/example/MyCustomModal.vue +37 -0
  34. package/package.json +1 -1
  35. package/src/assets/icons/add.svg +4 -0
  36. package/src/assets/icons/arrow-up.svg +4 -0
  37. package/src/assets/icons/close-circle.svg +5 -0
  38. package/src/assets/icons/close.svg +4 -0
  39. package/src/assets/icons/document-text.svg +4 -0
  40. package/src/assets/icons/export.svg +5 -0
  41. package/src/assets/icons/gallery.svg +5 -0
  42. package/src/assets/icons/notification-icon.svg +7 -0
  43. package/src/assets/icons/search-zoom-in.svg +6 -0
  44. package/src/assets/icons/trash.svg +7 -0
  45. package/src/assets/icons/upload.svg +5 -0
  46. package/src/components/BaseBadge/BaseBadge.vue +188 -0
  47. package/src/components/BaseBadge/BaseBadgeGroup.vue +120 -0
  48. package/src/components/BaseBadge/README.md +127 -0
  49. package/src/components/BaseBreadCrumbs/BaseBreadCrumbs.vue +2 -1
  50. package/src/components/BaseButton/BaseButton.vue +0 -112
  51. package/src/components/BaseInput/BaseInput.vue +4 -3
  52. package/src/components/BaseModal/BaseModal.vue +189 -0
  53. package/src/components/BaseTag/BaseTag.vue +245 -0
  54. package/src/components/BaseTag/README.md +125 -0
  55. package/src/components/BaseTextarea/BaseTextarea.vue +7 -14
  56. package/src/components/BaseUpload/BaseUpload.vue +392 -0
  57. package/src/components/BaseUpload/ImageModal.vue +25 -0
  58. package/src/composables/useModal.ts +14 -0
  59. package/src/index.ts +32 -19
  60. package/src/plugins/modalPlugin.ts +92 -76
  61. package/src/store/modal.ts +39 -16
  62. package/src/styles/root.scss +1 -0
  63. package/src/types/badge.d.ts +19 -0
  64. package/src/types/modal.d.ts +8 -0
  65. package/src/types/tag.d.ts +14 -0
  66. package/src/types/uploadedFile.d.ts +13 -0
  67. package/src/types/utils.d.ts +1 -1
  68. package/dist/types/index.d.ts +0 -5
  69. package/src/components/Modal/Modal.vue +0 -149
  70. package/src/components/Modal/README.md +0 -47
  71. package/src/types/index.ts +0 -7
package/src/index.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { createPinia } from "pinia";
2
- import Modal from "./components/Modal/Modal.vue";
3
2
  import DataTable from "./components/DataTable/DataTable.vue";
4
3
  import Tooltip from "./components/Tooltip/Tooltip.vue";
5
4
  import Spinner from "./components/Spinner/Spinner.vue";
6
- import ModalPlugin, { useModal } from "./plugins/modalPlugin";
5
+ import ModalPlugin from "./plugins/modalPlugin";
6
+ import { useModal } from "./composables/useModal";
7
7
  import ToasterPlugin, { useToast } from "./plugins/toasterPlugin";
8
8
  import "./sprite"; // Импортируем иконки для генерации спрайта
9
9
  import "./styles/root.scss";
@@ -30,12 +30,20 @@ import BaseInputCurrency from "./components/BaseInputCurrency/BaseInputCurrency.
30
30
  import BaseSegmentedButtons from "./components/BaseSegmentedButtons/BaseSegmentedButtons.vue";
31
31
  import BaseChips from "./components/BaseChips/BaseChips.vue";
32
32
  import BaseSwiper from "./components/BaseSwiper/BaseSwiper.vue";
33
+ import BaseModal from "./components/BaseModal/BaseModal.vue";
34
+ import BaseUpload from "./components/BaseUpload/BaseUpload.vue";
35
+ import BaseBadge from "./components/BaseBadge/BaseBadge.vue";
36
+ import BaseTag from "./components/BaseTag/BaseTag.vue";
37
+ import BaseBadgeGroup from "./components/BaseBadge/BaseBadgeGroup.vue";
33
38
 
34
- const components = {
35
- Modal,
36
- DataTable,
37
- Tooltip,
38
- Spinner,
39
+ const components = {
40
+ BaseModal,
41
+ BaseTag,
42
+ BaseBadge,
43
+ BaseBadgeGroup,
44
+ DataTable,
45
+ Tooltip,
46
+ Spinner,
39
47
  BaseIcon,
40
48
  BaseBreadCrumbs,
41
49
  BaseButton,
@@ -58,18 +66,19 @@ const components = {
58
66
  BasePagination,
59
67
  BaseSegmentedButtons,
60
68
  BaseChips,
61
- BaseSwiper
69
+ BaseSwiper,
70
+ BaseUpload
62
71
  };
63
72
 
64
73
  // Функция для загрузки sprite.svg
65
74
  const loadSprite = () => {
66
75
  const possiblePaths = [
67
76
  "/sprite.svg",
68
- "./sprite.svg",
77
+ "./sprite.svg",
69
78
  "sprite.svg",
70
- "/dist/sprite.svg"
79
+ "/dist/sprite.svg",
71
80
  ];
72
-
81
+
73
82
  const tryLoadSprite = async (paths: string[]) => {
74
83
  for (const path of paths) {
75
84
  try {
@@ -89,7 +98,7 @@ const loadSprite = () => {
89
98
  }
90
99
  console.error("Не удалось загрузить SVG-спрайт ни с одного из путей");
91
100
  };
92
-
101
+
93
102
  tryLoadSprite(possiblePaths);
94
103
  };
95
104
 
@@ -111,12 +120,15 @@ export default {
111
120
  },
112
121
  };
113
122
 
114
- export {
115
- Modal,
116
- DataTable,
117
- Tooltip,
118
- Spinner,
119
- useModal,
123
+ export {
124
+ BaseModal,
125
+ BaseBadgeGroup,
126
+ BaseBadge,
127
+ DataTable,
128
+ BaseTag,
129
+ Tooltip,
130
+ Spinner,
131
+ useModal,
120
132
  useToast,
121
133
  BaseIcon,
122
134
  BaseBreadCrumbs,
@@ -140,5 +152,6 @@ export {
140
152
  BasePagination,
141
153
  BaseSegmentedButtons,
142
154
  BaseChips,
143
- BaseSwiper
155
+ BaseSwiper,
156
+ BaseUpload
144
157
  };
@@ -1,89 +1,105 @@
1
- import {createApp, h, getCurrentInstance} from "vue";
2
- import {useModalStore} from "../store/modal";
3
- import Modal from "../components/Modal/Modal.vue";
4
- import {watch} from "vue";
5
- import {IModalState, IModalType} from "types";
1
+ import { createApp, h, markRaw, provide } from 'vue';
2
+ import { useModalStore } from '../store/modal';
3
+ import BaseModal from '../components/BaseModal/BaseModal.vue';
4
+ import { watch } from 'vue';
5
+ import type { ICoreModalProps, ModalComponent } from '../types/modal';
6
6
 
7
- export default {
8
- install(app: any) {
9
- const modalStore = useModalStore();
7
+ interface ModalInstance {
8
+ id: string;
9
+ isOpen: boolean;
10
+ props: ICoreModalProps;
11
+ app?: ReturnType<typeof createApp>;
12
+ component?: ModalComponent;
13
+ }
10
14
 
11
- // Добавление глобального метода $modal
12
- app.config.globalProperties.$modal = {
13
- open(name: IModalType, options: IModalState) {
14
- modalStore.openModal(name, options); // Открытие модалки через Pinia
15
- },
16
- close(id: number) {
17
- modalStore.closeModal(id); // Закрытие модалки через Pinia
18
- },
19
- };
15
+ export default {
16
+ install(app: any) {
17
+ console.log('Installing ModalPlugin...');
18
+ const modalStore = useModalStore();
19
+ const modalContainer = document.createElement('div');
20
+ modalContainer.classList.add('modal-container');
21
+ document.body.appendChild(modalContainer);
20
22
 
21
- // Найдем элемент с классом container
22
- const modalContainer = document.createElement("div");
23
- document.body.appendChild(modalContainer);
23
+ const $modal = {
24
+ open(id: string, props: ICoreModalProps = {}, component?: ModalComponent) {
25
+ modalStore.openModal(id, props, component ? markRaw(component) : undefined);
26
+ },
27
+ close(id: string) {
28
+ modalStore.closeModal(id);
29
+ },
30
+ };
24
31
 
25
- // Реактивное обновление модалок через watch
26
- watch(
27
- () => modalStore.modals,
28
- (newModals) => {
29
- // Очищаем контейнер
30
- modalContainer.innerHTML = "";
31
- // Обновляем data-атрибут и класс
32
- if (newModals.length > 0) {
33
- modalContainer.classList.add("modal");
34
- } else {
35
- modalContainer.classList.remove("modal");
36
- }
32
+ app.config.globalProperties.$modal = $modal;
33
+ app.provide('$modal', $modal);
37
34
 
38
- // Добавляем модалки в DOM
39
- newModals.forEach((modal) => {
40
- modalContainer.dataset.modalId = String(modal.id);
41
- modalContainer.setAttribute("name", modal.name);
35
+ const activeModals: ModalInstance[] = [];
42
36
 
43
- const modalApp = createApp({
44
- render() {
45
- return h(Modal, {
46
- options: modal.options,
47
- name: modal.name,
48
- onClose: () => {
49
- modalStore.closeModal(modal.id);
50
- },
51
- });
52
- },
53
- });
37
+ watch(
38
+ () => modalStore.modals,
39
+ (newModals) => {
40
+ const modalIds = newModals.map((modal) => modal.id);
41
+ activeModals.forEach((modal, index) => {
42
+ if (!modalIds.includes(modal.id) || !modal.isOpen) {
43
+ modal.app?.unmount();
44
+ activeModals.splice(index, 1);
45
+ }
46
+ });
54
47
 
55
- modalApp.mount(modalContainer);
48
+ newModals.forEach((modal) => {
49
+ let existingModal = activeModals.find((m) => m.id === modal.id);
50
+ if (!existingModal && modal.isOpen) {
51
+ const modalApp = createApp({
52
+ setup() {
53
+ provide('$modal', $modal);
54
+ return () => h(BaseModal, {
55
+ onClose: () => modalStore.closeModal(modal.id),
56
56
  });
57
- },
58
- {deep: true}
59
- );
60
- // ✅ Добавляем ОДИН обработчик клика по фону
61
- modalContainer.addEventListener("click", (event) => {
57
+ },
58
+ });
59
+ modalApp.mount(modalContainer);
60
+ activeModals.push({
61
+ id: modal.id,
62
+ isOpen: modal.isOpen,
63
+ props: modal.props ?? { isOpen: modal.isOpen },
64
+ app: modalApp,
65
+ component: modal.component,
66
+ });
67
+ } else if (existingModal) {
68
+ existingModal.isOpen = modal.isOpen;
69
+ existingModal.props = modal.props ?? { isOpen: modal.isOpen };
70
+ existingModal.component = modal.component;
71
+ }
72
+ });
62
73
 
63
- if (modalStore.modals.length > 0) {
64
- const lastModal = modalStore.modals[modalStore.modals.length - 1];
65
- modalStore.closeModal(lastModal.id);
74
+ modalContainer.classList.toggle('has-modals', activeModals.some((m) => m.isOpen));
75
+ },
76
+ { immediate: true, deep: true }
77
+ );
66
78
 
67
- // Удаляем класс, если это была последняя модалка
68
- if (modalStore.modals.length <= 1) {
69
- modalContainer.classList.remove("modal");
70
- }
71
- }
72
- });
73
- },
74
- };
79
+ const handleOverlayClick = (event: MouseEvent) => {
80
+ const topModal = activeModals.find(
81
+ (modal) => modal.isOpen && modal.id === modalStore.modals[modalStore.modals.length - 1]?.id
82
+ );
83
+ if (topModal && event.target === modalContainer && topModal.props.closable) {
84
+ modalStore.closeModal(topModal.id);
85
+ }
86
+ };
75
87
 
76
- export function useModal() {
77
- const instance = getCurrentInstance();
78
- return instance?.appContext.config.globalProperties.$modal;
79
- }
88
+ modalContainer.addEventListener('click', handleOverlayClick);
80
89
 
81
- // Расширение глобального интерфейса для TypeScript
82
- declare module "@vue/runtime-core" {
83
- interface ComponentCustomProperties {
84
- $modal: {
85
- open: (name: IModalType, options?: IModalState) => void;
86
- close: (id: number) => void;
87
- };
90
+ const cleanup = () => {
91
+ activeModals.forEach((modal) => modal.app?.unmount());
92
+ modalContainer.removeEventListener('click', handleOverlayClick);
93
+ document.body.removeChild(modalContainer);
94
+ };
95
+
96
+ if (app.unmount) {
97
+ const originalUnmount = app.unmount;
98
+ app.unmount = function () {
99
+ cleanup();
100
+ originalUnmount.call(app);
101
+ };
88
102
  }
89
- }
103
+ app._container?.addEventListener('beforeunload', cleanup);
104
+ },
105
+ };
@@ -1,20 +1,43 @@
1
1
  import { defineStore } from 'pinia';
2
- import {IModalState} from "../types";
2
+ import type { ICoreModalProps, ModalComponent } from '../types/modal';
3
3
 
4
4
  export const useModalStore = defineStore('modal', {
5
- state: () => ({
6
- modals: [] as Array<{ id: number; name: string; options: IModalState }>,
7
- }),
8
- actions: {
9
- openModal(name: string, options: IModalState) {
10
- this.modals.push({
11
- id: Date.now(),
12
- name,
13
- options,
14
- });
15
- },
16
- closeModal(id: number) {
17
- this.modals = this.modals.filter((modal) => modal.id !== id);
18
- },
5
+ state: () => ({
6
+ modals: [] as { id: string; isOpen: boolean; props?: ICoreModalProps; component?: ModalComponent }[],
7
+ }),
8
+ actions: {
9
+ openModal(id: string, props: ICoreModalProps = {}, component?: ModalComponent) {
10
+ const existingModal = this.modals.find(modal => modal.id === id);
11
+ if (!existingModal) {
12
+ this.modals.push({ id, isOpen: true, props, component });
13
+ } else {
14
+ existingModal.isOpen = true;
15
+ existingModal.props = props;
16
+ existingModal.component = component;
17
+ }
19
18
  },
20
- });
19
+ closeModal(id: string) {
20
+ const modalIndex = this.modals.findIndex(modal => modal.id === id);
21
+ if (modalIndex !== -1) {
22
+ this.modals[modalIndex].isOpen = false;
23
+ setTimeout(() => {
24
+ this.modals = this.modals.filter(modal => modal.id !== id);
25
+ }, 300); // Синхронизация с анимацией
26
+ }
27
+ },
28
+ toggleModal(id: string, props: ICoreModalProps = {}, component?: ModalComponent) {
29
+ const modal = this.modals.find(modal => modal.id === id);
30
+ if (modal) {
31
+ this.closeModal(id);
32
+ } else {
33
+ this.openModal(id, props, component);
34
+ }
35
+ },
36
+ },
37
+ getters: {
38
+ getModalState: (state) => (id: string) => {
39
+ const modal = state.modals.find(modal => modal.id === id);
40
+ return modal ? { isOpen: modal.isOpen, props: modal.props } : { isOpen: false, props: {} };
41
+ },
42
+ },
43
+ });
@@ -144,6 +144,7 @@
144
144
  --font-weight-semibold: 600;
145
145
  --corner-radius-3xs: 3px;
146
146
  --corner-radius-xxs: 4px;
147
+ --corner-radius-2xs: 6px;
147
148
  --corner-radius-xs: 8px;
148
149
  --corner-radius-s: 10px;
149
150
  --corner-radius-m: 12px;
@@ -0,0 +1,19 @@
1
+ import type { ICoreColor, ICoreSize } from './utils';
2
+
3
+ type IIconName = 'arrow-right' | 'arrow-up';
4
+
5
+ interface IBaseBadgeProps {
6
+ hasDot?: boolean;
7
+ closable?: boolean;
8
+ arrowUpIcon?: boolean;
9
+ arrowRightIcon?: boolean;
10
+ }
11
+
12
+ interface IBaseBadgeGroupProps {
13
+ arrowRightIcon?: boolean;
14
+ badgePosition?: 'left' | 'right'
15
+ }
16
+
17
+ export type ICoreBadgeGroupProps = ICoreSize & ICoreColor & IBaseBadgeGroupProps;
18
+
19
+ export type ICoreBadgeProps = ICoreSize & ICoreColor & IBaseBadgeProps;
@@ -0,0 +1,8 @@
1
+ import type { Component } from 'vue';
2
+
3
+ export interface ICoreModalProps {
4
+ closable?: boolean;
5
+ [key: string]: any;
6
+ }
7
+
8
+ export type ModalComponent = Component;
@@ -0,0 +1,14 @@
1
+ import type { ICoreColor, ICoreSize } from './utils';
2
+
3
+ type TColorTag = ICoreColor['color']['primary'] | ICoreColor['color']['secondary'];
4
+
5
+ interface IBaseTagProps {
6
+ text: string;
7
+ closable?: boolean;
8
+ color?: TColorTag;
9
+ isHasAddTag?: boolean,
10
+ inputText?: string;
11
+ addingTag?: boolean;
12
+ }
13
+
14
+ export type ICoreTagProps = ICoreSize & IBaseTagProps;
@@ -0,0 +1,13 @@
1
+ export interface UploadedFile {
2
+ name: string;
3
+ size: number;
4
+ file: File;
5
+ }
6
+
7
+ export interface IpropsUpload {
8
+ acceptedFormats: string[]; // Фильтр по типу файлов (например, "image/*" для изображений)
9
+ multiple?: boolean; // Разрешить множественный выбор файлов
10
+ maxFileSize?: number; // Максимальный размер файла в байтах
11
+ onUpload?: (files: UploadedFile[]) => void; // Callback при загрузке файлов
12
+ onError?: (error: string) => void; // Callback при ошибке загрузки
13
+ }
@@ -2,7 +2,7 @@ export type Nullable<T> = T | null;
2
2
 
3
3
  export type TCoreSize = 'large' | 'medium' | 'small' | 'extra-small' | 'custom';
4
4
 
5
- export type TCoreColor = string | 'primary' | 'secondary' | 'tertiary-gray' | 'tertiary-blue' | 'quaternary-gray' | 'quaternary-blue' | 'link-blue' | 'link-critical' | 'link-gray' | 'custom';
5
+ export type TCoreColor = string | 'primary' | 'secondary' | 'tertiary-gray' | 'tertiary-blue' | 'quaternary-gray' | 'quaternary-blue' | 'link-blue' | 'link-critical' | 'link-gray' | 'gray' | 'error' | 'warning' | 'success' | 'custom';
6
6
  export type TCoreInteractiveTag = 'link' | 'button' | 'span' | 'div' | 'a';
7
7
 
8
8
  export interface ICoreSize {
@@ -1,5 +0,0 @@
1
- export interface IModalState {
2
- title: string;
3
- message: string;
4
- }
5
- export type IModalType = string | 'success' | 'error' | 'info' | 'warning';
@@ -1,149 +0,0 @@
1
- <template>
2
- <div class="modal-container" @click.stop>
3
- <div
4
- class="modal-container-header"
5
- :class="{
6
- 'modal-container-header-show-all': showMore,
7
- [getTypeModal.nameClass]: getTypeModal.nameClass.length,
8
- }"
9
- >
10
- <div class="modal-container-header-title">
11
- <component :is="getTypeModal.img"/>
12
- <div>{{ options.title }}</div>
13
- </div>
14
- <div
15
- class="modal-container-header-show-more"
16
- @click="showMore = !showMore"
17
- >
18
- {{ showMore ? "Скрыть" : "Смотреть больше" }}
19
- </div>
20
- </div>
21
- <CloseIcon class="modal-button-close" @click="onClose"/>
22
- <div v-if="showMore" class="modal-container-subtitle">
23
- Описание: <br/>
24
- {{ options.message }}
25
- </div>
26
- </div>
27
- </template>
28
-
29
- <script setup lang="ts">
30
- import {ref, computed} from "vue";
31
- import CloseIcon from "../icons/CloseIcon.vue";
32
- import ErrorIcon from "../icons/ErrorIcon.vue";
33
- import SuccessIcon from "../icons/SuccessIcon.vue";
34
- import WarningIcon from "../icons/WarningIcon.vue";
35
- import InfoIcon from "../icons/InfoIcon.vue";
36
- import {IModalState, IModalType} from "../../types/index";
37
-
38
- interface IProps {
39
- options: IModalState
40
- name: IModalType;
41
- onClose: () => void;
42
- }
43
-
44
- const props = defineProps<IProps>();
45
- const showMore = ref<boolean>(false);
46
-
47
- const getTypeModal = computed<{ img: any; nameClass: string }>(() => {
48
- switch (props.name) {
49
- case "error":
50
- return {img: ErrorIcon, nameClass: "error"};
51
- case "success":
52
- return {img: SuccessIcon, nameClass: "success"};
53
- case "warning":
54
- return {img: WarningIcon, nameClass: "warning"};
55
- case "info":
56
- return {img: InfoIcon, nameClass: "info"};
57
- default:
58
- return {img: WarningIcon, nameClass: "info"};
59
- }
60
- });
61
- </script>
62
- <style lang="scss">
63
- .modal {
64
- position: fixed;
65
- top: 0;
66
- left: 0;
67
- width: 100%;
68
- height: 100%;
69
- display: flex;
70
- justify-content: center;
71
- align-items: center;
72
- background: rgba(0, 0, 0, 0.2);
73
- z-index: 9999;
74
- }
75
- </style>
76
-
77
- <style lang="scss" scoped>
78
- .modal {
79
-
80
- &-button-close {
81
- width: 12px;
82
- height: 12px;
83
- position: absolute;
84
- top: 20px;
85
- right: 20px;
86
- cursor: pointer;
87
- }
88
-
89
- &-container {
90
- position: relative;
91
- font-family: "Roboto Condensed", serif;
92
- font-optical-sizing: auto;
93
-
94
- background: white;
95
- border-radius: 16px;
96
- max-width: 540px;
97
- width: 100%;
98
-
99
- &-header {
100
- padding: 20px;
101
- border-radius: 12px;
102
- font-size: 20px;
103
- font-weight: 400;
104
- line-height: 24px;
105
-
106
- &-show-all {
107
- border-radius: 12px 12px 0 0;
108
- }
109
-
110
- &-title {
111
- color: white;
112
- display: flex;
113
- align-items: start;
114
- gap: 20px;
115
- }
116
-
117
- &-show-more {
118
- color: #f5c9c3;
119
- text-align: right;
120
- font-size: 16px;
121
- cursor: pointer;
122
- }
123
- }
124
-
125
- &-subtitle {
126
- padding: 20px;
127
- font-size: 18px;
128
- font-weight: 400;
129
- line-height: 24px;
130
- }
131
- }
132
- }
133
-
134
- .error {
135
- background: #ee5542;
136
- }
137
-
138
- .success {
139
- background: #15b853;
140
- }
141
-
142
- .warning {
143
- background: #f4a900;
144
- }
145
-
146
- .info {
147
- background: #0085cf;
148
- }
149
- </style>
@@ -1,47 +0,0 @@
1
- # Modal Window Plugin
2
-
3
- Этот плагин для модальных окон позволяет отображать пользователю различные статусы проекта: **success**, **info**, **warning** и **error**.
4
-
5
- ## Описание
6
-
7
- Модальное окно используется для информирования пользователя о статусах или событиях в проекте. В зависимости от переданного параметра `name`, модальное окно автоматически изменяет свой тип и стиль.
8
-
9
- ## Вызов модального окна
10
-
11
- Модальное окно можно открыть и закрыть с помощью следующих команд:
12
-
13
- - **Открыть модальное окно:** `$modal.open`
14
- - **Закрыть модальное окно:** `$modal.close`
15
-
16
- ## Параметры
17
-
18
- При вызове модального окна необходимо передать два параметра:
19
-
20
- 1. **name** (`string`)
21
- - Принимает любое строковое значение.
22
- - **Особенность:** В плагине реализован слушатель для параметра `name`, который меняет тип модального окна в зависимости от переданного значения (см. ниже описание типов).
23
-
24
- 2. **options** (`{ title: string; message: string; }`)
25
- - **title:** Заголовок модального окна.
26
- - **message:** Сообщение или основной текст, который будет отображён внутри модального окна.
27
-
28
- ## Типы модальных окон
29
-
30
- В зависимости от значения параметра `name` модальное окно может принимать следующие типы:
31
-
32
- - **success**8
33
- - **info**
34
- - **warning**
35
- - **error**
36
-
37
- ## Пример использования
38
-
39
- ```javascript
40
- // Пример открытия модального окна с типом "success"
41
- $modal.open('success', {
42
- title: 'Операция выполнена успешно',
43
- message: 'Ваш запрос был успешно обработан.'
44
- });
45
-
46
- // Пример закрытия модального окна
47
- $modal.close();
@@ -1,7 +0,0 @@
1
- export interface IModalState{
2
- title: string;
3
- message: string;
4
- }
5
-
6
- export type IModalType= string | 'success' | 'error' | 'info' | 'warning';
7
-