@antscorp/antsomi-ui 2.0.102 → 2.0.104
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/es/__mocks__/sql-query.json +56 -0
- package/es/assets/css/main.scss +2 -2
- package/es/components/atoms/App/App.d.ts +7 -0
- package/es/components/atoms/App/App.js +5 -0
- package/es/components/atoms/App/index.d.ts +1 -0
- package/es/components/atoms/App/index.js +1 -0
- package/es/components/atoms/Input/Input.d.ts +11 -17
- package/es/components/atoms/Input/Input.js +11 -12
- package/es/components/atoms/List/List.d.ts +1 -0
- package/es/components/atoms/List/List.js +1 -0
- package/es/components/atoms/List/index.d.ts +1 -0
- package/es/components/atoms/List/index.js +1 -0
- package/es/components/atoms/Scrollbars/Scrollbars.d.ts +3 -4
- package/es/components/atoms/Scrollbars/Scrollbars.js +2 -1
- package/es/components/atoms/SlideBar/SlideBar.js +1 -1
- package/es/components/atoms/Tag/Tag.js +1 -1
- package/es/components/atoms/index.d.ts +3 -0
- package/es/components/atoms/index.js +2 -0
- package/es/components/icons/FeedbackOutlinedIcon.d.ts +3 -0
- package/es/components/icons/FeedbackOutlinedIcon.js +7 -0
- package/es/components/icons/LazyIcon/LazyIcon.d.ts +5 -0
- package/es/components/icons/LazyIcon/LazyIcon.js +5 -0
- package/es/components/icons/NavigateBeforeIcon.d.ts +3 -0
- package/es/components/icons/NavigateBeforeIcon.js +7 -0
- package/es/components/icons/NavigateNextIcon.d.ts +3 -0
- package/es/components/icons/NavigateNextIcon.js +7 -0
- package/es/components/icons/PenSparkIcon.d.ts +3 -0
- package/es/components/icons/PenSparkIcon.js +7 -0
- package/es/components/icons/StatusSuccessIcon.d.ts +3 -0
- package/es/components/icons/StatusSuccessIcon.js +7 -0
- package/es/components/icons/SummarizeIconIcon.d.ts +3 -0
- package/es/components/icons/SummarizeIconIcon.js +7 -0
- package/es/components/icons/index.d.ts +5 -0
- package/es/components/icons/index.js +5 -0
- package/es/components/index.scss +1 -0
- package/es/components/molecules/AddDynamicContent/AddDynamicContent.d.ts +1 -2
- package/es/components/molecules/CalendarSelection/constants.d.ts +1 -1
- package/es/components/molecules/CalendarSelection/constants.js +1 -1
- package/es/components/molecules/CaptureScreen/CaptureScreen.d.ts +8 -2
- package/es/components/molecules/CaptureScreen/CaptureScreen.js +2 -2
- package/es/components/molecules/DrawerDetail/DrawerDetail.js +19 -7
- package/es/components/molecules/DrawerDetail/types.d.ts +5 -0
- package/es/components/molecules/EditingListV2/components/Loadable.d.ts +1 -1
- package/es/components/molecules/EditorScript/EditorScript.d.ts +1 -2
- package/es/components/molecules/EditorScript/EditorScript.js +5 -1
- package/es/components/molecules/FontSizeInput/index.scss +15 -0
- package/es/components/molecules/Select/styled.js +1 -1
- package/es/components/molecules/SelectAccount/type.d.ts +1 -1
- package/es/components/molecules/TagifyInput/utils.style.js +1 -0
- package/es/components/molecules/TemplateSaveAs/hooks/useTemplateSave.d.ts +1 -1
- package/es/components/organism/AccountProfile/components/AccountSetting/AccountSetting.js +2 -1
- package/es/components/organism/AccountProfile/components/AccountSetting/components/LanguageSelector/styles.d.ts +1 -1
- package/es/components/organism/AccountProfile/components/AccountSetting/components/LanguageSelector/styles.js +1 -1
- package/es/components/organism/ActivityTimeline/__mocks__/event_tracking.json +1290 -0
- package/es/components/organism/ActivityTimeline/__mocks__/timeline.json +3059 -0
- package/es/components/organism/BasicLogin/BasicLogin.js +1 -10
- package/es/components/organism/BasicLogin/components/AuthenticateResult/AuthenticateResult.js +1 -1
- package/es/components/organism/BasicLogin/styled.js +1 -1
- package/es/components/organism/DataTable/hooks/useDataTableListing/useDataTableListing.js +5 -4
- package/es/components/organism/Login/Login.js +1 -5
- package/es/components/organism/Login/components/LoginWithEmail/styled.js +1 -1
- package/es/components/organism/Login/components/SetupGGAuthenticator/styled.js +1 -1
- package/es/components/organism/Login/components/SignIn/styled.js +1 -1
- package/es/components/organism/Login/components/WidgetLayout/styled.js +1 -1
- package/es/components/organism/Login/styled.d.ts +3 -3
- package/es/components/organism/Login/styled.js +11 -11
- package/es/components/organism/ModifyColumnModal/styled.d.ts +2 -2
- package/es/components/organism/PreviewTemplateModal/components/ThumbnailSlider/styled.d.ts +1 -2
- package/es/components/organism/PreviewTemplateModal/components/ThumbnailSlider/styled.js +3 -1
- package/es/components/organism/SQLGeneration/SQLGeneration.d.ts +3 -0
- package/es/components/organism/SQLGeneration/SQLGeneration.js +26 -0
- package/es/components/organism/SQLGeneration/components/CheckboxShowDiff.d.ts +2 -0
- package/es/components/organism/SQLGeneration/components/CheckboxShowDiff.js +16 -0
- package/es/components/organism/SQLGeneration/components/EditTableSourcesDrawer.d.ts +2 -0
- package/es/components/organism/SQLGeneration/components/EditTableSourcesDrawer.js +56 -0
- package/es/components/organism/SQLGeneration/components/ErrorDisplay.d.ts +21 -0
- package/es/components/organism/SQLGeneration/components/ErrorDisplay.js +69 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationActions.d.ts +4 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationActions.js +23 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationCodeBlock.d.ts +2 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationCodeBlock.js +22 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationEditPrompt.d.ts +2 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationEditPrompt.js +66 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationHeader.d.ts +2 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationHeader.js +10 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationModal.d.ts +2 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationModal.js +35 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationPagination.d.ts +4 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationPagination.js +13 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationPrompt.d.ts +2 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationPrompt.js +31 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationPromptDisplay.d.ts +2 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationPromptDisplay.js +15 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationQuerySummary.d.ts +2 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationQuerySummary.js +17 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationRefine.d.ts +1 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationRefine.js +55 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationResult.d.ts +5 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationResult.js +29 -0
- package/es/components/organism/SQLGeneration/components/index.d.ts +9 -0
- package/es/components/organism/SQLGeneration/components/index.js +9 -0
- package/es/components/organism/SQLGeneration/components/styled.d.ts +52 -0
- package/es/components/organism/SQLGeneration/components/styled.js +382 -0
- package/es/components/organism/SQLGeneration/constants.d.ts +48 -0
- package/es/components/organism/SQLGeneration/constants.js +48 -0
- package/es/components/organism/SQLGeneration/hooks/index.d.ts +1 -0
- package/es/components/organism/SQLGeneration/hooks/index.js +1 -0
- package/es/components/organism/SQLGeneration/hooks/useKeyboardNavigation.d.ts +14 -0
- package/es/components/organism/SQLGeneration/hooks/useKeyboardNavigation.js +123 -0
- package/es/components/organism/SQLGeneration/index.d.ts +10 -0
- package/es/components/organism/SQLGeneration/index.js +6 -0
- package/es/components/organism/SQLGeneration/index.scss +1 -0
- package/es/components/organism/SQLGeneration/integrations/AceEditor/index.d.ts +1 -0
- package/es/components/organism/SQLGeneration/integrations/AceEditor/index.js +1 -0
- package/es/components/organism/SQLGeneration/integrations/AceEditor/index.scss +4 -0
- package/es/components/organism/SQLGeneration/integrations/AceEditor/useAceEditor.d.ts +9 -0
- package/es/components/organism/SQLGeneration/integrations/AceEditor/useAceEditor.js +24 -0
- package/es/components/organism/SQLGeneration/integrations/AceEditor/useEnhancePlaceholder.d.ts +10 -0
- package/es/components/organism/SQLGeneration/integrations/AceEditor/useEnhancePlaceholder.js +172 -0
- package/es/components/organism/SQLGeneration/integrations/AceEditor/useInsertQuery.d.ts +8 -0
- package/es/components/organism/SQLGeneration/integrations/AceEditor/useInsertQuery.js +21 -0
- package/es/components/organism/SQLGeneration/integrations/AntsomiAI/index.d.ts +1 -0
- package/es/components/organism/SQLGeneration/integrations/AntsomiAI/index.js +1 -0
- package/es/components/organism/SQLGeneration/integrations/AntsomiAI/useAntsomiAI.d.ts +1 -0
- package/es/components/organism/SQLGeneration/integrations/AntsomiAI/useAntsomiAI.js +35 -0
- package/es/components/organism/SQLGeneration/integrations/AntsomiSqlWS/index.d.ts +1 -0
- package/es/components/organism/SQLGeneration/integrations/AntsomiSqlWS/index.js +1 -0
- package/es/components/organism/SQLGeneration/integrations/AntsomiSqlWS/useAntsomiSqlWS.d.ts +7 -0
- package/es/components/organism/SQLGeneration/integrations/AntsomiSqlWS/useAntsomiSqlWS.js +10 -0
- package/es/components/organism/SQLGeneration/selectors.d.ts +857 -0
- package/es/components/organism/SQLGeneration/selectors.js +61 -0
- package/es/components/organism/SQLGeneration/store/index.d.ts +2 -0
- package/es/components/organism/SQLGeneration/store/index.js +1 -0
- package/es/components/organism/SQLGeneration/store/provider.d.ts +7 -0
- package/es/components/organism/SQLGeneration/store/provider.js +40 -0
- package/es/components/organism/SQLGeneration/store/store.d.ts +383 -0
- package/es/components/organism/SQLGeneration/store/store.js +309 -0
- package/es/components/organism/SQLGeneration/store/types.d.ts +97 -0
- package/es/components/organism/SQLGeneration/store/types.js +1 -0
- package/es/components/organism/SQLGeneration/types.d.ts +29 -0
- package/es/components/organism/SQLGeneration/types.js +1 -0
- package/es/components/organism/index.d.ts +1 -0
- package/es/components/organism/index.js +1 -0
- package/es/components/organism/index.scss +1 -0
- package/es/components/template/TemplateListing/hooks/useTemplateListing.d.ts +3 -4
- package/es/hooks/index.d.ts +1 -0
- package/es/hooks/index.js +1 -0
- package/es/hooks/useFocusManagement.d.ts +14 -0
- package/es/hooks/useFocusManagement.js +124 -0
- package/es/locales/ja/google-sheet.json +2 -2
- package/es/providers/ConfigProvider/ConfigProvider.js +4 -1
- package/es/providers/ConfigProvider/GlobalStyle.js +153 -46
- package/es/queries/AI/index.d.ts +23 -0
- package/es/queries/AI/index.js +4 -0
- package/es/queries/AI/useSqlGeneration.d.ts +25 -0
- package/es/queries/AI/useSqlGeneration.js +13 -0
- package/es/queries/TemplateListing/index.d.ts +2 -2
- package/es/queries/index.d.ts +1 -0
- package/es/queries/index.js +1 -0
- package/es/services/AI/index.d.ts +15 -0
- package/es/services/AI/index.js +15 -0
- package/es/types/auth.d.ts +25 -0
- package/es/types/auth.js +1 -0
- package/es/types/index.d.ts +1 -0
- package/es/types/index.js +1 -0
- package/es/utils/common.d.ts +1 -0
- package/es/utils/common.js +16 -1
- package/es/utils/web.d.ts +16 -3
- package/es/utils/web.js +36 -3
- package/es/utils/zustand.d.ts +10 -0
- package/es/utils/zustand.js +8 -0
- package/package.json +15 -10
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
// Libraries
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
// Components
|
|
4
|
+
import { Button, Typography } from '../../../atoms';
|
|
5
|
+
import { EditorScript } from '../../../molecules/EditorScript';
|
|
6
|
+
import { Modal } from '../../../molecules/Modal';
|
|
7
|
+
// Constants
|
|
8
|
+
import { THEME } from '../../../../constants';
|
|
9
|
+
import { Space } from 'antd';
|
|
10
|
+
const { Text } = Typography;
|
|
11
|
+
// SQLGenerationPopover styles
|
|
12
|
+
export const PopoverContent = styled.div `
|
|
13
|
+
max-width: ${props => props.maxWidth || 800}px;
|
|
14
|
+
padding: 0;
|
|
15
|
+
border-radius: 8px;
|
|
16
|
+
box-shadow:
|
|
17
|
+
0 6px 16px 0 rgba(0, 0, 0, 0.08),
|
|
18
|
+
0 3px 6px -4px rgba(0, 0, 0, 0.12),
|
|
19
|
+
0 9px 28px 8px rgba(0, 0, 0, 0.05);
|
|
20
|
+
`;
|
|
21
|
+
export const PopoverBody = styled.div `
|
|
22
|
+
padding: 0 16px 16px;
|
|
23
|
+
`;
|
|
24
|
+
// SQLGenerationHeader styles
|
|
25
|
+
export const HeaderContainer = styled.div `
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: space-between;
|
|
29
|
+
padding: 16px 16px 12px;
|
|
30
|
+
border-bottom: 1px solid #f0f0f0;
|
|
31
|
+
margin-bottom: 16px;
|
|
32
|
+
`;
|
|
33
|
+
export const HeaderContent = styled.div `
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
gap: 8px;
|
|
37
|
+
`;
|
|
38
|
+
export const HeaderTitle = styled(Text) `
|
|
39
|
+
&.antsomi-typography {
|
|
40
|
+
font-size: 16px;
|
|
41
|
+
font-weight: 500;
|
|
42
|
+
color: #202124;
|
|
43
|
+
margin: 0;
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
46
|
+
export const CloseButton = styled(Button) `
|
|
47
|
+
border: none;
|
|
48
|
+
box-shadow: none;
|
|
49
|
+
padding: 4px;
|
|
50
|
+
min-width: auto;
|
|
51
|
+
height: auto;
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
|
|
56
|
+
&:hover {
|
|
57
|
+
background-color: #f5f5f5;
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
60
|
+
// SQLGenerationPrompt styles
|
|
61
|
+
export const PromptSection = styled(Space) `
|
|
62
|
+
margin-bottom: 0px;
|
|
63
|
+
`;
|
|
64
|
+
export const PromptTextArea = styled.textarea `
|
|
65
|
+
width: 100%;
|
|
66
|
+
min-height: 72px;
|
|
67
|
+
max-height: 144px;
|
|
68
|
+
resize: none;
|
|
69
|
+
font-size: 14px;
|
|
70
|
+
line-height: 1.5;
|
|
71
|
+
border: 1px solid #d9d9d9;
|
|
72
|
+
border-radius: 4px;
|
|
73
|
+
padding: 8px 12px;
|
|
74
|
+
font-family: inherit;
|
|
75
|
+
outline: none;
|
|
76
|
+
transition: border-color 0.2s;
|
|
77
|
+
|
|
78
|
+
&:focus {
|
|
79
|
+
border-color: ${THEME.token?.colorPrimary};
|
|
80
|
+
box-shadow: 0 0 0 2px rgba(0, 94, 184, 0.1);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&::placeholder {
|
|
84
|
+
color: ${THEME.token?.colorTextPlaceholder};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&:disabled {
|
|
88
|
+
background-color: #f5f5f5;
|
|
89
|
+
cursor: not-allowed;
|
|
90
|
+
}
|
|
91
|
+
`;
|
|
92
|
+
export const GenerateButtonContainer = styled.div `
|
|
93
|
+
display: flex;
|
|
94
|
+
justify-content: flex-end;
|
|
95
|
+
margin-top: 12px;
|
|
96
|
+
`;
|
|
97
|
+
export const GenerateButton = styled(Button) `
|
|
98
|
+
border-radius: 6px;
|
|
99
|
+
font-weight: 500;
|
|
100
|
+
`;
|
|
101
|
+
// SQLGenerationResult styles
|
|
102
|
+
export const ResultSection = styled.div `
|
|
103
|
+
margin-bottom: 16px;
|
|
104
|
+
min-height: 200px;
|
|
105
|
+
`;
|
|
106
|
+
export const LoadingContainer = styled.div `
|
|
107
|
+
display: flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
justify-content: center;
|
|
110
|
+
min-height: 100px;
|
|
111
|
+
color: #666;
|
|
112
|
+
flex-direction: column;
|
|
113
|
+
gap: 12px;
|
|
114
|
+
`;
|
|
115
|
+
export const SQLCodeBlock = styled(EditorScript) `
|
|
116
|
+
padding: 0 12px;
|
|
117
|
+
background: #f1f3f4;
|
|
118
|
+
border-top-left-radius: 8px;
|
|
119
|
+
border-top-right-radius: 8px;
|
|
120
|
+
`;
|
|
121
|
+
export const ResultInfo = styled.div `
|
|
122
|
+
display: flex;
|
|
123
|
+
align-items: center;
|
|
124
|
+
gap: 8px;
|
|
125
|
+
background: #dbddde;
|
|
126
|
+
border-bottom-left-radius: 8px;
|
|
127
|
+
border-bottom-right-radius: 8px;
|
|
128
|
+
padding: 4px 12px;
|
|
129
|
+
`;
|
|
130
|
+
export const PaginationIndicator = styled.div `
|
|
131
|
+
display: flex;
|
|
132
|
+
justify-content: center;
|
|
133
|
+
align-items: center;
|
|
134
|
+
gap: 8px;
|
|
135
|
+
`;
|
|
136
|
+
// SQLGenerationActions styles
|
|
137
|
+
export const ActionsSection = styled.div `
|
|
138
|
+
border-top: 1px solid #f0f0f0;
|
|
139
|
+
padding-top: 12px;
|
|
140
|
+
`;
|
|
141
|
+
export const ActionButton = styled(Button) `
|
|
142
|
+
border-radius: 6px;
|
|
143
|
+
font-size: 13px;
|
|
144
|
+
height: 32px;
|
|
145
|
+
padding: 0 12px;
|
|
146
|
+
|
|
147
|
+
&.primary {
|
|
148
|
+
font-weight: 500;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
&.with-icon {
|
|
152
|
+
display: flex;
|
|
153
|
+
align-items: center;
|
|
154
|
+
gap: 4px;
|
|
155
|
+
}
|
|
156
|
+
`;
|
|
157
|
+
export const CautionLink = styled(Button) `
|
|
158
|
+
font-size: 13px;
|
|
159
|
+
height: 32px;
|
|
160
|
+
padding: 0 4px;
|
|
161
|
+
color: #1a73e8;
|
|
162
|
+
text-decoration: underline;
|
|
163
|
+
margin-left: auto;
|
|
164
|
+
|
|
165
|
+
&:hover {
|
|
166
|
+
color: #1557b0;
|
|
167
|
+
}
|
|
168
|
+
`;
|
|
169
|
+
export const RatingSection = styled.div `
|
|
170
|
+
margin-top: 12px;
|
|
171
|
+
display: flex;
|
|
172
|
+
align-items: center;
|
|
173
|
+
gap: 8px;
|
|
174
|
+
`;
|
|
175
|
+
export const RatingText = styled.span `
|
|
176
|
+
font-size: 13px;
|
|
177
|
+
color: #5f6368;
|
|
178
|
+
`;
|
|
179
|
+
export const RatingButton = styled(Button) `
|
|
180
|
+
min-width: auto;
|
|
181
|
+
height: 24px;
|
|
182
|
+
padding: 0 4px;
|
|
183
|
+
border: none;
|
|
184
|
+
box-shadow: none;
|
|
185
|
+
|
|
186
|
+
&:hover {
|
|
187
|
+
background-color: #f5f5f5;
|
|
188
|
+
}
|
|
189
|
+
`;
|
|
190
|
+
// EditTableSourcesModal styles
|
|
191
|
+
export const StyledModal = styled(Modal) `
|
|
192
|
+
.antsomi-modal-header {
|
|
193
|
+
border-bottom: 1px solid #f0f0f0;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.antsomi-modal-body {
|
|
197
|
+
padding: 16px 24px;
|
|
198
|
+
}
|
|
199
|
+
`;
|
|
200
|
+
export const ModalDescription = styled(Text) `
|
|
201
|
+
font-size: 14px;
|
|
202
|
+
color: ${THEME.token?.colorTextSecondary};
|
|
203
|
+
margin-bottom: 16px;
|
|
204
|
+
display: block;
|
|
205
|
+
`;
|
|
206
|
+
export const SearchSection = styled.div `
|
|
207
|
+
display: flex;
|
|
208
|
+
gap: 12px;
|
|
209
|
+
padding: 12px;
|
|
210
|
+
background-color: #f8f9fa;
|
|
211
|
+
border-radius: 6px;
|
|
212
|
+
border: 1px solid #e9ecef;
|
|
213
|
+
margin-bottom: 16px;
|
|
214
|
+
`;
|
|
215
|
+
export const LanguageSelector = styled.div `
|
|
216
|
+
display: flex;
|
|
217
|
+
align-items: center;
|
|
218
|
+
gap: 8px;
|
|
219
|
+
font-size: 14px;
|
|
220
|
+
font-weight: 500;
|
|
221
|
+
cursor: pointer;
|
|
222
|
+
`;
|
|
223
|
+
export const SearchInput = styled.div `
|
|
224
|
+
flex: 1;
|
|
225
|
+
`;
|
|
226
|
+
export const SearchActions = styled.div `
|
|
227
|
+
display: flex;
|
|
228
|
+
align-items: center;
|
|
229
|
+
gap: 8px;
|
|
230
|
+
`;
|
|
231
|
+
export const GeneratedSearchInfo = styled.div `
|
|
232
|
+
font-size: 13px;
|
|
233
|
+
color: #5f6368;
|
|
234
|
+
margin-bottom: 16px;
|
|
235
|
+
`;
|
|
236
|
+
export const TableListHeader = styled.div `
|
|
237
|
+
display: flex;
|
|
238
|
+
align-items: center;
|
|
239
|
+
justify-content: space-between;
|
|
240
|
+
margin-bottom: 12px;
|
|
241
|
+
padding-bottom: 8px;
|
|
242
|
+
border-bottom: 1px solid #f0f0f0;
|
|
243
|
+
`;
|
|
244
|
+
export const TableListHeaderLeft = styled.div `
|
|
245
|
+
display: flex;
|
|
246
|
+
align-items: center;
|
|
247
|
+
gap: 8px;
|
|
248
|
+
`;
|
|
249
|
+
export const TableListHeaderRight = styled.div `
|
|
250
|
+
display: flex;
|
|
251
|
+
align-items: center;
|
|
252
|
+
gap: 16px;
|
|
253
|
+
`;
|
|
254
|
+
export const TableListContainer = styled.div `
|
|
255
|
+
max-height: 300px;
|
|
256
|
+
overflow-y: auto;
|
|
257
|
+
`;
|
|
258
|
+
export const TableItem = styled.div `
|
|
259
|
+
display: flex;
|
|
260
|
+
align-items: center;
|
|
261
|
+
gap: 12px;
|
|
262
|
+
padding: 8px 0;
|
|
263
|
+
border-bottom: 1px solid #f5f5f5;
|
|
264
|
+
`;
|
|
265
|
+
export const TableItemContent = styled.div `
|
|
266
|
+
display: flex;
|
|
267
|
+
align-items: center;
|
|
268
|
+
gap: 8px;
|
|
269
|
+
flex: 1;
|
|
270
|
+
`;
|
|
271
|
+
export const TableName = styled(Text) `
|
|
272
|
+
font-size: 14px;
|
|
273
|
+
color: #1a73e8;
|
|
274
|
+
`;
|
|
275
|
+
export const EmptyState = styled.div `
|
|
276
|
+
text-align: center;
|
|
277
|
+
padding: 40px 20px;
|
|
278
|
+
color: #999;
|
|
279
|
+
`;
|
|
280
|
+
export const PaginationControls = styled.div `
|
|
281
|
+
display: flex;
|
|
282
|
+
align-items: center;
|
|
283
|
+
gap: 4px;
|
|
284
|
+
`;
|
|
285
|
+
export const PaginationText = styled(Text) `
|
|
286
|
+
font-size: 13px;
|
|
287
|
+
color: ${THEME.token?.colorTextSecondary};
|
|
288
|
+
`;
|
|
289
|
+
// Edit Prompt Styles
|
|
290
|
+
export const EditPromptSection = styled.div `
|
|
291
|
+
display: flex;
|
|
292
|
+
gap: 12px;
|
|
293
|
+
margin-bottom: 16px;
|
|
294
|
+
`;
|
|
295
|
+
export const EditPromptInput = styled.div `
|
|
296
|
+
display: flex;
|
|
297
|
+
align-items: center;
|
|
298
|
+
flex: 1;
|
|
299
|
+
|
|
300
|
+
.input__wrapper {
|
|
301
|
+
width: 100%;
|
|
302
|
+
}
|
|
303
|
+
`;
|
|
304
|
+
export const EditPromptActions = styled.div `
|
|
305
|
+
display: flex;
|
|
306
|
+
justify-content: flex-end;
|
|
307
|
+
align-items: center;
|
|
308
|
+
`;
|
|
309
|
+
// Prompt Display Styles
|
|
310
|
+
export const PromptDisplaySection = styled.div `
|
|
311
|
+
display: flex;
|
|
312
|
+
justify-content: space-between;
|
|
313
|
+
align-items: center;
|
|
314
|
+
margin-bottom: 16px;
|
|
315
|
+
gap: 12px;
|
|
316
|
+
`;
|
|
317
|
+
export const PromptDisplayText = styled.div `
|
|
318
|
+
flex: 1;
|
|
319
|
+
line-height: 1.4;
|
|
320
|
+
`;
|
|
321
|
+
export const PromptDisplayActions = styled.div `
|
|
322
|
+
flex-shrink: 0;
|
|
323
|
+
`;
|
|
324
|
+
export const SummarySection = styled.div `
|
|
325
|
+
margin-top: 16px;
|
|
326
|
+
max-height: 60px;
|
|
327
|
+
overflow-y: auto;
|
|
328
|
+
display: flex;
|
|
329
|
+
gap: 10px;
|
|
330
|
+
|
|
331
|
+
&.loading {
|
|
332
|
+
display: flex;
|
|
333
|
+
align-items: center;
|
|
334
|
+
justify-content: center;
|
|
335
|
+
height: 60px;
|
|
336
|
+
}
|
|
337
|
+
`;
|
|
338
|
+
export const RefineSection = styled.div `
|
|
339
|
+
display: flex;
|
|
340
|
+
gap: 12px;
|
|
341
|
+
margin-top: 16px;
|
|
342
|
+
margin-bottom: 16px;
|
|
343
|
+
`;
|
|
344
|
+
// Global styles for accessibility
|
|
345
|
+
export const AccessibilityStyles = styled.div `
|
|
346
|
+
/* Focus indicators */
|
|
347
|
+
.antsomi-btn:focus-visible,
|
|
348
|
+
.antsomi-input:focus-visible,
|
|
349
|
+
.antsomi-checkbox:focus-visible {
|
|
350
|
+
outline: 2px solid #1890ff !important;
|
|
351
|
+
outline-offset: 2px !important;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/* High contrast mode support */
|
|
355
|
+
@media (prefers-contrast: high) {
|
|
356
|
+
.sql-generation-modal {
|
|
357
|
+
border: 2px solid !important;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/* Reduced motion support */
|
|
362
|
+
@media (prefers-reduced-motion: reduce) {
|
|
363
|
+
.antsomi-spin {
|
|
364
|
+
animation: none !important;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/* Error display styles */
|
|
369
|
+
.sql-generation-error {
|
|
370
|
+
margin: 12px 0;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/* Keyboard shortcuts help */
|
|
374
|
+
kbd {
|
|
375
|
+
background-color: #f5f5f5;
|
|
376
|
+
border: 1px solid #d9d9d9;
|
|
377
|
+
border-radius: 3px;
|
|
378
|
+
padding: 2px 4px;
|
|
379
|
+
font-family: monospace;
|
|
380
|
+
font-size: 0.85em;
|
|
381
|
+
}
|
|
382
|
+
`;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export declare const SQL_GENERATION_CONSTANTS: {
|
|
2
|
+
readonly POPOVER_WIDTH: 600;
|
|
3
|
+
readonly POPOVER_MAX_WIDTH: 800;
|
|
4
|
+
readonly TEXTAREA_MIN_ROWS: 3;
|
|
5
|
+
readonly TEXTAREA_MAX_ROWS: 6;
|
|
6
|
+
readonly MODAL_WIDTH: 800;
|
|
7
|
+
readonly PLACEHOLDER_TEXTS: {
|
|
8
|
+
readonly PROMPT: "Enter a prompt to generate a query";
|
|
9
|
+
readonly SEARCH_TABLES: "Search for tables...";
|
|
10
|
+
readonly REFINE_PROMPT: "Refine";
|
|
11
|
+
readonly NO_RESULT: "No SQL generated yet";
|
|
12
|
+
};
|
|
13
|
+
readonly LOADING_TEXTS: {
|
|
14
|
+
readonly GENERATING: "Generating SQL...";
|
|
15
|
+
};
|
|
16
|
+
readonly RESULT_TEXTS: {
|
|
17
|
+
readonly PROCESSED_DATA: "This query will process {size} when run.";
|
|
18
|
+
};
|
|
19
|
+
readonly BUTTON_TEXTS: {
|
|
20
|
+
readonly GENERATE: "Generate";
|
|
21
|
+
readonly EDIT: "Edit";
|
|
22
|
+
readonly INSERT: "Insert";
|
|
23
|
+
readonly EDIT_TABLE_SOURCES: "Edit Table Sources";
|
|
24
|
+
readonly QUERY_SUMMARY: "Query Summary";
|
|
25
|
+
readonly APPLY: "Apply";
|
|
26
|
+
readonly CLOSE: "Close";
|
|
27
|
+
readonly CANCEL: "Cancel";
|
|
28
|
+
};
|
|
29
|
+
readonly TITLES: {
|
|
30
|
+
readonly MAIN: "Generate SQL with AI";
|
|
31
|
+
readonly EDIT_TABLE_SOURCES: "Edit table sources";
|
|
32
|
+
readonly TABLE_ASSET: "Table asset";
|
|
33
|
+
readonly RATING: {
|
|
34
|
+
readonly THUMBS_UP: "This is helpful";
|
|
35
|
+
readonly THUMBS_DOWN: "This is not helpful";
|
|
36
|
+
readonly MORE_FEEDBACK: "More feedback";
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
readonly MESSAGES: {
|
|
40
|
+
readonly LOADING: "Generating SQL...";
|
|
41
|
+
readonly NO_RESULT: "No SQL generated yet";
|
|
42
|
+
readonly PROCESSING_INFO: "This query will process {size} when run.";
|
|
43
|
+
readonly TABLE_SOURCES_INFO: "Metadata associated with the selected tables will be used to refine your suggestion.";
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export declare const DEFAULT_RESULT_SETTINGS: {
|
|
47
|
+
showDiff: boolean;
|
|
48
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export const SQL_GENERATION_CONSTANTS = {
|
|
2
|
+
POPOVER_WIDTH: 600,
|
|
3
|
+
POPOVER_MAX_WIDTH: 800,
|
|
4
|
+
TEXTAREA_MIN_ROWS: 3,
|
|
5
|
+
TEXTAREA_MAX_ROWS: 6,
|
|
6
|
+
MODAL_WIDTH: 800,
|
|
7
|
+
PLACEHOLDER_TEXTS: {
|
|
8
|
+
PROMPT: 'Enter a prompt to generate a query',
|
|
9
|
+
SEARCH_TABLES: 'Search for tables...',
|
|
10
|
+
REFINE_PROMPT: 'Refine',
|
|
11
|
+
NO_RESULT: 'No SQL generated yet',
|
|
12
|
+
},
|
|
13
|
+
LOADING_TEXTS: {
|
|
14
|
+
GENERATING: 'Generating SQL...',
|
|
15
|
+
},
|
|
16
|
+
RESULT_TEXTS: {
|
|
17
|
+
PROCESSED_DATA: 'This query will process {size} when run.',
|
|
18
|
+
},
|
|
19
|
+
BUTTON_TEXTS: {
|
|
20
|
+
GENERATE: 'Generate',
|
|
21
|
+
EDIT: 'Edit',
|
|
22
|
+
INSERT: 'Insert',
|
|
23
|
+
EDIT_TABLE_SOURCES: 'Edit Table Sources',
|
|
24
|
+
QUERY_SUMMARY: 'Query Summary',
|
|
25
|
+
APPLY: 'Apply',
|
|
26
|
+
CLOSE: 'Close',
|
|
27
|
+
CANCEL: 'Cancel',
|
|
28
|
+
},
|
|
29
|
+
TITLES: {
|
|
30
|
+
MAIN: 'Generate SQL with AI',
|
|
31
|
+
EDIT_TABLE_SOURCES: 'Edit table sources',
|
|
32
|
+
TABLE_ASSET: 'Table asset',
|
|
33
|
+
RATING: {
|
|
34
|
+
THUMBS_UP: 'This is helpful',
|
|
35
|
+
THUMBS_DOWN: 'This is not helpful',
|
|
36
|
+
MORE_FEEDBACK: 'More feedback',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
MESSAGES: {
|
|
40
|
+
LOADING: 'Generating SQL...',
|
|
41
|
+
NO_RESULT: 'No SQL generated yet',
|
|
42
|
+
PROCESSING_INFO: 'This query will process {size} when run.',
|
|
43
|
+
TABLE_SOURCES_INFO: 'Metadata associated with the selected tables will be used to refine your suggestion.',
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
export const DEFAULT_RESULT_SETTINGS = {
|
|
47
|
+
showDiff: false,
|
|
48
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useKeyboardNavigation, useSQLGenerationKeyboard } from './useKeyboardNavigation';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useKeyboardNavigation, useSQLGenerationKeyboard } from './useKeyboardNavigation';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface KeyboardNavigationOptions {
|
|
2
|
+
onEscape?: () => void;
|
|
3
|
+
onEnter?: () => void;
|
|
4
|
+
onCtrlEnter?: () => void;
|
|
5
|
+
onArrowUp?: () => void;
|
|
6
|
+
onArrowDown?: () => void;
|
|
7
|
+
onArrowLeft?: () => void;
|
|
8
|
+
onArrowRight?: () => void;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const useKeyboardNavigation: (options?: KeyboardNavigationOptions) => {
|
|
12
|
+
handleKeyDown: (event: KeyboardEvent) => void;
|
|
13
|
+
};
|
|
14
|
+
export declare const useSQLGenerationKeyboard: () => void;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { useEffect, useCallback } from 'react';
|
|
2
|
+
import { useSQLGenerationStore } from '../store/provider';
|
|
3
|
+
import { selectHasResult, selectIsEditingPrompt, selectIsRefining, selectIsLoading, } from '../selectors';
|
|
4
|
+
export const useKeyboardNavigation = (options = {}) => {
|
|
5
|
+
const { onEscape, onEnter, onCtrlEnter, onArrowUp, onArrowDown, onArrowLeft, onArrowRight, disabled = false, } = options;
|
|
6
|
+
const handleKeyDown = useCallback((event) => {
|
|
7
|
+
if (disabled)
|
|
8
|
+
return;
|
|
9
|
+
const { key, ctrlKey, metaKey, altKey, shiftKey } = event;
|
|
10
|
+
const isModifierPressed = ctrlKey || metaKey || altKey || shiftKey;
|
|
11
|
+
// Prevent handling if user is typing in an input/textarea
|
|
12
|
+
const target = event.target;
|
|
13
|
+
const isInputElement = ['INPUT', 'TEXTAREA'].includes(target.tagName) || target.contentEditable === 'true';
|
|
14
|
+
switch (key) {
|
|
15
|
+
case 'Escape':
|
|
16
|
+
if (onEscape) {
|
|
17
|
+
event.preventDefault();
|
|
18
|
+
onEscape();
|
|
19
|
+
}
|
|
20
|
+
break;
|
|
21
|
+
case 'Enter':
|
|
22
|
+
if ((ctrlKey || metaKey) && onCtrlEnter) {
|
|
23
|
+
event.preventDefault();
|
|
24
|
+
onCtrlEnter();
|
|
25
|
+
}
|
|
26
|
+
else if (!isModifierPressed && !isInputElement && onEnter) {
|
|
27
|
+
event.preventDefault();
|
|
28
|
+
onEnter();
|
|
29
|
+
}
|
|
30
|
+
break;
|
|
31
|
+
case 'ArrowUp':
|
|
32
|
+
if (!isInputElement && onArrowUp) {
|
|
33
|
+
event.preventDefault();
|
|
34
|
+
onArrowUp();
|
|
35
|
+
}
|
|
36
|
+
break;
|
|
37
|
+
case 'ArrowDown':
|
|
38
|
+
if (!isInputElement && onArrowDown) {
|
|
39
|
+
event.preventDefault();
|
|
40
|
+
onArrowDown();
|
|
41
|
+
}
|
|
42
|
+
break;
|
|
43
|
+
case 'ArrowLeft':
|
|
44
|
+
if (!isInputElement && onArrowLeft) {
|
|
45
|
+
event.preventDefault();
|
|
46
|
+
onArrowLeft();
|
|
47
|
+
}
|
|
48
|
+
break;
|
|
49
|
+
case 'ArrowRight':
|
|
50
|
+
if (!isInputElement && onArrowRight) {
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
onArrowRight();
|
|
53
|
+
}
|
|
54
|
+
break;
|
|
55
|
+
default:
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
}, [disabled, onEscape, onEnter, onCtrlEnter, onArrowUp, onArrowDown, onArrowLeft, onArrowRight]);
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (disabled)
|
|
61
|
+
return;
|
|
62
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
63
|
+
return () => {
|
|
64
|
+
document.removeEventListener('keydown', handleKeyDown);
|
|
65
|
+
};
|
|
66
|
+
}, [handleKeyDown, disabled]);
|
|
67
|
+
return { handleKeyDown };
|
|
68
|
+
};
|
|
69
|
+
// Hook for SQL Generation specific keyboard shortcuts
|
|
70
|
+
export const useSQLGenerationKeyboard = () => {
|
|
71
|
+
const hasResults = useSQLGenerationStore(selectHasResult);
|
|
72
|
+
const isEditingPrompt = useSQLGenerationStore(selectIsEditingPrompt);
|
|
73
|
+
const isRefining = useSQLGenerationStore(selectIsRefining);
|
|
74
|
+
const isLoading = useSQLGenerationStore(selectIsLoading);
|
|
75
|
+
const setIsOpen = useSQLGenerationStore(s => s.setIsOpen);
|
|
76
|
+
const setIsEditingPrompt = useSQLGenerationStore(s => s.setIsEditingPrompt);
|
|
77
|
+
const generateSQL = useSQLGenerationStore(s => s.generateSQL);
|
|
78
|
+
const refineSQL = useSQLGenerationStore(s => s.refineSQL);
|
|
79
|
+
const setCurrentResultKey = useSQLGenerationStore(s => s.setCurrentResultKey);
|
|
80
|
+
const resultAllKeys = useSQLGenerationStore(s => s.results.allKeys);
|
|
81
|
+
const currentResultKey = useSQLGenerationStore(s => s.currentResultKey);
|
|
82
|
+
const handleEscape = useCallback(() => {
|
|
83
|
+
if (isEditingPrompt) {
|
|
84
|
+
setIsEditingPrompt(false);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
setIsOpen(false);
|
|
88
|
+
}
|
|
89
|
+
}, [isEditingPrompt, setIsEditingPrompt, setIsOpen]);
|
|
90
|
+
const handleCtrlEnter = useCallback(() => {
|
|
91
|
+
if (isLoading)
|
|
92
|
+
return;
|
|
93
|
+
if (isRefining) {
|
|
94
|
+
refineSQL();
|
|
95
|
+
}
|
|
96
|
+
else if (!hasResults) {
|
|
97
|
+
generateSQL();
|
|
98
|
+
}
|
|
99
|
+
}, [isLoading, isRefining, hasResults, refineSQL, generateSQL]);
|
|
100
|
+
const handleArrowLeft = useCallback(() => {
|
|
101
|
+
if (hasResults && resultAllKeys.length > 1) {
|
|
102
|
+
const currentIndex = resultAllKeys.indexOf(currentResultKey || '');
|
|
103
|
+
if (currentIndex > 0) {
|
|
104
|
+
setCurrentResultKey(resultAllKeys[currentIndex - 1]);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}, [hasResults, resultAllKeys, currentResultKey, setCurrentResultKey]);
|
|
108
|
+
const handleArrowRight = useCallback(() => {
|
|
109
|
+
if (hasResults && resultAllKeys.length > 1) {
|
|
110
|
+
const currentIndex = resultAllKeys.indexOf(currentResultKey || '');
|
|
111
|
+
if (currentIndex < resultAllKeys.length - 1) {
|
|
112
|
+
setCurrentResultKey(resultAllKeys[currentIndex + 1]);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}, [hasResults, resultAllKeys, currentResultKey, setCurrentResultKey]);
|
|
116
|
+
useKeyboardNavigation({
|
|
117
|
+
onEscape: handleEscape,
|
|
118
|
+
onCtrlEnter: handleCtrlEnter,
|
|
119
|
+
onArrowLeft: handleArrowLeft,
|
|
120
|
+
onArrowRight: handleArrowRight,
|
|
121
|
+
disabled: false,
|
|
122
|
+
});
|
|
123
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { SQLGeneration } from './SQLGeneration';
|
|
2
|
+
export type { SQLGenerationProps, SQLGenerationResult, TableSource } from './types';
|
|
3
|
+
export { SQLGenerationProvider, useSQLGenerationStore, type SQLGenerationProviderProps, } from './store';
|
|
4
|
+
export declare const SQLGenerationIntegrations: {
|
|
5
|
+
readonly useAntsomiSqlWS: (params?: {
|
|
6
|
+
triggerTitle: string;
|
|
7
|
+
} | undefined) => {
|
|
8
|
+
setAceEditor: (editor: import("react-ace/lib/types").IAceEditor) => void;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@use './integrations/AceEditor';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useEnhancePlaceholder } from './useEnhancePlaceholder';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useEnhancePlaceholder } from './useEnhancePlaceholder';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IAceEditor } from 'react-ace/lib/types';
|
|
2
|
+
export type Params = {
|
|
3
|
+
triggerTitle?: string;
|
|
4
|
+
maxRetries?: number;
|
|
5
|
+
baseDelay?: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const useAceEditor: (params?: Params) => {
|
|
8
|
+
setAceEditor: (editor: IAceEditor) => void;
|
|
9
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { useEnhancePlaceholder } from './useEnhancePlaceholder';
|
|
3
|
+
import { useInsertQuery } from './useInsertQuery';
|
|
4
|
+
import { useSQLGenerationStore } from '../../store';
|
|
5
|
+
export const useAceEditor = (params) => {
|
|
6
|
+
const setIsOpen = useSQLGenerationStore(s => s.setIsOpen);
|
|
7
|
+
const resetStore = useSQLGenerationStore(s => s.reset);
|
|
8
|
+
const { setAceEditor: setAceEditorForPlaceholder } = useEnhancePlaceholder({
|
|
9
|
+
triggerTitle: params?.triggerTitle,
|
|
10
|
+
maxRetries: params?.maxRetries,
|
|
11
|
+
baseDelay: params?.baseDelay,
|
|
12
|
+
});
|
|
13
|
+
const { setAceEditor: setAceEditorForInsertQuery } = useInsertQuery({
|
|
14
|
+
onInsertQueryDone: () => {
|
|
15
|
+
setIsOpen(false);
|
|
16
|
+
resetStore();
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
const setAceEditor = useCallback((editor) => {
|
|
20
|
+
setAceEditorForPlaceholder(editor);
|
|
21
|
+
setAceEditorForInsertQuery(editor);
|
|
22
|
+
}, [setAceEditorForPlaceholder, setAceEditorForInsertQuery]);
|
|
23
|
+
return { setAceEditor };
|
|
24
|
+
};
|