@dimasbaguspm/versaur 0.0.11 → 0.0.13

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 (38) hide show
  1. package/dist/js/bottom-sheet-CBLNEX4F.js +281 -0
  2. package/dist/js/bottom-sheet.atoms-DFMOaMsU.js +78 -0
  3. package/dist/js/{calendar-De5dCVnE.js → calendar-B9rIZCdo.js} +318 -163
  4. package/dist/js/{index-DOdDlCoL.js → cn-BKwT3erk.js} +463 -788
  5. package/dist/js/enforce-subpath-import.js +1 -0
  6. package/dist/js/feedbacks/index.js +1 -1
  7. package/dist/js/{form-layout-BRqZZe8s.js → form-layout-PLH-7bWq.js} +14 -13
  8. package/dist/js/forms/index.js +1 -1
  9. package/dist/js/index-Dmu_fHni.js +329 -0
  10. package/dist/js/index.js +32 -31
  11. package/dist/js/layouts/index.js +1 -1
  12. package/dist/js/{menu-Du409VIG.js → menu-oRrbZAAy.js} +56 -60
  13. package/dist/js/navigation/index.js +1 -1
  14. package/dist/js/overlays/index.js +5 -4
  15. package/dist/js/primitive/index.js +2 -2
  16. package/dist/js/{skeleton-BNZyaRjo.js → skeleton-Ma-Fcs06.js} +6 -5
  17. package/dist/js/{switch-input-B-pwBWbi.js → switch-input-o8oO4Rf4.js} +482 -435
  18. package/dist/js/{tabs-BbOkYchB.js → tabs-DSeR5XxX.js} +6 -5
  19. package/dist/js/{tile-6SeBYc08.js → tile-8hqVMf2m.js} +110 -139
  20. package/dist/types/forms/chip-input/types.d.ts +16 -0
  21. package/dist/types/forms/date-range-picker-input/date-range-picker-input.d.ts +10 -0
  22. package/dist/types/forms/date-range-picker-input/index.d.ts +2 -0
  23. package/dist/types/forms/date-range-picker-input/types.d.ts +64 -0
  24. package/dist/types/forms/date-range-picker-input/use-date-range-picker.d.ts +13 -0
  25. package/dist/types/overlays/bottom-sheet/bottom-sheet.atoms.d.ts +17 -0
  26. package/dist/types/overlays/bottom-sheet/bottom-sheet.d.ts +7 -0
  27. package/dist/types/overlays/bottom-sheet/index.d.ts +2 -0
  28. package/dist/types/overlays/bottom-sheet/types.d.ts +22 -0
  29. package/dist/types/overlays/drawer/drawer.atoms.d.ts +2 -1
  30. package/dist/types/overlays/drawer/drawer.d.ts +1 -0
  31. package/dist/types/overlays/drawer/types.d.ts +6 -3
  32. package/dist/types/overlays/index.d.ts +1 -0
  33. package/dist/types/primitive/calendar/calendar.atoms.d.ts +13 -0
  34. package/dist/types/primitive/calendar/index.d.ts +1 -1
  35. package/dist/types/primitive/calendar/types.d.ts +38 -4
  36. package/dist/types/primitive/calendar/use-calendar.d.ts +18 -0
  37. package/package.json +1 -1
  38. package/dist/js/drawer-Cn7sreJG.js +0 -221
