@v1nt1248/3nclient-lib 0.3.28 → 0.3.29

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 (111) hide show
  1. package/dist/chunks/ui3n-notification-Dr_3Td9N.js +279 -0
  2. package/dist/components/index.d.ts +12 -12
  3. package/dist/components/ui3n-autocomplete/types.d.ts +8 -0
  4. package/dist/components/ui3n-autocomplete/ui3n-autocomplete.d.ts +2 -2
  5. package/dist/components/ui3n-badge/types.d.ts +12 -0
  6. package/dist/components/ui3n-badge/ui3n-badge-simple.d.ts +1 -1
  7. package/dist/components/ui3n-badge/ui3n-badge.d.ts +1 -1
  8. package/dist/components/ui3n-breadcrumbs/types.d.ts +1 -1
  9. package/dist/components/ui3n-breadcrumbs/ui3n-breadcrumb.d.ts +2 -2
  10. package/dist/components/ui3n-button/types.d.ts +4 -2
  11. package/dist/components/ui3n-checkbox/types.d.ts +11 -0
  12. package/dist/components/ui3n-checkbox/ui3n-checkbox.d.ts +4 -1
  13. package/dist/components/ui3n-chip/types.d.ts +6 -1
  14. package/dist/components/ui3n-chip/ui3n-chip.d.ts +2 -0
  15. package/dist/components/ui3n-drop-files/types.d.ts +7 -0
  16. package/dist/components/ui3n-drop-files/ui3n-drop-files.d.ts +7 -1
  17. package/dist/components/ui3n-editable/types.d.ts +11 -0
  18. package/dist/components/ui3n-editable/ui3n-editable.d.ts +4 -2
  19. package/dist/components/ui3n-icon/types.d.ts +5 -1
  20. package/dist/components/ui3n-icon/ui3n-icon.d.ts +2 -2
  21. package/dist/components/ui3n-input/types.d.ts +4 -0
  22. package/dist/components/ui3n-input/ui3n-input.d.ts +4 -1
  23. package/dist/components/ui3n-input-file/types.d.ts +11 -0
  24. package/dist/components/ui3n-input-file/ui3n-input-file.d.ts +4 -1
  25. package/dist/components/ui3n-list/types.d.ts +4 -0
  26. package/dist/components/ui3n-menu/types.d.ts +4 -0
  27. package/dist/components/ui3n-menu/ui3n-menu.d.ts +1 -1
  28. package/dist/components/ui3n-notification/ui3n-notification.d.ts +2 -2
  29. package/dist/components/ui3n-progress/ui3n-progress-circular.d.ts +1 -1
  30. package/dist/components/ui3n-progress/ui3n-progress-linear.d.ts +1 -1
  31. package/dist/components/ui3n-radio-group/types.d.ts +18 -0
  32. package/dist/components/ui3n-radio-group/ui3n-radio-group.d.ts +3 -1
  33. package/dist/components/ui3n-radio-group/ui3n-radio.d.ts +6 -7
  34. package/dist/components/ui3n-scrollbar-vertical/types.d.ts +2 -0
  35. package/dist/components/ui3n-scrollbar-vertical/ui3n-scrollbar-vertical.d.ts +2 -0
  36. package/dist/components/ui3n-selector/types.d.ts +11 -0
  37. package/dist/components/ui3n-selector/ui3n-selector.d.ts +2 -2
  38. package/dist/components/ui3n-slider/types.d.ts +11 -0
  39. package/dist/components/ui3n-slider/ui3n-slider.d.ts +4 -1
  40. package/dist/components/ui3n-step-line-bar/types.d.ts +4 -0
  41. package/dist/components/ui3n-switch/types.d.ts +11 -0
  42. package/dist/components/ui3n-switch/ui3n-switch.d.ts +4 -1
  43. package/dist/components/ui3n-table/composables/useTable.d.ts +1 -0
  44. package/dist/components/ui3n-table/types.d.ts +4 -0
  45. package/dist/components/ui3n-table/ui3n-table-sort-icon.d.ts +4 -1
  46. package/dist/components/ui3n-tabs/types.d.ts +4 -0
  47. package/dist/components/ui3n-text/types.d.ts +11 -0
  48. package/dist/components/ui3n-text/ui3n-text.d.ts +4 -1
  49. package/dist/components/ui3n-tooltip/types.d.ts +4 -0
  50. package/dist/components/ui3n-tooltip/ui3n-tooltip.d.ts +4 -2
  51. package/dist/style.css +1 -1
  52. package/dist/ui3n-components.js +2066 -1690
  53. package/dist/ui3n-plugins.js +1 -1
  54. package/package.json +1 -1
  55. package/src/components/index.ts +29 -7
  56. package/src/components/ui3n-autocomplete/types.ts +9 -1
  57. package/src/components/ui3n-autocomplete/ui3n-autocomplete.vue +182 -51
  58. package/src/components/ui3n-badge/types.ts +10 -0
  59. package/src/components/ui3n-badge/ui3n-badge-simple.vue +54 -55
  60. package/src/components/ui3n-badge/ui3n-badge.vue +4 -0
  61. package/src/components/ui3n-breadcrumbs/types.ts +1 -1
  62. package/src/components/ui3n-breadcrumbs/ui3n-breadcrumb.vue +7 -5
  63. package/src/components/ui3n-button/types.ts +4 -2
  64. package/src/components/ui3n-button/ui3n-button.vue +24 -19
  65. package/src/components/ui3n-checkbox/types.ts +12 -0
  66. package/src/components/ui3n-checkbox/ui3n-checkbox.vue +79 -29
  67. package/src/components/ui3n-chip/types.ts +6 -1
  68. package/src/components/ui3n-chip/ui3n-chip.vue +64 -61
  69. package/src/components/ui3n-dialog/ui3n-dialog.vue +3 -3
  70. package/src/components/ui3n-drop-files/types.ts +8 -0
  71. package/src/components/ui3n-drop-files/ui3n-drop-files.vue +73 -29
  72. package/src/components/ui3n-editable/types.ts +12 -0
  73. package/src/components/ui3n-editable/ui3n-editable.vue +56 -24
  74. package/src/components/ui3n-icon/types.ts +5 -1
  75. package/src/components/ui3n-icon/ui3n-icon.vue +45 -50
  76. package/src/components/ui3n-input/types.ts +4 -0
  77. package/src/components/ui3n-input/ui3n-input.vue +14 -1
  78. package/src/components/ui3n-input-file/types.ts +12 -0
  79. package/src/components/ui3n-input-file/ui3n-input-file.vue +33 -16
  80. package/src/components/ui3n-list/types.ts +4 -0
  81. package/src/components/ui3n-list/ui3n-list.vue +3 -1
  82. package/src/components/ui3n-menu/types.ts +4 -0
  83. package/src/components/ui3n-menu/ui3n-menu.vue +43 -32
  84. package/src/components/ui3n-notification/ui3n-notification.vue +190 -175
  85. package/src/components/ui3n-progress/ui3n-progress-circular.vue +40 -22
  86. package/src/components/ui3n-progress/ui3n-progress-linear.vue +14 -7
  87. package/src/components/ui3n-radio-group/types.ts +20 -0
  88. package/src/components/ui3n-radio-group/ui3n-radio-group.vue +61 -48
  89. package/src/components/ui3n-radio-group/ui3n-radio.vue +60 -65
  90. package/src/components/ui3n-scrollbar-vertical/types.ts +2 -0
  91. package/src/components/ui3n-scrollbar-vertical/ui3n-scrollbar-vertical.vue +4 -4
  92. package/src/components/ui3n-selector/types.ts +12 -0
  93. package/src/components/ui3n-selector/ui3n-selector.vue +63 -40
  94. package/src/components/ui3n-slider/types.ts +12 -0
  95. package/src/components/ui3n-slider/ui3n-slider.vue +88 -39
  96. package/src/components/ui3n-step-line-bar/types.ts +4 -0
  97. package/src/components/ui3n-step-line-bar/ui3n-step-line-bar.vue +8 -10
  98. package/src/components/ui3n-switch/types.ts +12 -0
  99. package/src/components/ui3n-switch/ui3n-switch.vue +57 -25
  100. package/src/components/ui3n-table/composables/useTable.ts +17 -0
  101. package/src/components/ui3n-table/types.ts +4 -0
  102. package/src/components/ui3n-table/ui3n-table-sort-icon.vue +9 -8
  103. package/src/components/ui3n-table/ui3n-table.vue +48 -17
  104. package/src/components/ui3n-tabs/types.ts +4 -0
  105. package/src/components/ui3n-tabs/ui3n-tabs.vue +146 -108
  106. package/src/components/ui3n-text/types.ts +12 -0
  107. package/src/components/ui3n-text/ui3n-text.vue +56 -15
  108. package/src/components/ui3n-tooltip/types.ts +4 -0
  109. package/src/components/ui3n-tooltip/ui3n-tooltip.vue +61 -43
  110. package/src/components/ui3n-virtual-scroll/ui3n-virtual-scroll.vue +201 -17
  111. package/dist/chunks/ui3n-notification-DlDM-u-R.js +0 -276
