@v1nt1248/3nclient-lib 0.3.8 → 0.3.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 (84) hide show
  1. package/README.md +3 -2
  2. package/dist/components/ui3n-autocomplete/types.d.ts +100 -0
  3. package/dist/components/ui3n-badge/types.d.ts +14 -0
  4. package/dist/components/ui3n-badge/ui3n-badge.vue.d.ts +2 -4
  5. package/dist/components/ui3n-breadcrumbs/types.d.ts +50 -0
  6. package/dist/components/ui3n-breadcrumbs/ui3n-breadcrumbs.vue.d.ts +2 -4
  7. package/dist/components/ui3n-button/types.d.ts +21 -0
  8. package/dist/components/ui3n-button/ui3n-button.vue.d.ts +2 -4
  9. package/dist/components/ui3n-checkbox/types.d.ts +44 -0
  10. package/dist/components/ui3n-chip/types.d.ts +49 -0
  11. package/dist/components/ui3n-dialog/types.d.ts +103 -0
  12. package/dist/components/ui3n-drop-files/types.d.ts +31 -0
  13. package/dist/components/ui3n-editable/types.d.ts +102 -0
  14. package/dist/components/ui3n-emoji/types.d.ts +13 -0
  15. package/dist/components/ui3n-icon/types.d.ts +10 -0
  16. package/dist/components/ui3n-input/types.d.ts +85 -0
  17. package/dist/components/ui3n-input-file/types.d.ts +29 -0
  18. package/dist/components/ui3n-list/types.d.ts +35 -0
  19. package/dist/components/ui3n-menu/types.d.ts +89 -0
  20. package/dist/components/ui3n-notification/types.d.ts +28 -0
  21. package/dist/components/ui3n-progress/types.d.ts +49 -0
  22. package/dist/components/ui3n-radio-group/types.d.ts +78 -0
  23. package/dist/components/ui3n-selector/types.d.ts +95 -0
  24. package/dist/components/ui3n-slider/types.d.ts +51 -0
  25. package/dist/components/ui3n-step-line-bar/types.d.ts +12 -0
  26. package/dist/components/ui3n-switch/types.d.ts +31 -0
  27. package/dist/components/ui3n-table/types.d.ts +198 -0
  28. package/dist/components/ui3n-tabs/types.d.ts +38 -0
  29. package/dist/components/ui3n-text/types.d.ts +56 -0
  30. package/dist/components/ui3n-tooltip/types.d.ts +69 -0
  31. package/dist/components/ui3n-virtual-scroll/types.d.ts +18 -0
  32. package/dist/constants/general.d.ts +0 -1
  33. package/dist/constants/plugins-keys.d.ts +0 -2
  34. package/dist/index.d.ts +0 -8
  35. package/dist/plugins/index.d.ts +1 -4
  36. package/dist/style.css +1 -1
  37. package/dist/ui3n-components.js +14949 -14627
  38. package/dist/ui3n-plugins.d.ts +3 -11
  39. package/dist/ui3n-plugins.js +338 -367
  40. package/dist/ui3n-utils.js +422 -439
  41. package/dist/utils/copy-to-clipboard.d.ts +1 -0
  42. package/dist/utils/execute-function.d.ts +29 -0
  43. package/dist/utils/index.d.ts +3 -0
  44. package/dist/utils/remove-whitespace-in-string.d.ts +1 -0
  45. package/dist/utils/ui/get-element-color.d.ts +1 -1
  46. package/package.json +29 -26
  47. package/src/components/ui3n-autocomplete/types.ts +100 -0
  48. package/src/components/ui3n-badge/types.ts +16 -0
  49. package/src/components/ui3n-badge/ui3n-badge-simple.vue +10 -9
  50. package/src/components/ui3n-badge/ui3n-badge.vue +37 -36
  51. package/src/components/ui3n-breadcrumbs/types.ts +51 -0
  52. package/src/components/ui3n-breadcrumbs/ui3n-breadcrumb.vue +69 -69
  53. package/src/components/ui3n-breadcrumbs/ui3n-breadcrumbs.vue +7 -8
  54. package/src/components/ui3n-button/types.ts +23 -0
  55. package/src/components/ui3n-button/ui3n-button.vue +27 -29
  56. package/src/components/ui3n-checkbox/types.ts +44 -0
  57. package/src/components/ui3n-checkbox/ui3n-checkbox.vue +16 -23
  58. package/src/components/ui3n-chip/types.ts +51 -0
  59. package/src/components/ui3n-dialog/types.ts +103 -0
  60. package/src/components/ui3n-drop-files/types.ts +31 -0
  61. package/src/components/ui3n-editable/types.ts +102 -0
  62. package/src/components/ui3n-editable/useContentEditable.ts +4 -2
  63. package/src/components/ui3n-emoji/types.ts +13 -0
  64. package/src/components/ui3n-icon/types.ts +10 -0
  65. package/src/components/ui3n-input/types.ts +85 -0
  66. package/src/components/ui3n-input/ui3n-input.vue +15 -3
  67. package/src/components/ui3n-input-file/types.ts +29 -0
  68. package/src/components/ui3n-list/types.ts +35 -0
  69. package/src/components/ui3n-menu/types.ts +89 -0
  70. package/src/components/ui3n-notification/types.ts +28 -0
  71. package/src/components/ui3n-progress/types.ts +49 -0
  72. package/src/components/ui3n-radio-group/types.ts +78 -0
  73. package/src/components/ui3n-selector/types.ts +96 -1
  74. package/src/components/ui3n-slider/types.ts +51 -0
  75. package/src/components/ui3n-step-line-bar/types.ts +12 -0
  76. package/src/components/ui3n-switch/types.ts +31 -0
  77. package/src/components/ui3n-table/types.ts +204 -0
  78. package/src/components/ui3n-tabs/types.ts +38 -0
  79. package/src/components/ui3n-text/types.ts +56 -0
  80. package/src/components/ui3n-tooltip/types.ts +69 -0
  81. package/src/components/ui3n-virtual-scroll/types.ts +18 -0
  82. package/dist/plugins/i18n/i18n.d.ts +0 -9
  83. package/dist/plugins/i18n/store-i18n.d.ts +0 -7
  84. package/dist/plugins/i18n/types.d.ts +0 -9
