@xy-planning-network/trees 0.13.3 → 0.13.4-dev-2

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 (70) hide show
  1. package/dist/trees.es.js +306 -293
  2. package/dist/trees.umd.js +10 -10
  3. package/package.json +1 -1
  4. package/src/lib-components/forms/DateRangePicker.vue +38 -8
  5. package/types/api/base.d.ts +0 -0
  6. package/types/api/client.d.ts +0 -0
  7. package/types/composables/date.d.ts +0 -0
  8. package/types/composables/forms.d.ts +0 -0
  9. package/types/composables/index.d.ts +0 -0
  10. package/types/composables/list.d.ts +0 -0
  11. package/types/composables/nav.d.ts +0 -0
  12. package/types/composables/overlay.d.ts +0 -0
  13. package/types/composables/table.d.ts +0 -0
  14. package/types/composables/useActionItems.d.ts +0 -0
  15. package/types/composables/useBaseAPI.d.ts +0 -0
  16. package/types/composables/useBulkTable.d.ts +0 -0
  17. package/types/composables/useFlashes.d.ts +0 -0
  18. package/types/composables/useSpinner.d.ts +0 -0
  19. package/types/composables/useTable.d.ts +0 -0
  20. package/types/composables/user.d.ts +0 -0
  21. package/types/entry.d.ts +0 -0
  22. package/types/helpers/Debounce.d.ts +0 -0
  23. package/types/helpers/Throttle.d.ts +0 -0
  24. package/types/helpers/Uniques.d.ts +0 -0
  25. package/types/lib-components/forms/BaseInput.vue.d.ts +0 -0
  26. package/types/lib-components/forms/Checkbox.vue.d.ts +0 -0
  27. package/types/lib-components/forms/DateRangePicker.vue.d.ts +0 -0
  28. package/types/lib-components/forms/DateTimeInput.vue.d.ts +0 -0
  29. package/types/lib-components/forms/FieldsetLegend.vue.d.ts +0 -0
  30. package/types/lib-components/forms/InputError.vue.d.ts +0 -0
  31. package/types/lib-components/forms/InputHelp.vue.d.ts +0 -0
  32. package/types/lib-components/forms/InputLabel.vue.d.ts +0 -0
  33. package/types/lib-components/forms/MultiCheckboxes.vue.d.ts +0 -0
  34. package/types/lib-components/forms/NumberInput.vue.d.ts +0 -0
  35. package/types/lib-components/forms/Radio.vue.d.ts +0 -0
  36. package/types/lib-components/forms/RadioCards.vue.d.ts +0 -0
  37. package/types/lib-components/forms/Select.vue.d.ts +0 -0
  38. package/types/lib-components/forms/TextArea.vue.d.ts +0 -0
  39. package/types/lib-components/forms/Toggle.vue.d.ts +0 -0
  40. package/types/lib-components/forms/YesOrNoRadio.vue.d.ts +0 -0
  41. package/types/lib-components/index.d.ts +0 -0
  42. package/types/lib-components/indicators/AppIcon.vue.d.ts +24 -0
  43. package/types/lib-components/indicators/InlineAlert.vue.d.ts +0 -0
  44. package/types/lib-components/indicators/ProgressCircles.vue.d.ts +0 -0
  45. package/types/lib-components/indicators/ProgressCirclesLabeled.vue.d.ts +0 -0
  46. package/types/lib-components/indicators/XYSpinner.vue.d.ts +0 -0
  47. package/types/lib-components/layout/DateFilter.vue.d.ts +0 -0
  48. package/types/lib-components/layout/SidebarLayout.vue.d.ts +0 -0
  49. package/types/lib-components/layout/StackedLayout.vue.d.ts +0 -0
  50. package/types/lib-components/layout/UserMenu.vue.d.ts +8 -0
  51. package/types/lib-components/lists/Cards.vue.d.ts +0 -0
  52. package/types/lib-components/lists/DataTable.vue.d.ts +0 -0
  53. package/types/lib-components/lists/DetailList.vue.d.ts +0 -0
  54. package/types/lib-components/lists/DownloadCell.vue.d.ts +0 -0
  55. package/types/lib-components/lists/DynamicTable.vue.d.ts +0 -0
  56. package/types/lib-components/lists/TableActionButtons.vue.d.ts +0 -0
  57. package/types/lib-components/navigation/ActionsDropdown.vue.d.ts +0 -0
  58. package/types/lib-components/navigation/Paginator.vue.d.ts +0 -0
  59. package/types/lib-components/navigation/Steps.vue.d.ts +0 -0
  60. package/types/lib-components/navigation/TablePaginator.vue.d.ts +0 -0
  61. package/types/lib-components/navigation/Tabs.vue.d.ts +0 -0
  62. package/types/lib-components/overlays/ContentModal.vue.d.ts +0 -0
  63. package/types/lib-components/overlays/Flash.vue.d.ts +0 -0
  64. package/types/lib-components/overlays/Modal.vue.d.ts +0 -0
  65. package/types/lib-components/overlays/Popover/Popover.vue.d.ts +0 -0
  66. package/types/lib-components/overlays/Popover/PopoverContent.vue.d.ts +0 -0
  67. package/types/lib-components/overlays/Slideover.vue.d.ts +0 -0
  68. package/types/lib-components/overlays/Spinner.vue.d.ts +0 -0
  69. package/types/lib-components/overlays/Tooltip.vue.d.ts +0 -0
  70. package/types/lib-components/overlays/TooltipWrapper.vue.d.ts +18 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xy-planning-network/trees",
3
- "version": "0.13.3",
3
+ "version": "0.13.4-dev-2",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "repository": "github:xy-planning-network/trees",
@@ -4,13 +4,15 @@ import InputHelp from "./InputHelp.vue"
4
4
  import InputError from "./InputError.vue"
