@v1nt1248/3nclient-lib 0.4.0 → 0.4.2

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 (28) hide show
  1. package/README.md +2 -0
  2. package/dist/chunks/{plugins-keys-DdadrIAg.js → plugins-keys-DY2USp8H.js} +550 -536
  3. package/dist/chunks/ui3n-tooltip-6Z-sRX7U.js +409 -0
  4. package/dist/src/components/ui3n-tooltip/types.d.ts +8 -2
  5. package/dist/src/components/ui3n-tooltip/ui3n-tooltip-container.d.ts +16 -0
  6. package/dist/src/components/ui3n-tooltip/ui3n-tooltip.d.ts +1 -2
  7. package/dist/src/constants/plugins-keys.d.ts +2 -0
  8. package/dist/src/index.d.ts +3 -0
  9. package/dist/src/plugins/index.d.ts +4 -1
  10. package/dist/src/plugins/tooltips/store-tooltips.d.ts +4 -0
  11. package/dist/src/plugins/tooltips/tooltips.d.ts +8 -0
  12. package/dist/src/plugins/tooltips/types.d.ts +34 -0
  13. package/dist/src/ui3n-plugins.d.ts +5 -3
  14. package/dist/src/utils/ui/has-slot-content.d.ts +8 -2
  15. package/dist/src/utils/ui/mark-search.d.ts +8 -0
  16. package/dist/style.css +1 -1
  17. package/dist/ui3n-components.js +1345 -1466
  18. package/dist/ui3n-plugins.js +168 -50
  19. package/dist/ui3n-utils.js +4 -4
  20. package/package.json +1 -1
  21. package/src/components/ui3n-autocomplete/ui3n-autocomplete.vue +24 -8
  22. package/src/components/ui3n-breadcrumbs/ui3n-breadcrumb.vue +3 -1
  23. package/src/components/ui3n-editable/useContentEditable.ts +5 -1
  24. package/src/components/ui3n-tooltip/types.ts +8 -2
  25. package/src/components/ui3n-tooltip/ui3n-tooltip-container.vue +79 -0
  26. package/src/components/ui3n-tooltip/ui3n-tooltip.vue +112 -62
  27. package/dist/chunks/ui3n-notification-CTYQV3nR.js +0 -273
  28. package/src/components/ui3n-tooltip/ui3n-tooltip-old.vue +0 -201
@@ -1,15 +1,16 @@
1
1
  <script lang="ts" setup>
2
- import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';
2
+ import { computed, onBeforeUnmount, onMounted, ref, useSlots, watch } from 'vue';
3
3
  import { arrow, autoUpdate, offset, useFloating } from '@floating-ui/vue';
4
4
  import { toCssLength } from '../../utils/ui/to-css-length';
5
+ import { hasSlotContent } from '../../utils/ui/has-slot-content';
5
6
  import type { Nullable } from '../../types';
6
7
  import type { Ui3nTooltipProps, Ui3nTooltipEmits, Ui3nTooltipSlots } from './types';
7
8
 
8
- const baseOffset = 5;
9
+ const arrowSize = 8;
10
+ const arrowOffset = Math.round((arrowSize / 2) * Math.SQRT2);
9
11
 
10
12
  const props = withDefaults(defineProps<Ui3nTooltipProps>(), {
11
13
  placement: 'top',
12
- positionStrategy: 'absolute',
13
14
  offsetX: 0,
14
15
  offsetY: 0,
15
16
  trigger: 'hover',
@@ -17,6 +18,7 @@
17
18
  });
18
19
  const emits = defineEmits<Ui3nTooltipEmits>();
19
20
  defineSlots<Ui3nTooltipSlots>();
21
+ const slots = useSlots();
20
22
 
21
23
  const showTooltip = ref(false);
22
24
  const referenceContainer = ref<Nullable<HTMLElement>>(null);
@@ -24,6 +26,38 @@
24
26
  const floatingArrowEl = ref<Nullable<HTMLElement>>(null);
25
27
 
26
28
  const isClient = ref(false);