@@ -1,42 +1,42 @@
1
1
  <script lang="ts" setup>
2
- import { computed, getCurrentInstance, useCssModule } from 'vue';
3
- import type { Ui3nBreadcrumbEmits, Ui3nBreadcrumbProps, Ui3nBreadcrumbSlots } from './types';
4
-
5
- const props = withDefaults(defineProps<Ui3nBreadcrumbProps>(), {
6
- separator: undefined,
7
- isActive: false,
8
- disabled: false,
9
- });
10
- const emits = defineEmits<Ui3nBreadcrumbEmits>();
11
- defineSlots<Ui3nBreadcrumbSlots>();
12
-
13
- const $css = useCssModule();
14
-
15
- const separatorValue = computed(() => {
16
- if (props.separator) {
17
- return props.separator;
18
- }
2
+ import { computed, getCurrentInstance, useCssModule } from 'vue';
3
+ import type { Ui3nBreadcrumbEmits, Ui3nBreadcrumbProps, Ui3nBreadcrumbSlots } from './types';
4
+
5
+ const props = withDefaults(defineProps<Ui3nBreadcrumbProps>(), {
6
+ separator: undefined,
7
+ isActive: false,
8
+ disabled: false,
9
+ });
10
+ const emits = defineEmits<Ui3nBreadcrumbEmits>();
11
+ defineSlots<Ui3nBreadcrumbSlots>();
12
+
13
+ const $css = useCssModule();
14
+
15
+ const separatorValue = computed(() => {
16
+ if (props.separator) {
17
+ return props.separator;
18
+ }
19
19
 
20
- const instance = getCurrentInstance();
21
- return instance?.parent?.props.separator || '/';
22
- });
20
+ const instance = getCurrentInstance();
21
+ return instance?.parent?.props.separator || '/';
22
+ });
23
23
 
24
- const parentDisabled = computed(() => {
25
- const instance = getCurrentInstance();
26
- return instance?.parent?.props.disabled || false;
27
- });
24
+ const parentDisabled = computed(() => {
25
+ const instance = getCurrentInstance();
26
+ return instance?.parent?.props.disabled || false;
27
+ });
28
28
 
