nuance-ui 0.3.0 → 0.3.1

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 (46) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/accordion/accordion-header.d.vue.ts +28 -0
  3. package/dist/runtime/components/accordion/accordion-header.vue +79 -0
  4. package/dist/runtime/components/accordion/accordion-header.vue.d.ts +28 -0
  5. package/dist/runtime/components/accordion/accordion-item.d.vue.ts +18 -0
  6. package/dist/runtime/components/accordion/accordion-item.vue +44 -0
  7. package/dist/runtime/components/accordion/accordion-item.vue.d.ts +18 -0
  8. package/dist/runtime/components/accordion/accordion-panel.d.vue.ts +18 -0
  9. package/dist/runtime/components/accordion/accordion-panel.vue +40 -0
  10. package/dist/runtime/components/accordion/accordion-panel.vue.d.ts +18 -0
  11. package/dist/runtime/components/accordion/accordion.d.vue.ts +61 -0
  12. package/dist/runtime/components/accordion/accordion.module.css +1 -0
  13. package/dist/runtime/components/accordion/accordion.vue +91 -0
  14. package/dist/runtime/components/accordion/accordion.vue.d.ts +61 -0
  15. package/dist/runtime/components/accordion/index.d.ts +6 -0
  16. package/dist/runtime/components/accordion/index.js +4 -0
  17. package/dist/runtime/components/accordion/lib/context.d.ts +34 -0
  18. package/dist/runtime/components/accordion/lib/context.js +9 -0
  19. package/dist/runtime/components/collapse.d.vue.ts +65 -0
  20. package/dist/runtime/components/collapse.vue +144 -0
  21. package/dist/runtime/components/collapse.vue.d.ts +65 -0
  22. package/dist/runtime/components/date-time-picker.d.vue.ts +2 -2
  23. package/dist/runtime/components/date-time-picker.vue.d.ts +2 -2
  24. package/dist/runtime/components/index.d.ts +2 -2
  25. package/dist/runtime/components/index.js +1 -1
  26. package/dist/runtime/components/input/date-picker.d.vue.ts +2 -2
  27. package/dist/runtime/components/input/date-picker.vue.d.ts +2 -2
  28. package/dist/runtime/components/link/lib.d.ts +2 -2
  29. package/dist/runtime/components/tabs/tabs-root.d.vue.ts +1 -1
  30. package/dist/runtime/components/tabs/tabs-root.vue.d.ts +1 -1
  31. package/dist/runtime/components/text.vue +1 -1
  32. package/package.json +2 -2
  33. package/dist/runtime/components/accordion.d.vue.ts +0 -79
  34. package/dist/runtime/components/accordion.vue +0 -44
  35. package/dist/runtime/components/accordion.vue.d.ts +0 -79
  36. package/dist/runtime/components/collapsible/collapsible-content.d.vue.ts +0 -18
  37. package/dist/runtime/components/collapsible/collapsible-content.vue +0 -76
  38. package/dist/runtime/components/collapsible/collapsible-content.vue.d.ts +0 -18
  39. package/dist/runtime/components/collapsible/collapsible-root.d.vue.ts +0 -42
  40. package/dist/runtime/components/collapsible/collapsible-root.vue +0 -41
  41. package/dist/runtime/components/collapsible/collapsible-root.vue.d.ts +0 -42
  42. package/dist/runtime/components/collapsible/collapsible-trigger.d.vue.ts +0 -13
  43. package/dist/runtime/components/collapsible/collapsible-trigger.vue +0 -20
  44. package/dist/runtime/components/collapsible/collapsible-trigger.vue.d.ts +0 -13
  45. package/dist/runtime/components/collapsible/index.d.ts +0 -3
  46. package/dist/runtime/components/collapsible/index.js +0 -1
