@xy-planning-network/trees 0.3.1 → 0.4.0-rc

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 (82) hide show
  1. package/README.md +3 -8
  2. package/config/tailwind.config.js +4 -7
  3. package/config/theme/colors.js +3 -75
  4. package/config/theme/fontFamily.js +1 -1
  5. package/config/theme/index.js +0 -3
  6. package/dist/style.css +1 -0
  7. package/dist/trees.es.js +8399 -0
  8. package/dist/trees.umd.js +10 -0
  9. package/dist/types/api/base.d.ts +12 -0
  10. package/dist/types/entry.d.ts +8 -0
  11. package/dist/types/helpers/Uniques.d.ts +4 -0
  12. package/dist/types/lib-components/forms/BaseInput.vue.d.ts +38 -0
  13. package/dist/types/lib-components/forms/Checkbox.vue.d.ts +22 -0
  14. package/dist/types/lib-components/forms/DateRangePicker.vue.d.ts +45 -0
  15. package/dist/types/lib-components/forms/InputHelp.vue.d.ts +22 -0
  16. package/dist/types/lib-components/forms/InputLabel.vue.d.ts +22 -0
  17. package/dist/types/lib-components/forms/MultiCheckboxes.vue.d.ts +34 -0
  18. package/dist/types/lib-components/forms/Radio.vue.d.ts +44 -0
  19. package/dist/types/lib-components/forms/Select.vue.d.ts +58 -0
  20. package/dist/types/lib-components/forms/TextArea.vue.d.ts +32 -0
  21. package/dist/types/lib-components/forms/Toggle.vue.d.ts +17 -0
  22. package/dist/types/lib-components/forms/YesOrNoRadio.vue.d.ts +33 -0
  23. package/dist/types/lib-components/index.d.ts +28 -0
  24. package/dist/types/lib-components/layout/DateFilter.vue.d.ts +34 -0
  25. package/dist/types/lib-components/layout/SidebarLayout.vue.d.ts +33 -0
  26. package/dist/types/lib-components/layout/StackedLayout.vue.d.ts +40 -0
  27. package/dist/types/lib-components/lists/Cards.vue.d.ts +23 -0
  28. package/dist/types/lib-components/lists/DetailList.vue.d.ts +34 -0
  29. package/dist/types/lib-components/lists/DownloadCell.vue.d.ts +20 -0
  30. package/dist/types/lib-components/lists/StaticTable.vue.d.ts +18 -0
  31. package/dist/types/lib-components/lists/Table.vue.d.ts +29 -0
  32. package/dist/types/lib-components/navigation/ActionsDropdown.vue.d.ts +26 -0
  33. package/dist/types/lib-components/navigation/Paginator.vue.d.ts +27 -0
  34. package/dist/types/lib-components/navigation/Steps.vue.d.ts +53 -0
  35. package/dist/types/lib-components/navigation/Tabs.vue.d.ts +36 -0
  36. package/dist/types/lib-components/overlays/ContentModal.vue.d.ts +24 -0
  37. package/dist/types/lib-components/overlays/Flash.vue.d.ts +6 -0
  38. package/dist/types/lib-components/overlays/Modal.vue.d.ts +51 -0
  39. package/dist/types/lib-components/overlays/Slideover.vue.d.ts +30 -0
  40. package/dist/types/lib-components/overlays/Spinner.vue.d.ts +2 -0
  41. package/dist/types/types/nav.d.ts +7 -0
  42. package/dist/types/types/table.d.ts +32 -0
  43. package/dist/types/types/users.d.ts +9 -0
  44. package/package.json +47 -64
  45. package/src/index.css +24 -36
  46. package/src/lib-components/forms/BaseInput.vue +51 -45
  47. package/src/lib-components/forms/Checkbox.vue +31 -22
  48. package/src/lib-components/forms/DateRangePicker.vue +56 -56
  49. package/src/lib-components/forms/InputHelp.vue +12 -9
  50. package/src/lib-components/forms/InputLabel.vue +12 -9
  51. package/src/lib-components/forms/MultiCheckboxes.vue +48 -44
  52. package/src/lib-components/forms/Radio.vue +34 -24
  53. package/src/lib-components/forms/Select.vue +40 -43
  54. package/src/lib-components/forms/TextArea.vue +23 -17
  55. package/src/lib-components/forms/Toggle.vue +7 -11
  56. package/src/lib-components/forms/YesOrNoRadio.vue +31 -27
  57. package/src/lib-components/layout/DateFilter.vue +31 -30
  58. package/src/lib-components/layout/SidebarLayout.vue +36 -51
  59. package/src/lib-components/layout/StackedLayout.vue +32 -55
  60. package/src/lib-components/lists/Cards.vue +8 -12
  61. package/src/lib-components/lists/DetailList.vue +83 -83
  62. package/src/lib-components/lists/DownloadCell.vue +8 -12
  63. package/src/lib-components/lists/StaticTable.vue +30 -23
  64. package/src/lib-components/lists/Table.vue +146 -122
  65. package/src/lib-components/navigation/ActionsDropdown.vue +39 -43
  66. package/src/lib-components/navigation/Paginator.vue +65 -80
  67. package/src/lib-components/navigation/Steps.vue +38 -27
  68. package/src/lib-components/navigation/Tabs.vue +64 -60
  69. package/src/lib-components/overlays/ContentModal.vue +27 -31
  70. package/src/lib-components/overlays/Flash.vue +85 -70
  71. package/src/lib-components/overlays/Modal.vue +39 -42
  72. package/src/lib-components/overlays/Slideover.vue +30 -34
  73. package/src/lib-components/overlays/Spinner.vue +51 -51
  74. package/src/types/env.d.ts +18 -0
  75. package/src/types/global.d.ts +10 -0
  76. package/config/theme/fontSize.js +0 -16
  77. package/config/theme/fontWeight.js +0 -27
  78. package/config/theme/spacing.js +0 -3
  79. package/dist/trees.esm.js +0 -10993
  80. package/dist/trees.min.js +0 -7
  81. package/dist/trees.ssr.js +0 -11668
  82. package/trees.d.ts +0 -43
