fluency-v8-components 1.3.4 → 1.3.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.
- package/dist/fluency-v8-components.es.js +1 -1
- package/dist/fluency-v8-components.umd.js +31 -31
- package/dist/{index-Dxs_Gn5T.mjs → index-BBxccHNP.mjs} +53 -47
- package/dist/index.css +1 -1
- package/dist/{index.es-YeMpD96e.mjs → index.es-D_XhLSeH.mjs} +1 -1
- package/package.json +3 -2
- package/src/assets/images/ai.svg +1 -0
- package/src/assets/images/github-dark.svg +1 -0
- package/src/assets/images/github.svg +1 -0
- package/src/assets/images/high-priority.svg +1 -0
- package/src/assets/images/power-off.svg +1 -0
- package/src/assets/images/save.svg +1 -0
- package/src/assets/index.ts +15 -0
- package/src/assets/main.css +505 -0
- package/src/assets/prism-theme.css +290 -0
- package/src/components/buttons/ActionButtons.vue +374 -0
- package/src/components/buttons/DropdownButton.vue +104 -0
- package/src/components/buttons/IconButton.vue +63 -0
- package/src/components/buttons/ImageButton.vue +16 -0
- package/src/components/buttons/MenuButton.vue +138 -0
- package/src/components/buttons/SubmitButtons.vue +51 -0
- package/src/components/buttons/TextButton.vue +40 -0
- package/src/components/charts/AlertChart.vue +376 -0
- package/src/components/charts/BarChart.vue +212 -0
- package/src/components/charts/BarChartHorizontal.vue +243 -0
- package/src/components/charts/CronChart.vue +146 -0
- package/src/components/charts/EmptyChart.vue +76 -0
- package/src/components/charts/GradientChart.vue +310 -0
- package/src/components/charts/LineChart.test.js +59 -0
- package/src/components/charts/LineChart.vue +434 -0
- package/src/components/charts/PieChart.vue +293 -0
- package/src/components/charts/ProgressChart.vue +106 -0
- package/src/components/charts/StackedChart.vue +364 -0
- package/src/components/charts/StackedChartClustered.vue +395 -0
- package/src/components/charts/TimelineChart.vue +215 -0
- package/src/components/charts/WorkflowChart.vue +520 -0
- package/src/components/common/AutoCompleteSearchBar.vue +100 -0
- package/src/components/common/AutoRefreshButton.vue +53 -0
- package/src/components/common/Breadcrumb.vue +45 -0
- package/src/components/common/ButtonToggle.vue +24 -0
- package/src/components/common/Card.vue +116 -0
- package/src/components/common/Carousel.vue +66 -0
- package/src/components/common/CategoryCard.vue +28 -0
- package/src/components/common/CodeEditor.vue +59 -0
- package/src/components/common/DatePicker.vue +21 -0
- package/src/components/common/DatePickerInput.vue +109 -0
- package/src/components/common/Dialog.vue +103 -0
- package/src/components/common/EditorHeading.vue +10 -0
- package/src/components/common/EventList.vue +41 -0
- package/src/components/common/Facet.vue +206 -0
- package/src/components/common/Feed.vue +58 -0
- package/src/components/common/Flag.vue +27 -0
- package/src/components/common/HomeCard.vue +20 -0
- package/src/components/common/ItemBox.vue +49 -0
- package/src/components/common/Loading.vue +19 -0
- package/src/components/common/LoadingDots.vue +12 -0
- package/src/components/common/PageHeading.vue +30 -0
- package/src/components/common/Pagination.vue +105 -0
- package/src/components/common/Popover.vue +24 -0
- package/src/components/common/PowerToggle.vue +130 -0
- package/src/components/common/ProgressBar.vue +33 -0
- package/src/components/common/RadioButtons.vue +52 -0
- package/src/components/common/Schedule.vue +79 -0
- package/src/components/common/SearchBar.vue +30 -0
- package/src/components/common/Separator.vue +3 -0
- package/src/components/common/Slideout.vue +95 -0
- package/src/components/common/Sort.vue +83 -0
- package/src/components/common/Table.vue +48 -0
- package/src/components/common/Tabs.vue +129 -0
- package/src/components/common/Tag.vue +53 -0
- package/src/components/common/Tooltip.vue +49 -0
- package/src/components/common/VerticalTabs.vue +34 -0
- package/src/components/common/card/CardItem.vue +27 -0
- package/src/components/common/card/CardItemGroup.vue +45 -0
- package/src/components/common/facet/Leaf.vue +97 -0
- package/src/components/common/facet/TriState.vue +37 -0
- package/src/components/common/table/TableData.vue +48 -0
- package/src/components/common/table/TableHeader.vue +21 -0
- package/src/components/dialogs/ChooseValueDialog.vue +97 -0
- package/src/components/dialogs/ConfirmDialog.vue +73 -0
- package/src/components/dialogs/CopyDialog.vue +51 -0
- package/src/components/dialogs/DownloadDialog.vue +48 -0
- package/src/components/dialogs/NameDescDialog.vue +74 -0
- package/src/components/dialogs/NameDialog.vue +56 -0
- package/src/components/dialogs/PopupEditor.vue +113 -0
- package/src/components/dialogs/ProgressDialog.vue +58 -0
- package/src/components/dialogs/ResetPasswordDialog.vue +58 -0
- package/src/components/dialogs/Wizard.vue +99 -0
- package/src/components/dialogs/wizard/Stepper.vue +31 -0
- package/src/components/form/CheckBox.vue +26 -0
- package/src/components/form/Editor.vue +93 -0
- package/src/components/form/FormCol.vue +19 -0
- package/src/components/form/FormRow.vue +19 -0
- package/src/components/form/FormSection.vue +21 -0
- package/src/components/form/GreyForm.vue +7 -0
- package/src/components/form/GreyInput.vue +51 -0
- package/src/components/form/GreyInputAutocomplete.vue +100 -0
- package/src/components/form/GreyInputCopy.vue +66 -0
- package/src/components/form/GreyInputGrow.vue +42 -0
- package/src/components/form/GreyInputToken.vue +78 -0
- package/src/components/form/GreyPassword.vue +36 -0
- package/src/components/form/GreySelect.vue +154 -0
- package/src/components/form/GreySelectInput.vue +123 -0
- package/src/components/form/GreySelectInputMultiple.vue +218 -0
- package/src/components/form/GreyTel.vue +58 -0
- package/src/components/form/HamburgerItem.vue +95 -0
- package/src/components/form/KeyValueEntry.vue +74 -0
- package/src/components/form/RadioInput.vue +38 -0
- package/src/components/form/UploadFile.vue +99 -0
- package/src/components/icons/AiIcon.vue +6 -0
- package/src/components/icons/GithubIcon.vue +18 -0
- package/src/components/icons/HighPriorityIcon.vue +6 -0
- package/src/components/icons/PowerOffIcon.vue +6 -0
- package/src/components/icons/SaveIcon.vue +6 -0
- package/src/components/index.js +134 -0
- package/src/components/menu/DialogMenu.vue +142 -0
- package/src/components/menu/GrandChild.vue +39 -0
- package/src/components/menu/GridMenu.vue +88 -0
- package/src/components/menu/MenuAvatar.vue +66 -0
- package/src/components/menu/MenuDesktop.vue +90 -0
- package/src/components/notifications/Notify.vue +123 -0
- package/src/components/notifications/NotifyList.vue +130 -0
- package/src/components/page-structure/FacetPage.vue +77 -0
- package/src/components/query/Child.vue +63 -0
- package/src/components/query/LVDBQuery.vue +38 -0
- package/src/components/status/Active.vue +44 -0
- package/src/components/status/ScoreLevel.vue +43 -0
- package/src/components/status/Status.vue +51 -0
- package/src/components/status/TaskDot.vue +25 -0
- package/src/components/status/TaskStatus.vue +26 -0
- package/src/components/status/TicketStatus.vue +201 -0
- package/src/components/status/Trend.vue +20 -0
- package/src/components/tables/ArgumentRunTable.vue +96 -0
- package/src/components/tables/ArgumentTable.vue +67 -0
- package/src/components/tables/CloudFormationParameters.vue +25 -0
- package/src/constants/colors.js +248 -0
- package/src/constants/font-map.js +128 -0
- package/src/constants/fpl2.js +162 -0
- package/src/constants/icon-svg.js +405 -0
- package/src/constants/schedule.js +52 -0
- package/src/fpl/AddPanel.vue +237 -0
- package/src/fpl/Configs/Alert.vue +16 -0
- package/src/fpl/Configs/AlertSprite.vue +2 -0
- package/src/fpl/Configs/Chart.vue +63 -0
- package/src/fpl/Configs/Config.js +154 -0
- package/src/fpl/Configs/Counter.vue +35 -0
- package/src/fpl/Configs/Histogram.vue +70 -0
- package/src/fpl/Configs/IPMap.vue +37 -0
- package/src/fpl/Configs/Image.vue +163 -0
- package/src/fpl/Configs/MetricChart.vue +20 -0
- package/src/fpl/Configs/PieChart.vue +37 -0
- package/src/fpl/Configs/SparkChart.vue +41 -0
- package/src/fpl/Configs/StackedBarChart.vue +49 -0
- package/src/fpl/Configs/Table.vue +211 -0
- package/src/fpl/Configs/Text.vue +14 -0
- package/src/fpl/Configs/TopNChart.vue +37 -0
- package/src/fpl/Outputs/FPLAlert.vue +64 -0
- package/src/fpl/Outputs/FPLStream.vue +41 -0
- package/src/fpl/Outputs/FPLTable.vue +77 -0
- package/src/fpl/Panel.vue +202 -0
- package/src/fpl/Panels/Alert.vue +85 -0
- package/src/fpl/Panels/AlertSprite.vue +9 -0
- package/src/fpl/Panels/Chart.vue +98 -0
- package/src/fpl/Panels/Counter.vue +43 -0
- package/src/fpl/Panels/Histogram.vue +138 -0
- package/src/fpl/Panels/IPMap.vue +48 -0
- package/src/fpl/Panels/Image.vue +35 -0
- package/src/fpl/Panels/MetricChart.vue +97 -0
- package/src/fpl/Panels/PieChart.vue +54 -0
- package/src/fpl/Panels/SparkChart.vue +166 -0
- package/src/fpl/Panels/StackedBarChart.vue +74 -0
- package/src/fpl/Panels/Table.vue +103 -0
- package/src/fpl/Panels/Text.vue +24 -0
- package/src/fpl/Panels/TopNChart.vue +69 -0
- package/src/fpl/index.js +39 -0
- package/src/utils/download.js +220 -0
- package/src/utils/formatOutput.js +156 -0
- package/src/utils/random.js +32 -0
- package/src/utils/timeUtils.js +138 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Combobox
|
|
3
|
+
as="div"
|
|
4
|
+
v-bind="$attrs"
|
|
5
|
+
:class="[
|
|
6
|
+
'input-block py-1 relative',
|
|
7
|
+
error ? 'ring-red-600 ' : '',
|
|
8
|
+
readonly ? 'disabled' : '',
|
|
9
|
+
]"
|
|
10
|
+
:disabled="readonly ? true : false"
|
|
11
|
+
>
|
|
12
|
+
<ComboboxInput
|
|
13
|
+
class="w-full border-0 text-sm bg-transparent p-1 px-2 focus:ring-0"
|
|
14
|
+
@change="query = $event.target.value"
|
|
15
|
+
:displayValue="(option) => option"
|
|
16
|
+
/>
|
|
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"
|
|
19
|
+
>
|
|
20
|
+
<ComboboxOption
|
|
21
|
+
v-if="queryOption && !filteredOptions.some((option) => option.value === queryOption)"
|
|
22
|
+
:value="queryOption"
|
|
23
|
+
as="template"
|
|
24
|
+
v-slot="{ active }"
|
|
25
|
+
>
|
|
26
|
+
<li
|
|
27
|
+
:class="[
|
|
28
|
+
active ? 'bg-indigo-600 text-white' : '',
|
|
29
|
+
'relative cursor-default select-none py-2 pl-3 pr-9',
|
|
30
|
+
]"
|
|
31
|
+
>
|
|
32
|
+
<div class="flex items-center">
|
|
33
|
+
<span :class="['block truncate']">{{ query }}</span>
|
|
34
|
+
</div>
|
|
35
|
+
</li>
|
|
36
|
+
</ComboboxOption>
|
|
37
|
+
<ComboboxOption
|
|
38
|
+
as="template"
|
|
39
|
+
v-for="option in filteredOptions"
|
|
40
|
+
:key="option.value"
|
|
41
|
+
:value="option.value"
|
|
42
|
+
v-slot="{ active }"
|
|
43
|
+
>
|
|
44
|
+
<li
|
|
45
|
+
:class="[
|
|
46
|
+
active ? 'bg-indigo-600 text-white' : '',
|
|
47
|
+
'relative cursor-default select-none py-2 pl-3 pr-9',
|
|
48
|
+
]"
|
|
49
|
+
>
|
|
50
|
+
<div class="flex items-center">
|
|
51
|
+
<span :class="['block truncate']">{{ option.label }}</span>
|
|
52
|
+
</div>
|
|
53
|
+
</li>
|
|
54
|
+
</ComboboxOption>
|
|
55
|
+
</ComboboxOptions>
|
|
56
|
+
</Combobox>
|
|
57
|
+
<div v-if="error" class="text-red-600 text-sm">
|
|
58
|
+
{{ error }}
|
|
59
|
+
</div>
|
|
60
|
+
</template>
|
|
61
|
+
|
|
62
|
+
<script setup>
|
|
63
|
+
import { ref, computed } from "vue";
|
|
64
|
+
import {
|
|
65
|
+
Combobox,
|
|
66
|
+
ComboboxInput,
|
|
67
|
+
ComboboxOptions,
|
|
68
|
+
ComboboxOption,
|
|
69
|
+
} from "@headlessui/vue";
|
|
70
|
+
|
|
71
|
+
const props = defineProps({
|
|
72
|
+
options: {
|
|
73
|
+
type: Array,
|
|
74
|
+
default: () => [],
|
|
75
|
+
},
|
|
76
|
+
readonly: {
|
|
77
|
+
type: [Boolean, Number],
|
|
78
|
+
default: false,
|
|
79
|
+
},
|
|
80
|
+
error: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: "",
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const query = ref("");
|
|
87
|
+
const queryOption = computed(() => {
|
|
88
|
+
return query.value === "" ? null : query.value;
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const filteredOptions = computed(() =>
|
|
92
|
+
query.value === ""
|
|
93
|
+
? props.options.slice(0, 100)
|
|
94
|
+
: props.options
|
|
95
|
+
.filter((option) => {
|
|
96
|
+
return option.value.toLowerCase().includes(query.value.toLowerCase());
|
|
97
|
+
})
|
|
98
|
+
.slice(0, 100)
|
|
99
|
+
);
|
|
100
|
+
</script>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="relative">
|
|
3
|
+
<input
|
|
4
|
+
type="text"
|
|
5
|
+
:class="[
|
|
6
|
+
'pl-3 input-block pr-8',
|
|
7
|
+
error ? 'ring-red-600 ' : '',
|
|
8
|
+
readonly ? 'disabled' : '',
|
|
9
|
+
]"
|
|
10
|
+
:value="$attrs.modelValue"
|
|
11
|
+
v-bind="$attrs"
|
|
12
|
+
:readonly="readonly"
|
|
13
|
+
@input="onChange"
|
|
14
|
+
/>
|
|
15
|
+
<span
|
|
16
|
+
:class="[
|
|
17
|
+
'cursor-pointer absolute flex items-center right-2 inset-y-0',
|
|
18
|
+
error ? 'pb-5' : '',
|
|
19
|
+
]"
|
|
20
|
+
@click="copyInput"
|
|
21
|
+
>
|
|
22
|
+
<DocumentDuplicateIcon class="icon-md text-gray-400" />
|
|
23
|
+
</span>
|
|
24
|
+
<div v-if="error" class="text-red-600 text-sm">
|
|
25
|
+
{{ error }}
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script>
|
|
31
|
+
import { DocumentDuplicateIcon } from "@heroicons/vue/20/solid";
|
|
32
|
+
|
|
33
|
+
export default {
|
|
34
|
+
components: {
|
|
35
|
+
DocumentDuplicateIcon,
|
|
36
|
+
},
|
|
37
|
+
props: {
|
|
38
|
+
error: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: "",
|
|
41
|
+
},
|
|
42
|
+
readonly: {
|
|
43
|
+
type: [Boolean, Number],
|
|
44
|
+
default: false,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
data() {
|
|
48
|
+
return {
|
|
49
|
+
inputValue: "",
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
mounted() {
|
|
53
|
+
this.inputValue = this.initialValue;
|
|
54
|
+
},
|
|
55
|
+
methods: {
|
|
56
|
+
onChange(event) {
|
|
57
|
+
this.$emit("update:modelValue", event.target.value);
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
async copyInput() {
|
|
61
|
+
await navigator.clipboard.writeText(this.$attrs.modelValue);
|
|
62
|
+
this.$emit("copied", "Copied to clipboard", "", true);
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
</script>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="['flex input-block relative', { 'ring-red-600 ': error }]"
|
|
4
|
+
v-bind="$attrs"
|
|
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
|
+
<textarea
|
|
12
|
+
: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',
|
|
14
|
+
readonly ? 'disabled' : '',
|
|
15
|
+
]"
|
|
16
|
+
:value="$attrs.modelValue || props.value"
|
|
17
|
+
v-bind="$attrs"
|
|
18
|
+
style="resize: none"
|
|
19
|
+
:readonly="props.readonly"
|
|
20
|
+
@input="$emit('update:modelValue', $event.target.value)"
|
|
21
|
+
/>
|
|
22
|
+
</div>
|
|
23
|
+
<div v-if="error" class="text-red-600 text-sm">
|
|
24
|
+
{{ error }}
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
<script setup>
|
|
28
|
+
const props = defineProps({
|
|
29
|
+
error: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: "",
|
|
32
|
+
},
|
|
33
|
+
readonly: {
|
|
34
|
+
type: [Boolean, Number],
|
|
35
|
+
default: false,
|
|
36
|
+
},
|
|
37
|
+
value: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: "",
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
</script>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="relative">
|
|
3
|
+
<input
|
|
4
|
+
type="text"
|
|
5
|
+
:class="[
|
|
6
|
+
'pl-3 input-block pr-8',
|
|
7
|
+
error ? 'ring-red-600 ' : '',
|
|
8
|
+
readonly ? 'disabled' : '',
|
|
9
|
+
]"
|
|
10
|
+
v-model.trim="inputValue"
|
|
11
|
+
v-bind="$attrs"
|
|
12
|
+
@input="onChange"
|
|
13
|
+
/>
|
|
14
|
+
<span
|
|
15
|
+
:class="[
|
|
16
|
+
'cursor-pointer absolute flex items-center right-2 inset-y-0',
|
|
17
|
+
{ 'pb-5': error },
|
|
18
|
+
{ hidden: readonly },
|
|
19
|
+
]"
|
|
20
|
+
>
|
|
21
|
+
<CurrencyDollarIcon
|
|
22
|
+
class="icon-md text-gray-400"
|
|
23
|
+
@click="generateToken"
|
|
24
|
+
/>
|
|
25
|
+
</span>
|
|
26
|
+
<div v-if="error" class="text-red-600 text-sm">
|
|
27
|
+
{{ error }}
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script>
|
|
33
|
+
import { CurrencyDollarIcon } from "@heroicons/vue/20/solid";
|
|
34
|
+
import { randomId } from "@/utils/random";
|
|
35
|
+
|
|
36
|
+
export default {
|
|
37
|
+
components: {
|
|
38
|
+
CurrencyDollarIcon,
|
|
39
|
+
},
|
|
40
|
+
props: {
|
|
41
|
+
error: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: "",
|
|
44
|
+
},
|
|
45
|
+
initialValue: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: "",
|
|
48
|
+
},
|
|
49
|
+
tokenFunction: {
|
|
50
|
+
type: Function,
|
|
51
|
+
default: () => randomId(10),
|
|
52
|
+
},
|
|
53
|
+
readonly: {
|
|
54
|
+
type: [Boolean, Number],
|
|
55
|
+
default: false,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
data() {
|
|
59
|
+
return {
|
|
60
|
+
inputValue: "",
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
mounted() {
|
|
64
|
+
this.inputValue = this.initialValue;
|
|
65
|
+
},
|
|
66
|
+
methods: {
|
|
67
|
+
onChange() {
|
|
68
|
+
this.$emit("updateModel", this.inputValue);
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
generateToken() {
|
|
72
|
+
const token = this.tokenFunction();
|
|
73
|
+
this.inputValue = token;
|
|
74
|
+
this.$emit("updateModel", token);
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
</script>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<input
|
|
3
|
+
type="password"
|
|
4
|
+
:class="[
|
|
5
|
+
'input-block',
|
|
6
|
+
error ? 'ring-red-600 ' : '',
|
|
7
|
+
readonly ? 'disabled' : '',
|
|
8
|
+
]"
|
|
9
|
+
:value="$attrs.modelValue"
|
|
10
|
+
v-bind="$attrs"
|
|
11
|
+
@input="onChange"
|
|
12
|
+
/>
|
|
13
|
+
<div v-if="error" class="text-red-600 text-sm">
|
|
14
|
+
{{ error }}
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script>
|
|
19
|
+
export default {
|
|
20
|
+
props: {
|
|
21
|
+
error: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: "",
|
|
24
|
+
},
|
|
25
|
+
readonly: {
|
|
26
|
+
type: [Boolean, Number],
|
|
27
|
+
default: false,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
methods: {
|
|
31
|
+
onChange(event) {
|
|
32
|
+
this.$emit("update:modelValue", event.target.value);
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
</script>
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Listbox as="div" :value="$attrs.modelValue" v-bind="$attrs">
|
|
3
|
+
<div class="relative">
|
|
4
|
+
<ListboxButton
|
|
5
|
+
v-if="selected"
|
|
6
|
+
:class="[
|
|
7
|
+
'input-block sm:text-sm sm:leading-6',
|
|
8
|
+
error ? 'ring-red-600 ' : '',
|
|
9
|
+
readonly ? 'disabled' : '',
|
|
10
|
+
]"
|
|
11
|
+
>
|
|
12
|
+
<span class="flex items-center pr-10">
|
|
13
|
+
<span class="ml-3 block truncate">{{ selected.label }}</span>
|
|
14
|
+
</span>
|
|
15
|
+
<span
|
|
16
|
+
class="pointer-events-none absolute inset-y-0 right-2 flex items-center"
|
|
17
|
+
>
|
|
18
|
+
<ChevronUpDownIcon class="icon-md text-gray-400" aria-hidden="true" />
|
|
19
|
+
</span>
|
|
20
|
+
</ListboxButton>
|
|
21
|
+
<ListboxButton
|
|
22
|
+
v-else
|
|
23
|
+
:class="[
|
|
24
|
+
'input-block sm:text-sm sm:leading-6',
|
|
25
|
+
error ? 'ring-red-600 ' : '',
|
|
26
|
+
readonly ? 'disabled' : '',
|
|
27
|
+
]"
|
|
28
|
+
>
|
|
29
|
+
<span class="flex items-center pr-10">
|
|
30
|
+
<span class="ml-3 block truncate">{{ placeholder }}</span>
|
|
31
|
+
</span>
|
|
32
|
+
<span
|
|
33
|
+
class="pointer-events-none absolute inset-y-0 right-2 flex items-center"
|
|
34
|
+
>
|
|
35
|
+
<ChevronUpDownIcon class="icon-md text-gray-400" aria-hidden="true" />
|
|
36
|
+
</span>
|
|
37
|
+
</ListboxButton>
|
|
38
|
+
|
|
39
|
+
<transition
|
|
40
|
+
v-if="!readonly"
|
|
41
|
+
leave-active-class="transition ease-in duration-100"
|
|
42
|
+
leave-from-class="opacity-100"
|
|
43
|
+
leave-to-class="opacity-0"
|
|
44
|
+
>
|
|
45
|
+
<ListboxOptions
|
|
46
|
+
class="input-block absolute z-50 mt-1 max-h-56 w-full overflow-auto rounded-md p-1 text-sm sm:text-xs"
|
|
47
|
+
>
|
|
48
|
+
<ListboxOption
|
|
49
|
+
as="template"
|
|
50
|
+
v-for="option in sortedOptions"
|
|
51
|
+
:key="option.id"
|
|
52
|
+
:value="option.value"
|
|
53
|
+
v-slot="{ active }"
|
|
54
|
+
>
|
|
55
|
+
<li
|
|
56
|
+
:class="[
|
|
57
|
+
active ? 'bg-indigo-600 text-white' : '',
|
|
58
|
+
'relative cursor-default select-none py-2',
|
|
59
|
+
]"
|
|
60
|
+
>
|
|
61
|
+
<div
|
|
62
|
+
:class="[
|
|
63
|
+
'flex items-center',
|
|
64
|
+
{ 'pr-10': selected && selected.value === option.value },
|
|
65
|
+
]"
|
|
66
|
+
>
|
|
67
|
+
<span
|
|
68
|
+
:class="[
|
|
69
|
+
selected ? 'font-semibold' : 'font-normal',
|
|
70
|
+
'ml-3 block truncate',
|
|
71
|
+
]"
|
|
72
|
+
>{{ option.label }}</span
|
|
73
|
+
>
|
|
74
|
+
</div>
|
|
75
|
+
<span
|
|
76
|
+
v-if="selected && selected.value === option.value"
|
|
77
|
+
:class="[
|
|
78
|
+
active ? 'text-white' : '',
|
|
79
|
+
'absolute inset-y-0 right-2 flex items-center',
|
|
80
|
+
]"
|
|
81
|
+
>
|
|
82
|
+
<CheckIcon class="icon-md" aria-hidden="true" />
|
|
83
|
+
</span>
|
|
84
|
+
</li>
|
|
85
|
+
</ListboxOption>
|
|
86
|
+
</ListboxOptions>
|
|
87
|
+
</transition>
|
|
88
|
+
</div>
|
|
89
|
+
</Listbox>
|
|
90
|
+
<div v-if="error" class="text-red-600 text-sm">
|
|
91
|
+
{{ error }}
|
|
92
|
+
</div>
|
|
93
|
+
</template>
|
|
94
|
+
|
|
95
|
+
<script>
|
|
96
|
+
import {
|
|
97
|
+
Listbox,
|
|
98
|
+
ListboxButton,
|
|
99
|
+
ListboxLabel,
|
|
100
|
+
ListboxOption,
|
|
101
|
+
ListboxOptions,
|
|
102
|
+
} from "@headlessui/vue";
|
|
103
|
+
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid";
|
|
104
|
+
|
|
105
|
+
export default {
|
|
106
|
+
components: {
|
|
107
|
+
Listbox,
|
|
108
|
+
ListboxButton,
|
|
109
|
+
ListboxLabel,
|
|
110
|
+
ListboxOption,
|
|
111
|
+
ListboxOptions,
|
|
112
|
+
CheckIcon,
|
|
113
|
+
ChevronUpDownIcon,
|
|
114
|
+
},
|
|
115
|
+
props: {
|
|
116
|
+
options: {
|
|
117
|
+
type: Array,
|
|
118
|
+
required: true,
|
|
119
|
+
},
|
|
120
|
+
readonly: {
|
|
121
|
+
type: [Boolean, Number],
|
|
122
|
+
default: false,
|
|
123
|
+
},
|
|
124
|
+
error: {
|
|
125
|
+
type: String,
|
|
126
|
+
default: "",
|
|
127
|
+
},
|
|
128
|
+
sorted: {
|
|
129
|
+
type: Boolean,
|
|
130
|
+
default: false,
|
|
131
|
+
},
|
|
132
|
+
placeholder: {
|
|
133
|
+
type: String,
|
|
134
|
+
default: "Select a value",
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
computed: {
|
|
138
|
+
selected() {
|
|
139
|
+
const target = this.options.find(
|
|
140
|
+
(option) => option.value === this.$attrs.modelValue
|
|
141
|
+
);
|
|
142
|
+
if (!target && this.$attrs.modelValue) {
|
|
143
|
+
return { label: this.$attrs.modelValue, value: this.$attrs.modelValue };
|
|
144
|
+
}
|
|
145
|
+
return target;
|
|
146
|
+
},
|
|
147
|
+
sortedOptions() {
|
|
148
|
+
return this.sorted
|
|
149
|
+
? this.options.sort((a, b) => a.label.localeCompare(b.label))
|
|
150
|
+
: this.options;
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
</script>
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Combobox as="div" v-bind="$attrs">
|
|
3
|
+
<div class="relative">
|
|
4
|
+
<input
|
|
5
|
+
type="text"
|
|
6
|
+
:class="[
|
|
7
|
+
'input-block',
|
|
8
|
+
error ? 'ring-red-600 ' : '',
|
|
9
|
+
readonly ? 'disabled' : '',
|
|
10
|
+
]"
|
|
11
|
+
v-model.trim="inputValue"
|
|
12
|
+
@input="setModelValue($event.target)"
|
|
13
|
+
/>
|
|
14
|
+
<ComboboxButton
|
|
15
|
+
class="absolute inset-y-0 right-0 flex items-center rounded-r-md px-2 focus:outline-hidden"
|
|
16
|
+
>
|
|
17
|
+
<ChevronUpDownIcon class="icon-md text-gray-400" aria-hidden="true" />
|
|
18
|
+
</ComboboxButton>
|
|
19
|
+
|
|
20
|
+
<transition
|
|
21
|
+
v-if="!readonly"
|
|
22
|
+
leave-active-class="transition ease-in duration-100"
|
|
23
|
+
leave-from-class="opacity-100"
|
|
24
|
+
leave-to-class="opacity-0"
|
|
25
|
+
>
|
|
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"
|
|
28
|
+
>
|
|
29
|
+
<ComboboxOption
|
|
30
|
+
as="template"
|
|
31
|
+
v-for="option in sortedOptions"
|
|
32
|
+
:key="option.id"
|
|
33
|
+
:value="option"
|
|
34
|
+
@click="updateInput(option)"
|
|
35
|
+
v-slot="{ active }"
|
|
36
|
+
>
|
|
37
|
+
<li
|
|
38
|
+
:class="[
|
|
39
|
+
active ? 'px-1 bg-indigo-600 text-white' : '',
|
|
40
|
+
'relative cursor-default select-none py-2 pl-3 pr-9',
|
|
41
|
+
]"
|
|
42
|
+
>
|
|
43
|
+
<div class="flex items-center">
|
|
44
|
+
<span class="'ml-3 block truncate">{{ option.label }}</span>
|
|
45
|
+
</div>
|
|
46
|
+
</li>
|
|
47
|
+
</ComboboxOption>
|
|
48
|
+
</ComboboxOptions>
|
|
49
|
+
</transition>
|
|
50
|
+
</div>
|
|
51
|
+
</Combobox>
|
|
52
|
+
<div v-if="error" class="text-red-600 text-sm">
|
|
53
|
+
{{ error }}
|
|
54
|
+
</div>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<script>
|
|
58
|
+
import {
|
|
59
|
+
Combobox,
|
|
60
|
+
ComboboxButton,
|
|
61
|
+
ComboboxOption,
|
|
62
|
+
ComboboxOptions,
|
|
63
|
+
} from "@headlessui/vue";
|
|
64
|
+
import { ChevronUpDownIcon } from "@heroicons/vue/20/solid";
|
|
65
|
+
|
|
66
|
+
export default {
|
|
67
|
+
components: {
|
|
68
|
+
Combobox,
|
|
69
|
+
ComboboxButton,
|
|
70
|
+
ComboboxOption,
|
|
71
|
+
ComboboxOptions,
|
|
72
|
+
ChevronUpDownIcon,
|
|
73
|
+
},
|
|
74
|
+
props: {
|
|
75
|
+
initialValue: {
|
|
76
|
+
type: String,
|
|
77
|
+
required: false,
|
|
78
|
+
},
|
|
79
|
+
options: {
|
|
80
|
+
type: Array,
|
|
81
|
+
required: true,
|
|
82
|
+
},
|
|
83
|
+
readonly: {
|
|
84
|
+
type: [Boolean, Number],
|
|
85
|
+
default: false,
|
|
86
|
+
},
|
|
87
|
+
error: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: "",
|
|
90
|
+
},
|
|
91
|
+
sorted: {
|
|
92
|
+
type: Boolean,
|
|
93
|
+
default: false,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
data() {
|
|
97
|
+
return {
|
|
98
|
+
inputValue: "",
|
|
99
|
+
};
|
|
100
|
+
},
|
|
101
|
+
computed: {
|
|
102
|
+
sortedOptions() {
|
|
103
|
+
return this.sorted
|
|
104
|
+
? this.options.sort((a, b) => a.label.localeCompare(b.label))
|
|
105
|
+
: this.options;
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
mounted() {
|
|
109
|
+
this.selected =
|
|
110
|
+
this.options.find((option) => option.value === this.initialValue) || "";
|
|
111
|
+
this.inputValue = this.initialValue;
|
|
112
|
+
},
|
|
113
|
+
methods: {
|
|
114
|
+
setModelValue(value) {
|
|
115
|
+
this.$emit("updateModel", value.value);
|
|
116
|
+
},
|
|
117
|
+
updateInput(option) {
|
|
118
|
+
this.inputValue = option.value;
|
|
119
|
+
this.setModelValue(option);
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
</script>
|