@vuu-ui/vuu-ui-controls 2.1.19-beta.1 → 2.1.19-beta.2

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 (180) hide show
  1. package/package.json +12 -13
  2. package/src/calendar/Calendar.css.js +10 -0
  3. package/src/calendar/Calendar.js +70 -0
  4. package/src/calendar/index.js +4 -0
  5. package/src/calendar/internal/CalendarCarousel.css.js +19 -0
  6. package/src/calendar/internal/CalendarCarousel.js +73 -0
  7. package/src/calendar/internal/CalendarContext.js +9 -0
  8. package/src/calendar/internal/CalendarDay.css.js +116 -0
  9. package/src/calendar/internal/CalendarDay.js +64 -0
  10. package/src/calendar/internal/CalendarMonth.css.js +13 -0
  11. package/src/calendar/internal/CalendarMonth.js +43 -0
  12. package/src/calendar/internal/CalendarNavigation.css.js +24 -0
  13. package/src/calendar/internal/CalendarNavigation.js +185 -0
  14. package/src/calendar/internal/CalendarWeekHeader.css.js +23 -0
  15. package/src/calendar/internal/CalendarWeekHeader.js +31 -0
  16. package/src/calendar/internal/useFocusManagement.js +66 -0
  17. package/src/calendar/internal/utils.js +57 -0
  18. package/src/calendar/useCalendar.js +116 -0
  19. package/src/calendar/useCalendarDay.js +74 -0
  20. package/src/calendar/useSelection.js +202 -0
  21. package/src/column-picker/ColumnPicker.css.js +8 -0
  22. package/src/column-picker/ColumnPicker.js +108 -0
  23. package/src/column-picker/ColumnSearch.css.js +61 -0
  24. package/src/column-picker/ColumnSearch.js +66 -0
  25. package/src/column-picker/index.js +2 -0
  26. package/src/column-picker/moving-window.js +49 -0
  27. package/src/common-hooks/index.js +3 -0
  28. package/src/common-hooks/selectionTypes.js +8 -0
  29. package/src/common-hooks/use-resize-observer.js +122 -0
  30. package/src/common-hooks/useControlled.js +45 -0
  31. package/src/context-panel-provider/ContextPanelProvider.js +80 -0
  32. package/src/cycle-state-button/CycleStateButton.js +30 -0
  33. package/src/cycle-state-button/index.js +1 -0
  34. package/src/date-input/DateInput.css.js +195 -0
  35. package/src/date-input/DateInput.js +210 -0
  36. package/src/date-input/index.js +1 -0
  37. package/src/date-picker/DatePicker.js +137 -0
  38. package/src/date-picker/DatePickerContext.js +20 -0
  39. package/src/date-picker/DatePickerPanel.css.js +25 -0
  40. package/src/date-picker/DatePickerPanel.js +124 -0
  41. package/src/date-picker/index.js +1 -0
  42. package/src/drag-drop/DragDropProvider.js +123 -0
  43. package/src/drag-drop/DragDropState.js +25 -0
  44. package/src/drag-drop/Draggable.css.js +57 -0
  45. package/src/drag-drop/Draggable.js +77 -0
  46. package/src/drag-drop/DropIndicator.css.js +11 -0
  47. package/src/drag-drop/DropIndicator.js +28 -0
  48. package/src/drag-drop/dragDropTypes.js +3 -0
  49. package/src/drag-drop/drop-target-utils.js +199 -0
  50. package/src/drag-drop/index.js +6 -0
  51. package/src/drag-drop/useAutoScroll.js +53 -0
  52. package/src/drag-drop/useDragDisplacers.js +126 -0
  53. package/src/drag-drop/useDragDrop.js +435 -0
  54. package/src/drag-drop/useDragDropCopy.js +22 -0
  55. package/src/drag-drop/useDragDropIndicator.js +182 -0
  56. package/src/drag-drop/useDragDropNaturalMovement.js +205 -0
  57. package/src/drag-drop/useDropIndicator.js +21 -0
  58. package/src/drag-drop/useGlobalDragDrop.js +67 -0
  59. package/src/drag-drop/useTransition.js +11 -0
  60. package/src/editable/index.js +1 -0
  61. package/src/editable/useEditableText.js +199 -0
  62. package/src/editable-label/EditableLabel.css.js +81 -0
  63. package/src/editable-label/EditableLabel.js +125 -0
  64. package/src/editable-label/index.js +1 -0
  65. package/src/expando-input/ExpandoInput.css.js +67 -0
  66. package/src/expando-input/ExpandoInput.js +40 -0
  67. package/src/expando-input/index.js +1 -0
  68. package/src/highlighter/Highlighter.css.js +8 -0
  69. package/src/highlighter/Highlighter.js +27 -0
  70. package/src/highlighter/index.js +1 -0
  71. package/src/hover-overlay/HoverOverlay.js +92 -0
  72. package/src/icon-button/Icon.css.js +8 -0
  73. package/src/icon-button/Icon.js +26 -0
  74. package/src/icon-button/IconButton.css.js +10 -0
  75. package/src/icon-button/IconButton.js +28 -0
  76. package/src/icon-button/ToggleIconButton.css.js +47 -0
  77. package/src/icon-button/ToggleIconButton.js +26 -0
  78. package/src/icon-button/index.js +3 -0
  79. package/src/index.js +31 -0
  80. package/src/instrument-picker/SearchCell.css.js +17 -0
  81. package/src/instrument-picker/SearchCell.js +29 -0
  82. package/src/instrument-picker/TablePicker.css.js +23 -0
  83. package/src/instrument-picker/TablePicker.js +89 -0
  84. package/src/instrument-picker/index.js +1 -0
  85. package/src/instrument-picker/moving-window.js +49 -0
  86. package/src/instrument-picker/useDataSource.js +38 -0
  87. package/src/instrument-picker/useTablePicker.js +136 -0
  88. package/src/measured-container/MeasuredContainer.css.js +11 -0
  89. package/src/measured-container/MeasuredContainer.js +50 -0
  90. package/src/measured-container/index.js +2 -0
  91. package/src/measured-container/useMeasuredContainer.js +156 -0
  92. package/src/modal-provider/ModalProvider.js +147 -0
  93. package/src/overflow-container/OverflowContainer.css.js +135 -0
  94. package/src/overflow-container/OverflowContainer.js +87 -0
  95. package/src/overflow-container/index.js +2 -0
  96. package/src/overflow-container/overflow-utils.js +211 -0
  97. package/src/overflow-container/useOverflowContainer.js +108 -0
  98. package/src/price-ticker/PriceTicker.css.js +32 -0
  99. package/src/price-ticker/PriceTicker.js +51 -0
  100. package/src/price-ticker/index.js +1 -0
  101. package/src/prompt/Prompt.css.js +48 -0
  102. package/src/prompt/Prompt.js +112 -0
  103. package/src/sortable-list/SortableList.js +39 -0
  104. package/src/split-button/SplitButton.css.js +117 -0
  105. package/src/split-button/SplitButton.js +60 -0
  106. package/src/split-button/SplitStateButton.css.js +66 -0
  107. package/src/split-button/SplitStateButton.js +23 -0
  108. package/src/split-button/index.js +2 -0
  109. package/src/split-button/useSplitButton.js +61 -0
  110. package/src/table-search/SearchCell.css.js +20 -0
  111. package/src/table-search/SearchCell.js +26 -0
  112. package/src/table-search/TableSearch.css.js +27 -0
  113. package/src/table-search/TableSearch.js +81 -0
  114. package/src/table-search/index.js +1 -0
  115. package/src/table-search/moving-window.js +49 -0
  116. package/src/table-search/useTableSearch.js +30 -0
  117. package/src/tabs-next/TabBar.css.js +26 -0
  118. package/src/tabs-next/TabBar.js +27 -0
  119. package/src/tabs-next/TabListNext.css.js +36 -0
  120. package/src/tabs-next/TabListNext.js +94 -0
  121. package/src/tabs-next/TabNext.css.js +76 -0
  122. package/src/tabs-next/TabNext.js +91 -0
  123. package/src/tabs-next/TabNextAction.js +26 -0
  124. package/src/tabs-next/TabNextContext.js +14 -0
  125. package/src/tabs-next/TabNextPanel.css.js +17 -0
  126. package/src/tabs-next/TabNextPanel.js +69 -0
  127. package/src/tabs-next/TabNextTrigger.css.js +22 -0
  128. package/src/tabs-next/TabNextTrigger.js +66 -0
  129. package/src/tabs-next/TabOverflowList.css.js +77 -0
  130. package/src/tabs-next/TabOverflowList.js +115 -0
  131. package/src/tabs-next/TabsNext.js +149 -0
  132. package/src/tabs-next/TabsNextContext.js +28 -0
  133. package/src/tabs-next/hooks/useCollection.js +80 -0
  134. package/src/tabs-next/hooks/useFocusOutside.js +23 -0
  135. package/src/tabs-next/hooks/useOverflow.js +118 -0
  136. package/src/tabs-next/index.js +7 -0
  137. package/src/tabstrip/Tab.css.js +148 -0
  138. package/src/tabstrip/Tab.js +107 -0
  139. package/src/tabstrip/TabMenu.css.js +8 -0
  140. package/src/tabstrip/TabMenu.js +48 -0
  141. package/src/tabstrip/TabMenuOptions.js +14 -0
  142. package/src/tabstrip/TabsTypes.js +0 -0
  143. package/src/tabstrip/Tabstrip.css.js +121 -0
  144. package/src/tabstrip/Tabstrip.js +106 -0
  145. package/src/tabstrip/ThemeTabstrip.css.js +20 -0
  146. package/src/tabstrip/index.js +4 -0
  147. package/src/tabstrip/tabstrip-dom-utils.js +11 -0
  148. package/src/tabstrip/useAnimatedSelectionThumb.js +68 -0
  149. package/src/tabstrip/useKeyboardNavigation.js +191 -0
  150. package/src/tabstrip/useSelection.js +50 -0
  151. package/src/tabstrip/useTabstrip.js +181 -0
  152. package/src/time-input/MaskedInput.js +285 -0
  153. package/src/time-input/TimeInput.css.js +39 -0
  154. package/src/time-input/TimeInput.js +37 -0
  155. package/src/time-input/useTimeInput.js +82 -0
  156. package/src/toolbar/Toolbar.css.js +46 -0
  157. package/src/toolbar/Toolbar.js +62 -0
  158. package/src/toolbar/index.js +1 -0
  159. package/src/toolbar/toolbar-dom-utils.js +11 -0
  160. package/src/toolbar/useKeyboardNavigation.js +240 -0
  161. package/src/toolbar/useSelection.js +82 -0
  162. package/src/toolbar/useToolbar.js +73 -0
  163. package/src/utils/deprecated-types.js +0 -0
  164. package/src/utils/escapeRegExp.js +5 -0
  165. package/src/utils/forwardCallbackProps.js +15 -0
  166. package/src/utils/index.js +5 -0
  167. package/src/utils/isOverflowElement.js +2 -0
  168. package/src/utils/isPlainObject.js +2 -0
  169. package/src/vuu-date-picker/VuuDatePicker.js +92 -0
  170. package/src/vuu-date-picker/index.js +1 -0
  171. package/src/vuu-input/VuuInput.css.js +13 -0
  172. package/src/vuu-input/VuuInput.js +85 -0
  173. package/src/vuu-input/index.js +1 -0
  174. package/src/vuu-time-picker/TimeRangePicker.js +0 -0
  175. package/src/vuu-time-picker/VuuTimePicker.css.js +14 -0
  176. package/src/vuu-time-picker/VuuTimePicker.js +26 -0
  177. package/src/vuu-typeahead-input/VuuTypeaheadInput.css.js +49 -0
  178. package/src/vuu-typeahead-input/VuuTypeaheadInput.js +46 -0
  179. package/src/vuu-typeahead-input/index.js +1 -0
  180. package/src/vuu-typeahead-input/useVuuTypeaheadInput.js +140 -0
