@jordan-mace/chaser-design-system 1.2.7 → 1.2.8
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/components/Accordion/Accordion.d.ts +5 -6
- package/dist/components/Accordion/Accordion.js +4 -4
- package/dist/components/Alert/Alert.d.ts +2 -1
- package/dist/components/Avatar/Avatar.d.ts +2 -2
- package/dist/components/Avatar/Avatar.js +1 -1
- package/dist/components/Badge/Badge.d.ts +3 -2
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +4 -3
- package/dist/components/Breadcrumb/Breadcrumb.js +1 -1
- package/dist/components/Button/Button.d.ts +2 -1
- package/dist/components/Card/Card.d.ts +2 -1
- package/dist/components/Checkbox/Checkbox.d.ts +145 -0
- package/dist/components/Checkbox/Checkbox.js +1 -1
- package/dist/components/Collapse/Collapse.d.ts +3 -3
- package/dist/components/Combobox/Combobox.d.ts +3 -2
- package/dist/components/Combobox/Combobox.js +15 -8
- package/dist/components/Container/Container.d.ts +155 -3
- package/dist/components/Divider/Divider.d.ts +3 -2
- package/dist/components/Divider/Divider.js +3 -1
- package/dist/components/Drawer/Drawer.d.ts +4 -2
- package/dist/components/Drawer/Drawer.js +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +3 -2
- package/dist/components/DropdownMenu/DropdownMenu.js +6 -3
- package/dist/components/EmptyState/EmptyState.d.ts +3 -3
- package/dist/components/EmptyState/EmptyState.js +1 -1
- package/dist/components/FileUpload/FileUpload.d.ts +3 -2
- package/dist/components/FileUpload/FileUpload.js +8 -4
- package/dist/components/Form/Form.d.ts +2 -2
- package/dist/components/Grid/Grid.d.ts +154 -5
- package/dist/components/Grid/Grid.js +4 -4
- package/dist/components/Icon/Icon.d.ts +2 -2
- package/dist/components/Input/Input.d.ts +2 -1
- package/dist/components/Kbd/Kbd.d.ts +3 -3
- package/dist/components/List/List.d.ts +3 -2
- package/dist/components/List/List.js +2 -2
- package/dist/components/List/ListItem.d.ts +3 -2
- package/dist/components/List/ListItem.js +2 -2
- package/dist/components/Modal/Modal.d.ts +4 -2
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/Navbar/Navbar.d.ts +2 -1
- package/dist/components/Navbar/NavbarItem.d.ts +2 -1
- package/dist/components/NumberInput/NumberInput.d.ts +3 -2
- package/dist/components/Pagination/Pagination.d.ts +4 -2
- package/dist/components/Pagination/Pagination.js +6 -3
- package/dist/components/Popover/Popover.d.ts +3 -2
- package/dist/components/Popover/Popover.js +2 -1
- package/dist/components/Progress/Progress.d.ts +3 -2
- package/dist/components/Radio/Radio.d.ts +145 -0
- package/dist/components/Radio/Radio.js +1 -1
- package/dist/components/ScrollArea/ScrollArea.d.ts +3 -3
- package/dist/components/Select/Select.d.ts +145 -0
- package/dist/components/Separator/Separator.d.ts +4 -3
- package/dist/components/Separator/Separator.js +1 -1
- package/dist/components/Skeleton/Skeleton.d.ts +3 -2
- package/dist/components/Spinner/Spinner.d.ts +3 -2
- package/dist/components/Spinner/Spinner.js +1 -1
- package/dist/components/Stack/Stack.d.ts +156 -5
- package/dist/components/Stepper/Stepper.d.ts +3 -2
- package/dist/components/Table/Table.d.ts +3 -4
- package/dist/components/Table/Table.js +6 -6
- package/dist/components/Tabs/Tabs.d.ts +3 -3
- package/dist/components/Tabs/Tabs.js +2 -2
- package/dist/components/Tag/Tag.d.ts +2 -2
- package/dist/components/Text/Header.d.ts +2 -2
- package/dist/components/Text/P.d.ts +2 -2
- package/dist/components/TextArea/TextArea.d.ts +2 -1
- package/dist/components/Toggle/Toggle.d.ts +3 -2
- package/dist/components/Toggle/Toggle.js +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +3 -2
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +4 -4
- package/dist/components/VisuallyHidden/VisuallyHidden.js +1 -1
- package/package.json +1 -1
- package/src/components/Accordion/Accordion.tsx +21 -16
- package/src/components/Alert/Alert.tsx +11 -7
- package/src/components/Avatar/Avatar.tsx +16 -14
- package/src/components/Badge/Badge.tsx +8 -6
- package/src/components/Breadcrumb/Breadcrumb.tsx +7 -10
- package/src/components/Button/Button.tsx +9 -11
- package/src/components/Card/Card.tsx +8 -10
- package/src/components/Checkbox/Checkbox.tsx +11 -8
- package/src/components/Collapse/Collapse.tsx +12 -9
- package/src/components/Combobox/Combobox.tsx +60 -31
- package/src/components/Container/Container.tsx +4 -3
- package/src/components/Divider/Divider.tsx +9 -5
- package/src/components/Drawer/Drawer.tsx +20 -13
- package/src/components/DropdownMenu/DropdownMenu.tsx +37 -15
- package/src/components/EmptyState/EmptyState.tsx +9 -12
- package/src/components/FileUpload/FileUpload.tsx +61 -45
- package/src/components/Form/Form.tsx +6 -8
- package/src/components/Grid/Grid.tsx +18 -13
- package/src/components/Icon/Icon.tsx +7 -6
- package/src/components/Input/Input.tsx +7 -8
- package/src/components/Kbd/Kbd.tsx +5 -4
- package/src/components/List/List.tsx +6 -2
- package/src/components/List/ListItem.tsx +6 -2
- package/src/components/Modal/Modal.tsx +16 -5
- package/src/components/Navbar/Navbar.tsx +2 -1
- package/src/components/Navbar/NavbarItem.tsx +2 -1
- package/src/components/NumberInput/NumberInput.tsx +29 -22
- package/src/components/Pagination/Pagination.tsx +39 -28
- package/src/components/Popover/Popover.tsx +37 -21
- package/src/components/Progress/Progress.tsx +39 -38
- package/src/components/Radio/Radio.tsx +12 -6
- package/src/components/ScrollArea/ScrollArea.tsx +9 -10
- package/src/components/Select/Select.tsx +12 -7
- package/src/components/Separator/Separator.tsx +8 -14
- package/src/components/Skeleton/Skeleton.tsx +11 -13
- package/src/components/Spinner/Spinner.tsx +15 -11
- package/src/components/Stack/Stack.tsx +34 -15
- package/src/components/Stepper/Stepper.tsx +19 -17
- package/src/components/Table/Table.tsx +31 -21
- package/src/components/Tabs/Tabs.tsx +14 -10
- package/src/components/Tag/Tag.tsx +8 -7
- package/src/components/Text/Header.tsx +6 -5
- package/src/components/Text/P.tsx +5 -4
- package/src/components/TextArea/TextArea.tsx +7 -8
- package/src/components/Toggle/Toggle.tsx +16 -7
- package/src/components/Tooltip/Tooltip.tsx +16 -11
- package/src/components/VisuallyHidden/VisuallyHidden.tsx +7 -8
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
3
|
+
type AccordionProps = React.HTMLAttributes<HTMLDivElement> & Sprinkles & {
|
|
3
4
|
children: React.ReactNode;
|
|
4
5
|
allowMultiple?: boolean;
|
|
5
|
-
className?: string;
|
|
6
6
|
};
|
|
7
|
-
type AccordionItemProps = {
|
|
7
|
+
type AccordionItemProps = React.HTMLAttributes<HTMLDivElement> & Sprinkles & {
|
|
8
8
|
value: string;
|
|
9
9
|
title: string;
|
|
10
10
|
children: React.ReactNode;
|
|
11
|
-
className?: string;
|
|
12
11
|
};
|
|
13
|
-
declare const AccordionComponent: (({ children, allowMultiple,
|
|
14
|
-
Item: ({ value, title, children,
|
|
12
|
+
declare const AccordionComponent: (({ children, allowMultiple, ...props }: AccordionProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
13
|
+
Item: ({ value, title, children, ...props }: AccordionItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
14
|
};
|
|
16
15
|
export default AccordionComponent;
|
|
@@ -8,7 +8,7 @@ const AccordionContext = createContext({
|
|
|
8
8
|
expandedItems: new Set(),
|
|
9
9
|
toggleItem: () => { },
|
|
10
10
|
});
|
|
11
|
-
const Accordion = ({ children, allowMultiple = false,
|
|
11
|
+
const Accordion = ({ children, allowMultiple = false, ...props }) => {
|
|
12
12
|
const [expandedItems, setExpandedItems] = useState(new Set());
|
|
13
13
|
const toggleItem = (value) => {
|
|
14
14
|
setExpandedItems((prev) => {
|
|
@@ -27,15 +27,15 @@ const Accordion = ({ children, allowMultiple = false, className, }) => {
|
|
|
27
27
|
return newSet;
|
|
28
28
|
});
|
|
29
29
|
};
|
|
30
|
-
return (_jsx(AccordionContext.Provider, { value: { allowMultiple, expandedItems, toggleItem }, children: _jsx(Box, { className: clsx(accordionGroup, className), width: "100%", children: children }) }));
|
|
30
|
+
return (_jsx(AccordionContext.Provider, { value: { allowMultiple, expandedItems, toggleItem }, children: _jsx(Box, { className: clsx(accordionGroup, props.className), width: "100%", ...props, children: children }) }));
|
|
31
31
|
};
|
|
32
|
-
const AccordionItem = ({ value, title, children,
|
|
32
|
+
const AccordionItem = ({ value, title, children, ...props }) => {
|
|
33
33
|
const { expandedItems, toggleItem } = useContext(AccordionContext);
|
|
34
34
|
const isExpanded = expandedItems.has(value);
|
|
35
35
|
const toggleExpanded = useCallback(() => {
|
|
36
36
|
toggleItem(value);
|
|
37
37
|
}, [value, toggleItem]);
|
|
38
|
-
return (_jsxs(Box, { as: "div", className: clsx(accordionItem, className), width: "100%", marginBottom: "small", border: "small", borderRadius: "large", overflow: "hidden", children: [_jsxs(Box, { as: "button", onClick: toggleExpanded, className: accordionHeader, display: "flex", alignItems: "center", justifyContent: "space-between", padding: "small", cursor: "pointer", style: { userSelect: 'none' }, fontSize: "14px", fontWeight: "500", color: "c5-700", "aria-expanded": isExpanded, "aria-controls": `accordion-content-${value}`, children: [_jsx(Box, { as: "span", children: title }), _jsx(Box, { as: "span", className: clsx(accordionIcon, isExpanded && accordionIconExpanded), fontSize: "12px", display: "flex", alignItems: "center", justifyContent: "center", "aria-hidden": "true", children: "\u25BC" })] }), _jsx(Box, { as: "div", id: `accordion-content-${value}`, className: clsx(accordionContent[isExpanded ? 'expanded' : 'collapsed']), padding: "small", fontSize: "14px", color: "c5-700", role: "region", children: children })] }));
|
|
38
|
+
return (_jsxs(Box, { as: "div", className: clsx(accordionItem, props.className), width: "100%", marginBottom: "small", border: "small", borderRadius: "large", overflow: "hidden", ...props, children: [_jsxs(Box, { as: "button", onClick: toggleExpanded, className: accordionHeader, display: "flex", alignItems: "center", justifyContent: "space-between", padding: "small", cursor: "pointer", style: { userSelect: 'none' }, fontSize: "14px", fontWeight: "500", color: "c5-700", "aria-expanded": isExpanded, "aria-controls": `accordion-content-${value}`, children: [_jsx(Box, { as: "span", children: title }), _jsx(Box, { as: "span", className: clsx(accordionIcon, isExpanded && accordionIconExpanded), fontSize: "12px", display: "flex", alignItems: "center", justifyContent: "center", "aria-hidden": "true", children: "\u25BC" })] }), _jsx(Box, { as: "div", id: `accordion-content-${value}`, className: clsx(accordionContent[isExpanded ? 'expanded' : 'collapsed']), padding: "small", fontSize: "14px", color: "c5-700", role: "region", children: children })] }));
|
|
39
39
|
};
|
|
40
40
|
const AccordionComponent = Object.assign(Accordion, {
|
|
41
41
|
Item: AccordionItem,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
3
|
+
type AlertProps = React.HTMLAttributes<HTMLDivElement> & Sprinkles & {
|
|
3
4
|
severity?: 'success' | 'warning' | 'error' | 'info';
|
|
4
5
|
dismissible?: boolean;
|
|
5
6
|
onDismiss?: () => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
3
|
+
type AvatarProps = React.HTMLAttributes<HTMLDivElement> & Sprinkles & {
|
|
3
4
|
alt?: string;
|
|
4
|
-
className?: string;
|
|
5
5
|
src?: string;
|
|
6
6
|
size?: 'small' | 'medium' | 'large' | 'xlarge';
|
|
7
7
|
children?: React.ReactNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import { avatar, avatarImage, avatarWithImage, avatarWrapper } from './styles.css';
|
|
3
|
+
import { avatar, avatarImage, avatarWithImage, avatarWrapper, } from './styles.css';
|
|
4
4
|
import Box from '../Box';
|
|
5
5
|
const Avatar = ({ alt, className, src, size = 'medium', children, fallback, }) => {
|
|
6
6
|
const sizeClass = avatar[size];
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
2
3
|
export type BadgeVariant = 'default' | 'success' | 'warning' | 'error' | 'info';
|
|
3
4
|
export type BadgeSize = 'small' | 'medium' | 'large';
|
|
4
|
-
export
|
|
5
|
+
export type BadgeProps = React.HTMLAttributes<HTMLSpanElement> & Sprinkles & {
|
|
5
6
|
variant?: BadgeVariant;
|
|
6
7
|
size?: BadgeSize;
|
|
7
8
|
dot?: boolean;
|
|
8
9
|
children?: React.ReactNode;
|
|
9
|
-
}
|
|
10
|
+
};
|
|
10
11
|
declare const Badge: ({ variant, size, dot, children, ...props }: BadgeProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export default Badge;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
1
3
|
type BreadcrumbItem = {
|
|
2
4
|
label: string;
|
|
3
5
|
href?: string;
|
|
4
6
|
current?: boolean;
|
|
5
7
|
};
|
|
6
|
-
type BreadcrumbProps = {
|
|
8
|
+
type BreadcrumbProps = React.HTMLAttributes<HTMLDivElement> & Sprinkles & {
|
|
7
9
|
items: BreadcrumbItem[];
|
|
8
|
-
className?: string;
|
|
9
10
|
separator?: string;
|
|
10
11
|
};
|
|
11
|
-
declare const Breadcrumb: ({ items, className, separator
|
|
12
|
+
declare const Breadcrumb: ({ items, className, separator }: BreadcrumbProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
export default Breadcrumb;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { breadcrumb, breadcrumbList, breadcrumbItem, breadcrumbLink, breadcrumbSeparator, breadcrumbCurrent, } from './styles.css';
|
|
4
4
|
import Box from '../Box';
|
|
5
|
-
const Breadcrumb = ({ items, className, separator = '/'
|
|
5
|
+
const Breadcrumb = ({ items, className, separator = '/' }) => {
|
|
6
6
|
return (_jsx(Box, { as: "nav", "aria-label": "Breadcrumb", className: clsx(breadcrumb, className), display: "flex", alignItems: "center", gap: "small", fontSize: "14px", children: _jsx(Box, { as: "ol", className: breadcrumbList, display: "flex", alignItems: "center", style: { listStyle: 'none' }, margin: "none", padding: "none", gap: "small", children: items.map((item, index) => (_jsxs(Box, { as: "li", className: breadcrumbItem, display: "flex", alignItems: "center", children: [item.href && !item.current ? (_jsx(Box, { as: "a", href: item.href, className: breadcrumbLink, display: "inline", alignItems: "center", color: "c5-600", fontSize: "14px", textDecoration: "none", children: item.label })) : (_jsx(Box, { as: "span", className: breadcrumbCurrent, display: "inline", alignItems: "center", color: "c5-700", fontSize: "14px", fontWeight: "500", children: item.label })), index < items.length - 1 && (_jsx(Box, { as: "span", className: breadcrumbSeparator, color: "c5-500", fontSize: "12px", style: { userSelect: 'none' }, children: separator }))] }, index))) }) }));
|
|
7
7
|
};
|
|
8
8
|
export default Breadcrumb;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
3
|
+
type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & Sprinkles & {
|
|
3
4
|
variant: 'primary' | 'secondary';
|
|
4
5
|
children?: React.ReactNode;
|
|
5
6
|
label?: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
3
|
+
type CardProps = React.HTMLAttributes<HTMLDivElement> & Sprinkles & {
|
|
3
4
|
variant?: 'elevated' | 'outlined' | 'filled';
|
|
4
5
|
children?: React.ReactNode;
|
|
5
6
|
padding?: 'none' | 'small' | 'medium' | 'large';
|
|
@@ -1,5 +1,150 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
declare const Checkbox: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "type"> & {
|
|
3
|
+
display?: ("flex" | "none" | "block" | "inline" | {
|
|
4
|
+
mobile?: "flex" | "none" | "block" | "inline";
|
|
5
|
+
tablet?: "flex" | "none" | "block" | "inline";
|
|
6
|
+
desktop?: "flex" | "none" | "block" | "inline";
|
|
7
|
+
}) | import("@vanilla-extract/sprinkles").ResponsiveArray<2 | 3 | 1, "flex" | "none" | "block" | "inline">;
|
|
8
|
+
width?: ("auto" | "100%" | "50%" | "25%" | {
|
|
9
|
+
mobile?: "auto" | "100%" | "50%" | "25%";
|
|
10
|
+
tablet?: "auto" | "100%" | "50%" | "25%";
|
|
11
|
+
desktop?: "auto" | "100%" | "50%" | "25%";
|
|
12
|
+
}) | import("@vanilla-extract/sprinkles").ResponsiveArray<2 | 3 | 1, "auto" | "100%" | "50%" | "25%">;
|
|
13
|
+
height?: ("auto" | "100%" | "50%" | "25%" | {
|
|
14
|
+
mobile?: "auto" | "100%" | "50%" | "25%";
|
|
15
|
+
tablet?: "auto" | "100%" | "50%" | "25%";
|
|
16
|
+
desktop?: "auto" | "100%" | "50%" | "25%";
|
|
17
|
+
}) | import("@vanilla-extract/sprinkles").ResponsiveArray<2 | 3 | 1, "auto" | "100%" | "50%" | "25%">;
|
|
18
|
+
flexDirection?: ("column" | "row" | {
|
|
19
|
+
mobile?: "column" | "row";
|
|
20
|
+
tablet?: "column" | "row";
|
|
21
|
+
desktop?: "column" | "row";
|
|
22
|
+
}) | import("@vanilla-extract/sprinkles").ResponsiveArray<2 | 3 | 1, "column" | "row">;
|
|
23
|
+
justifyContent?: ("space-around" | "space-between" | "stretch" | "center" | "flex-end" | "flex-start" | {
|
|
24
|
+
mobile?: "space-around" | "space-between" | "stretch" | "center" | "flex-end" | "flex-start";
|
|
25
|
+
tablet?: "space-around" | "space-between" | "stretch" | "center" | "flex-end" | "flex-start";
|
|
26
|
+
desktop?: "space-around" | "space-between" | "stretch" | "center" | "flex-end" | "flex-start";
|
|
27
|
+
}) | import("@vanilla-extract/sprinkles").ResponsiveArray<2 | 3 | 1, "space-around" | "space-between" | "stretch" | "center" | "flex-end" | "flex-start">;
|
|
28
|
+
alignItems?: ("stretch" | "center" | "flex-end" | "flex-start" | {
|
|
29
|
+
mobile?: "stretch" | "center" | "flex-end" | "flex-start";
|
|
30
|
+
tablet?: "stretch" | "center" | "flex-end" | "flex-start";
|
|
31
|
+
desktop?: "stretch" | "center" | "flex-end" | "flex-start";
|
|
32
|
+
}) | import("@vanilla-extract/sprinkles").ResponsiveArray<2 | 3 | 1, "stretch" | "center" | "flex-end" | "flex-start">;
|
|
33
|
+
paddingTop?: ("auto" | "medium" | "none" | "large" | "small" | {
|
|
34
|
+
mobile?: "auto" | "medium" | "none" | "large" | "small";
|
|
35
|
+
tablet?: "auto" | "medium" | "none" | "large" | "small";
|
|
36
|
+
desktop?: "auto" | "medium" | "none" | "large" | "small";
|
|
37
|
+
}) | import("@vanilla-extract/sprinkles").ResponsiveArray<2 | 3 | 1, "auto" | "medium" | "none" | "large" | "small">;
|
|
38
|
+
paddingBottom?: ("auto" | "medium" | "none" | "large" | "small" | {
|
|
39
|
+
mobile?: "auto" | "medium" | "none" | "large" | "small";
|
|
40
|
+
tablet?: "auto" | "medium" | "none" | "large" | "small";
|
|
41
|
+
desktop?: "auto" | "medium" | "none" | "large" | "small";
|
|
42
|
+
}) | import("@vanilla-extract/sprinkles").ResponsiveArray<2 | 3 | 1, "auto" | "medium" | "none" | "large" | "small">;
|
|
43
|
+
paddingLeft?: ("auto" | "medium" | "none" | "large" | "small" | {
|
|
44
|
+
mobile?: "auto" | "medium" | "none" | "large" | "small";
|
|
45
|
+
tablet?: "auto" | "medium" | "none" | "large" | "small";
|
|
46
|
+
desktop?: "auto" | "medium" | "none" | "large" | "small";
|
|
47
|
+
}) | import("@vanilla-extract/sprinkles").ResponsiveArray<2 | 3 | 1, "auto" | "medium" | "none" | "large" | "small">;
|
|
48
|
+
paddingRight?: ("auto" | "medium" | "none" | "large" | "small" | {
|
|
49
|
+
mobile?: "auto" | "medium" | "none" | "large" | "small";
|
|
50
|
+
tablet?: "auto" | "medium" | "none" | "large" | "small";
|
|
51
|
+
desktop?: "auto" | "medium" | "none" | "large" | "small";
|
|
52
|
+
}) | import("@vanilla-extract/sprinkles").ResponsiveArray<2 | 3 | 1, "auto" | "medium" | "none" | "large" | "small">;
|
|
53
|
+
marginLeft?: ("auto" | "medium" | "none" | "large" | "small" | {
|
|
54
|
+
mobile?: "auto" | "medium" | "none" | "large" | "small";
|
|
55
|
+
tablet?: "auto" | "medium" | "none" | "large" | "small";
|
|
56
|
+
desktop?: "auto" | "medium" | "none" | "large" | "small";
|
|
57
|
+
}) | import("@vanilla-extract/sprinkles").ResponsiveArray<2 | 3 | 1, "auto" | "medium" | "none" | "large" | "small">;
|
|
58
|
+
marginRight?: ("auto" | "medium" | "none" | "large" | "small" | {
|
|
59
|
+
mobile?: "auto" | "medium" | "none" | "large" | "small";
|
|
60
|
+
tablet?: "auto" | "medium" | "none" | "large" | "small";
|
|
61
|
+
desktop?: "auto" | "medium" | "none" | "large" | "small";
|
|
62
|
+
}) | import("@vanilla-extract/sprinkles").ResponsiveArray<2 | 3 | 1, "auto" | "medium" | "none" | "large" | "small">;
|
|
63
|
+
marginTop?: ("auto" | "medium" | "none" | "large" | "small" | {
|
|
64
|
+
mobile?: "auto" | "medium" | "none" | "large" | "small";
|
|
65
|
+
tablet?: "auto" | "medium" | "none" | "large" | "small";
|
|
66
|
+
desktop?: "auto" | "medium" | "none" | "large" | "small";
|
|
67
|
+
}) | import("@vanilla-extract/sprinkles").ResponsiveArray<2 | 3 | 1, "auto" | "medium" | "none" | "large" | "small">;
|
|
68
|
+
marginBottom?: ("auto" | "medium" | "none" | "large" | "small" | {
|
|
69
|
+
mobile?: "auto" | "medium" | "none" | "large" | "small";
|
|
70
|
+
tablet?: "auto" | "medium" | "none" | "large" | "small";
|
|
71
|
+
desktop?: "auto" | "medium" | "none" | "large" | "small";
|
|
72
|
+
}) | import("@vanilla-extract/sprinkles").ResponsiveArray<2 | 3 | 1, "auto" | "medium" | "none" | "large" | "small">;
|
|
73
|
+
borderLeft?: ("auto" | "medium" | "none" | "large" | "small" | {
|
|
74
|
+
mobile?: "auto" | "medium" | "none" | "large" | "small";
|
|
75
|
+
tablet?: "auto" | "medium" | "none" | "large" | "small";
|
|
76
|
+
desktop?: "auto" | "medium" | "none" | "large" | "small";
|
|
77
|
+
}) | import("@vanilla-extract/sprinkles").ResponsiveArray<2 | 3 | 1, "auto" | "medium" | "none" | "large" | "small">;
|
|
78
|
+
borderRight?: ("auto" | "medium" | "none" | "large" | "small" | {
|
|
79
|
+
mobile?: "auto" | "medium" | "none" | "large" | "small";
|
|
80
|
+
tablet?: "auto" | "medium" | "none" | "large" | "small";
|
|
81
|
+
desktop?: "auto" | "medium" | "none" | "large" | "small";
|
|
82
|
+
}) | import("@vanilla-extract/sprinkles").ResponsiveArray<2 | 3 | 1, "auto" | "medium" | "none" | "large" | "small">;
|
|
83
|
+
borderTop?: ("auto" | "medium" | "none" | "large" | "small" | {
|
|
84
|
+
mobile?: "auto" | "medium" | "none" | "large" | "small";
|
|
85
|
+
tablet?: "auto" | "medium" | "none" | "large" | "small";
|
|
86
|
+
desktop?: "auto" | "medium" | "none" | "large" | "small";
|
|
87
|
+
}) | import("@vanilla-extract/sprinkles").ResponsiveArray<2 | 3 | 1, "auto" | "medium" | "none" | "large" | "small">;
|
|
88
|
+
borderBottom?: ("auto" | "medium" | "none" | "large" | "small" | {
|
|
89
|
+
mobile?: "auto" | "medium" | "none" | "large" | "small";
|
|
90
|
+
tablet?: "auto" | "medium" | "none" | "large" | "small";
|
|
91
|
+
desktop?: "auto" | "medium" | "none" | "large" | "small";
|
|
92
|
+
}) | import("@vanilla-extract/sprinkles").ResponsiveArray<2 | 3 | 1, "auto" | "medium" | "none" | "large" | "small">;
|
|
93
|
+
borderRadius?: ("auto" | "medium" | "none" | "large" | "small" | {
|
|
94
|
+
mobile?: "auto" | "medium" | "none" | "large" | "small";
|
|
95
|
+
tablet?: "auto" | "medium" | "none" | "large" | "small";
|
|
96
|
+
desktop?: "auto" | "medium" | "none" | "large" | "small";
|
|
97
|
+
}) | import("@vanilla-extract/sprinkles").ResponsiveArray<2 | 3 | 1, "auto" | "medium" | "none" | "large" | "small">;
|
|
98
|
+
gap?: ("auto" | "medium" | "none" | "large" | "small" | {
|
|
99
|
+
mobile?: "auto" | "medium" | "none" | "large" | "small";
|
|
100
|
+
tablet?: "auto" | "medium" | "none" | "large" | "small";
|
|
101
|
+
desktop?: "auto" | "medium" | "none" | "large" | "small";
|
|
102
|
+
}) | import("@vanilla-extract/sprinkles").ResponsiveArray<2 | 3 | 1, "auto" | "medium" | "none" | "large" | "small">;
|
|
103
|
+
padding?: ("auto" | "medium" | "none" | "large" | "small" | {
|
|
104
|
+
mobile?: "auto" | "medium" | "none" | "large" | "small";
|
|
105
|
+
tablet?: "auto" | "medium" | "none" | "large" | "small";
|
|
106
|
+
desktop?: "auto" | "medium" | "none" | "large" | "small";
|
|
107
|
+
}) | import("@vanilla-extract/sprinkles").ResponsiveArray<2 | 3 | 1, "auto" | "medium" | "none" | "large" | "small">;
|
|
108
|
+
border?: ("auto" | "medium" | "none" | "large" | "small" | {
|
|
109
|
+
mobile?: "auto" | "medium" | "none" | "large" | "small";
|
|
110
|
+
tablet?: "auto" | "medium" | "none" | "large" | "small";
|
|
111
|
+
desktop?: "auto" | "medium" | "none" | "large" | "small";
|
|
112
|
+
}) | import("@vanilla-extract/sprinkles").ResponsiveArray<2 | 3 | 1, "auto" | "medium" | "none" | "large" | "small">;
|
|
113
|
+
paddingX?: ("auto" | "medium" | "none" | "large" | "small" | {
|
|
114
|
+
mobile?: "auto" | "medium" | "none" | "large" | "small";
|
|
115
|
+
tablet?: "auto" | "medium" | "none" | "large" | "small";
|
|
116
|
+
desktop?: "auto" | "medium" | "none" | "large" | "small";
|
|
117
|
+
}) | import("@vanilla-extract/sprinkles").ResponsiveArray<2 | 3 | 1, "auto" | "medium" | "none" | "large" | "small">;
|
|
118
|
+
paddingY?: ("auto" | "medium" | "none" | "large" | "small" | {
|
|
119
|
+
mobile?: "auto" | "medium" | "none" | "large" | "small";
|
|
120
|
+
tablet?: "auto" | "medium" | "none" | "large" | "small";
|
|
121
|
+
desktop?: "auto" | "medium" | "none" | "large" | "small";
|
|
122
|
+
}) | import("@vanilla-extract/sprinkles").ResponsiveArray<2 | 3 | 1, "auto" | "medium" | "none" | "large" | "small">;
|
|
123
|
+
marginX?: ("auto" | "medium" | "none" | "large" | "small" | {
|
|
124
|
+
mobile?: "auto" | "medium" | "none" | "large" | "small";
|
|
125
|
+
tablet?: "auto" | "medium" | "none" | "large" | "small";
|
|
126
|
+
desktop?: "auto" | "medium" | "none" | "large" | "small";
|
|
127
|
+
}) | import("@vanilla-extract/sprinkles").ResponsiveArray<2 | 3 | 1, "auto" | "medium" | "none" | "large" | "small">;
|
|
128
|
+
marginY?: ("auto" | "medium" | "none" | "large" | "small" | {
|
|
129
|
+
mobile?: "auto" | "medium" | "none" | "large" | "small";
|
|
130
|
+
tablet?: "auto" | "medium" | "none" | "large" | "small";
|
|
131
|
+
desktop?: "auto" | "medium" | "none" | "large" | "small";
|
|
132
|
+
}) | import("@vanilla-extract/sprinkles").ResponsiveArray<2 | 3 | 1, "auto" | "medium" | "none" | "large" | "small">;
|
|
133
|
+
placeItems?: import("@vanilla-extract/sprinkles").ResponsiveArray<2 | 3 | 1, "stretch" | "center" | "flex-end" | "flex-start"> | ("stretch" | "center" | "flex-end" | "flex-start" | {
|
|
134
|
+
mobile?: "stretch" | "center" | "flex-end" | "flex-start";
|
|
135
|
+
tablet?: "stretch" | "center" | "flex-end" | "flex-start";
|
|
136
|
+
desktop?: "stretch" | "center" | "flex-end" | "flex-start";
|
|
137
|
+
});
|
|
138
|
+
} & {
|
|
139
|
+
color?: "c1-50" | "c1-100" | "c1-150" | "c1-200" | "c1-250" | "c1-300" | "c1-350" | "c1-400" | "c1-450" | "c1-500" | "c1-550" | "c1-600" | "c1-650" | "c1-700" | "c1-750" | "c1-800" | "c1-850" | "c1-900" | "c2-50" | "c2-100" | "c2-150" | "c2-200" | "c2-250" | "c2-300" | "c2-350" | "c2-400" | "c2-450" | "c2-500" | "c2-550" | "c2-600" | "c2-650" | "c2-700" | "c2-750" | "c2-800" | "c2-850" | "c2-900" | "c3-50" | "c3-100" | "c3-150" | "c3-200" | "c3-250" | "c3-300" | "c3-350" | "c3-400" | "c3-450" | "c3-500" | "c3-550" | "c3-600" | "c3-650" | "c3-700" | "c3-750" | "c3-800" | "c3-850" | "c3-900" | "c4-50" | "c4-100" | "c4-150" | "c4-200" | "c4-250" | "c4-300" | "c4-350" | "c4-400" | "c4-450" | "c4-500" | "c4-550" | "c4-600" | "c4-650" | "c4-700" | "c4-750" | "c4-800" | "c4-850" | "c4-900" | "c5-50" | "c5-100" | "c5-150" | "c5-200" | "c5-250" | "c5-300" | "c5-350" | "c5-400" | "c5-450" | "c5-500" | "c5-550" | "c5-600" | "c5-650" | "c5-700" | "c5-750" | "c5-800" | "c5-850" | "c5-900" | {
|
|
140
|
+
lightMode?: "c1-50" | "c1-100" | "c1-150" | "c1-200" | "c1-250" | "c1-300" | "c1-350" | "c1-400" | "c1-450" | "c1-500" | "c1-550" | "c1-600" | "c1-650" | "c1-700" | "c1-750" | "c1-800" | "c1-850" | "c1-900" | "c2-50" | "c2-100" | "c2-150" | "c2-200" | "c2-250" | "c2-300" | "c2-350" | "c2-400" | "c2-450" | "c2-500" | "c2-550" | "c2-600" | "c2-650" | "c2-700" | "c2-750" | "c2-800" | "c2-850" | "c2-900" | "c3-50" | "c3-100" | "c3-150" | "c3-200" | "c3-250" | "c3-300" | "c3-350" | "c3-400" | "c3-450" | "c3-500" | "c3-550" | "c3-600" | "c3-650" | "c3-700" | "c3-750" | "c3-800" | "c3-850" | "c3-900" | "c4-50" | "c4-100" | "c4-150" | "c4-200" | "c4-250" | "c4-300" | "c4-350" | "c4-400" | "c4-450" | "c4-500" | "c4-550" | "c4-600" | "c4-650" | "c4-700" | "c4-750" | "c4-800" | "c4-850" | "c4-900" | "c5-50" | "c5-100" | "c5-150" | "c5-200" | "c5-250" | "c5-300" | "c5-350" | "c5-400" | "c5-450" | "c5-500" | "c5-550" | "c5-600" | "c5-650" | "c5-700" | "c5-750" | "c5-800" | "c5-850" | "c5-900";
|
|
141
|
+
darkMode?: "c1-50" | "c1-100" | "c1-150" | "c1-200" | "c1-250" | "c1-300" | "c1-350" | "c1-400" | "c1-450" | "c1-500" | "c1-550" | "c1-600" | "c1-650" | "c1-700" | "c1-750" | "c1-800" | "c1-850" | "c1-900" | "c2-50" | "c2-100" | "c2-150" | "c2-200" | "c2-250" | "c2-300" | "c2-350" | "c2-400" | "c2-450" | "c2-500" | "c2-550" | "c2-600" | "c2-650" | "c2-700" | "c2-750" | "c2-800" | "c2-850" | "c2-900" | "c3-50" | "c3-100" | "c3-150" | "c3-200" | "c3-250" | "c3-300" | "c3-350" | "c3-400" | "c3-450" | "c3-500" | "c3-550" | "c3-600" | "c3-650" | "c3-700" | "c3-750" | "c3-800" | "c3-850" | "c3-900" | "c4-50" | "c4-100" | "c4-150" | "c4-200" | "c4-250" | "c4-300" | "c4-350" | "c4-400" | "c4-450" | "c4-500" | "c4-550" | "c4-600" | "c4-650" | "c4-700" | "c4-750" | "c4-800" | "c4-850" | "c4-900" | "c5-50" | "c5-100" | "c5-150" | "c5-200" | "c5-250" | "c5-300" | "c5-350" | "c5-400" | "c5-450" | "c5-500" | "c5-550" | "c5-600" | "c5-650" | "c5-700" | "c5-750" | "c5-800" | "c5-850" | "c5-900";
|
|
142
|
+
};
|
|
143
|
+
background?: "c1-50" | "c1-100" | "c1-150" | "c1-200" | "c1-250" | "c1-300" | "c1-350" | "c1-400" | "c1-450" | "c1-500" | "c1-550" | "c1-600" | "c1-650" | "c1-700" | "c1-750" | "c1-800" | "c1-850" | "c1-900" | "c2-50" | "c2-100" | "c2-150" | "c2-200" | "c2-250" | "c2-300" | "c2-350" | "c2-400" | "c2-450" | "c2-500" | "c2-550" | "c2-600" | "c2-650" | "c2-700" | "c2-750" | "c2-800" | "c2-850" | "c2-900" | "c3-50" | "c3-100" | "c3-150" | "c3-200" | "c3-250" | "c3-300" | "c3-350" | "c3-400" | "c3-450" | "c3-500" | "c3-550" | "c3-600" | "c3-650" | "c3-700" | "c3-750" | "c3-800" | "c3-850" | "c3-900" | "c4-50" | "c4-100" | "c4-150" | "c4-200" | "c4-250" | "c4-300" | "c4-350" | "c4-400" | "c4-450" | "c4-500" | "c4-550" | "c4-600" | "c4-650" | "c4-700" | "c4-750" | "c4-800" | "c4-850" | "c4-900" | "c5-50" | "c5-100" | "c5-150" | "c5-200" | "c5-250" | "c5-300" | "c5-350" | "c5-400" | "c5-450" | "c5-500" | "c5-550" | "c5-600" | "c5-650" | "c5-700" | "c5-750" | "c5-800" | "c5-850" | "c5-900" | {
|
|
144
|
+
lightMode?: "c1-50" | "c1-100" | "c1-150" | "c1-200" | "c1-250" | "c1-300" | "c1-350" | "c1-400" | "c1-450" | "c1-500" | "c1-550" | "c1-600" | "c1-650" | "c1-700" | "c1-750" | "c1-800" | "c1-850" | "c1-900" | "c2-50" | "c2-100" | "c2-150" | "c2-200" | "c2-250" | "c2-300" | "c2-350" | "c2-400" | "c2-450" | "c2-500" | "c2-550" | "c2-600" | "c2-650" | "c2-700" | "c2-750" | "c2-800" | "c2-850" | "c2-900" | "c3-50" | "c3-100" | "c3-150" | "c3-200" | "c3-250" | "c3-300" | "c3-350" | "c3-400" | "c3-450" | "c3-500" | "c3-550" | "c3-600" | "c3-650" | "c3-700" | "c3-750" | "c3-800" | "c3-850" | "c3-900" | "c4-50" | "c4-100" | "c4-150" | "c4-200" | "c4-250" | "c4-300" | "c4-350" | "c4-400" | "c4-450" | "c4-500" | "c4-550" | "c4-600" | "c4-650" | "c4-700" | "c4-750" | "c4-800" | "c4-850" | "c4-900" | "c5-50" | "c5-100" | "c5-150" | "c5-200" | "c5-250" | "c5-300" | "c5-350" | "c5-400" | "c5-450" | "c5-500" | "c5-550" | "c5-600" | "c5-650" | "c5-700" | "c5-750" | "c5-800" | "c5-850" | "c5-900";
|
|
145
|
+
darkMode?: "c1-50" | "c1-100" | "c1-150" | "c1-200" | "c1-250" | "c1-300" | "c1-350" | "c1-400" | "c1-450" | "c1-500" | "c1-550" | "c1-600" | "c1-650" | "c1-700" | "c1-750" | "c1-800" | "c1-850" | "c1-900" | "c2-50" | "c2-100" | "c2-150" | "c2-200" | "c2-250" | "c2-300" | "c2-350" | "c2-400" | "c2-450" | "c2-500" | "c2-550" | "c2-600" | "c2-650" | "c2-700" | "c2-750" | "c2-800" | "c2-850" | "c2-900" | "c3-50" | "c3-100" | "c3-150" | "c3-200" | "c3-250" | "c3-300" | "c3-350" | "c3-400" | "c3-450" | "c3-500" | "c3-550" | "c3-600" | "c3-650" | "c3-700" | "c3-750" | "c3-800" | "c3-850" | "c3-900" | "c4-50" | "c4-100" | "c4-150" | "c4-200" | "c4-250" | "c4-300" | "c4-350" | "c4-400" | "c4-450" | "c4-500" | "c4-550" | "c4-600" | "c4-650" | "c4-700" | "c4-750" | "c4-800" | "c4-850" | "c4-900" | "c5-50" | "c5-100" | "c5-150" | "c5-200" | "c5-250" | "c5-300" | "c5-350" | "c5-400" | "c5-450" | "c5-500" | "c5-550" | "c5-600" | "c5-650" | "c5-700" | "c5-750" | "c5-800" | "c5-850" | "c5-900";
|
|
146
|
+
};
|
|
147
|
+
} & {
|
|
3
148
|
label?: string;
|
|
4
149
|
indeterminate?: boolean;
|
|
5
150
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -19,7 +19,7 @@ const Checkbox = forwardRef(({ label, className, indeterminate, ...props }, ref)
|
|
|
19
19
|
inputRef.current.indeterminate = !!indeterminate;
|
|
20
20
|
}
|
|
21
21
|
}, [indeterminate]);
|
|
22
|
-
return (_jsxs(Box, { as: "label", className: clsx(checkboxContainer, className), display: "flex", alignItems: "center", gap: "small", cursor: "pointer", style: { userSelect: 'none' }, children: [_jsx(Box, { as: "input", type: "checkbox", ref: combinedRef, className: checkboxInput, style: { width: '18px', height: '18px' }, ...props }), label && _jsx(Box, { as: "span", className: checkboxLabel, children: label })] }));
|
|
22
|
+
return (_jsxs(Box, { as: "label", className: clsx(checkboxContainer, className), display: "flex", alignItems: "center", gap: "small", cursor: "pointer", style: { userSelect: 'none' }, children: [_jsx(Box, { as: "input", type: "checkbox", ref: combinedRef, className: checkboxInput, style: { width: '18px', height: '18px' }, ...props }), label && (_jsx(Box, { as: "span", className: checkboxLabel, children: label }))] }));
|
|
23
23
|
});
|
|
24
24
|
Checkbox.displayName = 'Checkbox';
|
|
25
25
|
export default Checkbox;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
2
3
|
export type CollapseAnimation = 'height' | 'opacity' | 'both';
|
|
3
|
-
export
|
|
4
|
+
export type CollapseProps = React.HTMLAttributes<HTMLDivElement> & Sprinkles & {
|
|
4
5
|
isOpen: boolean;
|
|
5
6
|
children: React.ReactNode;
|
|
6
7
|
animation?: CollapseAnimation;
|
|
7
8
|
duration?: number;
|
|
8
|
-
className?: string;
|
|
9
9
|
onAnimationEnd?: () => void;
|
|
10
|
-
}
|
|
10
|
+
};
|
|
11
11
|
declare const Collapse: ({ isOpen, children, animation, duration, className, onAnimationEnd, }: CollapseProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
export default Collapse;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
2
3
|
export interface ComboboxOption {
|
|
3
4
|
value: string;
|
|
4
5
|
label: string;
|
|
5
6
|
disabled?: boolean;
|
|
6
7
|
}
|
|
7
|
-
export
|
|
8
|
+
export type ComboboxProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'value'> & Sprinkles & {
|
|
8
9
|
label?: string;
|
|
9
10
|
options: ComboboxOption[];
|
|
10
11
|
value?: string;
|
|
@@ -18,6 +19,6 @@ export interface ComboboxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
|
|
|
18
19
|
clearable?: boolean;
|
|
19
20
|
disabled?: boolean;
|
|
20
21
|
filterFn?: (option: ComboboxOption, inputValue: string) => boolean;
|
|
21
|
-
}
|
|
22
|
+
};
|
|
22
23
|
declare const Combobox: ({ label, options, value, onChange, onInputChange, placeholder, hint, error, errorMessage, fullWidth, clearable, disabled, filterFn, className, ...props }: ComboboxProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
24
|
export default Combobox;
|
|
@@ -12,7 +12,7 @@ const Combobox = ({ label, options, value, onChange, onInputChange, placeholder
|
|
|
12
12
|
const [highlightedIndex, setHighlightedIndex] = useState(-1);
|
|
13
13
|
const containerRef = useRef(null);
|
|
14
14
|
const inputRef = useRef(null);
|
|
15
|
-
const selectedOption = options.find(opt => opt.value === value);
|
|
15
|
+
const selectedOption = options.find((opt) => opt.value === value);
|
|
16
16
|
useEffect(() => {
|
|
17
17
|
if (selectedOption) {
|
|
18
18
|
setInputValue(selectedOption.label);
|
|
@@ -21,10 +21,11 @@ const Combobox = ({ label, options, value, onChange, onInputChange, placeholder
|
|
|
21
21
|
setInputValue('');
|
|
22
22
|
}
|
|
23
23
|
}, [selectedOption, isOpen]);
|
|
24
|
-
const filteredOptions = options.filter(option => filterFn(option, inputValue));
|
|
24
|
+
const filteredOptions = options.filter((option) => filterFn(option, inputValue));
|
|
25
25
|
useEffect(() => {
|
|
26
26
|
const handleClickOutside = (event) => {
|
|
27
|
-
if (containerRef.current &&
|
|
27
|
+
if (containerRef.current &&
|
|
28
|
+
!containerRef.current.contains(event.target)) {
|
|
28
29
|
setIsOpen(false);
|
|
29
30
|
if (selectedOption) {
|
|
30
31
|
setInputValue(selectedOption.label);
|
|
@@ -70,15 +71,17 @@ const Combobox = ({ label, options, value, onChange, onInputChange, placeholder
|
|
|
70
71
|
if (!isOpen) {
|
|
71
72
|
setIsOpen(true);
|
|
72
73
|
}
|
|
73
|
-
setHighlightedIndex(prev => prev < filteredOptions.length - 1 ? prev + 1 : prev);
|
|
74
|
+
setHighlightedIndex((prev) => prev < filteredOptions.length - 1 ? prev + 1 : prev);
|
|
74
75
|
break;
|
|
75
76
|
case 'ArrowUp':
|
|
76
77
|
e.preventDefault();
|
|
77
|
-
setHighlightedIndex(prev => (prev > 0 ? prev - 1 : prev));
|
|
78
|
+
setHighlightedIndex((prev) => (prev > 0 ? prev - 1 : prev));
|
|
78
79
|
break;
|
|
79
80
|
case 'Enter':
|
|
80
81
|
e.preventDefault();
|
|
81
|
-
if (isOpen &&
|
|
82
|
+
if (isOpen &&
|
|
83
|
+
highlightedIndex >= 0 &&
|
|
84
|
+
filteredOptions[highlightedIndex]) {
|
|
82
85
|
handleOptionClick(filteredOptions[highlightedIndex]);
|
|
83
86
|
}
|
|
84
87
|
else {
|
|
@@ -97,8 +100,12 @@ const Combobox = ({ label, options, value, onChange, onInputChange, placeholder
|
|
|
97
100
|
}
|
|
98
101
|
};
|
|
99
102
|
const displayValue = selectedOption && !isOpen ? selectedOption.label : inputValue;
|
|
100
|
-
return (_jsxs(Box, { className: comboboxContainer, ref: containerRef, width: fullWidth ? '100%' : undefined, children: [label && (_jsx(Box, { as: "label", className: comboboxLabel, children: label })), _jsxs(Box, { position: "relative", children: [_jsx(Box, { as: "input", ref: inputRef, type: "text", value: displayValue, onChange: handleInputChange, onKeyDown: handleKeyDown, onFocus: () => setIsOpen(true), placeholder: placeholder, disabled: disabled, className: clsx(comboboxInput, comboboxInputVariants[error ? 'error' : 'default'], className), role: "combobox", "aria-expanded": isOpen, "aria-autocomplete": "list", "aria-controls": isOpen ? 'combobox-listbox' : undefined, "aria-activedescendant": highlightedIndex >= 0
|
|
101
|
-
|
|
103
|
+
return (_jsxs(Box, { className: comboboxContainer, ref: containerRef, width: fullWidth ? '100%' : undefined, children: [label && (_jsx(Box, { as: "label", className: comboboxLabel, children: label })), _jsxs(Box, { position: "relative", children: [_jsx(Box, { as: "input", ref: inputRef, type: "text", value: displayValue, onChange: handleInputChange, onKeyDown: handleKeyDown, onFocus: () => setIsOpen(true), placeholder: placeholder, disabled: disabled, className: clsx(comboboxInput, comboboxInputVariants[error ? 'error' : 'default'], className), role: "combobox", "aria-expanded": isOpen, "aria-autocomplete": "list", "aria-controls": isOpen ? 'combobox-listbox' : undefined, "aria-activedescendant": highlightedIndex >= 0
|
|
104
|
+
? `option-${filteredOptions[highlightedIndex]?.value}`
|
|
105
|
+
: undefined, ...props }), clearable && inputValue && !disabled && (_jsx(Box, { as: "button", className: comboboxClearButton, onClick: handleClear, type: "button", "aria-label": "Clear selection", children: "\u00D7" })), _jsx(Box, { className: comboboxArrow, "aria-hidden": "true", children: _jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "currentColor", children: _jsx("path", { d: "M6 8L1 3h10z" }) }) })] }), isOpen && (_jsx(Box, { as: "ul", id: "combobox-listbox", className: comboboxDropdown, role: "listbox", children: filteredOptions.length === 0 ? (_jsx(Box, { as: "li", className: comboboxNoResults, children: "No results found" })) : (filteredOptions.map((option, index) => (_jsx(Box, { as: "li", id: `option-${option.value}`, className: clsx(comboboxOption, option.value === value && comboboxOptionSelected, option.disabled && comboboxOptionDisabled), onClick: () => handleOptionClick(option), role: "option", "aria-selected": option.value === value, "aria-disabled": option.disabled, style: {
|
|
106
|
+
backgroundColor: index === highlightedIndex
|
|
107
|
+
? 'var(--highlight-color, #f3f4f6)'
|
|
108
|
+
: undefined,
|
|
102
109
|
}, children: option.label }, option.value)))) })), error && errorMessage && (_jsx(Box, { as: "div", className: comboboxErrorMessage, role: "alert", children: errorMessage })), hint && !error && (_jsx(Box, { as: "div", className: comboboxHint, children: hint }))] }));
|
|
103
110
|
};
|
|
104
111
|
export default Combobox;
|