@studiocubics/components 0.0.3 → 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.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.js +1 -74
- 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 +1 -1
- package/dist/Layout/Drawer/Drawer.js +1 -38
- package/dist/Layout/Drawer/Drawer.js.map +1 -1
- package/dist/Layout/Drawer/Drawer.module.css.js +1 -3
- package/dist/Layout/Drawer/Drawer.module.css.js.map +1 -1
- 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/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.js +1 -11
- 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 +5 -2
- 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 -2398
- package/dist/index.js +1 -64
- package/dist/index.js.map +1 -1
- package/package.json +6 -4
- package/rollup.config.js +0 -34
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
export { styles as default };
|
|
1
|
+
var e={root:"TextAreaInput-module_root__HtNc8",fullWidth:"TextAreaInput-module_fullWidth__TUiOx",inputWrapper:"TextAreaInput-module_inputWrapper__P-2Yf",input:"TextAreaInput-module_input__1xpZl",label:"TextAreaInput-module_label__Fgykg",disableResize:"TextAreaInput-module_disableResize__uaUnX",errored:"TextAreaInput-module_errored__HJAUZ"};export{e as default};
|
|
4
2
|
//# sourceMappingURL=TextAreaInput.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextAreaInput.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextAreaInput.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,23 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { cn } from '@studiocubics/utils';
|
|
4
|
-
import { useState, useEffect } from 'react';
|
|
5
|
-
import { useRipple, eventWithRipple } from '../../Misc/Ripple/Ripple.js';
|
|
6
|
-
import styles from './TextInput.module.css.js';
|
|
7
|
-
import { InputErrors } from '../../Display/InputErrors/InputErrors.js';
|
|
8
|
-
|
|
9
|
-
function TextInput(props) {
|
|
10
|
-
const { startIcon, endIcon, label, error, fullWidth, disableEndIconGutters = false, disableStartIconGutters = false, size = "md", inputSize, onTouchStart, onClick, onBlur, slotProps = {}, className: inputClass, ...inputProps } = props;
|
|
11
|
-
const { rippleElements, createRipple } = useRipple(slotProps.ripple);
|
|
12
|
-
const [isErrored, setIsErrored] = useState(error && !!error.length);
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
setIsErrored(error && !!error.length);
|
|
15
|
-
}, [error]);
|
|
16
|
-
return (jsxs("div", { ...slotProps.root, className: cn(slotProps.root?.className, styles.root, styles[`size_${size}`], fullWidth ? styles.fullWidth : undefined, isErrored ? styles.errored : undefined), children: [label && (jsx("label", { ...slotProps.label, htmlFor: props.id || label, className: cn(slotProps.label?.className, styles.label), children: label })), jsxs("div", { ...slotProps.inputWrapper, className: cn(slotProps.inputWrapper?.className, styles.inputWrapper), children: [startIcon && (jsx("span", { ...slotProps.startIcon, className: cn(styles.iconContainer, slotProps.startIcon?.className, disableStartIconGutters ? styles.disableGutters : undefined), children: startIcon })), jsx("input", { type: "text", className: cn(inputClass, styles.input), onTouchStart: eventWithRipple(createRipple, onTouchStart), onClick: eventWithRipple(createRipple, onClick), onBlur: (e) => {
|
|
17
|
-
setIsErrored(false);
|
|
18
|
-
onBlur?.(e);
|
|
19
|
-
}, size: inputSize, id: label, ...inputProps }), endIcon && (jsx("span", { ...slotProps.endIcon, className: cn(styles.iconContainer, slotProps.endIcon?.className, disableEndIconGutters ? styles.disableGutters : undefined), children: endIcon })), rippleElements] }), isErrored && (jsx(InputErrors, { ...slotProps.error, className: cn(slotProps.error?.className, styles.errorText), error: error }))] }));
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export { TextInput };
|
|
1
|
+
"use client";import{jsxs as r,jsx as e}from"react/jsx-runtime";import{cn as t}from"@studiocubics/utils";import{useState as s,useEffect as o}from"react";import{useRipple as l,eventWithRipple as a}from"../../Misc/Ripple/Ripple.js";import i from"./TextInput.module.css.js";import{InputErrors as n}from"../../Display/InputErrors/InputErrors.js";function c(c){const{startIcon:p,endIcon:m,label:d,error:u,fullWidth:N,disableEndIconGutters:h=!1,disableStartIconGutters:I=!1,size:b="md",inputSize:f,onTouchStart:v,onClick:x,onBlur:W,slotProps:j={},className:z,...C}=c,{rippleElements:E,createRipple:G}=l(j.ripple),[S,T]=s(u&&!!u.length);return o(()=>{T(u&&!!u.length)},[u]),r("div",{...j.root,className:t(j.root?.className,i.root,i[`size_${b}`],N?i.fullWidth:void 0,S?i.errored:void 0),children:[d&&e("label",{...j.label,htmlFor:c.id||d,className:t(j.label?.className,i.label),children:d}),r("div",{...j.inputWrapper,className:t(j.inputWrapper?.className,i.inputWrapper),children:[p&&e("span",{...j.startIcon,className:t(i.iconContainer,j.startIcon?.className,I?i.disableGutters:void 0),children:p}),e("input",{type:"text",className:t(z,i.input),onTouchStart:a(G,v),onClick:a(G,x),onBlur:r=>{T(!1),W?.(r)},size:f,id:d,...C}),m&&e("span",{...j.endIcon,className:t(i.iconContainer,j.endIcon?.className,h?i.disableGutters:void 0),children:m}),E]}),S&&e(n,{...j.error,className:t(j.error?.className,i.errorText),error:u})]})}export{c as TextInput};
|
|
23
2
|
//# sourceMappingURL=TextInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.js","sources":["../../../src/Inputs/TextInput/TextInput.tsx"],"sourcesContent":["\"use client\";\n\nimport { cn } from \"@studiocubics/utils\";\nimport {\n useEffect,\n useState,\n type ComponentProps,\n type ReactNode,\n} from \"react\";\nimport {\n eventWithRipple,\n useRipple,\n type UseRippleProps,\n} from \"../../Misc/Ripple/Ripple\";\nimport styles from \"./TextInput.module.css\";\nimport {\n InputErrors,\n type InputErrorsProps,\n} from \"../../Display/InputErrors/InputErrors\";\n\nexport interface TextInputProps extends Omit<ComponentProps<\"input\">, \"size\"> {\n startIcon?: ReactNode;\n endIcon?: ReactNode;\n label?: string;\n error?: string | string[];\n fullWidth?: boolean;\n /**\n * Use inputSize for <input size=\"10\"/>\n */\n size?: \"sm\" | \"md\" | \"lg\";\n inputSize?: ComponentProps<\"input\">[\"size\"];\n disableEndIconGutters?: boolean;\n disableStartIconGutters?: boolean;\n slotProps?: {\n ripple?: UseRippleProps;\n startIcon?: ComponentProps<\"span\">;\n endIcon?: ComponentProps<\"span\">;\n root?: ComponentProps<\"div\">;\n inputWrapper?: ComponentProps<\"div\">;\n label?: ComponentProps<\"label\">;\n error?: InputErrorsProps;\n };\n}\n\nexport function TextInput(props: TextInputProps) {\n const {\n startIcon,\n endIcon,\n label,\n error,\n fullWidth,\n disableEndIconGutters = false,\n disableStartIconGutters = false,\n size = \"md\",\n inputSize,\n onTouchStart,\n onClick,\n onBlur,\n slotProps = {},\n className: inputClass,\n ...inputProps\n } = props;\n const { rippleElements, createRipple } = useRipple(slotProps.ripple);\n const [isErrored, setIsErrored] = useState(error && !!error.length);\n\n useEffect(() => {\n setIsErrored(error && !!error.length);\n }, [error]);\n\n return (\n <div\n {...slotProps.root}\n className={cn(\n slotProps.root?.className,\n styles.root,\n styles[`size_${size}`],\n fullWidth ? styles.fullWidth : undefined,\n isErrored ? styles.errored : undefined\n )}\n >\n {label && (\n <label\n {...slotProps.label}\n htmlFor={props.id || label}\n className={cn(slotProps.label?.className, styles.label)}\n >\n {label}\n </label>\n )}\n <div\n {...slotProps.inputWrapper}\n className={cn(slotProps.inputWrapper?.className, styles.inputWrapper)}\n >\n {startIcon && (\n <span\n {...slotProps.startIcon}\n className={cn(\n styles.iconContainer,\n slotProps.startIcon?.className,\n disableStartIconGutters ? styles.disableGutters : undefined\n )}\n >\n {startIcon}\n </span>\n )}\n <input\n type=\"text\"\n className={cn(inputClass, styles.input)}\n onTouchStart={eventWithRipple(createRipple, onTouchStart)}\n onClick={eventWithRipple(createRipple, onClick)}\n onBlur={(e) => {\n setIsErrored(false);\n onBlur?.(e);\n }}\n size={inputSize}\n id={label}\n {...inputProps}\n />\n {endIcon && (\n <span\n {...slotProps.endIcon}\n className={cn(\n styles.iconContainer,\n slotProps.endIcon?.className,\n disableEndIconGutters ? styles.disableGutters : undefined\n )}\n >\n {endIcon}\n </span>\n )}\n {rippleElements}\n </div>\n {isErrored && (\n <InputErrors\n {...slotProps.error}\n className={cn(slotProps.error?.className, styles.errorText)}\n error={error}\n />\n )}\n </div>\n );\n}\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;AA4CM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAC,CAAA,CAAA,CAAA,CAAA,CAAqB,CAAA,CAAA;IAC7C,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,EACJ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CACT,OAAO,CAAA,CACP,CAAA,CAAA,CAAA,CAAA,CAAK,EACL,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA,CACL,SAAS,CAAA,CACT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAqB,GAAG,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA,CAC7B,uBAAuB,CAAA,CAAA,CAAG,CAAA,CAAA,CAAA,CAAA,CAAK,EA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CAAA,CAAA,CACG,CAAA;AAEV;;"}
|
|
1
|
+
{"version":3,"file":"TextInput.js","sources":["../../../src/Inputs/TextInput/TextInput.tsx"],"sourcesContent":["\"use client\";\n\nimport { cn } from \"@studiocubics/utils\";\nimport {\n useEffect,\n useState,\n type ComponentProps,\n type ReactNode,\n} from \"react\";\nimport {\n eventWithRipple,\n useRipple,\n type UseRippleProps,\n} from \"../../Misc/Ripple/Ripple\";\nimport styles from \"./TextInput.module.css\";\nimport {\n InputErrors,\n type InputErrorsProps,\n} from \"../../Display/InputErrors/InputErrors\";\n\nexport interface TextInputProps extends Omit<ComponentProps<\"input\">, \"size\"> {\n startIcon?: ReactNode;\n endIcon?: ReactNode;\n label?: string;\n error?: string | string[];\n fullWidth?: boolean;\n /**\n * Use inputSize for <input size=\"10\"/>\n */\n size?: \"sm\" | \"md\" | \"lg\";\n inputSize?: ComponentProps<\"input\">[\"size\"];\n disableEndIconGutters?: boolean;\n disableStartIconGutters?: boolean;\n slotProps?: {\n ripple?: UseRippleProps;\n startIcon?: ComponentProps<\"span\">;\n endIcon?: ComponentProps<\"span\">;\n root?: ComponentProps<\"div\">;\n inputWrapper?: ComponentProps<\"div\">;\n label?: ComponentProps<\"label\">;\n error?: InputErrorsProps;\n };\n}\n\nexport function TextInput(props: TextInputProps) {\n const {\n startIcon,\n endIcon,\n label,\n error,\n fullWidth,\n disableEndIconGutters = false,\n disableStartIconGutters = false,\n size = \"md\",\n inputSize,\n onTouchStart,\n onClick,\n onBlur,\n slotProps = {},\n className: inputClass,\n ...inputProps\n } = props;\n const { rippleElements, createRipple } = useRipple(slotProps.ripple);\n const [isErrored, setIsErrored] = useState(error && !!error.length);\n\n useEffect(() => {\n setIsErrored(error && !!error.length);\n }, [error]);\n\n return (\n <div\n {...slotProps.root}\n className={cn(\n slotProps.root?.className,\n styles.root,\n styles[`size_${size}`],\n fullWidth ? styles.fullWidth : undefined,\n isErrored ? styles.errored : undefined\n )}\n >\n {label && (\n <label\n {...slotProps.label}\n htmlFor={props.id || label}\n className={cn(slotProps.label?.className, styles.label)}\n >\n {label}\n </label>\n )}\n <div\n {...slotProps.inputWrapper}\n className={cn(slotProps.inputWrapper?.className, styles.inputWrapper)}\n >\n {startIcon && (\n <span\n {...slotProps.startIcon}\n className={cn(\n styles.iconContainer,\n slotProps.startIcon?.className,\n disableStartIconGutters ? styles.disableGutters : undefined\n )}\n >\n {startIcon}\n </span>\n )}\n <input\n type=\"text\"\n className={cn(inputClass, styles.input)}\n onTouchStart={eventWithRipple(createRipple, onTouchStart)}\n onClick={eventWithRipple(createRipple, onClick)}\n onBlur={(e) => {\n setIsErrored(false);\n onBlur?.(e);\n }}\n size={inputSize}\n id={label}\n {...inputProps}\n />\n {endIcon && (\n <span\n {...slotProps.endIcon}\n className={cn(\n styles.iconContainer,\n slotProps.endIcon?.className,\n disableEndIconGutters ? styles.disableGutters : undefined\n )}\n >\n {endIcon}\n </span>\n )}\n {rippleElements}\n </div>\n {isErrored && (\n <InputErrors\n {...slotProps.error}\n className={cn(slotProps.error?.className, styles.errorText)}\n error={error}\n />\n )}\n </div>\n );\n}\n"],"names":["TextInput","props","startIcon","endIcon","label","error","fullWidth","disableEndIconGutters","disableStartIconGutters","size","inputSize","onTouchStart","onClick","onBlur","slotProps","className","inputClass","inputProps","rippleElements","createRipple","useRipple","ripple","isErrored","setIsErrored","useState","length","useEffect","_jsxs","root","cn","styles","undefined","errored","children","_jsx","htmlFor","id","inputWrapper","iconContainer","disableGutters","type","input","eventWithRipple","e","InputErrors","errorText"],"mappings":"qVA4CM,SAAUA,EAAUC,GACxB,MAAMC,UACJA,EAASC,QACTA,EAAOC,MACPA,EAAKC,MACLA,EAAKC,UACLA,EAASC,sBACTA,GAAwB,EAAKC,wBAC7BA,GAA0B,EAAKC,KAC/BA,EAAO,KAAIC,UACXA,EAASC,aACTA,EAAYC,QACZA,EAAOC,OACPA,EAAMC,UACNA,EAAY,GACZC,UAAWC,KACRC,GACDhB,GACEiB,eAAEA,EAAcC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as default };
|
|
1
|
+
var e={root:"TextInput-module_root__PFCcK",fullWidth:"TextInput-module_fullWidth__AT0dl",inputWrapper:"TextInput-module_inputWrapper__SJTji",input:"TextInput-module_input__I-YSj",label:"TextInput-module_label__AVOE4",iconContainer:"TextInput-module_iconContainer__Mkob8",disableGutters:"TextInput-module_disableGutters__zleWJ",errored:"TextInput-module_errored__OtcwB",size_sm:"TextInput-module_size_sm__5Y5wE",size_md:"TextInput-module_size_md__ngwcL",size_lg:"TextInput-module_size_lg__vFWvg"};export{e as default};
|
|
4
2
|
//# sourceMappingURL=TextInput.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextInput.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,31 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useAnchorElement } from '@studiocubics/hooks';
|
|
3
|
-
import { ListItem, List } from '../../Display/List/List.js';
|
|
4
|
-
import { Popover } from '../../Layout/Popover/Popover.js';
|
|
5
|
-
|
|
6
|
-
function ThemeToggleListItem(props) {
|
|
7
|
-
const { currentTheme, themeObject = {}, slotProps = {}, ...rest } = props;
|
|
8
|
-
const { open, anchorEl, handleClick, handleClose } = useAnchorElement();
|
|
9
|
-
const { popover = {}, ...listItemSlotProps } = slotProps;
|
|
10
|
-
const sanitisedThemeObject = {
|
|
11
|
-
dark: {
|
|
12
|
-
text: "Dark Mode",
|
|
13
|
-
icon: jsx(Fragment, { children: "\uD83C\uDF1A" }),
|
|
14
|
-
onClick: (e) => {
|
|
15
|
-
if (themeObject.dark?.onClick)
|
|
16
|
-
themeObject.dark?.onClick(e);
|
|
17
|
-
if (open)
|
|
18
|
-
handleClose();
|
|
19
|
-
else
|
|
20
|
-
handleClick(e);
|
|
21
|
-
},
|
|
22
|
-
...themeObject.dark,
|
|
23
|
-
},
|
|
24
|
-
light: { text: "Light Mode", icon: jsx(Fragment, { children: "\uD83C\uDF1E" }), ...themeObject.light },
|
|
25
|
-
system: { text: "System Color", icon: jsx(Fragment, { children: "\uD83D\uDCBB" }), ...themeObject.system },
|
|
26
|
-
};
|
|
27
|
-
return (jsxs(Fragment, { children: [jsx(ListItem, { slotProps: listItemSlotProps, startIcon: sanitisedThemeObject[currentTheme].icon, onClick: open ? handleClose : handleClick, ...rest, children: sanitisedThemeObject[currentTheme].text }), jsx(Popover, { open: open, anchorEl: anchorEl, onClose: handleClose, anchorPosition: { vertical: "top", horizontal: "right" }, transformOrigin: { vertical: "bottom", horizontal: "left" }, ...slotProps.popover, children: jsx(List, { className: "surfaceContainer", children: Object.entries(sanitisedThemeObject).map(([key, value]) => (jsx(ListItem, { selected: currentTheme == key, startIcon: value.icon, onClick: value.onClick, children: value.text }, key))) }) })] }));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export { ThemeToggleListItem };
|
|
1
|
+
import{jsx as o,Fragment as t,jsxs as r}from"react/jsx-runtime";import{useAnchorElement as e}from"@studiocubics/hooks";import{ListItem as i,List as n}from"../../Display/List/List.js";import{Popover as c}from"../../Layout/Popover/Popover.js";function l(l){const{currentTheme:s,themeObject:a={},slotProps:h={},...d}=l,{open:m,anchorEl:p,handleClick:k,handleClose:C}=e(),{popover:f={},...u}=h,x={dark:{text:"Dark Mode",icon:o(t,{children:"🌚"}),onClick:o=>{a.dark?.onClick&&a.dark?.onClick(o),m?C():k(o)},...a.dark},light:{text:"Light Mode",icon:o(t,{children:"🌞"}),...a.light},system:{text:"System Color",icon:o(t,{children:"💻"}),...a.system}};return r(t,{children:[o(i,{slotProps:u,startIcon:x[s].icon,onClick:m?C:k,...d,children:x[s].text}),o(c,{open:m,anchorEl:p,onClose:C,anchorPosition:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"left"},...h.popover,children:o(n,{className:"surfaceContainer",children:Object.entries(x).map(([t,r])=>o(i,{selected:s==t,startIcon:r.icon,onClick:r.onClick,children:r.text},t))})})]})}export{l as ThemeToggleListItem};
|
|
31
2
|
//# sourceMappingURL=ThemeToggleListItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeToggleListItem.js","sources":["../../../src/Inputs/ThemeToggle/ThemeToggleListItem.tsx"],"sourcesContent":["import { useAnchorElement } from \"@studiocubics/hooks\";\nimport {\n List,\n type ListItemProps,\n ListItem,\n} from \"../../Display/List/List\";\nimport { type PopoverProps, Popover } from \"../../Layout/Popover/Popover\";\nimport type { MouseEvent, ReactNode } from \"react\";\n\nexport type ThemeObject = Record<\n \"dark\" | \"light\" | \"system\",\n {\n text?: string;\n icon?: ReactNode;\n onClick?: (e: MouseEvent<HTMLElement>) => void;\n }\n>;\n\nexport interface ThemeToggleListItemProps\n extends Omit<ListItemProps, \"slotProps\"> {\n themeObject?: Partial<ThemeObject>;\n currentTheme: keyof ThemeObject;\n slotProps?: ListItemProps[\"slotProps\"] & {\n popover?: PopoverProps;\n };\n}\n\nexport function ThemeToggleListItem(props: ThemeToggleListItemProps) {\n const { currentTheme, themeObject = {}, slotProps = {}, ...rest } = props;\n const { open, anchorEl, handleClick, handleClose } = useAnchorElement();\n const { popover = {}, ...listItemSlotProps } = slotProps;\n const sanitisedThemeObject: ThemeObject = {\n dark: {\n text: \"Dark Mode\",\n icon: <>🌚</>,\n onClick: (e) => {\n if (themeObject.dark?.onClick) themeObject.dark?.onClick(e);\n if (open) handleClose();\n else handleClick(e);\n },\n ...themeObject.dark,\n },\n light: { text: \"Light Mode\", icon: <>🌞</>, ...themeObject.light },\n system: { text: \"System Color\", icon: <>💻</>, ...themeObject.system },\n };\n\n return (\n <>\n <ListItem\n slotProps={listItemSlotProps}\n startIcon={sanitisedThemeObject[currentTheme].icon}\n onClick={open ? handleClose : handleClick}\n {...rest}\n >\n {sanitisedThemeObject[currentTheme].text}\n </ListItem>\n <Popover\n open={open}\n anchorEl={anchorEl}\n onClose={handleClose}\n anchorPosition={{ vertical: \"top\", horizontal: \"right\" }}\n transformOrigin={{ vertical: \"bottom\", horizontal: \"left\" }}\n {...slotProps.popover}\n >\n <List className={\"surfaceContainer\"}>\n {Object.entries(sanitisedThemeObject).map(([key, value]) => (\n <ListItem\n selected={currentTheme == key}\n startIcon={value.icon}\n key={key}\n onClick={value.onClick}\n >\n {value.text}\n </ListItem>\n ))}\n </List>\n </Popover>\n </>\n );\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"ThemeToggleListItem.js","sources":["../../../src/Inputs/ThemeToggle/ThemeToggleListItem.tsx"],"sourcesContent":["import { useAnchorElement } from \"@studiocubics/hooks\";\nimport {\n List,\n type ListItemProps,\n ListItem,\n} from \"../../Display/List/List\";\nimport { type PopoverProps, Popover } from \"../../Layout/Popover/Popover\";\nimport type { MouseEvent, ReactNode } from \"react\";\n\nexport type ThemeObject = Record<\n \"dark\" | \"light\" | \"system\",\n {\n text?: string;\n icon?: ReactNode;\n onClick?: (e: MouseEvent<HTMLElement>) => void;\n }\n>;\n\nexport interface ThemeToggleListItemProps\n extends Omit<ListItemProps, \"slotProps\"> {\n themeObject?: Partial<ThemeObject>;\n currentTheme: keyof ThemeObject;\n slotProps?: ListItemProps[\"slotProps\"] & {\n popover?: PopoverProps;\n };\n}\n\nexport function ThemeToggleListItem(props: ThemeToggleListItemProps) {\n const { currentTheme, themeObject = {}, slotProps = {}, ...rest } = props;\n const { open, anchorEl, handleClick, handleClose } = useAnchorElement();\n const { popover = {}, ...listItemSlotProps } = slotProps;\n const sanitisedThemeObject: ThemeObject = {\n dark: {\n text: \"Dark Mode\",\n icon: <>🌚</>,\n onClick: (e) => {\n if (themeObject.dark?.onClick) themeObject.dark?.onClick(e);\n if (open) handleClose();\n else handleClick(e);\n },\n ...themeObject.dark,\n },\n light: { text: \"Light Mode\", icon: <>🌞</>, ...themeObject.light },\n system: { text: \"System Color\", icon: <>💻</>, ...themeObject.system },\n };\n\n return (\n <>\n <ListItem\n slotProps={listItemSlotProps}\n startIcon={sanitisedThemeObject[currentTheme].icon}\n onClick={open ? handleClose : handleClick}\n {...rest}\n >\n {sanitisedThemeObject[currentTheme].text}\n </ListItem>\n <Popover\n open={open}\n anchorEl={anchorEl}\n onClose={handleClose}\n anchorPosition={{ vertical: \"top\", horizontal: \"right\" }}\n transformOrigin={{ vertical: \"bottom\", horizontal: \"left\" }}\n {...slotProps.popover}\n >\n <List className={\"surfaceContainer\"}>\n {Object.entries(sanitisedThemeObject).map(([key, value]) => (\n <ListItem\n selected={currentTheme == key}\n startIcon={value.icon}\n key={key}\n onClick={value.onClick}\n >\n {value.text}\n </ListItem>\n ))}\n </List>\n </Popover>\n </>\n );\n}\n"],"names":["ThemeToggleListItem","props","currentTheme","themeObject","slotProps","rest","open","anchorEl","handleClick","handleClose","useAnchorElement","popover","listItemSlotProps","sanitisedThemeObject","dark","text","icon","_jsx","_Fragment","children","onClick","e","light","system","_jsxs","ListItem","startIcon","Popover","onClose","anchorPosition","vertical","horizontal","transformOrigin","List","className","Object","entries","map","key","value","selected"],"mappings":"iPA2BM,SAAUA,EAAoBC,GAClC,MAAMC,aAAEA,EAAYC,YAAEA,EAAc,CAAA,EAAEC,UAAEA,EAAY,MAAOC,GAASJ,GAC9DK,KAAEA,EAAIC,SAAEA,EAAQC,YAAEA,EAAWC,YAAEA,GAAgBC,KAC/CC,QAAEA,EAAU,CAAA,KAAOC,GAAsBR,EACzCS,EAAoC,CACxCC,KAAM,CACJC,KAAM,YACNC,KAAMC,EAAAC,EAAA,CAAAC,SAAA,OACNC,QAAUC,IACJlB,EAAYW,MAAMM,SAASjB,EAAYW,MAAMM,QAAQC,GACrDf,EAAMG,IACLD,EAAYa,OAEhBlB,EAAYW,MAEjBQ,MAAO,CAAEP,KAAM,aAAcC,KAAMC,EAAAC,EAAA,CAAAC,SAAA,UAAYhB,EAAYmB,OAC3DC,OAAQ,CAAER,KAAM,eAAgBC,KAAMC,EAAAC,EAAA,CAAAC,SAAA,UAAYhB,EAAYoB,SAGhE,OACEC,EAAAN,EAAA,CAAAC,SAAA,CACEF,EAACQ,GACCrB,UAAWQ,EACXc,UAAWb,EAAqBX,GAAcc,KAC9CI,QAASd,EAAOG,EAAcD,KAC1BH,WAEHQ,EAAqBX,GAAca,OAEtCE,EAACU,EAAO,CACNrB,KAAMA,EACNC,SAAUA,EACVqB,QAASnB,EACToB,eAAgB,CAAEC,SAAU,MAAOC,WAAY,SAC/CC,gBAAiB,CAAEF,SAAU,SAAUC,WAAY,WAC/C3B,EAAUO,QAAOQ,SAErBF,EAACgB,EAAI,CAACC,UAAW,mBAAkBf,SAChCgB,OAAOC,QAAQvB,GAAsBwB,IAAI,EAAEC,EAAKC,KAC/CtB,EAACQ,EAAQ,CACPe,SAAUtC,GAAgBoC,EAC1BZ,UAAWa,EAAMvB,KAEjBI,QAASmB,EAAMnB,QAAOD,SAErBoB,EAAMxB,MAHFuB,UAUnB"}
|
|
@@ -1,75 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useRef, useState, useEffect } from 'react';
|
|
4
|
-
import ReactDOM from 'react-dom';
|
|
5
|
-
import styles from './Dialog.module.css.js';
|
|
6
|
-
import { cn } from '@studiocubics/utils';
|
|
7
|
-
|
|
8
|
-
function Dialog({ open, onClose, children, fullWidth = false, fullScreen = false, disablePortal = false, className = "", style, ...rest }) {
|
|
9
|
-
const dialogRef = useRef(null);
|
|
10
|
-
const [mounted, setMounted] = useState(false);
|
|
11
|
-
// Only mark as mounted on client
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
setMounted(true);
|
|
14
|
-
}, []);
|
|
15
|
-
// Show or close dialog using native API
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
if (!mounted)
|
|
18
|
-
return;
|
|
19
|
-
const dialog = dialogRef.current;
|
|
20
|
-
if (!dialog)
|
|
21
|
-
return;
|
|
22
|
-
if (open && !dialog.open) {
|
|
23
|
-
dialog.showModal();
|
|
24
|
-
}
|
|
25
|
-
else if (!open && dialog.open) {
|
|
26
|
-
dialog.close();
|
|
27
|
-
}
|
|
28
|
-
}, [open, mounted]);
|
|
29
|
-
// Close handlers
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
if (!mounted)
|
|
32
|
-
return;
|
|
33
|
-
const dialog = dialogRef.current;
|
|
34
|
-
if (!dialog)
|
|
35
|
-
return;
|
|
36
|
-
function handleCancel(e) {
|
|
37
|
-
e.preventDefault();
|
|
38
|
-
onClose(e, "escapeKeyDown");
|
|
39
|
-
}
|
|
40
|
-
function handleClick(e) {
|
|
41
|
-
if (!dialog)
|
|
42
|
-
return;
|
|
43
|
-
const rect = dialog.getBoundingClientRect();
|
|
44
|
-
const isInDialog = rect.top <= e.clientY &&
|
|
45
|
-
e.clientY <= rect.top + rect.height &&
|
|
46
|
-
rect.left <= e.clientX &&
|
|
47
|
-
e.clientX <= rect.left + rect.width;
|
|
48
|
-
if (!isInDialog) {
|
|
49
|
-
onClose(e, "backdropClick");
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
dialog.addEventListener("cancel", handleCancel);
|
|
53
|
-
dialog.addEventListener("click", handleClick);
|
|
54
|
-
return () => {
|
|
55
|
-
dialog.removeEventListener("cancel", handleCancel);
|
|
56
|
-
dialog.removeEventListener("click", handleClick);
|
|
57
|
-
};
|
|
58
|
-
}, [onClose, mounted]);
|
|
59
|
-
const dialogContent = (jsx("dialog", { ...rest, ref: dialogRef, style: {
|
|
60
|
-
width: fullWidth || fullScreen ? "100%" : undefined,
|
|
61
|
-
height: fullScreen ? "100%" : undefined,
|
|
62
|
-
...style,
|
|
63
|
-
}, className: cn(className, styles.root), children: children }));
|
|
64
|
-
// Only render portal on client
|
|
65
|
-
if (!mounted)
|
|
66
|
-
return null;
|
|
67
|
-
if (!open)
|
|
68
|
-
return null;
|
|
69
|
-
if (disablePortal)
|
|
70
|
-
return dialogContent;
|
|
71
|
-
return ReactDOM.createPortal(dialogContent, document.body);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export { Dialog };
|
|
1
|
+
"use client";import{jsx as e}from"react/jsx-runtime";import{useRef as t,useState as n,useEffect as o}from"react";import r from"react-dom";import i from"./Dialog.module.css.js";import{cn as c}from"@studiocubics/utils";function l({open:l,onClose:s,children:u,fullWidth:a=!1,fullScreen:d=!1,disablePortal:f=!1,className:m="",style:p,...h}){const v=t(null),[g,b]=n(!1);o(()=>{b(!0)},[]),o(()=>{if(!g)return;const e=v.current;e&&(l&&!e.open?e.showModal():!l&&e.open&&e.close())},[l,g]),o(()=>{if(!g)return;const e=v.current;if(e)return e.addEventListener("cancel",t),e.addEventListener("click",n),()=>{e.removeEventListener("cancel",t),e.removeEventListener("click",n)};function t(e){e.preventDefault(),s(e,"escapeKeyDown")}function n(t){if(!e)return;const n=e.getBoundingClientRect();n.top<=t.clientY&&t.clientY<=n.top+n.height&&n.left<=t.clientX&&t.clientX<=n.left+n.width||s(t,"backdropClick")}},[s,g]);const k=e("dialog",{...h,ref:v,style:{width:a||d?"100%":void 0,height:d?"100%":void 0,...p},className:c(m,i.root),children:u});return g&&l?f?k:r.createPortal(k,document.body):null}export{l as Dialog};
|
|
75
2
|
//# sourceMappingURL=Dialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","sources":["../../../src/Layout/Dialog/Dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ComponentProps,\n type ReactNode,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport ReactDOM from \"react-dom\";\nimport styles from \"./Dialog.module.css\";\nimport { cn } from \"@studiocubics/utils\";\n\nexport type CloseReason = \"backdropClick\" | \"escapeKeyDown\";\n\ntype OmittedProps = \"onClose\" | \"onCancel\";\n\nexport interface DialogProps\n extends Omit<ComponentProps<\"dialog\">, OmittedProps> {\n open: boolean;\n onClose: (event: Event | MouseEvent, reason: CloseReason) => void;\n children?: ReactNode;\n fullWidth?: boolean;\n fullScreen?: boolean;\n disablePortal?: boolean;\n}\n\nexport function Dialog({\n open,\n onClose,\n children,\n fullWidth = false,\n fullScreen = false,\n disablePortal = false,\n className = \"\",\n style,\n ...rest\n}: DialogProps) {\n const dialogRef = useRef<HTMLDialogElement>(null);\n const [mounted, setMounted] = useState(false);\n // Only mark as mounted on client\n useEffect(() => {\n setMounted(true);\n }, []);\n\n // Show or close dialog using native API\n useEffect(() => {\n if (!mounted) return;\n\n const dialog = dialogRef.current;\n if (!dialog) return;\n\n if (open && !dialog.open) {\n dialog.showModal();\n } else if (!open && dialog.open) {\n dialog.close();\n }\n }, [open, mounted]);\n\n // Close handlers\n useEffect(() => {\n if (!mounted) return;\n\n const dialog = dialogRef.current;\n if (!dialog) return;\n\n function handleCancel(e: Event) {\n e.preventDefault();\n onClose(e, \"escapeKeyDown\");\n }\n\n function handleClick(e: MouseEvent) {\n if (!dialog) return;\n const rect = dialog.getBoundingClientRect();\n const isInDialog =\n rect.top <= e.clientY &&\n e.clientY <= rect.top + rect.height &&\n rect.left <= e.clientX &&\n e.clientX <= rect.left + rect.width;\n\n if (!isInDialog) {\n onClose(e, \"backdropClick\");\n }\n }\n\n dialog.addEventListener(\"cancel\", handleCancel);\n dialog.addEventListener(\"click\", handleClick);\n\n return () => {\n dialog.removeEventListener(\"cancel\", handleCancel);\n dialog.removeEventListener(\"click\", handleClick);\n };\n }, [onClose, mounted]);\n\n const dialogContent = (\n <dialog\n {...rest}\n ref={dialogRef}\n style={{\n width: fullWidth || fullScreen ? \"100%\" : undefined,\n height: fullScreen ? \"100%\" : undefined,\n ...style,\n }}\n className={cn(className, styles.root)}\n >\n {children}\n </dialog>\n );\n\n // Only render portal on client\n if (!mounted) return null;\n if (!open) return null;\n\n if (disablePortal) return dialogContent;\n\n return ReactDOM.createPortal(dialogContent, document.body);\n}\n"],"names":["_jsx"],"mappings":";;;;;;;AA2BM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAA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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa;AAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,OAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa;IAEvC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,CAAC,aAAa,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAC,CAAA,CAAA,CAAA,CAAI,CAAC;AAC5D;;"}
|
|
1
|
+
{"version":3,"file":"Dialog.js","sources":["../../../src/Layout/Dialog/Dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ComponentProps,\n type ReactNode,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport ReactDOM from \"react-dom\";\nimport styles from \"./Dialog.module.css\";\nimport { cn } from \"@studiocubics/utils\";\n\nexport type CloseReason = \"backdropClick\" | \"escapeKeyDown\";\n\ntype OmittedProps = \"onClose\" | \"onCancel\";\n\nexport interface DialogProps\n extends Omit<ComponentProps<\"dialog\">, OmittedProps> {\n open: boolean;\n onClose: (event: Event | MouseEvent, reason: CloseReason) => void;\n children?: ReactNode;\n fullWidth?: boolean;\n fullScreen?: boolean;\n disablePortal?: boolean;\n}\n\nexport function Dialog({\n open,\n onClose,\n children,\n fullWidth = false,\n fullScreen = false,\n disablePortal = false,\n className = \"\",\n style,\n ...rest\n}: DialogProps) {\n const dialogRef = useRef<HTMLDialogElement>(null);\n const [mounted, setMounted] = useState(false);\n // Only mark as mounted on client\n useEffect(() => {\n setMounted(true);\n }, []);\n\n // Show or close dialog using native API\n useEffect(() => {\n if (!mounted) return;\n\n const dialog = dialogRef.current;\n if (!dialog) return;\n\n if (open && !dialog.open) {\n dialog.showModal();\n } else if (!open && dialog.open) {\n dialog.close();\n }\n }, [open, mounted]);\n\n // Close handlers\n useEffect(() => {\n if (!mounted) return;\n\n const dialog = dialogRef.current;\n if (!dialog) return;\n\n function handleCancel(e: Event) {\n e.preventDefault();\n onClose(e, \"escapeKeyDown\");\n }\n\n function handleClick(e: MouseEvent) {\n if (!dialog) return;\n const rect = dialog.getBoundingClientRect();\n const isInDialog =\n rect.top <= e.clientY &&\n e.clientY <= rect.top + rect.height &&\n rect.left <= e.clientX &&\n e.clientX <= rect.left + rect.width;\n\n if (!isInDialog) {\n onClose(e, \"backdropClick\");\n }\n }\n\n dialog.addEventListener(\"cancel\", handleCancel);\n dialog.addEventListener(\"click\", handleClick);\n\n return () => {\n dialog.removeEventListener(\"cancel\", handleCancel);\n dialog.removeEventListener(\"click\", handleClick);\n };\n }, [onClose, mounted]);\n\n const dialogContent = (\n <dialog\n {...rest}\n ref={dialogRef}\n style={{\n width: fullWidth || fullScreen ? \"100%\" : undefined,\n height: fullScreen ? \"100%\" : undefined,\n ...style,\n }}\n className={cn(className, styles.root)}\n >\n {children}\n </dialog>\n );\n\n // Only render portal on client\n if (!mounted) return null;\n if (!open) return null;\n\n if (disablePortal) return dialogContent;\n\n return ReactDOM.createPortal(dialogContent, document.body);\n}\n"],"names":["Dialog","open","onClose","children","fullWidth","fullScreen","disablePortal","className","style","rest","dialogRef","useRef","mounted","setMounted","useState","useEffect","dialog","current","showModal","close","addEventListener","handleCancel","handleClick","removeEventListener","e","preventDefault","rect","getBoundingClientRect","top","clientY","height","left","clientX","width","dialogContent","_jsx","ref","undefined","cn","styles","root","ReactDOM","createPortal","document","body"],"mappings":"yNA2BM,SAAUA,GAAOC,KACrBA,EAAIC,QACJA,EAAOC,SACPA,EAAQC,UACRA,GAAY,EAAKC,WACjBA,GAAa,EAAKC,cAClBA,GAAgB,EAAKC,UACrBA,EAAY,GAAEC,MACdA,KACGC,IAEH,MAAMC,EAAYC,EAA0B,OACrCC,EAASC,GAAcC,GAAS,GAEvCC,EAAU,KACRF,GAAW,IACV,IAGHE,EAAU,KACR,IAAKH,EAAS,OAEd,MAAMI,EAASN,EAAUO,QACpBD,IAEDf,IAASe,EAAOf,KAClBe,EAAOE,aACGjB,GAAQe,EAAOf,MACzBe,EAAOG,UAER,CAAClB,EAAMW,IAGVG,EAAU,KACR,IAAKH,EAAS,OAEd,MAAMI,EAASN,EAAUO,QACzB,GAAKD,EAwBL,OAHAA,EAAOI,iBAAiB,SAAUC,GAClCL,EAAOI,iBAAiB,QAASE,GAE1B,KACLN,EAAOO,oBAAoB,SAAUF,GACrCL,EAAOO,oBAAoB,QAASD,IAxBtC,SAASD,EAAaG,GACpBA,EAAEC,iBACFvB,EAAQsB,EAAG,gBACb,CAEA,SAASF,EAAYE,GACnB,IAAKR,EAAQ,OACb,MAAMU,EAAOV,EAAOW,wBAElBD,EAAKE,KAAOJ,EAAEK,SACdL,EAAEK,SAAWH,EAAKE,IAAMF,EAAKI,QAC7BJ,EAAKK,MAAQP,EAAEQ,SACfR,EAAEQ,SAAWN,EAAKK,KAAOL,EAAKO,OAG9B/B,EAAQsB,EAAG,gBAEf,GASC,CAACtB,EAASU,IAEb,MAAMsB,EACJC,EAAA,SAAA,IACM1B,EACJ2B,IAAK1B,EACLF,MAAO,CACLyB,MAAO7B,GAAaC,EAAa,YAASgC,EAC1CP,OAAQzB,EAAa,YAASgC,KAC3B7B,GAELD,UAAW+B,EAAG/B,EAAWgC,EAAOC,MAAKrC,SAEpCA,IAKL,OAAKS,GACAX,EAEDK,EAAsB4B,EAEnBO,EAASC,aAAaR,EAAeS,SAASC,MALhC,IAMvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Dialog.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ButtonProps } from "../../Inputs/_index";
|
|
2
|
-
import { type DialogProps } from "
|
|
2
|
+
import { type DialogProps } from "../../Layout/Dialog/Dialog";
|
|
3
3
|
export interface DrawerProps extends Omit<DialogProps, "open" | "onClose"> {
|
|
4
4
|
/**
|
|
5
5
|
* @default "right"
|
|
@@ -1,39 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useDisclosure } from '@studiocubics/hooks';
|
|
3
|
-
import { Button } from '../../Inputs/Button/Button.js';
|
|
4
|
-
import 'react';
|
|
5
|
-
import '../../Inputs/Checkbox/CheckboxGroup/CheckboxGroup.js';
|
|
6
|
-
import { cn } from '@studiocubics/utils';
|
|
7
|
-
import '../../Display/InputErrors/InputErrors.js';
|
|
8
|
-
import '../../Display/Accordion/Accordion.js';
|
|
9
|
-
import '../../Cards/GlassCard/GlassCard.js';
|
|
10
|
-
import '../../Display/Chip/Chip.js';
|
|
11
|
-
import '../../Display/IdentityDisplay/IdentityDisplay.js';
|
|
12
|
-
import '../../Display/Kbd/buttonList.js';
|
|
13
|
-
import '../../Display/List/List.js';
|
|
14
|
-
import 'react-dom';
|
|
15
|
-
import { Dialog } from '../Dialog/Dialog.js';
|
|
16
|
-
import styles from './Drawer.module.css.js';
|
|
17
|
-
import '../PageLayout/PageLayout.js';
|
|
18
|
-
import '../../Navigation/Tabs/Tabs.js';
|
|
19
|
-
import '../../Navigation/Tabs/Tab/Tab.js';
|
|
20
|
-
import '../Sidebar/Sidebar.js';
|
|
21
|
-
import '../Table/Table.js';
|
|
22
|
-
|
|
23
|
-
const PanelLeft = (props) => {
|
|
24
|
-
return (jsxs("svg", { width: "24", height: "24", stroke: "currentColor", ...props, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [jsx("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }), jsx("path", { d: "M9 3v18" }), jsx("path", { d: "m16 15-3-3 3-3" })] }));
|
|
25
|
-
};
|
|
26
|
-
const PanelRight = (props) => {
|
|
27
|
-
return (jsxs("svg", { width: "24", height: "24", stroke: "currentColor", ...props, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [jsx("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }), jsx("path", { d: "M15 3v18" }), jsx("path", { d: "m8 9 3 3-3 3" })] }));
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Opens a drawer from the side of the screen
|
|
31
|
-
*/
|
|
32
|
-
function Drawer(props) {
|
|
33
|
-
const { side = "right", slotProps, children, className, ...rest } = props;
|
|
34
|
-
const { open, handleOpen, handleClose } = useDisclosure();
|
|
35
|
-
return (jsxs(Fragment, { children: [jsx(Button, { onClick: handleOpen, children: side == "left" ? jsx(PanelRight, {}) : jsx(PanelLeft, {}) }), jsx(Dialog, { open: open, onClose: handleClose, className: cn(className, styles.drawer), ...rest, children: children })] }));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export { Drawer };
|
|
1
|
+
import{jsxs as o,Fragment as r,jsx as t}from"react/jsx-runtime";import{useDisclosure as i}from"@studiocubics/hooks";import{Button as s}from"../../Inputs/Button/Button.js";import"react";import"../../Inputs/Checkbox/CheckboxGroup/CheckboxGroup.js";import{cn as e}from"@studiocubics/utils";import"../../Display/InputErrors/InputErrors.js";import"../../Display/Accordion/Accordion.js";import"../../Cards/GlassCard/GlassCard.js";import"../../Display/Chip/Chip.js";import"../../Display/IdentityDisplay/IdentityDisplay.js";import"../../Display/Kbd/buttonList.js";import"../../Display/List/List.js";import"react-dom";import{Dialog as n}from"../Dialog/Dialog.js";import p from"./Drawer.module.css.js";const l=r=>o("svg",{width:"24",height:"24",stroke:"currentColor",...r,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[t("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),t("path",{d:"M9 3v18"}),t("path",{d:"m16 15-3-3 3-3"})]}),d=r=>o("svg",{width:"24",height:"24",stroke:"currentColor",...r,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[t("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),t("path",{d:"M15 3v18"}),t("path",{d:"m8 9 3 3-3 3"})]});function h(h){const{side:c="right",slotProps:a,children:m,className:u,...w}=h,{open:j,handleOpen:g,handleClose:k}=i();return o(r,{children:[t(s,{onClick:g,children:t("left"==c?d:l,{})}),t(n,{open:j,onClose:k,className:e(u,p.drawer),...w,children:m})]})}export{h as Drawer};
|
|
39
2
|
//# sourceMappingURL=Drawer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.js","sources":["../../../src/Layout/Drawer/Drawer.tsx"],"sourcesContent":["import { useDisclosure } from \"@studiocubics/hooks\";\nimport { Button, type ButtonProps } from \"../../Inputs/_index\";\nimport { Dialog, type DialogProps } from \"
|
|
1
|
+
{"version":3,"file":"Drawer.js","sources":["../../../src/Layout/Drawer/Drawer.tsx"],"sourcesContent":["import { useDisclosure } from \"@studiocubics/hooks\";\nimport { Button, type ButtonProps } from \"../../Inputs/_index\";\nimport { Dialog, type DialogProps } from \"../../Layout/Dialog/Dialog\";\nimport type { ComponentProps } from \"react\";\nimport { cn } from \"@studiocubics/utils\";\nimport styles from \"./Drawer.module.css\";\n\nexport interface DrawerProps extends Omit<DialogProps, \"open\" | \"onClose\"> {\n /**\n * @default \"right\"\n */\n side?: \"right\" | \"left\";\n\n slotProps?: {\n button?: ButtonProps;\n };\n}\n\nconst PanelLeft = (props: ComponentProps<\"svg\">) => {\n return (\n <svg\n width=\"24\"\n height=\"24\"\n stroke=\"currentColor\"\n {...props}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M9 3v18\" />\n <path d=\"m16 15-3-3 3-3\" />\n </svg>\n );\n};\nconst PanelRight = (props: ComponentProps<\"svg\">) => {\n return (\n <svg\n width=\"24\"\n height=\"24\"\n stroke=\"currentColor\"\n {...props}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M15 3v18\" />\n <path d=\"m8 9 3 3-3 3\" />\n </svg>\n );\n};\n\n/**\n * Opens a drawer from the side of the screen\n */\nexport function Drawer(props: DrawerProps) {\n const { side = \"right\", slotProps, children, className, ...rest } = props;\n const { open, handleOpen, handleClose } = useDisclosure();\n\n return (\n <>\n <Button onClick={handleOpen}>\n {side == \"left\" ? <PanelRight /> : <PanelLeft />}\n </Button>\n <Dialog\n open={open}\n onClose={handleClose}\n className={cn(className, styles.drawer)}\n {...rest}\n >\n {children}\n </Dialog>\n </>\n );\n}\n"],"names":["PanelLeft","props","_jsxs","width","height","stroke","xmlns","viewBox","fill","children","_jsx","x","y","rx","d","PanelRight","Drawer","side","slotProps","className","rest","open","handleOpen","handleClose","useDisclosure","_Fragment","Button","onClick","Dialog","onClose","cn","styles","drawer"],"mappings":"orBAkBA,MAAMA,EAAaC,GAEfC,EAAA,MAAA,CACEC,MAAM,KACNC,OAAO,KACPC,OAAO,kBACHJ,EACJK,MAAM,6BACNC,QAAQ,YACRC,KAAK,OAAM,eACE,IAAG,iBACD,0BACC,QAAOC,SAAA,CAEvBC,EAAA,OAAA,CAAMP,MAAM,KAAKC,OAAO,KAAKO,EAAE,IAAIC,EAAE,IAAIC,GAAG,MAC5CH,EAAA,OAAA,CAAMI,EAAE,YACRJ,EAAA,OAAA,CAAMI,EAAE,sBAIRC,EAAcd,GAEhBC,EAAA,MAAA,CACEC,MAAM,KACNC,OAAO,KACPC,OAAO,kBACHJ,EACJK,MAAM,6BACNC,QAAQ,YACRC,KAAK,OAAM,eACE,IAAG,iBACD,0BACC,QAAOC,SAAA,CAEvBC,EAAA,OAAA,CAAMP,MAAM,KAAKC,OAAO,KAAKO,EAAE,IAAIC,EAAE,IAAIC,GAAG,MAC5CH,EAAA,OAAA,CAAMI,EAAE,aACRJ,EAAA,OAAA,CAAMI,EAAE,oBAQR,SAAUE,EAAOf,GACrB,MAAMgB,KAAEA,EAAO,QAAOC,UAAEA,EAAST,SAAEA,EAAQU,UAAEA,KAAcC,GAASnB,GAC9DoB,KAAEA,EAAIC,WAAEA,EAAUC,YAAEA,GAAgBC,IAE1C,OACEtB,EAAAuB,EAAA,CAAAhB,SAAA,CACEC,EAACgB,EAAM,CAACC,QAASL,EAAUb,SACPC,EAAT,QAARO,EAAkBF,EAAiBf,EAAP,CAAA,KAE/BU,EAACkB,EAAM,CACLP,KAAMA,EACNQ,QAASN,EACTJ,UAAWW,EAAGX,EAAWY,EAAOC,WAC5BZ,EAAIX,SAEPA,MAIT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Drawer.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,25 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import styles from './PageLayout.module.css.js';
|
|
3
|
-
import { cn } from '@studiocubics/utils';
|
|
4
|
-
import { PageTitle } from '../../Typography/PageTitle/PageTitle.js';
|
|
5
|
-
|
|
6
|
-
const defaultElement = "div";
|
|
7
|
-
function PageLayoutBase(props) {
|
|
8
|
-
const { as, children, titleBar, footer, slotProps = {}, ...rest } = props;
|
|
9
|
-
const Component = (as || defaultElement);
|
|
10
|
-
return (jsxs(Component, { ...slotProps.root, className: cn(styles.root, slotProps.root?.className), children: [jsx(PageTitle, { ...rest }), titleBar && (jsx("div", { ...slotProps.titleBar, className: cn(styles.titleBar, slotProps.titleBar?.className), children: titleBar })), jsx("div", { ...slotProps.body, className: cn(styles.body, slotProps.body?.className), children: children }), footer && (jsx("div", { ...slotProps.footer, className: cn(styles.footer, slotProps.footer?.className), children: footer }))] }));
|
|
11
|
-
}
|
|
12
|
-
PageLayoutBase.displayName = "PageLayout";
|
|
13
|
-
/**
|
|
14
|
-
* A polymorphic PageLayout component.
|
|
15
|
-
*
|
|
16
|
-
* By default it renders a `<main>`, but any element can be used via the `as` prop:
|
|
17
|
-
*
|
|
18
|
-
* ```tsx
|
|
19
|
-
* <PageLayout as="a" href="/docs">Read docs</PageLayout>
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
const PageLayout = PageLayoutBase;
|
|
23
|
-
|
|
24
|
-
export { PageLayout };
|
|
1
|
+
import{jsxs as o,jsx as e}from"react/jsx-runtime";import t from"./PageLayout.module.css.js";import{cn as a}from"@studiocubics/utils";import{PageTitle as r}from"../../Typography/PageTitle/PageTitle.js";function s(s){const{as:i,children:l,titleBar:c,footer:m,slotProps:d={},...n}=s;return o(i||"div",{...d.root,className:a(t.root,d.root?.className),children:[e(r,{...n}),c&&e("div",{...d.titleBar,className:a(t.titleBar,d.titleBar?.className),children:c}),e("div",{...d.body,className:a(t.body,d.body?.className),children:l}),m&&e("div",{...d.footer,className:a(t.footer,d.footer?.className),children:m})]})}s.displayName="PageLayout";const i=s;export{i as PageLayout};
|
|
25
2
|
//# sourceMappingURL=PageLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageLayout.js","sources":["../../../src/Layout/PageLayout/PageLayout.tsx"],"sourcesContent":["import styles from \"./PageLayout.module.css\";\nimport type { ComponentProps, ElementType, ReactNode } from \"react\";\nimport { cn } from \"@studiocubics/utils\";\nimport type {\n PolymorphicComponentProps,\n PolymorphicComponentType,\n} from \"@studiocubics/types\";\nimport {\n PageTitle,\n type PageTitleProps,\n} from \"../../Typography/PageTitle/PageTitle\";\n\nexport interface PageLayoutBaseProps extends PageTitleProps {\n children: ReactNode;\n titleBar?: ReactNode;\n footer?: ReactNode;\n slotProps?: {\n root?: ComponentProps<\"main\">;\n body?: ComponentProps<\"div\">;\n footer?: ComponentProps<\"div\">;\n titleBar?: ComponentProps<\"div\">;\n };\n}\nconst defaultElement = \"div\";\ntype DefaultElement = typeof defaultElement;\n\nexport type PageLayoutProps<C extends ElementType = DefaultElement> =\n PolymorphicComponentProps<C, PageLayoutBaseProps>;\n\nfunction PageLayoutBase(props: PageLayoutProps) {\n const { as, children, titleBar, footer, slotProps = {}, ...rest } = props;\n const Component = (as || defaultElement) as ElementType;\n return (\n <Component\n {...slotProps.root}\n className={cn(styles.root, slotProps.root?.className)}\n >\n <PageTitle {...rest} />\n {titleBar && (\n <div\n {...slotProps.titleBar}\n className={cn(styles.titleBar, slotProps.titleBar?.className)}\n >\n {titleBar}\n </div>\n )}\n\n <div\n {...slotProps.body}\n className={cn(styles.body, slotProps.body?.className)}\n >\n {children}\n </div>\n {footer && (\n <div\n {...slotProps.footer}\n className={cn(styles.footer, slotProps.footer?.className)}\n >\n {footer}\n </div>\n )}\n </Component>\n );\n}\nPageLayoutBase.displayName = \"PageLayout\";\n\n/**\n * A polymorphic PageLayout component.\n *\n * By default it renders a `<main>`, but any element can be used via the `as` prop:\n *\n * ```tsx\n * <PageLayout as=\"a\" href=\"/docs\">Read docs</PageLayout>\n * ```\n */\nexport const PageLayout = PageLayoutBase as PolymorphicComponentType<\n PageLayoutBaseProps,\n DefaultElement\n>;\n"],"names":["
|
|
1
|
+
{"version":3,"file":"PageLayout.js","sources":["../../../src/Layout/PageLayout/PageLayout.tsx"],"sourcesContent":["import styles from \"./PageLayout.module.css\";\nimport type { ComponentProps, ElementType, ReactNode } from \"react\";\nimport { cn } from \"@studiocubics/utils\";\nimport type {\n PolymorphicComponentProps,\n PolymorphicComponentType,\n} from \"@studiocubics/types\";\nimport {\n PageTitle,\n type PageTitleProps,\n} from \"../../Typography/PageTitle/PageTitle\";\n\nexport interface PageLayoutBaseProps extends PageTitleProps {\n children: ReactNode;\n titleBar?: ReactNode;\n footer?: ReactNode;\n slotProps?: {\n root?: ComponentProps<\"main\">;\n body?: ComponentProps<\"div\">;\n footer?: ComponentProps<\"div\">;\n titleBar?: ComponentProps<\"div\">;\n };\n}\nconst defaultElement = \"div\";\ntype DefaultElement = typeof defaultElement;\n\nexport type PageLayoutProps<C extends ElementType = DefaultElement> =\n PolymorphicComponentProps<C, PageLayoutBaseProps>;\n\nfunction PageLayoutBase(props: PageLayoutProps) {\n const { as, children, titleBar, footer, slotProps = {}, ...rest } = props;\n const Component = (as || defaultElement) as ElementType;\n return (\n <Component\n {...slotProps.root}\n className={cn(styles.root, slotProps.root?.className)}\n >\n <PageTitle {...rest} />\n {titleBar && (\n <div\n {...slotProps.titleBar}\n className={cn(styles.titleBar, slotProps.titleBar?.className)}\n >\n {titleBar}\n </div>\n )}\n\n <div\n {...slotProps.body}\n className={cn(styles.body, slotProps.body?.className)}\n >\n {children}\n </div>\n {footer && (\n <div\n {...slotProps.footer}\n className={cn(styles.footer, slotProps.footer?.className)}\n >\n {footer}\n </div>\n )}\n </Component>\n );\n}\nPageLayoutBase.displayName = \"PageLayout\";\n\n/**\n * A polymorphic PageLayout component.\n *\n * By default it renders a `<main>`, but any element can be used via the `as` prop:\n *\n * ```tsx\n * <PageLayout as=\"a\" href=\"/docs\">Read docs</PageLayout>\n * ```\n */\nexport const PageLayout = PageLayoutBase as PolymorphicComponentType<\n PageLayoutBaseProps,\n DefaultElement\n>;\n"],"names":["PageLayoutBase","props","as","children","titleBar","footer","slotProps","rest","_jsxs","root","className","cn","styles","_jsx","PageTitle","body","displayName","PageLayout"],"mappings":"yMA6BA,SAASA,EAAeC,GACtB,MAAMC,GAAEA,EAAEC,SAAEA,EAAQC,SAAEA,EAAQC,OAAEA,EAAMC,UAAEA,EAAY,CAAA,KAAOC,GAASN,EAEpE,OACEO,EAFiBN,GARE,MAUT,IACJI,EAAUG,KACdC,UAAWC,EAAGC,EAAOH,KAAMH,EAAUG,MAAMC,WAAUP,SAAA,CAErDU,EAACC,MAAcP,IACdH,GACCS,YACMP,EAAUF,SACdM,UAAWC,EAAGC,EAAOR,SAAUE,EAAUF,UAAUM,WAAUP,SAE5DC,IAILS,EAAA,MAAA,IACMP,EAAUS,KACdL,UAAWC,EAAGC,EAAOG,KAAMT,EAAUS,MAAML,WAAUP,SAEpDA,IAEFE,GACCQ,EAAA,MAAA,IACMP,EAAUD,OACdK,UAAWC,EAAGC,EAAOP,OAAQC,EAAUD,QAAQK,WAAUP,SAExDE,MAKX,CACAL,EAAegB,YAAc,aAWtB,MAAMC,EAAajB"}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
export { styles as default };
|
|
1
|
+
var o={root:"PageLayout-module_root__H4l4t",titleBar:"PageLayout-module_titleBar__Be27V",body:"PageLayout-module_body__yjAdc",footer:"PageLayout-module_footer__iR2sk"};export{o as default};
|
|
4
2
|
//# sourceMappingURL=PageLayout.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageLayout.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PageLayout.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Suspense } from 'react';
|
|
3
|
-
import { PageLayout } from '../PageLayout/PageLayout.js';
|
|
4
|
-
import styles from './PageLayoutPagination.module.css.js';
|
|
5
|
-
import { Skeleton } from '../../Display/Skeleton/Skeleton.js';
|
|
6
|
-
|
|
7
|
-
function PageLayoutPagination(props) {
|
|
8
|
-
const { skeletonHeight = 107, paginationComponent, children, ...rest } = props;
|
|
9
|
-
return (jsx(PageLayout, { footer: jsx(Suspense, { fallback: jsx(Skeleton, { height: 32 }), children: paginationComponent }), ...rest, children: jsx("div", { className: styles.list, children: jsx(Suspense, { fallback: Array.from({ length: 3 }).map((_, i) => (jsx(Skeleton, { height: skeletonHeight }, i))), children: children }) }) }));
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export { PageLayoutPagination };
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{Suspense as o}from"react";import{PageLayout as t}from"../PageLayout/PageLayout.js";import r from"./PageLayoutPagination.module.css.js";import{Skeleton as i}from"../../Display/Skeleton/Skeleton.js";function a(a){const{skeletonHeight:n=107,paginationComponent:l,children:m,...c}=a;return e(t,{footer:e(o,{fallback:e(i,{height:32}),children:l}),...c,children:e("div",{className:r.list,children:e(o,{fallback:Array.from({length:3}).map((o,t)=>e(i,{height:n},t)),children:m})})})}export{a as PageLayoutPagination};
|
|
13
2
|
//# sourceMappingURL=PageLayoutPagination.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageLayoutPagination.js","sources":["../../../src/Layout/PageLayoutPagination/PageLayoutPagination.tsx"],"sourcesContent":["import { type ReactNode, Suspense } from \"react\";\nimport { PageLayout, type PageLayoutProps } from \"../PageLayout/PageLayout\";\nimport styles from \"./PageLayoutPagination.module.css\";\nimport { Skeleton } from \"../../Display/Skeleton/Skeleton\";\n\nexport interface PageLayoutPaginationProps {\n skeletonHeight?: number;\n paginationComponent?: ReactNode;\n}\n\nexport function PageLayoutPagination(\n props: PageLayoutPaginationProps & Omit<PageLayoutProps, \"footer\">,\n) {\n const {\n skeletonHeight = 107,\n paginationComponent,\n children,\n ...rest\n } = props;\n return (\n <PageLayout\n footer={\n <Suspense fallback={<Skeleton height={32} />}>\n {paginationComponent}\n </Suspense>\n }\n {...rest}\n >\n <div className={styles.list}>\n <Suspense\n fallback={Array.from({ length: 3 }).map((_, i) => (\n <Skeleton key={i} height={skeletonHeight} />\n ))}\n >\n {children}\n </Suspense>\n </div>\n </PageLayout>\n );\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"PageLayoutPagination.js","sources":["../../../src/Layout/PageLayoutPagination/PageLayoutPagination.tsx"],"sourcesContent":["import { type ReactNode, Suspense } from \"react\";\nimport { PageLayout, type PageLayoutProps } from \"../PageLayout/PageLayout\";\nimport styles from \"./PageLayoutPagination.module.css\";\nimport { Skeleton } from \"../../Display/Skeleton/Skeleton\";\n\nexport interface PageLayoutPaginationProps {\n skeletonHeight?: number;\n paginationComponent?: ReactNode;\n}\n\nexport function PageLayoutPagination(\n props: PageLayoutPaginationProps & Omit<PageLayoutProps, \"footer\">,\n) {\n const {\n skeletonHeight = 107,\n paginationComponent,\n children,\n ...rest\n } = props;\n return (\n <PageLayout\n footer={\n <Suspense fallback={<Skeleton height={32} />}>\n {paginationComponent}\n </Suspense>\n }\n {...rest}\n >\n <div className={styles.list}>\n <Suspense\n fallback={Array.from({ length: 3 }).map((_, i) => (\n <Skeleton key={i} height={skeletonHeight} />\n ))}\n >\n {children}\n </Suspense>\n </div>\n </PageLayout>\n );\n}\n"],"names":["PageLayoutPagination","props","skeletonHeight","paginationComponent","children","rest","_jsx","PageLayout","footer","Suspense","fallback","Skeleton","height","className","styles","list","Array","from","length","map","_","i"],"mappings":"oPAUM,SAAUA,EACdC,GAEA,MAAMC,eACJA,EAAiB,IAAGC,oBACpBA,EAAmBC,SACnBA,KACGC,GACDJ,EACJ,OACEK,EAACC,EAAU,CACTC,OACEF,EAACG,EAAQ,CAACC,SAAUJ,EAACK,EAAQ,CAACC,OAAQ,KAAMR,SACzCD,OAGDE,EAAID,SAERE,SAAKO,UAAWC,EAAOC,KAAIX,SACzBE,EAACG,EAAQ,CACPC,SAAUM,MAAMC,KAAK,CAAEC,OAAQ,IAAKC,IAAI,CAACC,EAAGC,IAC1Cf,EAACK,EAAQ,CAASC,OAAQV,GAAXmB,aAGhBjB,OAKX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageLayoutPagination.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PageLayoutPagination.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,22 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { cn } from '@studiocubics/utils';
|
|
4
|
-
import { Tabs } from '../../Navigation/Tabs/Tabs.js';
|
|
5
|
-
import { TabsBar } from '../../Navigation/Tabs/TabsBar/TabsBar.js';
|
|
6
|
-
import { Tab } from '../../Navigation/Tabs/Tab/Tab.js';
|
|
7
|
-
import { PageLayout } from '../PageLayout/PageLayout.js';
|
|
8
|
-
import styles from './PageLayoutTabs.module.css.js';
|
|
9
|
-
|
|
10
|
-
function PageLayoutTabs(props) {
|
|
11
|
-
const { children, menuItems = [], slotProps = {}, selectedIndex = 0, LinkComponent = "a", ...rest } = props;
|
|
12
|
-
return (jsx(PageLayout, { ...rest, slotProps: {
|
|
13
|
-
...slotProps,
|
|
14
|
-
body: {
|
|
15
|
-
...slotProps.body,
|
|
16
|
-
className: cn(slotProps.body?.className, styles.body),
|
|
17
|
-
},
|
|
18
|
-
}, titleBar: jsx(Tabs, { children: jsx(TabsBar, { children: menuItems.map((mi, i) => (jsx(Tab, { ...slotProps.tab, as: LinkComponent, selected: i == selectedIndex, ...mi }, i))) }) }), noBorders: true, children: children }));
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export { PageLayoutTabs };
|
|
1
|
+
"use client";import{jsx as o}from"react/jsx-runtime";import{cn as a}from"@studiocubics/utils";import{Tabs as s}from"../../Navigation/Tabs/Tabs.js";import{TabsBar as t}from"../../Navigation/Tabs/TabsBar/TabsBar.js";import{Tab as r}from"../../Navigation/Tabs/Tab/Tab.js";import{PageLayout as e}from"../PageLayout/PageLayout.js";import i from"./PageLayoutTabs.module.css.js";function m(m){const{children:n,menuItems:b=[],slotProps:c={},selectedIndex:d=0,LinkComponent:l="a",...p}=m;return o(e,{...p,slotProps:{...c,body:{...c.body,className:a(c.body?.className,i.body)}},titleBar:o(s,{children:o(t,{children:b.map((a,s)=>o(r,{...c.tab,as:l,selected:s==d,...a},s))})}),noBorders:!0,children:n})}export{m as PageLayoutTabs};
|
|
22
2
|
//# sourceMappingURL=PageLayoutTabs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageLayoutTabs.js","sources":["../../../src/Layout/PageLayoutTabs/PageLayoutTabs.tsx"],"sourcesContent":["\"use client\";\n\nimport { type PageTitleProps } from \"../../Typography/PageTitle/PageTitle\";\nimport type { ComponentProps, ElementType, ReactNode } from \"react\";\nimport { Tabs } from \"../../Navigation/Tabs/Tabs\";\nimport { TabsBar } from \"../../Navigation/Tabs/TabsBar/TabsBar\";\nimport { Tab, type TabProps } from \"../../Navigation/Tabs/Tab/Tab\";\nimport { PageLayout, type PageLayoutProps } from \"../PageLayout/PageLayout\";\nimport { cn } from \"@studiocubics/utils\";\nimport styles from \"./PageLayoutTabs.module.css\";\n\nexport interface PageLayoutTabsProps extends PageTitleProps {\n children: ReactNode;\n menuItems?: TabProps[];\n LinkComponent?: ElementType<ComponentProps<any>>;\n selectedIndex?: number;\n slotProps?: PageLayoutProps[\"slotProps\"] & {\n tab?: TabProps;\n };\n}\n\nexport function PageLayoutTabs(props: PageLayoutTabsProps) {\n const {\n children,\n menuItems = [],\n slotProps = {},\n selectedIndex = 0,\n LinkComponent = \"a\",\n ...rest\n } = props;\n\n return (\n <PageLayout\n {...rest}\n slotProps={{\n ...slotProps,\n body: {\n ...slotProps.body,\n className: cn(slotProps.body?.className, styles.body),\n },\n }}\n titleBar={\n <Tabs>\n <TabsBar>\n {menuItems.map((mi, i) => (\n <Tab\n key={i}\n {...slotProps.tab}\n as={LinkComponent}\n selected={i == selectedIndex}\n {...mi}\n />\n ))}\n </TabsBar>\n </Tabs>\n }\n noBorders\n >\n {children}\n </PageLayout>\n );\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"PageLayoutTabs.js","sources":["../../../src/Layout/PageLayoutTabs/PageLayoutTabs.tsx"],"sourcesContent":["\"use client\";\n\nimport { type PageTitleProps } from \"../../Typography/PageTitle/PageTitle\";\nimport type { ComponentProps, ElementType, ReactNode } from \"react\";\nimport { Tabs } from \"../../Navigation/Tabs/Tabs\";\nimport { TabsBar } from \"../../Navigation/Tabs/TabsBar/TabsBar\";\nimport { Tab, type TabProps } from \"../../Navigation/Tabs/Tab/Tab\";\nimport { PageLayout, type PageLayoutProps } from \"../PageLayout/PageLayout\";\nimport { cn } from \"@studiocubics/utils\";\nimport styles from \"./PageLayoutTabs.module.css\";\n\nexport interface PageLayoutTabsProps extends PageTitleProps {\n children: ReactNode;\n menuItems?: TabProps[];\n LinkComponent?: ElementType<ComponentProps<any>>;\n selectedIndex?: number;\n slotProps?: PageLayoutProps[\"slotProps\"] & {\n tab?: TabProps;\n };\n}\n\nexport function PageLayoutTabs(props: PageLayoutTabsProps) {\n const {\n children,\n menuItems = [],\n slotProps = {},\n selectedIndex = 0,\n LinkComponent = \"a\",\n ...rest\n } = props;\n\n return (\n <PageLayout\n {...rest}\n slotProps={{\n ...slotProps,\n body: {\n ...slotProps.body,\n className: cn(slotProps.body?.className, styles.body),\n },\n }}\n titleBar={\n <Tabs>\n <TabsBar>\n {menuItems.map((mi, i) => (\n <Tab\n key={i}\n {...slotProps.tab}\n as={LinkComponent}\n selected={i == selectedIndex}\n {...mi}\n />\n ))}\n </TabsBar>\n </Tabs>\n }\n noBorders\n >\n {children}\n </PageLayout>\n );\n}\n"],"names":["PageLayoutTabs","props","children","menuItems","slotProps","selectedIndex","LinkComponent","rest","_jsx","PageLayout","body","className","cn","styles","titleBar","Tabs","TabsBar","map","mi","i","Tab","tab","as","selected","noBorders"],"mappings":"oXAqBM,SAAUA,EAAeC,GAC7B,MAAMC,SACJA,EAAQC,UACRA,EAAY,GAAEC,UACdA,EAAY,CAAA,EAAEC,cACdA,EAAgB,EAACC,cACjBA,EAAgB,OACbC,GACDN,EAEJ,OACEO,EAACC,MACKF,EACJH,UAAW,IACNA,EACHM,KAAM,IACDN,EAAUM,KACbC,UAAWC,EAAGR,EAAUM,MAAMC,UAAWE,EAAOH,QAGpDI,SACEN,EAACO,YACCP,EAACQ,EAAO,CAAAd,SACLC,EAAUc,IAAI,CAACC,EAAIC,IAClBX,EAACY,EAAG,IAEEhB,EAAUiB,IACdC,GAAIhB,EACJiB,SAAUJ,GAAKd,KACXa,GAJCC,QAUfK,WAAS,EAAAtB,SAERA,GAGP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageLayoutTabs.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PageLayoutTabs.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|