@datarobot/design-system 30.5.0 → 30.6.1

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.
@@ -8,6 +8,7 @@ export declare const VALIDATION_RULE_TYPES: {
8
8
  readonly IN_PROGRESS: "in-progress";
9
9
  readonly EXPIRED: "expired";
10
10
  readonly DISABLED: "disabled";
11
+ readonly THINKING: "thinking";
11
12
  };
12
13
  export type ValidationRuleTypes = ValueOf<typeof VALIDATION_RULE_TYPES>;
13
14
  export declare const MESSAGE_DISPLAY_LOCATION: {
@@ -30,6 +31,7 @@ export type VALIDATION_VALUES = {
30
31
  [VALIDATION_RULE_TYPES.IN_PROGRESS]?: string;
31
32
  [VALIDATION_RULE_TYPES.EXPIRED]?: string;
32
33
  [VALIDATION_RULE_TYPES.DISABLED]?: string;
34
+ [VALIDATION_RULE_TYPES.THINKING]?: string;
33
35
  };
34
36
  export declare const useDefaultValidationValues: () => VALIDATION_VALUES;
35
37
  export declare const INPUT_TYPES: {
@@ -15,7 +15,8 @@ const VALIDATION_RULE_TYPES = exports.VALIDATION_RULE_TYPES = {
15
15
  SUCCESS_INFO: 'success-info',
16
16
  IN_PROGRESS: 'in-progress',
17
17
  EXPIRED: 'expired',
18
- DISABLED: 'disabled'
18
+ DISABLED: 'disabled',
19
+ THINKING: 'thinking'
19
20
  };
20
21
  const MESSAGE_DISPLAY_LOCATION = exports.MESSAGE_DISPLAY_LOCATION = {
21
22
  INLINE: 'inline',
@@ -11,6 +11,7 @@ export declare const MESSAGE_TYPES: {
11
11
  readonly SUCCESS_INFO: "success-info";
12
12
  readonly IN_PROGRESS: "in-progress";
13
13
  readonly EXPIRED: "expired";
14
+ readonly THINKING: "thinking";
14
15
  };
15
16
  export declare const MESSAGE_ICON_PLACEMENT: {
16
17
  readonly LEFT: "left";
@@ -37,7 +38,7 @@ type Icons = {
37
38
  [key: string]: IconLookup;
38
39
  };
39
40
  export type MessageProps = {
40
- children: ReactNode;
41
+ children?: ReactNode;
41
42
  className?: string;
42
43
  testId?: string;
43
44
  /** Identifies the type of the message */
@@ -14,6 +14,7 @@ var _faCircleXmark = require("@fortawesome/free-solid-svg-icons/faCircleXmark");
14
14
  var _faCircleCheck = require("@fortawesome/free-solid-svg-icons/faCircleCheck");
15
15
  var _faCircleNotch = require("@fortawesome/free-solid-svg-icons/faCircleNotch");
16
16
  var _fontAwesomeIcon = require("../font-awesome-icon");
17
+ var _thinkingIcon = require("./thinking-icon");
17
18
  var _jsxRuntime = require("react/jsx-runtime");
18
19
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
19
20
  const MESSAGE_TYPES = exports.MESSAGE_TYPES = {
@@ -24,7 +25,8 @@ const MESSAGE_TYPES = exports.MESSAGE_TYPES = {
24
25
  SUCCESS: 'success',
25
26
  SUCCESS_INFO: 'success-info',
26
27
  IN_PROGRESS: 'in-progress',
27
- EXPIRED: 'expired'
28
+ EXPIRED: 'expired',
29
+ THINKING: 'thinking'
28
30
  };
29
31
  const MESSAGE_ICON_PLACEMENT = exports.MESSAGE_ICON_PLACEMENT = {
30
32
  LEFT: 'left',
@@ -88,6 +90,10 @@ function getMessageConfig(icons, type) {
88
90
  icon,
89
91
  className: 'expired'
90
92
  };
93
+ case MESSAGE_TYPES.THINKING:
94
+ return {
95
+ className: 'thinking'
96
+ };
91
97
  default:
92
98
  return {
93
99
  icon,
@@ -113,23 +119,33 @@ function Message({
113
119
  icons = MESSAGE_ICONS
114
120
  }) {
115
121
  const messageConfig = getMessageConfig(icons, type);
116
- const icon = /*#__PURE__*/(0, _jsxRuntime.jsx)(_fontAwesomeIcon.FontAwesomeIcon, {
117
- icon: messageConfig.icon,
118
- spin: type === MESSAGE_TYPES.IN_PROGRESS
119
- });
122
+ const renderIcon = () => {
123
+ if (type === MESSAGE_TYPES.THINKING) {
124
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_thinkingIcon.ThinkingIcon, {
125
+ size: size
126
+ });
127
+ }
128
+ if (messageConfig.icon) {
129
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_fontAwesomeIcon.FontAwesomeIcon, {
130
+ icon: messageConfig.icon,
131
+ spin: type === MESSAGE_TYPES.IN_PROGRESS
132
+ });
133
+ }
134
+ return null;
135
+ };
136
+ const icon = renderIcon();
137
+ const resolvedChildren = type === MESSAGE_TYPES.THINKING ? children ?? 'Thinking' : children;
120
138
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
121
139
  className: (0, _classnames.default)('message-component', isStatus && 'status', messageConfig.className, {
122
140
  'center-status': isCentered,
123
141
  sm: size === MESSAGE_SIZES.SM
124
- },
125
- // global styles for now, should be moved into the components styles, once we message css usages to React
126
- className, `with-${iconPlacement}-icon`),
142
+ }, className, `with-${iconPlacement}-icon`),
127
143
  "test-id": testId,
128
144
  id: id,
129
145
  "aria-live": "polite",
130
146
  role: messageConfig?.role,
131
147
  children: [iconPlacement === MESSAGE_ICON_PLACEMENT.LEFT && icon, /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
132
- children: children
148
+ children: resolvedChildren
133
149
  }), iconPlacement === MESSAGE_ICON_PLACEMENT.RIGHT && icon]
134
150
  });
135
151
  }
