@milaboratories/uikit 2.10.27 → 2.10.28

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/uikit",
3
- "version": "2.10.27",
3
+ "version": "2.10.28",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
@@ -41,8 +41,8 @@
41
41
  "svgo": "^3.3.2",
42
42
  "typescript": "~5.6.3",
43
43
  "vitest": "^4.0.16",
44
- "@milaboratories/ts-builder": "1.2.10",
45
44
  "@milaboratories/build-configs": "1.4.4",
45
+ "@milaboratories/ts-builder": "1.2.10",
46
46
  "@milaboratories/ts-configs": "1.2.1"
47
47
  },
48
48
  "scripts": {
@@ -2,47 +2,52 @@
2
2
  import { PlIcon16 } from "../PlIcon16";
3
3
  import { PlIcon24 } from "../PlIcon24";
4
4
  import { computed } from "vue";
5
+ import PlTooltip from "../PlTooltip/PlTooltip.vue";
5
6
 
6
- const emit = defineEmits(["update:modelValue"]);
7
+ const model = defineModel<string>({ required: true });
7
8
 
8
9
  const props = defineProps<{
9
10
  modelValue?: string;
10
11
  clearable?: boolean;
11
12
  placeholder?: string;
12
13
  disabled?: boolean;
14
+ helper?: string;
15
+ }>();
16
+ const slots = defineSlots<{
17
+ helper: () => unknown;
13
18
  }>();
14
19
 
15
- const value = computed({
16
- get() {
17
- return props.modelValue ?? "";
18
- },
19
- set(v) {
20
- emit("update:modelValue", v);
21
- },
22
- });
23
-
24
- const nonEmpty = computed(() => !!props.modelValue);
20
+ const nonEmpty = computed(() => model.value != null && model.value.length > 0);
21
+ const hasHelper = computed(() => props.helper != null || slots.helper != null);
25
22
 
26
- const clear = () => emit("update:modelValue", "");
23
+ const clear = () => (model.value = "");
27
24
  </script>
28
25
 
29
26
  <template>
30
- <div ref="root" class="pl-search-field" :class="[$style.component]">
27
+ <div ref="root" :class="$style.component">
31
28
  <PlIcon24 name="search" />
32
29
  <input
33
30
  ref="input"
34
- v-model="value"
35
- :disabled="disabled"
36
- :placeholder="placeholder || 'Find...'"
31
+ v-model="model"
32
+ :disabled="props.disabled"
33
+ :placeholder="props.placeholder || 'Find...'"
37
34
  type="text"
38
35
  spellcheck="false"
39
36
  />
40
37
  <PlIcon16
41
- v-if="clearable && nonEmpty"
38
+ v-if="props.clearable && nonEmpty"
42
39
  :class="$style.clear"
43
40
  name="delete-clear"
44
41
  @click.stop="clear"
45
42
  />
43
+
44
+ <PlTooltip v-if="hasHelper" class="info" position="bottom">
45
+ <template #tooltip>
46
+ <slot name="helper">
47
+ {{ props.helper }}
48
+ </slot>
49
+ </template>
50
+ </PlTooltip>
46
51
  </div>
47
52
  </template>
48
53
 
@@ -6,11 +6,11 @@ export default {
6
6
  </script>
7
7
 
8
8
  <script lang="ts" setup>
9
+ import { uniqueId } from "@milaboratories/helpers";
9
10
  import { onUnmounted, reactive, ref, watch } from "vue";
11
+ import { tMap } from "./global";
10
12
  import * as utils from "../../helpers/utils";
11
13
  import { useClickOutside } from "../../composition/useClickOutside";
12
- import { tMap } from "./global";
13
- import { uniqueId } from "@milaboratories/helpers";
14
14
 
15
15
  const emit = defineEmits(["tooltip:close"]);
16
16
 
@@ -189,7 +189,7 @@ const anchorName = `--anchor-${uniqueId()}`;
189
189
  '--anchorName': anchorName,
190
190
  '--gap': gap + 'px',
191
191
  '--offsetToTheEdge': offsetToTheEdge + 'px',
192
- '--pl-tooltip-max-width': maxWidth,
192
+ '--plTooltipMaxWidth': maxWidth,
193
193
  }"
194
194
  >
195
195
  <div :class="$style.plTooltipBox" @click.stop>
@@ -226,7 +226,7 @@ const anchorName = `--anchor-${uniqueId()}`;
226
226
  }
227
227
 
228
228
  .plTooltipContainer {
229
- --pl-tooltip-max-width: 300px;
229
+ --plTooltipMaxWidth: 300px;
230
230
  --gap: 8px;
231
231
  --tailWidth: 8px;
232
232
  --tailHeight: calc(var(--gap) + 2px);
@@ -252,7 +252,7 @@ const anchorName = `--anchor-${uniqueId()}`;
252
252
  border-radius: 6px;
253
253
  width: max-content;
254
254
  word-break: normal;
255
- max-width: var(--pl-tooltip-max-width);
255
+ max-width: var(--plTooltipMaxWidth);
256
256
  color: #fff;
257
257
  }
258
258