@@ -1,3 +1,67 @@
1
+ <script setup lang="ts">
2
+ import { computed } from "vue"
3
+
4
+ const props = withDefaults(
5
+ defineProps<{
6
+ modelValue: string
7
+ pillDesign?: boolean
8
+ tabs: Array<{
9
+ label: string
10
+ value: string
11
+ }>
12
+ }>(),
13
+ {
14
+ pillDesign: false,
15
+ }
16
+ )
17
+
18
+ const emit = defineEmits<{
19
+ (e: "update:modelValue", val: string): void
20
+ }>()
21
+
22
+ const updateModelValue = (modelValue: string): void => {
23
+ emit("update:modelValue", modelValue)
24
+ }
25
+
26
+ const classes = (currentTab: string, pastFirstTab: boolean): string => {
27
+ let c = ""
28
+
29
+ if (props.pillDesign) {
30
+ c =
31
+ "px-12 py-2 font-semibold text-md leading-5 rounded-t-md focus:outline-none "
32
+
33
+ if (props.modelValue === currentTab) {
34
+ c = c + "focus:bg-white text-gray-700 bg-white border-b-2 border-blue-500"
35
+ } else {
36
+ c =
37
+ c +
38
+ "text-gray-700 hover:text-gray-900 focus:text-gray-900 focus:bg-gray-100 border border-gray-200"
39
+ }
40
+
41
+ return c
42
+ }
43
+
44
+ c =
45
+ "px-1 py-4 text-sm font-semibold border-b-2 whitespace-nowrap leading-5 focus:outline-none "
46
+ if (props.modelValue === currentTab) {
47
+ c =
48
+ c +
49
+ "border-blue-500 text-xy-blue focus:text-blue-800 focus:border-blue-700"
50
+ } else {
51
+ c =
52
+ c +
53
+ "border-transparent text-gray-700 hover:text-gray-900 hover:border-gray-300 focus:text-gray-900 focus:border-gray-300"
54
+ }
55
+
56
+ if (pastFirstTab) c = c + " ml-8"
57
+
58
+ return c
59
+ }
60
+
61
+ const notPillDesign = computed((): boolean => {
62
+ return !props.pillDesign
63
+ })
64
+ </script>
1
65
  <template>
2
66
  <div>
3
67
  <div class="sm:hidden" :class="{ 'mb-4': pillDesign }">
@@ -26,63 +90,3 @@
26
90
  </div>
