@dimasbaguspm/versaur 0.0.57 → 0.0.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/js/desktop-breakpoint-CuSom-sN.js +47 -0
- package/dist/js/feedbacks/index.js +1 -1
- package/dist/js/forms/index.js +1 -1
- package/dist/js/helpers/index.js +14 -0
- package/dist/js/{image-rectangle-K9jmTTED.js → image-rectangle-CCvXv24a.js} +819 -926
- package/dist/js/{index-DOdDlCoL.js → index-BDtz_hQY.js} +520 -802
- package/dist/js/index.js +76 -64
- package/dist/js/jsx-runtime-C5mzlN2N.js +284 -0
- package/dist/js/layouts/index.js +1 -1
- package/dist/js/navigation/index.js +1 -1
- package/dist/js/overlays/index.js +2 -2
- package/dist/js/primitive/index.js +2 -2
- package/dist/js/providers/index.js +1 -1
- package/dist/js/{skeleton-BNZyaRjo.js → skeleton-BRwIW26B.js} +6 -5
- package/dist/js/{snackbar-DH8jCh2V.js → snackbar-CTq4MLir.js} +14 -13
- package/dist/js/{tabs-CmfJNCe6.js → tabs-BQs53hHL.js} +8 -7
- package/dist/js/{time-picker-input-BgbyllDK.js → time-picker-input-Disd231b.js} +24 -23
- package/dist/js/{tooltip-nZW9TUz3.js → tooltip-Dpx3TpR6.js} +211 -205
- package/dist/js/{top-bar-Do2JqSqe.js → top-bar-DEesTo9i.js} +195 -171
- package/dist/js/{use-snackbars-Cou8L41F.js → use-snackbars-B6lnVjrX.js} +14 -13
- package/dist/types/helpers/index.d.ts +1 -0
- package/dist/types/helpers/match-media/built-in/components/desktop-breakpoint.d.ts +18 -0
- package/dist/types/helpers/match-media/built-in/components/index.d.ts +3 -0
- package/dist/types/helpers/match-media/built-in/components/mobile-breakpoint.d.ts +18 -0
- package/dist/types/helpers/match-media/built-in/components/tablet-breakpoint.d.ts +18 -0
- package/dist/types/helpers/match-media/built-in/hooks/index.d.ts +3 -0
- package/dist/types/helpers/match-media/built-in/hooks/use-desktop-breakpoint.d.ts +11 -0
- package/dist/types/helpers/match-media/built-in/hooks/use-mobile-breakpoint.d.ts +11 -0
- package/dist/types/helpers/match-media/built-in/hooks/use-tablet-breakpoint.d.ts +11 -0
- package/dist/types/helpers/match-media/built-in/index.d.ts +2 -0
- package/dist/types/helpers/match-media/constants.d.ts +7 -0
- package/dist/types/helpers/match-media/index.d.ts +4 -0
- package/dist/types/helpers/match-media/match-media.d.ts +25 -0
- package/dist/types/helpers/match-media/test-helpers.d.ts +21 -0
- package/dist/types/helpers/match-media/use-match-media.d.ts +15 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/layouts/page-header/types.d.ts +14 -0
- package/dist/types/overlays/menu/types.d.ts +8 -8
- package/dist/types/primitive/button-menu/types.d.ts +1 -1
- package/dist/types/primitive/button-menu-icon/types.d.ts +1 -1
- package/dist/utils/enforce-subpath-import.js +3 -1
- package/package.json +5 -1
- package/dist/types/overlays/menu/use-menu.d.ts +0 -15
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { S as h } from "./snackbar-
|
|
4
|
-
|
|
1
|
+
import { j as c } from "./jsx-runtime-C5mzlN2N.js";
|
|
2
|
+
import { createContext as p, useState as x, useRef as k, useCallback as l, useEffect as S, useMemo as v, useContext as w } from "react";
|
|
3
|
+
import { S as h } from "./snackbar-CTq4MLir.js";
|
|
4
|
+
import { c as d } from "./index-BDtz_hQY.js";
|
|
5
|
+
const f = p(
|
|
5
6
|
null
|
|
6
7
|
), j = d(
|
|
7
8
|
[
|
|
@@ -20,11 +21,11 @@ const f = x(
|
|
|
20
21
|
}
|
|
21
22
|
}), C = 4e3;
|
|
22
23
|
function E() {
|
|
23
|
-
const [a, o] =
|
|
24
|
+
const [a, o] = x([]), t = k({}), n = l((e) => {
|
|
24
25
|
o((r) => r.filter((s) => s.id !== e)), t.current[e] && (clearTimeout(t.current[e]), delete t.current[e]);
|
|
25
|
-
}, []), i =
|
|
26
|
+
}, []), i = l(
|
|
26
27
|
(e, r, s) => {
|
|
27
|
-
const u = `${Date.now()}-${Math.random()}`,
|
|
28
|
+
const u = `${Date.now()}-${Math.random()}`, m = s?.duration ?? C;
|
|
28
29
|
o((b) => [
|
|
29
30
|
...b,
|
|
30
31
|
{
|
|
@@ -32,11 +33,11 @@ function E() {
|
|
|
32
33
|
color: e,
|
|
33
34
|
message: r,
|
|
34
35
|
...s,
|
|
35
|
-
duration:
|
|
36
|
+
duration: m
|
|
36
37
|
}
|
|
37
38
|
]), t.current[u] = setTimeout(() => {
|
|
38
39
|
n(u);
|
|
39
|
-
},
|
|
40
|
+
}, m);
|
|
40
41
|
},
|
|
41
42
|
[n]
|
|
42
43
|
);
|
|
@@ -44,7 +45,7 @@ function E() {
|
|
|
44
45
|
Object.values(t.current).forEach(clearTimeout), t.current = {};
|
|
45
46
|
}, []), { queue: a, showSnack: i, removeSnack: n };
|
|
46
47
|
}
|
|
47
|
-
const
|
|
48
|
+
const N = ({ children: a }) => {
|
|
48
49
|
const { queue: o, showSnack: t, removeSnack: n } = E(), i = v(() => ({ showSnack: t }), [t]);
|
|
49
50
|
return /* @__PURE__ */ c.jsxs(f.Provider, { value: i, children: [
|
|
50
51
|
a,
|
|
@@ -79,13 +80,13 @@ const V = ({ children: a }) => {
|
|
|
79
80
|
)
|
|
80
81
|
] });
|
|
81
82
|
};
|
|
82
|
-
function
|
|
83
|
+
function $() {
|
|
83
84
|
const a = w(f);
|
|
84
85
|
if (!a)
|
|
85
86
|
throw new Error("useSnackbars must be used within a SnackbarsProvider");
|
|
86
87
|
return a;
|
|
87
88
|
}
|
|
88
89
|
export {
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
N as S,
|
|
91
|
+
$ as u
|
|
91
92
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './match-media';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Props for breakpoint components
|
|
3
|
+
*/
|
|
4
|
+
interface BreakpointComponentProps {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Component that only renders children on desktop viewports
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <DesktopBreakpoint>
|
|
13
|
+
* <DesktopOnlyContent />
|
|
14
|
+
* </DesktopBreakpoint>
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function DesktopBreakpoint({ children }: BreakpointComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Props for breakpoint components
|
|
3
|
+
*/
|
|
4
|
+
interface BreakpointComponentProps {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Component that only renders children on mobile viewports
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <MobileBreakpoint>
|
|
13
|
+
* <MobileOnlyContent />
|
|
14
|
+
* </MobileBreakpoint>
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function MobileBreakpoint({ children }: BreakpointComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Props for breakpoint components
|
|
3
|
+
*/
|
|
4
|
+
interface BreakpointComponentProps {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Component that only renders children on tablet viewports
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <TabletBreakpoint>
|
|
13
|
+
* <TabletOnlyContent />
|
|
14
|
+
* </TabletBreakpoint>
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function TabletBreakpoint({ children }: BreakpointComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to detect if the current viewport is desktop
|
|
3
|
+
*
|
|
4
|
+
* @returns boolean indicating if viewport is desktop (min-width: 1024px)
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* const isDesktop = useDesktopBreakpoint()
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare function useDesktopBreakpoint(): boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to detect if the current viewport is mobile
|
|
3
|
+
*
|
|
4
|
+
* @returns boolean indicating if viewport is mobile (max-width: 767px)
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* const isMobile = useMobileBreakpoint()
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare function useMobileBreakpoint(): boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to detect if the current viewport is tablet
|
|
3
|
+
*
|
|
4
|
+
* @returns boolean indicating if viewport is tablet (768px - 1023px)
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* const isTablet = useTabletBreakpoint()
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare function useTabletBreakpoint(): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard Tailwind breakpoint definitions
|
|
3
|
+
* These align with common Tailwind CSS breakpoints
|
|
4
|
+
*/
|
|
5
|
+
export declare const BREAKPOINT_MOBILE = "(max-width: 767px)";
|
|
6
|
+
export declare const BREAKPOINT_TABLET = "(min-width: 768px) and (max-width: 1023px)";
|
|
7
|
+
export declare const BREAKPOINT_DESKTOP = "(min-width: 1024px)";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Props for MatchMedia component
|
|
3
|
+
*/
|
|
4
|
+
interface MatchMediaProps {
|
|
5
|
+
/** CSS media query string to match against */
|
|
6
|
+
query: string;
|
|
7
|
+
/** Content to render when query matches */
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Component that conditionally renders children based on a media query
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <MatchMedia query="(min-width: 1024px)">
|
|
16
|
+
* <DesktopContent />
|
|
17
|
+
* </MatchMedia>
|
|
18
|
+
*
|
|
19
|
+
* <MatchMedia query="(prefers-color-scheme: dark)">
|
|
20
|
+
* <DarkModeUI />
|
|
21
|
+
* </MatchMedia>
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function MatchMedia({ query, children }: MatchMediaProps): import("react/jsx-runtime").JSX.Element | null;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a mock MediaQueryList for testing
|
|
3
|
+
*/
|
|
4
|
+
export declare const createMatchMediaMock: (matches: boolean) => {
|
|
5
|
+
matches: boolean;
|
|
6
|
+
media: string;
|
|
7
|
+
onchange: null;
|
|
8
|
+
addListener: import('vitest').Mock<(...args: any[]) => any>;
|
|
9
|
+
removeListener: import('vitest').Mock<(...args: any[]) => any>;
|
|
10
|
+
addEventListener: import('vitest').Mock<(event: string, listener: (event: MediaQueryListEvent) => void) => void>;
|
|
11
|
+
removeEventListener: import('vitest').Mock<(event: string, listener: (event: MediaQueryListEvent) => void) => void>;
|
|
12
|
+
dispatchEvent: import('vitest').Mock<(...args: any[]) => any>;
|
|
13
|
+
_triggerChange: (newMatches: boolean) => void;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Setup and teardown for matchMedia mocking
|
|
17
|
+
*/
|
|
18
|
+
export declare const setupMatchMediaMock: () => {
|
|
19
|
+
beforeEach: () => void;
|
|
20
|
+
afterEach: () => void;
|
|
21
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base hook to detect if a media query matches
|
|
3
|
+
* Uses the native matchMedia API for optimal performance
|
|
4
|
+
*
|
|
5
|
+
* @param query - CSS media query string
|
|
6
|
+
* @returns boolean indicating if the query matches
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* const isMobile = useMatchMedia(BREAKPOINT_MOBILE)
|
|
11
|
+
* const isDesktop = useMatchMedia(BREAKPOINT_DESKTOP)
|
|
12
|
+
* const prefersDark = useMatchMedia('(prefers-color-scheme: dark)')
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function useMatchMedia(query: string): boolean;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -24,12 +24,26 @@ export interface PageHeaderProps extends HTMLAttributes<HTMLElement> {
|
|
|
24
24
|
*/
|
|
25
25
|
export interface PageHeaderTopProps extends HTMLAttributes<HTMLDivElement> {
|
|
26
26
|
children: ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* Size determines the horizontal padding
|
|
29
|
+
* - 'fluid': No padding
|
|
30
|
+
* - 'wide': px-6
|
|
31
|
+
* - 'narrow': px-4
|
|
32
|
+
*/
|
|
33
|
+
size?: 'fluid' | 'wide' | 'narrow';
|
|
27
34
|
}
|
|
28
35
|
/**
|
|
29
36
|
* Props for PageHeaderBreadcrumbs - breadcrumbs section
|
|
30
37
|
*/
|
|
31
38
|
export interface PageHeaderBreadcrumbsProps extends HTMLAttributes<HTMLDivElement> {
|
|
32
39
|
children: ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* Size determines the horizontal padding
|
|
42
|
+
* - 'fluid': No padding
|
|
43
|
+
* - 'wide': px-6
|
|
44
|
+
* - 'narrow': px-4
|
|
45
|
+
*/
|
|
46
|
+
size?: 'fluid' | 'wide' | 'narrow';
|
|
33
47
|
}
|
|
34
48
|
/**
|
|
35
49
|
* Props for PageHeaderContent - title and subtitle area
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { HTMLAttributes, MouseEvent, ReactNode
|
|
1
|
+
import { HTMLAttributes, MouseEvent, ReactNode } from 'react';
|
|
2
|
+
import { PopoverPlacement } from '../../utils/popover';
|
|
2
3
|
export type MenuSize = 'sm' | 'md';
|
|
3
|
-
export type MenuPlacement = 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end' | 'auto';
|
|
4
4
|
/**
|
|
5
5
|
* Props for Menu
|
|
6
6
|
*/
|
|
7
7
|
export interface MenuProps {
|
|
8
|
-
/** Whether the menu is open (controlled
|
|
8
|
+
/** Whether the menu is open (controlled) */
|
|
9
9
|
isOpen: boolean;
|
|
10
|
-
/** Callback when
|
|
11
|
-
|
|
10
|
+
/** Callback when the menu closes */
|
|
11
|
+
onClose: () => void;
|
|
12
12
|
/** Menu size variant */
|
|
13
13
|
size?: MenuSize;
|
|
14
14
|
/** Menu content (MenuContent/MenuItem) */
|
|
@@ -16,9 +16,9 @@ export interface MenuProps {
|
|
|
16
16
|
/** Trigger element */
|
|
17
17
|
children: ReactNode;
|
|
18
18
|
/** Preferred placement of the menu relative to trigger */
|
|
19
|
-
placement?:
|
|
20
|
-
/**
|
|
21
|
-
|
|
19
|
+
placement?: PopoverPlacement;
|
|
20
|
+
/** Gap between trigger and menu in pixels */
|
|
21
|
+
gap?: number;
|
|
22
22
|
/** Whether to keep the menu after list item clicked */
|
|
23
23
|
preserve?: boolean;
|
|
24
24
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { MenuProps } from '../../overlays/menu/types';
|
|
3
3
|
import { ButtonProps } from '../button/types';
|
|
4
|
-
export interface ButtonMenuProps extends Omit<ButtonProps, 'content'>, Pick<MenuProps, 'placement' | '
|
|
4
|
+
export interface ButtonMenuProps extends Omit<ButtonProps, 'content'>, Pick<MenuProps, 'placement' | 'preserve'> {
|
|
5
5
|
/**
|
|
6
6
|
* Callback function triggered when the menu open state changes.
|
|
7
7
|
*/
|
|
@@ -2,7 +2,7 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { IconProps } from '../icon';
|
|
3
3
|
import { ButtonIconProps } from '../button-icon';
|
|
4
4
|
import { MenuProps } from '../../overlays/menu/types';
|
|
5
|
-
export interface ButtonMenuIconProps extends Omit<ButtonIconProps, 'content'>, Pick<IconProps, 'as'>, Pick<MenuProps, 'placement' | '
|
|
5
|
+
export interface ButtonMenuIconProps extends Omit<ButtonIconProps, 'content'>, Pick<IconProps, 'as'>, Pick<MenuProps, 'placement' | 'preserve'> {
|
|
6
6
|
/**
|
|
7
7
|
* Callback function triggered when the menu open state changes.
|
|
8
8
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dimasbaguspm/versaur",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.58",
|
|
4
4
|
"description": "React UI library with Tailwind CSS",
|
|
5
5
|
"author": "Dimas Bagus Prayogo Mukti<dimas.bagus.pm@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,6 +46,10 @@
|
|
|
46
46
|
"import": "./dist/js/templates/index.js",
|
|
47
47
|
"types": "./dist/types/templates/index.d.ts"
|
|
48
48
|
},
|
|
49
|
+
"./helpers": {
|
|
50
|
+
"import": "./dist/js/helpers/index.js",
|
|
51
|
+
"types": "./dist/types/helpers/index.d.ts"
|
|
52
|
+
},
|
|
49
53
|
"./styles.css": "./dist/assets/styles.css",
|
|
50
54
|
"./eslint-subpath-import": "./dist/utils/enforce-subpath-import.js"
|
|
51
55
|
},
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
import { MenuPlacement } from './types';
|
|
3
|
-
export declare function useMenuOutsideClick(isOpen: boolean, contentRef: React.RefObject<HTMLDivElement | null>, triggerRef: React.RefObject<HTMLButtonElement | null>, onOutsideClick: () => void): void;
|
|
4
|
-
interface MenuPosition {
|
|
5
|
-
top?: number;
|
|
6
|
-
bottom?: number;
|
|
7
|
-
left?: number;
|
|
8
|
-
right?: number;
|
|
9
|
-
maxHeight?: number;
|
|
10
|
-
maxWidth?: number;
|
|
11
|
-
position?: 'absolute' | 'fixed';
|
|
12
|
-
isReady?: boolean;
|
|
13
|
-
}
|
|
14
|
-
export declare function useMenuPosition(isOpen: boolean, triggerRef: React.RefObject<HTMLElement | null>, contentRef: React.RefObject<HTMLDivElement | null>, placement: MenuPlacement | undefined, container: HTMLElement | RefObject<HTMLElement | null> | null): MenuPosition;
|
|
15
|
-
export {};
|