@@ -0,0 +1,144 @@
1
+ <script>
2
+ import Box from "./box.vue";
3
+ </script>
4
+
5
+ <script setup>
6
+ import { unrefElement, usePreferredReducedMotion } from "@vueuse/core";
7
+ import { computed, nextTick, onMounted, ref, useId, useTemplateRef, watch } from "vue";
8
+ const {
9
+ disabled,
10
+ keepMounted = true,
11
+ transitionDuration = 200,
12
+ transitionTimingFunction = "ease",
13
+ animateOpacity = true,
14
+ mod,
15
+ classes
16
+ } = defineProps({
17
+ defaultOpen: { type: Boolean, required: false },
18
+ disabled: { type: Boolean, required: false },
19
+ keepMounted: { type: Boolean, required: false },
20
+ transitionDuration: { type: Number, required: false },
21
+ transitionTimingFunction: { type: String, required: false },
22
+ animateOpacity: { type: Boolean, required: false },
23
+ mod: { type: [Object, Array, null], required: false },
24
+ classes: { type: Object, required: false }
25
+ });
26
+ defineSlots();
27
+ const opened = defineModel("open", { type: Boolean, ...{ default: (p) => p.defaultOpen } });
28
+ const contentId = useId();
29
+ const reducedMotion = usePreferredReducedMotion();
30
+ const duration = computed(() => reducedMotion.value === "reduce" ? 0 : transitionDuration);
31
+ function toggle() {
32
+ if (disabled)
33
+ return;
34
+ opened.value = !opened.value;
35
+ }
36
+ const dataState = computed(() => opened.value ? "open" : "closed");
37
+ const triggerProps = computed(() => ({
38
+ "aria-controls": contentId,
39
+ "aria-expanded": opened.value,
40
+ "disabled": disabled || void 0,
41
+ "data-state": dataState.value,
42
+ "data-disabled": disabled ? "" : void 0
43
+ }));
44
+ const el = useTemplateRef("content");
45
+ const mounted = ref(keepMounted || opened.value);
46
+ let timer;
47
+ function transitionStyle() {
48
+ const opacity = animateOpacity ? `, opacity ${duration.value}ms ${transitionTimingFunction}` : "";
49
+ return `height ${duration.value}ms ${transitionTimingFunction}${opacity}`;
50
+ }
51
+ function expand(node, instant) {
52
+ clearTimeout(timer);
53
+ node.style.overflow = "hidden";
54
+ if (instant) {
55
+ node.style.height = "";
56
+ node.style.opacity = "";
57
+ node.style.transition = "";
58
+ node.style.overflow = "";
59
+ return;
60
+ }
61
+ node.style.height = "0px";
62
+ if (animateOpacity)
63
+ node.style.opacity = "0";
64
+ void node.offsetHeight;
65
+ node.style.transition = transitionStyle();
66
+ node.style.height = `${node.scrollHeight}px`;
67
+ if (animateOpacity)
68
+ node.style.opacity = "1";
69
+ timer = setTimeout(() => {
70
+ node.style.transition = "";
71
+ node.style.height = "";
72
+ node.style.overflow = "";
73
+ node.style.opacity = "";
74
+ }, duration.value);
75
+ }
76
+ function collapse(node, instant) {
77
+ clearTimeout(timer);
78
+ node.style.overflow = "hidden";
79
+ node.style.height = `${node.scrollHeight}px`;
80
+ void node.offsetHeight;
81
+ if (instant) {
82
+ node.style.transition = "";
83
+ node.style.height = "0px";
84
+ if (animateOpacity)
85
+ node.style.opacity = "0";
86
+ if (!keepMounted)
87
+ mounted.value = false;
88
+ return;
89
+ }
90
+ node.style.transition = transitionStyle();
91
+ node.style.height = "0px";
92
+ if (animateOpacity)
93
+ node.style.opacity = "0";
94
+ timer = setTimeout(() => {
95
+ if (!keepMounted)
96
+ mounted.value = false;
97
+ }, duration.value);
98
+ }
99
+ onMounted(() => {
100
+ const node = unrefElement(el);
101
+ if (!node || opened.value)
102
+ return;
103
+ node.style.height = "0px";
104
+ node.style.overflow = "hidden";
105
+ if (animateOpacity)
106
+ node.style.opacity = "0";
107
+ });
108
+ watch(opened, async (value) => {
109
+ if (value) {
110
+ if (!mounted.value) {
111
+ mounted.value = true;
112
+ await nextTick();
113
+ }
114
+ if (el.value)
115
+ expand(unrefElement(el), duration.value === 0);
116
+ } else if (el.value) {
117
+ collapse(unrefElement(el), duration.value === 0);
118
+ }
119
+ });
120
+ </script>
121
+
122
+ <template>
123
+ <Box
124
+ :mod='[{ disabled, state: dataState }, mod]'
125
+ :class='classes?.root'
126
+ >
127
+ <slot
128
+ name='trigger'
129
+ :open='opened'
130
+ :toggle='toggle'
131
+ :props='triggerProps'
132
+ />
133
+
134
+ <Box
135
+ v-if='mounted'
136
+ :id='contentId'
137
+ ref='content'
138
+ :class='classes?.content'
139
+ :mod='{ disabled, open: opened }'
140
+ >
141
+ <slot :open='opened' />
142
+ </Box>
143
+ </box>
144
+ </template>
@@ -0,0 +1,65 @@
1
+ import type { Classes } from '@nui/types';
2
+ import type { BoxProps } from './box.vue.js';
3
+ export type CollapseClasses = 'root' | 'trigger' | 'content';
4
+ /** Props passed to the trigger slot, spread onto a custom toggle element for a11y. */
5
+ export interface CollapseTriggerProps {
6
+ 'aria-controls': string;
7
+ 'aria-expanded': boolean;
8
+ 'disabled': boolean | undefined;
9
+ 'data-state': 'open' | 'closed';
10
+ 'data-disabled': '' | undefined;
11
+ }
12
+ export interface CollapseProps {
13
+ /**
14
+ * The open state of the collapsible when it is initially rendered.
15
+ * Use when you do not need to control its open state.
16
+ * @default false
17
+ */
18
+ defaultOpen?: boolean;
19
+ /** Disables the component */
20
+ disabled?: boolean;
21
+ /**
22
+ * If set, the content stays mounted when collapsed.
23
+ * When `false`, content is unmounted after the exit transition.
24
+ * @default true
25
+ */
26
+ keepMounted?: boolean;
27
+ /** Transition duration in ms @default 200 */
28
+ transitionDuration?: number;
29
+ /** Transition timing function @default 'ease' */
30
+ transitionTimingFunction?: string;
31
+ /** If set, opacity is animated alongside height @default true */
32
+ animateOpacity?: boolean;
33
+ /** Element modifiers transformed into `data-` attributes, falsy values are removed */
34
+ mod?: BoxProps['mod'];
35
+ /** Styles API */
36
+ classes?: Classes<CollapseClasses>;
37
+ }
38
+ export interface CollapseSlots {
39
+ /** Collapsible content */
40
+ default?: (props: {
41
+ open: boolean;
42
+ }) => any;
43
+ /** Toggle control. Spread `props` onto a button to get a11y wiring. */
44
+ trigger?: (props: {
45
+ open: boolean;
46
+ toggle: () => void;
47
+ props: CollapseTriggerProps;
48
+ }) => any;
49
+ }
50
+ declare const _default: typeof __VLS_export;
51
+ export default _default;
52
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CollapseProps & {
53
+ open?: boolean;
54
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
55
+ "update:open": (value: boolean) => any;
56
+ }, string, import("vue").PublicProps, Readonly<CollapseProps & {
57
+ open?: boolean;
58
+ }> & Readonly<{
59
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
60
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, CollapseSlots>;
61
+ type __VLS_WithSlots<T, S> = T & {
62
+ new (): {
63
+ $slots: S;
64
+ };
65
+ };
@@ -41,16 +41,16 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
41
41
  next: () => any;
42
42
  "update:modelValue": (value: string | Date | null | undefined) => any;
43
43
  prev: () => any;
44
- level: () => any;
45
44
  open: () => any;
45
+ level: () => any;
46
46
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
47
47
  onSelect?: ((date: import("./calendar/index.js").Selection) => any) | undefined;
48
48
  onClose?: (() => any) | undefined;
49
49
  onNext?: (() => any) | undefined;
50
50
  "onUpdate:modelValue"?: ((value: string | Date | null | undefined) => any) | undefined;
51
51
  onPrev?: (() => any) | undefined;
52
- onLevel?: (() => any) | undefined;
53
52
  onOpen?: (() => any) | undefined;
53
+ onLevel?: (() => any) | undefined;
54
54
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
55
55
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
56
56
  declare const _default: typeof __VLS_export;
@@ -41,16 +41,16 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
41
41
  next: () => any;
42
42
  "update:modelValue": (value: string | Date | null | undefined) => any;
43
43
  prev: () => any;
44
- level: () => any;
45
44
  open: () => any;
45
+ level: () => any;
46
46
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
47
47
  onSelect?: ((date: import("./calendar/index.js").Selection) => any) | undefined;
48
48
  onClose?: (() => any) | undefined;
49
49
  onNext?: (() => any) | undefined;
50
50
  "onUpdate:modelValue"?: ((value: string | Date | null | undefined) => any) | undefined;
51
51
  onPrev?: (() => any) | undefined;
52
- onLevel?: (() => any) | undefined;
53
52
  onOpen?: (() => any) | undefined;
53
+ onLevel?: (() => any) | undefined;
54
54
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
55
55
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
56
56
  declare const _default: typeof __VLS_export;
@@ -1,4 +1,4 @@
1
- export type * from './accordion.vue';
1
+ export * from './accordion/index.js';
2
2
  export * from './action-icon/index.js';
3
3
  export * from './app-shell/index.js';
4
4
  export * from './avatar/index.js';
@@ -11,7 +11,7 @@ export * from './calendar/index.js';
11
11
  export * from './card/index.js';
12
12
  export * from './checkbox/index.js';
13
13
  export * from './chip/index.js';
14
- export * from './collapsible/index.js';
14
+ export type * from './collapse.vue';
15
15
  export * from './combobox/index.js';
16
16
  export type * from './container.vue';
17
17
  export type * from './date-time-picker.vue';
@@ -1,3 +1,4 @@
1
+ export * from "./accordion/index.js";
1
2
  export * from "./action-icon/index.js";
2
3
  export * from "./app-shell/index.js";
3
4
  export * from "./avatar/index.js";
@@ -6,7 +7,6 @@ export * from "./calendar/index.js";
6
7
  export * from "./card/index.js";
7
8
  export * from "./checkbox/index.js";
8
9
  export * from "./chip/index.js";
9
- export * from "./collapsible/index.js";
10
10
  export * from "./combobox/index.js";
11
11
  export * from "./dialog/index.js";
12
12
  export * from "./drawer/index.js";
@@ -20,8 +20,8 @@ declare const __VLS_export: <Mode extends SelectionMode>(__VLS_props: NonNullabl
20
20
  onNext?: (() => any) | undefined;
21
21
  "onUpdate:modelValue"?: ((value: DateSelection<Mode> | undefined) => any) | undefined;
22
22
  onPrev?: (() => any) | undefined;
23
- onLevel?: (() => any) | undefined;
24
23
  onOpen?: (() => any) | undefined;
24
+ onLevel?: (() => any) | undefined;
25
25
  }> & (typeof globalThis extends {
26
26
  __VLS_PROPS_FALLBACK: infer P;
27
27
  } ? P : {});
@@ -38,7 +38,7 @@ declare const __VLS_export: <Mode extends SelectionMode>(__VLS_props: NonNullabl
38
38
  } & {
39
39
  description?: (props: {}) => any;
40
40
  };
41
- emit: (((evt: "select", date: DateSelection<Mode>) => void) & ((evt: "close") => void) & ((evt: "next") => void) & ((evt: "prev") => void) & ((evt: "level") => void) & ((evt: "open") => void)) & ((event: "update:modelValue", value: DateSelection<Mode> | undefined) => void);
41
+ emit: (((evt: "select", date: DateSelection<Mode>) => void) & ((evt: "close") => void) & ((evt: "next") => void) & ((evt: "prev") => void) & ((evt: "open") => void) & ((evt: "level") => void)) & ((event: "update:modelValue", value: DateSelection<Mode> | undefined) => void);
42
42
  }>) => import("vue").VNode & {
43
43
  __ctx?: Awaited<typeof __VLS_setup>;
44
44
  };