@@ -1,45 +1,40 @@
1
1
  <script lang="ts" setup>
2
- import { nextTick, onMounted, ref, watch } from 'vue';
3
- import type { Ui3nBadgeSimpleProps } from './types';
2
+ import { nextTick, onMounted, ref, watch } from 'vue';
3
+ import type { Ui3nBadgeSimpleProps, Ui3nBadgeSimpleEmits } from './types';
4
4
 
5
- const props = withDefaults(
6
- defineProps<Ui3nBadgeSimpleProps>(),
7
- {
5
+ const props = withDefaults(defineProps<Ui3nBadgeSimpleProps>(), {
8
6
  dot: false,
9
7
  value: '',
10
8
  color: 'var(--color-bg-button-primary-default)',
11
9
  textColor: 'var(--color-text-button-primary-default)',
12
- },
13
- );
10
+ });
14
11
 
15
- const emits = defineEmits<{
16
- (ev: 'change:size', val: { width: number; height: number }): void;
17
- }>();
12
+ const emits = defineEmits<Ui3nBadgeSimpleEmits>();
18
13
 
19
- const element = ref<HTMLDivElement | null>(null);
14
+ const element = ref<HTMLDivElement | null>(null);
20
15
 
21
- function getElementSize() {
22
- nextTick(() => {
23
- if (element.value) {
24
- emits('change:size', { width: element.value.offsetWidth, height: element.value.offsetHeight });
25
- }
26
- });
27
- }
28
-
16
+ function getElementSize() {
17
+ nextTick(() => {
18
+ if (element.value) {
19
+ emits('change:size', { width: element.value.offsetWidth, height: element.value.offsetHeight });
20
+ }
21
+ });
22
+ }
29
23
 
