fluency-v8-components 1.4.9 → 1.5.1

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.
@@ -1,4 +1,4 @@
1
- import { c as Da, _ as Va, g as il } from "./index-RvcduEmd.mjs";
1
+ import { c as Da, _ as Va, g as il } from "./index-CICR-543.mjs";
2
2
  var fn = {}, cn = {}, cr, vn;
3
3
  function Q() {
4
4
  if (vn) return cr;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluency-v8-components",
3
- "version": "1.4.9",
3
+ "version": "1.5.1",
4
4
  "main": "dist/fluency-v8-components.umd.js",
5
5
  "module": "dist/fluency-v8-components.es.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,7 +13,7 @@ const props = defineProps({
13
13
  from: Number,
14
14
  to: Number,
15
15
  });
16
- const emits = defineEmits(["selectTime"]);
16
+ const emits = defineEmits(["selectTime", "error"]);
17
17
  const dateValue = ref(defaultRange());
18
18
 
19
19
  watch(
@@ -44,12 +44,24 @@ watch(
44
44
 
45
45
  watch(
46
46
  dateValue,
47
- (val) => {
48
- if (Array.isArray(val) && val.length === 2 && val[0] && val[1]) {
49
- emits("selectTime", [
50
- moment(val[0]).valueOf(),
51
- moment(val[1]).valueOf(),
52
- ]);
47
+ (newVal, oldVal) => {
48
+ if (Array.isArray(newVal) && newVal.length === 2 && newVal[0] && newVal[1]) {
49
+ if (newVal[0] > newVal[1]) {
50
+ // triggers component to break as component do not handle this case
51
+ emits('error', 'Time from is greater than time to')
52
+ } else if (Array.isArray(oldVal) && oldVal.length === 2 && oldVal[0] && oldVal[1]) {
53
+ if (oldVal[0] !== newVal[0] || oldVal[1] !== newVal[1]) {
54
+ emits("selectTime", [
55
+ moment(newVal[0]).valueOf(),
56
+ moment(newVal[1]).valueOf(),
57
+ ]);
58
+ }
59
+ } else {
60
+ emits("selectTime", [
61
+ moment(newVal[0]).valueOf(),
62
+ moment(newVal[1]).valueOf(),
63
+ ]);
64
+ }
53
65
  }
54
66
  },
55
67
  { deep: true }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <Dialog :open="open" :title="title" size="large" @close="$emit('clickout')">
2
+ <Dialog :open="open" :title="title" :size="size" @close="$emit('clickout')">
3
3
  <template #header>
4
4
  <slot name="header" />
5
5
  </template>
@@ -52,6 +52,10 @@ const props = defineProps({
52
52
  type: [Boolean, Number],
53
53
  default: false,
54
54
  },
55
+ size: {
56
+ type: String,
57
+ default: "large",
58
+ },
55
59
  });
56
60
  const steps = ref(props.steps);
57
61
  const currentStep = ref(0);
@@ -3,21 +3,17 @@
3
3
  :class="['flex input-block relative', { 'std-red-ring ': error }]"
4
4
  v-bind="$attrs"
5
5
  >
6
- <div
7
- class="overflow-y-hidden whitespace-pre-wrap break-words min-h-6 invisible"
8
- >
9
- {{ $attrs.modelValue || props.value }}
10
- </div>
11
6
  <textarea
7
+ ref="textarea"
12
8
  :class="[
13
- 'absolute right-0 top-0 bottom-0 left-0 resize-none border-0 py-2 px-3 text-sm bg-transparent p-0.5 focus:ring-0',
9
+ 'py-2 px-3 w-full resize-none focus:outline-none border-0',
14
10
  readonly ? 'disabled' : '',
15
11
  ]"
16
12
  :value="$attrs.modelValue || props.value"
17
13
  v-bind="$attrs"
18
- style="resize: none"
14
+ rows="1"
19
15
  :readonly="props.readonly"
20
- @input="$emit('update:modelValue', $event.target.value)"
16
+ @input="autoExpand($event.target.value)"
21
17
  />
22
18
  </div>
23
19
  <div v-if="error" class="std-red-text text-sm">
@@ -25,6 +21,8 @@
25
21
  </div>
26
22
  </template>
27
23
  <script setup>
24
+ import { ref } from "vue";
25
+
28
26
  const props = defineProps({
29
27
  error: {
30
28
  type: String,
@@ -38,5 +36,34 @@ const props = defineProps({
38
36
  type: String,
39
37
  default: "",
40
38
  },
39
+ maxHeight: {
40
+ type: Number,
41
+ default: 200,
42
+ },
41
43
  });
44
+ const emits = defineEmits(['update:modelValue']);
45
+
46
+ // states
47
+ const textarea = ref();
48
+
49
+ // function defs
50
+ function autoExpand(message) {
51
+ if (!textarea.value) return;
52
+
53
+ // 1. Reset height to initial state to correctly calculate scrollHeight
54
+ textarea.value.style.height = 'auto';
55
+
56
+ // 2. Set height based on content
57
+ const scrollHeight = textarea.value.scrollHeight;
58
+
59
+ if (scrollHeight <= props.maxHeight) {
60
+ textarea.value.style.height = `${scrollHeight}px`;
61
+ textarea.value.style.overflowY = 'hidden'; // Hide scrollbar if not maxed
62
+ } else {
63
+ // 3. Handle max height: set max height and enable scrollbar
64
+ textarea.value.style.height = `${props.maxHeight}px`;
65
+ textarea.value.style.overflowY = 'scroll';
66
+ }
67
+ emits("update:modelValue", message)
68
+ };
42
69
  </script>