@v1nt1248/3nclient-lib 0.3.30 → 0.3.32

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 (75) hide show
  1. package/dist/chunks/{ui3n-notification-Dr_3Td9N.js → ui3n-notification-DPC5Ke4b.js} +96 -97
  2. package/dist/components/index.d.ts +3 -3
  3. package/dist/components/ui3n-breadcrumbs/types.d.ts +2 -0
  4. package/dist/components/ui3n-dialog/types.d.ts +1 -1
  5. package/dist/components/ui3n-editable/types.d.ts +1 -1
  6. package/dist/components/ui3n-editable/ui3n-editable.d.ts +1 -1
  7. package/dist/components/ui3n-editable/useContentEditable.d.ts +1 -1
  8. package/dist/components/ui3n-input/types.d.ts +2 -2
  9. package/dist/components/ui3n-menu/types.d.ts +16 -1
  10. package/dist/components/ui3n-menu/ui3n-menu.d.ts +2 -0
  11. package/dist/components/ui3n-mobile-menu/ui3n-mobile-menu.d.ts +2 -2
  12. package/dist/components/ui3n-notification/types.d.ts +0 -4
  13. package/dist/components/ui3n-notification/ui3n-notification-container.d.ts +11 -0
  14. package/dist/components/ui3n-notification/ui3n-notification.d.ts +1 -1
  15. package/dist/components/ui3n-progress/ui3n-progress-circular.d.ts +3 -3
  16. package/dist/components/ui3n-progress/ui3n-progress-linear.d.ts +2 -0
  17. package/dist/components/ui3n-selector/types.d.ts +1 -11
  18. package/dist/components/ui3n-step-line-bar/ui3n-step-line-bar.d.ts +1 -0
  19. package/dist/components/ui3n-switch/ui3n-switch.d.ts +2 -6
  20. package/dist/components/ui3n-table/composables/useTable.d.ts +4 -3
  21. package/dist/components/ui3n-text/ui3n-text.d.ts +1 -0
  22. package/dist/components/ui3n-tooltip/ui3n-tooltip.d.ts +1 -0
  23. package/dist/index.d.ts +1 -1
  24. package/dist/plugins/dialogs/dialogs.d.ts +2 -2
  25. package/dist/plugins/dialogs/store-dialog.d.ts +2 -2
  26. package/dist/plugins/dialogs/types.d.ts +1 -1
  27. package/dist/plugins/notifications/store-notifications.d.ts +1 -1
  28. package/dist/plugins/notifications/types.d.ts +1 -1
  29. package/dist/style.css +1 -1
  30. package/dist/ui3n-components.d.ts +1 -1
  31. package/dist/ui3n-components.js +1402 -1392
  32. package/dist/ui3n-plugins.d.ts +5 -5
  33. package/dist/ui3n-plugins.js +56 -43
  34. package/dist/utils/files/create-video-thumbnail.d.ts +1 -1
  35. package/dist/utils/for-vue/try-on-scope-dispose.d.ts +1 -1
  36. package/dist/utils/for-vue/unref-element.d.ts +1 -1
  37. package/dist/utils/processes/scheduler-yield.d.ts +1 -1
  38. package/dist/utils/processes/task-runner.d.ts +1 -1
  39. package/package.json +2 -2
  40. package/src/components/index.ts +9 -2
  41. package/src/components/ui3n-autocomplete/ui3n-autocomplete.vue +2 -1
  42. package/src/components/ui3n-breadcrumbs/types.ts +2 -0
  43. package/src/components/ui3n-breadcrumbs/ui3n-breadcrumb.vue +45 -35
  44. package/src/components/ui3n-breadcrumbs/ui3n-breadcrumbs.vue +12 -1
  45. package/src/components/ui3n-checkbox/ui3n-checkbox.vue +33 -67
  46. package/src/components/ui3n-editable/ui3n-editable.vue +68 -46
  47. package/src/components/ui3n-emoji/ui3n-emoji.vue +21 -27
  48. package/src/components/ui3n-icon/ui3n-icon.vue +13 -5
  49. package/src/components/ui3n-input/types.ts +2 -2
  50. package/src/components/ui3n-input/ui3n-input.vue +15 -9
  51. package/src/components/ui3n-menu/types.ts +19 -1
  52. package/src/components/ui3n-menu/ui3n-menu.vue +60 -57
  53. package/src/components/ui3n-mobile-menu/ui3n-mobile-menu.vue +87 -38
  54. package/src/components/ui3n-notification/types.ts +0 -4
  55. package/src/components/ui3n-notification/ui3n-notification-container.vue +62 -0
  56. package/src/components/ui3n-notification/ui3n-notification.vue +74 -70
  57. package/src/components/ui3n-progress/ui3n-progress-circular.vue +80 -120
  58. package/src/components/ui3n-progress/ui3n-progress-linear.vue +32 -15
  59. package/src/components/ui3n-radio-group/ui3n-radio-group.vue +2 -1
  60. package/src/components/ui3n-radio-group/ui3n-radio.vue +38 -47
  61. package/src/components/ui3n-scrollbar-horizontal/{ui3n-scroolbar-horizontal.vue → ui3n-scrollbar-horizontal.vue} +6 -8
  62. package/src/components/ui3n-scrollbar-vertical/ui3n-scrollbar-vertical.vue +10 -6
  63. package/src/components/ui3n-selector/types.ts +1 -10
  64. package/src/components/ui3n-selector/ui3n-selector.vue +49 -47
  65. package/src/components/ui3n-slider/ui3n-slider.vue +6 -9
  66. package/src/components/ui3n-step-line-bar/ui3n-step-line-bar.vue +5 -1
  67. package/src/components/ui3n-switch/ui3n-switch.vue +24 -19
  68. package/src/components/ui3n-table/composables/useTable.ts +37 -22
  69. package/src/components/ui3n-table/ui3n-table-sort-icon.vue +6 -1
  70. package/src/components/ui3n-table/ui3n-table.vue +3 -1
  71. package/src/components/ui3n-tabs/ui3n-tabs.vue +0 -23
  72. package/src/components/ui3n-text/ui3n-text.vue +36 -8
  73. package/src/components/ui3n-tooltip/ui3n-tooltip.vue +39 -18
  74. package/src/components/ui3n-virtual-scroll/ui3n-virtual-scroll.vue +2 -2
  75. /package/dist/components/ui3n-scrollbar-horizontal/{ui3n-scroolbar-horizontal.d.ts → ui3n-scrollbar-horizontal.d.ts} +0 -0