27
91
  </div>
28
92
  </template>
29
-
30
- <script lang="ts">
31
- import { Emit, Options, Prop, Vue } from "vue-property-decorator";
32
-
33
- @Options({ name: "Tabs" })
34
- export default class Tabs extends Vue {
35
- @Prop({ type: String, required: true }) modelValue!: string;
36
- @Prop({ type: Boolean, required: true }) pillDesign?: boolean;
37
- @Prop({ type: Array, required: true }) tabs!: Array<{
38
- label: string;
39
- value: string;
40
- }>;
41
-
42
- @Emit("update:modelValue")
43
- updateModelValue(modelValue: string): string {
44
- return modelValue;
45
- }
46
-
47
- classes(currentTab: string, pastFirstTab: boolean): string {
48
- let c = "";
49
-
50
- if (this.pillDesign) {
51
- c =
52
- "px-12 py-2 font-semibold text-md leading-5 rounded-t-md focus:outline-none ";
53
-
54
- if (this.modelValue === currentTab) {
55
- c =
56
- c +
57
- "focus:bg-white text-gray-700 bg-white border-b-2 border-blue-500";
58
- } else {
59
- c =
60
- c +
61
- "text-gray-700 hover:text-gray-900 focus:text-gray-900 focus:bg-gray-100 border border-gray-200";
62
- }
63
-
64
- return c;
65
- }
66
-
67
- c =
68
- "px-1 py-4 text-sm font-semibold border-b-2 whitespace-nowrap leading-5 focus:outline-none ";
69
- if (this.modelValue === currentTab) {
70
- c =
71
- c +
72
- "border-blue-500 text-xy-blue focus:text-blue-800 focus:border-blue-700";
73
- } else {
74
- c =
75
- c +
76
- "border-transparent text-gray-700 hover:text-gray-900 hover:border-gray-300 focus:text-gray-900 focus:border-gray-300";
77
- }
78
-
79
- if (pastFirstTab) c = c + " ml-8";
80
-
81
- return c;
82
- }
83
-
84
- get notPillDesign(): boolean {
85
- return !this.pillDesign;
86
- }
87
- }
88
- </script>
@@ -1,3 +1,30 @@
1
+ <script setup lang="ts">
2
+ import {
3
+ Dialog,
4
+ DialogOverlay,
5
+ DialogTitle,
6
+ TransitionChild,
7
+ TransitionRoot,
8
+ } from "@headlessui/vue"
9
+
10
+ withDefaults(
11
+ defineProps<{
12
+ modelValue: boolean
13
+ title?: string
14
+ }>(),
15
+ {
16
+ title: "",
17
+ }
18
+ )
19
+
20
+ const emit = defineEmits<{
21
+ (e: "update:modelValue", val: boolean): void
22
+ }>()
23
+
24
+ const updateModelValue = (value: boolean) => {
25
+ emit("update:modelValue", value)
26
+ }
27
+ </script>
1
28
  <template>
2
29
  <TransitionRoot as="template" :show="modelValue">
3
30
  <Dialog
@@ -66,34 +93,3 @@
66
93
  </Dialog>
67
94
  </TransitionRoot>
68
95
  </template>
