@jordan-mace/chaser-design-system 1.2.8 → 1.2.9
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/index.d.mts +1834 -0
- package/dist/index.mjs +4729 -0
- package/dist/styles/layers.css.d.mts +6 -0
- package/dist/styles/layers.css.mjs +7 -0
- package/dist/styles/reset.css.d.mts +1 -0
- package/dist/styles/reset.css.mjs +24 -0
- package/dist/styles/sprinkles.css.d.mts +246 -0
- package/dist/styles/sprinkles.css.mjs +200 -0
- package/dist/styles/theme.css.d.mts +41 -0
- package/dist/styles/theme.css.mjs +50 -0
- package/package.json +18 -9
- package/src/components/Box/reset.css.ts +2 -2
- package/src/index.ts +6 -1
- package/dist/components/Accordion/Accordion.d.ts +0 -15
- package/dist/components/Accordion/Accordion.js +0 -43
- package/dist/components/Accordion/index.d.ts +0 -1
- package/dist/components/Accordion/index.js +0 -1
- package/dist/components/Accordion/styles.css.d.ts +0 -7
- package/dist/components/Accordion/styles.css.js +0 -65
- package/dist/components/Alert/Alert.d.ts +0 -10
- package/dist/components/Alert/Alert.js +0 -8
- package/dist/components/Alert/index.d.ts +0 -1
- package/dist/components/Alert/index.js +0 -1
- package/dist/components/Alert/styles.css.d.ts +0 -4
- package/dist/components/Alert/styles.css.js +0 -54
- package/dist/components/AspectRatio/AspectRatio.d.ts +0 -9
- package/dist/components/AspectRatio/AspectRatio.js +0 -12
- package/dist/components/AspectRatio/index.d.ts +0 -2
- package/dist/components/AspectRatio/index.js +0 -1
- package/dist/components/Avatar/Avatar.d.ts +0 -11
- package/dist/components/Avatar/Avatar.js +0 -13
- package/dist/components/Avatar/index.d.ts +0 -1
- package/dist/components/Avatar/index.js +0 -1
- package/dist/components/Avatar/styles.css.d.ts +0 -4
- package/dist/components/Avatar/styles.css.js +0 -151
- package/dist/components/Badge/Badge.d.ts +0 -12
- package/dist/components/Badge/Badge.js +0 -8
- package/dist/components/Badge/index.d.ts +0 -2
- package/dist/components/Badge/index.js +0 -1
- package/dist/components/Badge/styles.css.d.ts +0 -5
- package/dist/components/Badge/styles.css.js +0 -77
- package/dist/components/Box/Box.d.ts +0 -11
- package/dist/components/Box/Box.js +0 -54
- package/dist/components/Box/index.d.ts +0 -2
- package/dist/components/Box/index.js +0 -1
- package/dist/components/Box/reset.css.d.ts +0 -1
- package/dist/components/Box/reset.css.js +0 -15
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +0 -13
- package/dist/components/Breadcrumb/Breadcrumb.js +0 -8
- package/dist/components/Breadcrumb/index.d.ts +0 -1
- package/dist/components/Breadcrumb/index.js +0 -1
- package/dist/components/Breadcrumb/styles.css.d.ts +0 -6
- package/dist/components/Breadcrumb/styles.css.js +0 -50
- package/dist/components/Button/Button.d.ts +0 -10
- package/dist/components/Button/Button.js +0 -8
- package/dist/components/Button/index.d.ts +0 -1
- package/dist/components/Button/index.js +0 -1
- package/dist/components/Button/styles.css.d.ts +0 -2
- package/dist/components/Button/styles.css.js +0 -30
- package/dist/components/Card/Card.d.ts +0 -9
- package/dist/components/Card/Card.js +0 -8
- package/dist/components/Card/index.d.ts +0 -1
- package/dist/components/Card/index.js +0 -1
- package/dist/components/Card/styles.css.d.ts +0 -2
- package/dist/components/Card/styles.css.js +0 -25
- package/dist/components/Checkbox/Checkbox.d.ts +0 -151
- package/dist/components/Checkbox/Checkbox.js +0 -25
- package/dist/components/Checkbox/index.d.ts +0 -1
- package/dist/components/Checkbox/index.js +0 -1
- package/dist/components/Checkbox/styles.css.d.ts +0 -3
- package/dist/components/Checkbox/styles.css.js +0 -31
- package/dist/components/Collapse/Collapse.d.ts +0 -12
- package/dist/components/Collapse/Collapse.js +0 -56
- package/dist/components/Collapse/index.d.ts +0 -2
- package/dist/components/Collapse/index.js +0 -1
- package/dist/components/Collapse/styles.css.d.ts +0 -3
- package/dist/components/Collapse/styles.css.js +0 -36
- package/dist/components/Combobox/Combobox.d.ts +0 -24
- package/dist/components/Combobox/Combobox.js +0 -111
- package/dist/components/Combobox/index.d.ts +0 -2
- package/dist/components/Combobox/index.js +0 -1
- package/dist/components/Combobox/styles.css.d.ts +0 -13
- package/dist/components/Combobox/styles.css.js +0 -142
- package/dist/components/Container/Container.d.ts +0 -163
- package/dist/components/Container/Container.js +0 -21
- package/dist/components/Container/index.d.ts +0 -2
- package/dist/components/Container/index.js +0 -1
- package/dist/components/Divider/Divider.d.ts +0 -10
- package/dist/components/Divider/Divider.js +0 -10
- package/dist/components/Divider/index.d.ts +0 -2
- package/dist/components/Divider/index.js +0 -1
- package/dist/components/Divider/styles.css.d.ts +0 -4
- package/dist/components/Divider/styles.css.js +0 -41
- package/dist/components/Drawer/Drawer.d.ts +0 -18
- package/dist/components/Drawer/Drawer.js +0 -65
- package/dist/components/Drawer/index.d.ts +0 -2
- package/dist/components/Drawer/index.js +0 -1
- package/dist/components/Drawer/styles.css.d.ts +0 -8
- package/dist/components/Drawer/styles.css.js +0 -125
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +0 -24
- package/dist/components/DropdownMenu/DropdownMenu.js +0 -46
- package/dist/components/DropdownMenu/index.d.ts +0 -2
- package/dist/components/DropdownMenu/index.js +0 -1
- package/dist/components/DropdownMenu/styles.css.d.ts +0 -9
- package/dist/components/DropdownMenu/styles.css.js +0 -93
- package/dist/components/EmptyState/EmptyState.d.ts +0 -10
- package/dist/components/EmptyState/EmptyState.js +0 -8
- package/dist/components/EmptyState/index.d.ts +0 -2
- package/dist/components/EmptyState/index.js +0 -1
- package/dist/components/EmptyState/styles.css.d.ts +0 -5
- package/dist/components/EmptyState/styles.css.js +0 -30
- package/dist/components/FileUpload/FileUpload.d.ts +0 -28
- package/dist/components/FileUpload/FileUpload.js +0 -106
- package/dist/components/FileUpload/index.d.ts +0 -2
- package/dist/components/FileUpload/index.js +0 -1
- package/dist/components/FileUpload/styles.css.d.ts +0 -19
- package/dist/components/FileUpload/styles.css.js +0 -145
- package/dist/components/Form/Form.d.ts +0 -7
- package/dist/components/Form/Form.js +0 -8
- package/dist/components/Form/FormInput.d.ts +0 -5
- package/dist/components/Form/FormInput.js +0 -9
- package/dist/components/Form/index.d.ts +0 -2
- package/dist/components/Form/index.js +0 -2
- package/dist/components/Form/styles.css.d.ts +0 -2
- package/dist/components/Form/styles.css.js +0 -11
- package/dist/components/Grid/Grid.d.ts +0 -162
- package/dist/components/Grid/Grid.js +0 -25
- package/dist/components/Grid/index.d.ts +0 -2
- package/dist/components/Grid/index.js +0 -1
- package/dist/components/Icon/Icon.d.ts +0 -12
- package/dist/components/Icon/Icon.js +0 -21
- package/dist/components/Icon/index.d.ts +0 -1
- package/dist/components/Icon/index.js +0 -1
- package/dist/components/Icon/styles.css.d.ts +0 -1
- package/dist/components/Icon/styles.css.js +0 -9
- package/dist/components/Input/Input.d.ts +0 -8
- package/dist/components/Input/Input.js +0 -9
- package/dist/components/Input/index.d.ts +0 -1
- package/dist/components/Input/index.js +0 -1
- package/dist/components/Input/styles.css.d.ts +0 -2
- package/dist/components/Input/styles.css.js +0 -8
- package/dist/components/Kbd/Kbd.d.ts +0 -7
- package/dist/components/Kbd/Kbd.js +0 -6
- package/dist/components/Kbd/index.d.ts +0 -2
- package/dist/components/Kbd/index.js +0 -1
- package/dist/components/Kbd/styles.css.d.ts +0 -1
- package/dist/components/Kbd/styles.css.js +0 -16
- package/dist/components/List/List.d.ts +0 -6
- package/dist/components/List/List.js +0 -7
- package/dist/components/List/ListItem.d.ts +0 -6
- package/dist/components/List/ListItem.js +0 -7
- package/dist/components/List/index.d.ts +0 -2
- package/dist/components/List/index.js +0 -2
- package/dist/components/List/styles.css.d.ts +0 -2
- package/dist/components/List/styles.css.js +0 -11
- package/dist/components/Modal/Modal.d.ts +0 -15
- package/dist/components/Modal/Modal.js +0 -35
- package/dist/components/Modal/index.d.ts +0 -2
- package/dist/components/Modal/index.js +0 -1
- package/dist/components/Modal/styles.css.d.ts +0 -7
- package/dist/components/Modal/styles.css.js +0 -92
- package/dist/components/Navbar/Navbar.d.ts +0 -7
- package/dist/components/Navbar/Navbar.js +0 -8
- package/dist/components/Navbar/NavbarItem.d.ts +0 -7
- package/dist/components/Navbar/NavbarItem.js +0 -8
- package/dist/components/Navbar/index.d.ts +0 -2
- package/dist/components/Navbar/index.js +0 -2
- package/dist/components/Navbar/styles.css.d.ts +0 -2
- package/dist/components/Navbar/styles.css.js +0 -3
- package/dist/components/NumberInput/NumberInput.d.ts +0 -21
- package/dist/components/NumberInput/NumberInput.js +0 -39
- package/dist/components/NumberInput/index.d.ts +0 -2
- package/dist/components/NumberInput/index.js +0 -1
- package/dist/components/NumberInput/styles.css.d.ts +0 -10
- package/dist/components/NumberInput/styles.css.js +0 -117
- package/dist/components/Pagination/Pagination.d.ts +0 -12
- package/dist/components/Pagination/Pagination.js +0 -50
- package/dist/components/Pagination/index.d.ts +0 -2
- package/dist/components/Pagination/index.js +0 -1
- package/dist/components/Pagination/styles.css.d.ts +0 -4
- package/dist/components/Pagination/styles.css.js +0 -44
- package/dist/components/Popover/Popover.d.ts +0 -19
- package/dist/components/Popover/Popover.js +0 -56
- package/dist/components/Popover/index.d.ts +0 -2
- package/dist/components/Popover/index.js +0 -1
- package/dist/components/Popover/styles.css.d.ts +0 -11
- package/dist/components/Popover/styles.css.js +0 -185
- package/dist/components/Progress/Progress.d.ts +0 -11
- package/dist/components/Progress/Progress.js +0 -9
- package/dist/components/Progress/index.d.ts +0 -1
- package/dist/components/Progress/index.js +0 -1
- package/dist/components/Progress/styles.css.d.ts +0 -4
- package/dist/components/Progress/styles.css.js +0 -71
- package/dist/components/Radio/Radio.d.ts +0 -161
- package/dist/components/Radio/Radio.js +0 -25
- package/dist/components/Radio/index.d.ts +0 -1
- package/dist/components/Radio/index.js +0 -1
- package/dist/components/Radio/styles.css.d.ts +0 -5
- package/dist/components/Radio/styles.css.js +0 -42
- package/dist/components/ScrollArea/ScrollArea.d.ts +0 -11
- package/dist/components/ScrollArea/ScrollArea.js +0 -12
- package/dist/components/ScrollArea/index.d.ts +0 -2
- package/dist/components/ScrollArea/index.js +0 -1
- package/dist/components/ScrollArea/styles.css.d.ts +0 -3
- package/dist/components/ScrollArea/styles.css.js +0 -25
- package/dist/components/Select/Select.d.ts +0 -158
- package/dist/components/Select/Select.js +0 -10
- package/dist/components/Select/index.d.ts +0 -1
- package/dist/components/Select/index.js +0 -1
- package/dist/components/Select/styles.css.d.ts +0 -4
- package/dist/components/Select/styles.css.js +0 -82
- package/dist/components/Separator/Separator.d.ts +0 -9
- package/dist/components/Separator/Separator.js +0 -8
- package/dist/components/Separator/index.d.ts +0 -2
- package/dist/components/Separator/index.js +0 -1
- package/dist/components/Separator/styles.css.d.ts +0 -4
- package/dist/components/Separator/styles.css.js +0 -28
- package/dist/components/Skeleton/Skeleton.d.ts +0 -15
- package/dist/components/Skeleton/Skeleton.js +0 -13
- package/dist/components/Skeleton/index.d.ts +0 -2
- package/dist/components/Skeleton/index.js +0 -1
- package/dist/components/Skeleton/styles.css.d.ts +0 -4
- package/dist/components/Skeleton/styles.css.js +0 -56
- package/dist/components/Spinner/Spinner.d.ts +0 -11
- package/dist/components/Spinner/Spinner.js +0 -8
- package/dist/components/Spinner/index.d.ts +0 -2
- package/dist/components/Spinner/index.js +0 -1
- package/dist/components/Spinner/styles.css.d.ts +0 -4
- package/dist/components/Spinner/styles.css.js +0 -55
- package/dist/components/Stack/Stack.d.ts +0 -167
- package/dist/components/Stack/Stack.js +0 -24
- package/dist/components/Stack/index.d.ts +0 -2
- package/dist/components/Stack/index.js +0 -1
- package/dist/components/Stepper/Stepper.d.ts +0 -19
- package/dist/components/Stepper/Stepper.js +0 -25
- package/dist/components/Stepper/index.d.ts +0 -2
- package/dist/components/Stepper/index.js +0 -1
- package/dist/components/Stepper/styles.css.d.ts +0 -14
- package/dist/components/Stepper/styles.css.js +0 -104
- package/dist/components/Table/Table.d.ts +0 -41
- package/dist/components/Table/Table.js +0 -39
- package/dist/components/Table/index.d.ts +0 -1
- package/dist/components/Table/index.js +0 -1
- package/dist/components/Table/styles.css.d.ts +0 -8
- package/dist/components/Table/styles.css.js +0 -49
- package/dist/components/Tabs/Tabs.d.ts +0 -29
- package/dist/components/Tabs/Tabs.js +0 -52
- package/dist/components/Tabs/index.d.ts +0 -1
- package/dist/components/Tabs/index.js +0 -1
- package/dist/components/Tabs/styles.css.d.ts +0 -6
- package/dist/components/Tabs/styles.css.js +0 -100
- package/dist/components/Tag/Tag.d.ts +0 -16
- package/dist/components/Tag/Tag.js +0 -18
- package/dist/components/Tag/index.d.ts +0 -1
- package/dist/components/Tag/index.js +0 -1
- package/dist/components/Tag/styles.css.d.ts +0 -3
- package/dist/components/Tag/styles.css.js +0 -93
- package/dist/components/Text/Header.d.ts +0 -8
- package/dist/components/Text/Header.js +0 -8
- package/dist/components/Text/P.d.ts +0 -7
- package/dist/components/Text/P.js +0 -8
- package/dist/components/Text/index.d.ts +0 -2
- package/dist/components/Text/index.js +0 -2
- package/dist/components/Text/styles.css.d.ts +0 -2
- package/dist/components/Text/styles.css.js +0 -13
- package/dist/components/TextArea/TextArea.d.ts +0 -8
- package/dist/components/TextArea/TextArea.js +0 -9
- package/dist/components/TextArea/index.d.ts +0 -2
- package/dist/components/TextArea/index.js +0 -1
- package/dist/components/TextArea/styles.css.d.ts +0 -2
- package/dist/components/TextArea/styles.css.js +0 -10
- package/dist/components/Toast/Toast.d.ts +0 -34
- package/dist/components/Toast/Toast.js +0 -177
- package/dist/components/Toast/index.d.ts +0 -1
- package/dist/components/Toast/index.js +0 -1
- package/dist/components/Toast/styles.css.d.ts +0 -21
- package/dist/components/Toast/styles.css.js +0 -192
- package/dist/components/Toggle/Toggle.d.ts +0 -11
- package/dist/components/Toggle/Toggle.js +0 -17
- package/dist/components/Toggle/index.d.ts +0 -2
- package/dist/components/Toggle/index.js +0 -1
- package/dist/components/Toggle/styles.css.d.ts +0 -12
- package/dist/components/Toggle/styles.css.js +0 -118
- package/dist/components/Tooltip/Tooltip.d.ts +0 -11
- package/dist/components/Tooltip/Tooltip.js +0 -16
- package/dist/components/Tooltip/index.d.ts +0 -2
- package/dist/components/Tooltip/index.js +0 -1
- package/dist/components/Tooltip/styles.css.d.ts +0 -8
- package/dist/components/Tooltip/styles.css.js +0 -86
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +0 -8
- package/dist/components/VisuallyHidden/VisuallyHidden.js +0 -9
- package/dist/components/VisuallyHidden/index.d.ts +0 -2
- package/dist/components/VisuallyHidden/index.js +0 -1
- package/dist/components/VisuallyHidden/styles.css.d.ts +0 -1
- package/dist/components/VisuallyHidden/styles.css.js +0 -12
- package/dist/components/index.d.ts +0 -68
- package/dist/components/index.js +0 -47
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/styles/layers.css.d.ts +0 -3
- package/dist/styles/layers.css.js +0 -3
- package/dist/styles/sprinkles.css.d.ts +0 -241
- package/dist/styles/sprinkles.css.js +0 -165
- package/dist/styles/theme.css.d.ts +0 -38
- package/dist/styles/theme.css.js +0 -51
- package/dist/styles/utils.d.ts +0 -2
- package/dist/styles/utils.js +0 -7
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { style } from '@vanilla-extract/css';
|
|
2
|
-
import { vars } from '../../styles/theme.css';
|
|
3
|
-
export const list = style({
|
|
4
|
-
listStyle: 'none',
|
|
5
|
-
padding: 0,
|
|
6
|
-
margin: 0,
|
|
7
|
-
});
|
|
8
|
-
export const listItem = style({
|
|
9
|
-
padding: '0.5rem 0',
|
|
10
|
-
borderBottom: `1px solid ${vars.colors.listBorder}`,
|
|
11
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
3
|
-
export type ModalSize = 'small' | 'medium' | 'large' | 'full';
|
|
4
|
-
type ModalPropsType = React.HTMLAttributes<HTMLDialogElement> & {
|
|
5
|
-
isOpen: boolean;
|
|
6
|
-
onClose: () => void;
|
|
7
|
-
title?: string;
|
|
8
|
-
size?: ModalSize;
|
|
9
|
-
children?: React.ReactNode;
|
|
10
|
-
footer?: React.ReactNode;
|
|
11
|
-
showCloseButton?: boolean;
|
|
12
|
-
};
|
|
13
|
-
export type ModalProps = ModalPropsType & Sprinkles;
|
|
14
|
-
declare const Modal: ({ isOpen, onClose, title, size, children, footer, showCloseButton, ...props }: ModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export default Modal;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
import { modal, modalVariants, modalHeader, modalTitle, modalCloseButton, modalBody, modalFooter, } from './styles.css';
|
|
4
|
-
import { useEffect, useRef } from 'react';
|
|
5
|
-
import Box from '../Box';
|
|
6
|
-
const Modal = ({ isOpen, onClose, title, size = 'medium', children, footer, showCloseButton = true, ...props }) => {
|
|
7
|
-
const dialogRef = useRef(null);
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
const dialog = dialogRef.current;
|
|
10
|
-
if (!dialog)
|
|
11
|
-
return;
|
|
12
|
-
if (isOpen) {
|
|
13
|
-
dialog.showModal();
|
|
14
|
-
dialog.classList.add('open');
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
dialog.close();
|
|
18
|
-
dialog.classList.remove('open');
|
|
19
|
-
}
|
|
20
|
-
const handleClose = () => {
|
|
21
|
-
onClose();
|
|
22
|
-
};
|
|
23
|
-
dialog.addEventListener('close', handleClose);
|
|
24
|
-
return () => {
|
|
25
|
-
dialog.removeEventListener('close', handleClose);
|
|
26
|
-
};
|
|
27
|
-
}, [isOpen, onClose]);
|
|
28
|
-
return (_jsxs(Box, { as: "dialog", ref: dialogRef, className: clsx(modal, modalVariants[size]), onClick: (e) => {
|
|
29
|
-
// Close when clicking the backdrop
|
|
30
|
-
if (e.target === dialogRef.current) {
|
|
31
|
-
onClose();
|
|
32
|
-
}
|
|
33
|
-
}, ...props, children: [title && (_jsxs(Box, { as: "div", className: modalHeader, children: [_jsx(Box, { as: "h2", className: modalTitle, children: title }), showCloseButton && (_jsx(Box, { as: "button", className: modalCloseButton, onClick: onClose, "aria-label": "Close modal", type: "button", children: "\u00D7" }))] })), _jsx(Box, { as: "div", className: modalBody, children: children }), footer && (_jsx(Box, { as: "div", className: modalFooter, children: footer }))] }));
|
|
34
|
-
};
|
|
35
|
-
export default Modal;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Modal } from './Modal';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare const modalVariants: Record<"medium" | "large" | "small" | "full", string>;
|
|
2
|
-
export declare const modal: string;
|
|
3
|
-
export declare const modalHeader: string;
|
|
4
|
-
export declare const modalTitle: string;
|
|
5
|
-
export declare const modalCloseButton: string;
|
|
6
|
-
export declare const modalBody: string;
|
|
7
|
-
export declare const modalFooter: string;
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { styleVariants } from '@vanilla-extract/css';
|
|
2
|
-
import { vars } from '../../styles/theme.css';
|
|
3
|
-
import { styleWithLayer } from '../../styles/utils';
|
|
4
|
-
export const modalVariants = styleVariants({
|
|
5
|
-
small: {
|
|
6
|
-
maxWidth: '400px',
|
|
7
|
-
},
|
|
8
|
-
medium: {
|
|
9
|
-
maxWidth: '600px',
|
|
10
|
-
},
|
|
11
|
-
large: {
|
|
12
|
-
maxWidth: '800px',
|
|
13
|
-
},
|
|
14
|
-
full: {
|
|
15
|
-
maxWidth: '95vw',
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
export const modal = styleWithLayer({
|
|
19
|
-
background: vars.colors.backgroundDefault,
|
|
20
|
-
borderRadius: '0.75rem',
|
|
21
|
-
boxShadow: '0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)',
|
|
22
|
-
border: '1px solid var(--modal-border, transparent)',
|
|
23
|
-
color: vars.colors.textPrimary,
|
|
24
|
-
fontFamily: vars.fontFamily.body,
|
|
25
|
-
maxWidth: '90vw',
|
|
26
|
-
maxHeight: '90vh',
|
|
27
|
-
flexDirection: 'column',
|
|
28
|
-
overflow: 'hidden',
|
|
29
|
-
selectors: {
|
|
30
|
-
'&:not([open])': {
|
|
31
|
-
display: 'none',
|
|
32
|
-
},
|
|
33
|
-
'[open] &': {
|
|
34
|
-
display: 'flex',
|
|
35
|
-
},
|
|
36
|
-
'&::backdrop': {
|
|
37
|
-
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
export const modalHeader = styleWithLayer({
|
|
42
|
-
padding: '1.25rem',
|
|
43
|
-
borderBottom: `1px solid ${vars.colors.borderMuted}`,
|
|
44
|
-
display: 'flex',
|
|
45
|
-
alignItems: 'center',
|
|
46
|
-
justifyContent: 'space-between',
|
|
47
|
-
gap: '1rem',
|
|
48
|
-
});
|
|
49
|
-
export const modalTitle = styleWithLayer({
|
|
50
|
-
fontFamily: vars.fontFamily.heading,
|
|
51
|
-
fontSize: '1.25rem',
|
|
52
|
-
fontWeight: '600',
|
|
53
|
-
color: vars.colors.textPrimary,
|
|
54
|
-
margin: 0,
|
|
55
|
-
});
|
|
56
|
-
export const modalCloseButton = styleWithLayer({
|
|
57
|
-
background: 'none',
|
|
58
|
-
border: 'none',
|
|
59
|
-
padding: '0.5rem',
|
|
60
|
-
cursor: 'pointer',
|
|
61
|
-
borderRadius: '0.375rem',
|
|
62
|
-
display: 'flex',
|
|
63
|
-
alignItems: 'center',
|
|
64
|
-
justifyContent: 'center',
|
|
65
|
-
color: vars.colors.textSecondary,
|
|
66
|
-
fontSize: '1.5rem',
|
|
67
|
-
lineHeight: '1',
|
|
68
|
-
transition: 'background-color 0.2s ease-in-out, color 0.2s ease-in-out',
|
|
69
|
-
selectors: {
|
|
70
|
-
'&:hover': {
|
|
71
|
-
backgroundColor: vars.colors.borderMuted,
|
|
72
|
-
color: vars.colors.textPrimary,
|
|
73
|
-
},
|
|
74
|
-
'&:focus-visible': {
|
|
75
|
-
outline: '2px solid var(--modal-focus-ring, currentColor)',
|
|
76
|
-
outlineOffset: '2px',
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
});
|
|
80
|
-
export const modalBody = styleWithLayer({
|
|
81
|
-
padding: '1.25rem',
|
|
82
|
-
overflowY: 'auto',
|
|
83
|
-
flex: 1,
|
|
84
|
-
});
|
|
85
|
-
export const modalFooter = styleWithLayer({
|
|
86
|
-
padding: '1.25rem',
|
|
87
|
-
borderTop: `1px solid ${vars.colors.borderMuted}`,
|
|
88
|
-
display: 'flex',
|
|
89
|
-
gap: '0.75rem',
|
|
90
|
-
justifyContent: 'flex-end',
|
|
91
|
-
alignItems: 'center',
|
|
92
|
-
});
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
3
|
-
type NavbarProps = React.HTMLAttributes<HTMLElement> & Sprinkles & {
|
|
4
|
-
children?: React.ReactNode;
|
|
5
|
-
};
|
|
6
|
-
declare const Navbar: (props: NavbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export default Navbar;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
import { navbarStyle } from './styles.css';
|
|
4
|
-
import Box from '../Box';
|
|
5
|
-
const Navbar = (props) => {
|
|
6
|
-
return (_jsx(Box, { as: "nav", width: "100%", display: "flex", flexDirection: "row", gap: "medium", className: clsx(navbarStyle, props.className), ...props }));
|
|
7
|
-
};
|
|
8
|
-
export default Navbar;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
3
|
-
type NavbarItemProps = React.HTMLAttributes<HTMLDivElement> & Sprinkles & {
|
|
4
|
-
children?: React.ReactNode;
|
|
5
|
-
};
|
|
6
|
-
declare const NavbarItem: (props: NavbarItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export default NavbarItem;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
import { navbarItemStyle } from './styles.css';
|
|
4
|
-
import Box from '../Box';
|
|
5
|
-
const NavbarItem = (props) => {
|
|
6
|
-
return _jsx(Box, { as: "div", className: clsx(navbarItemStyle, props.className), ...props });
|
|
7
|
-
};
|
|
8
|
-
export default NavbarItem;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
3
|
-
export type NumberInputPosition = 'right' | 'left';
|
|
4
|
-
export type NumberInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'value' | 'min' | 'max'> & Sprinkles & {
|
|
5
|
-
label?: string;
|
|
6
|
-
value?: number | '';
|
|
7
|
-
onChange?: (value: number | '') => void;
|
|
8
|
-
min?: number;
|
|
9
|
-
max?: number;
|
|
10
|
-
step?: number;
|
|
11
|
-
stepperPosition?: NumberInputPosition;
|
|
12
|
-
placeholder?: string;
|
|
13
|
-
hint?: string;
|
|
14
|
-
error?: boolean;
|
|
15
|
-
errorMessage?: string;
|
|
16
|
-
fullWidth?: boolean;
|
|
17
|
-
disabled?: boolean;
|
|
18
|
-
allowEmpty?: boolean;
|
|
19
|
-
};
|
|
20
|
-
declare const NumberInput: ({ label, value, onChange, min, max, step, stepperPosition, placeholder, hint, error, errorMessage, fullWidth, disabled, allowEmpty, className, ...props }: NumberInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
-
export default NumberInput;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
import { useCallback } from 'react';
|
|
4
|
-
import { numberInputContainer, numberInput, numberInputVariants, numberInputLabel, numberInputStepper, numberInputStepperLeft, numberInputButton, numberInputWrapper, numberInputHint, numberInputErrorMessage, } from './styles.css';
|
|
5
|
-
import Box from '../Box';
|
|
6
|
-
const NumberInput = ({ label, value, onChange, min = -Infinity, max = Infinity, step = 1, stepperPosition = 'right', placeholder = '0', hint, error = false, errorMessage, fullWidth = true, disabled = false, allowEmpty = true, className, ...props }) => {
|
|
7
|
-
const handleChange = (e) => {
|
|
8
|
-
const inputValue = e.target.value;
|
|
9
|
-
if (inputValue === '') {
|
|
10
|
-
if (allowEmpty) {
|
|
11
|
-
onChange?.('');
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
onChange?.(0);
|
|
15
|
-
}
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
const numValue = parseFloat(inputValue);
|
|
19
|
-
if (!isNaN(numValue)) {
|
|
20
|
-
const clampedValue = Math.min(Math.max(numValue, min), max);
|
|
21
|
-
onChange?.(clampedValue);
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
const increment = useCallback(() => {
|
|
25
|
-
const currentValue = typeof value === 'number' ? value : 0;
|
|
26
|
-
const newValue = Math.min(currentValue + step, max);
|
|
27
|
-
onChange?.(newValue);
|
|
28
|
-
}, [value, step, max, onChange]);
|
|
29
|
-
const decrement = useCallback(() => {
|
|
30
|
-
const currentValue = typeof value === 'number' ? value : 0;
|
|
31
|
-
const newValue = Math.max(currentValue - step, min);
|
|
32
|
-
onChange?.(newValue);
|
|
33
|
-
}, [value, step, min, onChange]);
|
|
34
|
-
const isIncrementDisabled = disabled || (typeof value === 'number' && value >= max);
|
|
35
|
-
const isDecrementDisabled = disabled || (typeof value === 'number' && value <= min);
|
|
36
|
-
const displayValue = value === '' ? '' : value;
|
|
37
|
-
return (_jsxs(Box, { className: numberInputWrapper, width: fullWidth ? '100%' : undefined, children: [label && (_jsx(Box, { as: "label", className: numberInputLabel, children: label })), _jsxs(Box, { className: numberInputContainer, children: [_jsx(Box, { as: "input", type: "number", value: displayValue, onChange: handleChange, min: min, max: max, step: step, placeholder: placeholder, disabled: disabled, className: clsx(numberInput, numberInputVariants[error ? 'error' : 'default'], className), ...props }), _jsxs(Box, { className: clsx(numberInputStepper, stepperPosition === 'left' && numberInputStepperLeft), children: [_jsx(Box, { as: "button", className: numberInputButton, onClick: increment, disabled: isIncrementDisabled, type: "button", "aria-label": "Increase value", children: "+" }), _jsx(Box, { as: "button", className: numberInputButton, onClick: decrement, disabled: isDecrementDisabled, type: "button", "aria-label": "Decrease value", children: "\u2212" })] })] }), error && errorMessage && (_jsx(Box, { as: "div", className: numberInputErrorMessage, role: "alert", children: errorMessage })), hint && !error && (_jsx(Box, { as: "div", className: numberInputHint, children: hint }))] }));
|
|
38
|
-
};
|
|
39
|
-
export default NumberInput;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as NumberInput } from './NumberInput';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const numberInputContainer: string;
|
|
2
|
-
export declare const numberInput: string;
|
|
3
|
-
export declare const numberInputVariants: Record<"default" | "error", string>;
|
|
4
|
-
export declare const numberInputLabel: string;
|
|
5
|
-
export declare const numberInputStepper: string;
|
|
6
|
-
export declare const numberInputStepperLeft: string;
|
|
7
|
-
export declare const numberInputButton: string;
|
|
8
|
-
export declare const numberInputWrapper: string;
|
|
9
|
-
export declare const numberInputHint: string;
|
|
10
|
-
export declare const numberInputErrorMessage: string;
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { styleVariants } from '@vanilla-extract/css';
|
|
2
|
-
import { vars } from '../../styles/theme.css';
|
|
3
|
-
import { styleWithLayer } from '../../styles/utils';
|
|
4
|
-
export const numberInputContainer = styleWithLayer({
|
|
5
|
-
position: 'relative',
|
|
6
|
-
display: 'flex',
|
|
7
|
-
alignItems: 'center',
|
|
8
|
-
width: '100%',
|
|
9
|
-
});
|
|
10
|
-
export const numberInput = styleWithLayer({
|
|
11
|
-
width: '100%',
|
|
12
|
-
padding: '0.75rem 2.5rem',
|
|
13
|
-
fontSize: '14px',
|
|
14
|
-
fontFamily: vars.fontFamily.body,
|
|
15
|
-
color: vars.colors.textPrimary,
|
|
16
|
-
backgroundColor: vars.colors.inputBackground,
|
|
17
|
-
border: `1px solid ${vars.colors.inputBorder}`,
|
|
18
|
-
borderRadius: '8px',
|
|
19
|
-
outline: 'none',
|
|
20
|
-
textAlign: 'center',
|
|
21
|
-
transition: 'border-color 0.2s ease',
|
|
22
|
-
'::placeholder': {
|
|
23
|
-
color: vars.colors.inputPlaceholder,
|
|
24
|
-
},
|
|
25
|
-
':focus-visible': {
|
|
26
|
-
outline: `2px solid ${vars.colors.inputBorderFocused}`,
|
|
27
|
-
outlineOffset: '2px',
|
|
28
|
-
},
|
|
29
|
-
':hover': {
|
|
30
|
-
borderColor: vars.colors.inputBorderFocused,
|
|
31
|
-
},
|
|
32
|
-
selectors: {
|
|
33
|
-
'&:disabled': {
|
|
34
|
-
cursor: 'not-allowed',
|
|
35
|
-
opacity: 0.5,
|
|
36
|
-
backgroundColor: vars.colors.backgroundMuted,
|
|
37
|
-
},
|
|
38
|
-
'&:disabled:hover': {
|
|
39
|
-
borderColor: vars.colors.inputBorder,
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
export const numberInputVariants = styleVariants({
|
|
44
|
-
default: {},
|
|
45
|
-
error: {
|
|
46
|
-
border: `1px solid ${vars.colors.alertErrorBorder}`,
|
|
47
|
-
':focus-visible': {
|
|
48
|
-
outline: `2px solid ${vars.colors.alertErrorBorder}`,
|
|
49
|
-
},
|
|
50
|
-
':hover': {
|
|
51
|
-
borderColor: vars.colors.alertErrorBorder,
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
});
|
|
55
|
-
export const numberInputLabel = styleWithLayer({
|
|
56
|
-
display: 'block',
|
|
57
|
-
fontSize: '14px',
|
|
58
|
-
fontWeight: '500',
|
|
59
|
-
color: vars.colors.textPrimary,
|
|
60
|
-
marginBottom: '8px',
|
|
61
|
-
});
|
|
62
|
-
export const numberInputStepper = styleWithLayer({
|
|
63
|
-
position: 'absolute',
|
|
64
|
-
display: 'flex',
|
|
65
|
-
flexDirection: 'column',
|
|
66
|
-
right: '0.5rem',
|
|
67
|
-
top: '50%',
|
|
68
|
-
transform: 'translateY(-50%)',
|
|
69
|
-
gap: '2px',
|
|
70
|
-
});
|
|
71
|
-
export const numberInputStepperLeft = styleWithLayer({
|
|
72
|
-
left: '0.5rem',
|
|
73
|
-
right: 'auto',
|
|
74
|
-
});
|
|
75
|
-
export const numberInputButton = styleWithLayer({
|
|
76
|
-
width: '1.5rem',
|
|
77
|
-
height: '1.25rem',
|
|
78
|
-
display: 'flex',
|
|
79
|
-
alignItems: 'center',
|
|
80
|
-
justifyContent: 'center',
|
|
81
|
-
backgroundColor: vars.colors.buttonBackgroundSecondary,
|
|
82
|
-
border: `1px solid ${vars.colors.borderDefault}`,
|
|
83
|
-
borderRadius: '4px',
|
|
84
|
-
cursor: 'pointer',
|
|
85
|
-
fontSize: '12px',
|
|
86
|
-
color: vars.colors.buttonTextSecondary,
|
|
87
|
-
transition: 'all 0.15s ease',
|
|
88
|
-
padding: 0,
|
|
89
|
-
':hover': {
|
|
90
|
-
backgroundColor: vars.colors.buttonBackgroundFocusedSecondary,
|
|
91
|
-
},
|
|
92
|
-
':active': {
|
|
93
|
-
transform: 'scale(0.95)',
|
|
94
|
-
},
|
|
95
|
-
selectors: {
|
|
96
|
-
'&:disabled': {
|
|
97
|
-
cursor: 'not-allowed',
|
|
98
|
-
opacity: 0.5,
|
|
99
|
-
},
|
|
100
|
-
'&:disabled:hover': {
|
|
101
|
-
backgroundColor: vars.colors.buttonBackgroundSecondary,
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
});
|
|
105
|
-
export const numberInputWrapper = styleWithLayer({
|
|
106
|
-
width: '100%',
|
|
107
|
-
});
|
|
108
|
-
export const numberInputHint = styleWithLayer({
|
|
109
|
-
fontSize: '12px',
|
|
110
|
-
color: vars.colors.textSecondary,
|
|
111
|
-
marginTop: '4px',
|
|
112
|
-
});
|
|
113
|
-
export const numberInputErrorMessage = styleWithLayer({
|
|
114
|
-
fontSize: '12px',
|
|
115
|
-
color: vars.colors.alertErrorText,
|
|
116
|
-
marginTop: '4px',
|
|
117
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
3
|
-
export type PaginationProps = React.HTMLAttributes<HTMLDivElement> & Sprinkles & {
|
|
4
|
-
currentPage: number;
|
|
5
|
-
totalPages: number;
|
|
6
|
-
onPageChange: (page: number) => void;
|
|
7
|
-
siblingCount?: number;
|
|
8
|
-
showFirstLast?: boolean;
|
|
9
|
-
showPrevNext?: boolean;
|
|
10
|
-
};
|
|
11
|
-
declare const Pagination: ({ currentPage, totalPages, onPageChange, siblingCount, showFirstLast, showPrevNext, ...props }: PaginationProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export default Pagination;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
import { paginationContainer, pageButton, pageButtonVariants, ellipsis, } from './styles.css';
|
|
4
|
-
import Box from '../Box';
|
|
5
|
-
const Pagination = ({ currentPage, totalPages, onPageChange, siblingCount = 1, showFirstLast = true, showPrevNext = true, ...props }) => {
|
|
6
|
-
const generatePageNumbers = () => {
|
|
7
|
-
const pages = [];
|
|
8
|
-
const leftSiblingIndex = Math.max(currentPage - siblingCount, 1);
|
|
9
|
-
const rightSiblingIndex = Math.min(currentPage + siblingCount, totalPages);
|
|
10
|
-
const shouldShowLeftEllipsis = leftSiblingIndex > 2;
|
|
11
|
-
const shouldShowRightEllipsis = rightSiblingIndex < totalPages - 1;
|
|
12
|
-
if (totalPages <= 7) {
|
|
13
|
-
for (let i = 1; i <= totalPages; i++) {
|
|
14
|
-
pages.push(i);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
pages.push(1);
|
|
19
|
-
if (shouldShowLeftEllipsis) {
|
|
20
|
-
pages.push('left-ellipsis');
|
|
21
|
-
}
|
|
22
|
-
else if (currentPage > 3) {
|
|
23
|
-
for (let i = 2; i < leftSiblingIndex; i++) {
|
|
24
|
-
pages.push(i);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
for (let i = leftSiblingIndex; i <= rightSiblingIndex; i++) {
|
|
28
|
-
if (i !== 1 && i !== totalPages) {
|
|
29
|
-
pages.push(i);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
if (shouldShowRightEllipsis) {
|
|
33
|
-
pages.push('right-ellipsis');
|
|
34
|
-
}
|
|
35
|
-
else if (currentPage < totalPages - 2) {
|
|
36
|
-
for (let i = rightSiblingIndex + 1; i < totalPages; i++) {
|
|
37
|
-
pages.push(i);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
pages.push(totalPages);
|
|
41
|
-
}
|
|
42
|
-
return pages;
|
|
43
|
-
};
|
|
44
|
-
const pages = generatePageNumbers();
|
|
45
|
-
const { className, ...restProps } = props;
|
|
46
|
-
return (_jsxs(Box, { className: clsx(paginationContainer, className), ...restProps, children: [showFirstLast && (_jsx(Box, { as: "button", className: clsx(pageButton, pageButtonVariants.default), onClick: () => onPageChange(1), disabled: currentPage === 1, children: '<<' })), showPrevNext && (_jsx(Box, { as: "button", className: clsx(pageButton, pageButtonVariants.default), onClick: () => onPageChange(currentPage - 1), disabled: currentPage === 1, children: '<' })), pages.map((page, index) => typeof page === 'number' ? (_jsx(Box, { as: "button", className: clsx(pageButton, page === currentPage
|
|
47
|
-
? pageButtonVariants.active
|
|
48
|
-
: pageButtonVariants.default), onClick: () => onPageChange(page), children: page }, `page-${page}`)) : (_jsx(Box, { className: ellipsis, children: "..." }, `${page}-${index}`))), showPrevNext && (_jsx(Box, { as: "button", className: clsx(pageButton, pageButtonVariants.default), onClick: () => onPageChange(currentPage + 1), disabled: currentPage === totalPages, children: '>' })), showFirstLast && (_jsx(Box, { as: "button", className: clsx(pageButton, pageButtonVariants.default), onClick: () => onPageChange(totalPages), disabled: currentPage === totalPages, children: '>>' }))] }));
|
|
49
|
-
};
|
|
50
|
-
export default Pagination;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Pagination } from './Pagination';
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { styleVariants } from '@vanilla-extract/css';
|
|
2
|
-
import { vars } from '../../styles/theme.css';
|
|
3
|
-
import { styleWithLayer } from '../../styles/utils';
|
|
4
|
-
export const paginationContainer = styleWithLayer({
|
|
5
|
-
display: 'flex',
|
|
6
|
-
alignItems: 'center',
|
|
7
|
-
gap: '0.5rem',
|
|
8
|
-
});
|
|
9
|
-
export const pageButton = styleWithLayer({
|
|
10
|
-
padding: '0.5rem 0.75rem',
|
|
11
|
-
borderRadius: '0.5rem',
|
|
12
|
-
border: `1px solid ${vars.colors.borderDefault}`,
|
|
13
|
-
backgroundColor: 'transparent',
|
|
14
|
-
cursor: 'pointer',
|
|
15
|
-
minWidth: '2.5rem',
|
|
16
|
-
display: 'flex',
|
|
17
|
-
alignItems: 'center',
|
|
18
|
-
justifyContent: 'center',
|
|
19
|
-
':disabled': {
|
|
20
|
-
cursor: 'not-allowed',
|
|
21
|
-
opacity: 0.5,
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
export const pageButtonVariants = styleVariants({
|
|
25
|
-
default: {
|
|
26
|
-
color: vars.colors.textPrimary,
|
|
27
|
-
':hover': {
|
|
28
|
-
backgroundColor: vars.colors.buttonBackgroundSecondary,
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
active: {
|
|
32
|
-
backgroundColor: vars.colors.buttonBackgroundPrimary,
|
|
33
|
-
color: vars.colors.buttonTextPrimary,
|
|
34
|
-
borderColor: vars.colors.buttonBackgroundPrimary,
|
|
35
|
-
':hover': {
|
|
36
|
-
backgroundColor: vars.colors.buttonBackgroundFocusedPrimary,
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
export const ellipsis = styleWithLayer({
|
|
41
|
-
padding: '0.5rem',
|
|
42
|
-
color: vars.colors.textPrimary,
|
|
43
|
-
userSelect: 'none',
|
|
44
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Sprinkles } from '../../styles/sprinkles.css';
|
|
3
|
-
export type PopoverPosition = 'top' | 'bottom' | 'left' | 'right' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
|
|
4
|
-
export type PopoverTriggerType = 'click' | 'hover';
|
|
5
|
-
export type PopoverProps = React.HTMLAttributes<HTMLDivElement> & Sprinkles & {
|
|
6
|
-
trigger: React.ReactNode;
|
|
7
|
-
children: React.ReactNode;
|
|
8
|
-
position?: PopoverPosition;
|
|
9
|
-
title?: string;
|
|
10
|
-
footer?: React.ReactNode;
|
|
11
|
-
showArrow?: boolean;
|
|
12
|
-
triggerType?: PopoverTriggerType;
|
|
13
|
-
closeOnClickOutside?: boolean;
|
|
14
|
-
closeOnEscape?: boolean;
|
|
15
|
-
defaultOpen?: boolean;
|
|
16
|
-
onOpenChange?: (isOpen: boolean) => void;
|
|
17
|
-
};
|
|
18
|
-
declare const Popover: ({ trigger, children, position, title, footer, showArrow, triggerType, closeOnClickOutside, closeOnEscape, defaultOpen, onOpenChange, className, ...props }: PopoverProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
-
export default Popover;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
import { useState, useRef, useEffect } from 'react';
|
|
4
|
-
import { popoverContainer, popoverTrigger, popoverContent, popoverPositionVariants, popoverArrow, popoverArrowPositionVariants, popoverHeader, popoverTitle, popoverCloseButton, popoverBody, popoverFooter, } from './styles.css';
|
|
5
|
-
import Box from '../Box';
|
|
6
|
-
const Popover = ({ trigger, children, position = 'bottom', title, footer, showArrow = true, triggerType = 'click', closeOnClickOutside = true, closeOnEscape = true, defaultOpen = false, onOpenChange, className, ...props }) => {
|
|
7
|
-
const [isOpen, setIsOpen] = useState(defaultOpen);
|
|
8
|
-
const containerRef = useRef(null);
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
onOpenChange?.(isOpen);
|
|
11
|
-
}, [isOpen, onOpenChange]);
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
if (!closeOnClickOutside)
|
|
14
|
-
return;
|
|
15
|
-
const handleClickOutside = (event) => {
|
|
16
|
-
if (containerRef.current &&
|
|
17
|
-
!containerRef.current.contains(event.target)) {
|
|
18
|
-
setIsOpen(false);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
if (isOpen) {
|
|
22
|
-
document.addEventListener('mousedown', handleClickOutside);
|
|
23
|
-
}
|
|
24
|
-
return () => {
|
|
25
|
-
document.removeEventListener('mousedown', handleClickOutside);
|
|
26
|
-
};
|
|
27
|
-
}, [isOpen, closeOnClickOutside]);
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
if (!closeOnEscape)
|
|
30
|
-
return;
|
|
31
|
-
const handleEscape = (e) => {
|
|
32
|
-
if (e.key === 'Escape' && isOpen) {
|
|
33
|
-
setIsOpen(false);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
document.addEventListener('keydown', handleEscape);
|
|
37
|
-
return () => document.removeEventListener('keydown', handleEscape);
|
|
38
|
-
}, [isOpen, closeOnEscape]);
|
|
39
|
-
const handleTriggerClick = () => {
|
|
40
|
-
if (triggerType === 'click') {
|
|
41
|
-
setIsOpen(!isOpen);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
const handleTriggerMouseEnter = () => {
|
|
45
|
-
if (triggerType === 'hover') {
|
|
46
|
-
setIsOpen(true);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
const handleTriggerMouseLeave = () => {
|
|
50
|
-
if (triggerType === 'hover') {
|
|
51
|
-
setIsOpen(false);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
return (_jsxs(Box, { ref: containerRef, className: clsx(popoverContainer, className), onMouseEnter: handleTriggerMouseEnter, onMouseLeave: handleTriggerMouseLeave, ...props, children: [_jsx(Box, { className: popoverTrigger, onClick: handleTriggerClick, "aria-expanded": isOpen, children: trigger }), isOpen && (_jsxs(Box, { className: clsx(popoverContent, popoverPositionVariants[position]), role: "dialog", "aria-modal": "false", children: [showArrow && (_jsx(Box, { as: "span", className: clsx(popoverArrow, popoverArrowPositionVariants[position]) })), (title || triggerType === 'click') && (_jsxs(Box, { as: "div", className: popoverHeader, children: [title && (_jsx(Box, { as: "h3", className: popoverTitle, children: title })), triggerType === 'click' && (_jsx(Box, { as: "button", className: popoverCloseButton, onClick: () => setIsOpen(false), "aria-label": "Close popover", type: "button", children: "\u00D7" }))] })), _jsx(Box, { as: "div", className: popoverBody, children: children }), footer && (_jsx(Box, { as: "div", className: popoverFooter, children: footer }))] }))] }));
|
|
55
|
-
};
|
|
56
|
-
export default Popover;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Popover } from './Popover';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare const popoverContainer: string;
|
|
2
|
-
export declare const popoverTrigger: string;
|
|
3
|
-
export declare const popoverContent: string;
|
|
4
|
-
export declare const popoverPositionVariants: Record<"bottom" | "left" | "right" | "top" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight", string>;
|
|
5
|
-
export declare const popoverArrow: string;
|
|
6
|
-
export declare const popoverArrowPositionVariants: Record<"bottom" | "left" | "right" | "top" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight", string>;
|
|
7
|
-
export declare const popoverHeader: string;
|
|
8
|
-
export declare const popoverTitle: string;
|
|
9
|
-
export declare const popoverCloseButton: string;
|
|
10
|
-
export declare const popoverBody: string;
|
|
11
|
-
export declare const popoverFooter: string;
|