fluency-v8-components 1.3.5 → 1.3.7

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 (178) hide show
  1. package/dist/fluency-v8-components.es.js +1 -1
  2. package/dist/fluency-v8-components.umd.js +99 -99
  3. package/dist/{index-q2NbjdVo.mjs → index-ChEFiXF5.mjs} +12 -11
  4. package/dist/{index.es-PAPL4E6Y.mjs → index.es-CjjN70eV.mjs} +1 -1
  5. package/package.json +3 -2
  6. package/src/assets/images/ai.svg +1 -0
  7. package/src/assets/images/github-dark.svg +1 -0
  8. package/src/assets/images/github.svg +1 -0
  9. package/src/assets/images/high-priority.svg +1 -0
  10. package/src/assets/images/power-off.svg +1 -0
  11. package/src/assets/images/save.svg +1 -0
  12. package/src/assets/index.ts +15 -0
  13. package/src/assets/main.css +495 -0
  14. package/src/assets/prism-theme.css +290 -0
  15. package/src/components/buttons/ActionButtons.vue +374 -0
  16. package/src/components/buttons/DropdownButton.vue +104 -0
  17. package/src/components/buttons/IconButton.vue +63 -0
  18. package/src/components/buttons/ImageButton.vue +16 -0
  19. package/src/components/buttons/MenuButton.vue +138 -0
  20. package/src/components/buttons/SubmitButtons.vue +51 -0
  21. package/src/components/buttons/TextButton.vue +40 -0
  22. package/src/components/charts/AlertChart.vue +376 -0
  23. package/src/components/charts/BarChart.vue +212 -0
  24. package/src/components/charts/BarChartHorizontal.vue +243 -0
  25. package/src/components/charts/CronChart.vue +146 -0
  26. package/src/components/charts/EmptyChart.vue +76 -0
  27. package/src/components/charts/GradientChart.vue +310 -0
  28. package/src/components/charts/LineChart.test.js +59 -0
  29. package/src/components/charts/LineChart.vue +434 -0
  30. package/src/components/charts/PieChart.vue +293 -0
  31. package/src/components/charts/ProgressChart.vue +106 -0
  32. package/src/components/charts/StackedChart.vue +364 -0
  33. package/src/components/charts/StackedChartClustered.vue +395 -0
  34. package/src/components/charts/TimelineChart.vue +215 -0
  35. package/src/components/charts/WorkflowChart.vue +520 -0
  36. package/src/components/common/AutoCompleteSearchBar.vue +100 -0
  37. package/src/components/common/AutoRefreshButton.vue +53 -0
  38. package/src/components/common/Breadcrumb.vue +45 -0
  39. package/src/components/common/ButtonToggle.vue +24 -0
  40. package/src/components/common/Card.vue +116 -0
  41. package/src/components/common/Carousel.vue +66 -0
  42. package/src/components/common/CategoryCard.vue +28 -0
  43. package/src/components/common/CodeEditor.vue +59 -0
  44. package/src/components/common/DatePicker.vue +21 -0
  45. package/src/components/common/DatePickerInput.vue +109 -0
  46. package/src/components/common/Dialog.vue +103 -0
  47. package/src/components/common/EditorHeading.vue +10 -0
  48. package/src/components/common/EventList.vue +41 -0
  49. package/src/components/common/Facet.vue +206 -0
  50. package/src/components/common/Feed.vue +58 -0
  51. package/src/components/common/Flag.vue +27 -0
  52. package/src/components/common/HomeCard.vue +20 -0
  53. package/src/components/common/ItemBox.vue +49 -0
  54. package/src/components/common/Loading.vue +19 -0
  55. package/src/components/common/LoadingDots.vue +12 -0
  56. package/src/components/common/PageHeading.vue +30 -0
  57. package/src/components/common/Pagination.vue +105 -0
  58. package/src/components/common/Popover.vue +24 -0
  59. package/src/components/common/PowerToggle.vue +130 -0
  60. package/src/components/common/ProgressBar.vue +33 -0
  61. package/src/components/common/RadioButtons.vue +52 -0
  62. package/src/components/common/Schedule.vue +79 -0
  63. package/src/components/common/SearchBar.vue +30 -0
  64. package/src/components/common/Separator.vue +3 -0
  65. package/src/components/common/Slideout.vue +95 -0
  66. package/src/components/common/Sort.vue +83 -0
  67. package/src/components/common/Table.vue +48 -0
  68. package/src/components/common/Tabs.vue +129 -0
  69. package/src/components/common/Tag.vue +53 -0
  70. package/src/components/common/Tooltip.vue +49 -0
  71. package/src/components/common/VerticalTabs.vue +34 -0
  72. package/src/components/common/card/CardItem.vue +27 -0
  73. package/src/components/common/card/CardItemGroup.vue +45 -0
  74. package/src/components/common/facet/Leaf.vue +97 -0
  75. package/src/components/common/facet/TriState.vue +37 -0
  76. package/src/components/common/table/TableData.vue +48 -0
  77. package/src/components/common/table/TableHeader.vue +21 -0
  78. package/src/components/dialogs/ChooseValueDialog.vue +97 -0
  79. package/src/components/dialogs/ConfirmDialog.vue +73 -0
  80. package/src/components/dialogs/CopyDialog.vue +51 -0
  81. package/src/components/dialogs/DownloadDialog.vue +48 -0
  82. package/src/components/dialogs/NameDescDialog.vue +74 -0
  83. package/src/components/dialogs/NameDialog.vue +56 -0
  84. package/src/components/dialogs/PopupEditor.vue +113 -0
  85. package/src/components/dialogs/ProgressDialog.vue +58 -0
  86. package/src/components/dialogs/ResetPasswordDialog.vue +58 -0
  87. package/src/components/dialogs/Wizard.vue +99 -0
  88. package/src/components/dialogs/wizard/Stepper.vue +31 -0
  89. package/src/components/form/CheckBox.vue +26 -0
  90. package/src/components/form/Editor.vue +93 -0
  91. package/src/components/form/FormCol.vue +19 -0
  92. package/src/components/form/FormRow.vue +19 -0
  93. package/src/components/form/FormSection.vue +21 -0
  94. package/src/components/form/GreyForm.vue +7 -0
  95. package/src/components/form/GreyInput.vue +51 -0
  96. package/src/components/form/GreyInputAutocomplete.vue +100 -0
  97. package/src/components/form/GreyInputCopy.vue +66 -0
  98. package/src/components/form/GreyInputGrow.vue +42 -0
  99. package/src/components/form/GreyInputToken.vue +78 -0
  100. package/src/components/form/GreyPassword.vue +36 -0
  101. package/src/components/form/GreySelect.vue +154 -0
  102. package/src/components/form/GreySelectInput.vue +123 -0
  103. package/src/components/form/GreySelectInputMultiple.vue +218 -0
  104. package/src/components/form/GreyTel.vue +58 -0
  105. package/src/components/form/HamburgerItem.vue +95 -0
  106. package/src/components/form/KeyValueEntry.vue +74 -0
  107. package/src/components/form/RadioInput.vue +38 -0
  108. package/src/components/form/UploadFile.vue +99 -0
  109. package/src/components/icons/AiIcon.vue +6 -0
  110. package/src/components/icons/GithubIcon.vue +18 -0
  111. package/src/components/icons/HighPriorityIcon.vue +6 -0
  112. package/src/components/icons/PowerOffIcon.vue +6 -0
  113. package/src/components/icons/SaveIcon.vue +6 -0
  114. package/src/components/index.js +134 -0
  115. package/src/components/menu/DialogMenu.vue +142 -0
  116. package/src/components/menu/GrandChild.vue +39 -0
  117. package/src/components/menu/GridMenu.vue +88 -0
  118. package/src/components/menu/MenuAvatar.vue +66 -0
  119. package/src/components/menu/MenuDesktop.vue +90 -0
  120. package/src/components/notifications/Notify.vue +123 -0
  121. package/src/components/notifications/NotifyList.vue +130 -0
  122. package/src/components/page-structure/FacetPage.vue +77 -0
  123. package/src/components/query/Child.vue +63 -0
  124. package/src/components/query/LVDBQuery.vue +38 -0
  125. package/src/components/status/Active.vue +44 -0
  126. package/src/components/status/ScoreLevel.vue +43 -0
  127. package/src/components/status/Status.vue +51 -0
  128. package/src/components/status/TaskDot.vue +25 -0
  129. package/src/components/status/TaskStatus.vue +26 -0
  130. package/src/components/status/TicketStatus.vue +201 -0
  131. package/src/components/status/Trend.vue +20 -0
  132. package/src/components/tables/ArgumentRunTable.vue +96 -0
  133. package/src/components/tables/ArgumentTable.vue +67 -0
  134. package/src/components/tables/CloudFormationParameters.vue +25 -0
  135. package/src/constants/colors.js +248 -0
  136. package/src/constants/font-map.js +128 -0
  137. package/src/constants/fpl2.js +162 -0
  138. package/src/constants/icon-svg.js +405 -0
  139. package/src/constants/schedule.js +52 -0
  140. package/src/fpl/AddPanel.vue +237 -0
  141. package/src/fpl/Configs/Alert.vue +16 -0
  142. package/src/fpl/Configs/AlertSprite.vue +2 -0
  143. package/src/fpl/Configs/Chart.vue +63 -0
  144. package/src/fpl/Configs/Config.js +154 -0
  145. package/src/fpl/Configs/Counter.vue +35 -0
  146. package/src/fpl/Configs/Histogram.vue +70 -0
  147. package/src/fpl/Configs/IPMap.vue +37 -0
  148. package/src/fpl/Configs/Image.vue +163 -0
  149. package/src/fpl/Configs/MetricChart.vue +20 -0
  150. package/src/fpl/Configs/PieChart.vue +37 -0
  151. package/src/fpl/Configs/SparkChart.vue +41 -0
  152. package/src/fpl/Configs/StackedBarChart.vue +49 -0
  153. package/src/fpl/Configs/Table.vue +211 -0
  154. package/src/fpl/Configs/Text.vue +14 -0
  155. package/src/fpl/Configs/TopNChart.vue +37 -0
  156. package/src/fpl/Outputs/FPLAlert.vue +64 -0
  157. package/src/fpl/Outputs/FPLStream.vue +41 -0
  158. package/src/fpl/Outputs/FPLTable.vue +77 -0
  159. package/src/fpl/Panel.vue +202 -0
  160. package/src/fpl/Panels/Alert.vue +85 -0
  161. package/src/fpl/Panels/AlertSprite.vue +9 -0
  162. package/src/fpl/Panels/Chart.vue +98 -0
  163. package/src/fpl/Panels/Counter.vue +43 -0
  164. package/src/fpl/Panels/Histogram.vue +138 -0
  165. package/src/fpl/Panels/IPMap.vue +48 -0
  166. package/src/fpl/Panels/Image.vue +35 -0
  167. package/src/fpl/Panels/MetricChart.vue +97 -0
  168. package/src/fpl/Panels/PieChart.vue +54 -0
  169. package/src/fpl/Panels/SparkChart.vue +166 -0
  170. package/src/fpl/Panels/StackedBarChart.vue +74 -0
  171. package/src/fpl/Panels/Table.vue +103 -0
  172. package/src/fpl/Panels/Text.vue +24 -0
  173. package/src/fpl/Panels/TopNChart.vue +69 -0
  174. package/src/fpl/index.js +39 -0
  175. package/src/utils/download.js +220 -0
  176. package/src/utils/formatOutput.js +156 -0
  177. package/src/utils/random.js +32 -0
  178. package/src/utils/timeUtils.js +138 -0