69
-
70
- <script lang="ts">
71
- import { Emit, Options, Prop, Vue } from "vue-property-decorator";
72
- import {
73
- Dialog,
74
- DialogOverlay,
75
- DialogTitle,
76
- TransitionChild,
77
- TransitionRoot,
78
- } from "@headlessui/vue";
79
-
80
- @Options({
81
- components: {
82
- Dialog,
83
- DialogOverlay,
84
- DialogTitle,
85
- TransitionChild,
86
- TransitionRoot,
87
- },
88
- name: "ContentModal",
89
- })
90
- export default class ContentModal extends Vue {
91
- @Prop({ type: Boolean, required: true }) modelValue!: boolean;
92
- @Prop({ type: String, required: false }) title?: string;
93
-
94
- @Emit("update:modelValue")
95
- updateModelValue(value: boolean): boolean {
96
- return value;
97
- }
98
- }
99
- </script>
@@ -1,3 +1,87 @@
1
+ <script lang="ts">
2
+ export interface Flash {
3
+ type?: string
4
+ message: string
5
+ }
6
+ </script>
7
+ <script setup lang="ts">
8
+ import { onMounted, ref } from "vue"
9
+
10
+ // TODO: spk this might benefit from the composition api to avoid race conditions where a flash is requested before the component is mounted.
11
+
12
+ const flashes = ref<Flash[]>([])
13
+ const flashTypeBorderClass = {
14
+ warning: "border-orange-500",
15
+ error: "border-red-500",
16
+ info: "border-blue-500",
17
+ success: "border-green-500",
18
+ }
19
+
20
+ const getFlashClass = (flash: Flash): string => {
21
+ const availableTypes = Object.keys(flashTypeBorderClass)
22
+ // default the flash type to "info" if no flash type or an unsupported flash.type is found
23
+ const type =
24
+ flash?.type && availableTypes.includes(flash.type)
25
+ ? (flash.type as "warning" | "error" | "info" | "success")
26
+ : "info"
27
+ return flashTypeBorderClass[type]
28
+ }
29
+
30
+ const remove = (flash: Flash): void => {
31
+ let index = 0
32
+ for (const f of flashes.value) {
33
+ if (flash.message === f.message) {
34
+ flashes.value.splice(index, 1)
35
+ return
36
+ }
37
+ index++
38
+ }
39
+ }
40
+ const renderFlash = (flash: Flash): void => {
41
+ flashes.value.push(flash)
42
+ // Super simple flash implementation. This could get "smarter" by adding an
43
+ // id to the flash object, and then searching for the specific flash in the
44
+ // array and splicing, instead of simply doing a pop().
45
+ setTimeout(
46
+ (flashes: Flash[]) => {
47
+ flashes.pop()
48
+ },
49
+ 10000,
50
+ flashes.value
51
+ )
52
+ }
53
+
54
+ const renderGenericError = (email: string): void => {
55
+ renderFlash({
56
+ type: "error",
57
+ message:
58
+ "Whoops! Something went wrong, please reach out to " +
59
+ `<a class="underline text-xy-blue" href="mailto:${email}">${email}</a>` +
60
+ " if the issue persists.",
61
+ })
62
+ }
63
+
64
+ onMounted(() => {
65
+ window.VueBus.on("Flash-show-message", (flash) => {
66
+ renderFlash(flash)
67
+ })
68
+
69
+ window.VueBus.on("Flash-show-generic-error", (email) => {
70
+ renderGenericError(email)
71
+ })
72
+
73
+ if (window.Flashes) {
74
+ for (const flash of window.Flashes) {
75
+ if (typeof flash.type === "undefined") {
76
+ const values: string[] = flash.message.split(": ")
77
+ renderFlash({ type: values[0], message: values[1] })
78
+ return
79
+ }
80
+ renderFlash({ type: flash.type, message: flash.message })
81
+ }
82
+ }
83
+ })
84
+ </script>
1
85
  <template>
2
86
  <div
3
87
  class="fixed inset-0 flex flex-col items-end justify-end px-4 py-6 pointer-events-none sm:p-6 z-40"
@@ -16,7 +100,7 @@
16
100
  v-for="(flash, idx) in flashes"
17
101
  :key="flash.message"
18
102
  class="bg-white shadow-lg rounded-lg pointer-events-auto border-t-4 transform"
19
- :class="[{ 'mt-2': idx > 0 }, flashTypeBorderClass[flash.type]]"
103
+ :class="[{ 'mt-2': idx > 0 }, getFlashClass(flash)]"
20
104
  >
21
105
  <div
22
106
  class="rounded-lg ring-1 ring-black ring-opacity-5 overflow-hidden"
@@ -50,72 +134,3 @@
50
134
  </transition-group>
51
135
  </div>
52
136
  </template>
