sprintify-ui 0.10.86 → 0.10.88

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 (29) hide show
  1. package/dist/sprintify-ui.es.js +4611 -4502
  2. package/dist/types/components/BaseAutocomplete.vue.d.ts +88 -4
  3. package/dist/types/components/BaseAutocompleteDrawer.vue.d.ts +44 -4
  4. package/dist/types/components/BaseAutocompleteFetch.vue.d.ts +88 -4
  5. package/dist/types/components/BaseBelongsTo.vue.d.ts +88 -4
  6. package/dist/types/components/BaseBelongsToFetch.vue.d.ts +58 -4
  7. package/dist/types/components/BaseHasMany.vue.d.ts +36 -0
  8. package/dist/types/components/BaseInput.vue.d.ts +2 -0
  9. package/dist/types/components/BaseTagAutocomplete.vue.d.ts +96 -10
  10. package/dist/types/components/BaseTagAutocompleteFetch.vue.d.ts +52 -4
  11. package/dist/types/components/BaseTextarea.vue.d.ts +6 -0
  12. package/package.json +1 -1
  13. package/src/components/BaseAutocomplete.stories.js +10 -0
  14. package/src/components/BaseAutocomplete.vue +11 -1
  15. package/src/components/BaseAutocompleteDrawer.vue +52 -1
  16. package/src/components/BaseAutocompleteFetch.stories.js +6 -0
  17. package/src/components/BaseAutocompleteFetch.vue +10 -0
  18. package/src/components/BaseBelongsTo.stories.js +5 -0
  19. package/src/components/BaseBelongsTo.vue +10 -0
  20. package/src/components/BaseBelongsToFetch.stories.js +6 -0
  21. package/src/components/BaseBelongsToFetch.vue +6 -0
  22. package/src/components/BaseHasMany.stories.js +5 -0
  23. package/src/components/BaseHasMany.vue +10 -0
  24. package/src/components/BaseHasManyFetch.stories.js +12 -0
  25. package/src/components/BaseInput.vue +8 -5
  26. package/src/components/BaseTagAutocomplete.stories.js +5 -0
  27. package/src/components/BaseTagAutocomplete.vue +34 -1
  28. package/src/components/BaseTagAutocompleteFetch.stories.js +6 -0
  29. package/src/components/BaseTextarea.vue +4 -1
@@ -18,6 +18,12 @@ export default {
18
18
  showRouteUrl(id) {
19
19
  return `https://faker.witify.io/api/todos/${id}`;
20
20
  },
21
+ optionColor: (option) => {
22
+ if (option.type === "work") return "green";
23
+ if (option.type === "personal") return "blue";
24
+ if (option.type === "family") return "purple";
25
+ return "gray";
26
+ }
21
27
  },
22
28
  decorators: [() => ({ template: '<div class="mb-36"><story/></div>' })],
23
29
  };
@@ -20,6 +20,8 @@
20
20
  :visible-focus="visibleFocus"
21
21
  :focus-on-mount="focusOnMount"
22
22
  :select="select"
23
+ :option-color="optionColor"
24
+ :option-icon="optionIcon"
23
25
  @update:model-value="onUpdate"
24
26
  >
25
27
  <template #option="optionProps">
@@ -74,6 +76,8 @@ const props = withDefaults(
74
76
  showRemoveButton?: boolean;
75
77
  emptyOptionLabel?: string;
76
78
  select?: SelectConfiguration;
79
+ optionColor?: (option: RawOption) => string;
80
+ optionIcon?: (option: RawOption) => string;
77
81
  }>(),
78
82
  {
79
83
  modelValue: undefined,
@@ -95,6 +99,8 @@ const props = withDefaults(
95
99
  showRemoveButton: true,
96
100
  emptyOptionLabel: undefined,
97
101
  select: undefined,
102
+ optionColor: undefined,
103
+ optionIcon: undefined,
98
104
  }
99
105
  );
100
106
 
