@trackunit/react-components 8.0.7 → 8.0.9-alpha-3123793ad15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +143 -21
- package/index.esm.js +144 -22
- package/migrations/assets/react-router-components/package.json +6 -6
- package/migrations/entry.js.map +1 -0
- package/migrations/utils/jsx-utils.js.map +1 -0
- package/migrations/utils/move-named-imports.js.map +1 -0
- package/migrations/utils/package-json-utils.js.map +1 -0
- package/migrations/v2-0-0/breadcrumb-remove-deprecated-props.js.map +1 -0
- package/migrations/v2-0-0/cardheader-onclickclose-to-actions.js.map +1 -0
- package/migrations/v2-0-0/iconbutton-add-required-name.js.map +1 -0
- package/migrations/v2-0-0/kpi-tooltiplabel-to-wrapper.js.map +1 -0
- package/migrations/v2-0-0/notice-tooltiplabel-to-wrapper.js.map +1 -0
- package/migrations/v2-0-0/pagination-add-required-titles.js.map +1 -0
- package/migrations/v2-0-0/tag-add-removetaglabel.js.map +1 -0
- package/migrations/v2-0-0/togglegroup-remove-item-style.js.map +1 -0
- package/migrations/v2-6-0/menulist-rename-to-menucontent.js.map +1 -0
- package/migrations/v3-0-0/copyabletext-to-text-copybutton.js.map +1 -0
- package/migrations/v4-0-0/move-to-router-components.js.map +1 -0
- package/migrations/v8-0-0/collapse-native-details.js.map +1 -0
- package/package.json +6 -6
- package/src/components/Card/Card.d.ts +7 -1
- package/src/components/Card/Card.variants.d.ts +15 -1
- package/src/components/Popover/PopoverContent.d.ts +10 -1
- package/src/components/Popover/PopoverTypes.d.ts +10 -2
- package/src/components/Popover/usePopover.d.ts +1 -1
- package/src/components/Popover/utils/keyboardFocus/keyboardFocus.d.ts +13 -0
- package/src/components/Tooltip/Tooltip.d.ts +1 -1
- package/src/components/Tooltip/Tooltip.variants.d.ts +12 -6
- package/translation.cjs.js +1 -1
- package/translation.esm.js +1 -1
- package/translation11.cjs.js +1 -1
- package/translation11.esm.js +1 -1
- package/translation12.cjs.js +1 -1
- package/translation12.esm.js +1 -1
- package/translation6.cjs.js +1 -1
- package/translation6.esm.js +1 -1
package/index.cjs.js
CHANGED
|
@@ -765,7 +765,83 @@ const useHoverScrollGuard = ({ enabled, hoverEnabled, openSiblingPinned, isOpen,
|
|
|
765
765
|
return enabled && isHoverScrollSuppressed;
|
|
766
766
|
};
|
|
767
767
|
|
|
768
|
-
|
|
768
|
+
/**
|
|
769
|
+
* `useFocus` treats `:focus-visible` as keyboard focus. jsdom reports that for every focus, and a
|
|
770
|
+
* programmatic `focus()` would otherwise open the popover and consume the next Escape. A key press
|
|
771
|
+
* is the signal we keep.
|
|
772
|
+
*
|
|
773
|
+
* One shared listener pair for every popover that opts into focus activation. A per-instance
|
|
774
|
+
* listener would add a capture-phase `keydown` and `pointerdown` handler, plus a timer, for every
|
|
775
|
+
* tooltip on the page.
|
|
776
|
+
*/
|
|
777
|
+
let keyboardFocus = false;
|
|
778
|
+
let subscribers = 0;
|
|
779
|
+
let outerFrame = 0;
|
|
780
|
+
let innerFrame = 0;
|
|
781
|
+
const cancelClear = () => {
|
|
782
|
+
if (outerFrame !== 0) {
|
|
783
|
+
cancelAnimationFrame(outerFrame);
|
|
784
|
+
outerFrame = 0;
|
|
785
|
+
}
|
|
786
|
+
if (innerFrame !== 0) {
|
|
787
|
+
cancelAnimationFrame(innerFrame);
|
|
788
|
+
innerFrame = 0;
|
|
789
|
+
}
|
|
790
|
+
};
|
|
791
|
+
const clearKeyboardFocus = () => {
|
|
792
|
+
keyboardFocus = false;
|
|
793
|
+
cancelClear();
|
|
794
|
+
};
|
|
795
|
+
const markKeyboardFocus = (event) => {
|
|
796
|
+
// Escape closes a menu or dialog, which hands focus back to its trigger. That return is not
|
|
797
|
+
// navigation, so it must not open the trigger's tooltip.
|
|
798
|
+
if (event.key === "Escape") {
|
|
799
|
+
clearKeyboardFocus();
|
|
800
|
+
return;
|
|
801
|
+
}
|
|
802
|
+
keyboardFocus = true;
|
|
803
|
+
cancelClear();
|
|
804
|
+
// Tab moves focus in this key's default action, before either frame below. Menu navigation
|
|
805
|
+
// focuses the next item from Floating UI's requestAnimationFrame, which is later than a 0ms
|
|
806
|
+
// timeout, so the flag has to survive that frame. The frame after clears it: a programmatic
|
|
807
|
+
// focus() that was not caused by this key must not open a tooltip or take the next Escape.
|
|
808
|
+
outerFrame = requestAnimationFrame(() => {
|
|
809
|
+
outerFrame = 0;
|
|
810
|
+
innerFrame = requestAnimationFrame(() => {
|
|
811
|
+
keyboardFocus = false;
|
|
812
|
+
innerFrame = 0;
|
|
813
|
+
});
|
|
814
|
+
});
|
|
815
|
+
};
|
|
816
|
+
/**
|
|
817
|
+
* Installs the shared listeners on the first subscriber and removes them when the last one leaves.
|
|
818
|
+
*
|
|
819
|
+
* @returns {() => void} Unsubscribes this caller.
|
|
820
|
+
*/
|
|
821
|
+
const subscribeToKeyboardFocus = () => {
|
|
822
|
+
if (subscribers === 0) {
|
|
823
|
+
window.addEventListener("keydown", markKeyboardFocus, true);
|
|
824
|
+
window.addEventListener("pointerdown", clearKeyboardFocus, true);
|
|
825
|
+
}
|
|
826
|
+
subscribers += 1;
|
|
827
|
+
return () => {
|
|
828
|
+
subscribers -= 1;
|
|
829
|
+
if (subscribers === 0) {
|
|
830
|
+
window.removeEventListener("keydown", markKeyboardFocus, true);
|
|
831
|
+
window.removeEventListener("pointerdown", clearKeyboardFocus, true);
|
|
832
|
+
clearKeyboardFocus();
|
|
833
|
+
}
|
|
834
|
+
};
|
|
835
|
+
};
|
|
836
|
+
/**
|
|
837
|
+
* Whether the most recent input was a key press that should count as keyboard focus.
|
|
838
|
+
*
|
|
839
|
+
* @returns {boolean} True until the key's focus change has been handled, including one scheduled for the
|
|
840
|
+
* next frame, or a pointer press or Escape clears it.
|
|
841
|
+
*/
|
|
842
|
+
const isKeyboardFocus = () => keyboardFocus;
|
|
843
|
+
|
|
844
|
+
const DEFAULT_ACTIVATION = { click: true, hover: false, keyboardHandlers: true, focus: false };
|
|
769
845
|
const DEFAULT_DISMISSAL = {
|
|
770
846
|
enabled: true,
|
|
771
847
|
outsidePress: true,
|
|
@@ -838,7 +914,7 @@ const getNestedVerticalAlignmentAxis = ({ rects }) => {
|
|
|
838
914
|
* @param {PopoverProps} options The options for the popover
|
|
839
915
|
* @returns {UsePopoverType} The data for the popover
|
|
840
916
|
*/
|
|
841
|
-
const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen: controlledIsOpen, activation = DEFAULT_ACTIVATION, dismissal = DEFAULT_DISMISSAL, sizing = DEFAULT_SIZING, onOpenStateChange, role = "dialog", id, className, "data-testid": dataTestId, }) => {
|
|
917
|
+
const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen: controlledIsOpen, activation = DEFAULT_ACTIVATION, dismissal = DEFAULT_DISMISSAL, sizing = DEFAULT_SIZING, onOpenStateChange, role = "dialog", roleEnabled = true, id, className, "data-testid": dataTestId, }) => {
|
|
842
918
|
const [uncontrolledIsOpen, setUncontrolledIsOpen] = react.useState(initialOpen);
|
|
843
919
|
const [labelId, setLabelId] = react.useState();
|
|
844
920
|
const [descriptionId, setDescriptionId] = react.useState();
|
|
@@ -949,6 +1025,9 @@ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen
|
|
|
949
1025
|
placement,
|
|
950
1026
|
open: isOpen,
|
|
951
1027
|
onOpenChange: (open, _event, reason) => {
|
|
1028
|
+
if (open && reason === "focus" && !isKeyboardFocus()) {
|
|
1029
|
+
return;
|
|
1030
|
+
}
|
|
952
1031
|
setUncontrolledIsOpen(open);
|
|
953
1032
|
onOpenStateChange?.(open);
|
|
954
1033
|
// Reset to `undefined` on close (regardless of *how* it closed) rather than keeping the close
|
|
@@ -979,8 +1058,15 @@ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen
|
|
|
979
1058
|
}, [isOpen, popoverData.update]);
|
|
980
1059
|
const popoverContext = popoverData.context;
|
|
981
1060
|
const resolvedActivation = typeof activation === "function" ? activation(DEFAULT_ACTIVATION) : activation;
|
|
1061
|
+
const focusEnabled = resolvedActivation.focus === true;
|
|
1062
|
+
react.useEffect(() => {
|
|
1063
|
+
if (!focusEnabled) {
|
|
1064
|
+
return;
|
|
1065
|
+
}
|
|
1066
|
+
return subscribeToKeyboardFocus();
|
|
1067
|
+
}, [focusEnabled]);
|
|
982
1068
|
const resolvedDismissal = typeof dismissal === "function" ? dismissal(DEFAULT_DISMISSAL) : dismissal;
|
|
983
|
-
const { outsidePress: configuredOutsidePress, ...restDismissal } = resolvedDismissal;
|
|
1069
|
+
const { outsidePress: configuredOutsidePress, bubbles: configuredBubbles, ...restDismissal } = resolvedDismissal;
|
|
984
1070
|
const clickInteraction = react$1.useClick(popoverContext, {
|
|
985
1071
|
enabled: resolvedActivation.click,
|
|
986
1072
|
keyboardHandlers: resolvedActivation.keyboardHandlers,
|
|
@@ -1012,10 +1098,21 @@ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen
|
|
|
1012
1098
|
}
|
|
1013
1099
|
return true;
|
|
1014
1100
|
},
|
|
1015
|
-
// Nested in a MenuTree: Escape closes one level at a time
|
|
1016
|
-
//
|
|
1017
|
-
//
|
|
1018
|
-
|
|
1101
|
+
// Nested in a MenuTree: Escape closes one level at a time unless the caller opts out.
|
|
1102
|
+
// Tooltips do: a hint must not swallow the Escape that dismisses the menu. Outside-press
|
|
1103
|
+
// bubbles only when the press is genuinely outside the tree; sibling-row presses are filtered
|
|
1104
|
+
// above so they don't collapse the root menu.
|
|
1105
|
+
// Other popovers keep Floating UI's default (Escape does not bubble) unless the caller asks
|
|
1106
|
+
// otherwise.
|
|
1107
|
+
bubbles: isInsideMenuTree
|
|
1108
|
+
? {
|
|
1109
|
+
escapeKey: false,
|
|
1110
|
+
outsidePress: true,
|
|
1111
|
+
...(typeof configuredBubbles === "boolean"
|
|
1112
|
+
? { escapeKey: configuredBubbles, outsidePress: configuredBubbles }
|
|
1113
|
+
: configuredBubbles),
|
|
1114
|
+
}
|
|
1115
|
+
: configuredBubbles,
|
|
1019
1116
|
});
|
|
1020
1117
|
const hoverOptions = typeof resolvedActivation.hover === "object" ? resolvedActivation.hover : undefined;
|
|
1021
1118
|
const hoverEnabled = hoverOptions ? (hoverOptions.active ?? true) : resolvedActivation.hover === true;
|
|
@@ -1091,6 +1188,12 @@ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen
|
|
|
1091
1188
|
popoverContext,
|
|
1092
1189
|
referenceRef: popoverData.refs.reference,
|
|
1093
1190
|
});
|
|
1191
|
+
const focusInteraction = react$1.useFocus(popoverContext, {
|
|
1192
|
+
// `visibleOnly` keeps pointer focus from opening the popover. Keyboard focus still matches
|
|
1193
|
+
// `:focus-visible`.
|
|
1194
|
+
enabled: focusEnabled,
|
|
1195
|
+
visibleOnly: true,
|
|
1196
|
+
});
|
|
1094
1197
|
const hoverInteraction = react$1.useHover(popoverContext, {
|
|
1095
1198
|
enabled: hoverEnabled && !openSiblingPinned && !isHoverScrollSuppressed,
|
|
1096
1199
|
delay: isHoverDelayed && !hasOpenSibling ? { open: 400 } : undefined,
|
|
@@ -1121,9 +1224,7 @@ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen
|
|
|
1121
1224
|
? react$1.safePolygon({ blockPointerEvents: isInsideMenuTree })
|
|
1122
1225
|
: undefined,
|
|
1123
1226
|
});
|
|
1124
|
-
const
|
|
1125
|
-
const focusInteraction = react$1.useFocus(popoverContext, { enabled: focusEnabled });
|
|
1126
|
-
const roleInteraction = react$1.useRole(popoverContext, { role });
|
|
1227
|
+
const roleInteraction = react$1.useRole(popoverContext, { enabled: roleEnabled, role });
|
|
1127
1228
|
// Distinguishes a genuine open -> close transition from this node simply mounting closed (the
|
|
1128
1229
|
// common case: every unrelated sibling elsewhere in the tree mounts with `isOpen === false`).
|
|
1129
1230
|
// Without this, that initial "closed" render would emit `MENU_TREE_CLOSE_EVENT` regardless, and
|
|
@@ -1381,14 +1482,14 @@ const withVisibilityCheck = (sourceRef) => ({
|
|
|
1381
1482
|
* @param {PopoverContentProps} props - The props for the PopoverContent component
|
|
1382
1483
|
* @returns {ReactElement} The popover content element
|
|
1383
1484
|
*/
|
|
1384
|
-
const PopoverContent = function PopoverContent({ className, "data-testid": dataTestId, children, portalId, initialFocus, returnFocus = true, ref: propRef, ...props }) {
|
|
1485
|
+
const PopoverContent = function PopoverContent({ className, "data-testid": dataTestId, children, portalId, initialFocus, returnFocus = true, guards = true, ref: propRef, ...props }) {
|
|
1385
1486
|
const { context: floatingContext, customProps, ...context } = usePopoverContext();
|
|
1386
1487
|
const ref = react$1.useMergeRefs([context.refs.setFloating, propRef]);
|
|
1387
1488
|
// Only a ref-based `returnFocus` has a concrete target to check -- the `boolean` case defers to
|
|
1388
1489
|
// Floating UI's own app-wide "previously focused element" tracking, which isn't exposed here to
|
|
1389
1490
|
// check against.
|
|
1390
1491
|
const resolvedReturnFocus = typeof returnFocus === "boolean" ? returnFocus : withVisibilityCheck(returnFocus);
|
|
1391
|
-
return (jsxRuntime.jsx(react$1.FloatingPortal, { id: portalId, root: document.body, children: context.isOpen === true ? (jsxRuntime.jsx(react$1.FloatingFocusManager, { closeOnFocusOut: context.closeOnFocusOut, context: floatingContext, guards:
|
|
1492
|
+
return (jsxRuntime.jsx(react$1.FloatingPortal, { id: portalId, preserveTabOrder: guards, root: document.body, children: context.isOpen === true ? (jsxRuntime.jsx(react$1.FloatingFocusManager, { closeOnFocusOut: context.closeOnFocusOut, context: floatingContext, guards: guards, initialFocus: initialFocus, modal: context.isModal, order: ["reference", "content"], returnFocus: resolvedReturnFocus, children: jsxRuntime.jsx("div", { "aria-describedby": context.descriptionId, "aria-labelledby": context.labelId, className: cvaPopoverContainer({ className: className ?? customProps.className }), "data-testid": dataTestId ?? customProps["data-testid"] ?? "popover-content", ref: ref, style: {
|
|
1392
1493
|
position: context.strategy,
|
|
1393
1494
|
top: context.y,
|
|
1394
1495
|
left: context.x,
|
|
@@ -2102,12 +2203,21 @@ const Text = ({ children, type = "p", size = "medium", align = "left", weight =
|
|
|
2102
2203
|
};
|
|
2103
2204
|
Text.displayName = "Text";
|
|
2104
2205
|
|
|
2206
|
+
const cvaTooltipTrigger = cssClassVarianceUtilities.cva({
|
|
2207
|
+
base: ["group", "inline-flex", "cursor-pointer", "border-0", "bg-transparent", "p-0"],
|
|
2208
|
+
});
|
|
2105
2209
|
const cvaTooltipIcon = cssClassVarianceUtilities.cva({
|
|
2106
|
-
base: [
|
|
2210
|
+
base: [
|
|
2211
|
+
"text-neutral-300",
|
|
2212
|
+
"transition",
|
|
2213
|
+
"hover:cursor-pointer",
|
|
2214
|
+
"hover:text-neutral-400",
|
|
2215
|
+
"group-focus-visible:text-neutral-400",
|
|
2216
|
+
],
|
|
2107
2217
|
variants: {
|
|
2108
2218
|
color: {
|
|
2109
|
-
light: "hover:text-white",
|
|
2110
|
-
dark: "hover:text-neutral-400",
|
|
2219
|
+
light: ["hover:text-white", "group-focus-visible:text-white"],
|
|
2220
|
+
dark: ["hover:text-neutral-400", "group-focus-visible:text-neutral-400"],
|
|
2111
2221
|
},
|
|
2112
2222
|
defaultVariants: {
|
|
2113
2223
|
color: "dark",
|
|
@@ -2165,7 +2275,7 @@ const FloatingArrowContainer = ({ arrowRef, mode = "dark", }) => {
|
|
|
2165
2275
|
return (jsxRuntime.jsx(react$1.FloatingArrow, { className: cvaTooltipPopoverTail({ mode, placement: floatingContext.placement }), context: floatingContext, ref: arrowRef }));
|
|
2166
2276
|
};
|
|
2167
2277
|
/**
|
|
2168
|
-
* Tooltips display additional information upon hover
|
|
2278
|
+
* Tooltips display additional information upon hover, and on keyboard focus with `openOnFocus`. The information included should be contextual, helpful, and nonessential while providing that extra ability to communicate and give clarity to a user.
|
|
2169
2279
|
*
|
|
2170
2280
|
* Tooltips should be used sparingly and contain succinct, supplementary information, and they should contain read-only text. **❗️Do not include interactive elements in tooltips ** (no links, buttons, etc). Interactive elements in tooltips are inaccessible since tooltips do not receive focus.
|
|
2171
2281
|
*
|
|
@@ -2222,8 +2332,11 @@ const Tooltip = ({ children, "data-testid": dataTestId, disabled = false, label,
|
|
|
2222
2332
|
setIsOpen(false);
|
|
2223
2333
|
}
|
|
2224
2334
|
// A label that repeats the trigger's accessible name would be read twice as its description.
|
|
2225
|
-
|
|
2226
|
-
|
|
2335
|
+
// The default icon trigger is always named with the label.
|
|
2336
|
+
const labelIsTriggerName = children === undefined ||
|
|
2337
|
+
(react.isValidElement(children) &&
|
|
2338
|
+
(children.props.ariaLabel === label || children.props["aria-label"] === label));
|
|
2339
|
+
const { className: iconClassName, ...restIconProps } = iconProps ?? {};
|
|
2227
2340
|
const arrowRef = react.useRef(null);
|
|
2228
2341
|
const { refs, floatingStyles, context } = react$1.useFloating({
|
|
2229
2342
|
placement: placement === "auto" ? "bottom" : placement,
|
|
@@ -2246,7 +2359,8 @@ const Tooltip = ({ children, "data-testid": dataTestId, disabled = false, label,
|
|
|
2246
2359
|
const wrappedChildren = react.useMemo(() => {
|
|
2247
2360
|
return jsxRuntime.jsx(reactSlot.Slot, { children: children });
|
|
2248
2361
|
}, [children]);
|
|
2249
|
-
|
|
2362
|
+
// Escape closes the hint and continues upward, so a menu or the assistant panel still hears it.
|
|
2363
|
+
return (jsxRuntime.jsxs(Popover, { activation: { click: false, hover: { delayed, interactable }, focus: openOnFocus && !tooltipSuppressed }, className: cvaTooltipPopover(), "data-testid": dataTestId, dismissal: { bubbles: { escapeKey: true } }, id: id, isOpen: tooltipSuppressed ? false : isOpen, onOpenStateChange: setIsOpen, placement: placement === "auto" ? "bottom" : placement, role: openOnFocus ? (labelIsTriggerName ? "label" : "tooltip") : undefined, roleEnabled: !tooltipSuppressed, children: [jsxRuntime.jsx(PopoverTrigger, { ...rest, "data-testid": dataTestId ? `${dataTestId}-trigger` : null, ref: mergedRef, style: style, children: children !== undefined ? (wrappedChildren) : openOnFocus ? (jsxRuntime.jsxs("button", { "aria-label": typeof label === "string" ? label : undefined, className: cvaTooltipTrigger(), disabled: disabled, type: "button", children: [typeof label === "string" ? null : jsxRuntime.jsx("span", { className: "sr-only", children: label }), jsxRuntime.jsx(Icon, { "data-testid": dataTestId ? `${dataTestId}-icon` : undefined, name: "QuestionMarkCircle", size: "small", ...restIconProps, ariaHidden: true, className: cvaTooltipIcon({ className: iconClassName, color: mode }) })] })) : (jsxRuntime.jsx(Icon, { className: cvaTooltipIcon({ color: mode }), "data-testid": dataTestId ? `${dataTestId}-icon` : undefined, name: "QuestionMarkCircle", size: "small", ...iconProps })) }), tooltipSuppressed || !isMounted ? null : (jsxRuntime.jsx("div", { ref: refs.setFloating, style: floatingStyles, children: jsxRuntime.jsx(PopoverContent, { guards: !openOnFocus, initialFocus: -1, returnFocus: false, children: jsxRuntime.jsxs("div", { "aria-label": typeof label === "string" ? label : undefined, className: cvaTooltipPopoverContent({ color: mode }), "data-testid": dataTestId ? `${dataTestId}-content` : undefined, onClick: e => e.stopPropagation(), onDoubleClick: e => e.stopPropagation(), onMouseDown: e => e.stopPropagation(), onPointerDown: e => e.stopPropagation(), children: [jsxRuntime.jsx(Text, { "data-testid": dataTestId ? `${dataTestId}-text` : undefined, inverted: mode === "dark", size: "small", type: typeof label === "string" ? "p" : "span", children: label }), placement !== "auto" && jsxRuntime.jsx(FloatingArrowContainer, { arrowRef: arrowRef, mode: mode })] }) }) }))] }));
|
|
2250
2364
|
};
|
|
2251
2365
|
|
|
2252
2366
|
/**
|
|
@@ -2856,10 +2970,18 @@ const cvaCard = cssClassVarianceUtilities.cva({
|
|
|
2856
2970
|
false: "",
|
|
2857
2971
|
true: "h-full",
|
|
2858
2972
|
},
|
|
2973
|
+
// overflow-clip is not a scroll container, so as a flex/grid item the card keeps
|
|
2974
|
+
// min-width/min-height: auto and grows to fit its content. Content that scrolls on its own
|
|
2975
|
+
// (e.g. a Table) needs the card to stay within the space its parent gives it instead.
|
|
2976
|
+
scrollableContent: {
|
|
2977
|
+
false: "",
|
|
2978
|
+
true: ["min-h-0", "min-w-0"],
|
|
2979
|
+
},
|
|
2859
2980
|
},
|
|
2860
2981
|
defaultVariants: {
|
|
2861
2982
|
clickable: false,
|
|
2862
2983
|
fullHeight: false,
|
|
2984
|
+
scrollableContent: false,
|
|
2863
2985
|
},
|
|
2864
2986
|
});
|
|
2865
2987
|
const cvaCardFooterContainerRoot = cssClassVarianceUtilities.cva({
|
|
@@ -2974,8 +3096,8 @@ const ROLE_CARD = "region";
|
|
|
2974
3096
|
* @param {CardProps} props - The props for the Card component
|
|
2975
3097
|
* @returns {ReactElement} Card component
|
|
2976
3098
|
*/
|
|
2977
|
-
const Card = ({ children, onClick, fullHeight = false, onMouseEnter, onMouseLeave, className, "data-testid": dataTestId, ref, ...rest }) => {
|
|
2978
|
-
return (jsxRuntime.jsx("div", { className: cvaCard({ fullHeight, clickable: Boolean(onClick), className }), "data-card": true, "data-testid": dataTestId, onClick: onClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, ref: ref, role: ROLE_CARD, ...rest, children: children }));
|
|
3099
|
+
const Card = ({ children, onClick, fullHeight = false, scrollableContent = false, onMouseEnter, onMouseLeave, className, "data-testid": dataTestId, ref, ...rest }) => {
|
|
3100
|
+
return (jsxRuntime.jsx("div", { className: cvaCard({ fullHeight, scrollableContent, clickable: Boolean(onClick), className }), "data-card": true, "data-testid": dataTestId, onClick: onClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, ref: ref, role: ROLE_CARD, ...rest, children: children }));
|
|
2979
3101
|
};
|
|
2980
3102
|
Card.displayName = "Card";
|
|
2981
3103
|
|
package/index.esm.js
CHANGED
|
@@ -12,7 +12,7 @@ import IconSpriteOutline from '@trackunit/ui-icons/icons-sprite-outline.svg';
|
|
|
12
12
|
import IconSpriteSolid from '@trackunit/ui-icons/icons-sprite-solid.svg';
|
|
13
13
|
import { snakeCase, titleCase } from 'string-ts';
|
|
14
14
|
import { cva } from '@trackunit/css-class-variance-utilities';
|
|
15
|
-
import { FloatingTree, useFloatingNodeId, useFloatingParentNodeId, useFloatingTree, offset, flip, shift, size, useFloating, autoUpdate, useClick, useDismiss, useHover as useHover$1, safePolygon,
|
|
15
|
+
import { FloatingTree, useFloatingNodeId, useFloatingParentNodeId, useFloatingTree, offset, flip, shift, size, useFloating, autoUpdate, useClick, useDismiss, useFocus, useHover as useHover$1, safePolygon, useRole, useInteractions, FloatingNode, useMergeRefs as useMergeRefs$1, FloatingPortal, FloatingFocusManager, arrow, useTransitionStatus, FloatingArrow, useListNavigation, useTypeahead, FloatingList, useListItem } from '@floating-ui/react';
|
|
16
16
|
import { Slot, Slottable } from '@radix-ui/react-slot';
|
|
17
17
|
import { omit, isEqual } from 'es-toolkit';
|
|
18
18
|
import { Link, useBlocker } from '@tanstack/react-router';
|
|
@@ -764,7 +764,83 @@ const useHoverScrollGuard = ({ enabled, hoverEnabled, openSiblingPinned, isOpen,
|
|
|
764
764
|
return enabled && isHoverScrollSuppressed;
|
|
765
765
|
};
|
|
766
766
|
|
|
767
|
-
|
|
767
|
+
/**
|
|
768
|
+
* `useFocus` treats `:focus-visible` as keyboard focus. jsdom reports that for every focus, and a
|
|
769
|
+
* programmatic `focus()` would otherwise open the popover and consume the next Escape. A key press
|
|
770
|
+
* is the signal we keep.
|
|
771
|
+
*
|
|
772
|
+
* One shared listener pair for every popover that opts into focus activation. A per-instance
|
|
773
|
+
* listener would add a capture-phase `keydown` and `pointerdown` handler, plus a timer, for every
|
|
774
|
+
* tooltip on the page.
|
|
775
|
+
*/
|
|
776
|
+
let keyboardFocus = false;
|
|
777
|
+
let subscribers = 0;
|
|
778
|
+
let outerFrame = 0;
|
|
779
|
+
let innerFrame = 0;
|
|
780
|
+
const cancelClear = () => {
|
|
781
|
+
if (outerFrame !== 0) {
|
|
782
|
+
cancelAnimationFrame(outerFrame);
|
|
783
|
+
outerFrame = 0;
|
|
784
|
+
}
|
|
785
|
+
if (innerFrame !== 0) {
|
|
786
|
+
cancelAnimationFrame(innerFrame);
|
|
787
|
+
innerFrame = 0;
|
|
788
|
+
}
|
|
789
|
+
};
|
|
790
|
+
const clearKeyboardFocus = () => {
|
|
791
|
+
keyboardFocus = false;
|
|
792
|
+
cancelClear();
|
|
793
|
+
};
|
|
794
|
+
const markKeyboardFocus = (event) => {
|
|
795
|
+
// Escape closes a menu or dialog, which hands focus back to its trigger. That return is not
|
|
796
|
+
// navigation, so it must not open the trigger's tooltip.
|
|
797
|
+
if (event.key === "Escape") {
|
|
798
|
+
clearKeyboardFocus();
|
|
799
|
+
return;
|
|
800
|
+
}
|
|
801
|
+
keyboardFocus = true;
|
|
802
|
+
cancelClear();
|
|
803
|
+
// Tab moves focus in this key's default action, before either frame below. Menu navigation
|
|
804
|
+
// focuses the next item from Floating UI's requestAnimationFrame, which is later than a 0ms
|
|
805
|
+
// timeout, so the flag has to survive that frame. The frame after clears it: a programmatic
|
|
806
|
+
// focus() that was not caused by this key must not open a tooltip or take the next Escape.
|
|
807
|
+
outerFrame = requestAnimationFrame(() => {
|
|
808
|
+
outerFrame = 0;
|
|
809
|
+
innerFrame = requestAnimationFrame(() => {
|
|
810
|
+
keyboardFocus = false;
|
|
811
|
+
innerFrame = 0;
|
|
812
|
+
});
|
|
813
|
+
});
|
|
814
|
+
};
|
|
815
|
+
/**
|
|
816
|
+
* Installs the shared listeners on the first subscriber and removes them when the last one leaves.
|
|
817
|
+
*
|
|
818
|
+
* @returns {() => void} Unsubscribes this caller.
|
|
819
|
+
*/
|
|
820
|
+
const subscribeToKeyboardFocus = () => {
|
|
821
|
+
if (subscribers === 0) {
|
|
822
|
+
window.addEventListener("keydown", markKeyboardFocus, true);
|
|
823
|
+
window.addEventListener("pointerdown", clearKeyboardFocus, true);
|
|
824
|
+
}
|
|
825
|
+
subscribers += 1;
|
|
826
|
+
return () => {
|
|
827
|
+
subscribers -= 1;
|
|
828
|
+
if (subscribers === 0) {
|
|
829
|
+
window.removeEventListener("keydown", markKeyboardFocus, true);
|
|
830
|
+
window.removeEventListener("pointerdown", clearKeyboardFocus, true);
|
|
831
|
+
clearKeyboardFocus();
|
|
832
|
+
}
|
|
833
|
+
};
|
|
834
|
+
};
|
|
835
|
+
/**
|
|
836
|
+
* Whether the most recent input was a key press that should count as keyboard focus.
|
|
837
|
+
*
|
|
838
|
+
* @returns {boolean} True until the key's focus change has been handled, including one scheduled for the
|
|
839
|
+
* next frame, or a pointer press or Escape clears it.
|
|
840
|
+
*/
|
|
841
|
+
const isKeyboardFocus = () => keyboardFocus;
|
|
842
|
+
|
|
843
|
+
const DEFAULT_ACTIVATION = { click: true, hover: false, keyboardHandlers: true, focus: false };
|
|
768
844
|
const DEFAULT_DISMISSAL = {
|
|
769
845
|
enabled: true,
|
|
770
846
|
outsidePress: true,
|
|
@@ -837,7 +913,7 @@ const getNestedVerticalAlignmentAxis = ({ rects }) => {
|
|
|
837
913
|
* @param {PopoverProps} options The options for the popover
|
|
838
914
|
* @returns {UsePopoverType} The data for the popover
|
|
839
915
|
*/
|
|
840
|
-
const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen: controlledIsOpen, activation = DEFAULT_ACTIVATION, dismissal = DEFAULT_DISMISSAL, sizing = DEFAULT_SIZING, onOpenStateChange, role = "dialog", id, className, "data-testid": dataTestId, }) => {
|
|
916
|
+
const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen: controlledIsOpen, activation = DEFAULT_ACTIVATION, dismissal = DEFAULT_DISMISSAL, sizing = DEFAULT_SIZING, onOpenStateChange, role = "dialog", roleEnabled = true, id, className, "data-testid": dataTestId, }) => {
|
|
841
917
|
const [uncontrolledIsOpen, setUncontrolledIsOpen] = useState(initialOpen);
|
|
842
918
|
const [labelId, setLabelId] = useState();
|
|
843
919
|
const [descriptionId, setDescriptionId] = useState();
|
|
@@ -948,6 +1024,9 @@ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen
|
|
|
948
1024
|
placement,
|
|
949
1025
|
open: isOpen,
|
|
950
1026
|
onOpenChange: (open, _event, reason) => {
|
|
1027
|
+
if (open && reason === "focus" && !isKeyboardFocus()) {
|
|
1028
|
+
return;
|
|
1029
|
+
}
|
|
951
1030
|
setUncontrolledIsOpen(open);
|
|
952
1031
|
onOpenStateChange?.(open);
|
|
953
1032
|
// Reset to `undefined` on close (regardless of *how* it closed) rather than keeping the close
|
|
@@ -978,8 +1057,15 @@ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen
|
|
|
978
1057
|
}, [isOpen, popoverData.update]);
|
|
979
1058
|
const popoverContext = popoverData.context;
|
|
980
1059
|
const resolvedActivation = typeof activation === "function" ? activation(DEFAULT_ACTIVATION) : activation;
|
|
1060
|
+
const focusEnabled = resolvedActivation.focus === true;
|
|
1061
|
+
useEffect(() => {
|
|
1062
|
+
if (!focusEnabled) {
|
|
1063
|
+
return;
|
|
1064
|
+
}
|
|
1065
|
+
return subscribeToKeyboardFocus();
|
|
1066
|
+
}, [focusEnabled]);
|
|
981
1067
|
const resolvedDismissal = typeof dismissal === "function" ? dismissal(DEFAULT_DISMISSAL) : dismissal;
|
|
982
|
-
const { outsidePress: configuredOutsidePress, ...restDismissal } = resolvedDismissal;
|
|
1068
|
+
const { outsidePress: configuredOutsidePress, bubbles: configuredBubbles, ...restDismissal } = resolvedDismissal;
|
|
983
1069
|
const clickInteraction = useClick(popoverContext, {
|
|
984
1070
|
enabled: resolvedActivation.click,
|
|
985
1071
|
keyboardHandlers: resolvedActivation.keyboardHandlers,
|
|
@@ -1011,10 +1097,21 @@ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen
|
|
|
1011
1097
|
}
|
|
1012
1098
|
return true;
|
|
1013
1099
|
},
|
|
1014
|
-
// Nested in a MenuTree: Escape closes one level at a time
|
|
1015
|
-
//
|
|
1016
|
-
//
|
|
1017
|
-
|
|
1100
|
+
// Nested in a MenuTree: Escape closes one level at a time unless the caller opts out.
|
|
1101
|
+
// Tooltips do: a hint must not swallow the Escape that dismisses the menu. Outside-press
|
|
1102
|
+
// bubbles only when the press is genuinely outside the tree; sibling-row presses are filtered
|
|
1103
|
+
// above so they don't collapse the root menu.
|
|
1104
|
+
// Other popovers keep Floating UI's default (Escape does not bubble) unless the caller asks
|
|
1105
|
+
// otherwise.
|
|
1106
|
+
bubbles: isInsideMenuTree
|
|
1107
|
+
? {
|
|
1108
|
+
escapeKey: false,
|
|
1109
|
+
outsidePress: true,
|
|
1110
|
+
...(typeof configuredBubbles === "boolean"
|
|
1111
|
+
? { escapeKey: configuredBubbles, outsidePress: configuredBubbles }
|
|
1112
|
+
: configuredBubbles),
|
|
1113
|
+
}
|
|
1114
|
+
: configuredBubbles,
|
|
1018
1115
|
});
|
|
1019
1116
|
const hoverOptions = typeof resolvedActivation.hover === "object" ? resolvedActivation.hover : undefined;
|
|
1020
1117
|
const hoverEnabled = hoverOptions ? (hoverOptions.active ?? true) : resolvedActivation.hover === true;
|
|
@@ -1090,6 +1187,12 @@ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen
|
|
|
1090
1187
|
popoverContext,
|
|
1091
1188
|
referenceRef: popoverData.refs.reference,
|
|
1092
1189
|
});
|
|
1190
|
+
const focusInteraction = useFocus(popoverContext, {
|
|
1191
|
+
// `visibleOnly` keeps pointer focus from opening the popover. Keyboard focus still matches
|
|
1192
|
+
// `:focus-visible`.
|
|
1193
|
+
enabled: focusEnabled,
|
|
1194
|
+
visibleOnly: true,
|
|
1195
|
+
});
|
|
1093
1196
|
const hoverInteraction = useHover$1(popoverContext, {
|
|
1094
1197
|
enabled: hoverEnabled && !openSiblingPinned && !isHoverScrollSuppressed,
|
|
1095
1198
|
delay: isHoverDelayed && !hasOpenSibling ? { open: 400 } : undefined,
|
|
@@ -1120,9 +1223,7 @@ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen
|
|
|
1120
1223
|
? safePolygon({ blockPointerEvents: isInsideMenuTree })
|
|
1121
1224
|
: undefined,
|
|
1122
1225
|
});
|
|
1123
|
-
const
|
|
1124
|
-
const focusInteraction = useFocus(popoverContext, { enabled: focusEnabled });
|
|
1125
|
-
const roleInteraction = useRole(popoverContext, { role });
|
|
1226
|
+
const roleInteraction = useRole(popoverContext, { enabled: roleEnabled, role });
|
|
1126
1227
|
// Distinguishes a genuine open -> close transition from this node simply mounting closed (the
|
|
1127
1228
|
// common case: every unrelated sibling elsewhere in the tree mounts with `isOpen === false`).
|
|
1128
1229
|
// Without this, that initial "closed" render would emit `MENU_TREE_CLOSE_EVENT` regardless, and
|
|
@@ -1380,14 +1481,14 @@ const withVisibilityCheck = (sourceRef) => ({
|
|
|
1380
1481
|
* @param {PopoverContentProps} props - The props for the PopoverContent component
|
|
1381
1482
|
* @returns {ReactElement} The popover content element
|
|
1382
1483
|
*/
|
|
1383
|
-
const PopoverContent = function PopoverContent({ className, "data-testid": dataTestId, children, portalId, initialFocus, returnFocus = true, ref: propRef, ...props }) {
|
|
1484
|
+
const PopoverContent = function PopoverContent({ className, "data-testid": dataTestId, children, portalId, initialFocus, returnFocus = true, guards = true, ref: propRef, ...props }) {
|
|
1384
1485
|
const { context: floatingContext, customProps, ...context } = usePopoverContext();
|
|
1385
1486
|
const ref = useMergeRefs$1([context.refs.setFloating, propRef]);
|
|
1386
1487
|
// Only a ref-based `returnFocus` has a concrete target to check -- the `boolean` case defers to
|
|
1387
1488
|
// Floating UI's own app-wide "previously focused element" tracking, which isn't exposed here to
|
|
1388
1489
|
// check against.
|
|
1389
1490
|
const resolvedReturnFocus = typeof returnFocus === "boolean" ? returnFocus : withVisibilityCheck(returnFocus);
|
|
1390
|
-
return (jsx(FloatingPortal, { id: portalId, root: document.body, children: context.isOpen === true ? (jsx(FloatingFocusManager, { closeOnFocusOut: context.closeOnFocusOut, context: floatingContext, guards:
|
|
1491
|
+
return (jsx(FloatingPortal, { id: portalId, preserveTabOrder: guards, root: document.body, children: context.isOpen === true ? (jsx(FloatingFocusManager, { closeOnFocusOut: context.closeOnFocusOut, context: floatingContext, guards: guards, initialFocus: initialFocus, modal: context.isModal, order: ["reference", "content"], returnFocus: resolvedReturnFocus, children: jsx("div", { "aria-describedby": context.descriptionId, "aria-labelledby": context.labelId, className: cvaPopoverContainer({ className: className ?? customProps.className }), "data-testid": dataTestId ?? customProps["data-testid"] ?? "popover-content", ref: ref, style: {
|
|
1391
1492
|
position: context.strategy,
|
|
1392
1493
|
top: context.y,
|
|
1393
1494
|
left: context.x,
|
|
@@ -2101,12 +2202,21 @@ const Text = ({ children, type = "p", size = "medium", align = "left", weight =
|
|
|
2101
2202
|
};
|
|
2102
2203
|
Text.displayName = "Text";
|
|
2103
2204
|
|
|
2205
|
+
const cvaTooltipTrigger = cva({
|
|
2206
|
+
base: ["group", "inline-flex", "cursor-pointer", "border-0", "bg-transparent", "p-0"],
|
|
2207
|
+
});
|
|
2104
2208
|
const cvaTooltipIcon = cva({
|
|
2105
|
-
base: [
|
|
2209
|
+
base: [
|
|
2210
|
+
"text-neutral-300",
|
|
2211
|
+
"transition",
|
|
2212
|
+
"hover:cursor-pointer",
|
|
2213
|
+
"hover:text-neutral-400",
|
|
2214
|
+
"group-focus-visible:text-neutral-400",
|
|
2215
|
+
],
|
|
2106
2216
|
variants: {
|
|
2107
2217
|
color: {
|
|
2108
|
-
light: "hover:text-white",
|
|
2109
|
-
dark: "hover:text-neutral-400",
|
|
2218
|
+
light: ["hover:text-white", "group-focus-visible:text-white"],
|
|
2219
|
+
dark: ["hover:text-neutral-400", "group-focus-visible:text-neutral-400"],
|
|
2110
2220
|
},
|
|
2111
2221
|
defaultVariants: {
|
|
2112
2222
|
color: "dark",
|
|
@@ -2164,7 +2274,7 @@ const FloatingArrowContainer = ({ arrowRef, mode = "dark", }) => {
|
|
|
2164
2274
|
return (jsx(FloatingArrow, { className: cvaTooltipPopoverTail({ mode, placement: floatingContext.placement }), context: floatingContext, ref: arrowRef }));
|
|
2165
2275
|
};
|
|
2166
2276
|
/**
|
|
2167
|
-
* Tooltips display additional information upon hover
|
|
2277
|
+
* Tooltips display additional information upon hover, and on keyboard focus with `openOnFocus`. The information included should be contextual, helpful, and nonessential while providing that extra ability to communicate and give clarity to a user.
|
|
2168
2278
|
*
|
|
2169
2279
|
* Tooltips should be used sparingly and contain succinct, supplementary information, and they should contain read-only text. **❗️Do not include interactive elements in tooltips ** (no links, buttons, etc). Interactive elements in tooltips are inaccessible since tooltips do not receive focus.
|
|
2170
2280
|
*
|
|
@@ -2221,8 +2331,11 @@ const Tooltip = ({ children, "data-testid": dataTestId, disabled = false, label,
|
|
|
2221
2331
|
setIsOpen(false);
|
|
2222
2332
|
}
|
|
2223
2333
|
// A label that repeats the trigger's accessible name would be read twice as its description.
|
|
2224
|
-
|
|
2225
|
-
|
|
2334
|
+
// The default icon trigger is always named with the label.
|
|
2335
|
+
const labelIsTriggerName = children === undefined ||
|
|
2336
|
+
(isValidElement(children) &&
|
|
2337
|
+
(children.props.ariaLabel === label || children.props["aria-label"] === label));
|
|
2338
|
+
const { className: iconClassName, ...restIconProps } = iconProps ?? {};
|
|
2226
2339
|
const arrowRef = useRef(null);
|
|
2227
2340
|
const { refs, floatingStyles, context } = useFloating({
|
|
2228
2341
|
placement: placement === "auto" ? "bottom" : placement,
|
|
@@ -2245,7 +2358,8 @@ const Tooltip = ({ children, "data-testid": dataTestId, disabled = false, label,
|
|
|
2245
2358
|
const wrappedChildren = useMemo(() => {
|
|
2246
2359
|
return jsx(Slot, { children: children });
|
|
2247
2360
|
}, [children]);
|
|
2248
|
-
|
|
2361
|
+
// Escape closes the hint and continues upward, so a menu or the assistant panel still hears it.
|
|
2362
|
+
return (jsxs(Popover, { activation: { click: false, hover: { delayed, interactable }, focus: openOnFocus && !tooltipSuppressed }, className: cvaTooltipPopover(), "data-testid": dataTestId, dismissal: { bubbles: { escapeKey: true } }, id: id, isOpen: tooltipSuppressed ? false : isOpen, onOpenStateChange: setIsOpen, placement: placement === "auto" ? "bottom" : placement, role: openOnFocus ? (labelIsTriggerName ? "label" : "tooltip") : undefined, roleEnabled: !tooltipSuppressed, children: [jsx(PopoverTrigger, { ...rest, "data-testid": dataTestId ? `${dataTestId}-trigger` : null, ref: mergedRef, style: style, children: children !== undefined ? (wrappedChildren) : openOnFocus ? (jsxs("button", { "aria-label": typeof label === "string" ? label : undefined, className: cvaTooltipTrigger(), disabled: disabled, type: "button", children: [typeof label === "string" ? null : jsx("span", { className: "sr-only", children: label }), jsx(Icon, { "data-testid": dataTestId ? `${dataTestId}-icon` : undefined, name: "QuestionMarkCircle", size: "small", ...restIconProps, ariaHidden: true, className: cvaTooltipIcon({ className: iconClassName, color: mode }) })] })) : (jsx(Icon, { className: cvaTooltipIcon({ color: mode }), "data-testid": dataTestId ? `${dataTestId}-icon` : undefined, name: "QuestionMarkCircle", size: "small", ...iconProps })) }), tooltipSuppressed || !isMounted ? null : (jsx("div", { ref: refs.setFloating, style: floatingStyles, children: jsx(PopoverContent, { guards: !openOnFocus, initialFocus: -1, returnFocus: false, children: jsxs("div", { "aria-label": typeof label === "string" ? label : undefined, className: cvaTooltipPopoverContent({ color: mode }), "data-testid": dataTestId ? `${dataTestId}-content` : undefined, onClick: e => e.stopPropagation(), onDoubleClick: e => e.stopPropagation(), onMouseDown: e => e.stopPropagation(), onPointerDown: e => e.stopPropagation(), children: [jsx(Text, { "data-testid": dataTestId ? `${dataTestId}-text` : undefined, inverted: mode === "dark", size: "small", type: typeof label === "string" ? "p" : "span", children: label }), placement !== "auto" && jsx(FloatingArrowContainer, { arrowRef: arrowRef, mode: mode })] }) }) }))] }));
|
|
2249
2363
|
};
|
|
2250
2364
|
|
|
2251
2365
|
/**
|
|
@@ -2855,10 +2969,18 @@ const cvaCard = cva({
|
|
|
2855
2969
|
false: "",
|
|
2856
2970
|
true: "h-full",
|
|
2857
2971
|
},
|
|
2972
|
+
// overflow-clip is not a scroll container, so as a flex/grid item the card keeps
|
|
2973
|
+
// min-width/min-height: auto and grows to fit its content. Content that scrolls on its own
|
|
2974
|
+
// (e.g. a Table) needs the card to stay within the space its parent gives it instead.
|
|
2975
|
+
scrollableContent: {
|
|
2976
|
+
false: "",
|
|
2977
|
+
true: ["min-h-0", "min-w-0"],
|
|
2978
|
+
},
|
|
2858
2979
|
},
|
|
2859
2980
|
defaultVariants: {
|
|
2860
2981
|
clickable: false,
|
|
2861
2982
|
fullHeight: false,
|
|
2983
|
+
scrollableContent: false,
|
|
2862
2984
|
},
|
|
2863
2985
|
});
|
|
2864
2986
|
const cvaCardFooterContainerRoot = cva({
|
|
@@ -2973,8 +3095,8 @@ const ROLE_CARD = "region";
|
|
|
2973
3095
|
* @param {CardProps} props - The props for the Card component
|
|
2974
3096
|
* @returns {ReactElement} Card component
|
|
2975
3097
|
*/
|
|
2976
|
-
const Card = ({ children, onClick, fullHeight = false, onMouseEnter, onMouseLeave, className, "data-testid": dataTestId, ref, ...rest }) => {
|
|
2977
|
-
return (jsx("div", { className: cvaCard({ fullHeight, clickable: Boolean(onClick), className }), "data-card": true, "data-testid": dataTestId, onClick: onClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, ref: ref, role: ROLE_CARD, ...rest, children: children }));
|
|
3098
|
+
const Card = ({ children, onClick, fullHeight = false, scrollableContent = false, onMouseEnter, onMouseLeave, className, "data-testid": dataTestId, ref, ...rest }) => {
|
|
3099
|
+
return (jsx("div", { className: cvaCard({ fullHeight, scrollableContent, clickable: Boolean(onClick), className }), "data-card": true, "data-testid": dataTestId, onClick: onClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, ref: ref, role: ROLE_CARD, ...rest, children: children }));
|
|
2978
3100
|
};
|
|
2979
3101
|
Card.displayName = "Card";
|
|
2980
3102
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-router-components",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.21-alpha-3123793ad15.0",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=24.x"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@trackunit/css-class-variance-utilities": "
|
|
11
|
-
"@trackunit/i18n-library-translation": "
|
|
12
|
-
"@trackunit/react-components": "
|
|
13
|
-
"@trackunit/react-drawer": "
|
|
14
|
-
"@trackunit/shared-utils": "
|
|
10
|
+
"@trackunit/css-class-variance-utilities": "2.6.63-alpha-3123793ad15.0",
|
|
11
|
+
"@trackunit/i18n-library-translation": "2.14.60-alpha-3123793ad15.0",
|
|
12
|
+
"@trackunit/react-components": "8.0.9-alpha-3123793ad15.0",
|
|
13
|
+
"@trackunit/react-drawer": "3.0.21-alpha-3123793ad15.0",
|
|
14
|
+
"@trackunit/shared-utils": "1.22.63-alpha-3123793ad15.0",
|
|
15
15
|
"dequal": "^2.0.3",
|
|
16
16
|
"zod": "^3.25.76"
|
|
17
17
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry.js","sourceRoot":"","sources":["../../../../../libs/react/components/migrations/entry.ts"],"names":[],"mappings":"","sourcesContent":["// Migration entry point for @nx/js:tsc build target.\n// Migrations are registered in ../migrations.json and resolved by NX at runtime.\nexport {};\n"]}
|