@ttoss/ui 5.6.1 → 5.7.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 +47 -8
- package/dist/index.d.ts +6 -1
- package/package.json +3 -3
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,51 @@ 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
|
+
...props
|
|
1187
|
+
}) => {
|
|
1188
|
+
const className = `tooltip-component tooltip-${variant}`;
|
|
1189
|
+
const getVariantStyles = variantType => {
|
|
1190
|
+
const variants = {
|
|
1191
|
+
info: {
|
|
1192
|
+
backgroundColor: "input.background.secondary.default",
|
|
1193
|
+
color: "feedback.text.secondary.default",
|
|
1194
|
+
borderColor: "feedback.border.secondary.default"
|
|
1195
|
+
},
|
|
1196
|
+
success: {
|
|
1197
|
+
backgroundColor: "feedback.background.positive.default",
|
|
1198
|
+
color: "feedback.text.positive.default",
|
|
1199
|
+
borderColor: "feedback.border.positive.default"
|
|
1200
|
+
},
|
|
1201
|
+
warning: {
|
|
1202
|
+
backgroundColor: "feedback.background.caution.default",
|
|
1203
|
+
color: "feedback.text.caution.default",
|
|
1204
|
+
borderColor: "feedback.border.caution.default"
|
|
1205
|
+
},
|
|
1206
|
+
error: {
|
|
1207
|
+
backgroundColor: "feedback.background.negative.default",
|
|
1208
|
+
color: "feedback.text.negative.default",
|
|
1209
|
+
borderColor: "feedback.border.negative.default"
|
|
1210
|
+
}
|
|
1211
|
+
};
|
|
1212
|
+
return variants[variantType] || variants.info;
|
|
1213
|
+
};
|
|
1179
1214
|
return /* @__PURE__ */jsx21(Box, {
|
|
1180
1215
|
sx: ({
|
|
1181
1216
|
fonts
|
|
1182
1217
|
}) => {
|
|
1218
|
+
const variantStyles = getVariantStyles(variant);
|
|
1183
1219
|
return {
|
|
1220
|
+
".example-arrow": {
|
|
1221
|
+
display: "none"
|
|
1222
|
+
},
|
|
1184
1223
|
".tooltip-component": {
|
|
1185
1224
|
fontFamily: fonts?.body,
|
|
1186
|
-
backgroundColor: "input.background.secondary.default",
|
|
1187
1225
|
paddingY: "2",
|
|
1188
1226
|
paddingX: "3",
|
|
1189
|
-
color: "feedback.text.secondary.default",
|
|
1190
1227
|
border: "sm",
|
|
1191
1228
|
borderRadius: "xl",
|
|
1192
|
-
borderColor: "feedback.border.secondary.default",
|
|
1193
1229
|
zIndex: "tooltip",
|
|
1194
1230
|
opacity: "1",
|
|
1195
1231
|
lineHeight: "shorter",
|
|
@@ -1199,13 +1235,16 @@ var Tooltip = props => {
|
|
|
1199
1235
|
fontFamily: "body",
|
|
1200
1236
|
textDecorationLine: "underline",
|
|
1201
1237
|
lineHeight: "normal"
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1238
|
+
},
|
|
1239
|
+
...variantStyles
|
|
1240
|
+
},
|
|
1241
|
+
[`&.tooltip-${variant}`]: variantStyles
|
|
1204
1242
|
};
|
|
1205
1243
|
},
|
|
1206
1244
|
children: /* @__PURE__ */jsx21(TooltipReact, {
|
|
1207
1245
|
className,
|
|
1208
1246
|
...props,
|
|
1247
|
+
classNameArrow: "example-arrow",
|
|
1209
1248
|
children: props.children
|
|
1210
1249
|
})
|
|
1211
1250
|
});
|
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, ...props }: ITooltip) => 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.7.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",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"jest": "^29.7.0",
|
|
45
45
|
"react": "^19.0.0",
|
|
46
46
|
"tsup": "^8.3.5",
|
|
47
|
-
"@ttoss/config": "^1.35.3",
|
|
48
47
|
"@ttoss/react-icons": "^0.4.11",
|
|
48
|
+
"@ttoss/config": "^1.35.3",
|
|
49
49
|
"@ttoss/test-utils": "^2.1.23"
|
|
50
50
|
},
|
|
51
51
|
"keywords": [
|