@@ -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,79 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.THINKING_ICON_SIZES = void 0;
7
+ exports.ThinkingIcon = ThinkingIcon;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _classnames = _interopRequireDefault(require("classnames"));
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ const THINKING_ICON_SIZES = exports.THINKING_ICON_SIZES = {
13
+ SM: 'sm',
14
+ MD: 'md'
15
+ };
16
+ // Bar geometry in natural SVG coordinates (viewBox 0 0 18.667 18).
17
+ const BARS = [{
18
+ top: 0,
19
+ left: 0,
20
+ width: 9.334
21
+ }, {
22
+ top: 2,
23
+ left: 9.334,
24
+ width: 4.661
25
+ }, {
26
+ top: 4,
27
+ left: 0,
28
+ width: 9.334
29
+ }, {
30
+ top: 6,
31
+ left: 14,
32
+ width: 4.667
33
+ }, {
34
+ top: 8,
35
+ left: 0,
36
+ width: 14
37
+ }, {
38
+ top: 10,
39
+ left: 14,
40
+ width: 4.667
41
+ }, {
42
+ top: 12,
43
+ left: 0,
44
+ width: 9.334
45
+ }, {
46
+ top: 14,
47
+ left: 9.334,
48
+ width: 4.661
49
+ }, {
50
+ top: 16,
51
+ left: 0,
52
+ width: 9.334
53
+ }];
54
+ const BAR_HEIGHT = 2;
55
+
56
+ // Staggered cascade: left backbone bars enter first, right accent bars follow.
57
+ // Entry order: r1 → r7 → r3 → r9 → r5 → r8 → r2 → r4 → r6
58
+ const DELAYS = [0.0, 0.62, 0.22, 0.7, 0.44, 0.76, 0.12, 0.54, 0.32];
59
+ function ThinkingIcon({
60
+ size = THINKING_ICON_SIZES.MD
61
+ }) {
62
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
63
+ className: (0, _classnames.default)('thinking-icon', size),
64
+ viewBox: "0 0 18.667 18",
65
+ "aria-hidden": "true",
66
+ children: BARS.map((bar, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)("rect", {
67
+ className: "bar",
68
+ x: bar.left,
69
+ y: bar.top,
70
+ width: bar.width,
71
+ height: BAR_HEIGHT
72
+ // eslint-disable-next-line react/forbid-dom-props
73
+ ,
74
+ style: {
75
+ animationDelay: `${DELAYS[i]}s`
76
+ }
77
+ }, i))
78
+ });
79
+ }
@@ -170,9 +170,7 @@ function TextEditorContent({
170
170
  useSlate
171
171
  } = slateReact;
172
172
  const editor = useSlate();
173
- /* eslint-disable-next-line testing-library/render-result-naming-convention */
174
173
  const ElementNode = elementRender;
175
- /* eslint-disable-next-line testing-library/render-result-naming-convention */
176
174
  const LeafNode = leafRender;
177
175
 
178
176
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -127,10 +127,10 @@ function CheckboxOptionList({
127
127
  "test-id": "typeahead-dropdown-list",
128
128
  id: listId,
129
129
  ref: el => {
130
- // we have to search for parent container which is rendered by PopperDropdownWrapper
131
- // in typeahead component, because it is an actual scrollable container,
132
- // and we need it to correctly scroll to active option when navigating via arrow keys
133
- scrollableContainerRef.current = el?.parentElement ?? null;
130
+ // The element itself is the scrollable container (overflow-y: auto on
131
+ // .checkbox-multiselect-container); keyboard navigation needs the ref
132
+ // here so active options can be scrolled into view.
133
+ scrollableContainerRef.current = el;
134
134
  },
135
135
  children: visibleOptions.map(option => /*#__PURE__*/(0, _jsxRuntime.jsx)(CheckboxListItem, {
136
136
  option: option,
@@ -8,6 +8,7 @@ export declare const VALIDATION_RULE_TYPES: {
8
8
  readonly IN_PROGRESS: "in-progress";
9
9
  readonly EXPIRED: "expired";
10
10
  readonly DISABLED: "disabled";
11
+ readonly THINKING: "thinking";
11
12
  };
12
13
  export type ValidationRuleTypes = ValueOf<typeof VALIDATION_RULE_TYPES>;
13
14
  export declare const MESSAGE_DISPLAY_LOCATION: {
@@ -30,6 +31,7 @@ export type VALIDATION_VALUES = {
30
31
  [VALIDATION_RULE_TYPES.IN_PROGRESS]?: string;
31
32
  [VALIDATION_RULE_TYPES.EXPIRED]?: string;
32
33
  [VALIDATION_RULE_TYPES.DISABLED]?: string;
34
+ [VALIDATION_RULE_TYPES.THINKING]?: string;
33
35
  };
34
36
  export declare const useDefaultValidationValues: () => VALIDATION_VALUES;
35
37
  export declare const INPUT_TYPES: {
@@ -9,7 +9,8 @@ export const VALIDATION_RULE_TYPES = {
9
9
  SUCCESS_INFO: 'success-info',
10
10
  IN_PROGRESS: 'in-progress',
11
11
  EXPIRED: 'expired',
12
- DISABLED: 'disabled'
12
+ DISABLED: 'disabled',
13
+ THINKING: 'thinking'
13
14
  };
14
15
  export const MESSAGE_DISPLAY_LOCATION = {
15
16
  INLINE: 'inline',
@@ -11,6 +11,7 @@ export declare const MESSAGE_TYPES: {
11
11
  readonly SUCCESS_INFO: "success-info";
12
12
  readonly IN_PROGRESS: "in-progress";
13
13
  readonly EXPIRED: "expired";
14
+ readonly THINKING: "thinking";
14
15
  };
15
16
  export declare const MESSAGE_ICON_PLACEMENT: {
16
17
  readonly LEFT: "left";
@@ -37,7 +38,7 @@ type Icons = {
37
38
  [key: string]: IconLookup;
38
39
  };
39
40
  export type MessageProps = {
40
- children: ReactNode;
41
+ children?: ReactNode;
41
42
  className?: string;
42
43
  testId?: string;
43
44
  /** Identifies the type of the message */
@@ -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 icon = /*#__PURE__*/_jsx(FontAwesomeIcon, {
109
- icon: messageConfig.icon,
110
- spin: type === MESSAGE_TYPES.IN_PROGRESS
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: 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
@@ -119,10 +119,10 @@ function CheckboxOptionList({
119
119
  "test-id": "typeahead-dropdown-list",
120
120
  id: listId,
121
121
  ref: el => {
122
- // we have to search for parent container which is rendered by PopperDropdownWrapper
123
- // in typeahead component, because it is an actual scrollable container,
124
- // and we need it to correctly scroll to active option when navigating via arrow keys
125
- scrollableContainerRef.current = el?.parentElement ?? null;
122
+ // The element itself is the scrollable container (overflow-y: auto on
123
+ // .checkbox-multiselect-container); keyboard navigation needs the ref
124
+ // here so active options can be scrolled into view.
125
+ scrollableContainerRef.current = el;
126
126
  },
127
127
  children: visibleOptions.map(option => /*#__PURE__*/_jsx(CheckboxListItem, {
128
128
  option: option,