@xen-orchestra/web-core 0.4.0 → 0.5.0

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 (124) hide show
  1. package/lib/assets/css/_colors.pcss +56 -24
  2. package/lib/assets/css/_context.pcss +9 -9
  3. package/lib/assets/css/base.pcss +6 -6
  4. package/lib/components/backup-item/VtsBackupItem.vue +47 -0
  5. package/lib/components/backup-state/{BackupState.vue → VtsBackupState.vue} +4 -4
  6. package/lib/components/{button/ButtonGroup.vue → button-group/VtsButtonGroup.vue} +7 -6
  7. package/lib/components/cell-object/{CellObject.vue → VtsCellObject.vue} +14 -14
  8. package/lib/components/cell-text/{CellText.vue → VtsCellText.vue} +11 -11
  9. package/lib/components/console/{RemoteConsole.vue → VtsRemoteConsole.vue} +12 -18
  10. package/lib/components/donut-chart-with-legend/{DonutChartWithLegend.vue → VtsDonutChartWithLegend.vue} +6 -6
  11. package/lib/components/dropdown/DropdownItem.vue +8 -14
  12. package/lib/components/dropdown/DropdownTitle.vue +3 -3
  13. package/lib/components/icon/VtsIcon.vue +38 -42
  14. package/lib/components/layout/{LayoutSidebar.vue → VtsLayoutSidebar.vue} +31 -30
  15. package/lib/components/legend-group/VtsLegendGroup.vue +44 -0
  16. package/lib/components/{legend/LegendList.vue → legend-list/VtsLegendList.vue} +2 -2
  17. package/lib/components/menu/MenuTrigger.vue +2 -2
  18. package/lib/components/stacked-bar-with-legend/{StackedBarWithLegend.vue → VtsStackedBarWithLegend.vue} +14 -14
  19. package/lib/components/state-hero/VtsComingSoonHero.vue +13 -0
  20. package/lib/components/state-hero/VtsLoadingHero.vue +15 -0
  21. package/lib/components/state-hero/VtsNoDataHero.vue +11 -0
  22. package/lib/components/state-hero/VtsObjectNotFoundHero.vue +13 -0
  23. package/lib/components/state-hero/{StateHero.vue → VtsStateHero.vue} +42 -35
  24. package/lib/components/tab/TabItem.vue +6 -6
  25. package/lib/components/table/ColumnTitle.vue +7 -7
  26. package/lib/components/table/{UiTable.vue → VtsTable.vue} +7 -3
  27. package/lib/components/task/{QuickTaskButton.vue → VtsQuickTaskButton.vue} +8 -7
  28. package/lib/components/task/{QuickTaskList.vue → VtsQuickTaskList.vue} +10 -11
  29. package/lib/components/task/{QuickTaskTabBar.vue → VtsQuickTaskTabBar.vue} +9 -13
  30. package/lib/components/{tooltip/TooltipList.vue → tooltip-list/VtsTooltipList.vue} +2 -3
  31. package/lib/components/tree/{TreeItem.vue → VtsTreeItem.vue} +3 -4
  32. package/lib/components/tree/VtsTreeItemError.vue +18 -0
  33. package/lib/components/tree/{TreeLine.vue → VtsTreeLine.vue} +9 -11
  34. package/lib/components/tree/{TreeList.vue → VtsTreeList.vue} +5 -2
  35. package/lib/components/tree/VtsTreeLoadingItem.vue +61 -0
  36. package/lib/components/ui/account-menu-button/UiAccountMenuButton.vue +64 -0
  37. package/lib/components/ui/actions-title/UiActionsTitle.vue +2 -2
  38. package/lib/components/ui/button/UiButton.vue +532 -0
  39. package/lib/components/ui/button-icon/UiButtonIcon.vue +248 -0
  40. package/lib/components/{UiCard.vue → ui/card/UiCard.vue} +8 -6
  41. package/lib/components/ui/card-numbers/UiCardNumbers.vue +103 -0
  42. package/lib/components/ui/card-subtitle/UiCardSubtitle.vue +24 -0
  43. package/lib/components/ui/card-title/UiCardTitle.vue +56 -0
  44. package/lib/components/ui/checkbox/UiCheckbox.vue +410 -0
  45. package/lib/components/ui/checkbox-group/UiCheckboxGroup.vue +57 -0
  46. package/lib/components/ui/chip/ChipIcon.vue +21 -0
  47. package/lib/components/ui/chip/ChipRemoveIcon.vue +13 -0
  48. package/lib/components/ui/chip/UiChip.vue +135 -0
  49. package/lib/components/{icon/ComplexIcon.vue → ui/complex-icon/UiComplexIcon.vue} +21 -27
  50. package/lib/components/ui/counter/UiCounter.vue +134 -0
  51. package/lib/components/{donut-chart/DonutChart.vue → ui/donut-chart/UiDonutChart.vue} +28 -30
  52. package/lib/components/{head-bar/HeadBar.vue → ui/head-bar/UiHeadBar.vue} +31 -31
  53. package/lib/components/{info/VtsInfo.vue → ui/info/UiInfo.vue} +13 -11
  54. package/lib/components/{input → ui/input}/UiInput.vue +9 -7
  55. package/lib/components/ui/input/UiTextarea.vue +120 -0
  56. package/lib/components/{input/VtsLabel.vue → ui/label/UiLabel.vue} +25 -25
  57. package/lib/components/ui/legend/UiLegend.vue +98 -0
  58. package/lib/components/{LegendTitle.vue → ui/legend-title/UiLegendTitle.vue} +4 -4
  59. package/lib/components/{UiSpinner.vue → ui/loader/UiLoader.vue} +3 -3
  60. package/lib/components/{icon/ObjectIcon.vue → ui/object-icon/UiObjectIcon.vue} +44 -36
  61. package/lib/components/ui/object-link/UiObjectLink.vue +83 -0
  62. package/lib/components/ui/panel/UiPanel.vue +57 -0
  63. package/lib/components/{query-search-bar/QuerySearchBar.vue → ui/query-search-bar/UiQuerySearchBar.vue} +16 -16
  64. package/lib/components/{task/QuickTaskItem.vue → ui/quick-task-item/UiQuickTaskItem.vue} +46 -34
  65. package/lib/components/{task/QuickTaskPanel.vue → ui/quick-task-panel/UiQuickTaskPanel.vue} +8 -7
  66. package/lib/components/ui/radio-button/UiRadioButton.vue +196 -0
  67. package/lib/components/ui/radio-button-group/UiRadioButtonGroup.vue +56 -0
  68. package/lib/components/{stacked-bar → ui/stacked-bar}/StackedBarSegment.vue +23 -26
  69. package/lib/components/{stacked-bar/StackedBar.vue → ui/stacked-bar/UiStackedBar.vue} +6 -6
  70. package/lib/components/ui/table-actions/UiTableActions.vue +46 -0
  71. package/lib/components/ui/tag/UiTag.vue +118 -0
  72. package/lib/components/ui/title/UiTitle.vue +2 -2
  73. package/lib/components/ui/toaster/UiToaster.vue +100 -0
  74. package/lib/components/ui/toggle/UiToggle.vue +117 -0
  75. package/lib/components/{tooltip/TooltipItem.vue → ui/tooltip/UiTooltip.vue} +15 -15
  76. package/lib/components/ui/top-bottom-table/UiTopBottomTable.vue +64 -0
  77. package/lib/components/{tree/TreeItemLabel.vue → ui/tree-item-label/UiTreeItemLabel.vue} +60 -59
  78. package/lib/components/ui/user-link/UiUserLink.vue +76 -0
  79. package/lib/components/ui/user-logo/UiUserLogo.vue +50 -0
  80. package/lib/composables/route-query.composable.md +136 -0
  81. package/lib/composables/table.composable.md +159 -0
  82. package/lib/composables/tree/define-tree.ts +1 -1
  83. package/lib/composables/tree/tree-node-base.ts +6 -6
  84. package/lib/composables/tree.composable.md +536 -0
  85. package/lib/layouts/CoreLayout.vue +8 -6
  86. package/lib/locales/de.json +2 -2
  87. package/lib/locales/en.json +6 -3
  88. package/lib/locales/fa.json +2 -2
  89. package/lib/locales/fr.json +6 -3
  90. package/lib/types/color.type.ts +0 -2
  91. package/lib/types/subscribable-store.type.ts +2 -2
  92. package/lib/utils/create-subscribable-store-context.util.ts +1 -1
  93. package/lib/utils/if-else.utils.md +23 -0
  94. package/lib/utils/if-else.utils.ts +2 -2
  95. package/lib/utils/to-variants.util.md +62 -0
  96. package/package.json +7 -7
  97. package/lib/components/CardNumbers.vue +0 -101
  98. package/lib/components/PowerStateIcon.vue +0 -46
  99. package/lib/components/UiTag.vue +0 -101
  100. package/lib/components/backup-item/BackupItem.vue +0 -40
  101. package/lib/components/button/ButtonIcon.vue +0 -220
  102. package/lib/components/button/UiButton.vue +0 -470
  103. package/lib/components/card/CardSubtitle.vue +0 -24
  104. package/lib/components/card/CardTitle.vue +0 -57
  105. package/lib/components/chip/ChipIcon.vue +0 -30
  106. package/lib/components/chip/ChipRemoveIcon.vue +0 -13
  107. package/lib/components/chip/UiChip.vue +0 -137
  108. package/lib/components/counter/VtsCounter.vue +0 -147
  109. package/lib/components/legend/LegendGroup.vue +0 -44
  110. package/lib/components/legend/LegendItem.vue +0 -86
  111. package/lib/components/object-link/ObjectLink.vue +0 -87
  112. package/lib/components/state-hero/ComingSoonHero.vue +0 -13
  113. package/lib/components/state-hero/LoadingHero.vue +0 -15
  114. package/lib/components/state-hero/NoDataHero.vue +0 -11
  115. package/lib/components/state-hero/ObjectNotFoundHero.vue +0 -13
  116. package/lib/components/tree/TreeItemError.vue +0 -13
  117. package/lib/components/tree/TreeLoadingItem.vue +0 -60
  118. package/lib/components/user/UserLink.vue +0 -72
  119. package/lib/components/user/UserLogo.vue +0 -57
  120. package/lib/types/backup.type.ts +0 -11
  121. package/lib/types/size.type.ts +0 -1
  122. package/lib/types/task.type.ts +0 -13
  123. /package/lib/components/backdrop/{Backdrop.vue → VtsBackdrop.vue} +0 -0
  124. /package/lib/components/divider/{Divider.vue → VtsDivider.vue} +0 -0
