@delightui/components 0.1.16 → 0.1.17
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/cjs/App.d.ts +0 -1
- package/dist/cjs/components/atoms/Input/Input.d.ts +1 -0
- package/dist/cjs/components/atoms/Input/Input.types.d.ts +4 -0
- package/dist/cjs/components/atoms/List/List.d.ts +9 -3
- package/dist/cjs/components/atoms/List/List.types.d.ts +50 -0
- package/dist/cjs/components/atoms/List/components/ListItem.d.ts +9 -0
- package/dist/cjs/components/atoms/List/components/RootList.d.ts +9 -0
- package/dist/cjs/components/atoms/List/components/SortableList.d.ts +11 -0
- package/dist/cjs/components/atoms/List/components/SortableListItem.d.ts +9 -0
- package/dist/cjs/components/molecules/DatePicker/DatePicker.types.d.ts +23 -3
- package/dist/cjs/components/molecules/DatePicker/Plugins/utils.d.ts +18 -0
- package/dist/cjs/components/molecules/DatePicker/Plugins/utils.test.d.ts +1 -0
- package/dist/cjs/components/molecules/DatePicker/index.d.ts +2 -2
- package/dist/cjs/components/molecules/Nav/NavLink/NavLink.types.d.ts +5 -1
- package/dist/cjs/components/molecules/Select/Select.types.d.ts +5 -0
- package/dist/cjs/components/molecules/TabItem/TabItem.types.d.ts +8 -5
- package/dist/cjs/components/molecules/Tabs/Tabs.Context.d.ts +1 -1
- package/dist/cjs/components/molecules/Tabs/Tabs.types.d.ts +22 -0
- package/dist/cjs/library.css +12595 -48667
- package/dist/cjs/library.d.ts +0 -1
- package/dist/cjs/library.js +3 -3
- package/dist/cjs/library.js.map +1 -1
- package/dist/cjs/modules/theme/ThemeProvider.d.ts +0 -2
- package/dist/cjs/modules/theme/useBuildVariantProps.d.ts +4 -0
- package/dist/esm/App.d.ts +0 -1
- package/dist/esm/components/atoms/Input/Input.d.ts +1 -0
- package/dist/esm/components/atoms/Input/Input.types.d.ts +4 -0
- package/dist/esm/components/atoms/List/List.d.ts +9 -3
- package/dist/esm/components/atoms/List/List.types.d.ts +50 -0
- package/dist/esm/components/atoms/List/components/ListItem.d.ts +9 -0
- package/dist/esm/components/atoms/List/components/RootList.d.ts +9 -0
- package/dist/esm/components/atoms/List/components/SortableList.d.ts +11 -0
- package/dist/esm/components/atoms/List/components/SortableListItem.d.ts +9 -0
- package/dist/esm/components/molecules/DatePicker/DatePicker.types.d.ts +23 -3
- package/dist/esm/components/molecules/DatePicker/Plugins/utils.d.ts +18 -0
- package/dist/esm/components/molecules/DatePicker/Plugins/utils.test.d.ts +1 -0
- package/dist/esm/components/molecules/DatePicker/index.d.ts +2 -2
- package/dist/esm/components/molecules/Nav/NavLink/NavLink.types.d.ts +5 -1
- package/dist/esm/components/molecules/Select/Select.types.d.ts +5 -0
- package/dist/esm/components/molecules/TabItem/TabItem.types.d.ts +8 -5
- package/dist/esm/components/molecules/Tabs/Tabs.Context.d.ts +1 -1
- package/dist/esm/components/molecules/Tabs/Tabs.types.d.ts +22 -0
- package/dist/esm/library.css +12595 -48667
- package/dist/esm/library.d.ts +0 -1
- package/dist/esm/library.js +3 -3
- package/dist/esm/library.js.map +1 -1
- package/dist/esm/modules/theme/ThemeProvider.d.ts +0 -2
- package/dist/esm/modules/theme/useBuildVariantProps.d.ts +4 -0
- package/dist/index.d.ts +143 -54
- package/package.json +1 -1
package/dist/cjs/App.d.ts
CHANGED
|
@@ -6,5 +6,6 @@ declare const Input: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttribu
|
|
|
6
6
|
invalid?: boolean;
|
|
7
7
|
leadingIcon?: React.ReactNode;
|
|
8
8
|
trailingIcon?: React.ReactNode;
|
|
9
|
+
'component-variant'?: string;
|
|
9
10
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
10
11
|
export default Input;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { ListItemType, ListProps } from './List.types';
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
/**
|
|
3
|
+
* A wrapper component that manages the rendering of either a sortable or regular list based on the provided props.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The type of the list items.
|
|
6
|
+
* @param {ListProps<T>} props - The properties for the list wrapper.
|
|
7
|
+
* @returns {JSX.Element} The rendered list component.
|
|
8
|
+
*/
|
|
9
|
+
declare const List: <T extends ListItemType>(props: ListProps<T>) => import("react").JSX.Element;
|
|
10
|
+
export default List;
|
|
@@ -1,11 +1,61 @@
|
|
|
1
1
|
import type { Dispatch, HTMLAttributes, SetStateAction } from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* Enum for the alignment of the list.
|
|
4
|
+
*
|
|
5
|
+
* @typedef {'Horizontal' | 'Vertical'} ListAlignEnum
|
|
4
6
|
*/
|
|
5
7
|
export type ListAlignEnum = 'Horizontal' | 'Vertical';
|
|
8
|
+
/**
|
|
9
|
+
* Represents a generic list item.
|
|
10
|
+
*
|
|
11
|
+
* @property {string | number} [id] - A unique identifier for the list item. This is optional and can be auto-generated if not provided.
|
|
12
|
+
*/
|
|
6
13
|
export type ListItemType = object & {
|
|
7
14
|
id?: string | number;
|
|
8
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Props for an individual list item component.
|
|
18
|
+
*
|
|
19
|
+
* @template T - The type of the list item.
|
|
20
|
+
* @property {string | number} id - The unique identifier of the list item.
|
|
21
|
+
* @property {React.FC<any>} component - The React functional component used to render the list item.
|
|
22
|
+
* @property {T} item - The data for the list item.
|
|
23
|
+
*/
|
|
24
|
+
export type ListItemProps<T extends ListItemType> = {
|
|
25
|
+
id: string | number;
|
|
26
|
+
component: React.FC<any>;
|
|
27
|
+
item: T;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Props for the root list component, excluding certain properties.
|
|
31
|
+
*
|
|
32
|
+
* @template T - The type of the list items.
|
|
33
|
+
*/
|
|
34
|
+
export type RootListProps<T extends ListItemType> = Omit<ListProps<T>, 'data' | 'component' | 'keyExtractor' | 'sortable'>;
|
|
35
|
+
/**
|
|
36
|
+
* Props for the sortable list component.
|
|
37
|
+
*
|
|
38
|
+
* @template T - The type of the list items, which must include an `id` property.
|
|
39
|
+
* @property {T[]} data - The list of items to be rendered in the sortable list.
|
|
40
|
+
*/
|
|
41
|
+
export type SortableListProps<T extends {
|
|
42
|
+
id: string | number;
|
|
43
|
+
}> = ListProps<T> & {
|
|
44
|
+
data: T[];
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Props for the list wrapper component.
|
|
48
|
+
*
|
|
49
|
+
* @template T - The type of the list items.
|
|
50
|
+
* @property {T[]} [data] - The data to be rendered in the list.
|
|
51
|
+
* @property {React.FC<any>} component - The React functional component used to render each list item.
|
|
52
|
+
* @property {(item: T, index: number) => string | number} [keyExtractor] - A function to extract unique keys for each item.
|
|
53
|
+
* @property {'Horizontal' | 'Vertical'} [align='Vertical'] - The alignment of the list. Defaults to `'Vertical'`.
|
|
54
|
+
* @property {boolean} [wrap] - Whether the list content should wrap.
|
|
55
|
+
* @property {string} [className] - Additional class for styling the list.
|
|
56
|
+
* @property {boolean} [sortable] - Whether the list items can be sorted using drag-and-drop.
|
|
57
|
+
* @property {Dispatch<SetStateAction<T[]>>} [updateSortOrder] - Callback function to update the order of the list items after sorting.
|
|
58
|
+
*/
|
|
9
59
|
export type ListProps<T extends ListItemType> = HTMLAttributes<HTMLUListElement> & {
|
|
10
60
|
/**
|
|
11
61
|
* The data to be rendered in the list.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ListItemProps, ListItemType } from "../List.types";
|
|
2
|
+
/**
|
|
3
|
+
* A list item component that renders a single item.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The type of the list item.
|
|
6
|
+
* @param {ListItemProps<T>} props - The properties for the list item.
|
|
7
|
+
* @returns {JSX.Element} The rendered list item.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ListItem: <T extends ListItemType>(props: ListItemProps<T>) => import("react").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ListItemType, RootListProps } from "../List.types";
|
|
2
|
+
/**
|
|
3
|
+
* A root list component that provides layout and styling for list items.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The type of the list items.
|
|
6
|
+
* @param {RootListProps<T>} props - The properties for the root list.
|
|
7
|
+
* @returns {JSX.Element} The rendered root list.
|
|
8
|
+
*/
|
|
9
|
+
export declare const RootList: <T extends ListItemType>(props: RootListProps<T>) => import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SortableListProps } from "../List.types";
|
|
2
|
+
/**
|
|
3
|
+
* A sortable list component that allows drag-and-drop reordering of items.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The type of the list items, which must include an `id` property.
|
|
6
|
+
* @param {SortableListProps<T>} props - The properties for the sortable list.
|
|
7
|
+
* @returns {JSX.Element} The rendered sortable list.
|
|
8
|
+
*/
|
|
9
|
+
export declare const SortableList: <T extends {
|
|
10
|
+
id: string | number;
|
|
11
|
+
}>(props: SortableListProps<T>) => import("react").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ListItemProps, ListItemType } from "../List.types";
|
|
2
|
+
/**
|
|
3
|
+
* A sortable item component that integrates with the dnd-kit library for drag-and-drop functionality.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The type of the list item.
|
|
6
|
+
* @param {ListItemProps<T>} props - The properties for the sortable item.
|
|
7
|
+
* @returns {JSX.Element} The rendered sortable item.
|
|
8
|
+
*/
|
|
9
|
+
export declare const SortableItem: <T extends ListItemType>(props: ListItemProps<T>) => import("react").JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Plugin } from 'flatpickr/dist/types/options';
|
|
1
2
|
import FlatPickr from 'react-flatpickr';
|
|
2
3
|
type DatePickerPosition = 'auto' | 'above' | 'below' | 'auto left' | 'auto center' | 'auto right' | 'above left' | 'above center' | 'above right' | 'below left' | 'below center' | 'below right';
|
|
3
4
|
export type DatePickerProps = {
|
|
@@ -69,17 +70,36 @@ export type DatePickerProps = {
|
|
|
69
70
|
*/
|
|
70
71
|
position?: DatePickerPosition;
|
|
71
72
|
/**
|
|
72
|
-
* Function to parse date
|
|
73
|
-
*
|
|
73
|
+
* Function to parse date strings into Date objects.
|
|
74
|
+
* Used for parsing both the initial date string and any date strings entered in the input field.
|
|
75
|
+
* @param date - The date value to parse, can be a string
|
|
76
|
+
* @param format - Optional format string to use when parsing date strings
|
|
77
|
+
* @returns A Date object representing the parsed date
|
|
74
78
|
*/
|
|
75
|
-
parseDate?: (date: string) => Date;
|
|
79
|
+
parseDate?: (date: string, format?: string) => Date;
|
|
76
80
|
/**
|
|
77
81
|
* Allow user to type date/time in input.
|
|
78
82
|
* @default false
|
|
79
83
|
*/
|
|
80
84
|
allowInput?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Container element for the calendar when used inside a Popover
|
|
87
|
+
*/
|
|
88
|
+
container?: HTMLElement | null;
|
|
89
|
+
/**
|
|
90
|
+
* Custom time picker plugin
|
|
91
|
+
*/
|
|
92
|
+
customTimePickerPlugin?: (config: CustomTimePickerConfig) => Plugin;
|
|
93
|
+
/**
|
|
94
|
+
* Custom time picker plugin
|
|
95
|
+
*/
|
|
96
|
+
customDateTimePickerPlugin?: (config: CustomTimePickerConfig) => Plugin;
|
|
81
97
|
};
|
|
82
98
|
export type CustomTimePickerConfig = {
|
|
83
99
|
minuteStep: number;
|
|
100
|
+
/**
|
|
101
|
+
* Container element for the calendar when used inside a Popover
|
|
102
|
+
*/
|
|
103
|
+
container?: HTMLElement | null;
|
|
84
104
|
};
|
|
85
105
|
export {};
|
|
@@ -30,3 +30,21 @@ export declare const formatTime: (date: Date) => string;
|
|
|
30
30
|
*/
|
|
31
31
|
export declare const toggleDropdownVisibility: (dropdown: HTMLDivElement, isVisible: boolean) => void;
|
|
32
32
|
export declare const generateTimeOptions: (minuteStep: number) => string[];
|
|
33
|
+
/**
|
|
34
|
+
* Parses a time input string and returns a formatted time string.
|
|
35
|
+
* Handles various input formats and edge cases including AM/PM specifications.
|
|
36
|
+
* Hours greater than 24 are handled by taking remainder of 24.
|
|
37
|
+
*
|
|
38
|
+
* @param input - The time input string to parse (can be numeric, time string, or include AM/PM)
|
|
39
|
+
* @returns A formatted time string in "HH:MM AM/PM" format
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* parseTimeInput("1") => "1:00 AM"
|
|
43
|
+
* parseTimeInput("abc") => "12:00 AM"
|
|
44
|
+
* parseTimeInput("3456") => "10:00 AM"
|
|
45
|
+
* parseTimeInput("1:30") => "1:30 AM"
|
|
46
|
+
* parseTimeInput("1:30 PM") => "1:30 PM"
|
|
47
|
+
* parseTimeInput("13:45") => "1:45 PM"
|
|
48
|
+
* parseTimeInput("25:00") => "1:00 AM"
|
|
49
|
+
*/
|
|
50
|
+
export declare const parseTimeInput: (input: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import DatePicker from './DatePicker';
|
|
2
|
-
import type { DatePickerProps } from './DatePicker.types';
|
|
3
|
-
export type { DatePickerProps };
|
|
2
|
+
import type { DatePickerProps, CustomTimePickerConfig } from './DatePicker.types';
|
|
3
|
+
export type { DatePickerProps, CustomTimePickerConfig };
|
|
4
4
|
export default DatePicker;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LinkProps as RouteLinkProps } from 'react-router-dom';
|
|
2
2
|
import { ButtonProps } from '../../../atoms/Button/Button.types';
|
|
3
|
-
export type NavLinkProps = Omit<RouteLinkProps, 'to'> & Pick<ButtonProps, 'size' | 'style' | 'type'> & {
|
|
3
|
+
export type NavLinkProps = Omit<RouteLinkProps, 'to'> & Pick<ButtonProps, 'appearance' | 'size' | 'style' | 'type'> & {
|
|
4
4
|
/**
|
|
5
5
|
* The destination URL or path for the navigation link.
|
|
6
6
|
* If the URL starts with "https", it will be treated as an external link and rendered as an <a> tag.
|
|
@@ -14,4 +14,8 @@ export type NavLinkProps = Omit<RouteLinkProps, 'to'> & Pick<ButtonProps, 'size'
|
|
|
14
14
|
* <NavLink to="https://www.example.com">External</NavLink>
|
|
15
15
|
*/
|
|
16
16
|
to: string | -1;
|
|
17
|
+
/**
|
|
18
|
+
* provide a way to override the styling
|
|
19
|
+
*/
|
|
20
|
+
'component-variant'?: string;
|
|
17
21
|
};
|
|
@@ -117,6 +117,11 @@ export type SelectViewProps = Omit<HTMLAttributes<HTMLElement>, 'style' | 'child
|
|
|
117
117
|
* @default false
|
|
118
118
|
*/
|
|
119
119
|
hasDefaultOption?: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Indicates if multiple options can be selected.
|
|
122
|
+
* @default false
|
|
123
|
+
*/
|
|
124
|
+
multiple?: boolean;
|
|
120
125
|
/**
|
|
121
126
|
* Additional CSS classes for customization.
|
|
122
127
|
*/
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type
|
|
1
|
+
import { ButtonProps } from '../../atoms/Button';
|
|
2
|
+
export type TabItemTypeEnum = 'Selected' | 'Unselected';
|
|
3
|
+
export type TabItemStyleEnum = 'Filled' | 'Underlined';
|
|
4
|
+
export type TabItemProps = Omit<ButtonProps, 'actionType' | 'appearance' | 'size' | 'style' | 'type'> & {
|
|
3
5
|
/**
|
|
4
6
|
* The tabs value.
|
|
5
7
|
* @remarks
|
|
@@ -17,7 +19,8 @@ export type TabItemProps = Omit<HTMLAttributes<HTMLButtonElement>, 'style'> & {
|
|
|
17
19
|
*/
|
|
18
20
|
defaultTab?: boolean;
|
|
19
21
|
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
* The tab item style to apply.
|
|
23
|
+
* @default Filled
|
|
24
|
+
*/
|
|
25
|
+
style?: TabItemStyleEnum;
|
|
23
26
|
};
|
|
@@ -10,4 +10,4 @@ export declare const useTab: () => TabContextType;
|
|
|
10
10
|
* Provides context for Tab components
|
|
11
11
|
* Manages the current tab state and providing a method to update
|
|
12
12
|
*/
|
|
13
|
-
export declare const TabProvider: ({ children, value, onClick, }: TabProviderProps) => React.JSX.Element;
|
|
13
|
+
export declare const TabProvider: ({ children, value, style, onClick, }: TabProviderProps) => React.JSX.Element;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
export type TabsStyleEnum = 'Filled' | 'Underlined';
|
|
2
|
+
export type TabsTypeEnum = 'Horizontal' | 'Vertical';
|
|
1
3
|
export type TabContextType = {
|
|
4
|
+
/**
|
|
5
|
+
* The tab item style to apply.
|
|
6
|
+
* @default Filled
|
|
7
|
+
*/
|
|
8
|
+
style: TabsStyleEnum;
|
|
2
9
|
/**
|
|
3
10
|
* The currently selected tab.
|
|
4
11
|
*/
|
|
@@ -18,6 +25,11 @@ export type TabProviderProps = {
|
|
|
18
25
|
* The value of the tab.
|
|
19
26
|
*/
|
|
20
27
|
value?: number | string;
|
|
28
|
+
/**
|
|
29
|
+
* The tab item style to apply.
|
|
30
|
+
* @default Filled
|
|
31
|
+
*/
|
|
32
|
+
style?: TabsStyleEnum;
|
|
21
33
|
/**
|
|
22
34
|
* Callback function when a tab is clicked.
|
|
23
35
|
* @param value - The value of the clicked tab.
|
|
@@ -33,5 +45,15 @@ export type TabsViewProps = {
|
|
|
33
45
|
* Additional class for styling.
|
|
34
46
|
*/
|
|
35
47
|
className?: string;
|
|
48
|
+
/**
|
|
49
|
+
* The tab item style to apply.
|
|
50
|
+
* @default Filled
|
|
51
|
+
*/
|
|
52
|
+
style?: TabsStyleEnum;
|
|
53
|
+
/**
|
|
54
|
+
* The tab item type to apply.
|
|
55
|
+
* @default Horizontal
|
|
56
|
+
*/
|
|
57
|
+
type?: TabsTypeEnum;
|
|
36
58
|
};
|
|
37
59
|
export type TabsProps = TabProviderProps & TabsViewProps;
|