@v1nt1248/3nclient-lib 0.1.74 → 0.1.76

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.
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.1.74",
5
+ "version": "0.1.76",
6
6
  "description": "Library for 3NWeb clients",
7
7
  "type": "module",
8
8
  "files": [
@@ -7,3 +7,9 @@ export type ExtractComponentProps<TComponent> = TComponent extends new () => {
7
7
  : never;
8
8
 
9
9
  export type Nullable<T> = T | null;
10
+
11
+ export type Ui3nIconField = {
12
+ icon: string;
13
+ size?: string | number;
14
+ color?: string;
15
+ };
@@ -1,11 +1,12 @@
1
1
  import type { Component } from 'vue';
2
- import type { ExtractComponentProps } from '../types/index';
2
+ import type { ExtractComponentProps, Ui3nIconField } from '../types/index';
3
3
 
4
4
  export type Ui3nDialogEvent = 'open' | 'before-close' | 'close' | 'confirm' | 'cancel' | 'click-overlay';
5
5
 
6
6
  export interface Ui3nDialogProps {
7
7
  id?: string;
8
8
  title?: string;
9
+ icon?: string | Ui3nIconField;
9
10
  width?: string | number;
10
11
  draggable?: boolean;
11
12
  cssClass?: string[];
@@ -2,6 +2,7 @@
2
2
  import { type Component, computed, nextTick, onMounted, ref } from 'vue';
3
3
  import omit from 'lodash/omit';
4
4
  import Ui3nButton from '../ui3n-button/ui3n-button.vue';
5
+ import Ui3nIcon from '../ui3n-icon/ui3n-icon.vue';
5
6
  import type { Ui3nDialogEvent, Ui3nDialogComponentProps, Ui3nDialogComponentEmits } from './types';
6
7
  import { ExtractComponentProps } from '@/components/types';
7
8
  import { determineWindowWidth } from './util';
@@ -55,6 +56,26 @@
55
56
  }),
56
57
  }));
57
58
 
59
+ const iconData = computed(() => {
60
+ if (!props.dialogProps?.icon) return null;
61
+
62
+ if (typeof props.dialogProps.icon === 'string') {
63
+ return {
64
+ icon: props.dialogProps.icon,
65
+ width: 14,
66
+ height: 14,
67
+ color: 'var(--color-icon-control-secondary-default)',
68
+ };
69
+ }
70
+
71
+ return {
72
+ icon: props.dialogProps.icon.icon,
73
+ width: props.dialogProps.icon.size || 14,
74
+ height: props.dialogProps.icon.size || 14,
75
+ color: props.dialogProps.icon.color || 'var(--color-icon-control-secondary-default)',
76
+ };
77
+ });
78
+
58
79
  function selectData(value: unknown) {
59
80
  data.value = value;
60
81
  if (
@@ -219,6 +240,12 @@
219
240
  :class="$style.title"
220
241
  @click.stop
221
242
  >
243
+ <ui3n-icon
244
+ v-if="iconData"
245
+ v-bind="iconData"
246
+ :class="$style.icon"
247
+ />
248
+
222
249
  <span>{{ currentDialogProps.title }}</span>
223
250
  </div>
224
251
 
@@ -299,7 +326,7 @@
299
326
 
300
327
  .dialog {
301
328
  --dialog-border-radius: 8px;
302
- --dialog-title-padding: 16px 32px 16px 16px;
329
+ --dialog-title-padding: 0 32px 0 16px;
303
330
  --dialog-title-font-size: 14px;
304
331
  --dialog-actions-padding: 16px;
305
332
  --dialog-confirm-button-color: var(--color-text-button-primary-default);
@@ -330,13 +357,25 @@
330
357
  display: flex;
331
358
  justify-content: flex-start;
332
359
  align-items: center;
360
+ column-gap: var(--spacing-s);
333
361
  padding: var(--dialog-title-padding);
334
- font-size: var(--dialog-title-font-size);
335
- font-weight: 600;
336
- line-height: 1.2;
337
- color: var(--color-text-control-primary-default);
338
362
  border-bottom: 1px solid var(--color-border-block-primary-default);
339
- @include mixins.text-overflow-ellipsis();
363
+
364
+ span {
365
+ display: block;
366
+ position: relative;
367
+ height: var(--dialog-title-font-size);
368
+ flex-grow: 1;
369
+ font-size: var(--dialog-title-font-size);
370
+ font-weight: 600;
371
+ color: var(--color-text-control-primary-default);
372
+ @include mixins.text-overflow-ellipsis();
373
+ }
374
+
375
+ .icon {
376
+ position: relative;
377
+ top: -1px;
378
+ }
340
379
  }
341
380
 
342
381
  .dragHandleIcon {