@@ -16,6 +16,11 @@ export default {
16
16
  options: options,
17
17
  field: "label",
18
18
  primaryKey: "value",
19
+ optionColor: (option) => {
20
+ if (option.type === "jedi") return "blue";
21
+ if (option.type === "sith") return "black";
22
+ return "gray";
23
+ }
19
24
  },
20
25
  decorators: [() => ({ template: '<div class="mb-36"><story/></div>' })],
21
26
  };
@@ -12,6 +12,8 @@
12
12
  :size="size"
13
13
  :has-error="hasError"
14
14
  :max="max"
15
+ :option-color="optionColor"
16
+ :option-icon="optionIcon"
15
17
  @update:model-value="onUpdate"
16
18
  >
17
19
  <template #items="itemProps">
@@ -96,6 +98,14 @@ const props = defineProps({
96
98
  default: false,
97
99
  type: Boolean,
98
100
  },
101
+ optionColor: {
102
+ default: undefined,
103
+ type: Function as PropType<(option: RawOption) => string>,
104
+ },
105
+ optionIcon: {
106
+ default: undefined,
107
+ type: Function as PropType<(option: RawOption) => string>,
108
+ },
99
109
  });
100
110
 
101
111
  const emit = defineEmits(['update:modelValue']);
@@ -22,6 +22,18 @@ export default {
22
22
  const params = QueryString.stringify({ filter: { id: ids } });
23
23
  return `https://faker.witify.io/api/todos?${params}`;
24
24
  },
25
+ optionColor: (option) => {
26
+ if (option.type === "work") return "green";
27
+ if (option.type === "personal") return "blue";
28
+ if (option.type === "family") return "purple";
29
+ return "gray";
30
+ },
31
+ optionIcon: (option) => {
32
+ if (option.type === "work") return "heroicons-solid:briefcase";
33
+ if (option.type === "personal") return "heroicons-solid:user-circle";
34
+ if (option.type === "family") return "heroicons-solid:home";
35
+ return "heroicons-solid:tag";
36
+ }
25
37
  },
26
38
  decorators: [() => ({ template: '<div class="mb-36"><story/></div>' })],
27
39
  };
@@ -181,6 +181,9 @@ const props = defineProps({
181
181
  },
182
182
  });
183
183
 
184
+ const emit = defineEmits(['update:modelValue', 'focus', 'blur', 'click', 'keydown', 'keyup']);
185
+
186
+
184
187
  const input = ref<HTMLInputElement | null>(null);
185
188
  const focus = ref(false);
186
189
 
