@lobehub/ui 5.13.0 → 5.14.1
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/es/Menu/baseItem.d.mts +4 -0
- package/es/base-ui/ContextMenu/renderItems.mjs +21 -6
- package/es/base-ui/ContextMenu/renderItems.mjs.map +1 -1
- package/es/base-ui/DropdownMenu/renderItems.mjs +14 -5
- package/es/base-ui/DropdownMenu/renderItems.mjs.map +1 -1
- package/es/base-ui/ScrollArea/ScrollArea.mjs +9 -2
- package/es/base-ui/ScrollArea/ScrollArea.mjs.map +1 -1
- package/es/base-ui/ScrollArea/type.d.mts +9 -0
- package/es/base-ui/Toast/Toast.mjs +2 -1
- package/es/base-ui/Toast/Toast.mjs.map +1 -1
- package/es/base-ui/Toast/style.mjs +6 -3
- package/es/base-ui/Toast/style.mjs.map +1 -1
- package/package.json +1 -1
package/es/Menu/baseItem.d.mts
CHANGED
|
@@ -31,6 +31,10 @@ interface BaseSubMenuType {
|
|
|
31
31
|
delay?: number;
|
|
32
32
|
desc?: ReactNode;
|
|
33
33
|
disabled?: boolean;
|
|
34
|
+
/** Pinned footer slot, rendered below the scrollable submenu items with a divider border. */
|
|
35
|
+
footer?: ReactNode;
|
|
36
|
+
/** Pinned header slot, rendered above the scrollable submenu items with a divider border. */
|
|
37
|
+
header?: ReactNode;
|
|
34
38
|
icon?: IconProps['icon'];
|
|
35
39
|
key?: Key;
|
|
36
40
|
label?: ReactNode;
|
|
@@ -186,6 +186,11 @@ const renderContextMenuItems = (items, keyPath = [], options) => {
|
|
|
186
186
|
const label = getItemLabel(submenu);
|
|
187
187
|
const labelText = typeof label === "string" ? label : void 0;
|
|
188
188
|
const isDanger = "danger" in submenu && Boolean(submenu.danger);
|
|
189
|
+
const submenuHasSlots = submenu.header != null || submenu.footer != null;
|
|
190
|
+
const submenuBody = submenu.children && submenu.children.length > 0 ? renderContextMenuItems(submenu.children, nextKeyPath, {
|
|
191
|
+
iconAlign,
|
|
192
|
+
iconSpaceMode
|
|
193
|
+
}) : /* @__PURE__ */ jsx(EmptyMenuItem, {});
|
|
189
194
|
return /* @__PURE__ */ jsxs(ContextMenu.SubmenuRoot, {
|
|
190
195
|
defaultOpen: submenu.defaultOpen,
|
|
191
196
|
open: submenu.open,
|
|
@@ -210,12 +215,22 @@ const renderContextMenuItems = (items, keyPath = [], options) => {
|
|
|
210
215
|
"data-submenu": "",
|
|
211
216
|
sideOffset: -1,
|
|
212
217
|
onContextMenu: preventDefaultAndStopPropagation,
|
|
213
|
-
children: /* @__PURE__ */
|
|
214
|
-
className: styles.popup,
|
|
215
|
-
children:
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
218
|
+
children: /* @__PURE__ */ jsxs(ContextMenu.Popup, {
|
|
219
|
+
className: submenuHasSlots ? cx(styles.popup, styles.popupWithSlots) : styles.popup,
|
|
220
|
+
children: [
|
|
221
|
+
submenu.header == null ? null : /* @__PURE__ */ jsx("div", {
|
|
222
|
+
className: styles.header,
|
|
223
|
+
children: submenu.header
|
|
224
|
+
}),
|
|
225
|
+
submenuHasSlots ? /* @__PURE__ */ jsx("div", {
|
|
226
|
+
className: styles.slotViewport,
|
|
227
|
+
children: submenuBody
|
|
228
|
+
}) : submenuBody,
|
|
229
|
+
submenu.footer == null ? null : /* @__PURE__ */ jsx("div", {
|
|
230
|
+
className: styles.footer,
|
|
231
|
+
children: submenu.footer
|
|
232
|
+
})
|
|
233
|
+
]
|
|
219
234
|
})
|
|
220
235
|
}) })]
|
|
221
236
|
}, itemKey);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderItems.mjs","names":["common"],"sources":["../../../src/base-ui/ContextMenu/renderItems.tsx"],"sourcesContent":["import { ContextMenu } from '@base-ui/react/context-menu';\nimport { Switch } from 'antd';\nimport { cx } from 'antd-style';\nimport { Check, ChevronRight } from 'lucide-react';\nimport { type MenuInfo } from 'rc-menu/es/interface';\nimport {\n type KeyboardEvent as ReactKeyboardEvent,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n} from 'react';\nimport { memo, useCallback, useState } from 'react';\n\nimport common from '@/i18n/resources/en/common';\nimport { useTranslation } from '@/i18n/useTranslation';\nimport Icon from '@/Icon';\nimport {\n type BaseMenuItemGroupType,\n type BaseSubMenuType,\n getItemKey,\n getItemLabel,\n hasAnyIcon,\n hasCheckboxAndIcon,\n type MenuDividerType,\n type MenuItemType,\n renderIcon,\n type RenderItemContentOptions,\n type RenderOptions,\n} from '@/Menu';\nimport { styles } from '@/Menu/sharedStyle';\nimport { preventDefaultAndStopPropagation } from '@/utils/dom';\n\nimport {\n type ContextMenuCheckboxItem,\n type ContextMenuItem,\n type ContextMenuSwitchItem,\n} from './type';\n\nexport type { IconAlign, IconSpaceMode } from '@/Menu';\n\nconst EmptyMenuItem = memo(() => {\n const { t } = useTranslation(common);\n return (\n <ContextMenu.Item disabled className={cx(styles.item, styles.empty)}>\n <div className={styles.itemContent}>\n <span className={styles.label}>{t('common.empty')}</span>\n </div>\n </ContextMenu.Item>\n );\n});\n\nEmptyMenuItem.displayName = 'EmptyMenuItem';\n\ninterface ContextMenuSwitchItemInternalProps {\n checked?: boolean;\n children: ReactNode;\n closeOnClick?: boolean;\n danger?: boolean;\n defaultChecked?: boolean;\n disabled?: boolean;\n label?: string;\n onCheckedChange?: (checked: boolean) => void;\n}\n\nconst ContextMenuSwitchItemInternal = ({\n checked: checkedProp,\n children,\n closeOnClick = false,\n danger,\n defaultChecked,\n disabled,\n label,\n onCheckedChange,\n}: ContextMenuSwitchItemInternalProps) => {\n const [internalChecked, setInternalChecked] = useState(defaultChecked ?? false);\n const isControlled = checkedProp !== undefined;\n const checked = isControlled ? checkedProp : internalChecked;\n\n const handleCheckedChange = useCallback(\n (newChecked: boolean) => {\n if (!isControlled) {\n setInternalChecked(newChecked);\n }\n onCheckedChange?.(newChecked);\n },\n [isControlled, onCheckedChange],\n );\n\n return (\n <ContextMenu.Item\n className={cx(styles.item, danger && styles.danger)}\n closeOnClick={closeOnClick}\n disabled={disabled}\n label={label}\n onClick={(e) => {\n e.preventDefault();\n if (!disabled) {\n handleCheckedChange(!checked);\n }\n }}\n >\n {children}\n <span\n style={{ display: 'inline-flex', marginInlineStart: 16 }}\n onFocus={(e) => e.stopPropagation()}\n >\n <Switch\n checked={checked}\n disabled={disabled}\n size=\"small\"\n tabIndex={-1}\n onChange={handleCheckedChange}\n onClick={(_, e) => e.stopPropagation()}\n />\n </span>\n </ContextMenu.Item>\n );\n};\n\nconst renderItemContent = (\n item: MenuItemType | BaseSubMenuType | ContextMenuCheckboxItem | ContextMenuSwitchItem,\n options?: RenderItemContentOptions,\n iconNode?: ReactNode,\n) => {\n const label = getItemLabel(item);\n const desc = 'desc' in item ? item.desc : undefined;\n const extra = 'extra' in item ? item.extra : undefined;\n const indicatorOnRight = options?.indicatorOnRight;\n const alignStart = Boolean(desc) && options?.iconAlign === 'start';\n const hasCustomIcon = iconNode !== undefined && !indicatorOnRight;\n const hasIcon = hasCustomIcon ? Boolean(iconNode) : Boolean(item.icon);\n const shouldRenderIcon = hasCustomIcon\n ? Boolean(options?.reserveIconSpace || iconNode)\n : Boolean(hasIcon || options?.reserveIconSpace);\n\n const labelNode = desc ? (\n <div className={styles.labelGroup}>\n <span className={styles.label}>{label}</span>\n <span className={styles.desc}>{desc}</span>\n </div>\n ) : (\n <span className={styles.label}>{label}</span>\n );\n\n return (\n <div className={cx(styles.itemContent, alignStart && styles.itemContentAlignStart)}>\n {shouldRenderIcon ? (\n <span\n aria-hidden={!hasIcon}\n className={cx(styles.icon, alignStart && styles.iconAlignStart)}\n >\n {hasCustomIcon ? iconNode : hasIcon ? renderIcon(item.icon, 'small') : null}\n </span>\n ) : null}\n {labelNode}\n {extra ? <span className={styles.extra}>{extra}</span> : null}\n {indicatorOnRight && iconNode ? iconNode : null}\n {options?.submenu ? (\n <span className={styles.submenuArrow}>\n <ChevronRight size={16} />\n </span>\n ) : null}\n </div>\n );\n};\n\nconst invokeItemClick = (\n item: MenuItemType,\n keyPath: string[],\n event: ReactMouseEvent<HTMLElement> | ReactKeyboardEvent<HTMLElement>,\n) => {\n if (!item.onClick) return;\n const key = item.key ?? keyPath.at(-1) ?? '';\n const info: MenuInfo = {\n domEvent: event,\n item: event.currentTarget as MenuInfo['item'],\n key: String(key),\n keyPath,\n };\n item.onClick(info);\n};\n\nexport const renderContextMenuItems = (\n items: ContextMenuItem[],\n keyPath: string[] = [],\n options?: RenderOptions,\n): ReactNode[] => {\n const iconAlign = options?.iconAlign;\n const iconSpaceMode = options?.iconSpaceMode ?? 'global';\n const reserveIconSpace =\n options?.reserveIconSpace ?? hasAnyIcon(items, iconSpaceMode === 'global');\n const indicatorOnRight = options?.indicatorOnRight ?? hasCheckboxAndIcon(items);\n\n return items.map((item, index) => {\n if (!item) return null;\n\n const fallbackKey = `${keyPath.join('-') || 'root'}-${index}`;\n const itemKey = getItemKey(item, fallbackKey);\n const nextKeyPath = [...keyPath, String(itemKey)];\n\n if ((item as ContextMenuCheckboxItem).type === 'checkbox') {\n const checkboxItem = item as ContextMenuCheckboxItem;\n const label = getItemLabel(checkboxItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(checkboxItem.danger);\n const indicator = (\n <ContextMenu.CheckboxItemIndicator>\n <Icon icon={Check} size={'small'} />\n </ContextMenu.CheckboxItemIndicator>\n );\n\n return (\n <ContextMenu.CheckboxItem\n checked={checkboxItem.checked}\n className={cx(styles.item, isDanger && styles.danger)}\n closeOnClick={checkboxItem.closeOnClick}\n defaultChecked={checkboxItem.defaultChecked}\n disabled={checkboxItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={(checked) => checkboxItem.onCheckedChange?.(checked)}\n >\n {renderItemContent(\n checkboxItem,\n { iconAlign, indicatorOnRight, reserveIconSpace },\n indicator,\n )}\n </ContextMenu.CheckboxItem>\n );\n }\n\n if ((item as ContextMenuSwitchItem).type === 'switch') {\n const switchItem = item as ContextMenuSwitchItem;\n const label = getItemLabel(switchItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(switchItem.danger);\n\n return (\n <ContextMenuSwitchItemInternal\n checked={switchItem.checked}\n closeOnClick={switchItem.closeOnClick}\n danger={isDanger}\n defaultChecked={switchItem.defaultChecked}\n disabled={switchItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={switchItem.onCheckedChange}\n >\n {renderItemContent(switchItem, { iconAlign, reserveIconSpace })}\n </ContextMenuSwitchItemInternal>\n );\n }\n\n if ((item as MenuDividerType).type === 'divider') {\n return <ContextMenu.Separator className={styles.separator} key={itemKey} />;\n }\n\n if ((item as BaseMenuItemGroupType).type === 'group') {\n const group = item as BaseMenuItemGroupType;\n const groupReserveIconSpace =\n iconSpaceMode === 'group'\n ? group.children\n ? hasAnyIcon(group.children)\n : false\n : reserveIconSpace;\n const groupIndicatorOnRight = group.children ? hasCheckboxAndIcon(group.children) : false;\n return (\n <ContextMenu.Group key={itemKey}>\n {group.label ? (\n <ContextMenu.GroupLabel className={styles.groupLabel}>\n {group.label}\n </ContextMenu.GroupLabel>\n ) : null}\n {group.children\n ? renderContextMenuItems(group.children, nextKeyPath, {\n iconAlign,\n iconSpaceMode,\n indicatorOnRight: groupIndicatorOnRight,\n reserveIconSpace: groupReserveIconSpace,\n })\n : null}\n </ContextMenu.Group>\n );\n }\n\n if (\n (item as BaseSubMenuType).type === 'submenu' ||\n ('children' in item && (item as BaseSubMenuType).children)\n ) {\n const submenu = item as BaseSubMenuType;\n const label = getItemLabel(submenu);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in submenu && Boolean(submenu.danger);\n\n return (\n <ContextMenu.SubmenuRoot\n defaultOpen={submenu.defaultOpen}\n key={itemKey}\n open={submenu.open}\n onOpenChange={submenu.onOpenChange}\n >\n <ContextMenu.SubmenuTrigger\n {...submenu.triggerProps}\n className={cx(styles.item, isDanger && styles.danger)}\n closeDelay={submenu.closeDelay}\n delay={submenu.delay}\n disabled={submenu.disabled}\n label={labelText}\n openOnHover={submenu.openOnHover}\n onClick={submenu.onClick}\n >\n {renderItemContent(submenu, {\n iconAlign,\n reserveIconSpace,\n submenu: true,\n })}\n </ContextMenu.SubmenuTrigger>\n <ContextMenu.Portal>\n <ContextMenu.Positioner\n alignOffset={-4}\n className={styles.positioner}\n data-submenu=\"\"\n sideOffset={-1}\n onContextMenu={preventDefaultAndStopPropagation}\n >\n <ContextMenu.Popup className={styles.popup}>\n {submenu.children && submenu.children.length > 0 ? (\n renderContextMenuItems(submenu.children, nextKeyPath, {\n iconAlign,\n iconSpaceMode,\n })\n ) : (\n <EmptyMenuItem />\n )}\n </ContextMenu.Popup>\n </ContextMenu.Positioner>\n </ContextMenu.Portal>\n </ContextMenu.SubmenuRoot>\n );\n }\n\n const menuItem = item as MenuItemType;\n const label = getItemLabel(menuItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in menuItem && Boolean(menuItem.danger);\n\n return (\n <ContextMenu.Item\n className={cx(styles.item, isDanger && styles.danger)}\n closeOnClick={menuItem.closeOnClick}\n disabled={menuItem.disabled}\n key={itemKey}\n label={labelText}\n onClick={(event) => invokeItemClick(menuItem, nextKeyPath, event)}\n >\n {renderItemContent(menuItem, { iconAlign, reserveIconSpace })}\n </ContextMenu.Item>\n );\n });\n};\n"],"mappings":";;;;;;;;;;;;;AAuCA,MAAM,gBAAgB,WAAW;CAC/B,MAAM,EAAE,MAAM,eAAeA,eAAO;AACpC,QACE,oBAAC,YAAY,MAAb;EAAkB,UAAA;EAAS,WAAW,GAAG,OAAO,MAAM,OAAO,MAAM;YACjE,oBAAC,OAAD;GAAK,WAAW,OAAO;aACrB,oBAAC,QAAD;IAAM,WAAW,OAAO;cAAQ,EAAE,eAAe;IAAQ,CAAA;GACrD,CAAA;EACW,CAAA;EAErB;AAEF,cAAc,cAAc;AAa5B,MAAM,iCAAiC,EACrC,SAAS,aACT,UACA,eAAe,OACf,QACA,gBACA,UACA,OACA,sBACwC;CACxC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A;EACtD,MAAM,WAAW,YAAY,YAAY,QAAQ,SAAS,OAAO;AAEjE,SACE,oBAAC,YAAY,MAAb;GACE,WAAW,GAAG,OAAO,MAAM,YAAY,OAAO,OAAO;GACrD,cAAc,SAAS;GACvB,UAAU,SAAS;GAEnB,OAAO;GACP,UAAU,UAAU,gBAAgB,UAAU,aAAa,MAAM;aAEhE,kBAAkB,UAAU;IAAE;IAAW;IAAkB,CAAC;GAC5C,EALZ,QAKY;GAErB"}
|
|
1
|
+
{"version":3,"file":"renderItems.mjs","names":["common"],"sources":["../../../src/base-ui/ContextMenu/renderItems.tsx"],"sourcesContent":["import { ContextMenu } from '@base-ui/react/context-menu';\nimport { Switch } from 'antd';\nimport { cx } from 'antd-style';\nimport { Check, ChevronRight } from 'lucide-react';\nimport { type MenuInfo } from 'rc-menu/es/interface';\nimport {\n type KeyboardEvent as ReactKeyboardEvent,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n} from 'react';\nimport { memo, useCallback, useState } from 'react';\n\nimport common from '@/i18n/resources/en/common';\nimport { useTranslation } from '@/i18n/useTranslation';\nimport Icon from '@/Icon';\nimport {\n type BaseMenuItemGroupType,\n type BaseSubMenuType,\n getItemKey,\n getItemLabel,\n hasAnyIcon,\n hasCheckboxAndIcon,\n type MenuDividerType,\n type MenuItemType,\n renderIcon,\n type RenderItemContentOptions,\n type RenderOptions,\n} from '@/Menu';\nimport { styles } from '@/Menu/sharedStyle';\nimport { preventDefaultAndStopPropagation } from '@/utils/dom';\n\nimport {\n type ContextMenuCheckboxItem,\n type ContextMenuItem,\n type ContextMenuSwitchItem,\n} from './type';\n\nexport type { IconAlign, IconSpaceMode } from '@/Menu';\n\nconst EmptyMenuItem = memo(() => {\n const { t } = useTranslation(common);\n return (\n <ContextMenu.Item disabled className={cx(styles.item, styles.empty)}>\n <div className={styles.itemContent}>\n <span className={styles.label}>{t('common.empty')}</span>\n </div>\n </ContextMenu.Item>\n );\n});\n\nEmptyMenuItem.displayName = 'EmptyMenuItem';\n\ninterface ContextMenuSwitchItemInternalProps {\n checked?: boolean;\n children: ReactNode;\n closeOnClick?: boolean;\n danger?: boolean;\n defaultChecked?: boolean;\n disabled?: boolean;\n label?: string;\n onCheckedChange?: (checked: boolean) => void;\n}\n\nconst ContextMenuSwitchItemInternal = ({\n checked: checkedProp,\n children,\n closeOnClick = false,\n danger,\n defaultChecked,\n disabled,\n label,\n onCheckedChange,\n}: ContextMenuSwitchItemInternalProps) => {\n const [internalChecked, setInternalChecked] = useState(defaultChecked ?? false);\n const isControlled = checkedProp !== undefined;\n const checked = isControlled ? checkedProp : internalChecked;\n\n const handleCheckedChange = useCallback(\n (newChecked: boolean) => {\n if (!isControlled) {\n setInternalChecked(newChecked);\n }\n onCheckedChange?.(newChecked);\n },\n [isControlled, onCheckedChange],\n );\n\n return (\n <ContextMenu.Item\n className={cx(styles.item, danger && styles.danger)}\n closeOnClick={closeOnClick}\n disabled={disabled}\n label={label}\n onClick={(e) => {\n e.preventDefault();\n if (!disabled) {\n handleCheckedChange(!checked);\n }\n }}\n >\n {children}\n <span\n style={{ display: 'inline-flex', marginInlineStart: 16 }}\n onFocus={(e) => e.stopPropagation()}\n >\n <Switch\n checked={checked}\n disabled={disabled}\n size=\"small\"\n tabIndex={-1}\n onChange={handleCheckedChange}\n onClick={(_, e) => e.stopPropagation()}\n />\n </span>\n </ContextMenu.Item>\n );\n};\n\nconst renderItemContent = (\n item: MenuItemType | BaseSubMenuType | ContextMenuCheckboxItem | ContextMenuSwitchItem,\n options?: RenderItemContentOptions,\n iconNode?: ReactNode,\n) => {\n const label = getItemLabel(item);\n const desc = 'desc' in item ? item.desc : undefined;\n const extra = 'extra' in item ? item.extra : undefined;\n const indicatorOnRight = options?.indicatorOnRight;\n const alignStart = Boolean(desc) && options?.iconAlign === 'start';\n const hasCustomIcon = iconNode !== undefined && !indicatorOnRight;\n const hasIcon = hasCustomIcon ? Boolean(iconNode) : Boolean(item.icon);\n const shouldRenderIcon = hasCustomIcon\n ? Boolean(options?.reserveIconSpace || iconNode)\n : Boolean(hasIcon || options?.reserveIconSpace);\n\n const labelNode = desc ? (\n <div className={styles.labelGroup}>\n <span className={styles.label}>{label}</span>\n <span className={styles.desc}>{desc}</span>\n </div>\n ) : (\n <span className={styles.label}>{label}</span>\n );\n\n return (\n <div className={cx(styles.itemContent, alignStart && styles.itemContentAlignStart)}>\n {shouldRenderIcon ? (\n <span\n aria-hidden={!hasIcon}\n className={cx(styles.icon, alignStart && styles.iconAlignStart)}\n >\n {hasCustomIcon ? iconNode : hasIcon ? renderIcon(item.icon, 'small') : null}\n </span>\n ) : null}\n {labelNode}\n {extra ? <span className={styles.extra}>{extra}</span> : null}\n {indicatorOnRight && iconNode ? iconNode : null}\n {options?.submenu ? (\n <span className={styles.submenuArrow}>\n <ChevronRight size={16} />\n </span>\n ) : null}\n </div>\n );\n};\n\nconst invokeItemClick = (\n item: MenuItemType,\n keyPath: string[],\n event: ReactMouseEvent<HTMLElement> | ReactKeyboardEvent<HTMLElement>,\n) => {\n if (!item.onClick) return;\n const key = item.key ?? keyPath.at(-1) ?? '';\n const info: MenuInfo = {\n domEvent: event,\n item: event.currentTarget as MenuInfo['item'],\n key: String(key),\n keyPath,\n };\n item.onClick(info);\n};\n\nexport const renderContextMenuItems = (\n items: ContextMenuItem[],\n keyPath: string[] = [],\n options?: RenderOptions,\n): ReactNode[] => {\n const iconAlign = options?.iconAlign;\n const iconSpaceMode = options?.iconSpaceMode ?? 'global';\n const reserveIconSpace =\n options?.reserveIconSpace ?? hasAnyIcon(items, iconSpaceMode === 'global');\n const indicatorOnRight = options?.indicatorOnRight ?? hasCheckboxAndIcon(items);\n\n return items.map((item, index) => {\n if (!item) return null;\n\n const fallbackKey = `${keyPath.join('-') || 'root'}-${index}`;\n const itemKey = getItemKey(item, fallbackKey);\n const nextKeyPath = [...keyPath, String(itemKey)];\n\n if ((item as ContextMenuCheckboxItem).type === 'checkbox') {\n const checkboxItem = item as ContextMenuCheckboxItem;\n const label = getItemLabel(checkboxItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(checkboxItem.danger);\n const indicator = (\n <ContextMenu.CheckboxItemIndicator>\n <Icon icon={Check} size={'small'} />\n </ContextMenu.CheckboxItemIndicator>\n );\n\n return (\n <ContextMenu.CheckboxItem\n checked={checkboxItem.checked}\n className={cx(styles.item, isDanger && styles.danger)}\n closeOnClick={checkboxItem.closeOnClick}\n defaultChecked={checkboxItem.defaultChecked}\n disabled={checkboxItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={(checked) => checkboxItem.onCheckedChange?.(checked)}\n >\n {renderItemContent(\n checkboxItem,\n { iconAlign, indicatorOnRight, reserveIconSpace },\n indicator,\n )}\n </ContextMenu.CheckboxItem>\n );\n }\n\n if ((item as ContextMenuSwitchItem).type === 'switch') {\n const switchItem = item as ContextMenuSwitchItem;\n const label = getItemLabel(switchItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(switchItem.danger);\n\n return (\n <ContextMenuSwitchItemInternal\n checked={switchItem.checked}\n closeOnClick={switchItem.closeOnClick}\n danger={isDanger}\n defaultChecked={switchItem.defaultChecked}\n disabled={switchItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={switchItem.onCheckedChange}\n >\n {renderItemContent(switchItem, { iconAlign, reserveIconSpace })}\n </ContextMenuSwitchItemInternal>\n );\n }\n\n if ((item as MenuDividerType).type === 'divider') {\n return <ContextMenu.Separator className={styles.separator} key={itemKey} />;\n }\n\n if ((item as BaseMenuItemGroupType).type === 'group') {\n const group = item as BaseMenuItemGroupType;\n const groupReserveIconSpace =\n iconSpaceMode === 'group'\n ? group.children\n ? hasAnyIcon(group.children)\n : false\n : reserveIconSpace;\n const groupIndicatorOnRight = group.children ? hasCheckboxAndIcon(group.children) : false;\n return (\n <ContextMenu.Group key={itemKey}>\n {group.label ? (\n <ContextMenu.GroupLabel className={styles.groupLabel}>\n {group.label}\n </ContextMenu.GroupLabel>\n ) : null}\n {group.children\n ? renderContextMenuItems(group.children, nextKeyPath, {\n iconAlign,\n iconSpaceMode,\n indicatorOnRight: groupIndicatorOnRight,\n reserveIconSpace: groupReserveIconSpace,\n })\n : null}\n </ContextMenu.Group>\n );\n }\n\n if (\n (item as BaseSubMenuType).type === 'submenu' ||\n ('children' in item && (item as BaseSubMenuType).children)\n ) {\n const submenu = item as BaseSubMenuType;\n const label = getItemLabel(submenu);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in submenu && Boolean(submenu.danger);\n const submenuHasSlots = submenu.header != null || submenu.footer != null;\n const submenuBody =\n submenu.children && submenu.children.length > 0 ? (\n renderContextMenuItems(submenu.children, nextKeyPath, {\n iconAlign,\n iconSpaceMode,\n })\n ) : (\n <EmptyMenuItem />\n );\n\n return (\n <ContextMenu.SubmenuRoot\n defaultOpen={submenu.defaultOpen}\n key={itemKey}\n open={submenu.open}\n onOpenChange={submenu.onOpenChange}\n >\n <ContextMenu.SubmenuTrigger\n {...submenu.triggerProps}\n className={cx(styles.item, isDanger && styles.danger)}\n closeDelay={submenu.closeDelay}\n delay={submenu.delay}\n disabled={submenu.disabled}\n label={labelText}\n openOnHover={submenu.openOnHover}\n onClick={submenu.onClick}\n >\n {renderItemContent(submenu, {\n iconAlign,\n reserveIconSpace,\n submenu: true,\n })}\n </ContextMenu.SubmenuTrigger>\n <ContextMenu.Portal>\n <ContextMenu.Positioner\n alignOffset={-4}\n className={styles.positioner}\n data-submenu=\"\"\n sideOffset={-1}\n onContextMenu={preventDefaultAndStopPropagation}\n >\n <ContextMenu.Popup\n className={submenuHasSlots ? cx(styles.popup, styles.popupWithSlots) : styles.popup}\n >\n {submenu.header == null ? null : (\n <div className={styles.header}>{submenu.header}</div>\n )}\n {submenuHasSlots ? (\n <div className={styles.slotViewport}>{submenuBody}</div>\n ) : (\n submenuBody\n )}\n {submenu.footer == null ? null : (\n <div className={styles.footer}>{submenu.footer}</div>\n )}\n </ContextMenu.Popup>\n </ContextMenu.Positioner>\n </ContextMenu.Portal>\n </ContextMenu.SubmenuRoot>\n );\n }\n\n const menuItem = item as MenuItemType;\n const label = getItemLabel(menuItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in menuItem && Boolean(menuItem.danger);\n\n return (\n <ContextMenu.Item\n className={cx(styles.item, isDanger && styles.danger)}\n closeOnClick={menuItem.closeOnClick}\n disabled={menuItem.disabled}\n key={itemKey}\n label={labelText}\n onClick={(event) => invokeItemClick(menuItem, nextKeyPath, event)}\n >\n {renderItemContent(menuItem, { iconAlign, reserveIconSpace })}\n </ContextMenu.Item>\n );\n });\n};\n"],"mappings":";;;;;;;;;;;;;AAuCA,MAAM,gBAAgB,WAAW;CAC/B,MAAM,EAAE,MAAM,eAAeA,eAAO;AACpC,QACE,oBAAC,YAAY,MAAb;EAAkB,UAAA;EAAS,WAAW,GAAG,OAAO,MAAM,OAAO,MAAM;YACjE,oBAAC,OAAD;GAAK,WAAW,OAAO;aACrB,oBAAC,QAAD;IAAM,WAAW,OAAO;cAAQ,EAAE,eAAe;IAAQ,CAAA;GACrD,CAAA;EACW,CAAA;EAErB;AAEF,cAAc,cAAc;AAa5B,MAAM,iCAAiC,EACrC,SAAS,aACT,UACA,eAAe,OACf,QACA,gBACA,UACA,OACA,sBACwC;CACxC,MAAM,CAAC,iBAAiB,sBAAsB,SAAS,kBAAkB,MAAM;CAC/E,MAAM,eAAe,gBAAgB,KAAA;CACrC,MAAM,UAAU,eAAe,cAAc;CAE7C,MAAM,sBAAsB,aACzB,eAAwB;AACvB,MAAI,CAAC,aACH,oBAAmB,WAAW;AAEhC,oBAAkB,WAAW;IAE/B,CAAC,cAAc,gBAAgB,CAChC;AAED,QACE,qBAAC,YAAY,MAAb;EACE,WAAW,GAAG,OAAO,MAAM,UAAU,OAAO,OAAO;EACrC;EACJ;EACH;EACP,UAAU,MAAM;AACd,KAAE,gBAAgB;AAClB,OAAI,CAAC,SACH,qBAAoB,CAAC,QAAQ;;YARnC,CAYG,U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,YAAY,MAAb;GACE,WAAW,GAAG,OAAO,MAAM,YAAY,OAAO,OAAO;GACrD,cAAc,SAAS;GACvB,UAAU,SAAS;GAEnB,OAAO;GACP,UAAU,UAAU,gBAAgB,UAAU,aAAa,MAAM;aAEhE,kBAAkB,UAAU;IAAE;IAAW;IAAkB,CAAC;GAC5C,EALZ,QAKY;GAErB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { styles } from "../../Menu/sharedStyle.mjs";
|
|
2
|
-
import { DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemDesc, DropdownMenuItemExtra, DropdownMenuItemIcon, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuPopup, DropdownMenuPortal, DropdownMenuPositioner, DropdownMenuSeparator, DropdownMenuSubmenuArrow, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSwitchItem } from "./atoms.mjs";
|
|
2
|
+
import { DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuFooter, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuHeader, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemDesc, DropdownMenuItemExtra, DropdownMenuItemIcon, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuPopup, DropdownMenuPortal, DropdownMenuPositioner, DropdownMenuScrollViewport, DropdownMenuSeparator, DropdownMenuSubmenuArrow, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSwitchItem } from "./atoms.mjs";
|
|
3
3
|
import { getItemKey, getItemLabel, hasAnyIcon, hasCheckboxAndIcon, renderIcon } from "../../Menu/renderUtils.mjs";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { Check, ChevronRight } from "lucide-react";
|
|
@@ -106,6 +106,11 @@ const renderDropdownMenuItems = (items, keyPath = [], options) => {
|
|
|
106
106
|
const label = getItemLabel(submenu);
|
|
107
107
|
const labelText = typeof label === "string" ? label : void 0;
|
|
108
108
|
const isDanger = "danger" in submenu && Boolean(submenu.danger);
|
|
109
|
+
const submenuHasSlots = submenu.header != null || submenu.footer != null;
|
|
110
|
+
const submenuItems = submenu.children ? renderDropdownMenuItems(submenu.children, nextKeyPath, {
|
|
111
|
+
iconAlign,
|
|
112
|
+
iconSpaceMode
|
|
113
|
+
}) : null;
|
|
109
114
|
return /* @__PURE__ */ jsxs(DropdownMenuSubmenuRoot, {
|
|
110
115
|
defaultOpen: submenu.defaultOpen,
|
|
111
116
|
open: submenu.open,
|
|
@@ -128,10 +133,14 @@ const renderDropdownMenuItems = (items, keyPath = [], options) => {
|
|
|
128
133
|
alignOffset: -4,
|
|
129
134
|
"data-submenu": "",
|
|
130
135
|
sideOffset: -1,
|
|
131
|
-
children: /* @__PURE__ */
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
136
|
+
children: /* @__PURE__ */ jsxs(DropdownMenuPopup, {
|
|
137
|
+
className: submenuHasSlots ? styles.popupWithSlots : void 0,
|
|
138
|
+
children: [
|
|
139
|
+
submenu.header == null ? null : /* @__PURE__ */ jsx(DropdownMenuHeader, { children: submenu.header }),
|
|
140
|
+
submenuHasSlots ? /* @__PURE__ */ jsx(DropdownMenuScrollViewport, { children: submenuItems }) : submenuItems,
|
|
141
|
+
submenu.footer == null ? null : /* @__PURE__ */ jsx(DropdownMenuFooter, { children: submenu.footer })
|
|
142
|
+
]
|
|
143
|
+
})
|
|
135
144
|
}) })]
|
|
136
145
|
}, itemKey);
|
|
137
146
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderItems.mjs","names":[],"sources":["../../../src/base-ui/DropdownMenu/renderItems.tsx"],"sourcesContent":["import { Check, ChevronRight } from 'lucide-react';\nimport { type MenuInfo } from 'rc-menu/es/interface';\nimport {\n type KeyboardEvent as ReactKeyboardEvent,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n} from 'react';\n\nimport {\n type BaseMenuItemGroupType,\n type BaseSubMenuType,\n getItemKey,\n getItemLabel,\n hasAnyIcon,\n hasCheckboxAndIcon,\n type MenuDividerType,\n type MenuItemType,\n renderIcon,\n type RenderItemContentOptions,\n type RenderOptions,\n} from '@/Menu';\nimport { styles } from '@/Menu/sharedStyle';\n\nimport {\n DropdownMenuCheckboxItemIndicator,\n DropdownMenuCheckboxItemPrimitive,\n DropdownMenuGroup,\n DropdownMenuGroupLabel,\n DropdownMenuItem,\n DropdownMenuItemContent,\n DropdownMenuItemDesc,\n DropdownMenuItemExtra,\n DropdownMenuItemIcon,\n DropdownMenuItemLabel,\n DropdownMenuItemLabelGroup,\n DropdownMenuPopup,\n DropdownMenuPortal,\n DropdownMenuPositioner,\n DropdownMenuSeparator,\n DropdownMenuSubmenuArrow,\n DropdownMenuSubmenuRoot,\n DropdownMenuSubmenuTrigger,\n DropdownMenuSwitchItem,\n} from './atoms';\nimport {\n type DropdownItem,\n type DropdownMenuCheckboxItem as DropdownMenuCheckboxItemType,\n type DropdownMenuSwitchItem as DropdownMenuSwitchItemType,\n} from './type';\n\nexport type { IconAlign, IconSpaceMode } from '@/Menu';\n\nconst renderItemContent = (\n item: MenuItemType | BaseSubMenuType | DropdownMenuCheckboxItemType | DropdownMenuSwitchItemType,\n options?: RenderItemContentOptions,\n iconNode?: ReactNode,\n) => {\n const label = getItemLabel(item);\n const desc = 'desc' in item ? item.desc : undefined;\n const extra = 'extra' in item ? item.extra : undefined;\n const indicatorOnRight = options?.indicatorOnRight;\n const alignStart = Boolean(desc) && options?.iconAlign === 'start';\n\n const hasCustomIcon = iconNode !== undefined && !indicatorOnRight;\n const hasIcon = hasCustomIcon ? Boolean(iconNode) : Boolean(item.icon);\n const shouldRenderIcon = hasCustomIcon\n ? Boolean(options?.reserveIconSpace || iconNode)\n : Boolean(hasIcon || options?.reserveIconSpace);\n\n const labelNode = desc ? (\n <DropdownMenuItemLabelGroup>\n <DropdownMenuItemLabel>{label}</DropdownMenuItemLabel>\n <DropdownMenuItemDesc>{desc}</DropdownMenuItemDesc>\n </DropdownMenuItemLabelGroup>\n ) : (\n <DropdownMenuItemLabel>{label}</DropdownMenuItemLabel>\n );\n\n return (\n <DropdownMenuItemContent className={alignStart ? styles.itemContentAlignStart : undefined}>\n {shouldRenderIcon ? (\n <DropdownMenuItemIcon\n aria-hidden={!hasIcon}\n className={alignStart ? styles.iconAlignStart : undefined}\n >\n {hasCustomIcon ? iconNode : hasIcon ? renderIcon(item.icon) : null}\n </DropdownMenuItemIcon>\n ) : null}\n {labelNode}\n {extra ? <DropdownMenuItemExtra>{extra}</DropdownMenuItemExtra> : null}\n {indicatorOnRight && iconNode ? iconNode : null}\n {options?.submenu ? (\n <DropdownMenuSubmenuArrow>\n <ChevronRight size={16} />\n </DropdownMenuSubmenuArrow>\n ) : null}\n </DropdownMenuItemContent>\n );\n};\n\nconst invokeItemClick = (\n item: MenuItemType,\n keyPath: string[],\n event: ReactMouseEvent<HTMLElement> | ReactKeyboardEvent<HTMLElement>,\n) => {\n if (!item.onClick) return;\n const key = item.key ?? keyPath.at(-1) ?? '';\n const info: MenuInfo = {\n domEvent: event,\n item: event.currentTarget as MenuInfo['item'],\n key: String(key),\n keyPath,\n };\n item.onClick(info);\n};\n\nexport const renderDropdownMenuItems = (\n items: DropdownItem[],\n keyPath: string[] = [],\n options?: RenderOptions,\n): ReactNode[] => {\n const iconAlign = options?.iconAlign;\n const iconSpaceMode = options?.iconSpaceMode ?? 'global';\n const reserveIconSpace =\n options?.reserveIconSpace ?? hasAnyIcon(items, iconSpaceMode === 'global');\n const indicatorOnRight = options?.indicatorOnRight ?? hasCheckboxAndIcon(items);\n\n return items.map((item, index) => {\n if (!item) return null;\n\n const fallbackKey = `${keyPath.join('-') || 'root'}-${index}`;\n const itemKey = getItemKey(item, fallbackKey);\n const nextKeyPath = [...keyPath, String(itemKey)];\n\n if ((item as DropdownMenuCheckboxItemType).type === 'checkbox') {\n const checkboxItem = item as DropdownMenuCheckboxItemType;\n const label = getItemLabel(checkboxItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(checkboxItem.danger);\n const indicator = (\n <DropdownMenuCheckboxItemIndicator>{renderIcon(Check)}</DropdownMenuCheckboxItemIndicator>\n );\n\n return (\n <DropdownMenuCheckboxItemPrimitive\n checked={checkboxItem.checked}\n closeOnClick={checkboxItem.closeOnClick}\n danger={isDanger}\n defaultChecked={checkboxItem.defaultChecked}\n disabled={checkboxItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={(checked) => checkboxItem.onCheckedChange?.(checked)}\n >\n {renderItemContent(\n checkboxItem,\n { iconAlign, indicatorOnRight, reserveIconSpace },\n indicator,\n )}\n </DropdownMenuCheckboxItemPrimitive>\n );\n }\n\n if ((item as DropdownMenuSwitchItemType).type === 'switch') {\n const switchItem = item as DropdownMenuSwitchItemType;\n const label = getItemLabel(switchItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(switchItem.danger);\n\n return (\n <DropdownMenuSwitchItem\n checked={switchItem.checked}\n closeOnClick={switchItem.closeOnClick}\n danger={isDanger}\n defaultChecked={switchItem.defaultChecked}\n disabled={switchItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={(checked) => switchItem.onCheckedChange?.(checked)}\n >\n {renderItemContent(switchItem, { iconAlign, reserveIconSpace })}\n </DropdownMenuSwitchItem>\n );\n }\n\n if ((item as MenuDividerType).type === 'divider') {\n return <DropdownMenuSeparator key={itemKey} />;\n }\n\n if ((item as BaseMenuItemGroupType).type === 'group') {\n const group = item as BaseMenuItemGroupType;\n const groupReserveIconSpace =\n iconSpaceMode === 'group'\n ? group.children\n ? hasAnyIcon(group.children)\n : false\n : reserveIconSpace;\n const groupIndicatorOnRight = group.children ? hasCheckboxAndIcon(group.children) : false;\n return (\n <DropdownMenuGroup key={itemKey}>\n {group.label ? <DropdownMenuGroupLabel>{group.label}</DropdownMenuGroupLabel> : null}\n {group.children\n ? renderDropdownMenuItems(group.children, nextKeyPath, {\n iconAlign,\n iconSpaceMode,\n indicatorOnRight: groupIndicatorOnRight,\n reserveIconSpace: groupReserveIconSpace,\n })\n : null}\n </DropdownMenuGroup>\n );\n }\n\n if ((item as BaseSubMenuType).type === 'submenu' || 'children' in item) {\n const submenu = item as BaseSubMenuType;\n const label = getItemLabel(submenu);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in submenu && Boolean(submenu.danger);\n\n return (\n <DropdownMenuSubmenuRoot\n defaultOpen={submenu.defaultOpen}\n key={itemKey}\n open={submenu.open}\n onOpenChange={submenu.onOpenChange}\n >\n <DropdownMenuSubmenuTrigger\n {...submenu.triggerProps}\n closeDelay={submenu.closeDelay}\n danger={isDanger}\n delay={submenu.delay}\n disabled={submenu.disabled}\n label={labelText}\n openOnHover={submenu.openOnHover}\n onClick={submenu.onClick}\n >\n {renderItemContent(submenu, {\n iconAlign,\n reserveIconSpace,\n submenu: true,\n })}\n </DropdownMenuSubmenuTrigger>\n <DropdownMenuPortal>\n <DropdownMenuPositioner alignOffset={-4} data-submenu=\"\" sideOffset={-1}>\n <DropdownMenuPopup>\n {submenu.children\n ? renderDropdownMenuItems(submenu.children, nextKeyPath, {\n iconAlign,\n iconSpaceMode,\n })\n : null}\n </DropdownMenuPopup>\n </DropdownMenuPositioner>\n </DropdownMenuPortal>\n </DropdownMenuSubmenuRoot>\n );\n }\n\n const menuItem = item as MenuItemType;\n const label = getItemLabel(menuItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in menuItem && Boolean(menuItem.danger);\n\n return (\n <DropdownMenuItem\n closeOnClick={menuItem.closeOnClick}\n danger={isDanger}\n disabled={menuItem.disabled}\n key={itemKey}\n label={labelText}\n onClick={(event) => invokeItemClick(menuItem, nextKeyPath, event)}\n >\n {renderItemContent(menuItem, { iconAlign, reserveIconSpace })}\n </DropdownMenuItem>\n );\n });\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AAa;KAAG,YAAY;eACnE,oBAAC,mBAAD,EAAA,UACG,QAAQ,WACL,wBAAwB,QAAQ,UAAU,aAAa;MACrD;MACA;MACD,CAAC,GACF,MACc,CAAA;KACG,CAAA,EACN,CAAA,CACG;MAhCnB,QAgCmB;;EAI9B,MAAM,WAAW;EACjB,MAAM,QAAQ,aAAa,SAAS;EACpC,MAAM,YAAY,OAAO,UAAU,WAAW,QAAQ,KAAA;EACtD,MAAM,WAAW,YAAY,YAAY,QAAQ,SAAS,OAAO;AAEjE,SACE,oBAAC,kBAAD;GACE,cAAc,SAAS;GACvB,QAAQ;GACR,UAAU,SAAS;GAEnB,OAAO;GACP,UAAU,UAAU,gBAAgB,UAAU,aAAa,MAAM;aAEhE,kBAAkB,UAAU;IAAE;IAAW;IAAkB,CAAC;GAC5C,EALZ,QAKY;GAErB"}
|
|
1
|
+
{"version":3,"file":"renderItems.mjs","names":[],"sources":["../../../src/base-ui/DropdownMenu/renderItems.tsx"],"sourcesContent":["import { Check, ChevronRight } from 'lucide-react';\nimport { type MenuInfo } from 'rc-menu/es/interface';\nimport {\n type KeyboardEvent as ReactKeyboardEvent,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n} from 'react';\n\nimport {\n type BaseMenuItemGroupType,\n type BaseSubMenuType,\n getItemKey,\n getItemLabel,\n hasAnyIcon,\n hasCheckboxAndIcon,\n type MenuDividerType,\n type MenuItemType,\n renderIcon,\n type RenderItemContentOptions,\n type RenderOptions,\n} from '@/Menu';\nimport { styles } from '@/Menu/sharedStyle';\n\nimport {\n DropdownMenuCheckboxItemIndicator,\n DropdownMenuCheckboxItemPrimitive,\n DropdownMenuFooter,\n DropdownMenuGroup,\n DropdownMenuGroupLabel,\n DropdownMenuHeader,\n DropdownMenuItem,\n DropdownMenuItemContent,\n DropdownMenuItemDesc,\n DropdownMenuItemExtra,\n DropdownMenuItemIcon,\n DropdownMenuItemLabel,\n DropdownMenuItemLabelGroup,\n DropdownMenuPopup,\n DropdownMenuPortal,\n DropdownMenuPositioner,\n DropdownMenuScrollViewport,\n DropdownMenuSeparator,\n DropdownMenuSubmenuArrow,\n DropdownMenuSubmenuRoot,\n DropdownMenuSubmenuTrigger,\n DropdownMenuSwitchItem,\n} from './atoms';\nimport {\n type DropdownItem,\n type DropdownMenuCheckboxItem as DropdownMenuCheckboxItemType,\n type DropdownMenuSwitchItem as DropdownMenuSwitchItemType,\n} from './type';\n\nexport type { IconAlign, IconSpaceMode } from '@/Menu';\n\nconst renderItemContent = (\n item: MenuItemType | BaseSubMenuType | DropdownMenuCheckboxItemType | DropdownMenuSwitchItemType,\n options?: RenderItemContentOptions,\n iconNode?: ReactNode,\n) => {\n const label = getItemLabel(item);\n const desc = 'desc' in item ? item.desc : undefined;\n const extra = 'extra' in item ? item.extra : undefined;\n const indicatorOnRight = options?.indicatorOnRight;\n const alignStart = Boolean(desc) && options?.iconAlign === 'start';\n\n const hasCustomIcon = iconNode !== undefined && !indicatorOnRight;\n const hasIcon = hasCustomIcon ? Boolean(iconNode) : Boolean(item.icon);\n const shouldRenderIcon = hasCustomIcon\n ? Boolean(options?.reserveIconSpace || iconNode)\n : Boolean(hasIcon || options?.reserveIconSpace);\n\n const labelNode = desc ? (\n <DropdownMenuItemLabelGroup>\n <DropdownMenuItemLabel>{label}</DropdownMenuItemLabel>\n <DropdownMenuItemDesc>{desc}</DropdownMenuItemDesc>\n </DropdownMenuItemLabelGroup>\n ) : (\n <DropdownMenuItemLabel>{label}</DropdownMenuItemLabel>\n );\n\n return (\n <DropdownMenuItemContent className={alignStart ? styles.itemContentAlignStart : undefined}>\n {shouldRenderIcon ? (\n <DropdownMenuItemIcon\n aria-hidden={!hasIcon}\n className={alignStart ? styles.iconAlignStart : undefined}\n >\n {hasCustomIcon ? iconNode : hasIcon ? renderIcon(item.icon) : null}\n </DropdownMenuItemIcon>\n ) : null}\n {labelNode}\n {extra ? <DropdownMenuItemExtra>{extra}</DropdownMenuItemExtra> : null}\n {indicatorOnRight && iconNode ? iconNode : null}\n {options?.submenu ? (\n <DropdownMenuSubmenuArrow>\n <ChevronRight size={16} />\n </DropdownMenuSubmenuArrow>\n ) : null}\n </DropdownMenuItemContent>\n );\n};\n\nconst invokeItemClick = (\n item: MenuItemType,\n keyPath: string[],\n event: ReactMouseEvent<HTMLElement> | ReactKeyboardEvent<HTMLElement>,\n) => {\n if (!item.onClick) return;\n const key = item.key ?? keyPath.at(-1) ?? '';\n const info: MenuInfo = {\n domEvent: event,\n item: event.currentTarget as MenuInfo['item'],\n key: String(key),\n keyPath,\n };\n item.onClick(info);\n};\n\nexport const renderDropdownMenuItems = (\n items: DropdownItem[],\n keyPath: string[] = [],\n options?: RenderOptions,\n): ReactNode[] => {\n const iconAlign = options?.iconAlign;\n const iconSpaceMode = options?.iconSpaceMode ?? 'global';\n const reserveIconSpace =\n options?.reserveIconSpace ?? hasAnyIcon(items, iconSpaceMode === 'global');\n const indicatorOnRight = options?.indicatorOnRight ?? hasCheckboxAndIcon(items);\n\n return items.map((item, index) => {\n if (!item) return null;\n\n const fallbackKey = `${keyPath.join('-') || 'root'}-${index}`;\n const itemKey = getItemKey(item, fallbackKey);\n const nextKeyPath = [...keyPath, String(itemKey)];\n\n if ((item as DropdownMenuCheckboxItemType).type === 'checkbox') {\n const checkboxItem = item as DropdownMenuCheckboxItemType;\n const label = getItemLabel(checkboxItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(checkboxItem.danger);\n const indicator = (\n <DropdownMenuCheckboxItemIndicator>{renderIcon(Check)}</DropdownMenuCheckboxItemIndicator>\n );\n\n return (\n <DropdownMenuCheckboxItemPrimitive\n checked={checkboxItem.checked}\n closeOnClick={checkboxItem.closeOnClick}\n danger={isDanger}\n defaultChecked={checkboxItem.defaultChecked}\n disabled={checkboxItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={(checked) => checkboxItem.onCheckedChange?.(checked)}\n >\n {renderItemContent(\n checkboxItem,\n { iconAlign, indicatorOnRight, reserveIconSpace },\n indicator,\n )}\n </DropdownMenuCheckboxItemPrimitive>\n );\n }\n\n if ((item as DropdownMenuSwitchItemType).type === 'switch') {\n const switchItem = item as DropdownMenuSwitchItemType;\n const label = getItemLabel(switchItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = Boolean(switchItem.danger);\n\n return (\n <DropdownMenuSwitchItem\n checked={switchItem.checked}\n closeOnClick={switchItem.closeOnClick}\n danger={isDanger}\n defaultChecked={switchItem.defaultChecked}\n disabled={switchItem.disabled}\n key={itemKey}\n label={labelText}\n onCheckedChange={(checked) => switchItem.onCheckedChange?.(checked)}\n >\n {renderItemContent(switchItem, { iconAlign, reserveIconSpace })}\n </DropdownMenuSwitchItem>\n );\n }\n\n if ((item as MenuDividerType).type === 'divider') {\n return <DropdownMenuSeparator key={itemKey} />;\n }\n\n if ((item as BaseMenuItemGroupType).type === 'group') {\n const group = item as BaseMenuItemGroupType;\n const groupReserveIconSpace =\n iconSpaceMode === 'group'\n ? group.children\n ? hasAnyIcon(group.children)\n : false\n : reserveIconSpace;\n const groupIndicatorOnRight = group.children ? hasCheckboxAndIcon(group.children) : false;\n return (\n <DropdownMenuGroup key={itemKey}>\n {group.label ? <DropdownMenuGroupLabel>{group.label}</DropdownMenuGroupLabel> : null}\n {group.children\n ? renderDropdownMenuItems(group.children, nextKeyPath, {\n iconAlign,\n iconSpaceMode,\n indicatorOnRight: groupIndicatorOnRight,\n reserveIconSpace: groupReserveIconSpace,\n })\n : null}\n </DropdownMenuGroup>\n );\n }\n\n if ((item as BaseSubMenuType).type === 'submenu' || 'children' in item) {\n const submenu = item as BaseSubMenuType;\n const label = getItemLabel(submenu);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in submenu && Boolean(submenu.danger);\n const submenuHasSlots = submenu.header != null || submenu.footer != null;\n const submenuItems = submenu.children\n ? renderDropdownMenuItems(submenu.children, nextKeyPath, {\n iconAlign,\n iconSpaceMode,\n })\n : null;\n\n return (\n <DropdownMenuSubmenuRoot\n defaultOpen={submenu.defaultOpen}\n key={itemKey}\n open={submenu.open}\n onOpenChange={submenu.onOpenChange}\n >\n <DropdownMenuSubmenuTrigger\n {...submenu.triggerProps}\n closeDelay={submenu.closeDelay}\n danger={isDanger}\n delay={submenu.delay}\n disabled={submenu.disabled}\n label={labelText}\n openOnHover={submenu.openOnHover}\n onClick={submenu.onClick}\n >\n {renderItemContent(submenu, {\n iconAlign,\n reserveIconSpace,\n submenu: true,\n })}\n </DropdownMenuSubmenuTrigger>\n <DropdownMenuPortal>\n <DropdownMenuPositioner alignOffset={-4} data-submenu=\"\" sideOffset={-1}>\n <DropdownMenuPopup className={submenuHasSlots ? styles.popupWithSlots : undefined}>\n {submenu.header == null ? null : (\n <DropdownMenuHeader>{submenu.header}</DropdownMenuHeader>\n )}\n {submenuHasSlots ? (\n <DropdownMenuScrollViewport>{submenuItems}</DropdownMenuScrollViewport>\n ) : (\n submenuItems\n )}\n {submenu.footer == null ? null : (\n <DropdownMenuFooter>{submenu.footer}</DropdownMenuFooter>\n )}\n </DropdownMenuPopup>\n </DropdownMenuPositioner>\n </DropdownMenuPortal>\n </DropdownMenuSubmenuRoot>\n );\n }\n\n const menuItem = item as MenuItemType;\n const label = getItemLabel(menuItem);\n const labelText = typeof label === 'string' ? label : undefined;\n const isDanger = 'danger' in menuItem && Boolean(menuItem.danger);\n\n return (\n <DropdownMenuItem\n closeOnClick={menuItem.closeOnClick}\n danger={isDanger}\n disabled={menuItem.disabled}\n key={itemKey}\n label={labelText}\n onClick={(event) => invokeItemClick(menuItem, nextKeyPath, event)}\n >\n {renderItemContent(menuItem, { iconAlign, reserveIconSpace })}\n </DropdownMenuItem>\n );\n });\n};\n"],"mappings":";;;;;;AAuDA,MAAM,qBACJ,MACA,SACA,aACG;CACH,MAAM,QAAQ,aAAa,KAAK;CAChC,MAAM,OAAO,UAAU,OAAO,KAAK,OAAO,KAAA;CAC1C,MAAM,QAAQ,WAAW,OAAO,KAAK,QAAQ,KAAA;CAC7C,M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AAkB,OAAO,iBAAiB,KAAA;gBAAxE;OACG,QAAQ,UAAU,OAAO,OACxB,oBAAC,oBAAD,EAAA,UAAqB,QAAQ,QAA4B,CAAA;OAE1D,kBACC,oBAAC,4BAAD,EAAA,UAA6B,cAA0C,CAAA,GAEvE;OAED,QAAQ,UAAU,OAAO,OACxB,oBAAC,oBAAD,EAAA,UAAqB,QAAQ,QAA4B,CAAA;OAEzC;;KACG,CAAA,EACN,CAAA,CACG;MArCnB,QAqCmB;;EAI9B,MAAM,WAAW;EACjB,MAAM,QAAQ,aAAa,SAAS;EACpC,MAAM,YAAY,OAAO,UAAU,WAAW,QAAQ,KAAA;EACtD,MAAM,WAAW,YAAY,YAAY,QAAQ,SAAS,OAAO;AAEjE,SACE,oBAAC,kBAAD;GACE,cAAc,SAAS;GACvB,QAAQ;GACR,UAAU,SAAS;GAEnB,OAAO;GACP,UAAU,UAAU,gBAAgB,UAAU,aAAa,MAAM;aAEhE,kBAAkB,UAAU;IAAE;IAAW;IAAkB,CAAC;GAC5C,EALZ,QAKY;GAErB"}
|
|
@@ -2,7 +2,14 @@
|
|
|
2
2
|
import { ScrollAreaContent, ScrollAreaCorner, ScrollAreaRoot, ScrollAreaScrollbar, ScrollAreaThumb, ScrollAreaViewport } from "./atoms.mjs";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
//#region src/base-ui/ScrollArea/ScrollArea.tsx
|
|
5
|
-
const ScrollArea = ({ children, contentProps, corner = false, cornerProps, scrollFade = false, scrollbarProps, thumbProps, viewportProps, ...rest }) => {
|
|
5
|
+
const ScrollArea = ({ children, contentProps, corner = false, cornerProps, disableContentFit = false, scrollFade = false, scrollbarProps, thumbProps, viewportProps, ...rest }) => {
|
|
6
|
+
const mergedContentProps = disableContentFit ? {
|
|
7
|
+
...contentProps,
|
|
8
|
+
style: {
|
|
9
|
+
minWidth: 0,
|
|
10
|
+
...contentProps?.style
|
|
11
|
+
}
|
|
12
|
+
} : contentProps;
|
|
6
13
|
return /* @__PURE__ */ jsxs(ScrollAreaRoot, {
|
|
7
14
|
...rest,
|
|
8
15
|
children: [
|
|
@@ -10,7 +17,7 @@ const ScrollArea = ({ children, contentProps, corner = false, cornerProps, scrol
|
|
|
10
17
|
scrollFade,
|
|
11
18
|
...viewportProps,
|
|
12
19
|
children: /* @__PURE__ */ jsx(ScrollAreaContent, {
|
|
13
|
-
...
|
|
20
|
+
...mergedContentProps,
|
|
14
21
|
children
|
|
15
22
|
})
|
|
16
23
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollArea.mjs","names":[],"sources":["../../../src/base-ui/ScrollArea/ScrollArea.tsx"],"sourcesContent":["'use client';\n\nimport { type FC } from 'react';\n\nimport {\n ScrollAreaContent,\n ScrollAreaCorner,\n ScrollAreaRoot,\n ScrollAreaScrollbar,\n ScrollAreaThumb,\n ScrollAreaViewport,\n} from './atoms';\nimport type { ScrollAreaProps } from './type';\n\nexport const ScrollArea: FC<ScrollAreaProps> = ({\n children,\n contentProps,\n corner = false,\n cornerProps,\n scrollFade = false,\n scrollbarProps,\n thumbProps,\n viewportProps,\n ...rest\n}) => {\n return (\n <ScrollAreaRoot {...rest}>\n <ScrollAreaViewport scrollFade={scrollFade} {...viewportProps}>\n <ScrollAreaContent {...
|
|
1
|
+
{"version":3,"file":"ScrollArea.mjs","names":[],"sources":["../../../src/base-ui/ScrollArea/ScrollArea.tsx"],"sourcesContent":["'use client';\n\nimport { type FC } from 'react';\n\nimport {\n ScrollAreaContent,\n ScrollAreaCorner,\n ScrollAreaRoot,\n ScrollAreaScrollbar,\n ScrollAreaThumb,\n ScrollAreaViewport,\n} from './atoms';\nimport type { ScrollAreaProps } from './type';\n\nexport const ScrollArea: FC<ScrollAreaProps> = ({\n children,\n contentProps,\n corner = false,\n cornerProps,\n disableContentFit = false,\n scrollFade = false,\n scrollbarProps,\n thumbProps,\n viewportProps,\n ...rest\n}) => {\n const mergedContentProps = disableContentFit\n ? { ...contentProps, style: { minWidth: 0, ...contentProps?.style } }\n : contentProps;\n\n return (\n <ScrollAreaRoot {...rest}>\n <ScrollAreaViewport scrollFade={scrollFade} {...viewportProps}>\n <ScrollAreaContent {...mergedContentProps}>{children}</ScrollAreaContent>\n </ScrollAreaViewport>\n <ScrollAreaScrollbar {...scrollbarProps}>\n <ScrollAreaThumb {...thumbProps} />\n </ScrollAreaScrollbar>\n {corner && <ScrollAreaCorner {...cornerProps} />}\n </ScrollAreaRoot>\n );\n};\n"],"mappings":";;;;AAcA,MAAa,cAAmC,EAC9C,UACA,cACA,SAAS,OACT,aACA,oBAAoB,OACpB,aAAa,OACb,gBACA,YACA,eACA,GAAG,WACC;CACJ,MAAM,qBAAqB,oBACvB;EAAE,GAAG;EAAc,OAAO;GAAE,UAAU;GAAG,GAAG,cAAc;GAAO;EAAE,GACnE;AAEJ,QACE,qBAAC,gBAAD;EAAgB,GAAI;YAApB;GACE,oBAAC,oBAAD;IAAgC;IAAY,GAAI;cAC9C,oBAAC,mBAAD;KAAmB,GAAI;KAAqB;KAA6B,CAAA;IACtD,CAAA;GACrB,oBAAC,qBAAD;IAAqB,GAAI;cACvB,oBAAC,iBAAD,EAAiB,GAAI,YAAc,CAAA;IACf,CAAA;GACrB,UAAU,oBAAC,kBAAD,EAAkB,GAAI,aAAe,CAAA;GACjC"}
|
|
@@ -7,6 +7,15 @@ interface ScrollAreaProps extends Omit<ScrollAreaRootProps, 'children'> {
|
|
|
7
7
|
contentProps?: Omit<ScrollAreaContentProps, 'children'>;
|
|
8
8
|
corner?: boolean;
|
|
9
9
|
cornerProps?: ScrollAreaCornerProps;
|
|
10
|
+
/**
|
|
11
|
+
* Override Base UI's default `min-width: fit-content` on the content node by
|
|
12
|
+
* setting `min-width: 0`. Use this when an unbreakable wide child (e.g. a
|
|
13
|
+
* `<pre>` code block) would otherwise propagate its intrinsic width up the
|
|
14
|
+
* ancestor chain and stretch the scroll container past its parent.
|
|
15
|
+
*
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
disableContentFit?: boolean;
|
|
10
19
|
scrollbarProps?: Omit<ScrollAreaScrollbarProps, 'children'>;
|
|
11
20
|
/**
|
|
12
21
|
* Enable gradient scroll fade on the viewport edges.
|
|
@@ -39,6 +39,7 @@ const ToastItem = memo(({ toast, classNames, styles: customStyles }) => {
|
|
|
39
39
|
const iconColor = typeColors[type];
|
|
40
40
|
const IconComponent = icon ?? typeIcons[type];
|
|
41
41
|
const isLoading = type === "loading";
|
|
42
|
+
const standaloneDescriptionClassName = cx(styles.description, styles.descriptionStandalone, classNames?.description);
|
|
42
43
|
const renderIcon = () => {
|
|
43
44
|
if (!IconComponent) return null;
|
|
44
45
|
return /* @__PURE__ */ jsx("div", {
|
|
@@ -108,7 +109,7 @@ const ToastItem = memo(({ toast, classNames, styles: customStyles }) => {
|
|
|
108
109
|
})] }) : description && /* @__PURE__ */ jsxs("div", {
|
|
109
110
|
className: styles.titleRow,
|
|
110
111
|
children: [/* @__PURE__ */ jsx(Toast.Description, {
|
|
111
|
-
className:
|
|
112
|
+
className: standaloneDescriptionClassName,
|
|
112
113
|
style: customStyles?.description,
|
|
113
114
|
children: description
|
|
114
115
|
}), showCloseButton && /* @__PURE__ */ jsx(Toast.Close, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.mjs","names":["BaseToast"],"sources":["../../../src/base-ui/Toast/Toast.tsx"],"sourcesContent":["'use client';\n\nimport { Toast as BaseToast } from '@base-ui/react/toast';\nimport { cssVar, cx } from 'antd-style';\nimport { AlertTriangle, CheckCircle, Info, Loader2, X, XCircle } from 'lucide-react';\nimport { memo, type ReactNode } from 'react';\n\nimport Icon from '@/Icon';\n\nimport { useToastContext } from './context';\nimport { actionVariants, rootVariants, styles } from './style';\nimport { type ToastOptions, type ToastProps, type ToastType } from './type';\n\nconst typeIcons: Record<ToastType, typeof Info> = {\n default: Info,\n error: XCircle,\n info: Info,\n loading: Loader2,\n success: CheckCircle,\n warning: AlertTriangle,\n};\n\nconst typeColors: Record<ToastType, string> = {\n default: cssVar.colorText,\n error: cssVar.colorError,\n info: cssVar.colorInfo,\n loading: cssVar.colorPrimary,\n success: cssVar.colorSuccess,\n warning: cssVar.colorWarning,\n};\n\nconst ToastItem = memo<ToastProps>(({ toast, classNames, styles: customStyles }) => {\n const { position, swipeDirection } = useToastContext();\n const toastData = toast.data as ToastOptions | undefined;\n const type = toastData?.type ?? 'default';\n const closable = toastData?.closable ?? true;\n const hideCloseButton = toastData?.hideCloseButton ?? false;\n const showCloseButton = closable && !hideCloseButton;\n const icon = toastData?.icon;\n const title = toast.title ?? toastData?.title;\n const description = toast.description ?? toastData?.description;\n const actionProps = toast.actionProps ?? toastData?.actionProps;\n const actions = toastData?.actions;\n\n const iconColor = typeColors[type];\n const IconComponent = icon ?? typeIcons[type];\n const isLoading = type === 'loading';\n\n const renderIcon = (): ReactNode => {\n if (!IconComponent) return null;\n return (\n <div className={cx(styles.icon, classNames?.icon)} style={customStyles?.icon}>\n <Icon color={iconColor} icon={IconComponent} size={18} spin={isLoading} />\n </div>\n );\n };\n\n const renderActions = (): ReactNode => {\n if (actions && actions.length > 0) {\n return (\n <div className={cx(styles.actions, classNames?.actions)} style={customStyles?.actions}>\n {actions.map((action, index) => (\n <BaseToast.Action\n key={index}\n style={customStyles?.action}\n className={cx(\n actionVariants({ variant: action.variant ?? 'primary' }),\n classNames?.action,\n )}\n onClick={action.onClick}\n {...action.props}\n >\n {action.label}\n </BaseToast.Action>\n ))}\n </div>\n );\n }\n if (actionProps) {\n return (\n <BaseToast.Action\n className={cx(actionVariants({ variant: 'primary' }), classNames?.action)}\n style={customStyles?.action}\n {...actionProps}\n />\n );\n }\n return null;\n };\n\n return (\n <BaseToast.Root\n className={cx(rootVariants({ position }), classNames?.root)}\n swipeDirection={swipeDirection}\n toast={toast}\n style={{\n ...customStyles?.root,\n ...toastData?.style,\n }}\n >\n <BaseToast.Content\n className={cx(styles.content, classNames?.content)}\n style={customStyles?.content}\n >\n <div className={title ? styles.toastBody : styles.toastBodyCenter}>\n {renderIcon()}\n <div className={styles.contentArea}>\n {title ? (\n <>\n <div className={styles.titleRow}>\n <BaseToast.Title\n className={cx(styles.title, classNames?.title)}\n style={customStyles?.title}\n >\n {title}\n </BaseToast.Title>\n {showCloseButton && (\n <BaseToast.Close\n aria-label=\"Close\"\n className={cx(styles.close, classNames?.close)}\n style={customStyles?.close}\n >\n <X size={14} />\n </BaseToast.Close>\n )}\n </div>\n {description && (\n <BaseToast.Description\n className={cx(styles.description, classNames?.description)}\n style={{\n marginBlockStart: 4,\n ...customStyles?.description,\n }}\n >\n {description}\n </BaseToast.Description>\n )}\n </>\n ) : (\n description && (\n <div className={styles.titleRow}>\n <BaseToast.Description\n className={
|
|
1
|
+
{"version":3,"file":"Toast.mjs","names":["BaseToast"],"sources":["../../../src/base-ui/Toast/Toast.tsx"],"sourcesContent":["'use client';\n\nimport { Toast as BaseToast } from '@base-ui/react/toast';\nimport { cssVar, cx } from 'antd-style';\nimport { AlertTriangle, CheckCircle, Info, Loader2, X, XCircle } from 'lucide-react';\nimport { memo, type ReactNode } from 'react';\n\nimport Icon from '@/Icon';\n\nimport { useToastContext } from './context';\nimport { actionVariants, rootVariants, styles } from './style';\nimport { type ToastOptions, type ToastProps, type ToastType } from './type';\n\nconst typeIcons: Record<ToastType, typeof Info> = {\n default: Info,\n error: XCircle,\n info: Info,\n loading: Loader2,\n success: CheckCircle,\n warning: AlertTriangle,\n};\n\nconst typeColors: Record<ToastType, string> = {\n default: cssVar.colorText,\n error: cssVar.colorError,\n info: cssVar.colorInfo,\n loading: cssVar.colorPrimary,\n success: cssVar.colorSuccess,\n warning: cssVar.colorWarning,\n};\n\nconst ToastItem = memo<ToastProps>(({ toast, classNames, styles: customStyles }) => {\n const { position, swipeDirection } = useToastContext();\n const toastData = toast.data as ToastOptions | undefined;\n const type = toastData?.type ?? 'default';\n const closable = toastData?.closable ?? true;\n const hideCloseButton = toastData?.hideCloseButton ?? false;\n const showCloseButton = closable && !hideCloseButton;\n const icon = toastData?.icon;\n const title = toast.title ?? toastData?.title;\n const description = toast.description ?? toastData?.description;\n const actionProps = toast.actionProps ?? toastData?.actionProps;\n const actions = toastData?.actions;\n\n const iconColor = typeColors[type];\n const IconComponent = icon ?? typeIcons[type];\n const isLoading = type === 'loading';\n const standaloneDescriptionClassName = cx(\n styles.description,\n styles.descriptionStandalone,\n classNames?.description,\n );\n\n const renderIcon = (): ReactNode => {\n if (!IconComponent) return null;\n return (\n <div className={cx(styles.icon, classNames?.icon)} style={customStyles?.icon}>\n <Icon color={iconColor} icon={IconComponent} size={18} spin={isLoading} />\n </div>\n );\n };\n\n const renderActions = (): ReactNode => {\n if (actions && actions.length > 0) {\n return (\n <div className={cx(styles.actions, classNames?.actions)} style={customStyles?.actions}>\n {actions.map((action, index) => (\n <BaseToast.Action\n key={index}\n style={customStyles?.action}\n className={cx(\n actionVariants({ variant: action.variant ?? 'primary' }),\n classNames?.action,\n )}\n onClick={action.onClick}\n {...action.props}\n >\n {action.label}\n </BaseToast.Action>\n ))}\n </div>\n );\n }\n if (actionProps) {\n return (\n <BaseToast.Action\n className={cx(actionVariants({ variant: 'primary' }), classNames?.action)}\n style={customStyles?.action}\n {...actionProps}\n />\n );\n }\n return null;\n };\n\n return (\n <BaseToast.Root\n className={cx(rootVariants({ position }), classNames?.root)}\n swipeDirection={swipeDirection}\n toast={toast}\n style={{\n ...customStyles?.root,\n ...toastData?.style,\n }}\n >\n <BaseToast.Content\n className={cx(styles.content, classNames?.content)}\n style={customStyles?.content}\n >\n <div className={title ? styles.toastBody : styles.toastBodyCenter}>\n {renderIcon()}\n <div className={styles.contentArea}>\n {title ? (\n <>\n <div className={styles.titleRow}>\n <BaseToast.Title\n className={cx(styles.title, classNames?.title)}\n style={customStyles?.title}\n >\n {title}\n </BaseToast.Title>\n {showCloseButton && (\n <BaseToast.Close\n aria-label=\"Close\"\n className={cx(styles.close, classNames?.close)}\n style={customStyles?.close}\n >\n <X size={14} />\n </BaseToast.Close>\n )}\n </div>\n {description && (\n <BaseToast.Description\n className={cx(styles.description, classNames?.description)}\n style={{\n marginBlockStart: 4,\n ...customStyles?.description,\n }}\n >\n {description}\n </BaseToast.Description>\n )}\n </>\n ) : (\n description && (\n <div className={styles.titleRow}>\n <BaseToast.Description\n className={standaloneDescriptionClassName}\n style={customStyles?.description}\n >\n {description}\n </BaseToast.Description>\n {showCloseButton && (\n <BaseToast.Close\n aria-label=\"Close\"\n className={cx(styles.close, classNames?.close)}\n style={customStyles?.close}\n >\n <X size={14} />\n </BaseToast.Close>\n )}\n </div>\n )\n )}\n {renderActions()}\n </div>\n </div>\n </BaseToast.Content>\n </BaseToast.Root>\n );\n});\n\nToastItem.displayName = 'ToastItem';\n\nexport default ToastItem;\n"],"mappings":";;;;;;;;;;AAaA,MAAM,YAA4C;CAChD,SAAS;CACT,OAAO;CACP,MAAM;CACN,SAAS;CACT,SAAS;CACT,SAAS;CACV;AAED,MAAM,aAAwC;CAC5C,SAAS,OAAO;CAChB,OAAO,OAAO;CACd,MAAM,OAAO;CACb,SAAS,OAAO;CAChB,SAAS,OAAO;CAChB,SAAS,OAAO;CACjB;AAED,MAAM,YAAY,MAAkB,EAAE,OAAO,YAAY,QAAQ,mBAAmB;CAClF,MAAM,EAAE,UAAU,mBAAmB,iBAAiB;CACtD,MAAM,YAAY,MAAM;CACxB,MAAM,OAAO,WAAW,QAAQ;CAChC,MAAM,WAAW,WAAW,YAAY;CACxC,MAAM,kBAAkB,WAAW,mBAAmB;CACtD,MAAM,kBAAkB,YAAY,CAAC;CACrC,MAAM,OAAO,WAAW;CACxB,MAAM,QAAQ,MAAM,SAAS,WAAW;CACxC,MAAM,cAAc,MAAM,eAAe,WAAW;CACpD,MAAM,cAAc,MAAM,eAAe,WAAW;CACpD,MAAM,UAAU,WAAW;CAE3B,MAAM,YAAY,WAAW;CAC7B,MAAM,gBAAgB,QAAQ,UAAU;CACxC,MAAM,YAAY,SAAS;CAC3B,MAAM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AAvB,CACE,oBAACA,MAAU,OAAX;OACE,WAAW,GAAG,OAAO,OAAO,YAAY,MAAM;OAC9C,OAAO,cAAc;iBAEpB;OACe,CAAA,EACjB,mBACC,oBAACA,MAAU,OAAX;OACE,cAAW;OACX,WAAW,GAAG,OAAO,OAAO,YAAY,MAAM;OAC9C,OAAO,cAAc;iBAErB,oBAAC,GAAD,EAAG,MAAM,IAAM,CAAA;OACC,CAAA,CAEhB;SACL,eACC,oBAACA,MAAU,aAAX;MACE,WAAW,GAAG,OAAO,aAAa,YAAY,YAAY;MAC1D,OAAO;OACL,kBAAkB;OAClB,GAAG,cAAc;OAClB;gBAEA;MACqB,CAAA,CAEzB,EAAA,CAAA,GAEH,eACE,qBAAC,OAAD;MAAK,WAAW,OAAO;gBAAvB,CACE,oBAACA,MAAU,aAAX;OACE,WAAW;OACX,OAAO,cAAc;iBAEpB;OACqB,CAAA,EACvB,mBACC,oBAACA,MAAU,OAAX;OACE,cAAW;OACX,WAAW,GAAG,OAAO,OAAO,YAAY,MAAM;OAC9C,OAAO,cAAc;iBAErB,oBAAC,GAAD,EAAG,MAAM,IAAM,CAAA;OACC,CAAA,CAEhB;SAGT,eAAe,CACZ;OACF;;GACY,CAAA;EACL,CAAA;EAEnB;AAEF,UAAU,cAAc"}
|
|
@@ -121,7 +121,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
|
121
121
|
border: none;
|
|
122
122
|
border-radius: ${cssVar.borderRadiusSM};
|
|
123
123
|
|
|
124
|
-
color: ${cssVar.
|
|
124
|
+
color: ${cssVar.colorTextSecondary};
|
|
125
125
|
|
|
126
126
|
background: transparent;
|
|
127
127
|
|
|
@@ -157,6 +157,9 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
|
157
157
|
font-size: 13px;
|
|
158
158
|
line-height: 1.5;
|
|
159
159
|
color: ${cssVar.colorTextSecondary};
|
|
160
|
+
`,
|
|
161
|
+
descriptionStandalone: css`
|
|
162
|
+
color: ${cssVar.colorText};
|
|
160
163
|
`,
|
|
161
164
|
icon: css`
|
|
162
165
|
display: flex;
|
|
@@ -297,7 +300,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
|
297
300
|
titleRow: css`
|
|
298
301
|
display: flex;
|
|
299
302
|
gap: 8px;
|
|
300
|
-
align-items:
|
|
303
|
+
align-items: flex-start;
|
|
301
304
|
`,
|
|
302
305
|
toastBody: css`
|
|
303
306
|
display: flex;
|
|
@@ -307,7 +310,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
|
307
310
|
toastBodyCenter: css`
|
|
308
311
|
display: flex;
|
|
309
312
|
gap: 12px;
|
|
310
|
-
align-items:
|
|
313
|
+
align-items: flex-start;
|
|
311
314
|
`,
|
|
312
315
|
viewport: css`
|
|
313
316
|
position: fixed;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.mjs","names":[],"sources":["../../../src/base-ui/Toast/style.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\nimport { cva } from 'class-variance-authority';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n action: css`\n cursor: pointer;\n\n display: inline-flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n\n height: 28px;\n padding-inline: 12px;\n border: none;\n border-radius: ${cssVar.borderRadiusSM};\n\n font-size: 12px;\n font-weight: 500;\n line-height: 1;\n\n transition:\n background 0.2s,\n color 0.2s;\n\n &:focus-visible {\n outline: 2px solid ${cssVar.colorPrimaryBorder};\n outline-offset: 1px;\n }\n `,\n\n actionDanger: css`\n color: ${cssVar.colorTextLightSolid};\n background: ${cssVar.colorError};\n\n &:hover {\n background: ${cssVar.colorErrorHover};\n }\n\n &:active {\n background: ${cssVar.colorErrorActive};\n }\n\n &:focus-visible {\n outline-color: ${cssVar.colorErrorBorder};\n }\n `,\n\n actionGhost: css`\n border: 1px solid ${cssVar.colorBorder};\n color: ${cssVar.colorText};\n background: transparent;\n\n &:hover {\n border-color: ${cssVar.colorPrimary};\n color: ${cssVar.colorPrimary};\n }\n\n &:active {\n border-color: ${cssVar.colorPrimaryActive};\n color: ${cssVar.colorPrimaryActive};\n }\n `,\n\n actionPrimary: css`\n color: ${cssVar.colorTextLightSolid};\n background: ${cssVar.colorPrimary};\n\n &:hover {\n background: ${cssVar.colorPrimaryHover};\n }\n\n &:active {\n background: ${cssVar.colorPrimaryActive};\n }\n `,\n\n actionSecondary: css`\n color: ${cssVar.colorText};\n background: ${cssVar.colorFillSecondary};\n\n &:hover {\n background: ${cssVar.colorFillTertiary};\n }\n\n &:active {\n background: ${cssVar.colorFill};\n }\n `,\n\n actionText: css`\n color: ${cssVar.colorPrimary};\n background: transparent;\n\n &:hover {\n background: ${cssVar.colorFillTertiary};\n }\n\n &:active {\n background: ${cssVar.colorFillSecondary};\n }\n `,\n\n actions: css`\n display: flex;\n flex-grow: 1;\n flex-shrink: 0;\n gap: 8px;\n align-items: center;\n align-self: flex-end;\n justify-content: flex-end;\n\n margin-block-start: 8px;\n `,\n\n close: css`\n cursor: pointer;\n\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n\n width: 20px;\n height: 20px;\n margin-inline-start: auto;\n padding: 0;\n border: none;\n border-radius: ${cssVar.borderRadiusSM};\n\n color: ${cssVar.colorTextTertiary};\n\n background: transparent;\n\n transition: all 0.2s;\n\n &:hover {\n color: ${cssVar.colorText};\n background: ${cssVar.colorFillSecondary};\n }\n `,\n\n content: css`\n overflow: hidden;\n transition: opacity 0.2s;\n\n &[data-behind] {\n pointer-events: none;\n opacity: 0;\n }\n\n &[data-expanded] {\n pointer-events: auto;\n opacity: 1;\n }\n `,\n\n contentArea: css`\n display: flex;\n flex: 1;\n flex-direction: column;\n min-width: 0;\n `,\n\n description: css`\n margin: 0;\n font-size: 13px;\n line-height: 1.5;\n color: ${cssVar.colorTextSecondary};\n `,\n\n icon: css`\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n `,\n\n root: css`\n --toast-gap: 12px;\n --toast-peek: 12px;\n --toast-scale: calc(1 - var(--toast-index) * 0.05);\n --toast-shrink: calc(1 - var(--toast-scale));\n --toast-collapsed-height: var(--toast-frontmost-height, var(--toast-height));\n\n cursor: default;\n user-select: none;\n\n position: absolute;\n z-index: calc(1000 - var(--toast-index));\n inset-inline: 0;\n\n box-sizing: border-box;\n width: 100%;\n height: var(--toast-collapsed-height);\n padding-block: 12px;\n padding-inline: 16px;\n border-radius: ${cssVar.borderRadiusLG};\n\n color: ${cssVar.colorText};\n\n background: ${cssVar.colorBgElevated};\n background-clip: padding-box;\n box-shadow:\n 0 0 0 1px color-mix(in srgb, ${cssVar.colorBgSolid} 3%, transparent),\n 0 1px 1px -0.5px color-mix(in srgb, ${cssVar.colorBgSolid} 3%, transparent),\n 0 3px 3px -1.5px color-mix(in srgb, ${cssVar.colorBgSolid} 3%, transparent),\n 0 6px 6px -3px color-mix(in srgb, ${cssVar.colorBgSolid} 3%, transparent),\n 0 12px 12px -6px color-mix(in srgb, ${cssVar.colorBgSolid} 3%, transparent),\n 0 24px 24px -12px color-mix(in srgb, ${cssVar.colorBgSolid} 3%, transparent);\n\n transition:\n transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),\n opacity 0.4s,\n height 0.15s;\n\n /* Fill gap between stacked toasts to prevent hover flicker */\n &::after {\n content: '';\n position: absolute;\n inset-inline: 0;\n height: calc(var(--toast-gap) + var(--toast-peek) + 8px);\n }\n\n &[data-limited] {\n opacity: 0;\n }\n\n &[data-swiping] {\n transition: none;\n }\n `,\n\n // Bottom positions - stack upward\n rootBottom: css`\n inset-block: auto 0;\n transform-origin: bottom center;\n transform: translateX(var(--toast-swipe-movement-x))\n translateY(\n calc(\n var(--toast-swipe-movement-y) - (var(--toast-index) * var(--toast-peek)) -\n (var(--toast-shrink) * var(--toast-collapsed-height))\n )\n )\n scale(var(--toast-scale));\n\n &::after {\n inset-block-start: 100%;\n }\n\n &[data-expanded] {\n transform: translateX(var(--toast-swipe-movement-x))\n translateY(\n calc(\n var(--toast-swipe-movement-y) + var(--toast-offset-y) * -1 + var(--toast-index) *\n var(--toast-gap) * -1\n )\n )\n scale(1);\n height: var(--toast-height);\n }\n\n &[data-starting-style],\n &[data-ending-style] {\n transform: translateY(150%);\n opacity: 0;\n }\n `,\n\n // Top positions - stack downward\n rootTop: css`\n inset-block: 0 auto;\n transform-origin: top center;\n transform: translateX(var(--toast-swipe-movement-x))\n translateY(\n calc(\n var(--toast-swipe-movement-y) + (var(--toast-index) * var(--toast-peek)) +\n (var(--toast-shrink) * var(--toast-collapsed-height))\n )\n )\n scale(var(--toast-scale));\n\n &::after {\n inset-block-end: 100%;\n }\n\n &[data-expanded] {\n transform: translateX(var(--toast-swipe-movement-x))\n translateY(\n calc(\n var(--toast-swipe-movement-y) + var(--toast-offset-y) + var(--toast-index) *\n var(--toast-gap)\n )\n )\n scale(1);\n height: var(--toast-height);\n }\n\n &[data-starting-style],\n &[data-ending-style] {\n transform: translateY(-150%);\n opacity: 0;\n }\n `,\n\n title: css`\n margin: 0;\n\n font-size: 14px;\n font-weight: 500;\n line-height: 1.5;\n color: ${cssVar.colorText};\n `,\n\n titleRow: css`\n display: flex;\n gap: 8px;\n align-items: center;\n `,\n\n toastBody: css`\n display: flex;\n gap: 12px;\n align-items: flex-start;\n `,\n\n toastBodyCenter: css`\n display: flex;\n gap: 12px;\n align-items: center;\n `,\n\n viewport: css`\n position: fixed;\n z-index: 100000;\n\n width: 360px;\n max-width: calc(100vw - 32px);\n\n outline: 0;\n\n @media (width <= 480px) {\n width: calc(100vw - 32px);\n }\n `,\n\n viewportBottom: css`\n inset-block-end: 16px;\n inset-inline-start: 50%;\n transform: translateX(-50%);\n `,\n\n viewportBottomLeft: css`\n inset-block-end: 16px;\n inset-inline-start: 16px;\n `,\n\n viewportBottomRight: css`\n inset-block-end: 16px;\n inset-inline-end: 16px;\n `,\n\n viewportTop: css`\n inset-block-start: 16px;\n inset-inline-start: 50%;\n transform: translateX(-50%);\n `,\n\n viewportTopLeft: css`\n inset-block-start: 16px;\n inset-inline-start: 16px;\n `,\n\n viewportTopRight: css`\n inset-block-start: 16px;\n inset-inline-end: 16px;\n `,\n}));\n\nexport const viewportVariants = cva(styles.viewport, {\n defaultVariants: {\n position: 'bottom-right',\n },\n variants: {\n position: {\n 'bottom': styles.viewportBottom,\n 'bottom-left': styles.viewportBottomLeft,\n 'bottom-right': styles.viewportBottomRight,\n 'top': styles.viewportTop,\n 'top-left': styles.viewportTopLeft,\n 'top-right': styles.viewportTopRight,\n },\n },\n});\n\nexport const rootVariants = cva(styles.root, {\n defaultVariants: {\n position: 'bottom-right',\n },\n variants: {\n position: {\n 'bottom': styles.rootBottom,\n 'bottom-left': styles.rootBottom,\n 'bottom-right': styles.rootBottom,\n 'top': styles.rootTop,\n 'top-left': styles.rootTop,\n 'top-right': styles.rootTop,\n },\n },\n});\n\nexport const actionVariants = cva(styles.action, {\n defaultVariants: {\n variant: 'primary',\n },\n variants: {\n variant: {\n danger: styles.actionDanger,\n ghost: styles.actionGhost,\n primary: styles.actionPrimary,\n secondary: styles.actionSecondary,\n text: styles.actionText,\n },\n },\n});\n"],"mappings":";;;AAGA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,QAAQ,GAAG;;;;;;;;;;;qBAWQ,OAAO,eAAe;;;;;;;;;;;2BAWhB,OAAO,mBAAmB;;;;CAKnD,cAAc,GAAG;aACN,OAAO,oBAAoB;kBACtB,OAAO,WAAW;;;oBAGhB,OAAO,gBAAgB;;;;oBAIvB,OAAO,iBAAiB;;;;uBAIrB,OAAO,iBAAiB;;;CAI7C,aAAa,GAAG;wBACM,OAAO,YAAY;aAC9B,OAAO,UAAU;;;;sBAIR,OAAO,aAAa;eAC3B,OAAO,aAAa;;;;sBAIb,OAAO,mBAAmB;eACjC,OAAO,mBAAmB;;;CAIvC,eAAe,GAAG;aACP,OAAO,oBAAoB;kBACtB,OAAO,aAAa;;;oBAGlB,OAAO,kBAAkB;;;;oBAIzB,OAAO,mBA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EACf,UAAU,gBACX;CACD,UAAU,EACR,UAAU;EACR,UAAU,OAAO;EACjB,eAAe,OAAO;EACtB,gBAAgB,OAAO;EACvB,OAAO,OAAO;EACd,YAAY,OAAO;EACnB,aAAa,OAAO;EACrB,EACF;CACF,CAAC;AAEF,MAAa,eAAe,IAAI,OAAO,MAAM;CAC3C,iBAAiB,EACf,UAAU,gBACX;CACD,UAAU,EACR,UAAU;EACR,UAAU,OAAO;EACjB,eAAe,OAAO;EACtB,gBAAgB,OAAO;EACvB,OAAO,OAAO;EACd,YAAY,OAAO;EACnB,aAAa,OAAO;EACrB,EACF;CACF,CAAC;AAEF,MAAa,iBAAiB,IAAI,OAAO,QAAQ;CAC/C,iBAAiB,EACf,SAAS,WACV;CACD,UAAU,EACR,SAAS;EACP,QAAQ,OAAO;EACf,OAAO,OAAO;EACd,SAAS,OAAO;EAChB,WAAW,OAAO;EAClB,MAAM,OAAO;EACd,EACF;CACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"style.mjs","names":[],"sources":["../../../src/base-ui/Toast/style.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\nimport { cva } from 'class-variance-authority';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n action: css`\n cursor: pointer;\n\n display: inline-flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n\n height: 28px;\n padding-inline: 12px;\n border: none;\n border-radius: ${cssVar.borderRadiusSM};\n\n font-size: 12px;\n font-weight: 500;\n line-height: 1;\n\n transition:\n background 0.2s,\n color 0.2s;\n\n &:focus-visible {\n outline: 2px solid ${cssVar.colorPrimaryBorder};\n outline-offset: 1px;\n }\n `,\n\n actionDanger: css`\n color: ${cssVar.colorTextLightSolid};\n background: ${cssVar.colorError};\n\n &:hover {\n background: ${cssVar.colorErrorHover};\n }\n\n &:active {\n background: ${cssVar.colorErrorActive};\n }\n\n &:focus-visible {\n outline-color: ${cssVar.colorErrorBorder};\n }\n `,\n\n actionGhost: css`\n border: 1px solid ${cssVar.colorBorder};\n color: ${cssVar.colorText};\n background: transparent;\n\n &:hover {\n border-color: ${cssVar.colorPrimary};\n color: ${cssVar.colorPrimary};\n }\n\n &:active {\n border-color: ${cssVar.colorPrimaryActive};\n color: ${cssVar.colorPrimaryActive};\n }\n `,\n\n actionPrimary: css`\n color: ${cssVar.colorTextLightSolid};\n background: ${cssVar.colorPrimary};\n\n &:hover {\n background: ${cssVar.colorPrimaryHover};\n }\n\n &:active {\n background: ${cssVar.colorPrimaryActive};\n }\n `,\n\n actionSecondary: css`\n color: ${cssVar.colorText};\n background: ${cssVar.colorFillSecondary};\n\n &:hover {\n background: ${cssVar.colorFillTertiary};\n }\n\n &:active {\n background: ${cssVar.colorFill};\n }\n `,\n\n actionText: css`\n color: ${cssVar.colorPrimary};\n background: transparent;\n\n &:hover {\n background: ${cssVar.colorFillTertiary};\n }\n\n &:active {\n background: ${cssVar.colorFillSecondary};\n }\n `,\n\n actions: css`\n display: flex;\n flex-grow: 1;\n flex-shrink: 0;\n gap: 8px;\n align-items: center;\n align-self: flex-end;\n justify-content: flex-end;\n\n margin-block-start: 8px;\n `,\n\n close: css`\n cursor: pointer;\n\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n\n width: 20px;\n height: 20px;\n margin-inline-start: auto;\n padding: 0;\n border: none;\n border-radius: ${cssVar.borderRadiusSM};\n\n color: ${cssVar.colorTextSecondary};\n\n background: transparent;\n\n transition: all 0.2s;\n\n &:hover {\n color: ${cssVar.colorText};\n background: ${cssVar.colorFillSecondary};\n }\n `,\n\n content: css`\n overflow: hidden;\n transition: opacity 0.2s;\n\n &[data-behind] {\n pointer-events: none;\n opacity: 0;\n }\n\n &[data-expanded] {\n pointer-events: auto;\n opacity: 1;\n }\n `,\n\n contentArea: css`\n display: flex;\n flex: 1;\n flex-direction: column;\n min-width: 0;\n `,\n\n description: css`\n margin: 0;\n font-size: 13px;\n line-height: 1.5;\n color: ${cssVar.colorTextSecondary};\n `,\n\n descriptionStandalone: css`\n color: ${cssVar.colorText};\n `,\n\n icon: css`\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n `,\n\n root: css`\n --toast-gap: 12px;\n --toast-peek: 12px;\n --toast-scale: calc(1 - var(--toast-index) * 0.05);\n --toast-shrink: calc(1 - var(--toast-scale));\n --toast-collapsed-height: var(--toast-frontmost-height, var(--toast-height));\n\n cursor: default;\n user-select: none;\n\n position: absolute;\n z-index: calc(1000 - var(--toast-index));\n inset-inline: 0;\n\n box-sizing: border-box;\n width: 100%;\n height: var(--toast-collapsed-height);\n padding-block: 12px;\n padding-inline: 16px;\n border-radius: ${cssVar.borderRadiusLG};\n\n color: ${cssVar.colorText};\n\n background: ${cssVar.colorBgElevated};\n background-clip: padding-box;\n box-shadow:\n 0 0 0 1px color-mix(in srgb, ${cssVar.colorBgSolid} 3%, transparent),\n 0 1px 1px -0.5px color-mix(in srgb, ${cssVar.colorBgSolid} 3%, transparent),\n 0 3px 3px -1.5px color-mix(in srgb, ${cssVar.colorBgSolid} 3%, transparent),\n 0 6px 6px -3px color-mix(in srgb, ${cssVar.colorBgSolid} 3%, transparent),\n 0 12px 12px -6px color-mix(in srgb, ${cssVar.colorBgSolid} 3%, transparent),\n 0 24px 24px -12px color-mix(in srgb, ${cssVar.colorBgSolid} 3%, transparent);\n\n transition:\n transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),\n opacity 0.4s,\n height 0.15s;\n\n /* Fill gap between stacked toasts to prevent hover flicker */\n &::after {\n content: '';\n position: absolute;\n inset-inline: 0;\n height: calc(var(--toast-gap) + var(--toast-peek) + 8px);\n }\n\n &[data-limited] {\n opacity: 0;\n }\n\n &[data-swiping] {\n transition: none;\n }\n `,\n\n // Bottom positions - stack upward\n rootBottom: css`\n inset-block: auto 0;\n transform-origin: bottom center;\n transform: translateX(var(--toast-swipe-movement-x))\n translateY(\n calc(\n var(--toast-swipe-movement-y) - (var(--toast-index) * var(--toast-peek)) -\n (var(--toast-shrink) * var(--toast-collapsed-height))\n )\n )\n scale(var(--toast-scale));\n\n &::after {\n inset-block-start: 100%;\n }\n\n &[data-expanded] {\n transform: translateX(var(--toast-swipe-movement-x))\n translateY(\n calc(\n var(--toast-swipe-movement-y) + var(--toast-offset-y) * -1 + var(--toast-index) *\n var(--toast-gap) * -1\n )\n )\n scale(1);\n height: var(--toast-height);\n }\n\n &[data-starting-style],\n &[data-ending-style] {\n transform: translateY(150%);\n opacity: 0;\n }\n `,\n\n // Top positions - stack downward\n rootTop: css`\n inset-block: 0 auto;\n transform-origin: top center;\n transform: translateX(var(--toast-swipe-movement-x))\n translateY(\n calc(\n var(--toast-swipe-movement-y) + (var(--toast-index) * var(--toast-peek)) +\n (var(--toast-shrink) * var(--toast-collapsed-height))\n )\n )\n scale(var(--toast-scale));\n\n &::after {\n inset-block-end: 100%;\n }\n\n &[data-expanded] {\n transform: translateX(var(--toast-swipe-movement-x))\n translateY(\n calc(\n var(--toast-swipe-movement-y) + var(--toast-offset-y) + var(--toast-index) *\n var(--toast-gap)\n )\n )\n scale(1);\n height: var(--toast-height);\n }\n\n &[data-starting-style],\n &[data-ending-style] {\n transform: translateY(-150%);\n opacity: 0;\n }\n `,\n\n title: css`\n margin: 0;\n\n font-size: 14px;\n font-weight: 500;\n line-height: 1.5;\n color: ${cssVar.colorText};\n `,\n\n titleRow: css`\n display: flex;\n gap: 8px;\n align-items: flex-start;\n `,\n\n toastBody: css`\n display: flex;\n gap: 12px;\n align-items: flex-start;\n `,\n\n toastBodyCenter: css`\n display: flex;\n gap: 12px;\n align-items: flex-start;\n `,\n\n viewport: css`\n position: fixed;\n z-index: 100000;\n\n width: 360px;\n max-width: calc(100vw - 32px);\n\n outline: 0;\n\n @media (width <= 480px) {\n width: calc(100vw - 32px);\n }\n `,\n\n viewportBottom: css`\n inset-block-end: 16px;\n inset-inline-start: 50%;\n transform: translateX(-50%);\n `,\n\n viewportBottomLeft: css`\n inset-block-end: 16px;\n inset-inline-start: 16px;\n `,\n\n viewportBottomRight: css`\n inset-block-end: 16px;\n inset-inline-end: 16px;\n `,\n\n viewportTop: css`\n inset-block-start: 16px;\n inset-inline-start: 50%;\n transform: translateX(-50%);\n `,\n\n viewportTopLeft: css`\n inset-block-start: 16px;\n inset-inline-start: 16px;\n `,\n\n viewportTopRight: css`\n inset-block-start: 16px;\n inset-inline-end: 16px;\n `,\n}));\n\nexport const viewportVariants = cva(styles.viewport, {\n defaultVariants: {\n position: 'bottom-right',\n },\n variants: {\n position: {\n 'bottom': styles.viewportBottom,\n 'bottom-left': styles.viewportBottomLeft,\n 'bottom-right': styles.viewportBottomRight,\n 'top': styles.viewportTop,\n 'top-left': styles.viewportTopLeft,\n 'top-right': styles.viewportTopRight,\n },\n },\n});\n\nexport const rootVariants = cva(styles.root, {\n defaultVariants: {\n position: 'bottom-right',\n },\n variants: {\n position: {\n 'bottom': styles.rootBottom,\n 'bottom-left': styles.rootBottom,\n 'bottom-right': styles.rootBottom,\n 'top': styles.rootTop,\n 'top-left': styles.rootTop,\n 'top-right': styles.rootTop,\n },\n },\n});\n\nexport const actionVariants = cva(styles.action, {\n defaultVariants: {\n variant: 'primary',\n },\n variants: {\n variant: {\n danger: styles.actionDanger,\n ghost: styles.actionGhost,\n primary: styles.actionPrimary,\n secondary: styles.actionSecondary,\n text: styles.actionText,\n },\n },\n});\n"],"mappings":";;;AAGA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,QAAQ,GAAG;;;;;;;;;;;qBAWQ,OAAO,eAAe;;;;;;;;;;;2BAWhB,OAAO,mBAAmB;;;;CAKnD,cAAc,GAAG;aACN,OAAO,oBAAoB;kBACtB,OAAO,WAAW;;;oBAGhB,OAAO,gBAAgB;;;;oBAIvB,OAAO,iBAAiB;;;;uBAIrB,OAAO,iBAAiB;;;CAI7C,aAAa,GAAG;wBACM,OAAO,YAAY;aAC9B,OAAO,UAAU;;;;sBAIR,OAAO,aAAa;eAC3B,OAAO,aAAa;;;;sBAIb,OAAO,mBAAmB;eACjC,OA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