@ttoss/ui 5.6.1 → 5.8.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/dist/esm/index.js +49 -8
- package/dist/index.d.ts +6 -1
- package/package.json +4 -4
package/dist/esm/index.js
CHANGED
|
@@ -669,7 +669,10 @@ var Label = ({
|
|
|
669
669
|
cursor: "pointer"
|
|
670
670
|
},
|
|
671
671
|
"aria-label": TOOLTIP_LABEL,
|
|
672
|
-
children: [/* @__PURE__ */jsx14(Icon6, {
|
|
672
|
+
children: [tooltip.icon ? /* @__PURE__ */jsx14(Icon6, {
|
|
673
|
+
inline: true,
|
|
674
|
+
icon: tooltip.icon
|
|
675
|
+
}) : /* @__PURE__ */jsx14(Icon6, {
|
|
673
676
|
inline: true,
|
|
674
677
|
icon: "fluent:info-24-regular"
|
|
675
678
|
}), /* @__PURE__ */jsx14(Tooltip, {
|
|
@@ -677,6 +680,10 @@ var Label = ({
|
|
|
677
680
|
openOnClick: tooltip.openOnClick,
|
|
678
681
|
clickable: tooltip.clickable,
|
|
679
682
|
place: tooltip.place,
|
|
683
|
+
hidden: tooltip.hidden,
|
|
684
|
+
variant: tooltip.variant,
|
|
685
|
+
setIsOpen: tooltip.setIsOpen,
|
|
686
|
+
isOpen: tooltip.isOpen,
|
|
680
687
|
children: tooltip.render
|
|
681
688
|
})]
|
|
682
689
|
})]
|
|
@@ -1174,22 +1181,52 @@ Textarea.displayName = "Textarea";
|
|
|
1174
1181
|
// src/components/Tooltip.tsx
|
|
1175
1182
|
import { Tooltip as TooltipReact } from "react-tooltip";
|
|
1176
1183
|
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
1177
|
-
var Tooltip =
|
|
1178
|
-
|
|
1184
|
+
var Tooltip = ({
|
|
1185
|
+
variant = "info",
|
|
1186
|
+
sx,
|
|
1187
|
+
...props
|
|
1188
|
+
}) => {
|
|
1189
|
+
const className = `tooltip-component tooltip-${variant}`;
|
|
1190
|
+
const getVariantStyles = variantType => {
|
|
1191
|
+
const variants = {
|
|
1192
|
+
info: {
|
|
1193
|
+
backgroundColor: "input.background.secondary.default",
|
|
1194
|
+
color: "feedback.text.secondary.default",
|
|
1195
|
+
borderColor: "feedback.border.secondary.default"
|
|
1196
|
+
},
|
|
1197
|
+
success: {
|
|
1198
|
+
backgroundColor: "feedback.background.positive.default",
|
|
1199
|
+
color: "feedback.text.positive.default",
|
|
1200
|
+
borderColor: "feedback.border.positive.default"
|
|
1201
|
+
},
|
|
1202
|
+
warning: {
|
|
1203
|
+
backgroundColor: "feedback.background.caution.default",
|
|
1204
|
+
color: "feedback.text.caution.default",
|
|
1205
|
+
borderColor: "feedback.border.caution.default"
|
|
1206
|
+
},
|
|
1207
|
+
error: {
|
|
1208
|
+
backgroundColor: "feedback.background.negative.default",
|
|
1209
|
+
color: "feedback.text.negative.default",
|
|
1210
|
+
borderColor: "feedback.border.negative.default"
|
|
1211
|
+
}
|
|
1212
|
+
};
|
|
1213
|
+
return variants[variantType] || variants.info;
|
|
1214
|
+
};
|
|
1179
1215
|
return /* @__PURE__ */jsx21(Box, {
|
|
1180
1216
|
sx: ({
|
|
1181
1217
|
fonts
|
|
1182
1218
|
}) => {
|
|
1219
|
+
const variantStyles = getVariantStyles(variant);
|
|
1183
1220
|
return {
|
|
1221
|
+
".example-arrow": {
|
|
1222
|
+
display: "none"
|
|
1223
|
+
},
|
|
1184
1224
|
".tooltip-component": {
|
|
1185
1225
|
fontFamily: fonts?.body,
|
|
1186
|
-
backgroundColor: "input.background.secondary.default",
|
|
1187
1226
|
paddingY: "2",
|
|
1188
1227
|
paddingX: "3",
|
|
1189
|
-
color: "feedback.text.secondary.default",
|
|
1190
1228
|
border: "sm",
|
|
1191
1229
|
borderRadius: "xl",
|
|
1192
|
-
borderColor: "feedback.border.secondary.default",
|
|
1193
1230
|
zIndex: "tooltip",
|
|
1194
1231
|
opacity: "1",
|
|
1195
1232
|
lineHeight: "shorter",
|
|
@@ -1199,13 +1236,17 @@ var Tooltip = props => {
|
|
|
1199
1236
|
fontFamily: "body",
|
|
1200
1237
|
textDecorationLine: "underline",
|
|
1201
1238
|
lineHeight: "normal"
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1239
|
+
},
|
|
1240
|
+
...variantStyles,
|
|
1241
|
+
...sx
|
|
1242
|
+
},
|
|
1243
|
+
[`&.tooltip-${variant}`]: variantStyles
|
|
1204
1244
|
};
|
|
1205
1245
|
},
|
|
1206
1246
|
children: /* @__PURE__ */jsx21(TooltipReact, {
|
|
1207
1247
|
className,
|
|
1208
1248
|
...props,
|
|
1249
|
+
classNameArrow: "example-arrow",
|
|
1209
1250
|
children: props.children
|
|
1210
1251
|
})
|
|
1211
1252
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -88,6 +88,11 @@ type LabelProps = LabelProps$1 & {
|
|
|
88
88
|
place: 'top' | 'right' | 'bottom' | 'left';
|
|
89
89
|
openOnClick?: boolean;
|
|
90
90
|
clickable?: boolean;
|
|
91
|
+
variant?: 'dark' | 'light' | 'success' | 'warning' | 'error' | 'info';
|
|
92
|
+
hidden?: boolean;
|
|
93
|
+
setIsOpen?: (value: boolean) => void;
|
|
94
|
+
isOpen?: boolean;
|
|
95
|
+
icon?: string;
|
|
91
96
|
};
|
|
92
97
|
};
|
|
93
98
|
declare const Label: ({ children, tooltip, sx, ...props }: LabelProps) => react_jsx_runtime.JSX.Element;
|
|
@@ -159,7 +164,7 @@ interface TextareaProps extends TextareaProps$1 {
|
|
|
159
164
|
}
|
|
160
165
|
declare const Textarea: React.ForwardRefExoticComponent<Omit<TextareaProps, "ref"> & React.RefAttributes<HTMLTextAreaElement>>;
|
|
161
166
|
|
|
162
|
-
declare const Tooltip: (props: ITooltip) => react_jsx_runtime.JSX.Element;
|
|
167
|
+
declare const Tooltip: ({ variant, sx, ...props }: ITooltip & SxProp) => react_jsx_runtime.JSX.Element;
|
|
163
168
|
|
|
164
169
|
type ThemeProviderProps = {
|
|
165
170
|
children?: React.ReactNode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/ui",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.8.0",
|
|
4
4
|
"description": "Primitive layout, typographic, and other components for styling applications.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ttoss",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"react-select": "^5.9.0",
|
|
30
30
|
"react-tooltip": "^5.28.0",
|
|
31
31
|
"theme-ui": "^0.17.1",
|
|
32
|
-
"@ttoss/theme": "^2.
|
|
32
|
+
"@ttoss/theme": "^2.6.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@emotion/react": "^11",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"react": "^19.0.0",
|
|
46
46
|
"tsup": "^8.3.5",
|
|
47
47
|
"@ttoss/config": "^1.35.3",
|
|
48
|
-
"@ttoss/
|
|
49
|
-
"@ttoss/
|
|
48
|
+
"@ttoss/test-utils": "^2.1.23",
|
|
49
|
+
"@ttoss/react-icons": "^0.4.11"
|
|
50
50
|
},
|
|
51
51
|
"keywords": [
|
|
52
52
|
"React",
|