@redocly/theme 0.70.0-next.0 → 0.70.0-next.2
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/lib/components/Button/Button.js +5 -2
- package/lib/components/Button/variables.js +14 -5
- package/lib/components/Dropdown/Dropdown.js +0 -7
- package/lib/components/ReplaySecuritySchemeActions/ReplaySecuritySchemeActions.d.ts +11 -0
- package/lib/components/ReplaySecuritySchemeActions/ReplaySecuritySchemeActions.js +7 -0
- package/lib/components/Search/SearchAiConversationInput.js +10 -6
- package/lib/components/Search/SearchAiDialog.js +8 -1
- package/lib/components/Search/SearchItem.js +9 -1
- package/lib/components/SplitButton/SplitButton.d.ts +1 -0
- package/lib/components/SplitButton/SplitButton.js +2 -2
- package/lib/components/Tooltip/AnchorTooltip.js +17 -27
- package/lib/components/Tooltip/JsTooltip.js +34 -46
- package/lib/components/Tooltip/Tooltip.js +1 -2
- package/lib/core/constants/search.d.ts +1 -1
- package/lib/core/constants/search.js +1 -1
- package/lib/core/hooks/catalog/use-catalog-entity-schema.js +2 -2
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-controls.js +1 -1
- package/lib/core/hooks/index.d.ts +1 -0
- package/lib/core/hooks/index.js +1 -0
- package/lib/core/hooks/menu/use-nested-menu.js +2 -2
- package/lib/core/hooks/use-anchor-positioning.d.ts +3 -0
- package/lib/core/hooks/use-anchor-positioning.js +21 -0
- package/lib/core/hooks/use-dialog-hotkeys.js +4 -2
- package/lib/core/hooks/use-theme-hooks.js +0 -1
- package/lib/core/types/hooks.d.ts +0 -3
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/search.d.ts +2 -0
- package/lib/core/utils/load-and-navigate.js +3 -3
- package/package.json +3 -3
- package/src/components/Button/Button.tsx +5 -2
- package/src/components/Button/variables.ts +14 -5
- package/src/components/Dropdown/Dropdown.tsx +0 -7
- package/src/components/ReplaySecuritySchemeActions/ReplaySecuritySchemeActions.tsx +19 -0
- package/src/components/Search/SearchAiConversationInput.tsx +13 -7
- package/src/components/Search/SearchAiDialog.tsx +16 -1
- package/src/components/Search/SearchItem.tsx +14 -0
- package/src/components/SplitButton/SplitButton.tsx +3 -0
- package/src/components/Tooltip/AnchorTooltip.tsx +17 -27
- package/src/components/Tooltip/JsTooltip.tsx +55 -62
- package/src/components/Tooltip/Tooltip.tsx +1 -2
- package/src/core/constants/search.ts +1 -1
- package/src/core/hooks/__mocks__/index.ts +1 -0
- package/src/core/hooks/__mocks__/use-anchor-positioning.ts +3 -0
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +0 -3
- package/src/core/hooks/catalog/use-catalog-entity-schema.ts +2 -2
- package/src/core/hooks/code-walkthrough/__mocks__/MockIntersectionObserver.ts +1 -2
- package/src/core/hooks/code-walkthrough/__mocks__/mock-intersection-observer.ts +1 -2
- package/src/core/hooks/code-walkthrough/use-code-walkthrough-controls.ts +1 -1
- package/src/core/hooks/index.ts +1 -0
- package/src/core/hooks/menu/use-nested-menu.ts +2 -2
- package/src/core/hooks/use-anchor-positioning.ts +22 -0
- package/src/core/hooks/use-dialog-hotkeys.ts +11 -5
- package/src/core/hooks/use-theme-hooks.ts +0 -1
- package/src/core/types/hooks.ts +0 -1
- package/src/core/types/l10n.ts +3 -0
- package/src/core/types/search.ts +2 -0
- package/src/core/utils/load-and-navigate.ts +3 -3
|
@@ -118,7 +118,9 @@ const StyledButton = styled_components_1.default.button `
|
|
|
118
118
|
height: var(--button-icon-size);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
/* A button that owns an open menu keeps its hovered appearance. */
|
|
122
|
+
&:hover,
|
|
123
|
+
&[aria-expanded='true'] {
|
|
122
124
|
background-color: var(--button-bg-color-hover);
|
|
123
125
|
color: var(--button-color-hover);
|
|
124
126
|
border-color: var(--button-border-color-hover);
|
|
@@ -140,7 +142,8 @@ const StyledButton = styled_components_1.default.button `
|
|
|
140
142
|
border-color: var(--button-border-color-danger);
|
|
141
143
|
background-color: var(--button-bg-color-danger);
|
|
142
144
|
|
|
143
|
-
&:hover
|
|
145
|
+
&:hover,
|
|
146
|
+
&[aria-expanded='true'] {
|
|
144
147
|
color: var(--button-content-color-danger-hover);
|
|
145
148
|
border-color: var(--button-border-color-danger-hover);
|
|
146
149
|
background-color: var(--button-bg-color-danger-hover);
|
|
@@ -251,21 +251,30 @@ exports.button = (0, styled_components_1.css) `
|
|
|
251
251
|
--button-group-divider-opacity: 1;
|
|
252
252
|
--button-group-divider-color-disabled: var(--color-warm-grey-2); // @presenter Color
|
|
253
253
|
|
|
254
|
-
.button-group-primary {
|
|
255
|
-
--button-group-divider-color: var(--button-
|
|
254
|
+
.button-group-primary .button {
|
|
255
|
+
--button-group-divider-color: var(--button-color); // @presenter Color
|
|
256
256
|
--button-group-divider-opacity: 0.32;
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
-
.button-group-secondary {
|
|
260
|
-
--button-group-divider-color: var(--button-
|
|
259
|
+
.button-group-secondary .button {
|
|
260
|
+
--button-group-divider-color: var(--button-color); // @presenter Color
|
|
261
261
|
--button-group-divider-opacity: 0.12;
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
-
.button-group-outlined {
|
|
264
|
+
.button-group-outlined .button {
|
|
265
265
|
--button-group-divider-color: var(--button-border-color); // @presenter Color
|
|
266
266
|
--button-group-divider-opacity: 1;
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
+
.button-group-primary .button.button-tone-danger,
|
|
270
|
+
.button-group-secondary .button.button-tone-danger {
|
|
271
|
+
--button-group-divider-color: var(--button-content-color-danger); // @presenter Color
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.button-group-outlined .button.button-tone-danger {
|
|
275
|
+
--button-group-divider-color: var(--button-border-color-danger); // @presenter Color
|
|
276
|
+
}
|
|
277
|
+
|
|
269
278
|
// @tokens End
|
|
270
279
|
`;
|
|
271
280
|
//# sourceMappingURL=variables.js.map
|
|
@@ -142,13 +142,6 @@ const DropdownWrapper = styled_components_1.default.div `
|
|
|
142
142
|
position: relative;
|
|
143
143
|
|
|
144
144
|
text-decoration: none;
|
|
145
|
-
|
|
146
|
-
/* The trigger keeps its hovered appearance while the menu is open. */
|
|
147
|
-
> .button[aria-expanded='true'] {
|
|
148
|
-
background-color: var(--button-bg-color-hover);
|
|
149
|
-
color: var(--button-color-hover);
|
|
150
|
-
border-color: var(--button-border-color-hover);
|
|
151
|
-
}
|
|
152
145
|
`;
|
|
153
146
|
const ChildrenWrapper = styled_components_1.default.div `
|
|
154
147
|
padding-top: var(--dropdown-menu-padding-top);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type ReplaySecurityType = 'oauth2' | 'openIdConnect' | 'apiKey' | 'http-bearer';
|
|
2
|
+
export type ReplaySecuritySchemeActionsProps = {
|
|
3
|
+
schemeId: string | null;
|
|
4
|
+
securityType: ReplaySecurityType;
|
|
5
|
+
environment: string;
|
|
6
|
+
operationId?: string;
|
|
7
|
+
value: string;
|
|
8
|
+
setValue: (value: string) => void;
|
|
9
|
+
apiId?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function ReplaySecuritySchemeActions(_props: ReplaySecuritySchemeActionsProps): null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReplaySecuritySchemeActions = ReplaySecuritySchemeActions;
|
|
4
|
+
function ReplaySecuritySchemeActions(_props) {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=ReplaySecuritySchemeActions.js.map
|
|
@@ -48,17 +48,21 @@ function SearchAiConversationInput({ isGeneratingResponse, onMessageSent, classN
|
|
|
48
48
|
const { useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
49
49
|
const { translate } = useTranslate();
|
|
50
50
|
const inputRef = (0, react_1.useRef)(null);
|
|
51
|
+
const wasGeneratingResponseRef = (0, react_1.useRef)(isGeneratingResponse);
|
|
51
52
|
const [query, setQuery] = (0, react_1.useState)('');
|
|
52
53
|
(0, react_1.useEffect)(() => {
|
|
53
|
-
|
|
54
|
+
const wasGeneratingResponse = wasGeneratingResponseRef.current;
|
|
55
|
+
wasGeneratingResponseRef.current = isGeneratingResponse;
|
|
56
|
+
if (wasGeneratingResponse && !isGeneratingResponse) {
|
|
54
57
|
requestAnimationFrame(() => {
|
|
55
58
|
var _a;
|
|
56
59
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
57
60
|
});
|
|
58
61
|
}
|
|
59
62
|
}, [isGeneratingResponse]);
|
|
63
|
+
const isDisabled = disabled || isGeneratingResponse || query.trim().length === 0;
|
|
60
64
|
const handleSendMessage = () => {
|
|
61
|
-
if (
|
|
65
|
+
if (isDisabled)
|
|
62
66
|
return;
|
|
63
67
|
setQuery('');
|
|
64
68
|
onMessageSent(query);
|
|
@@ -72,7 +76,6 @@ function SearchAiConversationInput({ isGeneratingResponse, onMessageSent, classN
|
|
|
72
76
|
handleSendMessage();
|
|
73
77
|
}
|
|
74
78
|
};
|
|
75
|
-
const isDisabled = disabled || isGeneratingResponse || query.trim().length === 0;
|
|
76
79
|
const commonProps = {
|
|
77
80
|
placeholder: placeholder || translate('search.ai.followUpQuestion', 'Ask a follow up question?'),
|
|
78
81
|
onChange: (e) => setQuery(e.target.value),
|
|
@@ -83,7 +86,7 @@ function SearchAiConversationInput({ isGeneratingResponse, onMessageSent, classN
|
|
|
83
86
|
};
|
|
84
87
|
return (react_1.default.createElement(SearchAiConversationInputWrapper, { "data-component-name": "Search/SearchAiConversationInput", className: className },
|
|
85
88
|
multiline ? (react_1.default.createElement(ConversationTextarea, Object.assign({ ref: inputRef }, commonProps))) : (react_1.default.createElement(ConversationInput, Object.assign({ ref: inputRef, type: "text" }, commonProps))),
|
|
86
|
-
react_1.default.createElement(SendButton, { disabled: isDisabled, size: "small", icon: react_1.default.createElement(SendIcon_1.SendIcon, { color: isDisabled
|
|
89
|
+
react_1.default.createElement(SendButton, { "aria-label": translate('search.ai.send', 'Send question'), "aria-disabled": isDisabled, size: "small", icon: react_1.default.createElement(SendIcon_1.SendIcon, { color: isDisabled
|
|
87
90
|
? '--button-content-color-disabled'
|
|
88
91
|
: 'var(--search-ai-conversation-input-send-button-icon-color)' }), onClick: handleSendMessage })));
|
|
89
92
|
}
|
|
@@ -151,11 +154,12 @@ const SendButton = (0, styled_components_1.default)(Button_1.Button) `
|
|
|
151
154
|
border-radius: var(--search-ai-conversation-input-send-button-border-radius);
|
|
152
155
|
padding: var(--search-ai-conversation-input-send-button-padding);
|
|
153
156
|
|
|
154
|
-
&:hover {
|
|
157
|
+
&:hover:not([aria-disabled='true']) {
|
|
155
158
|
background-color: var(--search-ai-conversation-input-send-button-bg-color-hover);
|
|
156
159
|
}
|
|
157
160
|
|
|
158
|
-
|
|
161
|
+
&[aria-disabled='true'] {
|
|
162
|
+
cursor: default;
|
|
159
163
|
background-color: var(--search-ai-conversation-input-send-button-bg-color-disabled);
|
|
160
164
|
border: var(--search-ai-conversation-input-send-button-border-disabled);
|
|
161
165
|
}
|
|
@@ -52,6 +52,13 @@ function SearchAiDialog({ isGeneratingResponse, response, initialMessage, error,
|
|
|
52
52
|
const { aiAssistant } = (0, hooks_1.useThemeConfig)();
|
|
53
53
|
const { translate } = useTranslate();
|
|
54
54
|
const conversationEndRef = react_1.default.useRef(null);
|
|
55
|
+
const wrapperRef = react_1.default.useRef(null);
|
|
56
|
+
(0, react_1.useEffect)(() => {
|
|
57
|
+
requestAnimationFrame(() => {
|
|
58
|
+
var _a, _b;
|
|
59
|
+
(_b = (_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('[data-component-name="Search/SearchAiConversationInput"] :is(input, textarea):not(:disabled)')) === null || _b === void 0 ? void 0 : _b.focus();
|
|
60
|
+
});
|
|
61
|
+
}, []);
|
|
55
62
|
const suggestions = (_a = aiAssistant === null || aiAssistant === void 0 ? void 0 : aiAssistant.suggestions) !== null && _a !== void 0 ? _a : [];
|
|
56
63
|
const placeholder = isGeneratingResponse
|
|
57
64
|
? translate('search.ai.generatingResponse', 'Generating response...')
|
|
@@ -139,7 +146,7 @@ function SearchAiDialog({ isGeneratingResponse, response, initialMessage, error,
|
|
|
139
146
|
const handleFeedbackChange = (0, react_1.useCallback)((messageId, feedback) => {
|
|
140
147
|
setConversation((prev) => prev.map((item) => (item.messageId === messageId ? Object.assign(Object.assign({}, item), { feedback }) : item)));
|
|
141
148
|
}, [setConversation]);
|
|
142
|
-
return (react_1.default.createElement(SearchAiDialogWrapper, { "data-component-name": "Search/SearchAiDialog", className: className },
|
|
149
|
+
return (react_1.default.createElement(SearchAiDialogWrapper, { ref: wrapperRef, "data-component-name": "Search/SearchAiDialog", className: className },
|
|
143
150
|
!conversation.length && (react_1.default.createElement(WelcomeWrapper, null,
|
|
144
151
|
react_1.default.createElement(AiStarsIcon_1.AiStarsIcon, { color: "var(--search-ai-icon-color)", size: "32px", background: "var(--search-ai-icon-bg-color)", borderRadius: "var(--border-radius-lg)", margin: "0 var(--spacing-xs) 0 0" }),
|
|
145
152
|
translate('search.ai.welcomeText', 'Welcome to AI assistant! Feel free to ask me anything. How can I help you? '))),
|
|
@@ -99,7 +99,15 @@ function SearchItem({ onClick, item, className, product, innerRef, }) {
|
|
|
99
99
|
(0, SearchHighlight_1.searchHighlight)(parameter.path.join(' → ')),
|
|
100
100
|
` → `)) : null,
|
|
101
101
|
(0, SearchHighlight_1.searchHighlight)(parameter.name)),
|
|
102
|
-
react_1.default.createElement("div", null, (0, SearchHighlight_1.searchHighlight)(parameter.description))
|
|
102
|
+
react_1.default.createElement("div", null, (0, SearchHighlight_1.searchHighlight)(parameter.description)),
|
|
103
|
+
parameter.enum ? (react_1.default.createElement("div", null,
|
|
104
|
+
translate('search.searchItem.enum', 'Enum'),
|
|
105
|
+
': ',
|
|
106
|
+
(0, SearchHighlight_1.searchHighlight)(parameter.enum))) : null,
|
|
107
|
+
parameter.example ? (react_1.default.createElement("div", null,
|
|
108
|
+
translate('search.searchItem.example', 'Example'),
|
|
109
|
+
': ',
|
|
110
|
+
(0, SearchHighlight_1.searchHighlight)(parameter.example))) : null)) : (shouldShowPath && (react_1.default.createElement(SearchItemPath, null, highlight.path && highlight.path.length
|
|
103
111
|
? (0, SearchHighlight_1.searchHighlight)(highlight.path.join(' → '))
|
|
104
112
|
: (_c = document.path) === null || _c === void 0 ? void 0 : _c.join(' → '))))),
|
|
105
113
|
react_1.default.createElement(ReturnKeyIcon_1.ReturnKeyIcon, { color: "var(--search-item-text-color)" })));
|
|
@@ -8,6 +8,7 @@ export type SplitButtonProps = {
|
|
|
8
8
|
children: ComponentProps<typeof Dropdown>['children'];
|
|
9
9
|
variant?: ButtonGroupVariant;
|
|
10
10
|
size?: ButtonGroupSize;
|
|
11
|
+
tone?: ButtonProps['tone'];
|
|
11
12
|
placement?: 'top' | 'bottom';
|
|
12
13
|
alignment?: 'start' | 'end';
|
|
13
14
|
portalled?: boolean;
|
|
@@ -10,12 +10,12 @@ const Button_1 = require("../../components/Button/Button");
|
|
|
10
10
|
const ButtonGroup_1 = require("../../components/Button/ButtonGroup");
|
|
11
11
|
const Dropdown_1 = require("../../components/Dropdown/Dropdown");
|
|
12
12
|
function SplitButton(props) {
|
|
13
|
-
const { button, children, variant, size, placement = 'bottom', alignment = 'end', portalled, closeOnSelect = true, disabled, toggleAriaLabel, onOpen, onClose, className, } = props;
|
|
13
|
+
const { button, children, variant, size, tone, placement = 'bottom', alignment = 'end', portalled, closeOnSelect = true, disabled, toggleAriaLabel, onOpen, onClose, className, } = props;
|
|
14
14
|
const hasMenu = typeof children === 'function' || react_1.default.Children.toArray(children).length > 0;
|
|
15
15
|
return (react_1.default.createElement(SplitButtonWrapper, { "data-component-name": "SplitButton/SplitButton", className: className },
|
|
16
16
|
react_1.default.createElement(ButtonGroup_1.ButtonGroup, { variant: variant, size: size },
|
|
17
17
|
button,
|
|
18
|
-
hasMenu ? (react_1.default.createElement(ToggleDropdown, { closeOnClick: closeOnSelect, placement: placement, alignment: alignment, portalled: portalled, withArrow: true, onOpen: onOpen, onClose: onClose, trigger: react_1.default.createElement(Button_1.Button, { "aria-label": toggleAriaLabel, "aria-haspopup": "menu", variant: variant, size: size, disabled: disabled }) }, children)) : null)));
|
|
18
|
+
hasMenu ? (react_1.default.createElement(ToggleDropdown, { closeOnClick: closeOnSelect, placement: placement, alignment: alignment, portalled: portalled, withArrow: true, onOpen: onOpen, onClose: onClose, trigger: react_1.default.createElement(Button_1.Button, { "aria-label": toggleAriaLabel, "aria-haspopup": "menu", variant: variant, size: size, tone: tone, disabled: disabled }) }, children)) : null)));
|
|
19
19
|
}
|
|
20
20
|
const SplitButtonWrapper = styled_components_1.default.div `
|
|
21
21
|
position: relative;
|
|
@@ -103,15 +103,13 @@ const PLACEMENTS = {
|
|
|
103
103
|
${({ $withArrow, $arrowPosition }) => $withArrow &&
|
|
104
104
|
(0, styled_components_1.css) `
|
|
105
105
|
&::after {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
border-top-style: solid;
|
|
110
|
-
border-radius: 2px;
|
|
106
|
+
width: 16px;
|
|
107
|
+
height: 8px;
|
|
108
|
+
clip-path: path('M0 0H16L9.414 6.586A2 2 0 0 1 6.586 6.586Z');
|
|
111
109
|
bottom: 0;
|
|
112
|
-
${$arrowPosition === 'left' && 'left:
|
|
110
|
+
${$arrowPosition === 'left' && 'left: 22px; transform: translateY(100%);'}
|
|
113
111
|
${$arrowPosition === 'center' && 'left: 50%; transform: translate(-50%, 100%);'}
|
|
114
|
-
${$arrowPosition === 'right' && 'right:
|
|
112
|
+
${$arrowPosition === 'right' && 'right: 22px; transform: translateY(100%);'}
|
|
115
113
|
}
|
|
116
114
|
`}
|
|
117
115
|
`,
|
|
@@ -135,15 +133,13 @@ const PLACEMENTS = {
|
|
|
135
133
|
${({ $withArrow, $arrowPosition }) => $withArrow &&
|
|
136
134
|
(0, styled_components_1.css) `
|
|
137
135
|
&::after {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
border-bottom-style: solid;
|
|
142
|
-
border-radius: 0 0 2px 2px;
|
|
136
|
+
width: 16px;
|
|
137
|
+
height: 8px;
|
|
138
|
+
clip-path: path('M0 8H16L9.414 1.414A2 2 0 0 0 6.586 1.414Z');
|
|
143
139
|
top: 0;
|
|
144
|
-
${$arrowPosition === 'left' && 'left:
|
|
140
|
+
${$arrowPosition === 'left' && 'left: 22px; transform: translateY(-100%);'}
|
|
145
141
|
${$arrowPosition === 'center' && 'left: 50%; transform: translate(-50%, -100%);'}
|
|
146
|
-
${$arrowPosition === 'right' && 'right:
|
|
142
|
+
${$arrowPosition === 'right' && 'right: 22px; transform: translateY(-100%);'}
|
|
147
143
|
}
|
|
148
144
|
`}
|
|
149
145
|
`,
|
|
@@ -156,11 +152,9 @@ const PLACEMENTS = {
|
|
|
156
152
|
${({ $withArrow }) => $withArrow &&
|
|
157
153
|
(0, styled_components_1.css) `
|
|
158
154
|
&::after {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
border-left-style: solid;
|
|
163
|
-
border-radius: 2px 0 0 2px;
|
|
155
|
+
width: 8px;
|
|
156
|
+
height: 16px;
|
|
157
|
+
clip-path: path('M0 0V16L6.586 9.414A2 2 0 0 0 6.586 6.586Z');
|
|
164
158
|
right: -9px;
|
|
165
159
|
top: 50%;
|
|
166
160
|
transform: translateY(-50%);
|
|
@@ -176,11 +170,9 @@ const PLACEMENTS = {
|
|
|
176
170
|
${({ $withArrow }) => $withArrow &&
|
|
177
171
|
(0, styled_components_1.css) `
|
|
178
172
|
&::after {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
border-right-style: solid;
|
|
183
|
-
border-radius: 0 2px 2px 0;
|
|
173
|
+
width: 8px;
|
|
174
|
+
height: 16px;
|
|
175
|
+
clip-path: path('M8 0V16L1.414 9.414A2 2 0 0 1 1.414 6.586Z');
|
|
184
176
|
left: -9px;
|
|
185
177
|
top: 50%;
|
|
186
178
|
transform: translateY(-50%);
|
|
@@ -222,9 +214,7 @@ const TooltipBody = styled_components_1.default.span.attrs(({ $anchorName }) =>
|
|
|
222
214
|
|
|
223
215
|
content: ' ';
|
|
224
216
|
display: inline-block;
|
|
225
|
-
|
|
226
|
-
height: 0;
|
|
227
|
-
border-color: var(--tooltip-arrow-color, var(--tooltip-bg-color));
|
|
217
|
+
background: var(--tooltip-arrow-color, var(--tooltip-bg-color));
|
|
228
218
|
}
|
|
229
219
|
|
|
230
220
|
background: var(--tooltip-bg-color);
|
|
@@ -112,12 +112,12 @@ function TooltipComponent({ children, isOpen, tip, withArrow = true, placement =
|
|
|
112
112
|
exports.Tooltip = (0, react_1.memo)(TooltipComponent);
|
|
113
113
|
const PLACEMENTS = {
|
|
114
114
|
top: (0, styled_components_1.css) `
|
|
115
|
-
${({ withArrow, arrowPosition }) => withArrow && arrowPosition === 'left'
|
|
115
|
+
${({ $withArrow, $arrowPosition }) => $withArrow && $arrowPosition === 'left'
|
|
116
116
|
? (0, styled_components_1.css) `
|
|
117
117
|
transform: translate(0, -100%);
|
|
118
118
|
margin-top: -10px;
|
|
119
119
|
`
|
|
120
|
-
: arrowPosition === 'right'
|
|
120
|
+
: $arrowPosition === 'right'
|
|
121
121
|
? (0, styled_components_1.css) `
|
|
122
122
|
transform: translate(-100%, -100%);
|
|
123
123
|
margin-top: -10px;
|
|
@@ -127,28 +127,26 @@ const PLACEMENTS = {
|
|
|
127
127
|
margin-top: -10px;
|
|
128
128
|
`}
|
|
129
129
|
|
|
130
|
-
${({ withArrow, arrowPosition }) => withArrow &&
|
|
130
|
+
${({ $withArrow, $arrowPosition }) => $withArrow &&
|
|
131
131
|
(0, styled_components_1.css) `
|
|
132
132
|
&::after {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
border-top-style: solid;
|
|
137
|
-
border-radius: 2px;
|
|
133
|
+
width: 16px;
|
|
134
|
+
height: 8px;
|
|
135
|
+
clip-path: path('M0 0H16L9.414 6.586A2 2 0 0 1 6.586 6.586Z');
|
|
138
136
|
bottom: 0;
|
|
139
|
-
${arrowPosition === 'left' && 'left:
|
|
140
|
-
${arrowPosition === 'center' && 'left: 50%; transform: translate(-50%, 99%);'}
|
|
141
|
-
${arrowPosition === 'right' && 'right:
|
|
137
|
+
${$arrowPosition === 'left' && 'left: 22px; transform: translateY(99%);'}
|
|
138
|
+
${$arrowPosition === 'center' && 'left: 50%; transform: translate(-50%, 99%);'}
|
|
139
|
+
${$arrowPosition === 'right' && 'right: 22px; transform: translateY(99%);'}
|
|
142
140
|
}
|
|
143
141
|
`}
|
|
144
142
|
`,
|
|
145
143
|
bottom: (0, styled_components_1.css) `
|
|
146
|
-
${({ withArrow, arrowPosition }) => withArrow && arrowPosition === 'left'
|
|
144
|
+
${({ $withArrow, $arrowPosition }) => $withArrow && $arrowPosition === 'left'
|
|
147
145
|
? (0, styled_components_1.css) `
|
|
148
146
|
transform: translate(0, 10px);
|
|
149
147
|
margin-top: 0;
|
|
150
148
|
`
|
|
151
|
-
: arrowPosition === 'right'
|
|
149
|
+
: $arrowPosition === 'right'
|
|
152
150
|
? (0, styled_components_1.css) `
|
|
153
151
|
transform: translate(-100%, 10px);
|
|
154
152
|
margin-top: 0;
|
|
@@ -158,18 +156,16 @@ const PLACEMENTS = {
|
|
|
158
156
|
margin-top: 0;
|
|
159
157
|
`}
|
|
160
158
|
|
|
161
|
-
${({ withArrow, arrowPosition }) => withArrow &&
|
|
159
|
+
${({ $withArrow, $arrowPosition }) => $withArrow &&
|
|
162
160
|
(0, styled_components_1.css) `
|
|
163
161
|
&::after {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
border-bottom-style: solid;
|
|
168
|
-
border-radius: 0 0 2px 2px;
|
|
162
|
+
width: 16px;
|
|
163
|
+
height: 8px;
|
|
164
|
+
clip-path: path('M0 8H16L9.414 1.414A2 2 0 0 0 6.586 1.414Z');
|
|
169
165
|
top: 0;
|
|
170
|
-
${arrowPosition === 'left' && 'left:
|
|
171
|
-
${arrowPosition === 'center' && 'left: 50%; transform: translate(-50%, -99%);'}
|
|
172
|
-
${arrowPosition === 'right' && 'right:
|
|
166
|
+
${$arrowPosition === 'left' && 'left: 22px; transform: translateY(-99%);'}
|
|
167
|
+
${$arrowPosition === 'center' && 'left: 50%; transform: translate(-50%, -99%);'}
|
|
168
|
+
${$arrowPosition === 'right' && 'right: 22px; transform: translateY(-99%);'}
|
|
173
169
|
}
|
|
174
170
|
`}
|
|
175
171
|
`,
|
|
@@ -177,19 +173,17 @@ const PLACEMENTS = {
|
|
|
177
173
|
transform: translate(-100%, -50%);
|
|
178
174
|
margin-left: -10px;
|
|
179
175
|
|
|
180
|
-
${({ withArrow, arrowPosition }) => withArrow &&
|
|
176
|
+
${({ $withArrow, $arrowPosition }) => $withArrow &&
|
|
181
177
|
(0, styled_components_1.css) `
|
|
182
178
|
&::after {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
border-left-style: solid;
|
|
187
|
-
border-radius: 2px 0 0 2px;
|
|
179
|
+
width: 8px;
|
|
180
|
+
height: 16px;
|
|
181
|
+
clip-path: path('M0 0V16L6.586 9.414A2 2 0 0 0 6.586 6.586Z');
|
|
188
182
|
top: 50%;
|
|
189
183
|
right: 0;
|
|
190
|
-
${arrowPosition === 'top' && 'top:
|
|
191
|
-
${arrowPosition === 'center' && 'top: 50%; transform: translate(99%, -50%);'}
|
|
192
|
-
${arrowPosition === 'bottom' && 'bottom:
|
|
184
|
+
${$arrowPosition === 'top' && 'top: 22px; transform: translateX(99%);'}
|
|
185
|
+
${$arrowPosition === 'center' && 'top: 50%; transform: translate(99%, -50%);'}
|
|
186
|
+
${$arrowPosition === 'bottom' && 'bottom: 22px; transform: translateX(99%);'}
|
|
193
187
|
}
|
|
194
188
|
`}
|
|
195
189
|
`,
|
|
@@ -197,19 +191,17 @@ const PLACEMENTS = {
|
|
|
197
191
|
transform: translate(0, -50%);
|
|
198
192
|
margin-left: 10px;
|
|
199
193
|
|
|
200
|
-
${({ withArrow, arrowPosition }) => withArrow &&
|
|
194
|
+
${({ $withArrow, $arrowPosition }) => $withArrow &&
|
|
201
195
|
(0, styled_components_1.css) `
|
|
202
196
|
&::after {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
border-right-style: solid;
|
|
207
|
-
border-radius: 0 2px 2px 0;
|
|
197
|
+
width: 8px;
|
|
198
|
+
height: 16px;
|
|
199
|
+
clip-path: path('M8 0V16L1.414 9.414A2 2 0 0 1 1.414 6.586Z');
|
|
208
200
|
top: 50%;
|
|
209
201
|
left: 0;
|
|
210
|
-
${arrowPosition === 'top' && 'top:
|
|
211
|
-
${arrowPosition === 'center' && 'top: 50%; transform: translate(-99%, -50%);'}
|
|
212
|
-
${arrowPosition === 'bottom' && 'bottom:
|
|
202
|
+
${$arrowPosition === 'top' && 'top: 22px; transform: translateX(-99%);'}
|
|
203
|
+
${$arrowPosition === 'center' && 'top: 50%; transform: translate(-99%, -50%);'}
|
|
204
|
+
${$arrowPosition === 'bottom' && 'bottom: 22px; transform: translateX(-99%);'}
|
|
213
205
|
}
|
|
214
206
|
`}
|
|
215
207
|
`,
|
|
@@ -240,9 +232,7 @@ const TooltipBody = styled_components_1.default.span `
|
|
|
240
232
|
|
|
241
233
|
content: ' ';
|
|
242
234
|
display: inline-block;
|
|
243
|
-
|
|
244
|
-
height: 0;
|
|
245
|
-
border-color: var(--tooltip-arrow-color, var(--tooltip-bg-color));
|
|
235
|
+
background: var(--tooltip-arrow-color, var(--tooltip-bg-color));
|
|
246
236
|
}
|
|
247
237
|
|
|
248
238
|
background: var(--tooltip-bg-color);
|
|
@@ -252,8 +242,6 @@ const TooltipBody = styled_components_1.default.span `
|
|
|
252
242
|
box-shadow: var(--bg-raised-shadow);
|
|
253
243
|
|
|
254
244
|
width: ${({ $width }) => $width || 'max-content'};
|
|
255
|
-
${({ $placement }) =>
|
|
256
|
-
${PLACEMENTS[$placement]};
|
|
257
|
-
`}
|
|
245
|
+
${({ $placement }) => PLACEMENTS[$placement]}
|
|
258
246
|
`;
|
|
259
247
|
//# sourceMappingURL=JsTooltip.js.map
|
|
@@ -41,8 +41,7 @@ const hooks_1 = require("../../core/hooks");
|
|
|
41
41
|
const utils_1 = require("../../core/utils");
|
|
42
42
|
function TooltipComponent(props) {
|
|
43
43
|
var _a, _b;
|
|
44
|
-
const {
|
|
45
|
-
const { isSupported } = useAnchorPositioning();
|
|
44
|
+
const { isSupported } = (0, hooks_1.useAnchorPositioning)();
|
|
46
45
|
const fallbackPlacements = (_a = props.fallbackPlacements) !== null && _a !== void 0 ? _a : (0, utils_1.getDefaultFallbackPlacements)((_b = props.placement) !== null && _b !== void 0 ? _b : 'top');
|
|
47
46
|
if (isSupported) {
|
|
48
47
|
return (react_1.default.createElement(AnchorTooltip_1.Tooltip, Object.assign({}, props, { fallbackPlacements: fallbackPlacements, arrowPosition: prepareArrowPosition(props.arrowPosition) })));
|
|
@@ -13,7 +13,7 @@ export declare const AiSearchConversationRole: {
|
|
|
13
13
|
export type AiSearchConversationRole = (typeof AiSearchConversationRole)[keyof typeof AiSearchConversationRole];
|
|
14
14
|
export declare const AI_SEARCH_ERROR_CONFIG: Record<AiSearchError, AiSearchErrorConfig>;
|
|
15
15
|
export declare const AI_SEARCH_MAX_MESSAGE_LENGTH = 45000;
|
|
16
|
-
export declare const SEARCH_DEBOUNCE_TIME_MS =
|
|
16
|
+
export declare const SEARCH_DEBOUNCE_TIME_MS = 500;
|
|
17
17
|
export declare const DEFAULT_KEYBOARD_SHORTCUTS = "\u2318+K,CTRL+K";
|
|
18
18
|
export declare const TOOL_CALL_DISPLAY_TEXT: Partial<Record<string, {
|
|
19
19
|
inProgressText: string;
|
|
@@ -38,7 +38,7 @@ exports.AI_SEARCH_ERROR_CONFIG = {
|
|
|
38
38
|
[AiSearchError.ErrorProcessingResponse]: defaultErrorConfig,
|
|
39
39
|
};
|
|
40
40
|
exports.AI_SEARCH_MAX_MESSAGE_LENGTH = 45000;
|
|
41
|
-
exports.SEARCH_DEBOUNCE_TIME_MS =
|
|
41
|
+
exports.SEARCH_DEBOUNCE_TIME_MS = 500;
|
|
42
42
|
exports.DEFAULT_KEYBOARD_SHORTCUTS = '⌘+K,CTRL+K';
|
|
43
43
|
exports.TOOL_CALL_DISPLAY_TEXT = {
|
|
44
44
|
[search_1.ToolCallName.SearchDocumentation]: {
|
|
@@ -8,7 +8,7 @@ function useCatalogEntitySchema({ entity, relatedEntity }) {
|
|
|
8
8
|
try {
|
|
9
9
|
parsedSchema = JSON.parse(schema);
|
|
10
10
|
}
|
|
11
|
-
catch (
|
|
11
|
+
catch (_c) {
|
|
12
12
|
parsedSchema = undefined;
|
|
13
13
|
}
|
|
14
14
|
let parsedApiDefinition;
|
|
@@ -17,7 +17,7 @@ function useCatalogEntitySchema({ entity, relatedEntity }) {
|
|
|
17
17
|
? JSON.parse(relatedEntity.metadata.schema)
|
|
18
18
|
: undefined;
|
|
19
19
|
}
|
|
20
|
-
catch (
|
|
20
|
+
catch (_d) {
|
|
21
21
|
parsedApiDefinition = undefined;
|
|
22
22
|
}
|
|
23
23
|
const definition = !parsedApiDefinition || ((_b = relatedEntity === null || relatedEntity === void 0 ? void 0 : relatedEntity.metadata) === null || _b === void 0 ? void 0 : _b.specType) !== 'openapi'
|
|
@@ -42,7 +42,7 @@ function useCodeWalkthroughControls(filters, inputs, toggles, enableDeepLink) {
|
|
|
42
42
|
Object.entries(newState).forEach(([id, control]) => {
|
|
43
43
|
const existingControl = controlsState[id];
|
|
44
44
|
if (existingControl && existingControl.type === control.type) {
|
|
45
|
-
// @ts-
|
|
45
|
+
// @ts-expect-error
|
|
46
46
|
newState[id] = Object.assign(Object.assign({}, control), { value: existingControl.value });
|
|
47
47
|
}
|
|
48
48
|
});
|
package/lib/core/hooks/index.js
CHANGED
|
@@ -71,4 +71,5 @@ __exportStar(require("./use-toast"), exports);
|
|
|
71
71
|
__exportStar(require("./use-toast-logic"), exports);
|
|
72
72
|
__exportStar(require("./use-banner-telemetry"), exports);
|
|
73
73
|
__exportStar(require("./use-tooltip-fallback-placement"), exports);
|
|
74
|
+
__exportStar(require("./use-anchor-positioning"), exports);
|
|
74
75
|
//# sourceMappingURL=index.js.map
|
|
@@ -46,9 +46,9 @@ function useNestedMenu({ item, labelRef, nestedMenuRef }) {
|
|
|
46
46
|
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
|
|
47
47
|
rect.right <= (window.innerWidth || document.documentElement.clientWidth);
|
|
48
48
|
// Only scroll if element is in viewport to prevent page jumping
|
|
49
|
-
// @ts-
|
|
49
|
+
// @ts-expect-error
|
|
50
50
|
if (isInViewport && typeof el.scrollIntoViewIfNeeded === 'function') {
|
|
51
|
-
// @ts-
|
|
51
|
+
// @ts-expect-error
|
|
52
52
|
el.scrollIntoViewIfNeeded(centerIfNeeded);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAnchorPositioning = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useAnchorPositioning = () => {
|
|
6
|
+
const [isSupported, setIsSupported] = (0, react_1.useState)(false);
|
|
7
|
+
(0, react_1.useEffect)(() => {
|
|
8
|
+
setIsSupported(isAnchorPositioningSupported());
|
|
9
|
+
}, []);
|
|
10
|
+
return { isSupported };
|
|
11
|
+
};
|
|
12
|
+
exports.useAnchorPositioning = useAnchorPositioning;
|
|
13
|
+
function isAnchorPositioningSupported() {
|
|
14
|
+
if (typeof CSS === 'undefined' || typeof CSS.supports !== 'function') {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
return (CSS.supports('anchor-name: --a') &&
|
|
18
|
+
CSS.supports('position-anchor: --a') &&
|
|
19
|
+
CSS.supports('top: anchor(top)'));
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=use-anchor-positioning.js.map
|
|
@@ -23,8 +23,10 @@ function useDialogHotKeys(ref, onClose) {
|
|
|
23
23
|
};
|
|
24
24
|
const onFocusableElementsHandler = () => {
|
|
25
25
|
var _a;
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
var _b;
|
|
27
|
+
const focusableElements = Array.from((_b = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll('input, textarea, select, button, [href], [tabindex]:not([tabindex="-1"])')) !== null && _b !== void 0 ? _b : []).filter((element) => !element.hasAttribute('disabled') &&
|
|
28
|
+
(typeof element.checkVisibility !== 'function' || element.checkVisibility()));
|
|
29
|
+
if (focusableElements.length > 0) {
|
|
28
30
|
firstFocusableRef.current = focusableElements[0];
|
|
29
31
|
lastFocusableRef.current = focusableElements[focusableElements.length - 1];
|
|
30
32
|
}
|
|
@@ -5,7 +5,6 @@ const react_1 = require("react");
|
|
|
5
5
|
const ThemeDataContext_1 = require("../contexts/ThemeDataContext");
|
|
6
6
|
const use_telemetry_fallback_1 = require("./use-telemetry-fallback");
|
|
7
7
|
const fallbacks = {
|
|
8
|
-
useAnchorPositioning: () => ({ isSupported: false }),
|
|
9
8
|
useTranslate: () => ({
|
|
10
9
|
translate: (value, options) => (typeof options === 'string' ? options : options === null || options === void 0 ? void 0 : options.defaultValue) || value || '',
|
|
11
10
|
}),
|
|
@@ -14,9 +14,6 @@ import type { TFunction } from './l10n';
|
|
|
14
14
|
import type { BreadcrumbItem } from './breadcrumb';
|
|
15
15
|
import type { AiSearchError } from '../constants/search';
|
|
16
16
|
export type ThemeHooks = {
|
|
17
|
-
useAnchorPositioning: () => {
|
|
18
|
-
isSupported: boolean;
|
|
19
|
-
};
|
|
20
17
|
useTranslate: () => {
|
|
21
18
|
translate: TFunction;
|
|
22
19
|
};
|