29
- const cssClasses = computed(() => {
30
- const val = [$css.ui3nBreadcrumb];
31
- props.isActive && val.push($css.ui3nBreadcrumbActive);
32
- (props.disabled || parentDisabled.value) && val.push($css.ui3nBreadcrumbDisabled);
29
+ const cssClasses = computed(() => {
30
+ const val = [$css.ui3nBreadcrumb];
31
+ props.isActive && val.push($css.ui3nBreadcrumbActive);
32
+ (props.disabled || parentDisabled.value) && val.push($css.ui3nBreadcrumbDisabled);
33
33
 
34
- return val;
35
- });
34
+ return val;
35
+ });
36
36
 
37
- const onClick = (ev: Event) => {
38
- emits('click', ev);
39
- };
37
+ function onClick(ev: Event) {
38
+ emits('click', ev);
39
+ }
40
40
  </script>
41
41
 
42
42
  <template>
@@ -57,44 +57,44 @@ const onClick = (ev: Event) => {
57
57
  </template>
58
58
 
59
59
  <style lang="scss" module>
60
- .ui3nBreadcrumb {
61
- --ui3n-breadcrumb-font-size: var(--spacing-m);
62
- --ui3n-breadcrumb-color-default: var(--color-text-block-primary-default);
63
- --ui3n-breadcrumb-color-selected: var(--color-text-block-accent-default);
64
-
65
- position: relative;
66
- display: flex;
67
- align-items: center;
68
- }
69
-
70
- .separator {
71
- display: flex;
72
- align-items: center;
73
- margin: 0 var(--spacing-s);
74
- }
75
-
76
- .ui3nBreadcrumbActive {
77
- font-size: var(--ui3n-breadcrumb-font-size);
78
- line-height: 1.25;
79
- color: var(--ui3n-breadcrumb-color-default);
80
- padding-right: var(--spacing-xs);
81
-
82
- &:hover {
83
- cursor: pointer;
84
- color: var(--ui3n-breadcrumb-color-selected);
85
-
86
- .ui3nBreadcrumbSeparator {
87
- color: var(--ui3n-breadcrumb-color-default);
60
+ .ui3nBreadcrumb {
61
+ --ui3n-breadcrumb-font-size: var(--spacing-m);
62
+ --ui3n-breadcrumb-color-default: var(--color-text-block-primary-default);
63
+ --ui3n-breadcrumb-color-selected: var(--color-text-block-accent-default);
64
+
65
+ position: relative;
66
+ display: flex;
67
+ align-items: center;
68
+ }
69
+
70
+ .separator {
71
+ display: flex;
72
+ align-items: center;
73
+ margin: 0 var(--spacing-s);
74
+ }
75
+
76
+ .ui3nBreadcrumbActive {
77
+ font-size: var(--ui3n-breadcrumb-font-size);
78
+ line-height: 1.25;
79
+ color: var(--ui3n-breadcrumb-color-default);
80
+ padding-right: var(--spacing-xs);
81
+
82
+ &:hover {
83
+ cursor: pointer;
84
+ color: var(--ui3n-breadcrumb-color-selected);
85
+
86
+ .ui3nBreadcrumbSeparator {
87
+ color: var(--ui3n-breadcrumb-color-default);
88
+ }
88
89
  }
89
90
  }
90
- }
91
91
 
92
- .ui3nBreadcrumbSeparator {
93
- padding-left: var(--spacing-xs);
94
- }
92
+ .ui3nBreadcrumbSeparator {
93
+ padding-left: var(--spacing-xs);
94
+ }
95
95
 
96
- .ui3nBreadcrumbDisabled {
97
- cursor: default;
98
- pointer-events: none;
99
- }
96
+ .ui3nBreadcrumbDisabled {
97
+ cursor: default;
98
+ pointer-events: none;
99
+ }
100
100
  </style>
@@ -1,13 +1,12 @@
1
1
  <script lang="ts" setup>
2
- import type { Ui3nBreadcrumbsProps } from './types';
2
+ import type { Ui3nBreadcrumbsProps, Ui3nBreadcrumbsSlots } from './types';
3
3
 
4
- withDefaults(
5
- defineProps<Ui3nBreadcrumbsProps>(),
6
- {
7
- separator: '/',
8
- disabled: false,
9
- },
10
- );
4
+ withDefaults(defineProps<Ui3nBreadcrumbsProps>(), {
5
+ separator: '/',
6
+ disabled: false,
7
+ });
8
+
9
+ defineSlots<Ui3nBreadcrumbsSlots>();
11
10
  </script>
12
11
 
13
12
  <template>
@@ -1,23 +1,46 @@
1
+ import type { VNode } from 'vue';
2
+
1
3
  export interface Ui3nButtonProps {
4
+ /** Button type */
2
5
  type?: 'primary' | 'secondary' | 'tertiary' | 'icon' | 'custom';
6
+ /** Button size */
3
7
  size?: 'regular' | 'small';
8
+ /** Whether to stretch the button to the full width of the parent block */
4
9
  block?: boolean;
10
+ /** Button text color */
5
11
  textColor?: string;
12
+ /** Button background color */
6
13
  color?: string;
14
+ /** Add a raised effect to the button */
7
15
  elevation?: boolean;
16
+ /** The icon displayed on the button */
8
17
  icon?: string;
18
+ /** Button icon size */
9
19
  iconSize?: string | number;
20
+ /** Button icon color */
10
21
  iconColor?: string;
22
+ /** Button icon position */
11
23
  iconPosition?: 'left' | 'right';
24
+ /** Put component in disabled mode */
12
25
  disabled?: boolean;
13
26
  }
14
27
 
15
28
  export interface Ui3nButtonEmits {
29
+ /** Called when the component is initialized */
16
30
  (ev: 'init', value: HTMLButtonElement): void;
31
+ /** Called when the button is clicked */
17
32
  (ev: 'click', value: Event): void;
33
+ /** Called when the Enter key is pressed */
18
34
  (ev: 'enter', value: HTMLButtonElement): void;
35
+ /** Called when the button has focus */
19
36
  (ev: 'focus', value: Event): void;
37
+ /** Called when the button loses focus. */
20
38
  (ev: 'blur', value: Event): void;
21
39
  }
22
40
 
23
41
  export type Ui3nButtonEventName = 'init' | 'click' | 'enter' | 'focus' | 'blur';
42
+
43
+ export interface Ui3nButtonSlots {
44
+ /** Default slot */
45
+ default: () => VNode;
46
+ }
@@ -2,20 +2,18 @@
2
2
  import { computed, onMounted, ref, watch, useCssModule } from 'vue';
3
3
  import Ui3nIcon from '../ui3n-icon/ui3n-icon.vue';
4
4
  import Ui3nRipple from '../../directives/ui3n-ripple';
5
- import type { Ui3nButtonEmits, Ui3nButtonProps, Ui3nButtonEventName } from './types';
5
+ import { Ui3nButtonEmits, Ui3nButtonProps, Ui3nButtonSlots, Ui3nButtonEventName } from './types';
6
6
 
7
7
  const vUi3nRipple = Ui3nRipple;
8
8
 
9
- const props = withDefaults(
10
- defineProps<Ui3nButtonProps>(),
11
- {
12
- type: 'primary',
13
- size: 'regular',
14
- iconPosition: 'right',
15
- disabled: false,
16
- },
17
- );
9
+ const props = withDefaults(defineProps<Ui3nButtonProps>(), {
10
+ type: 'primary',
11
+ size: 'regular',
12
+ iconPosition: 'right',
13
+ disabled: false,
14
+ });
18
15
  const emits = defineEmits<Ui3nButtonEmits>();
16
+ defineSlots<Ui3nButtonSlots>();
19
17
 
20
18
  const $css = useCssModule();
21
19
 
@@ -49,32 +47,32 @@
49
47
  const [prevColor, prevTextColor] = prevValue;
50
48
  const [color, textColor] = newValue;
51
49
 
52
- (props.type === 'custom' || props.type === 'icon')
53
- && color !== prevColor
54
- && buttonEl.value.style.setProperty(
55
- '--ui3n-button-bg-color-custom',
56
- color ?? 'var(--color-bg-button-primary-default)',
57
- );
58
-
59
- props.type === 'custom'
60
- && textColor !== prevTextColor
61
- && buttonEl.value.style.setProperty(
62
- '--ui3n-button-text-color-custom',
63
- textColor ?? 'var(--color-text-button-primary-default',
64
- );
50
+ (props.type === 'custom' || props.type === 'icon') &&
51
+ color !== prevColor &&
52
+ buttonEl.value.style.setProperty(
53
+ '--ui3n-button-bg-color-custom',
54
+ color ?? 'var(--color-bg-button-primary-default)',
55
+ );
56
+
57
+ props.type === 'custom' &&
58
+ textColor !== prevTextColor &&
59
+ buttonEl.value.style.setProperty(
60
+ '--ui3n-button-text-color-custom',
61
+ textColor ?? 'var(--color-text-button-primary-default',
62
+ );
65
63
  },
66
64
  );
67
65
 
68
66
  onMounted(() => {
69
67
  if (!buttonEl.value) return;
70
68
 
71
- (props.type === 'custom' || props.type === 'icon')
72
- && props.color
73
- && buttonEl.value.style.setProperty('--ui3n-button-bg-color-custom', props.color);
69
+ (props.type === 'custom' || props.type === 'icon') &&
70
+ props.color &&
71
+ buttonEl.value.style.setProperty('--ui3n-button-bg-color-custom', props.color);
74
72
 
75
- props.type === 'custom'
76
- && props.textColor
77
- && buttonEl.value.style.setProperty('--ui3n-button-text-color-custom', props.textColor);
73
+ props.type === 'custom' &&
74
+ props.textColor &&
75
+ buttonEl.value.style.setProperty('--ui3n-button-text-color-custom', props.textColor);
78
76
 
79
77
  handleButtonEvent('init');
80
78
  });
@@ -1,22 +1,66 @@
1
1
  import { VNode } from 'vue';
2
2
 
3
+ /**
4
+ * Checkbox value type
5
+ */
3
6
  export type Ui3nCheckboxValue = boolean | string | number;
4
7
 
8
+ /**
9
+ * Checkbox component properties
10
+ */
5
11
  export interface Ui3nCheckboxProps {
12
+ /**
13
+ * Current checkbox value
14
+ */
6
15
  modelValue: Ui3nCheckboxValue;
16
+ /**
17
+ * Value when checkbox is checked
18
+ */
7
19
  checkedValue?: Ui3nCheckboxValue;
20
+ /**
21
+ * Value when checkbox is unchecked
22
+ */
8
23
  uncheckedValue?: Ui3nCheckboxValue;
24
+ /**
25
+ * Checkbox size
26
+ */
9
27
  size?: number | string;
28
+ /**
29
+ * Checkbox color
30
+ */
10
31
  color?: string;
32
+ /**
33
+ * Whether checkbox is in indeterminate state
34
+ * @default false
35
+ */
11
36
  indeterminate?: boolean;
37
+ /**
38
+ * Whether checkbox is disabled
39
+ * @default false
40
+ */
12
41
  disabled?: boolean;
13
42
  }
14
43
 
44
+ /**
45
+ * Checkbox component events
46
+ */
15
47
  export interface Ui3nCheckboxEmits {
48
+ /**
49
+ * Emitted when checkbox value changes
50
+ */
16
51
  (ev: 'change', value: Ui3nCheckboxValue): void;
52
+ /**
53
+ * Emitted when model value updates
54
+ */
17
55
  (ev: 'update:modelValue', value: Ui3nCheckboxValue): void;
18
56
  }
19
57
 
58
+ /**
59
+ * Checkbox component slots
60
+ */
20
61
  export interface Ui3nCheckboxSlots {
62
+ /**
63
+ * Default slot
64
+ */
21
65
  default: () => VNode;
22
66
  }
@@ -2,18 +2,15 @@
2
2
  import { computed, onMounted, watch, onBeforeMount, ref, useCssModule, useSlots } from 'vue';
3
3
  import type { Ui3nCheckboxEmits, Ui3nCheckboxProps, Ui3nCheckboxSlots, Ui3nCheckboxValue } from './types';
4
4
 
5
- const props = withDefaults(
6
- defineProps<Ui3nCheckboxProps>(),
7
- {
8
- modelValue: false,
9
- checkedValue: true,
10
- uncheckedValue: false,
11
- size: '16',
12
- color: 'var(--color-icon-control-accent-default)',
13
- indeterminate: false,
14
- disabled: false,
15
- },
16
- );
5
+ const props = withDefaults(defineProps<Ui3nCheckboxProps>(), {
6
+ modelValue: false,
7
+ checkedValue: true,
8
+ uncheckedValue: false,
9
+ size: '16',
10
+ color: 'var(--color-icon-control-accent-default)',
11
+ indeterminate: false,
12
+ disabled: false,
13
+ });
17
14
  const emits = defineEmits<Ui3nCheckboxEmits>();
18
15
  defineSlots<Ui3nCheckboxSlots>();
19
16
 
@@ -29,9 +26,7 @@
29
26
  return 'indeterminate';
30
27
  }