5
5
  import flatpickr from "flatpickr"
6
6
  import "flatpickr/dist/flatpickr.min.css"
7
- import { onMounted, useTemplateRef } from "vue"
7
+ import { onMounted, useTemplateRef, watch } from "vue"
8
8
  import {
9
9
  defaultInputProps,
10
10
  defaultModelOpts,
11
11
  useInputField,
12
12
  } from "@/composables/forms"
13
13
  import type { DateRangeInput } from "@/composables/forms"
14
+ import { Instance } from "flatpickr/dist/types/instance"
15
+ import { DateRange } from "@/composables/date"
14
16
 
15
17
  defineOptions({
16
18
  inheritAttrs: false,
@@ -26,23 +28,55 @@ const props = withDefaults(defineProps<DateRangeInput>(), {
26
28
  placeholder: "mm-dd-yyyy range",
27
29
  startDate: 0,
28
30
  })
31
+
29
32
  const modelState = defineModel<DateRangeInput["modelValue"]>({
30
33
  ...defaultModelOpts,
31
34
  default: { maxDate: 0, minDate: 0 },
32
35
  })
33
36
 
37
+ function isValidPickerRange(val: any): val is DateRange {
38
+ return (
39
+ val?.maxDate !== undefined &&
40
+ val?.minDate !== undefined &&
41
+ val?.minDate != 0 &&
42
+ val?.maxDate != 0
43
+ )
44
+ }
45
+
46
+ // NOTE(spk): use watcher.stop() and watcher.resume() when mutating
47
+ // state inside this component to avoid setting the picker value
48
+ // after the state was mutated by the picker itself
49
+ //
50
+ // This keeps the change handling scoped to a change triggered by
51
+ // the parent component on v-model.
52
+ const watcher = watch(modelState, () => {
53
+ if (isValidPickerRange(modelState.value)) {
54
+ picker?.setDate(
55
+ [modelState.value.minDate * 1000, modelState.value.maxDate * 1000],
56
+ false
57
+ )
58
+ return
59
+ }
60
+
61
+ picker?.clear()
62
+ })
63
+
34
64
  const { aria, errorState, inputID, isRequired, onInvalid, validate } =
35
65
  useInputField(props)
36
66
 
37
67
  const updateModelState = (value: { minDate: number; maxDate: number }) => {
68
+ watcher.stop()
38
69
  modelState.value = value
70
+ watcher.resume()
39
71
  }
40
72
 
41
73
  const wrapperRef = useTemplateRef("wrapper")
42
74
 
75
+ let picker: Instance | null = null
76
+
43
77
  onMounted(() => {
44
78
  const opts: flatpickr.Options.Options = {
45
- allowInput: true,
79
+ allowInput: !props.maxRange,
46
80
  appendTo: wrapperRef.value || undefined,
47
81
  dateFormat: "m-d-Y",
48
82
  mode: "range",
@@ -67,11 +101,7 @@ onMounted(() => {
67
101
  }
68
102
 
69
103
  // Handle initial values if set
70
- if (
71
- modelState.value && // NOTE(spk): even with a "default" value this may be a literal null
72
- modelState.value.minDate != 0 &&
73
- modelState.value.maxDate != 0
74
- ) {
104
+ if (isValidPickerRange(modelState.value)) {
75
105
  opts.defaultDate = [
76
106
  modelState.value.minDate * 1000,
77
107
  modelState.value.maxDate * 1000,
@@ -99,7 +129,7 @@ onMounted(() => {
99
129
  }
100
130
  }
101
131
 
102
- flatpickr(`#${inputID.value}`, opts)
132
+ picker = flatpickr(`#${inputID.value}`, opts) as Instance
103
133
  })
104
134
  </script>
105
135
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/types/entry.d.ts CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,24 @@
1
+ import type { Component, FunctionalComponent, RenderFunction } from "vue";
2
+ type __VLS_Props = {
3
+ bgColor?: `bg-${string}`;
4
+ iconColor?: `text-${string}`;
5
+ icon: FunctionalComponent | Component | RenderFunction;
6
+ indicator?: string | number | boolean;
7
+ size?: "xs" | "sm" | "base" | "lg" | "xl";
8
+ type?: "circle" | "square";
9
+ };
10
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
11
+ type: "circle" | "square";
12
+ size: "base" | "xs" | "sm" | "lg" | "xl";
13
+ bgColor: `bg-${string}`;
14
+ iconColor: `text-${string}`;
15
+ indicator: string | number | boolean;
16
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLDivElement>, {
17
+ default?(_: {}): any;
18
+ }>;
19
+ export default _default;
20
+ type __VLS_WithTemplateSlots<T, S> = T & {
21
+ new (): {
22
+ $slots: S;
23
+ };
24
+ };
File without changes
@@ -0,0 +1,8 @@
1
+ import { UserMenuItem } from "../../composables/nav";
2
+ type __VLS_Props = {
3
+ menu?: UserMenuItem[];
4
+ };
5
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
6
+ menu: UserMenuItem[];
7
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
+ export default _default;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,18 @@
1
+ import { type Placement } from "@floating-ui/vue";
2
+ type __VLS_Props = {
3
+ as?: string;
4
+ position?: Placement | "auto";
5
+ tooltip: string;
6
+ };
7
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
8
+ as: string;
9
+ position: Placement | "auto";
10
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
11
+ default?(_: {}): any;
12
+ }>;
13
+ export default _default;
14
+ type __VLS_WithTemplateSlots<T, S> = T & {
15
+ new (): {
16
+ $slots: S;
17
+ };
18
+ };