@luna-park/design 1.0.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 (130) hide show
  1. package/eslint.config.js +9 -0
  2. package/histoire.config.ts +60 -0
  3. package/package.json +71 -0
  4. package/public/favicon_rc.png +0 -0
  5. package/src/app.ts +9 -0
  6. package/src/assets/controls/mouse.svg +54 -0
  7. package/src/assets/logo_neon.svg +18 -0
  8. package/src/assets/logo_rc_color.svg +54 -0
  9. package/src/assets/logo_rc_square_blue.svg +16 -0
  10. package/src/assets/logo_square_blue.svg +17 -0
  11. package/src/assets/logo_square_white.svg +17 -0
  12. package/src/assets/logo_text_white.svg +32 -0
  13. package/src/assets/stars.svg +66 -0
  14. package/src/components/breadcrumb/LBreadLink.vue +40 -0
  15. package/src/components/breadcrumb/LBreadcrumb.story.vue +29 -0
  16. package/src/components/breadcrumb/LBreadcrumb.vue +54 -0
  17. package/src/components/breadcrumb/type.ts +6 -0
  18. package/src/components/context/LContextMenu.story.vue +73 -0
  19. package/src/components/context/LContextMenu.vue +24 -0
  20. package/src/components/context/LContextMenuElement.vue +54 -0
  21. package/src/components/context/LContextMenuWrapper.vue +55 -0
  22. package/src/components/context/LContextOption.story.vue +18 -0
  23. package/src/components/context/LContextOption.vue +160 -0
  24. package/src/components/context/LContextWrapper.story.vue +11 -0
  25. package/src/components/context/LContextWrapper.vue +60 -0
  26. package/src/components/context/store.ts +62 -0
  27. package/src/components/context/type.ts +27 -0
  28. package/src/components/dialog/LDialogAlert.vue +38 -0
  29. package/src/components/dialog/LDialogConfirm.vue +45 -0
  30. package/src/components/dialog/LDialogInjector.story.vue +41 -0
  31. package/src/components/dialog/LDialogInjector.vue +40 -0
  32. package/src/components/dialog/LDialogPrompt.vue +67 -0
  33. package/src/components/dialog/LDialogWrapper.vue +66 -0
  34. package/src/components/dialog/lib.ts +50 -0
  35. package/src/components/dialog/store.ts +32 -0
  36. package/src/components/floating/LFloating.story.vue +35 -0
  37. package/src/components/floating/LFloating.vue +362 -0
  38. package/src/components/form/LAutoComplete.vue +13 -0
  39. package/src/components/form/LAutoInput.story.vue +43 -0
  40. package/src/components/form/LAutoInput.vue +101 -0
  41. package/src/components/form/LButton.story.vue +147 -0
  42. package/src/components/form/LButton.vue +227 -0
  43. package/src/components/form/LCheckbox.story.vue +13 -0
  44. package/src/components/form/LCheckbox.vue +70 -0
  45. package/src/components/form/LColorInput.story.vue +28 -0
  46. package/src/components/form/LColorInput.vue +101 -0
  47. package/src/components/form/LImageInput.story.vue +28 -0
  48. package/src/components/form/LImageInput.vue +75 -0
  49. package/src/components/form/LInfo.story.vue +22 -0
  50. package/src/components/form/LInfo.vue +44 -0
  51. package/src/components/form/LInput.story.vue +150 -0
  52. package/src/components/form/LInput.vue +493 -0
  53. package/src/components/form/LInputDateFloating.vue +61 -0
  54. package/src/components/form/LInputNumber.story.vue +58 -0
  55. package/src/components/form/LProgress.story.vue +49 -0
  56. package/src/components/form/LProgress.vue +77 -0
  57. package/src/components/form/LSelect.story.vue +67 -0
  58. package/src/components/form/LSelect.vue +142 -0
  59. package/src/components/form/LSwitch.story.vue +15 -0
  60. package/src/components/form/LSwitch.vue +79 -0
  61. package/src/components/form/LTextarea.story.vue +29 -0
  62. package/src/components/form/LTextarea.vue +151 -0
  63. package/src/components/form/color-picker/LColorAlpha.vue +129 -0
  64. package/src/components/form/color-picker/LColorHue.vue +109 -0
  65. package/src/components/form/color-picker/LColorModels.vue +223 -0
  66. package/src/components/form/color-picker/LColorPicker.story.vue +44 -0
  67. package/src/components/form/color-picker/LColorPicker.vue +105 -0
  68. package/src/components/form/color-picker/LColorShade.vue +114 -0
  69. package/src/components/form/color-picker/LImagePicker.vue +477 -0
  70. package/src/components/form/dropdown/LDropdown.story.vue +123 -0
  71. package/src/components/form/dropdown/LDropdown.vue +483 -0
  72. package/src/components/form/dropdown/LDropdownOption.vue +224 -0
  73. package/src/components/form/dropdown/LDropdownSelection.vue +76 -0
  74. package/src/components/form/dropdown/types.ts +15 -0
  75. package/src/components/form/emoji-picker/LEmojiList.vue +54 -0
  76. package/src/components/form/emoji-picker/LEmojiListCategory.vue +92 -0
  77. package/src/components/form/emoji-picker/LEmojiPicker.story.vue +32 -0
  78. package/src/components/form/emoji-picker/LEmojiPicker.vue +55 -0
  79. package/src/components/form/emoji-picker/LEmojiSelect.story.vue +22 -0
  80. package/src/components/form/emoji-picker/LEmojiSelect.vue +51 -0
  81. package/src/components/form/icon-picker/LIconList.vue +100 -0
  82. package/src/components/form/icon-picker/LIconMaterial.vue +43 -0
  83. package/src/components/form/icon-picker/LIconPicker.story.vue +39 -0
  84. package/src/components/form/icon-picker/LIconPicker.vue +92 -0
  85. package/src/components/form/icon-picker/LIconSelect.story.vue +25 -0
  86. package/src/components/form/icon-picker/LIconSelect.vue +91 -0
  87. package/src/components/icons/LControls.story.vue +92 -0
  88. package/src/components/icons/LKeyIcon.vue +66 -0
  89. package/src/components/icons/LMouseIcon.vue +85 -0
  90. package/src/components/icons/LShortcut.story.vue +12 -0
  91. package/src/components/icons/LShortcut.vue +45 -0
  92. package/src/components/layout/LResizer.story.vue +89 -0
  93. package/src/components/layout/LResizer.vue +138 -0
  94. package/src/components/misc/LIcon.vue +34 -0
  95. package/src/components/misc/LLineLoader.story.vue +18 -0
  96. package/src/components/misc/LLineLoader.vue +52 -0
  97. package/src/components/misc/LLoading.story.vue +14 -0
  98. package/src/components/misc/LLoading.vue +28 -0
  99. package/src/components/misc/LStarsBackground.story.vue +16 -0
  100. package/src/components/misc/LStarsBackground.vue +121 -0
  101. package/src/components/navigation/LElementsPagination.vue +75 -0
  102. package/src/components/navigation/LPagination.story.vue +57 -0
  103. package/src/components/navigation/LPagination.vue +125 -0
  104. package/src/components/table/LCell.vue +37 -0
  105. package/src/components/table/LLine.vue +24 -0
  106. package/src/components/table/LTable.story.vue +35 -0
  107. package/src/components/table/LTable.vue +21 -0
  108. package/src/components/toasts/LContainer.story.vue +47 -0
  109. package/src/components/toasts/LContainer.vue +140 -0
  110. package/src/components/toasts/LToast.story.vue +47 -0
  111. package/src/components/toasts/LToast.vue +30 -0
  112. package/src/components/toasts/LToastInjector.vue +54 -0
  113. package/src/components/toasts/requests.ts +46 -0
  114. package/src/components/toasts/store.ts +45 -0
  115. package/src/components/utils/LVirtualElement.vue +36 -0
  116. package/src/components/utils/LVirtualScroller.story.vue +62 -0
  117. package/src/components/utils/LVirtualScroller.vue +105 -0
  118. package/src/components/utils/virtual.ts +6 -0
  119. package/src/env.d.ts +9 -0
  120. package/src/histoire.setup.ts +8 -0
  121. package/src/icons.ts +8 -0
  122. package/src/index.ts +58 -0
  123. package/src/style/colors.scss +152 -0
  124. package/src/style/fonts.scss +45 -0
  125. package/src/style/index.scss +64 -0
  126. package/src/style/layout.scss +3 -0
  127. package/src/style/lengths.scss +21 -0
  128. package/src/style/scrollbar.scss +27 -0
  129. package/tsconfig.json +34 -0
  130. package/vite.config.ts +68 -0