53
-
54
- <script lang="ts">
55
- import { Options, Vue } from "vue-property-decorator";
56
-
57
- @Options({ name: "Flash" })
58
- export default class Flash extends Vue {
59
- flashes: Array<{ type: string; message: string }> = [];
60
- flashTypeBorderClass = {
61
- warning: "border-orange-500",
62
- error: "border-red-500",
63
- info: "border-blue-500",
64
- success: "border-green-500",
65
- };
66
-
67
- mounted(): void {
68
- window.VueBus.on("Flash-show-message", (flash) => {
69
- this.renderFlash(flash);
70
- });
71
-
72
- window.VueBus.on("Flash-show-generic-error", (email) => {
73
- this.renderGenericError(email);
74
- });
75
-
76
- if (window.Flashes) {
77
- for (const flash of window.Flashes) {
78
- if (typeof flash.type === "undefined") {
79
- const values: string[] = flash.message.split(": ");
80
- this.renderFlash({ type: values[0], message: values[1] });
81
- return;
82
- }
83
- this.renderFlash({ type: flash.type, message: flash.message });
84
- }
85
- }
86
- }
87
-
88
- remove(flash: { type: string; message: string }): void {
89
- let index = 0;
90
- for (const f of this.flashes) {
91
- if (flash.message === f.message) {
92
- this.flashes.splice(index, 1);
93
- return;
94
- }
95
- index++;
96
- }
97
- }
98
- renderFlash(flash: { type: string; message: string }): void {
99
- this.flashes.push(flash);
100
- // Super simple flash implementation. This could get "smarter" by adding an
101
- // id to the flash object, and then searching for the specific flash in the
102
- // array and splicing, instead of simply doing a pop().
103
- setTimeout(
104
- (flashes: Array<{ type: string; message: string }>) => {
105
- flashes.pop();
106
- },
107
- 10000,
108
- this.flashes
109
- );
110
- }
111
- renderGenericError(email: string): void {
112
- this.renderFlash({
113
- type: "error",
114
- message:
115
- "Whoops! Something went wrong, please reach out to " +
116
- `<a class="underline text-xy-blue" href="mailto:${email}">${email}</a>` +
117
- " if the issue persists.",
118
- });
119
- }
120
- }
121
- </script>
@@ -1,3 +1,42 @@
1
+ <script setup lang="ts">
2
+ import {
3
+ Dialog,
4
+ DialogOverlay,
5
+ DialogTitle,
6
+ TransitionChild,
7
+ TransitionRoot,
8
+ } from "@headlessui/vue"
9
+ import { XIcon } from "@heroicons/vue/outline"
10
+
11
+ withDefaults(
12
+ defineProps<{
13
+ destructive?: boolean
14
+ disabled?: boolean
15
+ modelValue: boolean
16
+ submitText?: string
17
+ title?: string
18
+ }>(),
19
+ {
20
+ destructive: false,
21
+ disabled: false,
22
+ submitText: "",
23
+ title: "",
24
+ }
25
+ )
26
+
27
+ const emit = defineEmits<{
28
+ (e: "submit"): void
29
+ (e: "update:modelValue", val: boolean): void
30
+ }>()
31
+
32
+ const submit = () => {
33
+ emit("submit")
34
+ }
35
+
36
+ const updateModelValue = (value: boolean) => {
37
+ emit("update:modelValue", value)
38
+ }
39
+ </script>
1
40
  <template>
2
41
  <TransitionRoot as="template" :show="modelValue">
3
42
  <Dialog
@@ -92,45 +131,3 @@
92
131
  </Dialog>
93
132
  </TransitionRoot>
94
133
  </template>
95
-
96
- <script lang="ts">
97
- import { Emit, Options, Prop, Vue } from "vue-property-decorator";
98
- import {
99
- Dialog,
100
- DialogOverlay,
101
- DialogTitle,
102
- TransitionChild,
103
- TransitionRoot,
104
- } from "@headlessui/vue";
105
- import { ExclamationIcon, XIcon } from "@heroicons/vue/outline";
106
-
107
- @Options({
108
- components: {
109
- Dialog,
110
- DialogOverlay,
111
- DialogTitle,
112
- TransitionChild,
113
- TransitionRoot,
114
- ExclamationIcon,
115
- XIcon,
116
- },
117
- name: "Modal",
118
- })
119
- export default class Modal extends Vue {
120
- @Prop({ type: Boolean, required: false }) destructive?: boolean;
121
- @Prop({ type: Boolean, required: false }) disabled?: boolean;
122
- @Prop({ type: Boolean, required: true }) modelValue!: boolean;
123
- @Prop({ type: String, required: false }) submitText?: string;
124
- @Prop({ type: String, required: false }) title?: string;
125
-
126
- @Emit()
127
- submit(): void {
128
- return;
129
- }
130
-
131
- @Emit("update:modelValue")
132
- updateModelValue(value: boolean): boolean {
133
- return value;
134
- }
135
- }
136
- </script>
@@ -1,3 +1,33 @@
1
+ <script setup lang="ts">
2
+ import {
3
+ Dialog,
4
+ DialogOverlay,
5
+ DialogTitle,
6
+ TransitionChild,
7
+ TransitionRoot,
8
+ } from "@headlessui/vue"
9
+ import { XIcon } from "@heroicons/vue/outline"
10
+ import { ref } from "vue"
11
+
12
+ const props = defineProps<{
13
+ header: string
14
+ description: string
15
+ modelValue: boolean
16
+ }>()
17
+
18
+ const open = ref(props.modelValue)
19
+
20
+ const emit = defineEmits<{
21
+ (e: "close", val: boolean): void
22
+ (e: "update:modelValue", val: boolean): void
23
+ }>()
24
+
25
+ const close = () => {
26
+ open.value = false
27
+ emit("close", open.value)
28
+ emit("update:modelValue", open.value)
29
+ }
30
+ </script>
1
31
  <template>
