@plumile/ui 0.1.68 → 0.1.70
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/lib/esm/admin/organisms/admin_sidebar/AdminSidebar.js +62 -0
- package/lib/esm/admin/organisms/admin_sidebar/AdminSidebar.js.map +1 -0
- package/lib/esm/admin/organisms/admin_sidebar/adminSidebar.css.js +17 -0
- package/lib/esm/admin/organisms/admin_sidebar/adminSidebar.css.js.map +1 -0
- package/lib/esm/{backoffice/organisms/backoffice_topbar/BackofficeTopbar.js → admin/organisms/admin_topbar/AdminTopbar.js} +4 -4
- package/lib/esm/admin/organisms/admin_topbar/AdminTopbar.js.map +1 -0
- package/lib/esm/admin/organisms/admin_topbar/adminTopbar.css.js +8 -0
- package/lib/esm/admin/organisms/admin_topbar/adminTopbar.css.js.map +1 -0
- package/lib/esm/admin/templates/admin_shell_layout/AdminShellLayout.js +19 -0
- package/lib/esm/admin/templates/admin_shell_layout/AdminShellLayout.js.map +1 -0
- package/lib/esm/admin/theme/AdminThemeProvider.js +11 -0
- package/lib/esm/admin/theme/AdminThemeProvider.js.map +1 -0
- package/lib/esm/admin/theme/adminTheme.css.js +7 -0
- package/lib/esm/admin/theme/adminTheme.css.js.map +1 -0
- package/lib/esm/atomic/atoms/badge/Badge.js +3 -3
- package/lib/esm/atomic/atoms/button/Button.js +1 -1
- package/lib/esm/atomic/atoms/checkbox/Checkbox.js +1 -1
- package/lib/esm/atomic/atoms/error_message/ErrorMessage.js +1 -1
- package/lib/esm/atomic/atoms/formatted-date/FormattedDate.js +4 -4
- package/lib/esm/atomic/atoms/label/Label.js +1 -1
- package/lib/esm/atomic/atoms/modal/Modal.js +13 -13
- package/lib/esm/atomic/molecules/breadcrumb_navigation/BreadcrumbMenuDropdown.js +12 -12
- package/lib/esm/atomic/molecules/breadcrumb_navigation/BreadcrumbMenuPopover.js +20 -20
- package/lib/esm/atomic/molecules/breadcrumb_navigation/BreadcrumbNavigation.js +14 -14
- package/lib/esm/atomic/molecules/card/Card.js +6 -6
- package/lib/esm/atomic/molecules/checkbox_field/CheckboxField.js +1 -1
- package/lib/esm/atomic/molecules/dropdown/Dropdown.js +80 -80
- package/lib/esm/atomic/molecules/dropdown/Dropdown.js.map +1 -1
- package/lib/esm/atomic/molecules/form/Form.js +1 -1
- package/lib/esm/atomic/molecules/form_error/FormError.js +1 -1
- package/lib/esm/atomic/molecules/highlight/HighlightCode.js +25 -25
- package/lib/esm/atomic/molecules/markdown/LazyMarkdownRenderer.js +7 -7
- package/lib/esm/atomic/molecules/markdown/MarkdownRenderer.js +33 -33
- package/lib/esm/atomic/molecules/markdown/MarkdownRenderer.js.map +1 -1
- package/lib/esm/atomic/molecules/markdown/components/LazyMarkdownCodeBlock.js +9 -9
- package/lib/esm/atomic/molecules/markdown/components/MarkdownArticleContainer.css.js +0 -1
- package/lib/esm/atomic/molecules/markdown/components/MarkdownCodeBlock.js +7 -7
- package/lib/esm/atomic/molecules/markdown/components/MarkdownCodeCopyButton.js +9 -9
- package/lib/esm/atomic/molecules/markdown/components/MarkdownFootnotesSection.js +7 -7
- package/lib/esm/atomic/molecules/markdown/components/MarkdownMermaidBlock.js +34 -34
- package/lib/esm/atomic/molecules/markdown/components/MarkdownParagraph.css.js +1 -0
- package/lib/esm/atomic/molecules/markdown/components/MarkdownShikiCodeBlock.js +4 -4
- package/lib/esm/atomic/molecules/profile_dropdown/ProfileDropdown.js +25 -25
- package/lib/esm/atomic/molecules/toast/ToastProvider.js +15 -15
- package/lib/esm/atomic/molecules/toast/ToastViewport.js +15 -15
- package/lib/esm/atomic/organisms/login_form/LoginForm.js +1 -1
- package/lib/esm/atomic/organisms/sidebar/NavigationSidebar.js +34 -34
- package/lib/esm/atomic/organisms/sidebar/icons.js +13 -13
- package/lib/esm/atomic/templates/auth_layout/AuthLayout.js +1 -1
- package/lib/esm/atomic/templates/detail-page/DetailPage.js +49 -0
- package/lib/esm/atomic/templates/detail-page/DetailPage.js.map +1 -0
- package/lib/esm/atomic/templates/detail-page/detailPage.css.js +8 -0
- package/lib/esm/atomic/templates/detail-page/detailPage.css.js.map +1 -0
- package/lib/esm/atomic/templates/page-container/PageContainer.js +36 -0
- package/lib/esm/atomic/templates/page-container/PageContainer.js.map +1 -0
- package/lib/esm/atomic/templates/page-container/pageContainer.css.js +8 -0
- package/lib/esm/atomic/templates/page-container/pageContainer.css.js.map +1 -0
- package/lib/esm/backoffice/atoms/copyable_text/CopyableText.js +10 -10
- package/lib/esm/backoffice/atoms/shortcut_hint/ShortcutHint.js +6 -6
- package/lib/esm/backoffice/atoms/tag/Tag.js +7 -7
- package/lib/esm/backoffice/molecules/backoffice_filter_drawer/BackofficeFilterDrawer.js +22 -22
- package/lib/esm/backoffice/molecules/backoffice_json_viewer/BackofficeJsonViewer.js +12 -12
- package/lib/esm/backoffice/molecules/backoffice_json_viewer/LazyBackofficeJsonViewer.js +11 -11
- package/lib/esm/backoffice/molecules/backoffice_page_header/BackofficePageHeader.js +27 -21
- package/lib/esm/backoffice/molecules/backoffice_page_header/BackofficePageHeader.js.map +1 -1
- package/lib/esm/backoffice/molecules/backoffice_page_header/backofficePageHeader.css.js +2 -2
- package/lib/esm/backoffice/molecules/backoffice_page_header/backofficePageHeader.css.js.map +1 -1
- package/lib/esm/backoffice/molecules/backoffice_relations_menu/BackofficeRelationsMenu.js +12 -12
- package/lib/esm/backoffice/molecules/confirm_dialog/ConfirmDialog.js +9 -9
- package/lib/esm/backoffice/molecules/global_search_input/GlobalSearchInput.js +5 -5
- package/lib/esm/backoffice/molecules/sidebar_collapse_toggle/SidebarCollapseToggle.js +7 -7
- package/lib/esm/backoffice/molecules/sidebar_nav_item/SidebarNavItem.js +26 -26
- package/lib/esm/backoffice/molecules/sidebar_nav_item/SidebarNavItem.js.map +1 -1
- package/lib/esm/backoffice/molecules/sidebar_nav_section/SidebarNavSection.js +11 -11
- package/lib/esm/backoffice/organisms/backoffice_data_table/BackofficeDataTable.js +20 -20
- package/lib/esm/components/data-table/TableCell.js +17 -17
- package/lib/esm/components/data-table/VirtualizedConnectionTable.js +27 -27
- package/lib/esm/components/layout/AppShell.js +14 -0
- package/lib/esm/components/layout/AppShell.js.map +1 -0
- package/lib/esm/components/layout/PageShell.js +65 -65
- package/lib/esm/components/layout/PageShell.js.map +1 -1
- package/lib/esm/components/layout/SettingsLayout.css.js +8 -0
- package/lib/esm/components/layout/SettingsLayout.css.js.map +1 -0
- package/lib/esm/{backoffice/templates/settings_template/SettingsTemplate.js → components/layout/SettingsLayout.js} +5 -5
- package/lib/esm/components/layout/SettingsLayout.js.map +1 -0
- package/lib/esm/components/layout/SplitViewLayout.css.js +8 -0
- package/lib/esm/components/layout/SplitViewLayout.css.js.map +1 -0
- package/lib/esm/{backoffice/templates/split_view_template/SplitViewTemplate.js → components/layout/SplitViewLayout.js} +5 -5
- package/lib/esm/components/layout/SplitViewLayout.js.map +1 -0
- package/lib/esm/components/select/SimpleSelect.js +23 -23
- package/lib/esm/index.js +109 -106
- package/lib/esm/node_modules/react-shiki/dist/chunk-QPJZGYHO.js +23 -23
- package/lib/esm/node_modules/react-shiki/dist/chunk-QPJZGYHO.js.map +1 -1
- package/lib/esm/style.css +1 -1
- package/lib/esm/theme/ThemeProvider.js +11 -11
- package/lib/esm/theme/VisuallyHidden.js +3 -3
- package/lib/esm/theme/index.js +9 -9
- package/lib/types/{backoffice/organisms/backoffice_sidebar/BackofficeSidebar.d.ts → admin/organisms/admin_sidebar/AdminSidebar.d.ts} +7 -7
- package/lib/types/admin/organisms/admin_sidebar/AdminSidebar.d.ts.map +1 -0
- package/lib/types/{backoffice/organisms/backoffice_sidebar/backofficeSidebar.css.d.ts → admin/organisms/admin_sidebar/adminSidebar.css.d.ts} +1 -1
- package/lib/types/admin/organisms/admin_sidebar/adminSidebar.css.d.ts.map +1 -0
- package/lib/types/admin/organisms/admin_topbar/AdminTopbar.d.ts +10 -0
- package/lib/types/admin/organisms/admin_topbar/AdminTopbar.d.ts.map +1 -0
- package/lib/types/{backoffice/organisms/backoffice_topbar/backofficeTopbar.css.d.ts → admin/organisms/admin_topbar/adminTopbar.css.d.ts} +1 -1
- package/lib/types/admin/organisms/admin_topbar/adminTopbar.css.d.ts.map +1 -0
- package/lib/types/admin/templates/admin_shell_layout/AdminShellLayout.d.ts +14 -0
- package/lib/types/admin/templates/admin_shell_layout/AdminShellLayout.d.ts.map +1 -0
- package/lib/types/admin/theme/AdminThemeProvider.d.ts +7 -0
- package/lib/types/admin/theme/AdminThemeProvider.d.ts.map +1 -0
- package/lib/types/admin/theme/adminTheme.css.d.ts +2 -0
- package/lib/types/admin/theme/adminTheme.css.d.ts.map +1 -0
- package/lib/types/atomic/templates/detail-page/DetailPage.d.ts +19 -0
- package/lib/types/atomic/templates/detail-page/DetailPage.d.ts.map +1 -0
- package/lib/types/atomic/templates/detail-page/detailPage.css.d.ts +9 -0
- package/lib/types/atomic/templates/detail-page/detailPage.css.d.ts.map +1 -0
- package/lib/types/atomic/templates/page-container/PageContainer.d.ts +14 -0
- package/lib/types/atomic/templates/page-container/PageContainer.d.ts.map +1 -0
- package/lib/types/atomic/templates/page-container/pageContainer.css.d.ts +7 -0
- package/lib/types/atomic/templates/page-container/pageContainer.css.d.ts.map +1 -0
- package/lib/types/backoffice/molecules/backoffice_page_header/BackofficePageHeader.d.ts +2 -1
- package/lib/types/backoffice/molecules/backoffice_page_header/BackofficePageHeader.d.ts.map +1 -1
- package/lib/types/backoffice/molecules/backoffice_page_header/backofficePageHeader.css.d.ts +2 -0
- package/lib/types/backoffice/molecules/backoffice_page_header/backofficePageHeader.css.d.ts.map +1 -1
- package/lib/types/components/layout/AppShell.d.ts +12 -0
- package/lib/types/components/layout/AppShell.d.ts.map +1 -0
- package/lib/types/{backoffice/templates/settings_template/settingsTemplate.css.d.ts → components/layout/SettingsLayout.css.d.ts} +1 -1
- package/lib/types/components/layout/SettingsLayout.css.d.ts.map +1 -0
- package/lib/types/components/layout/SettingsLayout.d.ts +11 -0
- package/lib/types/components/layout/SettingsLayout.d.ts.map +1 -0
- package/lib/types/{backoffice/templates/split_view_template/splitViewTemplate.css.d.ts → components/layout/SplitViewLayout.css.d.ts} +1 -1
- package/lib/types/components/layout/SplitViewLayout.css.d.ts.map +1 -0
- package/lib/types/components/layout/SplitViewLayout.d.ts +11 -0
- package/lib/types/components/layout/SplitViewLayout.d.ts.map +1 -0
- package/lib/types/index.d.ts +11 -8
- package/lib/types/index.d.ts.map +1 -1
- package/package.json +10 -10
- package/lib/esm/backoffice/organisms/backoffice_app_shell/BackofficeAppShell.js +0 -14
- package/lib/esm/backoffice/organisms/backoffice_app_shell/BackofficeAppShell.js.map +0 -1
- package/lib/esm/backoffice/organisms/backoffice_sidebar/BackofficeSidebar.js +0 -62
- package/lib/esm/backoffice/organisms/backoffice_sidebar/BackofficeSidebar.js.map +0 -1
- package/lib/esm/backoffice/organisms/backoffice_sidebar/backofficeSidebar.css.js +0 -17
- package/lib/esm/backoffice/organisms/backoffice_sidebar/backofficeSidebar.css.js.map +0 -1
- package/lib/esm/backoffice/organisms/backoffice_topbar/BackofficeTopbar.js.map +0 -1
- package/lib/esm/backoffice/organisms/backoffice_topbar/backofficeTopbar.css.js +0 -8
- package/lib/esm/backoffice/organisms/backoffice_topbar/backofficeTopbar.css.js.map +0 -1
- package/lib/esm/backoffice/templates/backoffice_shell_template/BackofficeShellTemplate.js +0 -19
- package/lib/esm/backoffice/templates/backoffice_shell_template/BackofficeShellTemplate.js.map +0 -1
- package/lib/esm/backoffice/templates/settings_template/SettingsTemplate.js.map +0 -1
- package/lib/esm/backoffice/templates/settings_template/settingsTemplate.css.js +0 -8
- package/lib/esm/backoffice/templates/settings_template/settingsTemplate.css.js.map +0 -1
- package/lib/esm/backoffice/templates/split_view_template/SplitViewTemplate.js.map +0 -1
- package/lib/esm/backoffice/templates/split_view_template/splitViewTemplate.css.js +0 -8
- package/lib/esm/backoffice/templates/split_view_template/splitViewTemplate.css.js.map +0 -1
- package/lib/esm/backoffice/theme/BackofficeThemeProvider.js +0 -11
- package/lib/esm/backoffice/theme/BackofficeThemeProvider.js.map +0 -1
- package/lib/esm/backoffice/theme/backofficeTheme.css.js +0 -7
- package/lib/esm/backoffice/theme/backofficeTheme.css.js.map +0 -1
- package/lib/types/backoffice/organisms/backoffice_app_shell/BackofficeAppShell.d.ts +0 -12
- package/lib/types/backoffice/organisms/backoffice_app_shell/BackofficeAppShell.d.ts.map +0 -1
- package/lib/types/backoffice/organisms/backoffice_sidebar/BackofficeSidebar.d.ts.map +0 -1
- package/lib/types/backoffice/organisms/backoffice_sidebar/backofficeSidebar.css.d.ts.map +0 -1
- package/lib/types/backoffice/organisms/backoffice_topbar/BackofficeTopbar.d.ts +0 -10
- package/lib/types/backoffice/organisms/backoffice_topbar/BackofficeTopbar.d.ts.map +0 -1
- package/lib/types/backoffice/organisms/backoffice_topbar/backofficeTopbar.css.d.ts.map +0 -1
- package/lib/types/backoffice/templates/backoffice_shell_template/BackofficeShellTemplate.d.ts +0 -14
- package/lib/types/backoffice/templates/backoffice_shell_template/BackofficeShellTemplate.d.ts.map +0 -1
- package/lib/types/backoffice/templates/settings_template/SettingsTemplate.d.ts +0 -11
- package/lib/types/backoffice/templates/settings_template/SettingsTemplate.d.ts.map +0 -1
- package/lib/types/backoffice/templates/settings_template/settingsTemplate.css.d.ts.map +0 -1
- package/lib/types/backoffice/templates/split_view_template/SplitViewTemplate.d.ts +0 -11
- package/lib/types/backoffice/templates/split_view_template/SplitViewTemplate.d.ts.map +0 -1
- package/lib/types/backoffice/templates/split_view_template/splitViewTemplate.css.d.ts.map +0 -1
- package/lib/types/backoffice/theme/BackofficeThemeProvider.d.ts +0 -7
- package/lib/types/backoffice/theme/BackofficeThemeProvider.d.ts.map +0 -1
- package/lib/types/backoffice/theme/backofficeTheme.css.d.ts +0 -2
- package/lib/types/backoffice/theme/backofficeTheme.css.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidebarNavItem.js","names":[],"sources":["../../../../../src/backoffice/molecules/sidebar_nav_item/SidebarNavItem.tsx"],"sourcesContent":["import { Link } from '@plumile/router';\nimport {\n type AnchorHTMLAttributes,\n type ComponentPropsWithoutRef,\n type DragEvent,\n type FocusEvent,\n type JSX,\n type ReactNode,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nimport * as styles from './sidebarNavItem.css.js';\nimport { cx } from '@plumile/ui';\n\ntype RouterLinkProps = ComponentPropsWithoutRef<typeof Link> &\n AnchorHTMLAttributes<HTMLAnchorElement>;\nconst RouterLink = Link as unknown as (props: RouterLinkProps) => JSX.Element;\n\nexport type SidebarNavItemProps = {\n label: ReactNode;\n href?: string;\n icon?: ReactNode;\n badge?: ReactNode;\n isActive?: boolean;\n disabled?: boolean;\n onClick?: () => void;\n onDragStart?: (event: DragEvent) => void;\n onDragOver?: (event: DragEvent) => void;\n onDrop?: (event: DragEvent) => void;\n onDragEnd?: (event: DragEvent) => void;\n collapsed?: boolean;\n ariaLabel?: string;\n className?: string;\n actionSlot?: ReactNode;\n dragHandleSlot?: ReactNode;\n dragHandleLabel?: string;\n draggable?: boolean;\n};\n\nexport const SidebarNavItem = ({\n label,\n href,\n icon,\n badge,\n isActive = false,\n disabled = false,\n onClick,\n onDragStart,\n onDragOver,\n onDrop,\n onDragEnd,\n collapsed = false,\n ariaLabel,\n className,\n actionSlot,\n dragHandleSlot,\n dragHandleLabel,\n draggable = false,\n}: SidebarNavItemProps): JSX.Element => {\n const itemRef = useRef<HTMLDivElement | null>(null);\n const hoverTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const [isHoverIntent, setIsHoverIntent] = useState(false);\n const [isFocusWithin, setIsFocusWithin] = useState(false);\n\n const itemClassNames: (string | null | undefined)[] = [styles.item];\n if (collapsed) {\n itemClassNames.push(styles.itemCollapsed);\n }\n if (isActive) {\n itemClassNames.push(styles.itemActive);\n }\n if (disabled) {\n itemClassNames.push(styles.itemDisabled);\n }\n if (className != null) {\n itemClassNames.push(className);\n }\n const itemClassName = cx(...itemClassNames);\n\n let resolvedAriaLabel: string | undefined = ariaLabel;\n if (resolvedAriaLabel == null && typeof label === 'string') {\n resolvedAriaLabel = label;\n }\n\n let collapsedAriaLabel: string | undefined;\n let collapsedTitle: string | undefined;\n if (collapsed) {\n collapsedAriaLabel = resolvedAriaLabel;\n collapsedTitle = resolvedAriaLabel;\n }\n\n let ariaCurrent: 'page' | undefined;\n if (isActive) {\n ariaCurrent = 'page';\n }\n\n let iconNode: JSX.Element | null = null;\n if (icon != null) {\n iconNode = <span className={styles.icon}>{icon}</span>;\n }\n\n let labelExtraClass: string | null = null;\n if (collapsed) {\n labelExtraClass = styles.labelCollapsed;\n }\n const labelClassName = cx(styles.label, labelExtraClass);\n\n let badgeNode: JSX.Element | null = null;\n if (badge != null) {\n let badgeExtraClass: string | null = null;\n if (collapsed) {\n badgeExtraClass = styles.badgeCollapsed;\n }\n badgeNode = (\n <span className={cx(styles.badge, badgeExtraClass)}>{badge}</span>\n );\n }\n\n const content = (\n <>\n {iconNode}\n <span className={labelClassName}>{label}</span>\n {badgeNode}\n </>\n );\n\n const handleClick = (): void => {\n if (onClick != null) {\n onClick();\n }\n };\n\n const shouldRenderActions =\n !collapsed && !disabled && (actionSlot != null || dragHandleSlot != null);\n\n const clearHoverTimeout = useCallback((): void => {\n if (hoverTimeoutRef.current != null) {\n clearTimeout(hoverTimeoutRef.current);\n hoverTimeoutRef.current = null;\n }\n }, []);\n\n useEffect(() => {\n if (!shouldRenderActions) {\n setIsHoverIntent(false);\n setIsFocusWithin(false);\n clearHoverTimeout();\n }\n\n return () => {\n clearHoverTimeout();\n };\n }, [clearHoverTimeout, shouldRenderActions]);\n\n const handleMouseEnter = (): void => {\n if (!shouldRenderActions) {\n return;\n }\n clearHoverTimeout();\n hoverTimeoutRef.current = setTimeout(() => {\n setIsHoverIntent(true);\n }, 150);\n };\n\n const handleMouseLeave = (): void => {\n clearHoverTimeout();\n setIsHoverIntent(false);\n };\n\n const handleFocusCapture = (): void => {\n if (!shouldRenderActions) {\n return;\n }\n setIsFocusWithin(true);\n };\n\n const handleBlurCapture = (event: FocusEvent<HTMLDivElement>): void => {\n if (!shouldRenderActions) {\n setIsFocusWithin(false);\n return;\n }\n const nextTarget = event.relatedTarget as Node | null;\n if (nextTarget != null && itemRef.current?.contains(nextTarget)) {\n return;\n }\n setIsFocusWithin(false);\n };\n\n let mainNode: JSX.Element;\n if (disabled) {\n mainNode = (\n <span\n className={styles.link}\n aria-disabled=\"true\"\n aria-label={collapsedAriaLabel}\n title={collapsedTitle}\n >\n {content}\n </span>\n );\n } else if (href != null) {\n mainNode = (\n <RouterLink\n to={href}\n className={styles.link}\n aria-current={ariaCurrent}\n aria-label={collapsedAriaLabel}\n title={collapsedTitle}\n onClick={handleClick}\n >\n {content}\n </RouterLink>\n );\n } else {\n mainNode = (\n <button\n type=\"button\"\n className={styles.link}\n onClick={handleClick}\n aria-current={ariaCurrent}\n aria-label={collapsedAriaLabel}\n title={collapsedTitle}\n >\n {content}\n </button>\n );\n }\n\n const isActionsVisible =\n shouldRenderActions && (isHoverIntent || isFocusWithin);\n let actionsVisibilityClass: string | undefined;\n if (isActionsVisible) {\n actionsVisibilityClass = styles.actionsVisible;\n }\n const actionsClassName = cx(styles.actions, actionsVisibilityClass);\n\n let dragHandleNode: JSX.Element | null = null;\n if (dragHandleSlot != null && !collapsed) {\n dragHandleNode = (\n <button\n type=\"button\"\n className={styles.dragHandle}\n draggable={draggable}\n onDragStart={onDragStart}\n onDragEnd={onDragEnd}\n aria-label={dragHandleLabel}\n title={dragHandleLabel}\n >\n {dragHandleSlot}\n </button>\n );\n }\n\n let actionNode: JSX.Element | null = null;\n if (actionSlot != null && !collapsed) {\n actionNode = <span className={styles.actionSlot}>{actionSlot}</span>;\n }\n\n let actionsNode: JSX.Element | null = null;\n if (shouldRenderActions) {\n actionsNode = (\n <span className={actionsClassName}>\n {dragHandleNode}\n {actionNode}\n </span>\n );\n }\n\n return (\n <div\n className={itemClassName}\n onDragOver={onDragOver}\n onDrop={onDrop}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onFocusCapture={handleFocusCapture}\n onBlurCapture={handleBlurCapture}\n ref={itemRef}\n >\n {mainNode}\n {actionsNode}\n </div>\n );\n};\n\nexport default SidebarNavItem;\n"],"mappings":";;;;;;;AAmBA,IAAM,IAAa,GAuBN,KAAkB,EAC7B,OAAA,GACA,SACA,MAAA,GACA,OAAA,GACA,cAAW,IACX,cAAW,IACX,aACA,iBACA,gBACA,YACA,eACA,eAAY,IACZ,eACA,cACA,YAAA,GACA,mBACA,oBACA,eAAY,SAC0B;CACtC,IAAM,IAAU,EAA8B,KAAK,EAC7C,IAAkB,EAA6C,KAAK,EACpE,CAAC,GAAe,KAAoB,EAAS,GAAM,EACnD,CAAC,GAAe,KAAoB,EAAS,GAAM,EAEnD,IAAgD,CAAC,EAAY;AAUnE,CATI,KACF,EAAe,KAAK,EAAqB,EAEvC,KACF,EAAe,KAAK,EAAkB,EAEpC,KACF,EAAe,KAAK,EAAoB,EAEtC,KAAa,QACf,EAAe,KAAK,EAAU;CAEhC,IAAM,IAAgB,EAAG,GAAG,EAAe,EAEvC,IAAwC;AAC5C,CAAI,KAAqB,QAAQ,OAAO,KAAU,aAChD,IAAoB;CAGtB,IAAI,GACA;AACJ,CAAI,MACF,IAAqB,GACrB,IAAiB;CAGnB,IAAI;AACJ,CAAI,MACF,IAAc;CAGhB,IAAI,IAA+B;AACnC,CAAI,KAAQ,SACV,IAAW,kBAAC,QAAD;EAAM,WAAW;YAAc;EAAY,CAAA;CAGxD,IAAI,IAAiC;AACrC,CAAI,MACF,IAAkB;CAEpB,IAAM,KAAiB,EAAG,GAAc,EAAgB,EAEpD,IAAgC;AACpC,KAAI,KAAS,MAAM;EACjB,IAAI,IAAiC;AAIrC,EAHI,MACF,IAAkB,IAEpB,IACE,kBAAC,QAAD;GAAM,WAAW,EAAG,
|
|
1
|
+
{"version":3,"file":"SidebarNavItem.js","names":[],"sources":["../../../../../src/backoffice/molecules/sidebar_nav_item/SidebarNavItem.tsx"],"sourcesContent":["import { Link } from '@plumile/router';\nimport {\n type AnchorHTMLAttributes,\n type ComponentPropsWithoutRef,\n type DragEvent,\n type FocusEvent,\n type JSX,\n type ReactNode,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nimport * as styles from './sidebarNavItem.css.js';\nimport { cx } from '@plumile/ui';\n\ntype RouterLinkProps = ComponentPropsWithoutRef<typeof Link> &\n AnchorHTMLAttributes<HTMLAnchorElement>;\nconst RouterLink = Link as unknown as (props: RouterLinkProps) => JSX.Element;\n\nexport type SidebarNavItemProps = {\n label: ReactNode;\n href?: string;\n icon?: ReactNode;\n badge?: ReactNode;\n isActive?: boolean;\n disabled?: boolean;\n onClick?: () => void;\n onDragStart?: (event: DragEvent) => void;\n onDragOver?: (event: DragEvent) => void;\n onDrop?: (event: DragEvent) => void;\n onDragEnd?: (event: DragEvent) => void;\n collapsed?: boolean;\n ariaLabel?: string;\n className?: string;\n actionSlot?: ReactNode;\n dragHandleSlot?: ReactNode;\n dragHandleLabel?: string;\n draggable?: boolean;\n};\n\nexport const SidebarNavItem = ({\n label,\n href,\n icon,\n badge,\n isActive = false,\n disabled = false,\n onClick,\n onDragStart,\n onDragOver,\n onDrop,\n onDragEnd,\n collapsed = false,\n ariaLabel,\n className,\n actionSlot,\n dragHandleSlot,\n dragHandleLabel,\n draggable = false,\n}: SidebarNavItemProps): JSX.Element => {\n const itemRef = useRef<HTMLDivElement | null>(null);\n const hoverTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const [isHoverIntent, setIsHoverIntent] = useState(false);\n const [isFocusWithin, setIsFocusWithin] = useState(false);\n\n const itemClassNames: (string | null | undefined)[] = [styles.item];\n if (collapsed) {\n itemClassNames.push(styles.itemCollapsed);\n }\n if (isActive) {\n itemClassNames.push(styles.itemActive);\n }\n if (disabled) {\n itemClassNames.push(styles.itemDisabled);\n }\n if (className != null) {\n itemClassNames.push(className);\n }\n const itemClassName = cx(...itemClassNames);\n\n let resolvedAriaLabel: string | undefined = ariaLabel;\n if (resolvedAriaLabel == null && typeof label === 'string') {\n resolvedAriaLabel = label;\n }\n\n let collapsedAriaLabel: string | undefined;\n let collapsedTitle: string | undefined;\n if (collapsed) {\n collapsedAriaLabel = resolvedAriaLabel;\n collapsedTitle = resolvedAriaLabel;\n }\n\n let ariaCurrent: 'page' | undefined;\n if (isActive) {\n ariaCurrent = 'page';\n }\n\n let iconNode: JSX.Element | null = null;\n if (icon != null) {\n iconNode = <span className={styles.icon}>{icon}</span>;\n }\n\n let labelExtraClass: string | null = null;\n if (collapsed) {\n labelExtraClass = styles.labelCollapsed;\n }\n const labelClassName = cx(styles.label, labelExtraClass);\n\n let badgeNode: JSX.Element | null = null;\n if (badge != null) {\n let badgeExtraClass: string | null = null;\n if (collapsed) {\n badgeExtraClass = styles.badgeCollapsed;\n }\n badgeNode = (\n <span className={cx(styles.badge, badgeExtraClass)}>{badge}</span>\n );\n }\n\n const content = (\n <>\n {iconNode}\n <span className={labelClassName}>{label}</span>\n {badgeNode}\n </>\n );\n\n const handleClick = (): void => {\n if (onClick != null) {\n onClick();\n }\n };\n\n const shouldRenderActions =\n !collapsed && !disabled && (actionSlot != null || dragHandleSlot != null);\n\n const clearHoverTimeout = useCallback((): void => {\n if (hoverTimeoutRef.current != null) {\n clearTimeout(hoverTimeoutRef.current);\n hoverTimeoutRef.current = null;\n }\n }, []);\n\n useEffect(() => {\n if (!shouldRenderActions) {\n setIsHoverIntent(false);\n setIsFocusWithin(false);\n clearHoverTimeout();\n }\n\n return () => {\n clearHoverTimeout();\n };\n }, [clearHoverTimeout, shouldRenderActions]);\n\n const handleMouseEnter = (): void => {\n if (!shouldRenderActions) {\n return;\n }\n clearHoverTimeout();\n hoverTimeoutRef.current = setTimeout(() => {\n setIsHoverIntent(true);\n }, 150);\n };\n\n const handleMouseLeave = (): void => {\n clearHoverTimeout();\n setIsHoverIntent(false);\n };\n\n const handleFocusCapture = (): void => {\n if (!shouldRenderActions) {\n return;\n }\n setIsFocusWithin(true);\n };\n\n const handleBlurCapture = (event: FocusEvent<HTMLDivElement>): void => {\n if (!shouldRenderActions) {\n setIsFocusWithin(false);\n return;\n }\n const nextTarget = event.relatedTarget as Node | null;\n if (nextTarget != null && itemRef.current?.contains(nextTarget)) {\n return;\n }\n setIsFocusWithin(false);\n };\n\n let mainNode: JSX.Element;\n if (disabled) {\n mainNode = (\n <span\n className={styles.link}\n aria-disabled=\"true\"\n aria-label={collapsedAriaLabel}\n title={collapsedTitle}\n >\n {content}\n </span>\n );\n } else if (href != null) {\n mainNode = (\n <RouterLink\n to={href}\n className={styles.link}\n aria-current={ariaCurrent}\n aria-label={collapsedAriaLabel}\n title={collapsedTitle}\n onClick={handleClick}\n >\n {content}\n </RouterLink>\n );\n } else {\n mainNode = (\n <button\n type=\"button\"\n className={styles.link}\n onClick={handleClick}\n aria-current={ariaCurrent}\n aria-label={collapsedAriaLabel}\n title={collapsedTitle}\n >\n {content}\n </button>\n );\n }\n\n const isActionsVisible =\n shouldRenderActions && (isHoverIntent || isFocusWithin);\n let actionsVisibilityClass: string | undefined;\n if (isActionsVisible) {\n actionsVisibilityClass = styles.actionsVisible;\n }\n const actionsClassName = cx(styles.actions, actionsVisibilityClass);\n\n let dragHandleNode: JSX.Element | null = null;\n if (dragHandleSlot != null && !collapsed) {\n dragHandleNode = (\n <button\n type=\"button\"\n className={styles.dragHandle}\n draggable={draggable}\n onDragStart={onDragStart}\n onDragEnd={onDragEnd}\n aria-label={dragHandleLabel}\n title={dragHandleLabel}\n >\n {dragHandleSlot}\n </button>\n );\n }\n\n let actionNode: JSX.Element | null = null;\n if (actionSlot != null && !collapsed) {\n actionNode = <span className={styles.actionSlot}>{actionSlot}</span>;\n }\n\n let actionsNode: JSX.Element | null = null;\n if (shouldRenderActions) {\n actionsNode = (\n <span className={actionsClassName}>\n {dragHandleNode}\n {actionNode}\n </span>\n );\n }\n\n return (\n <div\n className={itemClassName}\n onDragOver={onDragOver}\n onDrop={onDrop}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onFocusCapture={handleFocusCapture}\n onBlurCapture={handleBlurCapture}\n ref={itemRef}\n >\n {mainNode}\n {actionsNode}\n </div>\n );\n};\n\nexport default SidebarNavItem;\n"],"mappings":"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"}
|
|
@@ -3,11 +3,11 @@ import { ChevronDownSvg as t } from "../../../icons/ChevronDownSvg.js";
|
|
|
3
3
|
import { SidebarNavItem as n } from "../sidebar_nav_item/SidebarNavItem.js";
|
|
4
4
|
import { header as r, items as i, section as a, title as o, toggle as s } from "./sidebarNavSection.css.js";
|
|
5
5
|
import "../../../index.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { useCallback as c, useMemo as l, useState as u } from "react";
|
|
7
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
8
8
|
//#region src/backoffice/molecules/sidebar_nav_section/SidebarNavSection.tsx
|
|
9
9
|
var p = ({ title: p, items: m, collapsible: h = !1, isCollapsed: g, defaultCollapsed: _ = !1, onCollapsedChange: v, collapsed: y = !1, className: b }) => {
|
|
10
|
-
let [x, S] =
|
|
10
|
+
let [x, S] = u(_), C = g ?? x, w = h, T = c(() => {
|
|
11
11
|
if (!w) return;
|
|
12
12
|
let e = !C;
|
|
13
13
|
g ?? S(e), v?.(e);
|
|
@@ -16,7 +16,7 @@ var p = ({ title: p, items: m, collapsible: h = !1, isCollapsed: g, defaultColla
|
|
|
16
16
|
C,
|
|
17
17
|
g,
|
|
18
18
|
v
|
|
19
|
-
]), E =
|
|
19
|
+
]), E = l(() => {
|
|
20
20
|
let e = "rotate(0deg)";
|
|
21
21
|
return C && (e = "rotate(-90deg)"), {
|
|
22
22
|
transform: e,
|
|
@@ -25,35 +25,35 @@ var p = ({ title: p, items: m, collapsible: h = !1, isCollapsed: g, defaultColla
|
|
|
25
25
|
}, [C]), D = null;
|
|
26
26
|
if (p != null) {
|
|
27
27
|
let e = null;
|
|
28
|
-
w && (e = /* @__PURE__ */
|
|
28
|
+
w && (e = /* @__PURE__ */ d("button", {
|
|
29
29
|
type: "button",
|
|
30
30
|
className: s,
|
|
31
31
|
onClick: T,
|
|
32
32
|
"aria-expanded": !C,
|
|
33
|
-
children: /* @__PURE__ */
|
|
33
|
+
children: /* @__PURE__ */ d(t, {
|
|
34
34
|
width: 18,
|
|
35
35
|
height: 18,
|
|
36
36
|
style: E
|
|
37
37
|
})
|
|
38
|
-
})), D = /* @__PURE__ */
|
|
38
|
+
})), D = /* @__PURE__ */ f("div", {
|
|
39
39
|
className: r,
|
|
40
|
-
children: [/* @__PURE__ */
|
|
40
|
+
children: [/* @__PURE__ */ d("div", {
|
|
41
41
|
className: o,
|
|
42
42
|
children: p
|
|
43
43
|
}), e]
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
let O = null;
|
|
47
|
-
return C || (O = /* @__PURE__ */
|
|
47
|
+
return C || (O = /* @__PURE__ */ d("div", {
|
|
48
48
|
className: i,
|
|
49
49
|
children: m.map((e) => {
|
|
50
50
|
let { id: t, data: r, ...i } = e;
|
|
51
|
-
return /* @__PURE__ */
|
|
51
|
+
return /* @__PURE__ */ d(n, {
|
|
52
52
|
...i,
|
|
53
53
|
collapsed: y
|
|
54
54
|
}, t);
|
|
55
55
|
})
|
|
56
|
-
})), /* @__PURE__ */
|
|
56
|
+
})), /* @__PURE__ */ f("section", {
|
|
57
57
|
className: e(a, b),
|
|
58
58
|
children: [D, O]
|
|
59
59
|
});
|
|
@@ -5,15 +5,15 @@ import { BulkActionsBar as r } from "../../molecules/bulk_actions_bar/BulkAction
|
|
|
5
5
|
import { TableToolbar as i } from "../../molecules/table_toolbar/TableToolbar.js";
|
|
6
6
|
import { selectionCell as a, wrapper as o } from "./backofficeDataTable.css.js";
|
|
7
7
|
import "../../../index.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { useCallback as s, useMemo as c } from "react";
|
|
9
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
10
10
|
//#region src/backoffice/organisms/backoffice_data_table/BackofficeDataTable.tsx
|
|
11
11
|
var d = (e) => {
|
|
12
12
|
let { rows: n, selection: r } = e, i = [];
|
|
13
13
|
for (let e of n) e.selectable && i.push(e.id);
|
|
14
|
-
let o = i.filter((e) => r.selectedRowIds.has(e)).length,
|
|
14
|
+
let o = i.filter((e) => r.selectedRowIds.has(e)).length, s = i.length > 0 && o === i.length, c = () => {
|
|
15
15
|
if (i.length !== 0) {
|
|
16
|
-
if (
|
|
16
|
+
if (s) {
|
|
17
17
|
r.onSelectionChange(/* @__PURE__ */ new Set());
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
@@ -22,21 +22,21 @@ var d = (e) => {
|
|
|
22
22
|
};
|
|
23
23
|
return {
|
|
24
24
|
id: "__select",
|
|
25
|
-
header: /* @__PURE__ */
|
|
25
|
+
header: /* @__PURE__ */ l("div", {
|
|
26
26
|
className: a,
|
|
27
|
-
children: /* @__PURE__ */
|
|
28
|
-
checked:
|
|
27
|
+
children: /* @__PURE__ */ l(t, {
|
|
28
|
+
checked: s,
|
|
29
29
|
onChange: () => {
|
|
30
|
-
|
|
30
|
+
c();
|
|
31
31
|
},
|
|
32
32
|
"aria-label": "Select all"
|
|
33
33
|
})
|
|
34
34
|
}),
|
|
35
35
|
cell: (e) => {
|
|
36
36
|
let { id: n, selectable: i } = e;
|
|
37
|
-
return /* @__PURE__ */
|
|
37
|
+
return /* @__PURE__ */ l("div", {
|
|
38
38
|
className: a,
|
|
39
|
-
children: /* @__PURE__ */
|
|
39
|
+
children: /* @__PURE__ */ l(t, {
|
|
40
40
|
checked: r.selectedRowIds.has(n),
|
|
41
41
|
disabled: !i,
|
|
42
42
|
onChange: () => {
|
|
@@ -50,7 +50,7 @@ var d = (e) => {
|
|
|
50
50
|
className: a
|
|
51
51
|
};
|
|
52
52
|
}, f = ({ columns: t, rows: a, getRowId: f, toolbar: p, selection: m, bulkActions: h, emptyState: g, className: _ }) => {
|
|
53
|
-
let v =
|
|
53
|
+
let v = c(() => a.map((e, t) => ({
|
|
54
54
|
row: e,
|
|
55
55
|
index: t,
|
|
56
56
|
id: f(e, t),
|
|
@@ -59,41 +59,41 @@ var d = (e) => {
|
|
|
59
59
|
f,
|
|
60
60
|
a,
|
|
61
61
|
m
|
|
62
|
-
]), y =
|
|
62
|
+
]), y = c(() => m == null ? null : d({
|
|
63
63
|
rows: v,
|
|
64
64
|
selection: m
|
|
65
|
-
}), [m, v]), b =
|
|
65
|
+
}), [m, v]), b = c(() => {
|
|
66
66
|
let e = t.map((e) => ({
|
|
67
67
|
...e,
|
|
68
68
|
cell: (t) => e.cell(t.row)
|
|
69
69
|
}));
|
|
70
70
|
return y == null ? e : [y, ...e];
|
|
71
|
-
}, [t, y]), x =
|
|
71
|
+
}, [t, y]), x = c(() => {
|
|
72
72
|
if (b.some((e) => e.isPrimary === !0) || b.length === 0) return b;
|
|
73
73
|
let e = 0;
|
|
74
74
|
return y != null && b.length > 1 && (e = 1), b.map((t, n) => n === e ? {
|
|
75
75
|
...t,
|
|
76
76
|
isPrimary: !0
|
|
77
77
|
} : t);
|
|
78
|
-
}, [b, y]), S =
|
|
78
|
+
}, [b, y]), S = c(() => {
|
|
79
79
|
if (y != null) return `2.75rem repeat(${Math.max(0, b.length - 1)}, minmax(0, 1fr))`;
|
|
80
80
|
}, [b.length, y]), C = 0;
|
|
81
81
|
m != null && (C = m.selectedRowIds.size);
|
|
82
|
-
let w =
|
|
82
|
+
let w = s(() => {
|
|
83
83
|
m?.onSelectionChange(/* @__PURE__ */ new Set());
|
|
84
84
|
}, [m]), T = null;
|
|
85
|
-
p != null && (T = /* @__PURE__ */
|
|
85
|
+
p != null && (T = /* @__PURE__ */ l(i, { ...p }));
|
|
86
86
|
let E = null;
|
|
87
|
-
return m != null && (E = /* @__PURE__ */
|
|
87
|
+
return m != null && (E = /* @__PURE__ */ l(r, {
|
|
88
88
|
selectedCount: C,
|
|
89
89
|
actions: h,
|
|
90
90
|
onClearSelection: w
|
|
91
|
-
})), /* @__PURE__ */
|
|
91
|
+
})), /* @__PURE__ */ u("div", {
|
|
92
92
|
className: e(o, _),
|
|
93
93
|
children: [
|
|
94
94
|
T,
|
|
95
95
|
E,
|
|
96
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */ l(n, {
|
|
97
97
|
columns: x,
|
|
98
98
|
rows: v,
|
|
99
99
|
getRowId: (e) => e.id,
|
|
@@ -3,8 +3,8 @@ import { Badge as t } from "../../atomic/atoms/badge/Badge.js";
|
|
|
3
3
|
import { FormattedDate as n } from "../../atomic/atoms/formatted-date/FormattedDate.js";
|
|
4
4
|
import { date as r, muted as i, number as a, text as o } from "./TableCell.css.js";
|
|
5
5
|
import { TableCellBase as s } from "./TableCellBase.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { useMemo as c } from "react";
|
|
7
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
8
8
|
//#region src/components/data-table/TableCell.tsx
|
|
9
9
|
var u = "—", d = u, f = { maximumFractionDigits: 2 }, p = {
|
|
10
10
|
dateStyle: "medium",
|
|
@@ -12,22 +12,22 @@ var u = "—", d = u, f = { maximumFractionDigits: 2 }, p = {
|
|
|
12
12
|
}, m = {
|
|
13
13
|
Base: s,
|
|
14
14
|
Text: ({ value: t, fallback: n = d, children: r, ellipsis: i = !1, className: a }) => {
|
|
15
|
-
let
|
|
16
|
-
if (
|
|
17
|
-
else if (typeof
|
|
18
|
-
let e =
|
|
19
|
-
|
|
15
|
+
let c = r ?? t;
|
|
16
|
+
if (c == null) c = n;
|
|
17
|
+
else if (typeof c == "string") {
|
|
18
|
+
let e = c.trim();
|
|
19
|
+
c = e.length === 0 ? n : e;
|
|
20
20
|
}
|
|
21
|
-
return /* @__PURE__ */
|
|
21
|
+
return /* @__PURE__ */ l(s, {
|
|
22
22
|
ellipsis: i,
|
|
23
23
|
className: e(o, a),
|
|
24
|
-
children:
|
|
24
|
+
children: c
|
|
25
25
|
});
|
|
26
26
|
},
|
|
27
|
-
Number: ({ value: e, fallback: t = d, locale: n, formatOptions: r = f }) => /* @__PURE__ */
|
|
27
|
+
Number: ({ value: e, fallback: t = d, locale: n, formatOptions: r = f }) => /* @__PURE__ */ l(s, {
|
|
28
28
|
align: "end",
|
|
29
29
|
className: a,
|
|
30
|
-
children:
|
|
30
|
+
children: c(() => {
|
|
31
31
|
if (e == null || Number.isNaN(Number(e))) return t;
|
|
32
32
|
try {
|
|
33
33
|
return new Intl.NumberFormat(n, r).format(e);
|
|
@@ -41,30 +41,30 @@ var u = "—", d = u, f = { maximumFractionDigits: 2 }, p = {
|
|
|
41
41
|
r
|
|
42
42
|
])
|
|
43
43
|
}),
|
|
44
|
-
Status: ({ label: e, tone: n, isLoading: r = !1 }) => /* @__PURE__ */
|
|
44
|
+
Status: ({ label: e, tone: n, isLoading: r = !1 }) => /* @__PURE__ */ l(s, { children: /* @__PURE__ */ l(t, {
|
|
45
45
|
tone: n,
|
|
46
46
|
loading: r,
|
|
47
47
|
children: e
|
|
48
48
|
}) }),
|
|
49
|
-
Date: ({ value: e, fallback: t = u, locale: i, options: a = p }) => /* @__PURE__ */
|
|
49
|
+
Date: ({ value: e, fallback: t = u, locale: i, options: a = p }) => /* @__PURE__ */ l(s, {
|
|
50
50
|
className: r,
|
|
51
|
-
children: /* @__PURE__ */
|
|
51
|
+
children: /* @__PURE__ */ l(n, {
|
|
52
52
|
value: e,
|
|
53
53
|
fallback: t,
|
|
54
54
|
locale: i,
|
|
55
55
|
options: a
|
|
56
56
|
})
|
|
57
57
|
}),
|
|
58
|
-
Badge: ({ label: e, tone: n }) => /* @__PURE__ */
|
|
58
|
+
Badge: ({ label: e, tone: n }) => /* @__PURE__ */ l(s, { children: /* @__PURE__ */ l(t, {
|
|
59
59
|
tone: n,
|
|
60
60
|
children: e
|
|
61
61
|
}) }),
|
|
62
|
-
Actions: ({ children: e, className: t }) => /* @__PURE__ */
|
|
62
|
+
Actions: ({ children: e, className: t }) => /* @__PURE__ */ l(s, {
|
|
63
63
|
align: "end",
|
|
64
64
|
className: t,
|
|
65
65
|
children: e
|
|
66
66
|
}),
|
|
67
|
-
Muted: ({ children: e }) => /* @__PURE__ */
|
|
67
|
+
Muted: ({ children: e }) => /* @__PURE__ */ l("span", {
|
|
68
68
|
className: i,
|
|
69
69
|
children: e
|
|
70
70
|
})
|
|
@@ -2,8 +2,8 @@ import { cx as e } from "../../theme/tools.js";
|
|
|
2
2
|
import { useUiTranslation as t } from "../../i18n/useUiTranslation.js";
|
|
3
3
|
import { body as n, cell as r, container as i, emptyRow as a, header as o, headerCell as s, headerRow as c, hideBelowRecipe as l, primaryCell as u, primaryHeaderCell as d, row as f, rowEven as p, rowOdd as m } from "./DataTable.css.js";
|
|
4
4
|
import { bodyViewport as ee, sentinel as te, singleLineCell as ne, spacer as h } from "./VirtualizedConnectionTable.css.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { useCallback as g, useEffect as _, useLayoutEffect as v, useMemo as y, useRef as b, useState as re } from "react";
|
|
6
|
+
import { jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
7
7
|
//#region src/components/data-table/VirtualizedConnectionTable.tsx
|
|
8
8
|
var C = "minmax(0, 1fr)", ie = (e, t) => typeof t == "string" && t !== "" ? { gridTemplateColumns: t } : { gridTemplateColumns: `repeat(${e}, ${C})` }, w = (e) => e == null ? null : l({ minVisibleAt: e }), T = (e) => {
|
|
9
9
|
let t = e;
|
|
@@ -14,24 +14,24 @@ var C = "minmax(0, 1fr)", ie = (e, t) => typeof t == "string" && t !== "" ? { gr
|
|
|
14
14
|
}
|
|
15
15
|
return null;
|
|
16
16
|
}, E = (e, t, n) => Math.min(n, Math.max(t, e)), D = ({ columns: l, rows: C, getRowId: D, emptyState: ae, className: oe, gridTemplateColumns: O, kind: se, classes: k, virtualization: A, infiniteScroll: j, hasNextPage: ce = !1, isLoadingMore: le = !1, onLoadMore: M }) => {
|
|
17
|
-
let { t: ue } = t(), N = se ?? "default", P =
|
|
17
|
+
let { t: ue } = t(), N = se ?? "default", P = b(null), F = b(null), I = b(null), L = b(null), R = b(null), z = b(!1), B = A?.enabled === !0, V = y(() => {
|
|
18
18
|
if (!B) return null;
|
|
19
19
|
let e = A.rowHeightPx;
|
|
20
20
|
return typeof e == "number" && Number.isFinite(e) && e > 0 ? e : 56;
|
|
21
|
-
}, [B, A]), H =
|
|
21
|
+
}, [B, A]), H = y(() => {
|
|
22
22
|
if (!B) return 0;
|
|
23
23
|
let e = 10, t = A.overscan;
|
|
24
24
|
return typeof t == "number" && Number.isFinite(t) && (e = t), Math.max(0, e);
|
|
25
|
-
}, [B, A]), U = j?.thresholdPx ?? 800, W = j?.autoLoad ?? !0, G = j?.enabled === !0, K = G && ce && !le && M != null, q =
|
|
25
|
+
}, [B, A]), U = j?.thresholdPx ?? 800, W = j?.autoLoad ?? !0, G = j?.enabled === !0, K = G && ce && !le && M != null, q = g(() => {
|
|
26
26
|
M?.();
|
|
27
27
|
}, [M]), [de, fe] = re(() => ({
|
|
28
28
|
startIndex: 0,
|
|
29
29
|
endIndex: Math.min(C.length, 50)
|
|
30
|
-
})), J =
|
|
30
|
+
})), J = y(() => ie(l.length, O), [l.length, O]), Y = g((t, n, i) => {
|
|
31
31
|
let a = D(t, n), o = [f({ kind: N }), k?.row];
|
|
32
32
|
n % 2 == 0 ? o.push(p({ kind: N }), k?.rowEven) : o.push(m({ kind: N }), k?.rowOdd);
|
|
33
33
|
let s = { ...J };
|
|
34
|
-
return typeof i == "number" && (s.height = i), /* @__PURE__ */
|
|
34
|
+
return typeof i == "number" && (s.height = i), /* @__PURE__ */ x("div", {
|
|
35
35
|
role: "row",
|
|
36
36
|
className: e(...o),
|
|
37
37
|
style: s,
|
|
@@ -41,7 +41,7 @@ var C = "minmax(0, 1fr)", ie = (e, t) => typeof t == "string" && t !== "" ? { gr
|
|
|
41
41
|
ne,
|
|
42
42
|
k?.cell
|
|
43
43
|
], a = w(n.minVisibleAt);
|
|
44
|
-
return a != null && i.push(a), n.className != null && i.push(n.className), n.isPrimary && i.push(u, k?.primaryCell), /* @__PURE__ */
|
|
44
|
+
return a != null && i.push(a), n.className != null && i.push(n.className), n.isPrimary && i.push(u, k?.primaryCell), /* @__PURE__ */ x("div", {
|
|
45
45
|
role: "cell",
|
|
46
46
|
className: e(...i),
|
|
47
47
|
children: n.cell(t)
|
|
@@ -54,7 +54,7 @@ var C = "minmax(0, 1fr)", ie = (e, t) => typeof t == "string" && t !== "" ? { gr
|
|
|
54
54
|
D,
|
|
55
55
|
J,
|
|
56
56
|
N
|
|
57
|
-
]), X =
|
|
57
|
+
]), X = g(() => {
|
|
58
58
|
if (!B) return;
|
|
59
59
|
let e = V;
|
|
60
60
|
if (e == null) return;
|
|
@@ -76,16 +76,16 @@ var C = "minmax(0, 1fr)", ie = (e, t) => typeof t == "string" && t !== "" ? { gr
|
|
|
76
76
|
C.length,
|
|
77
77
|
U,
|
|
78
78
|
q
|
|
79
|
-
]), Z =
|
|
79
|
+
]), Z = g(() => {
|
|
80
80
|
R.current ??= window.requestAnimationFrame(() => {
|
|
81
81
|
R.current = null, X();
|
|
82
82
|
});
|
|
83
83
|
}, [X]);
|
|
84
|
-
|
|
84
|
+
v(() => {
|
|
85
85
|
if (!B) return;
|
|
86
86
|
let e = P.current;
|
|
87
87
|
e != null && (L.current = T(e), Z());
|
|
88
|
-
}, [B, Z]),
|
|
88
|
+
}, [B, Z]), _(() => {
|
|
89
89
|
if (!B) return;
|
|
90
90
|
let e = L.current ?? window, t = () => {
|
|
91
91
|
Z();
|
|
@@ -93,7 +93,7 @@ var C = "minmax(0, 1fr)", ie = (e, t) => typeof t == "string" && t !== "" ? { gr
|
|
|
93
93
|
return e.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), () => {
|
|
94
94
|
e.removeEventListener("scroll", t), window.removeEventListener("resize", t);
|
|
95
95
|
};
|
|
96
|
-
}, [B, Z]),
|
|
96
|
+
}, [B, Z]), _(() => {
|
|
97
97
|
if (B || !G || !W || !K) return;
|
|
98
98
|
let e = I.current;
|
|
99
99
|
if (e == null) return;
|
|
@@ -116,21 +116,21 @@ var C = "minmax(0, 1fr)", ie = (e, t) => typeof t == "string" && t !== "" ? { gr
|
|
|
116
116
|
B,
|
|
117
117
|
U,
|
|
118
118
|
q
|
|
119
|
-
]),
|
|
119
|
+
]), v(() => {
|
|
120
120
|
if (B) return;
|
|
121
121
|
let e = P.current;
|
|
122
122
|
e != null && (L.current = T(e));
|
|
123
123
|
}, [B]);
|
|
124
|
-
let pe = /* @__PURE__ */
|
|
124
|
+
let pe = /* @__PURE__ */ x("div", {
|
|
125
125
|
className: e(o({ kind: N }), k?.header),
|
|
126
126
|
role: "rowgroup",
|
|
127
|
-
children: /* @__PURE__ */
|
|
127
|
+
children: /* @__PURE__ */ x("div", {
|
|
128
128
|
className: e(c, k?.headerRow),
|
|
129
129
|
role: "row",
|
|
130
130
|
style: J,
|
|
131
131
|
children: l.map((t) => {
|
|
132
132
|
let n = [s({ kind: N }), k?.headerCell], r = w(t.minVisibleAt);
|
|
133
|
-
return r != null && n.push(r), t.className != null && n.push(t.className), t.isPrimary && n.push(d, k?.primaryHeaderCell), /* @__PURE__ */
|
|
133
|
+
return r != null && n.push(r), t.className != null && n.push(t.className), t.isPrimary && n.push(d, k?.primaryHeaderCell), /* @__PURE__ */ x("div", {
|
|
134
134
|
role: "columnheader",
|
|
135
135
|
className: e(...n),
|
|
136
136
|
children: t.header
|
|
@@ -138,12 +138,12 @@ var C = "minmax(0, 1fr)", ie = (e, t) => typeof t == "string" && t !== "" ? { gr
|
|
|
138
138
|
})
|
|
139
139
|
})
|
|
140
140
|
}), Q;
|
|
141
|
-
if (C.length === 0) Q = /* @__PURE__ */
|
|
141
|
+
if (C.length === 0) Q = /* @__PURE__ */ x("div", {
|
|
142
142
|
className: e(a, k?.emptyRow),
|
|
143
143
|
role: "row",
|
|
144
|
-
children: /* @__PURE__ */
|
|
144
|
+
children: /* @__PURE__ */ x("div", {
|
|
145
145
|
role: "cell",
|
|
146
|
-
children: ae ?? /* @__PURE__ */
|
|
146
|
+
children: ae ?? /* @__PURE__ */ x("div", {
|
|
147
147
|
className: e("ysn8461j txvbqb96 txvbqbv8r txvbqbt5x", k?.emptyCell),
|
|
148
148
|
children: ue("common.table.empty")
|
|
149
149
|
})
|
|
@@ -151,34 +151,34 @@ var C = "minmax(0, 1fr)", ie = (e, t) => typeof t == "string" && t !== "" ? { gr
|
|
|
151
151
|
});
|
|
152
152
|
else if (B && V != null) {
|
|
153
153
|
let { startIndex: e, endIndex: t } = de, n = e * V, r = (C.length - t) * V, i = C.slice(e, t);
|
|
154
|
-
Q = /* @__PURE__ */
|
|
154
|
+
Q = /* @__PURE__ */ S("div", {
|
|
155
155
|
className: ee,
|
|
156
156
|
ref: F,
|
|
157
157
|
children: [
|
|
158
|
-
/* @__PURE__ */
|
|
158
|
+
/* @__PURE__ */ x("div", {
|
|
159
159
|
className: h,
|
|
160
160
|
style: { height: n }
|
|
161
161
|
}),
|
|
162
162
|
i.map((t, n) => Y(t, e + n, V)),
|
|
163
|
-
/* @__PURE__ */
|
|
163
|
+
/* @__PURE__ */ x("div", {
|
|
164
164
|
className: h,
|
|
165
165
|
style: { height: r }
|
|
166
166
|
})
|
|
167
167
|
]
|
|
168
168
|
});
|
|
169
|
-
} else Q = /* @__PURE__ */
|
|
169
|
+
} else Q = /* @__PURE__ */ x("div", {
|
|
170
170
|
ref: F,
|
|
171
171
|
children: C.map((e, t) => Y(e, t, null))
|
|
172
172
|
});
|
|
173
173
|
let $ = null;
|
|
174
|
-
return !B && G && W && ($ = /* @__PURE__ */
|
|
174
|
+
return !B && G && W && ($ = /* @__PURE__ */ x("div", {
|
|
175
175
|
ref: I,
|
|
176
176
|
className: te
|
|
177
|
-
})), /* @__PURE__ */
|
|
177
|
+
})), /* @__PURE__ */ S("div", {
|
|
178
178
|
ref: P,
|
|
179
179
|
className: e(i({ kind: N }), k?.container, oe),
|
|
180
180
|
role: "table",
|
|
181
|
-
children: [pe, /* @__PURE__ */
|
|
181
|
+
children: [pe, /* @__PURE__ */ S("div", {
|
|
182
182
|
className: e(n({ kind: N }), k?.body),
|
|
183
183
|
role: "rowgroup",
|
|
184
184
|
children: [Q, $]
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PageShell as e } from "./PageShell.js";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/layout/AppShell.tsx
|
|
4
|
+
var n = ({ sidebar: n, children: r, breadcrumbSlot: i, actions: a, tabs: o }) => /* @__PURE__ */ t(e, {
|
|
5
|
+
sidebar: n,
|
|
6
|
+
breadcrumbSlot: i,
|
|
7
|
+
actions: a,
|
|
8
|
+
tabs: o,
|
|
9
|
+
children: r
|
|
10
|
+
});
|
|
11
|
+
//#endregion
|
|
12
|
+
export { n as AppShell, n as default };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=AppShell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppShell.js","names":[],"sources":["../../../../src/components/layout/AppShell.tsx"],"sourcesContent":["import { type JSX, type ReactNode } from 'react';\n\nimport {\n PageShell,\n type PageShellActions,\n type PageShellTab,\n} from './PageShell.js';\n\nexport type AppShellProps = {\n sidebar: ReactNode;\n children: ReactNode;\n breadcrumbSlot?: ReactNode;\n actions?: PageShellActions;\n tabs?: PageShellTab[];\n};\n\nexport const AppShell = ({\n sidebar,\n children,\n breadcrumbSlot,\n actions,\n tabs,\n}: AppShellProps): JSX.Element => {\n return (\n <PageShell\n sidebar={sidebar}\n breadcrumbSlot={breadcrumbSlot}\n actions={actions}\n tabs={tabs}\n >\n {children}\n </PageShell>\n );\n};\n\nexport default AppShell;\n"],"mappings":";;;AAgBA,IAAa,KAAY,EACvB,YACA,aACA,mBACA,YACA,cAGE,kBAAC,GAAD;CACW;CACO;CACP;CACH;CAEL;CACS,CAAA"}
|