@@ -0,0 +1,64 @@
1
+ import { ReactNode } from 'react';
2
+ /**
3
+ * ISO 8601 date string (YYYY-MM-DD)
4
+ */
5
+ export type ISODateString = string;
6
+ /**
7
+ * Tuple for date range value: [start, end] (ISO 8601 or null)
8
+ */
9
+ export type DateRangeValue = [ISODateString | null, ISODateString | null] | null;
10
+ /**
11
+ * Props for DateRangePickerInput
12
+ */
13
+ export interface DateRangePickerInputProps {
14
+ /**
15
+ * The selected date range value (tuple of ISO 8601 strings or nulls)
16
+ */
17
+ value: DateRangeValue;
18
+ /**
19
+ * Callback when the value changes
20
+ */
21
+ onChange: (value: DateRangeValue) => void;
22
+ /**
23
+ * Label text to display above the input
24
+ */
25
+ label?: ReactNode;
26
+ /**
27
+ * Optional content to display inside the input (left)
28
+ */
29
+ leftContent?: ReactNode;
30
+ /**
31
+ * Optional content to display inside the input (right)
32
+ */
33
+ rightContent?: ReactNode;
34
+ /**
35
+ * Helper text to display below the input
36
+ */
37
+ helperText?: ReactNode;
38
+ /**
39
+ * Error message for invalid state
40
+ */
41
+ error?: ReactNode;
42
+ /**
43
+ * Visual style variant supporting Versaur color system
44
+ */
45
+ variant?: 'primary' | 'primary-outline' | 'secondary' | 'secondary-outline' | 'tertiary' | 'tertiary-outline' | 'ghost' | 'ghost-outline' | 'neutral' | 'neutral-outline' | 'success' | 'success-outline' | 'info' | 'info-outline' | 'warning' | 'warning-outline' | 'danger' | 'danger-outline';
46
+ /**
47
+ * Disabled state
48
+ */
49
+ disabled?: boolean;
50
+ /**
51
+ * Placeholder text when no date is selected
52
+ */
53
+ placeholder?: ReactNode;
54
+ /**
55
+ * Optional id for the input element
56
+ */
57
+ id?: string;
58
+ /**
59
+ * Optional custom date formatter. If not provided, uses default format.
60
+ * @param date Date to format
61
+ * @returns Formatted date string
62
+ */
63
+ formatDate?: (date?: Date) => string;
64
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Hook for managing open/close state and focus for DateRangePickerInput
3
+ */
4
+ export declare function useDateRangePicker({ id }: {
5
+ id?: string;
6
+ }): {
7
+ open: boolean;
8
+ setOpen: import('react').Dispatch<import('react').SetStateAction<boolean>>;
9
+ inputId: string;
10
+ buttonRef: import('react').RefObject<HTMLButtonElement | null>;
11
+ handleKeyDown: (e: React.KeyboardEvent) => void;
12
+ handleMenuClose: () => void;
13
+ };
@@ -0,0 +1,17 @@
1
+ import { BottomSheetHeaderProps, BottomSheetBodyProps, BottomSheetFooterProps, BottomSheetTitleProps } from './types';
2
+ /**
3
+ * BottomSheetTitle: Title text for the sheet header (for consistency)
4
+ */
5
+ export declare const BottomSheetTitle: import('react').ForwardRefExoticComponent<BottomSheetTitleProps & import('react').RefAttributes<HTMLHeadingElement>>;
6
+ /**
7
+ * BottomSheetHeader: Top section for title or actions
8
+ */
9
+ export declare const BottomSheetHeader: import('react').ForwardRefExoticComponent<BottomSheetHeaderProps & import('react').RefAttributes<HTMLDivElement>>;
10
+ /**
11
+ * BottomSheetBody: Main content area
12
+ */
13
+ export declare const BottomSheetBody: import('react').ForwardRefExoticComponent<BottomSheetBodyProps & import('react').RefAttributes<HTMLDivElement>>;
14
+ /**
15
+ * BottomSheetFooter: Bottom section for actions
16
+ */
17
+ export declare const BottomSheetFooter: import('react').ForwardRefExoticComponent<BottomSheetFooterProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,7 @@
1
+ import { BottomSheetProps } from './types';
2
+ export declare const BottomSheet: import('react').ForwardRefExoticComponent<BottomSheetProps & import('react').RefAttributes<HTMLDivElement>> & {
3
+ Header: import('react').ForwardRefExoticComponent<import('./types').BottomSheetHeaderProps & import('react').RefAttributes<HTMLDivElement>>;
4
+ Title: import('react').ForwardRefExoticComponent<import('./types').BottomSheetTitleProps & import('react').RefAttributes<HTMLHeadingElement>>;
5
+ Body: import('react').ForwardRefExoticComponent<import('./types').BottomSheetBodyProps & import('react').RefAttributes<HTMLDivElement>>;
6
+ Footer: import('react').ForwardRefExoticComponent<import('./types').BottomSheetFooterProps & import('react').RefAttributes<HTMLDivElement>>;
7
+ };
@@ -0,0 +1,2 @@
1
+ export * from './bottom-sheet';
2
+ export * from './types';
@@ -0,0 +1,22 @@
1
+ import { HTMLAttributes } from 'react';
2
+ /**
3
+ * Props for BottomSheetRoot (main component)
4
+ */
5
+ export interface BottomSheetProps extends HTMLAttributes<HTMLDivElement> {
6
+ /**
7
+ * Controls open state (controlled only)
8
+ */
9
+ isOpen: boolean;
10
+ /**
11
+ * Called when the backdrop is clicked (should close the sheet)
12
+ */
13
+ onClose: () => void;
14
+ /**
15
+ * Content of the bottom sheet
16
+ */
17
+ children: React.ReactNode;
18
+ }
19
+ export type BottomSheetHeaderProps = HTMLAttributes<HTMLDivElement>;
20
+ export type BottomSheetBodyProps = HTMLAttributes<HTMLDivElement>;
21
+ export type BottomSheetFooterProps = HTMLAttributes<HTMLDivElement>;
22
+ export type BottomSheetTitleProps = HTMLAttributes<HTMLHeadingElement>;
@@ -1,5 +1,5 @@
1
1
  import { default as React } from 'react';
2
- import { DrawerHeaderProps, DrawerBodyProps, DrawerFooterProps, DrawerOverlayProps } from './types';
2
+ import { DrawerHeaderProps, DrawerBodyProps, DrawerFooterProps, DrawerOverlayProps, DrawerHeaderTabProps } from './types';
3
3
  /**
4
4
  * DrawerOverlay - Background overlay that appears behind the drawer
5
5
  * Always provides a dark blurred background to help users focus on the drawer content
@@ -10,6 +10,7 @@ export declare const DrawerOverlay: React.ForwardRefExoticComponent<DrawerOverla
10
10
  * Typically contains the title and close button
11
11
  */
12
12
  export declare const DrawerHeader: React.ForwardRefExoticComponent<DrawerHeaderProps & React.RefAttributes<HTMLDivElement>>;
13
+ export declare const DrawerTab: React.ForwardRefExoticComponent<DrawerHeaderTabProps & React.RefAttributes<HTMLDivElement>>;
13
14
  /**
14
15
  * DrawerBody - Main content area of the drawer
15
16
  * Scrollable container for the drawer content
@@ -11,6 +11,7 @@ export declare const DrawerRoot: React.FC<DrawerProps>;
11
11
  */
12
12
  export declare const Drawer: React.FC<DrawerProps> & {
13
13
  Header: React.ForwardRefExoticComponent<import('./types').DrawerHeaderProps & React.RefAttributes<HTMLDivElement>>;
14
+ Tab: React.ForwardRefExoticComponent<import('./types').DrawerHeaderTabProps & React.RefAttributes<HTMLDivElement>>;
14
15
  Body: React.ForwardRefExoticComponent<import('./types').DrawerBodyProps & React.RefAttributes<HTMLDivElement>>;
15
16
  Footer: React.ForwardRefExoticComponent<import('./types').DrawerFooterProps & React.RefAttributes<HTMLDivElement>>;
16
17
  };
@@ -1,4 +1,4 @@
1
- import { ComponentPropsWithoutRef, ReactNode } from 'react';
1
+ import { ComponentPropsWithoutRef, HTMLAttributes, ReactNode } from 'react';
2
2
  import { VariantProps } from '../../utils/variants';
3
3
  import { drawerVariants } from './helpers';
4
4
  /**
@@ -65,8 +65,11 @@ export interface DrawerProps extends ComponentPropsWithoutRef<'div'> {
65
65
  export interface DrawerHeaderProps extends ComponentPropsWithoutRef<'div'> {
66
66
  /** Children components */
67
67
  children: ReactNode;
68
- /** Additional CSS classes */
69
- className?: string;
68
+ hasTab?: boolean;
69
+ }
70
+ export interface DrawerHeaderTabProps extends HTMLAttributes<HTMLDivElement> {
71
+ /** Children components */
72
+ children: ReactNode;
70
73
  }
