nuance-ui 0.3.0 → 0.3.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.
Files changed (89) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +2 -1
  3. package/dist/runtime/components/accordion/accordion-header.d.vue.ts +28 -0
  4. package/dist/runtime/components/accordion/accordion-header.vue +79 -0
  5. package/dist/runtime/components/accordion/accordion-header.vue.d.ts +28 -0
  6. package/dist/runtime/components/accordion/accordion-item.d.vue.ts +18 -0
  7. package/dist/runtime/components/accordion/accordion-item.vue +44 -0
  8. package/dist/runtime/components/accordion/accordion-item.vue.d.ts +18 -0
  9. package/dist/runtime/components/accordion/accordion-panel.d.vue.ts +18 -0
  10. package/dist/runtime/components/accordion/accordion-panel.vue +40 -0
  11. package/dist/runtime/components/accordion/accordion-panel.vue.d.ts +18 -0
  12. package/dist/runtime/components/accordion/accordion.d.vue.ts +61 -0
  13. package/dist/runtime/components/accordion/accordion.module.css +1 -0
  14. package/dist/runtime/components/accordion/accordion.vue +91 -0
  15. package/dist/runtime/components/accordion/accordion.vue.d.ts +61 -0
  16. package/dist/runtime/components/accordion/index.d.ts +6 -0
  17. package/dist/runtime/components/accordion/index.js +4 -0
  18. package/dist/runtime/components/accordion/lib/context.d.ts +34 -0
  19. package/dist/runtime/components/accordion/lib/context.js +9 -0
  20. package/dist/runtime/components/collapse.d.vue.ts +65 -0
  21. package/dist/runtime/components/collapse.vue +144 -0
  22. package/dist/runtime/components/collapse.vue.d.ts +65 -0
  23. package/dist/runtime/components/date-time-picker.d.vue.ts +2 -2
  24. package/dist/runtime/components/date-time-picker.vue.d.ts +2 -2
  25. package/dist/runtime/components/dialog/ui/dialog-root.d.vue.ts +1 -1
  26. package/dist/runtime/components/dialog/ui/dialog-root.vue +1 -1
  27. package/dist/runtime/components/dialog/ui/dialog-root.vue.d.ts +1 -1
  28. package/dist/runtime/components/index.d.ts +5 -3
  29. package/dist/runtime/components/index.js +2 -1
  30. package/dist/runtime/components/input/date-picker.d.vue.ts +2 -2
  31. package/dist/runtime/components/input/date-picker.vue.d.ts +2 -2
  32. package/dist/runtime/components/kbd.d.vue.ts +25 -0
  33. package/dist/runtime/components/kbd.vue +28 -0
  34. package/dist/runtime/components/kbd.vue.d.ts +25 -0
  35. package/dist/runtime/components/link/lib.d.ts +2 -2
  36. package/dist/runtime/components/notification.d.vue.ts +82 -0
  37. package/dist/runtime/components/notification.vue +144 -0
  38. package/dist/runtime/components/notification.vue.d.ts +82 -0
  39. package/dist/runtime/components/tabs/tabs-root.d.vue.ts +1 -1
  40. package/dist/runtime/components/tabs/tabs-root.vue.d.ts +1 -1
  41. package/dist/runtime/components/text.vue +1 -1
  42. package/dist/runtime/components/transition/index.d.ts +2 -0
  43. package/dist/runtime/components/transition/index.js +0 -0
  44. package/dist/runtime/components/transition/transition-group.d.vue.ts +35 -0
  45. package/dist/runtime/components/transition/transition-group.vue +32 -0
  46. package/dist/runtime/components/transition/transition-group.vue.d.ts +35 -0
  47. package/dist/runtime/components/transition/transition.vue +33 -0
  48. package/dist/runtime/components/tree/_ui/tree-item.vue +3 -3
  49. package/dist/runtime/composables/index.d.ts +1 -0
  50. package/dist/runtime/composables/index.js +1 -0
  51. package/dist/runtime/composables/use-countdown.d.ts +19 -0
  52. package/dist/runtime/composables/use-countdown.js +30 -0
  53. package/dist/runtime/notifications/index.d.ts +4 -0
  54. package/dist/runtime/notifications/index.js +3 -0
  55. package/dist/runtime/notifications/lib.d.ts +4 -0
  56. package/dist/runtime/notifications/lib.js +14 -0
  57. package/dist/runtime/notifications/notification-container.d.vue.ts +20 -0
  58. package/dist/runtime/notifications/notification-container.vue +35 -0
  59. package/dist/runtime/notifications/notification-container.vue.d.ts +20 -0
  60. package/dist/runtime/notifications/notifications-provider.d.vue.ts +22 -0
  61. package/dist/runtime/notifications/notifications-provider.vue +117 -0
  62. package/dist/runtime/notifications/notifications-provider.vue.d.ts +22 -0
  63. package/dist/runtime/notifications/notifications-store.d.ts +25 -0
  64. package/dist/runtime/notifications/notifications-store.js +80 -0
  65. package/dist/runtime/notifications/types.d.ts +50 -0
  66. package/dist/runtime/notifications/types.js +0 -0
  67. package/dist/runtime/notifications/use-notifications.d.ts +7 -0
  68. package/dist/runtime/notifications/use-notifications.js +10 -0
  69. package/dist/runtime/styles/global.css +1 -1
  70. package/dist/runtime/styles/transitions.css +1 -0
  71. package/dist/runtime/types/index.d.ts +2 -0
  72. package/package.json +10 -6
  73. package/dist/runtime/components/accordion.d.vue.ts +0 -79
  74. package/dist/runtime/components/accordion.vue +0 -44
  75. package/dist/runtime/components/accordion.vue.d.ts +0 -79
  76. package/dist/runtime/components/collapsible/collapsible-content.d.vue.ts +0 -18
  77. package/dist/runtime/components/collapsible/collapsible-content.vue +0 -76
  78. package/dist/runtime/components/collapsible/collapsible-content.vue.d.ts +0 -18
  79. package/dist/runtime/components/collapsible/collapsible-root.d.vue.ts +0 -42
  80. package/dist/runtime/components/collapsible/collapsible-root.vue +0 -41
  81. package/dist/runtime/components/collapsible/collapsible-root.vue.d.ts +0 -42
  82. package/dist/runtime/components/collapsible/collapsible-trigger.d.vue.ts +0 -13
  83. package/dist/runtime/components/collapsible/collapsible-trigger.vue +0 -20
  84. package/dist/runtime/components/collapsible/collapsible-trigger.vue.d.ts +0 -13
  85. package/dist/runtime/components/collapsible/index.d.ts +0 -3
  86. package/dist/runtime/components/collapsible/index.js +0 -1
  87. package/dist/runtime/components/transition.vue +0 -42
  88. /package/dist/runtime/components/{transition.d.vue.ts → transition/transition.d.vue.ts} +0 -0
  89. /package/dist/runtime/components/{transition.vue.d.ts → transition/transition.vue.d.ts} +0 -0
