react-public-components 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +178 -0
- package/dist/index.cjs +600 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +100 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.cts +46 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.js +562 -0
- package/dist/index.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../CollapseBox/index.tsx","../src/icons.tsx","../Splitter/index.tsx"],"sourcesContent":["// 统一入口\nexport { default as CollapseBox } from '../CollapseBox';\nexport type {\n CollapseBoxProps,\n CollapseBoxDirection,\n CollapseBoxButtonPosition,\n} from '../CollapseBox';\n\nexport { default as Splitter } from '../Splitter';\nexport type {\n SplitterProps,\n SplitterPanelProps,\n SplitterSize,\n SplitterOrientation,\n} from '../Splitter';\n","import { useState, type CSSProperties, type ReactNode } from 'react';\nimport { DownOutlined, LeftOutlined, RightOutlined, UpOutlined } from '../src/icons';\nimport './index.less';\n\nexport type CollapseBoxDirection = 'horizontal' | 'vertical';\nexport type CollapseBoxButtonPosition = 'left' | 'right' | 'top' | 'bottom';\n\nexport interface CollapseBoxProps {\n children?: ReactNode;\n title?: string;\n direction?: CollapseBoxDirection;\n buttonPosition?: CollapseBoxButtonPosition;\n defaultWidth?: number;\n defaultHeight?: number;\n contentPadding?: string;\n headerHeight?: number;\n}\n\nconst isNumber = (value: unknown): value is number => typeof value === 'number' && !Number.isNaN(value);\n\nconst ChevronLeft = () => <LeftOutlined />;\n\nconst ChevronRight = () => <RightOutlined />;\n\nconst ChevronUp = () => <UpOutlined />;\n\nconst ChevronDown = () => <DownOutlined />;\n\nconst CollapsibleBox = ({\n children,\n title = '内容区域',\n direction = 'horizontal',\n buttonPosition = 'right',\n defaultWidth = 600,\n defaultHeight = 300,\n contentPadding = '16px',\n headerHeight = 16,\n}: CollapseBoxProps) => {\n const [isExpanded, setIsExpanded] = useState(true);\n const contentMaxHeight = isNumber(defaultHeight) ? defaultHeight - headerHeight : '100%';\n\n const getIcon = () => {\n if (direction === 'horizontal') {\n if (buttonPosition === 'right') {\n return isExpanded ? <ChevronRight /> : <ChevronLeft />;\n } else {\n return isExpanded ? <ChevronLeft /> : <ChevronRight />;\n }\n } else {\n if (buttonPosition === 'bottom') {\n return isExpanded ? <ChevronUp /> : <ChevronDown />;\n } else {\n return isExpanded ? <ChevronDown /> : <ChevronUp />;\n }\n }\n };\n\n const getButtonClass = () => {\n if (direction === 'horizontal') {\n return buttonPosition === 'right' ? 'button-right' : 'button-left';\n } else {\n return buttonPosition === 'bottom' ? 'button-bottom' : 'button-top';\n }\n };\n\n const getContainerStyle = (): CSSProperties => {\n const resolvedHeight = isNumber(defaultHeight) ? `${defaultHeight}px` : defaultHeight;\n if (direction === 'horizontal') {\n return {\n width: isExpanded ? defaultWidth : '0px',\n height: resolvedHeight,\n minWidth: 0,\n };\n } else {\n return {\n height: isExpanded ? resolvedHeight : '0px',\n width: defaultWidth,\n minHeight: 0,\n };\n }\n };\n\n const wrapperClass =\n direction === 'horizontal' ? 'collapsible-wrapper horizontal' : 'collapsible-wrapper vertical';\n\n const containerClass =\n direction === 'horizontal' && buttonPosition === 'right'\n ? 'collapsible-container align-right'\n : 'collapsible-container';\n const height = isNumber(contentMaxHeight) ? contentMaxHeight + 'px' : '100%';\n const contentStyle: CSSProperties = {\n maxHeight: direction === 'vertical' ? (isExpanded ? `${height}` : '0px') : `${height}`,\n overflowY: 'auto',\n padding: direction === 'vertical' && !isExpanded ? '0px' : contentPadding,\n boxSizing: 'border-box',\n };\n\n // 折叠时(纵向 + 底部按钮):按钮需切换为 top:0 定位,使其显示在折叠线下方\n const buttonStyle: CSSProperties =\n direction === 'vertical' && buttonPosition === 'bottom' && !isExpanded\n ? { top: '0px', bottom: 'auto' }\n : {};\n\n // 让 wrapper 高度跟随容器,确保 bottom:0 的按钮贴住容器底部\n // 折叠时 wrapper 高度为 0,配合按钮的 translateY(-100%) 让按钮显示在折叠线上方\n const wrapperStyle: CSSProperties | undefined =\n direction === 'vertical'\n ? isExpanded\n ? {\n height: isNumber(defaultHeight) ? `${defaultHeight}px` : undefined,\n width: defaultWidth,\n }\n : { height: 0, width: defaultWidth }\n : undefined;\n\n return (\n <div className={wrapperClass} style={wrapperStyle}>\n <div style={getContainerStyle()} className={containerClass}>\n {title && (\n <div className=\"collapsible-header\" style={{ display: 'none' }}>\n <h3>{title}</h3>\n </div>\n )}\n\n <div className=\"collapsible-content\" style={contentStyle}>\n {children}\n </div>\n </div>\n\n <div\n onClick={() => setIsExpanded(!isExpanded)}\n className={`toggle-button ${getButtonClass()}`}\n style={buttonStyle}\n title={isExpanded ? '隐藏' : '展开'}\n >\n {getIcon()}\n </div>\n </div>\n );\n};\n\nexport default CollapsibleBox;\n","import type { CSSProperties } from 'react';\n\ninterface IconProps {\n style?: CSSProperties;\n className?: string;\n}\n\nconst baseStyle: CSSProperties = {\n display: 'inline-block',\n width: '1em',\n height: '1em',\n verticalAlign: '-0.125em',\n};\n\nexport const LeftOutlined = ({ style, className }: IconProps) => (\n <svg\n viewBox=\"0 0 1024 1024\"\n focusable=\"false\"\n data-icon=\"left\"\n width=\"1em\"\n height=\"1em\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n style={{ ...baseStyle, ...style }}\n className={className}\n >\n <path d=\"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z\" />\n </svg>\n);\n\nexport const RightOutlined = ({ style, className }: IconProps) => (\n <svg\n viewBox=\"0 0 1024 1024\"\n focusable=\"false\"\n data-icon=\"right\"\n width=\"1em\"\n height=\"1em\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n style={{ ...baseStyle, ...style }}\n className={className}\n >\n <path d=\"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z\" />\n </svg>\n);\n\nexport const UpOutlined = ({ style, className }: IconProps) => (\n <svg\n viewBox=\"0 0 1024 1024\"\n focusable=\"false\"\n data-icon=\"up\"\n width=\"1em\"\n height=\"1em\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n style={{ ...baseStyle, ...style }}\n className={className}\n >\n <path d=\"M890.5 755.3L537.4 268a31.96 31.96 0 00-50.8 0L133.5 755.3a7.95 7.95 0 006.3 12.7h75.5c4.9 0 9.6-2.3 12.6-6.1l281-360 281 360c3 3.8 7.7 6.1 12.6 6.1h75.5c6.7 0 10.4-7.6 6.1-12.7z\" />\n </svg>\n);\n\nexport const DownOutlined = ({ style, className }: IconProps) => (\n <svg\n viewBox=\"0 0 1024 1024\"\n focusable=\"false\"\n data-icon=\"down\"\n width=\"1em\"\n height=\"1em\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n style={{ ...baseStyle, ...style }}\n className={className}\n >\n <path d=\"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 37 17.6 49.8 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z\" />\n </svg>\n);\n","import { DownOutlined, LeftOutlined, RightOutlined, UpOutlined } from '../src/icons';\r\nimport type {\r\n CSSProperties,\r\n ReactElement,\r\n ReactNode,\r\n PointerEvent as ReactPointerEvent,\r\n} from 'react';\r\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\r\n\r\nexport type SplitterSize = number | `${number}%`;\r\nexport type SplitterOrientation = 'horizontal' | 'vertical';\r\n\r\nexport type SplitterPanelProps = {\r\n children?: ReactNode;\r\n collapsible?: boolean;\r\n defaultSize?: SplitterSize;\r\n max?: SplitterSize;\r\n min?: SplitterSize;\r\n resizable?: boolean;\r\n size?: SplitterSize;\r\n style?: CSSProperties;\r\n};\r\n\r\nexport type SplitterProps = {\r\n children: ReactNode;\r\n className?: string;\r\n lazy?: boolean;\r\n onResize?: (sizes: number[]) => void;\r\n onResizeEnd?: (sizes: number[]) => void;\r\n onResizeStart?: (sizes: number[]) => void;\r\n orientation?: SplitterOrientation;\r\n style?: CSSProperties;\r\n vertical?: boolean;\r\n};\r\n\r\ntype SplitterComponent = React.FC<SplitterProps> & {\r\n Panel: React.FC<SplitterPanelProps>;\r\n};\r\n\r\nconst DRAGGER_SIZE = 8;\r\nconst MIN_PANEL_SIZE = 0;\r\n\r\nconst SplitterPanel: React.FC<SplitterPanelProps> = ({ children }) => <>{children}</>;\r\n\r\nconst isPercentSize = (value: SplitterSize): value is `${number}%` =>\r\n typeof value === 'string' && value.endsWith('%');\r\n\r\nconst parseSize = (value: SplitterSize | undefined, total: number, fallback: number) => {\r\n if (value === undefined) {\r\n return fallback;\r\n }\r\n\r\n if (isPercentSize(value)) {\r\n return (Number.parseFloat(value) / 100) * total;\r\n }\r\n\r\n return Number(value);\r\n};\r\n\r\nconst roundSizes = (sizes: number[]) => sizes.map((size) => Math.round(size));\r\n\r\nconst getPointerPosition = (\r\n event: PointerEvent | ReactPointerEvent,\r\n orientation: SplitterOrientation,\r\n) => (orientation === 'horizontal' ? event.clientX : event.clientY);\r\n\r\nconst clamp = (value: number, min: number, max: number) => Math.min(Math.max(value, min), max);\r\n\r\nconst CustomSplitter: SplitterComponent = ({\r\n children,\r\n className,\r\n lazy = false,\r\n onResize,\r\n onResizeEnd,\r\n onResizeStart,\r\n orientation,\r\n style,\r\n vertical = false,\r\n}) => {\r\n const resolvedOrientation = orientation ?? (vertical ? 'vertical' : 'horizontal');\r\n const rootRef = useRef<HTMLDivElement>(null);\r\n const sizesRef = useRef<number[]>([]);\r\n const lastNonZeroSizesRef = useRef<number[]>([]);\r\n const [containerSize, setContainerSize] = useState(0);\r\n const [draggingIndex, setDraggingIndex] = useState<number | null>(null);\r\n const [hoveredIndex, setHoveredIndex] = useState<number | null>(null);\r\n const [sizes, setSizes] = useState<number[]>([]);\r\n\r\n const panels = useMemo(\r\n () =>\r\n React.Children.toArray(children).filter(\r\n React.isValidElement,\r\n ) as ReactElement<SplitterPanelProps>[],\r\n [children],\r\n );\r\n\r\n const trackSize = Math.max(0, containerSize - Math.max(0, panels.length - 1) * DRAGGER_SIZE);\r\n\r\n const getPanelMin = useCallback(\r\n (index: number) => parseSize(panels[index]?.props.min, trackSize, MIN_PANEL_SIZE),\r\n [panels, trackSize],\r\n );\r\n\r\n const getPanelMax = useCallback(\r\n (index: number) => parseSize(panels[index]?.props.max, trackSize, trackSize),\r\n [panels, trackSize],\r\n );\r\n\r\n const normalizeToTrack = useCallback(\r\n (nextSizes: number[]) => {\r\n if (!trackSize || !nextSizes.length) {\r\n return nextSizes;\r\n }\r\n\r\n const normalized = [...nextSizes];\r\n const diff = trackSize - normalized.reduce((sum, size) => sum + size, 0);\r\n const flexibleIndex = normalized.findIndex((size) => size > 0);\r\n normalized[flexibleIndex === -1 ? 0 : flexibleIndex] += diff;\r\n return normalized.map((size, index) => clamp(size, 0, getPanelMax(index)));\r\n },\r\n [getPanelMax, trackSize],\r\n );\r\n\r\n const buildInitialSizes = useCallback(\r\n (previous?: number[]) => {\r\n if (!trackSize || !panels.length) {\r\n return [];\r\n }\r\n\r\n if (previous?.length === panels.length) {\r\n const previousTotal = previous.reduce((sum, size) => sum + size, 0);\r\n if (previousTotal > 0) {\r\n return normalizeToTrack(previous.map((size) => (size / previousTotal) * trackSize));\r\n }\r\n }\r\n\r\n const explicitSizes = panels.map((panel) =>\r\n parseSize(panel.props.size ?? panel.props.defaultSize, trackSize, -1),\r\n );\r\n const usedSize = explicitSizes\r\n .filter((size) => size >= 0)\r\n .reduce((sum, size) => sum + size, 0);\r\n const unsetCount = explicitSizes.filter((size) => size < 0).length;\r\n const fallbackSize = unsetCount ? Math.max(0, (trackSize - usedSize) / unsetCount) : 0;\r\n\r\n return normalizeToTrack(\r\n explicitSizes.map((size, index) =>\r\n clamp(size >= 0 ? size : fallbackSize, getPanelMin(index), getPanelMax(index)),\r\n ),\r\n );\r\n },\r\n [getPanelMax, getPanelMin, normalizeToTrack, panels, trackSize],\r\n );\r\n\r\n const updateSizes = useCallback(\r\n (nextSizes: number[], notify = true) => {\r\n const normalized = normalizeToTrack(nextSizes);\r\n setSizes(normalized);\r\n sizesRef.current = normalized;\r\n normalized.forEach((size, index) => {\r\n if (size > 1) {\r\n lastNonZeroSizesRef.current[index] = size;\r\n }\r\n });\r\n if (notify) {\r\n onResize?.(roundSizes(normalized));\r\n }\r\n },\r\n [normalizeToTrack, onResize],\r\n );\r\n\r\n useEffect(() => {\r\n const node = rootRef.current;\r\n if (!node) {\r\n return undefined;\r\n }\r\n\r\n const syncSize = () => {\r\n const rect = node.getBoundingClientRect();\r\n setContainerSize(resolvedOrientation === 'horizontal' ? rect.width : rect.height);\r\n };\r\n syncSize();\r\n\r\n const observer = new ResizeObserver(syncSize);\r\n observer.observe(node);\r\n return () => observer.disconnect();\r\n }, [resolvedOrientation]);\r\n\r\n useEffect(() => {\r\n setSizes((previous) => {\r\n const nextSizes = buildInitialSizes(previous);\r\n sizesRef.current = nextSizes;\r\n lastNonZeroSizesRef.current = nextSizes.map((size) =>\r\n Math.max(size, trackSize / Math.max(panels.length, 1)),\r\n );\r\n return nextSizes;\r\n });\r\n }, [buildInitialSizes, panels.length, trackSize]);\r\n\r\n const getResizedPair = useCallback(\r\n (sourceSizes: number[], index: number, delta: number) => {\r\n const nextSizes = [...sourceSizes];\r\n const leftSize = nextSizes[index];\r\n const rightSize = nextSizes[index + 1];\r\n const leftMin = getPanelMin(index);\r\n const rightMin = getPanelMin(index + 1);\r\n const leftMax = getPanelMax(index);\r\n const rightMax = getPanelMax(index + 1);\r\n const minDelta = Math.max(leftMin - leftSize, rightSize - rightMax);\r\n const maxDelta = Math.min(leftMax - leftSize, rightSize - rightMin);\r\n const safeDelta = clamp(delta, minDelta, maxDelta);\r\n\r\n nextSizes[index] = leftSize + safeDelta;\r\n nextSizes[index + 1] = rightSize - safeDelta;\r\n return normalizeToTrack(nextSizes);\r\n },\r\n [getPanelMax, getPanelMin, normalizeToTrack],\r\n );\r\n\r\n const resizePair = useCallback(\r\n (index: number, delta: number, notify = true) => {\r\n updateSizes(getResizedPair(sizesRef.current, index, delta), notify);\r\n },\r\n [getResizedPair, updateSizes],\r\n );\r\n\r\n const startResize = (index: number, event: ReactPointerEvent<HTMLDivElement>) => {\r\n if (panels[index].props.resizable === false || panels[index + 1].props.resizable === false) {\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n const startPosition = getPointerPosition(event, resolvedOrientation);\r\n const startSizes = [...sizesRef.current];\r\n let latestSizes = startSizes;\r\n\r\n setDraggingIndex(index);\r\n onResizeStart?.(roundSizes(startSizes));\r\n\r\n const handlePointerMove = (moveEvent: PointerEvent) => {\r\n const delta = getPointerPosition(moveEvent, resolvedOrientation) - startPosition;\r\n latestSizes = getResizedPair(startSizes, index, delta);\r\n if (!lazy) {\r\n updateSizes(latestSizes, true);\r\n }\r\n };\r\n\r\n const handlePointerUp = () => {\r\n document.removeEventListener('pointermove', handlePointerMove);\r\n document.removeEventListener('pointerup', handlePointerUp);\r\n setDraggingIndex(null);\r\n if (lazy) {\r\n updateSizes(latestSizes, true);\r\n }\r\n onResizeEnd?.(roundSizes(sizesRef.current));\r\n };\r\n\r\n document.addEventListener('pointermove', handlePointerMove);\r\n document.addEventListener('pointerup', handlePointerUp);\r\n };\r\n\r\n const toggleCollapse = (index: number, neighborIndex: number) => {\r\n const nextSizes = [...sizesRef.current];\r\n\r\n if (nextSizes[index] > 1) {\r\n lastNonZeroSizesRef.current[index] = nextSizes[index];\r\n nextSizes[neighborIndex] += nextSizes[index];\r\n nextSizes[index] = 0;\r\n } else {\r\n const restoredSize =\r\n lastNonZeroSizesRef.current[index] ||\r\n parseSize(panels[index].props.defaultSize, trackSize, trackSize / panels.length);\r\n nextSizes[index] = clamp(restoredSize, getPanelMin(index), getPanelMax(index));\r\n nextSizes[neighborIndex] = Math.max(0, nextSizes[neighborIndex] - nextSizes[index]);\r\n }\r\n\r\n updateSizes(nextSizes);\r\n onResizeEnd?.(roundSizes(sizesRef.current));\r\n };\r\n\r\n const resetSizes = () => {\r\n const nextSizes = buildInitialSizes();\r\n updateSizes(nextSizes);\r\n onResizeEnd?.(roundSizes(nextSizes));\r\n };\r\n\r\n const rootStyle: CSSProperties = {\r\n border: '1px solid #f0f0f0',\r\n borderRadius: 8,\r\n display: 'flex',\r\n flexDirection: resolvedOrientation === 'horizontal' ? 'row' : 'column',\r\n height: 360,\r\n minHeight: 0,\r\n overflow: 'hidden',\r\n width: '100%',\r\n ...style,\r\n };\r\n\r\n const renderCollapseButton = (\r\n draggerIndex: number,\r\n panelIndex: number,\r\n direction: 'start' | 'end',\r\n ) => {\r\n const panel = panels[panelIndex];\r\n if (!panel?.props.collapsible) {\r\n return null;\r\n }\r\n\r\n const neighborIndex = direction === 'start' ? panelIndex + 1 : panelIndex - 1;\r\n const isCollapsed = (sizes[panelIndex] ?? 0) <= 1;\r\n const isNeighborCollapsed = (sizes[neighborIndex] ?? 0) <= 1;\r\n\r\n // 自己折叠后隐藏;对侧面板折叠后也隐藏(避免与展开按钮重复/语义冲突)\r\n if (isCollapsed || isNeighborCollapsed) {\r\n return null;\r\n }\r\n\r\n // 展开时箭头指向面板将被折叠到的方向\r\n const Icon =\r\n resolvedOrientation === 'horizontal'\r\n ? direction === 'start'\r\n ? LeftOutlined\r\n : RightOutlined\r\n : direction === 'start'\r\n ? UpOutlined\r\n : DownOutlined;\r\n\r\n return (\r\n <button\r\n aria-label=\"折叠面板\"\r\n title=\"折叠面板\"\r\n onClick={(event) => {\r\n event.stopPropagation();\r\n toggleCollapse(panelIndex, neighborIndex);\r\n }}\r\n style={{\r\n alignItems: 'center',\r\n background: '#fff',\r\n border: '1px solid #d9d9d9',\r\n borderRadius: 4,\r\n color: '#595959',\r\n cursor: 'pointer',\r\n display: 'flex',\r\n height: 20,\r\n justifyContent: 'center',\r\n padding: 0,\r\n width: 20,\r\n fontSize: 12,\r\n }}\r\n type=\"button\"\r\n >\r\n <Icon />\r\n </button>\r\n );\r\n };\r\n\r\n // 渲染\"展开\"按钮:当某个面板被折叠时显示在分隔条上,箭头指向展开方向\r\n const renderExpandButton = (panelIndex: number, direction: 'start' | 'end') => {\r\n const panel = panels[panelIndex];\r\n if (!panel?.props.collapsible) {\r\n return null;\r\n }\r\n\r\n const isCollapsed = (sizes[panelIndex] ?? 0) <= 1;\r\n if (!isCollapsed) {\r\n return null;\r\n }\r\n\r\n const neighborIndex = direction === 'start' ? panelIndex + 1 : panelIndex - 1;\r\n\r\n // 折叠后面板展开的方向与折叠方向相反\r\n const Icon =\r\n resolvedOrientation === 'horizontal'\r\n ? direction === 'start'\r\n ? RightOutlined // 左面板折叠后,展开方向朝右\r\n : LeftOutlined // 右面板折叠后,展开方向朝左\r\n : direction === 'start'\r\n ? DownOutlined\r\n : UpOutlined;\r\n\r\n return (\r\n <button\r\n aria-label=\"展开面板\"\r\n title=\"展开面板\"\r\n onClick={(event) => {\r\n event.stopPropagation();\r\n toggleCollapse(panelIndex, neighborIndex);\r\n }}\r\n style={{\r\n alignItems: 'center',\r\n background: '#fff',\r\n border: '1px solid #d9d9d9',\r\n borderRadius: 4,\r\n color: '#595959',\r\n cursor: 'pointer',\r\n display: 'flex',\r\n height: 20,\r\n justifyContent: 'center',\r\n padding: 0,\r\n width: 20,\r\n fontSize: 12,\r\n }}\r\n type=\"button\"\r\n >\r\n <Icon />\r\n </button>\r\n );\r\n };\r\n\r\n return (\r\n <div className={className} ref={rootRef} style={rootStyle}>\r\n {panels.map((panel, index) => {\r\n const isHidden = sizes[index] <= 1;\r\n\r\n return (\r\n <React.Fragment key={index}>\r\n <div\r\n style={{\r\n background: index % 2 ? '#fff' : '#fafafa',\r\n flex: `0 0 ${sizes[index] ?? 0}px`,\r\n minHeight: 0,\r\n minWidth: 0,\r\n overflow: 'auto',\r\n padding: isHidden ? 0 : 16,\r\n transition: draggingIndex === null ? 'flex-basis 0.2s ease' : undefined,\r\n ...panel.props.style,\r\n }}\r\n >\r\n {!isHidden && panel.props.children}\r\n </div>\r\n\r\n {index < panels.length - 1 && (\r\n <div\r\n aria-orientation={resolvedOrientation}\r\n onDoubleClick={resetSizes}\r\n onKeyDown={(event) => {\r\n const step = event.shiftKey ? 40 : 10;\r\n const directionMap =\r\n resolvedOrientation === 'horizontal'\r\n ? { ArrowLeft: -step, ArrowRight: step }\r\n : { ArrowUp: -step, ArrowDown: step };\r\n const delta = directionMap[event.key as keyof typeof directionMap];\r\n if (delta !== undefined) {\r\n event.preventDefault();\r\n resizePair(index, delta);\r\n }\r\n }}\r\n onPointerDown={(event) => startResize(index, event)}\r\n onPointerEnter={() => setHoveredIndex(index)}\r\n onPointerLeave={() => setHoveredIndex(null)}\r\n role=\"separator\"\r\n style={{\r\n alignItems: 'center',\r\n background:\r\n hoveredIndex === index || draggingIndex === index ? '#e6f4ff' : '#f5f5f5',\r\n cursor: resolvedOrientation === 'horizontal' ? 'col-resize' : 'row-resize',\r\n display: 'flex',\r\n flex: `0 0 ${DRAGGER_SIZE}px`,\r\n justifyContent: 'center',\r\n outline: 'none',\r\n position: 'relative',\r\n userSelect: 'none',\r\n zIndex: 1,\r\n }}\r\n tabIndex={0}\r\n >\r\n <div\r\n style={{\r\n background:\r\n hoveredIndex === index || draggingIndex === index ? '#1677ff' : '#d9d9d9',\r\n borderRadius: 2,\r\n height: resolvedOrientation === 'horizontal' ? 48 : 2,\r\n width: resolvedOrientation === 'horizontal' ? 2 : 48,\r\n }}\r\n />\r\n <div\r\n style={{\r\n position: 'absolute',\r\n display: 'flex',\r\n flexDirection: resolvedOrientation === 'horizontal' ? 'column' : 'row',\r\n gap: 2,\r\n opacity:\r\n hoveredIndex === index ||\r\n (sizes[index] ?? 0) <= 1 ||\r\n (sizes[index + 1] ?? 0) <= 1\r\n ? 1\r\n : 0,\r\n transition: 'opacity 0.15s ease',\r\n pointerEvents:\r\n hoveredIndex === index ||\r\n (sizes[index] ?? 0) <= 1 ||\r\n (sizes[index + 1] ?? 0) <= 1\r\n ? 'auto'\r\n : 'none',\r\n }}\r\n >\r\n {renderCollapseButton(index, index, 'start')}\r\n {renderCollapseButton(index, index + 1, 'end')}\r\n {renderExpandButton(index, 'start')}\r\n {renderExpandButton(index + 1, 'end')}\r\n </div>\r\n </div>\r\n )}\r\n </React.Fragment>\r\n );\r\n })}\r\n </div>\r\n );\r\n};\r\n\r\nCustomSplitter.Panel = SplitterPanel;\r\n\r\nexport default CustomSplitter;\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA6D;;;AC0BzD;AAnBJ,IAAM,YAA2B;AAAA,EAC/B,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,eAAe;AACjB;AAEO,IAAM,eAAe,CAAC,EAAE,OAAO,UAAU,MAC9C;AAAA,EAAC;AAAA;AAAA,IACC,SAAQ;AAAA,IACR,WAAU;AAAA,IACV,aAAU;AAAA,IACV,OAAM;AAAA,IACN,QAAO;AAAA,IACP,MAAK;AAAA,IACL,eAAY;AAAA,IACZ,OAAO,EAAE,GAAG,WAAW,GAAG,MAAM;AAAA,IAChC;AAAA,IAEA,sDAAC,UAAK,GAAE,yLAAwL;AAAA;AAClM;AAGK,IAAM,gBAAgB,CAAC,EAAE,OAAO,UAAU,MAC/C;AAAA,EAAC;AAAA;AAAA,IACC,SAAQ;AAAA,IACR,WAAU;AAAA,IACV,aAAU;AAAA,IACV,OAAM;AAAA,IACN,QAAO;AAAA,IACP,MAAK;AAAA,IACL,eAAY;AA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iB,WAChB,WAAM,KAAK,MAAX,YAAgB,MAAM,OACtB,WAAM,QAAQ,CAAC,MAAf,YAAoB,MAAM,IACvB,SACA;AAAA,gBACR;AAAA,gBAEC;AAAA,uCAAqB,OAAO,OAAO,OAAO;AAAA,kBAC1C,qBAAqB,OAAO,QAAQ,GAAG,KAAK;AAAA,kBAC5C,mBAAmB,OAAO,OAAO;AAAA,kBACjC,mBAAmB,QAAQ,GAAG,KAAK;AAAA;AAAA;AAAA,YACtC;AAAA;AAAA;AAAA,MACF;AAAA,SAtFiB,KAwFrB;AAAA,EAEJ,CAAC,GACH;AAEJ;AAEA,eAAe,QAAQ;AAEvB,IAAO,mBAAQ;","names":["import_jsx_runtime","import_react","import_jsx_runtime","React"]}
|
package/dist/index.css
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/* CollapseBox/index.less */
|
|
2
|
+
.collapsible-wrapper {
|
|
3
|
+
position: relative;
|
|
4
|
+
}
|
|
5
|
+
.collapsible-wrapper.horizontal {
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: stretch;
|
|
8
|
+
}
|
|
9
|
+
.collapsible-wrapper.vertical {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
align-items: flex-start;
|
|
13
|
+
}
|
|
14
|
+
.collapsible-container {
|
|
15
|
+
position: relative;
|
|
16
|
+
min-width: 0;
|
|
17
|
+
min-height: 0;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
background-color: white;
|
|
20
|
+
border: 1px solid #d1d5db;
|
|
21
|
+
border-radius: 8px;
|
|
22
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
23
|
+
transition: width 0.3s ease-in-out, height 0.3s ease-in-out;
|
|
24
|
+
}
|
|
25
|
+
.collapsible-container.align-right {
|
|
26
|
+
margin-left: auto;
|
|
27
|
+
}
|
|
28
|
+
.collapsible-header {
|
|
29
|
+
position: sticky;
|
|
30
|
+
top: 0;
|
|
31
|
+
z-index: 10;
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: space-between;
|
|
35
|
+
box-sizing: border-box;
|
|
36
|
+
height: 48px;
|
|
37
|
+
padding: 12px 16px;
|
|
38
|
+
background-color: #f9fafb;
|
|
39
|
+
border-bottom: 1px solid #d1d5db;
|
|
40
|
+
}
|
|
41
|
+
.collapsible-header h3 {
|
|
42
|
+
margin: 0;
|
|
43
|
+
color: #1f2937;
|
|
44
|
+
font-weight: 600;
|
|
45
|
+
font-size: 18px;
|
|
46
|
+
}
|
|
47
|
+
.collapsible-content {
|
|
48
|
+
box-sizing: border-box;
|
|
49
|
+
padding: 16px;
|
|
50
|
+
transition: max-height 0.3s ease-in-out, padding 0.3s ease-in-out;
|
|
51
|
+
}
|
|
52
|
+
.toggle-button {
|
|
53
|
+
position: absolute;
|
|
54
|
+
z-index: 10;
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
color: #8c8c8c;
|
|
59
|
+
background-color: #f3f4f6;
|
|
60
|
+
border: 1px solid #e5e7eb;
|
|
61
|
+
border-radius: 3px;
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
|
|
64
|
+
transition: all 0.2s ease;
|
|
65
|
+
font-size: 10px;
|
|
66
|
+
}
|
|
67
|
+
.toggle-button:hover {
|
|
68
|
+
background-color: #e5e7eb;
|
|
69
|
+
color: #4b5563;
|
|
70
|
+
border-color: #d1d5db;
|
|
71
|
+
}
|
|
72
|
+
.toggle-button.button-right {
|
|
73
|
+
top: 50%;
|
|
74
|
+
right: -7px;
|
|
75
|
+
transform: translateY(-50%);
|
|
76
|
+
width: 14px;
|
|
77
|
+
height: 48px;
|
|
78
|
+
}
|
|
79
|
+
.toggle-button.button-left {
|
|
80
|
+
top: 50%;
|
|
81
|
+
left: -7px;
|
|
82
|
+
transform: translateY(-50%);
|
|
83
|
+
width: 14px;
|
|
84
|
+
height: 48px;
|
|
85
|
+
}
|
|
86
|
+
.toggle-button.button-bottom {
|
|
87
|
+
bottom: -7px;
|
|
88
|
+
left: 50%;
|
|
89
|
+
transform: translateX(-50%);
|
|
90
|
+
width: 48px;
|
|
91
|
+
height: 14px;
|
|
92
|
+
}
|
|
93
|
+
.toggle-button.button-top {
|
|
94
|
+
top: -7px;
|
|
95
|
+
left: 50%;
|
|
96
|
+
transform: translateX(-50%);
|
|
97
|
+
width: 48px;
|
|
98
|
+
height: 14px;
|
|
99
|
+
}
|
|
100
|
+
/*# sourceMappingURL=index.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../CollapseBox/index.less"],"sourcesContent":[".collapsible-wrapper {\n position: relative;\n}\n.collapsible-wrapper.horizontal {\n display: flex;\n align-items: stretch;\n}\n.collapsible-wrapper.vertical {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n}\n.collapsible-container {\n position: relative;\n min-width: 0;\n min-height: 0;\n overflow: hidden;\n background-color: white;\n border: 1px solid #d1d5db;\n border-radius: 8px;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n transition: width 0.3s ease-in-out, height 0.3s ease-in-out;\n}\n.collapsible-container.align-right {\n margin-left: auto;\n}\n.collapsible-header {\n position: sticky;\n top: 0;\n z-index: 10;\n display: flex;\n align-items: center;\n justify-content: space-between;\n box-sizing: border-box;\n height: 48px;\n padding: 12px 16px;\n background-color: #f9fafb;\n border-bottom: 1px solid #d1d5db;\n}\n.collapsible-header h3 {\n margin: 0;\n color: #1f2937;\n font-weight: 600;\n font-size: 18px;\n}\n.collapsible-content {\n box-sizing: border-box;\n padding: 16px;\n transition: max-height 0.3s ease-in-out, padding 0.3s ease-in-out;\n}\n.toggle-button {\n position: absolute;\n z-index: 10;\n display: flex;\n align-items: center;\n justify-content: center;\n color: #8c8c8c;\n background-color: #f3f4f6;\n border: 1px solid #e5e7eb;\n border-radius: 3px;\n cursor: pointer;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);\n transition: all 0.2s ease;\n font-size: 10px;\n}\n.toggle-button:hover {\n background-color: #e5e7eb;\n color: #4b5563;\n border-color: #d1d5db;\n}\n.toggle-button.button-right {\n top: 50%;\n right: -7px;\n transform: translateY(-50%);\n width: 14px;\n height: 48px;\n}\n.toggle-button.button-left {\n top: 50%;\n left: -7px;\n transform: translateY(-50%);\n width: 14px;\n height: 48px;\n}\n.toggle-button.button-bottom {\n bottom: -7px;\n left: 50%;\n transform: translateX(-50%);\n width: 48px;\n height: 14px;\n}\n.toggle-button.button-top {\n top: -7px;\n left: 50%;\n transform: translateX(-50%);\n width: 48px;\n height: 14px;\n}\n"],"mappings":";AAAA,CAAC;AACC,YAAU;AACZ;AACA,CAHC,mBAGmB,CAAC;AACnB,WAAS;AACT,eAAa;AACf;AACA,CAPC,mBAOmB,CAAC;AACnB,WAAS;AACT,kBAAgB;AAChB,eAAa;AACf;AACA,CAAC;AACC,YAAU;AACV,aAAW;AACX,cAAY;AACZ,YAAU;AACV,oBAAkB;AAClB,UAAQ,IAAI,MAAM;AAClB,iBAAe;AACf,cAAY,EAAE,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;AACpC,cAAY,MAAM,KAAK,WAAW,EAAE,OAAO,KAAK;AAClD;AACA,CAXC,qBAWqB,CAAC;AACrB,eAAa;AACf;AACA,CAAC;AACC,YAAU;AACV,OAAK;AACL,WAAS;AACT,WAAS;AACT,eAAa;AACb,mBAAiB;AACjB,cAAY;AACZ,UAAQ;AACR,WAAS,KAAK;AACd,oBAAkB;AAClB,iBAAe,IAAI,MAAM;AAC3B;AACA,CAbC,mBAamB;AAClB,UAAQ;AACR,SAAO;AACP,eAAa;AACb,aAAW;AACb;AACA,CAAC;AACC,cAAY;AACZ,WAAS;AACT,cAAY,WAAW,KAAK,WAAW,EAAE,QAAQ,KAAK;AACxD;AACA,CAAC;AACC,YAAU;AACV,WAAS;AACT,WAAS;AACT,eAAa;AACb,mBAAiB;AACjB,SAAO;AACP,oBAAkB;AAClB,UAAQ,IAAI,MAAM;AAClB,iBAAe;AACf,UAAQ;AACR,cAAY,EAAE,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;AACpC,cAAY,IAAI,KAAK;AACrB,aAAW;AACb;AACA,CAfC,aAea;AACZ,oBAAkB;AAClB,SAAO;AACP,gBAAc;AAChB;AACA,CApBC,aAoBa,CAAC;AACb,OAAK;AACL,SAAO;AACP,aAAW,WAAW;AACtB,SAAO;AACP,UAAQ;AACV;AACA,CA3BC,aA2Ba,CAAC;AACb,OAAK;AACL,QAAM;AACN,aAAW,WAAW;AACtB,SAAO;AACP,UAAQ;AACV;AACA,CAlCC,aAkCa,CAAC;AACb,UAAQ;AACR,QAAM;AACN,aAAW,WAAW;AACtB,SAAO;AACP,UAAQ;AACV;AACA,CAzCC,aAyCa,CAAC;AACb,OAAK;AACL,QAAM;AACN,aAAW,WAAW;AACtB,SAAO;AACP,UAAQ;AACV;","names":[]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default, { ReactNode, CSSProperties } from 'react';
|
|
3
|
+
|
|
4
|
+
type CollapseBoxDirection = 'horizontal' | 'vertical';
|
|
5
|
+
type CollapseBoxButtonPosition = 'left' | 'right' | 'top' | 'bottom';
|
|
6
|
+
interface CollapseBoxProps {
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
title?: string;
|
|
9
|
+
direction?: CollapseBoxDirection;
|
|
10
|
+
buttonPosition?: CollapseBoxButtonPosition;
|
|
11
|
+
defaultWidth?: number;
|
|
12
|
+
defaultHeight?: number;
|
|
13
|
+
contentPadding?: string;
|
|
14
|
+
headerHeight?: number;
|
|
15
|
+
}
|
|
16
|
+
declare const CollapsibleBox: ({ children, title, direction, buttonPosition, defaultWidth, defaultHeight, contentPadding, headerHeight, }: CollapseBoxProps) => React.JSX.Element;
|
|
17
|
+
|
|
18
|
+
type SplitterSize = number | `${number}%`;
|
|
19
|
+
type SplitterOrientation = 'horizontal' | 'vertical';
|
|
20
|
+
type SplitterPanelProps = {
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
collapsible?: boolean;
|
|
23
|
+
defaultSize?: SplitterSize;
|
|
24
|
+
max?: SplitterSize;
|
|
25
|
+
min?: SplitterSize;
|
|
26
|
+
resizable?: boolean;
|
|
27
|
+
size?: SplitterSize;
|
|
28
|
+
style?: CSSProperties;
|
|
29
|
+
};
|
|
30
|
+
type SplitterProps = {
|
|
31
|
+
children: ReactNode;
|
|
32
|
+
className?: string;
|
|
33
|
+
lazy?: boolean;
|
|
34
|
+
onResize?: (sizes: number[]) => void;
|
|
35
|
+
onResizeEnd?: (sizes: number[]) => void;
|
|
36
|
+
onResizeStart?: (sizes: number[]) => void;
|
|
37
|
+
orientation?: SplitterOrientation;
|
|
38
|
+
style?: CSSProperties;
|
|
39
|
+
vertical?: boolean;
|
|
40
|
+
};
|
|
41
|
+
type SplitterComponent = React__default.FC<SplitterProps> & {
|
|
42
|
+
Panel: React__default.FC<SplitterPanelProps>;
|
|
43
|
+
};
|
|
44
|
+
declare const CustomSplitter: SplitterComponent;
|
|
45
|
+
|
|
46
|
+
export { CollapsibleBox as CollapseBox, type CollapseBoxButtonPosition, type CollapseBoxDirection, type CollapseBoxProps, CustomSplitter as Splitter, type SplitterOrientation, type SplitterPanelProps, type SplitterProps, type SplitterSize };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default, { ReactNode, CSSProperties } from 'react';
|
|
3
|
+
|
|
4
|
+
type CollapseBoxDirection = 'horizontal' | 'vertical';
|
|
5
|
+
type CollapseBoxButtonPosition = 'left' | 'right' | 'top' | 'bottom';
|
|
6
|
+
interface CollapseBoxProps {
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
title?: string;
|
|
9
|
+
direction?: CollapseBoxDirection;
|
|
10
|
+
buttonPosition?: CollapseBoxButtonPosition;
|
|
11
|
+
defaultWidth?: number;
|
|
12
|
+
defaultHeight?: number;
|
|
13
|
+
contentPadding?: string;
|
|
14
|
+
headerHeight?: number;
|
|
15
|
+
}
|
|
16
|
+
declare const CollapsibleBox: ({ children, title, direction, buttonPosition, defaultWidth, defaultHeight, contentPadding, headerHeight, }: CollapseBoxProps) => React.JSX.Element;
|
|
17
|
+
|
|
18
|
+
type SplitterSize = number | `${number}%`;
|
|
19
|
+
type SplitterOrientation = 'horizontal' | 'vertical';
|
|
20
|
+
type SplitterPanelProps = {
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
collapsible?: boolean;
|
|
23
|
+
defaultSize?: SplitterSize;
|
|
24
|
+
max?: SplitterSize;
|
|
25
|
+
min?: SplitterSize;
|
|
26
|
+
resizable?: boolean;
|
|
27
|
+
size?: SplitterSize;
|
|
28
|
+
style?: CSSProperties;
|
|
29
|
+
};
|
|
30
|
+
type SplitterProps = {
|
|
31
|
+
children: ReactNode;
|
|
32
|
+
className?: string;
|
|
33
|
+
lazy?: boolean;
|
|
34
|
+
onResize?: (sizes: number[]) => void;
|
|
35
|
+
onResizeEnd?: (sizes: number[]) => void;
|
|
36
|
+
onResizeStart?: (sizes: number[]) => void;
|
|
37
|
+
orientation?: SplitterOrientation;
|
|
38
|
+
style?: CSSProperties;
|
|
39
|
+
vertical?: boolean;
|
|
40
|
+
};
|
|
41
|
+
type SplitterComponent = React__default.FC<SplitterProps> & {
|
|
42
|
+
Panel: React__default.FC<SplitterPanelProps>;
|
|
43
|
+
};
|
|
44
|
+
declare const CustomSplitter: SplitterComponent;
|
|
45
|
+
|
|
46
|
+
export { CollapsibleBox as CollapseBox, type CollapseBoxButtonPosition, type CollapseBoxDirection, type CollapseBoxProps, CustomSplitter as Splitter, type SplitterOrientation, type SplitterPanelProps, type SplitterProps, type SplitterSize };
|