@openfin/ui-library 0.31.3-alpha.20260121152019 → 0.31.3-alpha.20260121191139

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 (26) hide show
  1. package/dist/components/layout/HorizontalOverflow/HorizontalOverflow.d.ts +25 -0
  2. package/dist/components/layout/HorizontalOverflow/HorizontalOverflow.types.d.ts +54 -0
  3. package/dist/components/layout/HorizontalOverflow/ScrollButton.d.ts +10 -0
  4. package/dist/components/layout/HorizontalOverflow/ScrollShadow.d.ts +10 -0
  5. package/dist/components/layout/HorizontalOverflow/index.d.ts +2 -0
  6. package/dist/hooks/useHorizontalOverflow.d.ts +83 -0
  7. package/dist/index.d.ts +3 -0
  8. package/dist/index.js +187 -187
  9. package/dist/lib/scrollChildIntoView.d.ts +68 -0
  10. package/dist/styles/_core/tokens.css +1 -1
  11. package/dist/styles/_modules/shared/horizontal-overflow/horizontal-overflow.css +1 -0
  12. package/dist/styles/_modules/shared/horizontal-overflow/horizontal-overflow.css.map +1 -0
  13. package/dist/styles/_modules/shared/horizontal-overflow/index.css +1 -0
  14. package/dist/styles/_modules/shared/horizontal-overflow/index.css.map +1 -0
  15. package/dist/styles/_modules/shared/index.css +1 -1
  16. package/dist/styles/_modules/shared/index.css.map +1 -1
  17. package/dist/types/core-ui-css-selectors.d.ts +1 -1
  18. package/dist/types/core-ui-css-selectors.js +1 -1
  19. package/dist/types/core-ui-css-selectors.ts +1 -1
  20. package/dist/types/enterprise-css-selectors.d.ts +1 -1
  21. package/dist/types/enterprise-css-selectors.js +1 -1
  22. package/dist/types/enterprise-css-selectors.ts +1 -1
  23. package/dist/types/shared-css-selectors.d.ts +17 -1
  24. package/dist/types/shared-css-selectors.js +17 -1
  25. package/dist/types/shared-css-selectors.ts +17 -1
  26. package/package.json +2 -2
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import type { HorizontalOverflowProps } from './HorizontalOverflow.types';
3
+ import './HorizontalOverflow.scss';
4
+ /**
5
+ * A reusable horizontal overflow container with consistent, accessible horizontal scrolling behavior.
6
+ * Designed for tab rows and icon rows across Enterprise Browser, Core UI, and Here-Zero.
7
+ *
8
+ * This component is CSS-first with BEM class-based styling - all visual styles are defined in SCSS.
9
+ * JavaScript handles only behavioral concerns like overflow detection, scroll events, and button interactions.
10
+ *
11
+ * The component takes 100% width and height of its parent container.
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * <HorizontalOverflow
16
+ * variant="enterprise-view-tabs"
17
+ * showScrollShadows
18
+ * showScrollButtons
19
+ * hideScrollbar
20
+ * >
21
+ * {tabs.map(tab => <Tab key={tab.id} {...tab} />)}
22
+ * </HorizontalOverflow>
23
+ * ```
24
+ */
25
+ export declare const HorizontalOverflow: React.ForwardRefExoticComponent<HorizontalOverflowProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,54 @@
1
+ import { CSSProperties, ReactNode, RefObject, UIEvent } from 'react';
2
+ export type HorizontalOverflowVariant = 'enterprise-top-tabs' | 'enterprise-view-tabs' | 'coreui-view-tabs' | 'dock-icons' | 'default';
3
+ export type ScrollShadowWidth = 'small' | 'large';
4
+ export type ScrollBehavior = 'smooth' | 'instant' | 'auto';
5
+ export interface HorizontalOverflowProps {
6
+ /** Content to render inside the scrollable container */
7
+ children: ReactNode;
8
+ /** Variant that maps to BEM modifiers for theming (shadow colors, etc.) */
9
+ variant?: HorizontalOverflowVariant;
10
+ /** Additional CSS class names */
11
+ className?: string;
12
+ /** Inline styles for the container */
13
+ style?: CSSProperties;
14
+ /** Accessible label for the scrollable region */
15
+ ariaLabel?: string;
16
+ /** Semantic HTML element to render as */
17
+ as?: 'div' | 'nav' | 'section' | 'ul';
18
+ /** Show scroll shadows when content overflows */
19
+ showScrollShadows?: boolean;
20
+ /** Width of scroll shadows ('small' = 12px, 'large' = 24px) */
21
+ shadowWidth?: ScrollShadowWidth;
22
+ /** Show left/right scroll buttons when overflowing */
23
+ showScrollButtons?: boolean;
24
+ /** Amount to scroll when buttons are clicked (in px) */
25
+ scrollButtonAmount?: number;
26
+ /** Hide scrollbar visually (content still scrollable) */
27
+ hideScrollbar?: boolean;
28
+ /** Enable horizontal wheel scroll (convert vertical to horizontal) */
29
+ enableWheelScroll?: boolean;
30
+ /** Scroll behavior for programmatic scrolls */
31
+ scrollBehavior?: ScrollBehavior;
32
+ /** Callback when overflow state changes */
33
+ onOverflowChange?: (isOverflowing: boolean) => void;
34
+ /** Callback when scroll position changes */
35
+ onScroll?: (event: UIEvent<HTMLDivElement>) => void;
36
+ /** Offset for scroll shadow positioning (accounts for adjacent buttons) */
37
+ shadowOffset?: number;
38
+ /** Ref forwarded to the scrollable container */
39
+ containerRef?: RefObject<HTMLDivElement>;
40
+ /** Test ID for testing */
41
+ 'data-testid'?: string;
42
+ }
43
+ export interface ScrollShadowProps {
44
+ direction: 'left' | 'right';
45
+ width: ScrollShadowWidth;
46
+ offset?: number;
47
+ visible: boolean;
48
+ }
49
+ export interface ScrollButtonProps {
50
+ direction: 'left' | 'right';
51
+ disabled: boolean;
52
+ onClick: () => void;
53
+ 'aria-label': string;
54
+ }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import type { ScrollButtonProps } from './HorizontalOverflow.types';
3
+ /**
4
+ * Internal navigation button for scrolling the overflow container.
5
+ * Renders a left or right chevron icon and handles click events for programmatic scrolling.
6
+ * Styled via BEM classes - visual appearance defined in SCSS.
7
+ *
8
+ * @internal This component is not exported publicly and is used only by HorizontalOverflow.
9
+ */
10
+ export declare const ScrollButton: React.FC<ScrollButtonProps>;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import type { ScrollShadowProps } from './HorizontalOverflow.types';
3
+ /**
4
+ * Internal component that renders a gradient shadow overlay to indicate scrollable content.
5
+ * The shadow fades in/out based on scroll position to provide visual feedback.
6
+ * Styled via BEM classes - visual appearance defined in SCSS.
7
+ *
8
+ * @internal This component is not exported publicly and is used only by HorizontalOverflow.
9
+ */
10
+ export declare const ScrollShadow: React.FC<ScrollShadowProps>;
@@ -0,0 +1,2 @@
1
+ export { HorizontalOverflow } from './HorizontalOverflow';
2
+ export type { HorizontalOverflowProps, HorizontalOverflowVariant, ScrollShadowWidth, ScrollBehavior } from './HorizontalOverflow.types';
@@ -0,0 +1,83 @@
1
+ import { RefObject } from 'react';
2
+ export interface UseHorizontalOverflowOptions {
3
+ /** Scroll behavior for programmatic scrolls */
4
+ scrollBehavior?: ScrollBehavior;
5
+ /** Amount to scroll when using scrollBy functions (in pixels) */
6
+ scrollAmount?: number;
7
+ /** Callback when overflow state changes */
8
+ onOverflowChange?: (isOverflowing: boolean) => void;
9
+ /** Debounce delay for resize checks (ms) */
10
+ resizeDebounce?: number;
11
+ /** External ref to use instead of creating internal ref */
12
+ containerRef?: RefObject<HTMLDivElement>;
13
+ }
14
+ export interface UseHorizontalOverflowReturn {
15
+ /** Ref to attach to the scrollable container */
16
+ containerRef: RefObject<HTMLDivElement>;
17
+ /** Whether content is overflowing the container */
18
+ isOverflowing: boolean;
19
+ /** Whether user can scroll left (not at start) */
20
+ canScrollLeft: boolean;
21
+ /** Whether user can scroll right (not at end) */
22
+ canScrollRight: boolean;
23
+ /** Current scroll position (0-1 normalized) */
24
+ scrollProgress: number;
25
+ /** Scroll left by configured amount */
26
+ scrollLeft: () => void;
27
+ /** Scroll right by configured amount */
28
+ scrollRight: () => void;
29
+ /** Scroll to the start of the container */
30
+ scrollToStart: () => void;
31
+ /** Scroll to the end of the container */
32
+ scrollToEnd: () => void;
33
+ /** Scroll a child element into view */
34
+ scrollChildIntoView: (childEl: HTMLElement, behavior?: ScrollBehavior) => void;
35
+ /** Manually trigger overflow check */
36
+ checkOverflow: () => void;
37
+ /** Handle wheel event (convert vertical to horizontal) */
38
+ handleWheelScroll: (event: WheelEvent) => void;
39
+ }
40
+ /**
41
+ * Hook for managing horizontal overflow behavior.
42
+ *
43
+ * Provides utilities for detecting overflow, scrolling programmatically,
44
+ * and scrolling child elements into view.
45
+ *
46
+ * @example
47
+ * ```tsx
48
+ * function TabList({ tabs, activeTabId }) {
49
+ * const {
50
+ * containerRef,
51
+ * isOverflowing,
52
+ * canScrollLeft,
53
+ * canScrollRight,
54
+ * scrollLeft,
55
+ * scrollRight,
56
+ * scrollChildIntoView,
57
+ * } = useHorizontalOverflow();
58
+ *
59
+ * // Scroll active tab into view when it changes
60
+ * useEffect(() => {
61
+ * const activeEl = document.getElementById(activeTabId);
62
+ * if (activeEl) {
63
+ * scrollChildIntoView(activeEl);
64
+ * }
65
+ * }, [activeTabId, scrollChildIntoView]);
66
+ *
67
+ * return (
68
+ * <div>
69
+ * {isOverflowing && (
70
+ * <button onClick={scrollLeft} disabled={!canScrollLeft}>←</button>
71
+ * )}
72
+ * <div ref={containerRef} style={{ overflowX: 'auto' }}>
73
+ * {tabs.map(tab => <Tab key={tab.id} id={tab.id} {...tab} />)}
74
+ * </div>
75
+ * {isOverflowing && (
76
+ * <button onClick={scrollRight} disabled={!canScrollRight}>→</button>
77
+ * )}
78
+ * </div>
79
+ * );
80
+ * }
81
+ * ```
82
+ */
83
+ export declare function useHorizontalOverflow(options?: UseHorizontalOverflowOptions): UseHorizontalOverflowReturn;
package/dist/index.d.ts CHANGED
@@ -23,6 +23,7 @@ export * from './components/input/DateInput';
23
23
  export * from './components/input/TextArea';
24
24
  export * from './components/layout/Box';
25
25
  export * from './components/layout/DefinitionList';
26
+ export * from './components/layout/HorizontalOverflow';
26
27
  export * from './components/system';
27
28
  export * from './components/templates/ContactCard';
28
29
  export * from './components/typography/Heading';
@@ -31,8 +32,10 @@ export * from './hooks/useColorScheme';
31
32
  export * from './hooks/useMediaQuery';
32
33
  export * from './hooks/usePrevious';
33
34
  export * from './hooks/useDropdownKeyboardNavigation';
35
+ export * from './hooks/useHorizontalOverflow';
34
36
  export * from './lib/whenFin';
35
37
  export * from './lib/color-generator';
38
+ export * from './lib/scrollChildIntoView';
36
39
  export * from './utils';
37
40
  export * from './components/helper/ValidationError';
38
41
  export * from './assets';