@@ -0,0 +1,144 @@
1
+ <script setup>
2
+ import { getRadius, getThemeColor, useVarsResolver } from "#imports";
3
+ import ActionIcon from "./action-icon/action-icon.vue";
4
+ import Box from "./box.vue";
5
+ import Button from "./button/button.vue";
6
+ import Loader from "./loader/loader.vue";
7
+ import Progress from "./progress/progress.vue";
8
+ const {
9
+ withCloseButton = true,
10
+ radius,
11
+ color,
12
+ mod,
13
+ loading,
14
+ withBorder,
15
+ role = "alert",
16
+ icon,
17
+ loaderProps,
18
+ title,
19
+ message,
20
+ actions,
21
+ orientation = "horizontal",
22
+ closeButtonProps,
23
+ classes,
24
+ withProgress = false
25
+ } = defineProps({
26
+ color: { type: null, required: false },
27
+ radius: { type: [String, Number], required: false },
28
+ icon: { type: String, required: false },
29
+ title: { type: [String, Object, Function], required: false },
30
+ message: { type: [String, Object, Function], required: false },
31
+ actions: { type: Array, required: false },
32
+ orientation: { type: String, required: false },
33
+ loading: { type: Boolean, required: false },
34
+ withProgress: { type: Boolean, required: false },
35
+ withBorder: { type: Boolean, required: false },
36
+ withCloseButton: { type: Boolean, required: false },
37
+ closeButtonProps: { type: Object, required: false },
38
+ loaderProps: { type: Object, required: false },
39
+ role: { type: String, required: false },
40
+ classes: { type: Object, required: false },
41
+ is: { type: null, required: false },
42
+ mod: { type: [Object, Array, null], required: false }
43
+ });
44
+ defineEmits(["close"]);
45
+ const progress = defineModel("progress", { type: Number, ...{ default: 0 } });
46
+ const style = useVarsResolver((theme) => ({
47
+ root: {
48
+ "--notification-radius": radius === void 0 ? void 0 : getRadius(radius),
49
+ "--notification-color": color ? getThemeColor(color, theme) : void 0
50
+ }
51
+ }));
52
+ </script>
53
+
54
+ <template>
55
+ <Box
56
+ :style='style.root'
57
+ :class='[$style.root, classes?.root]'
58
+ :role
59
+ :mod='[{
60
+ "with-icon": !!icon || !!$slots.icon || loading,
61
+ "with-border": withBorder,
62
+ orientation
63
+ }, mod]'
64
+ >
65
+ <div v-if='icon && !loading' :class='[$style.icon, classes?.icon]'>
66
+ <slot name='icon'>
67
+ <Icon :name='icon' />
68
+ </slot>
69
+ </div>
70
+
71
+ <Loader
72
+ v-if='loading'
73
+ size='28px'
74
+ :color
75
+ v-bind='loaderProps'
76
+ :class='[$style.loader, loaderProps?.class, classes?.loader]'
77
+ />
78
+
79
+ <div :class='[$style.body, classes?.body]'>
80
+ <div v-if='title || $slots.title' :class='[$style.title, classes?.title]'>
81
+ <slot name='title'>
82
+ <component :is='title()' v-if='typeof title === "function"' />
83
+ <component :is='title' v-else-if='title && typeof title === "object"' />
84
+ <template v-else>
85
+ {{ title }}
86
+ </template>
87
+ </slot>
88
+ </div>
89
+
90
+ <Box
91
+ :class='[$style.description, classes?.description]'
92
+ :mod='{ "with-title": !!title || !!$slots.title }'
93
+ >
94
+ <slot>
95
+ <component :is='message()' v-if='typeof message === "function"' />
96
+ <component :is='message' v-else-if='message && typeof message === "object"' />
97
+ <template v-else>
98
+ {{ message }}
99
+ </template>
100
+ </slot>
101
+ </Box>
102
+
103
+ <div v-if='withProgress' :class='$style.progress'>
104
+ <Progress
105
+ v-model='progress'
106
+ :class='$style.progressInput'
107
+ :color
108
+ size='4px'
109
+ />
110
+ </div>
111
+
112
+ <Box
113
+ v-if='actions?.length || $slots.actions'
114
+ :class='[$style.actions, classes?.actions]'
115
+ :mod='{ orientation }'
116
+ >
117
+ <slot name='actions'>
118
+ <Button
119
+ v-for='({ label, ...action }, index) in actions'
120
+ :key='index'
121
+ size='compact-sm'
122
+ :color
123
+ v-bind='action'
124
+ >
125
+ {{ label }}
126
+ </Button>
127
+ </slot>
128
+ </Box>
129
+ </div>
130
+
131
+ <ActionIcon
132
+ v-if='withCloseButton'
133
+ icon='lucide:x'
134
+ variant='subtle'
135
+ :class='[$style.closeButton, classes?.closeButton]'
136
+ v-bind='closeButtonProps'
137
+ @click='$emit("close")'
138
+ />
139
+ </Box>
140
+ </template>
141
+
142
+ <style module>
143
+ .root{--notification-radius:var(--radius-default);--notification-color:var(--color-primary-filled);align-items:center;box-shadow:var(--shadow-lg);box-sizing:border-box;display:flex;overflow:hidden;padding-bottom:var(--spacing-xs);padding-inline-end:var(--spacing-xs);padding-top:var(--spacing-xs);padding-inline-start:22px;position:relative}.root,.root:before{border-radius:var(--notification-radius)}.root:before{background-color:var(--notification-color);bottom:var(--notification-radius);content:"";display:block;inset-inline-start:4px;position:absolute;top:var(--notification-radius);width:6px}.root{@mixin where-light{background-color:var(--color-white)}}.root{@mixin where-dark{background-color:var(--color-dark-6)}}.root:where([data-with-icon]):before{display:none}.root:where([data-with-border]){@mixin where-light{border-bottom-color:var(--color-gray-3);border-bottom-style:solid;border-bottom-width:1px;border-left-color:var(--color-gray-3);border-left-style:solid;border-left-width:1px;border-right-color:var(--color-gray-3);border-right-style:solid;border-right-width:1px;border-top-color:var(--color-gray-3);border-top-style:solid;border-top-width:1px}@mixin where-dark{border-bottom-color:var(--color-dark-4);border-bottom-style:solid;border-bottom-width:1px;border-left-color:var(--color-dark-4);border-left-style:solid;border-left-width:1px;border-right-color:var(--color-dark-4);border-right-style:solid;border-right-width:1px;border-top-color:var(--color-dark-4);border-top-style:solid;border-top-width:1px}}.icon{align-items:center;background-color:var(--notification-color);border-radius:28px;box-sizing:border-box;color:var(--color-white);display:flex;height:28px;justify-content:center;width:28px}.icon,.loader{margin-inline-end:var(--spacing-md)}.body{flex:1;margin-inline-end:var(--spacing-xs);overflow:hidden}.title{font-size:var(--font-size-sm);font-weight:500;line-height:var(--line-height-sm);margin-bottom:2px;overflow:hidden;text-overflow:ellipsis;@mixin where-light{color:var(--color-gray-9)}@mixin where-dark{color:var(--color-white)}}.description{font-size:var(--font-size-sm);line-height:var(--line-height-sm);overflow:hidden;text-overflow:ellipsis;@mixin where-light{color:var(--color-black)}@mixin where-dark{color:var(--color-dark-0)}}.description:where([data-with-title]){@mixin where-light{color:var(--color-gray-6)}@mixin where-dark{color:var(--color-dark-2)}}.actions{align-items:center;display:flex;gap:var(--spacing-xs);margin-top:var(--spacing-xs)}.actions[data-orientation=horizontal],.closeButton{margin-inline-start:var(--spacing-xs)}.progress{bottom:0;left:0;position:absolute;right:0}.progress .progressInput{border-radius:0 0 var(--radius-md) var(--radius-md)}
144
+ </style>
@@ -0,0 +1,82 @@
1
+ import type { HTMLAttributes } from 'vue';
2
+ import type { Classes, NuanceColor, NuanceRadius, StringOrVNode } from '../types/index.js';
3
+ import type { ActionIconProps } from './action-icon/action-icon.vue.js';
4
+ import type { BoxProps } from './box.vue.js';
5
+ import type { ButtonProps } from './button/button.vue.js';
6
+ import type { LoaderProps } from './loader/index.js';
7
+ export type NotificationOrientation = 'vertical' | 'horizontal';
8
+ export interface NotificationAction extends ButtonProps {
9
+ /** Button label */
10
+ label: string;
11
+ /** Click handler */
12
+ onClick?: (event: MouseEvent) => void;
13
+ }
14
+ type NotificationClasses = 'root' | 'icon' | 'loader' | 'body' | 'title' | 'description' | 'actions' | 'closeButton';
15
+ export interface NotificationProps extends BoxProps {
16
+ /**
17
+ * Controls icon background color or notification accent line color, key of `theme.colors` or any valid CSS color.
18
+ * When `icon` is provided, sets the icon background color.
19
+ * When no icon is provided, sets the colored accent line on the left.
20
+ * @default theme.primaryColor
21
+ */
22
+ color?: NuanceColor;
23
+ /**
24
+ * Key of `theme.radius` or any valid CSS value to set `border-radius`
25
+ * @default theme.defaultRadius
26
+ */
27
+ radius?: NuanceRadius;
28
+ /** Notification icon, replaces color line */
29
+ icon?: string;
30
+ /** Notification title, displayed above the message body */
31
+ title?: StringOrVNode;
32
+ /** Notification body. When no title is provided, this is the main message. */
33
+ message?: StringOrVNode;
34
+ /** Action buttons */
35
+ actions?: NotificationAction[];
36
+ /** Actions/close layout @default 'vertical' */
37
+ orientation?: NotificationOrientation;
38
+ /** If set, displays a `Loader` component instead of the icon. Takes precedence over the `icon` prop if both are provided. */
39
+ loading?: boolean;
40
+ /** Shows the auto-close progress bar @default false */
41
+ withProgress?: boolean;
42
+ /** Adds border to the root element */
43
+ withBorder?: boolean;
44
+ /** If set, the close button is visible @default true */
45
+ withCloseButton?: boolean;
46
+ /** Props passed down to the close button */
47
+ closeButtonProps?: ActionIconProps;
48
+ /** Props passed down to the `Loader` component */
49
+ loaderProps?: LoaderProps & HTMLAttributes;
50
+ role?: string;
51
+ classes?: Classes<NotificationClasses>;
52
+ }
53
+ type __VLS_Props = NotificationProps;
54
+ type __VLS_ModelProps = {
55
+ 'progress'?: number;
56
+ };
57
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
58
+ declare var __VLS_8: {}, __VLS_20: {}, __VLS_38: {}, __VLS_61: {};
59
+ type __VLS_Slots = {} & {
60
+ icon?: (props: typeof __VLS_8) => any;
61
+ } & {
62
+ title?: (props: typeof __VLS_20) => any;
63
+ } & {
64
+ default?: (props: typeof __VLS_38) => any;
65
+ } & {
66
+ actions?: (props: typeof __VLS_61) => any;
67
+ };
68
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
69
+ close: () => any;
70
+ "update:progress": (value: number) => any;
71
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
72
+ onClose?: (() => any) | undefined;
73
+ "onUpdate:progress"?: ((value: number) => any) | undefined;
74
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
75
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
76
+ declare const _default: typeof __VLS_export;
77
+ export default _default;
78
+ type __VLS_WithSlots<T, S> = T & {
79
+ new (): {
80
+ $slots: S;
81
+ };
82
+ };
@@ -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,
@@ -0,0 +1,2 @@
1
+ export type * from './transition-group.vue';
2
+ export type * from './transition.vue';
File without changes
@@ -0,0 +1,35 @@
1
+ import type { TransitionName } from './transition.vue.js';
2
+ export interface TransitionGroupProps {
3
+ /**
4
+ * Transition animation name
5
+ * @default `'pop-bottom-left'`
6
+ */
7
+ name?: TransitionName;
8
+ /**
9
+ * Transition duration in ms
10
+ * @default `250`
11
+ */
12
+ duration?: number;
13
+ /**
14
+ * Transition delay in ms
15
+ * @default `0`
16
+ */
17
+ delay?: number;
18
+ /** Wrapper element/component rendered around the list @default `'div'` */
19
+ tag?: string;
20
+ /** Whether to apply transition on initial render @default `false` */
21
+ appear?: boolean;
22
+ }
23
+ declare var __VLS_8: {};
24
+ type __VLS_Slots = {} & {
25
+ default?: (props: typeof __VLS_8) => any;
26
+ };
27
+ declare const __VLS_base: import("vue").DefineComponent<TransitionGroupProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TransitionGroupProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
29
+ declare const _default: typeof __VLS_export;
30
+ export default _default;
31
+ type __VLS_WithSlots<T, S> = T & {
32
+ new (): {
33
+ $slots: S;
34
+ };
35
+ };
@@ -0,0 +1,32 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ const {
4
+ name = "pop-bottom-left",
5
+ duration = 250,
6
+ delay,
7
+ tag = "div",
8
+ appear
9
+ } = defineProps({
10
+ name: { type: String, required: false },
11
+ duration: { type: Number, required: false },
12
+ delay: { type: Number, required: false },
13
+ tag: { type: String, required: false },
14
+ appear: { type: Boolean, required: false }
15
+ });
16
+ const style = computed(() => ({
17
+ "--transition-duration": `${duration}ms`,
18
+ "--transition-delay": delay ? `${delay}ms` : void 0
19
+ }));
20
+ </script>
21
+
22
+ <template>
23
+ <TransitionGroup
24
+ :style
25
+ :name
26
+ :tag
27
+ :appear
28
+ move-class='transition-move'
29
+ >
30
+ <slot />
31
+ </TransitionGroup>
32
+ </template>
@@ -0,0 +1,35 @@
1
+ import type { TransitionName } from './transition.vue.js';
2
+ export interface TransitionGroupProps {
3
+ /**
4
+ * Transition animation name
5
+ * @default `'pop-bottom-left'`
6
+ */
7
+ name?: TransitionName;
8
+ /**
9
+ * Transition duration in ms
10
+ * @default `250`
11
+ */
12
+ duration?: number;
13
+ /**
14
+ * Transition delay in ms
15
+ * @default `0`
16
+ */
17
+ delay?: number;
18
+ /** Wrapper element/component rendered around the list @default `'div'` */
19
+ tag?: string;
20
+ /** Whether to apply transition on initial render @default `false` */
21
+ appear?: boolean;
22
+ }
23
+ declare var __VLS_8: {};
24
+ type __VLS_Slots = {} & {
25
+ default?: (props: typeof __VLS_8) => any;
26
+ };
27
+ declare const __VLS_base: import("vue").DefineComponent<TransitionGroupProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TransitionGroupProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
29
+ declare const _default: typeof __VLS_export;
30
+ export default _default;
31
+ type __VLS_WithSlots<T, S> = T & {
32
+ new (): {
33
+ $slots: S;
34
+ };
35
+ };
@@ -0,0 +1,33 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ const {
4
+ name = "pop-bottom-left",
5
+ duration = 250,
6
+ delay,
7
+ appear,
8
+ mode
9
+ } = defineProps({
10
+ name: { type: String, required: false },
11
+ duration: { type: Number, required: false },
12
+ delay: { type: Number, required: false },
13
+ mode: { type: String, required: false },
14
+ appear: { type: Boolean, required: false }
15
+ });
16
+ const emit = defineEmits(["afterLeave"]);
17
+ const style = computed(() => ({
18
+ "--transition-duration": `${duration}ms`,
19
+ "--transition-delay": delay ? `${delay}ms` : void 0
20
+ }));
21
+ </script>
22
+
23
+ <template>
24
+ <Transition
25
+ :style
26
+ :name
27
+ :mode
28
+ :appear
29
+ @after-leave='() => emit("afterLeave")'
30
+ >
31
+ <slot />
32
+ </Transition>
33
+ </template>
@@ -6,7 +6,7 @@ import ActionIcon from "../../action-icon/action-icon.vue";
6
6
  import Button from "../../button/button.vue";