@@ -222,6 +225,11 @@ const bindings = computed<any>(() => {
222
225
  if (event.code == 'Enter' && props.preventSubmit) {
223
226
  event.preventDefault();
224
227
  }
228
+
229
+ emit('keydown', event);
230
+ },
231
+ onKeyup(event: KeyboardEvent) {
232
+ emit('keyup', event);
225
233
  },
226
234
  onFocus: (e: Event) => {
227
235
  emit('focus', e);
@@ -254,7 +262,6 @@ const maskInternal = computed(() => {
254
262
  return props.mask;
255
263
  });
256
264
 
257
- const emit = defineEmits(['update:modelValue', 'focus', 'blur', 'click', 'keydown']);
258
265
 
259
266
  const { nameInternal, requiredInternal, hasErrorInternal, emitUpdate, sizeInternal } =
260
267
  useField({
@@ -277,10 +284,6 @@ function onClick(event: MouseEvent) {
277
284
  emit('click', event);
278
285
  }
279
286
 
280
- function onKeydown(event: KeyboardEvent) {
281
- emit('keydown', event);
282
- }
283
-
284
287
  const classes = computed(() => {
285
288
  const base = `inline-flex bg-white input-rounded border transition-colors duration-200`;
286
289
  const border = hasErrorInternal.value ? 'border-red-500' : 'border-slate-300';
@@ -22,6 +22,11 @@ export default {
22
22
  labelKey: "label",
23
23
  valueKey: "value",
24
24
  options: options,
25
+ optionColor: (option) => {
26
+ if (option.type === "jedi") return "blue";
27
+ if (option.type === "sith") return "black";
28
+ return "gray";
29
+ }
25
30
  },
26
31
  decorators: [() => ({ template: '<div class="mb-36"><story/></div>' })],
27
32
  };
@@ -17,8 +17,30 @@
17
17
  >
18
18
  <div
19
19
  :title="selection.label"
20
- class="truncate"
20
+ class="truncate flex gap-2 items-center"
21
21
  >
22
+ <div
23
+ v-if="optionIcon && selection.option"
24
+ class="shrink-0"
25
+ >
26
+ <BaseIcon
27
+ :icon="optionIcon(selection.option)"
28
+ class="shrink-0"
29
+ :color="optionColor ? optionColor(selection.option) : 'gray'"
30
+ />
31
+ </div>
32
+ <div
33
+ v-else-if="optionColor && selection.option"
34
+ class="shrink-0"
35
+ >
36
+ <div
37
+ class="shrink-0 rounded-full h-2.5 w-2.5"
38
+ :style="{
39
+ backgroundColor: optionColor(selection.option),
40
+ }"
41
+ />
42
+ </div>
43
+
22
44
  {{ selection.label }}
23
45
  </div>
24
46
 
@@ -70,6 +92,8 @@
70
92
  :loading="loading"
71
93
  :loading-bottom="loadingBottom"
72
94
  tw-drawer="p-1"
95
+ :option-color="optionColor"
96
+ :option-icon="optionIcon"
73
97
  :keywords="keywords"
74
98
  @select="onSelect"
75
99
  @scroll-bottom="emit('scrollBottom')"
@@ -112,6 +136,7 @@ import { t } from '@/i18n';
112
136
  import { Size, sizes } from '@/utils/sizes';
113
137
  import { autoUpdate, flip, offset, useFloating } from '@floating-ui/vue';
114
138
  import { useElementBounding } from '@vueuse/core';
139
+ import { BaseIcon } from '.';
115
140
 
116
141
  const snackbars = useSnackbarsStore();
117
142
 
@@ -193,6 +218,14 @@ const props = defineProps({
193
218
  default: true,
194
219
  type: Boolean,
195
220
  },
221
+ optionColor: {
222
+ default: undefined,
223
+ type: Function as PropType<(option: RawOption) => string>,
224
+ },
225
+ optionIcon: {
226
+ default: undefined,
227
+ type: Function as PropType<(option: RawOption) => string>,
228
+ },
196
229
  });
197
230
 
198
231
  const emit = defineEmits([
@@ -16,6 +16,12 @@ export default {
16
16
  url: "https://faker.witify.io/api/todos",
17
17
  labelKey: "name",
18
18
  valueKey: "id",
19
+ optionColor: (option) => {
20
+ if (option.type === "work") return "green";
21
+ if (option.type === "personal") return "blue";
22
+ if (option.type === "family") return "purple";
23
+ return "gray";
24
+ },
19
25
  },
20
26
  decorators: [() => ({ template: '<div class="mb-36"><story/></div>' })],
21
27
  };
@@ -10,6 +10,9 @@
10
10
  :rows="rows"
11
11
  :autocomplete="autocomplete ? 'on' : 'off'"
12
12
  :class="classes"
13
+ @click="$emit('click', $event)"
14
+ @keydown="$emit('keydown', $event)"
15
+ @keyup="$emit('keyup', $event)"
13
16
  @input="emitUpdate(transformInputValue($event))"
14
17
  @blur="$emit('blur')"
15
18
  @focus="$emit('focus')"
@@ -78,7 +81,7 @@ const props = defineProps({
78
81
  },
79
82
  });
80
83
 
81
- const emit = defineEmits(['update:modelValue', 'blur', 'focus']);
84
+ const emit = defineEmits(['update:modelValue', 'blur', 'focus', 'click', 'keydown', 'keyup']);
82
85
 
83
86
  const { nameInternal, requiredInternal, hasErrorInternal, emitUpdate, sizeInternal } =
84
87
  useField({