29
+ let boundEl: HTMLElement | null = null;
30
+
31
+ const showWrapper = computed(() => !props.triggerElement || hasSlotContent(slots.default));
32
+
33
+ const positionStrategy = computed(() => {
34
+ if (props.positionStrategy) {
35
+ return props.positionStrategy;
36
+ }
37
+
38
+ return props.triggerElement ? 'fixed' : 'absolute';
39
+ });
40
+
41
+ const shouldTeleport = computed(() => !!props.triggerElement || positionStrategy.value === 'fixed');
42
+
43
+ const usedReference = computed(() => props.triggerElement || referenceContainer.value);
44
+
45
+ const nativeReferenceEl = computed<HTMLElement | null>(() => {
46
+ const trigger = usedReference.value;
47
+ if (!trigger) {
48
+ return null;
49
+ }
50
+
51
+ if (trigger instanceof HTMLElement) {
52
+ return trigger;
53
+ }
54
+
55
+ if ('contextElement' in trigger && trigger.contextElement instanceof HTMLElement) {
56
+ return trigger.contextElement;
57
+ }
58
+
59
+ return null;
60
+ });
27
61
 
28
62
  const mainPlacement = computed(() => {
29
63
  const [part1] = props.placement.split('-');
@@ -34,19 +68,19 @@
34
68
  const options = { mainAxis: 0, crossAxis: 0 };
35
69
  switch (mainPlacement.value) {
36
70
  case 'top':
37
- options.mainAxis = -1 * Number(props.offsetY) + baseOffset;
71
+ options.mainAxis = -1 * Number(props.offsetY) + arrowOffset;
38
72
  options.crossAxis = Number(props.offsetX);
39
73
  break;
40
74
  case 'bottom':
41
- options.mainAxis = Number(props.offsetY) + baseOffset;
75
+ options.mainAxis = Number(props.offsetY) + arrowOffset;
42
76
  options.crossAxis = Number(props.offsetX);
43
77
  break;
44
78
  case 'left':
45
- options.mainAxis = -1 * Number(props.offsetX) + baseOffset;
79
+ options.mainAxis = -1 * Number(props.offsetX) + arrowOffset;
46
80
  options.crossAxis = Number(props.offsetY);
47
81
  break;
48
82
  case 'right':
49
- options.mainAxis = Number(props.offsetX) + baseOffset;
83
+ options.mainAxis = Number(props.offsetX) + arrowOffset;
50
84
  options.crossAxis = Number(props.offsetY);
51
85
  break;
52
86
  }
@@ -58,20 +92,25 @@
58
92
  arrow({ element: floatingArrowEl, padding: 8 }),
59
93
  ]);
60
94
 
