mood-ui 0.8.1 → 0.9.0

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.
@@ -43,20 +43,60 @@ declare var __VLS_8: {
43
43
  toggleCollapsed: typeof toggleCollapsed;
44
44
  isMobile: boolean;
45
45
  closeMobile: typeof closeMobile;
46
- }, __VLS_28: {}, __VLS_30: {}, __VLS_50: {
46
+ }, __VLS_28: {}, __VLS_30: {}, __VLS_32: {}, __VLS_34: {
47
+ toggleCollapsed: typeof toggleCollapsed;
48
+ collapsed: boolean;
49
+ }, __VLS_36: {}, __VLS_38: {
50
+ collapsed: boolean;
51
+ toggleCollapsed: typeof toggleCollapsed;
52
+ isMobile: boolean;
53
+ closeMobile: typeof closeMobile;
54
+ }, __VLS_40: {
55
+ collapsed: boolean;
56
+ toggleCollapsed: typeof toggleCollapsed;
57
+ isMobile: boolean;
58
+ closeMobile: typeof closeMobile;
59
+ }, __VLS_42: {
60
+ collapsed: boolean;
61
+ toggleCollapsed: typeof toggleCollapsed;
62
+ isMobile: boolean;
63
+ closeMobile: typeof closeMobile;
64
+ }, __VLS_44: {
65
+ collapsed: boolean;
66
+ mobileOpen: boolean;
67
+ toggleSidebar: typeof toggleSidebar;
68
+ toggleCollapsed: typeof toggleCollapsed;
69
+ openMobile: typeof openMobile;
70
+ closeMobile: typeof closeMobile;
71
+ }, __VLS_46: {
72
+ collapsed: boolean;
73
+ toggleCollapsed: typeof toggleCollapsed;
74
+ isMobile: boolean;
75
+ closeMobile: typeof closeMobile;
76
+ }, __VLS_48: {
47
77
  collapsed: boolean;
48
78
  toggleCollapsed: typeof toggleCollapsed;
49
79
  isMobile: boolean;
50
80
  closeMobile: typeof closeMobile;
51
- }, __VLS_52: {
81
+ }, __VLS_50: {
52
82
  collapsed: boolean;
53
83
  toggleCollapsed: typeof toggleCollapsed;
54
84
  isMobile: boolean;
55
85
  closeMobile: typeof closeMobile;
56
- }, __VLS_54: {
86
+ }, __VLS_52: {}, __VLS_54: {}, __VLS_74: {
57
87
  collapsed: boolean;
58
88
  toggleCollapsed: typeof toggleCollapsed;
59
- }, __VLS_56: {
89
+ isMobile: boolean;
90
+ closeMobile: typeof closeMobile;
91
+ }, __VLS_76: {
92
+ collapsed: boolean;
93
+ toggleCollapsed: typeof toggleCollapsed;
94
+ isMobile: boolean;
95
+ closeMobile: typeof closeMobile;
96
+ }, __VLS_78: {
97
+ collapsed: boolean;
98
+ toggleCollapsed: typeof toggleCollapsed;
99
+ }, __VLS_80: {
60
100
  collapsed: boolean;
61
101
  toggleCollapsed: typeof toggleCollapsed;
62
102
  isMobile: boolean;
@@ -87,13 +127,37 @@ type __VLS_Slots = {} & {
87
127
  } & {
88
128
  footer?: (props: typeof __VLS_30) => any;
89
129
  } & {
90
- 'sidebar-header'?: (props: typeof __VLS_50) => any;
130
+ 'rail-header'?: (props: typeof __VLS_32) => any;
131
+ } & {
132
+ rail?: (props: typeof __VLS_34) => any;
133
+ } & {
134
+ 'rail-footer'?: (props: typeof __VLS_36) => any;
135
+ } & {
136
+ 'sidebar-header'?: (props: typeof __VLS_38) => any;
137
+ } & {
138
+ sidebar?: (props: typeof __VLS_40) => any;
139
+ } & {
140
+ 'sidebar-footer'?: (props: typeof __VLS_42) => any;
141
+ } & {
142
+ topbar?: (props: typeof __VLS_44) => any;
143
+ } & {
144
+ 'sidebar-header'?: (props: typeof __VLS_46) => any;
145
+ } & {
146
+ sidebar?: (props: typeof __VLS_48) => any;
147
+ } & {
148
+ 'sidebar-footer'?: (props: typeof __VLS_50) => any;
149
+ } & {
150
+ default?: (props: typeof __VLS_52) => any;
151
+ } & {
152
+ footer?: (props: typeof __VLS_54) => any;
153
+ } & {
154
+ 'sidebar-header'?: (props: typeof __VLS_74) => any;
91
155
  } & {
92
- sidebar?: (props: typeof __VLS_52) => any;
156
+ sidebar?: (props: typeof __VLS_76) => any;
93
157
  } & {
94
- rail?: (props: typeof __VLS_54) => any;
158
+ rail?: (props: typeof __VLS_78) => any;
95
159
  } & {
96
- 'sidebar-footer'?: (props: typeof __VLS_56) => any;
160
+ 'sidebar-footer'?: (props: typeof __VLS_80) => any;
97
161
  };
98
162
  declare const __VLS_base: import('vue').DefineComponent<AppShell, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
99
163
  "update:collapsed": (value: boolean) => any;
@@ -117,6 +181,7 @@ declare const __VLS_base: import('vue').DefineComponent<AppShell, {}, {}, {}, {}
117
181
  stickySidebar: boolean;
118
182
  divider: boolean;
119
183
  mainPadding: "none" | "small" | "medium" | "large";
184
+ topbarSpan: "full" | "content";
120
185
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
121
186
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
122
187
  declare const _default: typeof __VLS_export;
@@ -16,9 +16,11 @@ type __VLS_Slots = {} & {
16
16
  };
17
17
  declare const __VLS_base: import('vue').DefineComponent<Sidebar, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
18
18
  select: (item: SidebarItem) => any;
19
+ "update:collapsed": (value: boolean) => any;
19
20
  "update:activeId": (value: string | number | null) => any;
20
21
  }, string, import('vue').PublicProps, Readonly<Sidebar> & Readonly<{
21
22
  onSelect?: ((item: SidebarItem) => any) | undefined;
23
+ "onUpdate:collapsed"?: ((value: boolean) => any) | undefined;
22
24
  "onUpdate:activeId"?: ((value: string | number | null) => any) | undefined;
23
25
  }>, {
24
26
  as: string;
@@ -28,6 +30,8 @@ declare const __VLS_base: import('vue').DefineComponent<Sidebar, {}, {}, {}, {},
28
30
  activeVariant: "tonal" | "solid" | "bar";
29
31
  barSide: "start" | "end";
30
32
  dividers: boolean;
33
+ showToggle: boolean;
34
+ toggleSide: "start" | "end";
31
35
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
32
36
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
33
37
  declare const _default: typeof __VLS_export;
@@ -0,0 +1,62 @@
1
+ import { Switcher as SwitcherProps, SwitcherItem, SwitcherValue } from '../../interfaces/navigation/Switcher.interface';
2
+ declare function onTriggerClick(): void;
3
+ declare var __VLS_1: {
4
+ activeItem: SwitcherItem | null;
5
+ isOpen: boolean;
6
+ toggle: typeof onTriggerClick;
7
+ }, __VLS_31: {}, __VLS_38: {}, __VLS_50: {
8
+ item: SwitcherItem;
9
+ active: boolean;
10
+ close: () => void;
11
+ }, __VLS_57: {
12
+ close: () => void;
13
+ };
14
+ type __VLS_Slots = {} & {
15
+ trigger?: (props: typeof __VLS_1) => any;
16
+ } & {
17
+ loading?: (props: typeof __VLS_31) => any;
18
+ } & {
19
+ empty?: (props: typeof __VLS_38) => any;
20
+ } & {
21
+ 'item-trailing'?: (props: typeof __VLS_50) => any;
22
+ } & {
23
+ footer?: (props: typeof __VLS_57) => any;
24
+ };
25
+ declare const __VLS_base: import('vue').DefineComponent<SwitcherProps, {
26
+ open: () => void;
27
+ close: () => void;
28
+ toggle: () => void;
29
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
30
+ change: (value: SwitcherValue | null, item: SwitcherItem | null) => any;
31
+ search: (query: string) => any;
32
+ close: () => any;
33
+ "update:modelValue": (value: SwitcherValue | null) => any;
34
+ open: () => any;
35
+ }, string, import('vue').PublicProps, Readonly<SwitcherProps> & Readonly<{
36
+ onChange?: ((value: SwitcherValue | null, item: SwitcherItem | null) => any) | undefined;
37
+ onSearch?: ((query: string) => any) | undefined;
38
+ onClose?: (() => any) | undefined;
39
+ "onUpdate:modelValue"?: ((value: SwitcherValue | null) => any) | undefined;
40
+ onOpen?: (() => any) | undefined;
41
+ }>, {
42
+ placement: import('../..').PopoverPlacement;
43
+ fullWidth: boolean;
44
+ disabled: boolean;
45
+ loading: boolean;
46
+ modelValue: SwitcherValue | null;
47
+ searchable: boolean;
48
+ panelWidth: "trigger" | "auto";
49
+ panelMinWidth: number | string;
50
+ chevron: "updown" | "down" | "none";
51
+ triggerVariant: "outline" | "ghost" | "filled";
52
+ compactTrigger: boolean;
53
+ panelMaxHeight: number | string;
54
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
55
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
56
+ declare const _default: typeof __VLS_export;
57
+ export default _default;
58
+ type __VLS_WithSlots<T, S> = T & {
59
+ new (): {
60
+ $slots: S;
61
+ };
62
+ };
@@ -11,18 +11,18 @@
11
11
  export type ColorMode = "light" | "dark" | "system";
12
12
  export interface ColorModeOptions {
13
13
  /**
14
- * Class name added to `<html>` when the resolved mode is `'dark'`.
15
- * Defaults to `'dark'` (the convention Tailwind v4 uses out of the box).
14
+ * Additional class to toggle on `<html>` when the resolved mode is
15
+ * `'dark'`. The lib **always** toggles its own internal `'dark'`
16
+ * class as well — its compiled CSS (Tailwind v4 `dark:` variants)
17
+ * is keyed off `.dark` and cannot work without it. Use this option
18
+ * when your application's CSS keys off a different class, e.g.
19
+ * `useColorMode({ darkClass: 'appdark' })`. With that call, `<html>`
20
+ * will carry both `appdark` (for your rules) and `dark` (for the
21
+ * lib's rules) whenever the resolved mode is dark.
16
22
  *
17
- * Override it when your app's CSS already keys off a custom class
18
- * — e.g. `useColorMode({ darkClass: 'appdark' })`. Calling this with
19
- * a new value swaps the class on `<html>` immediately, so existing
20
- * dark-mode rules keep firing.
21
- *
22
- * Note: mood-ui's own dark-mode CSS is compiled against `.dark`. If
23
- * you need both your `appdark` selectors AND the lib's dark variants
24
- * to work, configure Tailwind so `dark:` resolves to your custom
25
- * selector, or keep both classes in sync via `darkClassExtras`.
23
+ * Calling this with a new value swaps the previous extra class for
24
+ * the new one immediately; the lib's internal `dark` is never
25
+ * removed.
26
26
  */
27
27
  darkClass?: string;
28
28
  }
@@ -0,0 +1,10 @@
1
+ import { Ref } from 'vue';
2
+ /**
3
+ * Reactive ref backed by localStorage.
4
+ *
5
+ * - Reads the stored value on mount (falls back to `defaultValue` on parse errors).
6
+ * - Writes back on every change (deep watch for objects/arrays).
7
+ * - SSR-safe: on the server it returns a `defaultValue`-backed ref and never
8
+ * touches storage (avoids Node's experimental global `localStorage`).
9
+ */
10
+ export declare function useLocalStorage<T>(key: string, defaultValue: T): Ref<T>;
@@ -241,6 +241,20 @@ export interface ModoLocale {
241
241
  invalid: string;
242
242
  };
243
243
  };
244
+ switcher: {
245
+ /** Default aria-label for the trigger when no `ariaLabel` prop is passed. */
246
+ ariaLabel: string;
247
+ /** Trigger primary text when no item matches `modelValue`. */
248
+ placeholder: string;
249
+ /** Search input placeholder when `searchable=true`. */
250
+ searchPlaceholder: string;
251
+ /** Shown inside the panel when `items.length === 0`. */
252
+ empty: string;
253
+ /** Shown inside the panel when the search query matches no items. */
254
+ noResults: string;
255
+ /** Visually hidden text appended to the active item for screen readers. */
256
+ activeItemSr: string;
257
+ };
244
258
  }
