@indielayer/ui 1.11.0 → 1.12.1

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.
@@ -4,20 +4,27 @@ import { ref } from 'vue'
4
4
  const selectedMultiple = ref<string[]>(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M'])
5
5
 
6
6
  const options = ref([
7
- { value: 'A', label: 'Option lorem ipsum' },
8
- { value: 'B', label: 'Option B ipsum' },
9
- { value: 'C', label: 'Option C lorem ipsum' },
10
- { value: 'D', label: 'D' },
11
- { value: 'E', label: 'E ipsum' },
12
- { value: 'F', label: 'Option F' },
13
- { value: 'G', label: 'Option lorem ipsum qoiwjdoqiwjdoqiwjdoqiwjdoi' },
14
- { value: 'H', label: 'Option H' },
15
- { value: 'I', label: 'lorem ipsum dolo' },
16
- { value: 'J', label: 'Option J' },
17
- { value: 'K', label: 'Option K' },
18
- { value: 'L', label: 'consectetur adipi' },
19
- { value: 'M', label: 'Option M' },
7
+ { value: 'A', label: 'Option lorem ipsum', color: 'bg-red-500' },
8
+ { value: 'B', label: 'Option B ipsum', color: 'bg-orange-500' },
9
+ { value: 'C', label: 'Option C lorem ipsum', color: 'bg-amber-500' },
10
+ { value: 'D', label: 'D', color: 'bg-yellow-500' },
11
+ { value: 'E', label: 'E ipsum', color: 'bg-lime-500' },
12
+ { value: 'F', label: 'Option F', color: 'bg-green-500' },
13
+ { value: 'G', label: 'Option lorem ipsum qoiwjdoqiwjdoqiwjdoqiwjdoi', color: 'bg-emerald-500' },
14
+ { value: 'H', label: 'Option H', color: 'bg-teal-500' },
15
+ { value: 'I', label: 'lorem ipsum dolo', color: 'bg-cyan-500' },
16
+ { value: 'J', label: 'Option J', color: 'bg-sky-500' },
17
+ { value: 'K', label: 'Option K', color: 'bg-blue-500' },
18
+ { value: 'L', label: 'consectetur adipi', color: 'bg-indigo-500' },
19
+ { value: 'M', label: 'Option M', color: 'bg-violet-500' },
20
20
  ])
21
+
22
+ const optionsWithColors = options.value.map((option) => {
23
+ return {
24
+ ...option,
25
+ prefix: option.color,
26
+ }
27
+ })
21
28
  </script>
22
29
 
23
30
  <template>
@@ -46,5 +53,20 @@ const options = ref([
46
53
  multiple-checkbox
47
54
  filterable
48
55
  />
56
+ <x-select
57
+ v-model="selectedMultiple"
58
+ label="Multi select - checkbox - prefix items"
59
+ placeholder="Multiple"
60
+ :options="optionsWithColors"
61
+ multiple-checkbox
62
+ filterable
63
+ >
64
+ <template #prefix="{ item }">
65
+ <div class="w-2 h-2 rounded-full" :class="item.prefix"></div>
66
+ </template>
67
+ <template #tag-prefix="{ item }">
68
+ <div class="w-2 h-2 rounded-full" :class="item.prefix"></div>
69
+ </template>
70
+ </x-select>
49
71
  </div>
50
72
  </template>
@@ -111,6 +111,7 @@ const linkTab = ref(null)
111
111
  v-model="tab"
112
112
  class="pb-10"
113
113
  variant="block"
114
+ :full-width="false"
114
115
  ghost
115
116
  >
116
117
  <x-tab value="a" label="Tab A">
@@ -25,5 +25,31 @@ const notifications = useNotifications()
25
25
  <x-tag removable disabled @remove="notifications?.log('remove me')">I'm a md tag</x-tag>
26
26
  <x-tag removable size="lg" @remove="notifications?.log('remove me')">I'm a lg tag</x-tag>
27
27
  <x-tag removable size="xl" @remove="notifications?.log('remove me')">I'm a xl tag</x-tag>
28
+
29
+ <div class="flex flex-col max-w-xs gap-y-1">
30
+ <div>
31
+ <x-tag outlined>
32
+ I'm a veeeeeeeeeeeeeeeeeeeeeeeery long tag
33
+ </x-tag>
34
+ </div>
35
+
36
+ <div>
37
+ <x-tag outlined>
38
+ <template #prefix>
39
+ <div class="w-2 h-2 rounded-full bg-green-500"></div>
40
+ </template>
41
+ I'm a veeeeeeeeeeeeeeeeeeeeery long tag
42
+ </x-tag>
43
+ </div>
44
+
45
+ <div>
46
+ <x-tag removable outlined>
47
+ <template #prefix>
48
+ <div class="w-2 h-2 rounded-full bg-green-500"></div>
49
+ </template>
50
+ I'm a veeeeeeeeeeeeeeeeeeery long tag
51
+ </x-tag>
52
+ </div>
53
+ </div>
28
54
  </div>
29
55
  </template>
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { ref } from 'vue'
3
- import { useNotifications, type UploadFile } from '@indielayer/ui'
3
+ import { useNotifications, XUpload, type UploadFile } from '@indielayer/ui'
4
4
 
5
5
  const notifications = useNotifications()
6
6
 
@@ -72,29 +72,38 @@ function onSubmit(isValid: boolean) {
72
72
  notifications?.success('Valid! Submitted.')
73
73
  }
74
74
 
75
+ const uploadRef = ref<InstanceType<typeof XUpload>>()
76
+
77
+ function reset() {
78
+ uploadRef.value?.reset()
79
+ previewImg.value = undefined
80
+ }
81
+
75
82
  const action = 'https://run.mocky.io/v3/6904ae0b-3cfa-4ae1-bbf2-243a4dd32a3c'
76
83
  </script>
77
84
 
78
85
  <template>
79
86
  <div >
80
87
  <x-form @submit="onSubmit">
81
- <div class="grid md:grid-cols-2 gap-2">
82
- <x-upload
83
- v-model="imageFiles"
84
-
85
- :action="action"
86
- method="POST"
87
- :with-credentials="false"
88
- :rules="[rules.isValidUpload]"
89
-
90
- placeholder="Upload game title cover image"
91
- max-file-size="2000000"
92
- label="Cover Image"
93
- tooltip="Title cover image should be 16:9 aspect ratio and max 2MB"
94
- helper="Title cover image should be 16:9 aspect ratio and max 2MB"
95
- @upload="onUploadComplete"
96
- @change="onChangeImage"
97
- />
88
+ <div class="grid md:grid-cols-2 gap-2 mb-4">
89
+ <div>
90
+ <x-upload
91
+ ref="uploadRef"
92
+ v-model="imageFiles"
93
+ :action="action"
94
+ method="POST"
95
+ :with-credentials="false"
96
+ :rules="[rules.isValidUpload]"
97
+ placeholder="Upload game title cover image"
98
+ max-file-size="2000000"
99
+ label="Cover Image"
100
+ tooltip="Title cover image should be 16:9 aspect ratio and max 2MB"
101
+ helper="Title cover image should be 16:9 aspect ratio and max 2MB"
102
+ @upload="onUploadComplete"
103
+ @change="onChangeImage"
104
+ />
105
+ <x-button size="sm" outlined ghost @click="reset">Reset input</x-button>
106
+ </div>
98
107
  <x-upload
99
108
  v-model="jsonFile"
100
109
  placeholder="Upload your json file"
@@ -105,6 +114,7 @@ const action = 'https://run.mocky.io/v3/6904ae0b-3cfa-4ae1-bbf2-243a4dd32a3c'
105
114
  @change="onChangeJSON"
106
115
  />
107
116
  </div>
117
+ <x-divider class="my-4"/>
108
118
  <x-button type="submit">Submit</x-button>
109
119
  </x-form>
110
120
  <div v-if="previewImg">
@@ -78,10 +78,7 @@ const x = { key: 0 }, ee = ["xs", "sm", "md", "lg", "xl", "full"], oe = ["top",
78
78
  u.value = e, c.value = e, A(), document.body.style.paddingRight = "", document.body.style.overflow = "auto";
79
79
  }
80
80
  typeof window < "u" && G(document, "keydown", W);
81
- const R = (e) => [".v-popper__popper", ".x-datepicker"].some((n) => {
82
- if (typeof n == "string")
83
- return Array.from(window.document.querySelectorAll(n)).some((f) => f === e.target || e.composedPath().includes(f));
84
- });
81
+ const R = (e) => [".v-popper__popper", ".x-datepicker"].some((n) => typeof n == "string" ? Array.from(window.document.querySelectorAll(n)).some((f) => f === e.target || e.composedPath().includes(f)) : !1);
85
82
  function W(e) {
86
83
  e.key === "Escape" && !R(e) && c.value && !d.persistent && p();
87
84
  }
@@ -13,7 +13,6 @@ declare const selectProps: {
13
13
  type: StringConstructor;
14
14
  default: string;
15
15
  };
16
- filterInputProps: ObjectConstructor;
17
16
  virtualList: BooleanConstructor;
18
17
  virtualListOffsetTop: NumberConstructor;
19
18
  virtualListOffsetBottom: NumberConstructor;
@@ -95,7 +94,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<im
95
94
  type: StringConstructor;
96
95
  default: string;
97
96
  };
98
- filterInputProps: ObjectConstructor;
99
97
  virtualList: BooleanConstructor;
100
98
  virtualListOffsetTop: NumberConstructor;
101
99
  virtualListOffsetBottom: NumberConstructor;
@@ -825,7 +823,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<im
825
823
  type: StringConstructor;
826
824
  default: string;
827
825
  };
828
- filterInputProps: ObjectConstructor;
829
826
  virtualList: BooleanConstructor;
830
827
  virtualListOffsetTop: NumberConstructor;
831
828
  virtualListOffsetBottom: NumberConstructor;
@@ -1234,6 +1231,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<im
1234
1231
  disabled: boolean;
1235
1232
  label: string;
1236
1233
  }): any;
1234
+ "tag-prefix"?(_: {
1235
+ item: SelectOption | undefined;
1236
+ }): any;
1237
1237
  "content-header"?(_: {}): any;
1238
1238
  prefix?(_: {
1239
1239
  item: {