fluency-v8-components 1.3.8 → 1.4.0

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-mewQ1Z9n.mjs";
1
+ import { c as Da, _ as Va, g as il } from "./index-Br4jyWhU.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.3.8",
3
+ "version": "1.4.0",
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",
@@ -4,11 +4,23 @@
4
4
  }
5
5
 
6
6
  @utility editor-style {
7
+ font-family: Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace;
8
+ padding: 10px 5px 10px 5px;
9
+ :focus {
10
+ outline: none;
11
+ }
12
+ }
13
+
14
+ @utility editor-style-light {
15
+ scrollbar-color: #94a3b8 #64748b;
16
+ background: #475569;
17
+ color: #f8fafc;
18
+ }
19
+
20
+ @utility editor-style-dark {
7
21
  scrollbar-color: #e0e7ff #303030;
8
22
  background: #303030;
9
23
  color: #FFFFFF;
10
- font-family: Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace;
11
- padding: 10px 5px 10px 5px;
12
24
  }
13
25
 
14
26
  @utility report-container {
@@ -8,7 +8,7 @@
8
8
  placeholder="Search"
9
9
  @input="onChange"
10
10
  @keyup.enter="emits('search', newVal)"
11
- class="w-full dark:dark-bg py-2 px-2"
11
+ class="w-full bg-white outline-1 dark:dark-bg py-2 px-2"
12
12
  />
13
13
  <transition
14
14
  enter-active-class="transition duration-100 ease-out"
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <PrismEditor
3
- class="editor-style"
3
+ :class="['editor-style', props.theme === 'dark' ? 'editor-style-dark' : 'editor-style-light']"
4
4
  v-bind="$attrs"
5
5
  :style="`fontSize: ${props.fontSize}`"
6
6
  :readonly="props.readonly"
@@ -18,6 +18,10 @@ import "@/assets/prism-theme.css"; // import syntax highlighting styles
18
18
 
19
19
  // props and emits
20
20
  const props = defineProps({
21
+ theme: {
22
+ type: String,
23
+ default: "dark",
24
+ },
21
25
  fontSize: {
22
26
  type: String,
23
27
  default: "12px",
@@ -1,11 +1,11 @@
1
1
  <template>
2
2
  <div class="col">
3
- <vue-tailwind-datepicker :shortcuts="customShortcuts" v-model="dateValue" />
3
+ <VueTailwindDatepicker :shortcuts="customShortcuts" v-model="dateValue" />
4
4
  </div>
5
5
  </template>
6
6
 
7
7
  <script setup>
8
- import { ref, watch, onMounted } from "vue";
8
+ import { ref, watch } from "vue";
9
9
  import VueTailwindDatepicker from "vue-tailwind-datepicker";
10
10
  import moment from "moment";
11
11
 
@@ -14,40 +14,47 @@ const props = defineProps({
14
14
  to: Number,
15
15
  });
16
16
  const emits = defineEmits(["selectTime"]);
17
- const dateValue = ref([]);
17
+ const dateValue = ref(defaultRange());
18
18
 
19
- watch(dateValue, (val) => {
20
- emits("selectTime", [moment(val[0]).valueOf(), moment(val[1]).valueOf()]);
21
- });
22
19
  watch(
23
- () => props.from,
24
- (val) => {
25
- if (val) {
26
- dateValue.value[0] = formatTime(val);
20
+ () => [props.from, props.to],
21
+ ([from, to]) => {
22
+ const baseRange = Array.isArray(dateValue.value) ? dateValue.value : [];
23
+ const nextRange = baseRange.length === 2 ? [...baseRange] : defaultRange();
24
+ let updated = false;
25
+
26
+ if (isValidTimestamp(from)) {
27
+ nextRange[0] = formatTime(from);
28
+ updated = true;
29
+ }
30
+
31
+ if (isValidTimestamp(to)) {
32
+ nextRange[1] = formatTime(to);
33
+ updated = true;
34
+ }
35
+
36
+ if (updated) {
37
+ dateValue.value = nextRange;
27
38
  } else {
28
39
  resetDate();
29
40
  }
30
- }
41
+ },
42
+ { immediate: true }
31
43
  );
44
+
32
45
  watch(
33
- () => props.to,
46
+ dateValue,
34
47
  (val) => {
35
- if (val) {
36
- dateValue.value[1] = formatTime(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
+ ]);
37
53
  }
38
- }
54
+ },
55
+ { deep: true }
39
56
  );
40
57
 
41
- onMounted(() => {
42
- if (props.from && props.to) {
43
- const fromFormatted = formatTime(props.from);
44
- const toFormatted = formatTime(props.to);
45
- dateValue.value = [fromFormatted, toFormatted];
46
- } else {
47
- resetDate();
48
- }
49
- });
50
-
51
58
  function customShortcuts() {
52
59
  const date = moment().valueOf();
53
60
  return [
@@ -97,13 +104,21 @@ function customShortcuts() {
97
104
  }
98
105
 
99
106
  function resetDate() {
100
- dateValue.value = [
107
+ dateValue.value = defaultRange();
108
+ }
109
+
110
+ function formatTime(time) {
111
+ return moment(time).format("YYYY-MM-DD HH:mm:ss");
112
+ }
113
+
114
+ function defaultRange() {
115
+ return [
101
116
  formatTime(moment().subtract(1, "hours")),
102
117
  formatTime(moment()),
103
118
  ];
104
119
  }
105
120
 
106
- function formatTime(time) {
107
- return moment(time).format("YYYY-MM-DD HH:mm:ss");
121
+ function isValidTimestamp(value) {
122
+ return typeof value === "number" && !Number.isNaN(value);
108
123
  }
109
124
  </script>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div
3
- class="bg-neutral-600 text-white pl-3 py-1 sm:flex sm:items-center sm:justify-between content-center"
3
+ class="bg-gray-400 pl-3 py-1 sm:flex sm:items-center sm:justify-between content-center dark:bg-neutral-600 dark:text-white"
4
4
  >
5
5
  <slot name="title" />
6
6
  <div class="mt-3 flex sm:mt-0">
@@ -15,7 +15,7 @@
15
15
  :displayValue="(option) => option"
16
16
  />
17
17
  <ComboboxOptions
18
- class="input-block absolute z-10 mt-1 max-h-56 w-full overflow-auto rounded-md bg-white p-1 text-base shadow-lg ring-1 ring-black/5 focus:outline-hidden sm:text-sm"
18
+ class="input-block absolute z-20 mt-1 max-h-56 w-full overflow-auto rounded-md bg-white p-1 text-base shadow-lg ring-1 ring-black/5 focus:outline-hidden sm:text-sm"
19
19
  >
20
20
  <ComboboxOption
21
21
  v-if="queryOption && !filteredOptions.some((option) => option.value === queryOption)"
@@ -2,7 +2,7 @@
2
2
  <input
3
3
  type="password"
4
4
  :class="[
5
- 'input-block',
5
+ 'pl-3 input-block',
6
6
  error ? 'ring-red-600 ' : '',
7
7
  readonly ? 'disabled' : '',
8
8
  ]"
@@ -4,7 +4,7 @@
4
4
  <input
5
5
  type="text"
6
6
  :class="[
7
- 'input-block',
7
+ 'pl-3 input-block',
8
8
  error ? 'ring-red-600 ' : '',
9
9
  readonly ? 'disabled' : '',
10
10
  ]"
@@ -24,7 +24,7 @@
24
24
  leave-to-class="opacity-0"
25
25
  >
26
26
  <ComboboxOptions
27
- class="input-block absolute z-10 mt-1 max-h-56 w-full overflow-auto rounded-md p-1 text-base sm:text-sm"
27
+ class="input-block absolute z-20 mt-1 max-h-56 w-full overflow-auto rounded-md p-1 text-base sm:text-sm"
28
28
  >
29
29
  <ComboboxOption
30
30
  as="template"
@@ -24,7 +24,7 @@
24
24
  </div>
25
25
  <div
26
26
  v-if="!readonly"
27
- class="relative z-10 flex flex-auto flex-row-reverse"
27
+ class="relative z-9 flex flex-auto flex-row-reverse"
28
28
  >
29
29
  <XMarkIcon
30
30
  class="icon cursor-pointer hover:opacity-75"
@@ -64,7 +64,7 @@
64
64
  @after-leave="query = ''"
65
65
  >
66
66
  <ComboboxOptions
67
- class="input-block absolute z-20 mt-1 max-h-56 w-full overflow-auto rounded-md bg-white p-1 text-base shadow-lg ring-1 ring-black/5 focus:outline-hidden sm:text-sm"
67
+ class="input-block absolute z-20 mt-1 max-h-56 w-full overflow-auto rounded-md p-1 text-base shadow-lg ring-1 ring-black/5 focus:outline-hidden sm:text-sm"
68
68
  >
69
69
  <div
70
70
  v-if="filteredOptions.length === 0 && query !== ''"