31
28
 
32
- return val.value === props.checkedValue
33
- ? 'checked'
34
- : 'unchecked';
29
+ return val.value === props.checkedValue ? 'checked' : 'unchecked';
35
30
  });
36
31
 
37
32
  const mainCssClasses = computed(() => {
@@ -56,9 +51,9 @@
56
51
  const uncheckedValueType = typeof props.uncheckedValue;
57
52
  const valueType = typeof props.modelValue;
58
53
  if (
59
- checkedValueType !== uncheckedValueType
60
- || checkedValueType !== valueType
61
- || uncheckedValueType !== valueType
54
+ checkedValueType !== uncheckedValueType ||
55
+ checkedValueType !== valueType ||
56
+ uncheckedValueType !== valueType
62
57
  ) {
63
58
  throw Error('[Ui3nCheckbox] types of "value", "checkedValue" and "uncheckedValue" are different');
64
59
  }
@@ -73,13 +68,13 @@
73
68
 
74
69
  watch(
75
70
  () => props.modelValue,
76
- newValue => val.value = newValue,
71
+ newValue => (val.value = newValue),
77
72
  { immediate: true },
78
73
  );
79
74
 
80
75
  watch(
81
76
  () => props.indeterminate,
82
- newValue => uncertain.value = newValue,
77
+ newValue => (uncertain.value = newValue),
83
78
  { immediate: true },
84
79
  );
85
80
 
@@ -104,9 +99,7 @@
104
99
  function change(ev: Event) {
105
100
  ev.preventDefault();
106
101
 
107
- val.value = checkBoxValue.value !== 'unchecked'
108
- ? props.uncheckedValue
109
- : props.checkedValue;
102
+ val.value = checkBoxValue.value !== 'unchecked' ? props.uncheckedValue : props.checkedValue;
110
103
 
111
104
  if (uncertain.value) {
112
105
  uncertain.value = false;
@@ -1,20 +1,71 @@
1
1
  import { VNode } from 'vue';
2
2
 
3
+ /**
4
+ * Chip component properties
5
+ */
3
6
  export interface Ui3nChipProps {
7
+ /**
8
+ * Chip height
9
+ */
4
10
  height?: number | string;
11
+ /**
12
+ * Chip maximum width
13
+ */
5
14
  maxWidth?: number | string;
15
+ /**
16
+ * Chip plain style
17
+ * @default false
18
+ */
6
19
  plain?: boolean;
20
+ /**
21
+ * Chip round shape
22
+ * @default false
23
+ */
7
24
  round?: boolean;
25
+ /**
26
+ * Chip closeable
27
+ * @default false
28
+ */
8
29
  closeable?: boolean;
30
+ /**
31
+ * Chip color
32
+ */
9
33
  color?: string;
34
+ /**
35
+ * Text size
36
+ */
10
37
  textSize?: number | string;
38
+ /**
39
+ * Text color
40
+ */
11
41
  textColor?: string;
42
+ /**
43
+ * Chip disabled state
44
+ * @default false
45
+ */
12
46
  disabled?: boolean;
13
47
  }
48
+
49
+ /**
50
+ * Chip component emits
51
+ */
14
52
  export interface Ui3nChipEmits {
53
+ /**
54
+ * Called when chip is closed
55
+ */
15
56
  (ev: 'close'): void;
16
57
  }
58
+
59
+ /**
60
+ * Chip component slots
61
+ */
17
62
  export interface Ui3nChipSlots {
63
+ /**
64
+ * Left slot
65
+ */
18
66
  left: (props: { size: number; color: string }) => VNode;
67
+ /**
68
+ * Default slot
69
+ */
19
70
  default: () => VNode;
20
71
  }
@@ -1,42 +1,145 @@
1
1
  import type { VNode } from 'vue';
2
2
  import type { Ui3nIconField } from '@/types';
3
3
 
4
+ /**
5
+ * Dialog event base types
6
+ */
4
7
  export type Ui3nDialogEventBase = 'close' | 'confirm' | 'cancel' | 'click-overlay';
5
8
 
9
+ /**
10
+ * Dialog event types
11
+ */
6
12
  export type Ui3nDialogEvent<E extends string = never> = Ui3nDialogEventBase | E;
7
13
 
14
+ /**
15
+ * Dialog component properties
16
+ */
8
17
  export interface Ui3nDialogComponentProps<V> {
18
+ /**
19
+ * Dialog id
20
+ */
9
21
  id?: string;
22
+ /**
23
+ * Dialog title
24
+ */
10
25
  title?: string;
26
+ /**
27
+ * Dialog icon
28
+ */
11
29
  icon?: string | Ui3nIconField;
30
+ /**
31
+ * Dialog width
32
+ */
12
33
  width?: string | number;
34
+ /**
35
+ * Whether dialog is draggable
36
+ * @default false
37
+ */
13
38
  draggable?: boolean;
39
+ /**
40
+ * Whether to hide close button
41
+ * @default false
42
+ */
14
43
  hideCloseButton?: boolean;
44
+ /**
45
+ * CSS classes for dialog
46
+ */
15
47
  cssClass?: string[];
48
+ /**
49
+ * CSS styles for dialog
50
+ */
16
51
  cssStyle?: Record<string, string>;
52
+ /**
53
+ * CSS classes for content
54
+ */
17
55
  contentCssClass?: string[];
56
+ /**
57
+ * CSS styles for content
58
+ */
18
59
  contentCssStyle?: Record<string, string>;
60
+ /**
61
+ * Whether to show confirm button
62
+ * @default true
63
+ */
19
64
  confirmButton?: boolean;
65
+ /**
66
+ * Whether to show cancel button
67
+ * @default true
68
+ */
20
69
  cancelButton?: boolean;
70
+ /**
71
+ * Confirm button text
72
+ */
21
73
  confirmButtonText?: string;
74
+ /**
75
+ * Cancel button text
76
+ */
22
77
  cancelButtonText?: string;
78
+ /**
79
+ * Confirm button color
80
+ */
23
81
  confirmButtonColor?: string;
82
+ /**
83
+ * Cancel button color
84
+ */
24
85
  cancelButtonColor?: string;
86
+ /**
87
+ * Confirm button background
88
+ */
25
89
  confirmButtonBackground?: string;
90
+ /**
91
+ * Cancel button background
92
+ */
26
93
  cancelButtonBackground?: string;
94
+ /**
95
+ * Whether to close on click overlay
96
+ * @default true
97
+ */
27
98
  closeOnClickOverlay?: boolean;
99
+ /**
100
+ * Whether to close on ESC key
101
+ * @default true
102
+ */
28
103
  closeOnEsc?: boolean;
104
+ /**
105
+ * Dialog data
106
+ */
29
107
  data?: V;
108
+ /**
109
+ * Whether dialog is valid
110
+ * @default true
111
+ */
30
112
  isValid?: boolean;
31
113
  }
32
114
 
115
+ /**
116
+ * Dialog component emits
117
+ */
33
118
  export interface Ui3nDialogComponentEmits<V, E extends string = never> {
119
+ /**
120
+ * Called when dialog action is performed
121
+ */
34
122
  (event: 'action', value: { event: Ui3nDialogEvent<E>; data?: V }): void;
35
123
  }
36
124
 
125
+ /**
126
+ * Dialog component slots
127
+ */
37
128
  export interface Ui3nDialogComponentSlots {
129
+ /**
130
+ * Header slot
131
+ */
38
132
  header?: () => VNode;
133
+ /**
134
+ * Body slot
135
+ */
39
136
  body: () => VNode;
137
+ /**
138
+ * Actions slot
139
+ */
40
140
  actions?: () => VNode;
141
+ /**
142
+ * Loading slot
143
+ */
41
144
  loading?: () => VNode;
42
145
  }