@xy-planning-network/trees 0.11.1-dev-3 → 0.11.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xy-planning-network/trees",
3
- "version": "0.11.1-dev-3",
3
+ "version": "0.11.2",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "repository": "github:xy-planning-network/trees",
@@ -38,7 +38,7 @@
38
38
  "@tailwindcss/forms": "^0.5.3",
39
39
  "@tailwindcss/typography": "^0.5.7",
40
40
  "@types/node": "^18.15.11",
41
- "@vitejs/plugin-vue": "^5.1.4",
41
+ "@vitejs/plugin-vue": "^5.2.3",
42
42
  "@vue/eslint-config-prettier": "~8.0.0",
43
43
  "@vue/eslint-config-typescript": "~13.0.0",
44
44
  "autoprefixer": "^10.4.14",
@@ -52,8 +52,8 @@
52
52
  "tsc-alias": "^1.8.5",
53
53
  "typescript": "~5.4.5",
54
54
  "unplugin-vue-components": "^0.27.4",
55
- "unplugin-vue-markdown": "^0.25.2",
56
- "vite": "^5.4.10",
55
+ "unplugin-vue-markdown": "^0.26.3",
56
+ "vite": "^6.2.2",
57
57
  "vue-tsc": "^2.1.10"
58
58
  },
59
59
  "dependencies": {
@@ -5,20 +5,23 @@ import {
5
5
  Dialog,
6
6
  DialogOverlay,
7
7
  Menu,
8
+ MenuButton,
9
+ MenuItem,
10
+ MenuItems,
8
11
  TransitionChild,
9
12
  TransitionRoot,
10
13
  } from "@headlessui/vue"
11
14
  import { MenuAlt2Icon, XIcon } from "@heroicons/vue/outline"
12
- import type { NavItem, UserMenuItem } from "@/composables/nav"
15
+ import { CogIcon } from "@heroicons/vue/solid"
16
+ import type { NavItem } from "@/composables/nav"
13
17
  import { ref } from "vue"
14
- import UserMenu from "@/lib-components/layout/UserMenu.vue"
15
18
 
16
19
  const props = withDefaults(
17
20
  defineProps<{
18
21
  activeUrl?: string
19
22
  iconUrl: string
20
23
  navigation: NavItem[]
21
- userNavigation: UserMenuItem[]
24
+ userNavigation: NavItem[]
22
25
  }>(),
23
26
  {
24
27
  activeUrl: "",
@@ -202,7 +205,41 @@ const isActive = (url: string): boolean => {
202
205
  <div class="ml-4 flex items-center lg:ml-6">
203
206
  <!-- Profile dropdown -->
204
207
  <Menu as="div" class="ml-3 relative">
205
- <UserMenu :menu="userNavigation" />
208
+ <div>
209
+ <MenuButton
210
+ class="max-w-xs flex items-center text-sm text-white rounded-full hover:bg-blue-900 hover:text-gray-50 focus:outline-none focus:ring focus:text-white"
211
+ >
212
+ <span class="sr-only">Open user menu</span>
213
+ <CogIcon class="h-8 w-8" fill="currentColor" />
214
+ </MenuButton>
215
+ </div>
216
+ <transition
217
+ enter-active-class="transition ease-out duration-100"
218
+ enter-from-class="transform opacity-0 scale-95"
219
+ enter-to-class="transform opacity-100 scale-100"
220
+ leave-active-class="transition ease-in duration-75"
221
+ leave-from-class="transform opacity-100 scale-100"
222
+ leave-to-class="transform opacity-0 scale-95"
223
+ >
224
+ <MenuItems
225
+ class="origin-top-right absolute right-0 mt-2 w-48 rounded-md shadow-lg py-1 bg-white ring-1 ring-black ring-opacity-5 focus:outline-none"
226
+ >
227
+ <MenuItem
228
+ v-for="item in userNavigation"
229
+ :key="item.name"
230
+ v-slot="{ active }"
231
+ >
232
+ <a
233
+ :href="item.url"
234
+ :class="[
235
+ active ? 'bg-gray-100' : '',
236
+ 'block px-4 py-2 text-sm text-gray-700 font-semibold',
237
+ ]"
238
+ >{{ item.name }}</a
239
+ >
240
+ </MenuItem>
241
+ </MenuItems>
242
+ </transition>
206
243
  </Menu>
207
244
  </div>
208
245
  </div>
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { computed, defineModel } from "vue"
2
+ import { computed } from "vue"
3
3
 
4
4
  const props = withDefaults(
5
5
  defineProps<{
@@ -1,44 +1,7 @@
1
- <script setup lang="ts">
2
- import { computed } from "vue"
3
-
4
- const props = withDefaults(
5
- defineProps<{ size?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" }>(),
6
- { size: "xs" }
7
- )
8
- const maxWidth = computed(() => {
9
- let maxWidth = "max-w-xs"
10
- switch (props.size) {
11
- case "xs":
12
- maxWidth = "max-w-xs"
13
- break
14
- case "sm":
15
- maxWidth = "max-w-sm"
16
- break
17
- case "md":
18
- maxWidth = "max-w-md"
19
- break
20
- case "lg":
21
- maxWidth = "max-w-lg"
22
- break
23
- case "xl":
24
- maxWidth = "max-w-xl"
25
- break
26
- case "2xl":
27
- maxWidth = "max-w-2xl"
28
- break
29
- }
30
-
31
- return maxWidth
32
- })
33
- </script>
34
-
35
1
  <template>
36
2
  <!--styling wrapper - top level element will merge attrs for class overrides -->
37
3
  <div
38
- :class="[
39
- 'w-full bg-white rounded-xy p-2 border border-gray-100 shadow-md',
40
- maxWidth,
41
- ]"
4
+ class="w-full max-w-xs bg-white rounded-xy p-2 border border-gray-100 shadow-md"
42
5
  >
43
6
  <slot></slot>
44
7
  </div>
@@ -1,27 +1,7 @@
1
- import { type Component, type FunctionalComponent, type MaybeRef, type Ref, type RenderFunction } from "vue";
2
- interface UserMenuItemBase {
3
- indicator?: boolean | string | number;
4
- icon: Component | RenderFunction;
5
- name: string;
6
- }
7
- export interface UserMenuItemUrl extends UserMenuItemBase {
8
- action: "url";
9
- url: string;
10
- }
11
- export interface UserMenuItemNav extends UserMenuItemBase {
12
- action: "nav";
13
- navigation: NavItem[];
14
- }
15
- export interface UserMenuItemFlyout<T extends Component> extends UserMenuItemBase {
16
- action: "flyout";
17
- component: T;
18
- props: Record<string, any>;
19
- }
20
- export type UserMenuItem = UserMenuItemUrl | UserMenuItemNav | UserMenuItemFlyout<Component>;
1
+ import { Component, FunctionalComponent, MaybeRef, Ref, RenderFunction } from "vue";
21
2
  export interface NavItem {
22
3
  icon?: Component | RenderFunction;
23
4
  name: string;
24
- description?: string;
25
5
  openInTab?: boolean;
26
6
  url: string;
27
7
  }
@@ -179,4 +159,3 @@ export type URLParams<T> = {
179
159
  * @return Ref<T>
180
160
  */
181
161
  export declare const useUrlSearchParams: <T>(initial: URLParams<T>) => [URLParams<T>] extends [Ref<any, any>] ? import("@vue/shared").IfAny<Ref<any, any> & URLParams<T>, Ref<Ref<any, any> & URLParams<T>, Ref<any, any> & URLParams<T>>, Ref<any, any> & URLParams<T>> : Ref<import("vue").UnwrapRef<URLParams<T>>, URLParams<T> | import("vue").UnwrapRef<URLParams<T>>>;
182
- export {};
@@ -5,7 +5,6 @@ import { default as DateFilter } from "./layout/DateFilter.vue";
5
5
  import { default as DetailList } from "./lists/DetailList.vue";
6
6
  import { default as DownloadCell } from "./lists/DownloadCell.vue";
7
7
  import { default as Flash } from "./overlays/Flash.vue";
8
- import { default as AppIcon } from "./indicators/AppIcon.vue";
9
8
  import { default as InlineAlert } from "./indicators/InlineAlert.vue";
10
9
  import { default as Modal } from "./overlays/Modal.vue";
11
10
  import { default as SidebarLayout } from "./layout/SidebarLayout.vue";
@@ -39,7 +38,7 @@ import { default as RadioCards } from "./forms/RadioCards.vue";
39
38
  import { default as Select } from "./forms/Select.vue";
40
39
  import { default as TextArea } from "./forms/TextArea.vue";
41
40
  import { default as YesOrNoRadio } from "./forms/YesOrNoRadio.vue";
42
- export { ActionsDropdown, Cards, ContentModal, DateFilter, DetailList, DownloadCell, Flash, AppIcon, InlineAlert, Modal, SidebarLayout, Slideover, StackedLayout, Popover, PopoverContent, PopoverPosition, // Type export
41
+ export { ActionsDropdown, Cards, ContentModal, DateFilter, DetailList, DownloadCell, Flash, InlineAlert, Modal, SidebarLayout, Slideover, StackedLayout, Popover, PopoverContent, PopoverPosition, // Type export
43
42
  Paginator, Spinner, DataTable, Steps, DynamicTable, Tabs, Toggle, Tooltip, BaseInput, Checkbox, DateRangePicker, DateTime, InputError, InputHelp, InputLabel, FieldsetLegend, MultiCheckboxes, Radio, RadioCards, Select, TextArea, YesOrNoRadio, XYSpinner, ProgressCircles, ProgressCirclesLabeled, };
44
43
  /**
45
44
  * declare global component types for App.use(Trees)
@@ -52,7 +51,6 @@ export interface TreesComponents {
52
51
  DetailList: typeof DetailList;
53
52
  DownloadCell: typeof DownloadCell;
54
53
  Flash: typeof Flash;
55
- AppIcon: typeof AppIcon;
56
54
  Modal: typeof Modal;
57
55
  SidebarLayout: typeof SidebarLayout;
58
56
  Slideover: typeof Slideover;
@@ -1,9 +1,9 @@
1
- import type { NavItem, UserMenuItem } from "../../composables/nav";
1
+ import type { NavItem } from "../../composables/nav";
2
2
  type __VLS_Props = {
3
3
  activeUrl?: string;
4
4
  iconUrl: string;
5
5
  navigation: NavItem[];
6
- userNavigation: UserMenuItem[];
6
+ userNavigation: NavItem[];
7
7
  };
8
8
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
9
9
  activeUrl: string;
@@ -1,9 +1,4 @@
1
- type __VLS_Props = {
2
- size?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
3
- };
4
- declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
5
- size: "xs" | "sm" | "lg" | "xl" | "md" | "2xl";
6
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
1
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
7
2
  default?(_: {}): any;
8
3
  }>;
9
4
  export default _default;
@@ -1,97 +0,0 @@
1
- <script setup lang="ts">
2
- /**
3
- * IconCircle
4
- * A utility component for wrapping a Heroicon in a circle.
5
- *
6
- * Usage:
7
- * import CircleIcon from "@/components/shared/CircleIcon.vue"
8
- * import { SpeakerphoneIcon } from "@heroicons/vue/outline"
9
- * <template>
10
- * <CircleIcon
11
- * :icon="SpeakerphoneIcon"
12
- * icon-color="text-white"
13
- * bg-color="bg-xy-green"
14
- * />
15
- * </template>
16
- */
17
-
18
- import { computed } from "vue"
19
- import type { Component, FunctionalComponent, RenderFunction } from "vue"
20
-
21
- // TODO: themed icons?
22
-
23
- const props = withDefaults(
24
- defineProps<{
25
- bgColor?: `bg-${string}`
26
- iconColor?: `text-${string}`
27
- icon: FunctionalComponent | Component | RenderFunction
28
- indicator?: string | number | boolean
29
- size?: "xs" | "sm" | "base" | "lg" | "xl"
30
- type?: "circle" | "square" // TODO: squircle?
31
- }>(),
32
- {
33
- bgColor: "bg-transparent",
34
- iconColor: "text-xy-black",
35
- indicator: false,
36
- size: "base",
37
- type: "square",
38
- }
39
- )
40
-
41
- const size = computed(() => {
42
- const sizes = {
43
- xs: { bg: "w-6 h-6", icon: "w-4 h-4" },
44
- sm: { bg: "w-7 h-7", icon: "w-5 h-5" },
45
- base: { bg: "w-10 h-10", icon: "w-6 h-6" },
46
- lg: { bg: "w-12 h-12", icon: "w-6 h-6" },
47
- xl: { bg: "w-14 h-14", icon: "w-6 h-6" },
48
- }
49
-
50
- return sizes[props.size]
51
- })
52
-
53
- const indicatorStr = computed(() => {
54
- if (!props.indicator) {
55
- return ""
56
- }
57
-
58
- return ["string", "number"].includes(typeof props.indicator)
59
- ? props.indicator.toString()
60
- : ""
61
- })
62
- </script>
63
-
64
- <template>
65
- <div
66
- aria-hidden="true"
67
- :class="[
68
- 'aspect-square leading-none relative',
69
- type === 'circle' ? 'rounded-full' : 'rounded-md',
70
- bgColor,
71
- size.bg,
72
- ]"
73
- >
74
- <div class="flex flex-col h-full w-full items-center justify-center">
75
- <div
76
- :class="[size.icon]"
77
- class="flex flex-col items-center justify-center"
78
- >
79
- <component :is="icon" :class="iconColor" />
80
- <div v-if="$slots['default']" class="sr-only">
81
- <slot />
82
- </div>
83
- </div>
84
- </div>
85
-
86
- <!--TODO(spk): position edge cases based on content length-->
87
- <div
88
- v-if="props.indicator"
89
- :class="[
90
- 'absolute top-0 right-0 block bg-xy-green text-xy-black text-xs/3 font-bold translate-x-1/4 -translate-y-1/4',
91
- indicatorStr ? 'p-1 rounded-xy' : 'h-3 w-3 rounded-full',
92
- ]"
93
- >
94
- {{ indicatorStr }}
95
- </div>
96
- </div>
97
- </template>
@@ -1,89 +0,0 @@
1
- <script setup lang="ts">
2
- import { UserMenuItem } from "@/composables/nav"
3
- import AppIcon from "@/lib-components/indicators/AppIcon.vue"
4
- import Popover from "@/lib-components/overlays/Popover/Popover.vue"
5
- import PopoverContent from "@/lib-components/overlays/Popover/PopoverContent.vue"
6
- import TooltipWrapper from "@/lib-components/overlays/TooltipWrapper.vue"
7
- import { computed } from "vue"
8
-
9
- const props = withDefaults(defineProps<{ menu?: UserMenuItem[] }>(), {
10
- menu: () => [],
11
- })
12
-
13
- const items = computed(() => {
14
- return props.menu.map((item) => {
15
- const isPopover = item.action != "url"
16
-
17
- return {
18
- ...item,
19
- isPopover: isPopover,
20
- }
21
- })
22
- })
23
- </script>
24
-
25
- <template>
26
- <!--TODO: focus rings? -->
27
- <div v-if="items.length > 0" class="flex items-center justify-center gap-3.5">
28
- <template v-for="(item, key) in items" :key="key">
29
- <div v-if="item.action === 'url'">
30
- <TooltipWrapper position="bottom-end" :tooltip="item.name">
31
- <a :href="item.url" target="" class="block">
32
- <AppIcon
33
- bg-color="bg-transparent hover:bg-black/20"
34
- icon-color="text-neutral-200"
35
- :icon="item.icon"
36
- :indicator="item.indicator"
37
- size="base"
38
- type="square"
39
- >{{ item.name }}</AppIcon
40
- >
41
- </a>
42
- </TooltipWrapper>
43
- </div>
44
-
45
- <div v-else-if="item.isPopover" class="leading-none">
46
- <Popover position="bottom-end">
47
- <template #button>
48
- <TooltipWrapper position="bottom-end" :tooltip="item.name">
49
- <AppIcon
50
- bg-color="bg-transparent hover:bg-black/20"
51
- icon-color="text-neutral-200"
52
- :icon="item.icon"
53
- :indicator="item.indicator"
54
- size="base"
55
- >{{ item.name }}</AppIcon
56
- >
57
- </TooltipWrapper>
58
- </template>
59
-
60
- <template #default>
61
- <PopoverContent v-if="item.action === 'nav'">
62
- <ul class="flex flex-col text-sm/6">
63
- <li v-for="(nav, navKey) in item.navigation" :key="navKey">
64
- <a
65
- :href="nav.url"
66
- class="block relative rounded-lg p-4 hover:bg-gray-50"
67
- >
68
- <div class="font-semibold text-gray-900">
69
- {{ nav.name }}
70
- </div>
71
- <div v-if="nav.description" class="mt-0.5 text-gray-600">
72
- {{ nav.description }}
73
- </div>
74
- </a>
75
- </li>
76
- </ul>
77
- </PopoverContent>
78
-
79
- <component
80
- :is="item.component"
81
- v-if="item.action === 'flyout'"
82
- v-bind="item.props"
83
- />
84
- </template>
85
- </Popover>
86
- </div>
87
- </template>
88
- </div>
89
- </template>
@@ -1,73 +0,0 @@
1
- <script lang="ts" setup>
2
- import { computed, useTemplateRef } from "vue"
3
- import {
4
- autoPlacement,
5
- autoUpdate,
6
- offset,
7
- shift,
8
- useFloating,
9
- type Placement,
10
- } from "@floating-ui/vue"
11
-
12
- // props
13
- const props = withDefaults(
14
- defineProps<{
15
- as?: string
16
- position?: Placement | "auto"
17
- tooltip: string
18
- }>(),
19
- {
20
- as: "div",
21
- position: "auto",
22
- }
23
- )
24
-
25
- // NOTE(spk): explicitly typing as useTemplateRef is unable to infer the template type.
26
- // https://vuejs.org/guide/typescript/composition-api.html#typing-template-refs
27
- const triggerRef = useTemplateRef<HTMLElement>("trigger")
28
- const wrapperRef = useTemplateRef<HTMLElement>("wrapper")
29
- const middleware = computed(() => {
30
- const middleware = [offset(5), shift()]
31
- if (props.position === "auto") {
32
- middleware.push(autoPlacement())
33
- }
34
-
35
- return middleware
36
- })
37
-
38
- /**
39
- * floating-ui's placement property does not support a direct "auto"
40
- * mode. Passing undefined is expected when auto position is used.
41
- */
42
- const placement = computed(() => {
43
- if (props.position === "auto") {
44
- return undefined
45
- }
46
-
47
- return props.position
48
- })
49
-
50
- const { floatingStyles } = useFloating(triggerRef, wrapperRef, {
51
- middleware: middleware,
52
- placement: placement,
53
- strategy: "fixed",
54
- whileElementsMounted: autoUpdate,
55
- })
56
- </script>
57
-
58
- <template>
59
- <component :is="as" ref="trigger" class="group">
60
- <slot></slot>
61
- <div
62
- ref="wrapper"
63
- class="hidden group-hover:block z-[5]"
64
- :style="floatingStyles"
65
- >
66
- <div
67
- class="max-w-xs bg-xy-black rounded-md px-3 py-1 drop-shadow text-sm text-white leading-snug font-semibold"
68
- >
69
- {{ tooltip }}
70
- </div>
71
- </div>
72
- </component>
73
- </template>
@@ -1,24 +0,0 @@
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
- };
@@ -1,8 +0,0 @@
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;
@@ -1,18 +0,0 @@
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
- };
File without changes