@salt-ds/core 1.64.1 → 1.65.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.
Files changed (82) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/css/salt-core.css +241 -3
  3. package/dist-cjs/avatar/Avatar.css.js +1 -1
  4. package/dist-cjs/avatar/Avatar.js +12 -2
  5. package/dist-cjs/avatar/Avatar.js.map +1 -1
  6. package/dist-cjs/index.js +6 -0
  7. package/dist-cjs/index.js.map +1 -1
  8. package/dist-cjs/toolbar/Toolbar.css.js +6 -0
  9. package/dist-cjs/toolbar/Toolbar.css.js.map +1 -0
  10. package/dist-cjs/toolbar/Toolbar.js +401 -0
  11. package/dist-cjs/toolbar/Toolbar.js.map +1 -0
  12. package/dist-cjs/toolbar/ToolbarContent.css.js +6 -0
  13. package/dist-cjs/toolbar/ToolbarContent.css.js.map +1 -0
  14. package/dist-cjs/toolbar/ToolbarContent.js +38 -0
  15. package/dist-cjs/toolbar/ToolbarContent.js.map +1 -0
  16. package/dist-cjs/toolbar/ToolbarOverflow.css.js +6 -0
  17. package/dist-cjs/toolbar/ToolbarOverflow.css.js.map +1 -0
  18. package/dist-cjs/toolbar/ToolbarOverflow.js +712 -0
  19. package/dist-cjs/toolbar/ToolbarOverflow.js.map +1 -0
  20. package/dist-cjs/toolbar/ToolbarOverflowFloatingBoundary.js +160 -0
  21. package/dist-cjs/toolbar/ToolbarOverflowFloatingBoundary.js.map +1 -0
  22. package/dist-cjs/toolbar/Tooltray.css.js +6 -0
  23. package/dist-cjs/toolbar/Tooltray.css.js.map +1 -0
  24. package/dist-cjs/toolbar/Tooltray.js +59 -0
  25. package/dist-cjs/toolbar/Tooltray.js.map +1 -0
  26. package/dist-cjs/toolbar/toolbarKeyboardUtils.js +400 -0
  27. package/dist-cjs/toolbar/toolbarKeyboardUtils.js.map +1 -0
  28. package/dist-cjs/toolbar/toolbarUtils.js +220 -0
  29. package/dist-cjs/toolbar/toolbarUtils.js.map +1 -0
  30. package/dist-cjs/toolbar/useToolbarKeyboardNavigation.js +309 -0
  31. package/dist-cjs/toolbar/useToolbarKeyboardNavigation.js.map +1 -0
  32. package/dist-cjs/toolbar/useToolbarOverflow.js +750 -0
  33. package/dist-cjs/toolbar/useToolbarOverflow.js.map +1 -0
  34. package/dist-cjs/utils/mergeProps.js +2 -0
  35. package/dist-cjs/utils/mergeProps.js.map +1 -1
  36. package/dist-es/avatar/Avatar.css.js +1 -1
  37. package/dist-es/avatar/Avatar.js +12 -2
  38. package/dist-es/avatar/Avatar.js.map +1 -1
  39. package/dist-es/index.js +3 -0
  40. package/dist-es/index.js.map +1 -1
  41. package/dist-es/toolbar/Toolbar.css.js +4 -0
  42. package/dist-es/toolbar/Toolbar.css.js.map +1 -0
  43. package/dist-es/toolbar/Toolbar.js +399 -0
  44. package/dist-es/toolbar/Toolbar.js.map +1 -0
  45. package/dist-es/toolbar/ToolbarContent.css.js +4 -0
  46. package/dist-es/toolbar/ToolbarContent.css.js.map +1 -0
  47. package/dist-es/toolbar/ToolbarContent.js +36 -0
  48. package/dist-es/toolbar/ToolbarContent.js.map +1 -0
  49. package/dist-es/toolbar/ToolbarOverflow.css.js +4 -0
  50. package/dist-es/toolbar/ToolbarOverflow.css.js.map +1 -0
  51. package/dist-es/toolbar/ToolbarOverflow.js +707 -0
  52. package/dist-es/toolbar/ToolbarOverflow.js.map +1 -0
  53. package/dist-es/toolbar/ToolbarOverflowFloatingBoundary.js +154 -0
  54. package/dist-es/toolbar/ToolbarOverflowFloatingBoundary.js.map +1 -0
  55. package/dist-es/toolbar/Tooltray.css.js +4 -0
  56. package/dist-es/toolbar/Tooltray.css.js.map +1 -0
  57. package/dist-es/toolbar/Tooltray.js +57 -0
  58. package/dist-es/toolbar/Tooltray.js.map +1 -0
  59. package/dist-es/toolbar/toolbarKeyboardUtils.js +381 -0
  60. package/dist-es/toolbar/toolbarKeyboardUtils.js.map +1 -0
  61. package/dist-es/toolbar/toolbarUtils.js +216 -0
  62. package/dist-es/toolbar/toolbarUtils.js.map +1 -0
  63. package/dist-es/toolbar/useToolbarKeyboardNavigation.js +307 -0
  64. package/dist-es/toolbar/useToolbarKeyboardNavigation.js.map +1 -0
  65. package/dist-es/toolbar/useToolbarOverflow.js +748 -0
  66. package/dist-es/toolbar/useToolbarOverflow.js.map +1 -0
  67. package/dist-es/utils/mergeProps.js +2 -0
  68. package/dist-es/utils/mergeProps.js.map +1 -1
  69. package/dist-types/avatar/Avatar.d.ts +5 -0
  70. package/dist-types/index.d.ts +1 -0
  71. package/dist-types/toolbar/Toolbar.d.ts +12 -0
  72. package/dist-types/toolbar/ToolbarContent.d.ts +10 -0
  73. package/dist-types/toolbar/ToolbarOverflow.d.ts +34 -0
  74. package/dist-types/toolbar/ToolbarOverflowFloatingBoundary.d.ts +16 -0
  75. package/dist-types/toolbar/Tooltray.d.ts +36 -0
  76. package/dist-types/toolbar/index.d.ts +3 -0
  77. package/dist-types/toolbar/toolbarKeyboardUtils.d.ts +39 -0
  78. package/dist-types/toolbar/toolbarUtils.d.ts +44 -0
  79. package/dist-types/toolbar/useToolbarKeyboardNavigation.d.ts +42 -0
  80. package/dist-types/toolbar/useToolbarOverflow.d.ts +38 -0
  81. package/dist-types/utils/mergeProps.d.ts +4 -0
  82. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useToolbarOverflow.js","sources":["../src/toolbar/useToolbarOverflow.ts"],"sourcesContent":["import { useWindow } from \"@salt-ds/window\";\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { ownerWindow, useIsomorphicLayoutEffect } from \"../utils\";\nimport type { ToolbarContentProps } from \"./ToolbarContent\";\nimport {\n buildContentOverflowRenderSlots,\n type ToolbarContentModel,\n type ToolbarOverflowItem,\n} from \"./toolbarUtils\";\n\ntype ToolbarContentPosition = ToolbarContentProps[\"position\"];\n\ninterface OverflowGroupDefinition {\n id: string;\n key: string;\n label: string;\n named: boolean;\n order: number;\n overflowGroup: string;\n contentKey?: string;\n}\n\ninterface CollapseUnit {\n groupKey: string;\n itemIds: string[];\n order: number;\n priority: number;\n}\n\nexport interface ToolbarOverflowGroup {\n id: string;\n items: ToolbarOverflowItem[];\n key: string;\n label: string;\n named: boolean;\n overflowGroup: string;\n contentKey?: string;\n}\n\ninterface OverflowState {\n overflowGroups: ToolbarOverflowGroup[];\n overflowedIds: Set<string>;\n}\n\ninterface UseToolbarOverflowProps {\n content: ToolbarContentModel[];\n}\n\ntype ObservedWidthTarget =\n | {\n kind: \"container\";\n }\n | {\n id: string;\n kind: \"item\";\n }\n | {\n id: string;\n kind: \"named-trigger\";\n }\n | {\n id: string;\n kind: \"named-trigger-measure\";\n }\n | {\n groupKey: string;\n kind: \"shared-trigger-measure\";\n };\n\nconst emptyOverflowState: OverflowState = {\n overflowGroups: [],\n overflowedIds: new Set<string>(),\n};\n\nconst bandPositions: ToolbarContentPosition[] = [\"start\", \"center\", \"end\"];\n// Tolerance for comparing measured content against the available width.\n// `getBoundingClientRect` reports fractional pixels, so summed item, gap, and\n// container measurements can differ by sub-pixel amounts that never visibly\n// overflow. Treating differences below half a CSS pixel as \"fits\" prevents\n// false overflow. Matches the epsilon used by core Tabs for consistency.\nconst WIDTH_EPSILON = 0.5;\n\nfunction measureWidth(element: HTMLElement | null) {\n if (!element) {\n return 0;\n }\n\n const { width } = element.getBoundingClientRect();\n return width;\n}\n\nfunction isVisibleMeasurementElement(element: Element): element is HTMLElement {\n if (!(element instanceof HTMLElement)) {\n return false;\n }\n\n const { width, height } = element.getBoundingClientRect();\n const styles = ownerWindow(element).getComputedStyle(element);\n\n return (\n width > 0 &&\n height > 0 &&\n styles.display !== \"none\" &&\n styles.visibility !== \"hidden\"\n );\n}\n\nfunction measureOverflowItemWidth(element: HTMLElement | null) {\n if (!element) {\n return 0;\n }\n\n const rect = element.getBoundingClientRect();\n let left = rect.left;\n let right = rect.right;\n\n for (const descendant of element.querySelectorAll(\"*\")) {\n if (!isVisibleMeasurementElement(descendant)) {\n continue;\n }\n\n const descendantRect = descendant.getBoundingClientRect();\n left = Math.min(left, descendantRect.left);\n right = Math.max(right, descendantRect.right);\n }\n\n return Math.max(rect.width, right - left);\n}\n\nfunction exceedsAvailableWidth(measuredWidth: number, availableWidth: number) {\n return measuredWidth - availableWidth > WIDTH_EPSILON;\n}\n\nfunction readGap(gapValue: string) {\n return Number.parseFloat(gapValue || \"0\") || 0;\n}\n\nfunction sumFlexWidths(widths: number[], gap: number) {\n if (widths.length === 0) {\n return 0;\n }\n\n return (\n widths.reduce((total, width) => total + width, 0) +\n gap * (widths.length - 1)\n );\n}\n\nfunction buildGroupDefinitions(items: ToolbarOverflowItem[]) {\n const groupMap = new Map<string, OverflowGroupDefinition>();\n\n for (const [sequence, item] of items.entries()) {\n if (item.overflowMode === \"none\") {\n continue;\n }\n\n const existing = groupMap.get(item.overflowGroupKey);\n\n if (existing) {\n if (!existing.named && item.overflowGroup === \"shared\") {\n continue;\n }\n\n if (existing.label === item.overflowGroup && item.overflowLabel) {\n existing.label = item.overflowLabel;\n }\n\n continue;\n }\n\n groupMap.set(item.overflowGroupKey, {\n id: `${item.overflowGroupKey}-${sequence}`,\n key: item.overflowGroupKey,\n label:\n item.overflowGroup === \"shared\"\n ? \"More\"\n : (item.overflowLabel ?? item.overflowGroup),\n named: item.overflowGroup !== \"shared\",\n order: sequence,\n overflowGroup: item.overflowGroup,\n contentKey: item.overflowGroup === \"shared\" ? undefined : item.contentKey,\n });\n }\n\n return Array.from(groupMap.values()).sort(\n (left, right) => left.order - right.order,\n );\n}\n\nfunction buildCollapseUnits(items: ToolbarOverflowItem[]) {\n const groupedUnits = new Map<string, CollapseUnit>();\n const units: CollapseUnit[] = [];\n\n for (const [sequence, item] of items.entries()) {\n if (item.overflowMode === \"none\") {\n continue;\n }\n\n if (item.overflowMode === \"grouped\" && item.overflowGroup !== \"shared\") {\n const existing = groupedUnits.get(item.overflowGroupKey);\n\n if (existing) {\n existing.itemIds.push(item.id);\n existing.order = Math.max(existing.order, sequence);\n existing.priority = Math.max(existing.priority, item.overflowPriority);\n continue;\n }\n\n const unit: CollapseUnit = {\n groupKey: item.overflowGroupKey,\n itemIds: [item.id],\n order: sequence,\n priority: item.overflowPriority,\n };\n\n groupedUnits.set(item.overflowGroupKey, unit);\n units.push(unit);\n continue;\n }\n\n units.push({\n groupKey: item.overflowGroupKey,\n itemIds: [item.id],\n order: sequence,\n priority: item.overflowPriority,\n });\n }\n\n return units.sort((left, right) => {\n if (left.priority !== right.priority) {\n return right.priority - left.priority;\n }\n\n return right.order - left.order;\n });\n}\n\nfunction areOverflowStatesEqual(previous: OverflowState, next: OverflowState) {\n if (previous.overflowedIds.size !== next.overflowedIds.size) {\n return false;\n }\n\n for (const itemId of previous.overflowedIds) {\n if (!next.overflowedIds.has(itemId)) {\n return false;\n }\n }\n\n if (previous.overflowGroups.length !== next.overflowGroups.length) {\n return false;\n }\n\n return previous.overflowGroups.every((group, index) => {\n const nextGroup = next.overflowGroups[index];\n\n if (\n nextGroup == null ||\n group.id !== nextGroup.id ||\n group.label !== nextGroup.label ||\n group.items.length !== nextGroup.items.length\n ) {\n return false;\n }\n\n return group.items.every((item, itemIndex) => {\n return item.id === nextGroup.items[itemIndex]?.id;\n });\n });\n}\n\ninterface ComputeToolbarOverflowStateArgs {\n collapseUnits: CollapseUnit[];\n containerWidth: number;\n groupDefinitions: OverflowGroupDefinition[];\n itemWidths: Map<string, number>;\n items: ToolbarOverflowItem[];\n namedTriggerWidths: Map<string, number>;\n content: ToolbarContentModel[];\n contentGaps: Map<string, number>;\n rootGap: number;\n triggerWidths: Map<string, number>;\n bandGaps: Map<ToolbarContentPosition, number>;\n}\n\nfunction computeToolbarOverflowState({\n bandGaps,\n collapseUnits,\n containerWidth,\n groupDefinitions,\n itemWidths,\n items,\n namedTriggerWidths,\n content,\n contentGaps,\n rootGap,\n triggerWidths,\n}: ComputeToolbarOverflowStateArgs): OverflowState {\n const hasCenteredLayout = content.some(\n (contentArea) => contentArea.position === \"center\",\n );\n const contentByPosition = bandPositions.reduce<\n Record<ToolbarContentPosition, ToolbarContentModel[]>\n >(\n (bands, position) => {\n bands[position] = content.filter(\n (contentArea) => contentArea.position === position,\n );\n return bands;\n },\n {\n start: [],\n center: [],\n end: [],\n },\n );\n const overflowedIds = new Set<string>();\n const activeGroups = new Set<string>();\n\n const getContentWidth = (contentArea: ToolbarContentModel) => {\n const renderSlots = buildContentOverflowRenderSlots(\n contentArea.items,\n overflowedIds,\n new Set(\n groupDefinitions\n .filter((group) => {\n return (\n group.named &&\n group.contentKey === contentArea.key &&\n activeGroups.has(group.key)\n );\n })\n .map((group) => group.key),\n ),\n );\n const slotWidths: number[] = [];\n\n for (const slot of renderSlots) {\n const width =\n slot.triggerGroupKey != null\n ? namedTriggerWidths.get(slot.item.id)\n : itemWidths.get(slot.item.id);\n\n if (width == null || width <= 0) {\n return null;\n }\n\n slotWidths.push(width);\n }\n\n return sumFlexWidths(slotWidths, contentGaps.get(contentArea.key) ?? 0);\n };\n\n const getBandWidth = (position: ToolbarContentPosition) => {\n const bandChildWidths: number[] = [];\n\n for (const contentArea of contentByPosition[position]) {\n const contentWidth = getContentWidth(contentArea);\n\n if (contentWidth == null) {\n return null;\n }\n\n if (contentWidth > 0) {\n bandChildWidths.push(contentWidth);\n }\n }\n\n if (position === \"end\") {\n for (const group of groupDefinitions) {\n if (!group.named && activeGroups.has(group.key)) {\n const width = triggerWidths.get(group.key);\n\n if (width == null || width <= 0) {\n return null;\n }\n\n bandChildWidths.push(width);\n }\n }\n }\n\n return sumFlexWidths(bandChildWidths, bandGaps.get(position) ?? 0);\n };\n\n const getTotalWidth = () => {\n if (hasCenteredLayout) {\n const startBandWidth = getBandWidth(\"start\");\n const centerBandWidth = getBandWidth(\"center\");\n const endBandWidth = getBandWidth(\"end\");\n\n if (\n startBandWidth == null ||\n centerBandWidth == null ||\n endBandWidth == null\n ) {\n return null;\n }\n\n return centerBandWidth + Math.max(startBandWidth, endBandWidth) * 2;\n }\n\n const visibleBandWidths: number[] = [];\n\n for (const position of bandPositions) {\n const bandWidth = getBandWidth(position);\n\n if (bandWidth == null) {\n return null;\n }\n\n if (bandWidth > 0) {\n visibleBandWidths.push(bandWidth);\n }\n }\n\n return sumFlexWidths(visibleBandWidths, rootGap);\n };\n\n const initialWidth = getTotalWidth();\n\n if (initialWidth == null) {\n return emptyOverflowState;\n }\n\n if (exceedsAvailableWidth(initialWidth, containerWidth)) {\n for (const unit of collapseUnits) {\n for (const itemId of unit.itemIds) {\n overflowedIds.add(itemId);\n }\n\n activeGroups.add(unit.groupKey);\n\n const nextWidth = getTotalWidth();\n\n if (nextWidth == null) {\n return emptyOverflowState;\n }\n\n if (!exceedsAvailableWidth(nextWidth, containerWidth)) {\n break;\n }\n }\n }\n\n const overflowGroups = groupDefinitions.reduce<ToolbarOverflowGroup[]>(\n (groups, group) => {\n const hiddenItems = items.filter(\n (item) =>\n item.overflowGroupKey === group.key && overflowedIds.has(item.id),\n );\n\n if (hiddenItems.length > 0) {\n groups.push({\n id: group.id,\n items: hiddenItems,\n key: group.key,\n label: group.label,\n named: group.named,\n overflowGroup: group.overflowGroup,\n contentKey: group.contentKey,\n });\n }\n\n return groups;\n },\n [],\n );\n\n return {\n overflowGroups,\n overflowedIds,\n };\n}\n\nexport function useToolbarOverflow({ content }: UseToolbarOverflowProps) {\n const targetWindow = useWindow();\n const items = useMemo(\n () => content.flatMap((contentArea) => contentArea.items),\n [content],\n );\n const containerRef = useRef<HTMLDivElement>(null);\n\n const bandRefs = useRef<\n Record<ToolbarContentPosition, HTMLDivElement | null>\n >({\n start: null,\n center: null,\n end: null,\n });\n const bandRefCallbacks = useRef(\n new Map<ToolbarContentPosition, (node: HTMLDivElement | null) => void>(),\n );\n const contentRefs = useRef<Record<string, HTMLDivElement | null>>({});\n const contentRefCallbacks = useRef(\n new Map<string, (node: HTMLDivElement | null) => void>(),\n );\n const itemRefs = useRef<Record<string, HTMLDivElement | null>>({});\n const itemRefCallbacks = useRef(\n new Map<string, (node: HTMLDivElement | null) => void>(),\n );\n const namedTriggerRefs = useRef<Record<string, HTMLDivElement | null>>({});\n const namedTriggerRefCallbacks = useRef(\n new Map<string, (node: HTMLDivElement | null) => void>(),\n );\n const namedTriggerMeasureRefs = useRef<Record<string, HTMLDivElement | null>>(\n {},\n );\n const namedTriggerMeasureCallbacks = useRef(\n new Map<string, (node: HTMLDivElement | null) => void>(),\n );\n const triggerMeasureRefs = useRef<Record<string, HTMLButtonElement | null>>(\n {},\n );\n const triggerMeasureCallbacks = useRef(\n new Map<string, (node: HTMLButtonElement | null) => void>(),\n );\n const rafRef = useRef<number | null>(null);\n const clearComputingRafRef = useRef<number | null>(null);\n const isComputingRef = useRef(false);\n const pendingMeasureRef = useRef(false);\n const resizeObserverRef = useRef<ResizeObserver | null>(null);\n const observedWidthTargetsRef = useRef(\n new Map<Element, ObservedWidthTarget>(),\n );\n\n const cachedItemWidths = useRef<Record<string, number>>({});\n const cachedNamedTriggerWidths = useRef<Record<string, number>>({});\n const cachedSharedTriggerWidths = useRef<Record<string, number>>({});\n const [overflowState, setOverflowState] =\n useState<OverflowState>(emptyOverflowState);\n\n const namedTriggerItems = useMemo(\n () =>\n items.filter((item) => {\n return item.overflowMode !== \"none\" && item.overflowGroup !== \"shared\";\n }),\n [items],\n );\n\n const groupDefinitions = useMemo(() => buildGroupDefinitions(items), [items]);\n const collapseUnits = useMemo(() => buildCollapseUnits(items), [items]);\n\n const computeOverflow = useCallback((): OverflowState => {\n const container = containerRef.current;\n\n if (!container) {\n return emptyOverflowState;\n }\n\n const containerStyles = ownerWindow(container).getComputedStyle(container);\n const paddingLeft =\n Number.parseFloat(containerStyles.paddingLeft || \"0\") || 0;\n const paddingRight =\n Number.parseFloat(containerStyles.paddingRight || \"0\") || 0;\n const borderLeft =\n Number.parseFloat(containerStyles.borderLeftWidth || \"0\") || 0;\n const borderRight =\n Number.parseFloat(containerStyles.borderRightWidth || \"0\") || 0;\n const containerWidth =\n container.getBoundingClientRect().width -\n paddingLeft -\n paddingRight -\n borderLeft -\n borderRight;\n\n if (containerWidth <= 0) {\n return emptyOverflowState;\n }\n\n const rootGap = readGap(\n containerStyles.columnGap || containerStyles.gap || \"0\",\n );\n const bandGaps = new Map<ToolbarContentPosition, number>();\n const contentGaps = new Map<string, number>();\n const itemWidths = new Map<string, number>();\n const namedTriggerWidths = new Map<string, number>();\n const triggerWidths = new Map<string, number>();\n\n for (const position of bandPositions) {\n const bandElement = bandRefs.current[position];\n\n if (!bandElement) {\n bandGaps.set(position, 0);\n continue;\n }\n\n const bandStyles = ownerWindow(bandElement).getComputedStyle(bandElement);\n bandGaps.set(\n position,\n readGap(bandStyles.columnGap || bandStyles.gap || \"0\"),\n );\n }\n\n for (const contentArea of content) {\n const contentElement = contentRefs.current[contentArea.key];\n\n if (!contentElement) {\n return emptyOverflowState;\n }\n\n const contentStyles =\n ownerWindow(contentElement).getComputedStyle(contentElement);\n\n contentGaps.set(\n contentArea.key,\n readGap(contentStyles.columnGap || contentStyles.gap || \"0\"),\n );\n }\n\n for (const item of items) {\n const element = itemRefs.current[item.id];\n\n if (element) {\n const width = measureOverflowItemWidth(element);\n\n if (width > 0) {\n itemWidths.set(item.id, width);\n cachedItemWidths.current[item.id] = width;\n continue;\n }\n }\n\n const cached = cachedItemWidths.current[item.id];\n if (cached != null && cached > 0) {\n itemWidths.set(item.id, cached);\n continue;\n }\n\n return emptyOverflowState;\n }\n\n for (const item of namedTriggerItems) {\n const liveWidth = measureWidth(namedTriggerRefs.current[item.id]);\n\n if (liveWidth > 0) {\n namedTriggerWidths.set(item.id, liveWidth);\n cachedNamedTriggerWidths.current[item.id] = liveWidth;\n continue;\n }\n\n const measureWidthForItem = measureWidth(\n namedTriggerMeasureRefs.current[item.id],\n );\n\n if (measureWidthForItem > 0) {\n namedTriggerWidths.set(item.id, measureWidthForItem);\n cachedNamedTriggerWidths.current[item.id] = measureWidthForItem;\n continue;\n }\n\n const cached = cachedNamedTriggerWidths.current[item.id];\n if (cached != null && cached > 0) {\n namedTriggerWidths.set(item.id, cached);\n continue;\n }\n\n return emptyOverflowState;\n }\n\n for (const group of groupDefinitions.filter((entry) => !entry.named)) {\n const width = measureWidth(triggerMeasureRefs.current[group.key]);\n\n if (width <= 0) {\n const cached = cachedSharedTriggerWidths.current[group.key];\n\n if (cached != null && cached > 0) {\n triggerWidths.set(group.key, cached);\n continue;\n }\n\n return emptyOverflowState;\n }\n\n triggerWidths.set(group.key, width);\n cachedSharedTriggerWidths.current[group.key] = width;\n }\n\n const nextOverflowState = computeToolbarOverflowState({\n bandGaps,\n collapseUnits,\n containerWidth,\n groupDefinitions,\n itemWidths,\n items,\n namedTriggerWidths,\n content,\n contentGaps,\n rootGap,\n triggerWidths,\n });\n\n return nextOverflowState;\n }, [collapseUnits, groupDefinitions, items, namedTriggerItems, content]);\n\n const scheduleMeasureRef = useRef<() => void>(() => {});\n\n const scheduleMeasure = useCallback(() => {\n if (!targetWindow) {\n return;\n }\n\n if (isComputingRef.current) {\n pendingMeasureRef.current = true;\n return;\n }\n\n if (rafRef.current != null) {\n targetWindow.cancelAnimationFrame(rafRef.current);\n }\n\n rafRef.current = targetWindow.requestAnimationFrame(() => {\n rafRef.current = null;\n isComputingRef.current = true;\n\n try {\n const nextState = computeOverflow();\n\n setOverflowState((previous) => {\n return areOverflowStatesEqual(previous, nextState)\n ? previous\n : nextState;\n });\n } finally {\n clearComputingRafRef.current = targetWindow.requestAnimationFrame(\n () => {\n clearComputingRafRef.current = null;\n isComputingRef.current = false;\n\n if (pendingMeasureRef.current) {\n pendingMeasureRef.current = false;\n scheduleMeasureRef.current();\n }\n },\n );\n }\n });\n }, [computeOverflow, targetWindow]);\n\n useIsomorphicLayoutEffect(() => {\n scheduleMeasureRef.current = scheduleMeasure;\n\n return () => {\n scheduleMeasureRef.current = () => {};\n };\n }, [scheduleMeasure]);\n\n const getCachedWidthForObservedTarget = useCallback(\n (target: Exclude<ObservedWidthTarget, { kind: \"container\" }>) => {\n switch (target.kind) {\n case \"item\":\n return cachedItemWidths.current[target.id];\n case \"named-trigger\":\n case \"named-trigger-measure\":\n return cachedNamedTriggerWidths.current[target.id];\n case \"shared-trigger-measure\":\n return cachedSharedTriggerWidths.current[target.groupKey];\n }\n },\n [],\n );\n\n const setCachedWidthForObservedTarget = useCallback(\n (\n target: Exclude<ObservedWidthTarget, { kind: \"container\" }>,\n width: number,\n ) => {\n switch (target.kind) {\n case \"item\":\n cachedItemWidths.current[target.id] = width;\n return;\n case \"named-trigger\":\n case \"named-trigger-measure\":\n cachedNamedTriggerWidths.current[target.id] = width;\n return;\n case \"shared-trigger-measure\":\n cachedSharedTriggerWidths.current[target.groupKey] = width;\n return;\n }\n },\n [],\n );\n\n const observeWidthTarget = useCallback(\n (node: Element | null, target: ObservedWidthTarget) => {\n if (!node) {\n return;\n }\n\n observedWidthTargetsRef.current.set(node, target);\n resizeObserverRef.current?.observe(node);\n },\n [],\n );\n\n const unobserveWidthTarget = useCallback((node: Element | null) => {\n if (!node) {\n return;\n }\n\n observedWidthTargetsRef.current.delete(node);\n resizeObserverRef.current?.unobserve(node);\n }, []);\n\n const updateObservedNode = useCallback(\n <TElement extends Element>(\n nodes: Record<string, TElement | null>,\n key: string,\n node: TElement | null,\n target: ObservedWidthTarget,\n ) => {\n const previous = nodes[key];\n\n if (previous === node) {\n return;\n }\n\n if (previous) {\n unobserveWidthTarget(previous);\n }\n\n nodes[key] = node;\n\n if (node) {\n observeWidthTarget(node, target);\n }\n },\n [observeWidthTarget, unobserveWidthTarget],\n );\n\n useIsomorphicLayoutEffect(() => {\n scheduleMeasure();\n }, [scheduleMeasure]);\n\n useEffect(() => {\n const container = containerRef.current;\n\n if (!container) {\n return;\n }\n\n let cancelled = false;\n const win = ownerWindow(container);\n const resizeObserver = new win.ResizeObserver((entries) => {\n let shouldMeasure = false;\n\n for (const entry of entries) {\n const target = observedWidthTargetsRef.current.get(entry.target);\n\n if (!target) {\n continue;\n }\n\n if (target.kind === \"container\") {\n shouldMeasure = true;\n continue;\n }\n\n const nextWidth =\n target.kind === \"item\"\n ? measureOverflowItemWidth(entry.target as HTMLElement)\n : measureWidth(entry.target as HTMLElement);\n\n if (nextWidth <= 0) {\n continue;\n }\n\n const previousWidth = getCachedWidthForObservedTarget(target);\n\n if (previousWidth !== nextWidth) {\n setCachedWidthForObservedTarget(target, nextWidth);\n shouldMeasure = true;\n }\n }\n\n if (shouldMeasure) {\n scheduleMeasureRef.current();\n }\n });\n\n resizeObserverRef.current = resizeObserver;\n observeWidthTarget(container, { kind: \"container\" });\n\n for (const node of observedWidthTargetsRef.current.keys()) {\n resizeObserver.observe(node);\n }\n\n if (win.document.fonts) {\n void win.document.fonts.ready.then(() => {\n if (!cancelled) {\n scheduleMeasureRef.current();\n }\n });\n }\n\n return () => {\n cancelled = true;\n resizeObserverRef.current = null;\n resizeObserver.disconnect();\n\n if (rafRef.current != null) {\n win.cancelAnimationFrame(rafRef.current);\n rafRef.current = null;\n }\n\n if (clearComputingRafRef.current != null) {\n win.cancelAnimationFrame(clearComputingRafRef.current);\n clearComputingRafRef.current = null;\n }\n\n isComputingRef.current = false;\n pendingMeasureRef.current = false;\n };\n }, [\n getCachedWidthForObservedTarget,\n observeWidthTarget,\n setCachedWidthForObservedTarget,\n ]);\n\n const getItemRef = useCallback(\n (id: string) => {\n const existing = itemRefCallbacks.current.get(id);\n\n if (existing) {\n return existing;\n }\n\n const callback = (node: HTMLDivElement | null) => {\n updateObservedNode(itemRefs.current, id, node, {\n id,\n kind: \"item\",\n });\n };\n\n itemRefCallbacks.current.set(id, callback);\n return callback;\n },\n [updateObservedNode],\n );\n\n const getNamedTriggerRef = useCallback(\n (id: string) => {\n const existing = namedTriggerRefCallbacks.current.get(id);\n\n if (existing) {\n return existing;\n }\n\n const callback = (node: HTMLDivElement | null) => {\n updateObservedNode(namedTriggerRefs.current, id, node, {\n id,\n kind: \"named-trigger\",\n });\n };\n\n namedTriggerRefCallbacks.current.set(id, callback);\n return callback;\n },\n [updateObservedNode],\n );\n\n const getNamedTriggerMeasureRef = useCallback(\n (id: string) => {\n const existing = namedTriggerMeasureCallbacks.current.get(id);\n\n if (existing) {\n return existing;\n }\n\n const callback = (node: HTMLDivElement | null) => {\n updateObservedNode(namedTriggerMeasureRefs.current, id, node, {\n id,\n kind: \"named-trigger-measure\",\n });\n };\n\n namedTriggerMeasureCallbacks.current.set(id, callback);\n return callback;\n },\n [updateObservedNode],\n );\n\n const getContentRef = useCallback((contentKey: string) => {\n const existing = contentRefCallbacks.current.get(contentKey);\n\n if (existing) {\n return existing;\n }\n\n const callback = (node: HTMLDivElement | null) => {\n contentRefs.current[contentKey] = node;\n };\n\n contentRefCallbacks.current.set(contentKey, callback);\n return callback;\n }, []);\n const getBandRef = useCallback((position: ToolbarContentPosition) => {\n const existing = bandRefCallbacks.current.get(position);\n\n if (existing) {\n return existing;\n }\n\n const callback = (node: HTMLDivElement | null) => {\n bandRefs.current[position] = node;\n };\n\n bandRefCallbacks.current.set(position, callback);\n return callback;\n }, []);\n\n const getTriggerMeasureRef = useCallback(\n (groupKey: string) => {\n const existing = triggerMeasureCallbacks.current.get(groupKey);\n\n if (existing) {\n return existing;\n }\n\n const callback = (node: HTMLButtonElement | null) => {\n updateObservedNode(triggerMeasureRefs.current, groupKey, node, {\n groupKey,\n kind: \"shared-trigger-measure\",\n });\n };\n\n triggerMeasureCallbacks.current.set(groupKey, callback);\n return callback;\n },\n [updateObservedNode],\n );\n\n return {\n containerRef,\n getBandRef,\n getItemRef,\n getNamedTriggerMeasureRef,\n getNamedTriggerRef,\n getContentRef,\n getTriggerMeasureRef,\n isOverflowing: overflowState.overflowGroups.length > 0,\n overflowGroups: overflowState.overflowGroups,\n overflowedIds: overflowState.overflowedIds,\n overflowTriggerGroups: groupDefinitions,\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAqEA,MAAM,kBAAA,GAAoC;AAAA,EACxC,gBAAgB,EAAC;AAAA,EACjB,aAAA,sBAAmB,GAAA;AACrB,CAAA;AAE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,cAAA;AAAA,IAC9B,eAAe,aAAA,CAAc,aAAA;AAAA,IAC7B,qBAAA,EAAuB;AAAA,GACzB;AACF;;;;"}