@@ -20,8 +20,8 @@ declare const __VLS_export: <Mode extends SelectionMode>(__VLS_props: NonNullabl
20
20
  onNext?: (() => any) | undefined;
21
21
  "onUpdate:modelValue"?: ((value: DateSelection<Mode> | undefined) => any) | undefined;
22
22
  onPrev?: (() => any) | undefined;
23
- onLevel?: (() => any) | undefined;
24
23
  onOpen?: (() => any) | undefined;
24
+ onLevel?: (() => any) | undefined;
25
25
  }> & (typeof globalThis extends {
26
26
  __VLS_PROPS_FALLBACK: infer P;
27
27
  } ? P : {});
@@ -38,7 +38,7 @@ declare const __VLS_export: <Mode extends SelectionMode>(__VLS_props: NonNullabl
38
38
  } & {
39
39
  description?: (props: {}) => any;
40
40
  };
41
- emit: (((evt: "select", date: DateSelection<Mode>) => void) & ((evt: "close") => void) & ((evt: "next") => void) & ((evt: "prev") => void) & ((evt: "level") => void) & ((evt: "open") => void)) & ((event: "update:modelValue", value: DateSelection<Mode> | undefined) => void);
41
+ emit: (((evt: "select", date: DateSelection<Mode>) => void) & ((evt: "close") => void) & ((evt: "next") => void) & ((evt: "prev") => void) & ((evt: "open") => void) & ((evt: "level") => void)) & ((event: "update:modelValue", value: DateSelection<Mode> | undefined) => void);
42
42
  }>) => import("vue").VNode & {
43
43
  __ctx?: Awaited<typeof __VLS_setup>;
44
44
  };