245
259
  /** Default locale (English). Serves as the non-breaking fallback. */
246
260
  export declare const defaultLocale: ModoLocale;
@@ -9,6 +9,7 @@ export { useColorMode, configureColorMode, resolveColorMode, type ColorMode, typ
9
9
  export { useToast, useToastQueue } from './composables/useToast';
10
10
  export { useConfirm, useConfirmQueue } from './composables/useConfirm';
11
11
  export { useLocale } from './composables/useLocale';
12
+ export { useLocalStorage } from './composables/useLocalStorage';
12
13
  export { useAutoScroll, type UseAutoScrollInput, } from './composables/useAutoScroll';
13
14
  export { usePopover, type UsePopoverOptions, type PopoverPlacement, type PopoverPosition, } from './composables/usePopover';
14
15
  export { useCalendar, isSameDay, startOfDay, type CalendarDay, type UseCalendarOptions, } from './composables/useCalendar';
@@ -77,6 +78,7 @@ export { default as Breadcrumbs } from './components/navigation/Breadcrumbs.vue'
77
78
  export { default as DropdownMenu } from './components/navigation/DropdownMenu.vue';
78
79
  export { default as Pagination } from './components/navigation/Pagination.vue';
79
80
  export { default as Stepper } from './components/navigation/Stepper.vue';
81
+ export { default as Switcher } from './components/navigation/Switcher.vue';
80
82
  export { default as Card } from './components/data-display/Card.vue';
81
83
  export { default as Typography } from './components/data-display/Typography.vue';
82
84
  export { default as Avatar } from './components/data-display/avatar/Avatar.vue';
@@ -149,6 +151,7 @@ export type * from './interfaces/navigation/Breadcrumbs.interface';
149
151
  export type * from './interfaces/navigation/DropdownMenu.interface';
150
152
  export type * from './interfaces/navigation/Pagination.interface';
151
153
  export type * from './interfaces/navigation/Stepper.interface';
154
+ export type * from './interfaces/navigation/Switcher.interface';
152
155
  export type * from './interfaces/data-display/Card.interface';
153
156
  export type * from './interfaces/data-display/Typography.interface';
154
157
  export type * from './interfaces/data-display/Kbd.interface';
@@ -53,4 +53,12 @@ export interface AppShell {
53
53
  radius?: 'none' | 'small' | 'medium' | 'large' | 'full';
54
54
  /** Accessible label for the mobile navigation drawer (dialog). */
55
55
  drawerAriaLabel?: string;
56
+ /**
57
+ * Controls how far the topbar spans horizontally.
58
+ * - `'full'` — topbar covers the entire shell width (default, current behaviour).
59
+ * - `'content'` — sidebar extends to full height; topbar only covers the main
60
+ * content column. Produces the Linear / Notion sidebar-first layout.
61
+ * @default 'full'
62
+ */
63
+ topbarSpan?: 'full' | 'content';
56
64
  }
@@ -85,4 +85,17 @@ export interface Sidebar {
85
85
  * @default true
86
86
  */
87
87
  dividers?: boolean;
88
+ /**
89
+ * Render a built-in circular chevron button that toggles `collapsed`.
90
+ * The button is positioned `absolute` and overflows the sidebar edge by 12 px.
91
+ * Requires the sidebar container to NOT have `overflow: hidden`.
92
+ * @default false
93
+ */
94
+ showToggle?: boolean;
95
+ /**
96
+ * Which edge the toggle button appears on.
97
+ * Use `'end'` (default) for a left-side sidebar, `'start'` for a right-side sidebar.
98
+ * @default 'end'
99
+ */
100
+ toggleSide?: 'start' | 'end';
88
101
  }
@@ -0,0 +1,55 @@
1
+ import { Component } from 'vue';
2
+ import { ModoColor, ModoRadius, ModoSize } from '../../config/ModoConfig';
3
+ import { PopoverPlacement } from '../../composables/usePopover';
4
+ export type SwitcherValue = string | number;
5
+ export interface SwitcherItem {
6
+ /** Unique identifier used by v-model and keyed rendering. */
7
+ value: SwitcherValue;
8
+ /** Primary line (bold). */
9
+ title: string;
10
+ /** Secondary line (muted color). Optional. */
11
+ subtitle?: string;
12
+ /**
13
+ * Visual at the left of the item. Use ONLY ONE of `icon` or `avatar`.
14
+ * If both are set, `avatar` wins and a dev-only warning is logged.
15
+ */
16
+ icon?: Component;
17
+ avatar?: {
18
+ src?: string;
19
+ initials?: string;
20
+ };
21
+ /** Non-selectable (no click, no focus, reduced opacity). */
22
+ disabled?: boolean;
23
+ }
24
+ export interface Switcher {
25
+ modelValue?: SwitcherValue | null;
26
+ items: SwitcherItem[];
27
+ placeholder?: string;
28
+ compactTrigger?: boolean;
29
+ chevron?: "updown" | "down" | "none";
30
+ triggerVariant?: "outline" | "ghost" | "filled";
31
+ fullWidth?: boolean;
32
+ panelTitle?: string;
33
+ panelWidth?: "trigger" | "auto";
34
+ panelMinWidth?: number | string;
35
+ panelMaxHeight?: number | string;
36
+ placement?: PopoverPlacement;
37
+ searchable?: boolean;
38
+ searchPlaceholder?: string;
39
+ searchFields?: Array<"title" | "subtitle">;
40
+ noResultsText?: string;
41
+ loading?: boolean;
42
+ emptyText?: string;
43
+ disabled?: boolean;
44
+ color?: ModoColor;
45
+ radius?: ModoRadius;
46
+ size?: ModoSize;
47
+ ariaLabel?: string;
48
+ }
49
+ export type SwitcherEmits = {
50
+ "update:modelValue": [value: SwitcherValue | null];
51
+ change: [value: SwitcherValue | null, item: SwitcherItem | null];
52
+ open: [];
53
+ close: [];
54
+ search: [query: string];
55
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mood-ui",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "description": "Vue 3 component library with full theming, dark mode, palettes, calendar, scheduler, table and AppShell.",
5
5
  "type": "module",
6
6
  "license": "MIT",