@datarobot/design-system 30.4.0 → 30.6.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/cjs/expandable-content/expandable-content.d.ts +16 -0
- package/cjs/expandable-content/expandable-content.js +61 -0
- package/cjs/expandable-content/index.d.ts +3 -0
- package/cjs/expandable-content/index.js +12 -0
- package/cjs/form-field/constants.d.ts +2 -0
- package/cjs/form-field/constants.js +2 -1
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +11 -0
- package/cjs/markdown/markdown.d.ts +6 -0
- package/cjs/markdown/markdown.js +15 -2
- package/cjs/message/message.d.ts +2 -1
- package/cjs/message/message.js +25 -9
- package/cjs/message/thinking-icon.d.ts +12 -0
- package/cjs/message/thinking-icon.js +79 -0
- package/cjs/text-editor/text-editor-content.js +0 -2
- package/esm/expandable-content/expandable-content.d.ts +16 -0
- package/esm/expandable-content/expandable-content.js +53 -0
- package/esm/expandable-content/index.d.ts +3 -0
- package/esm/expandable-content/index.js +2 -0
- package/esm/form-field/constants.d.ts +2 -0
- package/esm/form-field/constants.js +2 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/markdown/markdown.d.ts +6 -0
- package/esm/markdown/markdown.js +15 -2
- package/esm/message/message.d.ts +2 -1
- package/esm/message/message.js +25 -9
- package/esm/message/thinking-icon.d.ts +12 -0
- package/esm/message/thinking-icon.js +71 -0
- package/esm/text-editor/text-editor-content.js +0 -2
- package/expandable-content/package.json +7 -0
- package/js/bundle/bundle.js +630 -380
- package/js/bundle/bundle.min.js +1 -1
- package/js/bundle/index.d.ts +31 -3
- package/package.json +1 -1
- package/styles/index.css +62 -1
- package/styles/index.min.css +1 -1
- package/styles/themes/alpine-light.css +1 -0
- package/styles/themes/alpine-light.min.css +1 -1
- package/styles/themes/midnight-gray.css +1 -0
- package/styles/themes/midnight-gray.min.css +1 -1
package/esm/message/message.js
CHANGED
|
@@ -7,6 +7,7 @@ import { faCircleXmark } from '@fortawesome/free-solid-svg-icons/faCircleXmark';
|
|
|
7
7
|
import { faCircleCheck } from '@fortawesome/free-solid-svg-icons/faCircleCheck';
|
|
8
8
|
import { faCircleNotch } from '@fortawesome/free-solid-svg-icons/faCircleNotch';
|
|
9
9
|
import { FontAwesomeIcon } from '../font-awesome-icon';
|
|
10
|
+
import { ThinkingIcon } from './thinking-icon';
|
|
10
11
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
12
|
export const MESSAGE_TYPES = {
|
|
12
13
|
DISABLED: 'disabled',
|
|
@@ -16,7 +17,8 @@ export const MESSAGE_TYPES = {
|
|
|
16
17
|
SUCCESS: 'success',
|
|
17
18
|
SUCCESS_INFO: 'success-info',
|
|
18
19
|
IN_PROGRESS: 'in-progress',
|
|
19
|
-
EXPIRED: 'expired'
|
|
20
|
+
EXPIRED: 'expired',
|
|
21
|
+
THINKING: 'thinking'
|
|
20
22
|
};
|
|
21
23
|
export const MESSAGE_ICON_PLACEMENT = {
|
|
22
24
|
LEFT: 'left',
|
|
@@ -80,6 +82,10 @@ function getMessageConfig(icons, type) {
|
|
|
80
82
|
icon,
|
|
81
83
|
className: 'expired'
|
|
82
84
|
};
|
|
85
|
+
case MESSAGE_TYPES.THINKING:
|
|
86
|
+
return {
|
|
87
|
+
className: 'thinking'
|
|
88
|
+
};
|
|
83
89
|
default:
|
|
84
90
|
return {
|
|
85
91
|
icon,
|
|
@@ -105,23 +111,33 @@ export function Message({
|
|
|
105
111
|
icons = MESSAGE_ICONS
|
|
106
112
|
}) {
|
|
107
113
|
const messageConfig = getMessageConfig(icons, type);
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
114
|
+
const renderIcon = () => {
|
|
115
|
+
if (type === MESSAGE_TYPES.THINKING) {
|
|
116
|
+
return /*#__PURE__*/_jsx(ThinkingIcon, {
|
|
117
|
+
size: size
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
if (messageConfig.icon) {
|
|
121
|
+
return /*#__PURE__*/_jsx(FontAwesomeIcon, {
|
|
122
|
+
icon: messageConfig.icon,
|
|
123
|
+
spin: type === MESSAGE_TYPES.IN_PROGRESS
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
return null;
|
|
127
|
+
};
|
|
128
|
+
const icon = renderIcon();
|
|
129
|
+
const resolvedChildren = type === MESSAGE_TYPES.THINKING ? children ?? 'Thinking' : children;
|
|
112
130
|
return /*#__PURE__*/_jsxs("p", {
|
|
113
131
|
className: classNames('message-component', isStatus && 'status', messageConfig.className, {
|
|
114
132
|
'center-status': isCentered,
|
|
115
133
|
sm: size === MESSAGE_SIZES.SM
|
|
116
|
-
},
|
|
117
|
-
// global styles for now, should be moved into the components styles, once we message css usages to React
|
|
118
|
-
className, `with-${iconPlacement}-icon`),
|
|
134
|
+
}, className, `with-${iconPlacement}-icon`),
|
|
119
135
|
"test-id": testId,
|
|
120
136
|
id: id,
|
|
121
137
|
"aria-live": "polite",
|
|
122
138
|
role: messageConfig?.role,
|
|
123
139
|
children: [iconPlacement === MESSAGE_ICON_PLACEMENT.LEFT && icon, /*#__PURE__*/_jsx("span", {
|
|
124
|
-
children:
|
|
140
|
+
children: resolvedChildren
|
|
125
141
|
}), iconPlacement === MESSAGE_ICON_PLACEMENT.RIGHT && icon]
|
|
126
142
|
});
|
|
127
143
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ValueOf } from '../types';
|
|
2
|
+
import './thinking-icon.less';
|
|
3
|
+
export declare const THINKING_ICON_SIZES: {
|
|
4
|
+
readonly SM: "sm";
|
|
5
|
+
readonly MD: "md";
|
|
6
|
+
};
|
|
7
|
+
export type ThinkingIconSize = ValueOf<typeof THINKING_ICON_SIZES>;
|
|
8
|
+
type ThinkingIconProps = {
|
|
9
|
+
size?: ThinkingIconSize;
|
|
10
|
+
};
|
|
11
|
+
export declare function ThinkingIcon({ size, }: ThinkingIconProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
export const THINKING_ICON_SIZES = {
|
|
5
|
+
SM: 'sm',
|
|
6
|
+
MD: 'md'
|
|
7
|
+
};
|
|
8
|
+
// Bar geometry in natural SVG coordinates (viewBox 0 0 18.667 18).
|
|
9
|
+
const BARS = [{
|
|
10
|
+
top: 0,
|
|
11
|
+
left: 0,
|
|
12
|
+
width: 9.334
|
|
13
|
+
}, {
|
|
14
|
+
top: 2,
|
|
15
|
+
left: 9.334,
|
|
16
|
+
width: 4.661
|
|
17
|
+
}, {
|
|
18
|
+
top: 4,
|
|
19
|
+
left: 0,
|
|
20
|
+
width: 9.334
|
|
21
|
+
}, {
|
|
22
|
+
top: 6,
|
|
23
|
+
left: 14,
|
|
24
|
+
width: 4.667
|
|
25
|
+
}, {
|
|
26
|
+
top: 8,
|
|
27
|
+
left: 0,
|
|
28
|
+
width: 14
|
|
29
|
+
}, {
|
|
30
|
+
top: 10,
|
|
31
|
+
left: 14,
|
|
32
|
+
width: 4.667
|
|
33
|
+
}, {
|
|
34
|
+
top: 12,
|
|
35
|
+
left: 0,
|
|
36
|
+
width: 9.334
|
|
37
|
+
}, {
|
|
38
|
+
top: 14,
|
|
39
|
+
left: 9.334,
|
|
40
|
+
width: 4.661
|
|
41
|
+
}, {
|
|
42
|
+
top: 16,
|
|
43
|
+
left: 0,
|
|
44
|
+
width: 9.334
|
|
45
|
+
}];
|
|
46
|
+
const BAR_HEIGHT = 2;
|
|
47
|
+
|
|
48
|
+
// Staggered cascade: left backbone bars enter first, right accent bars follow.
|
|
49
|
+
// Entry order: r1 → r7 → r3 → r9 → r5 → r8 → r2 → r4 → r6
|
|
50
|
+
const DELAYS = [0.0, 0.62, 0.22, 0.7, 0.44, 0.76, 0.12, 0.54, 0.32];
|
|
51
|
+
export function ThinkingIcon({
|
|
52
|
+
size = THINKING_ICON_SIZES.MD
|
|
53
|
+
}) {
|
|
54
|
+
return /*#__PURE__*/_jsx("svg", {
|
|
55
|
+
className: classNames('thinking-icon', size),
|
|
56
|
+
viewBox: "0 0 18.667 18",
|
|
57
|
+
"aria-hidden": "true",
|
|
58
|
+
children: BARS.map((bar, i) => /*#__PURE__*/_jsx("rect", {
|
|
59
|
+
className: "bar",
|
|
60
|
+
x: bar.left,
|
|
61
|
+
y: bar.top,
|
|
62
|
+
width: bar.width,
|
|
63
|
+
height: BAR_HEIGHT
|
|
64
|
+
// eslint-disable-next-line react/forbid-dom-props
|
|
65
|
+
,
|
|
66
|
+
style: {
|
|
67
|
+
animationDelay: `${DELAYS[i]}s`
|
|
68
|
+
}
|
|
69
|
+
}, i))
|
|
70
|
+
});
|
|
71
|
+
}
|
|
@@ -158,9 +158,7 @@ export default function TextEditorContent({
|
|
|
158
158
|
useSlate
|
|
159
159
|
} = slateReact;
|
|
160
160
|
const editor = useSlate();
|
|
161
|
-
/* eslint-disable-next-line testing-library/render-result-naming-convention */
|
|
162
161
|
const ElementNode = elementRender;
|
|
163
|
-
/* eslint-disable-next-line testing-library/render-result-naming-convention */
|
|
164
162
|
const LeafNode = leafRender;
|
|
165
163
|
|
|
166
164
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|