@@ -1,5 +1,5 @@
1
1
  import type { NuxtLinkProps } from '#app';
2
2
  export declare function pickLinkProps<T extends NuxtLinkProps>(props: T): {
3
- link: Pick<T, "replace" | "target" | "to" | "external" | "rel" | "noRel" | "prefetch" | "noPrefetch" | "prefetchOn" | "trailingSlash" | "activeClass" | "ariaCurrentValue" | "exactActiveClass" | "prefetchedClass" | "viewTransition">;
4
- rest: Omit<T, "replace" | "target" | "to" | "external" | "rel" | "noRel" | "prefetch" | "noPrefetch" | "prefetchOn" | "trailingSlash" | "activeClass" | "ariaCurrentValue" | "exactActiveClass" | "prefetchedClass" | "viewTransition">;
3
+ link: Pick<T, "replace" | "to" | "target" | "external" | "rel" | "noRel" | "prefetch" | "noPrefetch" | "prefetchOn" | "trailingSlash" | "activeClass" | "ariaCurrentValue" | "exactActiveClass" | "prefetchedClass" | "viewTransition">;
4
+ rest: Omit<T, "replace" | "to" | "target" | "external" | "rel" | "noRel" | "prefetch" | "noPrefetch" | "prefetchOn" | "trailingSlash" | "activeClass" | "ariaCurrentValue" | "exactActiveClass" | "prefetchedClass" | "viewTransition">;
5
5
  };