2
32
  <TransitionRoot as="template" :show="modelValue">
3
33
  <Dialog
@@ -55,37 +85,3 @@
55
85
  </Dialog>
56
86
  </TransitionRoot>
57
87
  </template>
58
-
59
- <script lang="ts">
60
- import { Options, Emit, Prop, Vue } from "vue-property-decorator";
61
- import {
62
- Dialog,
63
- DialogOverlay,
64
- DialogTitle,
65
- TransitionChild,
66
- TransitionRoot,
67
- } from "@headlessui/vue";
68
- import { XIcon } from "@heroicons/vue/outline";
69
-
70
- @Options({
71
- name: "Slideover",
72
- components: {
73
- Dialog,
74
- DialogOverlay,
75
- DialogTitle,
76
- TransitionChild,
77
- TransitionRoot,
78
- XIcon,
79
- },
80
- })
81
- export default class Slideover extends Vue {
82
- @Prop({ type: String, required: true }) header!: string;
83
- @Prop({ type: String, required: true }) description!: string;
84
- @Prop({ type: Boolean, required: true }) modelValue!: boolean;
85
-
86
- @Emit()
87
- close(): void {
88
- return;
89
- }
90
- }
91
- </script>
@@ -1,3 +1,51 @@
1
+ <script setup lang="ts">
2
+ import { onMounted, ref } from "vue"
3
+ // TODO: spk this may benefit from composition api
4
+
5
+ const idx = ref(0)
6
+ const loading = ref(false)
7
+ const maxIdx = ref(0)
8
+ const messages = ref<string[]>([])
9
+ const msg = ref("")
10
+ const showMsg = ref(false)
11
+
12
+ const fadeIn = (): void => {
13
+ idx.value++
14
+ if (idx.value > maxIdx.value) {
15
+ idx.value = 0
16
+ }
17
+ if (messages.value) {
18
+ msg.value = messages.value[idx.value]
19
+ }
20
+ showMsg.value = true
21
+ }
22
+
23
+ const fadeOut = (): void => {
24
+ window.setTimeout(() => {
25
+ showMsg.value = false
26
+ }, 2500)
27
+ }
28
+
29
+ onMounted(() => {
30
+ window.VueBus.on("Spinner-show", (spinMessages) => {
31
+ if (spinMessages) {
32
+ messages.value = spinMessages
33
+ maxIdx.value = spinMessages.length - 1
34
+ msg.value = messages.value[idx.value]
35
+ showMsg.value = true
36
+ }
37
+ loading.value = true
38
+ })
39
+
40
+ window.VueBus.on("Spinner-hide", () => {
41
+ idx.value = 0
42
+ maxIdx.value = 0
43
+ messages.value = []
44
+ msg.value = ""
45
+ loading.value = false
46
+ })
47
+ })
48
+ </script>
1
49
  <template>
2
50
  <div
3
51
  class="fixed top-0 left-0 flex items-center justify-center w-full h-full cursor-not-allowed z-50 bg-gray-50 bg-opacity-50"
@@ -91,59 +139,11 @@
91
139
  @after-enter="fadeOut"
92
140
  @after-leave="fadeIn"
93
141
  >