@@ -1,10 +1,10 @@
1
1
  import { Component, Ref } from 'vue';
2
- import { ExtractComponentProps } from './types';
3
- import { Ui3nNotificationProps } from './components/ui3n-notification/types';
4
- import { Ui3nDialogEvent } from './components/ui3n-dialog/types';
5
- import { notifications, storeNotifications, NotificationsPlugin, dialogs, storeDialogs, DialogOptions, DialogsPlugin, vueBus, storeVueBus, VueBusPlugin } from './plugins';
2
+ import { ExtractComponentProps } from '../types';
3
+ import { Ui3nNotificationProps } from '../components/ui3n-notification/types';
4
+ import { Ui3nDialogEvent } from '../components/ui3n-dialog/types';
5
+ import { notifications, storeNotifications, NotificationsPlugin, dialogs, storeDialogs, DialogOptions, DialogsPlugin, vueBus, storeVueBus, VueBusPlugin } from '../plugins';
6
6
  import { CbFunction, VueEventBus } from './plugins/vue-bus/types';
7
- import { NOTIFICATIONS_KEY, DIALOGS_KEY, VUEBUS_KEY } from './constants';
7
+ import { NOTIFICATIONS_KEY, DIALOGS_KEY, VUEBUS_KEY } from '../constants';
8
8
  declare module 'vue' {
9
9
  interface ComponentCustomProperties {
10
10
  $openDialog: <V>(component: Component, props: ExtractComponentProps<Component>) => Promise<{
@@ -1,51 +1,64 @@
1
1
  import { B as e, n as t, r as n, t as r } from "./chunks/plugins-keys-jqAZ5D94.js";
2
- import { t as i } from "./chunks/ui3n-notification-Dr_3Td9N.js";
3
- import { createApp as a, markRaw as o, ref as s } from "vue";
2
+ import { i, t as a } from "./chunks/ui3n-notification-DPC5Ke4b.js";
3
+ import { Fragment as o, createApp as s, createBlock as c, createElementBlock as l, defineComponent as u, markRaw as d, mergeProps as f, normalizeClass as p, openBlock as m, ref as h, renderList as g } from "vue";
4
4
  import "pinia";
5
- import c from "mitt";
6
- //#region src/plugins/notifications/notifications.ts
7
- var l = { install: (n) => {
8
- let r = (t) => {
9
- let n = document.createElement("div"), r = !t.teleport || t.teleport === "body" ? document.body : document.querySelector(t.teleport), o = t.duration ?? 1500;
10
- if (r) {
11
- let s = a(i, {
12
- id: e(6),
13
- content: t.content,
14
- ...t.type && { type: t.type },
15
- ...t.position && { position: t.position },
16
- ...t.withIcon && { withIcon: t.withIcon },
17
- ...t.onOpen && { onOpen: t.onOpen },
18
- duration: o,
19
- onClose: () => {
20
- c.$el.remove(), s && s.unmount && s.unmount();
21
- }
22
- }), c = s.mount(n);
23
- r.appendChild(c.$el), o && setTimeout(() => {
24
- c.$el.remove(), s && s.unmount && s.unmount();
25
- }, o);
5
+ import _ from "mitt";
6
+ var v = /* @__PURE__ */ i(/* @__PURE__ */ u({
7
+ __name: "ui3n-notification-container",
8
+ setup(e, { expose: t }) {
9
+ let n = h([]);
10
+ function r(e) {
11
+ n.value.push(e);
26
12
  }
13
+ function i(e) {
14
+ n.value = n.value.filter((t) => t.id !== e);
15
+ }
16
+ function s(e) {
17
+ e.onClose && e.onClose(), i(e.id);
18
+ }
19
+ return t({
20
+ add: r,
21
+ remove: i
22
+ }), (e, t) => (m(), l("div", {
23
+ id: "ui3n-notifications-container",
24
+ class: p(e.$style.ui3nNotificationsWrapper)
25
+ }, [(m(!0), l(o, null, g(n.value, (e) => (m(), c(a, f({ key: e.id }, { ref_for: !0 }, e, { "on-close": () => s(e) }), null, 16, ["on-close"]))), 128))], 2));
26
+ }
27
+ }), [["__cssModules", { $style: { ui3nNotificationsWrapper: "_ui3nNotificationsWrapper_3itgd_1" } }]]), y = { install: (n) => {
28
+ if (typeof window > "u") return;
29
+ let r = document.createElement("div");
30
+ document.body.appendChild(r);
31
+ let i = s(v);
32
+ i._context.provides = n._context.provides;
33
+ let a = i.mount(r), o = (t) => {
34
+ let n = t.id || e(6), r = t.duration === void 0 ? 1500 : t.duration;
35
+ a.add({
36
+ ...t,
37
+ id: n,
38
+ duration: r
39
+ });
27
40
  };
28
- n.config.globalProperties.$createNotice = r, n.provide(t, { $createNotice: r });
29
- } }, u = c(), d = {
30
- on: u.on.bind(u),
41
+ n.config.globalProperties.$createNotice = o, n.provide(t, { $createNotice: o });
42
+ } }, b = _(), x = {
43
+ on: b.on.bind(b),
31
44
  once: (e, t) => {
32
45
  function n() {
33
- u.off(e, n), t.apply(null, arguments);
46
+ b.off(e, n), t.apply(null, arguments);
34
47
  }
35
- u.on(e, n);
48
+ b.on(e, n);
36
49
  },
37
- off: u.off.bind(u),
38
- emit: u.emit.bind(u),
39
- clear: u.all.clear.bind(u)
40
- }, f = { install: (e) => {
41
- e.config.globalProperties.$emitter = d, e.provide(n, { $emitter: d });
42
- } }, p = { install(t) {
43
- let n = s([]);
50
+ off: b.off.bind(b),
51
+ emit: b.emit.bind(b),
52
+ clear: b.all.clear.bind(b)
53
+ }, S = { install: (e) => {
54
+ e.config.globalProperties.$emitter = x, e.provide(n, { $emitter: x });
55
+ } }, C = { install(t) {
56
+ let n = h([]);
44
57
  function i(t, r) {
45
58
  return new Promise((i) => {
46
59
  n.value.push({
47
60
  id: e(5),
48
- component: o(t),
61
+ component: d(t),
49
62
  props: r,
50
63
  resolve: i
51
64
  });
@@ -55,36 +68,36 @@ var l = { install: (n) => {
55
68
  let r = n.value.findIndex((t) => t.id === e);
56
69
  r !== -1 && (n.value[r].resolve(t), n.value.splice(r, 1));
57
70
  }
58
- function c() {
71
+ function o() {
59
72
  n.value = [];
60
73
  }
61
74
  t.config.globalProperties.$dialog = {
62
75
  dialogStack: n,
63
76
  $openDialog: i,
64
77
  $closeDialog: a,
65
- $closeDialogs: c
78
+ $closeDialogs: o
66
79
  }, t.provide(r, {
67
80
  dialogStack: n,
68
81
  $openDialog: i,
69
82
  $closeDialog: a,
70
- $closeDialogs: c
83
+ $closeDialogs: o
71
84
  });
72
85
  } };
73
86
  //#endregion
74
87
  //#region src/plugins/notifications/store-notifications.ts
75
- function m(e) {
88
+ function w(e) {
76
89
  let { app: t = {} } = e, { config: n = {} } = t, { globalProperties: r = {} } = n, { $createNotice: i } = r;
77
90
  return { $createNotice: i };
78
91
  }
79
92
  //#endregion
80
93
  //#region src/plugins/vue-bus/store-vue-bus.ts
81
- function h(e) {
94
+ function T(e) {
82
95
  let { app: t = {} } = e, { config: n = {} } = t, { globalProperties: r = {} } = n, { $emitter: i } = r;
83
96
  return { $emitter: i };
84
97
  }
85
98
  //#endregion
86
99
  //#region src/plugins/dialogs/store-dialog.ts
87
- function g(e) {
100
+ function E(e) {
88
101
  let { app: t = {} } = e, { config: n = {} } = t, { globalProperties: r = {} } = n, { $dialog: i } = r;
89
102
  return { $dialogs: {
90
103
  open: i.$openDialog,
@@ -94,4 +107,4 @@ function g(e) {
94
107
  } };
95
108
  }
96
109
  //#endregion
97
- export { r as DIALOGS_KEY, t as NOTIFICATIONS_KEY, n as VUEBUS_KEY, p as dialogs, l as notifications, g as storeDialogs, m as storeNotifications, h as storeVueBus, f as vueBus };
110
+ export { r as DIALOGS_KEY, t as NOTIFICATIONS_KEY, n as VUEBUS_KEY, C as dialogs, y as notifications, E as storeDialogs, w as storeNotifications, T as storeVueBus, S as vueBus };
@@ -1,2 +1,2 @@
1
- import { Nullable } from '../../types';
1
+ import { Nullable } from '../../../types';
2
2
  export declare function createVideoThumbnail(file: File, targetSize: number, seekTo: number): Promise<Nullable<string>>;
@@ -1,2 +1,2 @@
1
- import { Fn } from '../../types';
1
+ import { Fn } from '../../../types';
2
2
  export declare function tryOnScopeDispose(fn: Fn): boolean;
@@ -1,2 +1,2 @@
1
- import { MaybeComputedElementRef, MaybeElement, UnRefElementReturn } from '../../types';
1
+ import { MaybeComputedElementRef, MaybeElement, UnRefElementReturn } from '../../../types';
2
2
  export declare function unrefElement<T extends MaybeElement>(elRef: MaybeComputedElementRef<T>): UnRefElementReturn<T>;
@@ -1 +1 @@
1
- export declare function schedulerYield(): any;
1
+ export declare function schedulerYield(): Promise<unknown>;
@@ -1,4 +1,4 @@
1
- import { Task, TaskRunnerInstance } from '../../types';
1
+ import { Task, TaskRunnerInstance } from '../../../types';
2
2
  export declare class TaskRunner implements TaskRunnerInstance {
3
3
  private readonly maxNumberOfRunners;
4
4
  private arrayOfTasks;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@v1nt1248/3nclient-lib",
3
3
  "license": "AGPL-3.0-or-later",
4
4
  "author": "v1nt1248",
5
- "version": "0.3.30",
5
+ "version": "0.3.32",
6
6
  "description": "Library for 3NWeb clients",
7
7
  "type": "module",
8
8
  "files": [
@@ -89,7 +89,7 @@
89
89
  "stylelint-config-standard": "39.0.1",
90
90
  "stylelint-scss": "7.1.1",
91
91
  "tslib": "2.8.1",
92
- "typescript": "5.9.3",
92
+ "typescript": "6.0.3",
93
93
  "typescript-eslint": "8.60.0",
94
94
  "vite": "8.0.14",
95
95
  "vite-plugin-css-injected-by-js": "4.0.1",
@@ -57,7 +57,13 @@ import type {
57
57
  Ui3nDialogEvent,
58
58
  } from './ui3n-dialog/types';
59
59
  import Ui3nMenu from './ui3n-menu/ui3n-menu.vue';
60
- import type { Ui3nMenuProps, Ui3nMenuEmits, Ui3nMenuSlots, Ui3nMenuExpose } from './ui3n-menu/types';
60
+ import type {
61
+ Ui3nVirtualElement,
62
+ Ui3nMenuProps,
63
+ Ui3nMenuEmits,
64
+ Ui3nMenuSlots,
65
+ Ui3nMenuExpose,
66
+ } from './ui3n-menu/types';
61
67
  import Ui3nList from './ui3n-list/ui3n-list.vue';
62
68
  import type { Ui3nListProps, Ui3nListEmits, Ui3nListSlots } from './ui3n-list/types';
63
69
  import Ui3nVirtualScroll from './ui3n-virtual-scroll/ui3n-virtual-scroll.vue';
@@ -137,7 +143,7 @@ import type {
137
143
  Ui3nScrollbarVerticalSlots,
138
144
  Ui3nScrollbarVerticalExpose,
139
145
  } from './ui3n-scrollbar-vertical/types';
140
- import Ui3nScrollbarHorizontal from './ui3n-scrollbar-horizontal/ui3n-scroolbar-horizontal.vue';
146
+ import Ui3nScrollbarHorizontal from './ui3n-scrollbar-horizontal/ui3n-scrollbar-horizontal.vue';
141
147
  import type {
142
148
  Ui3nScrollbarHorizontalProps,
143
149
  Ui3nScrollbarHorizontalEmits,
@@ -208,6 +214,7 @@ export {
208
214
  Ui3nDialogComponentSlots,
209
215
  Ui3nDialogEvent,
210
216
  Ui3nMenu,
217
+ Ui3nVirtualElement,
211
218
  Ui3nMenuProps,
212
219
  Ui3nMenuEmits,
213
220
  Ui3nMenuSlots,
@@ -489,8 +489,9 @@
489
489
  .input {
490
490
  border-radius: var(--ui3n-autocomplete-border-radius);
491
491
  padding: 0 var(--ui3n-autocomplete-padding-inline);
492
- flex-grow: 1;
492
+ flex: 1 1 60px;
493
493
  height: var(--ui3n-autocomplete-min-height);
494
+ width: 100%;
494
495
  font-size: var(--ui3n-autocomplete-font-size);
495
496
  line-height: var(--ui3n-autocomplete-min-height);
496
497
  font-weight: 400;
@@ -65,6 +65,8 @@ export interface Ui3nBreadcrumbsProps {
65
65
  * Breadcrumbs component slots
66
66
  */
67
67
  export interface Ui3nBreadcrumbsSlots {
68
+ /** Global separator slot for the entire chain */
69
+ separator?: () => VNode;
68
70
  /**
69
71
  * Default slot
70
72
  */
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { computed, getCurrentInstance, useCssModule } from 'vue';
2
+ import { computed, inject, useCssModule, useSlots } from 'vue';
3
3
  import type { Ui3nBreadcrumbEmits, Ui3nBreadcrumbProps, Ui3nBreadcrumbSlots } from './types';
4
4
 
5
5
  const props = withDefaults(defineProps<Ui3nBreadcrumbProps>(), {
@@ -7,30 +7,29 @@
7
7
  isActive: false,
8
8
  disabled: false,
9
9
  });
10
+
10
11
  const emits = defineEmits<Ui3nBreadcrumbEmits>();
12
+
13
+ const slots = useSlots();
11
14
  defineSlots<Ui3nBreadcrumbSlots>();
12
15
 
13
16
  const $css = useCssModule();
14
17
 
15
- const separatorValue = computed(() => {
16
- if (props.separator) {
17
- return props.separator;
18
- }
18
+ const parentContext = inject<any>('ui3n-breadcrumbs-context', null);
19
19
 
20
- const instance = getCurrentInstance();
21
- return instance?.parent?.props.separator || '/';
20
+ const separatorValue = computed(() => {
21
+ if (props.separator) return props.separator;
22
+ return parentContext ? parentContext.separator() : '/';
22
23
  });
23
24
 
24
25
  const parentDisabled = computed(() => {
25
- const instance = getCurrentInstance();
26
- return instance?.parent?.props.disabled || false;
26
+ return parentContext ? parentContext.disabled() : false;
27
27
  });
28
28
 
29
29
  const cssClasses = computed(() => {
30
30
  const val = [$css.ui3nBreadcrumb];
31
31
  props.isActive && val.push($css.ui3nBreadcrumbActive);
32
32
  (props.disabled || parentDisabled.value) && val.push($css.ui3nBreadcrumbDisabled);
33
-
34
33
  return val;
35
34
  });
36
35
 
@@ -44,14 +43,22 @@
44
43
  :class="cssClasses"
45
44
  v-on="isActive && !(disabled || parentDisabled) ? { click: onClick } : {}"
46
45
  >
47
- <slot />
48
- <div
49
- v-if="isActive"
50
- :class="$style.ui3nBreadcrumbSeparator"
51
- >
52
- <slot name="separator">
53
- <span>{{ separatorValue }}</span>
54
- </slot>
46
+ <span :class="$style.content">
47
+ <slot />
48
+ </span>
49
+
50
+ <div :class="$style.ui3nBreadcrumbSeparator">
51
+ <slot
52
+ v-if="typeof slots.separator === 'function'"
53
+ name="separator"
54
+ />
55
+
56
+ <component
57
+ v-else-if="parentContext?.customSeparatorSlot"
58
+ :is="parentContext.customSeparatorSlot"
59
+ />
60
+
61
+ <span v-else>{{ separatorValue }}</span>
55
62
  </div>
56
63
  </div>
57
64
  </template>
@@ -64,39 +71,42 @@
64
71
  --ui3n-breadcrumb-color-default: var(--color-text-block-primary-default);
65
72
  --ui3n-breadcrumb-color-selected: var(--color-text-block-accent-default);
66
73
 
67
- position: relative;
68
74
  display: flex;
69
75
  align-items: center;
70
- }
71
76
 
72
- .separator {
73
- display: flex;
74
- align-items: center;
75
- margin: 0 var(--ui3n-breadcrumb-separator-distance);
77
+ &:last-child {
78
+ .ui3nBreadcrumbSeparator {
79
+ display: none !important;
80
+ }
81
+ }
76
82
  }
77
83
 
78
- .ui3nBreadcrumbActive {
84
+ .content {
79
85
  font-size: var(--ui3n-breadcrumb-font-size);
80
86
  line-height: 1.25;
81
87
  color: var(--ui3n-breadcrumb-color-default);
82
- padding-right: var(--ui3n-breadcrumb-padding-inline);
83
-
84
- &:hover {
85
- cursor: pointer;
86
- color: var(--ui3n-breadcrumb-color-selected);
87
-
88
- .ui3nBreadcrumbSeparator {
89
- color: var(--ui3n-breadcrumb-color-default);
90
- }
91
- }
92
88
  }
93
89
 
94
90
  .ui3nBreadcrumbSeparator {
91
+ display: flex;
92
+ align-items: center;
93
+ margin: 0 var(--ui3n-breadcrumb-separator-distance);
95
94
  padding-left: var(--ui3n-breadcrumb-padding-inline);
95
+ color: var(--color-text-block-tertiary-default);
96
+ }
97
+
98
+ .ui3nBreadcrumbActive {
99
+ .content {
100
+ &:hover {
101
+ cursor: pointer;
102
+ color: var(--ui3n-breadcrumb-color-selected);
103
+ }
104
+ }
96
105
  }
97
106
 
98
107
  .ui3nBreadcrumbDisabled {
99
108
  cursor: default;
100
109
  pointer-events: none;
110
+ opacity: 0.6;
101
111
  }
102
112
  </style>
@@ -1,12 +1,20 @@
1
1
  <script lang="ts" setup>
2
+ import { provide, useSlots } from 'vue';
2
3
  import type { Ui3nBreadcrumbsProps, Ui3nBreadcrumbsSlots } from './types';
3
4
 
4
- withDefaults(defineProps<Ui3nBreadcrumbsProps>(), {
5
+ const props = withDefaults(defineProps<Ui3nBreadcrumbsProps>(), {
5
6
  separator: '/',
6
7
  disabled: false,
7
8
  });
8
9
 
10
+ const slots = useSlots();
9
11
  defineSlots<Ui3nBreadcrumbsSlots>();
12
+
13
+ provide('ui3n-breadcrumbs-context', {
14
+ separator: () => props.separator,
15
+ disabled: () => props.disabled,
16
+ customSeparatorSlot: slots.separator,
17
+ });
10
18
  </script>
11
19
 
12
20
  <template>
@@ -20,5 +28,8 @@
20
28
  position: relative;
21
29
  display: flex;
22
30
  flex-wrap: wrap;
31
+ align-items: center;
32
+ padding: 0;
33
+ margin: 0;
23
34
  }
24
35
  </style>
@@ -1,12 +1,12 @@
1
1
  <script lang="ts" setup>
2
- import { computed, onMounted, watch, onBeforeMount, ref, useCssModule, useSlots } from 'vue';
2
+ import { computed, onBeforeMount, ref, useCssModule, useSlots, watch } from 'vue';
3
3
  import Ui3nRipple from '../../directives/ui3n-ripple';
4
4
  import type {
5
5
  Ui3nCheckboxEmits,
6
+ Ui3nCheckboxExpose,
6
7
  Ui3nCheckboxProps,
7
8
  Ui3nCheckboxSlots,
8
9
  Ui3nCheckboxValue,
9
- Ui3nCheckboxExpose,
10
10
  } from './types';
11
11
 
12
12
  const vUi3nRipple = Ui3nRipple;
@@ -16,7 +16,7 @@
16
16
  modelValue: false,
17
17
  checkedValue: true,
18
18
  uncheckedValue: false,
19
- size: '16',
19
+ size: 16,
20
20
  color: 'var(--color-icon-control-accent-default)',
21
21
  indeterminate: false,
22
22
  disabled: false,
@@ -28,14 +28,14 @@
28
28
  const $css = useCssModule();
29
29
 
30
30
  const checkboxEl = ref<HTMLDivElement | null>(null);
31
- const val = ref<Ui3nCheckboxValue>(props.uncheckedValue || false);
32
- const uncertain = ref(false);
31
+
32
+ const val = ref<Ui3nCheckboxValue>(props.modelValue);
33
+ const uncertain = ref(props.indeterminate);
33
34
 
34
35
  const checkBoxValue = computed(() => {
35
36
  if (uncertain.value) {
36
37
  return 'indeterminate';
37
38
  }
38
-
39
39
  return val.value === props.checkedValue ? 'checked' : 'unchecked';
40
40
  });
41
41
 
@@ -46,21 +46,31 @@
46
46
  return String(val.value);
47
47
  });
48
48
 
49
+ const iconSizeInline = computed(() => {
50
+ const numericSize = parseFloat(String(props.size));
51
+ return isNaN(numericSize) ? 12 : numericSize - 4;
52
+ });
53
+
54
+ const inlineStyles = computed(() => ({
55
+ '--ui3n-checkbox-size': typeof props.size === 'number' ? `${props.size}px` : props.size,
56
+ '--ui3n-checkbox-color': props.color,
57
+ }));
58
+
49
59
  const mainCssClasses = computed(() => {
50
- const val = [$css.ui3nCheckbox];
60
+ const classes = [$css.ui3nCheckbox];
51
61
 
52
- props.disabled && val.push($css.disabled);
53
- !slots.default && val.push($css.noLabel);
62
+ props.disabled && classes.push($css.disabled);
63
+ !slots.default && classes.push($css.noLabel);
54
64
 
55
- return val;
65
+ return classes;
56
66
  });
57
67
 
58
68
  const bodyCssClasses = computed(() => {
59
- const val = [$css.ui3nCheckboxBody];
69
+ const classes = [$css.ui3nCheckboxBody];
60
70
 
61
- checkBoxValue.value === 'unchecked' ? val.push($css.unfilled) : val.push($css.filled);
71
+ checkBoxValue.value === 'unchecked' ? classes.push($css.unfilled) : classes.push($css.filled);
62
72
 
63
- return val;
73
+ return classes;
64
74
  });
65
75
 
66
76
  function change(ev: Event) {
@@ -100,31 +110,11 @@
100
110
  watch(
101
111
  () => props.modelValue,
102
112
  newValue => (val.value = newValue),
103
- { immediate: true },
104
113
  );
105
114
 
106
115
  watch(
107
116
  () => props.indeterminate,
108
117
  newValue => (uncertain.value = newValue),
109
- { immediate: true },
110
- );
111
-
112
- watch(
113
- () => props.size,
114
- newValue => {
115
- if (checkboxEl.value) {
116
- checkboxEl.value.style.setProperty('--ui3n-checkbox-size', `${newValue}px`);
117
- }
118
- },
119
- );
120
-
121
- watch(
122
- () => props.color,
123
- newValue => {
124
- if (checkboxEl.value) {
125
- checkboxEl.value.style.setProperty('--ui3n-checkbox-color', newValue);
126
- }
127
- },
128
118
  );
129
119
 
130
120
  onBeforeMount(() => {
@@ -139,13 +129,6 @@
139
129
  throw Error('[Ui3nCheckbox] types of "value", "checkedValue" and "uncheckedValue" are different');
140
130
  }
141
131
  });
142
-
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
- });
149
132
  </script>
150
133
 
151
134
  <template>
@@ -153,6 +136,7 @@
153
136
  ref="checkboxEl"
154
137
  :id="id"
155
138
  :class="mainCssClasses"
139
+ :style="inlineStyles"
156
140
  >
157
141
  <input
158
142
  type="checkbox"
@@ -174,22 +158,12 @@
174
158
  >
175
159
  <svg
176
160
  v-if="checkBoxValue === 'checked'"
177
- :width="Number(size) - 4"
178
- :height="Number(size) - 4"
161
+ :width="iconSizeInline"
162
+ :height="iconSizeInline"
179
163
  viewBox="0 0 24 24"
180
164
  fill="none"
181
- xmlns="http://www.w3.org/2000/svg"
182
165
  :class="$style.ui3nCheckboxIcon"
183
166
  >
184
- <g
185
- id="SVGRepo_bgCarrier"
186
- stroke-width="0"
187
- />
188
- <g
189
- id="SVGRepo_tracerCarrier"
190
- stroke-linecap="round"
191
- stroke-linejoin="round"
192
- />
193
167
  <g id="SVGRepo_iconCarrier">
194
168
  <path
195
169
  d="M20.0001 7L9.0001 18L4 13"
@@ -203,22 +177,12 @@
203
177
 
204
178
  <svg
205
179
  v-if="checkBoxValue === 'indeterminate'"
206
- :width="Number(size) - 4"
207
- :height="Number(size) - 4"
180
+ :width="iconSizeInline"
181
+ :height="iconSizeInline"
208
182
  viewBox="0 0 24 24"
209
183
  fill="none"
210
- xmlns="http://www.w3.org/2000/svg"
211
184
  :class="$style.ui3nCheckboxIcon"
212
185
  >
213
- <g
214
- id="SVGRepo_bgCarrier"
215
- stroke-width="0"
216
- />
217
- <g
218
- id="SVGRepo_tracerCarrier"
219
- stroke-linecap="round"
220
- stroke-linejoin="round"
221
- />
222
186
  <g id="SVGRepo_iconCarrier">
223
187
  <path
224
188
  d="M7 12L17 12"
@@ -275,6 +239,9 @@
275
239
  border: calc(var(--ui3n-checkbox-size) / 10) solid var(--ui3n-checkbox-color);
276
240
  cursor: pointer;
277
241
  overflow: hidden;
242
+ transition:
243
+ border-color 0.2s,
244
+ background-color 0.2s;
278
245
  }
279
246
 
280
247
  .filled {
@@ -296,8 +263,7 @@
296
263
  }
297
264
 
298
265
  .ui3nCheckboxIcon {
299
- min-height: calc(var(--ui3n-checkbox-size) - 4px);
300
- min-width: calc(var(--ui3n-checkbox-size) - 4px);
266
+ display: block;
301
267
  }
302
268
 
303
269
  .ui3nCheckboxLabel {
@@ -309,7 +275,7 @@
309
275
  }
310
276
 
311
277
  .disabled {
312
- opacity: 0.7;
278
+ opacity: 0.5;
313
279
  pointer-events: none;
314
280
  }
315
281
  </style>