@@ -0,0 +1,477 @@
1
+ <template>
2
+ <div class="color-picker-gradient">
3
+ <div class="header">
4
+ <div class="preview">
5
+ <LDropdown
6
+ v-model="imageType"
7
+ class="gradient-type"
8
+ :options="gradientOptions"
9
+ />
10
+ <div class="color-preview">
11
+ <div class="current-color" />
12
+ </div>
13
+ </div>
14
+ <div
15
+ v-if="imageType !== EImageType.Image"
16
+ class="gradient-bar"
17
+ >
18
+ <div class="checkerboard">
19
+ <canvas
20
+ ref="gradient"
21
+ height="16"
22
+ title="Double click to add"
23
+ width="184"
24
+ @dblclick="createColor"
25
+ />
26
+ </div>
27
+ <div
28
+ v-for="(color, index) in colors"
29
+ :key="index"
30
+ class="cursor"
31
+ :class="{ selected: index === selectedCursor }"
32
+ :style="{ left: `${ colors[index].stop * 184 / 100 - 6 }px`, }"
33
+ title="Double click to remove"
34
+ @mousedown.left="startDragging(index)"
35
+ >
36
+ <div
37
+ class="color"
38
+ :style="{ background: color.value }"
39
+ @dblclick="removeColor(index)"
40
+ />
41
+ </div>
42
+ </div>
43
+ <div
44
+ v-if="[EImageType.Linear, EImageType.Conic].includes(imageType)"
45
+ class="orientation"
46
+ >
47
+ <LInput
48
+ v-model="angle"
49
+ :filter="maxFilter(360)"
50
+ :step="{step:5}"
51
+ type="number"
52
+ >
53
+ <template #prefix>
54
+ <span class="prefix">α:</span>
55
+ </template>
56
+ <template #suffix>
57
+ <span class="suffix">°</span>
58
+ </template>
59
+ </LInput>
60
+ </div>
61
+ <div
62
+ v-if="imageType === EImageType.Image"
63
+ class="url"
64
+ >
65
+ <LInput
66
+ v-model="imageUrl"
67
+ type="text"
68
+ >
69
+ <template #prefix>
70
+ <span class="prefix">URL:</span>
71
+ </template>
72
+ </LInput>
73
+ </div>
74
+ </div>
75
+ <div
76
+ v-if="imageType === EImageType.Radial"
77
+ class="radial-options"
78
+ >
79
+ <LDropdown
80
+ v-model="endingShape"
81
+ class="shape"
82
+ :options="shapeOptions"
83
+ >
84
+ <template #prefix>
85
+ <span class="prefix">Shape:</span>
86
+ </template>
87
+ </LDropdown>
88
+ <div class="space" />
89
+ <LDropdown
90
+ v-if="imageType === EImageType.Radial"
91
+ v-model="radialSize"
92
+ class="size"
93
+ :options="radialOptions"
94
+ >
95
+ <template #prefix>
96
+ <span class="prefix">Size:</span>
97
+ </template>
98
+ </LDropdown>
99
+ <LInput
100
+ v-model="location.x"
101
+ class="input"
102
+ type="number"
103
+ >
104
+ <template #prefix>
105
+ <span class="prefix">X:</span>
106
+ </template>
107
+ <template #suffix>
108
+ <span class="suffix">%</span>
109
+ </template>
110
+ </LInput>
111
+ <LInput
112
+ v-model="location.y"
113
+ class="input"
114
+ type="number"
115
+ >
116
+ <template #prefix>
117
+ <span class="prefix">Y:</span>
118
+ </template>
119
+ <template #suffix>
120
+ <span class="suffix">%</span>
121
+ </template>
122
+ </LInput>
123
+ </div>
124
+ <LColorPicker
125
+ v-if="imageType !== EImageType.Image"
126
+ v-model="colors[selectedCursor].value"
127
+ />
128
+ </div>
129
+ </template>
130
+
131
+ <script setup lang="ts">
132
+ import { computed, nextTick, onMounted, reactive, ref, watch } from "vue";
133
+ import { clamp, startCase } from "@luna-park/utils";
134
+ import { usePointer, watchThrottled, watchTriggerable } from "@vueuse/core";
135
+ import LColorPicker from "@/components/form/color-picker/LColorPicker.vue";
136
+ import LDropdown from "@/components/form/dropdown/LDropdown.vue";
137
+ import LInput from "@/components/form/LInput.vue";
138
+
139
+ enum EImageType {
140
+ Linear = "linear",
141
+ Conic = "conic",
142
+ Radial = "radial",
143
+ Image = "image"
144
+ }
145
+
146
+ enum EEndingShape {
147
+ Circle = "circle",
148
+ Ellipse = "ellipse"
149
+ }
150
+
151
+ enum ERadialSize {
152
+ ClosestSide = "closest-side",
153
+ ClosestCorner = "closest-corner",
154
+ FarthestSide = "farthest-side",
155
+ FarthestCorner = "farthest-corner"
156
+ }
157
+
158
+ type TColorStop = {
159
+ stop: number;
160
+ value: string;
161
+ }
162
+
163
+ const props = defineProps<{
164
+ modelValue: string;
165
+ }>();
166
+
167
+ const emits = defineEmits<(e: "update:modelValue", value: string) => void>();
168
+
169
+ const gradient = ref<HTMLCanvasElement>();
170
+ const colors = ref<Array<TColorStop>>([
171
+ { stop: 0, value: "#ff6600" },
172
+ { stop: 100, value: "#ffffff" }
173
+ ]);
174
+ const imageUrl = ref("");
175
+ const selectedCursor = ref(0);
176
+ const angle = ref(0);
177
+ const imageType = ref(EImageType.Linear);
178
+ const endingShape = ref(EEndingShape.Circle);
179
+ const radialSize = ref(ERadialSize.FarthestCorner);
180
+ const location = reactive({
181
+ x: 50,
182
+ y: 50
183
+ });
184
+
185
+ const { pressure: mouseClick, x: mouseX } = usePointer();
186
+ const isDragging = ref(false);
187
+ const startMouseX = ref(0);
188
+ const startStop = ref(0);
189
+
190
+ const gradientOptions = Object.values(EImageType).map((id) => ({ id, value: startCase(id) }));
191
+ const shapeOptions = Object.values(EEndingShape).map((id) => ({ id, value: startCase(id) }));
192
+ const radialOptions = Object.values(ERadialSize).map((id) => ({ id, value: startCase(id) }));
193
+
194
+ onMounted(() => {
195
+ drawCanvas();
196
+ });
197
+
198
+ function startDragging(index: number) {
199
+ selectedCursor.value = index;
200
+ isDragging.value = true;
201
+ startMouseX.value = mouseX.value;
202
+ startStop.value = colors.value[index].stop;
203
+ }
204
+
205
+ function createColor(event: MouseEvent) {
206
+ const rect = gradient.value?.getBoundingClientRect();
207
+
208
+ if (!rect) {
209
+ return;
210
+ }
211
+
212
+ const stop = clamp((event.clientX - rect.left) * 100 / 184, 0, 100);
213
+ const value = colors.value[selectedCursor.value].value;
214
+ colors.value.splice(selectedCursor.value + 1, 0, { stop, value });
215
+ selectedCursor.value++;
216
+ }
217
+
218
+ function removeColor(index: number) {
219
+ if (colors.value.length <= 2) {
220
+ return;
221
+ }
222
+ colors.value.splice(index, 1);
223
+ selectedCursor.value = clamp(selectedCursor.value, 0, colors.value.length - 1);
224
+ }
225
+
226
+ watchThrottled([isDragging, mouseClick, mouseX], () => {
227
+ if (!isDragging.value) {
228
+ return;
229
+ }
230
+
231
+ if (!mouseClick.value) {
232
+ isDragging.value = false;
233
+ return;
234
+ }
235
+
236
+ const delta = mouseX.value - startMouseX.value;
237
+ colors.value[selectedCursor.value].stop = Math.round(clamp(startStop.value + delta * 100 / 184, 0, 100));
238
+ }, {
239
+ deep: true,
240
+ throttle: 1000 / 60
241
+ });
242
+
243
+ function maxFilter(max: number) {
244
+ return (value: string) => clamp(parseFloat(value), 0, max).toString();
245
+ }
246
+
247
+ watch(() => props.modelValue, () => {
248
+ loadValues();
249
+ }, {
250
+ immediate: true
251
+ });
252
+
253
+ function loadValues() {
254
+ const gradient = props.modelValue.match(/^(\S+)\((.*)\)$/);
255
+
256
+ if (!gradient) {
257
+ return;
258
+ }
259
+
260
+
261
+ if (gradient[1] === "linear-gradient") {
262
+ imageType.value = EImageType.Linear;
263
+ const angleMatch = gradient[2].match(/^(\S+)deg, (.+)$/);
264
+
265
+ if (!angleMatch) {
266
+ return;
267
+ }
268
+
269
+ angle.value = parseFloat(angleMatch[1]);
270
+ colors.value = angleMatch[2].split(", ").map((color) => {
271
+ const [value, stop] = color.split(" ");
272
+ return { stop: parseFloat(stop), value };
273
+ });
274
+ }
275
+
276
+ if (gradient[1] === "radial-gradient") {
277
+ imageType.value = EImageType.Radial;
278
+ const radialMatch = gradient[2].match(/^(\S+) (\S+) at (\S+)% (\S+)%, (.+)$/);
279
+
280
+ if (!radialMatch) {
281
+ return;
282
+ }
283
+
284
+ endingShape.value = radialMatch[1] as EEndingShape;
285
+ radialSize.value = radialMatch[2] as ERadialSize;
286
+ location.x = parseFloat(radialMatch[3]);
287
+ location.y = parseFloat(radialMatch[4]);
288
+ colors.value = radialMatch[5].split(", ").map((color) => {
289
+ const [value, stop] = color.split(" ");
290
+ return { stop: parseFloat(stop), value };
291
+ });
292
+
293
+ }
294
+
295
+ if (gradient[1] === "conic-gradient") {
296
+ imageType.value = EImageType.Conic;
297
+ const angleMatch = gradient[2].match(/^from (\S+)deg, (.+)$/);
298
+
299
+ if (!angleMatch) {
300
+ return;
301
+ }
302
+
303
+ angle.value = parseFloat(angleMatch[1]);
304
+ colors.value = angleMatch[2].split(", ").map((color) => {
305
+ const [value, stop] = color.split(" ");
306
+ return { stop: parseFloat(stop), value };
307
+ });
308
+ }
309
+
310
+ if (gradient[1] === "url") {
311
+ imageType.value = EImageType.Image;
312
+ imageUrl.value = gradient[2];
313
+ }
314
+ }
315
+
316
+ const cssValue = computed(() => {
317
+ if (imageType.value === EImageType.Linear) {
318
+ return `linear-gradient(${ angle.value }deg, ${ [...colors.value].sort((a, b) => a.stop - b.stop)
319
+ .map((color) => `${ color.value } ${ color.stop }%`).join(", ") })`;
320
+ }
321
+ if (imageType.value === EImageType.Radial) {
322
+ return `radial-gradient(${ endingShape.value } ${ radialSize.value } at ${ location.x }% ${ location.y }%, ${ [...colors.value].sort((a, b) => a.stop - b.stop)
323
+ .map((color) => `${ color.value } ${ color.stop }%`).join(", ") })`;
324
+ }
325
+ if (imageType.value === EImageType.Conic) {
326
+ return `conic-gradient(from ${ angle.value }deg, ${ [...colors.value].sort((a, b) => a.stop - b.stop)
327
+ .map((color) => `${ color.value } ${ color.stop }%`).join(", ") })`;
328
+ }
329
+ if (imageType.value === EImageType.Image) {
330
+ return `url(${ imageUrl.value })`;
331
+ }
332
+ return "";
333
+ });
334
+
335
+ watch(cssValue, () => {
336
+ if (cssValue.value !== props.modelValue) {
337
+ emits("update:modelValue", cssValue.value);
338
+ }
339
+ });
340
+
341
+ const { trigger: drawCanvas } = watchTriggerable(() => [colors, imageType], async () => {
342
+ await nextTick();
343
+ const context = gradient.value?.getContext("2d");
344
+
345
+ if (!context) {
346
+ return;
347
+ }
348
+
349
+ context.clearRect(0, 0, 184, 16);
350
+
351
+ const hueGradient = context.createLinearGradient(0, 0, 184, 0);
352
+ for (const color of colors.value) {
353
+ try {
354
+ hueGradient.addColorStop(color.stop / 100, color.value);
355
+ }
356
+ catch (e) {
357
+ // noop
358
+ }
359
+ }
360
+ context.fillStyle = hueGradient;
361
+ context.fillRect(0, 0, 184, 16);
362
+ }, {
363
+ deep: true
364
+ });
365
+ </script>
366
+
367
+ <style scoped>
368
+ .color-picker-gradient {
369
+ display: flex;
370
+ flex-direction: column;
371
+ gap: var(--length-xs);
372
+ width: 396px;
373
+
374
+ .header {
375
+ display: flex;
376
+ align-items: center;
377
+ gap: var(--length-m);
378
+
379
+ .preview {
380
+ display: flex;
381
+ align-items: center;
382
+ gap: var(--length-xs);
383
+
384
+ .gradient-type {
385
+ width: 88px;
386
+ }
387
+
388
+ .color-preview {
389
+ background: repeating-conic-gradient(var(--color-background-0) 0% 25%, transparent 0% 50%) 50% / 16px 16px;
390
+ overflow: hidden;
391
+ height: 24px;
392
+ width: 24px;
393
+ border-radius: var(--length-radius-s);
394
+ box-shadow: 0 0 4px var(--color-soft);
395
+
396
+ .current-color {
397
+ background: v-bind(cssValue);
398
+ height: 100%;
399
+ width: 100%;
400
+ background-size: cover;
401
+ }
402
+ }
403
+ }
404
+
405
+ .gradient-bar {
406
+ width: 184px;
407
+ display: flex;
408
+ align-items: center;
409
+ position: relative;
410
+
411
+ .checkerboard {
412
+ background: repeating-conic-gradient(var(--color-background-0) 0% 25%, transparent 0% 50%) 50% / 16px 16px;
413
+ overflow: hidden;
414
+ border-radius: var(--length-radius-s);
415
+ height: 16px;
416
+ }
417
+
418
+ .cursor {
419
+ top: -4px;
420
+ box-sizing: border-box;
421
+ width: 12px;
422
+ height: 24px;
423
+ border: 2px solid var(--color-content-liter);
424
+ border-radius: 8px;
425
+ position: absolute;
426
+ box-shadow: 0 0 4px var(--color-background-lite);
427
+ cursor: ew-resize;
428
+ background: repeating-conic-gradient(var(--color-background-0) 0% 25%, var(--color-background-3) 0% 50%) 50% / 16px 16px;
429
+ overflow: hidden;
430
+
431
+ &:hover {
432
+ border-color: var(--color-content-lite);
433
+ }
434
+
435
+ &.selected {
436
+ border-color: var(--color-content);
437
+ }
438
+
439
+ .color {
440
+ width: 100%;
441
+ height: 100%;
442
+ }
443
+ }
444
+ }
445
+
446
+ .orientation {
447
+ width: 60px;
448
+ }
449
+
450
+ .ending-shape {
451
+ width: 60px;
452
+ }
453
+ }
454
+
455
+ .radial-options {
456
+ display: flex;
457
+ align-items: center;
458
+ gap: var(--length-xs);
459
+
460
+ .shape {
461
+ width: 120px;
462
+ }
463
+
464
+ .size {
465
+ width: 124px;
466
+ }
467
+
468
+ .input {
469
+ width: 60px;
470
+ }
471
+ }
472
+
473
+ .prefix, .suffix {
474
+ color: var(--color-content-litest);
475
+ }
476
+ }
477
+ </style>
@@ -0,0 +1,123 @@
1
+ <template>
2
+ <Story
3
+ :layout="{
4
+ type: 'grid',
5
+ width: '256',
6
+ }"
7
+ >
8
+ <Variant title="standard">
9
+ <LDropdown
10
+ v-model="value"
11
+ :options="options"
12
+ />
13
+ </Variant>
14
+ <Variant title="disabled">
15
+ <LDropdown
16
+ v-model="value"
17
+ disabled
18
+ :options="options"
19
+ />
20
+ </Variant>
21
+ <Variant title="label">
22
+ <LDropdown
23
+ v-model="value"
24
+ label="Label"
25
+ :options="options"
26
+ />
27
+ </variant>
28
+ <Variant title="big">
29
+ <LDropdown
30
+ v-model="value"
31
+ big
32
+ :options="options"
33
+ />
34
+ </Variant>
35
+ <Variant title="big label">
36
+ <LDropdown
37
+ v-model="value"
38
+ big
39
+ label="Label"
40
+ :options="options"
41
+ />
42
+ </Variant>
43
+ <Variant title="icon color">
44
+ <LDropdown
45
+ v-model="valueIcon"
46
+ :options="optionsIcon"
47
+ />
48
+ </Variant>
49
+ <Variant title="deep">
50
+ <LDropdown
51
+ v-model="valueDeep"
52
+ :options="optionsDeep"
53
+ />
54
+ </Variant>
55
+ <Variant title="input">
56
+ <LDropdown
57
+ v-model="value"
58
+ custom
59
+ :options="options"
60
+ />
61
+ </Variant>
62
+ <Variant title="standard search">
63
+ <LDropdown
64
+ v-model="value"
65
+ :options="options"
66
+ search
67
+ />
68
+ </Variant>
69
+ <Variant title="deep search">
70
+ <LDropdown
71
+ v-model="valueDeep"
72
+ :options="optionsDeep"
73
+ search
74
+ />
75
+ </Variant>
76
+ <Variant title="deep search inside">
77
+ <LDropdown
78
+ v-model="valueDeep"
79
+ :options="optionsDeep"
80
+ search-inside
81
+ />
82
+ </Variant>
83
+ </Story>
84
+ </template>
85
+
86
+ <script setup lang="ts">
87
+ import { ref } from "vue";
88
+ import { faCar, faPlane, faRocket } from "@fortawesome/pro-solid-svg-icons";
89
+ import LDropdown from "./LDropdown.vue";
90
+
91
+ const options = [
92
+ { id: "test", value: "Test" },
93
+ { id: "abc", value: "Abc" },
94
+ { id: "def", value: "Def" }
95
+ ];
96
+
97
+ const optionsIcon = [
98
+ { id: "rocket", icon: { color: "#ff0000", icon: faRocket }, value: "Test" },
99
+ { id: "plane", icon: { color: "#00ff00", icon: faPlane }, value: "Abc" },
100
+ { id: "car", icon: { color: "#0000ff", icon: faCar }, value: "Def" }
101
+ ];
102
+
103
+ const optionsDeep = [
104
+ { id: "child1", value: "Child 1" },
105
+ { id: "child2", disabled: true, value: "Child 2" },
106
+ { id: "parent1", children: [
107
+ { id: "child3", value: "Child 3 Child 3 Child 3 Child 3 Child 3 Child 3 Child 3 Child 3 Child 3 Child 3 " },
108
+ { id: "child4", disabled: true, value: "Child 4" },
109
+ { id: "child5", value: "Child 5" },
110
+ { id: "child6", value: "Child 6" }
111
+ ], value: "Parent 1" },
112
+ { id: "parent2", children: [
113
+ { id: "child7", value: "Child 7" },
114
+ { id: "child8", disabled: true, value: "Child 8" },
115
+ { id: "child9", value: "Child 9" },
116
+ { id: "child10", value: "Child 10" }
117
+ ], disabled: true, value: "Parent 2" }
118
+ ];
119
+
120
+ const value = ref("");
121
+ const valueIcon = ref("");
122
+ const valueDeep = ref("");
123
+ </script>