@delightui/components 0.1.110 → 0.1.112
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/components/molecules/Modal/Modal.types.d.ts +5 -0
- package/dist/cjs/components/molecules/Search/Search.d.ts +18 -0
- package/dist/cjs/components/molecules/Search/Search.presenter.d.ts +320 -0
- package/dist/cjs/components/molecules/Search/Search.types.d.ts +53 -0
- package/dist/cjs/components/molecules/Search/index.d.ts +2 -0
- package/dist/cjs/components/molecules/index.d.ts +2 -0
- package/dist/cjs/components/organisms/SlideOutPanel/FadeTransition.d.ts +8 -0
- package/dist/cjs/components/utils/RenderStateView/RenderStateView.types.d.ts +4 -0
- package/dist/cjs/components/utils/RenderStateView/usePresenter.d.ts +1 -0
- package/dist/cjs/components/utils/index.d.ts +2 -0
- package/dist/cjs/components/utils/useDebounce/index.d.ts +1 -0
- package/dist/cjs/components/utils/useDebounce/useDebounce.d.ts +10 -0
- package/dist/cjs/library.css +1699 -23
- package/dist/cjs/library.js +3 -3
- package/dist/cjs/library.js.map +1 -1
- package/dist/esm/components/molecules/Modal/Modal.types.d.ts +5 -0
- package/dist/esm/components/molecules/Search/Search.d.ts +18 -0
- package/dist/esm/components/molecules/Search/Search.presenter.d.ts +320 -0
- package/dist/esm/components/molecules/Search/Search.types.d.ts +53 -0
- package/dist/esm/components/molecules/Search/index.d.ts +2 -0
- package/dist/esm/components/molecules/index.d.ts +2 -0
- package/dist/esm/components/organisms/SlideOutPanel/FadeTransition.d.ts +8 -0
- package/dist/esm/components/utils/RenderStateView/RenderStateView.types.d.ts +4 -0
- package/dist/esm/components/utils/RenderStateView/usePresenter.d.ts +1 -0
- package/dist/esm/components/utils/index.d.ts +2 -0
- package/dist/esm/components/utils/useDebounce/index.d.ts +1 -0
- package/dist/esm/components/utils/useDebounce/useDebounce.d.ts +10 -0
- package/dist/esm/library.css +1699 -23
- package/dist/esm/library.js +3 -3
- package/dist/esm/library.js.map +1 -1
- package/dist/index.d.ts +91 -1
- package/docs/README.md +6 -0
- package/docs/components/atoms/Input.md +0 -63
- package/docs/components/molecules/Search.md +710 -0
- package/docs/components/utils/RenderStateView.md +138 -39
- package/docs/components/utils/useDebounce.md +576 -0
- package/package.json +4 -2
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import React__default, { ImgHTMLAttributes, SyntheticEvent, HTMLAttributes, Reac
|
|
|
4
4
|
import { LinkProps } from 'react-router-dom';
|
|
5
5
|
import { Plugin } from 'flatpickr/dist/types/options';
|
|
6
6
|
import FlatPickr from 'react-flatpickr';
|
|
7
|
+
import { ModalTransitionComponent } from 'react-overlays/cjs/Modal';
|
|
7
8
|
import { Offset } from 'react-overlays/usePopper';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -1461,6 +1462,10 @@ type ModalProps = {
|
|
|
1461
1462
|
* Additional CSS class names to apply to the modal.
|
|
1462
1463
|
*/
|
|
1463
1464
|
className?: string;
|
|
1465
|
+
/**
|
|
1466
|
+
* Optional transition component for the modal.
|
|
1467
|
+
*/
|
|
1468
|
+
Transition?: ModalTransitionComponent;
|
|
1464
1469
|
};
|
|
1465
1470
|
|
|
1466
1471
|
/**
|
|
@@ -2027,6 +2032,76 @@ type ChipInputProps = ControlledFormComponentProps<string[]> & {
|
|
|
2027
2032
|
|
|
2028
2033
|
declare const _default: React__default.NamedExoticComponent<ChipInputProps>;
|
|
2029
2034
|
|
|
2035
|
+
/**
|
|
2036
|
+
* Enum for different search modes.
|
|
2037
|
+
*/
|
|
2038
|
+
type SearchStyleEnum = 'Auto' | 'Button';
|
|
2039
|
+
/**
|
|
2040
|
+
* Search callback function type that receives the search query and returns a promise
|
|
2041
|
+
*/
|
|
2042
|
+
type SearchCallback = (query: string) => Promise<void>;
|
|
2043
|
+
/**
|
|
2044
|
+
* Props for the Search component
|
|
2045
|
+
*/
|
|
2046
|
+
type SearchProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'value'> & ControlledFormComponentProps<string> & {
|
|
2047
|
+
/**
|
|
2048
|
+
* The search style - 'Auto' for debounced search on input, 'Button' for search on enter/submit
|
|
2049
|
+
* @default 'Auto'
|
|
2050
|
+
*/
|
|
2051
|
+
style?: SearchStyleEnum;
|
|
2052
|
+
/**
|
|
2053
|
+
* Callback function to handle search with the query string
|
|
2054
|
+
*/
|
|
2055
|
+
onSearch?: SearchCallback;
|
|
2056
|
+
/**
|
|
2057
|
+
* Debounce delay in milliseconds for auto style
|
|
2058
|
+
* @default 300
|
|
2059
|
+
*/
|
|
2060
|
+
debounceMs?: number;
|
|
2061
|
+
/**
|
|
2062
|
+
* Minimum characters required to trigger search in auto style
|
|
2063
|
+
* @default 1
|
|
2064
|
+
*/
|
|
2065
|
+
minCharacters?: number;
|
|
2066
|
+
/**
|
|
2067
|
+
* Show submit button in button style
|
|
2068
|
+
* @default true
|
|
2069
|
+
*/
|
|
2070
|
+
showSubmitButton?: boolean;
|
|
2071
|
+
/**
|
|
2072
|
+
* Show clear button when there is text
|
|
2073
|
+
* @default true
|
|
2074
|
+
*/
|
|
2075
|
+
showClearButton?: boolean;
|
|
2076
|
+
/**
|
|
2077
|
+
* Loading state while search is in progress in auto style
|
|
2078
|
+
* @default false
|
|
2079
|
+
*/
|
|
2080
|
+
loading?: boolean;
|
|
2081
|
+
/**
|
|
2082
|
+
* Provide a way to override the styling
|
|
2083
|
+
*/
|
|
2084
|
+
'component-variant'?: string;
|
|
2085
|
+
};
|
|
2086
|
+
|
|
2087
|
+
/**
|
|
2088
|
+
* Search component with auto and manual search modes
|
|
2089
|
+
*
|
|
2090
|
+
* @param props - The search component props
|
|
2091
|
+
* @param ref - Forward ref to the input element
|
|
2092
|
+
* @returns Search component
|
|
2093
|
+
*/
|
|
2094
|
+
declare const Search: React$1.ForwardRefExoticComponent<Omit<React$1.InputHTMLAttributes<HTMLInputElement>, "value" | "type"> & ControlledFormComponentProps<string> & {
|
|
2095
|
+
style?: SearchStyleEnum;
|
|
2096
|
+
onSearch?: SearchCallback;
|
|
2097
|
+
debounceMs?: number;
|
|
2098
|
+
minCharacters?: number;
|
|
2099
|
+
showSubmitButton?: boolean;
|
|
2100
|
+
showClearButton?: boolean;
|
|
2101
|
+
loading?: boolean;
|
|
2102
|
+
'component-variant'?: string;
|
|
2103
|
+
} & React$1.RefAttributes<HTMLInputElement>>;
|
|
2104
|
+
|
|
2030
2105
|
type DropzoneStatus = 'Empty' | 'Loading' | 'Uploaded';
|
|
2031
2106
|
/**
|
|
2032
2107
|
* Dropzone component props
|
|
@@ -2319,11 +2394,15 @@ type RenderStateViewProps<T = unknown, P = any> = {
|
|
|
2319
2394
|
className?: string;
|
|
2320
2395
|
data?: T | null;
|
|
2321
2396
|
isLoading?: boolean;
|
|
2397
|
+
errorData?: Error | string | null;
|
|
2322
2398
|
filled?: React.ComponentType<{
|
|
2323
2399
|
data: T;
|
|
2324
2400
|
} & P>;
|
|
2325
2401
|
empty?: React.ComponentType<P>;
|
|
2326
2402
|
loading?: React.ComponentType<P>;
|
|
2403
|
+
error?: React.ComponentType<{
|
|
2404
|
+
error: Error | string;
|
|
2405
|
+
} & P>;
|
|
2327
2406
|
};
|
|
2328
2407
|
|
|
2329
2408
|
declare const RenderStateView: <T = unknown, P = any>(props: RenderStateViewProps<T, P>) => react_jsx_runtime.JSX.Element;
|
|
@@ -2369,6 +2448,17 @@ declare const RenderStateView: <T = unknown, P = any>(props: RenderStateViewProp
|
|
|
2369
2448
|
*/
|
|
2370
2449
|
declare const useInflateView: <T extends ComponentType<any>>(Component: T, props: React.ComponentProps<T>) => ReactElement;
|
|
2371
2450
|
|
|
2451
|
+
/**
|
|
2452
|
+
* Custom hook that debounces a callback function
|
|
2453
|
+
* @param callback - The function to debounce
|
|
2454
|
+
* @param delay - The debounce delay in milliseconds
|
|
2455
|
+
* @returns Object containing the debounced function and a cancel function
|
|
2456
|
+
*/
|
|
2457
|
+
declare const useDebounce: <T extends (...args: any[]) => void>(callback: T, delay: number) => {
|
|
2458
|
+
debouncedCallback: (...args: Parameters<T>) => void;
|
|
2459
|
+
cancel: () => void;
|
|
2460
|
+
};
|
|
2461
|
+
|
|
2372
2462
|
type ArrowDirectionEnum = 'ArrowUp' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight';
|
|
2373
2463
|
type AccessibilityActions = {
|
|
2374
2464
|
onClick?: (event?: SyntheticEvent) => void;
|
|
@@ -2466,4 +2556,4 @@ declare const NotificationContext: React__default.Context<NotificationContextVal
|
|
|
2466
2556
|
declare const NotificationProvider: React__default.FC<NotificationProviderProps>;
|
|
2467
2557
|
declare const useNotification: () => NotificationContextValue;
|
|
2468
2558
|
|
|
2469
|
-
export { type AccessibilityActions, type AccessibilityProps, Accordion, AccordionDetails, AccordionGroup, AccordionSummary, ActionCard, type ActionCardProps, ActionImage, type ActionImageProps, Breadcrumb, type BreadcrumbProps, Breadcrumbs, type BreadcrumbsProps, Breakpoint, type BreakpointProps, Button, ButtonGroup, type ButtonGroupProps, type ButtonProps, Card, type CardProps, Checkbox, CheckboxItem, type CheckboxItemProps, type CheckboxLabelAlignmentEnum, type CheckboxProps, type CheckboxSizeEnum, type CheckboxTypeEnum, Chip, _default as ChipInput, type ChipInputProps, type ChipListItemProps, type ChipListItemTypeEnum, type ChipProps, ConditionalView, type ConditionalViewProps, ContextMenu, type ContextMenuProps, type CustomTimePickerConfig, CustomToggle, type CustomToggleProps, DatePicker, type DatePickerProps, SortableItem as DraggableItem, SortableTrigger as DraggableItemTrigger, Dropzone, DropzoneClear, DropzoneContent, type DropzoneContentProps, type DropzoneContentTypeEnum, DropzoneFilename, DropzoneFilename as DropzonePreview, type DropzoneProps, DropzoneSupportedFormats as DropzoneReject, DropzoneTrigger as DropzoneRoot, DropzoneSupportedFormats, DropzoneTrigger, type FieldValidationFunction, type FieldValidators, type FieldValue, Form, type FormContextValues, type FormErrors, FormField, type FormFieldProps, type FormProps, type FormProviderProps, type FormState, type FormStateChangeHandler, type FormSubmitHandler, type FormValidator, Grid, GridItem, type GridItemProps, GridList, type GridListProps, type GridProps, Icon, IconButton, type IconButtonProps, type IconButtonStyleEnum, type IconProps, type IconSizeEnum, type IconStyleEnum, Image, type ImageFitEnum, type ImageProps, Input, type InputProps, type InputTypeEnum, List, ListItem, type ListItemProps$1 as ListItemProps, type ListProps, Modal, type ModalComponentProps, ModalFooter, type ModalFooterProps, ModalHeader, type ModalHeaderProps, type ModalProps, ModalProvider, type ModalProviderProps, Nav, NavItem, type NavItemProps, NavLink, type NavLinkProps, type NavProps, type NotificationContainerProps, NotificationContext, NotificationProvider, Option, type OptionProps, type OverlayDirectionEnum, Pagination, PaginationNumberField, type PaginationNumberFieldProps, type PaginationProps, Password, Popover, type PopoverHandle, type PopoverProps, ProgressBar, type ProgressBarProps, RadioButton, RadioButtonItem, type RadioButtonItemProps, type RadioButtonLabelAlignmentEnum, type RadioButtonProps, type RadioButtonSizeEnum, RadioGroup, type RadioGroupProps, RenderStateView, type RenderStateViewProps, RepeaterList, type RepeaterListProps, type RequiredFields, ResponsiveComponent, type ResponsiveComponentProps, Select, SelectListItem, type SelectListItemProps, type SelectProps, SelectProvider, SlideOutPanel, type SlideOutPanelDirectionEnum, type SlideOutPanelProps, type SlideOutPanelSizeEnum, Slider, type SliderProps, Spinner, type SpinnerProps, TabContent, type TabContentProps, TabItem, type TabItemProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableHeader, TableHeaderCell, type TableHeaderCellProps, type TableHeaderProps, type TableProps, TableRow, type TableRowProps, Tabs, type TabsProps, Text, TextArea, type TextAreaProps, type TextDecorationEnum, type TextProps, type TextTypeEnum, type TextWeightEnum, ThemeContext, type ThemeContextType, ThemeProvider, type ThemeProviderProps, Toggle, ToggleButton, type ToggleButtonProps, type ToggleLabelAlignmentEnum, type ToggleProps, Tooltip, type TooltipProps, type UseModalReturn, WrapTextNodes, type WrapTextNodesProps, applyPropsToChildren, getClickAccessibilityProps, mergeRefs, useDropzoneContext, useInflateView, useModal, useNotification, useSelectContext, useTab };
|
|
2559
|
+
export { type AccessibilityActions, type AccessibilityProps, Accordion, AccordionDetails, AccordionGroup, AccordionSummary, ActionCard, type ActionCardProps, ActionImage, type ActionImageProps, Breadcrumb, type BreadcrumbProps, Breadcrumbs, type BreadcrumbsProps, Breakpoint, type BreakpointProps, Button, ButtonGroup, type ButtonGroupProps, type ButtonProps, Card, type CardProps, Checkbox, CheckboxItem, type CheckboxItemProps, type CheckboxLabelAlignmentEnum, type CheckboxProps, type CheckboxSizeEnum, type CheckboxTypeEnum, Chip, _default as ChipInput, type ChipInputProps, type ChipListItemProps, type ChipListItemTypeEnum, type ChipProps, ConditionalView, type ConditionalViewProps, ContextMenu, type ContextMenuProps, type CustomTimePickerConfig, CustomToggle, type CustomToggleProps, DatePicker, type DatePickerProps, SortableItem as DraggableItem, SortableTrigger as DraggableItemTrigger, Dropzone, DropzoneClear, DropzoneContent, type DropzoneContentProps, type DropzoneContentTypeEnum, DropzoneFilename, DropzoneFilename as DropzonePreview, type DropzoneProps, DropzoneSupportedFormats as DropzoneReject, DropzoneTrigger as DropzoneRoot, DropzoneSupportedFormats, DropzoneTrigger, type FieldValidationFunction, type FieldValidators, type FieldValue, Form, type FormContextValues, type FormErrors, FormField, type FormFieldProps, type FormProps, type FormProviderProps, type FormState, type FormStateChangeHandler, type FormSubmitHandler, type FormValidator, Grid, GridItem, type GridItemProps, GridList, type GridListProps, type GridProps, Icon, IconButton, type IconButtonProps, type IconButtonStyleEnum, type IconProps, type IconSizeEnum, type IconStyleEnum, Image, type ImageFitEnum, type ImageProps, Input, type InputProps, type InputTypeEnum, List, ListItem, type ListItemProps$1 as ListItemProps, type ListProps, Modal, type ModalComponentProps, ModalFooter, type ModalFooterProps, ModalHeader, type ModalHeaderProps, type ModalProps, ModalProvider, type ModalProviderProps, Nav, NavItem, type NavItemProps, NavLink, type NavLinkProps, type NavProps, type NotificationContainerProps, NotificationContext, NotificationProvider, Option, type OptionProps, type OverlayDirectionEnum, Pagination, PaginationNumberField, type PaginationNumberFieldProps, type PaginationProps, Password, Popover, type PopoverHandle, type PopoverProps, ProgressBar, type ProgressBarProps, RadioButton, RadioButtonItem, type RadioButtonItemProps, type RadioButtonLabelAlignmentEnum, type RadioButtonProps, type RadioButtonSizeEnum, RadioGroup, type RadioGroupProps, RenderStateView, type RenderStateViewProps, RepeaterList, type RepeaterListProps, type RequiredFields, ResponsiveComponent, type ResponsiveComponentProps, Search, type SearchCallback, type SearchStyleEnum as SearchModeEnum, type SearchProps, Select, SelectListItem, type SelectListItemProps, type SelectProps, SelectProvider, SlideOutPanel, type SlideOutPanelDirectionEnum, type SlideOutPanelProps, type SlideOutPanelSizeEnum, Slider, type SliderProps, Spinner, type SpinnerProps, TabContent, type TabContentProps, TabItem, type TabItemProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableHeader, TableHeaderCell, type TableHeaderCellProps, type TableHeaderProps, type TableProps, TableRow, type TableRowProps, Tabs, type TabsProps, Text, TextArea, type TextAreaProps, type TextDecorationEnum, type TextProps, type TextTypeEnum, type TextWeightEnum, ThemeContext, type ThemeContextType, ThemeProvider, type ThemeProviderProps, Toggle, ToggleButton, type ToggleButtonProps, type ToggleLabelAlignmentEnum, type ToggleProps, Tooltip, type TooltipProps, type UseModalReturn, WrapTextNodes, type WrapTextNodesProps, applyPropsToChildren, getClickAccessibilityProps, mergeRefs, useDebounce, useDropzoneContext, useInflateView, useModal, useNotification, useSelectContext, useTab };
|
package/docs/README.md
CHANGED
|
@@ -185,6 +185,9 @@ Combinations of atoms forming more complex UI patterns:
|
|
|
185
185
|
- **[RepeaterList](./docs/components/molecules/RepeaterList.md)** - A simple list rendering component that iterates over an array of data and renders each item using a specified component. It provides a minimal, lightweight approach to rendering collections without additional layout or styling, making it perfect for simple repetitive content rendering.
|
|
186
186
|
- *Aliases: RepeaterList, ItemRepeater, DataRepeater, ComponentRepeater*
|
|
187
187
|
|
|
188
|
+
- **[Search](./docs/components/molecules/Search.md)** - A versatile search input component that supports both automatic and manual search modes. In auto mode, searches are triggered automatically with debouncing as the user types. In manual mode, searches are triggered only when the user presses Enter or clicks the search button. Includes built-in search, clear, and loading states with full keyboard navigation support.
|
|
189
|
+
- *Aliases: Search, SearchInput, SearchField, SearchBox, QueryInput*
|
|
190
|
+
|
|
188
191
|
- **[Select](./docs/components/molecules/Select.md)** - A dropdown selection component that allows users to choose from a list of options. Supports single and multiple selections, custom icons, placeholder text, and integrates seamlessly with form validation. Built with accessibility and keyboard navigation in mind.
|
|
189
192
|
- *Aliases: Select, Dropdown, ComboBox, Picker, OptionList*
|
|
190
193
|
|
|
@@ -254,6 +257,9 @@ React hooks for enhanced functionality:
|
|
|
254
257
|
- **[useInflateView](./docs/components/utils/useInflateView.md)** - A React hook that takes a component type and props and returns a memoized React element. This hook is useful for creating reusable component instances with built-in memoization to prevent unnecessary re-renders when props haven't changed.
|
|
255
258
|
- *Aliases: useInflateView, Component Inflater, Memoized View Hook, Dynamic Component Hook*
|
|
256
259
|
|
|
260
|
+
- **[useDebounce](./docs/components/utils/useDebounce.md)** - A React hook that debounces callback functions, preventing them from being called too frequently. Particularly useful for optimizing performance in scenarios like search inputs, API calls, window resize handlers, or any function that might be triggered rapidly.
|
|
261
|
+
- *Aliases: useDebounce, Debounce Hook, Throttled Callback Hook, Delayed Execution Hook*
|
|
262
|
+
|
|
257
263
|
### Utilities
|
|
258
264
|
Helper components and utilities:
|
|
259
265
|
|
|
@@ -263,69 +263,6 @@ function DisabledExample() {
|
|
|
263
263
|
}
|
|
264
264
|
```
|
|
265
265
|
|
|
266
|
-
### Search Input
|
|
267
|
-
```tsx
|
|
268
|
-
import { IconButton, Icon } from '@delightui/components';
|
|
269
|
-
|
|
270
|
-
function SearchExample() {
|
|
271
|
-
const [searchTerm, setSearchTerm] = useState('');
|
|
272
|
-
const [results, setResults] = useState([]);
|
|
273
|
-
|
|
274
|
-
const handleSearch = useCallback(
|
|
275
|
-
debounce((term) => {
|
|
276
|
-
if (term.length > 2) {
|
|
277
|
-
// Simulate search
|
|
278
|
-
setResults([
|
|
279
|
-
`Result 1 for "${term}"`,
|
|
280
|
-
`Result 2 for "${term}"`,
|
|
281
|
-
`Result 3 for "${term}"`
|
|
282
|
-
]);
|
|
283
|
-
} else {
|
|
284
|
-
setResults([]);
|
|
285
|
-
}
|
|
286
|
-
}, 300),
|
|
287
|
-
[]
|
|
288
|
-
);
|
|
289
|
-
|
|
290
|
-
useEffect(() => {
|
|
291
|
-
handleSearch(searchTerm);
|
|
292
|
-
}, [searchTerm, handleSearch]);
|
|
293
|
-
|
|
294
|
-
const clearSearch = () => {
|
|
295
|
-
setSearchTerm('');
|
|
296
|
-
setResults([]);
|
|
297
|
-
};
|
|
298
|
-
|
|
299
|
-
return (
|
|
300
|
-
<div className="search-input">
|
|
301
|
-
<Input
|
|
302
|
-
leadingIcon={<MagnifyingGlassIcon />}
|
|
303
|
-
trailingIcon={
|
|
304
|
-
searchTerm ? (
|
|
305
|
-
<IconButton onClick={clearSearch} size="Small">
|
|
306
|
-
<Icon icon="Close" />
|
|
307
|
-
</IconButton>
|
|
308
|
-
) : null
|
|
309
|
-
}
|
|
310
|
-
placeholder="Search..."
|
|
311
|
-
value={searchTerm}
|
|
312
|
-
onValueChange={setSearchTerm}
|
|
313
|
-
/>
|
|
314
|
-
|
|
315
|
-
{results.length > 0 && (
|
|
316
|
-
<div className="search-results">
|
|
317
|
-
{results.map((result, index) => (
|
|
318
|
-
<div key={index} className="result-item">
|
|
319
|
-
{result}
|
|
320
|
-
</div>
|
|
321
|
-
))}
|
|
322
|
-
</div>
|
|
323
|
-
)}
|
|
324
|
-
</div>
|
|
325
|
-
);
|
|
326
|
-
}
|
|
327
|
-
```
|
|
328
|
-
|
|
329
266
|
### Number Input with Validation
|
|
330
267
|
```tsx
|
|
331
268
|
import { Text } from '@delightui/components';
|