@@ -0,0 +1,206 @@
1
+ <template>
2
+ <div class="hidden md:col md:h-full overflow-hidden">
3
+ <div v-if="searchBar" class="flex">
4
+ <SearchBar
5
+ class="w-full"
6
+ :str="str"
7
+ @search="emits('search')"
8
+ @update="emits('updateStr', $event)"
9
+ />
10
+ </div>
11
+ <div class="h-0 flex-1 overflow-y-auto px-1">
12
+ <div v-if="tree.length == 0" class="q-ml-md text-bold">
13
+ No Facet data. Please select a search query.
14
+ </div>
15
+ <div v-for="primary in tree" :key="primary.id" class="primary">
16
+ <Leaf
17
+ :parent="primary"
18
+ :children="primary.children"
19
+ :clear="clearStates"
20
+ :facet-options="facetOptions"
21
+ :tooltip="tooltip"
22
+ @newState="updateParent"
23
+ />
24
+ <Separator />
25
+ </div>
26
+ </div>
27
+ <!--div v-if="buttons" class="absolute bottom-5"-->
28
+ <div v-if="buttons" class="flex flex-shrink-0 px-1 py-1">
29
+ <span class="relative isolate inline-flex rounded-md shadow-xs">
30
+ <button
31
+ type="button"
32
+ class="action-btn std-red rounded-l-md"
33
+ @click="emits('reset')"
34
+ @mouseover="mouseoverTooltip(true, 'Reset Facet')"
35
+ @mouseout="mouseoverTooltip(false)"
36
+ >
37
+ <XMarkIcon class="icon-md" aria-hidden="true" />
38
+ </button>
39
+ <button
40
+ type="button"
41
+ class="action-btn std-blue"
42
+ @click="emits('edit')"
43
+ @mouseover="mouseoverTooltip(true, 'Edit Facet')"
44
+ @mouseout="mouseoverTooltip(false)"
45
+ >
46
+ <PencilSquareIcon class="icon-md" aria-hidden="true" />
47
+ </button>
48
+ <button
49
+ type="button"
50
+ class="action-btn std-blue"
51
+ @click="emits('save')"
52
+ @mouseover="mouseoverTooltip(true, 'Save Facet')"
53
+ @mouseout="mouseoverTooltip(false)"
54
+ >
55
+ <SaveIcon class="icon-md" aria-hidden="true" />
56
+ </button>
57
+ <!--button
58
+ type="button"
59
+ class="action-btn std-green"
60
+ @click="emits('download')"
61
+ @mouseover="mouseoverTooltip(true, 'Download Facet')"
62
+ @mouseout="mouseoverTooltip(false)"
63
+ >
64
+ <ArrowDownTrayIcon class="icon-md" aria-hidden="true" />
65
+ </button-->
66
+ <button
67
+ type="button"
68
+ class="action-btn std-blue rounded-r-md"
69
+ @click="emits('search')"
70
+ @mouseover="mouseoverTooltip(true, 'Search')"
71
+ @mouseout="mouseoverTooltip(false)"
72
+ >
73
+ <MagnifyingGlassIcon class="icon-md" aria-hidden="true" />
74
+ </button>
75
+ <Tooltip
76
+ :tooltip="tooltipVal"
77
+ :showingTooltip="showingTooltip"
78
+ direction="top"
79
+ style="transform: translateY(-40%)"
80
+ />
81
+ </span>
82
+ </div>
83
+ </div>
84
+ </template>
85
+
86
+ <script lang="ts" setup>
87
+ import { ref } from "vue";
88
+ import type { FacetTag } from "@/interfaces/facet";
89
+ import { SearchBar, SaveIcon, Tooltip, Separator } from "@/components";
90
+ import Leaf from "./facet/Leaf.vue";
91
+ import {
92
+ ArrowDownTrayIcon,
93
+ MagnifyingGlassIcon,
94
+ PencilSquareIcon,
95
+ XMarkIcon,
96
+ } from "@heroicons/vue/20/solid";
97
+
98
+ // props and emits
99
+ const props = defineProps({
100
+ tree: {
101
+ type: Array<any>,
102
+ default: [],
103
+ },
104
+ facetOptions: {
105
+ type: Object,
106
+ default: {},
107
+ },
108
+ state: {
109
+ type: Number,
110
+ default: 0,
111
+ },
112
+ searchBar: {
113
+ type: Boolean,
114
+ default: true,
115
+ },
116
+ tooltip: {
117
+ type: Boolean,
118
+ default: false,
119
+ },
120
+ buttons: {
121
+ type: Boolean,
122
+ default: false,
123
+ },
124
+ });
125
+ const emits = defineEmits([
126
+ "search",
127
+ "updateStr",
128
+ "reset",
129
+ "edit",
130
+ "save",
131
+ "download",
132
+ "search",
133
+ ]);
134
+ // states
135
+ const must = ref(props.facetOptions?.mustFilters);
136
+ const mustnot = ref(props.facetOptions?.mustNotFilters);
137
+ const str = ref(props.facetOptions?.searchStr);
138
+ const clearStates = ref(props.state);
139
+ const showingTooltip = ref(false);
140
+ const tooltipVal = ref("");
141
+
142
+ // methods
143
+ function addList(tag: FacetTag, list: Array<any>) {
144
+ const parent = list.find((e) => e.field === tag.parent);
145
+ if (typeof parent !== "undefined") {
146
+ parent.terms.push(tag.child);
147
+ } else {
148
+ list.push({
149
+ field: tag.parent,
150
+ terms: [tag.child],
151
+ });
152
+ }
153
+ }
154
+
155
+ function removeList(tag: FacetTag, list: Array<any>) {
156
+ const parent = list.find((e) => e.field === tag.parent);
157
+ if (typeof parent !== "undefined") {
158
+ const index = parent.terms.indexOf(tag.child);
159
+ if (index > -1) {
160
+ parent.terms.splice(index, 1);
161
+ if (parent.terms.length === 0) {
162
+ const parentIndex = list.findIndex((e) => e.field === tag.parent);
163
+ list.splice(parentIndex, 1);
164
+ }
165
+ }
166
+ }
167
+ }
168
+
169
+ function updateParent(parent: string, child: string, newState: string) {
170
+ if (newState === "checked") {
171
+ statusChecked({ parent: parent, child: child });
172
+ } else if (newState === "ignored") {
173
+ statusIgnore({ parent: parent, child: child });
174
+ } else {
175
+ statusUnchecked({ parent: parent, child: child });
176
+ }
177
+ }
178
+
179
+ function statusChecked(tag: FacetTag) {
180
+ addList(tag, must.value);
181
+ }
182
+
183
+ function statusIgnore(tag: FacetTag) {
184
+ removeList(tag, must.value);
185
+ addList(tag, mustnot.value);
186
+ }
187
+
188
+ function statusUnchecked(tag: FacetTag) {
189
+ removeList(tag, mustnot.value);
190
+ }
191
+
192
+ function mouseoverTooltip(show: boolean, val = "") {
193
+ showingTooltip.value = show;
194
+ tooltipVal.value = val;
195
+ }
196
+ </script>
197
+ <style scoped>
198
+ .primary {
199
+ font-weight: 400;
200
+ padding-top: 5px;
201
+ }
202
+
203
+ .primary:first-child {
204
+ font-weight: 400;
205
+ }
206
+ </style>
@@ -0,0 +1,58 @@
1
+ <template>
2
+ <ul role="list" class="space-y-6">
3
+ <li v-for="(activity, i) in data" class="relative flex gap-x-4">
4
+ <div
5
+ :class="[
6
+ i === data.length - 1 ? 'h-6' : '-bottom-6',
7
+ 'absolute left-0 top-0 flex w-6 justify-center',
8
+ ]"
9
+ >
10
+ <div class="w-px bg-gray-200" />
11
+ </div>
12
+ <div
13
+ class="relative flex icon-lg flex-none items-center justify-center bg-white dark:bg-black"
14
+ >
15
+ <CheckCircleIcon
16
+ v-if="activity.action === 'resolve'"
17
+ class="icon-lg icon-green"
18
+ aria-hidden="true"
19
+ />
20
+ <ExclamationCircleIcon
21
+ v-else-if="activity.action === 'trigger'"
22
+ class="icon-lg icon-red"
23
+ aria-hidden="true"
24
+ />
25
+ <div
26
+ v-else
27
+ class="h-1.5 w-1.5 rounded-full bg-gray-100 ring-1 ring-gray-300"
28
+ />
29
+ </div>
30
+ <p
31
+ class="flex-auto py-0.5 text-xs leading-5 text-gray-500 dark:text-gray-400"
32
+ >
33
+ <span class="font-medium text-gray-900 dark:text-gray-200">{{
34
+ activity.source
35
+ }}</span>
36
+ {{ activity.action }} the alert.
37
+ </p>
38
+ <time
39
+ :datetime="activity.timestamp"
40
+ class="flex-none py-0.5 text-xs leading-5 text-gray-500 dark:text-gray-400"
41
+ >
42
+ {{ timeFromNow(activity.timestamp) }}
43
+ </time>
44
+ </li>
45
+ </ul>
46
+ </template>
47
+
48
+ <script setup>
49
+ import {
50
+ CheckCircleIcon,
51
+ ExclamationCircleIcon,
52
+ } from "@heroicons/vue/24/solid";
53
+ import { timeFromNow } from "@/utils/timeUtils";
54
+
55
+ const props = defineProps({
56
+ data: Array,
57
+ });
58
+ </script>
@@ -0,0 +1,27 @@
1
+ <template>
2
+ <div>
3
+ <span
4
+ v-if="country"
5
+ :class="[
6
+ 'fi mr-1',
7
+ { 'fis': props.squared },
8
+ `fi-${props.country.toLowerCase()}`,
9
+ ]"
10
+ :title="country"
11
+ />
12
+ <span v-if="city" class="text-xs">{{ city }}, {{ org }}</span>
13
+ </div>
14
+ </template>
15
+ <script setup>
16
+ // props and emits
17
+ const props = defineProps({
18
+ country: String,
19
+ city: String,
20
+ org: String,
21
+ squared: {
22
+ type: Boolean,
23
+ default: false,
24
+ },
25
+ });
26
+ const emits = defineEmits([]);
27
+ </script>
@@ -0,0 +1,20 @@
1
+ <template>
2
+ <div class="relative rounded-3xl p-2 px-4 white-bg dark:dark-bg">
3
+ <div class="row">
4
+ <slot name="top-left" />
5
+ <PageHeading :title="title" :description="description" size="text-lg" />
6
+ </div>
7
+ <div class="absolute top-2 right-3">
8
+ <slot name="top-right" />
9
+ </div>
10
+ <slot name="content" />
11
+ </div>
12
+ </template>
13
+ <script setup>
14
+ import { PageHeading } from "@/components";
15
+
16
+ const props = defineProps({
17
+ title: String,
18
+ description: String,
19
+ });
20
+ </script>
@@ -0,0 +1,49 @@
1
+ <template>
2
+ <div
3
+ :class="[
4
+ {'disabled-box': props.disabled },
5
+ { 'selected-green-box': props.inUse && props.selected && !props.disabled },
6
+ {
7
+ 'green-box': props.inUse && !props.selected && !props.disabled,
8
+ },
9
+ { 'selected-blue-box': !props.inUse && props.selected && !props.disabled },
10
+ {
11
+ 'blue-box': !props.inUse && !props.selected && !props.disabled,
12
+ },
13
+ 'box',
14
+ ]"
15
+ :style="`min-width: ${minWidth}`"
16
+ @click="emits('view')"
17
+ >
18
+ <slot name="icon" />
19
+ <img v-if="props.icon" :src="props.icon" :alt="props.icon" :style="`height: ${props.iconHeight}`" />
20
+ <div class="ml-2 flex-col">
21
+ <div class="text-md">{{ props.title }}</div>
22
+ <div class="text-xs font-light">{{ props.description }}</div>
23
+ <slot name="extra" />
24
+ </div>
25
+ </div>
26
+ </template>
27
+
28
+ <script setup>
29
+ const props = defineProps({
30
+ inUse: Boolean,
31
+ selected: Boolean,
32
+ icon: String,
33
+ iconHeight: {
34
+ type: String,
35
+ default: "40px",
36
+ },
37
+ minWidth: {
38
+ type: String,
39
+ default: "250px",
40
+ },
41
+ title: String,
42
+ description: String,
43
+ disabled: {
44
+ type: Boolean,
45
+ default: false,
46
+ },
47
+ });
48
+ const emits = defineEmits(["view"]);
49
+ </script>
@@ -0,0 +1,19 @@
1
+ <template>
2
+ <div class="flex">
3
+ <div
4
+ class="animate-ping rounded-full w-8 h-8 relative -left-3 -top-3 bg-indigo-600"
5
+ ></div>
6
+ <div
7
+ class="rounded-full w-8 h-8 relative -left-11 -top-3 bg-teal-500"
8
+ ></div>
9
+ <div class="loading">{{ text }}</div>
10
+ </div>
11
+ </template>
12
+ <script setup>
13
+ const props = defineProps({
14
+ text: {
15
+ type: String,
16
+ default: "Loading...",
17
+ },
18
+ });
19
+ </script>
@@ -0,0 +1,12 @@
1
+ <template>
2
+ <div class="row gap-x-1">
3
+ <span class="sr-only">Loading...</span>
4
+ <div
5
+ class="icon-md bg-indigo-600 rounded-full animate-bounce [animation-delay:-0.3s]"
6
+ ></div>
7
+ <div
8
+ class="icon-md bg-indigo-600 rounded-full animate-bounce [animation-delay:-0.15s]"
9
+ ></div>
10
+ <div class="icon-md bg-indigo-600 rounded-full animate-bounce"></div>
11
+ </div>
12
+ </template>
@@ -0,0 +1,30 @@
1
+ <template>
2
+ <div class="md:flex md:items-center md:justify-between">
3
+ <div class="min-w-0 flex-1 font-normal" @click="emits('title')">
4
+ <h2 :class="`${size} leading-7 sm:truncate sm:tracking-tight`">
5
+ {{ title }}
6
+ </h2>
7
+ <div class="sm:flex sm:items-center">
8
+ <div class="sm:flex-auto">
9
+ <!--h1 class="title2">Invoices</h1 -->
10
+ <p class="text-sm">{{ description }}</p>
11
+ </div>
12
+ </div>
13
+ </div>
14
+ <div class="mt-4 flex md:mt-0 md:ml-4">
15
+ <slot />
16
+ </div>
17
+ </div>
18
+ </template>
19
+
20
+ <script setup lang="ts">
21
+ const props = defineProps({
22
+ title: String,
23
+ description: String,
24
+ size: {
25
+ type: String,
26
+ default: "text-2xl",
27
+ },
28
+ });
29
+ const emits = defineEmits(["title"]);
30
+ </script>
@@ -0,0 +1,105 @@
1
+ <template>
2
+ <nav
3
+ class="flex items-center bg-neutral-200 dark:dark-bg justify-between px-4 py-3 sm:px-6 rounded-lg"
4
+ aria-label="Pagination"
5
+ >
6
+ <div class="hidden sm:block">
7
+ <p class="text-sm">
8
+ Showing
9
+ {{ " " }}
10
+ <span class="font-medium">{{ total === 0 ? 0 : startPos + 1 }} </span>
11
+ {{ " " }}
12
+ to
13
+ {{ " " }}
14
+ <span class="font-medium">{{
15
+ startPos + pageSize > total ? total : startPos + pageSize
16
+ }}</span>
17
+ {{ " " }}
18
+ of
19
+ {{ " " }}
20
+ <span class="font-medium">{{ total }}</span>
21
+ {{ " " }}
22
+ {{ resultsText }}
23
+ </p>
24
+ </div>
25
+ <div class="flex flex-1 space-x-3 sm:justify-end">
26
+ <nav
27
+ class="isolate inline-flex -space-x-px rounded-md shadow-xs"
28
+ aria-label="Pagination"
29
+ >
30
+ <a
31
+ class="relative inline-flex items-center rounded-l-md px-2 py-2 ring-1 ring-inset ring-gray-300 std-white dark:std-dark"
32
+ @click="emit('previous')"
33
+ >
34
+ <span class="sr-only">Previous</span>
35
+ <ChevronLeftIcon class="icon-md" aria-hidden="true" />
36
+ </a>
37
+ <!-- Current: "z-10 bg-indigo-600 text-white focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600", Default: "text-gray-900 ring-1 ring-inset ring-gray-300 hover:bg-gray-50 focus:outline-offset-0" -->
38
+ <a
39
+ v-for="(page, index) in pages"
40
+ :class="[
41
+ 'relative inline-flex items-center px-4 py-1 ring-1 ring-inset ring-gray-300',
42
+ startPos / pageSize + 1 === page
43
+ ? 'std-blue text-white'
44
+ : 'std-white dark:std-dark',
45
+ ]"
46
+ @click="page !== '...' ? emit('navtopage', page) : null"
47
+ >
48
+ {{ page }}
49
+ </a>
50
+ <a
51
+ class="relative inline-flex items-center rounded-r-md px-2 py-2 ring-1 ring-inset ring-gray-300 std-white dark:std-dark"
52
+ @click="emit('next')"
53
+ >
54
+ <span class="sr-only">Previous</span>
55
+ <ChevronRightIcon class="icon-md" aria-hidden="true" />
56
+ </a>
57
+ </nav>
58
+ </div>
59
+ </nav>
60
+ </template>
61
+
62
+ <script setup>
63
+ import { computed } from "vue";
64
+ import { ChevronLeftIcon, ChevronRightIcon } from "@heroicons/vue/20/solid";
65
+
66
+ const emit = defineEmits(["previous", "next", "navtopage"]);
67
+ const props = defineProps({
68
+ startPos: {
69
+ type: Number,
70
+ required: true,
71
+ },
72
+ pageSize: {
73
+ type: Number,
74
+ default: 10,
75
+ },
76
+ total: {
77
+ type: Number,
78
+ required: true,
79
+ },
80
+ resultsText: {
81
+ type: String,
82
+ default: "results",
83
+ },
84
+ });
85
+
86
+ const pages = computed(() => {
87
+ const pagesCount = (props.total + props.pageSize - 1) / props.pageSize;
88
+ const arr = Array.from({ length: pagesCount }, (_, i) => i + 1);
89
+ const current = props.startPos / props.pageSize + 1;
90
+
91
+ if (arr.length > 5) {
92
+ if (current < 4) return [...arr.slice(0, 4), "...", arr.length];
93
+ else if (current > arr.length - 3) return [1, "...", ...arr.slice(-4)];
94
+ return [
95
+ 1,
96
+ "...",
97
+ ...Array.from({ length: 5 }, (_, i) => current - 2 + i),
98
+ "...",
99
+ arr.length,
100
+ ];
101
+ }
102
+
103
+ return arr;
104
+ });
105
+ </script>
@@ -0,0 +1,24 @@
1
+ <template>
2
+ <Popover class="relative">
3
+ <PopoverButton>
4
+ <slot name="button" />
5
+ </PopoverButton>
6
+ <PopoverPanel
7
+ :class="['absolute z-10', direction === 'right' ? 'left-0' : 'right-0']"
8
+ >
9
+ <slot name="content" />
10
+ </PopoverPanel>
11
+ </Popover>
12
+ </template>
13
+
14
+ <script setup>
15
+ import { Popover, PopoverButton, PopoverPanel } from "@headlessui/vue";
16
+
17
+ // props and emits
18
+ const props = defineProps({
19
+ direction: {
20
+ type: String,
21
+ default: "right",
22
+ },
23
+ });
24
+ </script>
@@ -0,0 +1,130 @@
1
+ <template>
2
+ <Switch
3
+ v-bind="$attrs"
4
+ :class="[
5
+ forceActive || $attrs.modelValue === powerState
6
+ ? 'bg-green-600'
7
+ : 'bg-red-500',
8
+ readonly ? 'cursor-not-allowed' : 'cursor-pointer',
9
+ { 'h-6 w-9': props.size === 'sm' },
10
+ { 'h-8 w-[52px]': props.size === 'md' },
11
+ 'relative inline-flex flex-shrink-0 rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-hidden focus:ring-2 focus:ring-indigo-600 focus:ring-offset-1',
12
+ ]"
13
+ :disabled="props.readonly"
14
+ @update:model-value="emits('toggle')"
15
+ @mouseover="toggleTooltip(true)"
16
+ @mouseout="toggleTooltip(false)"
17
+ >
18
+ <span class="sr-only">Use setting</span>
19
+ <span
20
+ :class="[
21
+ forceActive || $attrs.modelValue === powerState
22
+ ? props.size === 'sm'
23
+ ? 'translate-x-3'
24
+ : 'translate-x-5'
25
+ : 'translate-x-0',
26
+ { 'h-5 w-5': props.size === 'sm' },
27
+ { 'h-7 w-7': props.size === 'md' },
28
+ 'pointer-events-none relative inline-block transform rounded-full bg-gray-100 shadow-sm ring-0 transition duration-200 ease-in-out',
29
+ ]"
30
+ >
31
+ <span
32
+ :class="[
33
+ forceActive || $attrs.modelValue === powerState
34
+ ? 'opacity-0 duration-100 ease-out'
35
+ : 'opacity-100 duration-200 ease-in',
36
+ 'absolute inset-0 flex h-full w-full items-center justify-center transition-opacity',
37
+ ]"
38
+ aria-hidden="true"
39
+ >
40
+ <svg
41
+ v-if="props.power"
42
+ height="20px"
43
+ viewBox="0 0 24 24"
44
+ width="20px"
45
+ fill="#ef4444"
46
+ >
47
+ <path d="M0 0h24v24H0V0z" fill="none" />
48
+ <path
49
+ d="M18 14.49V9c0-1-1.01-2.01-2-2V3h-2v4h-4V3H8v2.48l9.51 9.5.49-.49zm-1.76 1.77L7.2 7.2l-.01.01L3.98 4 2.71 5.25l3.36 3.36C6.04 8.74 6 8.87 6 9v5.48L9.5 18v3h5v-3l.48-.48L19.45 22l1.26-1.28-4.47-4.46z"
50
+ />
51
+ </svg>
52
+ <XMarkIcon
53
+ v-else
54
+ class="icon-md flex-shrink-0 text-red-600"
55
+ aria-hidden="true"
56
+ />
57
+ </span>
58
+ <span
59
+ :class="[
60
+ forceActive || $attrs.modelValue === powerState
61
+ ? 'opacity-100 duration-200 ease-in'
62
+ : 'opacity-0 duration-100 ease-out',
63
+ 'absolute inset-0 flex h-full w-full items-center justify-center transition-opacity',
64
+ ]"
65
+ aria-hidden="true"
66
+ >
67
+ <svg
68
+ v-if="props.power"
69
+ height="20px"
70
+ viewBox="0 0 24 24"
71
+ width="20px"
72
+ fill="#16a34a"
73
+ >
74
+ <path d="M0 0h24v24H0z" fill="none" />
75
+ <path
76
+ d="M16.01 7L16 3h-2v4h-4V3H8v4h-.01C7 6.99 6 7.99 6 8.99v5.49L9.5 18v3h5v-3l3.5-3.51v-5.5c0-1-1-2-1.99-1.99z"
77
+ />
78
+ </svg>
79
+ <CheckIcon
80
+ v-else
81
+ class="icon-md flex-shrink-0 text-green-600"
82
+ aria-hidden="true"
83
+ />
84
+ </span>
85
+ </span>
86
+ <Tooltip :tooltip="tooltip" :showingTooltip="showTooltip" />
87
+ </Switch>
88
+ </template>
89
+
90
+ <script setup>
91
+ import { ref } from "vue";
92
+ import { Switch } from "@headlessui/vue";
93
+ import { XMarkIcon, CheckIcon } from "@heroicons/vue/24/outline";
94
+ import { Tooltip } from "@/components";
95
+
96
+ const props = defineProps({
97
+ power: {
98
+ type: Boolean,
99
+ default: true,
100
+ },
101
+ powerState: {
102
+ type: Boolean || null,
103
+ default: true,
104
+ },
105
+ forceActive: {
106
+ type: Boolean,
107
+ default: false,
108
+ },
109
+ readonly: {
110
+ type: Boolean,
111
+ default: false,
112
+ },
113
+ tooltip: {
114
+ type: String,
115
+ default: "",
116
+ },
117
+ size: {
118
+ type: String,
119
+ default: "md",
120
+ },
121
+ });
122
+ const emits = defineEmits(["toggle"]);
123
+ const showTooltip = ref(false);
124
+
125
+ function toggleTooltip(val) {
126
+ if (props.tooltip) {
127
+ showTooltip.value = val;
128
+ }
129
+ }
130
+ </script>