71
74
  /**
72
75
  * Props for the DrawerBody component
@@ -1,3 +1,4 @@
1
1
  export * from './drawer';
2
2
  export * from './menu';
3
3
  export * from './modal';
4
+ export * from './bottom-sheet';
@@ -0,0 +1,13 @@
1
+ import { FC } from 'react';
2
+ /**
3
+ * CalendarHeader atom for Calendar component
4
+ */
5
+ export declare const CalendarHeader: FC;
6
+ /**
7
+ * CalendarWeekdays atom for Calendar component
8
+ */
9
+ export declare const CalendarWeekdays: React.FC;
10
+ /**
11
+ * CalendarDays atom: delegates to single or range atom based on context
12
+ */
13
+ export declare const CalendarDays: FC;
@@ -1,2 +1,2 @@
1
1
  export { Calendar } from './calendar';
2
- export type { CalendarProps } from './types';
2
+ export type * from './types';
@@ -4,17 +4,51 @@
4
4
  * @property onChange - Callback when a date is selected
5
5
  * @property className - Custom class for the calendar container
6
6
  */
7
+ /**
8
+ * Calendar selection type
9
+ * - 'single': single date selection
10
+ * - 'range': date range selection (start and end)
11
+ */
12
+ export type CalendarType = 'single' | 'range';
13
+ /**
14
+ * Calendar value type
15
+ * - Date for single
16
+ * - [Date | null, Date | null] for range
17
+ */
18
+ export type CalendarValue = Date | [Date | null, Date | null];
19
+ /**
20
+ * CalendarProps defines the props for the Calendar component
21
+ * @property value - The selected date or range
22
+ * @property onChange - Callback when a date or range is selected
23
+ * @property className - Custom class for the calendar container
24
+ * @property type - Selection type: 'single' or 'range'
25
+ */
7
26
  export interface CalendarProps {
8
27
  /**
9
- * The selected date
28
+ * The selected date or range
10
29
  */
11
- value?: Date;
30
+ value?: CalendarValue;
12
31
  /**
13
- * Callback when a date is selected
32
+ * Callback when a date or range is selected
14
33
  */
15
- onChange?: (date: Date) => void;
34
+ onChange?: (value: CalendarValue) => void;
16
35
  /**
17
36
  * Custom class for the calendar container
18
37
  */
19
38
  className?: string;
39
+ /**
40
+ * Selection type: 'single' or 'range'
41
+ */
42
+ type?: CalendarType;
43
+ }
44
+ /**
45
+ * Props for CalendarHeader atom
46
+ */
47
+ export interface CalendarHeaderProps {
48
+ value?: CalendarValue;
49
+ year: number;
50
+ month: number;
51
+ onPrevMonth: () => void;
52
+ onNextMonth: () => void;
53
+ className?: string;
20
54
  }