@@ -10,6 +10,8 @@ function mergeProps(propsA, propsB) {
10
10
  props[key] = createChainedFunction(a, b);
11
11
  } else if (typeof a === "string" && typeof b === "string" && key === "className") {
12
12
  props[key] = clsx(a, b);
13
+ } else if (key === "style" && typeof a === "object" && a !== null && typeof b === "object" && b !== null) {
14
+ props[key] = { ...a, ...b };
13
15
  } else {
14
16
  props[key] = b !== void 0 ? b : a;
15
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mergeProps.js","sources":["../src/utils/mergeProps.ts"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { createChainedFunction } from \"./createChainedFunction\";\n\ninterface Props {\n [key: string]: unknown;\n}\n\n/**\n * This utility merges two prop objects according to the following rules:\n *\n * - If the prop is a function and begins with \"on\" then chain the functions together\n * - If the prop key is \"className\" then merge them using `clsx`\n * - If the prop is anything else, then use the value from the second parameter unless it's undefined then use the value from the first parameter\n */\nexport function mergeProps(\n propsA: Props,\n propsB: Props,\n): Record<string, unknown> {\n const props = { ...propsA };\n\n for (const key of Object.keys(propsB)) {\n const a: any = props[key];\n const b: any = propsB[key];\n\n if (\n typeof a === \"function\" &&\n typeof b === \"function\" &&\n key.indexOf(\"on\") === 0\n ) {\n props[key] = createChainedFunction(a, b);\n } else if (\n typeof a === \"string\" &&\n typeof b === \"string\" &&\n key === \"className\"\n ) {\n props[key] = clsx(a, b);\n } else {\n props[key] = b !== undefined ? b : a;\n }\n }\n\n return props;\n}\n"],"names":[],"mappings":";;;AAcO,SAAS,UAAA,CACd,QACA,MAAA,EACyB;AACzB,EAAA,MAAM,KAAA,GAAQ,EAAE,GAAG,MAAA,EAAO;AAE1B,EAAA,KAAA,MAAW,GAAA,IAAO,MAAA,CAAO,IAAA,CAAK,MAAM,CAAA,EAAG;AACrC,IAAA,MAAM,CAAA,GAAS,MAAM,GAAG,CAAA;AACxB,IAAA,MAAM,CAAA,GAAS,OAAO,GAAG,CAAA;AAEzB,IAAA,IACE,OAAO,CAAA,KAAM,UAAA,IACb,OAAO,CAAA,KAAM,cACb,GAAA,CAAI,OAAA,CAAQ,IAAI,CAAA,KAAM,CAAA,EACtB;AACA,MAAA,KAAA,CAAM,GAAG,CAAA,GAAI,qBAAA,CAAsB,CAAA,EAAG,CAAC,CAAA;AAAA,IACzC,CAAA,MAAA,IACE,OAAO,CAAA,KAAM,QAAA,IACb,OAAO,CAAA,KAAM,QAAA,IACb,QAAQ,WAAA,EACR;AACA,MAAA,KAAA,CAAM,GAAG,CAAA,GAAI,IAAA,CAAK,CAAA,EAAG,CAAC,CAAA;AAAA,IACxB,CAAA,MAAO;AACL,MAAA,KAAA,CAAM,GAAG,CAAA,GAAI,CAAA,KAAM,MAAA,GAAY,CAAA,GAAI,CAAA;AAAA,IACrC;AAAA,EACF;AAEA,EAAA,OAAO,KAAA;AACT;;;;"}
1
+ {"version":3,"file":"mergeProps.js","sources":["../src/utils/mergeProps.ts"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { createChainedFunction } from \"./createChainedFunction\";\n\ninterface Props {\n [key: string]: unknown;\n}\n\n/**\n * This utility merges two prop objects according to the following rules:\n *\n * - If the prop is a function and begins with \"on\" then chain the functions together\n * - If the prop key is \"className\" then merge them using `clsx`\n * - If the prop key is \"style\" and both values are objects then shallow-merge them\n * (values from the second parameter win on key conflicts). This preserves CSS\n * custom properties set internally by the component (e.g. `--saltAvatar-size-multiplier`)\n * when a consumer passes their own `style` via a render prop.\n * - If the prop is anything else, then use the value from the second parameter unless it's undefined then use the value from the first parameter\n */\nexport function mergeProps(\n propsA: Props,\n propsB: Props,\n): Record<string, unknown> {\n const props = { ...propsA };\n\n for (const key of Object.keys(propsB)) {\n const a: any = props[key];\n const b: any = propsB[key];\n\n if (\n typeof a === \"function\" &&\n typeof b === \"function\" &&\n key.indexOf(\"on\") === 0\n ) {\n props[key] = createChainedFunction(a, b);\n } else if (\n typeof a === \"string\" &&\n typeof b === \"string\" &&\n key === \"className\"\n ) {\n props[key] = clsx(a, b);\n } else if (\n key === \"style\" &&\n typeof a === \"object\" &&\n a !== null &&\n typeof b === \"object\" &&\n b !== null\n ) {\n props[key] = { ...a, ...b };\n } else {\n props[key] = b !== undefined ? b : a;\n }\n }\n\n return props;\n}\n"],"names":[],"mappings":";;;AAkBO,SAAS,UAAA,CACd,QACA,MAAA,EACyB;AACzB,EAAA,MAAM,KAAA,GAAQ,EAAE,GAAG,MAAA,EAAO;AAE1B,EAAA,KAAA,MAAW,GAAA,IAAO,MAAA,CAAO,IAAA,CAAK,MAAM,CAAA,EAAG;AACrC,IAAA,MAAM,CAAA,GAAS,MAAM,GAAG,CAAA;AACxB,IAAA,MAAM,CAAA,GAAS,OAAO,GAAG,CAAA;AAEzB,IAAA,IACE,OAAO,CAAA,KAAM,UAAA,IACb,OAAO,CAAA,KAAM,cACb,GAAA,CAAI,OAAA,CAAQ,IAAI,CAAA,KAAM,CAAA,EACtB;AACA,MAAA,KAAA,CAAM,GAAG,CAAA,GAAI,qBAAA,CAAsB,CAAA,EAAG,CAAC,CAAA;AAAA,IACzC,CAAA,MAAA,IACE,OAAO,CAAA,KAAM,QAAA,IACb,OAAO,CAAA,KAAM,QAAA,IACb,QAAQ,WAAA,EACR;AACA,MAAA,KAAA,CAAM,GAAG,CAAA,GAAI,IAAA,CAAK,CAAA,EAAG,CAAC,CAAA;AAAA,IACxB,CAAA,MAAA,IACE,GAAA,KAAQ,OAAA,IACR,OAAO,CAAA,KAAM,QAAA,IACb,CAAA,KAAM,IAAA,IACN,OAAO,CAAA,KAAM,QAAA,IACb,CAAA,KAAM,IAAA,EACN;AACA,MAAA,KAAA,CAAM,GAAG,CAAA,GAAI,EAAE,GAAG,CAAA,EAAG,GAAG,CAAA,EAAE;AAAA,IAC5B,CAAA,MAAO;AACL,MAAA,KAAA,CAAM,GAAG,CAAA,GAAI,CAAA,KAAM,MAAA,GAAY,CAAA,GAAI,CAAA;AAAA,IACrC;AAAA,EACF;AAEA,EAAA,OAAO,KAAA;AACT;;;;"}
@@ -1,4 +1,5 @@
1
1
  import { type HTMLAttributes, type ReactNode } from "react";