@@ -62,8 +62,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
62
62
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
63
63
  "onUpdate:modelValue"?: ((value: string | null) => any) | undefined;
64
64
  }>, {
65
- orientation: "vertical" | "horizontal";
66
65
  variant: TabsVariant;
66
+ orientation: "vertical" | "horizontal";
67
67
  placement: "left" | "right";
68
68
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
69
69
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -62,8 +62,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
62
62
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
63
63
  "onUpdate:modelValue"?: ((value: string | null) => any) | undefined;
64
64
  }>, {
65
- orientation: "vertical" | "horizontal";
66
65
  variant: TabsVariant;
66
+ orientation: "vertical" | "horizontal";
67
67
  placement: "left" | "right";
68
68
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
69
69
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -45,7 +45,7 @@ const _mod = computed(() => [{
45
45
  const style = useVarsResolver((theme) => ({
46
46
  root: {
47
47
  "--text-fz": getFontSize(fz || size),
48
- "--text-ff": ff ? `var(--font-family${ff === "text" ? "" : ff})` : void 0,
48
+ "--text-ff": ff ? `var(--font-family-${ff === "text" ? "" : ff})` : void 0,
49
49
  "--text-fw": fw?.toString(),
50
50
  "--text-lh": getLineHeight(lh || size),
51
51
  "--text-gradient": variant === "gradient" ? getGradient(gradient, theme) : void 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuance-ui",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "A modern Nuxt UI library inspired by the best of the React ecosystem.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -46,7 +46,7 @@
46
46
  "dev": "npm run dev:prepare && nuxi dev playground",
47
47
  "dev:build": "nuxi build playground",
48
48
  "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
49
- "release": "npm run lint && npm run prepack && changelogen --release --minor && git push --follow-tags",
49
+ "release": "npm run lint && npm run prepack && changelogen --release && git push --follow-tags",
50
50
  "lint": "eslint ./src",
51
51
  "test": "vitest run",
52
52
  "test:watch": "vitest watch",
@@ -1,79 +0,0 @@
1
- import type { Classes, NuanceRadius } from '@nui/types';
2
- import type { TitleProps } from './title.vue.js';
3
- export interface AccordionItem {
4
- label?: string;
5
- slot?: string;
6
- content?: string;
7
- disabled?: boolean;
8
- /** Iconify icon */
9
- icon?: string;
10
- /** Iconify icon */
11
- trailingIcon?: string;
12
- /**
13
- * A unique value for the accordion item. Defaults to the index.
14
- * Also used as the Vue `key` for this item, so providing a stable value prevents
15
- * accordion content (and its local state) from remounting when items are added, removed,
16
- * or reordered.
17
- */
18
- value?: string;
19
- }
20
- type AccordionVariant = 'default' | 'contained' | 'filled' | 'separated';
21
- export interface AccordionProps<Multiple extends boolean = false> {
22
- /** If set, multiple items can be opened at the same time @default false */
23
- multiple?: Multiple;
24
- /** If set, arrow keys loop through items (first to last and last to first) @default true */
25
- loop?: boolean;
26
- /** @default 'default' */
27
- variant?: AccordionVariant;
28
- /** Transition duration in ms @default 200 */
29
- transitionDuration?: number;
30
- /** If set, chevron rotation is disabled @default false */
31
- disableChevronRotation?: boolean;
32
- /** Position of the chevron relative to the item label @default right */
33
- chevronPosition?: 'left' | 'right';
34
- /** Size of the chevron icon container @default auto */
35
- chevronSize?: number | string;
36
- /**
37
- * Size of the default chevron icon. Ignored when `chevron` prop is set.
38
- * Use `chevronSize` instead when using custom chevron.
39
- * @default 16
40
- */
41
- chevronIconSize?: number | string;
42
- /**
43
- * Sets heading level (h2-h6) for `Accordion.Control` elements.
44
- * Wraps each control in the corresponding heading tag, recommended to meet WAI-ARIA accessibility requirements.
45
- * Has no visual effect.
46
- */
47
- order?: TitleProps['order'];
48
- /** Custom chevron icon */
49
- chevron?: string;
50
- /**
51
- * Key of `theme.radius` or any valid CSS value to set border-radius.
52
- * Numbers are converted to rem.
53
- * @default theme.defaultRadius */
54
- radius?: NuanceRadius;
55
- /**
56
- * If set to `false`, panels are unmounted when collapsed.
57
- * By default, panels stay mounted when collapsed. @default true
58
- */
59
- keepMounted?: boolean;
60
- classes?: Classes<'root' | 'content' | 'item' | 'panel' | 'icon' | 'chevron' | 'label' | 'itemTitle' | 'control'>;
61
- }
62
- declare const _default: typeof __VLS_export;
63
- export default _default;
64
- declare const __VLS_export: <Multiple extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
65
- props: import("vue").PublicProps & __VLS_PrettifyLocal<AccordionProps<Multiple>> & (typeof globalThis extends {
66
- __VLS_PROPS_FALLBACK: infer P;
67
- } ? P : {});
68
- expose: (exposed: {}) => void;
69
- attrs: any;
70
- slots: {};
71
- emit: {};
72
- }>) => import("vue").VNode & {
73
- __ctx?: Awaited<typeof __VLS_setup>;
74
- };
75
- type __VLS_PrettifyLocal<T> = (T extends any ? {
76
- [K in keyof T]: T[K];
77
- } : {
78
- [K in keyof T as K]: T[K];
79
- }) & {};
@@ -1,44 +0,0 @@
1
- <script>
2
-
3
- </script>
4
-
5
- <script setup>
6
- import { getRadius, getSize, useVarsResolver } from "#imports";
7
- import Box from "./box.vue";
8
- const {
9
- transitionDuration,
10
- chevronSize,
11
- radius
12
- } = defineProps({
13
- multiple: { type: null, required: false },
14
- loop: { type: Boolean, required: false },
15
- variant: { type: String, required: false },
16
- transitionDuration: { type: Number, required: false },
17
- disableChevronRotation: { type: Boolean, required: false },
18
- chevronPosition: { type: String, required: false },
19
- chevronSize: { type: [Number, String], required: false },
20
- chevronIconSize: { type: [Number, String], required: false },
21
- order: { type: String, required: false },
22
- chevron: { type: String, required: false },
23
- radius: { type: [String, Number], required: false },
24
- keepMounted: { type: Boolean, required: false },
25
- classes: { type: Object, required: false }
26
- });
27
- const style = useVarsResolver(() => ({
28
- root: {
29
- "--accordion-transition-duration": transitionDuration === void 0 ? void 0 : `${transitionDuration}ms`,
30
- "--accordion-chevron-size": chevronSize === void 0 ? void 0 : getSize(chevronSize),
31
- "--accordion-radius": radius === void 0 ? void 0 : getRadius(radius)
32
- }
33
- }));
34
- </script>
35
-
36
- <template>
37
- <Box :style='style.root'>
38
- accordion
39
- </Box>
40
- </template>
41
-
42
- <style module>
43
- .root{--accordion-radius:var(--radius-default)}.panel{overflow-wrap:break-word}.content{padding:var(--spacing-md);padding-top:calc(var(--spacing-xs)/2)}.itemTitle{margin:0;padding:0;width:100%}.control{align-items:center;background-color:transparent;color:var(--color-bright);cursor:pointer;display:flex;flex-direction:row-reverse;opacity:1;padding-inline:var(--spacing-md);width:100%}.control:where([data-chevron-position=left]){flex-direction:row;padding-inline-start:0}.control:where(:disabled,[data-disabled]){cursor:not-allowed;opacity:.4}.control--contained:where(:not(:disabled,[data-disabled])),.control--default:where(:not(:disabled,[data-disabled])){@mixin hover{@mixin where-light{background-color:var(--color-gray-0)}@mixin where-dark{background-color:var(--color-dark-6)}}}.label{color:inherit;flex:1;font-weight:var(--font-weight-regular);overflow:hidden;padding-bottom:var(--spacing-sm);padding-top:var(--spacing-sm);text-overflow:ellipsis}.chevron{align-items:center;display:flex;justify-content:flex-start;min-width:var(--accordion-chevron-size,rem(15px));transform:rotate(0deg);transition:transform var(--accordion-transition-duration,.2s) ease;width:var(--accordion-chevron-size,rem(15px))}.chevron:where([data-rotate]){transform:rotate(180deg)}.chevron:where([data-position=left]){margin-inline-end:var(--spacing-md);margin-inline-start:var(--spacing-md)}.icon{align-items:center;display:flex;justify-content:center;margin-inline-end:var(--spacing-sm)}.icon:where([data-chevron-position=left]){margin-inline-end:0;margin-inline-start:var(--spacing-lg)}.item{@mixin where-light{--item-border-color:var(--color-gray-3);--item-filled-color:var(--color-gray-0)}@mixin where-dark{--item-border-color:var(--color-dark-4);--item-filled-color:var(--color-dark-6)}}.item--default{border-bottom:1px solid var(--item-border-color)}.item--contained{border:1px solid var(--item-border-color);transition:background-color .15s ease}.item--contained:where([data-active]){background-color:var(--item-filled-color)}.item--contained:first-of-type,.item--contained:first-of-type>[data-accordion-control]{border-start-end-radius:var(--accordion-radius);border-start-start-radius:var(--accordion-radius)}.item--contained:last-of-type,.item--contained:last-of-type>[data-accordion-control]{border-end-end-radius:var(--accordion-radius);border-end-start-radius:var(--accordion-radius)}.item--contained+.item--contained{border-top:0}.item--filled{border-radius:var(--accordion-radius)}.item--filled:where([data-active]){background-color:var(--item-filled-color)}.item--separated{background-color:var(--item-filled-color);border:1px solid transparent;border-radius:var(--accordion-radius);transition:background-color .15s ease}.item--separated[data-active]{border-color:var(--item-border-color);@mixin where-light{background-color:var(--color-white)}@mixin where-dark{background-color:var(--color-dark-7)}}.item--separated+.item--separated{margin-top:var(--spacing-md)}
44
- </style>
@@ -1,79 +0,0 @@
1
- import type { Classes, NuanceRadius } from '@nui/types';
2
- import type { TitleProps } from './title.vue.js';
3
- export interface AccordionItem {
4
- label?: string;
5
- slot?: string;
6
- content?: string;
7
- disabled?: boolean;
8
- /** Iconify icon */
9
- icon?: string;
10
- /** Iconify icon */
11
- trailingIcon?: string;
12
- /**
13
- * A unique value for the accordion item. Defaults to the index.
14
- * Also used as the Vue `key` for this item, so providing a stable value prevents
15
- * accordion content (and its local state) from remounting when items are added, removed,
16
- * or reordered.
17
- */
18
- value?: string;
19
- }
20
- type AccordionVariant = 'default' | 'contained' | 'filled' | 'separated';
21
- export interface AccordionProps<Multiple extends boolean = false> {
22
- /** If set, multiple items can be opened at the same time @default false */
23
- multiple?: Multiple;
24
- /** If set, arrow keys loop through items (first to last and last to first) @default true */
25
- loop?: boolean;
26
- /** @default 'default' */
27
- variant?: AccordionVariant;
28
- /** Transition duration in ms @default 200 */
29
- transitionDuration?: number;
30
- /** If set, chevron rotation is disabled @default false */
31
- disableChevronRotation?: boolean;
32
- /** Position of the chevron relative to the item label @default right */
33
- chevronPosition?: 'left' | 'right';
34
- /** Size of the chevron icon container @default auto */
35
- chevronSize?: number | string;
36
- /**
37
- * Size of the default chevron icon. Ignored when `chevron` prop is set.
38
- * Use `chevronSize` instead when using custom chevron.
39
- * @default 16
40
- */
41
- chevronIconSize?: number | string;
42
- /**
43
- * Sets heading level (h2-h6) for `Accordion.Control` elements.
44
- * Wraps each control in the corresponding heading tag, recommended to meet WAI-ARIA accessibility requirements.
45
- * Has no visual effect.
46
- */
47
- order?: TitleProps['order'];
48
- /** Custom chevron icon */
49
- chevron?: string;
50
- /**
51
- * Key of `theme.radius` or any valid CSS value to set border-radius.
52
- * Numbers are converted to rem.
53
- * @default theme.defaultRadius */
54
- radius?: NuanceRadius;
55
- /**
56
- * If set to `false`, panels are unmounted when collapsed.
57
- * By default, panels stay mounted when collapsed. @default true
58
- */
59
- keepMounted?: boolean;
60
- classes?: Classes<'root' | 'content' | 'item' | 'panel' | 'icon' | 'chevron' | 'label' | 'itemTitle' | 'control'>;
61
- }
62
- declare const _default: typeof __VLS_export;
63
- export default _default;
64
- declare const __VLS_export: <Multiple extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
65
- props: import("vue").PublicProps & __VLS_PrettifyLocal<AccordionProps<Multiple>> & (typeof globalThis extends {
66
- __VLS_PROPS_FALLBACK: infer P;
67
- } ? P : {});
68
- expose: (exposed: {}) => void;
69
- attrs: any;
70
- slots: {};
71
- emit: {};
72
- }>) => import("vue").VNode & {
73
- __ctx?: Awaited<typeof __VLS_setup>;
74
- };
75
- type __VLS_PrettifyLocal<T> = (T extends any ? {
76
- [K in keyof T]: T[K];
77
- } : {
78
- [K in keyof T as K]: T[K];
79
- }) & {};
@@ -1,18 +0,0 @@
1
- import type { BoxProps } from '../box.vue.js';
2
- export interface CollapsibleContentProps extends BoxProps {
3
- /**
4
- * Used to force mounting when more control is needed. Useful when
5
- * controlling animation with Vue animation libraries.
6
- */
7
- forceMount?: boolean;
8
- }
9
- declare const _default: typeof __VLS_export;
10
- export default _default;
11
- declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CollapsibleContentProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CollapsibleContentProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
12
- default?: (props: {}) => any;
13
- }>;
14
- type __VLS_WithSlots<T, S> = T & {
15
- new (): {
16
- $slots: S;
17
- };
18
- };