@economic/taco 8.1.2-hanger-base-ui.3 → 8.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/charts/components/useChartData.cjs +2 -2
- package/dist/charts/components/useChartData.cjs.map +1 -1
- package/dist/charts/components/useChartData.js +2 -2
- package/dist/charts/components/useChartData.js.map +1 -1
- package/dist/components/Backdrop/Backdrop.cjs +1 -1
- package/dist/components/Backdrop/Backdrop.cjs.map +1 -1
- package/dist/components/Backdrop/Backdrop.js +1 -1
- package/dist/components/Backdrop/Backdrop.js.map +1 -1
- package/dist/components/Button/util.cjs +3 -3
- package/dist/components/Button/util.cjs.map +1 -1
- package/dist/components/Button/util.js +3 -3
- package/dist/components/Button/util.js.map +1 -1
- package/dist/components/Card/Card.cjs +1 -1
- package/dist/components/Card/Card.cjs.map +1 -1
- package/dist/components/Card/Card.js +1 -1
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.cjs +2 -2
- package/dist/components/Checkbox/Checkbox.cjs.map +1 -1
- package/dist/components/Checkbox/Checkbox.js +2 -2
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/Datepicker/Datepicker.cjs +2 -2
- package/dist/components/Datepicker/Datepicker.cjs.map +1 -1
- package/dist/components/Datepicker/Datepicker.js +2 -2
- package/dist/components/Datepicker/Datepicker.js.map +1 -1
- package/dist/components/Drawer/components/Content.cjs +3 -3
- package/dist/components/Drawer/components/Content.cjs.map +1 -1
- package/dist/components/Drawer/components/Content.js +3 -3
- package/dist/components/Drawer/components/Content.js.map +1 -1
- package/dist/components/Drawer/util.cjs +1 -1
- package/dist/components/Drawer/util.cjs.map +1 -1
- package/dist/components/Drawer/util.js +1 -1
- package/dist/components/Drawer/util.js.map +1 -1
- package/dist/components/Field/Field.cjs +1 -1
- package/dist/components/Field/Field.cjs.map +1 -1
- package/dist/components/Field/Field.js +1 -1
- package/dist/components/Field/Field.js.map +1 -1
- package/dist/components/Hanger/Arrow.cjs +4 -3
- package/dist/components/Hanger/Arrow.cjs.map +1 -1
- package/dist/components/Hanger/Arrow.js +3 -3
- package/dist/components/Hanger/Arrow.js.map +1 -1
- package/dist/components/Hanger/Hanger.cjs +36 -33
- package/dist/components/Hanger/Hanger.cjs.map +1 -1
- package/dist/components/Hanger/Hanger.d.ts +1 -1
- package/dist/components/Hanger/Hanger.js +35 -33
- package/dist/components/Hanger/Hanger.js.map +1 -1
- package/dist/components/Header/Header.cjs +1 -1
- package/dist/components/Header/Header.cjs.map +1 -1
- package/dist/components/Header/Header.js +1 -1
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/Header/components/AgreementSelector.cjs +5 -5
- package/dist/components/Header/components/AgreementSelector.cjs.map +1 -1
- package/dist/components/Header/components/AgreementSelector.js +5 -5
- package/dist/components/Header/components/AgreementSelector.js.map +1 -1
- package/dist/components/Header/components/Button.cjs +1 -1
- package/dist/components/Header/components/Button.cjs.map +1 -1
- package/dist/components/Header/components/Button.js +1 -1
- package/dist/components/Header/components/Button.js.map +1 -1
- package/dist/components/Header/components/Link.cjs +1 -1
- package/dist/components/Header/components/Link.cjs.map +1 -1
- package/dist/components/Header/components/Link.js +1 -1
- package/dist/components/Header/components/Link.js.map +1 -1
- package/dist/components/Header/components/Logo.cjs +1 -1
- package/dist/components/Header/components/Logo.cjs.map +1 -1
- package/dist/components/Header/components/Logo.js +1 -1
- package/dist/components/Header/components/Logo.js.map +1 -1
- package/dist/components/Header/components/MenuButton.cjs +1 -1
- package/dist/components/Header/components/MenuButton.cjs.map +1 -1
- package/dist/components/Header/components/MenuButton.js +1 -1
- package/dist/components/Header/components/MenuButton.js.map +1 -1
- package/dist/components/Header/components/PrimaryNavigation.cjs +1 -1
- package/dist/components/Header/components/PrimaryNavigation.cjs.map +1 -1
- package/dist/components/Header/components/PrimaryNavigation.js +1 -1
- package/dist/components/Header/components/PrimaryNavigation.js.map +1 -1
- package/dist/components/HoverCard/HoverCard.cjs +2 -2
- package/dist/components/HoverCard/HoverCard.cjs.map +1 -1
- package/dist/components/HoverCard/HoverCard.js +2 -2
- package/dist/components/HoverCard/HoverCard.js.map +1 -1
- package/dist/components/Input/util.cjs +7 -7
- package/dist/components/Input/util.cjs.map +1 -1
- package/dist/components/Input/util.js +7 -7
- package/dist/components/Input/util.js.map +1 -1
- package/dist/components/Layout/components/Sidebar.cjs +2 -2
- package/dist/components/Layout/components/Sidebar.cjs.map +1 -1
- package/dist/components/Layout/components/Sidebar.js +2 -2
- package/dist/components/Layout/components/Sidebar.js.map +1 -1
- package/dist/components/Menu/components/Item.cjs +1 -1
- package/dist/components/Menu/components/Item.cjs.map +1 -1
- package/dist/components/Menu/components/Item.js +1 -1
- package/dist/components/Menu/components/Item.js.map +1 -1
- package/dist/components/Navigation2/Navigation2.cjs +1 -1
- package/dist/components/Navigation2/Navigation2.cjs.map +1 -1
- package/dist/components/Navigation2/Navigation2.js +1 -1
- package/dist/components/Navigation2/Navigation2.js.map +1 -1
- package/dist/components/Navigation2/components/Content.cjs +1 -1
- package/dist/components/Navigation2/components/Content.cjs.map +1 -1
- package/dist/components/Navigation2/components/Content.js +1 -1
- package/dist/components/Navigation2/components/Content.js.map +1 -1
- package/dist/components/Navigation2/components/Group.cjs +1 -1
- package/dist/components/Navigation2/components/Group.cjs.map +1 -1
- package/dist/components/Navigation2/components/Group.js +1 -1
- package/dist/components/Navigation2/components/Group.js.map +1 -1
- package/dist/components/Navigation2/components/Link.cjs +1 -1
- package/dist/components/Navigation2/components/Link.cjs.map +1 -1
- package/dist/components/Navigation2/components/Link.js +1 -1
- package/dist/components/Navigation2/components/Link.js.map +1 -1
- package/dist/components/Navigation2/components/Section.cjs +1 -1
- package/dist/components/Navigation2/components/Section.cjs.map +1 -1
- package/dist/components/Navigation2/components/Section.js +1 -1
- package/dist/components/Navigation2/components/Section.js.map +1 -1
- package/dist/components/SearchInput2/SearchInput2.cjs +4 -4
- package/dist/components/SearchInput2/SearchInput2.cjs.map +1 -1
- package/dist/components/SearchInput2/SearchInput2.js +4 -4
- package/dist/components/SearchInput2/SearchInput2.js.map +1 -1
- package/dist/components/Select/useSelect.cjs.map +1 -1
- package/dist/components/Select/useSelect.d.ts +2 -2
- package/dist/components/Select/useSelect.js.map +1 -1
- package/dist/components/Select2/Select2.cjs +1 -1
- package/dist/components/Select2/Select2.cjs.map +1 -1
- package/dist/components/Select2/Select2.js +1 -1
- package/dist/components/Select2/Select2.js.map +1 -1
- package/dist/components/Select2/components/Option.cjs +1 -1
- package/dist/components/Select2/components/Option.cjs.map +1 -1
- package/dist/components/Select2/components/Option.js +1 -1
- package/dist/components/Select2/components/Option.js.map +1 -1
- package/dist/components/Select2/utilities.cjs +2 -2
- package/dist/components/Select2/utilities.cjs.map +1 -1
- package/dist/components/Select2/utilities.js +2 -2
- package/dist/components/Select2/utilities.js.map +1 -1
- package/dist/components/Shortcut/Shortcut.cjs +1 -1
- package/dist/components/Shortcut/Shortcut.cjs.map +1 -1
- package/dist/components/Shortcut/Shortcut.js +1 -1
- package/dist/components/Shortcut/Shortcut.js.map +1 -1
- package/dist/components/Switch/Switch.cjs +2 -2
- package/dist/components/Switch/Switch.cjs.map +1 -1
- package/dist/components/Switch/Switch.js +2 -2
- package/dist/components/Switch/Switch.js.map +1 -1
- package/dist/components/Table/components/BaseTable.cjs +1 -1
- package/dist/components/Table/components/BaseTable.cjs.map +1 -1
- package/dist/components/Table/components/BaseTable.js +1 -1
- package/dist/components/Table/components/BaseTable.js.map +1 -1
- package/dist/components/Table/util/renderRow.cjs +2 -2
- package/dist/components/Table/util/renderRow.cjs.map +1 -1
- package/dist/components/Table/util/renderRow.js +2 -2
- package/dist/components/Table/util/renderRow.js.map +1 -1
- package/dist/components/Table3/components/Row/Editing/CreateNewRow.cjs +1 -1
- package/dist/components/Table3/components/Row/Editing/CreateNewRow.cjs.map +1 -1
- package/dist/components/Table3/components/Row/Editing/CreateNewRow.js +1 -1
- package/dist/components/Table3/components/Row/Editing/CreateNewRow.js.map +1 -1
- package/dist/components/Table3/components/Row/Editing/TemporaryRow.cjs +1 -1
- package/dist/components/Table3/components/Row/Editing/TemporaryRow.cjs.map +1 -1
- package/dist/components/Table3/components/Row/Editing/TemporaryRow.js +1 -1
- package/dist/components/Table3/components/Row/Editing/TemporaryRow.js.map +1 -1
- package/dist/components/Table3/components/Toolbar/Editing/Editing.cjs +1 -1
- package/dist/components/Table3/components/Toolbar/Editing/Editing.cjs.map +1 -1
- package/dist/components/Table3/components/Toolbar/Editing/Editing.js +1 -1
- package/dist/components/Table3/components/Toolbar/Editing/Editing.js.map +1 -1
- package/dist/components/Tabs/components/TabList.cjs +1 -1
- package/dist/components/Tabs/components/TabList.cjs.map +1 -1
- package/dist/components/Tabs/components/TabList.js +1 -1
- package/dist/components/Tabs/components/TabList.js.map +1 -1
- package/dist/components/Tabs/components/Trigger.cjs +1 -1
- package/dist/components/Tabs/components/Trigger.cjs.map +1 -1
- package/dist/components/Tabs/components/Trigger.js +1 -1
- package/dist/components/Tabs/components/Trigger.js.map +1 -1
- package/dist/components/Tag/Tag.cjs +1 -1
- package/dist/components/Tag/Tag.cjs.map +1 -1
- package/dist/components/Tag/Tag.js +1 -1
- package/dist/components/Tag/Tag.js.map +1 -1
- package/dist/components/Toast/Toast.cjs +4 -4
- package/dist/components/Toast/Toast.cjs.map +1 -1
- package/dist/components/Toast/Toast.js +4 -4
- package/dist/components/Toast/Toast.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.cjs +4 -4
- package/dist/components/Tooltip/Tooltip.cjs.map +1 -1
- package/dist/components/Tooltip/Tooltip.js +4 -4
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/taco.css +63 -79
- package/dist/tailwind.colors.cjs +156 -95
- package/dist/tailwind.colors.cjs.map +1 -1
- package/dist/tailwind.colors.js +156 -95
- package/dist/tailwind.colors.js.map +1 -1
- package/dist/utils/tailwind.cjs +26 -26
- package/dist/utils/tailwind.cjs.map +1 -1
- package/dist/utils/tailwind.js +26 -26
- package/dist/utils/tailwind.js.map +1 -1
- package/package.json +6 -5
- package/tailwind.colors.js +206 -95
- package/tailwind.config.js +10 -45
|
@@ -25,7 +25,7 @@ const Title = React.forwardRef(function DrawerTitle(props, externalRef) {
|
|
|
25
25
|
const [style, setStyle] = React.useState({});
|
|
26
26
|
const { texts } = Localization.useLocalization();
|
|
27
27
|
const { onClickBack } = Context.useCurrentDrawer();
|
|
28
|
-
const cName = cn("grow-0 py-4 px-4 justify-self-start mb-0 border-b-[1px] border-gray-
|
|
28
|
+
const cName = cn("grow-0 py-4 px-4 justify-self-start mb-0 border-b-[1px] border-gray-200 flex items-start", className);
|
|
29
29
|
React.useEffect(() => {
|
|
30
30
|
var _a;
|
|
31
31
|
const drawer2 = (_a = ref == null ? void 0 : ref.current) == null ? void 0 : _a.closest('[data-taco="drawer"]');
|
|
@@ -52,7 +52,7 @@ const Title = React.forwardRef(function DrawerTitle(props, externalRef) {
|
|
|
52
52
|
});
|
|
53
53
|
const Footer = React.forwardRef(function DrawerFooter(props, ref) {
|
|
54
54
|
const { className: _1, ...otherProps } = props;
|
|
55
|
-
const cName = cn("mt-auto flex justify-end grow-0 p-4 border-t-[1px] border-gray-
|
|
55
|
+
const cName = cn("mt-auto flex justify-end grow-0 p-4 border-t-[1px] border-gray-200", props.className);
|
|
56
56
|
return /* @__PURE__ */ React.createElement("div", { ...otherProps, className: cName, ref });
|
|
57
57
|
});
|
|
58
58
|
const Actions = React.forwardRef(function Actions2(props, ref) {
|
|
@@ -148,7 +148,7 @@ const Content = React.forwardRef(function Content2(props, externalRef) {
|
|
|
148
148
|
return /* @__PURE__ */ React.createElement(drawer.Drawer.Portal, { container: outlet ?? void 0, className: "h-full" }, variant === "overlay" ? /* @__PURE__ */ React.createElement(
|
|
149
149
|
drawer.Drawer.Backdrop,
|
|
150
150
|
{
|
|
151
|
-
className: "fixed inset-0 cursor-default overflow-y-auto
|
|
151
|
+
className: "bg-brand-midnight/[0.3] fixed inset-0 cursor-default overflow-y-auto print:absolute print:overflow-visible",
|
|
152
152
|
"data-taco": "backdrop"
|
|
153
153
|
}
|
|
154
154
|
) : null, /* @__PURE__ */ React.createElement(drawer.Drawer.Viewport, { className: "h-full" }, /* @__PURE__ */ React.createElement(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Content.cjs","sources":["../../../../src/components/Drawer/components/Content.tsx"],"sourcesContent":["import React from 'react';\nimport { Drawer as DrawerPrimitive } from '@base-ui/react/drawer';\nimport cn from 'clsx';\n\nimport { Group, GroupProps } from '../../Group/Group';\nimport { IconButton } from '../../IconButton/IconButton';\nimport { useLocalization } from '../../Provider/Localization';\nimport { useCurrentMenu } from '../../Menu/Context';\nimport { useCurrentDrawer } from '../Context';\nimport { useDraggable } from '../../../utils/hooks/useDraggable';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { getDrawerContainerClassNames, getDrawerContentClassNames, getDrawerDragHandlerClassNames } from '../util';\n\nconst RESIZE_MIN = 360;\nconst RESIZE_MAX = 1000;\n\nexport enum DrawerAnimationDefinition {\n Visible = 'visible',\n Hidden = 'hidden',\n}\n\nconst RenderPropWrapper = React.forwardRef(function RenderPropWrapper({ children, onClick, renderProps }: any, ref) {\n const close = () => {\n onClick(new CustomEvent('close'));\n };\n\n return children({ close, ref, ...renderProps });\n});\n\nexport type DrawerTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function DrawerTitle(props: DrawerTitleProps, externalRef: React.Ref<HTMLHeadingElement>) {\n const { className, children, ...otherProps } = props;\n const ref = useMergedRef<HTMLHeadingElement>(externalRef);\n const [style, setStyle] = React.useState({});\n const { texts } = useLocalization();\n const { onClickBack } = useCurrentDrawer();\n\n /**\n * By design in default drawer version Title has grey separator, but we might have exceptions like Drawer + Tabs scenario,\n * where we might want to hide the grey separator. For this reason separator was rendered with using of classNames,\n * so it can be easily overriden in exceptional scenarios.\n * */\n const cName = cn('grow-0 py-4 px-4 justify-self-start mb-0 border-b-[1px] border-gray-300 flex items-start', className);\n\n React.useEffect(() => {\n const drawer = ref?.current?.closest('[data-taco=\"drawer\"]');\n\n // This is the margin amount that we need to deduct from the margins to align with the design\n const marginAdjust = 4;\n\n const closeButton: HTMLButtonElement | null = drawer?.querySelector(`[aria-label=\"${texts.drawer.close}\"]`) ?? null;\n const closeButtonWidth = closeButton?.offsetWidth ?? 0;\n const closeButtonRightMargin = 8;\n\n const actionsWrapper: HTMLSpanElement | null = drawer?.querySelector(`#taco-drawer-actions[data-taco=\"group\"]`) ?? null;\n const actionsWrapperWidth = actionsWrapper?.offsetWidth ?? 0;\n const actionsWrapperRightMargin = 8;\n\n const marginRight =\n closeButtonWidth + actionsWrapperWidth + closeButtonRightMargin + actionsWrapperRightMargin - marginAdjust;\n\n setStyle({ marginRight });\n }, [ref, texts.drawer.close]);\n\n return (\n <DrawerPrimitive.Title className={cName} {...otherProps} ref={ref}>\n {onClickBack ? (\n <IconButton\n appearance=\"discrete\"\n aria-label={texts.drawer.back}\n className=\"mr-3 text-base\"\n icon=\"chevron-left\"\n onClick={onClickBack}\n />\n ) : null}\n {\n // We need to apply the right margin as an inline style instead of using Tailwind CSS.\n // This is necessary because we are creating styles dynamically at runtime,\n // and Tailwind doesn't support generating runtime styles.\n }\n <span className=\"line-clamp-2 inline-block overflow-y-hidden\" style={style}>\n {children}\n </span>\n </DrawerPrimitive.Title>\n );\n});\n\nexport type DrawerFooterProps = React.HTMLAttributes<HTMLDivElement>;\nexport const Footer = React.forwardRef(function DrawerFooter(props: DrawerFooterProps, ref: React.Ref<HTMLDivElement>) {\n const { className: _1, ...otherProps } = props;\n /**\n * The same scenario as Title, grey separator rendered using classNames to have posibility to override it.\n */\n const cName = cn('mt-auto flex justify-end grow-0 p-4 border-t-[1px] border-gray-300', props.className);\n return <div {...otherProps} className={cName} ref={ref} />;\n});\n\nexport const Actions = React.forwardRef(function Actions(props: GroupProps, ref: React.Ref<HTMLDivElement>) {\n const { className, ...otherProps } = props;\n const cName = cn('absolute top-0 right-10 mr-[8px] mt-4', className);\n // Id is added to identify the actions wrapper inside a useEffect in Dialog.Title\n return <Group {...otherProps} className={cName} id=\"taco-drawer-actions\" ref={ref} />;\n});\n\nexport type DrawerCloseProps = React.HTMLAttributes<HTMLButtonElement> & {\n children: React.ReactElement;\n};\n\nexport const Close = React.forwardRef(function DrawerClose(props: DrawerCloseProps, ref: React.Ref<HTMLButtonElement>) {\n const { onClose } = useCurrentDrawer();\n\n const { children, ...restProps } = props;\n\n return <DrawerPrimitive.Close {...restProps} onClick={onClose} ref={ref} render={children} />;\n});\n\nexport type DrawerInnerContentProps = React.HTMLAttributes<HTMLDivElement>;\n/**\n * It is container component, needed to provide default scrolling behaviour and padding, to simplyfy usage, requested by feature devs.\n * It is optional to use InnerContent component, if consumer need to implement custom behaviour or paddings for inner content,\n * then it's simply enough to render children and wrap them in custom implementation.\n */\nexport const InnerContent = React.forwardRef(function InnerContent(\n props: DrawerInnerContentProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const { className, children, ...otherProps } = props;\n return (\n <div {...otherProps} className={cn('flex grow flex-col overflow-y-hidden', className)} ref={ref}>\n <div className=\"w-full gap-y-0.5 overflow-auto p-4\">{children}</div>\n </div>\n );\n});\n\nexport type DrawerContentProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {\n /** An accessible label to be announced when the side drawer is opened */\n 'aria-label': string;\n children: React.ReactNode | ((props: { close: () => void }) => React.ReactNode);\n};\nexport const Content = React.forwardRef(function Content(props: DrawerContentProps, externalRef: React.Ref<HTMLDivElement>) {\n const { containerRef, size, onResize, variant, showCloseButton, outlet } = useCurrentDrawer();\n const { className, children, ...otherProps } = props;\n const { texts } = useLocalization();\n const ref = useMergedRef<HTMLDivElement>(externalRef);\n\n const contentRef = React.useRef(null);\n\n // if the drawer was opened by a menu, we need to close the menu when the drawer closes\n // the menu is still open (and mounted) because it is the trigger for the drawer\n const menu = useCurrentMenu();\n let finalFocus: DrawerPrimitive.Popup.Props['finalFocus'];\n\n if (menu) {\n finalFocus = () => {\n menu.close();\n };\n }\n\n const containerClassName: string = React.useMemo(() => cn(getDrawerContainerClassNames(variant), className), [className]);\n\n const { contentClassName, dragHandlerClassName } = React.useMemo(() => {\n const contentClassName = getDrawerContentClassNames(size, variant);\n const dragHandlerClassName: string = getDrawerDragHandlerClassNames();\n return { contentClassName, dragHandlerClassName };\n }, [size, variant]);\n\n const [containerWidth, setContainerWidth] = React.useState<number>();\n\n // resize\n const dragHandlerRef = React.useRef<HTMLDivElement>(null);\n\n const {\n position,\n dragging,\n handleProps: dragHandleProps,\n resetPosition,\n } = useDraggable(useMergedRef<HTMLDivElement>(dragHandlerRef));\n\n const resizedWidth = React.useMemo((): number | undefined => {\n if (containerWidth) {\n return Math.min(RESIZE_MAX, Math.max(RESIZE_MIN, containerWidth - position.x || 0));\n }\n return;\n }, [containerWidth, position]);\n\n React.useImperativeHandle(\n containerRef,\n () => ({\n onOpen: () => {\n requestAnimationFrame(() => {\n if (contentRef.current) {\n setContainerWidth((contentRef.current as HTMLElement)?.offsetWidth);\n }\n });\n },\n }),\n []\n );\n\n React.useEffect(() => {\n if (onResize) {\n onResize(position.x);\n }\n }, [position]);\n\n React.useEffect(() => {\n if (!dragging && resizedWidth) {\n setContainerWidth(resizedWidth);\n resetPosition();\n }\n }, [dragging]);\n\n let output;\n\n if (typeof children === 'function') {\n output = (\n <Close>\n <RenderPropWrapper>{children}</RenderPropWrapper>\n </Close>\n );\n } else {\n output = children;\n }\n\n const content = (\n <div ref={contentRef} data-taco=\"drawer\" className={containerClassName}>\n {output}\n <div className={dragHandlerClassName} {...dragHandleProps} data-testid=\"resize-handler\" ref={dragHandlerRef}>\n {dragging ? <div data-testid=\"resize-hit-area\" className=\"fixed bottom-0 left-0 right-0 top-0\" /> : null}\n </div>\n {showCloseButton ? (\n <Close>\n <IconButton\n appearance=\"discrete\"\n aria-label={texts.drawer.close}\n className=\"absolute right-0 top-0 mr-2 mt-4\"\n icon=\"close\"\n />\n </Close>\n ) : null}\n </div>\n );\n\n if (!outlet) {\n return null;\n }\n\n return (\n <DrawerPrimitive.Portal container={outlet ?? undefined} className=\"h-full\">\n {variant === 'overlay' ? (\n <DrawerPrimitive.Backdrop\n className=\"fixed inset-0 cursor-default overflow-y-auto bg-blue-900/[0.3] print:absolute print:overflow-visible\"\n data-taco=\"backdrop\"\n />\n ) : null}\n <DrawerPrimitive.Viewport className=\"h-full\">\n <DrawerPrimitive.Popup\n {...otherProps}\n className={contentClassName}\n finalFocus={finalFocus}\n ref={ref}\n style={{ width: resizedWidth }}>\n <DrawerPrimitive.Content>{content}</DrawerPrimitive.Content>\n </DrawerPrimitive.Popup>\n </DrawerPrimitive.Viewport>\n </DrawerPrimitive.Portal>\n );\n});\n"],"names":["RenderPropWrapper","useMergedRef","useLocalization","useCurrentDrawer","drawer","DrawerPrimitive","IconButton","Actions","Group","InnerContent","Content","useCurrentMenu","getDrawerContainerClassNames","contentClassName","getDrawerContentClassNames","dragHandlerClassName","getDrawerDragHandlerClassNames","useDraggable"],"mappings":";;;;;;;;;;;;;AAaA,MAAM,aAAa;AACnB,MAAM,aAAa;AAOnB,MAAM,oBAAoB,MAAM,WAAW,SAASA,mBAAkB,EAAE,UAAU,SAAS,YAAY,GAAQ,KAAK;AAChH,QAAM,QAAQ,MAAM;AACR,YAAA,IAAI,YAAY,OAAO,CAAC;AAAA,EACpC;AAEA,SAAO,SAAS,EAAE,OAAO,KAAK,GAAG,aAAa;AAClD,CAAC;AAGM,MAAM,QAAQ,MAAM,WAAW,SAAS,YAAY,OAAyB,aAA4C;AAC5H,QAAM,EAAE,WAAW,UAAU,GAAG,WAAe,IAAA;AACzC,QAAA,MAAMC,0BAAiC,WAAW;AACxD,QAAM,CAAC,OAAO,QAAQ,IAAI,MAAM,SAAS,CAAA,CAAE;AACrC,QAAA,EAAE,MAAM,IAAIC,6BAAgB;AAC5B,QAAA,EAAE,YAAY,IAAIC,yBAAiB;AAOnC,QAAA,QAAQ,GAAG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BAAuB,GAAG,iBAAiB,eAAY,kBAAiB,KAAK,eAAA,GACxF,WAAW,sBAAA,cAAC,SAAI,eAAY,mBAAkB,WAAU,uCAAsC,IAAK,IACxG,GACC,sDACI,OACG,MAAA,sBAAA;AAAA,IAACK,WAAA;AAAA,IAAA;AAAA,MACG,YAAW;AAAA,MACX,cAAY,MAAM,OAAO;AAAA,MACzB,WAAU;AAAA,MACV,MAAK;AAAA,IAAA;AAAA,EAEb,CAAA,IACA,IACR;AAGJ,MAAI,CAAC,QAAQ;AACF,WAAA;AAAA,EAAA;AAIP,SAAA,sBAAA,cAACD,OAAgB,OAAA,QAAhB,EAAuB,WAAW,UAAU,QAAW,WAAU,SAC7D,GAAA,YAAY,YACT,sBAAA;AAAA,IAACA,OAAAA,OAAgB;AAAA,IAAhB;AAAA,MACG,WAAU;AAAA,MACV,aAAU;AAAA,IAAA;AAAA,EAAA,IAEd,MACJ,sBAAA,cAACA,cAAgB,UAAhB,EAAyB,WAAU,YAChC,sBAAA;AAAA,IAACA,OAAAA,OAAgB;AAAA,IAAhB;AAAA,MACI,GAAG;AAAA,MACJ,WAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA,OAAO,EAAE,OAAO,aAAa;AAAA,IAAA;AAAA,IAC5B,sBAAA,cAAAA,OAAAA,OAAgB,SAAhB,MAAyB,OAAQ;AAAA,EAAA,CAE1C,CACJ;AAER,CAAC;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"Content.cjs","sources":["../../../../src/components/Drawer/components/Content.tsx"],"sourcesContent":["import React from 'react';\nimport { Drawer as DrawerPrimitive } from '@base-ui/react/drawer';\nimport cn from 'clsx';\n\nimport { Group, GroupProps } from '../../Group/Group';\nimport { IconButton } from '../../IconButton/IconButton';\nimport { useLocalization } from '../../Provider/Localization';\nimport { useCurrentMenu } from '../../Menu/Context';\nimport { useCurrentDrawer } from '../Context';\nimport { useDraggable } from '../../../utils/hooks/useDraggable';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { getDrawerContainerClassNames, getDrawerContentClassNames, getDrawerDragHandlerClassNames } from '../util';\n\nconst RESIZE_MIN = 360;\nconst RESIZE_MAX = 1000;\n\nexport enum DrawerAnimationDefinition {\n Visible = 'visible',\n Hidden = 'hidden',\n}\n\nconst RenderPropWrapper = React.forwardRef(function RenderPropWrapper({ children, onClick, renderProps }: any, ref) {\n const close = () => {\n onClick(new CustomEvent('close'));\n };\n\n return children({ close, ref, ...renderProps });\n});\n\nexport type DrawerTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function DrawerTitle(props: DrawerTitleProps, externalRef: React.Ref<HTMLHeadingElement>) {\n const { className, children, ...otherProps } = props;\n const ref = useMergedRef<HTMLHeadingElement>(externalRef);\n const [style, setStyle] = React.useState({});\n const { texts } = useLocalization();\n const { onClickBack } = useCurrentDrawer();\n\n /**\n * By design in default drawer version Title has grey separator, but we might have exceptions like Drawer + Tabs scenario,\n * where we might want to hide the grey separator. For this reason separator was rendered with using of classNames,\n * so it can be easily overriden in exceptional scenarios.\n * */\n const cName = cn('grow-0 py-4 px-4 justify-self-start mb-0 border-b-[1px] border-gray-200 flex items-start', className);\n\n React.useEffect(() => {\n const drawer = ref?.current?.closest('[data-taco=\"drawer\"]');\n\n // This is the margin amount that we need to deduct from the margins to align with the design\n const marginAdjust = 4;\n\n const closeButton: HTMLButtonElement | null = drawer?.querySelector(`[aria-label=\"${texts.drawer.close}\"]`) ?? null;\n const closeButtonWidth = closeButton?.offsetWidth ?? 0;\n const closeButtonRightMargin = 8;\n\n const actionsWrapper: HTMLSpanElement | null = drawer?.querySelector(`#taco-drawer-actions[data-taco=\"group\"]`) ?? null;\n const actionsWrapperWidth = actionsWrapper?.offsetWidth ?? 0;\n const actionsWrapperRightMargin = 8;\n\n const marginRight =\n closeButtonWidth + actionsWrapperWidth + closeButtonRightMargin + actionsWrapperRightMargin - marginAdjust;\n\n setStyle({ marginRight });\n }, [ref, texts.drawer.close]);\n\n return (\n <DrawerPrimitive.Title className={cName} {...otherProps} ref={ref}>\n {onClickBack ? (\n <IconButton\n appearance=\"discrete\"\n aria-label={texts.drawer.back}\n className=\"mr-3 text-base\"\n icon=\"chevron-left\"\n onClick={onClickBack}\n />\n ) : null}\n {\n // We need to apply the right margin as an inline style instead of using Tailwind CSS.\n // This is necessary because we are creating styles dynamically at runtime,\n // and Tailwind doesn't support generating runtime styles.\n }\n <span className=\"line-clamp-2 inline-block overflow-y-hidden\" style={style}>\n {children}\n </span>\n </DrawerPrimitive.Title>\n );\n});\n\nexport type DrawerFooterProps = React.HTMLAttributes<HTMLDivElement>;\nexport const Footer = React.forwardRef(function DrawerFooter(props: DrawerFooterProps, ref: React.Ref<HTMLDivElement>) {\n const { className: _1, ...otherProps } = props;\n /**\n * The same scenario as Title, grey separator rendered using classNames to have posibility to override it.\n */\n const cName = cn('mt-auto flex justify-end grow-0 p-4 border-t-[1px] border-gray-200', props.className);\n return <div {...otherProps} className={cName} ref={ref} />;\n});\n\nexport const Actions = React.forwardRef(function Actions(props: GroupProps, ref: React.Ref<HTMLDivElement>) {\n const { className, ...otherProps } = props;\n const cName = cn('absolute top-0 right-10 mr-[8px] mt-4', className);\n // Id is added to identify the actions wrapper inside a useEffect in Dialog.Title\n return <Group {...otherProps} className={cName} id=\"taco-drawer-actions\" ref={ref} />;\n});\n\nexport type DrawerCloseProps = React.HTMLAttributes<HTMLButtonElement> & {\n children: React.ReactElement;\n};\n\nexport const Close = React.forwardRef(function DrawerClose(props: DrawerCloseProps, ref: React.Ref<HTMLButtonElement>) {\n const { onClose } = useCurrentDrawer();\n\n const { children, ...restProps } = props;\n\n return <DrawerPrimitive.Close {...restProps} onClick={onClose} ref={ref} render={children} />;\n});\n\nexport type DrawerInnerContentProps = React.HTMLAttributes<HTMLDivElement>;\n/**\n * It is container component, needed to provide default scrolling behaviour and padding, to simplyfy usage, requested by feature devs.\n * It is optional to use InnerContent component, if consumer need to implement custom behaviour or paddings for inner content,\n * then it's simply enough to render children and wrap them in custom implementation.\n */\nexport const InnerContent = React.forwardRef(function InnerContent(\n props: DrawerInnerContentProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const { className, children, ...otherProps } = props;\n return (\n <div {...otherProps} className={cn('flex grow flex-col overflow-y-hidden', className)} ref={ref}>\n <div className=\"w-full gap-y-0.5 overflow-auto p-4\">{children}</div>\n </div>\n );\n});\n\nexport type DrawerContentProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {\n /** An accessible label to be announced when the side drawer is opened */\n 'aria-label': string;\n children: React.ReactNode | ((props: { close: () => void }) => React.ReactNode);\n};\nexport const Content = React.forwardRef(function Content(props: DrawerContentProps, externalRef: React.Ref<HTMLDivElement>) {\n const { containerRef, size, onResize, variant, showCloseButton, outlet } = useCurrentDrawer();\n const { className, children, ...otherProps } = props;\n const { texts } = useLocalization();\n const ref = useMergedRef<HTMLDivElement>(externalRef);\n\n const contentRef = React.useRef(null);\n\n // if the drawer was opened by a menu, we need to close the menu when the drawer closes\n // the menu is still open (and mounted) because it is the trigger for the drawer\n const menu = useCurrentMenu();\n let finalFocus: DrawerPrimitive.Popup.Props['finalFocus'];\n\n if (menu) {\n finalFocus = () => {\n menu.close();\n };\n }\n\n const containerClassName: string = React.useMemo(() => cn(getDrawerContainerClassNames(variant), className), [className]);\n\n const { contentClassName, dragHandlerClassName } = React.useMemo(() => {\n const contentClassName = getDrawerContentClassNames(size, variant);\n const dragHandlerClassName: string = getDrawerDragHandlerClassNames();\n return { contentClassName, dragHandlerClassName };\n }, [size, variant]);\n\n const [containerWidth, setContainerWidth] = React.useState<number>();\n\n // resize\n const dragHandlerRef = React.useRef<HTMLDivElement>(null);\n\n const {\n position,\n dragging,\n handleProps: dragHandleProps,\n resetPosition,\n } = useDraggable(useMergedRef<HTMLDivElement>(dragHandlerRef));\n\n const resizedWidth = React.useMemo((): number | undefined => {\n if (containerWidth) {\n return Math.min(RESIZE_MAX, Math.max(RESIZE_MIN, containerWidth - position.x || 0));\n }\n return;\n }, [containerWidth, position]);\n\n React.useImperativeHandle(\n containerRef,\n () => ({\n onOpen: () => {\n requestAnimationFrame(() => {\n if (contentRef.current) {\n setContainerWidth((contentRef.current as HTMLElement)?.offsetWidth);\n }\n });\n },\n }),\n []\n );\n\n React.useEffect(() => {\n if (onResize) {\n onResize(position.x);\n }\n }, [position]);\n\n React.useEffect(() => {\n if (!dragging && resizedWidth) {\n setContainerWidth(resizedWidth);\n resetPosition();\n }\n }, [dragging]);\n\n let output;\n\n if (typeof children === 'function') {\n output = (\n <Close>\n <RenderPropWrapper>{children}</RenderPropWrapper>\n </Close>\n );\n } else {\n output = children;\n }\n\n const content = (\n <div ref={contentRef} data-taco=\"drawer\" className={containerClassName}>\n {output}\n <div className={dragHandlerClassName} {...dragHandleProps} data-testid=\"resize-handler\" ref={dragHandlerRef}>\n {dragging ? <div data-testid=\"resize-hit-area\" className=\"fixed bottom-0 left-0 right-0 top-0\" /> : null}\n </div>\n {showCloseButton ? (\n <Close>\n <IconButton\n appearance=\"discrete\"\n aria-label={texts.drawer.close}\n className=\"absolute right-0 top-0 mr-2 mt-4\"\n icon=\"close\"\n />\n </Close>\n ) : null}\n </div>\n );\n\n if (!outlet) {\n return null;\n }\n\n return (\n <DrawerPrimitive.Portal container={outlet ?? undefined} className=\"h-full\">\n {variant === 'overlay' ? (\n <DrawerPrimitive.Backdrop\n className=\"bg-brand-midnight/[0.3] fixed inset-0 cursor-default overflow-y-auto print:absolute print:overflow-visible\"\n data-taco=\"backdrop\"\n />\n ) : null}\n <DrawerPrimitive.Viewport className=\"h-full\">\n <DrawerPrimitive.Popup\n {...otherProps}\n className={contentClassName}\n finalFocus={finalFocus}\n ref={ref}\n style={{ width: resizedWidth }}>\n <DrawerPrimitive.Content>{content}</DrawerPrimitive.Content>\n </DrawerPrimitive.Popup>\n </DrawerPrimitive.Viewport>\n </DrawerPrimitive.Portal>\n );\n});\n"],"names":["RenderPropWrapper","useMergedRef","useLocalization","useCurrentDrawer","drawer","DrawerPrimitive","IconButton","Actions","Group","InnerContent","Content","useCurrentMenu","getDrawerContainerClassNames","contentClassName","getDrawerContentClassNames","dragHandlerClassName","getDrawerDragHandlerClassNames","useDraggable"],"mappings":";;;;;;;;;;;;;AAaA,MAAM,aAAa;AACnB,MAAM,aAAa;AAOnB,MAAM,oBAAoB,MAAM,WAAW,SAASA,mBAAkB,EAAE,UAAU,SAAS,YAAY,GAAQ,KAAK;AAChH,QAAM,QAAQ,MAAM;AACR,YAAA,IAAI,YAAY,OAAO,CAAC;AAAA,EACpC;AAEA,SAAO,SAAS,EAAE,OAAO,KAAK,GAAG,aAAa;AAClD,CAAC;AAGM,MAAM,QAAQ,MAAM,WAAW,SAAS,YAAY,OAAyB,aAA4C;AAC5H,QAAM,EAAE,WAAW,UAAU,GAAG,WAAe,IAAA;AACzC,QAAA,MAAMC,0BAAiC,WAAW;AACxD,QAAM,CAAC,OAAO,QAAQ,IAAI,MAAM,SAAS,CAAA,CAAE;AACrC,QAAA,EAAE,MAAM,IAAIC,6BAAgB;AAC5B,QAAA,EAAE,YAAY,IAAIC,yBAAiB;AAOnC,QAAA,QAAQ,GAAG,4FAA4F,SAAS;AAEtH,QAAM,UAAU,MAAM;;AAClB,UAAMC,WAAS,gCAAK,YAAL,mBAAc,QAAQ;AAGrC,UAAM,eAAe;AAEf,UAAA,eAAwCA,WAAA,gBAAAA,QAAQ,cAAc,gBAAgB,MAAM,OAAO,KAAK,UAAS;AACzG,UAAA,oBAAmB,2CAAa,gBAAe;AACrD,UAAM,yBAAyB;AAE/B,UAAM,kBAAyCA,WAAA,gBAAAA,QAAQ,cAAc,+CAA8C;AAC7G,UAAA,uBAAsB,iDAAgB,gBAAe;AAC3D,UAAM,4BAA4B;AAElC,UAAM,cACF,mBAAmB,sBAAsB,yBAAyB,4BAA4B;AAEzF,aAAA,EAAE,aAAa;AAAA,KACzB,CAAC,KAAK,MAAM,OAAO,KAAK,CAAC;AAGxB,SAAA,sBAAA,cAACC,cAAgB,OAAhB,EAAsB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AA,IAAA;AAAA,EAAA,IAEd,MACJ,sBAAA,cAACA,cAAgB,UAAhB,EAAyB,WAAU,YAChC,sBAAA;AAAA,IAACA,OAAAA,OAAgB;AAAA,IAAhB;AAAA,MACI,GAAG;AAAA,MACJ,WAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA,OAAO,EAAE,OAAO,aAAa;AAAA,IAAA;AAAA,IAC5B,sBAAA,cAAAA,OAAAA,OAAgB,SAAhB,MAAyB,OAAQ;AAAA,EAAA,CAE1C,CACJ;AAER,CAAC;;;;;;;"}
|
|
@@ -23,7 +23,7 @@ const Title = React__default.forwardRef(function DrawerTitle(props, externalRef)
|
|
|
23
23
|
const [style, setStyle] = React__default.useState({});
|
|
24
24
|
const { texts } = useLocalization();
|
|
25
25
|
const { onClickBack } = useCurrentDrawer();
|
|
26
|
-
const cName = cn("grow-0 py-4 px-4 justify-self-start mb-0 border-b-[1px] border-gray-
|
|
26
|
+
const cName = cn("grow-0 py-4 px-4 justify-self-start mb-0 border-b-[1px] border-gray-200 flex items-start", className);
|
|
27
27
|
React__default.useEffect(() => {
|
|
28
28
|
var _a;
|
|
29
29
|
const drawer = (_a = ref == null ? void 0 : ref.current) == null ? void 0 : _a.closest('[data-taco="drawer"]');
|
|
@@ -50,7 +50,7 @@ const Title = React__default.forwardRef(function DrawerTitle(props, externalRef)
|
|
|
50
50
|
});
|
|
51
51
|
const Footer = React__default.forwardRef(function DrawerFooter(props, ref) {
|
|
52
52
|
const { className: _1, ...otherProps } = props;
|
|
53
|
-
const cName = cn("mt-auto flex justify-end grow-0 p-4 border-t-[1px] border-gray-
|
|
53
|
+
const cName = cn("mt-auto flex justify-end grow-0 p-4 border-t-[1px] border-gray-200", props.className);
|
|
54
54
|
return /* @__PURE__ */ React__default.createElement("div", { ...otherProps, className: cName, ref });
|
|
55
55
|
});
|
|
56
56
|
const Actions = React__default.forwardRef(function Actions2(props, ref) {
|
|
@@ -146,7 +146,7 @@ const Content = React__default.forwardRef(function Content2(props, externalRef)
|
|
|
146
146
|
return /* @__PURE__ */ React__default.createElement(Drawer.Portal, { container: outlet ?? void 0, className: "h-full" }, variant === "overlay" ? /* @__PURE__ */ React__default.createElement(
|
|
147
147
|
Drawer.Backdrop,
|
|
148
148
|
{
|
|
149
|
-
className: "fixed inset-0 cursor-default overflow-y-auto
|
|
149
|
+
className: "bg-brand-midnight/[0.3] fixed inset-0 cursor-default overflow-y-auto print:absolute print:overflow-visible",
|
|
150
150
|
"data-taco": "backdrop"
|
|
151
151
|
}
|
|
152
152
|
) : null, /* @__PURE__ */ React__default.createElement(Drawer.Viewport, { className: "h-full" }, /* @__PURE__ */ React__default.createElement(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Content.js","sources":["../../../../src/components/Drawer/components/Content.tsx"],"sourcesContent":["import React from 'react';\nimport { Drawer as DrawerPrimitive } from '@base-ui/react/drawer';\nimport cn from 'clsx';\n\nimport { Group, GroupProps } from '../../Group/Group';\nimport { IconButton } from '../../IconButton/IconButton';\nimport { useLocalization } from '../../Provider/Localization';\nimport { useCurrentMenu } from '../../Menu/Context';\nimport { useCurrentDrawer } from '../Context';\nimport { useDraggable } from '../../../utils/hooks/useDraggable';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { getDrawerContainerClassNames, getDrawerContentClassNames, getDrawerDragHandlerClassNames } from '../util';\n\nconst RESIZE_MIN = 360;\nconst RESIZE_MAX = 1000;\n\nexport enum DrawerAnimationDefinition {\n Visible = 'visible',\n Hidden = 'hidden',\n}\n\nconst RenderPropWrapper = React.forwardRef(function RenderPropWrapper({ children, onClick, renderProps }: any, ref) {\n const close = () => {\n onClick(new CustomEvent('close'));\n };\n\n return children({ close, ref, ...renderProps });\n});\n\nexport type DrawerTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function DrawerTitle(props: DrawerTitleProps, externalRef: React.Ref<HTMLHeadingElement>) {\n const { className, children, ...otherProps } = props;\n const ref = useMergedRef<HTMLHeadingElement>(externalRef);\n const [style, setStyle] = React.useState({});\n const { texts } = useLocalization();\n const { onClickBack } = useCurrentDrawer();\n\n /**\n * By design in default drawer version Title has grey separator, but we might have exceptions like Drawer + Tabs scenario,\n * where we might want to hide the grey separator. For this reason separator was rendered with using of classNames,\n * so it can be easily overriden in exceptional scenarios.\n * */\n const cName = cn('grow-0 py-4 px-4 justify-self-start mb-0 border-b-[1px] border-gray-300 flex items-start', className);\n\n React.useEffect(() => {\n const drawer = ref?.current?.closest('[data-taco=\"drawer\"]');\n\n // This is the margin amount that we need to deduct from the margins to align with the design\n const marginAdjust = 4;\n\n const closeButton: HTMLButtonElement | null = drawer?.querySelector(`[aria-label=\"${texts.drawer.close}\"]`) ?? null;\n const closeButtonWidth = closeButton?.offsetWidth ?? 0;\n const closeButtonRightMargin = 8;\n\n const actionsWrapper: HTMLSpanElement | null = drawer?.querySelector(`#taco-drawer-actions[data-taco=\"group\"]`) ?? null;\n const actionsWrapperWidth = actionsWrapper?.offsetWidth ?? 0;\n const actionsWrapperRightMargin = 8;\n\n const marginRight =\n closeButtonWidth + actionsWrapperWidth + closeButtonRightMargin + actionsWrapperRightMargin - marginAdjust;\n\n setStyle({ marginRight });\n }, [ref, texts.drawer.close]);\n\n return (\n <DrawerPrimitive.Title className={cName} {...otherProps} ref={ref}>\n {onClickBack ? (\n <IconButton\n appearance=\"discrete\"\n aria-label={texts.drawer.back}\n className=\"mr-3 text-base\"\n icon=\"chevron-left\"\n onClick={onClickBack}\n />\n ) : null}\n {\n // We need to apply the right margin as an inline style instead of using Tailwind CSS.\n // This is necessary because we are creating styles dynamically at runtime,\n // and Tailwind doesn't support generating runtime styles.\n }\n <span className=\"line-clamp-2 inline-block overflow-y-hidden\" style={style}>\n {children}\n </span>\n </DrawerPrimitive.Title>\n );\n});\n\nexport type DrawerFooterProps = React.HTMLAttributes<HTMLDivElement>;\nexport const Footer = React.forwardRef(function DrawerFooter(props: DrawerFooterProps, ref: React.Ref<HTMLDivElement>) {\n const { className: _1, ...otherProps } = props;\n /**\n * The same scenario as Title, grey separator rendered using classNames to have posibility to override it.\n */\n const cName = cn('mt-auto flex justify-end grow-0 p-4 border-t-[1px] border-gray-300', props.className);\n return <div {...otherProps} className={cName} ref={ref} />;\n});\n\nexport const Actions = React.forwardRef(function Actions(props: GroupProps, ref: React.Ref<HTMLDivElement>) {\n const { className, ...otherProps } = props;\n const cName = cn('absolute top-0 right-10 mr-[8px] mt-4', className);\n // Id is added to identify the actions wrapper inside a useEffect in Dialog.Title\n return <Group {...otherProps} className={cName} id=\"taco-drawer-actions\" ref={ref} />;\n});\n\nexport type DrawerCloseProps = React.HTMLAttributes<HTMLButtonElement> & {\n children: React.ReactElement;\n};\n\nexport const Close = React.forwardRef(function DrawerClose(props: DrawerCloseProps, ref: React.Ref<HTMLButtonElement>) {\n const { onClose } = useCurrentDrawer();\n\n const { children, ...restProps } = props;\n\n return <DrawerPrimitive.Close {...restProps} onClick={onClose} ref={ref} render={children} />;\n});\n\nexport type DrawerInnerContentProps = React.HTMLAttributes<HTMLDivElement>;\n/**\n * It is container component, needed to provide default scrolling behaviour and padding, to simplyfy usage, requested by feature devs.\n * It is optional to use InnerContent component, if consumer need to implement custom behaviour or paddings for inner content,\n * then it's simply enough to render children and wrap them in custom implementation.\n */\nexport const InnerContent = React.forwardRef(function InnerContent(\n props: DrawerInnerContentProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const { className, children, ...otherProps } = props;\n return (\n <div {...otherProps} className={cn('flex grow flex-col overflow-y-hidden', className)} ref={ref}>\n <div className=\"w-full gap-y-0.5 overflow-auto p-4\">{children}</div>\n </div>\n );\n});\n\nexport type DrawerContentProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {\n /** An accessible label to be announced when the side drawer is opened */\n 'aria-label': string;\n children: React.ReactNode | ((props: { close: () => void }) => React.ReactNode);\n};\nexport const Content = React.forwardRef(function Content(props: DrawerContentProps, externalRef: React.Ref<HTMLDivElement>) {\n const { containerRef, size, onResize, variant, showCloseButton, outlet } = useCurrentDrawer();\n const { className, children, ...otherProps } = props;\n const { texts } = useLocalization();\n const ref = useMergedRef<HTMLDivElement>(externalRef);\n\n const contentRef = React.useRef(null);\n\n // if the drawer was opened by a menu, we need to close the menu when the drawer closes\n // the menu is still open (and mounted) because it is the trigger for the drawer\n const menu = useCurrentMenu();\n let finalFocus: DrawerPrimitive.Popup.Props['finalFocus'];\n\n if (menu) {\n finalFocus = () => {\n menu.close();\n };\n }\n\n const containerClassName: string = React.useMemo(() => cn(getDrawerContainerClassNames(variant), className), [className]);\n\n const { contentClassName, dragHandlerClassName } = React.useMemo(() => {\n const contentClassName = getDrawerContentClassNames(size, variant);\n const dragHandlerClassName: string = getDrawerDragHandlerClassNames();\n return { contentClassName, dragHandlerClassName };\n }, [size, variant]);\n\n const [containerWidth, setContainerWidth] = React.useState<number>();\n\n // resize\n const dragHandlerRef = React.useRef<HTMLDivElement>(null);\n\n const {\n position,\n dragging,\n handleProps: dragHandleProps,\n resetPosition,\n } = useDraggable(useMergedRef<HTMLDivElement>(dragHandlerRef));\n\n const resizedWidth = React.useMemo((): number | undefined => {\n if (containerWidth) {\n return Math.min(RESIZE_MAX, Math.max(RESIZE_MIN, containerWidth - position.x || 0));\n }\n return;\n }, [containerWidth, position]);\n\n React.useImperativeHandle(\n containerRef,\n () => ({\n onOpen: () => {\n requestAnimationFrame(() => {\n if (contentRef.current) {\n setContainerWidth((contentRef.current as HTMLElement)?.offsetWidth);\n }\n });\n },\n }),\n []\n );\n\n React.useEffect(() => {\n if (onResize) {\n onResize(position.x);\n }\n }, [position]);\n\n React.useEffect(() => {\n if (!dragging && resizedWidth) {\n setContainerWidth(resizedWidth);\n resetPosition();\n }\n }, [dragging]);\n\n let output;\n\n if (typeof children === 'function') {\n output = (\n <Close>\n <RenderPropWrapper>{children}</RenderPropWrapper>\n </Close>\n );\n } else {\n output = children;\n }\n\n const content = (\n <div ref={contentRef} data-taco=\"drawer\" className={containerClassName}>\n {output}\n <div className={dragHandlerClassName} {...dragHandleProps} data-testid=\"resize-handler\" ref={dragHandlerRef}>\n {dragging ? <div data-testid=\"resize-hit-area\" className=\"fixed bottom-0 left-0 right-0 top-0\" /> : null}\n </div>\n {showCloseButton ? (\n <Close>\n <IconButton\n appearance=\"discrete\"\n aria-label={texts.drawer.close}\n className=\"absolute right-0 top-0 mr-2 mt-4\"\n icon=\"close\"\n />\n </Close>\n ) : null}\n </div>\n );\n\n if (!outlet) {\n return null;\n }\n\n return (\n <DrawerPrimitive.Portal container={outlet ?? undefined} className=\"h-full\">\n {variant === 'overlay' ? (\n <DrawerPrimitive.Backdrop\n className=\"fixed inset-0 cursor-default overflow-y-auto bg-blue-900/[0.3] print:absolute print:overflow-visible\"\n data-taco=\"backdrop\"\n />\n ) : null}\n <DrawerPrimitive.Viewport className=\"h-full\">\n <DrawerPrimitive.Popup\n {...otherProps}\n className={contentClassName}\n finalFocus={finalFocus}\n ref={ref}\n style={{ width: resizedWidth }}>\n <DrawerPrimitive.Content>{content}</DrawerPrimitive.Content>\n </DrawerPrimitive.Popup>\n </DrawerPrimitive.Viewport>\n </DrawerPrimitive.Portal>\n );\n});\n"],"names":["React","RenderPropWrapper","DrawerPrimitive","Actions","InnerContent","Content","contentClassName","dragHandlerClassName"],"mappings":";;;;;;;;;;;AAaA,MAAM,aAAa;AACnB,MAAM,aAAa;AAOnB,MAAM,oBAAoBA,eAAM,WAAW,SAASC,mBAAkB,EAAE,UAAU,SAAS,YAAY,GAAQ,KAAK;AAChH,QAAM,QAAQ,MAAM;AACR,YAAA,IAAI,YAAY,OAAO,CAAC;AAAA,EACpC;AAEA,SAAO,SAAS,EAAE,OAAO,KAAK,GAAG,aAAa;AAClD,CAAC;AAGM,MAAM,QAAQD,eAAM,WAAW,SAAS,YAAY,OAAyB,aAA4C;AAC5H,QAAM,EAAE,WAAW,UAAU,GAAG,WAAe,IAAA;AACzC,QAAA,MAAM,aAAiC,WAAW;AACxD,QAAM,CAAC,OAAO,QAAQ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AAI,EAAA,KAAK,YAAY,aAAU,UAAS,WAAW,sBAC/C,QACDA,+BAAA,cAAC,OAAI,EAAA,WAAW,sBAAuB,GAAG,iBAAiB,eAAY,kBAAiB,KAAK,eAAA,GACxF,WAAWA,+BAAA,cAAC,SAAI,eAAY,mBAAkB,WAAU,uCAAsC,IAAK,IACxG,GACC,+DACI,OACG,MAAAA,+BAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,YAAW;AAAA,MACX,cAAY,MAAM,OAAO;AAAA,MACzB,WAAU;AAAA,MACV,MAAK;AAAA,IAAA;AAAA,EAEb,CAAA,IACA,IACR;AAGJ,MAAI,CAAC,QAAQ;AACF,WAAA;AAAA,EAAA;AAIP,SAAAA,+BAAA,cAACE,OAAgB,QAAhB,EAAuB,WAAW,UAAU,QAAW,WAAU,SAC7D,GAAA,YAAY,YACTF,+BAAA;AAAA,IAACE,OAAgB;AAAA,IAAhB;AAAA,MACG,WAAU;AAAA,MACV,aAAU;AAAA,IAAA;AAAA,EAAA,IAEd,MACJF,+BAAA,cAACE,OAAgB,UAAhB,EAAyB,WAAU,YAChCF,+BAAA;AAAA,IAACE,OAAgB;AAAA,IAAhB;AAAA,MACI,GAAG;AAAA,MACJ,WAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA,OAAO,EAAE,OAAO,aAAa;AAAA,IAAA;AAAA,IAC5BF,+BAAA,cAAAE,OAAgB,SAAhB,MAAyB,OAAQ;AAAA,EAAA,CAE1C,CACJ;AAER,CAAC;"}
|
|
1
|
+
{"version":3,"file":"Content.js","sources":["../../../../src/components/Drawer/components/Content.tsx"],"sourcesContent":["import React from 'react';\nimport { Drawer as DrawerPrimitive } from '@base-ui/react/drawer';\nimport cn from 'clsx';\n\nimport { Group, GroupProps } from '../../Group/Group';\nimport { IconButton } from '../../IconButton/IconButton';\nimport { useLocalization } from '../../Provider/Localization';\nimport { useCurrentMenu } from '../../Menu/Context';\nimport { useCurrentDrawer } from '../Context';\nimport { useDraggable } from '../../../utils/hooks/useDraggable';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { getDrawerContainerClassNames, getDrawerContentClassNames, getDrawerDragHandlerClassNames } from '../util';\n\nconst RESIZE_MIN = 360;\nconst RESIZE_MAX = 1000;\n\nexport enum DrawerAnimationDefinition {\n Visible = 'visible',\n Hidden = 'hidden',\n}\n\nconst RenderPropWrapper = React.forwardRef(function RenderPropWrapper({ children, onClick, renderProps }: any, ref) {\n const close = () => {\n onClick(new CustomEvent('close'));\n };\n\n return children({ close, ref, ...renderProps });\n});\n\nexport type DrawerTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function DrawerTitle(props: DrawerTitleProps, externalRef: React.Ref<HTMLHeadingElement>) {\n const { className, children, ...otherProps } = props;\n const ref = useMergedRef<HTMLHeadingElement>(externalRef);\n const [style, setStyle] = React.useState({});\n const { texts } = useLocalization();\n const { onClickBack } = useCurrentDrawer();\n\n /**\n * By design in default drawer version Title has grey separator, but we might have exceptions like Drawer + Tabs scenario,\n * where we might want to hide the grey separator. For this reason separator was rendered with using of classNames,\n * so it can be easily overriden in exceptional scenarios.\n * */\n const cName = cn('grow-0 py-4 px-4 justify-self-start mb-0 border-b-[1px] border-gray-200 flex items-start', className);\n\n React.useEffect(() => {\n const drawer = ref?.current?.closest('[data-taco=\"drawer\"]');\n\n // This is the margin amount that we need to deduct from the margins to align with the design\n const marginAdjust = 4;\n\n const closeButton: HTMLButtonElement | null = drawer?.querySelector(`[aria-label=\"${texts.drawer.close}\"]`) ?? null;\n const closeButtonWidth = closeButton?.offsetWidth ?? 0;\n const closeButtonRightMargin = 8;\n\n const actionsWrapper: HTMLSpanElement | null = drawer?.querySelector(`#taco-drawer-actions[data-taco=\"group\"]`) ?? null;\n const actionsWrapperWidth = actionsWrapper?.offsetWidth ?? 0;\n const actionsWrapperRightMargin = 8;\n\n const marginRight =\n closeButtonWidth + actionsWrapperWidth + closeButtonRightMargin + actionsWrapperRightMargin - marginAdjust;\n\n setStyle({ marginRight });\n }, [ref, texts.drawer.close]);\n\n return (\n <DrawerPrimitive.Title className={cName} {...otherProps} ref={ref}>\n {onClickBack ? (\n <IconButton\n appearance=\"discrete\"\n aria-label={texts.drawer.back}\n className=\"mr-3 text-base\"\n icon=\"chevron-left\"\n onClick={onClickBack}\n />\n ) : null}\n {\n // We need to apply the right margin as an inline style instead of using Tailwind CSS.\n // This is necessary because we are creating styles dynamically at runtime,\n // and Tailwind doesn't support generating runtime styles.\n }\n <span className=\"line-clamp-2 inline-block overflow-y-hidden\" style={style}>\n {children}\n </span>\n </DrawerPrimitive.Title>\n );\n});\n\nexport type DrawerFooterProps = React.HTMLAttributes<HTMLDivElement>;\nexport const Footer = React.forwardRef(function DrawerFooter(props: DrawerFooterProps, ref: React.Ref<HTMLDivElement>) {\n const { className: _1, ...otherProps } = props;\n /**\n * The same scenario as Title, grey separator rendered using classNames to have posibility to override it.\n */\n const cName = cn('mt-auto flex justify-end grow-0 p-4 border-t-[1px] border-gray-200', props.className);\n return <div {...otherProps} className={cName} ref={ref} />;\n});\n\nexport const Actions = React.forwardRef(function Actions(props: GroupProps, ref: React.Ref<HTMLDivElement>) {\n const { className, ...otherProps } = props;\n const cName = cn('absolute top-0 right-10 mr-[8px] mt-4', className);\n // Id is added to identify the actions wrapper inside a useEffect in Dialog.Title\n return <Group {...otherProps} className={cName} id=\"taco-drawer-actions\" ref={ref} />;\n});\n\nexport type DrawerCloseProps = React.HTMLAttributes<HTMLButtonElement> & {\n children: React.ReactElement;\n};\n\nexport const Close = React.forwardRef(function DrawerClose(props: DrawerCloseProps, ref: React.Ref<HTMLButtonElement>) {\n const { onClose } = useCurrentDrawer();\n\n const { children, ...restProps } = props;\n\n return <DrawerPrimitive.Close {...restProps} onClick={onClose} ref={ref} render={children} />;\n});\n\nexport type DrawerInnerContentProps = React.HTMLAttributes<HTMLDivElement>;\n/**\n * It is container component, needed to provide default scrolling behaviour and padding, to simplyfy usage, requested by feature devs.\n * It is optional to use InnerContent component, if consumer need to implement custom behaviour or paddings for inner content,\n * then it's simply enough to render children and wrap them in custom implementation.\n */\nexport const InnerContent = React.forwardRef(function InnerContent(\n props: DrawerInnerContentProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const { className, children, ...otherProps } = props;\n return (\n <div {...otherProps} className={cn('flex grow flex-col overflow-y-hidden', className)} ref={ref}>\n <div className=\"w-full gap-y-0.5 overflow-auto p-4\">{children}</div>\n </div>\n );\n});\n\nexport type DrawerContentProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {\n /** An accessible label to be announced when the side drawer is opened */\n 'aria-label': string;\n children: React.ReactNode | ((props: { close: () => void }) => React.ReactNode);\n};\nexport const Content = React.forwardRef(function Content(props: DrawerContentProps, externalRef: React.Ref<HTMLDivElement>) {\n const { containerRef, size, onResize, variant, showCloseButton, outlet } = useCurrentDrawer();\n const { className, children, ...otherProps } = props;\n const { texts } = useLocalization();\n const ref = useMergedRef<HTMLDivElement>(externalRef);\n\n const contentRef = React.useRef(null);\n\n // if the drawer was opened by a menu, we need to close the menu when the drawer closes\n // the menu is still open (and mounted) because it is the trigger for the drawer\n const menu = useCurrentMenu();\n let finalFocus: DrawerPrimitive.Popup.Props['finalFocus'];\n\n if (menu) {\n finalFocus = () => {\n menu.close();\n };\n }\n\n const containerClassName: string = React.useMemo(() => cn(getDrawerContainerClassNames(variant), className), [className]);\n\n const { contentClassName, dragHandlerClassName } = React.useMemo(() => {\n const contentClassName = getDrawerContentClassNames(size, variant);\n const dragHandlerClassName: string = getDrawerDragHandlerClassNames();\n return { contentClassName, dragHandlerClassName };\n }, [size, variant]);\n\n const [containerWidth, setContainerWidth] = React.useState<number>();\n\n // resize\n const dragHandlerRef = React.useRef<HTMLDivElement>(null);\n\n const {\n position,\n dragging,\n handleProps: dragHandleProps,\n resetPosition,\n } = useDraggable(useMergedRef<HTMLDivElement>(dragHandlerRef));\n\n const resizedWidth = React.useMemo((): number | undefined => {\n if (containerWidth) {\n return Math.min(RESIZE_MAX, Math.max(RESIZE_MIN, containerWidth - position.x || 0));\n }\n return;\n }, [containerWidth, position]);\n\n React.useImperativeHandle(\n containerRef,\n () => ({\n onOpen: () => {\n requestAnimationFrame(() => {\n if (contentRef.current) {\n setContainerWidth((contentRef.current as HTMLElement)?.offsetWidth);\n }\n });\n },\n }),\n []\n );\n\n React.useEffect(() => {\n if (onResize) {\n onResize(position.x);\n }\n }, [position]);\n\n React.useEffect(() => {\n if (!dragging && resizedWidth) {\n setContainerWidth(resizedWidth);\n resetPosition();\n }\n }, [dragging]);\n\n let output;\n\n if (typeof children === 'function') {\n output = (\n <Close>\n <RenderPropWrapper>{children}</RenderPropWrapper>\n </Close>\n );\n } else {\n output = children;\n }\n\n const content = (\n <div ref={contentRef} data-taco=\"drawer\" className={containerClassName}>\n {output}\n <div className={dragHandlerClassName} {...dragHandleProps} data-testid=\"resize-handler\" ref={dragHandlerRef}>\n {dragging ? <div data-testid=\"resize-hit-area\" className=\"fixed bottom-0 left-0 right-0 top-0\" /> : null}\n </div>\n {showCloseButton ? (\n <Close>\n <IconButton\n appearance=\"discrete\"\n aria-label={texts.drawer.close}\n className=\"absolute right-0 top-0 mr-2 mt-4\"\n icon=\"close\"\n />\n </Close>\n ) : null}\n </div>\n );\n\n if (!outlet) {\n return null;\n }\n\n return (\n <DrawerPrimitive.Portal container={outlet ?? undefined} className=\"h-full\">\n {variant === 'overlay' ? (\n <DrawerPrimitive.Backdrop\n className=\"bg-brand-midnight/[0.3] fixed inset-0 cursor-default overflow-y-auto print:absolute print:overflow-visible\"\n data-taco=\"backdrop\"\n />\n ) : null}\n <DrawerPrimitive.Viewport className=\"h-full\">\n <DrawerPrimitive.Popup\n {...otherProps}\n className={contentClassName}\n finalFocus={finalFocus}\n ref={ref}\n style={{ width: resizedWidth }}>\n <DrawerPrimitive.Content>{content}</DrawerPrimitive.Content>\n </DrawerPrimitive.Popup>\n </DrawerPrimitive.Viewport>\n </DrawerPrimitive.Portal>\n );\n});\n"],"names":["React","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AAA,MACI,GAAG;AAAA,MACJ,WAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA,OAAO,EAAE,OAAO,aAAa;AAAA,IAAA;AAAA,IAC5BF,+BAAA,cAAAE,OAAgB,SAAhB,MAAyB,OAAQ;AAAA,EAAA,CAE1C,CACJ;AAER,CAAC;"}
|
|
@@ -22,7 +22,7 @@ const getDrawerContentClassNames = (size, variant) => {
|
|
|
22
22
|
const getDrawerContainerClassNames = (variant) => {
|
|
23
23
|
return cn("bg-white mx-auto absolute h-full w-full flex flex-col ", {
|
|
24
24
|
"shadow-[0_6px_9px_0_rgba(89,85,98,0.3),0_0_1px_0_rgba(89,85,98,0.2)]": variant === "overlay",
|
|
25
|
-
"border-l border-gray-
|
|
25
|
+
"border-l border-gray-200 h-full": variant === "embedded"
|
|
26
26
|
});
|
|
27
27
|
};
|
|
28
28
|
const getDrawerDragHandlerClassNames = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.cjs","sources":["../../../src/components/Drawer/util.ts"],"sourcesContent":["import { DrawerSize, DrawerVariant } from './types';\nimport cn from 'clsx';\n\nexport const getDrawerSizeClassnames = (size: DrawerSize): string => {\n switch (size) {\n case 'lg':\n return 'w-[600px]';\n default:\n return 'w-[420px]';\n }\n};\n\nexport const getDrawerPrimitiveContentClassNames = (): string => {\n return 'fixed bottom-0 top-0 right-0';\n};\n\nexport const getDrawerContentClassNames = (size: DrawerSize, variant: DrawerVariant): string => {\n return cn(\n 'bg-white h-full bottom-0 top-0 right-0 transition-none',\n {\n fixed: variant === 'overlay',\n 'relative h-full overflow-hidden': variant === 'embedded',\n },\n getDrawerSizeClassnames(size)\n );\n};\n\nexport const getDrawerContainerClassNames = (variant: DrawerVariant): string => {\n return cn('bg-white mx-auto absolute h-full w-full flex flex-col ', {\n 'shadow-[0_6px_9px_0_rgba(89,85,98,0.3),0_0_1px_0_rgba(89,85,98,0.2)]': variant === 'overlay',\n 'border-l border-gray-
|
|
1
|
+
{"version":3,"file":"util.cjs","sources":["../../../src/components/Drawer/util.ts"],"sourcesContent":["import { DrawerSize, DrawerVariant } from './types';\nimport cn from 'clsx';\n\nexport const getDrawerSizeClassnames = (size: DrawerSize): string => {\n switch (size) {\n case 'lg':\n return 'w-[600px]';\n default:\n return 'w-[420px]';\n }\n};\n\nexport const getDrawerPrimitiveContentClassNames = (): string => {\n return 'fixed bottom-0 top-0 right-0';\n};\n\nexport const getDrawerContentClassNames = (size: DrawerSize, variant: DrawerVariant): string => {\n return cn(\n 'bg-white h-full bottom-0 top-0 right-0 transition-none',\n {\n fixed: variant === 'overlay',\n 'relative h-full overflow-hidden': variant === 'embedded',\n },\n getDrawerSizeClassnames(size)\n );\n};\n\nexport const getDrawerContainerClassNames = (variant: DrawerVariant): string => {\n return cn('bg-white mx-auto absolute h-full w-full flex flex-col ', {\n 'shadow-[0_6px_9px_0_rgba(89,85,98,0.3),0_0_1px_0_rgba(89,85,98,0.2)]': variant === 'overlay',\n 'border-l border-gray-200 h-full': variant === 'embedded',\n });\n};\n\nexport const getDrawerDragHandlerClassNames = (): string => {\n return cn('border-[2px] absolute border-transparent top-0 w-2 h-full cursor-ew-resize left-0 hover:border-l-blue-500');\n};\n"],"names":[],"mappings":";;;AAGa,MAAA,0BAA0B,CAAC,SAA6B;AACjE,UAAQ,MAAM;AAAA,IACV,KAAK;AACM,aAAA;AAAA,IACX;AACW,aAAA;AAAA,EAAA;AAEnB;AAMa,MAAA,6BAA6B,CAAC,MAAkB,YAAmC;AACrF,SAAA;AAAA,IACH;AAAA,IACA;AAAA,MACI,OAAO,YAAY;AAAA,MACnB,mCAAmC,YAAY;AAAA,IACnD;AAAA,IACA,wBAAwB,IAAI;AAAA,EAChC;AACJ;AAEa,MAAA,+BAA+B,CAAC,YAAmC;AAC5E,SAAO,GAAG,0DAA0D;AAAA,IAChE,wEAAwE,YAAY;AAAA,IACpF,mCAAmC,YAAY;AAAA,EAAA,CAClD;AACL;AAEO,MAAM,iCAAiC,MAAc;AACxD,SAAO,GAAG,2GAA2G;AACzH;;;;;"}
|
|
@@ -20,7 +20,7 @@ const getDrawerContentClassNames = (size, variant) => {
|
|
|
20
20
|
const getDrawerContainerClassNames = (variant) => {
|
|
21
21
|
return cn("bg-white mx-auto absolute h-full w-full flex flex-col ", {
|
|
22
22
|
"shadow-[0_6px_9px_0_rgba(89,85,98,0.3),0_0_1px_0_rgba(89,85,98,0.2)]": variant === "overlay",
|
|
23
|
-
"border-l border-gray-
|
|
23
|
+
"border-l border-gray-200 h-full": variant === "embedded"
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
26
|
const getDrawerDragHandlerClassNames = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sources":["../../../src/components/Drawer/util.ts"],"sourcesContent":["import { DrawerSize, DrawerVariant } from './types';\nimport cn from 'clsx';\n\nexport const getDrawerSizeClassnames = (size: DrawerSize): string => {\n switch (size) {\n case 'lg':\n return 'w-[600px]';\n default:\n return 'w-[420px]';\n }\n};\n\nexport const getDrawerPrimitiveContentClassNames = (): string => {\n return 'fixed bottom-0 top-0 right-0';\n};\n\nexport const getDrawerContentClassNames = (size: DrawerSize, variant: DrawerVariant): string => {\n return cn(\n 'bg-white h-full bottom-0 top-0 right-0 transition-none',\n {\n fixed: variant === 'overlay',\n 'relative h-full overflow-hidden': variant === 'embedded',\n },\n getDrawerSizeClassnames(size)\n );\n};\n\nexport const getDrawerContainerClassNames = (variant: DrawerVariant): string => {\n return cn('bg-white mx-auto absolute h-full w-full flex flex-col ', {\n 'shadow-[0_6px_9px_0_rgba(89,85,98,0.3),0_0_1px_0_rgba(89,85,98,0.2)]': variant === 'overlay',\n 'border-l border-gray-
|
|
1
|
+
{"version":3,"file":"util.js","sources":["../../../src/components/Drawer/util.ts"],"sourcesContent":["import { DrawerSize, DrawerVariant } from './types';\nimport cn from 'clsx';\n\nexport const getDrawerSizeClassnames = (size: DrawerSize): string => {\n switch (size) {\n case 'lg':\n return 'w-[600px]';\n default:\n return 'w-[420px]';\n }\n};\n\nexport const getDrawerPrimitiveContentClassNames = (): string => {\n return 'fixed bottom-0 top-0 right-0';\n};\n\nexport const getDrawerContentClassNames = (size: DrawerSize, variant: DrawerVariant): string => {\n return cn(\n 'bg-white h-full bottom-0 top-0 right-0 transition-none',\n {\n fixed: variant === 'overlay',\n 'relative h-full overflow-hidden': variant === 'embedded',\n },\n getDrawerSizeClassnames(size)\n );\n};\n\nexport const getDrawerContainerClassNames = (variant: DrawerVariant): string => {\n return cn('bg-white mx-auto absolute h-full w-full flex flex-col ', {\n 'shadow-[0_6px_9px_0_rgba(89,85,98,0.3),0_0_1px_0_rgba(89,85,98,0.2)]': variant === 'overlay',\n 'border-l border-gray-200 h-full': variant === 'embedded',\n });\n};\n\nexport const getDrawerDragHandlerClassNames = (): string => {\n return cn('border-[2px] absolute border-transparent top-0 w-2 h-full cursor-ew-resize left-0 hover:border-l-blue-500');\n};\n"],"names":[],"mappings":";AAGa,MAAA,0BAA0B,CAAC,SAA6B;AACjE,UAAQ,MAAM;AAAA,IACV,KAAK;AACM,aAAA;AAAA,IACX;AACW,aAAA;AAAA,EAAA;AAEnB;AAMa,MAAA,6BAA6B,CAAC,MAAkB,YAAmC;AACrF,SAAA;AAAA,IACH;AAAA,IACA;AAAA,MACI,OAAO,YAAY;AAAA,MACnB,mCAAmC,YAAY;AAAA,IACnD;AAAA,IACA,wBAAwB,IAAI;AAAA,EAChC;AACJ;AAEa,MAAA,+BAA+B,CAAC,YAAmC;AAC5E,SAAO,GAAG,0DAA0D;AAAA,IAChE,wEAAwE,YAAY;AAAA,IACpF,mCAAmC,YAAY;AAAA,EAAA,CAClD;AACL;AAEO,MAAM,iCAAiC,MAAc;AACxD,SAAO,GAAG,2GAA2G;AACzH;"}
|
|
@@ -34,7 +34,7 @@ const Field = React__namespace.forwardRef(function Field2(props, ref) {
|
|
|
34
34
|
const messageClassName = cn("h-4 text-xs text-left leading-normal font-normal truncate -mb-4", {
|
|
35
35
|
"text-gray-700": !invalid && !warning,
|
|
36
36
|
"text-red-500": invalid,
|
|
37
|
-
"text-yellow-
|
|
37
|
+
"text-yellow-500": warning && !invalid,
|
|
38
38
|
"opacity-50": disabled
|
|
39
39
|
});
|
|
40
40
|
return /* @__PURE__ */ React__namespace.createElement("label", { ...otherProps, className, "data-taco": "label", ref }, children, message && /* @__PURE__ */ React__namespace.createElement(Truncate.Truncate, { tooltip: message }, /* @__PURE__ */ React__namespace.createElement(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.cjs","sources":["../../../src/components/Field/Field.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport './Field.css';\nimport { Truncate } from '../Truncate/Truncate';\n\nexport type FieldProps = React.LabelHTMLAttributes<HTMLLabelElement> & {\n /** Content of the field */\n children: React.ReactNode;\n /**\tChanges the style to indicate the element is disabled */\n disabled?: boolean;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n /* Whether the input is in a warning state */\n warning?: boolean;\n /**\n * Text displayed below the children of Field.\n * Should be a short text that indicates feedback for user.\n */\n message?: string;\n};\n\nexport const Field = React.forwardRef(function Field(props: FieldProps, ref: React.Ref<HTMLLabelElement>) {\n const messageRef = React.useRef<HTMLSpanElement>(null);\n\n const { disabled, children, invalid = false, warning = false, message, ...otherProps } = props;\n const className = cn(\n 'flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]',\n {\n 'text-gray-300': disabled,\n },\n props.className\n );\n const messageClassName = cn('h-4 text-xs text-left leading-normal font-normal truncate -mb-4', {\n 'text-gray-700': !invalid && !warning,\n 'text-red-500': invalid,\n 'text-yellow-
|
|
1
|
+
{"version":3,"file":"Field.cjs","sources":["../../../src/components/Field/Field.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport './Field.css';\nimport { Truncate } from '../Truncate/Truncate';\n\nexport type FieldProps = React.LabelHTMLAttributes<HTMLLabelElement> & {\n /** Content of the field */\n children: React.ReactNode;\n /**\tChanges the style to indicate the element is disabled */\n disabled?: boolean;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n /* Whether the input is in a warning state */\n warning?: boolean;\n /**\n * Text displayed below the children of Field.\n * Should be a short text that indicates feedback for user.\n */\n message?: string;\n};\n\nexport const Field = React.forwardRef(function Field(props: FieldProps, ref: React.Ref<HTMLLabelElement>) {\n const messageRef = React.useRef<HTMLSpanElement>(null);\n\n const { disabled, children, invalid = false, warning = false, message, ...otherProps } = props;\n const className = cn(\n 'flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]',\n {\n 'text-gray-300': disabled,\n },\n props.className\n );\n const messageClassName = cn('h-4 text-xs text-left leading-normal font-normal truncate -mb-4', {\n 'text-gray-700': !invalid && !warning,\n 'text-red-500': invalid,\n 'text-yellow-500': warning && !invalid,\n 'opacity-50': disabled,\n });\n\n return (\n <label {...otherProps} className={className} data-taco=\"label\" ref={ref}>\n {children}\n {message && (\n <Truncate tooltip={message}>\n <span\n className={messageClassName}\n data-taco=\"label-message\"\n ref={messageRef}\n role={invalid ? 'alert' : undefined}>\n {message}\n </span>\n </Truncate>\n )}\n </label>\n );\n});\n"],"names":["React","Field","Truncate"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAqBO,MAAM,QAAQA,iBAAM,WAAW,SAASC,OAAM,OAAmB,KAAkC;AAChG,QAAA,aAAaD,iBAAM,OAAwB,IAAI;AAE/C,QAAA,EAAE,UAAU,UAAU,UAAU,OAAO,UAAU,OAAO,SAAS,GAAG,WAAA,IAAe;AACzF,QAAM,YAAY;AAAA,IACd;AAAA,IACA;AAAA,MACI,iBAAiB;AAAA,IACrB;AAAA,IACA,MAAM;AAAA,EACV;AACM,QAAA,mBAAmB,GAAG,mEAAmE;AAAA,IAC3F,iBAAiB,CAAC,WAAW,CAAC;AAAA,IAC9B,gBAAgB;AAAA,IAChB,mBAAmB,WAAW,CAAC;AAAA,IAC/B,cAAc;AAAA,EAAA,CACjB;AAED,SACKA,iCAAA,cAAA,SAAA,EAAO,GAAG,YAAY,WAAsB,aAAU,SAAQ,IAAA,GAC1D,UACA,WACIA,iCAAA,cAAAE,SAAAA,UAAA,EAAS,SAAS,WACfF,iCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAW;AAAA,MACX,aAAU;AAAA,MACV,KAAK;AAAA,MACL,MAAM,UAAU,UAAU;AAAA,IAAA;AAAA,IACzB;AAAA,EAAA,CAET,CAER;AAER,CAAC;;"}
|
|
@@ -15,7 +15,7 @@ const Field = React.forwardRef(function Field2(props, ref) {
|
|
|
15
15
|
const messageClassName = cn("h-4 text-xs text-left leading-normal font-normal truncate -mb-4", {
|
|
16
16
|
"text-gray-700": !invalid && !warning,
|
|
17
17
|
"text-red-500": invalid,
|
|
18
|
-
"text-yellow-
|
|
18
|
+
"text-yellow-500": warning && !invalid,
|
|
19
19
|
"opacity-50": disabled
|
|
20
20
|
});
|
|
21
21
|
return /* @__PURE__ */ React.createElement("label", { ...otherProps, className, "data-taco": "label", ref }, children, message && /* @__PURE__ */ React.createElement(Truncate, { tooltip: message }, /* @__PURE__ */ React.createElement(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","sources":["../../../src/components/Field/Field.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport './Field.css';\nimport { Truncate } from '../Truncate/Truncate';\n\nexport type FieldProps = React.LabelHTMLAttributes<HTMLLabelElement> & {\n /** Content of the field */\n children: React.ReactNode;\n /**\tChanges the style to indicate the element is disabled */\n disabled?: boolean;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n /* Whether the input is in a warning state */\n warning?: boolean;\n /**\n * Text displayed below the children of Field.\n * Should be a short text that indicates feedback for user.\n */\n message?: string;\n};\n\nexport const Field = React.forwardRef(function Field(props: FieldProps, ref: React.Ref<HTMLLabelElement>) {\n const messageRef = React.useRef<HTMLSpanElement>(null);\n\n const { disabled, children, invalid = false, warning = false, message, ...otherProps } = props;\n const className = cn(\n 'flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]',\n {\n 'text-gray-300': disabled,\n },\n props.className\n );\n const messageClassName = cn('h-4 text-xs text-left leading-normal font-normal truncate -mb-4', {\n 'text-gray-700': !invalid && !warning,\n 'text-red-500': invalid,\n 'text-yellow-
|
|
1
|
+
{"version":3,"file":"Field.js","sources":["../../../src/components/Field/Field.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport './Field.css';\nimport { Truncate } from '../Truncate/Truncate';\n\nexport type FieldProps = React.LabelHTMLAttributes<HTMLLabelElement> & {\n /** Content of the field */\n children: React.ReactNode;\n /**\tChanges the style to indicate the element is disabled */\n disabled?: boolean;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n /* Whether the input is in a warning state */\n warning?: boolean;\n /**\n * Text displayed below the children of Field.\n * Should be a short text that indicates feedback for user.\n */\n message?: string;\n};\n\nexport const Field = React.forwardRef(function Field(props: FieldProps, ref: React.Ref<HTMLLabelElement>) {\n const messageRef = React.useRef<HTMLSpanElement>(null);\n\n const { disabled, children, invalid = false, warning = false, message, ...otherProps } = props;\n const className = cn(\n 'flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]',\n {\n 'text-gray-300': disabled,\n },\n props.className\n );\n const messageClassName = cn('h-4 text-xs text-left leading-normal font-normal truncate -mb-4', {\n 'text-gray-700': !invalid && !warning,\n 'text-red-500': invalid,\n 'text-yellow-500': warning && !invalid,\n 'opacity-50': disabled,\n });\n\n return (\n <label {...otherProps} className={className} data-taco=\"label\" ref={ref}>\n {children}\n {message && (\n <Truncate tooltip={message}>\n <span\n className={messageClassName}\n data-taco=\"label-message\"\n ref={messageRef}\n role={invalid ? 'alert' : undefined}>\n {message}\n </span>\n </Truncate>\n )}\n </label>\n );\n});\n"],"names":["Field"],"mappings":";;;;AAqBO,MAAM,QAAQ,MAAM,WAAW,SAASA,OAAM,OAAmB,KAAkC;AAChG,QAAA,aAAa,MAAM,OAAwB,IAAI;AAE/C,QAAA,EAAE,UAAU,UAAU,UAAU,OAAO,UAAU,OAAO,SAAS,GAAG,WAAA,IAAe;AACzF,QAAM,YAAY;AAAA,IACd;AAAA,IACA;AAAA,MACI,iBAAiB;AAAA,IACrB;AAAA,IACA,MAAM;AAAA,EACV;AACM,QAAA,mBAAmB,GAAG,mEAAmE;AAAA,IAC3F,iBAAiB,CAAC,WAAW,CAAC;AAAA,IAC9B,gBAAgB;AAAA,IAChB,mBAAmB,WAAW,CAAC;AAAA,IAC/B,cAAc;AAAA,EAAA,CACjB;AAED,SACK,sBAAA,cAAA,SAAA,EAAO,GAAG,YAAY,WAAsB,aAAU,SAAQ,IAAA,GAC1D,UACA,WACI,sBAAA,cAAA,UAAA,EAAS,SAAS,WACf,sBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAW;AAAA,MACX,aAAU;AAAA,MACV,KAAK;AAAA,MACL,MAAM,UAAU,UAAU;AAAA,IAAA;AAAA,IACzB;AAAA,EAAA,CAET,CAER;AAER,CAAC;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const React = require("react");
|
|
4
|
-
const
|
|
4
|
+
const PopoverPrimitive = require("@radix-ui/react-popover");
|
|
5
5
|
function _interopNamespaceDefault(e) {
|
|
6
6
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
7
7
|
if (e) {
|
|
@@ -19,11 +19,12 @@ function _interopNamespaceDefault(e) {
|
|
|
19
19
|
return Object.freeze(n);
|
|
20
20
|
}
|
|
21
21
|
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
22
|
+
const PopoverPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(PopoverPrimitive);
|
|
22
23
|
const UnstyledArrow = React__namespace.forwardRef(function PopoverArrow(props, ref) {
|
|
23
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
24
|
+
return /* @__PURE__ */ React__namespace.createElement(PopoverPrimitive__namespace.Arrow, { className: "pointer-events-none -mt-px", asChild: true, offset: 2, width: 30, height: 11 }, /* @__PURE__ */ React__namespace.createElement("svg", { ...props, ref, viewBox: "0 19 30 11", style: { transform: "rotateZ(180deg)" } }, /* @__PURE__ */ React__namespace.createElement(
|
|
24
25
|
"path",
|
|
25
26
|
{
|
|
26
|
-
className: "fill-current text-
|
|
27
|
+
className: "fill-current text-blue-500",
|
|
27
28
|
d: "M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26 C26.7,29,24.6,28.1,23.7,27.1z"
|
|
28
29
|
}
|
|
29
30
|
), /* @__PURE__ */ React__namespace.createElement(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Arrow.cjs","sources":["../../../src/components/Hanger/Arrow.tsx"],"sourcesContent":["import * as React from 'react';\nimport
|
|
1
|
+
{"version":3,"file":"Arrow.cjs","sources":["../../../src/components/Hanger/Arrow.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\n\nexport const UnstyledArrow = React.forwardRef<SVGSVGElement, React.SVGAttributes<SVGElement>>(function PopoverArrow(props, ref) {\n return (\n <PopoverPrimitive.Arrow className=\"pointer-events-none -mt-px\" asChild offset={2} width={30} height={11}>\n <svg {...props} ref={ref} viewBox=\"0 19 30 11\" style={{ transform: 'rotateZ(180deg)' }}>\n <path\n className=\"fill-current text-blue-500\"\n d=\"M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26 C26.7,29,24.6,28.1,23.7,27.1z\"></path>\n <path\n className=\"fill-current\"\n d=\"M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z\"></path>\n </svg>\n </PopoverPrimitive.Arrow>\n );\n});\n"],"names":["React","PopoverPrimitive"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAGO,MAAM,gBAAgBA,iBAAM,WAA2D,SAAS,aAAa,OAAO,KAAK;AAExH,SAAAA,iCAAA,cAACC,4BAAiB,OAAjB,EAAuB,WAAU,8BAA6B,SAAO,MAAC,QAAQ,GAAG,OAAO,IAAI,QAAQ,MACjGD,iCAAA,cAAC,OAAK,EAAA,GAAG,OAAO,KAAU,SAAQ,cAAa,OAAO,EAAE,WAAW,kBAAA,EAC/D,GAAAA,iCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAU;AAAA,MACV,GAAE;AAAA,IAAA;AAAA,EACN,GAAAA,iCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAU;AAAA,MACV,GAAE;AAAA,IAAA;AAAA,EAAA,CACV,CACJ;AAER,CAAC;;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
2
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
3
3
|
const UnstyledArrow = React.forwardRef(function PopoverArrow(props, ref) {
|
|
4
|
-
return /* @__PURE__ */ React.createElement(
|
|
4
|
+
return /* @__PURE__ */ React.createElement(PopoverPrimitive.Arrow, { className: "pointer-events-none -mt-px", asChild: true, offset: 2, width: 30, height: 11 }, /* @__PURE__ */ React.createElement("svg", { ...props, ref, viewBox: "0 19 30 11", style: { transform: "rotateZ(180deg)" } }, /* @__PURE__ */ React.createElement(
|
|
5
5
|
"path",
|
|
6
6
|
{
|
|
7
|
-
className: "fill-current text-
|
|
7
|
+
className: "fill-current text-blue-500",
|
|
8
8
|
d: "M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26 C26.7,29,24.6,28.1,23.7,27.1z"
|
|
9
9
|
}
|
|
10
10
|
), /* @__PURE__ */ React.createElement(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Arrow.js","sources":["../../../src/components/Hanger/Arrow.tsx"],"sourcesContent":["import * as React from 'react';\nimport
|
|
1
|
+
{"version":3,"file":"Arrow.js","sources":["../../../src/components/Hanger/Arrow.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\n\nexport const UnstyledArrow = React.forwardRef<SVGSVGElement, React.SVGAttributes<SVGElement>>(function PopoverArrow(props, ref) {\n return (\n <PopoverPrimitive.Arrow className=\"pointer-events-none -mt-px\" asChild offset={2} width={30} height={11}>\n <svg {...props} ref={ref} viewBox=\"0 19 30 11\" style={{ transform: 'rotateZ(180deg)' }}>\n <path\n className=\"fill-current text-blue-500\"\n d=\"M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26 C26.7,29,24.6,28.1,23.7,27.1z\"></path>\n <path\n className=\"fill-current\"\n d=\"M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z\"></path>\n </svg>\n </PopoverPrimitive.Arrow>\n );\n});\n"],"names":[],"mappings":";;AAGO,MAAM,gBAAgB,MAAM,WAA2D,SAAS,aAAa,OAAO,KAAK;AAExH,SAAA,sBAAA,cAAC,iBAAiB,OAAjB,EAAuB,WAAU,8BAA6B,SAAO,MAAC,QAAQ,GAAG,OAAO,IAAI,QAAQ,MACjG,sBAAA,cAAC,OAAK,EAAA,GAAG,OAAO,KAAU,SAAQ,cAAa,OAAO,EAAE,WAAW,kBAAA,EAC/D,GAAA,sBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAU;AAAA,MACV,GAAE;AAAA,IAAA;AAAA,EACN,GAAA,sBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAU;AAAA,MACV,GAAE;AAAA,IAAA;AAAA,EAAA,CACV,CACJ;AAER,CAAC;"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const React = require("react");
|
|
4
4
|
const cn = require("clsx");
|
|
5
|
-
const
|
|
5
|
+
const PopoverPrimitive = require("@radix-ui/react-popover");
|
|
6
6
|
const IconButton = require("../IconButton/IconButton.cjs");
|
|
7
7
|
const Arrow = require("./Arrow.cjs");
|
|
8
8
|
const Localization = require("../Provider/Localization.cjs");
|
|
@@ -25,72 +25,75 @@ function _interopNamespaceDefault(e) {
|
|
|
25
25
|
return Object.freeze(n);
|
|
26
26
|
}
|
|
27
27
|
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
28
|
+
const PopoverPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(PopoverPrimitive);
|
|
28
29
|
const HangerContext = React__namespace.createContext({
|
|
29
|
-
anchorRef: { current: null },
|
|
30
30
|
onClose: void 0,
|
|
31
31
|
props: {},
|
|
32
32
|
ref: null
|
|
33
33
|
});
|
|
34
34
|
const Anchor = React__namespace.forwardRef(function HangerAnchor(props, externalRef) {
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
|
|
35
|
+
var _a;
|
|
36
|
+
const { ref: parentRef, props: parentProps } = React__namespace.useContext(HangerContext);
|
|
37
|
+
const refCallback = mergeRefs.mergeRefs([parentRef, externalRef]);
|
|
38
|
+
let children = props.children;
|
|
39
|
+
if (React__namespace.isValidElement(props.children) && typeof ((_a = props.children) == null ? void 0 : _a.type) === "function") {
|
|
40
|
+
console.warn(
|
|
41
|
+
`Hanger.Anchor requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '${props.children.type.name}' in React.forwardRef()? Taco has wrapped '${props.children.type.name}' in a 'span' to maintain functionality, but this may cause unintended behaviour`
|
|
42
|
+
);
|
|
43
|
+
children = /* @__PURE__ */ React__namespace.createElement("span", null, props.children);
|
|
44
|
+
}
|
|
45
|
+
return /* @__PURE__ */ React__namespace.createElement(PopoverPrimitive__namespace.Anchor, { ...parentProps, ...props, ref: refCallback, asChild: true }, children);
|
|
38
46
|
});
|
|
39
47
|
const Title = React__namespace.forwardRef(function DialogTitle(props, ref) {
|
|
40
48
|
const className = cn("mb-1 text-base font-bold flex w-full", props.className);
|
|
41
49
|
return /* @__PURE__ */ React__namespace.createElement("span", { ...props, className, ref });
|
|
42
50
|
});
|
|
43
51
|
const Content = React__namespace.forwardRef(function HangerContent(props, ref) {
|
|
44
|
-
const { placement: side, hideWhenDetached = false, container
|
|
52
|
+
const { placement: side, hideWhenDetached = false, container } = props;
|
|
45
53
|
const context = React__namespace.useContext(HangerContext);
|
|
46
54
|
const { texts } = Localization.useLocalization();
|
|
47
55
|
const className = cn(
|
|
48
56
|
"wcag-blue-500 border border-transparent rounded p-3 pr-12 yt-shadow focus:border-transparent max-w-sm print:hidden",
|
|
49
57
|
props.className
|
|
50
58
|
);
|
|
51
|
-
|
|
52
|
-
|
|
59
|
+
const handleInteractOutside = (event) => {
|
|
60
|
+
event.preventDefault();
|
|
61
|
+
};
|
|
62
|
+
return /* @__PURE__ */ React__namespace.createElement(PopoverPrimitive__namespace.Portal, { container }, /* @__PURE__ */ React__namespace.createElement(
|
|
63
|
+
PopoverPrimitive__namespace.Content,
|
|
53
64
|
{
|
|
54
|
-
|
|
55
|
-
|
|
65
|
+
className,
|
|
66
|
+
"data-taco": "hanger",
|
|
67
|
+
onInteractOutside: handleInteractOutside,
|
|
56
68
|
side,
|
|
57
|
-
sideOffset:
|
|
69
|
+
sideOffset: 1,
|
|
70
|
+
ref,
|
|
71
|
+
hideWhenDetached
|
|
58
72
|
},
|
|
59
|
-
|
|
60
|
-
|
|
73
|
+
props.children,
|
|
74
|
+
/* @__PURE__ */ React__namespace.createElement(Arrow.UnstyledArrow, { className: "text-blue-500" }),
|
|
75
|
+
/* @__PURE__ */ React__namespace.createElement(PopoverPrimitive__namespace.Close, { asChild: true }, /* @__PURE__ */ React__namespace.createElement(
|
|
76
|
+
IconButton.IconButton,
|
|
61
77
|
{
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
className: "absolute right-0 top-0 ml-2 mr-2 mt-2 text-white",
|
|
68
|
-
icon: "close",
|
|
69
|
-
onClick: context.onClose
|
|
70
|
-
}
|
|
71
|
-
)
|
|
78
|
+
appearance: "primary",
|
|
79
|
+
"aria-label": texts.hanger.close,
|
|
80
|
+
className: "absolute right-0 top-0 ml-2 mr-2 mt-2 text-white",
|
|
81
|
+
icon: "close",
|
|
82
|
+
onClick: context.onClose
|
|
72
83
|
}
|
|
73
84
|
))
|
|
74
85
|
));
|
|
75
86
|
});
|
|
76
87
|
const Hanger = React__namespace.forwardRef(function Hanger2(props, ref) {
|
|
77
88
|
const { anchor, children, defaultOpen = true, onClose, ...otherProps } = props;
|
|
78
|
-
const
|
|
79
|
-
const context = React__namespace.useMemo(() => ({ anchorRef, onClose, props: otherProps, ref }), [onClose, otherProps, ref]);
|
|
89
|
+
const context = React__namespace.useMemo(() => ({ onClose, props: otherProps, ref }), [onClose, otherProps]);
|
|
80
90
|
const [open, setOpen] = React__namespace.useState(false);
|
|
81
91
|
React__namespace.useEffect(() => {
|
|
82
92
|
if (defaultOpen) {
|
|
83
93
|
setOpen(defaultOpen);
|
|
84
94
|
}
|
|
85
95
|
}, []);
|
|
86
|
-
|
|
87
|
-
if (!nextOpen && (eventDetails.reason === "outside-press" || eventDetails.reason === "focus-out")) {
|
|
88
|
-
eventDetails.cancel();
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
setOpen(nextOpen);
|
|
92
|
-
};
|
|
93
|
-
return /* @__PURE__ */ React__namespace.createElement(HangerContext.Provider, { value: context }, /* @__PURE__ */ React__namespace.createElement("span", { ...otherProps }, /* @__PURE__ */ React__namespace.createElement(popover.Popover.Root, { open, onOpenChange: handleOpenChange }, anchor && /* @__PURE__ */ React__namespace.createElement(Anchor, null, anchor), children)));
|
|
96
|
+
return /* @__PURE__ */ React__namespace.createElement(HangerContext.Provider, { value: context }, /* @__PURE__ */ React__namespace.createElement(PopoverPrimitive__namespace.Root, { key: String(open), defaultOpen: open }, anchor && /* @__PURE__ */ React__namespace.createElement(Anchor, null, anchor), children));
|
|
94
97
|
});
|
|
95
98
|
Hanger.Anchor = Anchor;
|
|
96
99
|
Hanger.Content = Content;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Hanger.cjs","sources":["../../../src/components/Hanger/Hanger.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport
|
|
1
|
+
{"version":3,"file":"Hanger.cjs","sources":["../../../src/components/Hanger/Hanger.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\n\nimport { IconButton } from '../IconButton/IconButton';\nimport { Placement } from '../..';\nimport { UnstyledArrow } from './Arrow';\nimport { useLocalization } from '../Provider/Localization';\nimport { mergeRefs } from '../../utils/mergeRefs';\nimport './Hanger.css';\n\ntype HangerContextValue = {\n /** Handler called when hanger closes by user interaction */\n onClose?: () => void;\n props: Record<string, any>;\n ref: React.Ref<HTMLElement>;\n};\nconst HangerContext = React.createContext<HangerContextValue>({\n onClose: undefined,\n props: {},\n ref: null,\n});\n\nexport type HangerTexts = {\n /** Aria-label for the close icon button of hanger */\n close: string;\n};\n\nexport type HangerAnchorProps = React.HTMLAttributes<HTMLDivElement>;\nconst Anchor = React.forwardRef(function HangerAnchor(props: HangerAnchorProps, externalRef: React.Ref<HTMLDivElement>) {\n const { ref: parentRef, props: parentProps } = React.useContext(HangerContext);\n const refCallback = mergeRefs([parentRef, externalRef]);\n\n let children = props.children;\n\n if (React.isValidElement(props.children) && typeof props.children?.type === 'function') {\n // oxlint-disable-next-line no-console\n console.warn(\n `Hanger.Anchor requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '${props.children.type.name}' in React.forwardRef()? Taco has wrapped '${props.children.type.name}' in a 'span' to maintain functionality, but this may cause unintended behaviour`\n );\n children = <span>{props.children}</span>;\n }\n\n return (\n <PopoverPrimitive.Anchor {...parentProps} {...props} ref={refCallback} asChild>\n {children}\n </PopoverPrimitive.Anchor>\n );\n});\n\nexport type HangerTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function DialogTitle(props: HangerTitleProps, ref: React.Ref<HTMLHeadingElement>) {\n const className = cn('mb-1 text-base font-bold flex w-full', props.className);\n return <span {...props} className={className} ref={ref} />;\n});\n\nexport type HangerContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Set the position of the Hanger relative to its achor. Default value is `bottom` */\n placement?: Placement;\n hideWhenDetached?: boolean;\n container?: HTMLElement | null;\n};\n\nconst Content = React.forwardRef(function HangerContent(props: HangerContentProps, ref: React.Ref<HTMLDivElement>) {\n const { placement: side, hideWhenDetached = false, container } = props;\n const context = React.useContext(HangerContext);\n const { texts } = useLocalization();\n const className = cn(\n 'wcag-blue-500 border border-transparent rounded p-3 pr-12 yt-shadow focus:border-transparent max-w-sm print:hidden',\n props.className\n );\n const handleInteractOutside = (event: CustomEvent): void => {\n event.preventDefault();\n };\n\n return (\n <PopoverPrimitive.Portal container={container}>\n <PopoverPrimitive.Content\n className={className}\n data-taco=\"hanger\"\n onInteractOutside={handleInteractOutside}\n side={side}\n sideOffset={1}\n ref={ref}\n hideWhenDetached={hideWhenDetached}>\n {props.children}\n <UnstyledArrow className=\"text-blue-500\" />\n <PopoverPrimitive.Close asChild>\n <IconButton\n appearance=\"primary\"\n aria-label={texts.hanger.close}\n className=\"absolute right-0 top-0 ml-2 mr-2 mt-2 text-white\"\n icon=\"close\"\n onClick={context.onClose}\n />\n </PopoverPrimitive.Close>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n );\n});\n\nexport type HangerProps = React.PropsWithChildren<{\n /** An anchor to be used for the hanger, should not be set if `children` already contains an anchor */\n anchor?: JSX.Element;\n /**\n * Shows or hides hanger depending on the value\n * @defaultValue true\n */\n defaultOpen?: boolean;\n /** Handler called when user closes the hanger */\n onClose?: () => void;\n}>;\n\nexport type ForwardedHangerWithStatics = React.ForwardRefExoticComponent<HangerProps & React.RefAttributes<HTMLElement>> & {\n Anchor: React.ForwardRefExoticComponent<HangerAnchorProps>;\n Content: React.ForwardRefExoticComponent<HangerContentProps>;\n Title: React.ForwardRefExoticComponent<HangerTitleProps>;\n};\n\nexport const Hanger = React.forwardRef<HTMLElement, HangerProps>(function Hanger(props, ref) {\n const { anchor, children, defaultOpen = true, onClose, ...otherProps } = props;\n const context = React.useMemo(() => ({ onClose, props: otherProps, ref }), [onClose, otherProps]);\n\n // we do this to ensure hangers are mounted after their containers, e.g. if the container is another portal\n const [open, setOpen] = React.useState(false);\n React.useEffect(() => {\n if (defaultOpen) {\n setOpen(defaultOpen);\n }\n }, []);\n\n return (\n <HangerContext.Provider value={context}>\n <PopoverPrimitive.Root key={String(open)} defaultOpen={open}>\n {anchor && <Anchor>{anchor}</Anchor>}\n {children}\n </PopoverPrimitive.Root>\n </HangerContext.Provider>\n );\n}) as ForwardedHangerWithStatics;\nHanger.Anchor = Anchor;\nHanger.Content = Content;\nHanger.Title = Title;\n"],"names":["React","mergeRefs","PopoverPrimitive","useLocalization","UnstyledArrow","IconButton","Hanger"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,MAAM,gBAAgBA,iBAAM,cAAkC;AAAA,EAC1D,SAAS;AAAA,EACT,OAAO,CAAC;AAAA,EACR,KAAK;AACT,CAAC;AAQD,MAAM,SAASA,iBAAM,WAAW,SAAS,aAAa,OAA0B,aAAwC;;AAC9G,QAAA,EAAE,KAAK,WAAW,OAAO,gBAAgBA,iBAAM,WAAW,aAAa;AAC7E,QAAM,cAAcC,UAAA,UAAU,CAAC,WAAW,WAAW,CAAC;AAEtD,MAA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B,GAAAF,iCAAA;AAAA,MAACK,WAAA;AAAA,MAAA;AAAA,QACG,YAAW;AAAA,QACX,cAAY,MAAM,OAAO;AAAA,QACzB,WAAU;AAAA,QACV,MAAK;AAAA,QACL,SAAS,QAAQ;AAAA,MAAA;AAAA,IAEzB,CAAA;AAAA,EAAA,CAER;AAER,CAAC;AAoBM,MAAM,SAASL,iBAAM,WAAqC,SAASM,QAAO,OAAO,KAAK;AACnF,QAAA,EAAE,QAAQ,UAAU,cAAc,MAAM,SAAS,GAAG,eAAe;AACzE,QAAM,UAAUN,iBAAM,QAAQ,OAAO,EAAE,SAAS,OAAO,YAAY,IAAI,IAAI,CAAC,SAAS,UAAU,CAAC;AAGhG,QAAM,CAAC,MAAM,OAAO,IAAIA,iBAAM,SAAS,KAAK;AAC5CA,mBAAM,UAAU,MAAM;AAClB,QAAI,aAAa;AACb,cAAQ,WAAW;AAAA,IAAA;AAAA,EAE3B,GAAG,EAAE;AAGD,SAAAA,iCAAA,cAAC,cAAc,UAAd,EAAuB,OAAO,QAC3B,GAAAA,iCAAA,cAACE,4BAAiB,MAAjB,EAAsB,KAAK,OAAO,IAAI,GAAG,aAAa,KAClD,GAAA,yDAAW,QAAQ,MAAA,MAAO,GAC1B,QACL,CACJ;AAER,CAAC;AACD,OAAO,SAAS;AAChB,OAAO,UAAU;AACjB,OAAO,QAAQ;;;"}
|
|
@@ -4,7 +4,7 @@ export type HangerTexts = {
|
|
|
4
4
|
/** Aria-label for the close icon button of hanger */
|
|
5
5
|
close: string;
|
|
6
6
|
};
|
|
7
|
-
export type HangerAnchorProps = React.HTMLAttributes<
|
|
7
|
+
export type HangerAnchorProps = React.HTMLAttributes<HTMLDivElement>;
|
|
8
8
|
export type HangerTitleProps = React.HTMLAttributes<HTMLHeadingElement>;
|
|
9
9
|
export declare const Title: React.ForwardRefExoticComponent<HangerTitleProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
10
10
|
export type HangerContentProps = React.HTMLAttributes<HTMLDivElement> & {
|