2
+ import { type RenderPropsType } from "../utils";
2
3
  export type NameToInitials = (name?: string) => string;
3
4
  export interface AvatarProps extends HTMLAttributes<HTMLDivElement> {
4
5
  /**
@@ -26,5 +27,9 @@ export interface AvatarProps extends HTMLAttributes<HTMLDivElement> {
26
27
  * Changes Avatar's color.
27
28
  */
28
29
  color?: "accent" | "category-1" | "category-2" | "category-3" | "category-4" | "category-5" | "category-6" | "category-7" | "category-8" | "category-9" | "category-10" | "category-11" | "category-12" | "category-13" | "category-14" | "category-15" | "category-16" | "category-17" | "category-18" | "category-19" | "category-20";
30
+ /**
31
+ * Render prop to enable customization of the avatar root element.
32
+ */
33
+ render?: RenderPropsType["render"];
29
34
  }
30
35
  export declare const Avatar: import("react").ForwardRefExoticComponent<AvatarProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -70,6 +70,7 @@ export * from "./toast";
70
70
  export * from "./toggle-button";
71
71
  export * from "./toggle-button-group";
72
72
  export * from "./toggletip";
73
+ export * from "./toolbar";
73
74
  export * from "./tooltip";
74
75
  export * from "./tree";
