sprintify-ui 0.1.16 → 0.1.18

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.
@@ -109,6 +109,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
109
109
  primaryKey: string;
110
110
  currentModels: Option[];
111
111
  }>, {
112
+ items: (_: {
113
+ items: import("@/types").NormalizedOption[];
114
+ removeOption: (option: import("@/types").NormalizedOption) => void;
115
+ disabled: boolean;
116
+ }) => any;
112
117
  option: (_: {
113
118
  focus: () => void;
114
119
  blur: () => void;
@@ -65,6 +65,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
65
65
  default: string;
66
66
  type: PropType<"focus" | "always">;
67
67
  };
68
+ containerClass: {
69
+ default: string;
70
+ type: StringConstructor;
71
+ };
68
72
  }, {
69
73
  focus: () => void;
70
74
  blur: () => void;
@@ -136,6 +140,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
136
140
  default: string;
137
141
  type: PropType<"focus" | "always">;
138
142
  };
143
+ containerClass: {
144
+ default: string;
145
+ type: StringConstructor;
146
+ };
139
147
  }>> & {
140
148
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
141
149
  onScrollBottom?: ((...args: any[]) => any) | undefined;
@@ -155,7 +163,13 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
155
163
  loadingBottom: boolean;
156
164
  size: "base" | "xs" | "sm";
157
165
  dropdownShow: "focus" | "always";
166
+ containerClass: string;
158
167
  }>, {
168
+ items: (_: {
169
+ items: NormalizedOption[];
170
+ removeOption: (option: NormalizedOption) => void;
171
+ disabled: boolean;
172
+ }) => any;
159
173
  empty: (_: {
160
174
  focus: () => void;
161
175
  blur: () => void;
@@ -101,6 +101,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
101
101
  hasError: boolean;
102
102
  queryKey: string;
103
103
  }>, {
104
+ items: (_: {
105
+ items: import("@/types").NormalizedOption[];
106
+ removeOption: (option: import("@/types").NormalizedOption) => void;
107
+ disabled: boolean;
108
+ }) => any;
104
109
  option: (_: {
105
110
  focus: () => void;
106
111
  blur: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build-fast": "rimraf dist && vite build",
@@ -16,7 +16,7 @@
16
16
  <div v-if="searchable" class="grow">
17
17
  <div class="relative h-11">
18
18
  <div
19
- class="pointer-events-none absolute top-0 left-0 flex h-full items-center justify-center pl-2.5"
19
+ class="pointer-events-none absolute left-0 top-0 flex h-full items-center justify-center pl-2.5"
20
20
  >
21
21
  <BaseIcon
22
22
  class="h-6 w-6 text-slate-400"
@@ -33,7 +33,7 @@
33
33
  />
34
34
  <div
35
35
  v-if="searchQuery"
36
- class="absolute top-0 right-0 flex h-full items-center justify-center p-1"
36
+ class="absolute right-0 top-0 flex h-full items-center justify-center p-1"
37
37
  >
38
38
  <button
39
39
  type="button"
@@ -494,6 +494,13 @@ watch(
494
494
  }
495
495
  );
496
496
 
497
+ watch(
498
+ () => props.url,
499
+ () => {
500
+ fetch();
501
+ }
502
+ );
503
+
497
504
  watch(
498
505
  () => props.urlQuery,
499
506
  () => {
@@ -62,7 +62,7 @@ Maximum.args = {
62
62
 
63
63
  export const SlotOption = (args) => {
64
64
  return {
65
- components: {},
65
+ components: { BaseHasMany },
66
66
  setup() {
67
67
  const value = ref([]);
68
68
  return { args, value };
@@ -93,9 +93,48 @@ export const SlotOption = (args) => {
93
93
  };
94
94
  };
95
95
 
96
+ export const SlotItem = (args) => {
97
+ return {
98
+ components: { BaseHasMany },
99
+ setup() {
100
+ const value = ref(null);
101
+ return { args, value };
102
+ },
103
+ template: `
104
+ <BaseHasMany
105
+ v-model="value"
106
+ v-bind="args"
107
+ >
108
+ <template #items="{items, removeOption}">
109
+ <div
110
+ v-for="item in items"
111
+ :key="item"
112
+ class="p-0.5"
113
+ >
114
+ <div class="flex items-center rounded border pl-2 py-1 bg-white">
115
+ <BaseIcon icon="heroicons:tag" class="mr-2 text-slate-500" />
116
+ <div>
117
+ {{ item.label }}
118
+ </div>
119
+
120
+ <button
121
+ type="button"
122
+ class="flex shrink-0 appearance-none items-center justify-center border-0 bg-transparent pl-1 pr-3 text-xs outline-none"
123
+ @click=removeOption(item)
124
+ >
125
+
126
+ </button>
127
+ </div>
128
+ </div>
129
+ </template>
130
+ </BaseHasMany>
131
+ `,
132
+ };
133
+ };
134
+
96
135
  export const SlotFooter = (args) => {
97
136
  return {
98
- components: {},
137
+ components: { BaseHasMany },
99
138
  setup() {
100
139
  const value = ref([]);
101
140
  function onClick() {
@@ -122,7 +161,7 @@ export const SlotFooter = (args) => {
122
161
 
123
162
  export const SlotEmpty = (args) => {
124
163
  return {
125
- components: {},
164
+ components: { BaseHasMany },
126
165
  setup() {
127
166
  const value = ref([]);
128
167
  return { args, value };
@@ -13,12 +13,18 @@
13
13
  :max="max"
14
14
  @update:model-value="onUpdate"
15
15
  >
16
+ <template #items="itemProps">
17
+ <slot name="items" v-bind="itemProps" />
18
+ </template>
19
+
16
20
  <template #option="optionProps">
17
21
  <slot name="option" v-bind="optionProps" />
18
22
  </template>
23
+
19
24
  <template #empty="emptyProps">
20
25
  <slot name="empty" v-bind="emptyProps" />
21
26
  </template>
27
+
22
28
  <template #footer="footerProps">
23
29
  <slot name="footer" v-bind="footerProps" />
24
30
  </template>
@@ -124,6 +124,85 @@ export const SlotOption = (args) => ({
124
124
  `,
125
125
  });
126
126
 
127
+ export const SlotItem = (args) => {
128
+ return {
129
+ components: { BaseTagAutocomplete },
130
+ setup() {
131
+ const value = ref(null);
132
+ return { args, value };
133
+ },
134
+ template: `
135
+ <BaseTagAutocomplete
136
+ v-model="value"
137
+ v-bind="args"
138
+ >
139
+ <template #items="{items, removeOption}">
140
+ <div
141
+ v-for="item in items"
142
+ :key="item"
143
+ class="p-0.5"
144
+ >
145
+ <div class="flex items-center rounded border pl-2 py-1 bg-white">
146
+ <BaseIcon icon="heroicons:tag" class="mr-2 text-slate-500" />
147
+ <div>
148
+ {{ item.label }}
149
+ </div>
150
+
151
+ <button
152
+ type="button"
153
+ class="flex shrink-0 appearance-none items-center justify-center border-0 bg-transparent pl-1 pr-3 text-xs outline-none"
154
+ @click=removeOption(item)
155
+ >
156
+
157
+ </button>
158
+ </div>
159
+ </div>
160
+ </template>
161
+ </BaseTagAutocomplete>
162
+ `,
163
+ };
164
+ };
165
+
166
+ export const SlotBlockItem = (args) => {
167
+ return {
168
+ components: { BaseTagAutocomplete },
169
+ setup() {
170
+ const value = ref(null);
171
+ return { args, value };
172
+ },
173
+ template: `
174
+ <BaseTagAutocomplete
175
+ v-model="value"
176
+ v-bind="args"
177
+ container-class="block"
178
+ >
179
+ <template #items="{items, removeOption}">
180
+ <div
181
+ v-for="item in items"
182
+ :key="item"
183
+ class="p-0.5"
184
+ >
185
+ <div class="flex items-center rounded border pl-2 py-1 bg-white">
186
+ <BaseIcon icon="heroicons:tag" class="mr-2 text-slate-500" />
187
+ <div>
188
+ {{ item.label }}
189
+ </div>
190
+
191
+ <button
192
+ type="button"
193
+ class="flex shrink-0 appearance-none items-center justify-center border-0 bg-transparent pl-1 pr-3 text-xs outline-none"
194
+ @click=removeOption(item)
195
+ >
196
+
197
+ </button>
198
+ </div>
199
+ </div>
200
+ </template>
201
+ </BaseTagAutocomplete>
202
+ `,
203
+ };
204
+ };
205
+
127
206
  export const SlotFooter = (args) => {
128
207
  return {
129
208
  components: { BaseTagAutocomplete, ShowValue, BaseAppNotifications },
@@ -7,32 +7,41 @@
7
7
  wrapperClass,
8
8
  ]"
9
9
  >
10
- <div class="-m-0.5 flex flex-wrap">
11
- <div
12
- v-for="selection in normalizedModelValue"
13
- :key="selection.value ? selection.value : 'null'"
14
- class="p-0.5"
10
+ <div :class="containerClass">
11
+ <slot
12
+ name="items"
13
+ :items="normalizedModelValue"
14
+ :remove-option="removeOption"
15
+ :disabled="disabled"
15
16
  >
16
17
  <div
17
- class="flex items-stretch rounded border"
18
- :class="[
19
- disabled ? 'cursor-not-allowed opacity-60' : '',
20
- selectionClass(selection),
21
- ]"
18
+ v-for="selection in normalizedModelValue"
19
+ :key="selection.value ? selection.value : 'null'"
20
+ class="p-0.5"
22
21
  >
23
- <div :class="[selectionLabelClass]">
24
- {{ selection.label }}
25
- </div>
26
- <button
27
- v-if="!disabled"
28
- type="button"
29
- class="flex shrink-0 appearance-none items-center justify-center border-0 bg-transparent pl-1 pr-3 text-xs outline-none"
30
- @click="removeOption(selection)"
22
+ <div
23
+ class="flex items-stretch rounded border"
24
+ :class="[
25
+ disabled ? 'cursor-not-allowed opacity-60' : '',
26
+ selectionClass(selection),
27
+ ]"
31
28
  >
32
-
33
- </button>
29
+ <div :class="[selectionLabelClass]">
30
+ {{ selection.label }}
31
+ </div>
32
+
33
+ <button
34
+ v-if="!disabled"
35
+ type="button"
36
+ class="flex shrink-0 appearance-none items-center justify-center border-0 bg-transparent pl-1 pr-3 text-xs outline-none"
37
+ @click="removeOption(selection)"
38
+ >
39
+
40
+ </button>
41
+ </div>
34
42
  </div>
35
- </div>
43
+ </slot>
44
+
36
45
  <div class="grow p-0.5">
37
46
  <input
38
47
  ref="inputElement"
@@ -141,6 +150,7 @@ const props = defineProps({
141
150
  default: false,
142
151
  type: Boolean,
143
152
  },
153
+
144
154
  max: {
145
155
  default: undefined,
146
156
  type: Number,
@@ -165,6 +175,10 @@ const props = defineProps({
165
175
  default: 'focus',
166
176
  type: String as PropType<'focus' | 'always'>,
167
177
  },
178
+ containerClass: {
179
+ default: '-m-0.5 flex flex-wrap',
180
+ type: String,
181
+ },
168
182
  });
169
183
 
170
184
  const emit = defineEmits([
@@ -89,6 +89,45 @@ export const SlotOption = (args) => {
89
89
  };
90
90
  };
91
91
 
92
+ export const SlotItem = (args) => {
93
+ return {
94
+ components: { BaseTagAutocompleteFetch },
95
+ setup() {
96
+ const value = ref(null);
97
+ return { args, value };
98
+ },
99
+ template: `
100
+ <BaseTagAutocompleteFetch
101
+ v-model="value"
102
+ v-bind="args"
103
+ >
104
+ <template #items="{items, removeOption}">
105
+ <div
106
+ v-for="item in items"
107
+ :key="item"
108
+ class="p-0.5"
109
+ >
110
+ <div class="flex items-center rounded border pl-2 py-1 bg-white">
111
+ <BaseIcon icon="heroicons:tag" class="mr-2 text-slate-500" />
112
+ <div>
113
+ {{ item.label }}
114
+ </div>
115
+
116
+ <button
117
+ type="button"
118
+ class="flex shrink-0 appearance-none items-center justify-center border-0 bg-transparent pl-1 pr-3 text-xs outline-none"
119
+ @click=removeOption(item)
120
+ >
121
+
122
+ </button>
123
+ </div>
124
+ </div>
125
+ </template>
126
+ </BaseTagAutocompleteFetch>
127
+ `,
128
+ };
129
+ };
130
+
92
131
  export const SlotFooter = (args) => {
93
132
  return {
94
133
  components: { BaseTagAutocompleteFetch },
@@ -17,6 +17,10 @@
17
17
  @scroll-bottom="scrollBottom"
18
18
  @update:model-value="$emit('update:modelValue', $event)"
19
19
  >
20
+ <template #items="itemProps">
21
+ <slot name="items" v-bind="itemProps" />
22
+ </template>
23
+
20
24
  <template #option="optionProps">
21
25
  <slot name="option" v-bind="optionProps" />
22
26
  </template>