@@ -0,0 +1,410 @@
1
+ <!-- v3 -->
2
+ <template>
3
+ <label class="ui-checkbox" :class="classNames" v-bind="wrapperAttrs">
4
+ <input
5
+ v-model="checkboxModel"
6
+ :class="{ indeterminate: isIndeterminate }"
7
+ :disabled="isDisabled"
8
+ type="checkbox"
9
+ class="input"
10
+ v-bind="attrs"
11
+ />
12
+ <span class="fake-checkbox">
13
+ <VtsIcon :icon class="icon" accent="info" />
14
+ </span>
15
+ <span v-if="slots.default" class="typo p1-regular">
16
+ <slot />
17
+ </span>
18
+ </label>
19
+ <UiInfo v-if="slots.info" :accent>
20
+ <slot name="info" />
21
+ </UiInfo>
22
+ </template>
23
+
24
+ <script lang="ts" setup>
25
+ import VtsIcon from '@core/components/icon/VtsIcon.vue'
26
+ import UiInfo from '@core/components/ui/info/UiInfo.vue'
27
+ import { useContext } from '@core/composables/context.composable'
28
+ import { DisabledContext } from '@core/context'
29
+ import { toVariants } from '@core/utils/to-variants.util'
30
+ import { faCheck, faMinus } from '@fortawesome/free-solid-svg-icons'
31
+ import { computed, type LabelHTMLAttributes, useAttrs } from 'vue'
32
+
33
+ type CheckboxAccent = 'info' | 'success' | 'warning' | 'danger'
34
+
35
+ defineOptions({ inheritAttrs: false })
36
+
37
+ const props = withDefaults(
38
+ defineProps<{
39
+ accent: CheckboxAccent
40
+ disabled?: boolean
41
+ wrapperAttrs?: LabelHTMLAttributes
42
+ }>(),
43
+ { disabled: undefined }
44
+ )
45
+
46
+ const checkboxModel = defineModel<boolean | undefined>({ default: undefined })
47
+
48
+ const slots = defineSlots<{
49
+ default?(): any
50
+ info?(): any
51
+ }>()
52
+
53
+ const isDisabled = useContext(DisabledContext, () => props.disabled)
54
+
55
+ const classNames = computed(() => [
56
+ toVariants({
57
+ accent: props.accent,
58
+ disabled: isDisabled.value,
59
+ }),
60
+ ])
61
+
62
+ const isIndeterminate = computed(() => checkboxModel.value === undefined)
63
+
64
+ const icon = computed(() => {
65
+ if (isIndeterminate.value) {
66
+ return faMinus
67
+ }
68
+
69
+ return faCheck
70
+ })
71
+
72
+ const attrs = useAttrs()
73
+ </script>
74
+
75
+ <style lang="postcss" scoped>
76
+ .ui-checkbox {
77
+ display: inline-flex;
78
+ align-items: center;
79
+ gap: 0.8rem;
80
+
81
+ .fake-checkbox {
82
+ display: inline-flex;
83
+ align-items: center;
84
+ justify-content: center;
85
+ height: 1.6rem;
86
+ width: 1.6rem;
87
+ transition:
88
+ background-color 0.125s ease-in-out,
89
+ border-color 0.125s ease-in-out;
90
+ border: 0.2rem solid transparent;
91
+ border-radius: 0.2rem;
92
+
93
+ .icon {
94
+ font-size: 0.75rem;
95
+ position: absolute;
96
+ color: var(--color-info-txt-item);
97
+ transition: opacity 0.125s ease-in-out;
98
+ }
99
+ }
100
+
101
+ .input {
102
+ font-size: inherit;
103
+ position: absolute;
104
+ pointer-events: none;
105
+ opacity: 0;
106
+
107
+ &.indeterminate + .fake-checkbox > .icon {
108
+ opacity: 1;
109
+ color: var(--color-info-txt-item);
110
+ }
111
+
112
+ & + .fake-checkbox > .icon {
113
+ opacity: 0;
114
+ }
115
+
116
+ &:checked + .fake-checkbox > .icon {
117
+ opacity: 1;
118
+ }
119
+
120
+ &:focus-visible + .fake-checkbox {
121
+ outline: none;
122
+
123
+ &::before {
124
+ content: '';
125
+ position: absolute;
126
+ inset: -0.5rem;
127
+ border-radius: 0.4rem;
128
+ border-width: 0.2rem;
129
+ border-style: solid;
130
+ }
131
+ }
132
+ }
133
+
134
+ &.accent--info {
135
+ .input {
136
+ & + .fake-checkbox {
137
+ border-color: var(--color-info-item-base);
138
+ }
139
+
140
+ &.indeterminate + .fake-checkbox {
141
+ background-color: var(--color-info-item-base);
142
+
143
+ &:hover {
144
+ border-color: transparent;
145
+ background-color: var(--color-info-item-hover);
146
+ }
147
+
148
+ &:active {
149
+ background-color: var(--color-info-item-active);
150
+ }
151
+ }
152
+
153
+ &.indeterminate:hover + .fake-checkbox {
154
+ border-color: transparent;
155
+ background-color: var(--color-info-item-hover);
156
+ }
157
+
158
+ &:hover + .fake-checkbox {
159
+ border-color: var(--color-info-item-hover);
160
+ }
161
+
162
+ &:focus-visible + .fake-checkbox::before {
163
+ border: 0.2rem solid var(--color-info-txt-base);
164
+ }
165
+
166
+ &:active + .fake-checkbox {
167
+ border-color: var(--color-info-item-active);
168
+ }
169
+
170
+ &:checked + .fake-checkbox {
171
+ border-color: transparent;
172
+ background-color: var(--color-info-item-base);
173
+ }
174
+
175
+ &:checked:hover + .fake-checkbox {
176
+ background-color: var(--color-info-item-hover);
177
+ }
178
+
179
+ &:checked:active + .fake-checkbox {
180
+ background-color: var(--color-info-item-active);
181
+ }
182
+
183
+ &:disabled {
184
+ & + .fake-checkbox {
185
+ cursor: not-allowed;
186
+ border-color: var(--color-neutral-txt-secondary);
187
+
188
+ > .icon {
189
+ color: var(--color-neutral-txt-secondary);
190
+ }
191
+ }
192
+
193
+ &:checked + .fake-checkbox,
194
+ &.indeterminate + .fake-checkbox {
195
+ border-color: transparent;
196
+ background-color: var(--color-info-item-disabled);
197
+ }
198
+ }
199
+ }
200
+ }
201
+
202
+ &.accent--success {
203
+ .input {
204
+ & + .fake-checkbox {
205
+ border-color: var(--color-success-item-base);
206
+ }
207
+
208
+ &.indeterminate + .fake-checkbox {
209
+ background-color: var(--color-success-item-base);
210
+
211
+ &:hover {
212
+ border-color: transparent;
213
+ background-color: var(--color-success-item-hover);
214
+ }
215
+
216
+ &:active {
217
+ background-color: var(--color-success-item-active);
218
+ }
219
+ }
220
+
221
+ &.indeterminate:hover + .fake-checkbox {
222
+ border-color: transparent;
223
+ background-color: var(--color-success-item-hover);
224
+ }
225
+
226
+ &:hover + .fake-checkbox {
227
+ border-color: var(--color-success-item-hover);
228
+ }
229
+
230
+ &:focus-visible + .fake-checkbox::before {
231
+ border: 0.2rem solid var(--color-success-txt-base);
232
+ }
233
+
234
+ &:active + .fake-checkbox {
235
+ border-color: var(--color-success-item-active);
236
+ }
237
+
238
+ &:checked + .fake-checkbox {
239
+ border-color: transparent;
240
+ background-color: var(--color-success-item-base);
241
+ }
242
+
243
+ &:checked:hover + .fake-checkbox {
244
+ background-color: var(--color-success-item-hover);
245
+ }
246
+
247
+ &:checked:active + .fake-checkbox {
248
+ background-color: var(--color-success-item-active);
249
+ }
250
+
251
+ &:disabled {
252
+ & + .fake-checkbox {
253
+ cursor: not-allowed;
254
+ border-color: var(--color-neutral-txt-secondary);
255
+
256
+ > .icon {
257
+ color: var(--color-neutral-txt-secondary);
258
+ }
259
+ }
260
+
261
+ &:checked + .fake-checkbox,
262
+ &.indeterminate + .fake-checkbox {
263
+ border-color: transparent;
264
+ background-color: var(--color-success-item-disabled);
265
+ }
266
+ }
267
+ }
268
+ }
269
+
270
+ &.accent--warning {
271
+ .input {
272
+ & + .fake-checkbox {
273
+ border-color: var(--color-warning-item-base);
274
+ }
275
+
276
+ &.indeterminate + .fake-checkbox {
277
+ background-color: var(--color-warning-item-base);
278
+
279
+ &:hover {
280
+ border-color: transparent;
281
+ background-color: var(--color-warning-item-hover);
282
+ }
283
+
284
+ &:active {
285
+ background-color: var(--color-warning-item-active);
286
+ }
287
+ }
288
+
289
+ &.indeterminate:hover + .fake-checkbox {
290
+ border-color: transparent;
291
+ background-color: var(--color-warning-item-hover);
292
+ }
293
+
294
+ &:hover + .fake-checkbox {
295
+ border-color: var(--color-warning-item-hover);
296
+ }
297
+
298
+ &:focus-visible + .fake-checkbox::before {
299
+ border: 0.2rem solid var(--color-warning-txt-base);
300
+ }
301
+
302
+ &:active + .fake-checkbox {
303
+ border-color: var(--color-warning-item-active);
304
+ }
305
+
306
+ &:checked + .fake-checkbox {
307
+ border-color: transparent;
308
+ background-color: var(--color-warning-item-base);
309
+ }
310
+
311
+ &:checked:hover + .fake-checkbox {
312
+ background-color: var(--color-warning-item-hover);
313
+ }
314
+
315
+ &:checked:active + .fake-checkbox {
316
+ background-color: var(--color-warning-item-active);
317
+ }
318
+
319
+ &:disabled {
320
+ & + .fake-checkbox {
321
+ cursor: not-allowed;
322
+ border-color: var(--color-neutral-txt-secondary);
323
+
324
+ > .icon {
325
+ color: var(--color-neutral-txt-secondary);
326
+ }
327
+ }
328
+
329
+ &:checked + .fake-checkbox,
330
+ &.indeterminate + .fake-checkbox {
331
+ border-color: transparent;
332
+ background-color: var(--color-warning-item-disabled);
333
+ }
334
+ }
335
+ }
336
+ }
337
+
338
+ &.accent--danger {
339
+ .input {
340
+ & + .fake-checkbox {
341
+ border-color: var(--color-danger-item-base);
342
+
343
+ > .icon {
344
+ color: var(--color-danger-txt-item);
345
+ }
346
+ }
347
+
348
+ &.indeterminate + .fake-checkbox {
349
+ background-color: var(--color-danger-item-base);
350
+
351
+ &:hover {
352
+ border-color: transparent;
353
+ background-color: var(--color-danger-item-hover);
354
+ }
355
+
356
+ &:active {
357
+ background-color: var(--color-danger-item-active);
358
+ }
359
+ }
360
+
361
+ &.indeterminate:hover + .fake-checkbox {
362
+ border-color: transparent;
363
+ background-color: var(--color-danger-item-hover);
364
+ }
365
+
366
+ &:hover + .fake-checkbox {
367
+ border-color: var(--color-danger-item-hover);
368
+ }
369
+
370
+ &:focus-visible + .fake-checkbox::before {
371
+ border: 0.2rem solid var(--color-danger-txt-base);
372
+ }
373
+
374
+ &:active + .fake-checkbox {
375
+ border-color: var(--color-danger-item-active);
376
+ }
377
+
378
+ &:checked + .fake-checkbox {
379
+ border-color: transparent;
380
+ background-color: var(--color-danger-item-base);
381
+ }
382
+
383
+ &:checked:hover + .fake-checkbox {
384
+ background-color: var(--color-danger-item-hover);
385
+ }
386
+
387
+ &:checked:active + .fake-checkbox {
388
+ background-color: var(--color-danger-item-active);
389
+ }
390
+
391
+ &:disabled {
392
+ & + .fake-checkbox {
393
+ cursor: not-allowed;
394
+ border-color: var(--color-neutral-txt-secondary);
395
+
396
+ > .icon {
397
+ color: var(--color-neutral-txt-secondary);
398
+ }
399
+ }
400
+
401
+ &:checked + .fake-checkbox,
402
+ &.indeterminate + .fake-checkbox {
403
+ border-color: transparent;
404
+ background-color: var(--color-danger-item-disabled);
405
+ }
406
+ }
407
+ }
408
+ }
409
+ }
410
+ </style>
@@ -0,0 +1,57 @@
1
+ <!-- v1 -->
2
+ <template>
3
+ <div class="ui-checkbox-group">
4
+ <slot v-if="slots.label || label !== undefined" name="label">
5
+ <UiLabel :accent="labelAccent">
6
+ {{ label }}
7
+ </UiLabel>
8
+ </slot>
9
+ <div class="group" :class="{ vertical }">
10
+ <slot />
11
+ </div>
12
+ <slot v-if="slots.info || info !== undefined" name="info">
13
+ <UiInfo :accent>
14
+ {{ info }}
15
+ </UiInfo>
16
+ </slot>
17
+ </div>
18
+ </template>
19
+
20
+ <script setup lang="ts">
21
+ import UiInfo from '@core/components/ui/info/UiInfo.vue'
22
+ import UiLabel from '@core/components/ui/label/UiLabel.vue'
23
+ import { computed } from 'vue'
24
+
25
+ const props = defineProps<{
26
+ accent: 'info' | 'warning' | 'danger'
27
+ label?: string
28
+ info?: string
29
+ vertical?: boolean
30
+ }>()
31
+
32
+ const slots = defineSlots<{
33
+ default(): any
34
+ label?(): any
35
+ info?(): any
36
+ }>()
37
+
38
+ const labelAccent = computed(() => (props.accent === 'info' ? 'neutral' : props.accent))
39
+ </script>
40
+
41
+ <style scoped lang="postcss">
42
+ .ui-checkbox-group {
43
+ display: flex;
44
+ flex-direction: column;
45
+ gap: 0.4rem;
46
+
47
+ .group {
48
+ display: flex;
49
+ gap: 6.4rem;
50
+
51
+ &.vertical {
52
+ flex-direction: column;
53
+ gap: 0.8rem;
54
+ }
55
+ }
56
+ }
57
+ </style>
@@ -0,0 +1,21 @@
1
+ <template>
2
+ <VtsIcon :class="{ muted: disabled }" accent="current" :icon class="chip-icon" fixed-width />
3
+ </template>
4
+
5
+ <script lang="ts" setup>
6
+ import VtsIcon from '@core/components/icon/VtsIcon.vue'
7
+ import type { IconDefinition } from '@fortawesome/fontawesome-common-types'
8
+
9
+ defineProps<{
10
+ icon?: IconDefinition
11
+ disabled?: boolean
12
+ }>()
13
+ </script>
14
+
15
+ <style lang="postcss" scoped>
16
+ .chip-icon {
17
+ &.muted {
18
+ color: var(--color-neutral-txt-secondary);
19
+ }
20
+ }
21
+ </style>
@@ -0,0 +1,13 @@
1
+ <template>
2
+ <VtsButtonIcon :accent :icon="faXmark" size="small" />
3
+ </template>
4
+
5
+ <script lang="ts" setup>
6
+ import VtsButtonIcon from '@core/components/ui/button-icon/UiButtonIcon.vue'
7
+ import type { ChipAccent } from '@core/components/ui/chip/UiChip.vue'
8
+ import { faXmark } from '@fortawesome/free-solid-svg-icons'
9
+
10
+ defineProps<{
11
+ accent: ChipAccent
12
+ }>()
13
+ </script>
@@ -0,0 +1,135 @@
1
+ <!-- v4 -->
2
+ <template>
3
+ <span :class="classNames" class="ui-chip typo p3-regular" @click="emit('edit')">
4
+ <ChipIcon :disabled :icon />
5
+ <span class="content text-ellipsis">
6
+ <slot />
7
+ </span>
8
+ <ChipRemoveIcon v-if="!disabled" :accent @click.stop="emit('remove')" />
9
+ </span>
10
+ </template>
11
+
12
+ <script lang="ts" setup>
13
+ import ChipIcon from '@core/components/ui/chip/ChipIcon.vue'
14
+ import ChipRemoveIcon from '@core/components/ui/chip/ChipRemoveIcon.vue'
15
+ import { toVariants } from '@core/utils/to-variants.util'
16
+ import type { IconDefinition } from '@fortawesome/fontawesome-common-types'
17
+ import { computed } from 'vue'
18
+
19
+ export type ChipAccent = 'info' | 'success' | 'warning' | 'danger'
20
+
21
+ const props = defineProps<{
22
+ accent: ChipAccent
23
+ icon?: IconDefinition
24
+ disabled?: boolean
25
+ }>()
26
+
27
+ const emit = defineEmits<{
28
+ edit: []
29
+ remove: []
30
+ }>()
31
+
32
+ defineSlots<{
33
+ default(): any
34
+ }>()
35
+
36
+ const classNames = computed(() => {
37
+ return [
38
+ toVariants({
39
+ accent: props.accent,
40
+ muted: props.disabled,
41
+ }),
42
+ ]
43
+ })
44
+ </script>
45
+
46
+ <style lang="postcss" scoped>
47
+ .ui-chip {
48
+ display: flex;
49
+ align-items: center;
50
+ gap: 0.8rem;
51
+ padding: 0.4rem 0.8rem;
52
+ border-radius: 10rem;
53
+ color: var(--color-neutral-txt-primary);
54
+ cursor: pointer;
55
+ min-height: 2.4rem;
56
+ vertical-align: middle;
57
+ white-space: nowrap;
58
+ min-width: 0;
59
+
60
+ &.muted {
61
+ color: var(--color-neutral-txt-secondary);
62
+ pointer-events: none;
63
+ }
64
+
65
+ .content {
66
+ line-height: 1.6rem;
67
+ }
68
+
69
+ /* COLOR VARIANTS */
70
+
71
+ &.accent--info {
72
+ background-color: var(--color-info-background-selected);
73
+
74
+ &:is(:hover, :focus-visible) {
75
+ background-color: var(--color-info-background-hover);
76
+ }
77
+
78
+ &:active {
79
+ background-color: var(--color-info-background-active);
80
+ }
81
+
82
+ &.muted {
83
+ background-color: var(--color-info-item-disabled);
84
+ }
85
+ }
86
+
87
+ &.accent--success {
88
+ background-color: var(--color-success-background-selected);
89
+
90
+ &:is(:hover, :focus-visible) {
91
+ background-color: var(--color-success-background-hover);
92
+ }
93
+
94
+ &:active {
95
+ background-color: var(--color-success-background-active);
96
+ }
97
+
98
+ &.muted {
99
+ background-color: var(--color-success-item-disabled);
100
+ }
101
+ }
102
+
103
+ &.accent--warning {
104
+ background-color: var(--color-warning-background-selected);
105
+
106
+ &:is(:hover, :focus-visible) {
107
+ background-color: var(--color-warning-background-hover);
108
+ }
109
+
110
+ &:active {
111
+ background-color: var(--color-warning-background-active);
112
+ }
113
+
114
+ &.muted {
115
+ background-color: var(--color-warning-item-disabled);
116
+ }
117
+ }
118
+
119
+ &.accent--danger {
120
+ background-color: var(--color-danger-background-selected);
121
+
122
+ &:is(:hover, :focus-visible) {
123
+ background-color: var(--color-danger-background-hover);
124
+ }
125
+
126
+ &:active {
127
+ background-color: var(--color-danger-background-active);
128
+ }
129
+
130
+ &.muted {
131
+ background-color: var(--color-danger-item-disabled);
132
+ }
133
+ }
134
+ }
135
+ </style>
@@ -1,41 +1,21 @@
1
- <!-- v1.1 -->
1
+ <!-- v2 -->
2
2
  <template>
