sprintify-ui 0.10.87 → 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.
@@ -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
  };
@@ -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
  };