@studiocubics/components 0.0.2 → 0.0.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/README.md +2 -0
- package/dist/Cards/Card/Card.js +1 -44
- package/dist/Cards/Card/Card.js.map +1 -1
- package/dist/Cards/Card/Card.module.css.js +1 -3
- package/dist/Cards/Card/Card.module.css.js.map +1 -1
- package/dist/Cards/CollectionItemCard/CollectionItemCard.js +1 -47
- package/dist/Cards/CollectionItemCard/CollectionItemCard.js.map +1 -1
- package/dist/Cards/CollectionItemCard/CollectionItemCard.module.css.js +1 -3
- package/dist/Cards/CollectionItemCard/CollectionItemCard.module.css.js.map +1 -1
- package/dist/Cards/CollectionItemCard/CollectionItemCardActions.js +1 -33
- package/dist/Cards/CollectionItemCard/CollectionItemCardActions.js.map +1 -1
- package/dist/Cards/GlassCard/GlassCard.js +1 -51
- package/dist/Cards/GlassCard/GlassCard.js.map +1 -1
- package/dist/Cards/GlassCard/GlassCard.module.css.js +1 -3
- package/dist/Cards/GlassCard/GlassCard.module.css.js.map +1 -1
- package/dist/Display/Accordion/Accordion.js +1 -27
- package/dist/Display/Accordion/Accordion.js.map +1 -1
- package/dist/Display/Accordion/Accordion.module.css.js +1 -3
- package/dist/Display/Accordion/Accordion.module.css.js.map +1 -1
- package/dist/Display/Accordion/AccordionItem.js +1 -55
- package/dist/Display/Accordion/AccordionItem.js.map +1 -1
- package/dist/Display/Chip/Chip.js +1 -42
- package/dist/Display/Chip/Chip.js.map +1 -1
- package/dist/Display/Chip/Chip.module.css.js +1 -3
- package/dist/Display/Chip/Chip.module.css.js.map +1 -1
- package/dist/Display/IdentityDisplay/IdentityDisplay.js +1 -35
- package/dist/Display/IdentityDisplay/IdentityDisplay.js.map +1 -1
- package/dist/Display/IdentityDisplay/IdentityDisplay.module.css.js +1 -3
- package/dist/Display/IdentityDisplay/IdentityDisplay.module.css.js.map +1 -1
- package/dist/Display/InputErrors/InputErrors.js +1 -24
- package/dist/Display/InputErrors/InputErrors.js.map +1 -1
- package/dist/Display/InputErrors/InputErrors.module.css.js +1 -3
- package/dist/Display/InputErrors/InputErrors.module.css.js.map +1 -1
- package/dist/Display/Kbd/Kbd.js +1 -18
- package/dist/Display/Kbd/Kbd.js.map +1 -1
- package/dist/Display/Kbd/Kbd.module.css.js +1 -3
- package/dist/Display/Kbd/Kbd.module.css.js.map +1 -1
- package/dist/Display/Kbd/buttonList.js +1 -197
- package/dist/Display/Kbd/buttonList.js.map +1 -1
- package/dist/Display/LabeledValue/LabeledValue.js +1 -10
- package/dist/Display/LabeledValue/LabeledValue.js.map +1 -1
- package/dist/Display/LabeledValue/LabeledValue.module.css.js +1 -3
- package/dist/Display/LabeledValue/LabeledValue.module.css.js.map +1 -1
- package/dist/Display/List/List.js +1 -95
- package/dist/Display/List/List.js.map +1 -1
- package/dist/Display/List/List.module.css.js +1 -3
- package/dist/Display/List/List.module.css.js.map +1 -1
- package/dist/Display/PasswordStrength/PasswordStrength.js +1 -16
- package/dist/Display/PasswordStrength/PasswordStrength.js.map +1 -1
- package/dist/Display/PasswordStrength/PasswordStrength.module.css.js +1 -3
- package/dist/Display/PasswordStrength/PasswordStrength.module.css.js.map +1 -1
- package/dist/Display/PasswordStrength/usePasswordStrength.js +1 -48
- package/dist/Display/PasswordStrength/usePasswordStrength.js.map +1 -1
- package/dist/Display/Skeleton/Skeleton.d.ts +1 -1
- package/dist/Display/Skeleton/Skeleton.js +1 -10
- package/dist/Display/Skeleton/Skeleton.js.map +1 -1
- package/dist/Display/Skeleton/Skeleton.module.css.js +1 -3
- package/dist/Display/Skeleton/Skeleton.module.css.js.map +1 -1
- package/dist/Display/Toast/Toaster.js +1 -44
- package/dist/Display/Toast/Toaster.js.map +1 -1
- package/dist/Display/Toast/toast.js +1 -31
- package/dist/Display/Toast/toast.js.map +1 -1
- package/dist/Display/Tooltip/Tooltip.js +1 -44
- package/dist/Display/Tooltip/Tooltip.js.map +1 -1
- package/dist/Display/Tooltip/Tooltip.module.css.js +1 -3
- package/dist/Display/Tooltip/Tooltip.module.css.js.map +1 -1
- package/dist/Display/Tooltip/getArrowDirection.js +1 -47
- package/dist/Display/Tooltip/getArrowDirection.js.map +1 -1
- package/dist/Display/Tooltip/useTooltip.js +1 -47
- package/dist/Display/Tooltip/useTooltip.js.map +1 -1
- package/dist/Display/WIP/WIP.d.ts +5 -0
- package/dist/Forms/ConfirmationForm/ConfirmationForm.js +1 -11
- package/dist/Forms/ConfirmationForm/ConfirmationForm.js.map +1 -1
- package/dist/Forms/ConfirmationForm/ConfirmationForm.module.css.js +1 -3
- package/dist/Forms/ConfirmationForm/ConfirmationForm.module.css.js.map +1 -1
- package/dist/Inputs/Button/Button.js +1 -55
- package/dist/Inputs/Button/Button.js.map +1 -1
- package/dist/Inputs/Button/Button.module.css.js +1 -3
- package/dist/Inputs/Button/Button.module.css.js.map +1 -1
- package/dist/Inputs/Checkbox/Checkbox.js +1 -54
- package/dist/Inputs/Checkbox/Checkbox.js.map +1 -1
- package/dist/Inputs/Checkbox/Checkbox.module.css.js +1 -3
- package/dist/Inputs/Checkbox/Checkbox.module.css.js.map +1 -1
- package/dist/Inputs/Checkbox/CheckboxGroup/CheckboxGroup.js +1 -34
- package/dist/Inputs/Checkbox/CheckboxGroup/CheckboxGroup.js.map +1 -1
- package/dist/Inputs/Checkbox/CheckboxGroup/CheckboxGroup.module.css.js +1 -3
- package/dist/Inputs/Checkbox/CheckboxGroup/CheckboxGroup.module.css.js.map +1 -1
- package/dist/Inputs/Checkbox/CheckboxSelectAll.js +1 -18
- package/dist/Inputs/Checkbox/CheckboxSelectAll.js.map +1 -1
- package/dist/Inputs/PasswordInput/PasswordInput.js +1 -44
- package/dist/Inputs/PasswordInput/PasswordInput.js.map +1 -1
- package/dist/Inputs/PasswordInput/PasswordInput.module.css.js +1 -3
- package/dist/Inputs/PasswordInput/PasswordInput.module.css.js.map +1 -1
- package/dist/Inputs/Select/Select.js +1 -25
- package/dist/Inputs/Select/Select.js.map +1 -1
- package/dist/Inputs/Select/Select.module.css.js +1 -3
- package/dist/Inputs/Select/Select.module.css.js.map +1 -1
- package/dist/Inputs/Switch/Switch.js +1 -80
- package/dist/Inputs/Switch/Switch.js.map +1 -1
- package/dist/Inputs/Switch/Switch.module.css.js +1 -3
- package/dist/Inputs/Switch/Switch.module.css.js.map +1 -1
- package/dist/Inputs/TextAreaInput/TextAreaInput.js +1 -29
- package/dist/Inputs/TextAreaInput/TextAreaInput.js.map +1 -1
- package/dist/Inputs/TextAreaInput/TextAreaInput.module.css.js +1 -3
- package/dist/Inputs/TextAreaInput/TextAreaInput.module.css.js.map +1 -1
- package/dist/Inputs/TextInput/TextInput.js +1 -22
- package/dist/Inputs/TextInput/TextInput.js.map +1 -1
- package/dist/Inputs/TextInput/TextInput.module.css.js +1 -3
- package/dist/Inputs/TextInput/TextInput.module.css.js.map +1 -1
- package/dist/Inputs/ThemeToggle/ThemeToggleListItem.js +1 -30
- package/dist/Inputs/ThemeToggle/ThemeToggleListItem.js.map +1 -1
- package/dist/Layout/Dialog/Dialog.d.ts +1 -1
- package/dist/Layout/Dialog/Dialog.js +1 -73
- package/dist/Layout/Dialog/Dialog.js.map +1 -1
- package/dist/Layout/Dialog/Dialog.module.css.js +1 -3
- package/dist/Layout/Dialog/Dialog.module.css.js.map +1 -1
- package/dist/Layout/Drawer/Drawer.d.ts +15 -0
- package/dist/Layout/Drawer/Drawer.js +2 -0
- package/dist/Layout/Drawer/Drawer.js.map +1 -0
- package/dist/Layout/Drawer/Drawer.module.css.js +2 -0
- package/dist/Layout/Drawer/Drawer.module.css.js.map +1 -0
- package/dist/Layout/PageLayout/PageLayout.js +1 -24
- package/dist/Layout/PageLayout/PageLayout.js.map +1 -1
- package/dist/Layout/PageLayout/PageLayout.module.css.js +1 -3
- package/dist/Layout/PageLayout/PageLayout.module.css.js.map +1 -1
- package/dist/Layout/PageLayoutPagination/PageLayoutPagination.js +1 -12
- package/dist/Layout/PageLayoutPagination/PageLayoutPagination.js.map +1 -1
- package/dist/Layout/PageLayoutPagination/PageLayoutPagination.module.css.js +1 -3
- package/dist/Layout/PageLayoutPagination/PageLayoutPagination.module.css.js.map +1 -1
- package/dist/Layout/PageLayoutTabs/PageLayoutTabs.js +1 -21
- package/dist/Layout/PageLayoutTabs/PageLayoutTabs.js.map +1 -1
- package/dist/Layout/PageLayoutTabs/PageLayoutTabs.module.css.js +1 -3
- package/dist/Layout/PageLayoutTabs/PageLayoutTabs.module.css.js.map +1 -1
- package/dist/Layout/Popover/Popover.js +1 -102
- package/dist/Layout/Popover/Popover.js.map +1 -1
- package/dist/Layout/Popover/Popover.module.css.js +1 -3
- package/dist/Layout/Popover/Popover.module.css.js.map +1 -1
- package/dist/Layout/SectionWrapper/SectionWrapper.js +1 -10
- package/dist/Layout/SectionWrapper/SectionWrapper.js.map +1 -1
- package/dist/Layout/SectionWrapper/SectionWrapper.module.css.js +1 -3
- package/dist/Layout/SectionWrapper/SectionWrapper.module.css.js.map +1 -1
- package/dist/Layout/Sidebar/Sidebar.js +1 -24
- package/dist/Layout/Sidebar/Sidebar.js.map +1 -1
- package/dist/Layout/Sidebar/Sidebar.module.css.js +1 -3
- package/dist/Layout/Sidebar/Sidebar.module.css.js.map +1 -1
- package/dist/Layout/Sidebar/SidebarBody/SidebarBody.js +1 -13
- package/dist/Layout/Sidebar/SidebarBody/SidebarBody.js.map +1 -1
- package/dist/Layout/Sidebar/SidebarBody/SidebarBody.module.css.js +1 -3
- package/dist/Layout/Sidebar/SidebarBody/SidebarBody.module.css.js.map +1 -1
- package/dist/Layout/Sidebar/SidebarDrawer/SidebarDrawer.js +1 -13
- package/dist/Layout/Sidebar/SidebarDrawer/SidebarDrawer.js.map +1 -1
- package/dist/Layout/Sidebar/SidebarDrawer/SidebarDrawer.module.css.js +1 -3
- package/dist/Layout/Sidebar/SidebarDrawer/SidebarDrawer.module.css.js.map +1 -1
- package/dist/Layout/Sidebar/SidebarFooter/SidebarFooter.js +1 -13
- package/dist/Layout/Sidebar/SidebarFooter/SidebarFooter.js.map +1 -1
- package/dist/Layout/Sidebar/SidebarFooter/SidebarFooter.module.css.js +1 -3
- package/dist/Layout/Sidebar/SidebarFooter/SidebarFooter.module.css.js.map +1 -1
- package/dist/Layout/Sidebar/SidebarHeader/SidebarHeader.js +1 -11
- package/dist/Layout/Sidebar/SidebarHeader/SidebarHeader.js.map +1 -1
- package/dist/Layout/Sidebar/SidebarViewport/SidebarViewport.js +1 -10
- package/dist/Layout/Sidebar/SidebarViewport/SidebarViewport.js.map +1 -1
- package/dist/Layout/Sidebar/SidebarViewport/SidebarViewport.module.css.js +1 -3
- package/dist/Layout/Sidebar/SidebarViewport/SidebarViewport.module.css.js.map +1 -1
- package/dist/Layout/Table/Table.js +1 -130
- package/dist/Layout/Table/Table.js.map +1 -1
- package/dist/Layout/Table/Table.module.css.js +1 -3
- package/dist/Layout/Table/Table.module.css.js.map +1 -1
- package/dist/Layout/Table/TableFooter.js +1 -8
- package/dist/Layout/Table/TableFooter.js.map +1 -1
- package/dist/Layout/Table/TableHeader.js +1 -8
- package/dist/Layout/Table/TableHeader.js.map +1 -1
- package/dist/Layout/Table/tableUtils.js +1 -123
- package/dist/Layout/Table/tableUtils.js.map +1 -1
- package/dist/Layout/_index.d.ts +1 -0
- package/dist/Misc/Cursor/Cursor.js +1 -58
- package/dist/Misc/Cursor/Cursor.js.map +1 -1
- package/dist/Misc/Cursor/Cursor.module.css.js +1 -3
- package/dist/Misc/Cursor/Cursor.module.css.js.map +1 -1
- package/dist/Misc/Logos.js +1 -28
- package/dist/Misc/Logos.js.map +1 -1
- package/dist/Misc/PoweredByBanner/PoweredByBanner.d.ts +5 -2
- package/dist/Misc/PoweredByBanner/PoweredByBanner.js +1 -10
- package/dist/Misc/PoweredByBanner/PoweredByBanner.js.map +1 -1
- package/dist/Misc/PoweredByBanner/PoweredByBanner.module.css.js +1 -3
- package/dist/Misc/PoweredByBanner/PoweredByBanner.module.css.js.map +1 -1
- package/dist/Misc/Ripple/Ripple.js +1 -61
- package/dist/Misc/Ripple/Ripple.js.map +1 -1
- package/dist/Misc/Ripple/Ripple.module.css.js +1 -3
- package/dist/Misc/Ripple/Ripple.module.css.js.map +1 -1
- package/dist/Misc/Spinner/Spinner.js +1 -11
- package/dist/Misc/Spinner/Spinner.js.map +1 -1
- package/dist/Misc/Spinner/Spinner.module.css.js +1 -3
- package/dist/Misc/Spinner/Spinner.module.css.js.map +1 -1
- package/dist/Misc/TransitionAnimation/TransitionAnimation.js +1 -86
- package/dist/Misc/TransitionAnimation/TransitionAnimation.js.map +1 -1
- package/dist/Misc/TransitionAnimation/TransitionAnimation.module.css.js +1 -3
- package/dist/Misc/TransitionAnimation/TransitionAnimation.module.css.js.map +1 -1
- package/dist/Navigation/Breadcrumbs/Breadcrumbs.js +1 -35
- package/dist/Navigation/Breadcrumbs/Breadcrumbs.js.map +1 -1
- package/dist/Navigation/Breadcrumbs/Breadcrumbs.module.css.js +1 -3
- package/dist/Navigation/Breadcrumbs/Breadcrumbs.module.css.js.map +1 -1
- package/dist/Navigation/Breadcrumbs/BreadcrumbsItem.js +1 -14
- package/dist/Navigation/Breadcrumbs/BreadcrumbsItem.js.map +1 -1
- package/dist/Navigation/Breadcrumbs/useBreadcrumbs.js +1 -43
- package/dist/Navigation/Breadcrumbs/useBreadcrumbs.js.map +1 -1
- package/dist/Navigation/Pagination/Pagination.js +1 -60
- package/dist/Navigation/Pagination/Pagination.js.map +1 -1
- package/dist/Navigation/Pagination/Pagination.module.css.js +1 -3
- package/dist/Navigation/Pagination/Pagination.module.css.js.map +1 -1
- package/dist/Navigation/Pagination/PaginationItem.js +1 -13
- package/dist/Navigation/Pagination/PaginationItem.js.map +1 -1
- package/dist/Navigation/Pagination/usePagination.js +1 -37
- package/dist/Navigation/Pagination/usePagination.js.map +1 -1
- package/dist/Navigation/Tabs/Tab/Tab.js +1 -69
- package/dist/Navigation/Tabs/Tab/Tab.js.map +1 -1
- package/dist/Navigation/Tabs/Tab/Tab.module.css.js +1 -3
- package/dist/Navigation/Tabs/Tab/Tab.module.css.js.map +1 -1
- package/dist/Navigation/Tabs/Tabs.js +1 -21
- package/dist/Navigation/Tabs/Tabs.js.map +1 -1
- package/dist/Navigation/Tabs/TabsBar/TabsBar.d.ts +10 -7
- package/dist/Navigation/Tabs/TabsBar/TabsBar.js +1 -43
- package/dist/Navigation/Tabs/TabsBar/TabsBar.js.map +1 -1
- package/dist/Navigation/Tabs/TabsBar/TabsBar.module.css.js +1 -3
- package/dist/Navigation/Tabs/TabsBar/TabsBar.module.css.js.map +1 -1
- package/dist/Typography/ClampedText/ClampedText.js +1 -43
- package/dist/Typography/ClampedText/ClampedText.js.map +1 -1
- package/dist/Typography/ClampedText/ClampedText.module.css.js +1 -3
- package/dist/Typography/ClampedText/ClampedText.module.css.js.map +1 -1
- package/dist/Typography/CopyableText/CopyableText.js +1 -38
- package/dist/Typography/CopyableText/CopyableText.js.map +1 -1
- package/dist/Typography/CopyableText/CopyableText.module.css.js +1 -3
- package/dist/Typography/CopyableText/CopyableText.module.css.js.map +1 -1
- package/dist/Typography/PageTitle/PageTitle.js +1 -9
- package/dist/Typography/PageTitle/PageTitle.js.map +1 -1
- package/dist/Typography/PageTitle/PageTitle.module.css.js +1 -3
- package/dist/Typography/PageTitle/PageTitle.module.css.js.map +1 -1
- package/dist/index.css +1 -2392
- package/dist/index.js +1 -63
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/rollup.config.js +0 -34
|
@@ -1,96 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import { createContext, useContext, useState, useRef, useEffect } from 'react';
|
|
4
|
-
import styles from './List.module.css.js';
|
|
5
|
-
import { cn, mergeRefs } from '@studiocubics/utils';
|
|
6
|
-
import { useRipple, eventWithRipple } from '../../Misc/Ripple/Ripple.js';
|
|
7
|
-
import { useDisclosure } from '@studiocubics/hooks';
|
|
8
|
-
import '../../Cards/Card/Card.js';
|
|
9
|
-
import '../../Cards/CollectionItemCard/CollectionItemCard.js';
|
|
10
|
-
import '../../Inputs/Button/Button.js';
|
|
11
|
-
import 'react-dom';
|
|
12
|
-
import { GlassCard } from '../../Cards/GlassCard/GlassCard.js';
|
|
13
|
-
|
|
14
|
-
const ListContext = createContext(null);
|
|
15
|
-
function useList() {
|
|
16
|
-
const c = useContext(ListContext);
|
|
17
|
-
if (!c)
|
|
18
|
-
throw new Error("Components must be wrapped in <List/>");
|
|
19
|
-
return c;
|
|
20
|
-
}
|
|
21
|
-
function List(props) {
|
|
22
|
-
const { children, ordered = false, secondary = false, listData = [], slotProps = {}, className, renderMarker = true, listItemProps = {}, } = props;
|
|
23
|
-
const [activeListItem, setActiveListItem] = useState(null);
|
|
24
|
-
const markerRef = useRef(null);
|
|
25
|
-
const rootRef = useRef(null);
|
|
26
|
-
const rootClass = cn(styles.root, className, secondary ? styles.secondary : "");
|
|
27
|
-
const body = listData.length
|
|
28
|
-
? listData.map((ld, i) => jsx(ListItem, { ...listItemProps, ...ld }, i))
|
|
29
|
-
: children;
|
|
30
|
-
const marker = renderMarker ? (jsx(GlassCard, { ...slotProps.marker, ref: markerRef, className: cn(styles.marker, slotProps.marker?.className) })) : null;
|
|
31
|
-
const Component = ordered ? "ol" : "ul";
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
if (!rootRef.current || !markerRef.current || !activeListItem)
|
|
34
|
-
return;
|
|
35
|
-
const updateMarkerPosition = () => {
|
|
36
|
-
if (!rootRef.current || !markerRef.current || !activeListItem)
|
|
37
|
-
return;
|
|
38
|
-
const marker = markerRef.current;
|
|
39
|
-
const tabRect = activeListItem.getBoundingClientRect();
|
|
40
|
-
const rootRect = rootRef.current.getBoundingClientRect();
|
|
41
|
-
// Account for scroll offset
|
|
42
|
-
const scrollLeft = rootRef.current.scrollLeft;
|
|
43
|
-
const scrollTop = rootRef.current.scrollTop;
|
|
44
|
-
marker.style.display = "block";
|
|
45
|
-
marker.style.width = `${tabRect.width}px`;
|
|
46
|
-
marker.style.height = `${tabRect.height}px`;
|
|
47
|
-
marker.style.left = `${tabRect.left - rootRect.left + scrollLeft}px`;
|
|
48
|
-
marker.style.top = `${tabRect.top - rootRect.top + scrollTop}px`;
|
|
49
|
-
};
|
|
50
|
-
updateMarkerPosition();
|
|
51
|
-
const container = rootRef.current;
|
|
52
|
-
// Update marker position when container resizes
|
|
53
|
-
const resizeObserver = new ResizeObserver(updateMarkerPosition);
|
|
54
|
-
resizeObserver.observe(container);
|
|
55
|
-
return () => {
|
|
56
|
-
resizeObserver.disconnect();
|
|
57
|
-
};
|
|
58
|
-
}, [activeListItem]);
|
|
59
|
-
return (jsx(ListContext.Provider, { value: { activeListItem, setActiveListItem }, children: jsxs(Component, { ref: rootRef, className: rootClass, children: [body, marker] }) }));
|
|
60
|
-
}
|
|
61
|
-
function ChevronDown() {
|
|
62
|
-
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "lucide lucide-chevron-down-icon lucide-chevron-down", children: jsx("path", { d: "m6 9 6 6 6-6" }) }));
|
|
63
|
-
}
|
|
64
|
-
// Create the base component with forwardRef
|
|
65
|
-
function ListItem(props) {
|
|
66
|
-
const { className, children, onTouchStart, onClick, shortened = false, shortenedIcon = "start", selected = false, dropDownIcon = jsx(ChevronDown, {}), color, startIcon, endIcon, disabled, childNodes = [], href, LinkComponent = "a", slotProps: _slotProps, ref, ...restProps } = props;
|
|
67
|
-
const slotProps = _slotProps ?? {};
|
|
68
|
-
const { setActiveListItem } = useList();
|
|
69
|
-
const listItemRef = useRef(null);
|
|
70
|
-
const { rippleElements, createRipple } = useRipple(slotProps.ripple);
|
|
71
|
-
const { open, handleToggle } = useDisclosure();
|
|
72
|
-
const clickable = !disabled && (!!href || !!onClick || (!shortened && !!childNodes.length));
|
|
73
|
-
const componentProps = {
|
|
74
|
-
className: cn(className, styles.listItem, shortened ? styles.shortened : "", selected ? styles.selected : "", clickable ? styles.clickable : "", disabled ? styles.disabled : ""),
|
|
75
|
-
onTouchStart: disabled
|
|
76
|
-
? undefined
|
|
77
|
-
: eventWithRipple(createRipple, onTouchStart, handleToggle),
|
|
78
|
-
onClick: disabled
|
|
79
|
-
? undefined
|
|
80
|
-
: eventWithRipple(createRipple, onClick, handleToggle),
|
|
81
|
-
"data-color": color,
|
|
82
|
-
ref: mergeRefs(ref, listItemRef),
|
|
83
|
-
...restProps,
|
|
84
|
-
};
|
|
85
|
-
const body = (jsxs(Fragment, { children: [clickable && rippleElements, startIcon && (jsx("span", { ...slotProps.startIcon, className: cn(styles.iconContainer, shortenedIcon == "start" ? styles.primaryIcon : "", slotProps.startIcon?.className), children: startIcon })), jsx("span", { ...slotProps.content, className: cn(styles.content, slotProps.content?.className), children: children }), endIcon && (jsx("span", { ...slotProps.endIcon, className: cn(styles.iconContainer, shortenedIcon == "end" ? styles.primaryIcon : "", slotProps.endIcon?.className), children: endIcon })), !!childNodes.length && (jsx("span", { ...slotProps.dropDownIcon, className: cn(styles.iconContainer, styles.dropDownIcon, slotProps.dropDownIcon?.className, open ? styles.openSublist : ""), children: dropDownIcon }))] }));
|
|
86
|
-
useEffect(() => {
|
|
87
|
-
if (!listItemRef.current)
|
|
88
|
-
return;
|
|
89
|
-
if (selected)
|
|
90
|
-
setActiveListItem(listItemRef.current);
|
|
91
|
-
}, [selected]);
|
|
92
|
-
return (jsxs(Fragment, { children: [href ? (jsx(LinkComponent, { href: href, disabled: disabled, ...componentProps, children: body })) : (jsx("li", { ...componentProps, children: body })), !!childNodes.length && !shortened && open && (jsx(List, { secondary: true, children: childNodes.map((c, i) => (jsx(ListItem, { ...c }, i))) }))] }));
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export { List, ListItem, useList };
|
|
1
|
+
"use client";import{jsx as e,jsxs as r,Fragment as t}from"react/jsx-runtime";import{createContext as n,useContext as o,useState as s,useRef as c,useEffect as l}from"react";import i from"./List.module.css.js";import{cn as a,mergeRefs as d}from"@studiocubics/utils";import{useRipple as m,eventWithRipple as p}from"../../Misc/Ripple/Ripple.js";import{useDisclosure as u}from"@studiocubics/hooks";import"../../Cards/Card/Card.js";import"../../Cards/CollectionItemCard/CollectionItemCard.js";import"../../Inputs/Button/Button.js";import"react-dom";import{GlassCard as h}from"../../Cards/GlassCard/GlassCard.js";const f=n(null);function C(){const e=o(f);if(!e)throw new Error("Components must be wrapped in <List/>");return e}function I(t){const{children:n,ordered:o=!1,secondary:d=!1,listData:m=[],slotProps:p={},className:u,renderMarker:C=!0,listItemProps:I={}}=t,[w,N]=s(null),k=c(null),v=c(null),b=a(i.root,u,d?i.secondary:""),y=m.length?m.map((r,t)=>e(g,{...I,...r},t)):n,L=C?e(h,{...p.marker,ref:k,className:a(i.marker,p.marker?.className)}):null,j=o?"ol":"ul";return l(()=>{if(!v.current||!k.current||!w)return;const e=()=>{if(!v.current||!k.current||!w)return;const e=k.current,r=w.getBoundingClientRect(),t=v.current.getBoundingClientRect(),n=v.current.scrollLeft,o=v.current.scrollTop;e.style.display="block",e.style.width=`${r.width}px`,e.style.height=`${r.height}px`,e.style.left=`${r.left-t.left+n}px`,e.style.top=`${r.top-t.top+o}px`};e();const r=v.current,t=new ResizeObserver(e);return t.observe(r),()=>{t.disconnect()}},[w]),e(f.Provider,{value:{activeListItem:w,setActiveListItem:N},children:r(j,{ref:v,className:b,children:[y,L]})})}function w(){return e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-chevron-down-icon lucide-chevron-down",children:e("path",{d:"m6 9 6 6 6-6"})})}function g(n){const{className:o,children:s,onTouchStart:h,onClick:f,shortened:N=!1,shortenedIcon:k="start",selected:v=!1,dropDownIcon:b=e(w,{}),color:y,startIcon:L,endIcon:j,disabled:x,childNodes:R=[],href:B,LinkComponent:D="a",slotProps:P,ref:T,...$}=n,S=P??{},{setActiveListItem:A}=C(),E=c(null),{rippleElements:G,createRipple:M}=m(S.ripple),{open:z,handleToggle:O}=u(),W=!(x||!B&&!f&&(N||!R.length)),q={className:a(o,i.listItem,N?i.shortened:"",v?i.selected:"",W?i.clickable:"",x?i.disabled:""),onTouchStart:x?void 0:p(M,h,O),onClick:x?void 0:p(M,f,O),"data-color":y,ref:d(T,E),...$},F=r(t,{children:[W&&G,L&&e("span",{...S.startIcon,className:a(i.iconContainer,"start"==k?i.primaryIcon:"",S.startIcon?.className),children:L}),e("span",{...S.content,className:a(i.content,S.content?.className),children:s}),j&&e("span",{...S.endIcon,className:a(i.iconContainer,"end"==k?i.primaryIcon:"",S.endIcon?.className),children:j}),!!R.length&&e("span",{...S.dropDownIcon,className:a(i.iconContainer,i.dropDownIcon,S.dropDownIcon?.className,z?i.openSublist:""),children:b})]});return l(()=>{E.current&&v&&A(E.current)},[v]),r(t,{children:[B?e(D,{href:B,disabled:x,...q,children:F}):e("li",{...q,children:F}),!!R.length&&!N&&z&&e(I,{secondary:!0,children:R.map((r,t)=>e(g,{...r},t))})]})}export{I as List,g as ListItem,C as useList};
|
|
96
2
|
//# sourceMappingURL=List.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.js","sources":["../../../src/Display/List/List.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ComponentProps,\n createContext,\n type ElementType,\n type ReactNode,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport styles from \"./List.module.css\";\nimport { cn, mergeRefs } from \"@studiocubics/utils\";\nimport {\n eventWithRipple,\n useRipple,\n type UseRippleProps,\n} from \"../../Misc/_index\";\nimport { useDisclosure } from \"@studiocubics/hooks\";\nimport { GlassCard, type GlassCardProps } from \"../../Cards/_index\";\nimport type { SetState } from \"@studiocubics/types\";\n\ninterface ListContextProps {\n activeListItem: HTMLLIElement | null;\n setActiveListItem: SetState<HTMLLIElement | null>;\n}\nexport type ListProps = {\n ordered?: boolean;\n className?: string;\n secondary?: boolean;\n renderMarker?: boolean;\n\n slotProps?: {\n marker?: GlassCardProps;\n };\n} & (\n | {\n listData?: ListItemProps[];\n children?: undefined;\n listItemProps?: ListItemProps;\n }\n | {\n children?: ReactNode;\n listData?: undefined;\n listItemProps?: undefined;\n }\n);\n\nconst ListContext = createContext<ListContextProps | null>(null);\n\nexport function useList() {\n const c = useContext(ListContext);\n if (!c) throw new Error(\"Components must be wrapped in <List/>\");\n return c;\n}\n\nexport function List(props: ListProps) {\n const {\n children,\n ordered = false,\n secondary = false,\n listData = [],\n slotProps = {},\n className,\n renderMarker = true,\n listItemProps = {},\n } = props;\n const [activeListItem, setActiveListItem] =\n useState<ListContextProps[\"activeListItem\"]>(null);\n const markerRef = useRef<HTMLDivElement>(null);\n const rootRef = useRef<HTMLOListElement>(null);\n\n const rootClass = cn(\n styles.root,\n className,\n secondary ? styles.secondary : \"\",\n );\n const body = listData.length\n ? listData.map((ld, i) => <ListItem key={i} {...listItemProps} {...ld} />)\n : children;\n\n const marker = renderMarker ? (\n <GlassCard\n {...slotProps.marker}\n ref={markerRef}\n className={cn(styles.marker, slotProps.marker?.className)}\n />\n ) : null;\n const Component = ordered ? \"ol\" : \"ul\";\n\n useEffect(() => {\n if (!rootRef.current || !markerRef.current || !activeListItem) return;\n\n const updateMarkerPosition = () => {\n if (!rootRef.current || !markerRef.current || !activeListItem) return;\n\n const marker = markerRef.current;\n const tabRect = activeListItem.getBoundingClientRect();\n const rootRect = rootRef.current.getBoundingClientRect();\n\n // Account for scroll offset\n const scrollLeft = rootRef.current.scrollLeft;\n const scrollTop = rootRef.current.scrollTop;\n\n marker.style.display = \"block\";\n marker.style.width = `${tabRect.width}px`;\n marker.style.height = `${tabRect.height}px`;\n marker.style.left = `${tabRect.left - rootRect.left + scrollLeft}px`;\n marker.style.top = `${tabRect.top - rootRect.top + scrollTop}px`;\n };\n\n updateMarkerPosition();\n\n const container = rootRef.current;\n\n // Update marker position when container resizes\n const resizeObserver = new ResizeObserver(updateMarkerPosition);\n resizeObserver.observe(container);\n\n return () => {\n resizeObserver.disconnect();\n };\n }, [activeListItem]);\n return (\n <ListContext.Provider value={{ activeListItem, setActiveListItem }}>\n <Component ref={rootRef} className={rootClass}>\n {body}\n {marker}\n </Component>\n </ListContext.Provider>\n );\n}\n\nexport interface ListItemProps extends ComponentProps<\"li\"> {\n startIcon?: ReactNode;\n endIcon?: ReactNode;\n dropDownIcon?: ReactNode;\n selected?: boolean;\n shortened?: boolean;\n shortenedIcon?: \"start\" | \"end\";\n href?: ComponentProps<\"a\">[\"href\"];\n disabled?: boolean;\n color?: \"primary\" | \"secondary\" | \"error\";\n slotProps?: {\n ripple?: UseRippleProps;\n content?: ComponentProps<\"span\">;\n startIcon?: ComponentProps<\"span\">;\n endIcon?: ComponentProps<\"span\">;\n dropDownIcon?: ComponentProps<\"span\">;\n linkComponent?: ComponentProps<\"a\">;\n };\n childNodes?: Array<ListItemProps>;\n LinkComponent?: ElementType<ComponentProps<any>>;\n}\nfunction ChevronDown() {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"lucide lucide-chevron-down-icon lucide-chevron-down\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n );\n}\n// Create the base component with forwardRef\nexport function ListItem(props: ListItemProps) {\n const {\n className,\n children,\n onTouchStart,\n onClick,\n shortened = false,\n shortenedIcon = \"start\",\n selected = false,\n dropDownIcon = <ChevronDown />,\n color,\n startIcon,\n endIcon,\n disabled,\n childNodes = [],\n href,\n LinkComponent = \"a\",\n slotProps: _slotProps,\n ref,\n ...restProps\n } = props;\n const slotProps: NonNullable<ListItemProps[\"slotProps\"]> = _slotProps ?? {};\n const { setActiveListItem } = useList();\n const listItemRef = useRef<HTMLLIElement>(null);\n\n const { rippleElements, createRipple } = useRipple(slotProps.ripple);\n const { open, handleToggle } = useDisclosure();\n\n const clickable =\n !disabled && (!!href || !!onClick || (!shortened && !!childNodes.length));\n\n const componentProps = {\n className: cn(\n className,\n styles.listItem,\n shortened ? styles.shortened : \"\",\n selected ? styles.selected : \"\",\n clickable ? styles.clickable : \"\",\n disabled ? styles.disabled : \"\",\n ),\n onTouchStart: disabled\n ? undefined\n : eventWithRipple(createRipple, onTouchStart, handleToggle),\n onClick: disabled\n ? undefined\n : eventWithRipple(createRipple, onClick, handleToggle),\n \"data-color\": color,\n ref: mergeRefs(ref, listItemRef),\n ...restProps,\n };\n\n const body = (\n <>\n {clickable && rippleElements}\n {startIcon && (\n <span\n {...slotProps.startIcon}\n className={cn(\n styles.iconContainer,\n shortenedIcon == \"start\" ? styles.primaryIcon : \"\",\n slotProps.startIcon?.className,\n )}\n >\n {startIcon}\n </span>\n )}\n <span\n {...slotProps.content}\n className={cn(styles.content, slotProps.content?.className)}\n >\n {children}\n </span>\n {endIcon && (\n <span\n {...slotProps.endIcon}\n className={cn(\n styles.iconContainer,\n shortenedIcon == \"end\" ? styles.primaryIcon : \"\",\n slotProps.endIcon?.className,\n )}\n >\n {endIcon}\n </span>\n )}\n {!!childNodes.length && (\n <span\n {...slotProps.dropDownIcon}\n className={cn(\n styles.iconContainer,\n styles.dropDownIcon,\n slotProps.dropDownIcon?.className,\n open ? styles.openSublist : \"\",\n )}\n >\n {dropDownIcon}\n </span>\n )}\n </>\n );\n\n useEffect(() => {\n if (!listItemRef.current) return;\n if (selected) setActiveListItem(listItemRef.current);\n }, [selected]);\n\n return (\n <>\n {href ? (\n <LinkComponent href={href} disabled={disabled} {...componentProps}>\n {body}\n </LinkComponent>\n ) : (\n <li {...componentProps}>{body}</li>\n )}\n {!!childNodes.length && !shortened && open && (\n <List secondary>\n {childNodes.map((c, i) => (\n <ListItem key={i} {...c} />\n ))}\n </List>\n )}\n </>\n );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AA,CAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,GAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAc,CAAA,CAAA,QAAA,CAAA,CAAG,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAM,CACpC,CAAA,CACA,CAAC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAI,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAI,IAAI,CAAA,CAAA,CAAA,CAAA,CACxCA,CAAAA,CAAAA,CAAA,CAAC,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,EAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,iBACZ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,CAAC,CAAA,CAAA,CAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CACnBA,GAAA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,MAAa,CAAC,EAAA,CAAA,CAAR,CAAC,CAAW,CAC5B,CAAC,EAAA,CACG,CACR,CAAA,CAAA,CAAA,CACA,CAAA;AAEP;;"}
|
|
1
|
+
{"version":3,"file":"List.js","sources":["../../../src/Display/List/List.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ComponentProps,\n createContext,\n type ElementType,\n type ReactNode,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport styles from \"./List.module.css\";\nimport { cn, mergeRefs } from \"@studiocubics/utils\";\nimport {\n eventWithRipple,\n useRipple,\n type UseRippleProps,\n} from \"../../Misc/_index\";\nimport { useDisclosure } from \"@studiocubics/hooks\";\nimport { GlassCard, type GlassCardProps } from \"../../Cards/_index\";\nimport type { SetState } from \"@studiocubics/types\";\n\ninterface ListContextProps {\n activeListItem: HTMLLIElement | null;\n setActiveListItem: SetState<HTMLLIElement | null>;\n}\nexport type ListProps = {\n ordered?: boolean;\n className?: string;\n secondary?: boolean;\n renderMarker?: boolean;\n\n slotProps?: {\n marker?: GlassCardProps;\n };\n} & (\n | {\n listData?: ListItemProps[];\n children?: undefined;\n listItemProps?: ListItemProps;\n }\n | {\n children?: ReactNode;\n listData?: undefined;\n listItemProps?: undefined;\n }\n);\n\nconst ListContext = createContext<ListContextProps | null>(null);\n\nexport function useList() {\n const c = useContext(ListContext);\n if (!c) throw new Error(\"Components must be wrapped in <List/>\");\n return c;\n}\n\nexport function List(props: ListProps) {\n const {\n children,\n ordered = false,\n secondary = false,\n listData = [],\n slotProps = {},\n className,\n renderMarker = true,\n listItemProps = {},\n } = props;\n const [activeListItem, setActiveListItem] =\n useState<ListContextProps[\"activeListItem\"]>(null);\n const markerRef = useRef<HTMLDivElement>(null);\n const rootRef = useRef<HTMLOListElement>(null);\n\n const rootClass = cn(\n styles.root,\n className,\n secondary ? styles.secondary : \"\",\n );\n const body = listData.length\n ? listData.map((ld, i) => <ListItem key={i} {...listItemProps} {...ld} />)\n : children;\n\n const marker = renderMarker ? (\n <GlassCard\n {...slotProps.marker}\n ref={markerRef}\n className={cn(styles.marker, slotProps.marker?.className)}\n />\n ) : null;\n const Component = ordered ? \"ol\" : \"ul\";\n\n useEffect(() => {\n if (!rootRef.current || !markerRef.current || !activeListItem) return;\n\n const updateMarkerPosition = () => {\n if (!rootRef.current || !markerRef.current || !activeListItem) return;\n\n const marker = markerRef.current;\n const tabRect = activeListItem.getBoundingClientRect();\n const rootRect = rootRef.current.getBoundingClientRect();\n\n // Account for scroll offset\n const scrollLeft = rootRef.current.scrollLeft;\n const scrollTop = rootRef.current.scrollTop;\n\n marker.style.display = \"block\";\n marker.style.width = `${tabRect.width}px`;\n marker.style.height = `${tabRect.height}px`;\n marker.style.left = `${tabRect.left - rootRect.left + scrollLeft}px`;\n marker.style.top = `${tabRect.top - rootRect.top + scrollTop}px`;\n };\n\n updateMarkerPosition();\n\n const container = rootRef.current;\n\n // Update marker position when container resizes\n const resizeObserver = new ResizeObserver(updateMarkerPosition);\n resizeObserver.observe(container);\n\n return () => {\n resizeObserver.disconnect();\n };\n }, [activeListItem]);\n return (\n <ListContext.Provider value={{ activeListItem, setActiveListItem }}>\n <Component ref={rootRef} className={rootClass}>\n {body}\n {marker}\n </Component>\n </ListContext.Provider>\n );\n}\n\nexport interface ListItemProps extends ComponentProps<\"li\"> {\n startIcon?: ReactNode;\n endIcon?: ReactNode;\n dropDownIcon?: ReactNode;\n selected?: boolean;\n shortened?: boolean;\n shortenedIcon?: \"start\" | \"end\";\n href?: ComponentProps<\"a\">[\"href\"];\n disabled?: boolean;\n color?: \"primary\" | \"secondary\" | \"error\";\n slotProps?: {\n ripple?: UseRippleProps;\n content?: ComponentProps<\"span\">;\n startIcon?: ComponentProps<\"span\">;\n endIcon?: ComponentProps<\"span\">;\n dropDownIcon?: ComponentProps<\"span\">;\n linkComponent?: ComponentProps<\"a\">;\n };\n childNodes?: Array<ListItemProps>;\n LinkComponent?: ElementType<ComponentProps<any>>;\n}\nfunction ChevronDown() {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"lucide lucide-chevron-down-icon lucide-chevron-down\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n );\n}\n// Create the base component with forwardRef\nexport function ListItem(props: ListItemProps) {\n const {\n className,\n children,\n onTouchStart,\n onClick,\n shortened = false,\n shortenedIcon = \"start\",\n selected = false,\n dropDownIcon = <ChevronDown />,\n color,\n startIcon,\n endIcon,\n disabled,\n childNodes = [],\n href,\n LinkComponent = \"a\",\n slotProps: _slotProps,\n ref,\n ...restProps\n } = props;\n const slotProps: NonNullable<ListItemProps[\"slotProps\"]> = _slotProps ?? {};\n const { setActiveListItem } = useList();\n const listItemRef = useRef<HTMLLIElement>(null);\n\n const { rippleElements, createRipple } = useRipple(slotProps.ripple);\n const { open, handleToggle } = useDisclosure();\n\n const clickable =\n !disabled && (!!href || !!onClick || (!shortened && !!childNodes.length));\n\n const componentProps = {\n className: cn(\n className,\n styles.listItem,\n shortened ? styles.shortened : \"\",\n selected ? styles.selected : \"\",\n clickable ? styles.clickable : \"\",\n disabled ? styles.disabled : \"\",\n ),\n onTouchStart: disabled\n ? undefined\n : eventWithRipple(createRipple, onTouchStart, handleToggle),\n onClick: disabled\n ? undefined\n : eventWithRipple(createRipple, onClick, handleToggle),\n \"data-color\": color,\n ref: mergeRefs(ref, listItemRef),\n ...restProps,\n };\n\n const body = (\n <>\n {clickable && rippleElements}\n {startIcon && (\n <span\n {...slotProps.startIcon}\n className={cn(\n styles.iconContainer,\n shortenedIcon == \"start\" ? styles.primaryIcon : \"\",\n slotProps.startIcon?.className,\n )}\n >\n {startIcon}\n </span>\n )}\n <span\n {...slotProps.content}\n className={cn(styles.content, slotProps.content?.className)}\n >\n {children}\n </span>\n {endIcon && (\n <span\n {...slotProps.endIcon}\n className={cn(\n styles.iconContainer,\n shortenedIcon == \"end\" ? styles.primaryIcon : \"\",\n slotProps.endIcon?.className,\n )}\n >\n {endIcon}\n </span>\n )}\n {!!childNodes.length && (\n <span\n {...slotProps.dropDownIcon}\n className={cn(\n styles.iconContainer,\n styles.dropDownIcon,\n slotProps.dropDownIcon?.className,\n open ? styles.openSublist : \"\",\n )}\n >\n {dropDownIcon}\n </span>\n )}\n </>\n );\n\n useEffect(() => {\n if (!listItemRef.current) return;\n if (selected) setActiveListItem(listItemRef.current);\n }, [selected]);\n\n return (\n <>\n {href ? (\n <LinkComponent href={href} disabled={disabled} {...componentProps}>\n {body}\n </LinkComponent>\n ) : (\n <li {...componentProps}>{body}</li>\n )}\n {!!childNodes.length && !shortened && open && (\n <List secondary>\n {childNodes.map((c, i) => (\n <ListItem key={i} {...c} />\n ))}\n </List>\n )}\n </>\n );\n}\n"],"names":["ListContext","createContext","useList","c","useContext","Error","List","props","children","ordered","secondary","listData","slotProps","className","renderMarker","listItemProps","activeListItem","setActiveListItem","useState","markerRef","useRef","rootRef","rootClass","cn","styles","root","body","length","map","ld","i","_jsx","ListItem","marker","GlassCard","ref","Component","useEffect","current","updateMarkerPosition","tabRect","getBoundingClientRect","rootRect","scrollLeft","scrollTop","style","display","width","height","left","top","container","resizeObserver","ResizeObserver","observe","disconnect","Provider","value","_jsxs","ChevronDown","xmlns","viewBox","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","d","onTouchStart","onClick","shortened","shortenedIcon","selected","dropDownIcon","color","startIcon","endIcon","disabled","childNodes","href","LinkComponent","_slotProps","restProps","listItemRef","rippleElements","createRipple","useRipple","ripple","open","handleToggle","useDisclosure","clickable","componentProps","listItem","undefined","eventWithRipple","mergeRefs","_Fragment","iconContainer","primaryIcon","content","openSublist"],"mappings":"8lBAiDA,MAAMA,EAAcC,EAAuC,eAE3CC,IACd,MAAMC,EAAIC,EAAWJ,GACrB,IAAKG,EAAG,MAAM,IAAIE,MAAM,yCACxB,OAAOF,CACT,CAEM,SAAUG,EAAKC,GACnB,MAAMC,SACJA,EAAQC,QACRA,GAAU,EAAKC,UACfA,GAAY,EAAKC,SACjBA,EAAW,GAAEC,UACbA,EAAY,CAAA,EAAEC,UACdA,EAASC,aACTA,GAAe,EAAIC,cACnBA,EAAgB,CAAA,GACdR,GACGS,EAAgBC,GACrBC,EAA6C,MACzCC,EAAYC,EAAuB,MACnCC,EAAUD,EAAyB,MAEnCE,EAAYC,EAChBC,EAAOC,KACPZ,EACAH,EAAYc,EAAOd,UAAY,IAE3BgB,EAAOf,EAASgB,OAClBhB,EAASiB,IAAI,CAACC,E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IAEFoE,GACC7C,EAAA,OAAA,IACMnB,EAAUgE,QACd/D,UAAWU,EACTC,EAAO0E,cACU,OAAjB3B,EAAyB/C,EAAO2E,YAAc,GAC9CvF,EAAUgE,SAAS/D,WACpBL,SAEAoE,MAGFE,EAAWnD,QACZI,EAAA,OAAA,IACMnB,EAAU6D,aACd5D,UAAWU,EACTC,EAAO0E,cACP1E,EAAOiD,aACP7D,EAAU6D,cAAc5D,UACxB2E,EAAOhE,EAAO6E,YAAc,IAC7B7F,SAEAiE,OAWT,OALApC,EAAU,KACH8C,EAAY7C,SACbkC,GAAUvD,EAAkBkE,EAAY7C,UAC3C,CAACkC,IAGFd,EAAAuC,EAAA,CAAAzF,SAAA,CACGuE,EACChD,EAACiD,EAAa,CAACD,KAAMA,EAAMF,SAAUA,KAAce,EAAcpF,SAC9DkB,IAGHK,EAAA,KAAA,IAAQ6D,EAAcpF,SAAGkB,MAExBoD,EAAWnD,SAAW2C,GAAakB,GACpCzD,EAACzB,EAAI,CAACI,sBACHoE,EAAWlD,IAAI,CAACzB,EAAG2B,IAClBC,EAACC,MAAqB7B,GAAP2B,QAM3B"}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
export { styles as default };
|
|
1
|
+
var e={root:"List-module_root__VY-ni",shortened:"List-module_shortened__cbFoK",secondary:"List-module_secondary__lU6qH",listItem:"List-module_listItem__8lcu6",clickable:"List-module_clickable__3Fj4n",selected:"List-module_selected__nXBs4",disabled:"List-module_disabled__RJxHm",primaryIcon:"List-module_primaryIcon__WyWmw",content:"List-module_content__Q2M2b",iconContainer:"List-module_iconContainer__ZHqxe",dropDownIcon:"List-module_dropDownIcon__XfJpu",openSublist:"List-module_openSublist__Izz1t",marker:"List-module_marker__o4rTn"};export{e as default};
|
|
4
2
|
//# sourceMappingURL=List.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"List.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import styles from './PasswordStrength.module.css.js';
|
|
4
|
-
import { remap, cn } from '@studiocubics/utils';
|
|
5
|
-
|
|
6
|
-
const STRENGTH_MESSAGES = ["", "Weak", "Medium", "Good", "Strong"];
|
|
7
|
-
const Bar = ({ className, ...rest }) => {
|
|
8
|
-
return jsx("span", { className: cn(styles.bar, className), ...rest });
|
|
9
|
-
};
|
|
10
|
-
function PasswordStrength({ strength }) {
|
|
11
|
-
const remappedStrength = strength ? remap(strength, [1, 5], [1, 4]) : 0;
|
|
12
|
-
const strengthMsg = STRENGTH_MESSAGES[remappedStrength];
|
|
13
|
-
return (jsxs("div", { className: cn(styles.root, !!strength ? styles.show : ""), children: [jsx("p", { className: cn(styles.title), children: strengthMsg }), jsxs("div", { className: cn(styles.strengthBars), children: [jsx(Bar, { className: cn(styles.weak, remappedStrength >= 1 ? styles.show : "") }), jsx(Bar, { className: cn(styles.medium, remappedStrength >= 2 ? styles.show : "") }), jsx(Bar, { className: cn(styles.good, remappedStrength >= 3 ? styles.show : "") }), jsx(Bar, { className: cn(styles.strong, remappedStrength == 4 ? styles.show : "") })] })] }));
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { PasswordStrength, STRENGTH_MESSAGES };
|
|
1
|
+
"use client";import{jsxs as s,jsx as e}from"react/jsx-runtime";import o from"./PasswordStrength.module.css.js";import{remap as a,cn as t}from"@studiocubics/utils";const r=["","Weak","Medium","Good","Strong"],c=({className:s,...a})=>e("span",{className:t(o.bar,s),...a});function m({strength:m}){const i=m?a(m,[1,5],[1,4]):0,l=r[i];return s("div",{className:t(o.root,m?o.show:""),children:[e("p",{className:t(o.title),children:l}),s("div",{className:t(o.strengthBars),children:[e(c,{className:t(o.weak,i>=1?o.show:"")}),e(c,{className:t(o.medium,i>=2?o.show:"")}),e(c,{className:t(o.good,i>=3?o.show:"")}),e(c,{className:t(o.strong,4==i?o.show:"")})]})]})}export{m as PasswordStrength,r as STRENGTH_MESSAGES};
|
|
17
2
|
//# sourceMappingURL=PasswordStrength.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordStrength.js","sources":["../../../src/Display/PasswordStrength/PasswordStrength.tsx"],"sourcesContent":["\"use client\";\n\nimport styles from \"./PasswordStrength.module.css\";\nimport { cn, remap } from \"@studiocubics/utils\";\nimport type { ComponentProps } from \"react\";\n\nexport const STRENGTH_MESSAGES = [\"\", \"Weak\", \"Medium\", \"Good\", \"Strong\"];\n\nconst Bar = ({ className, ...rest }: ComponentProps<\"span\">) => {\n return <span className={cn(styles.bar, className)} {...rest} />;\n};\n\nexport function PasswordStrength({ strength }: { strength?: number | null }) {\n const remappedStrength = strength ? remap(strength, [1, 5], [1, 4]) : 0;\n const strengthMsg = STRENGTH_MESSAGES[remappedStrength];\n return (\n <div className={cn(styles.root, !!strength ? styles.show : \"\")}>\n <p className={cn(styles.title)}>{strengthMsg}</p>\n <div className={cn(styles.strengthBars)}>\n <Bar\n className={cn(styles.weak, remappedStrength >= 1 ? styles.show : \"\")}\n />\n <Bar\n className={cn(\n styles.medium,\n remappedStrength >= 2 ? styles.show : \"\",\n )}\n />\n <Bar\n className={cn(styles.good, remappedStrength >= 3 ? styles.show : \"\")}\n />\n <Bar\n className={cn(\n styles.strong,\n remappedStrength == 4 ? styles.show : \"\",\n )}\n />\n </div>\n </div>\n );\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"PasswordStrength.js","sources":["../../../src/Display/PasswordStrength/PasswordStrength.tsx"],"sourcesContent":["\"use client\";\n\nimport styles from \"./PasswordStrength.module.css\";\nimport { cn, remap } from \"@studiocubics/utils\";\nimport type { ComponentProps } from \"react\";\n\nexport const STRENGTH_MESSAGES = [\"\", \"Weak\", \"Medium\", \"Good\", \"Strong\"];\n\nconst Bar = ({ className, ...rest }: ComponentProps<\"span\">) => {\n return <span className={cn(styles.bar, className)} {...rest} />;\n};\n\nexport function PasswordStrength({ strength }: { strength?: number | null }) {\n const remappedStrength = strength ? remap(strength, [1, 5], [1, 4]) : 0;\n const strengthMsg = STRENGTH_MESSAGES[remappedStrength];\n return (\n <div className={cn(styles.root, !!strength ? styles.show : \"\")}>\n <p className={cn(styles.title)}>{strengthMsg}</p>\n <div className={cn(styles.strengthBars)}>\n <Bar\n className={cn(styles.weak, remappedStrength >= 1 ? styles.show : \"\")}\n />\n <Bar\n className={cn(\n styles.medium,\n remappedStrength >= 2 ? styles.show : \"\",\n )}\n />\n <Bar\n className={cn(styles.good, remappedStrength >= 3 ? styles.show : \"\")}\n />\n <Bar\n className={cn(\n styles.strong,\n remappedStrength == 4 ? styles.show : \"\",\n )}\n />\n </div>\n </div>\n );\n}\n"],"names":["STRENGTH_MESSAGES","Bar","className","rest","_jsx","cn","styles","bar","PasswordStrength","strength","remappedStrength","remap","strengthMsg","_jsxs","root","show","children","title","strengthBars","weak","medium","good","strong"],"mappings":"mKAMO,MAAMA,EAAoB,CAAC,GAAI,OAAQ,SAAU,OAAQ,UAE1DC,EAAM,EAAGC,eAAcC,KACpBC,EAAA,OAAA,CAAMF,UAAWG,EAAGC,EAAOC,IAAKL,MAAgBC,IAGnD,SAAUK,GAAiBC,SAAEA,IACjC,MAAMC,EAAmBD,EAAWE,EAAMF,EAAU,CAAC,EAAG,GAAI,CAAC,EAAG,IAAM,EAChEG,EAAcZ,EAAkBU,GACtC,OACEG,EAAA,MAAA,CAAKX,UAAWG,EAAGC,EAAOQ,KAAQL,EAAWH,EAAOS,KAAO,IAAGC,SAAA,CAC5DZ,OAAGF,UAAWG,EAAGC,EAAOW,OAAMD,SAAGJ,IACjCC,EAAA,MAAA,CAAKX,UAAWG,EAAGC,EAAOY,cAAaF,SAAA,CACrCZ,EAACH,GACCC,UAAWG,EAAGC,EAAOa,KAAMT,GAAoB,EAAIJ,EAAOS,KAAO,MAEnEX,EAACH,EAAG,CACFC,UAAWG,EACTC,EAAOc,OACPV,GAAoB,EAAIJ,EAAOS,KAAO,MAG1CX,EAACH,EAAG,CACFC,UAAWG,EAAGC,EAAOe,KAAMX,GAAoB,EAAIJ,EAAOS,KAAO,MAEnEX,EAACH,GACCC,UAAWG,EACTC,EAAOgB,OACa,GAApBZ,EAAwBJ,EAAOS,KAAO,WAMlD"}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
export { styles as default };
|
|
1
|
+
var t={root:"PasswordStrength-module_root__YPak5",title:"PasswordStrength-module_title__PnvjF",strengthBars:"PasswordStrength-module_strengthBars__VDp4V",bar:"PasswordStrength-module_bar__cVDvu",weak:"PasswordStrength-module_weak__1uds9",medium:"PasswordStrength-module_medium__iDdic",good:"PasswordStrength-module_good__WkBFX",strong:"PasswordStrength-module_strong__WKvRA",show:"PasswordStrength-module_show__D2ml-"};export{t as default};
|
|
4
2
|
//# sourceMappingURL=PasswordStrength.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordStrength.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PasswordStrength.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,49 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const PASSWORD_REGEX = {
|
|
4
|
-
ASCII_NO_SPACE: { ex: /^[!-~]+$/, score: 0.5 },
|
|
5
|
-
LOWERCASE: { ex: /[a-z]/, score: 0.5 },
|
|
6
|
-
UPPERCASE: { ex: /[A-Z]/, score: 1 },
|
|
7
|
-
DIGIT: { ex: /\d/, score: 1 },
|
|
8
|
-
SPECIAL: { ex: /[!@#$%^&*()_\-+=\[\]{};:'",.<>/?\\|`~]/, score: 1 },
|
|
9
|
-
NO_TRIPLE_REPEAT: { ex: /^(?!.*(.)\1\1).*$/, score: 1 },
|
|
10
|
-
};
|
|
11
|
-
const ALL_PASSWORD_TESTS = [
|
|
12
|
-
"ASCII_NO_SPACE",
|
|
13
|
-
"DIGIT",
|
|
14
|
-
"LOWERCASE",
|
|
15
|
-
"NO_TRIPLE_REPEAT",
|
|
16
|
-
"SPECIAL",
|
|
17
|
-
"UPPERCASE",
|
|
18
|
-
];
|
|
19
|
-
function usePasswordStrength({ password, requiredTests = [], disableStrengthMeter = true, minLength = 8, }) {
|
|
20
|
-
const [strength, setStrength] = useState(null);
|
|
21
|
-
const [testsPassed, setPassed] = useState([]);
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
if (!password) {
|
|
24
|
-
setStrength(null);
|
|
25
|
-
setPassed([]);
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const results = [];
|
|
29
|
-
for (const [key, regex] of Object.entries(PASSWORD_REGEX)) {
|
|
30
|
-
if (regex.ex.test(password))
|
|
31
|
-
results.push(key);
|
|
32
|
-
}
|
|
33
|
-
setPassed(results);
|
|
34
|
-
// REQUIRED TESTS GATE
|
|
35
|
-
const allRequiredPassed = results.every((test) => requiredTests.includes(test));
|
|
36
|
-
if (!allRequiredPassed || password.length < minLength) {
|
|
37
|
-
setStrength(1); // Weak
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
// Otherwise score by total passed tests
|
|
41
|
-
const totalScore = Object.entries(PASSWORD_REGEX).reduce((acc, [key, value]) => results.includes(key) ? acc + value.score : acc, 0);
|
|
42
|
-
setStrength(totalScore);
|
|
43
|
-
}, [password, requiredTests]);
|
|
44
|
-
if (!disableStrengthMeter)
|
|
45
|
-
return { strength, testsPassed };
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export { ALL_PASSWORD_TESTS, PASSWORD_REGEX, usePasswordStrength };
|
|
1
|
+
import{useState as e,useEffect as r}from"react";const s={ASCII_NO_SPACE:{ex:/^[!-~]+$/,score:.5},LOWERCASE:{ex:/[a-z]/,score:.5},UPPERCASE:{ex:/[A-Z]/,score:1},DIGIT:{ex:/\d/,score:1},SPECIAL:{ex:/[!@#$%^&*()_\-+=\[\]{};:'",.<>/?\\|`~]/,score:1},NO_TRIPLE_REPEAT:{ex:/^(?!.*(.)\1\1).*$/,score:1}},t=["ASCII_NO_SPACE","DIGIT","LOWERCASE","NO_TRIPLE_REPEAT","SPECIAL","UPPERCASE"];function n({password:t,requiredTests:n=[],disableStrengthMeter:o=!0,minLength:c=8}){const[E,i]=e(null),[A,P]=e([]);if(r(()=>{if(!t)return i(null),void P([]);const e=[];for(const[r,n]of Object.entries(s))n.ex.test(t)&&e.push(r);P(e);if(!e.every(e=>n.includes(e))||t.length<c)return void i(1);const r=Object.entries(s).reduce((r,[s,t])=>e.includes(s)?r+t.score:r,0);i(r)},[t,n]),!o)return{strength:E,testsPassed:A}}export{t as ALL_PASSWORD_TESTS,s as PASSWORD_REGEX,n as usePasswordStrength};
|
|
49
2
|
//# sourceMappingURL=usePasswordStrength.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePasswordStrength.js","sources":["../../../src/Display/PasswordStrength/usePasswordStrength.tsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nexport const PASSWORD_REGEX = {\n ASCII_NO_SPACE: { ex: /^[!-~]+$/, score: 0.5 },\n LOWERCASE: { ex: /[a-z]/, score: 0.5 },\n UPPERCASE: { ex: /[A-Z]/, score: 1 },\n DIGIT: { ex: /\\d/, score: 1 },\n SPECIAL: { ex: /[!@#$%^&*()_\\-+=\\[\\]{};:'\",.<>/?\\\\|`~]/, score: 1 },\n NO_TRIPLE_REPEAT: { ex: /^(?!.*(.)\\1\\1).*$/, score: 1 },\n} as const;\n\nexport type PasswordTest = keyof typeof PASSWORD_REGEX;\n\nexport const ALL_PASSWORD_TESTS: PasswordTest[] = [\n \"ASCII_NO_SPACE\",\n \"DIGIT\",\n \"LOWERCASE\",\n \"NO_TRIPLE_REPEAT\",\n \"SPECIAL\",\n \"UPPERCASE\",\n];\nexport interface PasswordStrengthProps {\n password?: string;\n requiredTests?: PasswordTest[];\n disableStrengthMeter?: boolean;\n /**\n * Minimum length of the password when it should start checking,\n * before reaching the minimum length the strength will always be 1\n */\n minLength?: number;\n}\n\nexport function usePasswordStrength({\n password,\n requiredTests = [],\n disableStrengthMeter = true,\n minLength = 8,\n}: PasswordStrengthProps) {\n const [strength, setStrength] = useState<number | null>(null);\n const [testsPassed, setPassed] = useState<PasswordTest[]>([]);\n\n useEffect(() => {\n if (!password) {\n setStrength(null);\n setPassed([]);\n return;\n }\n\n const results: PasswordTest[] = [];\n\n for (const [key, regex] of Object.entries(PASSWORD_REGEX)) {\n if (regex.ex.test(password)) results.push(key as PasswordTest);\n }\n\n setPassed(results);\n\n // REQUIRED TESTS GATE\n const allRequiredPassed = results.every((test) =>\n requiredTests.includes(test),\n );\n\n if (!allRequiredPassed || password.length < minLength) {\n setStrength(1); // Weak\n return;\n }\n\n // Otherwise score by total passed tests\n const totalScore = Object.entries(PASSWORD_REGEX).reduce(\n (acc, [key, value]) =>\n results.includes(key as PasswordTest) ? acc + value.score : acc,\n 0,\n );\n setStrength(totalScore);\n }, [password, requiredTests]);\n\n if (!disableStrengthMeter) return { strength, testsPassed };\n}\n"],"names":[
|
|
1
|
+
{"version":3,"file":"usePasswordStrength.js","sources":["../../../src/Display/PasswordStrength/usePasswordStrength.tsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nexport const PASSWORD_REGEX = {\n ASCII_NO_SPACE: { ex: /^[!-~]+$/, score: 0.5 },\n LOWERCASE: { ex: /[a-z]/, score: 0.5 },\n UPPERCASE: { ex: /[A-Z]/, score: 1 },\n DIGIT: { ex: /\\d/, score: 1 },\n SPECIAL: { ex: /[!@#$%^&*()_\\-+=\\[\\]{};:'\",.<>/?\\\\|`~]/, score: 1 },\n NO_TRIPLE_REPEAT: { ex: /^(?!.*(.)\\1\\1).*$/, score: 1 },\n} as const;\n\nexport type PasswordTest = keyof typeof PASSWORD_REGEX;\n\nexport const ALL_PASSWORD_TESTS: PasswordTest[] = [\n \"ASCII_NO_SPACE\",\n \"DIGIT\",\n \"LOWERCASE\",\n \"NO_TRIPLE_REPEAT\",\n \"SPECIAL\",\n \"UPPERCASE\",\n];\nexport interface PasswordStrengthProps {\n password?: string;\n requiredTests?: PasswordTest[];\n disableStrengthMeter?: boolean;\n /**\n * Minimum length of the password when it should start checking,\n * before reaching the minimum length the strength will always be 1\n */\n minLength?: number;\n}\n\nexport function usePasswordStrength({\n password,\n requiredTests = [],\n disableStrengthMeter = true,\n minLength = 8,\n}: PasswordStrengthProps) {\n const [strength, setStrength] = useState<number | null>(null);\n const [testsPassed, setPassed] = useState<PasswordTest[]>([]);\n\n useEffect(() => {\n if (!password) {\n setStrength(null);\n setPassed([]);\n return;\n }\n\n const results: PasswordTest[] = [];\n\n for (const [key, regex] of Object.entries(PASSWORD_REGEX)) {\n if (regex.ex.test(password)) results.push(key as PasswordTest);\n }\n\n setPassed(results);\n\n // REQUIRED TESTS GATE\n const allRequiredPassed = results.every((test) =>\n requiredTests.includes(test),\n );\n\n if (!allRequiredPassed || password.length < minLength) {\n setStrength(1); // Weak\n return;\n }\n\n // Otherwise score by total passed tests\n const totalScore = Object.entries(PASSWORD_REGEX).reduce(\n (acc, [key, value]) =>\n results.includes(key as PasswordTest) ? acc + value.score : acc,\n 0,\n );\n setStrength(totalScore);\n }, [password, requiredTests]);\n\n if (!disableStrengthMeter) return { strength, testsPassed };\n}\n"],"names":["PASSWORD_REGEX","ASCII_NO_SPACE","ex","score","LOWERCASE","UPPERCASE","DIGIT","SPECIAL","NO_TRIPLE_REPEAT","ALL_PASSWORD_TESTS","usePasswordStrength","password","requiredTests","disableStrengthMeter","minLength","strength","setStrength","useState","testsPassed","setPassed","useEffect","results","key","regex","Object","entries","test","push","every","includes","length","totalScore","reduce","acc","value"],"mappings":"gDAEO,MAAMA,EAAiB,CAC5BC,eAAgB,CAAEC,GAAI,WAAYC,MAAO,IACzCC,UAAW,CAAEF,GAAI,QAASC,MAAO,IACjCE,UAAW,CAAEH,GAAI,QAASC,MAAO,GACjCG,MAAO,CAAEJ,GAAI,KAAMC,MAAO,GAC1BI,QAAS,CAAEL,GAAI,yCAA0CC,MAAO,GAChEK,iBAAkB,CAAEN,GAAI,oBAAqBC,MAAO,IAKzCM,EAAqC,CAChD,iBACA,QACA,YACA,mBACA,UACA,sBAacC,GAAoBC,SAClCA,EAAQC,cACRA,EAAgB,GAAEC,qBAClBA,GAAuB,EAAIC,UAC3BA,EAAY,IAEZ,MAAOC,EAAUC,GAAeC,EAAwB,OACjDC,EAAaC,GAAaF,EAAyB,IAoC1D,GAlCAG,EAAU,KACR,IAAKT,EAGH,OAFAK,EAAY,WACZG,EAAU,IAIZ,MAAME,EAA0B,GAEhC,IAAK,MAAOC,EAAKC,KAAUC,OAAOC,QAAQzB,GACpCuB,EAAMrB,GAAGwB,KAAKf,IAAWU,EAAQM,KAAKL,GAG5CH,EAAUE,GAOV,IAJ0BA,EAAQO,MAAOF,GACvCd,EAAciB,SAASH,KAGCf,EAASmB,OAAShB,EAE1C,YADAE,EAAY,GAKd,MAAMe,EAAaP,OAAOC,QAAQzB,GAAgBgC,OAChD,CAACC,GAAMX,EAAKY,KACVb,EAAQQ,SAASP,GAAuBW,EAAMC,EAAM/B,MAAQ8B,EAC9D,GAEFjB,EAAYe,IACX,CAACpB,EAAUC,KAETC,EAAsB,MAAO,CAAEE,WAAUG,cAChD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentProps, CSSProperties } from "react";
|
|
2
|
-
export interface SkeletonProps extends ComponentProps<"
|
|
2
|
+
export interface SkeletonProps extends ComponentProps<"div"> {
|
|
3
3
|
type?: "text" | "card";
|
|
4
4
|
size?: "small" | "medium" | "large";
|
|
5
5
|
width?: CSSProperties["width"];
|
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import styles from './Skeleton.module.css.js';
|
|
3
|
-
import { cn } from '@studiocubics/utils';
|
|
4
|
-
|
|
5
|
-
function Skeleton(props) {
|
|
6
|
-
const { className, style, type = "text", size = "medium", width = "100%", height = "1.5em", ...rest } = props;
|
|
7
|
-
return (jsx("span", { className: cn(className, styles.root, styles[size], styles[type]), style: { width, height, ...style }, ...rest }));
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export { Skeleton };
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import e from"./Skeleton.module.css.js";import{cn as i}from"@studiocubics/utils";function s(s){const{className:o,style:m,type:r="text",size:c="medium",width:u="100%",height:l="1.5em",...d}=s;return t("div",{className:i(o,e.root,e[c],e[r]),style:{width:u,height:l,...m},...d})}export{s as Skeleton};
|
|
11
2
|
//# sourceMappingURL=Skeleton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Skeleton.js","sources":["../../../src/Display/Skeleton/Skeleton.tsx"],"sourcesContent":["import type { ComponentProps, CSSProperties } from \"react\";\nimport styles from \"./Skeleton.module.css\";\nimport { cn } from \"@studiocubics/utils\";\nexport interface SkeletonProps extends ComponentProps<\"
|
|
1
|
+
{"version":3,"file":"Skeleton.js","sources":["../../../src/Display/Skeleton/Skeleton.tsx"],"sourcesContent":["import type { ComponentProps, CSSProperties } from \"react\";\nimport styles from \"./Skeleton.module.css\";\nimport { cn } from \"@studiocubics/utils\";\nexport interface SkeletonProps extends ComponentProps<\"div\"> {\n type?: \"text\" | \"card\";\n size?: \"small\" | \"medium\" | \"large\";\n width?: CSSProperties[\"width\"];\n height?: CSSProperties[\"height\"];\n}\n\nexport function Skeleton(props: SkeletonProps) {\n const {\n className,\n style,\n type = \"text\",\n size = \"medium\",\n width = \"100%\",\n height = \"1.5em\",\n ...rest\n } = props;\n return (\n <div\n className={cn(className, styles.root, styles[size], styles[type])}\n style={{ width, height, ...style }}\n {...rest}\n ></div>\n );\n}\n"],"names":["Skeleton","props","className","style","type","size","width","height","rest","_jsx","cn","styles","root"],"mappings":"yHAUM,SAAUA,EAASC,GACvB,MAAMC,UACJA,EAASC,MACTA,EAAKC,KACLA,EAAO,OAAMC,KACbA,EAAO,SAAQC,MACfA,EAAQ,OAAMC,OACdA,EAAS,WACNC,GACDP,EACJ,OACEQ,EAAA,MAAA,CACEP,UAAWQ,EAAGR,EAAWS,EAAOC,KAAMD,EAAON,GAAOM,EAAOP,IAC3DD,MAAO,CAAEG,QAAOC,YAAWJ,MACvBK,GAGV"}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
export { styles as default };
|
|
1
|
+
var e={root:"Skeleton-module_root__Ft3Ey",throb:"Skeleton-module_throb__SxiMC",large:"Skeleton-module_large__LnDji",medium:"Skeleton-module_medium__LjhY7",small:"Skeleton-module_small__j9Re2",wave:"Skeleton-module_wave__mC2od"};export{e as default};
|
|
4
2
|
//# sourceMappingURL=Skeleton.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Skeleton.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Skeleton.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,45 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import { useState, useEffect } from 'react';
|
|
4
|
-
import { subscribe, dismiss } from './toast.js';
|
|
5
|
-
|
|
6
|
-
function Toaster() {
|
|
7
|
-
const [toasts, setToasts] = useState([]);
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
return () => {
|
|
10
|
-
subscribe(setToasts);
|
|
11
|
-
};
|
|
12
|
-
}, []);
|
|
13
|
-
if (toasts.length === 0)
|
|
14
|
-
return null;
|
|
15
|
-
return (jsx("div", { style: containerStyle, children: toasts.map((t) => (jsxs("div", { style: toastStyle, children: [jsx("span", { children: t.message }), jsx("button", { onClick: () => dismiss(t.id), style: closeStyle, children: "\u00D7" })] }, t.id))) }));
|
|
16
|
-
}
|
|
17
|
-
const containerStyle = {
|
|
18
|
-
position: "fixed",
|
|
19
|
-
top: 16,
|
|
20
|
-
right: 16,
|
|
21
|
-
display: "flex",
|
|
22
|
-
flexDirection: "column",
|
|
23
|
-
gap: 8,
|
|
24
|
-
zIndex: 1000,
|
|
25
|
-
};
|
|
26
|
-
const toastStyle = {
|
|
27
|
-
background: "#111",
|
|
28
|
-
color: "#fff",
|
|
29
|
-
padding: "12px 16px",
|
|
30
|
-
borderRadius: 6,
|
|
31
|
-
minWidth: 200,
|
|
32
|
-
display: "flex",
|
|
33
|
-
justifyContent: "space-between",
|
|
34
|
-
alignItems: "center",
|
|
35
|
-
};
|
|
36
|
-
const closeStyle = {
|
|
37
|
-
background: "transparent",
|
|
38
|
-
border: "none",
|
|
39
|
-
color: "#fff",
|
|
40
|
-
fontSize: 16,
|
|
41
|
-
cursor: "pointer",
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export { Toaster };
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useState as n,useEffect as r}from"react";import{subscribe as o,dismiss as i}from"./toast.js";import{Button as s}from"../../Inputs/Button/Button.js";function l(){const[l,a]=n([]);return r(()=>()=>{o(a)},[]),0===l.length?null:e("div",{style:c,children:l.map(n=>t("div",{style:d,children:[e("span",{children:n.message}),e(s,{square:!0,onClick:()=>i(n.id),style:p,children:"×"})]},n.id))})}const c={position:"fixed",top:16,right:16,display:"flex",flexDirection:"column",gap:8,zIndex:1e3},d={background:"#111",color:"#fff",padding:"12px 16px",borderRadius:6,minWidth:200,display:"flex",justifyContent:"space-between",alignItems:"center"},p={background:"transparent",border:"none",color:"#fff",fontSize:16,cursor:"pointer"};export{l as Toaster};
|
|
45
2
|
//# sourceMappingURL=Toaster.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toaster.js","sources":["../../../src/Display/Toast/Toaster.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { subscribe, dismiss, type Toast } from \"./toast\";\n\nexport function Toaster() {\n const [toasts, setToasts] = useState<Toast[]>([]);\n\n useEffect(() => {\n return () => {\n subscribe(setToasts);\n };\n }, []);\n\n if (toasts.length === 0) return null;\n\n return (\n <div style={containerStyle}>\n {toasts.map((t) => (\n <div key={t.id} style={toastStyle}>\n <span>{t.message}</span>\n <
|
|
1
|
+
{"version":3,"file":"Toaster.js","sources":["../../../src/Display/Toast/Toaster.tsx"],"sourcesContent":["\"use client\";\n// TODO complete toaster\nimport { useEffect, useState } from \"react\";\nimport { subscribe, dismiss, type Toast } from \"./toast\";\nimport { Button } from \"../../Inputs/Button/Button\";\n\nexport function Toaster() {\n const [toasts, setToasts] = useState<Toast[]>([]);\n\n useEffect(() => {\n return () => {\n subscribe(setToasts);\n };\n }, []);\n\n if (toasts.length === 0) return null;\n\n return (\n <div style={containerStyle}>\n {toasts.map((t) => (\n <div key={t.id} style={toastStyle}>\n <span>{t.message}</span>\n <Button square onClick={() => dismiss(t.id)} style={closeStyle}>\n ×\n </Button>\n </div>\n ))}\n </div>\n );\n}\n\nconst containerStyle: React.CSSProperties = {\n position: \"fixed\",\n top: 16,\n right: 16,\n display: \"flex\",\n flexDirection: \"column\",\n gap: 8,\n zIndex: 1000,\n};\n\nconst toastStyle: React.CSSProperties = {\n background: \"#111\",\n color: \"#fff\",\n padding: \"12px 16px\",\n borderRadius: 6,\n minWidth: 200,\n display: \"flex\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n};\n\nconst closeStyle: React.CSSProperties = {\n background: \"transparent\",\n border: \"none\",\n color: \"#fff\",\n fontSize: 16,\n cursor: \"pointer\",\n};\n"],"names":["Toaster","toasts","setToasts","useState","useEffect","subscribe","length","_jsx","style","containerStyle","children","map","t","_jsxs","toastStyle","message","Button","square","onClick","dismiss","id","closeStyle","position","top","right","display","flexDirection","gap","zIndex","background","color","padding","borderRadius","minWidth","justifyContent","alignItems","border","fontSize","cursor"],"mappings":"mOAMgBA,IACd,MAAOC,EAAQC,GAAaC,EAAkB,IAQ9C,OANAC,EAAU,IACD,KACLC,EAAUH,IAEX,IAEmB,IAAlBD,EAAOK,OAAqB,KAG9BC,EAAA,MAAA,CAAKC,MAAOC,EAAcC,SACvBT,EAAOU,IAAKC,GACXC,EAAA,MAAA,CAAgBL,MAAOM,EAAUJ,SAAA,CAC/BH,EAAA,OAAA,CAAAG,SAAOE,EAAEG,UACTR,EAACS,EAAM,CAACC,QAAM,EAACC,QAAS,IAAMC,EAAQP,EAAEQ,IAAKZ,MAAOa,EAAUX,SAAA,QAFtDE,EAAEQ,MASpB,CAEA,MAAMX,EAAsC,CAC1Ca,SAAU,QACVC,IAAK,GACLC,MAAO,GACPC,QAAS,OACTC,cAAe,SACfC,IAAK,EACLC,OAAQ,KAGJd,EAAkC,CACtCe,WAAY,OACZC,MAAO,OACPC,QAAS,YACTC,aAAc,EACdC,SAAU,IACVR,QAAS,OACTS,eAAgB,gBAChBC,WAAY,UAGRd,EAAkC,CACtCQ,WAAY,cACZO,OAAQ,OACRN,MAAO,OACPO,SAAU,GACVC,OAAQ"}
|
|
@@ -1,32 +1,2 @@
|
|
|
1
|
-
let
|
|
2
|
-
const listeners = new Set();
|
|
3
|
-
function emit() {
|
|
4
|
-
listeners.forEach((l) => l(toasts));
|
|
5
|
-
}
|
|
6
|
-
function subscribe(listener) {
|
|
7
|
-
listeners.add(listener);
|
|
8
|
-
return () => listeners.delete(listener);
|
|
9
|
-
}
|
|
10
|
-
function toast(message, options) {
|
|
11
|
-
const id = crypto.randomUUID();
|
|
12
|
-
const t = {
|
|
13
|
-
id,
|
|
14
|
-
message,
|
|
15
|
-
duration: options?.duration ?? 3000,
|
|
16
|
-
};
|
|
17
|
-
toasts = [...toasts, t];
|
|
18
|
-
emit();
|
|
19
|
-
// Its a toast not a lecture!
|
|
20
|
-
if (t.duration <= 20000) {
|
|
21
|
-
setTimeout(() => {
|
|
22
|
-
dismiss(id);
|
|
23
|
-
}, t.duration);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
function dismiss(id) {
|
|
27
|
-
toasts = toasts.filter((t) => t.id !== id);
|
|
28
|
-
emit();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export { dismiss, subscribe, toast };
|
|
1
|
+
let t=[];const n=new Set;function e(){n.forEach(n=>n(t))}function o(t){return n.add(t),()=>n.delete(t)}function i(n,o){const i=crypto.randomUUID(),d={id:i,message:n,duration:o?.duration??3e3};t=[...t,d],e(),d.duration<=2e4&&setTimeout(()=>{r(i)},d.duration)}function r(n){t=t.filter(t=>t.id!==n),e()}export{r as dismiss,o as subscribe,i as toast};
|
|
32
2
|
//# sourceMappingURL=toast.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast.js","sources":["../../../src/Display/Toast/toast.ts"],"sourcesContent":["export type Toast = {\n id: string;\n message: string;\n duration?: number;\n};\n\ntype Listener = (toasts: Toast[]) => void;\n\nlet toasts: Toast[] = [];\nconst listeners = new Set<Listener>();\n\nfunction emit() {\n listeners.forEach((l) => l(toasts));\n}\n\nexport function subscribe(listener: Listener) {\n listeners.add(listener);\n return () => listeners.delete(listener);\n}\n\nexport function toast(message: string, options?: { duration?: number }) {\n const id = crypto.randomUUID();\n\n const t: Required<Toast> = {\n id,\n message,\n duration: options?.duration ?? 3000,\n };\n\n toasts = [...toasts, t];\n emit();\n\n // Its a toast not a lecture!\n if (t.duration <= 20000) {\n setTimeout(() => {\n dismiss(id);\n }, t.duration);\n }\n}\n\nexport function dismiss(id: string) {\n toasts = toasts.filter((t) => t.id !== id);\n emit();\n}\n"],"names":[
|
|
1
|
+
{"version":3,"file":"toast.js","sources":["../../../src/Display/Toast/toast.ts"],"sourcesContent":["export type Toast = {\n id: string;\n message: string;\n duration?: number;\n};\n\ntype Listener = (toasts: Toast[]) => void;\n\nlet toasts: Toast[] = [];\nconst listeners = new Set<Listener>();\n\nfunction emit() {\n listeners.forEach((l) => l(toasts));\n}\n\nexport function subscribe(listener: Listener) {\n listeners.add(listener);\n return () => listeners.delete(listener);\n}\n\nexport function toast(message: string, options?: { duration?: number }) {\n const id = crypto.randomUUID();\n\n const t: Required<Toast> = {\n id,\n message,\n duration: options?.duration ?? 3000,\n };\n\n toasts = [...toasts, t];\n emit();\n\n // Its a toast not a lecture!\n if (t.duration <= 20000) {\n setTimeout(() => {\n dismiss(id);\n }, t.duration);\n }\n}\n\nexport function dismiss(id: string) {\n toasts = toasts.filter((t) => t.id !== id);\n emit();\n}\n"],"names":["toasts","listeners","Set","emit","forEach","l","subscribe","listener","add","delete","toast","message","options","id","crypto","randomUUID","t","duration","setTimeout","dismiss","filter"],"mappings":"AAQA,IAAIA,EAAkB,GACtB,MAAMC,EAAY,IAAIC,IAEtB,SAASC,IACPF,EAAUG,QAASC,GAAMA,EAAEL,GAC7B,CAEM,SAAUM,EAAUC,GAExB,OADAN,EAAUO,IAAID,GACP,IAAMN,EAAUQ,OAAOF,EAChC,CAEM,SAAUG,EAAMC,EAAiBC,GACrC,MAAMC,EAAKC,OAAOC,aAEZC,EAAqB,CACzBH,KACAF,UACAM,SAAUL,GAASK,UAAY,KAGjCjB,EAAS,IAAIA,EAAQgB,GACrBb,IAGIa,EAAEC,UAAY,KAChBC,WAAW,KACTC,EAAQN,IACPG,EAAEC,SAET,CAEM,SAAUE,EAAQN,GACtBb,EAASA,EAAOoB,OAAQJ,GAAMA,EAAEH,KAAOA,GACvCV,GACF"}
|
|
@@ -1,45 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useMemo, Children, useEffect, isValidElement, cloneElement } from 'react';
|
|
4
|
-
import { createPortal } from 'react-dom';
|
|
5
|
-
import { useTooltip } from './useTooltip.js';
|
|
6
|
-
import styles from './Tooltip.module.css.js';
|
|
7
|
-
import getArrowDirection from './getArrowDirection.js';
|
|
8
|
-
import { cn } from '@studiocubics/utils';
|
|
9
|
-
|
|
10
|
-
function Tooltip({ title, children, renderArrow = false, anchorOrigin, transformOrigin, margin, }) {
|
|
11
|
-
const options = useMemo(() => {
|
|
12
|
-
return {
|
|
13
|
-
anchorOrigin: anchorOrigin ?? "bottom center",
|
|
14
|
-
transformOrigin: transformOrigin ?? "top center",
|
|
15
|
-
margin: margin ?? 8,
|
|
16
|
-
};
|
|
17
|
-
}, [anchorOrigin, transformOrigin, margin]);
|
|
18
|
-
const { anchorRef, showTooltip, tooltipRef, position, updatePosition } = useTooltip(options);
|
|
19
|
-
const direction = renderArrow
|
|
20
|
-
? getArrowDirection(anchorOrigin ?? "bottom center", transformOrigin ?? "top center")
|
|
21
|
-
: null;
|
|
22
|
-
// Ensure only one child is passed
|
|
23
|
-
const child = Children.only(children);
|
|
24
|
-
const childWithRef = () => {
|
|
25
|
-
if (isValidElement(child))
|
|
26
|
-
return cloneElement(child, { ref: anchorRef });
|
|
27
|
-
else {
|
|
28
|
-
throw new Error("Children passed to Tooltip should be a valid react element");
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
if (showTooltip)
|
|
33
|
-
updatePosition();
|
|
34
|
-
}, [title, showTooltip, updatePosition]);
|
|
35
|
-
if (!title)
|
|
36
|
-
return child;
|
|
37
|
-
return (jsxs(Fragment, { children: [showTooltip &&
|
|
38
|
-
createPortal(jsx("div", { className: cn(styles.root, renderArrow && direction ? styles[`arrow-${direction}`] : ""), ref: tooltipRef, style: {
|
|
39
|
-
left: `${position.x}px`,
|
|
40
|
-
top: `${position.y}px`,
|
|
41
|
-
}, children: title }), document.body), childWithRef()] }));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export { Tooltip };
|
|
1
|
+
"use client";import{jsxs as r,Fragment as o,jsx as t}from"react/jsx-runtime";import{useMemo as e,Children as i,useEffect as n,isValidElement as m,cloneElement as c}from"react";import{createPortal as s}from"react-dom";import{useTooltip as l}from"./useTooltip.js";import p from"./Tooltip.module.css.js";import a from"./getArrowDirection.js";import{cn as f}from"@studiocubics/utils";function d({title:d,children:u,renderArrow:h=!1,anchorOrigin:g,transformOrigin:w,margin:b}){const x=e(()=>({anchorOrigin:g??"bottom center",transformOrigin:w??"top center",margin:b??8}),[g,w,b]),{anchorRef:j,showTooltip:y,tooltipRef:O,position:T,updatePosition:$}=l(x),v=h?a(g??"bottom center",w??"top center"):null,A=i.only(u);return n(()=>{y&&$()},[d,y,$]),d?r(o,{children:[y&&s(t("div",{className:f(p.root,h&&v?p[`arrow-${v}`]:""),ref:O,style:{left:`${T.x}px`,top:`${T.y}px`},children:d}),document.body),(()=>{if(m(A))return c(A,{ref:j});throw new Error("Children passed to Tooltip should be a valid react element")})()]}):A}export{d as Tooltip};
|
|
45
2
|
//# sourceMappingURL=Tooltip.js.map
|