75
76
  export * from "./types";
@@ -0,0 +1,12 @@
1
+ import { type ComponentPropsWithoutRef } from "react";
2
+ export interface ToolbarProps extends ComponentPropsWithoutRef<"div"> {
3
+ /**
4
+ * Visual treatment of the toolbar. Defaults to `"bordered"`.
5
+ */
6
+ appearance?: "bordered" | "transparent";
7
+ /**
8
+ * Styling variant. Defaults to `"primary"`.
9
+ */
10
+ variant?: "primary" | "secondary" | "tertiary";
11
+ }
12
+ export declare const Toolbar: import("react").ForwardRefExoticComponent<ToolbarProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,10 @@
1
+ import { type ComponentPropsWithoutRef } from "react";
2
+ export interface ToolbarContentProps extends ComponentPropsWithoutRef<"div"> {
3
+ /**
4
+ * Controls where the content is placed across the full toolbar.
5
+ * If any content uses `"center"`, `Toolbar` reserves symmetric side space
6
+ * so the center band stays on the toolbar midpoint.
7
+ */
8
+ position: "start" | "center" | "end";
9
+ }
10
+ export declare const ToolbarContent: import("react").ForwardRefExoticComponent<ToolbarContentProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,34 @@
1
+ import { type RefObject } from "react";
2
+ import { type ToolbarFocusMemory } from "./toolbarKeyboardUtils";
3
+ import type { ToolbarContentModel, ToolbarOverflowItem } from "./toolbarUtils";
4
+ import type { ToolbarOverflowGroup } from "./useToolbarOverflow";
5
+ export type ToolbarItemHostKind = "main" | "measurement" | "overflow";
6
+ interface ToolbarOverflowOwnersProps {
7
+ hostNodes: Record<string, HTMLDivElement | null>;
8
+ items: ToolbarOverflowItem[];
9
+ }
10
+ export declare function ToolbarOverflowOwners({ hostNodes, items, }: ToolbarOverflowOwnersProps): import("react/jsx-runtime").JSX.Element;
11
+ export declare function ToolbarOverflowTriggerContent({ label, named, }: {
12
+ label: string;
13
+ named: boolean;
14
+ }): import("react/jsx-runtime").JSX.Element;
15
+ interface ToolbarOverflowMenuProps {
16
+ focusMemoryRef?: RefObject<ToolbarFocusMemory | null>;
17
+ getItemHostRef: (id: string, kind: ToolbarItemHostKind) => (node: HTMLDivElement | null) => void;
18
+ group: ToolbarOverflowGroup;
19
+ onItemFocus?: (itemId: string, controlIndex: number) => void;
20
+ }
21
+ export declare function ToolbarOverflowMenu({ focusMemoryRef, getItemHostRef, group, onItemFocus, }: ToolbarOverflowMenuProps): import("react/jsx-runtime").JSX.Element;
22
+ export interface ToolbarOverflowContentProps {
23
+ focusMemoryRef?: RefObject<ToolbarFocusMemory | null>;
24
+ getItemHostRef: (id: string, kind: ToolbarItemHostKind) => (node: HTMLDivElement | null) => void;
25
+ getItemRef: (id: string) => (node: HTMLDivElement | null) => void;
26
+ getNamedTriggerRef: (id: string) => (node: HTMLDivElement | null) => void;
27
+ getContentRef: (contentKey: string) => (node: HTMLDivElement | null) => void;
28
+ onItemFocus?: (itemId: string, controlIndex: number) => void;
29
+ overflowGroups: ToolbarOverflowGroup[];
30
+ overflowedIds: Set<string>;
31
+ content: ToolbarContentModel;
32
+ }
33
+ export declare function ToolbarOverflowContent({ content, focusMemoryRef, getItemHostRef, getItemRef, getNamedTriggerRef, getContentRef, onItemFocus, overflowGroups, overflowedIds, }: ToolbarOverflowContentProps): import("react/jsx-runtime").JSX.Element;
34
+ export {};
@@ -0,0 +1,16 @@
1
+ import { type ReactNode } from "react";
2
+ interface ToolbarOverflowFloatingBoundaryContextValue {
3
+ isTargetInsideBoundary: (boundaryKey: string, target: EventTarget | null) => boolean;
4
+ registerFloatingRoot: (boundaryKey: string, root: HTMLElement) => () => void;
5
+ }
6
+ export declare function ToolbarOverflowFloatingBoundaryProvider({ children, }: {
7
+ children: ReactNode;
8
+ }): import("react/jsx-runtime").JSX.Element;
9
+ export declare function useToolbarOverflowFloatingBoundary(): ToolbarOverflowFloatingBoundaryContextValue | null;
10
+ export declare function isTargetInsideOverflowBoundary(panelContent: HTMLElement | null, floatingBoundary: ToolbarOverflowFloatingBoundaryContextValue | null, boundaryKey: string, target: EventTarget | null): boolean;
11
+ export declare function getToolbarOverflowBoundaryKey(host: HTMLElement | null): string | null;
12
+ export declare function ToolbarOverflowFloatingComponentProvider({ boundaryKey, children, }: {
13
+ boundaryKey: string | null;
14
+ children: ReactNode;
15
+ }): import("react/jsx-runtime").JSX.Element;
16
+ export {};
@@ -0,0 +1,36 @@
1
+ import { type ComponentPropsWithoutRef } from "react";
2
+ export interface TooltrayProps extends Omit<ComponentPropsWithoutRef<"div">, "align"> {
3
+ /**
4
+ * Alignment of the tooltray.
5
+ * - When a `Tooltray` is used directly inside `Toolbar`, this acts as
6
+ * shorthand for which toolbar band the tray belongs to.
7
+ * - When a `Tooltray` is used inside `ToolbarContent`, this alignment is
8
+ * local to that content area.
9
+ *
10
+ * Defaults to `"start"`.
11
+ */
12
+ align?: "start" | "end" | "center";
13
+ /**
14
+ * Controls how this tray participates in `Toolbar` overflow.
15
+ *
16
+ * Defaults to `"independent"`.
17
+ */
18
+ overflowMode?: "none" | "independent" | "grouped";
19
+ /**
20
+ * Higher numbers overflow before lower numbers.
21
+ *
22
+ * Defaults to `0`.
23
+ */
24
+ overflowPriority?: number;
25
+ /**
26
+ * Collapse this tray into the shared overflow or a named local overflow.
27
+ *
28
+ * Defaults to `"shared"`.
29
+ */
30
+ overflowGroup?: "shared" | string;
31
+ /**
32
+ * Accessible label for the named overflow trigger.
33
+ */
34
+ overflowLabel?: string;
35
+ }
36
+ export declare const Tooltray: import("react").ForwardRefExoticComponent<TooltrayProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,3 @@
1
+ export * from "./Toolbar";
2
+ export * from "./ToolbarContent";
3
+ export * from "./Tooltray";
@@ -0,0 +1,39 @@
1
+ import type { ToolbarOverflowItem } from "./toolbarUtils";
2
+ export declare const TOOLBAR_SCOPE_ROOT_ATTR = "data-salt-toolbar-scope-root";
3
+ export declare const TOOLBAR_ITEM_ATTR = "data-salt-toolbar-item-id";
4
+ export declare const TOOLBAR_GROUP_KEY_ATTR = "data-salt-toolbar-overflow-group-key";
5
+ export declare const TOOLBAR_OVERFLOW_TRIGGER_ATTR = "data-salt-toolbar-overflow-trigger";
6
+ export declare const toolbarFocusableSelector: string;
7
+ export type ToolbarFocusMemory = {
8
+ controlIndex: number;
9
+ itemId: string;
10
+ scopeIndex: number;
11
+ type: "item";
12
+ } | {
13
+ groupKey: string;
14
+ scopeIndex: number;
15
+ type: "overflow-trigger";
16
+ } | {
17
+ scopeIndex: number;
18
+ type: "scope";
19
+ };
20
+ export interface ToolbarFocusableOptions {
21
+ includeTabIndexMinusOne?: boolean;
22
+ }
23
+ export declare function getClosestToolbarScopeRoot(target: EventTarget | null): HTMLElement | null;
24
+ export declare function getToolbarItemId(target: Element | null): string | null;
25
+ export declare function isToolbarFocusFromPointerTarget(focusTarget: HTMLElement, pointerTarget: EventTarget | null): boolean;
26
+ export declare function getToolbarScopeFocusableElements(scopeRoot: HTMLElement, options?: ToolbarFocusableOptions): HTMLElement[];
27
+ export declare function getToolbarFocusMemory(scopeRoot: HTMLElement, target: HTMLElement, options?: ToolbarFocusableOptions): ToolbarFocusMemory | null;
28
+ export declare function resolveToolbarFocusTarget(scopeRoot: HTMLElement, focusMemory: ToolbarFocusMemory | null, { includeTabIndexMinusOne, items, overflowedIds, }?: {
29
+ items?: ToolbarOverflowItem[];
30
+ includeTabIndexMinusOne?: boolean;
31
+ overflowedIds?: Set<string>;
32
+ }): HTMLElement | null;
33
+ export declare function getToolbarDirectionalMoveTarget(scopeRoot: HTMLElement, target: HTMLElement, key: string, options?: ToolbarFocusableOptions): HTMLElement | null;
34
+ export declare function getToolbarTabMoveTarget(scopeRoot: HTMLElement, shiftKey: boolean): HTMLElement | null;
35
+ export declare function shouldToolbarPreserveNativeTab(target: HTMLElement): boolean;
36
+ export declare function isToolbarFocusable(target: HTMLElement, { includeTabIndexMinusOne }?: ToolbarFocusableOptions): boolean;
37
+ export declare function focusToolbarElement(target: HTMLElement | null | undefined): void;
38
+ export declare function scheduleToolbarFocus(target: HTMLElement | null | undefined, targetWindow?: (Window & typeof globalThis) | null | undefined): () => void;
39
+ export declare function getDocumentFocusableElements(ownerDocument: Document): HTMLElement[];
@@ -0,0 +1,44 @@
1
+ import { type ReactElement, type ReactNode, type Ref } from "react";
2
+ import { type ToolbarContentProps } from "./ToolbarContent";
3
+ import { type TooltrayProps } from "./Tooltray";
4
+ export type ToolbarMode = "explicit" | "flat" | "invalid";
5
+ type ToolbarChild = Exclude<ReactNode, boolean | null | undefined>;
6
+ type ToolbarContentPosition = ToolbarContentProps["position"];
7
+ type TooltrayOverflowMode = NonNullable<TooltrayProps["overflowMode"]>;
8
+ export interface ToolbarOverflowItem {
9
+ align: NonNullable<TooltrayProps["align"]>;
10
+ element: ReactElement<TooltrayProps>;
11
+ id: string;
12
+ leadingDecorations: ReactElement[];
13
+ order: number;
14
+ overflowGroup: string;
15
+ overflowGroupKey: string;
16
+ overflowLabel?: string;
17
+ overflowMode: TooltrayOverflowMode;
18
+ overflowPriority: number;
19
+ contentKey: string;
20
+ trailingDecorations: ReactElement[];
21
+ }
22
+ export interface ToolbarOverflowRenderSlot {
23
+ item: ToolbarOverflowItem;
24
+ overflowed: boolean;
25
+ showLeadingDecorations: boolean;
26
+ showTrailingDecorations: boolean;
27
+ triggerGroupKey?: string;
28
+ }
29
+ export interface ToolbarContentModel {
30
+ implicit: boolean;
31
+ items: ToolbarOverflowItem[];
32
+ key: string;
33
+ position: ToolbarContentPosition;
34
+ props: Omit<ToolbarContentProps, "children" | "position">;
35
+ ref: Ref<HTMLDivElement> | null;
36
+ }
37
+ export interface ToolbarModel {
38
+ mode: ToolbarMode;
39
+ content: ToolbarContentModel[];
40
+ }
41
+ export declare function buildContentOverflowRenderSlots(items: ToolbarOverflowItem[], overflowedIds: Set<string>, activeNamedGroupKeys: Set<string>): ToolbarOverflowRenderSlot[];
42
+ export declare function flattenToolbarChildren(children: ReactNode): ToolbarChild[];
43
+ export declare function normalizeToolbarChildren(children: ReactNode): ToolbarModel;
44
+ export {};
@@ -0,0 +1,42 @@
1
+ import { type FocusEventHandler, type KeyboardEventHandler, type PointerEventHandler, type RefObject } from "react";
2
+ import { type ToolbarFocusMemory } from "./toolbarKeyboardUtils";
3
+ import type { ToolbarOverflowItem } from "./toolbarUtils";
4
+ interface UseToolbarKeyboardNavigationProps {
5
+ includeTabIndexMinusOne?: boolean;
6
+ items?: ToolbarOverflowItem[];
7
+ overflowedIds?: Set<string>;
8
+ scopeRef: RefObject<HTMLElement | null>;
9
+ }
10
+ interface ToolbarFocusEvent {
11
+ relatedTarget: EventTarget | null;
12
+ stopPropagation: () => void;
13
+ target: EventTarget | null;
14
+ }
15
+ interface ToolbarKeyDownEvent {
16
+ altKey: boolean;
17
+ ctrlKey: boolean;
18
+ key: string;
19
+ metaKey: boolean;
20
+ preventDefault: () => void;
21
+ shiftKey: boolean;
22
+ stopPropagation: () => void;
23
+ target: EventTarget | null;
24
+ }
25
+ interface ToolbarPointerEvent {
26
+ target: EventTarget | null;
27
+ }
28
+ export declare function useToolbarKeyboardNavigation({ includeTabIndexMinusOne, items, overflowedIds, scopeRef, }: UseToolbarKeyboardNavigationProps): {
29
+ focusEntryTarget: () => void;
30
+ getEntryFocusable: () => HTMLElement | null;
31
+ handleBlurCapture: FocusEventHandler<HTMLElement>;
32
+ handleFocusCapture: FocusEventHandler<HTMLElement>;
33
+ handleKeyDownCapture: KeyboardEventHandler<HTMLElement>;
34
+ handlePointerDownCapture: PointerEventHandler<HTMLElement>;
35
+ handleScopeBlur: (event: ToolbarFocusEvent) => void;
36
+ handleScopeFocus: (event: ToolbarFocusEvent) => void;
37
+ handleScopeKeyDown: (event: ToolbarKeyDownEvent) => void;
38
+ handleScopePointerDown: (event: ToolbarPointerEvent) => void;
39
+ rememberItemFocus: (itemId: string, controlIndex: number) => void;
40
+ rememberedFocusRef: import("react").MutableRefObject<ToolbarFocusMemory | null>;
41
+ };
42
+ export {};
@@ -0,0 +1,38 @@
1
+ import type { ToolbarContentProps } from "./ToolbarContent";
2
+ import { type ToolbarContentModel, type ToolbarOverflowItem } from "./toolbarUtils";
3
+ type ToolbarContentPosition = ToolbarContentProps["position"];
4
+ interface OverflowGroupDefinition {
5
+ id: string;
6
+ key: string;
7
+ label: string;
8
+ named: boolean;
9
+ order: number;
10
+ overflowGroup: string;
11
+ contentKey?: string;
12
+ }
13
+ export interface ToolbarOverflowGroup {
14
+ id: string;
15
+ items: ToolbarOverflowItem[];
16
+ key: string;
17
+ label: string;
18
+ named: boolean;
19
+ overflowGroup: string;
20
+ contentKey?: string;
21
+ }
22
+ interface UseToolbarOverflowProps {
23
+ content: ToolbarContentModel[];
24
+ }
25
+ export declare function useToolbarOverflow({ content }: UseToolbarOverflowProps): {
26
+ containerRef: import("react").RefObject<HTMLDivElement>;
27
+ getBandRef: (position: ToolbarContentPosition) => (node: HTMLDivElement | null) => void;
28
+ getItemRef: (id: string) => (node: HTMLDivElement | null) => void;
29
+ getNamedTriggerMeasureRef: (id: string) => (node: HTMLDivElement | null) => void;
30
+ getNamedTriggerRef: (id: string) => (node: HTMLDivElement | null) => void;
31
+ getContentRef: (contentKey: string) => (node: HTMLDivElement | null) => void;
32
+ getTriggerMeasureRef: (groupKey: string) => (node: HTMLButtonElement | null) => void;
33
+ isOverflowing: boolean;
34
+ overflowGroups: ToolbarOverflowGroup[];
35
+ overflowedIds: Set<string>;
36
+ overflowTriggerGroups: OverflowGroupDefinition[];
37
+ };
38
+ export {};
@@ -6,6 +6,10 @@ interface Props {
6
6
  *
7
7
  * - If the prop is a function and begins with "on" then chain the functions together
8
8
  * - If the prop key is "className" then merge them using `clsx`
9
+ * - If the prop key is "style" and both values are objects then shallow-merge them
10
+ * (values from the second parameter win on key conflicts). This preserves CSS
11
+ * custom properties set internally by the component (e.g. `--saltAvatar-size-multiplier`)
12
+ * when a consumer passes their own `style` via a render prop.
9
13
  * - If the prop is anything else, then use the value from the second parameter unless it's undefined then use the value from the first parameter
10
14
  */
11
15
  export declare function mergeProps(propsA: Props, propsB: Props): Record<string, unknown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salt-ds/core",
3
- "version": "1.64.1",
3
+ "version": "1.65.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",