3
- <FontAwesomeLayers :class="size" class="complex-icon">
3
+ <FontAwesomeLayers :class="toVariants({ size })" class="ui-complex-icon">
4
4
  <slot />
5
5
  </FontAwesomeLayers>
6
6
  </template>
7
7
 
8
8
  <script lang="ts" setup>
9
+ import { toVariants } from '@core/utils/to-variants.util'
9
10
  import { FontAwesomeLayers } from '@fortawesome/vue-fontawesome'
10
11
 
11
- withDefaults(
12
- defineProps<{
13
- size?: 'small' | 'medium' | 'large'
14
- }>(),
15
- { size: 'medium' }
16
- )
12
+ defineProps<{
13
+ size: 'small' | 'medium' | 'large'
14
+ }>()
17
15
  </script>
18
16
 
19
17
  <style lang="postcss" scoped>
20
- /* SIZE VARIANTS */
21
- .complex-icon {
22
- &.small {
23
- --font-size: 1.2rem;
24
- }
25
-
26
- &.medium {
27
- --font-size: 1.6rem;
28
- }
29
-
30
- &.large {
31
- --font-size: 2rem;
32
- }
33
- }
34
-
35
- /* IMPLEMENTATION */
36
- .complex-icon {
37
- font-size: var(--font-size);
38
-
18
+ .ui-complex-icon {
39
19
  :nth-child(2) {
40
20
  font-size: 0.5em;
41
21
  transform: translate(100%, 80%);
@@ -47,5 +27,19 @@ withDefaults(
47
27
  paint-order: stroke;
48
28
  }
49
29
  }
30
+
31
+ /*SIZE VARIANTS*/
32
+
33
+ &.size--small {
34
+ font-size: 1.2rem;
35
+ }
36
+
37
+ &.size--medium {
38
+ font-size: 1.6rem;
39
+ }
40
+
41
+ &.size--large {
42
+ font-size: 2rem;
43
+ }
50
44
  }
51
45
  </style>