@dative-gpi/foundation-shared-components 0.0.5 → 0.0.6

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 (46) hide show
  1. package/components/FSBreadcrumbs.vue +16 -14
  2. package/components/FSButton.vue +79 -29
  3. package/components/FSCheckbox.vue +21 -10
  4. package/components/FSCol.vue +17 -17
  5. package/components/FSColor.vue +80 -0
  6. package/components/FSFadeOut.vue +4 -4
  7. package/components/FSIcon.vue +5 -3
  8. package/components/FSNumberField.vue +1 -1
  9. package/components/FSPasswordField.vue +20 -9
  10. package/components/FSRadio.vue +20 -10
  11. package/components/FSRadioGroup.vue +5 -7
  12. package/components/FSRow.vue +17 -17
  13. package/components/FSSearchField.vue +122 -0
  14. package/components/FSSlideGroup.vue +16 -12
  15. package/components/FSSpan.vue +27 -2
  16. package/components/FSSwitch.vue +25 -12
  17. package/components/FSTab.vue +9 -2
  18. package/components/FSTabs.vue +18 -10
  19. package/components/FSTag.vue +31 -17
  20. package/components/FSTagField.vue +152 -0
  21. package/components/FSTagGroup.vue +60 -0
  22. package/components/FSText.vue +78 -0
  23. package/components/FSTextField.vue +74 -18
  24. package/components/FSWrapGroup.vue +15 -12
  25. package/composables/useColors.ts +31 -21
  26. package/{defaults → models}/FSButtons.ts +24 -6
  27. package/models/FSTags.ts +8 -0
  28. package/models/FSTextFields.ts +17 -0
  29. package/package.json +5 -4
  30. package/styles/components/fs_breadcrumbs.scss +10 -5
  31. package/styles/components/fs_button.scss +21 -20
  32. package/styles/components/fs_checkbox.scss +3 -4
  33. package/styles/components/fs_color.scss +5 -0
  34. package/styles/components/fs_password_field.scss +6 -1
  35. package/styles/components/fs_radio.scss +3 -4
  36. package/styles/components/fs_span.scss +7 -2
  37. package/styles/components/fs_switch.scss +4 -4
  38. package/styles/components/fs_tabs.scss +8 -8
  39. package/styles/components/fs_tag.scss +8 -8
  40. package/styles/components/fs_tag_field.scss +10 -0
  41. package/styles/components/fs_text.scss +5 -0
  42. package/styles/components/fs_text_field.scss +25 -14
  43. package/styles/components/index.scss +3 -0
  44. package/styles/globals/overrides.scss +13 -4
  45. package/styles/globals/text_fonts.scss +4 -0
  46. package/themes/default.ts +6 -6
@@ -50,57 +50,57 @@ export default defineComponent({
50
50
  "--fs-row-height": height.value
51
51
  }));
52
52
 
