@moondreamsdev/dreamer-ui 1.7.10-test.99 → 1.7.12
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/README.md +2 -11
- package/dist/Toast-DUpf_XxS.js +754 -0
- package/dist/Toast-DUpf_XxS.js.map +1 -0
- package/dist/Toast-Dj3X8g0Q.cjs +2 -0
- package/dist/Toast-Dj3X8g0Q.cjs.map +1 -0
- package/dist/Window-U9c7lCJ4.cjs +2 -0
- package/dist/Window-U9c7lCJ4.cjs.map +1 -0
- package/dist/{Window-uX5BuBwi.js → Window-bavT8vOT.js} +141 -21
- package/dist/Window-bavT8vOT.js.map +1 -0
- package/dist/components.cjs.js +2 -2
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.esm.js +4250 -2867
- package/dist/components.esm.js.map +1 -1
- package/dist/hooks.cjs.js +1 -1
- package/dist/hooks.esm.js +6 -4
- package/dist/hooks.esm.js.map +1 -1
- package/dist/providers.cjs.js +1 -1
- package/dist/providers.esm.js +2 -2
- package/dist/src/components/accordion/Accordion.d.ts +36 -0
- package/dist/src/components/accordion/AccordionItem.d.ts +20 -0
- package/dist/src/components/actionmodal/ActionModal.d.ts +34 -0
- package/dist/src/components/avatar/Avatar.d.ts +24 -8
- package/dist/src/components/badge/Badge.d.ts +24 -2
- package/dist/src/components/button/Button.d.ts +22 -1
- package/dist/src/components/button/LoadingDots.d.ts +9 -0
- package/dist/src/components/button/variants.d.ts +4 -1
- package/dist/src/components/calendar/Calendar.d.ts +105 -0
- package/dist/src/components/calendar/hooks.d.ts +40 -0
- package/dist/src/components/calendar/index.d.ts +2 -0
- package/dist/src/components/calendar/variants.d.ts +41 -0
- package/dist/src/components/callout/Callout.d.ts +31 -10
- package/dist/src/components/card/Card.d.ts +29 -7
- package/dist/src/components/carousel/Carousel.d.ts +24 -1
- package/dist/src/components/checkbox/Checkbox.d.ts +37 -1
- package/dist/src/components/clickable/Clickable.d.ts +28 -0
- package/dist/src/components/code/Code.d.ts +18 -0
- package/dist/src/components/code-block/CodeBlock.d.ts +35 -10
- package/dist/src/components/code-block/classes.d.ts +2 -1
- package/dist/src/components/code-block/format.d.ts +2 -1
- package/dist/src/components/code-block/index.d.ts +1 -1
- package/dist/src/components/code-block/tokenize.d.ts +6 -2
- package/dist/src/components/code-block/types.d.ts +24 -1
- package/dist/src/components/disclosure/Disclosure.d.ts +30 -9
- package/dist/src/components/drawer/Drawer.d.ts +35 -10
- package/dist/src/components/dropdown-menu/DropdownMenu.d.ts +34 -0
- package/dist/src/components/dynamic-list/DynamicList.d.ts +68 -0
- package/dist/src/components/dynamic-list/hooks.d.ts +19 -0
- package/dist/src/components/dynamic-list/index.d.ts +2 -0
- package/dist/src/components/dynamic-list/markers.d.ts +8 -0
- package/dist/src/components/dynamic-list/variants.d.ts +4 -0
- package/dist/src/components/error-boundary/ErrorBoundary.d.ts +32 -9
- package/dist/src/components/form/Form.d.ts +28 -0
- package/dist/src/components/form/factories.d.ts +8 -0
- package/dist/src/components/form/hooks.d.ts +9 -0
- package/dist/src/components/form/index.d.ts +3 -0
- package/dist/src/components/form/types.d.ts +91 -0
- package/dist/src/components/form/variants.d.ts +32 -0
- package/dist/src/components/help-icon/HelpIcon.d.ts +48 -0
- package/dist/src/components/help-icon/index.d.ts +1 -0
- package/dist/src/components/index.d.ts +5 -1
- package/dist/src/components/input/Input.d.ts +30 -0
- package/dist/src/components/input/variants.d.ts +2 -0
- package/dist/src/components/label/Label.d.ts +33 -0
- package/dist/src/components/modal/Modal.d.ts +47 -1
- package/dist/src/components/pagination/Pagination.d.ts +36 -4
- package/dist/src/components/popover/Popover.d.ts +53 -3
- package/dist/src/components/radiogroup/RadioGroup.d.ts +33 -0
- package/dist/src/components/radiogroup/RadioGroupItem.d.ts +9 -0
- package/dist/src/components/scroll-area/ScrollArea.d.ts +25 -0
- package/dist/src/components/select/Select.d.ts +49 -0
- package/dist/src/components/separator/Separator.d.ts +23 -5
- package/dist/src/components/skeleton/Skeleton.d.ts +22 -2
- package/dist/src/components/skeleton/variants.d.ts +2 -0
- package/dist/src/components/slider/Slider.d.ts +46 -10
- package/dist/src/components/table/Table.d.ts +96 -0
- package/dist/src/components/table/hooks.d.ts +28 -0
- package/dist/src/components/table/index.d.ts +2 -0
- package/dist/src/components/table/variants.d.ts +14 -0
- package/dist/src/components/tabs/Tabs.d.ts +34 -9
- package/dist/src/components/textarea/Textarea.d.ts +37 -0
- package/dist/src/components/textarea/variants.d.ts +2 -0
- package/dist/src/components/toast/Toast.d.ts +39 -0
- package/dist/src/components/toggle/Toggle.d.ts +29 -0
- package/dist/src/components/tooltip/Tooltip.d.ts +42 -1
- package/dist/src/hooks/index.d.ts +1 -0
- package/dist/src/{components/carousel → hooks}/useScreenSize.d.ts +4 -4
- package/dist/src/symbols/ChevronUp.d.ts +2 -0
- package/dist/src/symbols/GripVertical.d.ts +2 -0
- package/dist/src/symbols/InfoCircledFilled.d.ts +2 -0
- package/dist/src/symbols/Plus.d.ts +2 -0
- package/dist/src/symbols/Trash.d.ts +2 -0
- package/dist/src/symbols/index.d.ts +5 -0
- package/dist/src/symbols/props.d.ts +2 -2
- package/dist/symbols.cjs.js +1 -1
- package/dist/symbols.esm.js +21 -16
- package/dist/theme.css +4 -1
- package/dist/useScreenSize-DiuQZBHb.js +32 -0
- package/dist/useScreenSize-DiuQZBHb.js.map +1 -0
- package/dist/useScreenSize-UGyolnfn.cjs +2 -0
- package/dist/useScreenSize-UGyolnfn.cjs.map +1 -0
- package/package.json +5 -1
- package/dist/Toast-CRG3g8vr.js +0 -512
- package/dist/Toast-CRG3g8vr.js.map +0 -1
- package/dist/Toast-wRAL8PRi.cjs +0 -2
- package/dist/Toast-wRAL8PRi.cjs.map +0 -1
- package/dist/Window-5IZnBJt9.cjs +0 -2
- package/dist/Window-5IZnBJt9.cjs.map +0 -1
- package/dist/Window-uX5BuBwi.js.map +0 -1
- package/dist/src/components/slot/Slot.d.ts +0 -7
- package/dist/src/components/slot/index.d.ts +0 -1
- package/dist/src/components/tooltip/hooks.d.ts +0 -31
package/dist/hooks.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useToast-CraVIawn.cjs"),o=require("./useScreenSize-UGyolnfn.cjs");exports.ActionModalContext=e.ActionModalContext;exports.useActionModal=e.useActionModal;exports.useToast=e.useToast;exports.useScreenSize=o.useScreenSize;
|
|
2
2
|
//# sourceMappingURL=hooks.cjs.js.map
|
package/dist/hooks.esm.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as a, u as s, a as t } from "./useToast-CEKvEJVB.js";
|
|
2
|
+
import { u } from "./useScreenSize-DiuQZBHb.js";
|
|
2
3
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
a as ActionModalContext,
|
|
5
|
+
s as useActionModal,
|
|
6
|
+
u as useScreenSize,
|
|
7
|
+
t as useToast
|
|
6
8
|
};
|
|
7
9
|
//# sourceMappingURL=hooks.esm.js.map
|
package/dist/hooks.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
package/dist/providers.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),s=require("react"),x=require("./Toast-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),s=require("react"),x=require("./Toast-Dj3X8g0Q.cjs"),g=require("./useToast-CraVIawn.cjs");require("react-dom");const b=require("./join-BVMUUvyP.cjs");function y({children:d}){const[e,n]=s.useState(null),m=s.useCallback(t=>new Promise(l=>{n({isOpen:!0,type:"confirm",title:t.title,message:t.message,confirmText:t.confirmText,cancelText:t.cancelText,destructive:t.destructive,resolve:l})}),[]),c=s.useCallback(t=>new Promise(l=>{n({isOpen:!0,type:"alert",title:t.title,message:t.message,confirmText:t.confirmText,destructive:t.destructive,resolve:l})}),[]),i=s.useCallback(()=>{e!=null&&e.resolve&&(e.type==="confirm"?e.resolve(!1):e.resolve()),n(null)},[e]),a=s.useCallback(()=>{e!=null&&e.resolve&&(e.type==="confirm"?e.resolve(!0):e.resolve()),n(null)},[e]),f={confirm:m,alert:c};return o.jsxs(g.ActionModalContext.Provider,{value:f,children:[d,e&&e.type==="alert"&&o.jsx(x.ActionModal,{type:"alert",isOpen:e.isOpen,onClose:i,title:e.title,message:e.message,confirmText:e.confirmText,destructive:e.destructive,onConfirm:a,className:"bg-white dark:bg-gray-800 rounded-lg"}),e&&e.type==="confirm"&&o.jsx(x.ActionModal,{type:"confirm",isOpen:e.isOpen,onClose:i,title:e.title,message:e.message,confirmText:e.confirmText,cancelText:e.cancelText,destructive:e.destructive,onConfirm:a,className:"bg-white dark:bg-gray-800 rounded-lg"})]})}const C={"top-right":"top-4 right-4","top-left":"top-4 left-4","bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-center":"top-4 left-1/2 -translate-x-1/2","bottom-center":"bottom-4 left-1/2 -translate-x-1/2"};function h({children:d,customTypes:e,customComponent:n,position:m="top-right",maxToasts:c=5}){const[i,a]=s.useState([]),f=s.useCallback(r=>{const v=`toast-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,u=r.id||v,T={id:u,title:r.title,description:r.description,type:r.type||"info",action:r.action,duration:r.duration??5e3};return a(p=>[T,...p].slice(0,c)),u},[c]),t=s.useCallback(r=>{a(v=>v.filter(u=>u.id!==r))},[]),l={addToast:f,removeToast:t,toasts:i};return o.jsxs(g.ToastContext.Provider,{value:l,children:[d,o.jsx("div",{className:b.join("fixed z-50 pointer-events-none max-w-sm w-full space-y-2",C[m]),role:"region","aria-label":"Notifications",children:i.map(r=>o.jsx("div",{className:"pointer-events-auto",children:o.jsx(x.Toast,{...r,onRemove:t,customTypes:e,customComponent:n})},r.id))})]})}exports.ActionModalProvider=y;exports.ToastProvider=h;
|
|
2
2
|
//# sourceMappingURL=providers.cjs.js.map
|
package/dist/providers.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as g, jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import { useState as x, useCallback as s } from "react";
|
|
3
|
-
import { A as v, T as y } from "./Toast-
|
|
4
|
-
import "react-dom";
|
|
3
|
+
import { A as v, T as y } from "./Toast-DUpf_XxS.js";
|
|
5
4
|
import { A as b, T as C } from "./useToast-CEKvEJVB.js";
|
|
5
|
+
import "react-dom";
|
|
6
6
|
import { j as w } from "./join-BmgR_f4v.js";
|
|
7
7
|
function $({ children: d }) {
|
|
8
8
|
const [e, o] = x(null), f = s((t) => new Promise((a) => {
|
|
@@ -1,21 +1,57 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AccordionItemProps } from './AccordionItem';
|
|
3
3
|
export interface AccordionOption {
|
|
4
|
+
/** Unique identifier for the accordion item. */
|
|
4
5
|
id?: string;
|
|
6
|
+
/** The title/header content for the accordion item. */
|
|
5
7
|
title: React.ReactNode;
|
|
8
|
+
/** The main content that will be shown when the item is expanded. */
|
|
6
9
|
content: React.ReactNode;
|
|
10
|
+
/** Whether the accordion item is disabled and cannot be toggled. */
|
|
7
11
|
disabled?: boolean;
|
|
12
|
+
/** Whether the accordion item should be open by default. */
|
|
8
13
|
defaultOpen?: boolean;
|
|
9
14
|
}
|
|
10
15
|
export interface AccordionProps {
|
|
16
|
+
/** Unique identifier for the accordion container. */
|
|
11
17
|
id?: string;
|
|
18
|
+
/** Array of accordion items with id, title, content, and optional disabled state. */
|
|
12
19
|
items?: AccordionOption[];
|
|
20
|
+
/** AccordionItem components when using the component approach. */
|
|
13
21
|
children?: React.ReactElement<AccordionItemProps>[] | React.ReactElement<AccordionItemProps>;
|
|
22
|
+
/** Additional CSS classes to apply to the accordion container. */
|
|
14
23
|
className?: string;
|
|
24
|
+
/** Additional CSS classes to apply to individual accordion items. */
|
|
15
25
|
itemClassName?: string;
|
|
26
|
+
/** Whether multiple items can be open simultaneously. */
|
|
16
27
|
allowMultiple?: boolean;
|
|
28
|
+
/** Array of item IDs that should be open by default. */
|
|
17
29
|
defaultOpenItems?: string[];
|
|
30
|
+
/** Additional CSS classes to apply to all trigger buttons. */
|
|
18
31
|
triggersClassName?: string;
|
|
32
|
+
/** Additional CSS classes to apply to all content bodies. */
|
|
19
33
|
bodiesClassName?: string;
|
|
20
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* A flexible accordion component that supports expandable/collapsible content sections.
|
|
37
|
+
* Can be used either with an items array or with AccordionItem child components.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```tsx
|
|
41
|
+
* // Using items prop
|
|
42
|
+
* <Accordion
|
|
43
|
+
* items={[
|
|
44
|
+
* { id: "1", title: "Section 1", content: "Content here" },
|
|
45
|
+
* { id: "2", title: "Section 2", content: "More content" }
|
|
46
|
+
* ]}
|
|
47
|
+
* allowMultiple={false}
|
|
48
|
+
* />
|
|
49
|
+
*
|
|
50
|
+
* // Using children
|
|
51
|
+
* <Accordion allowMultiple>
|
|
52
|
+
* <AccordionItem title="Custom Section" content="Custom content" />
|
|
53
|
+
* <AccordionItem title="Another Section" content="Another content" />
|
|
54
|
+
* </Accordion>
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
21
57
|
export declare function Accordion({ id, items, children, className, itemClassName, allowMultiple, defaultOpenItems, triggersClassName, bodiesClassName, }: AccordionProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,11 +1,31 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { AccordionOption } from './Accordion';
|
|
3
3
|
export interface AccordionItemProps extends Omit<AccordionOption, 'defaultOpen'> {
|
|
4
|
+
/** Content to render inside the accordion item. */
|
|
4
5
|
children?: React.ReactNode;
|
|
6
|
+
/** Additional CSS classes to apply to the accordion item. */
|
|
5
7
|
className?: string;
|
|
8
|
+
/** Whether the accordion item is currently open. */
|
|
6
9
|
isOpen?: boolean;
|
|
10
|
+
/** Callback function called when the accordion item is toggled. */
|
|
7
11
|
onToggle?: () => void;
|
|
12
|
+
/** Additional CSS classes to apply to the trigger button. */
|
|
8
13
|
triggerClassName?: string;
|
|
14
|
+
/** Additional CSS classes to apply to the content body. */
|
|
9
15
|
bodyClassName?: string;
|
|
10
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Individual accordion item component with expandable content.
|
|
19
|
+
* Provides keyboard navigation and accessibility features.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <AccordionItem
|
|
24
|
+
* title="FAQ Question"
|
|
25
|
+
* content="This is the answer to the question"
|
|
26
|
+
* isOpen={false}
|
|
27
|
+
* onToggle={() => console.log('toggled')}
|
|
28
|
+
* />
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
11
31
|
export declare function AccordionItem({ id, title, content, children, className, disabled, isOpen, onToggle, triggerClassName, bodyClassName, }: AccordionItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,21 +1,55 @@
|
|
|
1
1
|
import { ModalProps } from '@moondreamsdev/dreamer-ui/components';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
interface BaseActionModalProps extends Omit<ModalProps, 'children' | 'actions'> {
|
|
4
|
+
/** The main content/message to display in the modal. */
|
|
4
5
|
message: React.ReactNode;
|
|
6
|
+
/** Whether to style the confirm button with destructive/danger styling. */
|
|
5
7
|
destructive?: boolean;
|
|
6
8
|
}
|
|
7
9
|
interface AlertModalProps extends BaseActionModalProps {
|
|
10
|
+
/** The type of action modal - alert shows only OK, confirm shows OK and Cancel. */
|
|
8
11
|
type: 'alert';
|
|
12
|
+
/** Custom text for the confirm/OK button. */
|
|
9
13
|
confirmText?: string;
|
|
14
|
+
/** Callback fired when the confirm/OK button is clicked. */
|
|
10
15
|
onConfirm?: () => void;
|
|
11
16
|
cancelText?: never;
|
|
12
17
|
}
|
|
13
18
|
interface ConfirmModalProps extends BaseActionModalProps {
|
|
19
|
+
/** The type of action modal - alert shows only OK, confirm shows OK and Cancel. */
|
|
14
20
|
type: 'confirm';
|
|
21
|
+
/** Custom text for the confirm/OK button. */
|
|
15
22
|
confirmText?: string;
|
|
23
|
+
/** Custom text for the cancel button (only for confirm type). */
|
|
16
24
|
cancelText?: string;
|
|
25
|
+
/** Callback fired when the confirm/OK button is clicked. */
|
|
17
26
|
onConfirm?: () => void;
|
|
18
27
|
}
|
|
19
28
|
export type ActionModalProps = AlertModalProps | ConfirmModalProps;
|
|
29
|
+
/**
|
|
30
|
+
* A modal dialog for user confirmation or alerts with predefined action buttons.
|
|
31
|
+
* Supports both alert (single OK button) and confirm (OK + Cancel buttons) modes.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* // Alert modal
|
|
36
|
+
* <ActionModal
|
|
37
|
+
* type="alert"
|
|
38
|
+
* message="Operation completed successfully!"
|
|
39
|
+
* onClose={() => setShowModal(false)}
|
|
40
|
+
* isOpen={showModal}
|
|
41
|
+
* />
|
|
42
|
+
*
|
|
43
|
+
* // Confirmation modal
|
|
44
|
+
* <ActionModal
|
|
45
|
+
* type="confirm"
|
|
46
|
+
* message="Are you sure you want to delete this item?"
|
|
47
|
+
* destructive
|
|
48
|
+
* onConfirm={() => deleteItem()}
|
|
49
|
+
* onClose={() => setShowModal(false)}
|
|
50
|
+
* isOpen={showModal}
|
|
51
|
+
* />
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
20
54
|
export declare function ActionModal({ type, message, cancelText, confirmText, onConfirm, onClose, destructive, title, ...modalProps }: ActionModalProps): import("react/jsx-runtime").JSX.Element;
|
|
21
55
|
export {};
|
|
@@ -1,23 +1,39 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AvatarPreset, AvatarShape, AvatarSize } from './variants';
|
|
3
3
|
export interface AvatarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
-
/**
|
|
4
|
+
/** The HTML id attribute for the avatar */
|
|
5
5
|
id?: string;
|
|
6
6
|
/** Reference to the avatar element */
|
|
7
7
|
ref?: React.Ref<HTMLDivElement>;
|
|
8
|
-
/**
|
|
8
|
+
/** The size of the avatar */
|
|
9
9
|
size?: AvatarSize;
|
|
10
|
-
/**
|
|
10
|
+
/** The shape of the avatar */
|
|
11
11
|
shape?: AvatarShape;
|
|
12
|
-
/** Pre-defined avatar
|
|
12
|
+
/** Pre-defined cartoon-like avatar to display */
|
|
13
13
|
preset?: AvatarPreset;
|
|
14
|
-
/**
|
|
14
|
+
/** Alternative text for the avatar image */
|
|
15
15
|
alt?: string;
|
|
16
|
-
/** Additional CSS classes */
|
|
16
|
+
/** Additional CSS classes to apply to the avatar */
|
|
17
17
|
className?: string;
|
|
18
|
-
/** Custom image source
|
|
18
|
+
/** Custom image source URL */
|
|
19
19
|
src?: string;
|
|
20
|
-
/** Initials to display
|
|
20
|
+
/** Initials to display when no preset or src is provided */
|
|
21
21
|
initials?: string;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Displays user avatars with support for images, preset icons, or initials.
|
|
25
|
+
* Provides various size and shape options with built-in fallback handling.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* // With custom image
|
|
30
|
+
* <Avatar src="/user-photo.jpg" alt="John Doe" size="lg" />
|
|
31
|
+
*
|
|
32
|
+
* // With preset character
|
|
33
|
+
* <Avatar preset="astronaut" size="md" shape="circle" />
|
|
34
|
+
*
|
|
35
|
+
* // With initials fallback
|
|
36
|
+
* <Avatar initials="JD" size="sm" />
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
23
39
|
export declare function Avatar({ id, ref, size, shape, preset, alt, className, src, initials, ...props }: AvatarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,15 +1,37 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BadgeSize, BadgeUse, BadgeVariant } from './variants';
|
|
3
3
|
export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
4
|
+
/** The HTML id attribute for the badge */
|
|
4
5
|
id?: string;
|
|
6
|
+
/** Reference to the badge element */
|
|
5
7
|
ref?: React.Ref<HTMLSpanElement>;
|
|
8
|
+
/** The visual style variant of the badge */
|
|
6
9
|
variant?: BadgeVariant;
|
|
10
|
+
/** Whether to render the badge with an outline style */
|
|
7
11
|
outline?: boolean;
|
|
12
|
+
/** The content to display inside the badge */
|
|
8
13
|
children?: React.ReactNode;
|
|
14
|
+
/** The aspect ratio of the badge - square for equal padding, video for horizontal padding */
|
|
9
15
|
aspect?: 'square' | 'video';
|
|
10
|
-
/**
|
|
16
|
+
/** The semantic use of the badge for accessibility purposes */
|
|
11
17
|
use?: BadgeUse;
|
|
12
|
-
/**
|
|
18
|
+
/** The size of the badge */
|
|
13
19
|
size?: BadgeSize;
|
|
14
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* A small UI element for displaying status, labels, or categories.
|
|
23
|
+
* Supports various colors, sizes, and semantic accessibility attributes.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* // Status badge
|
|
28
|
+
* <Badge variant="success" use="status">Active</Badge>
|
|
29
|
+
*
|
|
30
|
+
* // Notification count
|
|
31
|
+
* <Badge variant="destructive" aspect="square" use="status">5</Badge>
|
|
32
|
+
*
|
|
33
|
+
* // Category tag
|
|
34
|
+
* <Badge variant="muted" outline>JavaScript</Badge>
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
15
37
|
export declare function Badge({ id, ref, variant, outline, children, className, aspect, use, size, ...props }: BadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,16 +1,37 @@
|
|
|
1
|
-
import { ButtonHTMLAttributes, Ref } from 'react';
|
|
1
|
+
import React, { ButtonHTMLAttributes, Ref } from 'react';
|
|
2
2
|
import { ButtonVariants } from './variants';
|
|
3
3
|
interface ButtonButtonProps extends Partial<ButtonVariants>, ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
4
|
href?: never;
|
|
5
|
+
/** Reference to the button element. */
|
|
5
6
|
ref?: Ref<HTMLButtonElement>;
|
|
7
|
+
/** Whether the button is in a loading state. */
|
|
6
8
|
loading?: boolean;
|
|
7
9
|
}
|
|
8
10
|
interface ButtonLinkProps extends Partial<ButtonVariants>, Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href' | 'role'> {
|
|
11
|
+
/** When provided, renders the button as a link. */
|
|
9
12
|
href: string;
|
|
13
|
+
/** Reference to the anchor element. */
|
|
10
14
|
ref?: Ref<HTMLAnchorElement>;
|
|
11
15
|
loading?: never;
|
|
16
|
+
/** Whether the button is disabled. */
|
|
12
17
|
disabled?: boolean;
|
|
13
18
|
}
|
|
14
19
|
export type ButtonProps = ButtonButtonProps | ButtonLinkProps;
|
|
20
|
+
/**
|
|
21
|
+
* A versatile button component that can render as either a button or anchor element.
|
|
22
|
+
* Supports loading states, various visual variants, and accessibility features.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* // Regular button
|
|
27
|
+
* <Button variant="primary" onClick={() => save()}>Save</Button>
|
|
28
|
+
*
|
|
29
|
+
* // Loading state
|
|
30
|
+
* <Button loading variant="primary">Processing...</Button>
|
|
31
|
+
*
|
|
32
|
+
* // Link button
|
|
33
|
+
* <Button href="/dashboard" variant="secondary">Go to Dashboard</Button>
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
15
36
|
export declare function Button({ variant, size, rounded, loading, className, ...rest }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
16
37
|
export {};
|
|
@@ -1 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An animated loading indicator with three bouncing dots.
|
|
3
|
+
* Used internally by Button component to show loading state.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```tsx
|
|
7
|
+
* <LoadingDots />
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
1
10
|
export declare function LoadingDots(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -10,7 +10,7 @@ export declare const buttonVariants: {
|
|
|
10
10
|
export type ButtonVariant = keyof typeof buttonVariants;
|
|
11
11
|
export declare const sizeVariants: {
|
|
12
12
|
readonly stripped: "";
|
|
13
|
-
readonly fitted: "size-fit";
|
|
13
|
+
readonly fitted: "size-fit leading-0";
|
|
14
14
|
readonly sm: "px-2 py-1 text-sm";
|
|
15
15
|
readonly md: "px-4 py-2 text-base";
|
|
16
16
|
readonly lg: "px-6 py-3 text-lg";
|
|
@@ -27,8 +27,11 @@ export declare const roundedVariants: {
|
|
|
27
27
|
};
|
|
28
28
|
export type ButtonRounded = keyof typeof roundedVariants;
|
|
29
29
|
export interface ButtonVariants {
|
|
30
|
+
/** The visual style variant of the button. */
|
|
30
31
|
variant: ButtonVariant;
|
|
32
|
+
/** The size of the button. */
|
|
31
33
|
size: ButtonSize;
|
|
34
|
+
/** The border radius of the button. */
|
|
32
35
|
rounded: ButtonRounded;
|
|
33
36
|
}
|
|
34
37
|
export declare const buttonDefaults: ButtonVariants;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { ReactNode, Ref } from 'react';
|
|
2
|
+
import { CalendarDateRange, UseCalendarOptions } from './hooks';
|
|
3
|
+
import { CalendarSize } from './variants';
|
|
4
|
+
export interface CalendarCustomStyles {
|
|
5
|
+
/** Custom CSS classes for the main calendar container. */
|
|
6
|
+
containerClassName?: string;
|
|
7
|
+
/** Custom CSS classes for the calendar header. */
|
|
8
|
+
headerClassName?: string;
|
|
9
|
+
/** Custom CSS classes for the navigation button container. */
|
|
10
|
+
navigationClassName?: string;
|
|
11
|
+
/** Custom CSS classes for the previous navigation button. */
|
|
12
|
+
prevButtonClassName?: string;
|
|
13
|
+
/** Custom CSS classes for the next navigation button. */
|
|
14
|
+
nextButtonClassName?: string;
|
|
15
|
+
/** Custom CSS classes for the calendar title. */
|
|
16
|
+
titleClassName?: string;
|
|
17
|
+
/** Custom CSS classes for the view selector buttons. */
|
|
18
|
+
viewSelectorClassName?: string;
|
|
19
|
+
/** Custom CSS classes for the month and year dropdown selectors. */
|
|
20
|
+
monthYearSelectorsClassName?: string;
|
|
21
|
+
/** Custom CSS classes for the today button. */
|
|
22
|
+
todayButtonClassName?: string;
|
|
23
|
+
/** Custom CSS classes for the weekdays header row. */
|
|
24
|
+
weekdaysClassName?: string;
|
|
25
|
+
/** Custom CSS classes for individual weekday cells. */
|
|
26
|
+
weekdayClassName?: string;
|
|
27
|
+
/** Custom CSS classes for the month view grid. */
|
|
28
|
+
monthGridClassName?: string;
|
|
29
|
+
/** Custom CSS classes for the week view grid. */
|
|
30
|
+
weekGridClassName?: string;
|
|
31
|
+
/** Custom CSS classes for the day view grid. */
|
|
32
|
+
dayGridClassName?: string;
|
|
33
|
+
/** Custom CSS classes for date cells. */
|
|
34
|
+
cellClassName?: string;
|
|
35
|
+
/** Custom CSS classes for selected date cells. */
|
|
36
|
+
selectedCellClassName?: string;
|
|
37
|
+
/** Custom CSS classes for today's date cell. */
|
|
38
|
+
todayCellClassName?: string;
|
|
39
|
+
/** Custom CSS classes for disabled date cells. */
|
|
40
|
+
disabledCellClassName?: string;
|
|
41
|
+
/** Custom CSS classes for date cells within a selected range. */
|
|
42
|
+
rangeCellClassName?: string;
|
|
43
|
+
/** Custom CSS classes for the start date of a selected range. */
|
|
44
|
+
rangeStartCellClassName?: string;
|
|
45
|
+
/** Custom CSS classes for the end date of a selected range. */
|
|
46
|
+
rangeEndCellClassName?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface CalendarProps extends Omit<UseCalendarOptions, 'onDateSelect' | 'onRangeSelect'> {
|
|
49
|
+
/** The HTML id attribute for the calendar. */
|
|
50
|
+
id?: string;
|
|
51
|
+
/** Reference to the calendar container element. */
|
|
52
|
+
ref?: Ref<HTMLDivElement>;
|
|
53
|
+
/** Additional CSS classes to apply to the calendar container. */
|
|
54
|
+
className?: string;
|
|
55
|
+
/** The size of the calendar component. */
|
|
56
|
+
size?: CalendarSize;
|
|
57
|
+
/** Object containing custom CSS classes for different calendar elements. */
|
|
58
|
+
customStyles?: CalendarCustomStyles;
|
|
59
|
+
/** Custom render function for date cells. */
|
|
60
|
+
renderCell?: (date: Date, isSelected: boolean, isDisabled: boolean, isToday: boolean) => ReactNode;
|
|
61
|
+
/** Whether to show the view selector buttons. */
|
|
62
|
+
showViewSelector?: boolean;
|
|
63
|
+
/** Whether to show the navigation buttons. */
|
|
64
|
+
showNavigation?: boolean;
|
|
65
|
+
/** Layout of navigation buttons - adjacent (both on left) or around (on sides of title). */
|
|
66
|
+
navigationLayout?: 'adjacent' | 'around';
|
|
67
|
+
/** Whether to show month and year as dropdown selectors for easier navigation. */
|
|
68
|
+
useMonthYearSelector?: boolean;
|
|
69
|
+
/** Whether to show a button to quickly jump to the current date. */
|
|
70
|
+
showTodayButton?: boolean;
|
|
71
|
+
/** Callback fired when a date is selected in single mode. */
|
|
72
|
+
onDateSelect?: (date: Date) => void;
|
|
73
|
+
/** Callback fired when a date range is selected in range mode. */
|
|
74
|
+
onRangeSelect?: (range: CalendarDateRange) => void;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A full-featured calendar component supporting single date selection, date ranges,
|
|
78
|
+
* and multiple view modes (month/week/day). Includes navigation, accessibility features,
|
|
79
|
+
* and extensive customization options.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```tsx
|
|
83
|
+
* // Basic date picker
|
|
84
|
+
* <Calendar
|
|
85
|
+
* mode="single"
|
|
86
|
+
* onDateSelect={(date) => setSelectedDate(date)}
|
|
87
|
+
* initialDate={new Date()}
|
|
88
|
+
* />
|
|
89
|
+
*
|
|
90
|
+
* // Date range picker
|
|
91
|
+
* <Calendar
|
|
92
|
+
* mode="range"
|
|
93
|
+
* onRangeSelect={(range) => setDateRange(range)}
|
|
94
|
+
* showTodayButton
|
|
95
|
+
* />
|
|
96
|
+
*
|
|
97
|
+
* // Multi-view calendar
|
|
98
|
+
* <Calendar
|
|
99
|
+
* showViewSelector
|
|
100
|
+
* useMonthYearSelector
|
|
101
|
+
* navigationLayout="adjacent"
|
|
102
|
+
* />
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
export declare function Calendar({ id, ref, className, size, customStyles, view, mode, initialDate, minDate, maxDate, renderCell, showViewSelector, showNavigation, navigationLayout, useMonthYearSelector, showTodayButton, onDateSelect, onRangeSelect, ...rest }: CalendarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface CalendarDateRange {
|
|
2
|
+
/** The start date of the range, or null if not selected. */
|
|
3
|
+
start: Date | null;
|
|
4
|
+
/** The end date of the range, or null if not selected. */
|
|
5
|
+
end: Date | null;
|
|
6
|
+
}
|
|
7
|
+
export interface UseCalendarOptions {
|
|
8
|
+
/** The initial date to display and optionally select. */
|
|
9
|
+
initialDate?: Date;
|
|
10
|
+
/** The selection mode - single date or date range selection. */
|
|
11
|
+
mode?: 'single' | 'range';
|
|
12
|
+
/** The minimum selectable date (dates before this will be disabled). */
|
|
13
|
+
minDate?: Date;
|
|
14
|
+
/** The maximum selectable date (dates after this will be disabled). */
|
|
15
|
+
maxDate?: Date;
|
|
16
|
+
/** The calendar view to display. */
|
|
17
|
+
view?: 'month' | 'week' | 'day';
|
|
18
|
+
/** Callback fired when a date is selected in single mode. */
|
|
19
|
+
onDateSelect?: (date: Date) => void;
|
|
20
|
+
/** Callback fired when a date range is selected in range mode. */
|
|
21
|
+
onRangeSelect?: (range: CalendarDateRange) => void;
|
|
22
|
+
}
|
|
23
|
+
export declare function useCalendar(options?: UseCalendarOptions): {
|
|
24
|
+
currentDate: Date;
|
|
25
|
+
selectedDate: Date | null;
|
|
26
|
+
selectedRange: CalendarDateRange | null;
|
|
27
|
+
view: "month" | "week" | "day";
|
|
28
|
+
daysInView: Date[];
|
|
29
|
+
selectDate: (date: Date) => void;
|
|
30
|
+
navigate: (direction: 'prev' | 'next') => void;
|
|
31
|
+
changeView: (newView: 'month' | 'week' | 'day') => void;
|
|
32
|
+
goToDate: (date: Date) => void;
|
|
33
|
+
changeMonth: (month: number) => void;
|
|
34
|
+
changeYear: (year: number) => void;
|
|
35
|
+
isDateSelected: (date: Date) => boolean | null;
|
|
36
|
+
isDateDisabled: (date: Date) => boolean;
|
|
37
|
+
isDateInRange: (date: Date) => boolean;
|
|
38
|
+
isDateRangeStart: (date: Date) => boolean;
|
|
39
|
+
isDateRangeEnd: (date: Date) => boolean;
|
|
40
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare const calendarSizeVariants: {
|
|
2
|
+
readonly small: {
|
|
3
|
+
readonly container: "text-xs";
|
|
4
|
+
readonly cell: "w-7 h-7 text-xs";
|
|
5
|
+
readonly header: "text-sm px-2 py-1";
|
|
6
|
+
readonly navigation: "p-1";
|
|
7
|
+
readonly weekdays: "text-xs px-1 py-1";
|
|
8
|
+
};
|
|
9
|
+
readonly medium: {
|
|
10
|
+
readonly container: "text-sm";
|
|
11
|
+
readonly cell: "w-9 h-9 text-sm";
|
|
12
|
+
readonly header: "text-base px-3 py-2";
|
|
13
|
+
readonly navigation: "p-2";
|
|
14
|
+
readonly weekdays: "text-sm px-2 py-2";
|
|
15
|
+
};
|
|
16
|
+
readonly large: {
|
|
17
|
+
readonly container: "text-base";
|
|
18
|
+
readonly cell: "w-12 h-12 text-base";
|
|
19
|
+
readonly header: "text-lg px-4 py-3";
|
|
20
|
+
readonly navigation: "p-3";
|
|
21
|
+
readonly weekdays: "text-base px-3 py-2";
|
|
22
|
+
};
|
|
23
|
+
readonly auto: {
|
|
24
|
+
readonly container: "w-full h-full";
|
|
25
|
+
readonly cell: "flex-1 min-h-[2rem] text-sm";
|
|
26
|
+
readonly header: "text-base px-3 py-2";
|
|
27
|
+
readonly navigation: "p-2";
|
|
28
|
+
readonly weekdays: "text-sm px-2 py-2";
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export type CalendarSize = keyof typeof calendarSizeVariants;
|
|
32
|
+
export declare const calendarViewVariants: {
|
|
33
|
+
readonly month: "grid-cols-7";
|
|
34
|
+
readonly week: "grid-cols-7";
|
|
35
|
+
readonly day: "grid-cols-1";
|
|
36
|
+
};
|
|
37
|
+
export type CalendarView = keyof typeof calendarViewVariants;
|
|
38
|
+
export declare const calendarDefaults: {
|
|
39
|
+
readonly size: "small" | "auto" | "medium" | "large";
|
|
40
|
+
readonly view: "month" | "week" | "day";
|
|
41
|
+
};
|
|
@@ -1,23 +1,44 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CalloutVariants } from './variants';
|
|
3
3
|
export interface CalloutProps {
|
|
4
|
-
/**The id of the
|
|
4
|
+
/** The id of the callout element */
|
|
5
5
|
id?: string;
|
|
6
|
-
/**
|
|
6
|
+
/** Reference to the callout element */
|
|
7
7
|
ref?: React.Ref<HTMLDivElement>;
|
|
8
|
-
/**The variant of the
|
|
8
|
+
/** The visual style variant of the callout */
|
|
9
9
|
variant?: CalloutVariants;
|
|
10
|
-
/**
|
|
11
|
-
icon?:
|
|
12
|
-
/**
|
|
10
|
+
/** Custom icon to display. Will use default icon if not provided. Pass null to hide the icon */
|
|
11
|
+
icon?: string | React.ReactElement | null;
|
|
12
|
+
/** Optional title for the callout */
|
|
13
13
|
title?: React.ReactNode;
|
|
14
|
-
/** The
|
|
14
|
+
/** The main content to display inside the callout */
|
|
15
15
|
description?: React.ReactNode;
|
|
16
|
-
/** Additional classes to apply to the
|
|
16
|
+
/** Additional CSS classes to apply to the callout */
|
|
17
17
|
className?: string;
|
|
18
|
-
/** Whether the
|
|
18
|
+
/** Whether the callout can be dismissed */
|
|
19
19
|
dismissible?: boolean;
|
|
20
|
-
/** Callback
|
|
20
|
+
/** Callback fired when the dismiss button is clicked */
|
|
21
21
|
onDismiss?: () => void;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* A prominent notice component for displaying important information, alerts, or status messages.
|
|
25
|
+
* Supports different visual variants with appropriate icons and dismissible functionality.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* // Info callout
|
|
30
|
+
* <Callout variant="info" title="Tip" description="Save your work frequently" />
|
|
31
|
+
*
|
|
32
|
+
* // Warning with custom content
|
|
33
|
+
* <Callout
|
|
34
|
+
* variant="warning"
|
|
35
|
+
* title="Unsaved Changes"
|
|
36
|
+
* description={<>You have <strong>3 unsaved</strong> documents.</>}
|
|
37
|
+
* dismissible
|
|
38
|
+
* />
|
|
39
|
+
*
|
|
40
|
+
* // Success notification
|
|
41
|
+
* <Callout variant="success" description="Profile updated successfully!" />
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
23
44
|
export declare function Callout({ id, ref, variant, icon, title, description, className, dismissible, onDismiss, }: CalloutProps): import("react/jsx-runtime").JSX.Element | null;
|