@ultraviolet/ui 1.8.2 → 1.8.4
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/index.d.ts
CHANGED
|
@@ -717,8 +717,8 @@ declare const extendTheme: (extendedTheme: RecursivePartial<SCWUITheme>) => {
|
|
|
717
717
|
xlarge: number;
|
|
718
718
|
};
|
|
719
719
|
};
|
|
720
|
-
type Color = Extract<keyof typeof consoleLightTheme.colors, 'primary' | 'neutral' | 'success' | 'danger' | 'warning' | 'info'>;
|
|
721
|
-
declare const SENTIMENTS: readonly ["primary", "neutral", "success", "danger", "warning", "info"];
|
|
720
|
+
type Color = Extract<keyof typeof consoleLightTheme.colors, 'primary' | 'secondary' | 'neutral' | 'success' | 'danger' | 'warning' | 'info'>;
|
|
721
|
+
declare const SENTIMENTS: readonly ["primary", "secondary", "neutral", "success", "danger", "warning", "info"];
|
|
722
722
|
|
|
723
723
|
type SENTIMENT = (typeof SENTIMENTS)[number];
|
|
724
724
|
declare const SIZE_HEIGHT: {
|
|
@@ -1285,7 +1285,7 @@ declare const List: react.ForwardRefExoticComponent<ListProps & react.RefAttribu
|
|
|
1285
1285
|
expandable?: ReactNode;
|
|
1286
1286
|
selectDisabled?: string | boolean | undefined;
|
|
1287
1287
|
disabled?: boolean | undefined;
|
|
1288
|
-
sentiment?: "primary" | "neutral" | "success" | "danger" | "warning" | "info" | undefined;
|
|
1288
|
+
sentiment?: "primary" | "secondary" | "neutral" | "success" | "danger" | "warning" | "info" | undefined;
|
|
1289
1289
|
className?: string | undefined;
|
|
1290
1290
|
'data-testid'?: string | undefined;
|
|
1291
1291
|
} & react.RefAttributes<HTMLDivElement>>;
|
|
@@ -2181,7 +2181,11 @@ type TextProps = {
|
|
|
2181
2181
|
children: ReactNode;
|
|
2182
2182
|
placement?: PlacementProps;
|
|
2183
2183
|
variant: TextVariant;
|
|
2184
|
+
/**
|
|
2185
|
+
* @deprecated: use `sentiment` property instead
|
|
2186
|
+
*/
|
|
2184
2187
|
color?: Color;
|
|
2188
|
+
sentiment?: Color;
|
|
2185
2189
|
prominence?: ProminenceProps;
|
|
2186
2190
|
as: ElementType;
|
|
2187
2191
|
oneLine?: boolean;
|
|
@@ -2193,7 +2197,7 @@ type TextProps = {
|
|
|
2193
2197
|
htmlFor?: string;
|
|
2194
2198
|
'data-testid'?: string;
|
|
2195
2199
|
};
|
|
2196
|
-
declare const Text: ({ variant, children, as, color, oneLine, placement, prominence, className, disabled, italic, underline, id, dir, htmlFor, "data-testid": dataTestId, }: TextProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
2200
|
+
declare const Text: ({ variant, children, as, color, sentiment, oneLine, placement, prominence, className, disabled, italic, underline, id, dir, htmlFor, "data-testid": dataTestId, }: TextProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
2197
2201
|
|
|
2198
2202
|
declare const inputSizes: {
|
|
2199
2203
|
medium: {
|
|
@@ -31,6 +31,8 @@ const FOCUS_RING_KEY = {
|
|
|
31
31
|
info: 'focusInfo',
|
|
32
32
|
neutral: 'focusNeutral',
|
|
33
33
|
primary: 'focusPrimary',
|
|
34
|
+
// @note: no focusSecondary so far, it will be added later, so far focusPrimary sounds fine
|
|
35
|
+
secondary: 'focusPrimary',
|
|
34
36
|
success: 'focusSuccess',
|
|
35
37
|
warning: 'focusWarning'
|
|
36
38
|
};
|
|
@@ -19,7 +19,7 @@ const generateStyles = _ref => {
|
|
|
19
19
|
let {
|
|
20
20
|
placement,
|
|
21
21
|
prominence,
|
|
22
|
-
|
|
22
|
+
sentiment,
|
|
23
23
|
variant,
|
|
24
24
|
theme,
|
|
25
25
|
oneLine,
|
|
@@ -27,12 +27,12 @@ const generateStyles = _ref => {
|
|
|
27
27
|
italic,
|
|
28
28
|
underline
|
|
29
29
|
} = _ref;
|
|
30
|
-
// stronger is available only for neutral
|
|
31
|
-
const definedProminence =
|
|
32
|
-
theme.colors[
|
|
30
|
+
// stronger is available only for neutral sentiment
|
|
31
|
+
const definedProminence = sentiment !== 'neutral' && prominence === 'stronger' ? capitalize(PROMINENCES.default) : capitalize(PROMINENCES[prominence]);
|
|
32
|
+
theme.colors[sentiment];
|
|
33
33
|
const text = `text${definedProminence}${disabled ? 'Disabled' : ''}`;
|
|
34
34
|
return `
|
|
35
|
-
color: ${theme.colors[
|
|
35
|
+
color: ${theme.colors[sentiment][text]};
|
|
36
36
|
|
|
37
37
|
font-size: ${theme.typography[variant].fontSize};
|
|
38
38
|
font-family: ${theme.typography[variant].fontFamily};
|
|
@@ -51,7 +51,7 @@ const generateStyles = _ref => {
|
|
|
51
51
|
`;
|
|
52
52
|
};
|
|
53
53
|
const StyledText = /*#__PURE__*/_styled('div', {
|
|
54
|
-
shouldForwardProp: prop => !['as', 'placement', 'variant', '
|
|
54
|
+
shouldForwardProp: prop => !['as', 'placement', 'variant', 'sentiment', 'prominence', 'oneLine', 'disabled', 'italic', 'underline'].includes(prop),
|
|
55
55
|
target: "e13y3mga0"
|
|
56
56
|
})(generateStyles);
|
|
57
57
|
const Text = _ref2 => {
|
|
@@ -59,7 +59,8 @@ const Text = _ref2 => {
|
|
|
59
59
|
variant,
|
|
60
60
|
children,
|
|
61
61
|
as,
|
|
62
|
-
color
|
|
62
|
+
color,
|
|
63
|
+
sentiment,
|
|
63
64
|
oneLine = false,
|
|
64
65
|
placement,
|
|
65
66
|
prominence = 'default',
|
|
@@ -72,6 +73,7 @@ const Text = _ref2 => {
|
|
|
72
73
|
htmlFor,
|
|
73
74
|
'data-testid': dataTestId
|
|
74
75
|
} = _ref2;
|
|
76
|
+
const computedSentiment = sentiment ?? color ?? 'neutral';
|
|
75
77
|
const [isTruncated, setIsTruncated] = useState(false);
|
|
76
78
|
const elementRef = useRef(null);
|
|
77
79
|
const finalStringChildren = recursivelyGetChildrenString(children);
|
|
@@ -91,7 +93,7 @@ const Text = _ref2 => {
|
|
|
91
93
|
as: as,
|
|
92
94
|
placement: placement,
|
|
93
95
|
prominence: prominence,
|
|
94
|
-
|
|
96
|
+
sentiment: computedSentiment,
|
|
95
97
|
variant: variant,
|
|
96
98
|
oneLine: oneLine,
|
|
97
99
|
className: className,
|
package/dist/src/theme/index.js
CHANGED
|
@@ -17,9 +17,9 @@ const {
|
|
|
17
17
|
*/
|
|
18
18
|
const extendTheme = extendedTheme => deepmerge(consoleLightTheme, extendedTheme);
|
|
19
19
|
|
|
20
|
-
// This type exclude overlay
|
|
20
|
+
// This type exclude overlay color
|
|
21
21
|
|
|
22
|
-
const SENTIMENTS = ['primary', 'neutral', 'success', 'danger', 'warning', 'info'];
|
|
22
|
+
const SENTIMENTS = ['primary', 'secondary', 'neutral', 'success', 'danger', 'warning', 'info'];
|
|
23
23
|
const SENTIMENTS_WITHOUT_NEUTRAL = /*#__PURE__*/SENTIMENTS.filter(sentiment => sentiment !== 'neutral');
|
|
24
24
|
|
|
25
25
|
export { SENTIMENTS, SENTIMENTS_WITHOUT_NEUTRAL, colors, extendTheme, radii, screens, shadows, space, typography };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultraviolet/ui",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.4",
|
|
4
4
|
"description": "Ultraviolet UI",
|
|
5
5
|
"homepage": "https://github.com/scaleway/ultraviolet#readme",
|
|
6
6
|
"repository": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@emotion/react": "11.11.1",
|
|
45
45
|
"@emotion/styled": "11.11.0",
|
|
46
46
|
"@types/react": "18.2.8",
|
|
47
|
-
"@types/react-datepicker": "4.
|
|
47
|
+
"@types/react-datepicker": "4.15.0",
|
|
48
48
|
"@types/react-dom": "18.2.4",
|
|
49
49
|
"react": "18.2.0",
|
|
50
50
|
"react-dom": "18.2.0"
|
|
@@ -68,6 +68,6 @@
|
|
|
68
68
|
"react-use-clipboard": "1.0.9",
|
|
69
69
|
"reakit": "1.3.11",
|
|
70
70
|
"@ultraviolet/themes": "1.2.1",
|
|
71
|
-
"@ultraviolet/icons": "1.2.
|
|
71
|
+
"@ultraviolet/icons": "1.2.3"
|
|
72
72
|
}
|
|
73
73
|
}
|