@@ -0,0 +1,18 @@
1
+ import { CalendarType, CalendarValue } from './types';
2
+ export interface UseCalendarProps {
3
+ value?: CalendarValue;
4
+ type: CalendarType;
5
+ onChange?: (value: CalendarValue) => void;
6
+ initialYear: number;
7
+ initialMonth: number;
8
+ }
9
+ export declare function useCalendar({ value: controlledValue, type, onChange, initialYear, initialMonth, }: UseCalendarProps): {
10
+ year: number;
11
+ month: number;
12
+ value: CalendarValue | undefined;
13
+ setMonth: import('react').Dispatch<import('react').SetStateAction<number>>;
14
+ setYear: import('react').Dispatch<import('react').SetStateAction<number>>;
15
+ onChange: (val: CalendarValue) => void;
16
+ handlePrevMonth: () => void;
17
+ handleNextMonth: () => void;
18
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dimasbaguspm/versaur",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
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",
@@ -1,221 +0,0 @@
1
- import { c as i, j as n, a as l } from "./index-DOdDlCoL.js";
2
- import d, { createContext as p, useContext as h, useCallback as y, useEffect as j } from "react";
3
- const v = p(null);
4
- function c() {
5
- const t = h(v);
6
- if (!t)
7
- throw new Error(
8
- "Drawer components must be used within a DrawerRoot component"
9
- );
10
- return t;
11
- }
12
- const k = i(
13
- "fixed inset-0 z-50 transition-opacity duration-300 bg-black/30 backdrop-blur-md",
14
- {
15
- variants: {
16
- state: {
17
- open: "opacity-100",
18
- closed: "opacity-0 pointer-events-none"
19
- }
20
- },
21
- defaultVariants: {
22
- state: "closed"
23
- }
24
- }
25
- ), D = i("fixed z-50 shadow-xl flex flex-col", {
26
- variants: {
27
- position: {
28
- left: "left-0 top-0 bottom-0 border-r",
29
- right: "right-0 top-0 bottom-0 border-l"
30
- },
31
- size: {
32
- sm: "w-80",
33
- md: "w-96",
34
- lg: "w-[28rem]",
35
- xl: "w-[32rem]",
36
- "3/4": "w-[75vw]",
37
- full: "w-full"
38
- },
39
- variant: {
40
- default: "bg-white border-gray-200",
41
- glass: "bg-white/10 backdrop-blur-lg border-white/20"
42
- },
43
- transitionType: {
44
- slide: "transition-transform duration-300 ease-in-out",
45
- fade: "transition-opacity duration-300 ease-in-out"
46
- }
47
- },
48
- defaultVariants: {
49
- position: "right",
50
- size: "md",
51
- variant: "default",
52
- transitionType: "slide"
53
- }
54
- }), V = i("flex-shrink-0 px-6 py-4 border-b", {
55
- variants: {
56
- variant: {
57
- default: "bg-white border-gray-200",
58
- glass: "bg-transparent border-white/10"
59
- }
60
- },
61
- defaultVariants: {
62
- variant: "default"
63
- }
64
- }), C = i("flex-1 overflow-y-auto px-6 py-4", {
65
- variants: {
66
- variant: {
67
- default: "bg-white",
68
- glass: "bg-transparent"
69
- }
70
- },
71
- defaultVariants: {
72
- variant: "default"
73
- }
74
- }), R = i("flex-shrink-0 px-6 py-4 border-t", {
75
- variants: {
76
- variant: {
77
- default: "bg-white border-gray-200",
78
- glass: "bg-transparent border-white/10"
79
- },
80
- responsiveFlex: {
81
- true: "flex flex-row gap-3 sm:justify-end [&>*]:sm:flex-grow-0 [&>*]:flex-grow",
82
- false: "flex gap-2"
83
- }
84
- },
85
- defaultVariants: {
86
- variant: "default",
87
- responsiveFlex: !0
88
- }
89
- }), E = d.forwardRef(({ className: t, ...e }, a) => {
90
- const { isOpen: r, onClose: o } = c(), s = () => {
91
- o();
92
- };
93
- return /* @__PURE__ */ n.jsx(
94
- "div",
95
- {
96
- ref: a,
97
- onClick: s,
98
- className: l(
99
- k({
100
- state: r ? "open" : "closed"
101
- }),
102
- t
103
- ),
104
- ...e
105
- }
106
- );
107
- }), N = d.forwardRef(
108
- ({ children: t, className: e, ...a }, r) => {
109
- const { variant: o } = c();
110
- return /* @__PURE__ */ n.jsx(
111
- "div",
112
- {
113
- ref: r,
114
- className: l(V({ variant: o }), e),
115
- ...a,
116
- children: t
117
- }
118
- );
119
- }
120
- ), F = d.forwardRef(
121
- ({ children: t, className: e, ...a }, r) => {
122
- const { variant: o } = c();
123
- return /* @__PURE__ */ n.jsx(
124
- "div",
125
- {
126
- ref: r,
127
- className: l(C({ variant: o }), e),
128
- ...a,
129
- children: t
130
- }
131
- );
132
- }
133
- ), z = d.forwardRef(
134
- ({ children: t, className: e, responsiveFlex: a = !0, ...r }, o) => {
135
- const { variant: s } = c();
136
- return /* @__PURE__ */ n.jsx(
137
- "div",
138
- {
139
- ref: o,
140
- className: l(
141
- R({ variant: s, responsiveFlex: a }),
142
- e
143
- ),
144
- ...r,
145
- children: t
146
- }
147
- );
148
- }
149
- ), B = ({
150
- children: t,
151
- isOpen: e,
152
- onClose: a,
153
- position: r = "right",
154
- size: o = "md",
155
- variant: s = "default",
156
- transitionType: f = "slide",
157
- className: x,
158
- ...b
159
- }) => {
160
- const u = y(() => {
161
- a(!1);
162
- }, [a]), m = {
163
- isOpen: e,
164
- onClose: u,
165
- position: r,
166
- size: o,
167
- variant: s,
168
- transitionType: f
169
- };
170
- return j(() => {
171
- const w = (g) => {
172
- g.key === "Escape" && e && u();
173
- };
174
- return e && (document.addEventListener("keydown", w), document.body.style.overflow = "hidden"), () => {
175
- document.removeEventListener("keydown", w), document.body.style.overflow = "unset";
176
- };
177
- }, [e, u]), /* @__PURE__ */ n.jsx(v.Provider, { value: m, children: /* @__PURE__ */ n.jsxs(
178
- "div",
179
- {
180
- className: l(
181
- "fixed z-50 inset-0 pointer-events-none",
182
- e && "pointer-events-auto"
183
- ),
184
- children: [
185
- /* @__PURE__ */ n.jsx(E, {}),
186
- /* @__PURE__ */ n.jsx(
187
- "div",
188
- {
189
- role: e ? "dialog" : void 0,
190
- "aria-modal": e ? "true" : void 0,
191
- className: l(
192
- D({
193
- position: r,
194
- size: o,
195
- variant: s,
196
- transitionType: f
197
- }),
198
- f === "slide" ? [
199
- !e && r === "left" && "-translate-x-full",
200
- !e && r === "right" && "translate-x-full"
201
- ] : [
202
- "left-0 right-0 top-0 bottom-0",
203
- e ? "opacity-100" : "opacity-0 pointer-events-none"
204
- ],
205
- x
206
- ),
207
- ...b,
208
- children: e && t
209
- }
210
- )
211
- ]
212
- }
213
- ) });
214
- }, _ = Object.assign(B, {
215
- Header: N,
216
- Body: F,
217
- Footer: z
218
- });
219
- export {
220
- _ as D
221
- };