@dimasbaguspm/versaur 0.0.17 → 0.0.19
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 → assets}/styles.css +37 -0
- package/dist/js/{bottom-sheet-CHRSxXRE.js → bottom-sheet-BRv-oJL-.js} +285 -140
- package/dist/js/feedbacks/index.js +1 -1
- package/dist/js/{form-layout-Dhlv-FZL.js → form-layout-4ASWdXn8.js} +1 -1
- package/dist/js/forms/index.js +15 -16
- package/dist/js/{tile-B9bt2AY6.js → image-rectangle-CLU-GVtw.js} +855 -658
- package/dist/js/{index-C1uJQB34.js → index-DOdDlCoL.js} +2 -2
- package/dist/js/index.js +54 -47
- package/dist/js/layouts/index.js +1 -1
- package/dist/js/navigation/index.js +1 -1
- package/dist/js/overlays/index.js +4 -5
- package/dist/js/primitive/index.js +22 -16
- package/dist/js/providers/index.js +5 -0
- package/dist/js/selectable-multiple-input-CJXfqy1Z.js +1901 -0
- package/dist/js/{skeleton-QEyPZAuF.js → skeleton-BNZyaRjo.js} +1 -1
- package/dist/js/snackbar-DH8jCh2V.js +50 -0
- package/dist/js/{tabs-DYcTvVao.js → tabs-BbOkYchB.js} +1 -1
- package/dist/js/use-snackbars-oPoF7J5t.js +94 -0
- package/dist/types/feedbacks/loading-indicator/index.d.ts +2 -1
- package/dist/types/forms/chip-single-input/index.d.ts +2 -1
- package/dist/types/forms/index.d.ts +2 -1
- package/dist/types/forms/price-input/index.d.ts +1 -1
- package/dist/types/forms/selectable-multiple-input/index.d.ts +2 -0
- package/dist/types/forms/selectable-multiple-input/selectable-multiple-input.d.ts +6 -0
- package/dist/types/forms/selectable-multiple-input/types.d.ts +18 -0
- package/dist/types/forms/selectable-single-input/index.d.ts +2 -0
- package/dist/types/forms/selectable-single-input/selectable-single-input.d.ts +6 -0
- package/dist/types/forms/selectable-single-input/types.d.ts +18 -0
- package/dist/types/forms/switch-input/index.d.ts +2 -3
- package/dist/types/forms/time-picker-input/time-picker-input.d.ts +4 -4
- package/dist/types/forms/time-picker-input/types.d.ts +2 -38
- package/dist/types/index.d.ts +1 -0
- package/dist/types/layouts/page-layout/index.d.ts +2 -1
- package/dist/types/overlays/menu/index.d.ts +2 -2
- package/dist/types/primitive/description-list/description-list.atoms.d.ts +13 -0
- package/dist/types/primitive/description-list/description-list.d.ts +6 -0
- package/dist/types/primitive/description-list/index.d.ts +2 -0
- package/dist/types/primitive/description-list/types.d.ts +46 -0
- package/dist/types/primitive/image/base-image.atoms.d.ts +6 -0
- package/dist/types/primitive/image/base-image.d.ts +6 -0
- package/dist/types/primitive/image/image-circle.d.ts +6 -0
- package/dist/types/primitive/image/image-rectangle.d.ts +6 -0
- package/dist/types/primitive/image/image-square.d.ts +6 -0
- package/dist/types/primitive/image/index.d.ts +5 -0
- package/dist/types/primitive/image/types.d.ts +48 -0
- package/dist/types/primitive/image/use-image.d.ts +13 -0
- package/dist/types/primitive/index.d.ts +2 -0
- package/dist/types/providers/index.d.ts +1 -0
- package/dist/types/providers/snackbars-provider/index.d.ts +3 -0
- package/dist/types/providers/snackbars-provider/provider.d.ts +7 -0
- package/dist/types/providers/snackbars-provider/types.d.ts +28 -0
- package/dist/types/providers/snackbars-provider/use-snackbars-queue.d.ts +9 -0
- package/dist/types/providers/snackbars-provider/use-snackbars.d.ts +4 -0
- package/dist/{js → utils}/enforce-subpath-import.js +67 -54
- package/package.json +8 -4
- package/dist/js/email-input-CVyrFzqL.js +0 -1820
- package/dist/js/modal-FqewbVts.js +0 -150
- package/dist/types/forms/calculator-input/calculator-input.atoms.d.ts +0 -11
- package/dist/types/forms/calculator-input/calculator-input.d.ts +0 -8
- package/dist/types/forms/calculator-input/index.d.ts +0 -1
- package/dist/types/forms/calculator-input/types.d.ts +0 -51
- package/dist/types/forms/time-picker-input/time-picker-input.atoms.d.ts +0 -15
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { c, j as r, a as d } from "./index-DOdDlCoL.js";
|
|
2
|
+
import { forwardRef as i } from "react";
|
|
3
|
+
const l = c(
|
|
4
|
+
"flex items-center gap-2 px-4 py-2 rounded-sm w-auto mx-4 sm:mx-0 sm:w-fit relative shadow-sm",
|
|
5
|
+
{
|
|
6
|
+
variants: {
|
|
7
|
+
color: {
|
|
8
|
+
success: "text-success-bold bg-success-soft border-l-4 border-success",
|
|
9
|
+
info: "text-info-bold bg-info-soft border-l-4 border-info",
|
|
10
|
+
warning: "text-warning-bold bg-warning-soft border-l-4 border-warning",
|
|
11
|
+
danger: "text-danger-bold bg-danger-soft border-l-4 border-danger"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
color: "success"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
), b = ({
|
|
19
|
+
children: a,
|
|
20
|
+
...s
|
|
21
|
+
}) => /* @__PURE__ */ r.jsx(
|
|
22
|
+
"span",
|
|
23
|
+
{
|
|
24
|
+
className: "flex-1 truncate text-sm",
|
|
25
|
+
"data-testid": "snackbar-text",
|
|
26
|
+
...s,
|
|
27
|
+
children: a
|
|
28
|
+
}
|
|
29
|
+
), x = ({
|
|
30
|
+
children: a,
|
|
31
|
+
...s
|
|
32
|
+
}) => /* @__PURE__ */ r.jsx("span", { className: "ml-2", "data-testid": "snackbar-action", ...s, children: a }), g = i(
|
|
33
|
+
({ children: a, action: s, color: e, className: t, ...o }, n) => /* @__PURE__ */ r.jsxs(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
ref: n,
|
|
37
|
+
role: "status",
|
|
38
|
+
"aria-live": "polite",
|
|
39
|
+
className: d(l({ color: e }), t),
|
|
40
|
+
...o,
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ r.jsx(b, { children: a }),
|
|
43
|
+
s && /* @__PURE__ */ r.jsx(x, { children: s })
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
);
|
|
48
|
+
export {
|
|
49
|
+
g as S
|
|
50
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as d, j as o, a as u } from "./index-DOdDlCoL.js";
|
|
2
2
|
import { forwardRef as f, createContext as x, useContext as g, useState as p, useLayoutEffect as y, useRef as h } from "react";
|
|
3
3
|
const w = d(
|
|
4
4
|
"flex items-center gap-2 text-sm text-tertiary",
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { c as d, j as c } from "./index-DOdDlCoL.js";
|
|
2
|
+
import { createContext as x, useState as k, useRef as p, useCallback as m, useEffect as S, useMemo as v, useContext as h } from "react";
|
|
3
|
+
import { S as w } from "./snackbar-DH8jCh2V.js";
|
|
4
|
+
const f = x(
|
|
5
|
+
null
|
|
6
|
+
), j = d(
|
|
7
|
+
[
|
|
8
|
+
"fixed z-50 flex flex-col gap-2 px-0 pb-2",
|
|
9
|
+
"w-screen left-0 bottom-0",
|
|
10
|
+
// mobile: full width
|
|
11
|
+
"sm:w-auto sm:left-4 sm:bottom-4 sm:max-w-sm"
|
|
12
|
+
// desktop/tablet
|
|
13
|
+
].join(" ")
|
|
14
|
+
), T = d("", {
|
|
15
|
+
variants: {
|
|
16
|
+
placement: {
|
|
17
|
+
mobile: "snackbar-animate-fade-in-out",
|
|
18
|
+
desktop: "snackbar-animate-slide-in-left"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: {
|
|
22
|
+
placement: "mobile"
|
|
23
|
+
}
|
|
24
|
+
}), C = 4e3;
|
|
25
|
+
function E() {
|
|
26
|
+
const [a, s] = k([]), t = p({}), n = m((e) => {
|
|
27
|
+
s((r) => r.filter((o) => o.id !== e)), t.current[e] && (clearTimeout(t.current[e]), delete t.current[e]);
|
|
28
|
+
}, []), i = m(
|
|
29
|
+
(e, r, o) => {
|
|
30
|
+
const u = `${Date.now()}-${Math.random()}`, l = o?.duration ?? C;
|
|
31
|
+
s((b) => [
|
|
32
|
+
...b,
|
|
33
|
+
{
|
|
34
|
+
id: u,
|
|
35
|
+
color: e,
|
|
36
|
+
message: r,
|
|
37
|
+
...o,
|
|
38
|
+
duration: l
|
|
39
|
+
}
|
|
40
|
+
]), t.current[u] = setTimeout(() => {
|
|
41
|
+
n(u);
|
|
42
|
+
}, l);
|
|
43
|
+
},
|
|
44
|
+
[n]
|
|
45
|
+
);
|
|
46
|
+
return S(() => () => {
|
|
47
|
+
Object.values(t.current).forEach(clearTimeout), t.current = {};
|
|
48
|
+
}, []), { queue: a, showSnack: i, removeSnack: n };
|
|
49
|
+
}
|
|
50
|
+
const V = ({ children: a }) => {
|
|
51
|
+
const { queue: s, showSnack: t, removeSnack: n } = E(), i = v(() => ({ showSnack: t }), [t]);
|
|
52
|
+
return /* @__PURE__ */ c.jsxs(f.Provider, { value: i, children: [
|
|
53
|
+
a,
|
|
54
|
+
/* @__PURE__ */ c.jsx(
|
|
55
|
+
"div",
|
|
56
|
+
{
|
|
57
|
+
className: j(),
|
|
58
|
+
"aria-live": "polite",
|
|
59
|
+
"aria-atomic": "true",
|
|
60
|
+
children: s.map((e, r) => /* @__PURE__ */ c.jsx(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
className: T({
|
|
64
|
+
placement: window.innerWidth >= 640 ? "desktop" : "mobile"
|
|
65
|
+
}),
|
|
66
|
+
style: { transitionDelay: `${r * 60}ms` },
|
|
67
|
+
children: /* @__PURE__ */ c.jsx(
|
|
68
|
+
w,
|
|
69
|
+
{
|
|
70
|
+
color: e.color,
|
|
71
|
+
action: e.action,
|
|
72
|
+
onClose: () => {
|
|
73
|
+
n(e.id);
|
|
74
|
+
},
|
|
75
|
+
children: e.message
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
},
|
|
79
|
+
e.id
|
|
80
|
+
))
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
] });
|
|
84
|
+
};
|
|
85
|
+
function N() {
|
|
86
|
+
const a = h(f);
|
|
87
|
+
if (!a)
|
|
88
|
+
throw new Error("useSnackbars must be used within a SnackbarsProvider");
|
|
89
|
+
return a;
|
|
90
|
+
}
|
|
91
|
+
export {
|
|
92
|
+
V as S,
|
|
93
|
+
N as u
|
|
94
|
+
};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { LoadingIndicator } from './loading-indicator';
|
|
2
|
+
export type * from './types';
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export { ChipSingleInput } from './chip-single-input';
|
|
2
|
+
export type * from './types';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from './calculator-input';
|
|
2
1
|
export * from './checkbox-input';
|
|
3
2
|
export * from './chip-single-input';
|
|
4
3
|
export * from './chip-multiple-input';
|
|
@@ -14,3 +13,5 @@ export * from './time-picker-input';
|
|
|
14
13
|
export * from './switch-input';
|
|
15
14
|
export * from './price-input';
|
|
16
15
|
export * from './email-input';
|
|
16
|
+
export * from './selectable-single-input';
|
|
17
|
+
export * from './selectable-multiple-input';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { PriceInput } from './price-input';
|
|
2
2
|
export type { PriceInputProps } from './types';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SelectableMultipleInputProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* SelectableMultipleInput is a checkbox input with a custom label and checked icon
|
|
4
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/
|
|
5
|
+
*/
|
|
6
|
+
export declare const SelectableMultipleInput: import('react').ForwardRefExoticComponent<SelectableMultipleInputProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode, InputHTMLAttributes } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Props for SelectableMultipleInput
|
|
4
|
+
*/
|
|
5
|
+
export interface SelectableMultipleInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
6
|
+
/**
|
|
7
|
+
* The value of the checkbox input
|
|
8
|
+
*/
|
|
9
|
+
value: string;
|
|
10
|
+
/**
|
|
11
|
+
* The label to display next to the checkbox input (can be any ReactNode)
|
|
12
|
+
*/
|
|
13
|
+
label: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Whether the input is checked (controlled)
|
|
16
|
+
*/
|
|
17
|
+
checked: boolean;
|
|
18
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SelectableSingleInputProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* SelectableSingleInput is a radio input with a custom label and checked icon
|
|
4
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/radio/
|
|
5
|
+
*/
|
|
6
|
+
export declare const SelectableSingleInput: import('react').ForwardRefExoticComponent<SelectableSingleInputProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode, InputHTMLAttributes } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Props for SelectableSingleInput
|
|
4
|
+
*/
|
|
5
|
+
export interface SelectableSingleInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
6
|
+
/**
|
|
7
|
+
* The value of the radio input
|
|
8
|
+
*/
|
|
9
|
+
value: string;
|
|
10
|
+
/**
|
|
11
|
+
* The label to display next to the radio input (can be any ReactNode)
|
|
12
|
+
*/
|
|
13
|
+
label: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Whether the input is checked (controlled)
|
|
16
|
+
*/
|
|
17
|
+
checked: boolean;
|
|
18
|
+
}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './types';
|
|
1
|
+
export { SwitchInput } from './switch-input';
|
|
2
|
+
export type * from './types';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
1
|
import { TimePickerInputProps } from './types';
|
|
3
2
|
/**
|
|
4
3
|
* TimePickerInput component for Versaur UI
|
|
5
4
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Renders a visually accessible text input
|
|
6
|
+
*
|
|
7
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/time
|
|
8
8
|
*/
|
|
9
|
-
export declare const TimePickerInput:
|
|
9
|
+
export declare const TimePickerInput: import('react').ForwardRefExoticComponent<TimePickerInputProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
@@ -1,47 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ModalRootProps } from '../../overlays/modal';
|
|
1
|
+
import { TextInputProps } from '../text-input';
|
|
3
2
|
/**
|
|
4
3
|
* Props for the TimePickerInput component
|
|
5
4
|
*/
|
|
6
|
-
export interface TimePickerInputProps {
|
|
7
|
-
/**
|
|
8
|
-
* The selected time value in 12-hour format (e.g., '02:30 PM')
|
|
9
|
-
*/
|
|
5
|
+
export interface TimePickerInputProps extends Omit<TextInputProps, 'type' | 'value' | 'onChange'> {
|
|
10
6
|
value: string;
|
|
11
7
|
/**
|
|
12
8
|
* Called when the time value changes
|
|
13
9
|
*/
|
|
14
10
|
onChange: (value: string) => void;
|
|
15
|
-
/**
|
|
16
|
-
* Optional label for the input
|
|
17
|
-
*/
|
|
18
|
-
label?: ReactNode;
|
|
19
|
-
/**
|
|
20
|
-
* Optional helper text below the input
|
|
21
|
-
*/
|
|
22
|
-
helperText?: ReactNode;
|
|
23
|
-
/**
|
|
24
|
-
* Whether the input is disabled
|
|
25
|
-
*/
|
|
26
|
-
disabled?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Optional error message
|
|
29
|
-
*/
|
|
30
|
-
error?: ReactNode;
|
|
31
|
-
/**
|
|
32
|
-
* Whether to decide the modal placement'
|
|
33
|
-
*/
|
|
34
|
-
placement?: ModalRootProps['placement'];
|
|
35
|
-
/**
|
|
36
|
-
* Optional: ARIA label for dialog
|
|
37
|
-
*/
|
|
38
|
-
'aria-label'?: string;
|
|
39
|
-
/**
|
|
40
|
-
* Optional: ARIA labelledby for dialog
|
|
41
|
-
*/
|
|
42
|
-
'aria-labelledby'?: string;
|
|
43
|
-
/**
|
|
44
|
-
* Optional: ARIA describedby for dialog
|
|
45
|
-
*/
|
|
46
|
-
'aria-describedby'?: string;
|
|
47
11
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { PageLayout } from './page-layout';
|
|
2
|
+
export type * from './types';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from './types';
|
|
1
|
+
export { Menu } from './menu';
|
|
2
|
+
export type * from './types';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DescriptionListItemProps, DescriptionListTermProps, DescriptionListDetailsProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* DescriptionList.Item atom
|
|
4
|
+
*/
|
|
5
|
+
export declare const DescriptionListItem: import('react').ForwardRefExoticComponent<DescriptionListItemProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
6
|
+
/**
|
|
7
|
+
* DescriptionList.Term atom
|
|
8
|
+
*/
|
|
9
|
+
export declare const DescriptionListTerm: import('react').ForwardRefExoticComponent<DescriptionListTermProps & import('react').RefAttributes<HTMLElement>>;
|
|
10
|
+
/**
|
|
11
|
+
* DescriptionList.Details atom
|
|
12
|
+
*/
|
|
13
|
+
export declare const DescriptionListDetails: import('react').ForwardRefExoticComponent<DescriptionListDetailsProps & import('react').RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DescriptionListProps } from './types';
|
|
2
|
+
export declare const DescriptionList: import('react').ForwardRefExoticComponent<DescriptionListProps & import('react').RefAttributes<HTMLDListElement>> & {
|
|
3
|
+
Item: import('react').ForwardRefExoticComponent<import('./types').DescriptionListItemProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
4
|
+
Term: import('react').ForwardRefExoticComponent<import('./types').DescriptionListTermProps & import('react').RefAttributes<HTMLElement>>;
|
|
5
|
+
Details: import('react').ForwardRefExoticComponent<import('./types').DescriptionListDetailsProps & import('react').RefAttributes<HTMLElement>>;
|
|
6
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ReactNode, HTMLAttributes } from 'react';
|
|
2
|
+
import { TextProps } from '../text';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the DescriptionList root component
|
|
5
|
+
*/
|
|
6
|
+
export interface DescriptionListProps extends HTMLAttributes<HTMLDListElement> {
|
|
7
|
+
/**
|
|
8
|
+
* Children should be DescriptionList.Item elements
|
|
9
|
+
*/
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Props for DescriptionList.Item
|
|
14
|
+
*/
|
|
15
|
+
export interface DescriptionListItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
16
|
+
/**
|
|
17
|
+
* Children should be DescriptionList.Term and DescriptionList.Details
|
|
18
|
+
*/
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Number of grid columns to span (default: 4)
|
|
22
|
+
*/
|
|
23
|
+
span?: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Props for DescriptionList.Term
|
|
27
|
+
*/
|
|
28
|
+
export interface DescriptionListTermProps extends Omit<HTMLAttributes<HTMLElement>, 'children'> {
|
|
29
|
+
/**
|
|
30
|
+
* Term label (required, string only)
|
|
31
|
+
*/
|
|
32
|
+
children: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Props for DescriptionList.Details
|
|
36
|
+
*/
|
|
37
|
+
export interface DescriptionListDetailsProps extends Omit<HTMLAttributes<HTMLElement>, 'children'> {
|
|
38
|
+
/**
|
|
39
|
+
* Details value (required, string only)
|
|
40
|
+
*/
|
|
41
|
+
children: string;
|
|
42
|
+
/**
|
|
43
|
+
* Text Color (default: 'black')
|
|
44
|
+
*/
|
|
45
|
+
color?: TextProps['color'];
|
|
46
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseImageFallbackProps, BaseImageSkeletonProps } from './types';
|
|
2
|
+
export declare function BaseImageSkeleton({ className, shape, size, height, width, }: BaseImageSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
/**
|
|
4
|
+
* FallbackAtom - displays a fallback UI when the image fails to load
|
|
5
|
+
*/
|
|
6
|
+
export declare function BaseImageFallback({ alt, width, height, className, style, shape, size, }: BaseImageFallbackProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseImageProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Image component that aligns with standard HTML <img> behavior, with required shape, skeleton loading, and cva variants
|
|
4
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img
|
|
5
|
+
*/
|
|
6
|
+
export declare const BaseImage: import('react').ForwardRefExoticComponent<BaseImageProps & import('react').RefAttributes<HTMLImageElement>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseImageProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Circle-shaped Image component for Versaur
|
|
4
|
+
* Inherits all behavior from BaseImage, sets shape to 'circle'
|
|
5
|
+
*/
|
|
6
|
+
export declare const ImageCircle: import('react').ForwardRefExoticComponent<Omit<BaseImageProps, "shape"> & import('react').RefAttributes<HTMLImageElement>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseImageProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Rectangle-shaped Image component for Versaur
|
|
4
|
+
* Inherits all behavior from BaseImage, sets shape to 'rectangle'
|
|
5
|
+
*/
|
|
6
|
+
export declare const ImageRectangle: import('react').ForwardRefExoticComponent<Omit<BaseImageProps, "shape"> & import('react').RefAttributes<HTMLImageElement>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseImageProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Square-shaped Image component for Versaur
|
|
4
|
+
* Inherits all behavior from BaseImage, sets shape to 'square'
|
|
5
|
+
*/
|
|
6
|
+
export declare const ImageSquare: import('react').ForwardRefExoticComponent<Omit<BaseImageProps, "shape"> & import('react').RefAttributes<HTMLImageElement>>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { SkeletonProps } from '../../feedbacks';
|
|
2
|
+
import { ImgHTMLAttributes } from 'react';
|
|
3
|
+
export interface BaseImageSkeletonProps extends Omit<SkeletonProps, 'shape' | 'size'> {
|
|
4
|
+
/**
|
|
5
|
+
* Shape of the skeleton: 'square', 'rectangle', or 'circle'
|
|
6
|
+
*/
|
|
7
|
+
shape?: BaseImageProps['shape'];
|
|
8
|
+
/**
|
|
9
|
+
* Predefined size variant for the skeleton (see helpers.ts)
|
|
10
|
+
*/
|
|
11
|
+
size?: BaseImageProps['size'];
|
|
12
|
+
width?: number | string;
|
|
13
|
+
height?: number | string;
|
|
14
|
+
}
|
|
15
|
+
export interface BaseImageFallbackProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, 'src' | 'alt'> {
|
|
16
|
+
/**
|
|
17
|
+
* Alternative text for the fallback image
|
|
18
|
+
*/
|
|
19
|
+
alt: string;
|
|
20
|
+
shape?: BaseImageProps['shape'];
|
|
21
|
+
size?: BaseImageProps['size'];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* ImageProps extends standard HTML <img> attributes with required src and alt, and supports position/size variants
|
|
25
|
+
*/
|
|
26
|
+
export interface BaseImageProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, 'src' | 'alt'> {
|
|
27
|
+
/**
|
|
28
|
+
* Image source URL
|
|
29
|
+
*/
|
|
30
|
+
src: string;
|
|
31
|
+
/**
|
|
32
|
+
* Alternative text for the image
|
|
33
|
+
*/
|
|
34
|
+
alt: string;
|
|
35
|
+
/**
|
|
36
|
+
* Image object-fit/position variant (see helpers.ts)
|
|
37
|
+
*/
|
|
38
|
+
position?: 'cover' | 'contain' | 'center' | 'top' | 'bottom' | 'left' | 'right' | 'none';
|
|
39
|
+
/**
|
|
40
|
+
* Predefined image size variant (see helpers.ts)
|
|
41
|
+
*/
|
|
42
|
+
size?: 'sm' | 'md' | 'lg' | 'full' | 'auto';
|
|
43
|
+
/**
|
|
44
|
+
* Shape of the image: 'square', 'rectangle', or 'circle'
|
|
45
|
+
* Required for all image components
|
|
46
|
+
*/
|
|
47
|
+
shape: 'square' | 'rectangle' | 'circle';
|
|
48
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface UseImageProps {
|
|
2
|
+
src: string;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Custom hook to manage image loading, error, and natural size detection
|
|
6
|
+
*/
|
|
7
|
+
export declare function useImage({ src }: UseImageProps): {
|
|
8
|
+
loaded: boolean;
|
|
9
|
+
errored: boolean;
|
|
10
|
+
handleLoad: () => void;
|
|
11
|
+
handleError: () => void;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './snackbars-provider';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { SnackbarsProviderProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* SnackbarsProvider manages a queue of snackbars and provides showSnack
|
|
5
|
+
* Placement: full width bottom for mobile, bottom left for desktop/tablet
|
|
6
|
+
*/
|
|
7
|
+
export declare const SnackbarsProvider: FC<SnackbarsProviderProps>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* SnackbarQueueItem: Represents a snackbar in the queue
|
|
4
|
+
*/
|
|
5
|
+
export interface SnackbarQueueItem {
|
|
6
|
+
/** Unique id for the snackbar */
|
|
7
|
+
id: string;
|
|
8
|
+
/** Message content */
|
|
9
|
+
message: ReactNode;
|
|
10
|
+
/** Color variant */
|
|
11
|
+
color?: 'success' | 'info' | 'warning' | 'danger';
|
|
12
|
+
/** Optional action element */
|
|
13
|
+
action?: ReactNode;
|
|
14
|
+
/** Optional duration in milliseconds */
|
|
15
|
+
duration?: number | null;
|
|
16
|
+
}
|
|
17
|
+
export type ShowSnackFunction = (color: SnackbarQueueItem['color'], message: ReactNode, options?: Partial<Omit<SnackbarQueueItem, 'id' | 'color' | 'message'>>) => void;
|
|
18
|
+
/**
|
|
19
|
+
* SnackbarsContextValue: Context value for snackbars
|
|
20
|
+
*/
|
|
21
|
+
export interface SnackbarsContextValue {
|
|
22
|
+
/** Show a snackbar */
|
|
23
|
+
showSnack: ShowSnackFunction;
|
|
24
|
+
}
|
|
25
|
+
export interface SnackbarsProviderProps {
|
|
26
|
+
/** Children to render inside the provider */
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ShowSnackFunction, SnackbarQueueItem } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Custom hook to manage snackbar queue and auto-close logic
|
|
4
|
+
*/
|
|
5
|
+
export declare function useSnackbarsQueue(): {
|
|
6
|
+
queue: SnackbarQueueItem[];
|
|
7
|
+
showSnack: ShowSnackFunction;
|
|
8
|
+
removeSnack: (id: string) => void;
|
|
9
|
+
};
|