@jordan-mace/chaser-design-system 1.2.3 → 1.2.4
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 +16 -0
- package/dist/components/Accordion/Accordion.js +43 -0
- package/dist/components/Accordion/index.d.ts +1 -0
- package/dist/components/Accordion/index.js +1 -0
- package/dist/components/Accordion/styles.css.d.ts +7 -0
- package/dist/components/Accordion/styles.css.js +65 -0
- package/dist/components/Alert/Alert.d.ts +9 -0
- package/dist/components/Alert/Alert.js +8 -0
- package/dist/components/Alert/index.d.ts +1 -0
- package/dist/components/Alert/index.js +1 -0
- package/dist/components/Alert/styles.css.d.ts +4 -0
- package/dist/components/Alert/styles.css.js +54 -0
- package/dist/components/AspectRatio/AspectRatio.d.ts +9 -0
- package/dist/components/AspectRatio/AspectRatio.js +12 -0
- package/dist/components/AspectRatio/index.d.ts +2 -0
- package/dist/components/AspectRatio/index.js +1 -0
- package/dist/components/Avatar/Avatar.d.ts +11 -0
- package/dist/components/Avatar/Avatar.js +13 -0
- package/dist/components/Avatar/index.d.ts +1 -0
- package/dist/components/Avatar/index.js +1 -0
- package/dist/components/Avatar/styles.css.d.ts +4 -0
- package/dist/components/Avatar/styles.css.js +151 -0
- package/dist/components/Badge/Badge.d.ts +11 -0
- package/dist/components/Badge/Badge.js +8 -0
- package/dist/components/Badge/index.d.ts +2 -0
- package/dist/components/Badge/index.js +1 -0
- package/dist/components/Badge/styles.css.d.ts +5 -0
- package/dist/components/Badge/styles.css.js +77 -0
- package/dist/components/Box/Box.d.ts +11 -0
- package/dist/components/Box/Box.js +54 -0
- package/dist/components/Box/index.d.ts +2 -0
- package/dist/components/Box/index.js +1 -0
- package/dist/components/Box/reset.css.d.ts +1 -0
- package/dist/components/Box/reset.css.js +15 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +12 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +8 -0
- package/dist/components/Breadcrumb/index.d.ts +1 -0
- package/dist/components/Breadcrumb/index.js +1 -0
- package/dist/components/Breadcrumb/styles.css.d.ts +6 -0
- package/dist/components/Breadcrumb/styles.css.js +50 -0
- package/dist/components/Button/Button.d.ts +9 -0
- package/dist/components/Button/Button.js +8 -0
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/Button/index.js +1 -0
- package/dist/components/Button/styles.css.d.ts +2 -0
- package/dist/components/Button/styles.css.js +30 -0
- package/dist/components/Card/Card.d.ts +8 -0
- package/dist/components/Card/Card.js +8 -0
- package/dist/components/Card/index.d.ts +1 -0
- package/dist/components/Card/index.js +1 -0
- package/dist/components/Card/styles.css.d.ts +2 -0
- package/dist/components/Card/styles.css.js +25 -0
- package/dist/components/Checkbox/Checkbox.d.ts +6 -0
- package/dist/components/Checkbox/Checkbox.js +25 -0
- package/dist/components/Checkbox/index.d.ts +1 -0
- package/dist/components/Checkbox/index.js +1 -0
- package/dist/components/Checkbox/styles.css.d.ts +3 -0
- package/dist/components/Checkbox/styles.css.js +31 -0
- package/dist/components/Collapse/Collapse.d.ts +12 -0
- package/dist/components/Collapse/Collapse.js +56 -0
- package/dist/components/Collapse/index.d.ts +2 -0
- package/dist/components/Collapse/index.js +1 -0
- package/dist/components/Collapse/styles.css.d.ts +3 -0
- package/dist/components/Collapse/styles.css.js +36 -0
- package/dist/components/Combobox/Combobox.d.ts +23 -0
- package/dist/components/Combobox/Combobox.js +104 -0
- package/dist/components/Combobox/index.d.ts +2 -0
- package/dist/components/Combobox/index.js +1 -0
- package/dist/components/Combobox/styles.css.d.ts +13 -0
- package/dist/components/Combobox/styles.css.js +142 -0
- package/dist/components/Container/Container.d.ts +11 -0
- package/dist/components/Container/Container.js +21 -0
- package/dist/components/Container/index.d.ts +2 -0
- package/dist/components/Container/index.js +1 -0
- package/dist/components/Divider/Divider.d.ts +9 -0
- package/dist/components/Divider/Divider.js +8 -0
- package/dist/components/Divider/index.d.ts +2 -0
- package/dist/components/Divider/index.js +1 -0
- package/dist/components/Divider/styles.css.d.ts +4 -0
- package/dist/components/Divider/styles.css.js +41 -0
- package/dist/components/Drawer/Drawer.d.ts +16 -0
- package/dist/components/Drawer/Drawer.js +65 -0
- package/dist/components/Drawer/index.d.ts +2 -0
- package/dist/components/Drawer/index.js +1 -0
- package/dist/components/Drawer/styles.css.d.ts +8 -0
- package/dist/components/Drawer/styles.css.js +125 -0
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +23 -0
- package/dist/components/DropdownMenu/DropdownMenu.js +43 -0
- package/dist/components/DropdownMenu/index.d.ts +2 -0
- package/dist/components/DropdownMenu/index.js +1 -0
- package/dist/components/DropdownMenu/styles.css.d.ts +9 -0
- package/dist/components/DropdownMenu/styles.css.js +93 -0
- package/dist/components/EmptyState/EmptyState.d.ts +10 -0
- package/dist/components/EmptyState/EmptyState.js +8 -0
- package/dist/components/EmptyState/index.d.ts +2 -0
- package/dist/components/EmptyState/index.js +1 -0
- package/dist/components/EmptyState/styles.css.d.ts +5 -0
- package/dist/components/EmptyState/styles.css.js +30 -0
- package/dist/components/FileUpload/FileUpload.d.ts +27 -0
- package/dist/components/FileUpload/FileUpload.js +102 -0
- package/dist/components/FileUpload/index.d.ts +2 -0
- package/dist/components/FileUpload/index.js +1 -0
- package/dist/components/FileUpload/styles.css.d.ts +19 -0
- package/dist/components/FileUpload/styles.css.js +145 -0
- package/dist/components/Form/Form.d.ts +7 -0
- package/dist/components/Form/Form.js +8 -0
- package/dist/components/Form/FormInput.d.ts +5 -0
- package/dist/components/Form/FormInput.js +9 -0
- package/dist/components/Form/index.d.ts +2 -0
- package/dist/components/Form/index.js +2 -0
- package/dist/components/Form/styles.css.d.ts +2 -0
- package/dist/components/Form/styles.css.js +11 -0
- package/dist/components/Grid/Grid.d.ts +13 -0
- package/dist/components/Grid/Grid.js +25 -0
- package/dist/components/Grid/index.d.ts +2 -0
- package/dist/components/Grid/index.js +1 -0
- package/dist/components/Icon/Icon.d.ts +12 -0
- package/dist/components/Icon/Icon.js +21 -0
- package/dist/components/Icon/index.d.ts +1 -0
- package/dist/components/Icon/index.js +1 -0
- package/dist/components/Icon/styles.css.d.ts +1 -0
- package/dist/components/Icon/styles.css.js +9 -0
- package/dist/components/Input/Input.d.ts +7 -0
- package/dist/components/Input/Input.js +9 -0
- package/dist/components/Input/index.d.ts +1 -0
- package/dist/components/Input/index.js +1 -0
- package/dist/components/Input/styles.css.d.ts +2 -0
- package/dist/components/Input/styles.css.js +8 -0
- package/dist/components/Kbd/Kbd.d.ts +7 -0
- package/dist/components/Kbd/Kbd.js +6 -0
- package/dist/components/Kbd/index.d.ts +2 -0
- package/dist/components/Kbd/index.js +1 -0
- package/dist/components/Kbd/styles.css.d.ts +1 -0
- package/dist/components/Kbd/styles.css.js +16 -0
- package/dist/components/List/List.d.ts +5 -0
- package/dist/components/List/List.js +7 -0
- package/dist/components/List/ListItem.d.ts +5 -0
- package/dist/components/List/ListItem.js +7 -0
- package/dist/components/List/index.d.ts +2 -0
- package/dist/components/List/index.js +2 -0
- package/dist/components/List/styles.css.d.ts +2 -0
- package/dist/components/List/styles.css.js +11 -0
- package/dist/components/Modal/Modal.d.ts +13 -0
- package/dist/components/Modal/Modal.js +35 -0
- package/dist/components/Modal/index.d.ts +2 -0
- package/dist/components/Modal/index.js +1 -0
- package/dist/components/Modal/styles.css.d.ts +7 -0
- package/dist/components/Modal/styles.css.js +92 -0
- package/dist/components/Navbar/Navbar.d.ts +6 -0
- package/dist/components/Navbar/Navbar.js +8 -0
- package/dist/components/Navbar/NavbarItem.d.ts +6 -0
- package/dist/components/Navbar/NavbarItem.js +8 -0
- package/dist/components/Navbar/index.d.ts +2 -0
- package/dist/components/Navbar/index.js +2 -0
- package/dist/components/Navbar/styles.css.d.ts +2 -0
- package/dist/components/Navbar/styles.css.js +3 -0
- package/dist/components/NumberInput/NumberInput.d.ts +20 -0
- package/dist/components/NumberInput/NumberInput.js +39 -0
- package/dist/components/NumberInput/index.d.ts +2 -0
- package/dist/components/NumberInput/index.js +1 -0
- package/dist/components/NumberInput/styles.css.d.ts +10 -0
- package/dist/components/NumberInput/styles.css.js +117 -0
- package/dist/components/Pagination/Pagination.d.ts +10 -0
- package/dist/components/Pagination/Pagination.js +47 -0
- package/dist/components/Pagination/index.d.ts +2 -0
- package/dist/components/Pagination/index.js +1 -0
- package/dist/components/Pagination/styles.css.d.ts +4 -0
- package/dist/components/Pagination/styles.css.js +44 -0
- package/dist/components/Popover/Popover.d.ts +18 -0
- package/dist/components/Popover/Popover.js +55 -0
- package/dist/components/Popover/index.d.ts +2 -0
- package/dist/components/Popover/index.js +1 -0
- package/dist/components/Popover/styles.css.d.ts +11 -0
- package/dist/components/Popover/styles.css.js +185 -0
- package/dist/components/Progress/Progress.d.ts +10 -0
- package/dist/components/Progress/Progress.js +9 -0
- package/dist/components/Progress/index.d.ts +1 -0
- package/dist/components/Progress/index.js +1 -0
- package/dist/components/Progress/styles.css.d.ts +4 -0
- package/dist/components/Progress/styles.css.js +71 -0
- package/dist/components/Radio/Radio.d.ts +16 -0
- package/dist/components/Radio/Radio.js +25 -0
- package/dist/components/Radio/index.d.ts +1 -0
- package/dist/components/Radio/index.js +1 -0
- package/dist/components/Radio/styles.css.d.ts +5 -0
- package/dist/components/Radio/styles.css.js +42 -0
- package/dist/components/ScrollArea/ScrollArea.d.ts +11 -0
- package/dist/components/ScrollArea/ScrollArea.js +12 -0
- package/dist/components/ScrollArea/index.d.ts +2 -0
- package/dist/components/ScrollArea/index.js +1 -0
- package/dist/components/ScrollArea/styles.css.d.ts +3 -0
- package/dist/components/ScrollArea/styles.css.js +25 -0
- package/dist/components/Select/Select.d.ts +13 -0
- package/dist/components/Select/Select.js +10 -0
- package/dist/components/Select/index.d.ts +1 -0
- package/dist/components/Select/index.js +1 -0
- package/dist/components/Select/styles.css.d.ts +4 -0
- package/dist/components/Select/styles.css.js +82 -0
- package/dist/components/Separator/Separator.d.ts +8 -0
- package/dist/components/Separator/Separator.js +8 -0
- package/dist/components/Separator/index.d.ts +2 -0
- package/dist/components/Separator/index.js +1 -0
- package/dist/components/Separator/styles.css.d.ts +4 -0
- package/dist/components/Separator/styles.css.js +28 -0
- package/dist/components/Skeleton/Skeleton.d.ts +14 -0
- package/dist/components/Skeleton/Skeleton.js +13 -0
- package/dist/components/Skeleton/index.d.ts +2 -0
- package/dist/components/Skeleton/index.js +1 -0
- package/dist/components/Skeleton/styles.css.d.ts +4 -0
- package/dist/components/Skeleton/styles.css.js +56 -0
- package/dist/components/Spinner/Spinner.d.ts +10 -0
- package/dist/components/Spinner/Spinner.js +8 -0
- package/dist/components/Spinner/index.d.ts +2 -0
- package/dist/components/Spinner/index.js +1 -0
- package/dist/components/Spinner/styles.css.d.ts +4 -0
- package/dist/components/Spinner/styles.css.js +55 -0
- package/dist/components/Stack/Stack.d.ts +16 -0
- package/dist/components/Stack/Stack.js +24 -0
- package/dist/components/Stack/index.d.ts +2 -0
- package/dist/components/Stack/index.js +1 -0
- package/dist/components/Stepper/Stepper.d.ts +18 -0
- package/dist/components/Stepper/Stepper.js +25 -0
- package/dist/components/Stepper/index.d.ts +2 -0
- package/dist/components/Stepper/index.js +1 -0
- package/dist/components/Stepper/styles.css.d.ts +14 -0
- package/dist/components/Stepper/styles.css.js +104 -0
- package/dist/components/Table/Table.d.ts +42 -0
- package/dist/components/Table/Table.js +39 -0
- package/dist/components/Table/index.d.ts +1 -0
- package/dist/components/Table/index.js +1 -0
- package/dist/components/Table/styles.css.d.ts +8 -0
- package/dist/components/Table/styles.css.js +49 -0
- package/dist/components/Tabs/Tabs.d.ts +29 -0
- package/dist/components/Tabs/Tabs.js +52 -0
- package/dist/components/Tabs/index.d.ts +1 -0
- package/dist/components/Tabs/index.js +1 -0
- package/dist/components/Tabs/styles.css.d.ts +6 -0
- package/dist/components/Tabs/styles.css.js +100 -0
- package/dist/components/Tag/Tag.d.ts +16 -0
- package/dist/components/Tag/Tag.js +18 -0
- package/dist/components/Tag/index.d.ts +1 -0
- package/dist/components/Tag/index.js +1 -0
- package/dist/components/Tag/styles.css.d.ts +3 -0
- package/dist/components/Tag/styles.css.js +93 -0
- package/dist/components/Text/Header.d.ts +8 -0
- package/dist/components/Text/Header.js +8 -0
- package/dist/components/Text/P.d.ts +7 -0
- package/dist/components/Text/P.js +8 -0
- package/dist/components/Text/index.d.ts +2 -0
- package/dist/components/Text/index.js +2 -0
- package/dist/components/Text/styles.css.d.ts +2 -0
- package/dist/components/Text/styles.css.js +13 -0
- package/dist/components/TextArea/TextArea.d.ts +7 -0
- package/dist/components/TextArea/TextArea.js +9 -0
- package/dist/components/TextArea/index.d.ts +2 -0
- package/dist/components/TextArea/index.js +1 -0
- package/dist/components/TextArea/styles.css.d.ts +2 -0
- package/dist/components/TextArea/styles.css.js +10 -0
- package/dist/components/Toast/Toast.d.ts +34 -0
- package/dist/components/Toast/Toast.js +177 -0
- package/dist/components/Toast/index.d.ts +1 -0
- package/dist/components/Toast/index.js +1 -0
- package/dist/components/Toast/styles.css.d.ts +21 -0
- package/dist/components/Toast/styles.css.js +192 -0
- package/dist/components/Toggle/Toggle.d.ts +10 -0
- package/dist/components/Toggle/Toggle.js +17 -0
- package/dist/components/Toggle/index.d.ts +2 -0
- package/dist/components/Toggle/index.js +1 -0
- package/dist/components/Toggle/styles.css.d.ts +12 -0
- package/dist/components/Toggle/styles.css.js +118 -0
- package/dist/components/Tooltip/Tooltip.d.ts +10 -0
- package/dist/components/Tooltip/Tooltip.js +16 -0
- package/dist/components/Tooltip/index.d.ts +2 -0
- package/dist/components/Tooltip/index.js +1 -0
- package/dist/components/Tooltip/styles.css.d.ts +8 -0
- package/dist/components/Tooltip/styles.css.js +86 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +8 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.js +9 -0
- package/dist/components/VisuallyHidden/index.d.ts +2 -0
- package/dist/components/VisuallyHidden/index.js +1 -0
- package/dist/components/VisuallyHidden/styles.css.d.ts +1 -0
- package/dist/components/VisuallyHidden/styles.css.js +12 -0
- package/dist/components/index.d.ts +68 -0
- package/dist/components/index.js +47 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/styles/layers.css.d.ts +3 -0
- package/dist/styles/layers.css.js +3 -0
- package/dist/styles/sprinkles.css.d.ts +241 -0
- package/dist/styles/sprinkles.css.js +165 -0
- package/dist/styles/theme.css.d.ts +38 -0
- package/dist/styles/theme.css.js +51 -0
- package/dist/styles/utils.d.ts +2 -0
- package/dist/styles/utils.js +7 -0
- package/package.json +9 -18
- package/dist/index.cjs +0 -4894
- package/dist/index.d.cts +0 -1111
- package/dist/index.d.mts +0 -1111
- package/dist/index.mjs +0 -4812
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type AccordionProps = {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
allowMultiple?: boolean;
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
7
|
+
type AccordionItemProps = {
|
|
8
|
+
value: string;
|
|
9
|
+
title: string;
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
className?: string;
|
|
12
|
+
};
|
|
13
|
+
declare const AccordionComponent: (({ children, allowMultiple, className, }: AccordionProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
14
|
+
Item: ({ value, title, children, className, }: AccordionItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
};
|
|
16
|
+
export default AccordionComponent;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { createContext, useContext, useState, useCallback } from 'react';
|
|
4
|
+
import { accordionItem, accordionHeader, accordionContent, accordionIcon, accordionIconExpanded, accordionGroup, } from './styles.css';
|
|
5
|
+
import Box from '../Box';
|
|
6
|
+
const AccordionContext = createContext({
|
|
7
|
+
allowMultiple: false,
|
|
8
|
+
expandedItems: new Set(),
|
|
9
|
+
toggleItem: () => { },
|
|
10
|
+
});
|
|
11
|
+
const Accordion = ({ children, allowMultiple = false, className, }) => {
|
|
12
|
+
const [expandedItems, setExpandedItems] = useState(new Set());
|
|
13
|
+
const toggleItem = (value) => {
|
|
14
|
+
setExpandedItems((prev) => {
|
|
15
|
+
const newSet = new Set(prev);
|
|
16
|
+
if (newSet.has(value)) {
|
|
17
|
+
newSet.delete(value);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
if (allowMultiple) {
|
|
21
|
+
newSet.add(value);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return new Set([value]);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return newSet;
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
return (_jsx(AccordionContext.Provider, { value: { allowMultiple, expandedItems, toggleItem }, children: _jsx(Box, { className: clsx(accordionGroup, className), width: "100%", children: children }) }));
|
|
31
|
+
};
|
|
32
|
+
const AccordionItem = ({ value, title, children, className, }) => {
|
|
33
|
+
const { expandedItems, toggleItem } = useContext(AccordionContext);
|
|
34
|
+
const isExpanded = expandedItems.has(value);
|
|
35
|
+
const toggleExpanded = useCallback(() => {
|
|
36
|
+
toggleItem(value);
|
|
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 })] }));
|
|
39
|
+
};
|
|
40
|
+
const AccordionComponent = Object.assign(Accordion, {
|
|
41
|
+
Item: AccordionItem,
|
|
42
|
+
});
|
|
43
|
+
export default AccordionComponent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Accordion } from './Accordion';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Accordion } from './Accordion';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const accordion: string;
|
|
2
|
+
export declare const accordionItem: string;
|
|
3
|
+
export declare const accordionHeader: string;
|
|
4
|
+
export declare const accordionContent: Record<"expanded" | "collapsed", string>;
|
|
5
|
+
export declare const accordionIcon: string;
|
|
6
|
+
export declare const accordionIconExpanded: string;
|
|
7
|
+
export declare const accordionGroup: string;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { style, styleVariants } from '@vanilla-extract/css';
|
|
2
|
+
import { vars } from '../../styles/theme.css';
|
|
3
|
+
import { styleWithLayer } from '../../styles/utils';
|
|
4
|
+
export const accordion = styleWithLayer({
|
|
5
|
+
width: '100%',
|
|
6
|
+
fontFamily: vars.fontFamily.body,
|
|
7
|
+
});
|
|
8
|
+
export const accordionItem = style({
|
|
9
|
+
width: '100%',
|
|
10
|
+
marginBottom: '4px',
|
|
11
|
+
border: `1px solid ${vars.colors.borderDefault}`,
|
|
12
|
+
borderRadius: '8px',
|
|
13
|
+
overflow: 'hidden',
|
|
14
|
+
});
|
|
15
|
+
export const accordionHeader = style({
|
|
16
|
+
width: '100%',
|
|
17
|
+
display: 'flex',
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
justifyContent: 'space-between',
|
|
20
|
+
padding: '12px 16px',
|
|
21
|
+
backgroundColor: vars.colors.backgroundMuted,
|
|
22
|
+
cursor: 'pointer',
|
|
23
|
+
userSelect: 'none',
|
|
24
|
+
fontSize: '14px',
|
|
25
|
+
fontWeight: '500',
|
|
26
|
+
color: vars.colors.textPrimary,
|
|
27
|
+
transition: 'background-color 0.2s ease',
|
|
28
|
+
':hover': {
|
|
29
|
+
backgroundColor: vars.colors.backgroundDefault,
|
|
30
|
+
},
|
|
31
|
+
':focus-visible': {
|
|
32
|
+
outline: `2px solid ${vars.colors.buttonBackgroundPrimary}`,
|
|
33
|
+
outlineOffset: '-2px',
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
export const accordionContent = styleVariants({
|
|
37
|
+
collapsed: {
|
|
38
|
+
display: 'none',
|
|
39
|
+
padding: '0 16px',
|
|
40
|
+
fontSize: '14px',
|
|
41
|
+
color: vars.colors.textPrimary,
|
|
42
|
+
backgroundColor: vars.colors.backgroundDefault,
|
|
43
|
+
},
|
|
44
|
+
expanded: {
|
|
45
|
+
display: 'block',
|
|
46
|
+
padding: '12px 16px',
|
|
47
|
+
fontSize: '14px',
|
|
48
|
+
color: vars.colors.textPrimary,
|
|
49
|
+
backgroundColor: vars.colors.backgroundDefault,
|
|
50
|
+
animation: 'slideDown 0.2s ease',
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
export const accordionIcon = style({
|
|
54
|
+
fontSize: '12px',
|
|
55
|
+
transition: 'transform 0.2s ease',
|
|
56
|
+
display: 'flex',
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
justifyContent: 'center',
|
|
59
|
+
});
|
|
60
|
+
export const accordionIconExpanded = style({
|
|
61
|
+
transform: 'rotate(180deg)',
|
|
62
|
+
});
|
|
63
|
+
export const accordionGroup = styleWithLayer({
|
|
64
|
+
width: '100%',
|
|
65
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type AlertProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
severity?: 'success' | 'warning' | 'error' | 'info';
|
|
4
|
+
dismissible?: boolean;
|
|
5
|
+
onDismiss?: () => void;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
};
|
|
8
|
+
declare const Alert: ({ severity, dismissible, onDismiss, children, ...props }: AlertProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default Alert;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { alert, alertVariants, alertContent, alertDismissButton, } from './styles.css';
|
|
4
|
+
import Box from '../Box';
|
|
5
|
+
const Alert = ({ severity = 'info', dismissible = false, onDismiss, children, ...props }) => {
|
|
6
|
+
return (_jsxs(Box, { as: "div", role: "alert", className: clsx(alert, alertVariants[severity], props.className), ...props, children: [_jsx(Box, { as: "div", className: alertContent, children: children }), dismissible && onDismiss && (_jsx(Box, { as: "button", className: alertDismissButton, onClick: onDismiss, "aria-label": "Dismiss alert", type: "button", children: "\u00D7" }))] }));
|
|
7
|
+
};
|
|
8
|
+
export default Alert;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Alert } from './Alert';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Alert } from './Alert';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { styleVariants } from '@vanilla-extract/css';
|
|
2
|
+
import { vars } from '../../styles/theme.css';
|
|
3
|
+
import { styleWithLayer } from '../../styles/utils';
|
|
4
|
+
export const alertVariants = styleVariants({
|
|
5
|
+
success: {
|
|
6
|
+
backgroundColor: vars.colors.alertSuccessBackground,
|
|
7
|
+
borderLeftColor: vars.colors.alertSuccessBorder,
|
|
8
|
+
color: vars.colors.alertSuccessText,
|
|
9
|
+
},
|
|
10
|
+
warning: {
|
|
11
|
+
backgroundColor: vars.colors.alertWarningBackground,
|
|
12
|
+
borderLeftColor: vars.colors.alertWarningBorder,
|
|
13
|
+
color: vars.colors.alertWarningText,
|
|
14
|
+
},
|
|
15
|
+
error: {
|
|
16
|
+
backgroundColor: vars.colors.alertErrorBackground,
|
|
17
|
+
borderLeftColor: vars.colors.alertErrorBorder,
|
|
18
|
+
color: vars.colors.alertErrorText,
|
|
19
|
+
},
|
|
20
|
+
info: {
|
|
21
|
+
backgroundColor: vars.colors.alertInfoBackground,
|
|
22
|
+
borderLeftColor: vars.colors.alertInfoBorder,
|
|
23
|
+
color: vars.colors.alertInfoText,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
export const alert = styleWithLayer({
|
|
27
|
+
padding: '1rem',
|
|
28
|
+
borderLeft: '4px solid',
|
|
29
|
+
borderRadius: '0.5rem',
|
|
30
|
+
display: 'flex',
|
|
31
|
+
alignItems: 'flex-start',
|
|
32
|
+
gap: '0.5rem',
|
|
33
|
+
fontFamily: vars.fontFamily.body,
|
|
34
|
+
fontSize: '0.875rem',
|
|
35
|
+
lineHeight: '1.5',
|
|
36
|
+
});
|
|
37
|
+
export const alertContent = styleWithLayer({
|
|
38
|
+
flex: 1,
|
|
39
|
+
});
|
|
40
|
+
export const alertDismissButton = styleWithLayer({
|
|
41
|
+
background: 'none',
|
|
42
|
+
border: 'none',
|
|
43
|
+
padding: '0.25rem',
|
|
44
|
+
cursor: 'pointer',
|
|
45
|
+
borderRadius: '0.25rem',
|
|
46
|
+
display: 'flex',
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
justifyContent: 'center',
|
|
49
|
+
opacity: 0.7,
|
|
50
|
+
transition: 'opacity 0.2s ease-in-out',
|
|
51
|
+
':hover': {
|
|
52
|
+
opacity: 1,
|
|
53
|
+
},
|
|
54
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type BoxProps } from '../Box';
|
|
3
|
+
export type AspectRatioValue = '1/1' | '4/3' | '16/9' | '21/9' | number;
|
|
4
|
+
export interface AspectRatioProps extends BoxProps {
|
|
5
|
+
ratio?: AspectRatioValue;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
declare const AspectRatio: React.ForwardRefExoticComponent<Omit<AspectRatioProps, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
9
|
+
export default AspectRatio;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import Box from '../Box';
|
|
4
|
+
const AspectRatio = forwardRef(({ ratio = '1/1', children, ...props }, ref) => {
|
|
5
|
+
const aspectRatio = typeof ratio === 'number' ? ratio : ratio;
|
|
6
|
+
return (_jsx(Box, { ref: ref, position: "relative", style: {
|
|
7
|
+
aspectRatio,
|
|
8
|
+
overflow: 'hidden',
|
|
9
|
+
}, ...props, children: _jsx(Box, { position: "absolute", width: "100%", height: "100%", display: "flex", alignItems: "center", justifyContent: "center", children: children }) }));
|
|
10
|
+
});
|
|
11
|
+
AspectRatio.displayName = 'AspectRatio';
|
|
12
|
+
export default AspectRatio;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as AspectRatio } from './AspectRatio';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type AvatarProps = {
|
|
3
|
+
alt?: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
src?: string;
|
|
6
|
+
size?: 'small' | 'medium' | 'large' | 'xlarge';
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
fallback?: string;
|
|
9
|
+
};
|
|
10
|
+
declare const Avatar: ({ alt, className, src, size, children, fallback, }: AvatarProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default Avatar;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { avatar, avatarImage, avatarWithImage, avatarWrapper } from './styles.css';
|
|
4
|
+
import Box from '../Box';
|
|
5
|
+
const Avatar = ({ alt, className, src, size = 'medium', children, fallback, }) => {
|
|
6
|
+
const sizeClass = avatar[size];
|
|
7
|
+
if (src) {
|
|
8
|
+
return (_jsx(Box, { className: clsx(avatarWrapper, className), display: "inline", children: _jsx(Box, { as: "img", src: src, alt: alt || 'Avatar', className: clsx(avatarWithImage[size], avatarImage) }) }));
|
|
9
|
+
}
|
|
10
|
+
const initials = children || fallback;
|
|
11
|
+
return (_jsx(Box, { className: clsx(sizeClass, className), role: "img", "aria-label": alt, children: initials }));
|
|
12
|
+
};
|
|
13
|
+
export default Avatar;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Avatar } from './Avatar';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Avatar } from './Avatar';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const avatar: Record<"medium" | "large" | "small" | "base" | "xlarge", string>;
|
|
2
|
+
export declare const avatarImage: string;
|
|
3
|
+
export declare const avatarWithImage: Record<"medium" | "large" | "small" | "xlarge", string>;
|
|
4
|
+
export declare const avatarWrapper: string;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { style, styleVariants } from '@vanilla-extract/css';
|
|
2
|
+
import { vars } from '../../styles/theme.css';
|
|
3
|
+
import { styleWithLayer } from '../../styles/utils';
|
|
4
|
+
export const avatar = styleVariants({
|
|
5
|
+
base: {
|
|
6
|
+
display: 'inline-flex',
|
|
7
|
+
alignItems: 'center',
|
|
8
|
+
justifyContent: 'center',
|
|
9
|
+
backgroundColor: vars.colors.backgroundMuted,
|
|
10
|
+
color: vars.colors.textPrimary,
|
|
11
|
+
fontFamily: vars.fontFamily.body,
|
|
12
|
+
fontWeight: '500',
|
|
13
|
+
overflow: 'hidden',
|
|
14
|
+
userSelect: 'none',
|
|
15
|
+
textDecoration: 'none',
|
|
16
|
+
':focus-visible': {
|
|
17
|
+
outline: `2px solid ${vars.colors.buttonBackgroundPrimary}`,
|
|
18
|
+
outlineOffset: '2px',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
small: {
|
|
22
|
+
display: 'inline-flex',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
justifyContent: 'center',
|
|
25
|
+
backgroundColor: vars.colors.backgroundMuted,
|
|
26
|
+
color: vars.colors.textPrimary,
|
|
27
|
+
fontFamily: vars.fontFamily.body,
|
|
28
|
+
fontWeight: '500',
|
|
29
|
+
overflow: 'hidden',
|
|
30
|
+
userSelect: 'none',
|
|
31
|
+
textDecoration: 'none',
|
|
32
|
+
width: '24px',
|
|
33
|
+
height: '24px',
|
|
34
|
+
fontSize: '12px',
|
|
35
|
+
borderRadius: '12px',
|
|
36
|
+
':focus-visible': {
|
|
37
|
+
outline: `2px solid ${vars.colors.buttonBackgroundPrimary}`,
|
|
38
|
+
outlineOffset: '2px',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
medium: {
|
|
42
|
+
display: 'inline-flex',
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
justifyContent: 'center',
|
|
45
|
+
backgroundColor: vars.colors.backgroundMuted,
|
|
46
|
+
color: vars.colors.textPrimary,
|
|
47
|
+
fontFamily: vars.fontFamily.body,
|
|
48
|
+
fontWeight: '500',
|
|
49
|
+
overflow: 'hidden',
|
|
50
|
+
userSelect: 'none',
|
|
51
|
+
textDecoration: 'none',
|
|
52
|
+
width: '32px',
|
|
53
|
+
height: '32px',
|
|
54
|
+
fontSize: '14px',
|
|
55
|
+
borderRadius: '16px',
|
|
56
|
+
':focus-visible': {
|
|
57
|
+
outline: `2px solid ${vars.colors.buttonBackgroundPrimary}`,
|
|
58
|
+
outlineOffset: '2px',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
large: {
|
|
62
|
+
display: 'inline-flex',
|
|
63
|
+
alignItems: 'center',
|
|
64
|
+
justifyContent: 'center',
|
|
65
|
+
backgroundColor: vars.colors.backgroundMuted,
|
|
66
|
+
color: vars.colors.textPrimary,
|
|
67
|
+
fontFamily: vars.fontFamily.body,
|
|
68
|
+
fontWeight: '500',
|
|
69
|
+
overflow: 'hidden',
|
|
70
|
+
userSelect: 'none',
|
|
71
|
+
textDecoration: 'none',
|
|
72
|
+
width: '40px',
|
|
73
|
+
height: '40px',
|
|
74
|
+
fontSize: '16px',
|
|
75
|
+
borderRadius: '20px',
|
|
76
|
+
':focus-visible': {
|
|
77
|
+
outline: `2px solid ${vars.colors.buttonBackgroundPrimary}`,
|
|
78
|
+
outlineOffset: '2px',
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
xlarge: {
|
|
82
|
+
display: 'inline-flex',
|
|
83
|
+
alignItems: 'center',
|
|
84
|
+
justifyContent: 'center',
|
|
85
|
+
backgroundColor: vars.colors.backgroundMuted,
|
|
86
|
+
color: vars.colors.textPrimary,
|
|
87
|
+
fontFamily: vars.fontFamily.body,
|
|
88
|
+
fontWeight: '500',
|
|
89
|
+
overflow: 'hidden',
|
|
90
|
+
userSelect: 'none',
|
|
91
|
+
textDecoration: 'none',
|
|
92
|
+
width: '64px',
|
|
93
|
+
height: '64px',
|
|
94
|
+
fontSize: '24px',
|
|
95
|
+
borderRadius: '32px',
|
|
96
|
+
':focus-visible': {
|
|
97
|
+
outline: `2px solid ${vars.colors.buttonBackgroundPrimary}`,
|
|
98
|
+
outlineOffset: '2px',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
export const avatarImage = style({
|
|
103
|
+
width: '100%',
|
|
104
|
+
height: '100%',
|
|
105
|
+
objectFit: 'cover',
|
|
106
|
+
});
|
|
107
|
+
export const avatarWithImage = styleVariants({
|
|
108
|
+
small: {
|
|
109
|
+
width: '24px',
|
|
110
|
+
height: '24px',
|
|
111
|
+
borderRadius: '12px',
|
|
112
|
+
overflow: 'hidden',
|
|
113
|
+
':focus-visible': {
|
|
114
|
+
outline: `2px solid ${vars.colors.buttonBackgroundPrimary}`,
|
|
115
|
+
outlineOffset: '2px',
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
medium: {
|
|
119
|
+
width: '32px',
|
|
120
|
+
height: '32px',
|
|
121
|
+
borderRadius: '16px',
|
|
122
|
+
overflow: 'hidden',
|
|
123
|
+
':focus-visible': {
|
|
124
|
+
outline: `2px solid ${vars.colors.buttonBackgroundPrimary}`,
|
|
125
|
+
outlineOffset: '2px',
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
large: {
|
|
129
|
+
width: '40px',
|
|
130
|
+
height: '40px',
|
|
131
|
+
borderRadius: '20px',
|
|
132
|
+
overflow: 'hidden',
|
|
133
|
+
':focus-visible': {
|
|
134
|
+
outline: `2px solid ${vars.colors.buttonBackgroundPrimary}`,
|
|
135
|
+
outlineOffset: '2px',
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
xlarge: {
|
|
139
|
+
width: '64px',
|
|
140
|
+
height: '64px',
|
|
141
|
+
borderRadius: '32px',
|
|
142
|
+
overflow: 'hidden',
|
|
143
|
+
':focus-visible': {
|
|
144
|
+
outline: `2px solid ${vars.colors.buttonBackgroundPrimary}`,
|
|
145
|
+
outlineOffset: '2px',
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
export const avatarWrapper = styleWithLayer({
|
|
150
|
+
display: 'inline-flex',
|
|
151
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type BadgeVariant = 'default' | 'success' | 'warning' | 'error' | 'info';
|
|
3
|
+
export type BadgeSize = 'small' | 'medium' | 'large';
|
|
4
|
+
export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
5
|
+
variant?: BadgeVariant;
|
|
6
|
+
size?: BadgeSize;
|
|
7
|
+
dot?: boolean;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
declare const Badge: ({ variant, size, dot, children, ...props }: BadgeProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default Badge;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { badge, badgeVariants, badgeSizes, badgeDot, badgeDotSizes, } from './styles.css';
|
|
4
|
+
import Box from '../Box';
|
|
5
|
+
const Badge = ({ variant = 'default', size = 'medium', dot = false, children, ...props }) => {
|
|
6
|
+
return (_jsx(Box, { as: "span", className: clsx(badge, badgeVariants[variant], dot ? badgeDot : badgeSizes[size], dot && badgeDotSizes[size], props.className), ...props, children: dot ? null : children }));
|
|
7
|
+
};
|
|
8
|
+
export default Badge;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Badge } from './Badge';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const badgeVariants: Record<"default" | "success" | "warning" | "error" | "info", string>;
|
|
2
|
+
export declare const badgeSizes: Record<"medium" | "large" | "small", string>;
|
|
3
|
+
export declare const badge: string;
|
|
4
|
+
export declare const badgeDot: string;
|
|
5
|
+
export declare const badgeDotSizes: Record<"medium" | "large" | "small", string>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { styleVariants } from '@vanilla-extract/css';
|
|
2
|
+
import { vars } from '../../styles/theme.css';
|
|
3
|
+
import { styleWithLayer } from '../../styles/utils';
|
|
4
|
+
export const badgeVariants = styleVariants({
|
|
5
|
+
default: {
|
|
6
|
+
backgroundColor: vars.colors.borderDefault,
|
|
7
|
+
color: vars.colors.textPrimary,
|
|
8
|
+
},
|
|
9
|
+
success: {
|
|
10
|
+
backgroundColor: vars.colors.alertSuccessBackground,
|
|
11
|
+
color: vars.colors.alertSuccessText,
|
|
12
|
+
border: `1px solid ${vars.colors.alertSuccessBorder}`,
|
|
13
|
+
},
|
|
14
|
+
warning: {
|
|
15
|
+
backgroundColor: vars.colors.alertWarningBackground,
|
|
16
|
+
color: vars.colors.alertWarningText,
|
|
17
|
+
border: `1px solid ${vars.colors.alertWarningBorder}`,
|
|
18
|
+
},
|
|
19
|
+
error: {
|
|
20
|
+
backgroundColor: vars.colors.alertErrorBackground,
|
|
21
|
+
color: vars.colors.alertErrorText,
|
|
22
|
+
border: `1px solid ${vars.colors.alertErrorBorder}`,
|
|
23
|
+
},
|
|
24
|
+
info: {
|
|
25
|
+
backgroundColor: vars.colors.alertInfoBackground,
|
|
26
|
+
color: vars.colors.alertInfoText,
|
|
27
|
+
border: `1px solid ${vars.colors.alertInfoBorder}`,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
export const badgeSizes = styleVariants({
|
|
31
|
+
small: {
|
|
32
|
+
fontSize: '0.7rem',
|
|
33
|
+
padding: '0.125rem 0.375rem',
|
|
34
|
+
borderRadius: '0.25rem',
|
|
35
|
+
},
|
|
36
|
+
medium: {
|
|
37
|
+
fontSize: '0.75rem',
|
|
38
|
+
padding: '0.25rem 0.5rem',
|
|
39
|
+
borderRadius: '0.375rem',
|
|
40
|
+
},
|
|
41
|
+
large: {
|
|
42
|
+
fontSize: '0.875rem',
|
|
43
|
+
padding: '0.375rem 0.625rem',
|
|
44
|
+
borderRadius: '0.5rem',
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
export const badge = styleWithLayer({
|
|
48
|
+
display: 'inline-flex',
|
|
49
|
+
alignItems: 'center',
|
|
50
|
+
justifyContent: 'center',
|
|
51
|
+
fontWeight: '500',
|
|
52
|
+
whiteSpace: 'nowrap',
|
|
53
|
+
fontFamily: vars.fontFamily.body,
|
|
54
|
+
transition: 'background-color 0.2s ease-in-out, color 0.2s ease-in-out, border-color 0.2s ease-in-out',
|
|
55
|
+
});
|
|
56
|
+
export const badgeDot = styleWithLayer({
|
|
57
|
+
width: '0.5rem',
|
|
58
|
+
height: '0.5rem',
|
|
59
|
+
borderRadius: '50%',
|
|
60
|
+
display: 'inline-block',
|
|
61
|
+
padding: 0,
|
|
62
|
+
minWidth: 'auto',
|
|
63
|
+
});
|
|
64
|
+
export const badgeDotSizes = styleVariants({
|
|
65
|
+
small: {
|
|
66
|
+
width: '0.375rem',
|
|
67
|
+
height: '0.375rem',
|
|
68
|
+
},
|
|
69
|
+
medium: {
|
|
70
|
+
width: '0.5rem',
|
|
71
|
+
height: '0.5rem',
|
|
72
|
+
},
|
|
73
|
+
large: {
|
|
74
|
+
width: '0.625rem',
|
|
75
|
+
height: '0.625rem',
|
|
76
|
+
},
|
|
77
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Sprinkles } from '../../styles/sprinkles.css';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
type BoxProps = Sprinkles & {
|
|
4
|
+
as?: React.ElementType;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
};
|
|
9
|
+
declare const Box: React.ForwardRefExoticComponent<Omit<BoxProps, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
10
|
+
export default Box;
|
|
11
|
+
export type { BoxProps };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import { sprinkles } from '../../styles/sprinkles.css';
|
|
3
|
+
import { reset } from './reset.css';
|
|
4
|
+
import React, { forwardRef } from 'react';
|
|
5
|
+
const Box = forwardRef((props, ref) => {
|
|
6
|
+
const { as: Component = 'div', className, children, ...rest } = props;
|
|
7
|
+
const sprinkleProps = {};
|
|
8
|
+
const otherProps = { ref };
|
|
9
|
+
const sprinkleKeys = new Set([
|
|
10
|
+
'display',
|
|
11
|
+
'width',
|
|
12
|
+
'height',
|
|
13
|
+
'flexDirection',
|
|
14
|
+
'justifyContent',
|
|
15
|
+
'alignItems',
|
|
16
|
+
'paddingTop',
|
|
17
|
+
'paddingBottom',
|
|
18
|
+
'paddingLeft',
|
|
19
|
+
'paddingRight',
|
|
20
|
+
'marginLeft',
|
|
21
|
+
'marginRight',
|
|
22
|
+
'marginTop',
|
|
23
|
+
'marginBottom',
|
|
24
|
+
'borderLeft',
|
|
25
|
+
'borderRight',
|
|
26
|
+
'borderTop',
|
|
27
|
+
'borderBottom',
|
|
28
|
+
'borderRadius',
|
|
29
|
+
'gap',
|
|
30
|
+
'padding',
|
|
31
|
+
'border',
|
|
32
|
+
'paddingX',
|
|
33
|
+
'paddingY',
|
|
34
|
+
'marginX',
|
|
35
|
+
'marginY',
|
|
36
|
+
'placeItems',
|
|
37
|
+
'color',
|
|
38
|
+
'background',
|
|
39
|
+
]);
|
|
40
|
+
Object.entries(rest).forEach(([key, value]) => {
|
|
41
|
+
if (sprinkleKeys.has(key)) {
|
|
42
|
+
sprinkleProps[key] = value;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
otherProps[key] = value;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return React.createElement(Component, {
|
|
49
|
+
className: clsx(reset, sprinkles(sprinkleProps), className),
|
|
50
|
+
...otherProps,
|
|
51
|
+
}, children);
|
|
52
|
+
});
|
|
53
|
+
Box.displayName = 'Box';
|
|
54
|
+
export default Box;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Box';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const reset: string;
|