53
- const classes = computed((): string => {
54
- let classes = "fs-row";
53
+ const classes = computed((): string[] => {
54
+ const classes = ["fs-row"];
55
55
  switch (width.value) {
56
56
  case "hug":
57
- classes += " fs-row-width-hug";
57
+ classes.push("fs-row-width-hug");
58
58
  break;
59
59
  case "fill":
60
- classes += " fs-row-width-fill";
60
+ classes.push("fs-row-width-fill");
61
61
  break;
62
62
  default:
63
- classes += " fs-row-width-fixed";
63
+ classes.push("fs-row-width-fixed");
64
64
  break;
65
65
  }
66
66
  switch (height.value) {
67
67
  case "hug":
68
- classes += " fs-row-height-hug";
68
+ classes.push("fs-row-height-hug");
69
69
  break;
70
70
  case "fill":
71
- classes += " fs-row-height-fill";
71
+ classes.push("fs-row-height-fill");
72
72
  break;
73
73
  default:
74
- classes += " fs-row-height-fixed";
74
+ classes.push("fs-row-height-fixed");
75
75
  break;
76
76
  }
77
77
  switch (align.value) {
78
78
  case "top-left":
79
- classes += " fs-row-top-left";
79
+ classes.push("fs-row-top-left");
80
80
  break;
81
81
  case "top-center":
82
- classes += " fs-row-top-center";
82
+ classes.push("fs-row-top-center");
83
83
  break;
84
84
  case "top-right":
85
- classes += " fs-row-top-right";
85
+ classes.push("fs-row-top-right");
86
86
  break;
87
87
  case "center-left":
88
- classes += " fs-row-center-left";
88
+ classes.push("fs-row-center-left");
89
89
  break;
90
90
  case "center-center":
91
- classes += " fs-row-center-center";
91
+ classes.push("fs-row-center-center");
92
92
  break;
93
93
  case "center-right":
94
- classes += " fs-row-center-right";
94
+ classes.push("fs-row-center-right");
95
95
  break;
96
96
  case "bottom-left":
97
- classes += " fs-row-bottom-left";
97
+ classes.push("fs-row-bottom-left");
98
98
  break;
99
99
  case "bottom-center":
100
- classes += " fs-row-bottom-center";
100
+ classes.push("fs-row-bottom-center");
101
101
  break;
102
102
  case "bottom-right":
103
- classes += " fs-row-bottom-right";
103
+ classes.push("fs-row-bottom-right");
104
104
  break;
105
105
  }
106
106
  return classes;
@@ -0,0 +1,122 @@
1
+ <template>
2
+ <FSTextField
3
+ :label="$props.label"
4
+ :description="$props.description"
5
+ :type="type"
6
+ :color="$props.color"
7
+ :required="$props.required"
8
+ :editable="$props.editable"
9
+ :value="innerValue"
10
+ @update:value="(value) => innerValue = value"
11
+ v-bind="$attrs"
12
+ >
13
+ <template #append>
14
+ <FSButton
15
+ :prependIcon="$props.buttonPrependIcon"
16
+ :label="$props.buttonLabel"
17
+ :appendIcon="$props.buttonAppendIcon"
18
+ :variant="$props.buttonVariant"
19
+ :color="$props.buttonColor"
20
+ :editable="$props.editable"
21
+ @click="onUpdate"
22
+ />
23
+ </template>
24
+ <template v-for="(_, name) in $slots" v-slot:[name]="slotData">
25
+ <slot :name="name" v-bind="slotData" />
26
+ </template>
27
+ </FSTextField>
28
+ </template>
29
+
30
+ <script lang="ts">
31
+ import { defineComponent, PropType, Ref, ref, toRefs } from "vue";
32
+
33
+ import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
34
+
35
+ import FSTextField from "./FSTextField.vue";
36
+ import FSButton from "./FSButton.vue";
37
+ import FSIcon from "./FSIcon.vue";
38
+
39
+ export default defineComponent({
40
+ name: "FSSearchField",
41
+ components: {
42
+ FSTextField,
43
+ FSButton,
44
+ FSIcon
45
+ },
46
+ props: {
47
+ label: {
48
+ type: String,
49
+ required: false,
50
+ default: null
51
+ },
52
+ description: {
53
+ type: String,
54
+ required: false,
55
+ default: null
56
+ },
57
+ buttonPrependIcon: {
58
+ type: String,
59
+ required: false,
60
+ default: "mdi-magnify"
61
+ },
62
+ buttonLabel: {
63
+ type: String,
64
+ required: false,
65
+ default: null
66
+ },
67
+ buttonAppendIcon: {
68
+ type: String,
69
+ required: false,
70
+ default: null
71
+ },
72
+ buttonVariant: {
73
+ type: String as PropType<"standard" | "full" | "icon">,
74
+ required: false,
75
+ default: "standard"
76
+ },
77
+ value: {
78
+ type: String,
79
+ required: false,
80
+ default: null
81
+ },
82
+ color: {
83
+ type: String as PropType<ColorBase>,
84
+ required: false,
85
+ default: ColorBase.Dark
86
+ },
87
+ buttonColor: {
88
+ type: String as PropType<ColorBase>,
89
+ required: false,
90
+ default: ColorBase.Primary
91
+ },
92
+ required: {
93
+ type: Boolean,
94
+ required: false,
95
+ default: false
96
+ },
97
+ editable: {
98
+ type: Boolean,
99
+ required: false,
100
+ default: true
101
+ }
102
+ },
103
+ emits: ["update:value"],
104
+ setup(props, { emit }) {
105
+ const { editable } = toRefs(props);
106
+
107
+ const innerValue: Ref<String> = ref(props.value);
108
+
109
+ const onUpdate = (): void => {
110
+ if (!editable.value) {
111
+ return;
112
+ }
113
+ emit("update:value", innerValue.value);
114
+ };
115
+
116
+ return {
117
+ innerValue,
118
+ onUpdate
119
+ };
120
+ }
121
+ });
122
+ </script>
@@ -7,14 +7,14 @@
7
7
  >
8
8
  <FSRow>
9
9
  <v-slide-group-item v-for="(component, index) in $slots.default()" :key="index">
10
- <component :is="component" v-bind="{ color }" />
10
+ <component :is="component" v-bind="{ color, colors, style }" />
11
11
  </v-slide-group-item>
12
12
  </FSRow>
13
13
  </v-slide-group>
14
14
  </template>
15
15
 
16
16
  <script lang="ts">
17
- import { defineComponent, PropType, toRefs } from "vue";
17
+ import { defineComponent, PropType, Ref, ref, toRefs } from "vue";
18
18
 
19
19
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
20
20
  import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
@@ -36,20 +36,24 @@ export default defineComponent({
36
36
  setup(props) {
37
37
  const { color } = toRefs(props);
38
38
 
39
- const colors = useColors().getVariants(color.value);
40
- const dark = useColors().getVariants(ColorBase.Dark);
39
+ const textColors = useColors().getContrasts(color.value);
40
+ const colors = useColors().getColors(color.value);
41
41
 
42
- const style = {
43
- "--fs-group-light-color" : colors.light,
44
- "--fs-group-base-color" : colors.base,
45
- "--fs-group-dark-color" : colors.dark,
46
- "--fs-group-light-text" : dark.base,
47
- "--fs-group-base-text" : dark.base,
48
- "--fs-group-dark-text" : dark.dark
49
- };
42
+ const darks = useColors().getColors(ColorBase.Dark);
43
+
44
+ const style: Ref<{ [code: string]: string } & Partial<CSSStyleDeclaration>> = ref({
45
+ "--fs-group-color": darks.base,
46
+ "--fs-group-hover-background-color": colors.light,
47
+ "--fs-group-hover-color": darks.dark,
48
+ "--fs-group-disabled-color": darks.light,
49
+ "--fs-group-light": colors.light,
50
+ "--fs-group-base": colors.base,
51
+ "--fs-group-dark": colors.dark
52
+ });
50
53
 
51
54
  return {
52
55
  color,
56
+ colors,
53
57
  style
54
58
  };
55
59
  }
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <span
3
- :class="'fs-span ' + $props.font"
3
+ :class="classes"
4
4
  v-bind="$attrs"
5
5
  >
6
6
  <slot />
@@ -8,7 +8,7 @@
8
8
  </template>
9
9
 
10
10
  <script lang="ts">
11
- import { defineComponent, PropType } from "vue";
11
+ import { computed, defineComponent, PropType, toRefs, useSlots } from "vue";
12
12
 
13
13
  export default defineComponent({
14
14
  name: "FSSpan",
@@ -17,7 +17,32 @@ export default defineComponent({
17
17
  type: String as PropType<"text-h1" | "text-h2" | "text-h3" | "text-body" | "text-button" | "text-overline" | "text-underline">,
18
18
  required: false,
19
19
  default: "text-body"
20
+ },
21
+ ellipsis: {
22
+ type: Boolean,
23
+ required: false,
24
+ default: true
20
25
  }
26
+ },
27
+ setup(props) {
28
+ const { font } = toRefs(props);
29
+
30
+ const slots = useSlots();
31
+
32
+ const classes = computed((): string[] => {
33
+ const classes = ["fs-span", font.value];
34
+ if (props.ellipsis) {
35
+ classes.push("fs-span-ellipsis");
36
+ }
37
+ if (!slots.default) {
38
+ classes.push("fs-span-pre-wrap");
39
+ }
40
+ return classes;
41
+ });
42
+
43
+ return {
44
+ classes
45
+ };
21
46
  }
22
47
  });
23
48
  </script>
@@ -84,21 +84,34 @@ export default defineComponent({
84
84
  setup(props, { emit }) {
85
85
  const { value, color, editable } = toRefs(props);
86
86
 
87
- const background = useColors().getBackground();
88
- const colors = useColors().getVariants(color.value);
89
- const dark = useColors().getVariants(ColorBase.Dark);
87
+ const colors = useColors().getColors(color.value);
90
88
 
91
- const style = computed(() => ({
92
- "--fs-switch-cursor" : editable.value ? "pointer" : "default",
93
- "--fs-switch-translate-x" : value.value ? "8px" : "-8px",
94
- "--fs-switch-base-color" : value.value ? colors.base : editable.value ? dark.base : dark.light,
95
- "--fs-switch-base-text" : editable.value ? dark.base : dark.light,
96
- "--fs-switch-base-background": background.base
97
- }));
89
+ const backgrounds = useColors().getColors(ColorBase.Background);
90
+ const lights = useColors().getColors(ColorBase.Light);
91
+ const darks = useColors().getColors(ColorBase.Dark);
98
92
 
99
- const font = computed(() => value.value ? "text-button" : "text-body");
93
+ const style = computed((): { [code: string]: string } & Partial<CSSStyleDeclaration> => {
94
+ if (!editable.value) {
95
+ return {
96
+ "--fs-switch-translate-x": value.value ? "8px" : "-8px",
97
+ "--fs-switch-cursor": "default",
98
+ "--fs-switch-track-color": lights.dark,
99
+ "--fs-switch-thumb-color": backgrounds.base,
100
+ "--fs-switch-color": lights.dark
101
+ };
102
+ }
103
+ return {
104
+ "--fs-switch-translate-x": value.value ? "8px" : "-8px",
105
+ "--fs-switch-cursor": "pointer",
106
+ "--fs-switch-track-color": value.value ? colors.base : darks.base,
107
+ "--fs-switch-thumb-color": backgrounds.base,
108
+ "--fs-switch-color": darks.base
109
+ };
110
+ });
111
+
112
+ const font = computed((): string => value.value ? "text-button" : "text-body");
100
113
 
101
- const onToggle = () => {
114
+ const onToggle = (): void => {
102
115
  if (!editable.value) {
103
116
  return;
104
117
  }
@@ -16,7 +16,7 @@
16
16
  {{ $props.label }}
17
17
  </FSSpan>
18
18
  </slot>
19
- <v-spacer />
19
+ <v-spacer v-if="$props.tag" />
20
20
  <slot name="tag">
21
21
  <FSSpan v-if="$props.tag" class="fs-tab-tag">
22
22
  {{ $props.tag }}
@@ -33,7 +33,9 @@
33
33
  </template>
34
34
 
35
35
  <script lang="ts">
36
- import { defineComponent } from "vue";
36
+ import { defineComponent, PropType } from "vue";
37
+
38
+ import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
37
39
 
38
40
  import FSSpan from "./FSSpan.vue";
39
41
  import FSIcon from "./FSIcon.vue";
@@ -66,6 +68,11 @@ export default defineComponent({
66
68
  type: String,
67
69
  required: false,
68
70
  default: null
71
+ },
72
+ color: {
73
+ type: String as PropType<ColorBase>,
74
+ required: false,
75
+ default: ColorBase.Dark
69
76
  }
70
77
  }
71
78
  });
@@ -11,13 +11,13 @@
11
11
  v-bind="$attrs"
12
12
  >
13
13
  <template v-for="(component, index) in $slots.default()" :key="index">
14
- <component :is="component" />
14
+ <component :is="component" v-bind="{ color, colors, style }" />
15
15
  </template>
16
16
  </v-tabs>
17
17
  </template>
18
18
 
19
19
  <script lang="ts">
20
- import { defineComponent, PropType, toRefs } from "vue";
20
+ import { defineComponent, PropType, Ref, ref, toRefs } from "vue";
21
21
 
22
22
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
23
23
  import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
@@ -40,18 +40,26 @@ export default defineComponent({
40
40
  setup(props, { emit }) {
41
41
  const { tab, color } = toRefs(props);
42
42
 
43
- const colors = useColors().getVariants(color.value);
44
- const dark = useColors().getVariants(ColorBase.Dark);
43
+ const textColors = useColors().getContrasts(color.value);
44
+ const colors = useColors().getColors(color.value);
45
45
 
46
- const style = {
47
- "--fs-group-light-color" : colors.light,
48
- "--fs-group-base-color" : colors.base,
49
- "--fs-group-light-text" : dark.base,
50
- "--fs-group-dark-text" : dark.dark
51
- };
46
+ const darks = useColors().getColors(ColorBase.Dark);
47
+
48
+ const style: Ref<{ [code: string]: string } & Partial<CSSStyleDeclaration>> = ref({
49
+ "--fs-group-color": darks.base,
50
+ "--fs-group-hover-background-color": colors.light,
51
+ "--fs-group-hover-color": darks.dark,
52
+ "--fs-group-disabled-color": darks.light,
53
+ "--fs-group-light": colors.light,
54
+ "--fs-group-base": colors.base,
55
+ "--fs-group-dark": colors.dark,
56
+ "--fs-tab-tag-background-color": colors.base,
57
+ "--fs-tab-tag-color": textColors.light
58
+ });
52
59
 
53
60
  return {
54
61
  tab,
62
+ color,
55
63
  colors,
56
64
  style,
57
65
  emit
@@ -6,14 +6,14 @@
6
6
  :style="style"
7
7
  v-bind="$attrs"
8
8
  >
9
- <slot name="default">
9
+ <slot name="default" v-bind="{ color, colors }">
10
10
  <FSSpan class="fs-tag-label">
11
11
  {{ $props.label }}
12
12
  </FSSpan>
13
13
  </slot>
14
- <slot name="button">
14
+ <slot name="button" v-bind="{ color, colors }">
15
15
  <v-btn
16
- v-if="editable"
16
+ v-if="$props.editable"
17
17
  class="fs-tag-button"
18
18
  :ripple="false"
19
19
  @click="$emit('remove')"
@@ -48,10 +48,10 @@ export default defineComponent({
48
48
  type: String,
49
49
  required: true
50
50
  },
51
- full: {
52
- type: Boolean,
51
+ variant: {
52
+ type: String as PropType<"standard" | "full">,
53
53
  required: false,
54
- default: true
54
+ default: "full"
55
55
  },
56
56
  color: {
57
57
  type: String as PropType<ColorBase>,
@@ -66,21 +66,35 @@ export default defineComponent({
66
66
  },
67
67
  emits: ["remove"],
68
68
  setup(props) {
69
- const { full, color, editable } = toRefs(props);
69
+ const { variant, color } = toRefs(props);
70
70
 
71
- const colors = useColors().getVariants(color.value);
71
+ const textColors = useColors().getContrasts(color.value);
72
+ const colors = useColors().getColors(color.value);
72
73
 
73
- const style = computed(() => ({
74
- "--fs-tag-light-color": full.value ? colors.base : colors.light,
75
- "--fs-tag-base-color" : colors.base,
76
- "--fs-tag-dark-color" : colors.dark,
77
- "--fs-tag-light-text" : full.value ? colors.light : colors.base,
78
- "--fs-tag-base-text" : colors.light,
79
- "--fs-tag-dark-text" : colors.light
80
- }));
74
+ const style = computed((): { [code: string]: string } & Partial<CSSStyleDeclaration> => {
75
+ switch (variant.value) {
76
+ case "standard": return {
77
+ "--fs-tag-background-color": colors.light,
78
+ "--fs-tag-color": textColors.base,
79
+ "--fs-tag-hover-background-color": colors.base,
80
+ "--fs-tag-hover-color": textColors.light,
81
+ "--fs-tag-active-background-color": colors.dark,
82
+ "--fs-tag-active-color": textColors.light
83
+ };
84
+ case "full": return {
85
+ "--fs-tag-background-color": colors.base,
86
+ "--fs-tag-color": textColors.light,
87
+ "--fs-tag-hover-background-color": colors.base,
88
+ "--fs-tag-hover-color": textColors.light,
89
+ "--fs-tag-active-background-color": colors.dark,
90
+ "--fs-tag-active-color": textColors.light
91
+ };
92
+ }
93
+ });
81
94
 
82
95
  return {
83
- editable,
96
+ colors,
97
+ color,
84
98
  style
85
99
  };
86
100
  }
@@ -0,0 +1,152 @@
1
+ <template>
2
+ <FSCol>
3
+ <FSTextField
4
+ :label="$props.label"
5
+ :description="$props.description"
6
+ :type="type"
7
+ :color="$props.color"
8
+ :required="$props.required"
9
+ :editable="$props.editable"
10
+ :value="innerValue"
11
+ @update:value="(value) => innerValue = value"
12
+ @keydown.enter="onAdd"
13
+ v-bind="$attrs"
14
+ >
15
+ <template #append-inner>
16
+ <FSIcon
17
+ class="fs-tag-field-icon"
18
+ size="m"
19
+ :style="style"
20
+ @click="onAdd"
21
+ >
22
+ mdi-tag-outline
23
+ </FSIcon>
24
+ </template>
25
+ <template v-for="(_, name) in $slots" v-slot:[name]="slotData">
26
+ <slot :name="name" v-bind="slotData" />
27
+ </template>
28
+ </FSTextField>
29
+ <FSTagGroup
30
+ :tags="$props.value"
31
+ :variant="$props.variant"
32
+ :color="$props.tagColor"
33
+ :editable="$props.editable"
34
+ @remove="onRemove"
35
+ />
36
+ </FSCol>
37
+ </template>
38
+
39
+ <script lang="ts">
40
+ import { computed, defineComponent, PropType, ref, toRefs } from "vue";
41
+
42
+ import { useColors } from "@dative-gpi/foundation-shared-components/composables";
43
+ import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
44
+
45
+ import FSTextField from "./FSTextField.vue";
46
+ import FSTagGroup from "./FSTagGroup.vue";
47
+ import FSCol from "./FSCol.vue"
48
+
49
+ export default defineComponent({
50
+ name: "FSTagField",
51
+ components: {
52
+ FSTextField,
53
+ FSTagGroup,
54
+ FSCol
55
+ },
56
+ props: {
57
+ label: {
58
+ type: String,
59
+ required: false,
60
+ default: null
61
+ },
62
+ description: {
63
+ type: String,
64
+ required: false,
65
+ default: null
66
+ },
67
+ value: {
68
+ type: Array as PropType<string[]>,
69
+ required: false,
70
+ default: () => []
71
+ },
72
+ variant: {
73
+ type: String as PropType<"standard" | "full">,
74
+ required: false,
75
+ default: "full"
76
+ },
77
+ color: {
78
+ type: String as PropType<ColorBase>,
79
+ required: false,
80
+ default: ColorBase.Primary
81
+ },
82
+ tagColor: {
83
+ type: String as PropType<ColorBase>,
84
+ required: false,
85
+ default: ColorBase.Primary
86
+ },
87
+ required: {
88
+ type: Boolean,
89
+ required: false,
90
+ default: false
91
+ },
92
+ editable: {
93
+ type: Boolean,
94
+ required: false,
95
+ default: true
96
+ }
97
+ },
98
+ emits: ["update:value"],
99
+ setup(props, { emit }) {
100
+ const { value, editable } = toRefs(props);
101
+
102
+ const innerValue = ref("");
103
+
104
+ const darks = useColors().getColors(ColorBase.Dark);
105
+
106
+ const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
107
+ if (!editable.value) {
108
+ return {
109
+ "--fs-tag-field-cursor" : "default",
110
+ "--fs-tag-field-base-text": darks.light,
111
+ "--fs-tag-field-dark-text": darks.light
112
+ };
113
+ }
114
+ return {
115
+ "--fs-tag-field-cursor" : "pointer",
116
+ "--fs-tag-field-base-text": darks.base,
117
+ "--fs-tag-field-dark-text": darks.dark
118
+ };
119
+ });
120
+
121
+ const onAdd = (): void => {
122
+ if (!editable.value) {
123
+ return;
124
+ }
125
+ const tags = value.value ?? [];
126
+ if (!innerValue.value.length || tags.includes(innerValue.value)) {
127
+ return;
128
+ }
129
+ emit("update:value", tags.concat(innerValue.value));
130
+ innerValue.value = "";
131
+ }
132
+
133
+ const onRemove = (label: string): void => {
134
+ if (!editable.value) {
135
+ return;
136
+ }
137
+ const tags = value.value ?? [];
138
+ if (!tags.length || !tags.includes(label)) {
139
+ return;
140
+ }
141
+ emit("update:value", tags.filter(t => t !== label));
142
+ }
143
+
144
+ return {
145
+ innerValue,
146
+ style,
147
+ onAdd,
148
+ onRemove
149
+ };
150
+ }
151
+ });
152
+ </script>