30
- watch(
31
- () => [props.value, props.dot],
32
- () => getElementSize(),
33
- );
24
+ watch(
25
+ () => [props.value, props.dot],
26
+ () => getElementSize(),
27
+ );
34
28
 
35
- onMounted(() => {
36
- getElementSize();
37
- });
29
+ onMounted(() => {
30
+ getElementSize();
31
+ });
38
32
  </script>
39
33
 
40
34
  <template>
41
35
  <div
42
36
  ref="element"
37
+ :id="id"
43
38
  :class="[$style.ui3nBadgeSimple, dot && $style.ui3nBadgeDot]"
44
39
  >
45
40
  <span
@@ -52,38 +47,42 @@ onMounted(() => {
52
47
  </template>
53
48
 
54
49
  <style lang="scss" module>
55
- .ui3nBadgeSimple {
56
- --ui3n-badge-size: 20px;
50
+ .ui3nBadgeSimple {
51
+ --ui3n-badge-size: 20px;
52
+ --ui3n-badge-dot-size: 8px;
53
+ --ui3n-badge-padding-inline: 6px;
54
+ --ui3n-badge-nodot-border-radius: 10px;
55
+ --ui3n-badge-font-size: 12px;
57
56
 
58
- position: relative;
59
- box-sizing: border-box;
60
- background-color: v-bind(color);
61
- outline: 1px var(--color-bg-block-primary-default)solid;
57
+ position: relative;
58
+ box-sizing: border-box;
59
+ background-color: v-bind(color);
60
+ outline: 1px var(--color-bg-block-primary-default) solid;
62
61
 
63
- &:not(.ui3nBadgeDot) {
64
- min-height: var(--ui3n-badge-size);
65
- height: var(--ui3n-badge-size);
66
- width: max-content;
67
- padding: 0 6px;
68
- border-radius: 10px;
62
+ &:not(.ui3nBadgeDot) {
63
+ min-height: var(--ui3n-badge-size);
64
+ height: var(--ui3n-badge-size);
65
+ width: max-content;
66
+ padding: 0 var(--ui3n-badge-padding-inline);
67
+ border-radius: var(--ui3n-badge-nodot-border-radius);
68
+ }
69
69
  }
70
- }
71
70
 
72
- .ui3nBadgeDot {
73
- min-width: var(--spacing-s);
74
- width: var(--spacing-s);
75
- max-width: var(--spacing-s);
76
- min-height: var(--spacing-s);
77
- height: var(--spacing-s);
78
- max-height: var(--spacing-s);
79
- border-radius: 50%;
80
- }
71
+ .ui3nBadgeDot {
72
+ min-width: var(--ui3n-badge-dot-size);
73
+ width: var(--ui3n-badge-dot-size);
74
+ max-width: var(--ui3n-badge-dot-size);
75
+ min-height: var(--ui3n-badge-dot-size);
76
+ height: var(--ui3n-badge-dot-size);
77
+ max-height: var(--ui3n-badge-dot-size);
78
+ border-radius: 50%;
79
+ }
81
80
 
82
- .ui3nBadgeText {
83
- display: block;
84
- color: v-bind(textColor);
85
- font-size: var(--font-12);
86
- line-height: var(--ui3n-badge-size);
87
- text-align: center;
88
- }
81
+ .ui3nBadgeText {
82
+ display: block;
83
+ color: v-bind(textColor);
84
+ font-size: var(--ui3n-badge-font-size);
85
+ line-height: var(--ui3n-badge-size);
86
+ text-align: center;
87
+ }
89
88
  </style>
@@ -23,6 +23,7 @@
23
23
  >();
24
24
 
25
25
  const hasDefaultSlot = computed(() => !!slots.default);
26
+
26
27
  const style = computed(() => {
27
28
  const [xPosition, yPosition] = props.position.split('-');
28
29
  return {
@@ -44,6 +45,7 @@
44
45
  <slot />
45
46
 
46
47
  <ui3n-badge-simple
48
+ :id="id"
47
49
  :dot="dot"
48
50
  :value="value"
49
51
  :color="color"
@@ -57,6 +59,7 @@
57
59
 
58
60
  <ui3n-badge-simple
59
61
  v-else
62
+ :id="id"
60
63
  :dot="dot"
61
64
  :value="value"
62
65
  :color="color"
@@ -74,6 +77,7 @@
74
77
  .ui3nBadgeWrapper {
75
78
  position: relative;
76
79
  width: max-content;
80
+ min-width: var(--ui3n-badge-size);
77
81
  }
78
82
 
79
83
  .ui3nBadgeContent {
@@ -28,7 +28,7 @@ export interface Ui3nBreadcrumbEmits {
28
28
  /**
29
29
  * Called when the breadcrumb is clicked
30
30
  */
31
- (ev: 'click', value: Event): void;
31
+ (ev: 'click', value: MouseEvent): void;
32
32
  }
33
33
 
34
34
  /**
@@ -34,7 +34,7 @@
34
34
  return val;
35
35
  });
36
36
 
37
- function onClick(ev: Event) {
37
+ function onClick(ev: MouseEvent) {
38
38
  emits('click', ev);
39
39
  }
40
40
  </script>
@@ -58,7 +58,9 @@
58
58
 
59
59
  <style lang="scss" module>
60
60
  .ui3nBreadcrumb {
61
- --ui3n-breadcrumb-font-size: var(--spacing-m);
61
+ --ui3n-breadcrumb-font-size: 16px;
62
+ --ui3n-breadcrumb-padding-inline: 4px;
63
+ --ui3n-breadcrumb-separator-distance: 8px;
62
64
  --ui3n-breadcrumb-color-default: var(--color-text-block-primary-default);
63
65
  --ui3n-breadcrumb-color-selected: var(--color-text-block-accent-default);
64
66
 
@@ -70,14 +72,14 @@
70
72
  .separator {
71
73
  display: flex;
72
74
  align-items: center;
73
- margin: 0 var(--spacing-s);
75
+ margin: 0 var(--ui3n-breadcrumb-separator-distance);
74
76
  }
75
77
 
76
78
  .ui3nBreadcrumbActive {
77
79
  font-size: var(--ui3n-breadcrumb-font-size);
78
80
  line-height: 1.25;
79
81
  color: var(--ui3n-breadcrumb-color-default);
80
- padding-right: var(--spacing-xs);
82
+ padding-right: var(--ui3n-breadcrumb-padding-inline);
81
83
 
82
84
  &:hover {
83
85
  cursor: pointer;
@@ -90,7 +92,7 @@
90
92
  }
91
93
 
92
94
  .ui3nBreadcrumbSeparator {
93
- padding-left: var(--spacing-xs);
95
+ padding-left: var(--ui3n-breadcrumb-padding-inline);
94
96
  }
95
97
 
96
98
  .ui3nBreadcrumbDisabled {
@@ -1,6 +1,8 @@
1
- import type { VNode } from 'vue';
1
+ import type { ButtonHTMLAttributes, VNode } from 'vue';
2
2
 
3
- export interface Ui3nButtonProps {
3
+ export interface Ui3nButtonProps extends /*@vue-ignore */ Omit<ButtonHTMLAttributes, 'type'> {
4
+ /** Root element id*/
5
+ id?: string;
4
6
  /** Button type */
5
7
  type?: 'primary' | 'secondary' | 'tertiary' | 'outline' | 'icon' | 'custom';
6
8
  /** Button size */
@@ -104,6 +104,7 @@
104
104
  <button
105
105
  ref="buttonEl"
106
106
  v-ui3n-ripple
107
+ :id="id"
107
108
  :class="mainCssClasses"
108
109
  type="button"
109
110
  :disabled="disabled"
@@ -135,12 +136,16 @@
135
136
  .ui3nButton {
136
137
  --ui3n-button-height: 32px;
137
138
  --ui3n-button-border-radius: calc(var(--ui3n-button-height) / 2);
139
+ --ui3n-button-gap: 4px;
138
140
  --ui3n-button-outline-color: transparent;
139
- --ui3n-button-padding: 0 var(--spacing-m);
140
- --ui3n-button-padding-when-icon: var(--spacing-s);
141
- --ui3n-button-text-size: var(--font-12);
141
+ --ui3n-button-padding: 0 16px;
142
+ --ui3n-button-padding-when-icon: 8px;
143
+ --ui3n-button-text-size: 12px;
142
144
  --ui3n-button-text-color: var(--color-text-button-primary-default);
143
145
  --ui3n-button-bg-color: var(--color-bg-button-primary-default);
146
+ --ui3n-button-icon-small: 24px;
147
+ --ui3n-button-icon-regular: 32px;
148
+ --ui3n-button-icon-large: 48px;
144
149
 
145
150
  position: relative;
146
151
  width: max-content;
@@ -149,7 +154,7 @@
149
154
  display: flex;
150
155
  justify-content: center;
151
156
  align-items: center;
152
- column-gap: var(--spacing-xs);
157
+ column-gap: var(--ui3n-button-gap);
153
158
  border: none;
154
159
  border-radius: var(--ui3n-button-border-radius);
155
160
  outline: 2px solid var(--ui3n-button-outline-color);
@@ -182,23 +187,23 @@
182
187
 
183
188
  .regular {
184
189
  --ui3n-button-height: 32px;
185
- --ui3n-button-padding: 0 var(--spacing-m);
186
- --ui3n-button-padding-when-icon: var(--spacing-s);
187
- --ui3n-button-text-size: var(--font-12);
190
+ --ui3n-button-padding: 0 16px;
191
+ --ui3n-button-padding-when-icon: 8px;
192
+ --ui3n-button-text-size: 12px;
188
193
  }
189
194
 
190
195
  .small {
191
196
  --ui3n-button-height: 24px;
192
- --ui3n-button-padding: 0 var(--spacing-s);
193
- --ui3n-button-padding-when-icon: var(--spacing-xs);
194
- --ui3n-button-text-size: var(--font-12);
197
+ --ui3n-button-padding: 0 8px;
198
+ --ui3n-button-padding-when-icon: 4px;
199
+ --ui3n-button-text-size: 12px;
195
200
  }
196
201
 
197
202
  .large {
198
203
  --ui3n-button-height: 48px;
199
- --ui3n-button-padding: 0 var(--spacing-m);
200
- --ui3n-button-padding-when-icon: var(--spacing-s);
201
- --ui3n-button-text-size: var(--font-15);
204
+ --ui3n-button-padding: 0 16px;
205
+ --ui3n-button-padding-when-icon: 8px;
206
+ --ui3n-button-text-size: 15px;
202
207
  }
203
208
 
204
209
  .block {
@@ -534,18 +539,18 @@
534
539
  }
535
540
 
536
541
  &.regular {
537
- min-width: var(--spacing-l);
538
- width: var(--spacing-l);
542
+ min-width: var(--ui3n-button-icon-regular);
543
+ width: var(--ui3n-button-icon-regular);
539
544
  }
540
545
 
541
546
  &.small {
542
- min-width: var(--spacing-ml);
543
- width: var(--spacing-ml);
547
+ min-width: var(--ui3n-button-icon-small);
548
+ width: var(--ui3n-button-icon-small);
544
549
  }
545
550
 
546
551
  &.large {
547
- min-width: var(--spacing-xxl);
548
- width: var(--spacing-xxl);
552
+ min-width: var(--ui3n-button-icon-large);
553
+ width: var(--ui3n-button-icon-large);
549
554
  }
550
555
  }
551
556
 
@@ -9,6 +9,14 @@ export type Ui3nCheckboxValue = boolean | string | number;
9
9
  * Checkbox component properties
10
10
  */
11
11
  export interface Ui3nCheckboxProps {
12
+ /**
13
+ * Root element id
14
+ */
15
+ id?: string;
16
+ /**
17
+ * HTML name attribute for form submission
18
+ */
19
+ name?: string;
12
20
  /**
13
21
  * Current checkbox value
14
22
  */
@@ -64,3 +72,7 @@ export interface Ui3nCheckboxSlots {
64
72
  */
65
73
  default: () => VNode;
66
74
  }
75
+
76
+ export interface Ui3nCheckboxExpose {
77
+ clear: () => void;
78
+ }
@@ -1,8 +1,18 @@
1
1
  <script lang="ts" setup>
2
2
  import { computed, onMounted, watch, onBeforeMount, ref, useCssModule, useSlots } from 'vue';
3
- import type { Ui3nCheckboxEmits, Ui3nCheckboxProps, Ui3nCheckboxSlots, Ui3nCheckboxValue } from './types';
3
+ import Ui3nRipple from '../../directives/ui3n-ripple';
4
+ import type {
5
+ Ui3nCheckboxEmits,
6
+ Ui3nCheckboxProps,
7
+ Ui3nCheckboxSlots,
8
+ Ui3nCheckboxValue,
9
+ Ui3nCheckboxExpose,
10
+ } from './types';
11
+
12
+ const vUi3nRipple = Ui3nRipple;
4
13
 
5
14
  const props = withDefaults(defineProps<Ui3nCheckboxProps>(), {
15
+ name: undefined,
6
16
  modelValue: false,
7
17
  checkedValue: true,
8
18
  uncheckedValue: false,
@@ -29,6 +39,13 @@
29
39
  return val.value === props.checkedValue ? 'checked' : 'unchecked';
30
40
  });
31
41
 
42
+ const nativeInputValue = computed(() => {
43
+ if (typeof val.value === 'boolean') {
44
+ return val.value ? 'on' : '';
45
+ }
46
+ return String(val.value);
47
+ });
48
+
32
49
  const mainCssClasses = computed(() => {
33
50
  const val = [$css.ui3nCheckbox];
34
51
 
@@ -46,26 +63,40 @@
46
63
  return val;
47
64
  });
48
65
 
49
- onBeforeMount(() => {
50
- const checkedValueType = typeof props.checkedValue;
51
- const uncheckedValueType = typeof props.uncheckedValue;
52
- const valueType = typeof props.modelValue;
53
- if (
54
- checkedValueType !== uncheckedValueType ||
55
- checkedValueType !== valueType ||
56
- uncheckedValueType !== valueType
57
- ) {
58
- throw Error('[Ui3nCheckbox] types of "value", "checkedValue" and "uncheckedValue" are different');
59
- }
60
- });
66
+ function change(ev: Event) {
67
+ ev.preventDefault();
61
68
 
62
- onMounted(() => {
63
- if (checkboxEl.value) {
64
- checkboxEl.value.style.setProperty('--ui3n-checkbox-size', `${props.size}px`);
65
- checkboxEl.value.style.setProperty('--ui3n-checkbox-color', props.color);
69
+ val.value = checkBoxValue.value !== 'unchecked' ? props.uncheckedValue : props.checkedValue;
70
+
71
+ if (uncertain.value) {
72
+ uncertain.value = false;
66
73
  }
74
+
75
+ emits('change', val.value);
76
+ emits('update:modelValue', val.value);
77
+ }
78
+
79
+ function clear() {
80
+ val.value = props.uncheckedValue;
81
+ uncertain.value = false;
82
+
83
+ emits('change', val.value);
84
+ emits('update:modelValue', val.value);
85
+ }
86
+
87
+ defineExpose<Ui3nCheckboxExpose>({
88
+ clear,
67
89
  });
68
90
 
91
+ watch(
92
+ () => props.name,
93
+ newName => {
94
+ if (!newName) {
95
+ clear();
96
+ }
97
+ },
98
+ );
99
+
69
100
  watch(
70
101
  () => props.modelValue,
71
102
  newValue => (val.value = newValue),
@@ -96,26 +127,45 @@
96
127
  },
97
128
  );
98
129
 
99
- function change(ev: Event) {
100
- ev.preventDefault();
101
-
102
- val.value = checkBoxValue.value !== 'unchecked' ? props.uncheckedValue : props.checkedValue;
103
-
104
- if (uncertain.value) {
105
- uncertain.value = false;
130
+ onBeforeMount(() => {
131
+ const checkedValueType = typeof props.checkedValue;
132
+ const uncheckedValueType = typeof props.uncheckedValue;
133
+ const valueType = typeof props.modelValue;
134
+ if (
135
+ checkedValueType !== uncheckedValueType ||
136
+ checkedValueType !== valueType ||
137
+ uncheckedValueType !== valueType
138
+ ) {
139
+ throw Error('[Ui3nCheckbox] types of "value", "checkedValue" and "uncheckedValue" are different');
106
140
  }
141
+ });
107
142
 
108
- emits('change', val.value);
109
- emits('update:modelValue', val.value);
110
- }
143
+ onMounted(() => {
144
+ if (checkboxEl.value) {
145
+ checkboxEl.value.style.setProperty('--ui3n-checkbox-size', `${props.size}px`);
146
+ checkboxEl.value.style.setProperty('--ui3n-checkbox-color', props.color);
147
+ }
148
+ });
111
149
  </script>
112
150
 
113
151
  <template>
114
152
  <div
115
153
  ref="checkboxEl"
154
+ :id="id"
116
155
  :class="mainCssClasses"
117
156
  >
157
+ <input
158
+ type="checkbox"
159
+ style="display: none"
160
+ :name="name"
161
+ :id="id ? `${id}-native` : undefined"
162
+ :disabled="disabled"
163
+ :checked="checkBoxValue !== 'unchecked'"
164
+ :value="nativeInputValue"
165
+ />
166
+
118
167
  <div
168
+ v-ui3n-ripple
119
169
  :class="bodyCssClasses"
120
170
  :tabindex="disabled ? -1 : 0"
121
171
  @keydown.space="change"
@@ -195,6 +245,7 @@
195
245
 
196
246
  .ui3nCheckbox {
197
247
  --ui3n-checkbox-size: 16px;
248
+ --ui3n-checkbox-gap: 4px;
198
249
  --ui3n-checkbox-color: var(--color-icon-control-accent-default);
199
250
  --ui3n-checkbox-text-size: 12px;
200
251
  --ui3n-checkbox-text-color: var(--color-text-control-primary-default);
@@ -204,8 +255,7 @@
204
255
  display: flex;
205
256
  justify-content: flex-start;
206
257
  align-items: center;
207
- min-height: var(--spacing-m);
208
- gap: var(--spacing-s);
258
+ gap: var(--ui3n-checkbox-gap);
209
259
  }
210
260
 
211
261
  .noLabel {
@@ -4,6 +4,10 @@ import { VNode } from 'vue';
4
4
  * Chip component properties
5
5
  */
6
6
  export interface Ui3nChipProps {
7
+ /**
8
+ * Root element id
9
+ */
10
+ id?: string;
7
11
  /**
8
12
  * Chip height
9
13
  */
@@ -53,7 +57,8 @@ export interface Ui3nChipEmits {
53
57
  /**
54
58
  * Called when chip is closed
55
59
  */
56
- (ev: 'close'): void;
60
+ (event: 'close'): void;
61
+ (event: 'click', value: MouseEvent): void;
57
62
  }
58
63
 
59
64
  /**