@databricks/design-system 1.12.8 → 1.12.9
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/dist/Typography-91d3d591.js +2106 -0
- package/dist/Typography-91d3d591.js.map +1 -0
- package/dist/design-system/DialogCombobox/DialogComboboxContent.d.ts +1 -1
- package/dist/design-system/DialogCombobox/DialogComboboxContent.d.ts.map +1 -1
- package/dist/design-system/DialogCombobox/DialogComboboxOptionControlledList.d.ts.map +1 -1
- package/dist/design-system/DialogCombobox/DialogComboboxOptionList.d.ts.map +1 -1
- package/dist/design-system/DialogCombobox/DialogComboboxOptionListCheckboxItem.d.ts.map +1 -1
- package/dist/design-system/DialogCombobox/DialogComboboxOptionListSelectItem.d.ts.map +1 -1
- package/dist/design-system/DialogCombobox/DialogComboboxTrigger.d.ts +3 -2
- package/dist/design-system/DialogCombobox/DialogComboboxTrigger.d.ts.map +1 -1
- package/dist/design-system/DialogCombobox/providers/DialogComboboxOptionListContext.d.ts +2 -2
- package/dist/design-system/DialogCombobox/providers/DialogComboboxOptionListContext.d.ts.map +1 -1
- package/dist/design-system/DialogCombobox/shared.d.ts +2 -0
- package/dist/design-system/DialogCombobox/shared.d.ts.map +1 -1
- package/dist/design-system/FormV2/RHFAdapters.d.ts +32 -1
- package/dist/design-system/FormV2/RHFAdapters.d.ts.map +1 -1
- package/dist/design-system/Icon/__generated/icons/index.d.ts +0 -1
- package/dist/design-system/Icon/__generated/icons/index.d.ts.map +1 -1
- package/dist/design-system/SelectV2/Select.d.ts +7 -0
- package/dist/design-system/SelectV2/Select.d.ts.map +1 -0
- package/dist/design-system/SelectV2/SelectContent.d.ts +6 -0
- package/dist/design-system/SelectV2/SelectContent.d.ts.map +1 -0
- package/dist/design-system/SelectV2/SelectOption.d.ts +6 -0
- package/dist/design-system/SelectV2/SelectOption.d.ts.map +1 -0
- package/dist/design-system/SelectV2/SelectOptionGroup.d.ts +7 -0
- package/dist/design-system/SelectV2/SelectOptionGroup.d.ts.map +1 -0
- package/dist/design-system/SelectV2/SelectTrigger.d.ts +6 -0
- package/dist/design-system/SelectV2/SelectTrigger.d.ts.map +1 -0
- package/dist/design-system/SelectV2/hooks/useSelectContext.d.ts +2 -0
- package/dist/design-system/SelectV2/hooks/useSelectContext.d.ts.map +1 -0
- package/dist/design-system/SelectV2/index.d.ts +6 -0
- package/dist/design-system/SelectV2/index.d.ts.map +1 -0
- package/dist/design-system/SelectV2/providers/SelectContext.d.ts +11 -0
- package/dist/design-system/SelectV2/providers/SelectContext.d.ts.map +1 -0
- package/dist/design-system/index.d.ts +1 -0
- package/dist/design-system/index.d.ts.map +1 -1
- package/dist/development/ChatUI/ChatInput.d.ts.map +1 -1
- package/dist/development/ChatUI/CodeSnippet.d.ts.map +1 -1
- package/dist/development/ChatUI/Feedback.d.ts.map +1 -1
- package/dist/development/ChatUI/MessageActionButton.d.ts +4 -0
- package/dist/development/ChatUI/MessageActionButton.d.ts.map +1 -0
- package/dist/development/ChatUI/index.d.ts +1 -0
- package/dist/development/ChatUI/index.d.ts.map +1 -1
- package/dist/development.js +92 -22
- package/dist/development.js.map +1 -1
- package/dist/index.js +380 -128
- package/dist/index.js.map +1 -1
- package/dist/test-utils/enzyme.js.map +1 -1
- package/dist/test-utils/rtl/selectEvent.d.ts.map +1 -1
- package/dist/test-utils/rtl.js +25 -8
- package/dist/test-utils/rtl.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { useRef, useMemo, forwardRef, createContext, useContext, useState, useEffect, useImperativeHandle, Children, useCallback } from 'react';
|
|
3
|
-
import { u as useDesignSystemTheme, I as Icon, D as DesignSystemAntDConfigProvider, R as RestoreAntDDefaultClsPrefix, g as getAnimationCss, C as CloseIcon, a as ChevronRightIcon, b as useDesignSystemFlags, i as importantify, c as DU_BOIS_ENABLE_ANIMATION_CLASSNAME, d as useDesignSystemContext, e as Input, B as Button,
|
|
4
|
-
export { A as ApplyDesignSystemContextOverrides,
|
|
3
|
+
import { u as useDesignSystemTheme, I as Icon, D as DesignSystemAntDConfigProvider, R as RestoreAntDDefaultClsPrefix, g as getAnimationCss, C as CloseIcon, a as ChevronRightIcon, b as useDesignSystemFlags, i as importantify, c as DU_BOIS_ENABLE_ANIMATION_CLASSNAME, d as useDesignSystemContext, e as CheckIcon, f as Input, B as Button, h as getValidationStateColor, A as ApplyDesignSystemContextOverrides, T as Typography, j as Title$2, k as ChevronLeftIcon, l as getDefaultStyles, m as getPrimaryStyles, n as getDisabledStyles, o as lightColorList } from './Typography-91d3d591.js';
|
|
4
|
+
export { A as ApplyDesignSystemContextOverrides, v as ApplyDesignSystemFlags, B as Button, e as CheckIcon, k as ChevronLeftIcon, a as ChevronRightIcon, C as CloseIcon, x as CursorIcon, c as DU_BOIS_ENABLE_ANIMATION_CLASSNAME, D as DesignSystemAntDConfigProvider, r as DesignSystemContext, t as DesignSystemProvider, q as DesignSystemThemeContext, s as DesignSystemThemeProvider, F as FaceFrownIcon, y as FaceNeutralIcon, z as FaceSmileIcon, I as Icon, f as Input, N as NewWindowIcon, R as RestoreAntDDefaultClsPrefix, T as Typography, W as WithDesignSystemThemeHoc, G as __INTERNAL_DO_NOT_USE_DEDUPE__Group, E as __INTERNAL_DO_NOT_USE__Password, _ as __INTERNAL_DO_NOT_USE__TextArea, g as getAnimationCss, p as getButtonEmotionStyles, w as useAntDConfigProviderContext, b as useDesignSystemFlags, u as useDesignSystemTheme } from './Typography-91d3d591.js';
|
|
5
5
|
import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
|
|
6
6
|
import { css, keyframes, ClassNames } from '@emotion/react';
|
|
7
7
|
import { Collapse, Alert as Alert$1, AutoComplete as AutoComplete$1, Breadcrumb as Breadcrumb$1, Checkbox as Checkbox$1, DatePicker, Tooltip as Tooltip$1, Dropdown as Dropdown$1, Form as Form$1, Radio as Radio$1, Select as Select$1, Col as Col$1, Row as Row$1, Space as Space$1, Layout as Layout$1, notification, Popover as Popover$2, Pagination as Pagination$1, Table as Table$1, Menu as Menu$1, Modal as Modal$1, Skeleton as Skeleton$1, Button as Button$1, Switch as Switch$1, Tabs as Tabs$1, Tree as Tree$1 } from 'antd';
|
|
@@ -817,29 +817,6 @@ function CheckCircleIcon(props) {
|
|
|
817
817
|
});
|
|
818
818
|
}
|
|
819
819
|
|
|
820
|
-
function SvgCheckIcon(props) {
|
|
821
|
-
return jsx("svg", {
|
|
822
|
-
width: "1em",
|
|
823
|
-
height: "1em",
|
|
824
|
-
viewBox: "0 0 16 16",
|
|
825
|
-
fill: "none",
|
|
826
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
827
|
-
...props,
|
|
828
|
-
children: jsx("path", {
|
|
829
|
-
fillRule: "evenodd",
|
|
830
|
-
clipRule: "evenodd",
|
|
831
|
-
d: "M15.06 3.56l-9.53 9.531L1 8.561 2.06 7.5l3.47 3.47L14 2.5l1.06 1.06z",
|
|
832
|
-
fill: "currentColor"
|
|
833
|
-
})
|
|
834
|
-
});
|
|
835
|
-
}
|
|
836
|
-
function CheckIcon(props) {
|
|
837
|
-
return jsx(Icon, {
|
|
838
|
-
...props,
|
|
839
|
-
component: SvgCheckIcon
|
|
840
|
-
});
|
|
841
|
-
}
|
|
842
|
-
|
|
843
820
|
function SvgCheckLineIcon(props) {
|
|
844
821
|
return jsx("svg", {
|
|
845
822
|
width: "1em",
|
|
@@ -4757,27 +4734,6 @@ function UserIcon(props) {
|
|
|
4757
4734
|
});
|
|
4758
4735
|
}
|
|
4759
4736
|
|
|
4760
|
-
function SvgVariableIcon(props) {
|
|
4761
|
-
return jsx("svg", {
|
|
4762
|
-
width: "1em",
|
|
4763
|
-
height: "1em",
|
|
4764
|
-
viewBox: "0 0 16 16",
|
|
4765
|
-
fill: "none",
|
|
4766
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
4767
|
-
...props,
|
|
4768
|
-
children: jsx("path", {
|
|
4769
|
-
d: "M3.73 13.2h.4v-1.109h-.257c-.78 0-1.084-.345-1.084-1.228v-1.74c0-.858-.507-1.347-1.472-1.448v-.173c.965-.108 1.472-.596 1.472-1.455v-1.71c0-.883.304-1.228 1.084-1.228h.257V2h-.4c-1.638 0-2.353.662-2.353 2.158v1.46c0 .906-.37 1.234-1.377 1.234v1.466c1.013.006 1.377.334 1.377 1.234v1.472c0 1.502.715 2.176 2.353 2.176zM4.994 11.036H6.59L7.92 8.771h.1l1.336 2.265h1.668L8.897 7.74 11 4.521H9.374l-1.288 2.26h-.1L6.691 4.52H4.976l2.127 3.285-2.11 3.23zM12.27 13.2c1.638 0 2.354-.674 2.354-2.176V9.552c0-.9.363-1.228 1.376-1.234V6.852c-1.007 0-1.377-.328-1.377-1.234v-1.46C14.623 2.662 13.909 2 12.27 2h-.4v1.109h.257c.786 0 1.09.345 1.09 1.228v1.71c0 .859.5 1.347 1.466 1.455v.173c-.965.1-1.466.59-1.466 1.448v1.74c0 .883-.31 1.228-1.09 1.228h-.257V13.2h.4z",
|
|
4770
|
-
fill: "currentColor"
|
|
4771
|
-
})
|
|
4772
|
-
});
|
|
4773
|
-
}
|
|
4774
|
-
function VariableIcon(props) {
|
|
4775
|
-
return jsx(Icon, {
|
|
4776
|
-
...props,
|
|
4777
|
-
component: SvgVariableIcon
|
|
4778
|
-
});
|
|
4779
|
-
}
|
|
4780
|
-
|
|
4781
4737
|
function SvgVisibleIcon(props) {
|
|
4782
4738
|
return jsxs("svg", {
|
|
4783
4739
|
width: "1em",
|
|
@@ -6046,19 +6002,23 @@ const DialogComboboxLoadingSpinner = props => {
|
|
|
6046
6002
|
});
|
|
6047
6003
|
};
|
|
6048
6004
|
|
|
6049
|
-
function _EMOTION_STRINGIFIED_CSS_ERROR__$
|
|
6005
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__$g() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
6050
6006
|
const getContentWrapperStyles = (theme, _ref) => {
|
|
6051
6007
|
let {
|
|
6052
6008
|
maxHeight = '100vh',
|
|
6053
6009
|
maxWidth = '100vw',
|
|
6054
6010
|
minHeight = 0,
|
|
6055
|
-
minWidth = 0
|
|
6011
|
+
minWidth = 0,
|
|
6012
|
+
width
|
|
6056
6013
|
} = _ref;
|
|
6057
6014
|
return /*#__PURE__*/css({
|
|
6058
6015
|
maxHeight,
|
|
6059
6016
|
maxWidth,
|
|
6060
6017
|
minHeight,
|
|
6061
6018
|
minWidth,
|
|
6019
|
+
...(width ? {
|
|
6020
|
+
width
|
|
6021
|
+
} : {}),
|
|
6062
6022
|
background: theme.colors.backgroundPrimary,
|
|
6063
6023
|
color: theme.colors.textPrimary,
|
|
6064
6024
|
overflow: 'auto',
|
|
@@ -6078,7 +6038,7 @@ var _ref3$5 = process.env.NODE_ENV === "production" ? {
|
|
|
6078
6038
|
} : {
|
|
6079
6039
|
name: "189loa6-DialogComboboxContent",
|
|
6080
6040
|
styles: "display:flex;flex-direction:column;align-items:flex-start;justify-content:center;label:DialogComboboxContent;",
|
|
6081
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$
|
|
6041
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$g
|
|
6082
6042
|
};
|
|
6083
6043
|
const DialogComboboxContent = /*#__PURE__*/forwardRef((_ref2, forwardedRef) => {
|
|
6084
6044
|
let {
|
|
@@ -6088,6 +6048,7 @@ const DialogComboboxContent = /*#__PURE__*/forwardRef((_ref2, forwardedRef) => {
|
|
|
6088
6048
|
maxWidth,
|
|
6089
6049
|
minHeight,
|
|
6090
6050
|
minWidth = 240,
|
|
6051
|
+
width,
|
|
6091
6052
|
align = 'start',
|
|
6092
6053
|
side = 'bottom',
|
|
6093
6054
|
sideOffset = 4,
|
|
@@ -6115,7 +6076,8 @@ const DialogComboboxContent = /*#__PURE__*/forwardRef((_ref2, forwardedRef) => {
|
|
|
6115
6076
|
maxHeight,
|
|
6116
6077
|
maxWidth,
|
|
6117
6078
|
minHeight,
|
|
6118
|
-
minWidth
|
|
6079
|
+
minWidth,
|
|
6080
|
+
width
|
|
6119
6081
|
}),
|
|
6120
6082
|
align: align,
|
|
6121
6083
|
side: side,
|
|
@@ -6162,16 +6124,11 @@ const DialogComboboxCountBadge = props => {
|
|
|
6162
6124
|
});
|
|
6163
6125
|
};
|
|
6164
6126
|
|
|
6165
|
-
const
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
const useSelectContext = () => {
|
|
6171
|
-
return useContext(SelectContext);
|
|
6172
|
-
};
|
|
6173
|
-
|
|
6174
|
-
const DialogComboboxOptionListContext = /*#__PURE__*/createContext({});
|
|
6127
|
+
const DialogComboboxOptionListContext = /*#__PURE__*/createContext({
|
|
6128
|
+
isInsideDialogComboboxOptionList: false,
|
|
6129
|
+
lookAhead: '',
|
|
6130
|
+
setLookAhead: () => {}
|
|
6131
|
+
});
|
|
6175
6132
|
const DialogComboboxOptionListContextProvider = _ref => {
|
|
6176
6133
|
let {
|
|
6177
6134
|
children,
|
|
@@ -6183,14 +6140,14 @@ const DialogComboboxOptionListContextProvider = _ref => {
|
|
|
6183
6140
|
});
|
|
6184
6141
|
};
|
|
6185
6142
|
|
|
6186
|
-
function _EMOTION_STRINGIFIED_CSS_ERROR__$
|
|
6187
|
-
var _ref2$
|
|
6143
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__$f() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
6144
|
+
var _ref2$5 = process.env.NODE_ENV === "production" ? {
|
|
6188
6145
|
name: "1pgv7dg",
|
|
6189
6146
|
styles: "display:flex;flex-direction:column;align-items:flex-start;width:100%"
|
|
6190
6147
|
} : {
|
|
6191
6148
|
name: "1dtf9pj-DialogComboboxOptionList",
|
|
6192
6149
|
styles: "display:flex;flex-direction:column;align-items:flex-start;width:100%;label:DialogComboboxOptionList;",
|
|
6193
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$
|
|
6150
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$f
|
|
6194
6151
|
};
|
|
6195
6152
|
const DialogComboboxOptionList = /*#__PURE__*/forwardRef((_ref, forwardedRef) => {
|
|
6196
6153
|
let {
|
|
@@ -6202,9 +6159,6 @@ const DialogComboboxOptionList = /*#__PURE__*/forwardRef((_ref, forwardedRef) =>
|
|
|
6202
6159
|
const {
|
|
6203
6160
|
isInsideDialogCombobox
|
|
6204
6161
|
} = useDialogComboboxContext();
|
|
6205
|
-
const {
|
|
6206
|
-
isSelect
|
|
6207
|
-
} = useSelectContext();
|
|
6208
6162
|
const ref = useRef(null);
|
|
6209
6163
|
useImperativeHandle(forwardedRef, () => ref.current);
|
|
6210
6164
|
const [lookAhead, setLookAhead] = useState('');
|
|
@@ -6213,20 +6167,18 @@ const DialogComboboxOptionList = /*#__PURE__*/forwardRef((_ref, forwardedRef) =>
|
|
|
6213
6167
|
}
|
|
6214
6168
|
const lookAheadTimeout = useRef(null);
|
|
6215
6169
|
useEffect(() => {
|
|
6216
|
-
if (
|
|
6217
|
-
|
|
6218
|
-
clearTimeout(lookAheadTimeout.current);
|
|
6219
|
-
}
|
|
6220
|
-
lookAheadTimeout.current = setTimeout(() => {
|
|
6221
|
-
setLookAhead('');
|
|
6222
|
-
}, 1500);
|
|
6170
|
+
if (lookAheadTimeout.current) {
|
|
6171
|
+
clearTimeout(lookAheadTimeout.current);
|
|
6223
6172
|
}
|
|
6173
|
+
lookAheadTimeout.current = setTimeout(() => {
|
|
6174
|
+
setLookAhead('');
|
|
6175
|
+
}, 1500);
|
|
6224
6176
|
return () => {
|
|
6225
6177
|
if (lookAheadTimeout.current) {
|
|
6226
6178
|
clearTimeout(lookAheadTimeout.current);
|
|
6227
6179
|
}
|
|
6228
6180
|
};
|
|
6229
|
-
}, [
|
|
6181
|
+
}, [lookAhead]);
|
|
6230
6182
|
useEffect(() => {
|
|
6231
6183
|
var _ref$current;
|
|
6232
6184
|
if (loading && !withProgressiveLoading) {
|
|
@@ -6247,15 +6199,13 @@ const DialogComboboxOptionList = /*#__PURE__*/forwardRef((_ref, forwardedRef) =>
|
|
|
6247
6199
|
ref: ref,
|
|
6248
6200
|
"aria-busy": loading,
|
|
6249
6201
|
role: "list",
|
|
6250
|
-
css: _ref2$
|
|
6202
|
+
css: _ref2$5,
|
|
6251
6203
|
...restProps,
|
|
6252
6204
|
children: jsx(DialogComboboxOptionListContextProvider, {
|
|
6253
6205
|
value: {
|
|
6254
6206
|
isInsideDialogComboboxOptionList: true,
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
setLookAhead
|
|
6258
|
-
})
|
|
6207
|
+
lookAhead,
|
|
6208
|
+
setLookAhead
|
|
6259
6209
|
},
|
|
6260
6210
|
children: loading ? withProgressiveLoading ? jsxs(Fragment, {
|
|
6261
6211
|
children: [children, jsx(DialogComboboxLoadingSpinner, {
|
|
@@ -6404,7 +6354,6 @@ const getKeyboardNavigationFunctions = (handleSelect, _ref) => {
|
|
|
6404
6354
|
previousSibling.setAttribute('tabIndex', '0');
|
|
6405
6355
|
}
|
|
6406
6356
|
break;
|
|
6407
|
-
case ' ':
|
|
6408
6357
|
case 'Enter':
|
|
6409
6358
|
e.preventDefault();
|
|
6410
6359
|
handleSelect();
|
|
@@ -6428,6 +6377,28 @@ const resetTabIndexToFocusedElement = elem => {
|
|
|
6428
6377
|
elem.setAttribute('tabIndex', '0');
|
|
6429
6378
|
elem.focus();
|
|
6430
6379
|
};
|
|
6380
|
+
const dialogComboboxLookAheadKeyDown = (e, setLookAhead, lookAhead) => {
|
|
6381
|
+
var _e$currentTarget$pare, _e$currentTarget$pare2;
|
|
6382
|
+
if (e.key === 'Escape' || e.key === 'Tab' || e.key === 'Enter') {
|
|
6383
|
+
return;
|
|
6384
|
+
}
|
|
6385
|
+
e.preventDefault();
|
|
6386
|
+
const siblings = Array.from((_e$currentTarget$pare = (_e$currentTarget$pare2 = e.currentTarget.parentElement) === null || _e$currentTarget$pare2 === void 0 ? void 0 : _e$currentTarget$pare2.children) !== null && _e$currentTarget$pare !== void 0 ? _e$currentTarget$pare : []);
|
|
6387
|
+
// Look for the first sibling that starts with the pressed key + recently pressed keys (lookAhead, cleared after 1.5 seconds of inactivity)
|
|
6388
|
+
const nextSiblingIndex = siblings.findIndex(sibling => {
|
|
6389
|
+
var _sibling$textContent$, _sibling$textContent;
|
|
6390
|
+
const siblingLabel = (_sibling$textContent$ = (_sibling$textContent = sibling.textContent) === null || _sibling$textContent === void 0 ? void 0 : _sibling$textContent.toLowerCase()) !== null && _sibling$textContent$ !== void 0 ? _sibling$textContent$ : '';
|
|
6391
|
+
return siblingLabel.startsWith(lookAhead + e.key);
|
|
6392
|
+
});
|
|
6393
|
+
if (nextSiblingIndex !== -1) {
|
|
6394
|
+
const nextSibling = siblings[nextSiblingIndex];
|
|
6395
|
+
nextSibling.focus();
|
|
6396
|
+
if (setLookAhead) {
|
|
6397
|
+
setLookAhead(lookAhead + e.key);
|
|
6398
|
+
}
|
|
6399
|
+
resetTabIndexToFocusedElement(nextSibling);
|
|
6400
|
+
}
|
|
6401
|
+
};
|
|
6431
6402
|
|
|
6432
6403
|
const DialogComboboxOptionListCheckboxItem = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
6433
6404
|
let {
|
|
@@ -6443,7 +6414,9 @@ const DialogComboboxOptionListCheckboxItem = /*#__PURE__*/forwardRef((_ref, ref)
|
|
|
6443
6414
|
theme
|
|
6444
6415
|
} = useDesignSystemTheme();
|
|
6445
6416
|
const {
|
|
6446
|
-
isInsideDialogComboboxOptionList
|
|
6417
|
+
isInsideDialogComboboxOptionList,
|
|
6418
|
+
setLookAhead,
|
|
6419
|
+
lookAhead
|
|
6447
6420
|
} = useDialogComboboxOptionListContext();
|
|
6448
6421
|
if (!isInsideDialogComboboxOptionList) {
|
|
6449
6422
|
throw new Error('`DialogComboboxOptionListCheckboxItem` must be used within `DialogComboboxOptionList`');
|
|
@@ -6484,7 +6457,8 @@ const DialogComboboxOptionListCheckboxItem = /*#__PURE__*/forwardRef((_ref, ref)
|
|
|
6484
6457
|
tabIndex: -1,
|
|
6485
6458
|
...getKeyboardNavigationFunctions(handleSelect, {
|
|
6486
6459
|
onKeyDown: props.onKeyDown,
|
|
6487
|
-
onMouseEnter: props.onMouseEnter
|
|
6460
|
+
onMouseEnter: props.onMouseEnter,
|
|
6461
|
+
onDefaultKeyDown: e => dialogComboboxLookAheadKeyDown(e, setLookAhead, lookAhead)
|
|
6488
6462
|
}),
|
|
6489
6463
|
children: jsx(Checkbox, {
|
|
6490
6464
|
disabled: props.disabled,
|
|
@@ -6509,15 +6483,25 @@ const DialogComboboxOptionListCheckboxItem = /*#__PURE__*/forwardRef((_ref, ref)
|
|
|
6509
6483
|
});
|
|
6510
6484
|
});
|
|
6511
6485
|
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
name: "1cjitc6",
|
|
6515
|
-
styles: "width:16px"
|
|
6516
|
-
} : {
|
|
6517
|
-
name: "gvtsec-DialogComboboxOptionListSelectItem",
|
|
6518
|
-
styles: "width:16px;label:DialogComboboxOptionListSelectItem;",
|
|
6519
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$f
|
|
6486
|
+
const selectContextDefaults = {
|
|
6487
|
+
isSelect: false
|
|
6520
6488
|
};
|
|
6489
|
+
const SelectContext = /*#__PURE__*/createContext(selectContextDefaults);
|
|
6490
|
+
const SelectContextProvider = _ref => {
|
|
6491
|
+
let {
|
|
6492
|
+
children,
|
|
6493
|
+
value
|
|
6494
|
+
} = _ref;
|
|
6495
|
+
return jsx(SelectContext.Provider, {
|
|
6496
|
+
value: value,
|
|
6497
|
+
children: children
|
|
6498
|
+
});
|
|
6499
|
+
};
|
|
6500
|
+
|
|
6501
|
+
const useSelectContext = () => {
|
|
6502
|
+
return useContext(SelectContext);
|
|
6503
|
+
};
|
|
6504
|
+
|
|
6521
6505
|
const DialogComboboxOptionListSelectItem = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
6522
6506
|
let {
|
|
6523
6507
|
value,
|
|
@@ -6596,33 +6580,15 @@ const DialogComboboxOptionListSelectItem = /*#__PURE__*/forwardRef((_ref, ref) =
|
|
|
6596
6580
|
...getKeyboardNavigationFunctions(handleSelect, {
|
|
6597
6581
|
onKeyDown: props.onKeyDown,
|
|
6598
6582
|
onMouseEnter: props.onMouseEnter,
|
|
6599
|
-
onDefaultKeyDown: e =>
|
|
6600
|
-
if (isSelect) {
|
|
6601
|
-
var _e$currentTarget$pare, _e$currentTarget$pare2;
|
|
6602
|
-
e.preventDefault();
|
|
6603
|
-
const siblings = Array.from((_e$currentTarget$pare = (_e$currentTarget$pare2 = e.currentTarget.parentElement) === null || _e$currentTarget$pare2 === void 0 ? void 0 : _e$currentTarget$pare2.children) !== null && _e$currentTarget$pare !== void 0 ? _e$currentTarget$pare : []);
|
|
6604
|
-
// Look for the first sibling that starts with the pressed key + recently pressed keys (lookAhead, cleared after 1.5 seconds of inactivity)
|
|
6605
|
-
const nextSiblingIndex = siblings.findIndex(sibling => {
|
|
6606
|
-
var _sibling$textContent$, _sibling$textContent;
|
|
6607
|
-
const siblingLabel = (_sibling$textContent$ = (_sibling$textContent = sibling.textContent) === null || _sibling$textContent === void 0 ? void 0 : _sibling$textContent.toLowerCase()) !== null && _sibling$textContent$ !== void 0 ? _sibling$textContent$ : '';
|
|
6608
|
-
return siblingLabel.startsWith(lookAhead + e.key);
|
|
6609
|
-
});
|
|
6610
|
-
if (nextSiblingIndex !== -1) {
|
|
6611
|
-
const nextSibling = siblings[nextSiblingIndex];
|
|
6612
|
-
nextSibling.focus();
|
|
6613
|
-
if (setLookAhead) {
|
|
6614
|
-
setLookAhead(lookAhead + e.key);
|
|
6615
|
-
}
|
|
6616
|
-
resetTabIndexToFocusedElement(nextSibling);
|
|
6617
|
-
}
|
|
6618
|
-
}
|
|
6619
|
-
}
|
|
6583
|
+
onDefaultKeyDown: e => dialogComboboxLookAheadKeyDown(e, setLookAhead, lookAhead)
|
|
6620
6584
|
}),
|
|
6621
6585
|
role: "option",
|
|
6622
6586
|
"aria-selected": checked,
|
|
6623
6587
|
"aria-label": value,
|
|
6624
6588
|
children: [checked ? jsx(CheckIcon, {}) : jsx("div", {
|
|
6625
|
-
|
|
6589
|
+
style: {
|
|
6590
|
+
width: 16
|
|
6591
|
+
}
|
|
6626
6592
|
}), jsx("label", {
|
|
6627
6593
|
style: {
|
|
6628
6594
|
fontSize: theme.typography.fontSizeBase,
|
|
@@ -6743,9 +6709,24 @@ const DialogComboboxOptionControlledList = /*#__PURE__*/forwardRef((_ref, forwar
|
|
|
6743
6709
|
setValue,
|
|
6744
6710
|
setIsControlled
|
|
6745
6711
|
} = useDialogComboboxContext();
|
|
6712
|
+
const [lookAhead, setLookAhead] = useState('');
|
|
6746
6713
|
if (!isInsideDialogCombobox) {
|
|
6747
6714
|
throw new Error('`DialogComboboxOptionControlledList` must be used within `DialogCombobox`');
|
|
6748
6715
|
}
|
|
6716
|
+
const lookAheadTimeout = useRef(null);
|
|
6717
|
+
useEffect(() => {
|
|
6718
|
+
if (lookAheadTimeout.current) {
|
|
6719
|
+
clearTimeout(lookAheadTimeout.current);
|
|
6720
|
+
}
|
|
6721
|
+
lookAheadTimeout.current = setTimeout(() => {
|
|
6722
|
+
setLookAhead('');
|
|
6723
|
+
}, 1500);
|
|
6724
|
+
return () => {
|
|
6725
|
+
if (lookAheadTimeout.current) {
|
|
6726
|
+
clearTimeout(lookAheadTimeout.current);
|
|
6727
|
+
}
|
|
6728
|
+
};
|
|
6729
|
+
}, [lookAhead]);
|
|
6749
6730
|
const isOptionChecked = options.reduce((acc, option) => {
|
|
6750
6731
|
acc[option] = value === null || value === void 0 ? void 0 : value.includes(option);
|
|
6751
6732
|
return acc;
|
|
@@ -6814,7 +6795,9 @@ const DialogComboboxOptionControlledList = /*#__PURE__*/forwardRef((_ref, forwar
|
|
|
6814
6795
|
...restProps,
|
|
6815
6796
|
children: jsx(DialogComboboxOptionListContextProvider, {
|
|
6816
6797
|
value: {
|
|
6817
|
-
isInsideDialogComboboxOptionList: true
|
|
6798
|
+
isInsideDialogComboboxOptionList: true,
|
|
6799
|
+
lookAhead,
|
|
6800
|
+
setLookAhead
|
|
6818
6801
|
},
|
|
6819
6802
|
children: jsx(Fragment, {
|
|
6820
6803
|
children: loading ? withProgressiveLoading ? jsxs(Fragment, {
|
|
@@ -6904,7 +6887,7 @@ const getTriggerWrapperStyles = (removable, width) => /*#__PURE__*/css(important
|
|
|
6904
6887
|
})
|
|
6905
6888
|
})
|
|
6906
6889
|
}), process.env.NODE_ENV === "production" ? "" : ";label:getTriggerWrapperStyles;");
|
|
6907
|
-
const getTriggerStyles = (theme, maxWidth, minWidth, removable, width) => {
|
|
6890
|
+
const getTriggerStyles = (theme, maxWidth, minWidth, removable, width, validationState) => {
|
|
6908
6891
|
const removeButtonInteractionStyles = {
|
|
6909
6892
|
...(removable && {
|
|
6910
6893
|
zIndex: theme.options.zIndexBase + 2,
|
|
@@ -6914,6 +6897,7 @@ const getTriggerStyles = (theme, maxWidth, minWidth, removable, width) => {
|
|
|
6914
6897
|
}
|
|
6915
6898
|
})
|
|
6916
6899
|
};
|
|
6900
|
+
const validationColor = getValidationStateColor(theme, validationState);
|
|
6917
6901
|
return /*#__PURE__*/css(importantify({
|
|
6918
6902
|
position: 'relative',
|
|
6919
6903
|
display: 'inline-flex',
|
|
@@ -6949,6 +6933,16 @@ const getTriggerStyles = (theme, maxWidth, minWidth, removable, width) => {
|
|
|
6949
6933
|
borderColor: theme.colors.actionDefaultBorderFocus,
|
|
6950
6934
|
...removeButtonInteractionStyles
|
|
6951
6935
|
},
|
|
6936
|
+
...(validationState && {
|
|
6937
|
+
borderColor: validationColor,
|
|
6938
|
+
'&:hover': {
|
|
6939
|
+
borderColor: validationColor
|
|
6940
|
+
},
|
|
6941
|
+
'&:focus': {
|
|
6942
|
+
outlineColor: validationColor,
|
|
6943
|
+
outlineOffset: -2
|
|
6944
|
+
}
|
|
6945
|
+
}),
|
|
6952
6946
|
[`&[disabled]`]: {
|
|
6953
6947
|
background: theme.colors.actionDisabledBackground,
|
|
6954
6948
|
color: theme.colors.actionDisabledText,
|
|
@@ -6972,6 +6966,9 @@ const DialogComboboxTrigger = /*#__PURE__*/forwardRef((_ref, forwardedRef) => {
|
|
|
6972
6966
|
wrapperProps,
|
|
6973
6967
|
width,
|
|
6974
6968
|
withChevronIcon = true,
|
|
6969
|
+
validationState,
|
|
6970
|
+
withInlineLabel = true,
|
|
6971
|
+
placeholder,
|
|
6975
6972
|
...restProps
|
|
6976
6973
|
} = _ref;
|
|
6977
6974
|
const {
|
|
@@ -6987,7 +6984,7 @@ const DialogComboboxTrigger = /*#__PURE__*/forwardRef((_ref, forwardedRef) => {
|
|
|
6987
6984
|
} = useDialogComboboxContext();
|
|
6988
6985
|
const {
|
|
6989
6986
|
isSelect,
|
|
6990
|
-
placeholder
|
|
6987
|
+
placeholder: selectPlaceholder
|
|
6991
6988
|
} = useSelectContext();
|
|
6992
6989
|
if (!isInsideDialogCombobox) {
|
|
6993
6990
|
throw new Error('`DialogComboboxTrigger` must be used within `DialogCombobox`');
|
|
@@ -7036,12 +7033,13 @@ const DialogComboboxTrigger = /*#__PURE__*/forwardRef((_ref, forwardedRef) => {
|
|
|
7036
7033
|
ariaLabel += multiSelect ? ', multiselectable, 0 options selected' : ', no option selected';
|
|
7037
7034
|
}
|
|
7038
7035
|
const customSelectContent = isSelect && children ? children : null;
|
|
7036
|
+
const dialogComboboxClassname = !isSelect ? `${classNamePrefix}-dialogcombobox` : '';
|
|
7039
7037
|
const selectV2Classname = isSelect ? `${classNamePrefix}-selectv2` : '';
|
|
7040
7038
|
const triggerContent = isSelect ? jsxs(Popover$1.Trigger, {
|
|
7041
7039
|
"aria-label": ariaLabel,
|
|
7042
7040
|
ref: forwardedRef,
|
|
7043
7041
|
...restProps,
|
|
7044
|
-
css: getTriggerStyles(theme, maxWidth, minWidth, removable, width),
|
|
7042
|
+
css: getTriggerStyles(theme, maxWidth, minWidth, removable, width, validationState),
|
|
7045
7043
|
role: "listbox",
|
|
7046
7044
|
"aria-multiselectable": multiSelect,
|
|
7047
7045
|
children: [jsx("span", {
|
|
@@ -7057,7 +7055,7 @@ const DialogComboboxTrigger = /*#__PURE__*/forwardRef((_ref, forwardedRef) => {
|
|
|
7057
7055
|
css: /*#__PURE__*/css({
|
|
7058
7056
|
color: theme.colors.textPlaceholder
|
|
7059
7057
|
}, process.env.NODE_ENV === "production" ? "" : ";label:triggerContent;"),
|
|
7060
|
-
children:
|
|
7058
|
+
children: selectPlaceholder
|
|
7061
7059
|
})
|
|
7062
7060
|
}), allowClear && value !== null && value !== void 0 && value.length ? jsx(XCircleFillIcon, {
|
|
7063
7061
|
onClick: handleClear,
|
|
@@ -7081,7 +7079,7 @@ const DialogComboboxTrigger = /*#__PURE__*/forwardRef((_ref, forwardedRef) => {
|
|
|
7081
7079
|
"aria-label": ariaLabel,
|
|
7082
7080
|
ref: forwardedRef,
|
|
7083
7081
|
...restProps,
|
|
7084
|
-
css: getTriggerStyles(theme, maxWidth, minWidth, removable, width),
|
|
7082
|
+
css: getTriggerStyles(theme, maxWidth, minWidth, removable, width, validationState),
|
|
7085
7083
|
role: "listbox",
|
|
7086
7084
|
"aria-multiselectable": multiSelect,
|
|
7087
7085
|
children: [jsxs("span", {
|
|
@@ -7097,7 +7095,7 @@ const DialogComboboxTrigger = /*#__PURE__*/forwardRef((_ref, forwardedRef) => {
|
|
|
7097
7095
|
}
|
|
7098
7096
|
}, process.env.NODE_ENV === "production" ? "" : ";label:triggerContent;"),
|
|
7099
7097
|
ref: triggerContentRef,
|
|
7100
|
-
children: [jsx("span", {
|
|
7098
|
+
children: [withInlineLabel ? jsx("span", {
|
|
7101
7099
|
css: /*#__PURE__*/css({
|
|
7102
7100
|
height: theme.typography.lineHeightBase,
|
|
7103
7101
|
marginRight: theme.spacing.xs,
|
|
@@ -7107,6 +7105,11 @@ const DialogComboboxTrigger = /*#__PURE__*/forwardRef((_ref, forwardedRef) => {
|
|
|
7107
7105
|
textOverflow: 'unset'
|
|
7108
7106
|
}, process.env.NODE_ENV === "production" ? "" : ";label:triggerContent;"),
|
|
7109
7107
|
children: label
|
|
7108
|
+
}) : !(value !== null && value !== void 0 && value.length) && jsx("span", {
|
|
7109
|
+
css: /*#__PURE__*/css({
|
|
7110
|
+
color: theme.colors.textPlaceholder
|
|
7111
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:triggerContent;"),
|
|
7112
|
+
children: placeholder
|
|
7110
7113
|
}), (value === null || value === void 0 ? void 0 : value.length) > showTagAfterValueCount ? jsxs(Fragment, {
|
|
7111
7114
|
children: [jsx("span", {
|
|
7112
7115
|
style: {
|
|
@@ -7141,7 +7144,7 @@ const DialogComboboxTrigger = /*#__PURE__*/forwardRef((_ref, forwardedRef) => {
|
|
|
7141
7144
|
});
|
|
7142
7145
|
return jsxs("div", {
|
|
7143
7146
|
...wrapperProps,
|
|
7144
|
-
className: `${(_restProps$className = restProps === null || restProps === void 0 ? void 0 : restProps.className) !== null && _restProps$className !== void 0 ? _restProps$className : ''} ${selectV2Classname}`.trim(),
|
|
7147
|
+
className: `${(_restProps$className = restProps === null || restProps === void 0 ? void 0 : restProps.className) !== null && _restProps$className !== void 0 ? _restProps$className : ''} ${dialogComboboxClassname} ${selectV2Classname}`.trim(),
|
|
7145
7148
|
css: [getTriggerWrapperStyles(removable, width), wrapperProps === null || wrapperProps === void 0 ? void 0 : wrapperProps.css, process.env.NODE_ENV === "production" ? "" : ";label:DialogComboboxTrigger;"],
|
|
7146
7149
|
children: [showTooltip && value !== null && value !== void 0 && value.length ? jsx(Tooltip, {
|
|
7147
7150
|
title: customSelectContent !== null && customSelectContent !== void 0 ? customSelectContent : displayedValues,
|
|
@@ -8105,7 +8108,7 @@ const getHintStyles = (classNamePrefix, theme) => {
|
|
|
8105
8108
|
color: theme.colors.textSecondary,
|
|
8106
8109
|
lineHeight: theme.typography.lineHeightSm,
|
|
8107
8110
|
fontSize: theme.typography.fontSizeSm,
|
|
8108
|
-
[`&& + .${classNamePrefix}-input, && + .${classNamePrefix}-select, && + .${classNamePrefix}-selectv2, && + .${classNamePrefix}-checkbox-group, && + .${classNamePrefix}-radio-group`]: {
|
|
8111
|
+
[`&& + .${classNamePrefix}-input, && + .${classNamePrefix}-select, && + .${classNamePrefix}-selectv2, && + .${classNamePrefix}-dialogcombobox, && + .${classNamePrefix}-checkbox-group, && + .${classNamePrefix}-radio-group`]: {
|
|
8109
8112
|
marginTop: theme.spacing.sm
|
|
8110
8113
|
}
|
|
8111
8114
|
};
|
|
@@ -8138,7 +8141,7 @@ const getLabelStyles = (classNamePrefix, theme, _ref) => {
|
|
|
8138
8141
|
display: inline ? 'inline' : 'block',
|
|
8139
8142
|
lineHeight: theme.typography.lineHeightBase
|
|
8140
8143
|
},
|
|
8141
|
-
[`&& + .${classNamePrefix}-input, && + .${classNamePrefix}-select, && + .${classNamePrefix}-selectv2, && + .${classNamePrefix}-checkbox-group, && + .${classNamePrefix}-radio-group`]: {
|
|
8144
|
+
[`&& + .${classNamePrefix}-input, && + .${classNamePrefix}-select, && + .${classNamePrefix}-selectv2, && + .${classNamePrefix}-dialogcombobox, && + .${classNamePrefix}-checkbox-group, && + .${classNamePrefix}-radio-group`]: {
|
|
8142
8145
|
marginTop: theme.spacing.sm
|
|
8143
8146
|
}
|
|
8144
8147
|
};
|
|
@@ -8929,6 +8932,9 @@ function DuboisSelect(_ref2, ref) {
|
|
|
8929
8932
|
}
|
|
8930
8933
|
});
|
|
8931
8934
|
}
|
|
8935
|
+
|
|
8936
|
+
/** @deprecated Use `SelectOptionProps` */
|
|
8937
|
+
|
|
8932
8938
|
const SelectOption = /*#__PURE__*/forwardRef(function Option(props, ref) {
|
|
8933
8939
|
const {
|
|
8934
8940
|
dangerouslySetAntdProps,
|
|
@@ -8948,6 +8954,9 @@ SelectOption.isSelectOption = true;
|
|
|
8948
8954
|
* @deprecated use Select.Option instead
|
|
8949
8955
|
*/
|
|
8950
8956
|
const Option = SelectOption;
|
|
8957
|
+
|
|
8958
|
+
/** @deprecated Use `SelectOptGroupProps` */
|
|
8959
|
+
|
|
8951
8960
|
const SelectOptGroup = /* #__PURE__ */(() => {
|
|
8952
8961
|
const OptGroup = /*#__PURE__*/forwardRef(function OptGroup(props, ref) {
|
|
8953
8962
|
return jsx(Select$1.OptGroup, {
|
|
@@ -8972,6 +8981,79 @@ const Select = /* #__PURE__ */(() => {
|
|
|
8972
8981
|
return DuboisRefForwardedSelect;
|
|
8973
8982
|
})();
|
|
8974
8983
|
|
|
8984
|
+
const SelectV2 = props => {
|
|
8985
|
+
const {
|
|
8986
|
+
children,
|
|
8987
|
+
placeholder,
|
|
8988
|
+
value,
|
|
8989
|
+
...restProps
|
|
8990
|
+
} = props;
|
|
8991
|
+
return jsx(SelectContextProvider, {
|
|
8992
|
+
value: {
|
|
8993
|
+
isSelect: true,
|
|
8994
|
+
placeholder
|
|
8995
|
+
},
|
|
8996
|
+
children: jsx(DialogCombobox, {
|
|
8997
|
+
value: value ? [value] : [],
|
|
8998
|
+
...restProps,
|
|
8999
|
+
children: children
|
|
9000
|
+
})
|
|
9001
|
+
});
|
|
9002
|
+
};
|
|
9003
|
+
|
|
9004
|
+
const SelectV2Content = /*#__PURE__*/forwardRef((props, ref) => {
|
|
9005
|
+
const {
|
|
9006
|
+
children,
|
|
9007
|
+
...restProps
|
|
9008
|
+
} = props;
|
|
9009
|
+
return jsx(DialogComboboxContent, {
|
|
9010
|
+
minWidth: 150,
|
|
9011
|
+
...restProps,
|
|
9012
|
+
ref: ref,
|
|
9013
|
+
children: jsx(DialogComboboxOptionList, {
|
|
9014
|
+
children: children
|
|
9015
|
+
})
|
|
9016
|
+
});
|
|
9017
|
+
});
|
|
9018
|
+
|
|
9019
|
+
const SelectV2Option = /*#__PURE__*/forwardRef((props, ref) => {
|
|
9020
|
+
const {
|
|
9021
|
+
value
|
|
9022
|
+
} = useDialogComboboxContext();
|
|
9023
|
+
return jsx(DialogComboboxOptionListSelectItem, {
|
|
9024
|
+
checked: value && value[0] === props.value,
|
|
9025
|
+
...props,
|
|
9026
|
+
ref: ref
|
|
9027
|
+
});
|
|
9028
|
+
});
|
|
9029
|
+
|
|
9030
|
+
const SelectV2OptionGroup = props => {
|
|
9031
|
+
const {
|
|
9032
|
+
name,
|
|
9033
|
+
children,
|
|
9034
|
+
...restProps
|
|
9035
|
+
} = props;
|
|
9036
|
+
return jsxs(Fragment, {
|
|
9037
|
+
children: [jsx(DialogComboboxSectionHeader, {
|
|
9038
|
+
...restProps,
|
|
9039
|
+
children: name
|
|
9040
|
+
}), children]
|
|
9041
|
+
});
|
|
9042
|
+
};
|
|
9043
|
+
|
|
9044
|
+
const SelectV2Trigger = /*#__PURE__*/forwardRef((props, ref) => {
|
|
9045
|
+
const {
|
|
9046
|
+
children,
|
|
9047
|
+
...restProps
|
|
9048
|
+
} = props;
|
|
9049
|
+
return jsx(DialogComboboxTrigger, {
|
|
9050
|
+
allowClear: false,
|
|
9051
|
+
...restProps,
|
|
9052
|
+
ref: ref,
|
|
9053
|
+
children: children
|
|
9054
|
+
});
|
|
9055
|
+
});
|
|
9056
|
+
|
|
8975
9057
|
function RHFControlledInput(_ref) {
|
|
8976
9058
|
let {
|
|
8977
9059
|
name,
|
|
@@ -9056,11 +9138,15 @@ function RHFControlledSelect(_ref4) {
|
|
|
9056
9138
|
defaultValue: field.value
|
|
9057
9139
|
});
|
|
9058
9140
|
}
|
|
9059
|
-
function
|
|
9141
|
+
function RHFControlledSelectV2(_ref5) {
|
|
9060
9142
|
let {
|
|
9061
9143
|
name,
|
|
9062
9144
|
control,
|
|
9063
9145
|
rules,
|
|
9146
|
+
options,
|
|
9147
|
+
validationState,
|
|
9148
|
+
children,
|
|
9149
|
+
width,
|
|
9064
9150
|
...restProps
|
|
9065
9151
|
} = _ref5;
|
|
9066
9152
|
const {
|
|
@@ -9070,19 +9156,183 @@ function RHFControlledCheckboxGroup(_ref5) {
|
|
|
9070
9156
|
control: control,
|
|
9071
9157
|
rules: rules
|
|
9072
9158
|
});
|
|
9159
|
+
const [selectedValueLabel, setSelectedValueLabel] = useState(field.value ? field.value.label ? field.value.label : field.value : '');
|
|
9160
|
+
const handleOnChange = option => {
|
|
9161
|
+
setSelectedValueLabel(typeof option === 'object' ? option.label : option);
|
|
9162
|
+
field.onChange(typeof option === 'object' ? option.value : option);
|
|
9163
|
+
};
|
|
9164
|
+
useEffect(() => {
|
|
9165
|
+
if (!field.value) {
|
|
9166
|
+
return;
|
|
9167
|
+
}
|
|
9168
|
+
|
|
9169
|
+
// Find the appropriate label for value selected by default
|
|
9170
|
+
if (!(options !== null && options !== void 0 && options.length) && children) {
|
|
9171
|
+
const renderedChildren = children({
|
|
9172
|
+
onChange: handleOnChange
|
|
9173
|
+
});
|
|
9174
|
+
const child = Children.toArray(renderedChildren.props.children).find(child => /*#__PURE__*/React__default.isValidElement(child) && child.props.value === field.value);
|
|
9175
|
+
if (child) {
|
|
9176
|
+
setSelectedValueLabel(child.props.children);
|
|
9177
|
+
}
|
|
9178
|
+
} else if (options !== null && options !== void 0 && options.length) {
|
|
9179
|
+
const option = options.find(option => option.value === field.value);
|
|
9180
|
+
setSelectedValueLabel(option === null || option === void 0 ? void 0 : option.label);
|
|
9181
|
+
}
|
|
9182
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
9183
|
+
}, []);
|
|
9184
|
+
return jsxs(SelectV2, {
|
|
9185
|
+
...restProps,
|
|
9186
|
+
value: field.value,
|
|
9187
|
+
children: [jsx(SelectV2Trigger, {
|
|
9188
|
+
width: width,
|
|
9189
|
+
onBlur: field.onBlur,
|
|
9190
|
+
validationState: validationState,
|
|
9191
|
+
children: selectedValueLabel
|
|
9192
|
+
}), jsx(SelectV2Content, {
|
|
9193
|
+
side: "bottom",
|
|
9194
|
+
width: width,
|
|
9195
|
+
children: options && options.length > 0 ? options.map(option => jsx(SelectV2Option, {
|
|
9196
|
+
value: option.value,
|
|
9197
|
+
onChange: handleOnChange,
|
|
9198
|
+
children: option.label
|
|
9199
|
+
}, option.value)) : // SelectV2Option out of the box gives users control over state and in this case RHF is controlling state
|
|
9200
|
+
// We expose onChange through a children renderer function to let users pass this down to SelectV2Option
|
|
9201
|
+
children === null || children === void 0 ? void 0 : children({
|
|
9202
|
+
onChange: handleOnChange
|
|
9203
|
+
})
|
|
9204
|
+
})]
|
|
9205
|
+
});
|
|
9206
|
+
}
|
|
9207
|
+
function RHFControlledDialogCombobox(_ref6) {
|
|
9208
|
+
let {
|
|
9209
|
+
name,
|
|
9210
|
+
control,
|
|
9211
|
+
rules,
|
|
9212
|
+
children,
|
|
9213
|
+
allowClear,
|
|
9214
|
+
validationState,
|
|
9215
|
+
placeholder,
|
|
9216
|
+
width,
|
|
9217
|
+
...restProps
|
|
9218
|
+
} = _ref6;
|
|
9219
|
+
const {
|
|
9220
|
+
field
|
|
9221
|
+
} = useController({
|
|
9222
|
+
name: name,
|
|
9223
|
+
control: control,
|
|
9224
|
+
rules: rules
|
|
9225
|
+
});
|
|
9226
|
+
const [valueMap, setValueMap] = useState({}); // Used for multi-select
|
|
9227
|
+
|
|
9228
|
+
const updateValueMap = updatedValue => {
|
|
9229
|
+
if (updatedValue) {
|
|
9230
|
+
if (Array.isArray(updatedValue)) {
|
|
9231
|
+
setValueMap(updatedValue.reduce((acc, value) => {
|
|
9232
|
+
acc[value] = true;
|
|
9233
|
+
return acc;
|
|
9234
|
+
}, {}));
|
|
9235
|
+
} else {
|
|
9236
|
+
setValueMap({
|
|
9237
|
+
[updatedValue]: true
|
|
9238
|
+
});
|
|
9239
|
+
}
|
|
9240
|
+
} else {
|
|
9241
|
+
setValueMap({});
|
|
9242
|
+
}
|
|
9243
|
+
};
|
|
9244
|
+
const handleOnChangeSingleSelect = option => {
|
|
9245
|
+
let updatedValue = field.value;
|
|
9246
|
+
if (field.value === option) {
|
|
9247
|
+
updatedValue = undefined;
|
|
9248
|
+
} else {
|
|
9249
|
+
updatedValue = option;
|
|
9250
|
+
}
|
|
9251
|
+
field.onChange(updatedValue);
|
|
9252
|
+
updateValueMap(updatedValue);
|
|
9253
|
+
};
|
|
9254
|
+
const hanldeOnChangeMultiSelect = option => {
|
|
9255
|
+
var _field$value;
|
|
9256
|
+
let updatedValue = field.value;
|
|
9257
|
+
if ((_field$value = field.value) !== null && _field$value !== void 0 && _field$value.includes(option)) {
|
|
9258
|
+
updatedValue = field.value.filter(value => value !== option);
|
|
9259
|
+
} else {
|
|
9260
|
+
updatedValue = [...field.value, option];
|
|
9261
|
+
}
|
|
9262
|
+
field.onChange(updatedValue);
|
|
9263
|
+
updateValueMap(updatedValue);
|
|
9264
|
+
};
|
|
9265
|
+
const handleOnChange = option => {
|
|
9266
|
+
if (restProps.multiSelect) {
|
|
9267
|
+
hanldeOnChangeMultiSelect(option);
|
|
9268
|
+
} else {
|
|
9269
|
+
handleOnChangeSingleSelect(option);
|
|
9270
|
+
}
|
|
9271
|
+
};
|
|
9272
|
+
useEffect(() => {
|
|
9273
|
+
if (field.value) {
|
|
9274
|
+
updateValueMap(field.value);
|
|
9275
|
+
}
|
|
9276
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
9277
|
+
}, []);
|
|
9278
|
+
const isChecked = option => {
|
|
9279
|
+
return valueMap[option];
|
|
9280
|
+
};
|
|
9281
|
+
const handleOnClear = () => {
|
|
9282
|
+
field.onChange(Array.isArray(field.value) ? [] : '');
|
|
9283
|
+
setValueMap({});
|
|
9284
|
+
};
|
|
9285
|
+
return jsxs(DialogCombobox, {
|
|
9286
|
+
...restProps,
|
|
9287
|
+
value: field.value ? Array.isArray(field.value) ? field.value : [field.value] : undefined,
|
|
9288
|
+
children: [jsx(DialogComboboxTrigger, {
|
|
9289
|
+
onBlur: field.onBlur,
|
|
9290
|
+
allowClear: allowClear,
|
|
9291
|
+
validationState: validationState,
|
|
9292
|
+
onClear: handleOnClear,
|
|
9293
|
+
withInlineLabel: false,
|
|
9294
|
+
placeholder: placeholder,
|
|
9295
|
+
width: width
|
|
9296
|
+
}), jsx(DialogComboboxContent, {
|
|
9297
|
+
side: "bottom",
|
|
9298
|
+
width: width,
|
|
9299
|
+
children: jsx(DialogComboboxOptionList, {
|
|
9300
|
+
children: children === null || children === void 0 ? void 0 : children({
|
|
9301
|
+
onChange: handleOnChange,
|
|
9302
|
+
value: field.value,
|
|
9303
|
+
isChecked
|
|
9304
|
+
})
|
|
9305
|
+
})
|
|
9306
|
+
})]
|
|
9307
|
+
});
|
|
9308
|
+
}
|
|
9309
|
+
function RHFControlledCheckboxGroup(_ref7) {
|
|
9310
|
+
let {
|
|
9311
|
+
name,
|
|
9312
|
+
control,
|
|
9313
|
+
rules,
|
|
9314
|
+
...restProps
|
|
9315
|
+
} = _ref7;
|
|
9316
|
+
const {
|
|
9317
|
+
field
|
|
9318
|
+
} = useController({
|
|
9319
|
+
name: name,
|
|
9320
|
+
control: control,
|
|
9321
|
+
rules: rules
|
|
9322
|
+
});
|
|
9073
9323
|
return jsx(Checkbox.Group, {
|
|
9074
9324
|
...restProps,
|
|
9075
9325
|
...field,
|
|
9076
9326
|
value: field.value
|
|
9077
9327
|
});
|
|
9078
9328
|
}
|
|
9079
|
-
function RHFControlledCheckbox(
|
|
9329
|
+
function RHFControlledCheckbox(_ref8) {
|
|
9080
9330
|
let {
|
|
9081
9331
|
name,
|
|
9082
9332
|
control,
|
|
9083
9333
|
rules,
|
|
9084
9334
|
...restProps
|
|
9085
|
-
} =
|
|
9335
|
+
} = _ref8;
|
|
9086
9336
|
const {
|
|
9087
9337
|
field
|
|
9088
9338
|
} = useController({
|
|
@@ -9104,13 +9354,13 @@ function RHFControlledCheckbox(_ref6) {
|
|
|
9104
9354
|
})
|
|
9105
9355
|
});
|
|
9106
9356
|
}
|
|
9107
|
-
function RHFControlledRadioGroup(
|
|
9357
|
+
function RHFControlledRadioGroup(_ref9) {
|
|
9108
9358
|
let {
|
|
9109
9359
|
name,
|
|
9110
9360
|
control,
|
|
9111
9361
|
rules,
|
|
9112
9362
|
...restProps
|
|
9113
|
-
} =
|
|
9363
|
+
} = _ref9;
|
|
9114
9364
|
const {
|
|
9115
9365
|
field
|
|
9116
9366
|
} = useController({
|
|
@@ -9128,6 +9378,8 @@ const RHFControlledComponents = {
|
|
|
9128
9378
|
Password: RHFControlledPasswordInput,
|
|
9129
9379
|
TextArea: RHFControlledTextArea,
|
|
9130
9380
|
Select: RHFControlledSelect,
|
|
9381
|
+
SelectV2: RHFControlledSelectV2,
|
|
9382
|
+
DialogCombobox: RHFControlledDialogCombobox,
|
|
9131
9383
|
Checkbox: RHFControlledCheckbox,
|
|
9132
9384
|
CheckboxGroup: RHFControlledCheckboxGroup,
|
|
9133
9385
|
RadioGroup: RHFControlledRadioGroup
|
|
@@ -12982,5 +13234,5 @@ const Tree = /*#__PURE__*/forwardRef(function Tree(_ref, ref) {
|
|
|
12982
13234
|
});
|
|
12983
13235
|
});
|
|
12984
13236
|
|
|
12985
|
-
export { Accordion, AccordionPanel, Alert, AlignCenterIcon, AlignLeftIcon, AlignRightIcon, AppIcon, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon, ArrowsUpDownIcon, AutoComplete, BarChartIcon, BeakerIcon, BinaryIcon, BoldIcon, BookIcon, BookmarkFillIcon, BookmarkIcon, BooksIcon, BracketsCurlyIcon, BracketsSquareIcon, BracketsXIcon, BranchIcon, Breadcrumb, BriefcaseFillIcon, BriefcaseIcon, CalendarEventIcon, CalendarIcon, CaretDownSquareIcon, CaretUpSquareIcon, CatalogIcon, ChartLineIcon, CheckCircleBadgeIcon, CheckCircleFillIcon, CheckCircleIcon,
|
|
13237
|
+
export { Accordion, AccordionPanel, Alert, AlignCenterIcon, AlignLeftIcon, AlignRightIcon, AppIcon, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon, ArrowsUpDownIcon, AutoComplete, BarChartIcon, BeakerIcon, BinaryIcon, BoldIcon, BookIcon, BookmarkFillIcon, BookmarkIcon, BooksIcon, BracketsCurlyIcon, BracketsSquareIcon, BracketsXIcon, BranchIcon, Breadcrumb, BriefcaseFillIcon, BriefcaseIcon, CalendarEventIcon, CalendarIcon, CaretDownSquareIcon, CaretUpSquareIcon, CatalogIcon, ChartLineIcon, CheckCircleBadgeIcon, CheckCircleFillIcon, CheckCircleIcon, CheckLineIcon, Checkbox, ChecklistIcon, ChevronDoubleDownIcon, ChevronDoubleLeftIcon, ChevronDoubleRightIcon, ChevronDoubleUpIcon, ChevronDownIcon, ChevronUpIcon, CircleIcon, ClipboardIcon, ClockIcon, CloudDownloadIcon, CloudIcon, CloudKeyIcon, CloudModelIcon, CloudOffIcon, CloudUploadIcon, CodeIcon, Col, ColorFillIcon, ColumnIcon, ConnectIcon, Content, CopyIcon, CursorPagination, CursorTypeIcon, DIcon, DagIcon, DangerFillIcon, DangerIcon, DangerModal, DashIcon, DashboardIcon, DataIcon, DatabaseIcon, DecimalIcon, DialogCombobox, DialogComboboxButtonContainer, DialogComboboxContent, DialogComboboxCountBadge, DialogComboboxLoadingSpinner, DialogComboboxOptionControlledList, DialogComboboxOptionList, DialogComboboxOptionListCheckboxItem, DialogComboboxOptionListSearch, DialogComboboxOptionListSelectItem, DialogComboboxSectionHeader, DialogComboboxSeparator, DialogComboboxTrigger, DotsCircleIcon, DownloadIcon, DragIcon, Drawer, Dropdown, DropdownMenu, DuboisDatePicker, Empty, ExpandLessIcon, ExpandMoreIcon, FileCodeIcon, FileDocumentIcon, FileIcon, FileImageIcon, FileModelIcon, FilterIcon, FolderBranchIcon, FolderFillIcon, FolderIcon, FontIcon, ForkIcon, Form, FormDubois, FormUI, FullscreenExitIcon, FullscreenIcon, FunctionIcon, GearFillIcon, GearIcon, GiftIcon, GitCommitIcon, GlobeIcon, GridDashIcon, GridIcon, H1Icon, H2Icon, H3Icon, Header$1 as Header, HistoryIcon, HomeIcon, ImageIcon, IndentDecreaseIcon, IndentIncreaseIcon, InfinityIcon, InfoFillIcon, InfoIcon, ItalicIcon, KeyIcon, KeyboardIcon, LayerIcon, Layout, LegacyDatePicker, LegacyPopover, LegacyTable, LettersIcon, LightningIcon, LinkIcon, LinkOffIcon, ListBorderIcon, ListIcon, LoadingIcon, LockFillIcon, LockIcon, LockUnlockedIcon, MIcon, Menu, MenuIcon, MinusBoxIcon, MinusCircleFillIcon, MinusCircleIcon, Modal, ModelsIcon, Nav, NavButton, NoIcon, NotebookIcon, Notification, NotificationIcon, NotificationOffIcon, NumbersIcon, OfficeIcon, OptGroup, Option, OverflowIcon, PageBottomIcon, PageFirstIcon, PageLastIcon, PageTopIcon, PageWrapper, Pagination, Panel, PanelBody, PanelHeader, PanelHeaderButtons, PanelHeaderTitle, PencilIcon, PinCancelIcon, PinFillIcon, PinIcon, PipelineIcon, PlayCircleFillIcon, PlayCircleIcon, PlayIcon, PlugIcon, PlusCircleFillIcon, PlusCircleIcon, PlusIcon, PlusSquareIcon, Popover, QueryEditorIcon, QueryIcon, QuestionMarkFillIcon, QuestionMarkIcon, RHFControlledComponents, ROW_GUTTER_SIZE, Radio, ReaderModeIcon, RedoIcon, RefreshIcon, Row, SaveIcon, SchoolIcon, SearchIcon, SecurityIcon, SegmentedControlButton, SegmentedControlGroup, Select, SelectOptGroup, SelectOption, SelectV2, SelectV2Content, SelectV2Option, SelectV2OptionGroup, SelectV2Trigger, ShareIcon, Sidebar, SidebarAutoIcon, SidebarCollapseIcon, SidebarExpandIcon, SidebarIcon, Skeleton, SlidersIcon, SortAscendingIcon, SortDescendingIcon, SortUnsortedIcon, Space, Spacer, SpeechBubbleIcon, SpeechBubblePlusIcon, Spinner, SplitButton, StarFillIcon, StarIcon, StopCircleFillIcon, StopCircleIcon, StopIcon, StorefrontIcon, StreamIcon, Switch, SyncIcon, TabPane, Table, TableCell, TableContext, TableFilterInput, TableFilterLayout, TableHeader, TableIcon, TableInfinityIcon, TableLightningIcon, TableRow, TableRowAction, TableRowContext, TableRowMenuContainer, TableRowSelectCell, TableSkeleton, TableSkeletonRows, TableViewIcon, Tabs, Tag, TextBoxIcon, ThumbsDownIcon, ThumbsUpIcon, ToggleButton, Tooltip, TrashIcon, Tree, TreeIcon, UnderlineIcon, UndoIcon, UploadIcon, UsbIcon, UserBadgeIcon, UserCircleIcon, UserGroupIcon, UserIcon, VisibleIcon, VisibleOffIcon, WarningFillIcon, WarningIcon, WorkspacesIcon, XCircleFillIcon, XCircleIcon, ZoomInIcon, ZoomOutIcon, __INTERNAL_DO_NOT_USE__FormItem, __INTERNAL_DO_NOT_USE__Group, __INTERNAL_DO_NOT_USE__HorizontalGroup, __INTERNAL_DO_NOT_USE__VerticalGroup, getPaginationEmotionStyles, getRadioStyles, getTabEmotionStyles, getWrapperStyle, useLegacyNotification, useThemedStyles, visuallyHidden, withNotifications };
|
|
12986
13238
|
//# sourceMappingURL=index.js.map
|