@databricks/design-system 1.12.20 → 1.12.21
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/codemods/camelize.ts +5 -5
- package/dist/Popover-CrX63HDP.js +3831 -0
- package/dist/Popover-CrX63HDP.js.map +1 -0
- package/dist/Popover-DQEbjNyV.js +3831 -0
- package/dist/Popover-DQEbjNyV.js.map +1 -0
- package/dist/WizardStepContentWrapper-Bv2MqnDd.js +2276 -0
- package/dist/WizardStepContentWrapper-Bv2MqnDd.js.map +1 -0
- package/dist/WizardStepContentWrapper-CzvxVy-w.js +2278 -0
- package/dist/WizardStepContentWrapper-CzvxVy-w.js.map +1 -0
- package/dist/development.js +3 -3
- package/dist/development.js.map +1 -1
- package/dist/index-BC9PpmGo.js +770 -0
- package/dist/index-BC9PpmGo.js.map +1 -0
- package/dist/index-DxyvNv4-.js +770 -0
- package/dist/index-DxyvNv4-.js.map +1 -0
- package/dist/index.js +162 -66
- package/dist/index.js.map +1 -1
- package/dist/patterns.js +2 -2
- package/package.json +4 -4
- package/scripts/theme_regeneration/common.ts +3 -3
- package/scripts/theme_regeneration/regenerate_color_validity_enums.ts +3 -3
- package/src/assets/icons/RowsIcon.svg +3 -0
- package/src/assets/icons/TokenIcon.svg +8 -0
- package/src/assets/icons/TrendingIcon.svg +1 -0
- package/src/design-system/Accordion/Accordion.tsx +2 -2
- package/src/design-system/Alert/Alert.tsx +1 -1
- package/src/design-system/ApplyGlobalStyles/ApplyGlobalStyles.tsx +1 -1
- package/src/design-system/Card/Card.test.tsx +52 -0
- package/src/design-system/Card/Card.tsx +21 -5
- package/src/design-system/DatePicker/DatePicker.tsx +6 -4
- package/src/design-system/DesignSystemEventProvider/DesignSystemEventProvider.test.tsx +5 -3
- package/src/design-system/DesignSystemProvider/DesignSystemProvider.test.tsx +1 -1
- package/src/design-system/DesignSystemProvider/DesignSystemProvider.tsx +8 -6
- package/src/design-system/Dropdown/Dropdown.tsx +1 -1
- package/src/design-system/Empty/Empty.tsx +1 -1
- package/src/design-system/Grid/Col.tsx +1 -1
- package/src/design-system/Grid/Row.tsx +1 -1
- package/src/design-system/Header/Header.tsx +1 -1
- package/src/design-system/Hooks/useDesignSystemTheme.tsx +3 -1
- package/src/design-system/HoverCard/HoverCard.tsx +11 -5
- package/src/design-system/Icon/Icon.tsx +4 -4
- package/src/design-system/Icon/__generated/icons/{InfoIcon.tsx → RowsIcon.tsx} +6 -7
- package/src/design-system/Icon/__generated/icons/TokenIcon.tsx +28 -0
- package/src/design-system/Icon/__generated/icons/TrendingIcon.tsx +23 -0
- package/src/design-system/Icon/__generated/icons/index.ts +3 -1
- package/src/design-system/Input/Password.tsx +25 -23
- package/src/design-system/LegacyForm/LegacyForm.tsx +5 -1
- package/src/design-system/LegacyPopover/LegacyPopover.tsx +5 -1
- package/src/design-system/LegacySelect/LegacySelect.tsx +2 -2
- package/src/design-system/LegacyTable/LegacyTable.tsx +1 -1
- package/src/design-system/LegacyTabs/index.tsx +4 -1
- package/src/design-system/LegacyTooltip/LegacyTooltip.tsx +1 -1
- package/src/design-system/LoadingState/LoadingState.tsx +1 -1
- package/src/design-system/Modal/Modal.tsx +19 -2
- package/src/design-system/PageWrapper/PageWrapper.tsx +1 -1
- package/src/design-system/Pagination/index.tsx +2 -2
- package/src/design-system/PreviewCard/PreviewCard.test.tsx +70 -0
- package/src/design-system/PreviewCard/PreviewCard.tsx +15 -5
- package/src/design-system/Radio/Radio.tsx +28 -28
- package/src/design-system/SegmentedControl/SegmentedControl.tsx +2 -2
- package/src/design-system/Select/SimpleSelect.tsx +4 -1
- package/src/design-system/Skeleton/TableSkeleton.tsx +4 -2
- package/src/design-system/Skeleton/TitleSkeleton.tsx +10 -2
- package/src/design-system/Space/Space.tsx +1 -1
- package/src/design-system/Spacer/Spacer.tsx +1 -1
- package/src/design-system/Spinner/Spinner.tsx +1 -1
- package/src/design-system/SplitButton/Dropdown/DropdownButton.tsx +1 -1
- package/src/design-system/SplitButton/SplitButton.tsx +3 -1
- package/src/design-system/Stepper/Stepper.tsx +1 -1
- package/src/design-system/Switch/Switch.tsx +1 -1
- package/src/design-system/TableUI/TableCell.tsx +10 -1
- package/src/design-system/Tooltip/Tooltip.tsx +1 -1
- package/src/design-system/TypeaheadCombobox/CountBadge.tsx +5 -1
- package/src/design-system/TypeaheadCombobox/TypeaheadComboboxControls.tsx +1 -1
- package/src/design-system/TypeaheadCombobox/TypeaheadComboboxRoot.tsx +1 -1
- package/src/design-system/TypeaheadCombobox/TypeaheadComboboxSelectedItem.tsx +1 -1
- package/src/design-system/TypeaheadCombobox/tests/TypeaheadCombobox.test.tsx +3 -3
- package/src/design-system/TypeaheadCombobox/tests/testFixtures.tsx +3 -3
- package/src/design-system/utils/css-utils.tsx +6 -6
- package/src/design-system/utils/shadow-dom-storybook-wrapper.tsx +1 -1
- package/src/development/Banner/Banner.tsx +1 -1
- package/src/development/PillControl/PillControl.tsx +1 -0
- package/src/development/TreeGrid/TreeGrid.test.tsx +2 -2
- package/src/development/TreeGrid/TreeGrid.tsx +1 -1
- package/src/theme/convertToLessVars.ts +5 -5
- package/src/~patterns/Wizard/VerticalWizardContent.tsx +3 -1
- package/src/assets/icons/InfoIcon.svg +0 -5
|
@@ -0,0 +1,770 @@
|
|
|
1
|
+
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
2
|
+
import React__default, { forwardRef, useMemo, useRef, useCallback, useEffect } from 'react';
|
|
3
|
+
import { I as Icon, u as useDesignSystemTheme, a as useDesignSystemSafexFlags, D as DesignSystemAntDConfigProvider, b as addDebugOutlineIfEnabled, g as getValidationStateColor, c as getAnimationCss, s as safex, d as useFormContext, e as DesignSystemEventProviderAnalyticsEventTypes, f as useDesignSystemEventComponentCallbacks, h as DesignSystemEventProviderComponentTypes, i as importantify } from './Popover-DQEbjNyV.js';
|
|
4
|
+
import { css } from '@emotion/react';
|
|
5
|
+
import { Input as Input$2 } from 'antd';
|
|
6
|
+
|
|
7
|
+
function SvgClockIcon(props) {
|
|
8
|
+
return /*#__PURE__*/ jsxs("svg", {
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
width: "1em",
|
|
11
|
+
height: "1em",
|
|
12
|
+
fill: "none",
|
|
13
|
+
viewBox: "0 0 16 16",
|
|
14
|
+
...props,
|
|
15
|
+
children: [
|
|
16
|
+
/*#__PURE__*/ jsx("path", {
|
|
17
|
+
fill: "currentColor",
|
|
18
|
+
d: "M7.25 4v4c0 .199.079.39.22.53l2 2 1.06-1.06-1.78-1.78V4z"
|
|
19
|
+
}),
|
|
20
|
+
/*#__PURE__*/ jsx("path", {
|
|
21
|
+
fill: "currentColor",
|
|
22
|
+
fillRule: "evenodd",
|
|
23
|
+
d: "M8 0a8 8 0 1 0 0 16A8 8 0 0 0 8 0M1.5 8a6.5 6.5 0 1 1 13 0 6.5 6.5 0 0 1-13 0",
|
|
24
|
+
clipRule: "evenodd"
|
|
25
|
+
})
|
|
26
|
+
]
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
const ClockIcon = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
30
|
+
return /*#__PURE__*/ jsx(Icon, {
|
|
31
|
+
ref: forwardedRef,
|
|
32
|
+
...props,
|
|
33
|
+
component: SvgClockIcon
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
ClockIcon.displayName = 'ClockIcon';
|
|
37
|
+
|
|
38
|
+
function SvgLockIcon(props) {
|
|
39
|
+
return /*#__PURE__*/ jsxs("svg", {
|
|
40
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
41
|
+
width: "1em",
|
|
42
|
+
height: "1em",
|
|
43
|
+
fill: "none",
|
|
44
|
+
viewBox: "0 0 16 16",
|
|
45
|
+
...props,
|
|
46
|
+
children: [
|
|
47
|
+
/*#__PURE__*/ jsx("path", {
|
|
48
|
+
fill: "currentColor",
|
|
49
|
+
d: "M7.25 9v4h1.5V9z"
|
|
50
|
+
}),
|
|
51
|
+
/*#__PURE__*/ jsx("path", {
|
|
52
|
+
fill: "currentColor",
|
|
53
|
+
fillRule: "evenodd",
|
|
54
|
+
d: "M12 6V4a4 4 0 0 0-8 0v2H2.75a.75.75 0 0 0-.75.75v8.5c0 .414.336.75.75.75h10.5a.75.75 0 0 0 .75-.75v-8.5a.75.75 0 0 0-.75-.75zm.5 1.5v7h-9v-7zM5.5 4v2h5V4a2.5 2.5 0 0 0-5 0",
|
|
55
|
+
clipRule: "evenodd"
|
|
56
|
+
})
|
|
57
|
+
]
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
const LockIcon = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
61
|
+
return /*#__PURE__*/ jsx(Icon, {
|
|
62
|
+
ref: forwardedRef,
|
|
63
|
+
...props,
|
|
64
|
+
component: SvgLockIcon
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
LockIcon.displayName = 'LockIcon';
|
|
68
|
+
|
|
69
|
+
function SvgMegaphoneIcon(props) {
|
|
70
|
+
return /*#__PURE__*/ jsx("svg", {
|
|
71
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
72
|
+
width: "1em",
|
|
73
|
+
height: "1em",
|
|
74
|
+
fill: "none",
|
|
75
|
+
viewBox: "0 0 16 16",
|
|
76
|
+
...props,
|
|
77
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
78
|
+
fill: "currentColor",
|
|
79
|
+
fillRule: "evenodd",
|
|
80
|
+
d: "M12.197 1.243A.75.75 0 0 1 12.75 1h1.5a.75.75 0 0 1 .75.75v10.5a.75.75 0 0 1-.75.75h-1.5a.75.75 0 0 1-.553-.243l-.892-.973A5.5 5.5 0 0 0 8 10.051V13a2 2 0 1 1-4 0v-3a3 3 0 0 1 0-6h3.25a5.5 5.5 0 0 0 4.055-1.784zM6.5 8.5v-3H4a1.5 1.5 0 1 0 0 3zm-1 1.5v3a.5.5 0 0 0 1 0v-3zm6.911.77A7 7 0 0 0 8 8.54V5.46a7 7 0 0 0 4.411-2.23l.669-.73h.42v9h-.42z",
|
|
81
|
+
clipRule: "evenodd"
|
|
82
|
+
})
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
const MegaphoneIcon = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
86
|
+
return /*#__PURE__*/ jsx(Icon, {
|
|
87
|
+
ref: forwardedRef,
|
|
88
|
+
...props,
|
|
89
|
+
component: SvgMegaphoneIcon
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
MegaphoneIcon.displayName = 'MegaphoneIcon';
|
|
93
|
+
|
|
94
|
+
function SvgSearchIcon(props) {
|
|
95
|
+
return /*#__PURE__*/ jsxs("svg", {
|
|
96
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
97
|
+
width: "1em",
|
|
98
|
+
height: "1em",
|
|
99
|
+
fill: "none",
|
|
100
|
+
viewBox: "0 0 16 16",
|
|
101
|
+
...props,
|
|
102
|
+
children: [
|
|
103
|
+
/*#__PURE__*/ jsx("g", {
|
|
104
|
+
clipPath: "url(#SearchIcon_svg__a)",
|
|
105
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
106
|
+
fill: "currentColor",
|
|
107
|
+
fillRule: "evenodd",
|
|
108
|
+
d: "M8 1a7 7 0 1 0 4.39 12.453l2.55 2.55 1.06-1.06-2.55-2.55A7 7 0 0 0 8 1M2.5 8a5.5 5.5 0 1 1 11 0 5.5 5.5 0 0 1-11 0",
|
|
109
|
+
clipRule: "evenodd"
|
|
110
|
+
})
|
|
111
|
+
}),
|
|
112
|
+
/*#__PURE__*/ jsx("defs", {
|
|
113
|
+
children: /*#__PURE__*/ jsx("clipPath", {
|
|
114
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
115
|
+
fill: "#fff",
|
|
116
|
+
d: "M0 0h16v16H0z"
|
|
117
|
+
})
|
|
118
|
+
})
|
|
119
|
+
})
|
|
120
|
+
]
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
const SearchIcon = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
124
|
+
return /*#__PURE__*/ jsx(Icon, {
|
|
125
|
+
ref: forwardedRef,
|
|
126
|
+
...props,
|
|
127
|
+
component: SvgSearchIcon
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
SearchIcon.displayName = 'SearchIcon';
|
|
131
|
+
|
|
132
|
+
function SvgXCircleFillIcon(props) {
|
|
133
|
+
return /*#__PURE__*/ jsx("svg", {
|
|
134
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
135
|
+
width: "1em",
|
|
136
|
+
height: "1em",
|
|
137
|
+
fill: "none",
|
|
138
|
+
viewBox: "0 0 16 16",
|
|
139
|
+
...props,
|
|
140
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
141
|
+
fill: "currentColor",
|
|
142
|
+
fillRule: "evenodd",
|
|
143
|
+
d: "M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m1.97-4.97L8 9.06l-1.97 1.97-1.06-1.06L6.94 8 4.97 6.03l1.06-1.06L8 6.94l1.97-1.97 1.06 1.06L9.06 8l1.97 1.97z",
|
|
144
|
+
clipRule: "evenodd"
|
|
145
|
+
})
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
const XCircleFillIcon = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
149
|
+
return /*#__PURE__*/ jsx(Icon, {
|
|
150
|
+
ref: forwardedRef,
|
|
151
|
+
...props,
|
|
152
|
+
component: SvgXCircleFillIcon
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
XCircleFillIcon.displayName = 'XCircleFillIcon';
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* ES-1267895 When entering composed characters, we should not submit forms on Enter.
|
|
159
|
+
* For instance Japanese characters are composed and we should not submit forms when
|
|
160
|
+
* the user is still composing the characters.
|
|
161
|
+
*
|
|
162
|
+
* This hook provides a reusable way to invoke a callback on Enter,
|
|
163
|
+
* but not when composing characters.
|
|
164
|
+
* This can be used to invoke a form submission callback when Enter is pressed.
|
|
165
|
+
* @param callback VoidFunction to call when the Enter is pressed
|
|
166
|
+
* @param allowBasicEnter If true, the callback will be invoked when Enter is pressed without any modifiers
|
|
167
|
+
* @param allowPlatformEnter If true, the callback will be invoked when Enter is pressed with the platform modifier (CMD on Mac, CTRL on Windows)
|
|
168
|
+
* @returns Object with onKeyDown, onCompositionEnd, and onCompositionStart event handlers
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```tsx
|
|
172
|
+
* const handleSubmit = (event: React.KeyboardEvent) => {
|
|
173
|
+
* event.preventDefault();
|
|
174
|
+
* // Submit the form
|
|
175
|
+
* };
|
|
176
|
+
* const eventHandlers = useCallbackOnEnter({
|
|
177
|
+
* callback: handleSubmit,
|
|
178
|
+
* allowBasicEnter: true,
|
|
179
|
+
* allowPlatformEnter: true,
|
|
180
|
+
* })
|
|
181
|
+
* return <input {...eventHandlers} />;
|
|
182
|
+
* ```
|
|
183
|
+
*/ const useCallbackOnEnter = (param)=>{
|
|
184
|
+
let { callback, allowBasicEnter, allowPlatformEnter } = param;
|
|
185
|
+
const isMacOs = useMemo(()=>navigator.userAgent.includes('Mac'), []);
|
|
186
|
+
// Keeping track of whether we are composing characters
|
|
187
|
+
// This is stored in a ref so that it can be accessed in the onKeyDown event handler
|
|
188
|
+
// without causing a re-renders
|
|
189
|
+
const isComposing = useRef(false);
|
|
190
|
+
// Handler for when the composition starts
|
|
191
|
+
const onCompositionStart = useCallback(()=>{
|
|
192
|
+
isComposing.current = true;
|
|
193
|
+
}, []);
|
|
194
|
+
// Handler for when the composition ends
|
|
195
|
+
const onCompositionEnd = useCallback(()=>{
|
|
196
|
+
isComposing.current = false;
|
|
197
|
+
}, []);
|
|
198
|
+
// Handler for when a key is pressed
|
|
199
|
+
// Used to submit the form when Enter is pressed
|
|
200
|
+
const onKeyDown = useCallback((event)=>{
|
|
201
|
+
// Only invoke the callback on Enter
|
|
202
|
+
if (event.key !== 'Enter') return;
|
|
203
|
+
// Do not submit on Enter if user is composing characters
|
|
204
|
+
if (isComposing.current) return;
|
|
205
|
+
// Do not submit on Enter if both are false
|
|
206
|
+
if (!allowBasicEnter && !allowPlatformEnter) return;
|
|
207
|
+
// Check if the event is a valid Enter press
|
|
208
|
+
const basicEnter = allowBasicEnter && !event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey;
|
|
209
|
+
const platformEnter = allowPlatformEnter && (isMacOs ? event.metaKey : event.ctrlKey);
|
|
210
|
+
const isValidEnterPress = basicEnter || platformEnter;
|
|
211
|
+
// Submit the form if the Enter press is valid
|
|
212
|
+
if (isValidEnterPress) callback(event);
|
|
213
|
+
}, [
|
|
214
|
+
allowBasicEnter,
|
|
215
|
+
allowPlatformEnter,
|
|
216
|
+
callback,
|
|
217
|
+
isMacOs
|
|
218
|
+
]);
|
|
219
|
+
return {
|
|
220
|
+
onKeyDown,
|
|
221
|
+
onCompositionEnd,
|
|
222
|
+
onCompositionStart
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
const getInputGroupStyling = (clsPrefix, theme, useNewShadows, useNewBorderRadii)=>{
|
|
227
|
+
const inputClass = `.${clsPrefix}-input`;
|
|
228
|
+
const buttonClass = `.${clsPrefix}-btn`;
|
|
229
|
+
return /*#__PURE__*/ css({
|
|
230
|
+
display: 'inline-flex !important',
|
|
231
|
+
width: 'auto',
|
|
232
|
+
[`& > ${inputClass}`]: {
|
|
233
|
+
flexGrow: 1,
|
|
234
|
+
...useNewBorderRadii && {
|
|
235
|
+
borderTopRightRadius: '0px !important',
|
|
236
|
+
borderBottomRightRadius: '0px !important'
|
|
237
|
+
},
|
|
238
|
+
'&:disabled': {
|
|
239
|
+
border: 'none',
|
|
240
|
+
background: theme.colors.actionDisabledBackground,
|
|
241
|
+
'&:hover': {
|
|
242
|
+
borderRight: `1px solid ${theme.colors.actionDisabledBorder} !important`
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
'&[data-validation]': {
|
|
246
|
+
marginRight: 0
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
...useNewShadows && {
|
|
250
|
+
[`& > ${buttonClass}`]: {
|
|
251
|
+
boxShadow: 'none !important'
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
...useNewBorderRadii && {
|
|
255
|
+
[`& > ${buttonClass}`]: {
|
|
256
|
+
borderTopLeftRadius: '0px !important',
|
|
257
|
+
borderBottomLeftRadius: '0px !important'
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
[`& > ${buttonClass} > span`]: {
|
|
261
|
+
verticalAlign: 'middle'
|
|
262
|
+
},
|
|
263
|
+
[`& > ${buttonClass}:disabled, & > ${buttonClass}:disabled:hover`]: {
|
|
264
|
+
borderLeft: `1px solid ${theme.colors.actionDisabledBorder} !important`,
|
|
265
|
+
backgroundColor: `${theme.colors.actionDisabledBackground} !important`,
|
|
266
|
+
color: `${theme.colors.actionDisabledText} !important`
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
};
|
|
270
|
+
const Group = (param)=>{
|
|
271
|
+
let { dangerouslySetAntdProps, dangerouslyAppendEmotionCSS, compact = true, ...props } = param;
|
|
272
|
+
const { classNamePrefix, theme } = useDesignSystemTheme();
|
|
273
|
+
const { useNewShadows, useNewBorderRadii } = useDesignSystemSafexFlags();
|
|
274
|
+
return /*#__PURE__*/ jsx(DesignSystemAntDConfigProvider, {
|
|
275
|
+
children: /*#__PURE__*/ jsx(Input$2.Group, {
|
|
276
|
+
...addDebugOutlineIfEnabled(),
|
|
277
|
+
css: [
|
|
278
|
+
getInputGroupStyling(classNamePrefix, theme, useNewShadows, useNewBorderRadii),
|
|
279
|
+
dangerouslyAppendEmotionCSS
|
|
280
|
+
],
|
|
281
|
+
compact: compact,
|
|
282
|
+
...props,
|
|
283
|
+
...dangerouslySetAntdProps
|
|
284
|
+
})
|
|
285
|
+
});
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* A React custom hook that allows a callback function to be executed exactly once until it is explicitly reset.
|
|
290
|
+
*
|
|
291
|
+
* Usage:
|
|
292
|
+
*
|
|
293
|
+
* const originalCallback = () => { console.log('originalCallback'); }
|
|
294
|
+
* const { callbackOnceUntilReset, reset } = useCallbackOnceUntilReset(originalCallback);
|
|
295
|
+
*
|
|
296
|
+
* // To execute the callback
|
|
297
|
+
* callbackOnceUntilReset(); // Prints 'originalCallback'
|
|
298
|
+
* callbackOnceUntilReset(); // No effect for further calls
|
|
299
|
+
* reset();
|
|
300
|
+
* callbackOnceUntilReset(); // Prints 'originalCallback' again
|
|
301
|
+
*/ const useCallbackOnceUntilReset = (callback)=>{
|
|
302
|
+
const canTriggerRef = useRef(true);
|
|
303
|
+
const reset = useCallback(()=>{
|
|
304
|
+
canTriggerRef.current = true;
|
|
305
|
+
}, []);
|
|
306
|
+
const callbackOnceUntilReset = useCallback(()=>{
|
|
307
|
+
if (canTriggerRef.current) {
|
|
308
|
+
callback();
|
|
309
|
+
canTriggerRef.current = false;
|
|
310
|
+
}
|
|
311
|
+
}, [
|
|
312
|
+
callback
|
|
313
|
+
]);
|
|
314
|
+
return {
|
|
315
|
+
callbackOnceUntilReset,
|
|
316
|
+
reset
|
|
317
|
+
};
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* This hook provides a way to chain event handlers together.
|
|
322
|
+
* Optionally, it can stop calling the next handler if the event has been defaultPrevented.
|
|
323
|
+
* @param handlers Array of event handlers to chain together. Optional handlers are allowed for convenience.
|
|
324
|
+
* @param stopOnDefaultPrevented If true, the next handler will not be called if the event has been defaultPrevented
|
|
325
|
+
* @returns A function that will call each handler in the order they are provided
|
|
326
|
+
* @example
|
|
327
|
+
* ```tsx
|
|
328
|
+
* const onClick = useChainEventHandlers({ handlers: [onClick1, onClick2] });
|
|
329
|
+
* return <button onClick={onClick} />;
|
|
330
|
+
*/ const useChainEventHandlers = (props)=>{
|
|
331
|
+
const { handlers, stopOnDefaultPrevented } = props;
|
|
332
|
+
return useCallback((event)=>{
|
|
333
|
+
// Loop over each handler in succession
|
|
334
|
+
for (const handler of handlers){
|
|
335
|
+
// Break if the event has been defaultPrevented and stopOnDefaultPrevented is true
|
|
336
|
+
if (stopOnDefaultPrevented && event.defaultPrevented) return;
|
|
337
|
+
// Call the handler if it exists
|
|
338
|
+
handler?.(event);
|
|
339
|
+
}
|
|
340
|
+
}, [
|
|
341
|
+
handlers,
|
|
342
|
+
stopOnDefaultPrevented
|
|
343
|
+
]);
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
const SMALL_INPUT_HEIGHT = 24;
|
|
347
|
+
const getInputStyles = (clsPrefix, theme, param, param1)=>{
|
|
348
|
+
let { validationState, type, hasValue, useNewShadows, useNewFormUISpacing, useNewBorderRadii, locked, size } = param, { useFocusWithin = false } = param1;
|
|
349
|
+
const inputClass = `.${clsPrefix}-input`;
|
|
350
|
+
const affixClass = `.${clsPrefix}-input-affix-wrapper`;
|
|
351
|
+
const affixClassDisabled = `.${clsPrefix}-input-affix-wrapper-disabled`;
|
|
352
|
+
const affixClassFocused = `.${clsPrefix}-input-affix-wrapper-focused`;
|
|
353
|
+
const clearIcon = `.${clsPrefix}-input-clear-icon`;
|
|
354
|
+
const prefixIcon = `.${clsPrefix}-input-prefix`;
|
|
355
|
+
const suffixIcon = `.${clsPrefix}-input-suffix`;
|
|
356
|
+
const validationColor = getValidationStateColor(theme, validationState);
|
|
357
|
+
const focusSpecifier = useFocusWithin ? 'focus-within' : 'focus';
|
|
358
|
+
const styles = {
|
|
359
|
+
'&&': {
|
|
360
|
+
lineHeight: theme.typography.lineHeightBase,
|
|
361
|
+
...size === 'small' ? {
|
|
362
|
+
height: SMALL_INPUT_HEIGHT
|
|
363
|
+
} : {
|
|
364
|
+
minHeight: theme.general.heightSm
|
|
365
|
+
},
|
|
366
|
+
...size === 'small' && {
|
|
367
|
+
paddingLeft: theme.spacing.sm,
|
|
368
|
+
paddingRight: theme.spacing.sm
|
|
369
|
+
},
|
|
370
|
+
borderColor: theme.colors.actionDefaultBorderDefault,
|
|
371
|
+
...validationState && {
|
|
372
|
+
borderColor: validationColor
|
|
373
|
+
},
|
|
374
|
+
'&:hover': {
|
|
375
|
+
borderColor: validationState ? validationColor : theme.colors.actionPrimaryBackgroundHover
|
|
376
|
+
},
|
|
377
|
+
[`&:${focusSpecifier}`]: {
|
|
378
|
+
outlineColor: validationState ? validationColor : theme.colors.actionDefaultBorderFocus,
|
|
379
|
+
outlineWidth: 2,
|
|
380
|
+
outlineOffset: -2,
|
|
381
|
+
outlineStyle: 'solid',
|
|
382
|
+
...!useNewShadows && {
|
|
383
|
+
boxShadow: 'none'
|
|
384
|
+
},
|
|
385
|
+
borderColor: 'transparent'
|
|
386
|
+
},
|
|
387
|
+
'&:focus-visible': {
|
|
388
|
+
outlineColor: validationState ? validationColor : theme.colors.actionDefaultBorderFocus,
|
|
389
|
+
outlineWidth: 2,
|
|
390
|
+
outlineOffset: -2,
|
|
391
|
+
outlineStyle: 'solid',
|
|
392
|
+
...!useNewShadows && {
|
|
393
|
+
boxShadow: 'none'
|
|
394
|
+
},
|
|
395
|
+
borderColor: 'transparent'
|
|
396
|
+
},
|
|
397
|
+
...useNewFormUISpacing && {
|
|
398
|
+
[`& + .${clsPrefix}-form-message`]: {
|
|
399
|
+
marginTop: theme.spacing.sm
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
[`&${inputClass}, ${inputClass}`]: {
|
|
404
|
+
backgroundColor: 'transparent',
|
|
405
|
+
...useNewBorderRadii && {
|
|
406
|
+
borderRadius: theme.borders.borderRadiusSm
|
|
407
|
+
},
|
|
408
|
+
'&:disabled': {
|
|
409
|
+
backgroundColor: theme.colors.actionDisabledBackground,
|
|
410
|
+
color: theme.colors.actionDisabledText,
|
|
411
|
+
borderColor: theme.colors.actionDisabledBorder
|
|
412
|
+
},
|
|
413
|
+
'&::placeholder': {
|
|
414
|
+
color: theme.colors.textPlaceholder
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
[`&${affixClass}`]: {
|
|
418
|
+
backgroundColor: 'transparent',
|
|
419
|
+
lineHeight: theme.typography.lineHeightBase,
|
|
420
|
+
paddingTop: 5,
|
|
421
|
+
paddingBottom: 5,
|
|
422
|
+
...size === 'small' ? {
|
|
423
|
+
height: SMALL_INPUT_HEIGHT
|
|
424
|
+
} : {
|
|
425
|
+
minHeight: theme.general.heightSm
|
|
426
|
+
},
|
|
427
|
+
'::before': {
|
|
428
|
+
lineHeight: theme.typography.lineHeightBase
|
|
429
|
+
},
|
|
430
|
+
'&:hover': {
|
|
431
|
+
borderColor: validationState ? validationColor : theme.colors.actionPrimaryBackgroundHover
|
|
432
|
+
},
|
|
433
|
+
[`input.${clsPrefix}-input`]: {
|
|
434
|
+
borderRadius: 0
|
|
435
|
+
}
|
|
436
|
+
},
|
|
437
|
+
[`&${affixClassDisabled}`]: {
|
|
438
|
+
backgroundColor: theme.colors.actionDisabledBackground
|
|
439
|
+
},
|
|
440
|
+
[`&${affixClassFocused}`]: {
|
|
441
|
+
boxShadow: 'none',
|
|
442
|
+
[`&&, &:${focusSpecifier}`]: {
|
|
443
|
+
outlineColor: validationState ? validationColor : theme.colors.actionDefaultBorderFocus,
|
|
444
|
+
outlineWidth: 2,
|
|
445
|
+
outlineOffset: -2,
|
|
446
|
+
outlineStyle: 'solid',
|
|
447
|
+
boxShadow: 'none',
|
|
448
|
+
borderColor: 'transparent'
|
|
449
|
+
}
|
|
450
|
+
},
|
|
451
|
+
[clearIcon]: {
|
|
452
|
+
fontSize: theme.typography.fontSizeSm
|
|
453
|
+
},
|
|
454
|
+
[prefixIcon]: {
|
|
455
|
+
marginRight: theme.spacing.sm,
|
|
456
|
+
color: theme.colors.textSecondary
|
|
457
|
+
},
|
|
458
|
+
[suffixIcon]: {
|
|
459
|
+
marginLeft: theme.spacing.sm,
|
|
460
|
+
color: theme.colors.textSecondary,
|
|
461
|
+
...!hasValue && type === 'number' && {
|
|
462
|
+
display: 'none'
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
...locked ? {
|
|
466
|
+
[`&${affixClass}`]: {
|
|
467
|
+
backgroundColor: theme.colors.backgroundSecondary
|
|
468
|
+
},
|
|
469
|
+
[`input.${clsPrefix}-input`]: {
|
|
470
|
+
backgroundColor: `${theme.colors.backgroundSecondary} !important`,
|
|
471
|
+
color: `${theme.colors.textPrimary} !important`
|
|
472
|
+
}
|
|
473
|
+
} : {},
|
|
474
|
+
...getAnimationCss(theme.options.enableAnimation)
|
|
475
|
+
};
|
|
476
|
+
return styles;
|
|
477
|
+
};
|
|
478
|
+
const getInputEmotionStyles = (clsPrefix, theme, param)=>{
|
|
479
|
+
let { validationState, type, hasValue, useNewShadows, useNewBorderRadii, locked, size } = param;
|
|
480
|
+
const styles = getInputStyles(clsPrefix, theme, {
|
|
481
|
+
validationState,
|
|
482
|
+
type,
|
|
483
|
+
hasValue,
|
|
484
|
+
useNewShadows,
|
|
485
|
+
useNewBorderRadii,
|
|
486
|
+
locked,
|
|
487
|
+
size
|
|
488
|
+
}, {});
|
|
489
|
+
return /*#__PURE__*/ css(importantify(styles));
|
|
490
|
+
};
|
|
491
|
+
const Input$1 = /*#__PURE__*/ forwardRef(function Input(param, ref) {
|
|
492
|
+
let { validationState, autoComplete = 'off', dangerouslySetAntdProps, dangerouslyAppendEmotionCSS, onChange, onClear, onFocus, onPressEnter, onCompositionStart, onCompositionEnd, componentId, shouldPreventFormSubmission, analyticsEvents, readOnly, locked, size = 'middle', ...props } = param;
|
|
493
|
+
const emitOnView = safex('databricks.fe.observability.defaultComponentView.input', false);
|
|
494
|
+
const formContext = useFormContext();
|
|
495
|
+
const { classNamePrefix, theme } = useDesignSystemTheme();
|
|
496
|
+
const [hasValue, setHasValue] = React__default.useState(props.value !== undefined && props.value !== null && props.value !== '');
|
|
497
|
+
const { useNewShadows, useNewBorderRadii } = useDesignSystemSafexFlags();
|
|
498
|
+
const memoizedAnalyticsEvents = useMemo(()=>analyticsEvents ?? (emitOnView ? [
|
|
499
|
+
DesignSystemEventProviderAnalyticsEventTypes.OnValueChange,
|
|
500
|
+
DesignSystemEventProviderAnalyticsEventTypes.OnView
|
|
501
|
+
] : [
|
|
502
|
+
DesignSystemEventProviderAnalyticsEventTypes.OnValueChange
|
|
503
|
+
]), [
|
|
504
|
+
analyticsEvents,
|
|
505
|
+
emitOnView
|
|
506
|
+
]);
|
|
507
|
+
const eventContext = useDesignSystemEventComponentCallbacks({
|
|
508
|
+
componentType: DesignSystemEventProviderComponentTypes.Input,
|
|
509
|
+
componentId,
|
|
510
|
+
analyticsEvents: memoizedAnalyticsEvents,
|
|
511
|
+
valueHasNoPii: false
|
|
512
|
+
});
|
|
513
|
+
const firstView = useRef(true);
|
|
514
|
+
useEffect(()=>{
|
|
515
|
+
if (firstView.current) {
|
|
516
|
+
eventContext.onView();
|
|
517
|
+
firstView.current = false;
|
|
518
|
+
}
|
|
519
|
+
}, [
|
|
520
|
+
eventContext
|
|
521
|
+
]);
|
|
522
|
+
// Prevents multiple onValueChange triggers until after a focus event resets it.
|
|
523
|
+
const { callbackOnceUntilReset: sendAnalyticsEventOncePerFocus, reset: resetSendAnalyticsEventOnFocus } = useCallbackOnceUntilReset(eventContext.onValueChange);
|
|
524
|
+
const handleChange = useCallback((e)=>{
|
|
525
|
+
sendAnalyticsEventOncePerFocus();
|
|
526
|
+
// If the input is cleared, call the onClear handler, but only
|
|
527
|
+
// if the event is not an input event -- which is the case when you click the
|
|
528
|
+
// ant-provided (X) button.
|
|
529
|
+
if (!e.target.value && e.nativeEvent instanceof InputEvent === false && onClear) {
|
|
530
|
+
onClear?.();
|
|
531
|
+
setHasValue(false);
|
|
532
|
+
} else {
|
|
533
|
+
onChange?.(e);
|
|
534
|
+
setHasValue(Boolean(e.target.value));
|
|
535
|
+
}
|
|
536
|
+
}, [
|
|
537
|
+
onChange,
|
|
538
|
+
onClear,
|
|
539
|
+
sendAnalyticsEventOncePerFocus
|
|
540
|
+
]);
|
|
541
|
+
const handleFocus = useCallback((e)=>{
|
|
542
|
+
resetSendAnalyticsEventOnFocus();
|
|
543
|
+
onFocus?.(e);
|
|
544
|
+
}, [
|
|
545
|
+
onFocus,
|
|
546
|
+
resetSendAnalyticsEventOnFocus
|
|
547
|
+
]);
|
|
548
|
+
const onFormSubmit = useCallback((e)=>{
|
|
549
|
+
if (!formContext.formRef?.current) return;
|
|
550
|
+
e.preventDefault();
|
|
551
|
+
formContext.formRef.current.requestSubmit();
|
|
552
|
+
}, [
|
|
553
|
+
formContext.formRef
|
|
554
|
+
]);
|
|
555
|
+
const submitHandlers = useCallbackOnEnter({
|
|
556
|
+
callback: onFormSubmit,
|
|
557
|
+
allowBasicEnter: !shouldPreventFormSubmission,
|
|
558
|
+
allowPlatformEnter: !shouldPreventFormSubmission
|
|
559
|
+
});
|
|
560
|
+
const onPressEnterChain = useChainEventHandlers(useMemo(()=>({
|
|
561
|
+
handlers: [
|
|
562
|
+
submitHandlers.onKeyDown,
|
|
563
|
+
onPressEnter
|
|
564
|
+
],
|
|
565
|
+
stopOnDefaultPrevented: false
|
|
566
|
+
}), [
|
|
567
|
+
submitHandlers.onKeyDown,
|
|
568
|
+
onPressEnter
|
|
569
|
+
]));
|
|
570
|
+
const onCompositionStartChain = useChainEventHandlers(useMemo(()=>({
|
|
571
|
+
handlers: [
|
|
572
|
+
submitHandlers.onCompositionStart,
|
|
573
|
+
onCompositionStart
|
|
574
|
+
]
|
|
575
|
+
}), [
|
|
576
|
+
submitHandlers.onCompositionStart,
|
|
577
|
+
onCompositionStart
|
|
578
|
+
]));
|
|
579
|
+
const onCompositionEndChain = useChainEventHandlers(useMemo(()=>({
|
|
580
|
+
handlers: [
|
|
581
|
+
submitHandlers.onCompositionEnd,
|
|
582
|
+
onCompositionEnd
|
|
583
|
+
]
|
|
584
|
+
}), [
|
|
585
|
+
submitHandlers.onCompositionEnd,
|
|
586
|
+
onCompositionEnd
|
|
587
|
+
]));
|
|
588
|
+
return /*#__PURE__*/ jsx(DesignSystemAntDConfigProvider, {
|
|
589
|
+
children: /*#__PURE__*/ jsx(Input$2, {
|
|
590
|
+
...addDebugOutlineIfEnabled(),
|
|
591
|
+
autoComplete: autoComplete,
|
|
592
|
+
"data-validation": validationState,
|
|
593
|
+
ref: ref,
|
|
594
|
+
css: [
|
|
595
|
+
getInputEmotionStyles(classNamePrefix, theme, {
|
|
596
|
+
validationState,
|
|
597
|
+
type: props.type,
|
|
598
|
+
hasValue,
|
|
599
|
+
useNewShadows,
|
|
600
|
+
useNewBorderRadii,
|
|
601
|
+
locked,
|
|
602
|
+
size
|
|
603
|
+
}),
|
|
604
|
+
dangerouslyAppendEmotionCSS
|
|
605
|
+
],
|
|
606
|
+
onChange: handleChange,
|
|
607
|
+
onFocus: handleFocus,
|
|
608
|
+
onPressEnter: onPressEnterChain,
|
|
609
|
+
onCompositionStart: onCompositionStartChain,
|
|
610
|
+
onCompositionEnd: onCompositionEndChain,
|
|
611
|
+
...props,
|
|
612
|
+
readOnly: locked || readOnly,
|
|
613
|
+
suffix: locked ? /*#__PURE__*/ jsx(LockIcon, {}) : props.suffix,
|
|
614
|
+
...dangerouslySetAntdProps,
|
|
615
|
+
...eventContext.dataComponentProps
|
|
616
|
+
})
|
|
617
|
+
});
|
|
618
|
+
});
|
|
619
|
+
|
|
620
|
+
const Password = /*#__PURE__*/ forwardRef(function Password(param, ref) {
|
|
621
|
+
let { validationState, autoComplete = 'off', dangerouslySetAntdProps, dangerouslyAppendEmotionCSS, ...props } = param;
|
|
622
|
+
const { classNamePrefix, theme } = useDesignSystemTheme();
|
|
623
|
+
const { useNewShadows, useNewBorderRadii } = useDesignSystemSafexFlags();
|
|
624
|
+
return /*#__PURE__*/ jsx(DesignSystemAntDConfigProvider, {
|
|
625
|
+
children: /*#__PURE__*/ jsx(Input$2.Password, {
|
|
626
|
+
...addDebugOutlineIfEnabled(),
|
|
627
|
+
visibilityToggle: false,
|
|
628
|
+
ref: ref,
|
|
629
|
+
autoComplete: autoComplete,
|
|
630
|
+
css: [
|
|
631
|
+
getInputEmotionStyles(classNamePrefix, theme, {
|
|
632
|
+
validationState,
|
|
633
|
+
useNewShadows,
|
|
634
|
+
useNewBorderRadii
|
|
635
|
+
}),
|
|
636
|
+
dangerouslyAppendEmotionCSS
|
|
637
|
+
],
|
|
638
|
+
...props,
|
|
639
|
+
...dangerouslySetAntdProps
|
|
640
|
+
})
|
|
641
|
+
});
|
|
642
|
+
});
|
|
643
|
+
|
|
644
|
+
const TextArea = /*#__PURE__*/ forwardRef(function TextArea(param, ref) {
|
|
645
|
+
let { validationState, autoComplete = 'off', dangerouslySetAntdProps, dangerouslyAppendEmotionCSS, componentId, analyticsEvents, onChange, onFocus, onKeyDown, onCompositionStart, onCompositionEnd, allowFormSubmitOnEnter = false, ...props } = param;
|
|
646
|
+
const emitOnView = safex('databricks.fe.observability.defaultComponentView.textArea', false);
|
|
647
|
+
const formContext = useFormContext();
|
|
648
|
+
const { classNamePrefix, theme } = useDesignSystemTheme();
|
|
649
|
+
const { useNewShadows, useNewBorderRadii } = useDesignSystemSafexFlags();
|
|
650
|
+
const memoizedAnalyticsEvents = useMemo(()=>analyticsEvents ?? (emitOnView ? [
|
|
651
|
+
DesignSystemEventProviderAnalyticsEventTypes.OnValueChange,
|
|
652
|
+
DesignSystemEventProviderAnalyticsEventTypes.OnView
|
|
653
|
+
] : [
|
|
654
|
+
DesignSystemEventProviderAnalyticsEventTypes.OnValueChange
|
|
655
|
+
]), [
|
|
656
|
+
analyticsEvents,
|
|
657
|
+
emitOnView
|
|
658
|
+
]);
|
|
659
|
+
const eventContext = useDesignSystemEventComponentCallbacks({
|
|
660
|
+
componentType: DesignSystemEventProviderComponentTypes.TextArea,
|
|
661
|
+
componentId,
|
|
662
|
+
analyticsEvents: memoizedAnalyticsEvents,
|
|
663
|
+
valueHasNoPii: false
|
|
664
|
+
});
|
|
665
|
+
const firstView = useRef(true);
|
|
666
|
+
useEffect(()=>{
|
|
667
|
+
if (firstView.current) {
|
|
668
|
+
eventContext.onView();
|
|
669
|
+
firstView.current = false;
|
|
670
|
+
}
|
|
671
|
+
}, [
|
|
672
|
+
eventContext
|
|
673
|
+
]);
|
|
674
|
+
// Prevents multiple onValueChange triggers until after a focus event resets it.
|
|
675
|
+
const { callbackOnceUntilReset: sendAnalyticsEventOncePerFocus, reset: resetSendAnalyticsEventOnFocus } = useCallbackOnceUntilReset(eventContext.onValueChange);
|
|
676
|
+
const handleChange = useCallback((e)=>{
|
|
677
|
+
sendAnalyticsEventOncePerFocus();
|
|
678
|
+
onChange?.(e);
|
|
679
|
+
}, [
|
|
680
|
+
onChange,
|
|
681
|
+
sendAnalyticsEventOncePerFocus
|
|
682
|
+
]);
|
|
683
|
+
const handleFocus = useCallback((e)=>{
|
|
684
|
+
resetSendAnalyticsEventOnFocus();
|
|
685
|
+
onFocus?.(e);
|
|
686
|
+
}, [
|
|
687
|
+
onFocus,
|
|
688
|
+
resetSendAnalyticsEventOnFocus
|
|
689
|
+
]);
|
|
690
|
+
// Callback used to submit the parent form
|
|
691
|
+
// This is used when allowFormSubmitOnEnter is true
|
|
692
|
+
const handleSubmitForm = useCallback((event)=>{
|
|
693
|
+
if (!formContext.formRef?.current) return;
|
|
694
|
+
event.preventDefault();
|
|
695
|
+
formContext.formRef.current.requestSubmit();
|
|
696
|
+
}, [
|
|
697
|
+
formContext.formRef
|
|
698
|
+
]);
|
|
699
|
+
// Event handlers for submitting the form on Enter
|
|
700
|
+
// This hook takes meta keys into account for platform-specific behavior
|
|
701
|
+
const submitHandlers = useCallbackOnEnter({
|
|
702
|
+
callback: handleSubmitForm,
|
|
703
|
+
allowBasicEnter: allowFormSubmitOnEnter,
|
|
704
|
+
allowPlatformEnter: true
|
|
705
|
+
});
|
|
706
|
+
// Chains the event handlers from useCallbackOnEnter together with potential event handlers from props
|
|
707
|
+
const onKeyDownChain = useChainEventHandlers(useMemo(()=>({
|
|
708
|
+
handlers: [
|
|
709
|
+
submitHandlers.onKeyDown,
|
|
710
|
+
onKeyDown
|
|
711
|
+
],
|
|
712
|
+
stopOnDefaultPrevented: true
|
|
713
|
+
}), [
|
|
714
|
+
onKeyDown,
|
|
715
|
+
submitHandlers.onKeyDown
|
|
716
|
+
]));
|
|
717
|
+
const onCompositionStartChain = useChainEventHandlers(useMemo(()=>({
|
|
718
|
+
handlers: [
|
|
719
|
+
submitHandlers.onCompositionStart,
|
|
720
|
+
onCompositionStart
|
|
721
|
+
]
|
|
722
|
+
}), [
|
|
723
|
+
submitHandlers.onCompositionStart,
|
|
724
|
+
onCompositionStart
|
|
725
|
+
]));
|
|
726
|
+
const onCompositionEndChain = useChainEventHandlers(useMemo(()=>({
|
|
727
|
+
handlers: [
|
|
728
|
+
submitHandlers.onCompositionEnd,
|
|
729
|
+
onCompositionEnd
|
|
730
|
+
]
|
|
731
|
+
}), [
|
|
732
|
+
submitHandlers.onCompositionEnd,
|
|
733
|
+
onCompositionEnd
|
|
734
|
+
]));
|
|
735
|
+
return /*#__PURE__*/ jsx(DesignSystemAntDConfigProvider, {
|
|
736
|
+
children: /*#__PURE__*/ jsx(Input$2.TextArea, {
|
|
737
|
+
...addDebugOutlineIfEnabled(),
|
|
738
|
+
ref: ref,
|
|
739
|
+
autoComplete: autoComplete,
|
|
740
|
+
css: [
|
|
741
|
+
getInputEmotionStyles(classNamePrefix, theme, {
|
|
742
|
+
validationState,
|
|
743
|
+
useNewShadows,
|
|
744
|
+
useNewBorderRadii
|
|
745
|
+
}),
|
|
746
|
+
dangerouslyAppendEmotionCSS
|
|
747
|
+
],
|
|
748
|
+
onChange: handleChange,
|
|
749
|
+
onFocus: handleFocus,
|
|
750
|
+
onKeyDown: onKeyDownChain,
|
|
751
|
+
onCompositionStart: onCompositionStartChain,
|
|
752
|
+
onCompositionEnd: onCompositionEndChain,
|
|
753
|
+
"data-component-type": DesignSystemEventProviderComponentTypes.TextArea,
|
|
754
|
+
"data-component-id": componentId,
|
|
755
|
+
...props,
|
|
756
|
+
...dangerouslySetAntdProps
|
|
757
|
+
})
|
|
758
|
+
});
|
|
759
|
+
});
|
|
760
|
+
|
|
761
|
+
// Properly creates the namespace and dot-notation components with correct types.
|
|
762
|
+
const InputNamespace = /* #__PURE__ */ Object.assign(Input$1, {
|
|
763
|
+
TextArea,
|
|
764
|
+
Password,
|
|
765
|
+
Group
|
|
766
|
+
});
|
|
767
|
+
const Input = InputNamespace;
|
|
768
|
+
|
|
769
|
+
export { ClockIcon as C, Input as I, LockIcon as L, MegaphoneIcon as M, SearchIcon as S, XCircleFillIcon as X, useCallbackOnEnter as a, getInputStyles as g, useCallbackOnceUntilReset as u };
|
|
770
|
+
//# sourceMappingURL=index-DxyvNv4-.js.map
|