@v1nt1248/3nclient-lib 0.0.8 → 0.0.11

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 (36) hide show
  1. package/dist/components/index.d.ts +20 -1
  2. package/dist/components/ui3n-dialog.vue.d.ts +73 -0
  3. package/dist/components/ui3n-drop-files.vue.d.ts +41 -0
  4. package/dist/components/ui3n-emoji.vue.d.ts +36 -0
  5. package/dist/components/ui3n-input.vue.d.ts +96 -0
  6. package/dist/components/ui3n-list.vue.d.ts +45 -0
  7. package/dist/components/ui3n-menu.vue.d.ts +85 -0
  8. package/dist/components/ui3n-notification.vue.d.ts +4 -4
  9. package/dist/components/ui3n-table-sort-icon.vue.d.ts +29 -0
  10. package/dist/components/ui3n-table.vue.d.ts +42 -0
  11. package/dist/components/ui3n-text.vue.d.ts +79 -0
  12. package/dist/directives/index.d.ts +1 -0
  13. package/dist/directives/ui3n-click-outside.d.ts +10 -0
  14. package/dist/index.d.ts +31 -0
  15. package/dist/plugins/dialogs.d.ts +17 -0
  16. package/dist/plugins/i18n.d.ts +2 -0
  17. package/dist/plugins/index.d.ts +8 -4
  18. package/dist/plugins/notifications.d.ts +2 -0
  19. package/dist/plugins/store-dialogs.d.ts +4 -0
  20. package/dist/plugins/store-notifications.d.ts +4 -0
  21. package/dist/plugins/vue-bus.d.ts +2 -0
  22. package/dist/style.css +1 -1
  23. package/dist/ui-3n-lib.js +6931 -6186
  24. package/package.json +8 -3
  25. package/src/components/index.ts +50 -0
  26. package/src/components/ui3n-button.vue +4 -5
  27. package/src/components/ui3n-dialog.vue +311 -0
  28. package/src/components/ui3n-drop-files.vue +8 -4
  29. package/src/components/ui3n-emoji.vue +8 -4
  30. package/src/components/ui3n-list.vue +135 -0
  31. package/src/components/ui3n-menu.vue +134 -0
  32. package/src/components/ui3n-notification.vue +2 -13
  33. package/src/components/ui3n-table-sort-icon.vue +4 -2
  34. package/src/components/ui3n-table.vue +9 -4
  35. package/src/components/ui3n-text.vue +9 -5
  36. package/dist/types.d.ts +0 -23