94
- <div class="transition-opacity" v-show="showMsg">{{ msg }}</div>
142
+ <div class="text-center transition-opacity" v-show="showMsg">
143
+ {{ msg }}
144
+ </div>
95
145
  </transition>
96
146
  </div>
97
147
  </div>
98
148
  </div>
99
149
  </template>
100
-
101
- <script lang="ts">
102
- import { Options, Vue } from "vue-property-decorator";
103
-
104
- @Options({ name: "Spinner" })
105
- export default class Spinner extends Vue {
106
- idx = 0;
107
- loading = false;
108
- maxIdx = 0;
109
- messages = [];
110
- msg = "";
111
- showMsg = false;
112
-
113
- mounted() {
114
- window.VueBus.on("Spinner-show", (messages) => {
115
- if (messages) {
116
- this.messages = messages;
117
- this.maxIdx = this.messages.length - 1;
118
- this.msg = this.messages[this.idx];
119
- this.showMsg = true;
120
- }
121
- this.loading = true;
122
- });
123
-
124
- window.VueBus.on("Spinner-hide", () => {
125
- this.idx = 0;
126
- this.maxIdx = 0;
127
- this.messages = [];
128
- this.msg = "";
129
- this.loading = false;
130
- });
131
- }
132
-
133
- fadeIn(): void {
134
- this.idx++;
135
- if (this.idx > this.maxIdx) {
136
- this.idx = 0;
137
- }
138
- if (this.messages) {
139
- this.msg = this.messages[this.idx];
140
- }
141
- this.showMsg = true;
142
- }
143
- fadeOut(): void {
144
- window.setTimeout(() => {
145
- this.showMsg = false;
146
- }, 2500);
147
- }
148
- }
149
- </script>
@@ -0,0 +1,18 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ declare module "*.vue" {
4
+ import { DefineComponent } from "vue"
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
6
+ const component: DefineComponent<{}, {}, any>
7
+ export default component
8
+ }
9
+
10
+ // import.meta.env type support
11
+ // https://vitejs.dev/guide/env-and-mode.html
12
+ interface ImportMetaEnv {
13
+ readonly VITE_APP_BASE_API_URL: string
14
+ }
15
+
16
+ interface ImportMeta {
17
+ readonly env: ImportMetaEnv
18
+ }
@@ -0,0 +1,10 @@
1
+ import { Emitter } from "mitt"
2
+
3
+ export {}
4
+
5
+ declare global {
6
+ interface Window {
7
+ Flashes: Array<{ type?: string; message: string }>
8
+ VueBus: Emitter
9
+ }
10
+ }
@@ -1,16 +0,0 @@
1
- module.exports = {
2
- xxs: ["0.625rem", "1.4"],
3
- xs: ["0.75rem", "1.333333"],
4
- sm: ["0.875rem", "1.28571429"],
5
- base: ["1rem", "1.5"],
6
- lg: ["1.125rem", "1.55555556"],
7
- xl: ["1.25rem", "1.4"],
8
- "2xl": ["1.5rem", "1.33333333"],
9
- "3xl": ["1.875rem", "1.2"],
10
- "4xl": ["2.25rem", "1.11111111"],
11
- "5xl": ["3rem", "1"],
12
- "6xl": ["3.75rem", "1"],
13
- "7xl": ["4.5rem", "1"],
14
- "8xl": ["6rem", "1"],
15
- "9xl": ["8rem", "1"],
16
- };
@@ -1,27 +0,0 @@
1
- // NOTE: medium and extrabold are here for back compatibility
2
- let mediumWarn = false;
3
- let extraBoldWarn = false;
4
-
5
- module.exports = {
6
- normal: 400,
7
- get medium() {
8
- if (!mediumWarn) {
9
- mediumWarn = true;
10
- console.log(
11
- "warn - `font-medium` does not exist in the design library. The font weight will resolve to `600`. Please replace instances of `font-medium` with `font-semibold`."
12
- );
13
- }
14
- return 600;
15
- },
16
- semibold: 600,
17
- bold: 700,
18
- get extrabold() {
19
- if (!extraBoldWarn) {
20
- extraBoldWarn = true;
21
- console.log(
22
- "warn - `font-extrabold` does not exist in the design library. The font weight will resolve to `700`. Please replace instances of `font-extrabold` with `font-bold`."
23
- );
24
- }
25
- return 700;
26
- },
27
- };