@xy-planning-network/trees 0.3.4 → 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 (73) hide show
  1. package/dist/style.css +1 -0
  2. package/dist/trees.es.js +8399 -0
  3. package/dist/trees.umd.js +10 -0
  4. package/dist/types/api/base.d.ts +12 -0
  5. package/dist/types/entry.d.ts +8 -0
  6. package/dist/types/helpers/Uniques.d.ts +4 -0
  7. package/dist/types/lib-components/forms/BaseInput.vue.d.ts +38 -0
  8. package/dist/types/lib-components/forms/Checkbox.vue.d.ts +22 -0
  9. package/dist/types/lib-components/forms/DateRangePicker.vue.d.ts +45 -0
  10. package/dist/types/lib-components/forms/InputHelp.vue.d.ts +22 -0
  11. package/dist/types/lib-components/forms/InputLabel.vue.d.ts +22 -0
  12. package/dist/types/lib-components/forms/MultiCheckboxes.vue.d.ts +34 -0
  13. package/dist/types/lib-components/forms/Radio.vue.d.ts +44 -0
  14. package/dist/types/lib-components/forms/Select.vue.d.ts +58 -0
  15. package/dist/types/lib-components/forms/TextArea.vue.d.ts +32 -0
  16. package/dist/types/lib-components/forms/Toggle.vue.d.ts +17 -0
  17. package/dist/types/lib-components/forms/YesOrNoRadio.vue.d.ts +33 -0
  18. package/dist/types/lib-components/index.d.ts +28 -0
  19. package/dist/types/lib-components/layout/DateFilter.vue.d.ts +34 -0
  20. package/dist/types/lib-components/layout/SidebarLayout.vue.d.ts +33 -0
  21. package/dist/types/lib-components/layout/StackedLayout.vue.d.ts +40 -0
  22. package/dist/types/lib-components/lists/Cards.vue.d.ts +23 -0
  23. package/dist/types/lib-components/lists/DetailList.vue.d.ts +34 -0
  24. package/dist/types/lib-components/lists/DownloadCell.vue.d.ts +20 -0
  25. package/dist/types/lib-components/lists/StaticTable.vue.d.ts +18 -0
  26. package/dist/types/lib-components/lists/Table.vue.d.ts +29 -0
  27. package/dist/types/lib-components/navigation/ActionsDropdown.vue.d.ts +26 -0
  28. package/dist/types/lib-components/navigation/Paginator.vue.d.ts +27 -0
  29. package/dist/types/lib-components/navigation/Steps.vue.d.ts +53 -0
  30. package/dist/types/lib-components/navigation/Tabs.vue.d.ts +36 -0
  31. package/dist/types/lib-components/overlays/ContentModal.vue.d.ts +24 -0
  32. package/dist/types/lib-components/overlays/Flash.vue.d.ts +6 -0
  33. package/dist/types/lib-components/overlays/Modal.vue.d.ts +51 -0
  34. package/dist/types/lib-components/overlays/Slideover.vue.d.ts +30 -0
  35. package/dist/types/lib-components/overlays/Spinner.vue.d.ts +2 -0
  36. package/dist/types/types/nav.d.ts +7 -0
  37. package/dist/types/types/table.d.ts +32 -0
  38. package/dist/types/types/users.d.ts +9 -0
  39. package/package.json +47 -66
  40. package/src/lib-components/forms/BaseInput.vue +51 -45
  41. package/src/lib-components/forms/Checkbox.vue +31 -22
  42. package/src/lib-components/forms/DateRangePicker.vue +56 -56
  43. package/src/lib-components/forms/InputHelp.vue +12 -9
  44. package/src/lib-components/forms/InputLabel.vue +12 -9
  45. package/src/lib-components/forms/MultiCheckboxes.vue +48 -44
  46. package/src/lib-components/forms/Radio.vue +34 -24
  47. package/src/lib-components/forms/Select.vue +40 -46
  48. package/src/lib-components/forms/TextArea.vue +23 -17
  49. package/src/lib-components/forms/Toggle.vue +7 -11
  50. package/src/lib-components/forms/YesOrNoRadio.vue +31 -27
  51. package/src/lib-components/layout/DateFilter.vue +31 -30
  52. package/src/lib-components/layout/SidebarLayout.vue +36 -51
  53. package/src/lib-components/layout/StackedLayout.vue +32 -55
  54. package/src/lib-components/lists/Cards.vue +8 -12
  55. package/src/lib-components/lists/DetailList.vue +83 -83
  56. package/src/lib-components/lists/DownloadCell.vue +8 -12
  57. package/src/lib-components/lists/StaticTable.vue +30 -23
  58. package/src/lib-components/lists/Table.vue +146 -122
  59. package/src/lib-components/navigation/ActionsDropdown.vue +39 -43
  60. package/src/lib-components/navigation/Paginator.vue +65 -80
  61. package/src/lib-components/navigation/Steps.vue +38 -27
  62. package/src/lib-components/navigation/Tabs.vue +64 -60
  63. package/src/lib-components/overlays/ContentModal.vue +27 -31
  64. package/src/lib-components/overlays/Flash.vue +85 -70
  65. package/src/lib-components/overlays/Modal.vue +39 -42
  66. package/src/lib-components/overlays/Slideover.vue +30 -35
  67. package/src/lib-components/overlays/Spinner.vue +51 -51
  68. package/src/types/env.d.ts +18 -0
  69. package/src/types/global.d.ts +10 -0
  70. package/dist/trees.esm.js +0 -10994
  71. package/dist/trees.min.js +0 -7
  72. package/dist/trees.ssr.js +0 -11669
  73. package/trees.d.ts +0 -43
@@ -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,38 +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("close")
87
- @Emit("update:modelValue")
88
- close(): boolean {
89
- return false;
90
- }
91
- }
92
- </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
+ }