@@ -0,0 +1,134 @@
1
+ <script lang="ts" setup>
2
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
+ import { computed, onMounted, ref } from 'vue'
4
+ import { default as vClickOutside } from '../directives/ui3n-click-outside'
5
+
6
+ export interface Ui3nMenuProps {
7
+ offsetX?: number;
8
+ offsetY?: number;
9
+ closeOnClick?: boolean;
10
+ closeOnClickOutside?: boolean;
11
+ disabled?: boolean;
12
+ }
13
+
14
+ export interface Ui3nMenuEmits {
15
+ (ev: 'open'): void;
16
+ (ev: 'opened'): void;
17
+ (ev: 'close'): void;
18
+ (ev: 'closed'): void;
19
+ (ev: 'click-outside'): void;
20
+ }
21
+
22
+ export interface Ui3nMenuSlots {
23
+ default: () => any;
24
+ menu?: () => any;
25
+ }
26
+
27
+ const props = withDefaults(defineProps<Ui3nMenuProps>(), {
28
+ offsetX: 0,
29
+ offsetY: 0,
30
+ closeOnClick: true,
31
+ closeOnClickOutside: true,
32
+ disabled: false,
33
+ })
34
+ const emits = defineEmits<Ui3nMenuEmits>()
35
+ defineSlots<Ui3nMenuSlots>()
36
+
37
+ const menuElement = ref<HTMLDivElement | null>(null)
38
+ const menuTriggerElement = ref<HTMLDivElement | null>(null)
39
+ const isShow = ref(false)
40
+ const defaultAnimationDuration = 400
41
+ const menuContentStyle = computed(() => {
42
+ if (!props.offsetX && !props.offsetY) {
43
+ return {}
44
+ }
45
+ return {
46
+ ...(props.offsetX && { left: `${props.offsetX}px` }),
47
+ ...(props.offsetY && { top: `${menuTriggerElement.value!.clientHeight + props.offsetY}px` }),
48
+ }
49
+ })
50
+
51
+ onMounted(() => {
52
+ menuElement.value!.style.setProperty('--menu-animation-duration', `${defaultAnimationDuration}ms`)
53
+ })
54
+
55
+ const toggleMenu = () => {
56
+ isShow.value = !isShow.value
57
+ }
58
+
59
+ const onContentClick = () => {
60
+ isShow.value = false
61
+ }
62
+ const onClickOutside = () => {
63
+ emits('click-outside')
64
+ if (props.closeOnClickOutside) {
65
+ isShow.value = false
66
+ }
67
+ }
68
+ </script>
69
+
70
+ <template>
71
+ <div
72
+ ref="menuElement"
73
+ class="ui3n-menu"
74
+ >
75
+ <div
76
+ ref="menuTriggerElement"
77
+ class="ui3n-menu__trigger"
78
+ @click.stop="toggleMenu"
79
+ >
80
+ <slot />
81
+ </div>
82
+
83
+ <transition
84
+ name="menu"
85
+ :duration="defaultAnimationDuration"
86
+ @before-enter="emits('open')"
87
+ @after-enter="emits('opened')"
88
+ @before-leave="emits('close')"
89
+ @after-leave="emits('closed')"
90
+ >
91
+ <div
92
+ v-if="isShow"
93
+ v-click-outside="onClickOutside"
94
+ :style="menuContentStyle"
95
+ class="ui3n-menu__content"
96
+ v-on="props.closeOnClick ? { click: onContentClick } : {}"
97
+ >
98
+ <slot name="menu" />
99
+ </div>
100
+ </transition>
101
+ </div>
102
+ </template>
103
+
104
+ <style lang="scss" scoped>
105
+ @import "../assets/styles/mixins";
106
+
107
+ .ui3n-menu {
108
+ --menu-animation-duration: 400ms;
109
+
110
+ position: relative;
111
+ overflow: visible;
112
+
113
+ .menu-enter-active,
114
+ .menu-leave-active {
115
+ transition: opacity var(--menu-animation-duration);
116
+ }
117
+
118
+ .menu-enter-from,
119
+ .menu-leave-to {
120
+ opacity: 0;
121
+ }
122
+
123
+ &__trigger {
124
+ position: relative;
125
+ }
126
+
127
+ &__content {
128
+ position: absolute;
129
+ border-radius: 4px;
130
+ background-color: var(--system-white, #fff);
131
+ @include elevation(3);
132
+ }
133
+ }
134
+ </style>
@@ -2,20 +2,9 @@ ui<script lang="ts" setup>
2
2
  import { computed } from 'vue'
3
3
  import Ui3nIcon from './ui3n-icon.vue'
4
4
  import Ui3nButton from './ui3n-button.vue'
5
+ import type { Ui3nNotificationProps } from '../constants'
5
6
 
6
- const props = defineProps<{
7
- id?: string;
8
- type?: 'success' | 'warning' | 'info' | 'error';
9
- content: string;
10
- icon?: string;
11
- iconSize?: string | number;
12
- iconColor?: string;
13
- position?: 'left' | 'center' | 'right';
14
- duration?: number;
15
- teleport?: string;
16
- onOpen?: () => void;
17
- onClose?: () => void;
18
- }>()
7
+ const props = defineProps<Ui3nNotificationProps>()
19
8
  const params = computed(() => {
20
9
  const {
21
10
  id,
@@ -2,11 +2,13 @@
2
2
  import { computed } from 'vue'
3
3
  import Ui3nIcon from './ui3n-icon.vue'
4
4
 
5
- const props = defineProps<{
5
+ export interface Ui3nTableSortIconProps {
6
6
  size?: string | number;
7
7
  color?: string;
8
8
  value: 'asc' | 'desc';
9
- }>()
9
+ }
10
+
11
+ const props = defineProps<Ui3nTableSortIconProps>()
10
12
 
11
13
  const iconSize = computed(() => props.size ? +props.size : 16)
12
14
  const iconColor = computed(() => props.color || 'var(--black-90, #212121)')
@@ -2,15 +2,20 @@
2
2
  import { computed, ref } from 'vue'
3
3
  import { Icon } from '@iconify/vue'
4
4
  import Ui3nTableSortIcon from './ui3n-table-sort-icon.vue'
5
+ import type { ListingEntryTypeExtended, EntityAction, SortField } from '../constants'
5
6
 
6
- const props = defineProps<{
7
+ export interface Ui3nTableProps {
7
8
  items: ListingEntryTypeExtended[];
8
9
  textIfEmpty?: string;
9
- }>()
10
- const emit = defineEmits<{
10
+ }
11
+
12
+ export interface Ui3nTableEmits {
11
13
  (ev: 'go', name: string): void;
12
14
  (ev: 'action', value: { action: EntityAction, entity: ListingEntryTypeExtended }): void;
13
- }>()
15
+ }
16
+
17
+ const props = defineProps<Ui3nTableProps>()
18
+ const emit = defineEmits<Ui3nTableEmits>()
14
19
 
15
20
  const sortField = ref<SortField>('name')
16
21
  const sortDirection = ref<'asc'|'desc'>('asc')
@@ -1,9 +1,9 @@
1
1
  <script lang="ts" setup>
2
2
  /* eslint-disable @typescript-eslint/no-explicit-any */
3
3
  import { computed, onMounted, ref, watch } from 'vue'
4
- import { patchTextareaMaxRowsSupport } from '../helpers/textarea-max-rows'
4
+ import { patchTextareaMaxRowsSupport } from '../tools'
5
5
 
6
- const props = defineProps<{
6
+ export interface Ui3nTextProps {
7
7
  text: string;
8
8
  rows?: number;
9
9
  maxRows?: number;
@@ -11,15 +11,19 @@
11
11
  placeholder?: string;
12
12
  rules?: Array<(v: string) => any>;
13
13
  disabled?: boolean;
14
- }>()
15
- const emit = defineEmits<{
14
+ }
15
+
16
+ export interface Ui3nTextEmits {
16
17
  (ev: 'init', value: HTMLTextAreaElement): void;
17
18
  (ev: 'input', value: string): void;
18
19
  (ev: 'focus', value: Event): void;
19
20
  (ev: 'blur', value: Event): void;
20
21
  (ev: 'update:text', value: string): void;
21
22
  (ev: 'update:valid', value: boolean): void;
22
- }>()
23
+ }
24
+
25
+ const props = defineProps<Ui3nTextProps>()
26
+ const emit = defineEmits<Ui3nTextEmits>()
23
27
 
24
28
  const textareaElement = ref<HTMLTextAreaElement | null>(null)
25
29
  const isFocused = ref(false)
package/dist/types.d.ts DELETED
@@ -1,23 +0,0 @@
1
- import { VNode } from 'vue'
2
- import type { Ui3nNotificationProps, VueEventBus } from './constants'
3
- import type { Ui3nButtonProps, Ui3nButtonEmits } from './components'
4
-
5
- declare module '@vue/runtime-core' {
6
- interface ComponentCustomProperties {
7
- $createNotice: (params: Ui3nNotificationProps) => void;
8
- $locale: string;
9
- $tr: (key: string, placeholders?: Record<string, string>) => string;
10
- $changeLocale: (lang: string) => void;
11
- $emitter: VueEventBus;
12
- }
13
- }
14
-
15
- declare module '@v1nt1248/3nclient-lib' {
16
- class Ui3nButton {
17
- $props: Ui3nButtonProps;
18
- $emits: Ui3nButtonEmits;
19
- $clots: {
20
- default: () => VNode[];
21
- }
22
- }
23
- }