@@ -0,0 +1,94 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { capitalize, makePrefixer, useForkRef, useIsomorphicLayoutEffect } from "@salt-ds/core";
3
+ import { useComponentCssInjection } from "@salt-ds/styles";
4
+ import { useWindow } from "@salt-ds/window";
5
+ import { clsx } from "clsx";
6
+ import { forwardRef, useRef } from "react";
7
+ import TabListNext from "./TabListNext.css";
8
+ import { TabOverflowList } from "./TabOverflowList.js";
9
+ import { useTabsNext } from "./TabsNextContext.js";
10
+ import { useOverflow } from "./hooks/useOverflow.js";
11
+ const withBaseName = makePrefixer("saltTabListNext");
12
+ const TabListNext_TabListNext = /*#__PURE__*/ forwardRef(function(props, ref) {
13
+ const { appearance = "bordered", activeColor = "primary", children, className, onKeyDown, ...rest } = props;
14
+ const targetWindow = useWindow();
15
+ useComponentCssInjection({
16
+ testId: "salt-tablist-next",
17
+ css: TabListNext,
18
+ window: targetWindow
19
+ });
20
+ const { selected, getNext, getPrevious, getFirst, getLast, items, activeTab, menuOpen, setMenuOpen, returnFocus } = useTabsNext();
21
+ const tabstripRef = useRef(null);
22
+ const handleRef = useForkRef(tabstripRef, ref);
23
+ const overflowButtonRef = useRef(null);
24
+ const [visible, hidden, isMeasuring] = useOverflow({
25
+ container: tabstripRef,
26
+ tabs: items,
27
+ children,
28
+ selected,
29
+ overflowButton: overflowButtonRef
30
+ });
31
+ const handleKeyDown = (event)=>{
32
+ onKeyDown?.(event);
33
+ const actionMap = {
34
+ ArrowRight: getNext,
35
+ ArrowLeft: getPrevious,
36
+ Home: getFirst,
37
+ End: getLast,
38
+ ArrowUp: menuOpen ? getPrevious : void 0,
39
+ ArrowDown: menuOpen ? getNext : void 0
40
+ };
41
+ const action = actionMap[event.key];
42
+ if (action) {
43
+ event.preventDefault();
44
+ const activeTabId = activeTab.current?.id;
45
+ if (!activeTabId) return;
46
+ const nextItem = action(activeTabId);
47
+ if (nextItem) {
48
+ nextItem.element?.scrollIntoView({
49
+ block: "nearest",
50
+ inline: "nearest"
51
+ });
52
+ nextItem.element?.focus({
53
+ preventScroll: true
54
+ });
55
+ }
56
+ }
57
+ };
58
+ useIsomorphicLayoutEffect(()=>{
59
+ if (!returnFocus.current || visible.length < 1 || void 0 === selected) return;
60
+ const itemToFocus = items.find((i)=>i.value === returnFocus.current);
61
+ itemToFocus?.element?.focus({
62
+ preventScroll: true
63
+ });
64
+ requestAnimationFrame(()=>{
65
+ if (targetWindow?.document?.activeElement === itemToFocus?.element) returnFocus.current = void 0;
66
+ });
67
+ }, [
68
+ visible,
69
+ returnFocus,
70
+ targetWindow,
71
+ items,
72
+ selected
73
+ ]);
74
+ return /*#__PURE__*/ jsxs("div", {
75
+ role: "tablist",
76
+ className: clsx(withBaseName(), withBaseName(appearance), withBaseName("horizontal"), withBaseName(`activeColor${capitalize(activeColor)}`), className),
77
+ "data-ismeasuring": isMeasuring ? true : void 0,
78
+ ref: handleRef,
79
+ onKeyDown: handleKeyDown,
80
+ ...rest,
81
+ children: [
82
+ visible,
83
+ /*#__PURE__*/ jsx(TabOverflowList, {
84
+ isMeasuring: isMeasuring,
85
+ buttonRef: overflowButtonRef,
86
+ tabstripRef: tabstripRef,
87
+ open: menuOpen,
88
+ setOpen: setMenuOpen,
89
+ children: hidden
90
+ })
91
+ ]
92
+ });
93
+ });
94
+ export { TabListNext_TabListNext as TabListNext };
@@ -0,0 +1,76 @@
1
+ const css = `
2
+ .saltTabNext {
3
+ appearance: none;
4
+ justify-content: center;
5
+ align-items: center;
6
+ gap: var(--salt-spacing-100);
7
+ border: none;
8
+ border-left: var(--salt-size-border) var(--salt-container-borderStyle) transparent;
9
+ border-right: var(--salt-size-border) var(--salt-container-borderStyle) transparent;
10
+ white-space: pre;
11
+ min-height: calc(var(--salt-size-base) + var(--salt-spacing-100));
12
+ min-width: 4em;
13
+ padding: var(--salt-spacing-50) var(--salt-spacing-100);
14
+ box-sizing: border-box;
15
+ --tabNext-radius: var(--salt-palette-corner-weak, 0);
16
+ border-radius: var(--tab-radius) var(--tab-radius) 0 0;
17
+ cursor: var(--salt-navigable-cursor-hover);
18
+ color: var(--salt-content-primary-foreground);
19
+ font-weight: var(--salt-navigable-fontWeight);
20
+ font-family: var(--salt-text-fontFamily);
21
+ text-align: var(--salt-text-textAlign);
22
+ letter-spacing: var(--salt-text-letterSpacing);
23
+ line-height: var(--salt-text-lineHeight);
24
+ font-size: var(--salt-text-fontSize);
25
+ flex-shrink: 0;
26
+ display: inline-flex;
27
+ position: relative;
28
+ overflow: hidden;
29
+ }
30
+
31
+ .saltTabNext:after {
32
+ content: "";
33
+ left: calc(var(--salt-size-border) * -1);
34
+ right: calc(var(--salt-size-border) * -1);
35
+ height: var(--salt-size-indicator);
36
+ position: absolute;
37
+ }
38
+
39
+ .saltTabListNext-bordered .saltTabNext:after {
40
+ top: 0;
41
+ }
42
+
43
+ .saltTabListNext-transparent .saltTabNext:after {
44
+ bottom: 0;
45
+ }
46
+
47
+ .saltTabNext:hover:after, .saltTabNext-focusVisible:after {
48
+ background: var(--salt-navigable-indicator-hover);
49
+ }
50
+
51
+ .saltTabNext-disabled:hover:after, .saltTabNext-disabled.saltTabNext-focusVisible:after {
52
+ background: none;
53
+ }
54
+
55
+ .saltTabNext-focusVisible {
56
+ outline: var(--salt-focused-outline);
57
+ }
58
+
59
+ .saltTabListNext-bordered .saltTabNext.saltTabNext-selected {
60
+ background: var(--saltTabListNext-activeColor);
61
+ border-left: var(--salt-size-border) var(--salt-separable-borderStyle) var(--salt-separable-secondary-borderColor);
62
+ border-right: var(--salt-size-border) var(--salt-separable-borderStyle) var(--salt-separable-secondary-borderColor);
63
+ }
64
+
65
+ .saltTabNext.saltTabNext-selected:after {
66
+ background: var(--salt-navigable-indicator-active);
67
+ }
68
+
69
+ .saltTabNext.saltTabNext-disabled {
70
+ cursor: var(--salt-navigable-cursor-disabled);
71
+ color: var(--salt-content-primary-foreground-disabled);
72
+ }
73
+
74
+
75
+ `;
76
+ export default css;
@@ -0,0 +1,91 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { makePrefixer, useId } from "@salt-ds/core";
3
+ import { useComponentCssInjection } from "@salt-ds/styles";
4
+ import { useWindow } from "@salt-ds/window";
5
+ import { clsx } from "clsx";
6
+ import { forwardRef, useCallback, useMemo, useRef, useState } from "react";
7
+ import TabNext from "./TabNext.css";
8
+ import { TabNextContext } from "./TabNextContext.js";
9
+ import { useTabsNext } from "./TabsNextContext.js";
10
+ const withBaseName = makePrefixer("saltTabNext");
11
+ const TabNext_TabNext = /*#__PURE__*/ forwardRef(function(props, ref) {
12
+ const { "aria-labelledby": ariaLabelledBy, children, className, disabled: disabledProp, onBlur, onMouseDown, onFocus, onFocusCapture, value, id: idProp, ...rest } = props;
13
+ const targetWindow = useWindow();
14
+ useComponentCssInjection({
15
+ testId: "salt-tab-next",
16
+ css: TabNext,
17
+ window: targetWindow
18
+ });
19
+ const { selected, activeTab } = useTabsNext();
20
+ const disabled = !!disabledProp;
21
+ const id = useId(idProp);
22
+ const wasMouseDown = useRef(false);
23
+ const [focusVisible, setFocusVisible] = useState(false);
24
+ const [focused, setFocused] = useState(false);
25
+ const handleFocusCapture = (event)=>{
26
+ onFocusCapture?.(event);
27
+ if (value && id) activeTab.current = {
28
+ value,
29
+ id
30
+ };
31
+ };
32
+ const handleFocus = (event)=>{
33
+ onFocus?.(event);
34
+ setFocused(true);
35
+ if (!wasMouseDown.current && "tab" === event.target.getAttribute("role")) setFocusVisible(true);
36
+ wasMouseDown.current = false;
37
+ };
38
+ const handleBlur = (event)=>{
39
+ onBlur?.(event);
40
+ setFocused(false);
41
+ setFocusVisible(false);
42
+ };
43
+ const handleMouseDown = (event)=>{
44
+ onMouseDown?.(event);
45
+ wasMouseDown.current = true;
46
+ };
47
+ const [actions, setActions] = useState([]);
48
+ const registerAction = useCallback((id)=>{
49
+ setActions((old)=>old.concat(id));
50
+ return ()=>{
51
+ setActions((old)=>old.filter((action)=>action !== id));
52
+ };
53
+ }, []);
54
+ const context = useMemo(()=>({
55
+ tabId: id,
56
+ selected: selected === value,
57
+ focused,
58
+ value,
59
+ disabled,
60
+ actions,
61
+ registerAction
62
+ }), [
63
+ id,
64
+ selected,
65
+ value,
66
+ focused,
67
+ disabled,
68
+ actions,
69
+ registerAction
70
+ ]);
71
+ return /*#__PURE__*/ jsx(TabNextContext.Provider, {
72
+ value: context,
73
+ children: /*#__PURE__*/ jsx("div", {
74
+ className: clsx(withBaseName(), {
75
+ [withBaseName("selected")]: selected === value,
76
+ [withBaseName("disabled")]: disabled,
77
+ [withBaseName("focusVisible")]: focusVisible
78
+ }, className),
79
+ "data-overflowitem": "true",
80
+ ref: ref,
81
+ onMouseDown: handleMouseDown,
82
+ onFocusCapture: handleFocusCapture,
83
+ onFocus: handleFocus,
84
+ onBlur: handleBlur,
85
+ role: "presentation",
86
+ ...rest,
87
+ children: children
88
+ })
89
+ });
90
+ });
91
+ export { TabNext_TabNext as TabNext };
@@ -0,0 +1,26 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Button, useId, useIsomorphicLayoutEffect } from "@salt-ds/core";
3
+ import { clsx } from "clsx";
4
+ import { forwardRef } from "react";
5
+ import { useTabNext } from "./TabNextContext.js";
6
+ const TabNextAction_TabNextAction = /*#__PURE__*/ forwardRef(function(props, ref) {
7
+ const { "aria-labelledby": ariaLabelledBy, id: idProp, ...rest } = props;
8
+ const id = useId(idProp);
9
+ const { focused, selected, tabId, registerAction } = useTabNext();
10
+ useIsomorphicLayoutEffect(()=>{
11
+ if (id) return registerAction(id);
12
+ }, [
13
+ registerAction,
14
+ id
15
+ ]);
16
+ return /*#__PURE__*/ jsx(Button, {
17
+ id: id,
18
+ "aria-labelledby": clsx(ariaLabelledBy, tabId, id),
19
+ tabIndex: focused || selected ? void 0 : -1,
20
+ appearance: "transparent",
21
+ sentiment: "neutral",
22
+ ref: ref,
23
+ ...rest
24
+ });
25
+ });
26
+ export { TabNextAction_TabNextAction as TabNextAction };
@@ -0,0 +1,14 @@
1
+ import { createContext } from "@salt-ds/core";
2
+ import { useContext } from "react";
3
+ const TabNextContext = createContext("TabNextContext", {
4
+ focused: false,
5
+ selected: false,
6
+ disabled: false,
7
+ value: "",
8
+ actions: [],
9
+ registerAction: ()=>()=>void 0
10
+ });
11
+ function useTabNext() {
12
+ return useContext(TabNextContext);
13
+ }
14
+ export { TabNextContext, useTabNext };
@@ -0,0 +1,17 @@
1
+ const css = `
2
+ .saltTabNextPanel {
3
+ width: 100%;
4
+ height: 100%;
5
+ }
6
+
7
+ .saltTabNextPanel[hidden] {
8
+ display: none;
9
+ }
10
+
11
+ .saltTabNextPanel:focus-visible {
12
+ outline: var(--salt-focused-outline);
13
+ }
14
+
15
+
16
+ `;
17
+ export default css;
@@ -0,0 +1,69 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { makePrefixer, useForkRef, useId, useIsomorphicLayoutEffect } from "@salt-ds/core";
3
+ import { useComponentCssInjection } from "@salt-ds/styles";
4
+ import { useWindow } from "@salt-ds/window";
5
+ import { clsx } from "clsx";
6
+ import { forwardRef, useEffect, useRef, useState } from "react";
7
+ import { tabbable } from "tabbable";
8
+ import TabNextPanel_0 from "./TabNextPanel.css";
9
+ import { useTabsNext } from "./TabsNextContext.js";
10
+ const withBaseName = makePrefixer("saltTabNextPanel");
11
+ const TabNextPanel_TabNextPanel = /*#__PURE__*/ forwardRef(function(props, ref) {
12
+ const { className, children, id: idProp, value, ...rest } = props;
13
+ const targetWindow = useWindow();
14
+ useComponentCssInjection({
15
+ testId: "salt-tab-next-panel",
16
+ css: TabNextPanel_0,
17
+ window: targetWindow
18
+ });
19
+ const id = useId(idProp);
20
+ const { registerPanel, getTabId, selected } = useTabsNext();
21
+ const panelRef = useRef(null);
22
+ const handleRef = useForkRef(panelRef, ref);
23
+ useIsomorphicLayoutEffect(()=>{
24
+ if (value && id) return registerPanel(id, value);
25
+ }, [
26
+ value,
27
+ id,
28
+ registerPanel
29
+ ]);
30
+ const [hasFocusableChildren, setHasFocusableChildren] = useState(false);
31
+ useEffect(()=>{
32
+ if (!panelRef.current) return;
33
+ const detectFocusableChildren = ()=>{
34
+ requestAnimationFrame(()=>{
35
+ if (!panelRef.current) return;
36
+ const elements = tabbable(panelRef.current);
37
+ setHasFocusableChildren(elements.length > 0);
38
+ });
39
+ };
40
+ const observer = new MutationObserver(()=>{
41
+ detectFocusableChildren();
42
+ });
43
+ requestAnimationFrame(()=>{
44
+ detectFocusableChildren();
45
+ });
46
+ observer.observe(panelRef.current, {
47
+ childList: true,
48
+ subtree: true,
49
+ attributes: true
50
+ });
51
+ return ()=>{
52
+ observer.disconnect();
53
+ };
54
+ }, []);
55
+ const hidden = selected !== value;
56
+ const tabId = getTabId(value);
57
+ return /*#__PURE__*/ jsx("div", {
58
+ id: id,
59
+ ref: handleRef,
60
+ role: "tabpanel",
61
+ "aria-labelledby": tabId,
62
+ className: clsx(withBaseName(), className),
63
+ hidden: hidden || void 0,
64
+ tabIndex: hidden || hasFocusableChildren ? void 0 : 0,
65
+ ...rest,
66
+ children: children
67
+ });
68
+ });
69
+ export { TabNextPanel_TabNextPanel as TabNextPanel };
@@ -0,0 +1,22 @@
1
+ const css = `
2
+ .saltTabNextTrigger {
3
+ all: unset;
4
+ gap: var(--salt-spacing-100);
5
+ flex: 1;
6
+ justify-content: center;
7
+ align-items: center;
8
+ display: flex;
9
+ }
10
+
11
+ .saltTabNextTrigger:before {
12
+ content: "";
13
+ width: 100%;
14
+ height: 100%;
15
+ position: absolute;
16
+ top: 0;
17
+ left: 0;
18
+ }
19
+
20
+
21
+ `;
22
+ export default css;
@@ -0,0 +1,66 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { makePrefixer, useForkRef, useIsomorphicLayoutEffect } from "@salt-ds/core";
3
+ import { useComponentCssInjection } from "@salt-ds/styles";
4
+ import { useWindow } from "@salt-ds/window";
5
+ import { clsx } from "clsx";
6
+ import { forwardRef, useRef } from "react";
7
+ import { useTabNext } from "./TabNextContext.js";
8
+ import TabNextTrigger_0 from "./TabNextTrigger.css";
9
+ import { useTabsNext } from "./TabsNextContext.js";
10
+ const withBaseName = makePrefixer("saltTabNextTrigger");
11
+ function getAriaDescription(count) {
12
+ if (count < 1) return;
13
+ if (1 === count) return "1 action available";
14
+ return `${count} actions available`;
15
+ }
16
+ const TabNextTrigger_TabNextTrigger = /*#__PURE__*/ forwardRef(function(props, ref) {
17
+ const { children, id: idProp, onClick, onKeyDown, ...rest } = props;
18
+ const targetWindow = useWindow();
19
+ useComponentCssInjection({
20
+ testId: "salt-tab-next-trigger",
21
+ css: TabNextTrigger_0,
22
+ window: targetWindow
23
+ });
24
+ const { setSelected, registerTab, getPanelId } = useTabsNext();
25
+ const { selected, value, focused, disabled, tabId, actions } = useTabNext();
26
+ const tabRef = useRef(null);
27
+ const id = tabId;
28
+ useIsomorphicLayoutEffect(()=>{
29
+ if (value && id && tabRef.current) return registerTab({
30
+ id,
31
+ value,
32
+ element: tabRef.current
33
+ });
34
+ }, [
35
+ value,
36
+ id,
37
+ registerTab
38
+ ]);
39
+ const handleClick = (event)=>{
40
+ setSelected(event, value);
41
+ };
42
+ const handleKeyDown = (event)=>{
43
+ onKeyDown?.(event);
44
+ if ("Enter" === event.key || " " === event.key) setSelected(event, value);
45
+ };
46
+ const handleRef = useForkRef(tabRef, ref);
47
+ const panelId = getPanelId(value);
48
+ return /*#__PURE__*/ jsx("button", {
49
+ "aria-selected": selected,
50
+ "aria-disabled": disabled,
51
+ "aria-controls": panelId,
52
+ "aria-actions": clsx(actions) || void 0,
53
+ "aria-description": getAriaDescription(actions.length),
54
+ tabIndex: focused || selected ? void 0 : -1,
55
+ role: "tab",
56
+ type: "button",
57
+ onClick: disabled ? void 0 : handleClick,
58
+ onKeyDown: disabled ? void 0 : handleKeyDown,
59
+ className: withBaseName(),
60
+ id: id,
61
+ ref: handleRef,
62
+ ...rest,
63
+ children: children
64
+ });
65
+ });
66
+ export { TabNextTrigger_TabNextTrigger as TabNextTrigger };
@@ -0,0 +1,77 @@
1
+ const css = `
2
+ .saltTabOverflow {
3
+ position: relative;
4
+ }
5
+
6
+ .saltTabOverflow-list {
7
+ background: var(--salt-container-primary-background);
8
+ border: var(--salt-size-border) var(--salt-selectable-borderStyle-selected) var(--salt-selectable-borderColor-selected);
9
+ z-index: var(--salt-zIndex-flyover);
10
+ box-shadow: var(--salt-overlayable-shadow-popout);
11
+ box-sizing: border-box;
12
+ border-radius: var(--salt-palette-corner, 0);
13
+ position: absolute;
14
+ overflow: hidden auto;
15
+ }
16
+
17
+ .saltTabOverflow-listContainer {
18
+ gap: var(--salt-size-border);
19
+ max-height: inherit;
20
+ min-height: inherit;
21
+ flex-direction: column;
22
+ display: flex;
23
+ }
24
+
25
+ .saltTabOverflow-list[data-hidden="true"] {
26
+ opacity: 0;
27
+ pointer-events: none;
28
+ }
29
+
30
+ .saltTabOverflow-list .saltTabNext {
31
+ color: var(--salt-content-primary-foreground);
32
+ background: var(--salt-selectable-background);
33
+ font-size: var(--salt-text-fontSize);
34
+ font-weight: var(--salt-text-fontWeight);
35
+ min-height: calc(var(--salt-size-base) + var(--salt-spacing-100));
36
+ padding-left: var(--salt-spacing-100);
37
+ padding-right: var(--salt-spacing-100);
38
+ gap: var(--salt-spacing-100);
39
+ cursor: var(--salt-selectable-cursor-hover);
40
+ box-sizing: border-box;
41
+ flex-shrink: 0;
42
+ justify-content: flex-start;
43
+ align-items: center;
44
+ display: flex;
45
+ position: relative;
46
+ }
47
+
48
+ .saltTabOverflow-list .saltTabNext .saltTabNextTrigger {
49
+ justify-content: start;
50
+ }
51
+
52
+ .saltTabOverflow-list .saltTabNext:after {
53
+ display: none;
54
+ }
55
+
56
+ .saltTabOverflow-list .saltTabNext[aria-disabled="true"] {
57
+ color: var(--salt-content-primary-foreground-disabled);
58
+ cursor: var(--salt-selectable-cursor-disabled);
59
+ }
60
+
61
+ .saltTabOverflow-list .saltTabNext-focusVisible {
62
+ outline: var(--salt-focused-outline);
63
+ outline-offset: calc(var(--salt-size-border) * -2);
64
+ }
65
+
66
+ .saltTabOverflow-list .saltTabNext:hover {
67
+ background: var(--salt-selectable-background-hover);
68
+ }
69
+
70
+ .saltTabOverflow-list .saltTabNext:active {
71
+ background: var(--salt-selectable-background-selected);
72
+ box-shadow: 0 calc(var(--salt-size-border) * -1) 0 0 var(--salt-selectable-borderColor-selected), 0 var(--salt-size-border) 0 0 var(--salt-selectable-borderColor-selected);
73
+ }
74
+
75
+
76
+ `;
77
+ export default css;
@@ -0,0 +1,115 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { FloatingTree, offset, size, useDismiss, useInteractions } from "@floating-ui/react";
3
+ import { Button, makePrefixer, useFloatingUI, useForkRef, useIcon, useId } from "@salt-ds/core";
4
+ import { useComponentCssInjection } from "@salt-ds/styles";
5
+ import { useWindow } from "@salt-ds/window";
6
+ import { Children, forwardRef, useCallback, useRef } from "react";
7
+ import TabOverflowList_0 from "./TabOverflowList.css";
8
+ import { useFocusOutside } from "./hooks/useFocusOutside.js";
9
+ const withBaseName = makePrefixer("saltTabOverflow");
10
+ const TabOverflowList_TabOverflowList = /*#__PURE__*/ forwardRef(function(props, ref) {
11
+ const { buttonRef, tabstripRef, children, isMeasuring, open, setOpen, ...rest } = props;
12
+ const targetWindow = useWindow();
13
+ useComponentCssInjection({
14
+ testId: "salt-tabs-next-overflow-list",
15
+ css: TabOverflowList_0,
16
+ window: targetWindow
17
+ });
18
+ const { OverflowIcon } = useIcon();
19
+ const { refs, x, y, strategy, context } = useFloatingUI({
20
+ open: open,
21
+ onOpenChange (open, _, reason) {
22
+ if ("escape-key" === reason) queueMicrotask(()=>{
23
+ const allTabs = tabstripRef.current?.querySelectorAll('[role="tab"]:not([aria-hidden])') ?? [];
24
+ const numberOfTabsInOverflow = listRef.current?.querySelectorAll('[role="tab"]').length ?? 0;
25
+ allTabs[allTabs.length - numberOfTabsInOverflow - 1]?.focus({
26
+ preventScroll: true
27
+ });
28
+ });
29
+ setOpen(open);
30
+ },
31
+ placement: "bottom-start",
32
+ middleware: [
33
+ offset(1),
34
+ size({
35
+ apply ({ elements, availableHeight }) {
36
+ Object.assign(elements.floating.style, {
37
+ maxHeight: `max(calc((var(--salt-size-base) + var(--salt-spacing-100)) * 5), calc(${availableHeight}px - var(--salt-spacing-100)))`
38
+ });
39
+ }
40
+ })
41
+ ]
42
+ });
43
+ const { getFloatingProps } = useInteractions([
44
+ useDismiss(context)
45
+ ]);
46
+ const rootRef = useRef(null);
47
+ const handleRootRef = useForkRef(rootRef, ref);
48
+ const listRef = useRef(null);
49
+ const handleListRef = useForkRef(listRef, refs.setFloating);
50
+ const handleFocusOutside = useCallback(()=>{
51
+ setOpen(false);
52
+ }, [
53
+ setOpen
54
+ ]);
55
+ useFocusOutside(rootRef, handleFocusOutside, open, "[data-floating-ui-portal]");
56
+ const handleClick = ()=>{
57
+ if (open) setOpen(false);
58
+ else listRef.current?.querySelectorAll('[role="tab"]')[0]?.focus({
59
+ preventScroll: true
60
+ });
61
+ };
62
+ const handleFocus = ()=>{
63
+ setOpen(true);
64
+ };
65
+ const handleButtonRef = useForkRef(buttonRef, refs.setReference);
66
+ const listId = useId();
67
+ const childCount = Children.count(children);
68
+ if (0 === childCount && !isMeasuring) return null;
69
+ return /*#__PURE__*/ jsxs("div", {
70
+ className: withBaseName(),
71
+ ref: handleRootRef,
72
+ children: [
73
+ /*#__PURE__*/ jsx(Button, {
74
+ "data-overflowbutton": true,
75
+ tabIndex: -1,
76
+ appearance: "transparent",
77
+ sentiment: "neutral",
78
+ onClick: handleClick,
79
+ ref: handleButtonRef,
80
+ "aria-label": `Overflow menu. ${childCount} tabs hidden`,
81
+ "aria-expanded": open,
82
+ "aria-controls": listId,
83
+ "aria-hidden": "true",
84
+ role: "tab",
85
+ "aria-haspopup": true,
86
+ ...rest,
87
+ children: /*#__PURE__*/ jsx(OverflowIcon, {
88
+ "aria-hidden": true
89
+ })
90
+ }),
91
+ /*#__PURE__*/ jsx(FloatingTree, {
92
+ children: /*#__PURE__*/ jsx("div", {
93
+ ref: handleListRef,
94
+ ...getFloatingProps({
95
+ onFocus: handleFocus,
96
+ role: "presentation"
97
+ }),
98
+ className: withBaseName("list"),
99
+ "data-hidden": !open,
100
+ style: open ? {
101
+ left: x ?? 0,
102
+ top: y ?? 0,
103
+ position: strategy
104
+ } : void 0,
105
+ id: listId,
106
+ children: /*#__PURE__*/ jsx("div", {
107
+ className: withBaseName("listContainer"),
108
+ children: children
109
+ })
110
+ })
111
+ })
112
+ ]
113
+ });
114
+ });
115
+ export { TabOverflowList_TabOverflowList as TabOverflowList };