fluency-v8-components 1.4.8 → 1.4.9
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/dist/fluency-v8-components.es.js +115 -117
- package/dist/fluency-v8-components.umd.js +98 -98
- package/dist/{index-CmFd3BaD.mjs → index-RvcduEmd.mjs} +10003 -10254
- package/dist/{index.es-Ih5Hksav.mjs → index.es-le_XjTgU.mjs} +1 -1
- package/package.json +1 -1
- package/src/components/common/Select.vue +33 -6
- package/src/components/common/Slideout.vue +14 -2
- package/src/components/index.js +0 -2
- package/src/components/notifications/Notify.vue +2 -3
- package/src/components/buttons/DropdownButton.vue +0 -104
- package/src/components/buttons/MenuButton.vue +0 -135
package/package.json
CHANGED
|
@@ -2,8 +2,13 @@
|
|
|
2
2
|
<Menu as="div" class="relative inline-block text-left">
|
|
3
3
|
<MenuButton
|
|
4
4
|
:class="[
|
|
5
|
-
`group inline-flex justify-center text-${size} font-medium
|
|
5
|
+
`group inline-flex justify-center text-${size} font-medium`,
|
|
6
|
+
{ 'std-btn std-btn-red': color === 'red' },
|
|
7
|
+
{ 'std-btn std-btn-green': color === 'green' },
|
|
8
|
+
{ 'std-btn std-btn-blue': color === 'blue' },
|
|
9
|
+
{ 'px-3! py-1!': dense },
|
|
6
10
|
]"
|
|
11
|
+
:disabled="disabled"
|
|
7
12
|
>
|
|
8
13
|
<slot name="btn" />
|
|
9
14
|
</MenuButton>
|
|
@@ -18,21 +23,28 @@
|
|
|
18
23
|
>
|
|
19
24
|
<MenuItems
|
|
20
25
|
:class="[
|
|
21
|
-
|
|
26
|
+
`std-white input-dropdown w-${optionsSize} origin-top-right shadow-lg max-h-96`,
|
|
22
27
|
direction === 'right' ? 'left-0 ' : 'right-0',
|
|
28
|
+
{ 'std-red': color === 'red' },
|
|
29
|
+
{ 'std-green': color === 'green' },
|
|
30
|
+
{ 'std-blue': color === 'blue' },
|
|
31
|
+
{ 'std-white': color !== 'red' && color !== 'blue' && color !== 'green' },
|
|
23
32
|
]"
|
|
24
33
|
>
|
|
25
34
|
<div class="py-1">
|
|
26
35
|
<MenuItem v-for="option in options" :key="option" v-slot="{ active }">
|
|
27
36
|
<span
|
|
28
37
|
:class="[
|
|
29
|
-
|
|
30
|
-
{ 'white-bg-hover dark:dark-bg-hover':
|
|
38
|
+
{ 'outline-hidden': active },
|
|
39
|
+
{ 'white-bg-hover dark:dark-bg-hover': color !== 'red' && color !== 'blue' && color !== 'green' && (active || labelMatch(option)) },
|
|
40
|
+
{ 'std-red-hover-light': color === 'red' && (active || labelMatch(option)) },
|
|
41
|
+
{ 'std-blue-hover-light': color === 'blue' && (active || labelMatch(option)) },
|
|
42
|
+
{ 'std-green-hover-light': color === 'green' && (active || labelMatch(option)) },
|
|
31
43
|
`group flex w-full items-center rounded-md px-2 py-2 text-${size} cursor-pointer`,
|
|
32
44
|
]"
|
|
33
45
|
@click.stop="emits('select', option)"
|
|
34
46
|
>
|
|
35
|
-
{{ option
|
|
47
|
+
{{ option?.label || option }}
|
|
36
48
|
</span>
|
|
37
49
|
</MenuItem>
|
|
38
50
|
</div>
|
|
@@ -53,11 +65,26 @@ const props = defineProps({
|
|
|
53
65
|
type: String,
|
|
54
66
|
default: "left",
|
|
55
67
|
},
|
|
68
|
+
optionsSize: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: "40",
|
|
71
|
+
},
|
|
56
72
|
size: {
|
|
57
73
|
type: String,
|
|
58
74
|
default: "xs",
|
|
59
75
|
},
|
|
60
|
-
|
|
76
|
+
color: String,
|
|
77
|
+
current: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: "",
|
|
80
|
+
},
|
|
81
|
+
disabled: Boolean,
|
|
82
|
+
dense: Boolean,
|
|
61
83
|
});
|
|
62
84
|
const emits = defineEmits(["select"]);
|
|
85
|
+
|
|
86
|
+
// function defs
|
|
87
|
+
function labelMatch(option) {
|
|
88
|
+
return props.current === option || props.current === option?.label
|
|
89
|
+
}
|
|
63
90
|
</script>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<TransitionRoot as="template" :show="open">
|
|
3
|
-
<Dialog as="div" class="relative z-40" @close="
|
|
3
|
+
<Dialog as="div" class="relative z-40" @close="hideSlideout">
|
|
4
4
|
<!--div class="fixed inset-0" /-->
|
|
5
5
|
<TransitionChild
|
|
6
6
|
as="template"
|
|
@@ -84,11 +84,23 @@ import {
|
|
|
84
84
|
import { XMarkIcon } from "@heroicons/vue/24/outline";
|
|
85
85
|
import { adjustText } from "@/constants/font-map";
|
|
86
86
|
|
|
87
|
+
// constants
|
|
88
|
+
const titleWidth = 2800;
|
|
89
|
+
|
|
90
|
+
// props and emits
|
|
87
91
|
const props = defineProps({
|
|
88
92
|
open: Boolean,
|
|
89
93
|
title: String,
|
|
90
94
|
});
|
|
91
95
|
const emits = defineEmits(["close", "hide"]);
|
|
92
96
|
|
|
93
|
-
|
|
97
|
+
// function defs
|
|
98
|
+
function hideSlideout() {
|
|
99
|
+
const dialogs = window.document.querySelectorAll("#headlessui-portal-root");
|
|
100
|
+
if (dialogs && dialogs.length > 0 && dialogs[0].childElementCount > 2) {
|
|
101
|
+
// another dialog is open
|
|
102
|
+
} else {
|
|
103
|
+
emits('hide')
|
|
104
|
+
}
|
|
105
|
+
}
|
|
94
106
|
</script>
|
package/src/components/index.js
CHANGED
|
@@ -49,8 +49,6 @@ export { default as ActionButtons } from "./buttons/ActionButtons.vue";
|
|
|
49
49
|
export { default as TextButton } from "./buttons/TextButton.vue";
|
|
50
50
|
export { default as IconButton } from "./buttons/IconButton.vue";
|
|
51
51
|
export { default as ImageButton } from "./buttons/ImageButton.vue";
|
|
52
|
-
export { default as DropdownButton } from "./buttons/DropdownButton.vue";
|
|
53
|
-
export { default as MenuButton } from "./buttons/MenuButton.vue";
|
|
54
52
|
export { default as SubmitButtons } from "./buttons/SubmitButtons.vue";
|
|
55
53
|
|
|
56
54
|
// statuses
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
<!-- TODO: dark mode -->
|
|
2
1
|
<template>
|
|
3
2
|
<TransitionRoot as="template" :show="open">
|
|
4
3
|
<Dialog
|
|
@@ -34,7 +33,7 @@
|
|
|
34
33
|
</div>
|
|
35
34
|
<div class="ml-auto pl-3">
|
|
36
35
|
<div class="-mx-1.5 -my-1.5">
|
|
37
|
-
<IconButton :color="getColor()" @click="closeModal">
|
|
36
|
+
<IconButton :color="getColor()" @click.stop="closeModal">
|
|
38
37
|
<XMarkIcon class="icon-md" aria-hidden="true" />
|
|
39
38
|
</IconButton>
|
|
40
39
|
</div>
|
|
@@ -72,7 +71,7 @@
|
|
|
72
71
|
</div>
|
|
73
72
|
<div class="ml-auto pl-3">
|
|
74
73
|
<div class="-mx-1.5 -my-1.5">
|
|
75
|
-
<IconButton :color="getColor()" @click="closeModal">
|
|
74
|
+
<IconButton :color="getColor()" @click.stop="closeModal">
|
|
76
75
|
<XMarkIcon class="icon-md" aria-hidden="true" />
|
|
77
76
|
</IconButton>
|
|
78
77
|
</div>
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<Menu as="div" class="relative">
|
|
3
|
-
<div class="std-btn py-0">
|
|
4
|
-
<div
|
|
5
|
-
:class="[
|
|
6
|
-
'rounded-l-lg px-5 py-3 cursor-pointer',
|
|
7
|
-
{ 'std-btn-red': color === 'red' },
|
|
8
|
-
{ 'std-btn-green': color === 'green' },
|
|
9
|
-
{ 'std-btn-blue': color === 'blue' },
|
|
10
|
-
]"
|
|
11
|
-
@click="loading ? null : emits('mainClick')"
|
|
12
|
-
>
|
|
13
|
-
<div v-if="loading" class="mx-2 inline-block spinner"></div>
|
|
14
|
-
<div v-else class="flex">
|
|
15
|
-
<slot />
|
|
16
|
-
{{ props.text }}
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
<MenuButton
|
|
20
|
-
:class="[
|
|
21
|
-
'rounded-r-lg px-1 py-3 border-l-2 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50',
|
|
22
|
-
{ 'std-btn-red': color === 'red' },
|
|
23
|
-
{ 'std-btn-green': color === 'green' },
|
|
24
|
-
{ 'std-btn-blue': color === 'blue' },
|
|
25
|
-
]"
|
|
26
|
-
:disabled="secondaryButtons.length === 0 || loading"
|
|
27
|
-
@click="dropdown = !dropdown"
|
|
28
|
-
>
|
|
29
|
-
<ArrowDownIcon v-if="!dropdown" class="icon-md" />
|
|
30
|
-
<ArrowUpIcon v-else class="icon-md" />
|
|
31
|
-
</MenuButton>
|
|
32
|
-
</div>
|
|
33
|
-
<Transition
|
|
34
|
-
enter="transition ease-out duration-75"
|
|
35
|
-
enterFrom="opacity-0 scale-95"
|
|
36
|
-
enterTo="opacity-100 scale-100"
|
|
37
|
-
leave="transition ease-in duration-100"
|
|
38
|
-
leaveFrom="opacity-100 scale-100"
|
|
39
|
-
leaveTo="opacity-0 scale-95"
|
|
40
|
-
>
|
|
41
|
-
<MenuItems
|
|
42
|
-
:class="[
|
|
43
|
-
'absolute right-0 z-50 mt-0.5 w-32 origin-top-right rounded-md py-2 shadow-lg text-white max-h-96 overflow-y-auto break-all',
|
|
44
|
-
{ 'std-red': color === 'red' },
|
|
45
|
-
{ 'std-green': color === 'green' },
|
|
46
|
-
{ 'std-blue': color === 'blue' },
|
|
47
|
-
]"
|
|
48
|
-
>
|
|
49
|
-
<MenuItem v-for="button in sortedButtons" v-slot="{ active }">
|
|
50
|
-
<div
|
|
51
|
-
:class="[
|
|
52
|
-
active ? 'cursor-pointer' : '',
|
|
53
|
-
'block px-3 py-1 text-sm leading-6',
|
|
54
|
-
{ 'std-btn-red': color === 'red' },
|
|
55
|
-
{ 'std-btn-green': color === 'green' },
|
|
56
|
-
{ 'std-btn-blue': color === 'blue' },
|
|
57
|
-
]"
|
|
58
|
-
@click="loading ? null : emits('secondaryClick', button)"
|
|
59
|
-
>
|
|
60
|
-
{{ button }}
|
|
61
|
-
</div>
|
|
62
|
-
</MenuItem>
|
|
63
|
-
</MenuItems>
|
|
64
|
-
</Transition>
|
|
65
|
-
</Menu>
|
|
66
|
-
</template>
|
|
67
|
-
|
|
68
|
-
<script setup>
|
|
69
|
-
import { ref, computed } from "vue";
|
|
70
|
-
import { ArrowDownIcon, ArrowUpIcon } from "@heroicons/vue/20/solid";
|
|
71
|
-
import { Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/vue";
|
|
72
|
-
|
|
73
|
-
const props = defineProps({
|
|
74
|
-
text: {
|
|
75
|
-
type: String,
|
|
76
|
-
required: true,
|
|
77
|
-
},
|
|
78
|
-
color: {
|
|
79
|
-
type: String,
|
|
80
|
-
default: "blue",
|
|
81
|
-
validator: (value) => ["red", "green", "blue"].includes(value),
|
|
82
|
-
},
|
|
83
|
-
loading: {
|
|
84
|
-
type: Boolean,
|
|
85
|
-
default: false,
|
|
86
|
-
},
|
|
87
|
-
secondaryButtons: {
|
|
88
|
-
type: Array,
|
|
89
|
-
default: () => [],
|
|
90
|
-
},
|
|
91
|
-
sorted: {
|
|
92
|
-
type: Boolean,
|
|
93
|
-
default: false,
|
|
94
|
-
},
|
|
95
|
-
});
|
|
96
|
-
const emits = defineEmits(["mainClick", "secondaryClick"]);
|
|
97
|
-
const dropdown = ref(false);
|
|
98
|
-
|
|
99
|
-
const sortedButtons = computed(() => {
|
|
100
|
-
return props.sorted
|
|
101
|
-
? props.secondaryButtons.sort((a, b) => a.localeCompare(b))
|
|
102
|
-
: props.secondaryButtons;
|
|
103
|
-
});
|
|
104
|
-
</script>
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<Menu
|
|
3
|
-
as="div"
|
|
4
|
-
:class="[
|
|
5
|
-
'relative',
|
|
6
|
-
{ 'px-3 py-1': dense },
|
|
7
|
-
{ 'std-btn-red': color === 'red' },
|
|
8
|
-
{ 'std-btn-green': color === 'green' },
|
|
9
|
-
{ 'std-btn-blue': color === 'blue' },
|
|
10
|
-
{ 'std-btn': type === 'button' },
|
|
11
|
-
{ 'std-white-text': color === 'none' },
|
|
12
|
-
{ 'cursor-not-allowed': disabled },
|
|
13
|
-
]"
|
|
14
|
-
>
|
|
15
|
-
<MenuButton class="row" :disabled="disabled || loading">
|
|
16
|
-
{{ props.text }}
|
|
17
|
-
<ArrowDownIcon v-if="type === 'button'" class="icon-md" />
|
|
18
|
-
<slot />
|
|
19
|
-
</MenuButton>
|
|
20
|
-
<Transition
|
|
21
|
-
enter="transition ease-out duration-75"
|
|
22
|
-
enterFrom="opacity-0 scale-95"
|
|
23
|
-
enterTo="opacity-100 scale-100"
|
|
24
|
-
leave="transition ease-in duration-100"
|
|
25
|
-
leaveFrom="opacity-100 scale-100"
|
|
26
|
-
leaveTo="opacity-0 scale-95"
|
|
27
|
-
>
|
|
28
|
-
<MenuItems
|
|
29
|
-
:class="[
|
|
30
|
-
'absolute right-0 top-full z-50 mt-0.5 rounded-lg py-2 shadow-lg max-h-96 overflow-y-auto break-all',
|
|
31
|
-
{ 'std-red': color === 'red' },
|
|
32
|
-
{ 'std-green': color === 'green' },
|
|
33
|
-
{ 'std-blue': color === 'blue' },
|
|
34
|
-
{ 'std-white': color === 'none' },
|
|
35
|
-
{ 'right-0': anchor === 'right' },
|
|
36
|
-
{ 'left-0': anchor === 'left' },
|
|
37
|
-
]"
|
|
38
|
-
anchor="bottom-start"
|
|
39
|
-
>
|
|
40
|
-
<MenuItem v-for="button in sortedButtons" v-slot="{ active }">
|
|
41
|
-
<div
|
|
42
|
-
:class="[
|
|
43
|
-
active ? 'cursor-pointer' : '',
|
|
44
|
-
'block px-3 py-1 text-sm leading-6 min-w-44',
|
|
45
|
-
{ 'std-btn-red': color === 'red' },
|
|
46
|
-
{ 'std-btn-green': color === 'green' },
|
|
47
|
-
{ 'std-btn-blue': color === 'blue' },
|
|
48
|
-
{
|
|
49
|
-
'std-btn-white': active && color === 'none',
|
|
50
|
-
},
|
|
51
|
-
]"
|
|
52
|
-
@click="secondaryClick(button)"
|
|
53
|
-
>
|
|
54
|
-
{{ button.name || button }}
|
|
55
|
-
</div>
|
|
56
|
-
</MenuItem>
|
|
57
|
-
<slot name="items" />
|
|
58
|
-
</MenuItems>
|
|
59
|
-
</Transition>
|
|
60
|
-
</Menu>
|
|
61
|
-
</template>
|
|
62
|
-
|
|
63
|
-
<script setup>
|
|
64
|
-
import { computed } from "vue";
|
|
65
|
-
import { ArrowDownIcon } from "@heroicons/vue/20/solid";
|
|
66
|
-
import { Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/vue";
|
|
67
|
-
|
|
68
|
-
const props = defineProps({
|
|
69
|
-
text: {
|
|
70
|
-
type: String,
|
|
71
|
-
default: "",
|
|
72
|
-
},
|
|
73
|
-
color: {
|
|
74
|
-
type: String,
|
|
75
|
-
default: "blue",
|
|
76
|
-
},
|
|
77
|
-
disabled: {
|
|
78
|
-
type: Boolean,
|
|
79
|
-
default: false,
|
|
80
|
-
},
|
|
81
|
-
dense: {
|
|
82
|
-
type: Boolean,
|
|
83
|
-
default: false,
|
|
84
|
-
},
|
|
85
|
-
loading: {
|
|
86
|
-
type: Boolean,
|
|
87
|
-
default: false,
|
|
88
|
-
},
|
|
89
|
-
secondaryButtons: {
|
|
90
|
-
type: Array,
|
|
91
|
-
default: () => [],
|
|
92
|
-
},
|
|
93
|
-
anchor: {
|
|
94
|
-
type: String,
|
|
95
|
-
default: "right",
|
|
96
|
-
},
|
|
97
|
-
type: {
|
|
98
|
-
type: String,
|
|
99
|
-
default: "button",
|
|
100
|
-
},
|
|
101
|
-
emitValue: {
|
|
102
|
-
type: Boolean,
|
|
103
|
-
default: true,
|
|
104
|
-
},
|
|
105
|
-
sorted: {
|
|
106
|
-
type: Boolean,
|
|
107
|
-
default: false,
|
|
108
|
-
},
|
|
109
|
-
});
|
|
110
|
-
const emits = defineEmits(["secondaryClick"]);
|
|
111
|
-
|
|
112
|
-
const sortedButtons = computed(() => {
|
|
113
|
-
if (props.sorted) {
|
|
114
|
-
return props.secondaryButtons.sort((a, b) => {
|
|
115
|
-
if (a.name && b.name) {
|
|
116
|
-
return a.name.localeCompare(b.name);
|
|
117
|
-
}
|
|
118
|
-
return a.localeCompare(b);
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
return props.secondaryButtons;
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
function secondaryClick(button) {
|
|
125
|
-
if (props.disabled || props.loading) {
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if (props.emitValue) {
|
|
130
|
-
emits("secondaryClick", button.name || button);
|
|
131
|
-
} else {
|
|
132
|
-
emits("secondaryClick", button);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
</script>
|