tfy-web-components 0.0.40 → 0.0.42
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/dist/{Button-BfBg-JuM.js → Button-BMEClWyK.js} +6 -5
- package/dist/{Button-BfBg-JuM.js.map → Button-BMEClWyK.js.map} +1 -1
- package/dist/{Input-BJKnSR9Y.js → Input-OmtWyaSl.js} +7 -16
- package/dist/{Input-BJKnSR9Y.js.map → Input-OmtWyaSl.js.map} +1 -1
- package/dist/{Popover-P_pJI0ZD.js → Popover-CBnt1wgJ.js} +3 -3
- package/dist/{Popover-P_pJI0ZD.js.map → Popover-CBnt1wgJ.js.map} +1 -1
- package/dist/{Tooltip-a0OxvWau.js → Tooltip-BkP9fnI0.js} +174 -92
- package/dist/{Tooltip-a0OxvWau.js.map → Tooltip-BkP9fnI0.js.map} +1 -1
- package/dist/components/atoms/Button.es.js +2 -2
- package/dist/components/atoms/ButtonGroup.es.js +5 -5
- package/dist/components/atoms/ButtonGroup.es.js.map +1 -1
- package/dist/components/atoms/Code.d.ts +5 -0
- package/dist/components/atoms/Code.es.js +31 -0
- package/dist/components/atoms/Code.es.js.map +1 -0
- package/dist/components/atoms/IconButton.es.js +4 -4
- package/dist/components/atoms/IconButton.es.js.map +1 -1
- package/dist/components/atoms/OverflowButton.es.js +4 -4
- package/dist/components/atoms/OverflowButton.es.js.map +1 -1
- package/dist/components/atoms/TabButton.es.js +1 -1
- package/dist/components/atoms/Tooltip.d.ts +50 -16
- package/dist/components/atoms/Tooltip.es.js +14 -2
- package/dist/components/atoms/Tooltip.es.js.map +1 -1
- package/dist/components/molecules/Alert.es.js +2 -2
- package/dist/components/molecules/CopyField.es.js +2 -2
- package/dist/components/molecules/ImagesPreview.es.js +1 -1
- package/dist/components/molecules/Input.es.js +2 -2
- package/dist/components/molecules/Markdown.es.js +1 -1
- package/dist/components/molecules/SimpleCodeEditor.es.js +2 -2
- package/dist/components/molecules/ToggleButton.es.js +2 -2
- package/dist/components/molecules/agent-chat.es.js +2 -2
- package/dist/index.es.js +1 -1
- package/dist/new-components/atoms/Popover.es.js +2 -2
- package/dist/new-components/atoms/Toggletip.es.js +5 -24
- package/dist/new-components/atoms/Toggletip.es.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +3 -2
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import { useLayoutEffect } from "react";
|
|
7
|
+
import { c as cva } from "./index-DSVg79g-.js";
|
|
8
|
+
import { CodeBlock, InlineCode } from "./components/atoms/Code.es.js";
|
|
7
9
|
import { c as classNames } from "./classNames-B1XpQHle.js";
|
|
8
10
|
import { u as useTimeout, T as Timeout } from "./useTimeout-BXf1hDIL.js";
|
|
9
11
|
import { u as useIsoLayoutEffect, a as useStableCallback, e as useRefWithInit, f as formatErrorMessage, m as mergeProps, d as EMPTY_OBJECT, b as useRenderElement } from "./useIsoLayoutEffect-e9VA-ICd.js";
|
|
@@ -3879,42 +3881,6 @@ const TooltipPopup = /* @__PURE__ */ React.forwardRef(function TooltipPopup2(com
|
|
|
3879
3881
|
return element;
|
|
3880
3882
|
});
|
|
3881
3883
|
if (process.env.NODE_ENV !== "production") TooltipPopup.displayName = "TooltipPopup";
|
|
3882
|
-
const TooltipArrow$1 = /* @__PURE__ */ React.forwardRef(function TooltipArrow(componentProps, forwardedRef) {
|
|
3883
|
-
const {
|
|
3884
|
-
render,
|
|
3885
|
-
className,
|
|
3886
|
-
style,
|
|
3887
|
-
...elementProps
|
|
3888
|
-
} = componentProps;
|
|
3889
|
-
const store = useTooltipRootContext();
|
|
3890
|
-
const {
|
|
3891
|
-
arrowRef,
|
|
3892
|
-
side,
|
|
3893
|
-
align,
|
|
3894
|
-
arrowUncentered,
|
|
3895
|
-
arrowStyles
|
|
3896
|
-
} = useTooltipPositionerContext();
|
|
3897
|
-
const open = store.useState("open");
|
|
3898
|
-
const instantType = store.useState("instantType");
|
|
3899
|
-
const state = {
|
|
3900
|
-
open,
|
|
3901
|
-
side,
|
|
3902
|
-
align,
|
|
3903
|
-
uncentered: arrowUncentered,
|
|
3904
|
-
instant: instantType
|
|
3905
|
-
};
|
|
3906
|
-
const element = useRenderElement("div", componentProps, {
|
|
3907
|
-
state,
|
|
3908
|
-
ref: [forwardedRef, arrowRef],
|
|
3909
|
-
props: [{
|
|
3910
|
-
style: arrowStyles,
|
|
3911
|
-
"aria-hidden": true
|
|
3912
|
-
}, elementProps],
|
|
3913
|
-
stateAttributesMapping: popupStateMapping
|
|
3914
|
-
});
|
|
3915
|
-
return element;
|
|
3916
|
-
});
|
|
3917
|
-
if (process.env.NODE_ENV !== "production") TooltipArrow$1.displayName = "TooltipArrow";
|
|
3918
3884
|
const TooltipProvider$1 = function TooltipProvider(props) {
|
|
3919
3885
|
const {
|
|
3920
3886
|
delay,
|
|
@@ -3944,38 +3910,52 @@ function Tooltip(props) {
|
|
|
3944
3910
|
function TooltipTrigger2(props) {
|
|
3945
3911
|
return /* @__PURE__ */ jsx(TooltipTrigger$1, { "data-slot": "tooltip-trigger", ...props });
|
|
3946
3912
|
}
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3913
|
+
const tooltipMotionClass = "origin-[var(--transform-origin)] transition-[opacity,scale] duration-200 ease-out data-[instant]:transition-none data-[starting-style]:scale-75 data-[starting-style]:opacity-0 data-[ending-style]:scale-75 data-[ending-style]:opacity-0";
|
|
3914
|
+
const tooltipContentVariants = cva("z-[1500] flex max-w-80 items-center gap-space-8 overflow-visible outline-none", {
|
|
3915
|
+
variants: {
|
|
3916
|
+
surface: {
|
|
3917
|
+
inverse: "rounded-sm border-0 bg-background-inverse px-space-8 py-space-4 text-label-sm text-text-on-inverse shadow-elevation-2",
|
|
3918
|
+
card: "rounded-control bg-background-overlay px-space-12 py-space-8 text-body-sm text-text-primary shadow-elevation-2",
|
|
3919
|
+
unstyled: "max-w-none border-0 bg-transparent p-0 text-text-primary shadow-none",
|
|
3920
|
+
code: "w-140 max-w-none rounded-container border-0 bg-code-background-base p-0 text-text-primary shadow-elevation-2"
|
|
3921
|
+
},
|
|
3922
|
+
tone: {
|
|
3923
|
+
default: "",
|
|
3924
|
+
error: ""
|
|
3925
|
+
}
|
|
3926
|
+
},
|
|
3927
|
+
compoundVariants: [
|
|
3950
3928
|
{
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
/* @__PURE__ */ jsx("path", { d: "M.5 4.5h8l-4-4-4 4Z", fill: "currentColor" }),
|
|
3960
|
-
/* @__PURE__ */ jsx("path", { d: "m.5 4.5 4-4 4 4", className: "stroke-border-default" })
|
|
3961
|
-
] })
|
|
3929
|
+
surface: "inverse",
|
|
3930
|
+
tone: "error",
|
|
3931
|
+
class: "bg-status-background-error-bold"
|
|
3932
|
+
},
|
|
3933
|
+
{
|
|
3934
|
+
surface: "card",
|
|
3935
|
+
tone: "error",
|
|
3936
|
+
class: "border border-status-border-error-bold bg-status-background-error"
|
|
3962
3937
|
}
|
|
3963
|
-
|
|
3964
|
-
|
|
3938
|
+
],
|
|
3939
|
+
defaultVariants: {
|
|
3940
|
+
surface: "inverse",
|
|
3941
|
+
tone: "default"
|
|
3942
|
+
}
|
|
3943
|
+
});
|
|
3965
3944
|
function TooltipContent({
|
|
3966
|
-
className,
|
|
3967
|
-
side = "bottom",
|
|
3968
|
-
sideOffset = 4,
|
|
3969
3945
|
align = "center",
|
|
3970
3946
|
alignOffset = 0,
|
|
3971
|
-
arrow: arrow2 = false,
|
|
3972
|
-
arrowClassName,
|
|
3973
|
-
positionerClassName,
|
|
3974
3947
|
children,
|
|
3948
|
+
className,
|
|
3949
|
+
container,
|
|
3950
|
+
positionerClassName,
|
|
3951
|
+
side = "bottom",
|
|
3952
|
+
sideOffset = 8,
|
|
3975
3953
|
style,
|
|
3954
|
+
surface,
|
|
3955
|
+
tone,
|
|
3976
3956
|
...props
|
|
3977
3957
|
}) {
|
|
3978
|
-
return /* @__PURE__ */ jsx(TooltipPortal, { children: /* @__PURE__ */
|
|
3958
|
+
return /* @__PURE__ */ jsx(TooltipPortal, { container, children: /* @__PURE__ */ jsx(
|
|
3979
3959
|
TooltipPositioner,
|
|
3980
3960
|
{
|
|
3981
3961
|
align,
|
|
@@ -3983,28 +3963,109 @@ function TooltipContent({
|
|
|
3983
3963
|
side,
|
|
3984
3964
|
sideOffset,
|
|
3985
3965
|
className: classNames("isolate z-[1500]", positionerClassName),
|
|
3986
|
-
children:
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
...props,
|
|
3997
|
-
children
|
|
3998
|
-
}
|
|
3999
|
-
),
|
|
4000
|
-
arrow2 ? /* @__PURE__ */ jsx(TooltipArrow2, { className: arrowClassName }) : null
|
|
4001
|
-
]
|
|
3966
|
+
children: /* @__PURE__ */ jsx(
|
|
3967
|
+
TooltipPopup,
|
|
3968
|
+
{
|
|
3969
|
+
"data-slot": "tooltip-content",
|
|
3970
|
+
className: classNames(tooltipMotionClass, tooltipContentVariants({ surface, tone }), className),
|
|
3971
|
+
style,
|
|
3972
|
+
...props,
|
|
3973
|
+
children
|
|
3974
|
+
}
|
|
3975
|
+
)
|
|
4002
3976
|
}
|
|
4003
3977
|
) });
|
|
4004
3978
|
}
|
|
3979
|
+
function TooltipShortcut({ keys, surface }) {
|
|
3980
|
+
if (keys.length === 0) return null;
|
|
3981
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "tooltip-shortcut", className: "flex shrink-0 items-center gap-space-4", children: keys.map((key, index2) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
3982
|
+
index2 > 0 ? /* @__PURE__ */ jsx(
|
|
3983
|
+
"span",
|
|
3984
|
+
{
|
|
3985
|
+
className: classNames(
|
|
3986
|
+
"text-label-sm font-medium",
|
|
3987
|
+
surface === "inverse" ? "text-text-on-inverse" : "text-text-secondary"
|
|
3988
|
+
),
|
|
3989
|
+
children: "+"
|
|
3990
|
+
}
|
|
3991
|
+
) : null,
|
|
3992
|
+
/* @__PURE__ */ jsx(
|
|
3993
|
+
"kbd",
|
|
3994
|
+
{
|
|
3995
|
+
"data-slot": "tooltip-kbd",
|
|
3996
|
+
className: classNames(
|
|
3997
|
+
"relative inline-flex h-4 min-w-4 items-center justify-center rounded-sm px-space-4 text-label-sm font-medium",
|
|
3998
|
+
surface === "inverse" ? "text-text-on-inverse before:pointer-events-none before:absolute before:inset-0 before:rounded-sm before:border before:border-text-on-inverse before:opacity-40" : "border border-border-default text-text-secondary"
|
|
3999
|
+
),
|
|
4000
|
+
children: key
|
|
4001
|
+
}
|
|
4002
|
+
)
|
|
4003
|
+
] }, `${key}-${index2}`)) });
|
|
4004
|
+
}
|
|
4005
|
+
function TooltipBody({
|
|
4006
|
+
heading,
|
|
4007
|
+
headingClassName,
|
|
4008
|
+
children
|
|
4009
|
+
}) {
|
|
4010
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "tooltip-body", className: "flex min-w-0 flex-col gap-space-2 overflow-hidden", children: [
|
|
4011
|
+
heading != null && heading !== "" ? /* @__PURE__ */ jsx("div", { "data-slot": "tooltip-heading", className: classNames("text-label-md", headingClassName), children: heading }) : null,
|
|
4012
|
+
/* @__PURE__ */ jsx("div", { "data-slot": "tooltip-message", className: "min-w-0 [word-break:break-word]", children })
|
|
4013
|
+
] });
|
|
4014
|
+
}
|
|
4015
|
+
function TooltipInlineCode(props) {
|
|
4016
|
+
return /* @__PURE__ */ jsx(InlineCode, { "data-slot": "tooltip-inline-code", ...props });
|
|
4017
|
+
}
|
|
4018
|
+
function TooltipCode(props) {
|
|
4019
|
+
return /* @__PURE__ */ jsx(CodeBlock, { "data-slot": "tooltip-code", ...props });
|
|
4020
|
+
}
|
|
4021
|
+
function DisabledTooltipTrigger({
|
|
4022
|
+
className,
|
|
4023
|
+
node,
|
|
4024
|
+
onKeyDown,
|
|
4025
|
+
...props
|
|
4026
|
+
}) {
|
|
4027
|
+
const fallbackId = React.useId();
|
|
4028
|
+
const id = node.props.id || fallbackId;
|
|
4029
|
+
return /* @__PURE__ */ jsx(
|
|
4030
|
+
"span",
|
|
4031
|
+
{
|
|
4032
|
+
...props,
|
|
4033
|
+
role: "button",
|
|
4034
|
+
tabIndex: 0,
|
|
4035
|
+
"aria-disabled": "true",
|
|
4036
|
+
"aria-labelledby": id,
|
|
4037
|
+
onKeyDown: (event) => {
|
|
4038
|
+
onKeyDown == null ? void 0 : onKeyDown(event);
|
|
4039
|
+
if (!event.defaultPrevented && (event.key === "Enter" || event.key === " ")) {
|
|
4040
|
+
event.preventDefault();
|
|
4041
|
+
}
|
|
4042
|
+
},
|
|
4043
|
+
className: classNames("focus-ring inline-flex cursor-not-allowed rounded-control", className),
|
|
4044
|
+
children: React.cloneElement(node, {
|
|
4045
|
+
id,
|
|
4046
|
+
"aria-hidden": true,
|
|
4047
|
+
tabIndex: -1
|
|
4048
|
+
})
|
|
4049
|
+
}
|
|
4050
|
+
);
|
|
4051
|
+
}
|
|
4052
|
+
function tooltipTrigger(disabled2, node, className) {
|
|
4053
|
+
if (!disabled2) {
|
|
4054
|
+
return className ? /* @__PURE__ */ jsx("span", { className, children: node }) : node;
|
|
4055
|
+
}
|
|
4056
|
+
return /* @__PURE__ */ jsx(DisabledTooltipTrigger, { className, node });
|
|
4057
|
+
}
|
|
4058
|
+
const headingClass = {
|
|
4059
|
+
inverse: { default: "text-text-on-inverse", error: "text-text-on-inverse" },
|
|
4060
|
+
card: { default: "text-text-primary", error: "text-status-text-error" },
|
|
4061
|
+
code: { default: "text-text-primary", error: "text-text-primary" },
|
|
4062
|
+
unstyled: { default: "text-text-primary", error: "text-text-primary" }
|
|
4063
|
+
};
|
|
4005
4064
|
const sizeClasses = {
|
|
4006
|
-
|
|
4007
|
-
|
|
4065
|
+
// Default Figma wrap is applied separately; these are explicit overrides.
|
|
4066
|
+
small: "max-w-[15.625rem] max-h-[12.5rem]",
|
|
4067
|
+
large: "max-w-[26.25rem] max-h-[25rem]",
|
|
4068
|
+
medium: "max-w-[22.5rem] max-h-[18.75rem]",
|
|
4008
4069
|
variable: "max-w-none max-h-none",
|
|
4009
4070
|
fit: "max-w-fit max-h-none"
|
|
4010
4071
|
};
|
|
@@ -4012,11 +4073,15 @@ function parsePlacement(placement) {
|
|
|
4012
4073
|
const [side, alignPart] = placement.split("-");
|
|
4013
4074
|
return { side, align: alignPart ?? "center" };
|
|
4014
4075
|
}
|
|
4076
|
+
function resolveSurface(variant, content) {
|
|
4077
|
+
if (variant === "unstyled") return "unstyled";
|
|
4078
|
+
if (content === "code") return "code";
|
|
4079
|
+
return variant === "light" ? "card" : "inverse";
|
|
4080
|
+
}
|
|
4015
4081
|
function LegacyTooltip({
|
|
4016
4082
|
title,
|
|
4017
4083
|
placement = "bottom",
|
|
4018
|
-
size: size2
|
|
4019
|
-
border,
|
|
4084
|
+
size: size2,
|
|
4020
4085
|
padding,
|
|
4021
4086
|
open,
|
|
4022
4087
|
onOpen,
|
|
@@ -4024,7 +4089,11 @@ function LegacyTooltip({
|
|
|
4024
4089
|
disableHoverListener,
|
|
4025
4090
|
disableInteractive,
|
|
4026
4091
|
interactive,
|
|
4027
|
-
|
|
4092
|
+
tone = "default",
|
|
4093
|
+
heading,
|
|
4094
|
+
shortcut,
|
|
4095
|
+
content = "text",
|
|
4096
|
+
container,
|
|
4028
4097
|
children,
|
|
4029
4098
|
classes,
|
|
4030
4099
|
className,
|
|
@@ -4034,17 +4103,19 @@ function LegacyTooltip({
|
|
|
4034
4103
|
return children;
|
|
4035
4104
|
}
|
|
4036
4105
|
const { side, align } = parsePlacement(placement);
|
|
4106
|
+
const surface = resolveSurface(variant, content);
|
|
4037
4107
|
const disableHoverablePopup = disableInteractive !== void 0 ? disableInteractive : interactive !== void 0 ? !interactive : void 0;
|
|
4108
|
+
const scrolls = size2 === "small" || size2 === "medium" || size2 === "large";
|
|
4038
4109
|
const contentClass = classNames(
|
|
4039
|
-
sizeClasses[size2
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
variant === "dark" && "border-border-default bg-background-inverse text-text-on-inverse",
|
|
4043
|
-
variant === "unstyled" && "border-0 bg-transparent p-0 text-text-primary shadow-none",
|
|
4044
|
-
border && variant === "light" && "border",
|
|
4110
|
+
size2 != null ? sizeClasses[size2] : void 0,
|
|
4111
|
+
// items-center plus a max height centers the overflow, so the start cannot be scrolled into view.
|
|
4112
|
+
scrolls ? "custom-scrollbar items-start overflow-auto" : "overflow-visible",
|
|
4045
4113
|
classes == null ? void 0 : classes.tooltip
|
|
4046
4114
|
);
|
|
4047
|
-
const
|
|
4115
|
+
const body = surface === "code" || surface === "unstyled" ? title : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4116
|
+
/* @__PURE__ */ jsx(TooltipBody, { heading, headingClassName: headingClass[surface][tone], children: title }),
|
|
4117
|
+
shortcut != null && shortcut.length > 0 ? /* @__PURE__ */ jsx(TooltipShortcut, { keys: shortcut, surface }) : null
|
|
4118
|
+
] });
|
|
4048
4119
|
return (
|
|
4049
4120
|
// Match MUI Tooltip feel: open immediately on hover (Base UI defaults are 300–600ms).
|
|
4050
4121
|
/* @__PURE__ */ jsx(TooltipProvider2, { delay: 0, closeDelay: 0, children: /* @__PURE__ */ jsxs(
|
|
@@ -4066,12 +4137,13 @@ function LegacyTooltip({
|
|
|
4066
4137
|
{
|
|
4067
4138
|
side,
|
|
4068
4139
|
align,
|
|
4069
|
-
|
|
4070
|
-
|
|
4140
|
+
surface,
|
|
4141
|
+
tone,
|
|
4071
4142
|
className: contentClass,
|
|
4143
|
+
container,
|
|
4072
4144
|
positionerClassName: classNames(className, classes == null ? void 0 : classes.popper),
|
|
4073
4145
|
style: padding != null ? { padding } : void 0,
|
|
4074
|
-
children:
|
|
4146
|
+
children: body
|
|
4075
4147
|
}
|
|
4076
4148
|
)
|
|
4077
4149
|
]
|
|
@@ -4085,12 +4157,22 @@ const UnstyledTooltip = React.memo((props) => /* @__PURE__ */ jsx(LegacyTooltip,
|
|
|
4085
4157
|
export {
|
|
4086
4158
|
DarkTooltip as D,
|
|
4087
4159
|
LightTooltip as L,
|
|
4160
|
+
Tooltip as T,
|
|
4088
4161
|
UnstyledTooltip as U,
|
|
4089
4162
|
useAnchorPositioning as a,
|
|
4090
4163
|
usePositioner as b,
|
|
4091
4164
|
useHoverFloatingInteraction as c,
|
|
4165
|
+
TooltipBody as d,
|
|
4166
|
+
TooltipCode as e,
|
|
4167
|
+
TooltipContent as f,
|
|
4092
4168
|
getDisabledMountTransitionStyles as g,
|
|
4169
|
+
tooltipContentVariants as h,
|
|
4170
|
+
TooltipInlineCode as i,
|
|
4171
|
+
TooltipProvider2 as j,
|
|
4172
|
+
TooltipShortcut as k,
|
|
4173
|
+
TooltipTrigger2 as l,
|
|
4093
4174
|
safePolygon as s,
|
|
4175
|
+
tooltipTrigger as t,
|
|
4094
4176
|
useHoverReferenceInteraction as u
|
|
4095
4177
|
};
|
|
4096
|
-
//# sourceMappingURL=Tooltip-
|
|
4178
|
+
//# sourceMappingURL=Tooltip-BkP9fnI0.js.map
|