nuance-ui 0.1.23 → 0.1.25

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/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^4.0.0"
6
6
  },
7
- "version": "0.1.23",
7
+ "version": "0.1.25",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -10,11 +10,14 @@ export interface BreadcrumbsItem extends Omit<LinkProps, 'mod'> {
10
10
  slot?: string;
11
11
  }
12
12
  export interface BreadcrumbsProps extends BoxProps {
13
+ /** Manual items array */
13
14
  items?: MaybeRef<BreadcrumbsItem[]>;
14
15
  /** Separator icon between items @default `'gravity-ui:chevron-right'` */
15
16
  separator?: string;
16
17
  /** Controls spacing between separator and breadcrumb @default `'xs'` */
17
18
  spacing?: NuanceSpacing;
19
+ /** Function to determine if an item is active */
20
+ activeItem?: (item: BreadcrumbsItem) => boolean;
18
21
  color?: NuanceColor;
19
22
  size?: TextProps['fz'];
20
23
  }
@@ -11,11 +11,13 @@ const {
11
11
  spacing,
12
12
  separator = "gravity-ui:chevron-right",
13
13
  color = "primary",
14
- size
14
+ size,
15
+ items
15
16
  } = defineProps({
16
17
  items: { type: null, required: false },
17
18
  separator: { type: String, required: false },
18
19
  spacing: { type: [String, Number], required: false },
20
+ activeItem: { type: Function, required: false },
19
21
  color: { type: null, required: false },
20
22
  size: { type: null, required: false },
21
23
  is: { type: null, required: false },
@@ -27,7 +29,7 @@ const style = computed(() => ({
27
29
  </script>
28
30
 
29
31
  <template>
30
- <Box :is :mod :style :class='$style.root' aria-label='breadcrumb'>
32
+ <Box :is :mod :style :class='$style.root' aria-label='breadcrumb'>
31
33
  <template v-for='(item, ix) in unref(items)' :key='ix'>
32
34
  <Text
33
35
  is='li'
@@ -38,8 +40,18 @@ const style = computed(() => ({
38
40
  aria-hidden='true'
39
41
  >
40
42
  <NuxtLink v-slot='{ isActive }' v-bind='pickLinkProps(item).link' custom>
41
- <slot :name='item.slot ?? "item"' :item='item' :ix='ix' :active='isActive'>
42
- <Link v-bind='pickLinkProps(item).link' inherit :class='$style.item' :mod='{ active: isActive }'>
43
+ <slot
44
+ :name='item.slot ?? "item"'
45
+ :item='item'
46
+ :ix='ix'
47
+ :active='activeItem ? activeItem(item) : isActive'
48
+ >
49
+ <Link
50
+ v-bind='pickLinkProps(item).link'
51
+ inherit
52
+ :class='$style.item'
53
+ :mod='{ active: activeItem ? activeItem(item) : isActive }'
54
+ >
43
55
  <Icon v-if='item?.icon' :name='item.icon' :class='$style.icon' />
44
56
  <Text is='span' inherit truncate>
45
57
  {{ item.label }}
@@ -65,8 +77,6 @@ const style = computed(() => ({
65
77
  flex-wrap: wrap;
66
78
  gap: var(--bc-spacing);
67
79
  align-items: center;
68
-
69
- list-style: none;
70
80
  }
71
81
 
72
82
  .breadcrumb {
@@ -82,6 +92,7 @@ const style = computed(() => ({
82
92
  display: flex;
83
93
  gap: .25rem;
84
94
  align-items: center;
95
+ text-transform: capitalize;
85
96
 
86
97
  font-weight: 600;
87
98
 
@@ -10,11 +10,14 @@ export interface BreadcrumbsItem extends Omit<LinkProps, 'mod'> {
10
10
  slot?: string;
11
11
  }
12
12
  export interface BreadcrumbsProps extends BoxProps {
13
+ /** Manual items array */
13
14
  items?: MaybeRef<BreadcrumbsItem[]>;
14
15
  /** Separator icon between items @default `'gravity-ui:chevron-right'` */
15
16
  separator?: string;
16
17
  /** Controls spacing between separator and breadcrumb @default `'xs'` */
17
18
  spacing?: NuanceSpacing;
19
+ /** Function to determine if an item is active */
20
+ activeItem?: (item: BreadcrumbsItem) => boolean;
18
21
  color?: NuanceColor;
19
22
  size?: TextProps['fz'];
20
23
  }
@@ -1,21 +1,21 @@
1
1
  import type { NuxtLinkProps } from '#app';
2
2
  export declare function pickLinkProps<T extends NuxtLinkProps>(props: T): {
3
3
  link: {
4
- prefetch: NonNullable<import("vue").UnwrapRef<T["prefetch"]>> | undefined;
5
- noPrefetch: NonNullable<import("vue").UnwrapRef<T["noPrefetch"]>> | undefined;
6
- to?: import("vue").UnwrapRef<T["to"]> | undefined;
7
- target?: import("vue").UnwrapRef<T["target"]> | undefined;
8
- external?: import("vue").UnwrapRef<T["external"]> | undefined;
9
- rel?: import("vue").UnwrapRef<T["rel"]> | undefined;
10
- noRel?: import("vue").UnwrapRef<T["noRel"]> | undefined;
11
- replace?: import("vue").UnwrapRef<T["replace"]> | undefined;
12
- prefetchOn?: import("vue").UnwrapRef<T["prefetchOn"]> | undefined;
13
- trailingSlash?: import("vue").UnwrapRef<T["trailingSlash"]> | undefined;
14
- activeClass?: import("vue").UnwrapRef<T["activeClass"]> | undefined;
15
- ariaCurrentValue?: import("vue").UnwrapRef<T["ariaCurrentValue"]> | undefined;
16
- exactActiveClass?: import("vue").UnwrapRef<T["exactActiveClass"]> | undefined;
17
- prefetchedClass?: import("vue").UnwrapRef<T["prefetchedClass"]> | undefined;
18
- viewTransition?: import("vue").UnwrapRef<T["viewTransition"]> | undefined;
4
+ prefetch: NonNullable<T["prefetch"]> | undefined;
5
+ noPrefetch: NonNullable<T["noPrefetch"]> | undefined;
6
+ to?: T["to"] | undefined;
7
+ target?: T["target"] | undefined;
8
+ external?: T["external"] | undefined;
9
+ rel?: T["rel"] | undefined;
10
+ noRel?: T["noRel"] | undefined;
11
+ replace?: T["replace"] | undefined;
12
+ prefetchOn?: T["prefetchOn"] | undefined;
13
+ trailingSlash?: T["trailingSlash"] | undefined;
14
+ activeClass?: T["activeClass"] | undefined;
15
+ ariaCurrentValue?: T["ariaCurrentValue"] | undefined;
16
+ exactActiveClass?: T["exactActiveClass"] | undefined;
17
+ prefetchedClass?: T["prefetchedClass"] | undefined;
18
+ viewTransition?: T["viewTransition"] | undefined;
19
19
  };
20
- rest: Omit<T, Extract<"to", keyof T> | Extract<"target", keyof T> | Extract<"external", keyof T> | Extract<"rel", keyof T> | Extract<"noRel", keyof T> | Extract<"prefetch", keyof T> | Extract<"noPrefetch", keyof T> | Extract<"replace", keyof T> | Extract<"prefetchOn", keyof T> | Extract<"trailingSlash", keyof T> | Extract<"activeClass", keyof T> | Extract<"ariaCurrentValue", keyof T> | Extract<"exactActiveClass", keyof T> | Extract<"prefetchedClass", keyof T> | Extract<"viewTransition", keyof T>>;
20
+ rest: Omit<T, "to" | "target" | "external" | "rel" | "noRel" | "prefetch" | "noPrefetch" | "replace" | "prefetchOn" | "trailingSlash" | "activeClass" | "ariaCurrentValue" | "exactActiveClass" | "prefetchedClass" | "viewTransition">;
21
21
  };
@@ -1,4 +1,3 @@
1
- import { reactiveOmit, reactivePick } from "@vueuse/core";
2
1
  const linkProps = [
3
2
  "to",
4
3
  "target",
@@ -17,13 +16,20 @@ const linkProps = [
17
16
  "viewTransition"
18
17
  ];
19
18
  export function pickLinkProps(props) {
20
- const link = reactivePick(props, ...linkProps);
21
- const rest = reactiveOmit(props, ...linkProps);
19
+ const link = {};
20
+ const rest = {};
21
+ for (const key in props) {
22
+ if (linkProps.includes(key)) {
23
+ link[key] = props[key];
24
+ } else {
25
+ rest[key] = props[key];
26
+ }
27
+ }
22
28
  return {
23
29
  link: {
24
30
  ...link,
25
- prefetch: link?.prefetch || void 0,
26
- noPrefetch: link?.noPrefetch || void 0
31
+ prefetch: link?.prefetch ?? void 0,
32
+ noPrefetch: link?.noPrefetch ?? void 0
27
33
  },
28
34
  rest
29
35
  };
@@ -155,8 +155,6 @@ const { handleClick, handleKeyDown } = useTreeItemHandlers(path, isFolder, expan
155
155
 
156
156
  padding-inline-start: .75rem;
157
157
  border-left: 1px solid var(--color-gray-4);
158
-
159
- list-style: none;
160
158
  }
161
159
 
162
160
  .root {
@@ -84,7 +84,5 @@ if (removable) {
84
84
  gap: .25rem;
85
85
 
86
86
  padding-inline-start: 0;
87
-
88
- list-style: none;
89
87
  }
90
88
  </style>
@@ -1,5 +1,5 @@
1
1
  import type { Ref } from 'vue';
2
2
  export declare function useTreeItemHandlers(path: string, isFolder: Ref<boolean>, expanded: Ref<boolean>): {
3
3
  handleClick: (event: MouseEvent) => void;
4
- handleKeyDown: (event: KeyboardEvent) => any;
4
+ handleKeyDown: (event: KeyboardEvent) => void;
5
5
  };
@@ -2,7 +2,7 @@ import { useRovingFocus } from "@nui/components";
2
2
  import { useTreeState } from "./context.js";
3
3
  export function useTreeItemHandlers(path, isFolder, expanded) {
4
4
  const ctx = useTreeState();
5
- const { focus } = useRovingFocus();
5
+ const { focus } = useRovingFocus() ?? {};
6
6
  function handleClick(event) {
7
7
  if (event.shiftKey)
8
8
  ctx.toggle("select", path, "range");
@@ -1 +1 @@
1
- *,:after,:before{box-sizing:border-box}*{margin:0}@media (prefers-reduced-motion:no-preference){html{interpolate-size:allow-keywords}}body{background-color:var(--color-body);color:var(--color-text);font-family:var(--font-family),sans-serif;font-size:var(--font-size-md);line-height:var(--line-height);margin:0;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media screen and (max-device-width:em(500px)){body{-webkit-text-size-adjust:100%}}body:has(dialog[data-modal][open]){overflow:hidden}canvas,img,picture,svg,video{display:block;max-width:100%}button,input,select,textarea{font:inherit}button{border:0}button,select{text-transform:none}h1,h2,h3,h4,h5,h6,p{overflow-wrap:break-word}p{text-wrap:pretty}h1,h2,h3,h4,h5,h6{text-wrap:balance}
1
+ *,:after,:before{box-sizing:border-box}*{margin:0}@media (prefers-reduced-motion:no-preference){html{interpolate-size:allow-keywords}}body{background-color:var(--color-body);color:var(--color-text);font-family:var(--font-family),sans-serif;font-size:var(--font-size-md);line-height:var(--line-height);margin:0;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media screen and (max-device-width:em(500px)){body{-webkit-text-size-adjust:100%}}body:has(dialog[data-modal][open]){overflow:hidden}canvas,img,picture,svg,video{display:block;max-width:100%}button,input,select,textarea{font:inherit}button{border:0}button,select{text-transform:none}h1,h2,h3,h4,h5,h6,p{overflow-wrap:break-word}p{text-wrap:pretty}h1,h2,h3,h4,h5,h6{text-wrap:balance}ol,ul{list-style:none;margin:0;padding:0}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuance-ui",
3
- "version": "0.1.23",
3
+ "version": "0.1.25",
4
4
  "description": "A UI Library for Modern Web Apps, powered by Vue.",
5
5
  "repository": {
6
6
  "type": "git",