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

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.
@@ -136,4 +154,4 @@ export type URLParams<T> = {
136
154
  * @param initial any Record<string, URLParamValue> like interface
137
155
  * @return Ref<T>
138
156
  */
139
- export declare const useUrlSearchParams: <T>(initial: URLParams<T>) => import("vue").Ref<import("vue").UnwrapRef<URLParams<T>>>;
157
+ export declare const useUrlSearchParams: <T>(initial: URLParams<T>) => Ref<import("vue").UnwrapRef<URLParams<T>>>;