@juxtui/ui 0.1.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.
Files changed (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +62 -0
  3. package/dist/components/avatar/JAvatar.vue.d.ts +26 -0
  4. package/dist/components/badge/JBadge.vue.d.ts +26 -0
  5. package/dist/components/button/JButton.vue.d.ts +37 -0
  6. package/dist/components/card/JCard.vue.d.ts +29 -0
  7. package/dist/components/checkbox/JCheckbox.vue.d.ts +36 -0
  8. package/dist/components/command-palette/JCommandPalette.vue.d.ts +81 -0
  9. package/dist/components/command-palette/search.d.ts +16 -0
  10. package/dist/components/dialog/JDialog.vue.d.ts +53 -0
  11. package/dist/components/dropdown-menu/JDropdownMenu.vue.d.ts +39 -0
  12. package/dist/components/dropdown-menu/JDropdownMenuItem.vue.d.ts +35 -0
  13. package/dist/components/dropdown-menu/JDropdownMenuLabel.vue.d.ts +12 -0
  14. package/dist/components/dropdown-menu/JDropdownMenuSeparator.vue.d.ts +3 -0
  15. package/dist/components/dropdown-menu/JDropdownMenuSub.vue.d.ts +17 -0
  16. package/dist/components/dropdown-menu/JMenuContent.vue.d.ts +44 -0
  17. package/dist/components/dropdown-menu/context.d.ts +17 -0
  18. package/dist/components/field/JFieldShell.vue.d.ts +33 -0
  19. package/dist/components/field/useField.d.ts +24 -0
  20. package/dist/components/input/JInput.vue.d.ts +42 -0
  21. package/dist/components/primitives/JPortal.vue.d.ts +17 -0
  22. package/dist/components/primitives/JSlot.d.ts +8 -0
  23. package/dist/components/select/JSelect.vue.d.ts +53 -0
  24. package/dist/components/switch/JSwitch.vue.d.ts +37 -0
  25. package/dist/components/tabs/JTabs.vue.d.ts +48 -0
  26. package/dist/components/textarea/JTextarea.vue.d.ts +38 -0
  27. package/dist/components/toast/JToastItem.vue.d.ts +13 -0
  28. package/dist/components/toast/JToaster.vue.d.ts +18 -0
  29. package/dist/components/tooltip/JTooltip.vue.d.ts +24 -0
  30. package/dist/components.d.ts +19 -0
  31. package/dist/composables/useFloating.d.ts +28 -0
  32. package/dist/composables/useFocusTrap.d.ts +12 -0
  33. package/dist/composables/useHotkey.d.ts +10 -0
  34. package/dist/composables/useLayer.d.ts +13 -0
  35. package/dist/composables/useRecentCommands.d.ts +19 -0
  36. package/dist/composables/useScrollLock.d.ts +3 -0
  37. package/dist/composables/useToast.d.ts +93 -0
  38. package/dist/composables/useTypeahead.d.ts +8 -0
  39. package/dist/icons.d.ts +18 -0
  40. package/dist/index.d.ts +30 -0
  41. package/dist/index.js +3486 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/nuxt.d.ts +13 -0
  44. package/dist/nuxt.js +61 -0
  45. package/dist/nuxt.js.map +1 -0
  46. package/dist/plugin.d.ts +9 -0
  47. package/dist/style.css +2463 -0
  48. package/dist/tailwind.css +74 -0
  49. package/dist/tokens.css +237 -0
  50. package/dist/utils/dom.d.ts +10 -0
  51. package/package.json +68 -0
@@ -0,0 +1,42 @@
1
+ import type { FieldProps } from '../field/useField';
2
+ export type InputSize = 'sm' | 'md' | 'lg';
3
+ export interface InputProps extends FieldProps {
4
+ type?: string;
5
+ placeholder?: string;
6
+ size?: InputSize;
7
+ readonly?: boolean;
8
+ name?: string;
9
+ autocomplete?: string;
10
+ }
11
+ type __VLS_Props = InputProps;
12
+ type __VLS_Slots = {
13
+ leading?: () => unknown;
14
+ trailing?: () => unknown;
15
+ label?: () => unknown;
16
+ };
17
+ type __VLS_ModelProps = {
18
+ modelValue?: string | number | null;
19
+ };
20
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
21
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
22
+ /** The underlying `<input>` element. */
23
+ input: import("vue").Ref<HTMLInputElement | null, HTMLInputElement | null>;
24
+ focus: () => void | undefined;
25
+ select: () => void | undefined;
26
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
27
+ "update:modelValue": (value: string | number | null) => any;
28
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
29
+ "onUpdate:modelValue"?: ((value: string | number | null) => any) | undefined;
30
+ }>, {
31
+ size: InputSize;
32
+ error: string | boolean;
33
+ type: string;
34
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
35
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
36
+ declare const _default: typeof __VLS_export;
37
+ export default _default;
38
+ type __VLS_WithSlots<T, S> = T & {
39
+ new (): {
40
+ $slots: S;
41
+ };
42
+ };
@@ -0,0 +1,17 @@
1
+ type __VLS_Props = {
2
+ to?: string;
3
+ };
4
+ type __VLS_Slots = {
5
+ default?: () => unknown;
6
+ };
7
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
8
+ to: string;
9
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
11
+ declare const _default: typeof __VLS_export;
12
+ export default _default;
13
+ type __VLS_WithSlots<T, S> = T & {
14
+ new (): {
15
+ $slots: S;
16
+ };
17
+ };
@@ -0,0 +1,8 @@
1
+ import type { VNode } from 'vue';
2
+ /**
3
+ * Internal: renders its first child element and merges its own attributes
4
+ * (ARIA, listeners, ids) onto it — no wrapper element.
5
+ */
6
+ export declare const JSlot: import("vue").DefineComponent<{}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
7
+ [key: string]: any;
8
+ }> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,53 @@
1
+ import type { FieldProps } from '../field/useField';
2
+ export interface SelectOption<V = string | number> {
3
+ value: V;
4
+ label: string;
5
+ description?: string;
6
+ disabled?: boolean;
7
+ }
8
+ export interface SelectProps<V> extends FieldProps {
9
+ /** Options as objects, or plain strings when value and label are the same. */
10
+ options: Array<SelectOption<V> | V>;
11
+ placeholder?: string;
12
+ size?: 'sm' | 'md' | 'lg';
13
+ /** Submits the value under this name in a form. */
14
+ name?: string;
15
+ }
16
+ declare const __VLS_export: <T extends string | number = string>(__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<{
17
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<(SelectProps<T> & {
18
+ modelValue?: T | null;
19
+ }) & {
20
+ onClose?: (() => any) | undefined;
21
+ "onUpdate:modelValue"?: ((value: T | null) => any) | undefined;
22
+ onOpen?: (() => any) | undefined;
23
+ }> & (typeof globalThis extends {
24
+ __VLS_PROPS_FALLBACK: infer P;
25
+ } ? P : {});
26
+ expose: (exposed: import("vue").ShallowUnwrapRef<{
27
+ focus: () => void | undefined;
28
+ open: () => void;
29
+ close: () => void;
30
+ }>) => void;
31
+ attrs: any;
32
+ slots: {
33
+ option?: (props: {
34
+ option: SelectOption<T>;
35
+ selected: boolean;
36
+ active: boolean;
37
+ }) => unknown;
38
+ value?: (props: {
39
+ option: SelectOption<T>;
40
+ }) => unknown;
41
+ label?: () => unknown;
42
+ };
43
+ emit: (((evt: "close") => void) & ((evt: "open") => void)) & ((event: "update:modelValue", value: T | null) => void);
44
+ }>) => import("vue").VNode & {
45
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
46
+ };
47
+ declare const _default: typeof __VLS_export;
48
+ export default _default;
49
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
50
+ [K in keyof T]: T[K];
51
+ } : {
52
+ [K in keyof T as K]: T[K];
53
+ }) & {};
@@ -0,0 +1,37 @@
1
+ export interface SwitchProps {
2
+ label?: string;
3
+ description?: string;
4
+ disabled?: boolean;
5
+ size?: 'sm' | 'md';
6
+ /** Submits `value` under `name` in a form when on. */
7
+ name?: string;
8
+ value?: string;
9
+ id?: string;
10
+ }
11
+ type __VLS_Props = SwitchProps;
12
+ type __VLS_Slots = {
13
+ default?: () => unknown;
14
+ description?: () => unknown;
15
+ };
16
+ type __VLS_ModelProps = {
17
+ modelValue?: boolean;
18
+ };
19
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
20
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
21
+ focus: () => void | undefined;
22
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
23
+ "update:modelValue": (value: boolean) => any;
24
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
25
+ "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
26
+ }>, {
27
+ size: "sm" | "md";
28
+ value: string;
29
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
31
+ declare const _default: typeof __VLS_export;
32
+ export default _default;
33
+ type __VLS_WithSlots<T, S> = T & {
34
+ new (): {
35
+ $slots: S;
36
+ };
37
+ };
@@ -0,0 +1,48 @@
1
+ export interface TabItem {
2
+ value: string;
3
+ label: string;
4
+ disabled?: boolean;
5
+ }
6
+ export interface TabsProps {
7
+ items: TabItem[];
8
+ /** `line` for page sections, `pill` for compact view switches. */
9
+ variant?: 'line' | 'pill';
10
+ size?: 'sm' | 'md';
11
+ /** Accessible name for the tab list. */
12
+ label?: string;
13
+ /** Stretch tabs to fill the width. */
14
+ fill?: boolean;
15
+ }
16
+ type __VLS_Props = TabsProps;
17
+ type __VLS_Slots = {
18
+ /** Custom tab label. */
19
+ tab?: (props: {
20
+ item: TabItem;
21
+ selected: boolean;
22
+ }) => unknown;
23
+ /** Panels are named after each item's `value`. */
24
+ [value: string]: ((props: {
25
+ item: TabItem;
26
+ selected: boolean;
27
+ }) => unknown) | undefined;
28
+ };
29
+ type __VLS_ModelProps = {
30
+ modelValue?: string;
31
+ };
32
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
33
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
34
+ "update:modelValue": (value: string | undefined) => any;
35
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
36
+ "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
37
+ }>, {
38
+ size: "sm" | "md";
39
+ variant: "line" | "pill";
40
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
41
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
42
+ declare const _default: typeof __VLS_export;
43
+ export default _default;
44
+ type __VLS_WithSlots<T, S> = T & {
45
+ new (): {
46
+ $slots: S;
47
+ };
48
+ };
@@ -0,0 +1,38 @@
1
+ import type { FieldProps } from '../field/useField';
2
+ export interface TextareaProps extends FieldProps {
3
+ placeholder?: string;
4
+ rows?: number;
5
+ /** Grow with the content, up to `maxRows`. */
6
+ autoresize?: boolean;
7
+ maxRows?: number;
8
+ readonly?: boolean;
9
+ name?: string;
10
+ }
11
+ type __VLS_Props = TextareaProps;
12
+ type __VLS_Slots = {
13
+ label?: () => unknown;
14
+ };
15
+ type __VLS_ModelProps = {
16
+ modelValue?: string | null;
17
+ };
18
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
19
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
20
+ textarea: import("vue").Ref<HTMLTextAreaElement | null, HTMLTextAreaElement | null>;
21
+ focus: () => void | undefined;
22
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
23
+ "update:modelValue": (value: string | null) => any;
24
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
25
+ "onUpdate:modelValue"?: ((value: string | null) => any) | undefined;
26
+ }>, {
27
+ error: string | boolean;
28
+ rows: number;
29
+ maxRows: number;
30
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
31
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
32
+ declare const _default: typeof __VLS_export;
33
+ export default _default;
34
+ type __VLS_WithSlots<T, S> = T & {
35
+ new (): {
36
+ $slots: S;
37
+ };
38
+ };
@@ -0,0 +1,13 @@
1
+ /** Internal: one toast. Owns its timer, swipe gesture and keyboard dismissal. */
2
+ import type { Toast } from '../../composables/useToast';
3
+ type __VLS_Props = {
4
+ toast: Toast;
5
+ paused: boolean;
6
+ };
7
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
+ dismiss: (id: string) => any;
9
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
10
+ onDismiss?: ((id: string) => any) | undefined;
11
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
@@ -0,0 +1,18 @@
1
+ export type ToasterPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
2
+ export interface ToasterProps {
3
+ position?: ToasterPosition;
4
+ /** How many toasts are visible at once. Extra toasts wait their turn. */
5
+ max?: number;
6
+ /** Shortcut that moves focus to the newest toast. */
7
+ hotkey?: string;
8
+ /** Accessible name for the notification region. */
9
+ label?: string;
10
+ }
11
+ declare const __VLS_export: import("vue").DefineComponent<ToasterProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ToasterProps> & Readonly<{}>, {
12
+ label: string;
13
+ hotkey: string;
14
+ position: ToasterPosition;
15
+ max: number;
16
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
+ declare const _default: typeof __VLS_export;
18
+ export default _default;
@@ -0,0 +1,24 @@
1
+ export interface TooltipProps {
2
+ /** Tooltip text. Use the `content` slot for richer content. */
3
+ content?: string;
4
+ side?: 'top' | 'right' | 'bottom' | 'left';
5
+ align?: 'start' | 'center' | 'end';
6
+ /** Hover delay before opening, in ms. Keyboard focus opens immediately. */
7
+ delay?: number;
8
+ disabled?: boolean;
9
+ }
10
+ declare const _default: typeof __VLS_export;
11
+ export default _default;
12
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<TooltipProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TooltipProps> & Readonly<{}>, {
13
+ align: "start" | "center" | "end";
14
+ side: "top" | "right" | "bottom" | "left";
15
+ delay: number;
16
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
17
+ default?: () => unknown;
18
+ content?: () => unknown;
19
+ }>;
20
+ type __VLS_WithSlots<T, S> = T & {
21
+ new (): {
22
+ $slots: S;
23
+ };
24
+ };
@@ -0,0 +1,19 @@
1
+ export { default as JAvatar } from './components/avatar/JAvatar.vue';
2
+ export { default as JBadge } from './components/badge/JBadge.vue';
3
+ export { default as JButton } from './components/button/JButton.vue';
4
+ export { default as JCard } from './components/card/JCard.vue';
5
+ export { default as JCheckbox } from './components/checkbox/JCheckbox.vue';
6
+ export { default as JCommandPalette } from './components/command-palette/JCommandPalette.vue';
7
+ export { default as JDialog } from './components/dialog/JDialog.vue';
8
+ export { default as JDropdownMenu } from './components/dropdown-menu/JDropdownMenu.vue';
9
+ export { default as JDropdownMenuItem } from './components/dropdown-menu/JDropdownMenuItem.vue';
10
+ export { default as JDropdownMenuLabel } from './components/dropdown-menu/JDropdownMenuLabel.vue';
11
+ export { default as JDropdownMenuSeparator } from './components/dropdown-menu/JDropdownMenuSeparator.vue';
12
+ export { default as JDropdownMenuSub } from './components/dropdown-menu/JDropdownMenuSub.vue';
13
+ export { default as JInput } from './components/input/JInput.vue';
14
+ export { default as JSelect } from './components/select/JSelect.vue';
15
+ export { default as JSwitch } from './components/switch/JSwitch.vue';
16
+ export { default as JTabs } from './components/tabs/JTabs.vue';
17
+ export { default as JTextarea } from './components/textarea/JTextarea.vue';
18
+ export { default as JToaster } from './components/toast/JToaster.vue';
19
+ export { default as JTooltip } from './components/tooltip/JTooltip.vue';
@@ -0,0 +1,28 @@
1
+ import type { Placement } from '@floating-ui/dom';
2
+ import type { CSSProperties, Ref } from 'vue';
3
+ export type { Placement };
4
+ export interface FloatingOptions {
5
+ placement?: Placement;
6
+ /** Gap between reference and floating element, in px. */
7
+ offset?: number | {
8
+ mainAxis?: number;
9
+ crossAxis?: number;
10
+ };
11
+ /** Make the floating element at least as wide as the reference. */
12
+ matchWidth?: boolean;
13
+ /** Padding kept from the viewport edge, in px. */
14
+ padding?: number;
15
+ }
16
+ /**
17
+ * Position a floating element next to a reference element and keep it there
18
+ * through scroll and resize. Coordinates are written to `left`/`top` so
19
+ * `transform` stays free for enter/leave motion.
20
+ */
21
+ export declare function useFloating(reference: Ref<HTMLElement | null>, floating: Ref<HTMLElement | null>, options?: FloatingOptions | (() => FloatingOptions)): {
22
+ x: Ref<number, number>;
23
+ y: Ref<number, number>;
24
+ placement: Ref<Placement, Placement>;
25
+ side: import("vue").ComputedRef<"top" | "right" | "bottom" | "left">;
26
+ styles: import("vue").ComputedRef<CSSProperties>;
27
+ update: () => Promise<void>;
28
+ };
@@ -0,0 +1,12 @@
1
+ import type { Ref } from 'vue';
2
+ export interface FocusTrapOptions {
3
+ /** Element to focus when the trap activates. Falls back to the first focusable element, then the container. */
4
+ initialFocus?: () => HTMLElement | null | undefined;
5
+ /** Return focus to whatever was focused before activation. Defaults to true. */
6
+ restoreFocus?: boolean;
7
+ }
8
+ /**
9
+ * Keep keyboard focus inside `container` while `active` is true, and put it
10
+ * back where it came from afterwards.
11
+ */
12
+ export declare function useFocusTrap(container: Ref<HTMLElement | null>, active: Ref<boolean>, options?: FocusTrapOptions): void;
@@ -0,0 +1,10 @@
1
+ import type { MaybeRefOrGetter } from 'vue';
2
+ /**
3
+ * Parse a shortcut such as `mod+k`, `shift+/` or `alt+t`.
4
+ * `mod` is ⌘ on Apple platforms and Ctrl elsewhere.
5
+ */
6
+ export declare function matchesHotkey(event: KeyboardEvent, hotkey: string): boolean;
7
+ /** Human-readable parts of a shortcut, e.g. `mod+k` → `['⌘', 'K']`. */
8
+ export declare function formatHotkey(hotkey: string): string[];
9
+ /** Run `handler` whenever the shortcut is pressed anywhere on the page. */
10
+ export declare function useHotkey(hotkey: MaybeRefOrGetter<string | false | undefined>, handler: (event: KeyboardEvent) => void): void;
@@ -0,0 +1,13 @@
1
+ import type { Ref } from 'vue';
2
+ export interface LayerOptions {
3
+ /** The layer is registered only while this is true. */
4
+ active: Ref<boolean>;
5
+ /** Elements that count as "inside" the layer. */
6
+ elements: () => Array<HTMLElement | null | undefined>;
7
+ onEscape?: (event: KeyboardEvent) => void;
8
+ /** Called when a pointer goes down outside every element of the top-most layer. */
9
+ onPointerDownOutside?: (event: PointerEvent) => void;
10
+ }
11
+ export declare function useLayer(options: LayerOptions): {
12
+ isTopLayer: () => boolean;
13
+ };
@@ -0,0 +1,19 @@
1
+ export interface RecentCommandsOptions {
2
+ /** localStorage key. */
3
+ key?: string;
4
+ /** How many ids to remember. */
5
+ limit?: number;
6
+ }
7
+ /**
8
+ * Remembers which commands were used most recently, per browser.
9
+ * Pair `record(item.id)` in your select handler with `resolve(allItems)`
10
+ * to feed the palette's `recent` prop.
11
+ */
12
+ export declare function useRecentCommands(options?: RecentCommandsOptions): {
13
+ ids: import("vue").Ref<string[], string[]>;
14
+ record: (id: string) => void;
15
+ clear: () => void;
16
+ resolve: <T extends {
17
+ id: string;
18
+ }>(items: T[]) => T[];
19
+ };
@@ -0,0 +1,3 @@
1
+ import type { Ref } from 'vue';
2
+ /** Prevent the page behind an overlay from scrolling while `active` is true. */
3
+ export declare function useScrollLock(active: Ref<boolean>): void;
@@ -0,0 +1,93 @@
1
+ export type ToastType = 'default' | 'success' | 'error' | 'warning' | 'info' | 'loading';
2
+ export interface ToastAction {
3
+ label: string;
4
+ onClick: () => void;
5
+ }
6
+ export interface ToastOptions {
7
+ /** Reuse an id to replace an existing toast instead of stacking a new one. */
8
+ id?: string;
9
+ description?: string;
10
+ type?: ToastType;
11
+ /** Time on screen in ms. `Infinity` keeps it until dismissed. Loading toasts never expire. */
12
+ duration?: number;
13
+ action?: ToastAction;
14
+ /** Show the close button. Defaults to true. */
15
+ dismissible?: boolean;
16
+ onDismiss?: () => void;
17
+ }
18
+ export interface Toast {
19
+ id: string;
20
+ title: string;
21
+ description?: string;
22
+ type: ToastType;
23
+ duration: number;
24
+ action?: ToastAction;
25
+ dismissible: boolean;
26
+ onDismiss?: () => void;
27
+ /** Bumps whenever the toast changes, restarting its timer. */
28
+ version: number;
29
+ }
30
+ export declare const DEFAULT_TOAST_DURATION = 5000;
31
+ declare function update(id: string, patch: Partial<ToastOptions> & {
32
+ title?: string;
33
+ }): void;
34
+ declare function dismiss(id?: string): void;
35
+ type Message<T> = string | ((value: T) => string);
36
+ interface PromiseMessages<T> {
37
+ loading: string;
38
+ success: Message<T>;
39
+ error: Message<unknown>;
40
+ description?: string;
41
+ }
42
+ declare function promise<T>(input: Promise<T> | (() => Promise<T>), messages: PromiseMessages<T>): Promise<T>;
43
+ type Shortcut = (title: string, options?: Omit<ToastOptions, 'type'>) => string;
44
+ export interface ToastFn {
45
+ (title: string, options?: ToastOptions): string;
46
+ success: Shortcut;
47
+ error: Shortcut;
48
+ warning: Shortcut;
49
+ info: Shortcut;
50
+ loading: Shortcut;
51
+ promise: typeof promise;
52
+ update: typeof update;
53
+ dismiss: typeof dismiss;
54
+ }
55
+ /** Show a toast. Works anywhere — inside or outside components. */
56
+ export declare const toast: ToastFn;
57
+ export declare function useToast(): {
58
+ toast: ToastFn;
59
+ dismiss: typeof dismiss;
60
+ update: typeof update;
61
+ toasts: readonly {
62
+ readonly id: string;
63
+ readonly title: string;
64
+ readonly description?: string | undefined;
65
+ readonly type: ToastType;
66
+ readonly duration: number;
67
+ readonly action?: {
68
+ readonly label: string;
69
+ readonly onClick: () => void;
70
+ } | undefined;
71
+ readonly dismissible: boolean;
72
+ readonly onDismiss?: (() => void) | undefined;
73
+ readonly version: number;
74
+ }[];
75
+ };
76
+ /** @internal Mutable access for JToaster and tests. */
77
+ export declare const toastState: {
78
+ toasts: {
79
+ id: string;
80
+ title: string;
81
+ description?: string | undefined;
82
+ type: ToastType;
83
+ duration: number;
84
+ action?: {
85
+ label: string;
86
+ onClick: () => void;
87
+ } | undefined;
88
+ dismissible: boolean;
89
+ onDismiss?: (() => void) | undefined;
90
+ version: number;
91
+ }[];
92
+ };
93
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Type-to-jump for lists. Characters typed in quick succession form a query;
3
+ * repeating the same letter cycles through matches.
4
+ */
5
+ export declare function useTypeahead(timeout?: number): {
6
+ search: <T>(key: string, items: T[], getLabel: (item: T) => string, currentIndex: number) => number;
7
+ isSearching: () => boolean;
8
+ };
@@ -0,0 +1,18 @@
1
+ import type { FunctionalComponent, SVGAttributes } from 'vue';
2
+ type Icon = FunctionalComponent<SVGAttributes>;
3
+ export declare const IconCheck: Icon;
4
+ export declare const IconChevronDown: Icon;
5
+ export declare const IconChevronUpDown: Icon;
6
+ export declare const IconChevronRight: Icon;
7
+ export declare const IconX: Icon;
8
+ export declare const IconSearch: Icon;
9
+ export declare const IconCircleCheck: Icon;
10
+ export declare const IconCircleX: Icon;
11
+ export declare const IconAlert: Icon;
12
+ export declare const IconInfo: Icon;
13
+ export declare const IconCornerDownLeft: Icon;
14
+ /** The loading spinner used across Juxt. A quarter arc over a faint track. */
15
+ export declare const Spinner: FunctionalComponent<{
16
+ size?: number;
17
+ }>;
18
+ export {};
@@ -0,0 +1,30 @@
1
+ import './styles/index.css';
2
+ export * from './components';
3
+ export type { AvatarProps, AvatarStatus } from './components/avatar/JAvatar.vue';
4
+ export type { BadgeProps, BadgeVariant } from './components/badge/JBadge.vue';
5
+ export type { ButtonProps, ButtonSize, ButtonVariant } from './components/button/JButton.vue';
6
+ export type { CardProps } from './components/card/JCard.vue';
7
+ export type { CheckboxProps } from './components/checkbox/JCheckbox.vue';
8
+ export type { CommandGroup, CommandItem, CommandPaletteProps } from './components/command-palette/JCommandPalette.vue';
9
+ export { matchText } from './components/command-palette/search';
10
+ export type { DialogProps } from './components/dialog/JDialog.vue';
11
+ export type { DropdownMenuProps } from './components/dropdown-menu/JDropdownMenu.vue';
12
+ export type { DropdownMenuItemProps } from './components/dropdown-menu/JDropdownMenuItem.vue';
13
+ export type { DropdownMenuSubProps } from './components/dropdown-menu/JDropdownMenuSub.vue';
14
+ export type { FieldProps } from './components/field/useField';
15
+ export type { InputProps, InputSize } from './components/input/JInput.vue';
16
+ export type { SelectOption, SelectProps } from './components/select/JSelect.vue';
17
+ export type { SwitchProps } from './components/switch/JSwitch.vue';
18
+ export type { TabItem, TabsProps } from './components/tabs/JTabs.vue';
19
+ export type { TextareaProps } from './components/textarea/JTextarea.vue';
20
+ export type { ToasterPosition, ToasterProps } from './components/toast/JToaster.vue';
21
+ export type { TooltipProps } from './components/tooltip/JTooltip.vue';
22
+ export { useFocusTrap } from './composables/useFocusTrap';
23
+ export type { FocusTrapOptions } from './composables/useFocusTrap';
24
+ export { formatHotkey, matchesHotkey, useHotkey } from './composables/useHotkey';
25
+ export { useRecentCommands } from './composables/useRecentCommands';
26
+ export type { RecentCommandsOptions } from './composables/useRecentCommands';
27
+ export { useScrollLock } from './composables/useScrollLock';
28
+ export { toast, useToast } from './composables/useToast';
29
+ export type { Toast, ToastAction, ToastFn, ToastOptions, ToastType } from './composables/useToast';
30
+ export { JuxtUI, JuxtUI as default } from './plugin';