@transferwise/components 0.0.0-experimental-e95c8a5 → 0.0.0-experimental-39ab3ec
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/build/index.esm.js +65 -688
- package/build/index.esm.js.map +1 -1
- package/build/index.js +65 -691
- package/build/index.js.map +1 -1
- package/build/main.css +1 -1
- package/build/styles/common/closeButton/CloseButton.css +1 -1
- package/build/styles/inputs/Input.css +1 -1
- package/build/styles/inputs/InputGroup.css +1 -1
- package/build/styles/inputs/TextArea.css +1 -1
- package/build/styles/main.css +1 -1
- package/build/styles/promoCard/PromoCard.css +1 -1
- package/build/types/common/card/index.d.ts +1 -0
- package/build/types/common/card/index.d.ts.map +1 -1
- package/build/types/dateLookup/dateTrigger/DateTrigger.messages.d.ts +7 -7
- package/build/types/dateLookup/dateTrigger/DateTrigger.messages.d.ts.map +1 -1
- package/build/types/index.d.ts +0 -4
- package/build/types/index.d.ts.map +1 -1
- package/build/types/inputs/Input.d.ts +0 -1
- package/build/types/inputs/Input.d.ts.map +1 -1
- package/build/types/inputs/_common.d.ts.map +1 -1
- package/build/types/promoCard/PromoCard.d.ts +9 -3
- package/build/types/promoCard/PromoCard.d.ts.map +1 -1
- package/build/types/promoCard/PromoCardIndicator.d.ts +5 -3
- package/build/types/promoCard/PromoCardIndicator.d.ts.map +1 -1
- package/package.json +22 -28
- package/src/avatar/Avatar.story.tsx +16 -14
- package/src/common/card/Card.tsx +1 -1
- package/src/common/card/index.ts +1 -0
- package/src/common/closeButton/CloseButton.css +1 -1
- package/src/index.ts +0 -8
- package/src/inputs/Input.css +1 -1
- package/src/inputs/Input.less +0 -14
- package/src/inputs/Input.tsx +2 -6
- package/src/inputs/InputGroup.css +1 -1
- package/src/inputs/InputGroup.less +0 -5
- package/src/inputs/TextArea.css +1 -1
- package/src/inputs/TextArea.less +0 -5
- package/src/inputs/_common.less +4 -0
- package/src/inputs/_common.ts +1 -0
- package/src/main.css +1 -1
- package/src/main.less +0 -4
- package/src/navigationOption/NavigationOption.story.js +3 -5
- package/src/promoCard/PromoCard.css +1 -1
- package/src/promoCard/PromoCard.less +9 -9
- package/src/promoCard/PromoCard.spec.tsx +1 -0
- package/src/promoCard/PromoCard.story.tsx +86 -29
- package/src/promoCard/PromoCard.tsx +69 -22
- package/src/promoCard/PromoCardIndicator.tsx +20 -8
- package/src/radio/Radio.story.js +3 -2
- package/src/radioGroup/RadioGroup.story.js +2 -1
- package/src/select/searchBox/__snapshots__/SearchBox.spec.js.snap +1 -1
- package/src/ssr.spec.js +0 -7
- package/build/styles/inputs/SelectInput.css +0 -1
- package/build/types/common/hooks/useMedia.d.ts +0 -2
- package/build/types/common/hooks/useMedia.d.ts.map +0 -1
- package/build/types/common/hooks/useScreenSize.d.ts +0 -3
- package/build/types/common/hooks/useScreenSize.d.ts.map +0 -1
- package/build/types/common/preventScroll/PreventScroll.d.ts +0 -2
- package/build/types/common/preventScroll/PreventScroll.d.ts.map +0 -1
- package/build/types/inputs/SearchInput.d.ts +0 -10
- package/build/types/inputs/SearchInput.d.ts.map +0 -1
- package/build/types/inputs/SelectInput.d.ts +0 -41
- package/build/types/inputs/SelectInput.d.ts.map +0 -1
- package/build/types/inputs/_BottomSheet.d.ts +0 -17
- package/build/types/inputs/_BottomSheet.d.ts.map +0 -1
- package/build/types/inputs/_ButtonInput.d.ts +0 -6
- package/build/types/inputs/_ButtonInput.d.ts.map +0 -1
- package/build/types/inputs/_Popover.d.ts +0 -18
- package/build/types/inputs/_Popover.d.ts.map +0 -1
- package/build/types/utilities/wrapInFragment.d.ts +0 -3
- package/build/types/utilities/wrapInFragment.d.ts.map +0 -1
- package/src/common/hooks/useMedia.spec.ts +0 -39
- package/src/common/hooks/useMedia.ts +0 -15
- package/src/common/hooks/useScreenSize.ts +0 -7
- package/src/common/preventScroll/PreventScroll.tsx +0 -6
- package/src/inputs/SearchInput.story.tsx +0 -40
- package/src/inputs/SearchInput.tsx +0 -35
- package/src/inputs/SelectInput.css +0 -1
- package/src/inputs/SelectInput.less +0 -183
- package/src/inputs/SelectInput.spec.tsx +0 -120
- package/src/inputs/SelectInput.story.tsx +0 -259
- package/src/inputs/SelectInput.tsx +0 -565
- package/src/inputs/_BottomSheet.less +0 -107
- package/src/inputs/_BottomSheet.tsx +0 -128
- package/src/inputs/_ButtonInput.less +0 -7
- package/src/inputs/_ButtonInput.tsx +0 -27
- package/src/inputs/_Popover.less +0 -38
- package/src/inputs/_Popover.tsx +0 -118
- package/src/utilities/wrapInFragment.tsx +0 -3
- /package/src/dateLookup/dateTrigger/{DateTrigger.messages.ts → DateTrigger.messages.js} +0 -0
package/build/index.js
CHANGED
|
@@ -14,11 +14,6 @@ var reactDom = require('react-dom');
|
|
|
14
14
|
var neptuneValidation = require('@transferwise/neptune-validation');
|
|
15
15
|
var mergeRefs = require('react-merge-refs');
|
|
16
16
|
var reactPopper = require('react-popper');
|
|
17
|
-
var react$1 = require('@headlessui/react');
|
|
18
|
-
var reactId = require('@radix-ui/react-id');
|
|
19
|
-
var shim = require('use-sync-external-store/shim');
|
|
20
|
-
var react = require('@floating-ui/react');
|
|
21
|
-
var overlays = require('@react-aria/overlays');
|
|
22
17
|
var art = require('@wise/art');
|
|
23
18
|
var clamp$2 = require('lodash.clamp');
|
|
24
19
|
var debounce = require('lodash.debounce');
|
|
@@ -2007,7 +2002,7 @@ const MOVE_OFFSET_THRESHOLD = 50;
|
|
|
2007
2002
|
* Neptune Web: https://transferwise.github.io/neptune-web/components/overlays/BottomSheet
|
|
2008
2003
|
*
|
|
2009
2004
|
*/
|
|
2010
|
-
const BottomSheet
|
|
2005
|
+
const BottomSheet = props => {
|
|
2011
2006
|
const bottomSheetReference = React.useRef(null);
|
|
2012
2007
|
const topBarReference = React.useRef(null);
|
|
2013
2008
|
const contentReference = React.useRef(null);
|
|
@@ -2161,7 +2156,7 @@ const BottomSheet$1 = props => {
|
|
|
2161
2156
|
})
|
|
2162
2157
|
});
|
|
2163
2158
|
};
|
|
2164
|
-
var BottomSheet$
|
|
2159
|
+
var BottomSheet$1 = BottomSheet;
|
|
2165
2160
|
|
|
2166
2161
|
const typeClassMap$1 = {
|
|
2167
2162
|
[exports.ControlType.ACCENT]: 'btn-accent',
|
|
@@ -2355,7 +2350,7 @@ var Card$2 = Card$1;
|
|
|
2355
2350
|
|
|
2356
2351
|
const Card = ({
|
|
2357
2352
|
className,
|
|
2358
|
-
children,
|
|
2353
|
+
children = null,
|
|
2359
2354
|
id,
|
|
2360
2355
|
isDisabled = false,
|
|
2361
2356
|
isSmall = false,
|
|
@@ -3188,7 +3183,7 @@ const ResponsivePanel = /*#__PURE__*/React.forwardRef(({
|
|
|
3188
3183
|
isMobile
|
|
3189
3184
|
} = useLayout();
|
|
3190
3185
|
if (isMobile) {
|
|
3191
|
-
return /*#__PURE__*/jsxRuntime.jsx(BottomSheet$
|
|
3186
|
+
return /*#__PURE__*/jsxRuntime.jsx(BottomSheet$1, {
|
|
3192
3187
|
open: open,
|
|
3193
3188
|
className: className,
|
|
3194
3189
|
onClose: onClose,
|
|
@@ -5866,7 +5861,7 @@ const Modal = ({
|
|
|
5866
5861
|
});
|
|
5867
5862
|
};
|
|
5868
5863
|
|
|
5869
|
-
const Popover
|
|
5864
|
+
const Popover = ({
|
|
5870
5865
|
children,
|
|
5871
5866
|
className,
|
|
5872
5867
|
content,
|
|
@@ -5920,12 +5915,12 @@ const logActionRequired = ({
|
|
|
5920
5915
|
}) => {
|
|
5921
5916
|
logActionRequiredIf(`Popover has deprecated ${preferredPlacement} value for the 'preferredPlacement' prop. Please use ${deprecatedPlacements[preferredPlacement]} instead.`, deprecatedPlacements[preferredPlacement]);
|
|
5922
5917
|
};
|
|
5923
|
-
Popover
|
|
5918
|
+
Popover.defaultProps = {
|
|
5924
5919
|
className: undefined,
|
|
5925
5920
|
preferredPlacement: exports.Position.RIGHT,
|
|
5926
5921
|
title: undefined
|
|
5927
5922
|
};
|
|
5928
|
-
Popover
|
|
5923
|
+
Popover.propTypes = {
|
|
5929
5924
|
children: PropTypes__default.default.node.isRequired,
|
|
5930
5925
|
className: PropTypes__default.default.string,
|
|
5931
5926
|
content: PropTypes__default.default.node.isRequired,
|
|
@@ -5942,7 +5937,7 @@ const deprecatedPlacements = {
|
|
|
5942
5937
|
[exports.Position.LEFT_TOP]: exports.Position.TOP,
|
|
5943
5938
|
[exports.Position.RIGHT_TOP]: exports.Position.TOP
|
|
5944
5939
|
};
|
|
5945
|
-
var Popover$
|
|
5940
|
+
var Popover$1 = Popover;
|
|
5946
5941
|
|
|
5947
5942
|
const Info = ({
|
|
5948
5943
|
className = undefined,
|
|
@@ -5984,7 +5979,7 @@ const Info = ({
|
|
|
5984
5979
|
title: title,
|
|
5985
5980
|
onClose: () => setOpen(false)
|
|
5986
5981
|
})]
|
|
5987
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(Popover$
|
|
5982
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(Popover$1, {
|
|
5988
5983
|
content: content,
|
|
5989
5984
|
preferredPlacement: exports.Position.BOTTOM,
|
|
5990
5985
|
title: title,
|
|
@@ -6173,12 +6168,11 @@ function formControlClassNameBase({
|
|
|
6173
6168
|
'np-form-control--size-sm np-text-body-default': size === 'sm',
|
|
6174
6169
|
'np-form-control--size-md np-text-body-large': size === 'md',
|
|
6175
6170
|
'np-form-control--size-lg np-text-title-subsection': size === 'lg'
|
|
6176
|
-
});
|
|
6171
|
+
}, 'np-form-control--shape-rectangle');
|
|
6177
6172
|
}
|
|
6178
6173
|
|
|
6179
6174
|
const Input = /*#__PURE__*/React.forwardRef(function Input({
|
|
6180
6175
|
size = 'auto',
|
|
6181
|
-
shape = 'rectangle',
|
|
6182
6176
|
className,
|
|
6183
6177
|
...restProps
|
|
6184
6178
|
}, reference) {
|
|
@@ -6187,10 +6181,7 @@ const Input = /*#__PURE__*/React.forwardRef(function Input({
|
|
|
6187
6181
|
ref: reference,
|
|
6188
6182
|
className: classNames__default.default(className, formControlClassNameBase({
|
|
6189
6183
|
size
|
|
6190
|
-
})
|
|
6191
|
-
'np-input--shape-rectangle': shape === 'rectangle',
|
|
6192
|
-
'np-input--shape-pill': shape === 'pill'
|
|
6193
|
-
})
|
|
6184
|
+
}))
|
|
6194
6185
|
// eslint-disable-next-line react/forbid-dom-props
|
|
6195
6186
|
,
|
|
6196
6187
|
style: inputPaddings,
|
|
@@ -6198,653 +6189,6 @@ const Input = /*#__PURE__*/React.forwardRef(function Input({
|
|
|
6198
6189
|
});
|
|
6199
6190
|
});
|
|
6200
6191
|
|
|
6201
|
-
const SearchInput = /*#__PURE__*/React.forwardRef(function SearchInput({
|
|
6202
|
-
shape = 'pill',
|
|
6203
|
-
disabled,
|
|
6204
|
-
className,
|
|
6205
|
-
...restProps
|
|
6206
|
-
}, ref) {
|
|
6207
|
-
return /*#__PURE__*/jsxRuntime.jsx(InputGroup, {
|
|
6208
|
-
addonStart: {
|
|
6209
|
-
content: /*#__PURE__*/jsxRuntime.jsx(icons.Search, {
|
|
6210
|
-
size: 24
|
|
6211
|
-
}),
|
|
6212
|
-
initialContentWidth: 24
|
|
6213
|
-
},
|
|
6214
|
-
disabled: disabled,
|
|
6215
|
-
className: className,
|
|
6216
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Input, {
|
|
6217
|
-
ref: ref,
|
|
6218
|
-
role: "searchbox",
|
|
6219
|
-
inputMode: "search",
|
|
6220
|
-
shape: shape,
|
|
6221
|
-
...restProps
|
|
6222
|
-
})
|
|
6223
|
-
});
|
|
6224
|
-
});
|
|
6225
|
-
|
|
6226
|
-
function useMedia(query) {
|
|
6227
|
-
return shim.useSyncExternalStore(onStoreChange => {
|
|
6228
|
-
const mediaQueryList = window.matchMedia(query);
|
|
6229
|
-
mediaQueryList.addEventListener('change', onStoreChange);
|
|
6230
|
-
return () => {
|
|
6231
|
-
mediaQueryList.removeEventListener('change', onStoreChange);
|
|
6232
|
-
};
|
|
6233
|
-
}, () => typeof window !== 'undefined' ? window.matchMedia(query).matches : undefined, () => undefined);
|
|
6234
|
-
}
|
|
6235
|
-
|
|
6236
|
-
function useScreenSize(size) {
|
|
6237
|
-
return useMedia(`(min-width: ${size}px)`);
|
|
6238
|
-
}
|
|
6239
|
-
|
|
6240
|
-
function wrapInFragment(value) {
|
|
6241
|
-
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
6242
|
-
children: value
|
|
6243
|
-
});
|
|
6244
|
-
}
|
|
6245
|
-
|
|
6246
|
-
function PreventScroll() {
|
|
6247
|
-
overlays.usePreventScroll();
|
|
6248
|
-
return null;
|
|
6249
|
-
}
|
|
6250
|
-
|
|
6251
|
-
function BottomSheet({
|
|
6252
|
-
open,
|
|
6253
|
-
renderTrigger,
|
|
6254
|
-
title,
|
|
6255
|
-
initialFocusRef,
|
|
6256
|
-
padding = 'md',
|
|
6257
|
-
children,
|
|
6258
|
-
onClose
|
|
6259
|
-
}) {
|
|
6260
|
-
const {
|
|
6261
|
-
refs,
|
|
6262
|
-
context
|
|
6263
|
-
} = react.useFloating({
|
|
6264
|
-
open,
|
|
6265
|
-
onOpenChange: value => {
|
|
6266
|
-
if (!value) {
|
|
6267
|
-
onClose?.();
|
|
6268
|
-
}
|
|
6269
|
-
}
|
|
6270
|
-
});
|
|
6271
|
-
const dismiss = react.useDismiss(context, {
|
|
6272
|
-
outsidePressEvent: 'mousedown'
|
|
6273
|
-
});
|
|
6274
|
-
const role = react.useRole(context);
|
|
6275
|
-
const {
|
|
6276
|
-
getReferenceProps,
|
|
6277
|
-
getFloatingProps
|
|
6278
|
-
} = react.useInteractions([dismiss, role]);
|
|
6279
|
-
const [floatingKey, setFloatingKey] = React.useState(0);
|
|
6280
|
-
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
6281
|
-
children: [open ? /*#__PURE__*/jsxRuntime.jsx(PreventScroll, {}) : null, renderTrigger?.({
|
|
6282
|
-
ref: refs.setReference,
|
|
6283
|
-
getInteractionProps: getReferenceProps
|
|
6284
|
-
}), /*#__PURE__*/jsxRuntime.jsx(react.FloatingPortal, {
|
|
6285
|
-
children: /*#__PURE__*/jsxRuntime.jsxs(react$1.Transition, {
|
|
6286
|
-
show: open,
|
|
6287
|
-
className: "np-bottom-sheet-v2-container",
|
|
6288
|
-
beforeEnter: () => {
|
|
6289
|
-
setFloatingKey(prev => prev + 1);
|
|
6290
|
-
},
|
|
6291
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(react$1.Transition.Child, {
|
|
6292
|
-
enter: "np-bottom-sheet-v2-backdrop-container--enter",
|
|
6293
|
-
enterFrom: "np-bottom-sheet-v2-backdrop-container--enter-from",
|
|
6294
|
-
leave: "np-bottom-sheet-v2-backdrop-container--leave",
|
|
6295
|
-
leaveTo: "np-bottom-sheet-v2-backdrop-container--leave-to",
|
|
6296
|
-
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6297
|
-
className: "np-bottom-sheet-v2-backdrop"
|
|
6298
|
-
})
|
|
6299
|
-
}), /*#__PURE__*/jsxRuntime.jsx(react.FloatingFocusManager, {
|
|
6300
|
-
context: context,
|
|
6301
|
-
initialFocus: initialFocusRef,
|
|
6302
|
-
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6303
|
-
className: "np-bottom-sheet-v2",
|
|
6304
|
-
children: /*#__PURE__*/jsxRuntime.jsx(react$1.Transition.Child, {
|
|
6305
|
-
className: "np-bottom-sheet-v2-content",
|
|
6306
|
-
enter: "np-bottom-sheet-v2-content--enter",
|
|
6307
|
-
enterFrom: "np-bottom-sheet-v2-content--enter-from",
|
|
6308
|
-
leave: "np-bottom-sheet-v2-content--leave",
|
|
6309
|
-
leaveTo: "np-bottom-sheet-v2-content--leave-to",
|
|
6310
|
-
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
6311
|
-
// Force inner state invalidation on open
|
|
6312
|
-
ref: refs.setFloating,
|
|
6313
|
-
className: "np-bottom-sheet-v2-content-inner-container",
|
|
6314
|
-
...getFloatingProps(),
|
|
6315
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6316
|
-
className: "np-bottom-sheet-v2-header",
|
|
6317
|
-
children: /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
|
|
6318
|
-
size: exports.Size.SMALL,
|
|
6319
|
-
onClick: () => {
|
|
6320
|
-
onClose?.();
|
|
6321
|
-
}
|
|
6322
|
-
})
|
|
6323
|
-
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
6324
|
-
className: classNames__default.default('np-bottom-sheet-v2-content-inner', title && 'np-bottom-sheet-v2-content-inner--has-title', {
|
|
6325
|
-
'np-bottom-sheet-v2-content-inner--padding-md': padding === 'md'
|
|
6326
|
-
}),
|
|
6327
|
-
children: [title ? /*#__PURE__*/jsxRuntime.jsx("h2", {
|
|
6328
|
-
className: "np-bottom-sheet-v2-title np-text-title-body",
|
|
6329
|
-
children: title
|
|
6330
|
-
}) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6331
|
-
className: "np-bottom-sheet-v2-body np-text-body-default",
|
|
6332
|
-
children: children
|
|
6333
|
-
})]
|
|
6334
|
-
})]
|
|
6335
|
-
}, floatingKey)
|
|
6336
|
-
})
|
|
6337
|
-
})
|
|
6338
|
-
})]
|
|
6339
|
-
})
|
|
6340
|
-
})]
|
|
6341
|
-
});
|
|
6342
|
-
}
|
|
6343
|
-
|
|
6344
|
-
const ButtonInput = /*#__PURE__*/React.forwardRef(function ButtonInput({
|
|
6345
|
-
size = 'md',
|
|
6346
|
-
className,
|
|
6347
|
-
style,
|
|
6348
|
-
...restProps
|
|
6349
|
-
}, ref) {
|
|
6350
|
-
const inputPaddings = useInputPaddings();
|
|
6351
|
-
return /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
6352
|
-
ref: ref,
|
|
6353
|
-
type: "button",
|
|
6354
|
-
className: classNames__default.default(className, formControlClassNameBase({
|
|
6355
|
-
size
|
|
6356
|
-
}), 'np-button-input')
|
|
6357
|
-
// eslint-disable-next-line react/forbid-dom-props
|
|
6358
|
-
,
|
|
6359
|
-
style: {
|
|
6360
|
-
...inputPaddings,
|
|
6361
|
-
...style
|
|
6362
|
-
},
|
|
6363
|
-
...restProps
|
|
6364
|
-
});
|
|
6365
|
-
});
|
|
6366
|
-
|
|
6367
|
-
const floatingPadding = 16;
|
|
6368
|
-
function Popover({
|
|
6369
|
-
placement,
|
|
6370
|
-
open,
|
|
6371
|
-
renderTrigger,
|
|
6372
|
-
title,
|
|
6373
|
-
padding = 'md',
|
|
6374
|
-
children,
|
|
6375
|
-
onClose
|
|
6376
|
-
}) {
|
|
6377
|
-
const {
|
|
6378
|
-
refs,
|
|
6379
|
-
floatingStyles,
|
|
6380
|
-
context
|
|
6381
|
-
} = react.useFloating({
|
|
6382
|
-
placement,
|
|
6383
|
-
middleware: [react.offset(8), react.flip({
|
|
6384
|
-
padding: floatingPadding,
|
|
6385
|
-
crossAxis: false
|
|
6386
|
-
}), react.shift(), react.size({
|
|
6387
|
-
padding: floatingPadding,
|
|
6388
|
-
apply: ({
|
|
6389
|
-
elements,
|
|
6390
|
-
rects,
|
|
6391
|
-
availableHeight
|
|
6392
|
-
}) => {
|
|
6393
|
-
elements.floating.style.setProperty('--max-height', `${availableHeight}px`);
|
|
6394
|
-
elements.floating.style.setProperty('--width', `${rects.reference.width}px`);
|
|
6395
|
-
}
|
|
6396
|
-
})],
|
|
6397
|
-
whileElementsMounted: react.autoUpdate,
|
|
6398
|
-
open,
|
|
6399
|
-
onOpenChange: value => {
|
|
6400
|
-
if (!value) {
|
|
6401
|
-
onClose?.();
|
|
6402
|
-
}
|
|
6403
|
-
}
|
|
6404
|
-
});
|
|
6405
|
-
const dismiss = react.useDismiss(context, {
|
|
6406
|
-
outsidePressEvent: 'mousedown'
|
|
6407
|
-
});
|
|
6408
|
-
const role = react.useRole(context);
|
|
6409
|
-
const {
|
|
6410
|
-
getReferenceProps,
|
|
6411
|
-
getFloatingProps
|
|
6412
|
-
} = react.useInteractions([role, dismiss]);
|
|
6413
|
-
const [floatingKey, setFloatingKey] = React.useState(0);
|
|
6414
|
-
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
6415
|
-
children: [open ? /*#__PURE__*/jsxRuntime.jsx(PreventScroll, {}) : null, renderTrigger({
|
|
6416
|
-
ref: refs.setReference,
|
|
6417
|
-
getInteractionProps: getReferenceProps
|
|
6418
|
-
}), /*#__PURE__*/jsxRuntime.jsx(react.FloatingPortal, {
|
|
6419
|
-
children: /*#__PURE__*/jsxRuntime.jsx(react.FloatingFocusManager, {
|
|
6420
|
-
context: context,
|
|
6421
|
-
children: /*#__PURE__*/jsxRuntime.jsx(react$1.Transition, {
|
|
6422
|
-
show: open,
|
|
6423
|
-
leave: "transition-opacity",
|
|
6424
|
-
leaveTo: "opacity-0",
|
|
6425
|
-
beforeEnter: () => {
|
|
6426
|
-
setFloatingKey(prev => prev + 1);
|
|
6427
|
-
},
|
|
6428
|
-
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6429
|
-
// Force inner state invalidation on open
|
|
6430
|
-
ref: refs.setFloating,
|
|
6431
|
-
className: "np-popover-v2-container"
|
|
6432
|
-
// eslint-disable-next-line react/forbid-dom-props
|
|
6433
|
-
,
|
|
6434
|
-
style: floatingStyles,
|
|
6435
|
-
...getFloatingProps(),
|
|
6436
|
-
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
6437
|
-
className: classNames__default.default('np-popover-v2', title && 'np-popover-v2--has-title', {
|
|
6438
|
-
'np-popover-v2--padding-md': padding === 'md'
|
|
6439
|
-
}),
|
|
6440
|
-
children: [title ? /*#__PURE__*/jsxRuntime.jsx("h2", {
|
|
6441
|
-
className: "np-popover-v2-title np-text-title-body",
|
|
6442
|
-
children: title
|
|
6443
|
-
}) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6444
|
-
className: "np-popover-v2-content np-text-body-default",
|
|
6445
|
-
children: children
|
|
6446
|
-
})]
|
|
6447
|
-
})
|
|
6448
|
-
}, floatingKey)
|
|
6449
|
-
})
|
|
6450
|
-
})
|
|
6451
|
-
})]
|
|
6452
|
-
});
|
|
6453
|
-
}
|
|
6454
|
-
|
|
6455
|
-
function searchableString(value) {
|
|
6456
|
-
return value.trim().replace(/\s+/gu, ' ').toLowerCase();
|
|
6457
|
-
}
|
|
6458
|
-
function inferSearchableStrings(value) {
|
|
6459
|
-
if (typeof value === 'string') {
|
|
6460
|
-
return [searchableString(value)];
|
|
6461
|
-
}
|
|
6462
|
-
if (typeof value === 'object' && value != null) {
|
|
6463
|
-
return Object.values(value).filter(innerValue => typeof innerValue === 'string').map(innerValue => searchableString(innerValue));
|
|
6464
|
-
}
|
|
6465
|
-
return [];
|
|
6466
|
-
}
|
|
6467
|
-
const SelectInputHasValueContext = /*#__PURE__*/React.createContext(false);
|
|
6468
|
-
const SelectInputOptionContentCompactContext = /*#__PURE__*/React.createContext(false);
|
|
6469
|
-
function dedupeSelectInputOptionItem(item, existingValues) {
|
|
6470
|
-
if (existingValues.has(item.value)) {
|
|
6471
|
-
return {
|
|
6472
|
-
...item,
|
|
6473
|
-
value: undefined
|
|
6474
|
-
};
|
|
6475
|
-
}
|
|
6476
|
-
existingValues.add(item.value);
|
|
6477
|
-
return item;
|
|
6478
|
-
}
|
|
6479
|
-
function dedupeSelectInputItems(items) {
|
|
6480
|
-
const existingValues = new Set();
|
|
6481
|
-
return items.map(item => {
|
|
6482
|
-
switch (item.type) {
|
|
6483
|
-
case 'option':
|
|
6484
|
-
{
|
|
6485
|
-
return dedupeSelectInputOptionItem(item, existingValues);
|
|
6486
|
-
}
|
|
6487
|
-
case 'group':
|
|
6488
|
-
{
|
|
6489
|
-
return {
|
|
6490
|
-
...item,
|
|
6491
|
-
options: item.options.map(option => dedupeSelectInputOptionItem(option, existingValues))
|
|
6492
|
-
};
|
|
6493
|
-
}
|
|
6494
|
-
}
|
|
6495
|
-
return item;
|
|
6496
|
-
});
|
|
6497
|
-
}
|
|
6498
|
-
function SelectInput({
|
|
6499
|
-
name,
|
|
6500
|
-
placeholder,
|
|
6501
|
-
items,
|
|
6502
|
-
defaultValue,
|
|
6503
|
-
value: controlledValue,
|
|
6504
|
-
renderValue = wrapInFragment,
|
|
6505
|
-
compareValues,
|
|
6506
|
-
filterable,
|
|
6507
|
-
filterPlaceholder,
|
|
6508
|
-
disabled,
|
|
6509
|
-
className,
|
|
6510
|
-
onChange,
|
|
6511
|
-
onClear
|
|
6512
|
-
}) {
|
|
6513
|
-
const intl = reactIntl.useIntl();
|
|
6514
|
-
const [open, setOpen] = React.useState(false);
|
|
6515
|
-
const triggerRef = React.useRef(null);
|
|
6516
|
-
const screenSm = useScreenSize(exports.Breakpoint.SMALL);
|
|
6517
|
-
const OptionsOverlay = screenSm ? Popover : BottomSheet;
|
|
6518
|
-
const searchInputRef = React.useRef(null);
|
|
6519
|
-
const listboxRef = React.useRef(null);
|
|
6520
|
-
const controllerRef = filterable ? searchInputRef : listboxRef;
|
|
6521
|
-
return /*#__PURE__*/jsxRuntime.jsx(react$1.Listbox, {
|
|
6522
|
-
name: name,
|
|
6523
|
-
defaultValue: defaultValue,
|
|
6524
|
-
value: controlledValue
|
|
6525
|
-
// TODO: Remove assertion when upgrading TypeScript to v5
|
|
6526
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
6527
|
-
,
|
|
6528
|
-
by: compareValues,
|
|
6529
|
-
disabled: disabled,
|
|
6530
|
-
onChange: value => {
|
|
6531
|
-
setOpen(false);
|
|
6532
|
-
onChange?.(value);
|
|
6533
|
-
},
|
|
6534
|
-
children: ({
|
|
6535
|
-
disabled: uiDisabled,
|
|
6536
|
-
value
|
|
6537
|
-
}) => /*#__PURE__*/jsxRuntime.jsx(SelectInputHasValueContext.Provider, {
|
|
6538
|
-
value: value != null,
|
|
6539
|
-
children: /*#__PURE__*/jsxRuntime.jsx(InputGroup, {
|
|
6540
|
-
addonEnd: {
|
|
6541
|
-
content: /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
6542
|
-
className: classNames__default.default('np-select-input-addon-container', uiDisabled && 'disabled'),
|
|
6543
|
-
children: [onClear != null && value != null ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
6544
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("button", {
|
|
6545
|
-
type: "button",
|
|
6546
|
-
"aria-label": intl.formatMessage(messages$4.ariaLabel),
|
|
6547
|
-
disabled: uiDisabled,
|
|
6548
|
-
className: "np-select-input-addon np-select-input-addon--interactive",
|
|
6549
|
-
onClick: event => {
|
|
6550
|
-
event.preventDefault();
|
|
6551
|
-
onClear();
|
|
6552
|
-
triggerRef.current?.focus({
|
|
6553
|
-
preventScroll: true
|
|
6554
|
-
});
|
|
6555
|
-
},
|
|
6556
|
-
children: /*#__PURE__*/jsxRuntime.jsx(icons.Cross, {
|
|
6557
|
-
size: 16
|
|
6558
|
-
})
|
|
6559
|
-
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
6560
|
-
className: "np-select-input-addon-separator"
|
|
6561
|
-
})]
|
|
6562
|
-
}) : null, /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
6563
|
-
className: "np-select-input-addon",
|
|
6564
|
-
children: /*#__PURE__*/jsxRuntime.jsx(icons.ChevronDown, {
|
|
6565
|
-
size: 16
|
|
6566
|
-
})
|
|
6567
|
-
})]
|
|
6568
|
-
}),
|
|
6569
|
-
padding: 'sm'
|
|
6570
|
-
},
|
|
6571
|
-
className: className,
|
|
6572
|
-
children: /*#__PURE__*/jsxRuntime.jsx(OptionsOverlay, {
|
|
6573
|
-
open: open,
|
|
6574
|
-
renderTrigger: ({
|
|
6575
|
-
ref,
|
|
6576
|
-
getInteractionProps
|
|
6577
|
-
}) => /*#__PURE__*/jsxRuntime.jsx(react$1.Listbox.Button, {
|
|
6578
|
-
ref: mergeRefs__default.default([ref, triggerRef]),
|
|
6579
|
-
as: SelectInputButton,
|
|
6580
|
-
overrides: getInteractionProps(),
|
|
6581
|
-
onClick: () => {
|
|
6582
|
-
setOpen(prev => !prev);
|
|
6583
|
-
},
|
|
6584
|
-
children: value != null ? /*#__PURE__*/jsxRuntime.jsx(SelectInputOptionContentCompactContext.Provider, {
|
|
6585
|
-
value: true,
|
|
6586
|
-
children: renderValue(value, true)
|
|
6587
|
-
}) : /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
6588
|
-
className: "np-select-input-placeholder",
|
|
6589
|
-
children: placeholder
|
|
6590
|
-
})
|
|
6591
|
-
}),
|
|
6592
|
-
initialFocusRef: controllerRef,
|
|
6593
|
-
padding: "none",
|
|
6594
|
-
onClose: () => {
|
|
6595
|
-
setOpen(false);
|
|
6596
|
-
},
|
|
6597
|
-
children: /*#__PURE__*/jsxRuntime.jsx(SelectInputOptions, {
|
|
6598
|
-
items: items,
|
|
6599
|
-
renderValue: renderValue,
|
|
6600
|
-
filterable: filterable,
|
|
6601
|
-
filterPlaceholder: filterPlaceholder,
|
|
6602
|
-
searchInputRef: searchInputRef,
|
|
6603
|
-
listboxRef: listboxRef
|
|
6604
|
-
})
|
|
6605
|
-
})
|
|
6606
|
-
})
|
|
6607
|
-
})
|
|
6608
|
-
});
|
|
6609
|
-
}
|
|
6610
|
-
const SelectInputButton = /*#__PURE__*/React.forwardRef(function SelectInputButton({
|
|
6611
|
-
overrides,
|
|
6612
|
-
...restProps
|
|
6613
|
-
}, ref) {
|
|
6614
|
-
return /*#__PURE__*/jsxRuntime.jsx(ButtonInput, {
|
|
6615
|
-
ref: ref,
|
|
6616
|
-
...restProps,
|
|
6617
|
-
...overrides
|
|
6618
|
-
});
|
|
6619
|
-
});
|
|
6620
|
-
const SelectInputOptionsContainer = /*#__PURE__*/React.forwardRef(function SelectInputOptionsContainer({
|
|
6621
|
-
'aria-orientation': ariaOrientation,
|
|
6622
|
-
'aria-activedescendant': ariaActiveDescendant,
|
|
6623
|
-
role,
|
|
6624
|
-
tabIndex,
|
|
6625
|
-
onAriaActiveDescendantChange,
|
|
6626
|
-
onKeyDown,
|
|
6627
|
-
...restProps
|
|
6628
|
-
}, ref) {
|
|
6629
|
-
const handleAriaActiveDescendantChange = useEffectEvent(onAriaActiveDescendantChange);
|
|
6630
|
-
React.useEffect(() => {
|
|
6631
|
-
handleAriaActiveDescendantChange(ariaActiveDescendant);
|
|
6632
|
-
}, [ariaActiveDescendant, handleAriaActiveDescendantChange]);
|
|
6633
|
-
return (
|
|
6634
|
-
/*#__PURE__*/
|
|
6635
|
-
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
6636
|
-
jsxRuntime.jsx("div", {
|
|
6637
|
-
ref: ref,
|
|
6638
|
-
onKeyDown: event => {
|
|
6639
|
-
// Prevent absorbing dismissal requests too early
|
|
6640
|
-
if (event.key !== 'Escape') {
|
|
6641
|
-
onKeyDown?.(event);
|
|
6642
|
-
}
|
|
6643
|
-
},
|
|
6644
|
-
...restProps
|
|
6645
|
-
})
|
|
6646
|
-
);
|
|
6647
|
-
});
|
|
6648
|
-
function SelectInputOptions({
|
|
6649
|
-
items,
|
|
6650
|
-
renderValue = wrapInFragment,
|
|
6651
|
-
filterable,
|
|
6652
|
-
filterPlaceholder,
|
|
6653
|
-
searchInputRef,
|
|
6654
|
-
listboxRef
|
|
6655
|
-
}) {
|
|
6656
|
-
const [query, setQuery] = React.useState('');
|
|
6657
|
-
const needle = React.useMemo(() => query ? searchableString(query) : null, [query]);
|
|
6658
|
-
const listboxContainerRef = React.useRef(null);
|
|
6659
|
-
React.useEffect(() => {
|
|
6660
|
-
if (listboxContainerRef.current != null) {
|
|
6661
|
-
listboxContainerRef.current.style.setProperty('--initial-height', `${listboxContainerRef.current.offsetHeight}px`);
|
|
6662
|
-
}
|
|
6663
|
-
}, []);
|
|
6664
|
-
const listboxId = reactId.useId();
|
|
6665
|
-
const controllerRef = filterable ? searchInputRef : listboxRef;
|
|
6666
|
-
return /*#__PURE__*/jsxRuntime.jsxs(react$1.Listbox.Options, {
|
|
6667
|
-
as: SelectInputOptionsContainer,
|
|
6668
|
-
static: true,
|
|
6669
|
-
className: "np-select-input-options-container",
|
|
6670
|
-
onAriaActiveDescendantChange: value => {
|
|
6671
|
-
if (controllerRef.current != null) {
|
|
6672
|
-
if (value != null) {
|
|
6673
|
-
controllerRef.current.setAttribute('aria-activedescendant', value);
|
|
6674
|
-
} else {
|
|
6675
|
-
controllerRef.current.removeAttribute('aria-activedescendant');
|
|
6676
|
-
}
|
|
6677
|
-
}
|
|
6678
|
-
},
|
|
6679
|
-
children: [filterable ? /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6680
|
-
className: "np-select-input-query-container",
|
|
6681
|
-
children: /*#__PURE__*/jsxRuntime.jsx(SearchInput, {
|
|
6682
|
-
ref: searchInputRef,
|
|
6683
|
-
shape: "rectangle",
|
|
6684
|
-
placeholder: filterPlaceholder,
|
|
6685
|
-
value: query,
|
|
6686
|
-
"aria-controls": listboxId,
|
|
6687
|
-
onKeyDown: event => {
|
|
6688
|
-
// Prevent interfering with the matcher of Headless UI
|
|
6689
|
-
// https://mathiasbynens.be/notes/javascript-unicode#regex
|
|
6690
|
-
if (/^.$/u.test(event.key)) {
|
|
6691
|
-
event.stopPropagation();
|
|
6692
|
-
}
|
|
6693
|
-
},
|
|
6694
|
-
onChange: event => {
|
|
6695
|
-
setQuery(event.currentTarget.value);
|
|
6696
|
-
}
|
|
6697
|
-
})
|
|
6698
|
-
}) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6699
|
-
ref: listboxContainerRef,
|
|
6700
|
-
className: classNames__default.default('np-select-input-listbox-container', items.some(item => item.type === 'group') && 'np-select-input-listbox-container--has-group'),
|
|
6701
|
-
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6702
|
-
ref: listboxRef,
|
|
6703
|
-
id: listboxId,
|
|
6704
|
-
role: "listbox",
|
|
6705
|
-
"aria-orientation": "vertical",
|
|
6706
|
-
tabIndex: 0,
|
|
6707
|
-
className: "np-select-input-listbox",
|
|
6708
|
-
children: (needle == null ? items : dedupeSelectInputItems(items)).map((item, index) => /*#__PURE__*/jsxRuntime.jsx(SelectInputItemView
|
|
6709
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
6710
|
-
, {
|
|
6711
|
-
item: item,
|
|
6712
|
-
renderValue: renderValue,
|
|
6713
|
-
needle: needle
|
|
6714
|
-
}, index))
|
|
6715
|
-
})
|
|
6716
|
-
})]
|
|
6717
|
-
});
|
|
6718
|
-
}
|
|
6719
|
-
function SelectInputItemView({
|
|
6720
|
-
item,
|
|
6721
|
-
renderValue,
|
|
6722
|
-
needle
|
|
6723
|
-
}) {
|
|
6724
|
-
switch (item.type) {
|
|
6725
|
-
case 'option':
|
|
6726
|
-
{
|
|
6727
|
-
if (item.value != null && (!needle || inferSearchableStrings(item.filterMatchers ?? item.value).some(haystack => haystack.includes(needle)))) {
|
|
6728
|
-
return /*#__PURE__*/jsxRuntime.jsx(SelectInputOption, {
|
|
6729
|
-
value: item.value,
|
|
6730
|
-
disabled: item.disabled,
|
|
6731
|
-
children: renderValue(item.value, false)
|
|
6732
|
-
});
|
|
6733
|
-
}
|
|
6734
|
-
break;
|
|
6735
|
-
}
|
|
6736
|
-
case 'group':
|
|
6737
|
-
{
|
|
6738
|
-
return /*#__PURE__*/jsxRuntime.jsx(SelectInputGroupItemView, {
|
|
6739
|
-
item: item,
|
|
6740
|
-
renderValue: renderValue,
|
|
6741
|
-
needle: needle
|
|
6742
|
-
});
|
|
6743
|
-
}
|
|
6744
|
-
case 'separator':
|
|
6745
|
-
{
|
|
6746
|
-
if (needle == null) {
|
|
6747
|
-
return /*#__PURE__*/jsxRuntime.jsx("hr", {
|
|
6748
|
-
className: "np-select-input-separator-item",
|
|
6749
|
-
"aria-hidden": true
|
|
6750
|
-
});
|
|
6751
|
-
}
|
|
6752
|
-
break;
|
|
6753
|
-
}
|
|
6754
|
-
}
|
|
6755
|
-
return null;
|
|
6756
|
-
}
|
|
6757
|
-
function SelectInputGroupItemView({
|
|
6758
|
-
item,
|
|
6759
|
-
renderValue,
|
|
6760
|
-
needle
|
|
6761
|
-
}) {
|
|
6762
|
-
const headerId = reactId.useId();
|
|
6763
|
-
return (
|
|
6764
|
-
/*#__PURE__*/
|
|
6765
|
-
// An empty container may be rendered when no options match `needle`
|
|
6766
|
-
// However, pre-filtering would result in worse performance overall
|
|
6767
|
-
jsxRuntime.jsxs("section", {
|
|
6768
|
-
role: "group",
|
|
6769
|
-
"aria-labelledby": headerId,
|
|
6770
|
-
className: classNames__default.default(needle == null && 'np-select-input-group-item--without-needle'),
|
|
6771
|
-
children: [needle == null ? /*#__PURE__*/jsxRuntime.jsx("header", {
|
|
6772
|
-
id: headerId,
|
|
6773
|
-
role: "presentation",
|
|
6774
|
-
className: "np-select-input-group-item-header np-text-title-group",
|
|
6775
|
-
children: item.label
|
|
6776
|
-
}) : null, item.options.map((option, index) => /*#__PURE__*/jsxRuntime.jsx(SelectInputItemView
|
|
6777
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
6778
|
-
, {
|
|
6779
|
-
item: option,
|
|
6780
|
-
renderValue: renderValue,
|
|
6781
|
-
needle: needle
|
|
6782
|
-
}, index))]
|
|
6783
|
-
})
|
|
6784
|
-
);
|
|
6785
|
-
}
|
|
6786
|
-
function SelectInputOption({
|
|
6787
|
-
value,
|
|
6788
|
-
disabled,
|
|
6789
|
-
children
|
|
6790
|
-
}) {
|
|
6791
|
-
const parentHasValue = React.useContext(SelectInputHasValueContext);
|
|
6792
|
-
// Avoid flash during exit transition
|
|
6793
|
-
const {
|
|
6794
|
-
current: cachedParentHasValue
|
|
6795
|
-
} = React.useRef(parentHasValue);
|
|
6796
|
-
return /*#__PURE__*/jsxRuntime.jsx(react$1.Listbox.Option, {
|
|
6797
|
-
as: "div",
|
|
6798
|
-
value: value,
|
|
6799
|
-
disabled: disabled,
|
|
6800
|
-
className: ({
|
|
6801
|
-
active,
|
|
6802
|
-
disabled: uiDisabled
|
|
6803
|
-
}) => classNames__default.default('np-select-input-option-container np-text-body-large', active && 'np-select-input-option-container--active', uiDisabled && 'np-select-input-option-container--disabled'),
|
|
6804
|
-
children: ({
|
|
6805
|
-
selected
|
|
6806
|
-
}) => /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
6807
|
-
children: [cachedParentHasValue ? /*#__PURE__*/jsxRuntime.jsx(icons.Check, {
|
|
6808
|
-
size: 16,
|
|
6809
|
-
className: classNames__default.default(!selected && 'np-select-input-option-check--not-selected')
|
|
6810
|
-
}) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6811
|
-
className: "np-select-input-option",
|
|
6812
|
-
children: children
|
|
6813
|
-
})]
|
|
6814
|
-
})
|
|
6815
|
-
});
|
|
6816
|
-
}
|
|
6817
|
-
function SelectInputOptionContent({
|
|
6818
|
-
title,
|
|
6819
|
-
note,
|
|
6820
|
-
description,
|
|
6821
|
-
icon
|
|
6822
|
-
}) {
|
|
6823
|
-
const compact = React.useContext(SelectInputOptionContentCompactContext);
|
|
6824
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
6825
|
-
className: "np-select-input-option-content-container np-text-body-large",
|
|
6826
|
-
children: [icon ? /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6827
|
-
className: classNames__default.default('np-select-input-option-content-icon', !compact && 'np-select-input-option-content-icon--not-compact'),
|
|
6828
|
-
children: icon
|
|
6829
|
-
}) : null, /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
6830
|
-
className: "np-select-input-option-content-text",
|
|
6831
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
6832
|
-
className: classNames__default.default('np-select-input-option-content-text-line-1', compact && 'np-select-input-option-content-text-compact'),
|
|
6833
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("h4", {
|
|
6834
|
-
className: "d-inline np-text-body-large",
|
|
6835
|
-
children: title
|
|
6836
|
-
}), note ? /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
6837
|
-
className: "np-select-input-option-content-text-secondary np-text-body-default",
|
|
6838
|
-
children: note
|
|
6839
|
-
}) : null]
|
|
6840
|
-
}), description ? /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6841
|
-
className: classNames__default.default('np-select-input-option-content-text-secondary np-text-body-default', compact && 'np-select-input-option-content-text-compact'),
|
|
6842
|
-
children: description
|
|
6843
|
-
}) : null]
|
|
6844
|
-
})]
|
|
6845
|
-
});
|
|
6846
|
-
}
|
|
6847
|
-
|
|
6848
6192
|
const TextArea = /*#__PURE__*/React.forwardRef(function TextArea({
|
|
6849
6193
|
className,
|
|
6850
6194
|
...restProps
|
|
@@ -7960,7 +7304,7 @@ function Select({
|
|
|
7960
7304
|
headerTitle: searchPlaceholder || formatMessage(messages$3.searchPlaceholder),
|
|
7961
7305
|
onClose: handleCloseOptions,
|
|
7962
7306
|
children: renderOptionsList()
|
|
7963
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(BottomSheet$
|
|
7307
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(BottomSheet$1, {
|
|
7964
7308
|
open: open,
|
|
7965
7309
|
onClose: handleCloseOptions,
|
|
7966
7310
|
children: renderOptionsList({
|
|
@@ -10393,10 +9737,12 @@ const PromoCardIndicator = ({
|
|
|
10393
9737
|
children,
|
|
10394
9738
|
label,
|
|
10395
9739
|
icon,
|
|
9740
|
+
isSmall = false,
|
|
10396
9741
|
testid,
|
|
10397
9742
|
...rest
|
|
10398
9743
|
}) => {
|
|
10399
|
-
const
|
|
9744
|
+
const isIconString = icon && typeof icon === 'string';
|
|
9745
|
+
const IconComponent = isIconString && {
|
|
10400
9746
|
check: icons.Check,
|
|
10401
9747
|
arrow: icons.ArrowRight,
|
|
10402
9748
|
download: icons.Download
|
|
@@ -10410,12 +9756,15 @@ const PromoCardIndicator = ({
|
|
|
10410
9756
|
type: exports.Typography.BODY_LARGE_BOLD,
|
|
10411
9757
|
className: "np-Card-indicatorText",
|
|
10412
9758
|
children: label
|
|
10413
|
-
}),
|
|
9759
|
+
}), icon && /*#__PURE__*/jsxRuntime.jsx(Avatar, {
|
|
9760
|
+
type: exports.AvatarType.ICON,
|
|
9761
|
+
size: isSmall ? 40 : 56,
|
|
9762
|
+
backgroundColor: "var(--Card-indicator-icon-background-color)",
|
|
10414
9763
|
className: "np-Card-indicatorIcon",
|
|
10415
|
-
children: /*#__PURE__*/jsxRuntime.jsx(IconComponent, {
|
|
9764
|
+
children: IconComponent ? /*#__PURE__*/jsxRuntime.jsx(IconComponent, {
|
|
10416
9765
|
size: 24,
|
|
10417
9766
|
"aria-hidden": "true"
|
|
10418
|
-
})
|
|
9767
|
+
}) : icon
|
|
10419
9768
|
}), children]
|
|
10420
9769
|
});
|
|
10421
9770
|
};
|
|
@@ -10477,6 +9826,7 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
10477
9826
|
imageClass,
|
|
10478
9827
|
imageSource,
|
|
10479
9828
|
indicatorLabel,
|
|
9829
|
+
indicatorIcon,
|
|
10480
9830
|
isChecked,
|
|
10481
9831
|
isDisabled,
|
|
10482
9832
|
onClick,
|
|
@@ -10487,6 +9837,8 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
10487
9837
|
title,
|
|
10488
9838
|
type,
|
|
10489
9839
|
value,
|
|
9840
|
+
isSmall,
|
|
9841
|
+
useDisplayFont = true,
|
|
10490
9842
|
...props
|
|
10491
9843
|
}, reference) => {
|
|
10492
9844
|
// Set the `checked` state to the value of `defaultChecked` if it is truthy,
|
|
@@ -10510,7 +9862,19 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
10510
9862
|
// Set the icon to `'arrow'` if `href` is truthy and `type` is falsy, or
|
|
10511
9863
|
// `'download'` if `download` is truthy. If neither condition is true, set
|
|
10512
9864
|
// `icon` to `undefined`.
|
|
10513
|
-
|
|
9865
|
+
// Create a function to get icon type
|
|
9866
|
+
const getIconType = () => {
|
|
9867
|
+
if (indicatorIcon) {
|
|
9868
|
+
return indicatorIcon;
|
|
9869
|
+
}
|
|
9870
|
+
if (download) {
|
|
9871
|
+
return 'download';
|
|
9872
|
+
}
|
|
9873
|
+
if (href && !type) {
|
|
9874
|
+
return 'arrow';
|
|
9875
|
+
}
|
|
9876
|
+
return undefined;
|
|
9877
|
+
};
|
|
10514
9878
|
// Define all class names string based on the values of the `href`, `type`,
|
|
10515
9879
|
// `checked`, and `className` props.
|
|
10516
9880
|
const commonClasses = classNames__default.default({
|
|
@@ -10527,7 +9891,8 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
10527
9891
|
isDisabled: isDisabled || contextIsDisabled,
|
|
10528
9892
|
onClick,
|
|
10529
9893
|
ref: reference,
|
|
10530
|
-
'data-testid': testId
|
|
9894
|
+
'data-testid': testId,
|
|
9895
|
+
isSmall
|
|
10531
9896
|
};
|
|
10532
9897
|
// Object with Anchor props that will be passed to the `a` element. These
|
|
10533
9898
|
// won't be refurned if set to `isDisabled`
|
|
@@ -10555,6 +9920,27 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
10555
9920
|
ref: reference,
|
|
10556
9921
|
tabIndex: 0
|
|
10557
9922
|
} : {};
|
|
9923
|
+
const getTitle = () => {
|
|
9924
|
+
const titleContent = href && !type ? /*#__PURE__*/jsxRuntime.jsx("a", {
|
|
9925
|
+
className: "np-Card-titleLink",
|
|
9926
|
+
...anchorProps,
|
|
9927
|
+
children: title
|
|
9928
|
+
}) : title;
|
|
9929
|
+
const titleProps = {
|
|
9930
|
+
id: `${componentId}-title`,
|
|
9931
|
+
as: headingLevel,
|
|
9932
|
+
className: 'np-Card-title'
|
|
9933
|
+
};
|
|
9934
|
+
return useDisplayFont ? /*#__PURE__*/jsxRuntime.jsx(Display, {
|
|
9935
|
+
type: exports.Typography.DISPLAY_SMALL,
|
|
9936
|
+
...titleProps,
|
|
9937
|
+
children: titleContent
|
|
9938
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(Title, {
|
|
9939
|
+
type: exports.Typography.TITLE_SUBSECTION,
|
|
9940
|
+
...titleProps,
|
|
9941
|
+
children: titleContent
|
|
9942
|
+
});
|
|
9943
|
+
};
|
|
10558
9944
|
React.useEffect(() => {
|
|
10559
9945
|
setChecked(defaultChecked ?? isChecked ?? false);
|
|
10560
9946
|
}, [defaultChecked, isChecked]);
|
|
@@ -10568,17 +9954,7 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
10568
9954
|
size: 24,
|
|
10569
9955
|
"aria-hidden": "true"
|
|
10570
9956
|
})
|
|
10571
|
-
}), /*#__PURE__*/jsxRuntime.jsx(
|
|
10572
|
-
id: `${componentId}-title`,
|
|
10573
|
-
as: headingLevel,
|
|
10574
|
-
className: "np-Card-title",
|
|
10575
|
-
type: exports.Typography.DISPLAY_SMALL,
|
|
10576
|
-
children: href && !type ? /*#__PURE__*/jsxRuntime.jsx("a", {
|
|
10577
|
-
className: "np-Card-titleLink",
|
|
10578
|
-
...anchorProps,
|
|
10579
|
-
children: title
|
|
10580
|
-
}) : title
|
|
10581
|
-
}), /*#__PURE__*/jsxRuntime.jsx(Body, {
|
|
9957
|
+
}), getTitle(), /*#__PURE__*/jsxRuntime.jsx(Body, {
|
|
10582
9958
|
className: "np-Card-description",
|
|
10583
9959
|
children: description
|
|
10584
9960
|
}), imageSource && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
@@ -10592,7 +9968,8 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
10592
9968
|
})
|
|
10593
9969
|
}), /*#__PURE__*/jsxRuntime.jsx(PromoCardIndicator, {
|
|
10594
9970
|
label: indicatorLabel,
|
|
10595
|
-
icon:
|
|
9971
|
+
icon: getIconType(),
|
|
9972
|
+
isSmall: isSmall
|
|
10596
9973
|
})]
|
|
10597
9974
|
});
|
|
10598
9975
|
});
|
|
@@ -15083,7 +14460,7 @@ exports.AvatarWrapper = AvatarWrapper;
|
|
|
15083
14460
|
exports.Badge = Badge;
|
|
15084
14461
|
exports.BaseCard = Card;
|
|
15085
14462
|
exports.Body = Body;
|
|
15086
|
-
exports.BottomSheet = BottomSheet$
|
|
14463
|
+
exports.BottomSheet = BottomSheet$1;
|
|
15087
14464
|
exports.Button = Button;
|
|
15088
14465
|
exports.Card = Card$2;
|
|
15089
14466
|
exports.Checkbox = Checkbox$1;
|
|
@@ -15131,7 +14508,7 @@ exports.Nudge = Nudge;
|
|
|
15131
14508
|
exports.Option = Option$2;
|
|
15132
14509
|
exports.OverlayHeader = OverlayHeader$1;
|
|
15133
14510
|
exports.PhoneNumberInput = PhoneNumberInput$1;
|
|
15134
|
-
exports.Popover = Popover$
|
|
14511
|
+
exports.Popover = Popover$1;
|
|
15135
14512
|
exports.ProcessIndicator = ProcessIndicator$1;
|
|
15136
14513
|
exports.Progress = Progress;
|
|
15137
14514
|
exports.ProgressBar = ProgressBar;
|
|
@@ -15143,11 +14520,8 @@ exports.Radio = Radio$1;
|
|
|
15143
14520
|
exports.RadioGroup = RadioGroup$1;
|
|
15144
14521
|
exports.RadioOption = RadioOption$1;
|
|
15145
14522
|
exports.SUPPORTED_LANGUAGES = SUPPORTED_LANGUAGES;
|
|
15146
|
-
exports.SearchInput = SearchInput;
|
|
15147
14523
|
exports.Section = Section;
|
|
15148
14524
|
exports.Select = Select;
|
|
15149
|
-
exports.SelectInput = SelectInput;
|
|
15150
|
-
exports.SelectInputOptionContent = SelectInputOptionContent;
|
|
15151
14525
|
exports.SlidingPanel = SlidingPanel$1;
|
|
15152
14526
|
exports.SnackbarConsumer = SnackbarConsumer;
|
|
15153
14527
|
exports.SnackbarContext = SnackbarContext;
|