7
7
  import Loader from "../../loader/loader.vue";
8
8
  import RovingFocusItem from "../../roving-focus/roving-focus-item.vue";
9
- import UTransition from "../../transition.vue";
9
+ import NTransition from "../../transition/transition.vue";
10
10
  import { useTreeState } from "../lib/context";
11
11
  import { filterTreeItems } from "../lib/filter-tree-items";
12
12
  import { useTreeItemHandlers } from "../lib/item-handlers";
@@ -106,7 +106,7 @@ const { handleClick, handleKeyDown } = useTreeItemHandlers(path, isFolder, expan
106
106
  </Button>
107
107
  </RovingFocusItem>
108
108
 
109
- <UTransition name='scale-y'>
109
+ <NTransition name='scale-y'>
110
110
  <ul
111
111
  v-if='expanded && data && data.length > 0'
112
112
  :class='$style.list'
@@ -120,7 +120,7 @@ const { handleClick, handleKeyDown } = useTreeItemHandlers(path, isFolder, expan
120
120
  :level='level + 1'
121
121
  />
122
122
  </ul>
123
- </UTransition>
123
+ </NTransition>
124
124
  </li>
125
125
  </template>
126
126
 
@@ -1,6 +1,7 @@
1
1
  export * from './create-strict-injection.js';
2
2
  export * from './use-active-link.js';
3
3
  export * from './use-config.js';
4
+ export * from './use-countdown.js';
4
5
  export * from './use-date-config.js';
5
6
  export * from './use-floating-indicator.js';
6
7
  export * from './use-selectable-group.js';
@@ -1,6 +1,7 @@
1
1
  export * from "./create-strict-injection.js";
2
2
  export * from "./use-active-link.js";
3
3
  export * from "./use-config.js";
4
+ export * from "./use-countdown.js";
4
5
  export * from "./use-date-config.js";
5
6
  export * from "./use-floating-indicator.js";
6
7
  export * from "./use-selectable-group.js";
@@ -0,0 +1,19 @@
1
+ import type { Ref } from 'vue';
2
+ export interface UseCountdownOptions {
3
+ /** Countdown duration in ms, `0` disables the timer */
4
+ duration: number;
5
+ /** Interval step in ms @default 16 */
6
+ step?: number;
7
+ /** Whether the timer is currently paused */
8
+ paused?: Ref<boolean>;
9
+ /** Called when the countdown reaches 0 */
10
+ onComplete: () => void;
11
+ }
12
+ export interface UseCountdownReturn {
13
+ /** Remaining time in ms */
14
+ remaining: Ref<number>;
15
+ /** Remaining time as a percentage of the total duration, `0` if duration is `0` */
16
+ progress: Ref<number>;
17
+ }
18
+ /** Countdown timer driven by `useIntervalFn`, pausable via an external ref. */
19
+ export declare function useCountdown({ duration, step, paused, onComplete, }: UseCountdownOptions): UseCountdownReturn;
@@ -0,0 +1,30 @@
1
+ import { useIntervalFn } from "@vueuse/core";
2
+ import { computed, ref, watch } from "vue";
3
+ export function useCountdown({
4
+ duration,
5
+ step = 16,
6
+ paused,
7
+ onComplete
8
+ }) {
9
+ const active = duration > 0;
10
+ const remaining = ref(duration);
11
+ const progress = computed(() => active ? remaining.value / duration * 100 : 0);
12
+ const { pause, resume } = useIntervalFn(() => {
13
+ remaining.value -= step;
14
+ if (remaining.value <= 0) {
15
+ pause();
16
+ onComplete();
17
+ }
18
+ }, step, { immediate: active && !paused?.value });
19
+ if (paused) {
20
+ watch(paused, (isPaused) => {
21
+ if (!active)
22
+ return;
23
+ if (isPaused)
24
+ pause();
25
+ else
26
+ resume();
27
+ });
28
+ }
29
+ return { remaining, progress };
30
+ }
@@ -0,0 +1,4 @@
1
+ export { default as NNotificationsProvider } from './notifications-provider.vue.js';
2
+ export { $notifications } from './notifications-store.js';
3
+ export type * from './types';
4
+ export { useNotifications } from './use-notifications.js';
@@ -0,0 +1,3 @@
1
+ export { default as NNotificationsProvider } from "./notifications-provider.vue";
2
+ export { $notifications } from "./notifications-store.js";
3
+ export { useNotifications } from "./use-notifications.js";
@@ -0,0 +1,4 @@
1
+ /** Unique id for a notification. */
2
+ export declare function createId(): string;
3
+ /** Resolves the effective auto-close: a notification number/false wins, else the global value. */
4
+ export declare function getAutoClose(global: number | false, notification: number | false | undefined): number | false;
@@ -0,0 +1,14 @@
1
+ let counter = 0;
2
+ export function createId() {
3
+ if (typeof crypto !== "undefined" && "randomUUID" in crypto)
4
+ return crypto.randomUUID();
5
+ counter += 1;
6
+ return `notification-${Date.now()}-${counter}`;
7
+ }
8
+ export function getAutoClose(global, notification) {
9
+ if (typeof notification === "number")
10
+ return notification;
11
+ if (notification === false || global === false)
12
+ return false;
13
+ return global;
14
+ }
@@ -0,0 +1,20 @@
1
+ import type { NotificationData } from './types.js';
2
+ type __VLS_Props = {
3
+ /** Notification data object */
4
+ data: NotificationData;
5
+ /** Global auto-close duration in ms, or false to disable */
6
+ autoClose: number | false;
7
+ /** Whether the timer is currently paused */
8
+ paused: boolean;
9
+ };
10
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
+ hide: (id: string) => any;
12
+ hoverStart: () => any;
13
+ hoverEnd: () => any;
14
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
15
+ onHide?: ((id: string) => any) | undefined;
16
+ onHoverStart?: (() => any) | undefined;
17
+ onHoverEnd?: (() => any) | undefined;
18
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
+ declare const _default: typeof __VLS_export;
20
+ export default _default;
@@ -0,0 +1,35 @@
1
+ <script setup>
2
+ import { onBeforeUnmount, onMounted, toRef } from "vue";
3
+ import Notification from "../components/notification.vue";
4
+ import { useCountdown } from "../composables";
5
+ import { getAutoClose } from "./lib";
6
+ const props = defineProps({
7
+ data: { type: Object, required: true },
8
+ autoClose: { type: [Number, Boolean], required: true },
9
+ paused: { type: Boolean, required: true }
10
+ });
11
+ const emit = defineEmits(["hide", "hoverStart", "hoverEnd"]);
12
+ const duration = getAutoClose(props.autoClose, props.data.autoClose);
13
+ const { progress } = useCountdown({
14
+ duration: typeof duration === "number" ? duration : 0,
15
+ paused: toRef(props, "paused"),
16
+ onComplete: () => emit("hide", props.data.id)
17
+ });
18
+ onMounted(() => {
19
+ props.data.onOpen?.(props.data.id);
20
+ });
21
+ onBeforeUnmount(() => {
22
+ props.data.onClose?.(props.data.id);
23
+ });
24
+ </script>
25
+
26
+ <template>
27
+ <Notification
28
+ v-bind='props.data'
29
+ v-model:progress='progress'
30
+ :with-progress='props.data.withProgress && !!duration'
31
+ @close="emit('hide', props.data.id)"
32
+ @mouseenter='$emit("hoverStart")'
33
+ @mouseleave='$emit("hoverEnd")'
34
+ />
35
+ </template>
@@ -0,0 +1,20 @@
1
+ import type { NotificationData } from './types.js';
2
+ type __VLS_Props = {
3
+ /** Notification data object */
4
+ data: NotificationData;
5
+ /** Global auto-close duration in ms, or false to disable */
6
+ autoClose: number | false;
7
+ /** Whether the timer is currently paused */
8
+ paused: boolean;
9
+ };
10
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
+ hide: (id: string) => any;
12
+ hoverStart: () => any;
13
+ hoverEnd: () => any;
14
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
15
+ onHide?: ((id: string) => any) | undefined;
16
+ onHoverStart?: (() => any) | undefined;
17
+ onHoverEnd?: (() => any) | undefined;
18
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
+ declare const _default: typeof __VLS_export;
20
+ export default _default;
@@ -0,0 +1,22 @@
1
+ import type { Classes } from '@nui/types';
2
+ import type { NotificationPosition } from './types.js';
3
+ export interface NotificationProviderProps {
4
+ /** Default notification position @default 'bottom-right' */
5
+ position?: NotificationPosition;
6
+ /** Auto-close in ms, or `false` to disable @default 4000 */
7
+ autoClose?: number | false;
8
+ /** Max visible at once @default 5 */
9
+ limit?: number;
10
+ /** Viewport z-index @default 1 */
11
+ zIndex?: number | string;
12
+ /** Container width @default 440 */
13
+ containerWidth?: number | string;
14
+ /** Transition duration in ms @default 250 */
15
+ transitionDuration?: number;
16
+ /** Which notifications pause auto-close on hover @default 'all' */
17
+ pauseOnHover?: 'all' | 'notification';
18
+ classes?: Classes<'root' | 'notification'>;
19
+ }
20
+ declare const __VLS_export: import("vue").DefineComponent<NotificationProviderProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NotificationProviderProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
+ declare const _default: typeof __VLS_export;
22
+ export default _default;