@xy-planning-network/trees 0.9.2-rc1 → 0.9.2-rc3

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.
@@ -1,4 +1,4 @@
1
- import { Component, FunctionalComponent, MaybeRef, RenderFunction } from "vue";
1
+ import { Component, FunctionalComponent, MaybeRef, Ref, RenderFunction } from "vue";
2
2
  export interface Item {
3
3
  icon?: Component | RenderFunction;
4
4
  name: string;
@@ -33,34 +33,52 @@ export interface UseTabHistoryOpts {
33
33
  */
34
34
  paramName?: string;
35
35
  }
36
+ /**
37
+ * UseTabHistory is a convenience composable for adding history
38
+ * support to tab based navigation.
39
+ */
40
+ export interface UseTabHistory {
41
+ /**
42
+ * activeTab is a ref of currently visible tab.
43
+ * The value typically should be one of tabs[number].value.
44
+ */
45
+ activeTab: Ref<string>;
46
+ /**
47
+ * isActiveTab is a helper method for determining if a string value
48
+ * is the currently active tab. This is useful in templates where
49
+ * content is conditionally displayed based on the activeTab.
50
+ *
51
+ * @param tab string typically should be one of tabs[number].value.
52
+ * @return boolean
53
+ */
54
+ isActiveTab: (tab: string) => boolean;
55
+ /**
56
+ * tabs is the Ref of initialized tabs.
57
+ */
58
+ tabs: Ref<{
59
+ label: string;
60
+ value: string;
61
+ }[]>;
62
+ }
36
63
  /**
37
64
  * useTabHistory
38
65
  *
39
66
  * Example Usage:
40
67
  *
41
- * const {activeTab, tabs} = useTabHistory([{label: "Tab One", value: "tab-1"}, {label: "Tab Two", value: "tab-2"}]})
68
+ * const {activeTab, isActiveTab, tabs} = useTabHistory([{label: "Tab One", value: "tab-1"}, {label: "Tab Two", value: "tab-2"}]})
42
69
  *
43
70
  * <Tabs v-model="activeTab" :tabs="tabs" />
44
71
  *
45
- * <div v-if="activeTab === 'tab-1'">Tab 1 Content</div>
46
- * <div v-if="activeTab === 'tab-2'">Tab 2 Content</div>
72
+ * <div v-if="isActiveTab('tab-1')">Tab 1 Content</div>
73
+ * <div v-if="isActiveTab('tab-2')">Tab 2 Content</div>
47
74
  *
48
75
  * @param opts UseTabHistoryOpts
49
- * @return {activeTab: Ref<string>, tabs: Ref<{labe: string, value: string}[]>}
76
+ * @return UseTabHistory
50
77
  */
51
78
  export declare const useTabHistory: (initialTabs: MaybeRef<{
52
79
  label: string;
53
80
  value: string;
54
- }[]>, opts?: UseTabHistoryOpts) => {
55
- activeTab: import("vue").Ref<string>;
56
- tabs: import("vue").Ref<{
57
- label: string;
58
- value: string;
59
- }[] | {
60
- label: string;
61
- value: string;
62
- }[]>;
63
- };
81
+ }[]>, opts?: UseTabHistoryOpts) => UseTabHistory;
64
82
  /**
65
83
  * URLParamValue is the set of value types that are
66
84
  * currently spec'd to be parsed into a query string.
@@ -110,6 +128,7 @@ export type URLParams<T> = {
110
128
  * interface SearchParams {
111
129
  * q: string
112
130
  * isActive: boolean
131
+ * attributes: string[]
113
132
  * }
114
133
  *
115
134
  * // NOTE: initial params values should come from the
@@ -123,17 +142,20 @@ export type URLParams<T> = {
123
142
  *
124
143
  * <BaseInput v-model="searchParams.q" label="Search" type="search" />
125
144
  * <Checkbox v-model="searchParams.isActive" label="Is Active" />
145
+ * <MultiCheckboxes v-model="searchParams.attributes" label="Attributes" :options="attrOpts" />
126
146
  *
127
- * When q = "jimothy bobbitz" and isActive = false
128
- * /path?q=jimothy+bobbitz
147
+ * When initialized as {q: "", isActive: false, attributes: []}
148
+ * the query string is not immediately updated. Updates
149
+ * begin once the Ref is mutated.
150
+ * /path
129
151
  *
130
- * When q = "jimothy bobbitz" and isActive = true
131
- * /path?q=jimothy+bobbitz&isActive=true
152
+ * When mutated to {q: "jimothy bobbitz", isActive: true, attributes: ['att-1', 'att-3']}
153
+ * /path?q=jimothy+bobbitz&isActive=true&attributes=att-1&attributes=att-3
132
154
  *
133
- * * When q = "" and isActive = false
134
- * /path
155
+ * When mutated later back to {q: "", isActive: false, attributes: []}
156
+ * /path?q=&isActive=false
135
157
  *
136
158
  * @param initial any Record<string, URLParamValue> like interface
137
159
  * @return Ref<T>
138
160
  */
139
- export declare const useUrlSearchParams: <T>(initial: URLParams<T>) => import("vue").Ref<import("vue").UnwrapRef<URLParams<T>>>;
161
+ export declare const useUrlSearchParams: <T>(initial: URLParams<T>) => Ref<import("vue").UnwrapRef<URLParams<T>>>;