61
- const { floatingStyles, isPositioned, middlewareData } = useFloating(referenceContainer, floatingEl, {
95
+ const { floatingStyles, isPositioned, middlewareData, update } = useFloating(usedReference, floatingEl, {
62
96
  open: showTooltip,
63
- placement: props.placement,
64
- strategy: props.positionStrategy,
97
+ placement: () => props.placement,
98
+ strategy: positionStrategy,
65
99
  middleware: middlewareComputed,
66
- whileElementsMounted: props.positionStrategy === 'fixed' ? autoUpdate : undefined,
100
+ whileElementsMounted: (reference, floating, onUpdate) => {
101
+ if (positionStrategy.value === 'fixed' || props.triggerElement) {
102
+ return autoUpdate(reference, floating, onUpdate);
103
+ }
104
+
105
+ onUpdate();
106
+ return () => undefined;
107
+ },
67
108
  });
68
109
 
69
- /* colours and the maximum width default in CSS, so a stylesheet can change them */
70
110
  const tooltipStylesComputed = computed(() => {
71
111
  const styles: Record<string, string> = {
72
112
  ...floatingStyles.value,
73
- '--ui3n-tooltip-arrow-size': `${baseOffset}px`,
74
- '--ui3n-tooltip-base-offset': `${-baseOffset}px`,
113
+ '--ui3n-tooltip-arrow-size': `${arrowSize}px`,
75
114
  };
76
115
 
77
116
  if (props.color) {
@@ -122,26 +161,29 @@
122
161
  }
123
162
 
124
163
  function removeEventListeners() {
125
- if (!referenceContainer.value) {
164
+ if (!boundEl) {
126
165
  return;
127
166
  }
128
167
 
129
- referenceContainer.value.removeEventListener('mouseenter', onMouseenter);
130
- referenceContainer.value.removeEventListener('mouseleave', onMouseleave);
131
- referenceContainer.value.removeEventListener('click', onClick);
168
+ boundEl.removeEventListener('mouseenter', onMouseenter);
169
+ boundEl.removeEventListener('mouseleave', onMouseleave);
170
+ boundEl.removeEventListener('click', onClick);
171
+ boundEl = null;
132
172
  }
133
173
 
134
174
  function setupEventListeners() {
135
175
  removeEventListeners();
136
- if (!referenceContainer.value || props.disabled) {
176
+ if (!nativeReferenceEl.value || props.disabled) {
137
177
  return;
138
178
  }
139
179
 
180
+ boundEl = nativeReferenceEl.value;
181
+
140
182
  if (props.trigger === 'hover') {
141
- referenceContainer.value.addEventListener('mouseenter', onMouseenter);
142
- referenceContainer.value.addEventListener('mouseleave', onMouseleave);
183
+ boundEl.addEventListener('mouseenter', onMouseenter);
184
+ boundEl.addEventListener('mouseleave', onMouseleave);
143
185
  } else if (props.trigger === 'click') {
144
- referenceContainer.value.addEventListener('click', onClick);
186
+ boundEl.addEventListener('click', onClick);
145
187
  }
146
188
  }
147
189
 
@@ -154,10 +196,19 @@
154
196
  removeEventListeners();
155
197
  });
156
198
 
157
- watch([() => props.trigger, () => props.disabled], () => {
158
- setupEventListeners();
199
+ watch([() => props.trigger, () => props.disabled, nativeReferenceEl], () => {
200
+ if (isClient.value) {
201
+ setupEventListeners();
202
+ }
159
203
  });
160
204
 
205
+ watch(
206
+ () => props.triggerElement,
207
+ () => {
208
+ update();
209
+ },
210
+ );
211
+
161
212
  watch(
162
213
  () => props.modelValue,
163
214
  val => props.trigger === 'manual' && (showTooltip.value = val),
@@ -171,6 +222,7 @@
171
222
 
172
223
  <template>
173
224
  <div
225
+ v-if="showWrapper"
174
226
  ref="referenceContainer"
175
227
  data-ui3n="tooltip"
176
228
  :class="$style.container"
@@ -178,27 +230,32 @@
178
230
  <slot />
179
231
  </div>
180
232
 
181
- <div
182
- v-if="showTooltip"
183
- ref="floatingEl"
184
- data-ui3n="tooltip-content"
185
- :class="$style.floating"
186
- :style="tooltipStylesComputed"
233
+ <Teleport
234
+ to="body"
235
+ :disabled="!isClient || !shouldTeleport"
187
236
  >
188
- <slot name="content">
189
- <div :class="$style.content">
190
- {{ content }}
237
+ <div
238
+ v-if="showTooltip"
239
+ ref="floatingEl"
240
+ data-ui3n="tooltip-content"
241
+ :class="[$style.floating, shouldTeleport && $style.floatingTeleported]"
242
+ :style="tooltipStylesComputed"
243
+ >
244
+ <slot name="content">
191
245
  <div
192
246
  ref="floatingArrowEl"
193
247
  :class="[$style.arrow, $style[`arrow-${mainPlacement}`]]"
194
248
  :style="{
195
- left: middlewareData.arrow?.x != null ? `${middlewareData.arrow?.x}px` : '',
196
- top: middlewareData.arrow?.y != null ? `${middlewareData.arrow?.y}px` : '',
249
+ left: middlewareData.arrow?.x != null ? `${middlewareData.arrow.x}px` : '',
250
+ top: middlewareData.arrow?.y != null ? `${middlewareData.arrow.y}px` : '',
197
251
  }"
198
252
  />
199
- </div>
200
- </slot>
201
- </div>
253
+ <div :class="$style.content">
254
+ {{ content }}
255
+ </div>
256
+ </slot>
257
+ </div>
258
+ </Teleport>
202
259
  </template>
203
260
 
204
261
  <style lang="scss" module>
@@ -214,51 +271,44 @@
214
271
  --_tooltip-max-width: var(--ui3n-tooltip-max-width, 400px);
215
272
 
216
273
  width: max-content;
274
+ overflow: visible;
217
275
  z-index: 5;
218
276
  }
219
277
 
278
+ .floatingTeleported {
279
+ z-index: 2000;
280
+ }
281
+
220
282
  .arrow {
221
283
  position: absolute;
222
- width: 0;
223
- height: 0;
224
-
225
- &-top,
226
- &-bottom {
227
- border-style: solid;
228
- border-width: 0 var(--ui3n-tooltip-arrow-size, 5px) var(--ui3n-tooltip-arrow-size, 5px) var(--ui3n-tooltip-arrow-size, 5px);
229
- border-color: transparent transparent var(--_tooltip-bg-color) transparent;
230
- }
284
+ width: var(--ui3n-tooltip-arrow-size, 8px);
285
+ height: var(--ui3n-tooltip-arrow-size, 8px);
286
+ background-color: var(--_tooltip-bg-color);
287
+ border-radius: 2px;
288
+ transform: rotate(45deg);
289
+ z-index: 0;
231
290
 
232
291
  &-top {
233
- bottom: var(--ui3n-tooltip-base-offset, -5px);
234
- transform: rotate(180deg);
292
+ bottom: calc(var(--ui3n-tooltip-arrow-size, 8px) / -2);
235
293
  }
236
294
 
237
295
  &-bottom {
238
- top: var(--ui3n-tooltip-base-offset, -5px);
239
- transform: rotate(0deg);
240
- }
241
-
242
- &-left,
243
- &-right {
244
- border-style: solid;
245
- border-width: var(--ui3n-tooltip-arrow-size, 5px) 0 var(--ui3n-tooltip-arrow-size, 5px) var(--ui3n-tooltip-arrow-size, 5px);
246
- border-color: transparent transparent transparent var(--_tooltip-bg-color);
296
+ top: calc(var(--ui3n-tooltip-arrow-size, 8px) / -2);
247
297
  }
248
298
 
249
299
  &-left {
250
- right: var(--ui3n-tooltip-base-offset, -5px);
251
- transform: rotate(0deg);
300
+ right: calc(var(--ui3n-tooltip-arrow-size, 8px) / -2);
252
301
  }
253
302
 
254
303
  &-right {
255
- left: var(--ui3n-tooltip-base-offset, -5px);
256
- transform: rotate(180deg);
304
+ left: calc(var(--ui3n-tooltip-arrow-size, 8px) / -2);
257
305
  }
258
306
  }
259
307
 
260
308
  .content {
261
309
  position: relative;
310
+ z-index: 1;
311
+ overflow: visible;
262
312
  max-width: var(--_tooltip-max-width);
263
313
  padding: var(--ui3n-tooltip-padding, 6px 8px);
264
314
  border-radius: var(--ui3n-tooltip-border-radius, 6px);
@@ -1,273 +0,0 @@
1
- import { b as e } from "./plugins-keys-DdadrIAg.js";
2
- import { computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createVNode as o, defineComponent as s, mergeProps as c, normalizeClass as l, normalizeStyle as u, onBeforeUnmount as d, onMounted as f, openBlock as p, ref as m, renderSlot as h, toDisplayString as g, unref as _, useCssModule as v, watch as y, withDirectives as b, withKeys as x } from "vue";
3
- //#region src/directives/ui3n-ripple.ts
4
- var S = /* @__PURE__ */ new WeakMap();
5
- function C(e, t, n) {
6
- let r = document.createElement("div"), i = Math.max(e.clientWidth, e.clientHeight), a = i / 2;
7
- r.style.width = r.style.height = `${i}px`, r.style.left = `${Math.round(e.clientWidth / 2 - a)}px`, r.style.top = `${Math.round(e.clientHeight / 2 - a)}px`, r.classList.add("ui3n-ripple"), t && r.style.setProperty("--ui3n-ripple-bg-color", t), n && r.style.setProperty("--ui3n-ripple-duration", `${n}ms`);
8
- let o = e.getElementsByClassName("ui3n-ripple")[0];
9
- o && o.remove(), e.appendChild(r);
10
- }
11
- function w(e, t) {
12
- S.get(e)?.controller.abort();
13
- let { color: n, duration: r, eventsTriggers: i = [], disabled: a = !1 } = t.value || {};
14
- if (a) {
15
- S.delete(e);
16
- return;
17
- }
18
- let o = new AbortController(), s = { signal: o.signal };
19
- (!i.length || i.includes("click")) && e.addEventListener("click", () => C(e, n, r), s), i.length && i.includes("enter") && e.addEventListener("keydown", (t) => {
20
- t.key === "Enter" && C(e, n, r);
21
- }, s), S.set(e, { controller: o });
22
- }
23
- var T = {
24
- mounted(e, t) {
25
- w(e, t);
26
- },
27
- updated(e, t) {
28
- w(e, t);
29
- },
30
- beforeUnmount(e) {
31
- S.get(e)?.controller.abort(), S.delete(e);
32
- }
33
- }, E = ["id", "title"], D = /* @__PURE__ */ s({
34
- __name: "ui3n-icon",
35
- props: {
36
- id: {},
37
- icon: {},
38
- title: { default: "" },
39
- size: {},
40
- width: {},
41
- height: {},
42
- color: {},
43
- horizontalFlip: { type: Boolean },
44
- verticalFlip: { type: Boolean },
45
- rotate: { default: 0 }
46
- },
47
- emits: ["click"],
48
- setup(e, { emit: n }) {
49
- let r = e, a = n, o = t(() => r.size || r.width), s = t(() => r.size || r.height), l = t(() => {
50
- let e = {};
51
- o.value !== void 0 && (e["--ui3n-icon-width"] = u(o.value)), s.value !== void 0 && (e["--ui3n-icon-height"] = u(s.value)), r.color && (e["--ui3n-icon-color"] = r.color);
52
- let t = [];
53
- return r.horizontalFlip && t.push("rotateY(180deg)"), r.verticalFlip && t.push("rotateX(180deg)"), r.rotate && t.push(`rotate(${r.rotate}deg)`), t.length && (e.transform = t.join(" ")), e;
54
- });
55
- function u(e) {
56
- return isNaN(Number(e)) ? String(e) : `${e}px`;
57
- }
58
- return (t, n) => (p(), i("div", c({
59
- id: e.id,
60
- "data-ui3n": "icon",
61
- class: t.$style.ui3nIcon,
62
- title: e.title,
63
- style: l.value
64
- }, { "data-icon": e.icon }, { onClick: n[0] ||= (e) => a("click", e) }), null, 16, E));
65
- }
66
- }), O = { ui3nIcon: "_ui3nIcon_pfn1q_1" }, k = (e, t) => {
67
- let n = e.__vccOpts || e;
68
- for (let [e, r] of t) n[e] = r;
69
- return n;
70
- }, A = /* @__PURE__ */ k(D, [["__cssModules", { $style: O }]]), j = {
71
- small: 12,
72
- regular: 16,
73
- large: 24
74
- }, M = ["id", "disabled"], N = /* @__PURE__ */ k(/* @__PURE__ */ s({
75
- __name: "ui3n-button",
76
- props: {
77
- id: {},
78
- type: { default: "primary" },
79
- size: { default: "regular" },
80
- square: { type: Boolean },
81
- block: { type: Boolean },
82
- textColor: {},
83
- color: {},
84
- elevation: { type: Boolean },
85
- icon: {},
86
- iconSize: {},
87
- iconColor: {},
88
- iconPosition: { default: "right" },
89
- disabled: {
90
- type: Boolean,
91
- default: !1
92
- }
93
- },
94
- emits: [
95
- "init",
96
- "click",
97
- "enter",
98
- "focus",
99
- "blur"
100
- ],
101
- setup(e, { emit: a }) {
102
- let o = T, s = e, c = a, u = v(), d = m(null), g = t(() => {
103
- let e = [
104
- u.ui3nButton,
105
- u[s.size],
106
- u[s.type]
107
- ];
108
- return s.block && s.type !== "icon" && e.push(u.block), s.square && e.push(u.square), s.icon && e.push(u[`withIcon-${s.iconPosition}`]), s.elevation && e.push(u.elevation), e;
109
- }), S = t(() => s.iconSize ? s.iconSize : j[s.size]), C = t(() => s.iconColor ? s.iconColor : "inherit");
110
- async function w(e, t) {
111
- ["init", "enter"].includes(e) ? c(e, d.value) : c(e, t);
112
- }
113
- return y([() => s.color, () => s.textColor], (e, t) => {
114
- if (!d.value) return;
115
- let [n, r] = t, [i, a] = e;
116
- (s.type === "custom" || s.type === "icon") && i !== n && d.value.style.setProperty("--ui3n-button-bg-color", i ?? "var(--color-bg-button-primary-default)"), (s.type === "custom" || s.type === "icon") && a !== r && d.value.style.setProperty("--ui3n-button-text-color", a ?? "var(--color-text-button-primary-default)");
117
- }), f(() => {
118
- d.value && ((s.type === "custom" || s.type === "icon") && s.color && d.value.style.setProperty("--ui3n-button-bg-color", s.color), s.type === "custom" && s.textColor && d.value.style.setProperty("--ui3n-button-text-color", s.textColor), w("init"));
119
- }), (t, a) => b((p(), i("button", {
120
- ref_key: "buttonEl",
121
- ref: d,
122
- id: e.id,
123
- "data-ui3n": "button",
124
- class: l(g.value),
125
- type: "button",
126
- disabled: e.disabled,
127
- onClick: a[0] ||= (e) => w("click", e),
128
- onFocusin: a[1] ||= (e) => w("focus", e),
129
- onFocusout: a[2] ||= (e) => w("blur", e),
130
- onKeydown: a[3] ||= x((e) => w("enter"), ["enter"])
131
- }, [e.icon ? (p(), n(A, {
132
- key: 0,
133
- class: l(t.$style.buttonIcon),
134
- icon: e.icon,
135
- size: S.value,
136
- color: C.value
137
- }, null, 8, [
138
- "class",
139
- "icon",
140
- "size",
141
- "color"
142
- ])) : r("", !0), e.type === "icon" ? r("", !0) : (p(), i("span", {
143
- key: 1,
144
- class: l(t.$style.text)
145
- }, [h(t.$slots, "default")], 2))], 42, M)), [[_(o)]]);
146
- }
147
- }), [["__cssModules", { $style: {
148
- ui3nButton: "_ui3nButton_1y5ej_3",
149
- "withIcon-left": "_withIcon-left_1y5ej_43",
150
- "withIcon-right": "_withIcon-right_1y5ej_46",
151
- square: "_square_1y5ej_49",
152
- regular: "_regular_1y5ej_57",
153
- small: "_small_1y5ej_67",
154
- large: "_large_1y5ej_77",
155
- block: "_block_1y5ej_87",
156
- primary: "_primary_1y5ej_91",
157
- elevation: "_elevation_1y5ej_117",
158
- text: "_text_1y5ej_122",
159
- secondary: "_secondary_1y5ej_160",
160
- tertiary: "_tertiary_1y5ej_232",
161
- outline: "_outline_1y5ej_302",
162
- icon: "_icon_1y5ej_340",
163
- custom: "_custom_1y5ej_360",
164
- buttonIcon: "_buttonIcon_1y5ej_392"
165
- } }]]), P = ["id"], F = /* @__PURE__ */ k(/* @__PURE__ */ s({
166
- __name: "ui3n-notification",
167
- props: {
168
- id: {},
169
- type: { default: "info" },
170
- content: {},
171
- position: { default: "center" },
172
- duration: { default: 0 },
173
- withIcon: {
174
- type: Boolean,
175
- default: !0
176
- },
177
- borderRadius: { default: 8 },
178
- onOpen: {
179
- type: Function,
180
- default: () => {}
181
- },
182
- onClose: {
183
- type: Function,
184
- default: () => {}
185
- }
186
- },
187
- setup(s) {
188
- let c = s, m = null, h = v(), y = t(() => ({
189
- success: {
190
- icon: "round-check-circle",
191
- iconColor: "var(--success-fill-default)",
192
- iconRotate: 0
193
- },
194
- warning: {
195
- icon: "round-warning",
196
- iconColor: "var(--warning-fill-default)",
197
- iconRotate: 0
198
- },
199
- info: {
200
- icon: "round-info",
201
- iconColor: "var(--info-fill-default)",
202
- iconRotate: 180
203
- },
204
- error: {
205
- icon: "round-info",
206
- iconColor: "var(--error-fill-default)",
207
- iconRotate: 180
208
- }
209
- })[c.type || "info"]), b = t(() => {
210
- let e = [
211
- h.ui3nNotification,
212
- h[`${c.type}Type`],
213
- h[`${c.position}Position`]
214
- ];
215
- return c.withIcon && e.push(h.withIcon), e;
216
- }), x = t(() => ({ "--ui3n-notification-border-radius": e(c.borderRadius, "8px") }));
217
- function S() {
218
- c.onClose && c.onClose();
219
- }
220
- return f(() => {
221
- c.onOpen && c.onOpen(), c.duration > 0 && (m = setTimeout(() => {
222
- S();
223
- }, c.duration));
224
- }), d(() => {
225
- m && clearTimeout(m);
226
- }), (e, t) => (p(), i("div", {
227
- id: s.id,
228
- "data-ui3n": "notification",
229
- class: l(b.value),
230
- style: u(x.value)
231
- }, [
232
- s.withIcon ? (p(), i("div", {
233
- key: 0,
234
- class: l(_(h).ui3nNotificationIcon)
235
- }, [o(A, {
236
- icon: y.value.icon,
237
- size: "16",
238
- rotate: y.value.iconRotate,
239
- color: y.value.iconColor
240
- }, null, 8, [
241
- "icon",
242
- "rotate",
243
- "color"
244
- ])], 2)) : r("", !0),
245
- a("div", { class: l(_(h).ui3nNotificationContent) }, g(s.content), 3),
246
- s.duration ? r("", !0) : (p(), n(N, {
247
- key: 1,
248
- type: "icon",
249
- size: "small",
250
- color: "transparent",
251
- icon: "round-close",
252
- "icon-size": "16",
253
- class: l(_(h).closeBtn),
254
- onClick: S
255
- }, null, 8, ["class"]))
256
- ], 14, P));
257
- }
258
- }), [["__cssModules", { $style: {
259
- ui3nNotification: "_ui3nNotification_152ae_1",
260
- withIcon: "_withIcon_152ae_24",
261
- ui3nNotificationIcon: "_ui3nNotificationIcon_152ae_28",
262
- ui3nNotificationContent: "_ui3nNotificationContent_152ae_41",
263
- closeBtn: "_closeBtn_152ae_51",
264
- infoType: "_infoType_152ae_59",
265
- successType: "_successType_152ae_70",
266
- warningType: "_warningType_152ae_81",
267
- errorType: "_errorType_152ae_92",
268
- leftPosition: "_leftPosition_152ae_103",
269
- centerPosition: "_centerPosition_152ae_108",
270
- rightPosition: "_rightPosition_152ae_113"
271
- } }]]);
272
- //#endregion
273
- export { T as a, k as i, N as n, A as r, F as t };