@donotdev/components 0.0.12 → 0.0.14
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/advanced/Bento/Bento.d.ts +0 -9
- package/dist/advanced/Bento/Bento.d.ts.map +1 -1
- package/dist/advanced/Bento/Bento.js +10 -0
- package/dist/advanced/Code/Code.d.ts +1 -9
- package/dist/advanced/Code/Code.d.ts.map +1 -1
- package/dist/advanced/Code/CodeContent.d.ts.map +1 -1
- package/dist/advanced/Code/CodeContent.js +5 -1
- package/dist/advanced/Code/CodeSkeleton.d.ts.map +1 -1
- package/dist/advanced/Code/CodeSkeleton.js +2 -1
- package/dist/advanced/JsonViewer/JsonViewer.d.ts.map +1 -1
- package/dist/advanced/JsonViewer/JsonViewer.js +2 -1
- package/dist/atomic/Accordion/index.d.ts.map +1 -1
- package/dist/atomic/Accordion/index.js +1 -1
- package/dist/atomic/ActionButton/index.d.ts.map +1 -1
- package/dist/atomic/AlertDialog/AlertDialogPrimitive.d.ts.map +1 -1
- package/dist/atomic/AlertDialog/index.js +2 -2
- package/dist/atomic/Avatar/AvatarPrimitive.d.ts +1 -1
- package/dist/atomic/Avatar/AvatarPrimitive.d.ts.map +1 -1
- package/dist/atomic/Avatar/AvatarPrimitive.js +0 -1
- package/dist/atomic/Blockquote/index.d.ts +1 -9
- package/dist/atomic/Blockquote/index.d.ts.map +1 -1
- package/dist/atomic/Button/index.d.ts +18 -1
- package/dist/atomic/Button/index.d.ts.map +1 -1
- package/dist/atomic/Button/index.js +15 -5
- package/dist/atomic/Calendar/index.d.ts.map +1 -1
- package/dist/atomic/Calendar/index.js +3 -2
- package/dist/atomic/Checkbox/CheckboxPrimitive.d.ts +1 -1
- package/dist/atomic/Checkbox/CheckboxPrimitive.d.ts.map +1 -1
- package/dist/atomic/Checkbox/CheckboxPrimitive.js +0 -1
- package/dist/atomic/Checkbox/index.d.ts +17 -3
- package/dist/atomic/Checkbox/index.d.ts.map +1 -1
- package/dist/atomic/Checkbox/index.js +22 -6
- package/dist/atomic/Collapsible/CollapsiblePrimitive.d.ts +1 -1
- package/dist/atomic/Collapsible/CollapsiblePrimitive.d.ts.map +1 -1
- package/dist/atomic/Collapsible/CollapsiblePrimitive.js +0 -1
- package/dist/atomic/Collapsible/index.d.ts.map +1 -1
- package/dist/atomic/Collapsible/index.js +6 -2
- package/dist/atomic/Combobox/index.d.ts.map +1 -1
- package/dist/atomic/Combobox/index.js +4 -4
- package/dist/atomic/CommandDialog/index.d.ts.map +1 -1
- package/dist/atomic/CommandDialog/index.js +1 -1
- package/dist/atomic/ContextMenu/ContextMenuPrimitive.d.ts +1 -1
- package/dist/atomic/ContextMenu/ContextMenuPrimitive.d.ts.map +1 -1
- package/dist/atomic/ContextMenu/ContextMenuPrimitive.js +0 -1
- package/dist/atomic/ContextMenu/index.d.ts.map +1 -1
- package/dist/atomic/Dialog/DialogPrimitive.d.ts.map +1 -1
- package/dist/atomic/Dialog/index.d.ts.map +1 -1
- package/dist/atomic/Dialog/index.js +1 -1
- package/dist/atomic/DropdownMenu/index.d.ts.map +1 -1
- package/dist/atomic/DropdownMenu/index.js +17 -3
- package/dist/atomic/DualCard/index.d.ts +10 -2
- package/dist/atomic/DualCard/index.d.ts.map +1 -1
- package/dist/atomic/DualCard/index.js +3 -3
- package/dist/atomic/FeatureFallback/index.js +1 -1
- package/dist/atomic/HoverCard/HoverCardPrimitive.d.ts +1 -1
- package/dist/atomic/HoverCard/HoverCardPrimitive.d.ts.map +1 -1
- package/dist/atomic/HoverCard/HoverCardPrimitive.js +0 -1
- package/dist/atomic/HoverCard/index.js +1 -1
- package/dist/atomic/Icons/Partner/providerIcons.d.ts.map +1 -1
- package/dist/atomic/Icons/Partner/providerIcons.js +17 -1
- package/dist/atomic/Input/index.d.ts +6 -1
- package/dist/atomic/Input/index.d.ts.map +1 -1
- package/dist/atomic/Input/index.js +17 -5
- package/dist/atomic/Label/FloatingLabel.d.ts +26 -10
- package/dist/atomic/Label/FloatingLabel.d.ts.map +1 -1
- package/dist/atomic/Label/FloatingLabel.js +14 -14
- package/dist/atomic/Label/index.d.ts +1 -1
- package/dist/atomic/Label/index.d.ts.map +1 -1
- package/dist/atomic/Label/index.js +1 -1
- package/dist/atomic/List/index.d.ts +8 -0
- package/dist/atomic/List/index.d.ts.map +1 -1
- package/dist/atomic/List/index.js +1 -1
- package/dist/atomic/NavigationMenu/NavigationMenuPrimitive.d.ts +1 -1
- package/dist/atomic/NavigationMenu/NavigationMenuPrimitive.d.ts.map +1 -1
- package/dist/atomic/NavigationMenu/NavigationMenuPrimitive.js +0 -1
- package/dist/atomic/NavigationMenu/index.d.ts +1 -1
- package/dist/atomic/NavigationMenu/index.d.ts.map +1 -1
- package/dist/atomic/NavigationMenu/index.js +10 -1
- package/dist/atomic/Pagination/index.d.ts +7 -29
- package/dist/atomic/Pagination/index.d.ts.map +1 -1
- package/dist/atomic/Pagination/index.js +101 -71
- package/dist/atomic/PasswordInput/index.d.ts +1 -1
- package/dist/atomic/PasswordInput/index.d.ts.map +1 -1
- package/dist/atomic/PasswordInput/index.js +5 -1
- package/dist/atomic/Popover/index.d.ts +0 -8
- package/dist/atomic/Popover/index.d.ts.map +1 -1
- package/dist/atomic/Popover/index.js +1 -1
- package/dist/atomic/PortalButton/index.d.ts +8 -0
- package/dist/atomic/PortalButton/index.d.ts.map +1 -1
- package/dist/atomic/PortalButton/index.js +1 -1
- package/dist/atomic/Progress/ProgressPrimitive.d.ts +1 -1
- package/dist/atomic/Progress/ProgressPrimitive.d.ts.map +1 -1
- package/dist/atomic/Progress/ProgressPrimitive.js +0 -1
- package/dist/atomic/Progress/index.d.ts +8 -0
- package/dist/atomic/Progress/index.d.ts.map +1 -1
- package/dist/atomic/Progress/index.js +1 -1
- package/dist/atomic/RadioGroup/index.d.ts +0 -9
- package/dist/atomic/RadioGroup/index.d.ts.map +1 -1
- package/dist/atomic/RadioGroup/index.js +2 -2
- package/dist/atomic/RangeInput/index.d.ts +45 -0
- package/dist/atomic/RangeInput/index.d.ts.map +1 -0
- package/dist/atomic/RangeInput/index.js +63 -0
- package/dist/atomic/ScrollArea/ScrollAreaPrimitive.d.ts +1 -1
- package/dist/atomic/ScrollArea/ScrollAreaPrimitive.d.ts.map +1 -1
- package/dist/atomic/ScrollArea/ScrollAreaPrimitive.js +0 -1
- package/dist/atomic/Section/index.d.ts +0 -32
- package/dist/atomic/Section/index.d.ts.map +1 -1
- package/dist/atomic/Section/index.js +4 -4
- package/dist/atomic/Select/SelectPrimitive.d.ts +1 -1
- package/dist/atomic/Select/SelectPrimitive.d.ts.map +1 -1
- package/dist/atomic/Select/SelectPrimitive.js +0 -1
- package/dist/atomic/Select/index.d.ts.map +1 -1
- package/dist/atomic/Select/index.js +2 -1
- package/dist/atomic/Separator/SeparatorPrimitive.d.ts +1 -1
- package/dist/atomic/Separator/SeparatorPrimitive.d.ts.map +1 -1
- package/dist/atomic/Separator/SeparatorPrimitive.js +0 -1
- package/dist/atomic/Separator/index.d.ts +1 -1
- package/dist/atomic/Separator/index.d.ts.map +1 -1
- package/dist/atomic/Separator/index.js +0 -1
- package/dist/atomic/Sheet/index.d.ts +3 -1
- package/dist/atomic/Sheet/index.d.ts.map +1 -1
- package/dist/atomic/Sheet/index.js +3 -3
- package/dist/atomic/Slider/SliderPrimitive.d.ts +1 -1
- package/dist/atomic/Slider/SliderPrimitive.d.ts.map +1 -1
- package/dist/atomic/Slider/SliderPrimitive.js +0 -1
- package/dist/atomic/Slider/index.d.ts +3 -2
- package/dist/atomic/Slider/index.d.ts.map +1 -1
- package/dist/atomic/Slider/index.js +9 -7
- package/dist/atomic/Slot/index.d.ts.map +1 -1
- package/dist/atomic/Stepper/index.js +1 -1
- package/dist/atomic/Switch/SwitchPrimitive.d.ts +1 -1
- package/dist/atomic/Switch/SwitchPrimitive.d.ts.map +1 -1
- package/dist/atomic/Switch/SwitchPrimitive.js +0 -1
- package/dist/atomic/Switch/index.d.ts +3 -2
- package/dist/atomic/Switch/index.d.ts.map +1 -1
- package/dist/atomic/Switch/index.js +2 -3
- package/dist/atomic/Table/index.d.ts +20 -5
- package/dist/atomic/Table/index.d.ts.map +1 -1
- package/dist/atomic/Table/index.js +92 -22
- package/dist/atomic/Tabs/TabsPrimitive.d.ts +1 -1
- package/dist/atomic/Tabs/TabsPrimitive.d.ts.map +1 -1
- package/dist/atomic/Tabs/TabsPrimitive.js +0 -1
- package/dist/atomic/Tabs/index.js +1 -1
- package/dist/atomic/Tag/index.d.ts +8 -0
- package/dist/atomic/Tag/index.d.ts.map +1 -1
- package/dist/atomic/Tag/index.js +1 -1
- package/dist/atomic/Text/index.js +1 -1
- package/dist/atomic/Textarea/index.d.ts +4 -0
- package/dist/atomic/Textarea/index.d.ts.map +1 -1
- package/dist/atomic/Textarea/index.js +3 -3
- package/dist/atomic/Toaster/Toast.types.d.ts +17 -0
- package/dist/atomic/Toaster/Toast.types.d.ts.map +1 -0
- package/dist/atomic/Toaster/Toast.types.js +2 -0
- package/dist/atomic/Toaster/ToastPrimitive.d.ts +1 -1
- package/dist/atomic/Toaster/ToastPrimitive.d.ts.map +1 -1
- package/dist/atomic/ToggleGroup/ToggleGroupPrimitive.d.ts +1 -1
- package/dist/atomic/ToggleGroup/ToggleGroupPrimitive.d.ts.map +1 -1
- package/dist/atomic/Tooltip/TooltipPrimitive.d.ts +1 -1
- package/dist/atomic/Tooltip/TooltipPrimitive.d.ts.map +1 -1
- package/dist/atomic/Tooltip/TooltipPrimitive.js +0 -1
- package/dist/atomic/Tooltip/index.d.ts +6 -12
- package/dist/atomic/Tooltip/index.d.ts.map +1 -1
- package/dist/atomic/Tooltip/index.js +13 -23
- package/dist/atomic/VideoPlayer/index.d.ts +11 -1
- package/dist/atomic/VideoPlayer/index.d.ts.map +1 -1
- package/dist/atomic/VideoPlayer/index.js +6 -8
- package/dist/atomic/VisuallyHidden/VisuallyHiddenPrimitive.d.ts.map +1 -1
- package/dist/atomic/index.d.ts +2 -0
- package/dist/atomic/index.d.ts.map +1 -1
- package/dist/atomic/index.js +1 -0
- package/dist/hooks/index.d.ts +2 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/useToast.d.ts +2 -33
- package/dist/hooks/useToast.d.ts.map +1 -1
- package/dist/hooks/useToast.js +1 -0
- package/dist/index.js +4 -4
- package/dist/styles/index.css +489 -95
- package/dist/utils/variants.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,41 +1,19 @@
|
|
|
1
|
-
import { type ComponentProps } from 'react';
|
|
2
1
|
import './Pagination.css';
|
|
3
|
-
export interface PaginationProps
|
|
4
|
-
/** Current page (1-indexed) */
|
|
2
|
+
export interface PaginationProps {
|
|
5
3
|
currentPage: number;
|
|
6
|
-
/** Total number of pages */
|
|
7
4
|
totalPages: number;
|
|
8
|
-
/** Callback when page changes */
|
|
9
5
|
onPageChange: (page: number) => void;
|
|
10
|
-
|
|
6
|
+
pageSize?: number;
|
|
7
|
+
total?: number;
|
|
8
|
+
onPageSizeChange?: (pageSize: number) => void;
|
|
11
9
|
maxVisible?: number;
|
|
12
|
-
/** Show previous/next buttons (default: true) */
|
|
13
10
|
showNavigation?: boolean;
|
|
14
|
-
/** Label for previous button (default: "Previous") */
|
|
15
11
|
previousLabel?: string;
|
|
16
|
-
/** Label for next button (default: "Next") */
|
|
17
12
|
nextLabel?: string;
|
|
18
|
-
|
|
13
|
+
itemsPerPagePlaceholder?: string;
|
|
14
|
+
showingLabel?: string;
|
|
19
15
|
className?: string;
|
|
20
16
|
}
|
|
21
|
-
|
|
22
|
-
* Accessible pagination component with props-based API.
|
|
23
|
-
* Handles page number generation, ellipsis truncation, and navigation controls.
|
|
24
|
-
*
|
|
25
|
-
* React 19: ref is a native prop, no forwardRef needed.
|
|
26
|
-
*
|
|
27
|
-
* @component
|
|
28
|
-
* @example
|
|
29
|
-
* ```tsx
|
|
30
|
-
* <Pagination
|
|
31
|
-
* currentPage={1}
|
|
32
|
-
* totalPages={10}
|
|
33
|
-
* onPageChange={handlePageChange}
|
|
34
|
-
* />
|
|
35
|
-
* ```
|
|
36
|
-
* @param {PaginationProps} props - The props for the pagination
|
|
37
|
-
* @returns {JSX.Element} The rendered pagination
|
|
38
|
-
*/
|
|
39
|
-
declare const Pagination: ({ currentPage, totalPages, onPageChange, maxVisible, showNavigation, previousLabel, nextLabel, className, ...props }: PaginationProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
declare const Pagination: ({ currentPage, totalPages, onPageChange, pageSize: pageSizeProp, total: totalProp, onPageSizeChange, maxVisible, showNavigation, previousLabel, nextLabel, itemsPerPagePlaceholder, showingLabel, className, }: PaginationProps) => import("react/jsx-runtime").JSX.Element;
|
|
40
18
|
export default Pagination;
|
|
41
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Pagination/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Pagination/index.tsx"],"names":[],"mappings":"AAIA,OAAO,kBAAkB,CAAC;AAM1B,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,UAAU,GAAI,gNAcjB,eAAe,4CA0LjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1,77 +1,107 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// packages/components/src/atomic/Pagination/index.tsx
|
|
3
|
-
|
|
4
|
-
* @fileoverview Pagination component
|
|
5
|
-
* @description Accessible pagination component with props-based API
|
|
6
|
-
*
|
|
7
|
-
* @version 0.0.1
|
|
8
|
-
* @since 0.0.1
|
|
9
|
-
* @author AMBROISE PARK Consulting
|
|
10
|
-
*/
|
|
3
|
+
import { useMemo, useState } from 'react';
|
|
11
4
|
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
|
12
|
-
import { useMemo } from 'react';
|
|
13
|
-
import { cn } from '../../utils/helpers';
|
|
14
|
-
import Stack from '../Stack';
|
|
15
5
|
import './Pagination.css';
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
6
|
+
import Button from '../Button';
|
|
7
|
+
import Select from '../Select';
|
|
8
|
+
import Text from '../Text';
|
|
9
|
+
import { cn } from '../../utils/helpers';
|
|
10
|
+
const Pagination = ({ currentPage, totalPages, onPageChange, pageSize: pageSizeProp, total: totalProp, onPageSizeChange, maxVisible = 5, // Default to 5 to fit safe on mobile (48px * 7 items ~= 336px)
|
|
11
|
+
showNavigation = true, previousLabel = 'Previous', nextLabel = 'Next', itemsPerPagePlaceholder = 'Items per page', showingLabel, className, }) => {
|
|
12
|
+
const [internalPageSize, setInternalPageSize] = useState(12);
|
|
13
|
+
const pageSize = pageSizeProp ?? internalPageSize;
|
|
14
|
+
const total = totalProp;
|
|
15
|
+
const handlePageSizeChange = (value) => {
|
|
16
|
+
const newPageSize = value === 'all' ? 0 : Number(value);
|
|
17
|
+
if (onPageSizeChange) {
|
|
18
|
+
onPageSizeChange(newPageSize);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
setInternalPageSize(newPageSize);
|
|
22
|
+
}
|
|
23
|
+
onPageChange(1);
|
|
24
|
+
};
|
|
25
|
+
const isShowingAll = pageSize === 0;
|
|
26
|
+
const effectiveTotalPages = isShowingAll
|
|
27
|
+
? 1
|
|
28
|
+
: total && total > 0
|
|
29
|
+
? Math.ceil(total / pageSize)
|
|
30
|
+
: totalPages;
|
|
31
|
+
const selectValue = isShowingAll ? 'all' : String(pageSize);
|
|
32
|
+
let pageSizeOptions = [];
|
|
33
|
+
if (typeof total === 'number' && total > 0) {
|
|
34
|
+
if (total < 12) {
|
|
35
|
+
pageSizeOptions = [];
|
|
36
|
+
}
|
|
37
|
+
else if (total < 36) {
|
|
38
|
+
pageSizeOptions = [
|
|
39
|
+
{ value: '12', label: '12' },
|
|
40
|
+
{ value: 'all', label: String(total) },
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
else if (total < 120) {
|
|
44
|
+
pageSizeOptions = [
|
|
45
|
+
{ value: '12', label: '12' },
|
|
46
|
+
{ value: '36', label: '36' },
|
|
47
|
+
{ value: 'ALL', label: String(total) },
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
pageSizeOptions = [
|
|
52
|
+
{ value: '12', label: '12' },
|
|
53
|
+
{ value: '36', label: '36' },
|
|
54
|
+
{ value: '120', label: '120' },
|
|
55
|
+
{ value: 'all', label: String(total) },
|
|
56
|
+
];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
pageSizeOptions = [
|
|
61
|
+
{ value: '12', label: '12' },
|
|
62
|
+
{ value: '36', label: '36' },
|
|
63
|
+
{ value: '120', label: '120' },
|
|
64
|
+
{ value: 'all', label: 'All' },
|
|
65
|
+
];
|
|
66
|
+
}
|
|
67
|
+
const showPageSizeSelector = pageSizeOptions.length > 1;
|
|
36
68
|
const pageNumbers = useMemo(() => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
pages.push(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return (_jsx("li", { className: "dndev-pagination-item", children: _jsx("button", { type: "button", onClick: () => onPageChange(page), "aria-current": page === currentPage ? 'page' : undefined, "aria-label": `Page ${page}`, className: "dndev-pagination-button", children: page }) }, page));
|
|
75
|
-
}), showNavigation && currentPage < totalPages && (_jsx("li", { className: "dndev-pagination-item", children: _jsx("button", { type: "button", onClick: () => onPageChange(Math.min(totalPages, currentPage + 1)), className: "dndev-pagination-button", "aria-label": nextLabel, children: _jsx(ChevronRight, { className: "dndev-size-md" }) }) }, "next"))] }) }));
|
|
69
|
+
if (isShowingAll)
|
|
70
|
+
return [1];
|
|
71
|
+
if (effectiveTotalPages <= maxVisible) {
|
|
72
|
+
return Array.from({ length: effectiveTotalPages }, (_, i) => i + 1);
|
|
73
|
+
}
|
|
74
|
+
const pages = [];
|
|
75
|
+
const half = Math.floor(maxVisible / 2);
|
|
76
|
+
if (currentPage <= half + 1) {
|
|
77
|
+
for (let i = 1; i <= maxVisible - 2; i++)
|
|
78
|
+
pages.push(i);
|
|
79
|
+
pages.push('ellipsis', effectiveTotalPages);
|
|
80
|
+
}
|
|
81
|
+
else if (currentPage >= effectiveTotalPages - half) {
|
|
82
|
+
pages.push(1, 'ellipsis');
|
|
83
|
+
for (let i = effectiveTotalPages - (maxVisible - 3); i <= effectiveTotalPages; i++)
|
|
84
|
+
pages.push(i);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
pages.push(1, 'ellipsis');
|
|
88
|
+
for (let i = currentPage - 1; i <= currentPage + 1; i++)
|
|
89
|
+
pages.push(i);
|
|
90
|
+
pages.push('ellipsis', effectiveTotalPages);
|
|
91
|
+
}
|
|
92
|
+
return pages;
|
|
93
|
+
}, [currentPage, effectiveTotalPages, maxVisible, isShowingAll]);
|
|
94
|
+
const startItem = (currentPage - 1) * pageSize + 1;
|
|
95
|
+
const endItem = Math.min(currentPage * pageSize, total || 0);
|
|
96
|
+
const showInfo = typeof total === 'number' && total > 0;
|
|
97
|
+
const showingText = showInfo && showingLabel
|
|
98
|
+
? showingLabel
|
|
99
|
+
.replace('{{from}}', String(startItem))
|
|
100
|
+
.replace('{{to}}', String(endItem))
|
|
101
|
+
.replace('{{total}}', String(total))
|
|
102
|
+
: showInfo
|
|
103
|
+
? `Showing ${startItem}-${endItem} of ${total}`
|
|
104
|
+
: null;
|
|
105
|
+
return (_jsxs("nav", { role: "navigation", "aria-label": "pagination", className: cn('dndev-pagination', className), children: [_jsx("div", { className: "dndev-pagination-info", children: showingText && (_jsx(Text, { level: "small", variant: "muted", children: showingText })) }), _jsx("div", { className: "dndev-pagination-size", children: showPageSizeSelector && (_jsxs(_Fragment, { children: [_jsx("span", { className: "dndev-pagination-size-label", children: _jsx(Text, { level: "small", variant: "muted", children: itemsPerPagePlaceholder }) }), _jsx(Select, { value: selectValue, onValueChange: handlePageSizeChange, options: pageSizeOptions, placeholder: String(pageSize) })] })) }), _jsxs("div", { className: "dndev-pagination-nav", children: [showNavigation && (_jsx(Button, { variant: "ghost", className: "dndev-pagination-button", icon: ChevronLeft, onClick: () => onPageChange(Math.max(1, currentPage - 1)), disabled: currentPage <= 1, "aria-label": previousLabel })), _jsx("ul", { className: "dndev-pagination-list", children: pageNumbers.map((page, index) => page === 'ellipsis' ? (_jsx("li", { children: _jsx("div", { className: "dndev-pagination-button", children: _jsx(Text, { level: "small", variant: "muted", children: "..." }) }) }, `ellipsis-${index}`)) : (_jsx("li", { children: _jsx(Button, { variant: page === currentPage ? 'default' : 'ghost', className: "dndev-pagination-button", onClick: () => onPageChange(page), "aria-current": page === currentPage ? 'page' : undefined, "aria-label": `Page ${page}`, children: page }) }, page))) }), showNavigation && (_jsx(Button, { variant: "ghost", className: "dndev-pagination-button", icon: ChevronRight, onClick: () => onPageChange(Math.min(effectiveTotalPages, currentPage + 1)), disabled: currentPage >= effectiveTotalPages, "aria-label": nextLabel }))] })] }));
|
|
76
106
|
};
|
|
77
107
|
export default Pagination;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { InputHTMLAttributes } from 'react';
|
|
2
2
|
import './PasswordInput.css';
|
|
3
3
|
export interface PasswordInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
4
4
|
/** Whether the password is currently visible */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/PasswordInput/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/PasswordInput/index.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,qBAAqB,CAAC;AAE7B,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAC9C,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,MAAM,CACP;IACC,gDAAgD;IAChD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uCAAuC;IACvC,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAChD,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,QAAA,MAAM,aAAa,GAAI,kHAUpB,kBAAkB,4CAoEpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -55,6 +55,10 @@ const PasswordInput = ({ className, visible: controlledVisible, onVisibilityChan
|
|
|
55
55
|
}
|
|
56
56
|
onVisibilityChange?.(newVisible);
|
|
57
57
|
};
|
|
58
|
-
|
|
58
|
+
const inputContent = (_jsxs("div", { className: "dndev-relative", children: [_jsx("input", { id: id, type: isVisible ? 'text' : 'password', value: value, className: cn('dndev-input', 'dndev-password-input-with-toggle', className), "data-bare": hasLabel || undefined, onFocus: onFocus, onBlur: onBlur, required: required, ...props }), _jsx("button", { type: "button", className: "dndev-password-toggle-button", onClick: toggleVisibility, "aria-label": isVisible ? 'Hide password' : 'Show password', "aria-describedby": props['aria-describedby'], tabIndex: -1, children: isVisible ? (_jsx(EyeOff, { className: "dndev-size-md dndev-password-toggle-icon" })) : (_jsx(Eye, { className: "dndev-size-md dndev-password-toggle-icon" })) })] }));
|
|
59
|
+
if (!hasLabel) {
|
|
60
|
+
return inputContent;
|
|
61
|
+
}
|
|
62
|
+
return (_jsx(FloatingLabel, { htmlFor: id, label: label, disabled: props.disabled, required: required, children: inputContent }));
|
|
59
63
|
};
|
|
60
64
|
export default PasswordInput;
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Popover component
|
|
3
|
-
* @description Accessible popover component built on Radix UI primitives
|
|
4
|
-
*
|
|
5
|
-
* @version 0.0.1
|
|
6
|
-
* @since 0.0.1
|
|
7
|
-
* @author AMBROISE PARK Consulting
|
|
8
|
-
*/
|
|
9
1
|
import { type FloatingVariant } from '../../utils/constants';
|
|
10
2
|
/**
|
|
11
3
|
* Popover subcomponents for advanced usage
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Popover/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Popover/index.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG/E;;GAEG;AACH,QAAA,MAAM,WAAW,oEAAmB,CAAC;AACrC,QAAA,MAAM,uBAAuB,qJAAiB,CAAC;AAC/C,QAAA,MAAM,uBAAuB;oBAK1B,CAAA;qBAA6C,CAAC;6CALH,CAAC;AAE/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;;;GAIG;AACH,eAAO,MAAM,eAAe;;;;;;;;;CAAmB,CAAC;AAEhD,MAAM,WAAW,YAAY;IAC3B,2CAA2C;IAC3C,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,4BAA4B;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uCAAuC;IACvC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,oCAAoC;IACpC,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACnC,2BAA2B;IAC3B,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC3C,4BAA4B;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sEAAsE;IACtE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,gCAAgC;IAChC,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAC5C;AAED;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,OAAO;wHAYV,YAAY;;;;wBAzDZ,CAAA;yBAA6C,CAAC;;CA2EhD,CAAC;wBAMwB,OAAO,OAAO,GAAG;IACzC,IAAI,EAAE,OAAO,WAAW,CAAC;IACzB,OAAO,EAAE,OAAO,uBAAuB,CAAC;IACxC,OAAO,EAAE,OAAO,uBAAuB,CAAC;CACzC;AAJD,wBAIE"}
|
|
@@ -8,9 +8,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
8
8
|
* @since 0.0.1
|
|
9
9
|
* @author AMBROISE PARK Consulting
|
|
10
10
|
*/
|
|
11
|
+
import PopoverPrimitive, { PopoverTrigger, PopoverContent, } from './PopoverPrimitive';
|
|
11
12
|
import { FLOATING_VARIANT } from '../../utils/constants';
|
|
12
13
|
import { cn, getVariantDataAttrs } from '../../utils/helpers';
|
|
13
|
-
import PopoverPrimitive, { PopoverTrigger, PopoverContent, } from './PopoverPrimitive';
|
|
14
14
|
/**
|
|
15
15
|
* Popover subcomponents for advanced usage
|
|
16
16
|
*/
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview PortalButton component
|
|
3
|
+
* @description Button component that renders in a portal (document.body) to avoid transform issues
|
|
4
|
+
*
|
|
5
|
+
* @version 0.0.1
|
|
6
|
+
* @since 0.0.1
|
|
7
|
+
* @author AMBROISE PARK Consulting
|
|
8
|
+
*/
|
|
1
9
|
import { type ButtonProps } from '../Button';
|
|
2
10
|
export interface PortalButtonProps extends ButtonProps {
|
|
3
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/PortalButton/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/PortalButton/index.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAe,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAGrD,MAAM,WAAW,iBAAkB,SAAQ,WAAW;CAAG;AAEzD;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,YAAY,GAAI,OAAO,iBAAiB,4CAM7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -8,8 +8,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
8
8
|
* @since 0.0.1
|
|
9
9
|
* @author AMBROISE PARK Consulting
|
|
10
10
|
*/
|
|
11
|
-
import Portal from '../Portal';
|
|
12
11
|
import Button, {} from '../Button';
|
|
12
|
+
import Portal from '../Portal';
|
|
13
13
|
/**
|
|
14
14
|
* PortalButton - Button component rendered in a portal
|
|
15
15
|
*
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @author AMBROISE PARK Consulting
|
|
8
8
|
*/
|
|
9
9
|
import * as ProgressPrimitive from '@radix-ui/react-progress';
|
|
10
|
-
import {
|
|
10
|
+
import type { ComponentProps } from 'react';
|
|
11
11
|
export interface ProgressPrimitiveProps extends ComponentProps<typeof ProgressPrimitive.Root> {
|
|
12
12
|
/**
|
|
13
13
|
* Visual variant of the progress bar.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressPrimitive.d.ts","sourceRoot":"","sources":["../../../src/atomic/Progress/ProgressPrimitive.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"ProgressPrimitive.d.ts","sourceRoot":"","sources":["../../../src/atomic/Progress/ProgressPrimitive.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAI9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,MAAM,WAAW,sBAAuB,SAAQ,cAAc,CAC5D,OAAO,iBAAiB,CAAC,IAAI,CAC9B;IACC;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,aAAa,CAAC;CACxE;AAED;;;;;;;;;;GAUG;AACH,QAAA,MAAM,0BAA0B,GAAI,yCAKjC,sBAAsB,4CAkBxB,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
|
|
@@ -9,7 +9,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
9
9
|
* @author AMBROISE PARK Consulting
|
|
10
10
|
*/
|
|
11
11
|
import * as ProgressPrimitive from '@radix-ui/react-progress';
|
|
12
|
-
import {} from 'react';
|
|
13
12
|
import { cn, getVariantDataAttrs } from '../../utils/helpers';
|
|
14
13
|
/**
|
|
15
14
|
* Accessible progress bar component built on Radix UI Progress.
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Progress component
|
|
3
|
+
* @description Accessible progress component built on Radix UI primitives
|
|
4
|
+
*
|
|
5
|
+
* @version 0.0.1
|
|
6
|
+
* @since 0.0.1
|
|
7
|
+
* @author AMBROISE PARK Consulting
|
|
8
|
+
*/
|
|
1
9
|
import ProgressPrimitive, { type ProgressPrimitiveProps } from './ProgressPrimitive';
|
|
2
10
|
declare const Progress: ({ className, ...props }: ProgressPrimitiveProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
11
|
export default Progress;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Progress/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Progress/index.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,iBAAiB,EAAE,EACxB,KAAK,sBAAsB,EAC5B,MAAM,qBAAqB,CAAC;AAG7B,QAAA,MAAM,QAAQ,GAAI,yBAAyB,sBAAsB,4CAEhE,CAAC;AAEF,eAAe,QAAQ,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC7B,YAAY,EAAE,sBAAsB,IAAI,aAAa,EAAE,CAAC"}
|
|
@@ -8,8 +8,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
8
8
|
* @since 0.0.1
|
|
9
9
|
* @author AMBROISE PARK Consulting
|
|
10
10
|
*/
|
|
11
|
-
import { cn } from '../../utils/helpers';
|
|
12
11
|
import ProgressPrimitive, {} from './ProgressPrimitive';
|
|
12
|
+
import { cn } from '../../utils/helpers';
|
|
13
13
|
const Progress = ({ className, ...props }) => (_jsx(ProgressPrimitive, { className: cn('dndev-progress', className), ...props }));
|
|
14
14
|
export default Progress;
|
|
15
15
|
export { ProgressPrimitive };
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview RadioGroup Component - Props-based API
|
|
3
|
-
* @description Accessible radio group component built on Radix UI primitives with semantic color variants.
|
|
4
|
-
* Provides props-based API for 90% use cases with items prop.
|
|
5
|
-
*
|
|
6
|
-
* @version 0.0.3
|
|
7
|
-
* @since 0.0.1
|
|
8
|
-
* @author AMBROISE PARK Consulting
|
|
9
|
-
*/
|
|
10
1
|
import { type RadioOption, type RadioGroupRootProps } from './RadioGroupPrimitive';
|
|
11
2
|
import { CONTROL_VARIANT, type ControlVariant } from '../../utils/constants';
|
|
12
3
|
import type { ReactNode } from 'react';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/RadioGroup/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/RadioGroup/index.tsx"],"names":[],"mappings":"AAcA,OAA4B,EAI1B,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,kBAAkB,CAAC;AAoB1B,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC;IAC5E,6BAA6B;IAC7B,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,sDAAsD;IACtD,KAAK,CAAC,EAAE,WAAW,EAAE,CAAC;IACtB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,UAAU,GAAG,WAAW,CAAC;IACtE,iDAAiD;IACjD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,QAAA,MAAM,UAAU,GAAI,6DAOjB,eAAe,4CAyBjB,CAAC;AAEF,eAAe,UAAU,CAAC;AAC1B,OAAO,EAAE,eAAe,IAAI,kBAAkB,EAAE,CAAC;AACjD,YAAY,EAAE,WAAW,EAAE,cAAc,IAAI,iBAAiB,EAAE,CAAC"}
|
|
@@ -9,10 +9,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
9
9
|
* @since 0.0.1
|
|
10
10
|
* @author AMBROISE PARK Consulting
|
|
11
11
|
*/
|
|
12
|
-
import RadioGroupPrimitive, { RadioGroupRootPrimitive, RadioGroupItemPrimitive, RadioGroupIndicatorPrimitive, } from './RadioGroupPrimitive';
|
|
13
12
|
import { cva } from 'class-variance-authority';
|
|
14
|
-
import {
|
|
13
|
+
import RadioGroupPrimitive, { RadioGroupRootPrimitive, RadioGroupItemPrimitive, RadioGroupIndicatorPrimitive, } from './RadioGroupPrimitive';
|
|
15
14
|
import { CONTROL_VARIANT } from '../../utils/constants';
|
|
15
|
+
import { cn, getVariantDataAttrs } from '../../utils/helpers';
|
|
16
16
|
import './RadioGroup.css';
|
|
17
17
|
const radioGroupVariants = cva('dndev-radio-group dndev-control-group', {
|
|
18
18
|
variants: {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { InputHTMLAttributes } from 'react';
|
|
2
|
+
import './RangeInput.css';
|
|
3
|
+
export interface RangeInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'value'> {
|
|
4
|
+
/** Label for the range (single FloatingLabel wrapping both inputs) */
|
|
5
|
+
label?: string;
|
|
6
|
+
/** Placeholder for min input */
|
|
7
|
+
minPlaceholder?: string;
|
|
8
|
+
/** Placeholder for max input */
|
|
9
|
+
maxPlaceholder?: string;
|
|
10
|
+
/** Current min value */
|
|
11
|
+
minValue?: string;
|
|
12
|
+
/** Current max value */
|
|
13
|
+
maxValue?: string;
|
|
14
|
+
/** Actual min value from data (for auto-populate on focus) */
|
|
15
|
+
actualMin?: string | number;
|
|
16
|
+
/** Actual max value from data (for auto-populate on focus) */
|
|
17
|
+
actualMax?: string | number;
|
|
18
|
+
/** Change handler: (min, max) => void */
|
|
19
|
+
onChange: (min: string, max: string) => void;
|
|
20
|
+
/** Clear handler - required, X button always visible */
|
|
21
|
+
onClear: () => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* RangeInput - Two-input component for min/max ranges
|
|
25
|
+
*
|
|
26
|
+
* Features:
|
|
27
|
+
* - Single FloatingLabel wrapping both inputs (when label provided)
|
|
28
|
+
* - Auto-populates with actual data min/max on focus if empty
|
|
29
|
+
* - Selects all text on focus
|
|
30
|
+
* - Clear button always visible (disabled when empty)
|
|
31
|
+
*
|
|
32
|
+
* @component
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* <RangeInput
|
|
36
|
+
* type="number"
|
|
37
|
+
* label="Price"
|
|
38
|
+
* onChange={(min, max) => setFilter({ min, max })}
|
|
39
|
+
* onClear={() => setFilter({ min: '', max: '' })}
|
|
40
|
+
* />
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function RangeInput({ type, label, minPlaceholder, maxPlaceholder, minValue, maxValue, actualMin, actualMax, min, max, onChange, onClear, ...props }: RangeInputProps): import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
export default RangeInput;
|
|
45
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/RangeInput/index.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,kBAAkB,CAAC;AAE1B,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAC3C,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,UAAU,GAAG,OAAO,CACrB;IACC,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gCAAgC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,wBAAwB;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wBAAwB;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,yCAAyC;IACzC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,wDAAwD;IACxD,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CAAC,EACzB,IAAe,EACf,KAAK,EACL,cAAsB,EACtB,cAAsB,EACtB,QAAa,EACb,QAAa,EACb,SAAS,EACT,SAAS,EACT,GAAG,EACH,GAAG,EACH,QAAQ,EACR,OAAO,EACP,GAAG,KAAK,EACT,EAAE,eAAe,2CA+EjB;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// packages/components/src/atomic/RangeInput/index.tsx
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview RangeInput component
|
|
5
|
+
* @description Two-input range component for min/max values (e.g., price ranges, date ranges)
|
|
6
|
+
*
|
|
7
|
+
* @version 0.0.2
|
|
8
|
+
* @since 0.0.1
|
|
9
|
+
* @author AMBROISE PARK Consulting
|
|
10
|
+
*/
|
|
11
|
+
import { X } from 'lucide-react';
|
|
12
|
+
import Button from '../Button';
|
|
13
|
+
import Input from '../Input';
|
|
14
|
+
import { FloatingLabel } from '../Label';
|
|
15
|
+
import Text from '../Text';
|
|
16
|
+
import './RangeInput.css';
|
|
17
|
+
/**
|
|
18
|
+
* RangeInput - Two-input component for min/max ranges
|
|
19
|
+
*
|
|
20
|
+
* Features:
|
|
21
|
+
* - Single FloatingLabel wrapping both inputs (when label provided)
|
|
22
|
+
* - Auto-populates with actual data min/max on focus if empty
|
|
23
|
+
* - Selects all text on focus
|
|
24
|
+
* - Clear button always visible (disabled when empty)
|
|
25
|
+
*
|
|
26
|
+
* @component
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* <RangeInput
|
|
30
|
+
* type="number"
|
|
31
|
+
* label="Price"
|
|
32
|
+
* onChange={(min, max) => setFilter({ min, max })}
|
|
33
|
+
* onClear={() => setFilter({ min: '', max: '' })}
|
|
34
|
+
* />
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export function RangeInput({ type = 'number', label, minPlaceholder = 'Min', maxPlaceholder = 'Max', minValue = '', maxValue = '', actualMin, actualMax, min, max, onChange, onClear, ...props }) {
|
|
38
|
+
const handleMinFocus = (e) => {
|
|
39
|
+
e.target.select();
|
|
40
|
+
if (!minValue &&
|
|
41
|
+
actualMin !== null &&
|
|
42
|
+
actualMin !== undefined &&
|
|
43
|
+
actualMin !== '') {
|
|
44
|
+
onChange(String(actualMin), maxValue);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const handleMaxFocus = (e) => {
|
|
48
|
+
e.target.select();
|
|
49
|
+
if (!maxValue &&
|
|
50
|
+
actualMax !== null &&
|
|
51
|
+
actualMax !== undefined &&
|
|
52
|
+
actualMax !== '') {
|
|
53
|
+
onChange(minValue, String(actualMax));
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const hasValue = !!(minValue || maxValue);
|
|
57
|
+
const inputs = (_jsxs(_Fragment, { children: [_jsx(Input, { type: type, placeholder: minPlaceholder, value: minValue, min: min, max: max, bare: true, onFocus: handleMinFocus, onChange: (e) => onChange(e.target.value, maxValue), ...props }), _jsx(Text, { level: "small", variant: "muted", className: "dndev-range-input-separator", children: "\u2013" }), _jsx(Input, { type: type, placeholder: maxPlaceholder, value: maxValue, min: min, max: max, bare: true, onFocus: handleMaxFocus, onChange: (e) => onChange(minValue, e.target.value), ...props }), _jsx(Button, { icon: X, variant: "ghost", display: "compact", onClick: onClear, disabled: !hasValue, "aria-label": "Clear", className: "dndev-range-input-clear" })] }));
|
|
58
|
+
if (label) {
|
|
59
|
+
return (_jsx(FloatingLabel, { label: label, className: "dndev-range-input", children: inputs }));
|
|
60
|
+
}
|
|
61
|
+
return _jsx("div", { className: "dndev-range-input", children: inputs });
|
|
62
|
+
}
|
|
63
|
+
export default RangeInput;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @author AMBROISE PARK Consulting
|
|
8
8
|
*/
|
|
9
9
|
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
10
|
-
import {
|
|
10
|
+
import type { ComponentProps } from 'react';
|
|
11
11
|
declare const ScrollAreaPrimitiveRoot: import("react").ForwardRefExoticComponent<ScrollAreaPrimitive.ScrollAreaProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
12
12
|
declare const ScrollAreaViewportPrimitive: import("react").ForwardRefExoticComponent<ScrollAreaPrimitive.ScrollAreaViewportProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
13
13
|
declare const ScrollAreaCornerPrimitive: import("react").ForwardRefExoticComponent<ScrollAreaPrimitive.ScrollAreaCornerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollAreaPrimitive.d.ts","sourceRoot":"","sources":["../../../src/atomic/ScrollArea/ScrollAreaPrimitive.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"ScrollAreaPrimitive.d.ts","sourceRoot":"","sources":["../../../src/atomic/ScrollArea/ScrollAreaPrimitive.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAC;AAInE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,QAAA,MAAM,uBAAuB,gIAA2B,CAAC;AACzD,QAAA,MAAM,2BAA2B,wIAA+B,CAAC;AACjE,QAAA,MAAM,yBAAyB,sIAA6B,CAAC;AAE7D,MAAM,WAAW,uBAAwB,SAAQ,cAAc,CAC7D,OAAO,mBAAmB,CAAC,mBAAmB,CAC/C;CAAG;AAEJ,QAAA,MAAM,kBAAkB,GAAI,sCAIzB,uBAAuB,4CAYzB,CAAC;AAEF,eAAe,uBAAuB,CAAC;AACvC,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EACzB,kBAAkB,GACnB,CAAC"}
|
|
@@ -9,7 +9,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
9
9
|
* @author AMBROISE PARK Consulting
|
|
10
10
|
*/
|
|
11
11
|
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
12
|
-
import {} from 'react';
|
|
13
12
|
import { cn } from '../../utils/helpers';
|
|
14
13
|
const ScrollAreaPrimitiveRoot = ScrollAreaPrimitive.Root;
|
|
15
14
|
const ScrollAreaViewportPrimitive = ScrollAreaPrimitive.Viewport;
|
|
@@ -1,35 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Section component
|
|
3
|
-
* @description Minimal layout section with title, optional separator, and tone backgrounds.
|
|
4
|
-
* Content width is automatically constrained by PageContainer's --content-width variable.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```tsx
|
|
8
|
-
* // Fixed 3 columns
|
|
9
|
-
* <Section title="Features" gridCols={3}>
|
|
10
|
-
* <Card />
|
|
11
|
-
* <Card />
|
|
12
|
-
* <Card />
|
|
13
|
-
* </Section>
|
|
14
|
-
*
|
|
15
|
-
* // Responsive: [mobile, tablet, laptop, desktop]
|
|
16
|
-
* <Section title="Features" gridCols={[1, 1, 2, 3]}>
|
|
17
|
-
* <Card />
|
|
18
|
-
* <Card />
|
|
19
|
-
* <Card />
|
|
20
|
-
* </Section>
|
|
21
|
-
*
|
|
22
|
-
* // Collapsible section
|
|
23
|
-
* <Section title="Details" collapsible defaultOpen={false}>
|
|
24
|
-
* <Card />
|
|
25
|
-
* <Card />
|
|
26
|
-
* </Section>
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @version 0.0.5
|
|
30
|
-
* @since 0.0.1
|
|
31
|
-
* @author AMBROISE PARK Consulting
|
|
32
|
-
*/
|
|
33
1
|
import { type ElementType, type ComponentPropsWithRef, type ReactNode } from 'react';
|
|
34
2
|
import { type ResponsiveCols } from '../Grid';
|
|
35
3
|
import './Section.css';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Section/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Section/index.tsx"],"names":[],"mappings":"AAoCA,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAQf,OAAa,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC;AAKpD,OAAO,eAAe,CAAC;AAEvB;;GAEG;AACH,UAAU,eAAe;IACvB;;;OAGG;IACH,EAAE,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;IAEtD,sBAAsB;IACtB,QAAQ,EAAE,SAAS,CAAC;IAEpB,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,kDAAkD;IAClD,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAC;IAE7D;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IAEnC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;IAEnC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IAEhD;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAEvC;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,WAAW,GAAG,SAAS,IAAI,eAAe,GAC3E,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,MAAM,eAAe,CAAC,CAAC;AAExD;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,OAAO,8HAmGZ,CAAC;AAIF,eAAe,OAAO,CAAC"}
|