@ballistix.digital/react-components 9.10.0 → 9.10.1-rc-410.0
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/index.d.ts +50 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +147 -23
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +146 -22
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {jsx as $4MPRY$jsx, jsxs as $4MPRY$jsxs, Fragment as $4MPRY$Fragment} from "react/jsx-runtime";
|
|
2
|
-
import {set as $4MPRY$set, get as $4MPRY$get, isArray as $4MPRY$isArray, map as $4MPRY$map, padStart as $4MPRY$padStart, concat as $4MPRY$concat, isNil as $4MPRY$isNil, noop as $4MPRY$noop, toSafeInteger as $4MPRY$toSafeInteger, filter as $4MPRY$filter, indexOf as $4MPRY$indexOf, find as $4MPRY$find, compact as $4MPRY$compact, forEach as $4MPRY$forEach, assign as $4MPRY$assign, includes as $4MPRY$includes, isEmpty as $4MPRY$isEmpty, some as $4MPRY$some, findIndex as $4MPRY$findIndex, last as $4MPRY$last, first as $4MPRY$first, times as $4MPRY$times, pick as $4MPRY$pick, intersection as $4MPRY$intersection, every as $4MPRY$every, uniq as $4MPRY$uniq, trim as $4MPRY$trim, lastIndexOf as $4MPRY$lastIndexOf} from "lodash";
|
|
2
|
+
import {set as $4MPRY$set, get as $4MPRY$get, isArray as $4MPRY$isArray, map as $4MPRY$map, padStart as $4MPRY$padStart, concat as $4MPRY$concat, isNil as $4MPRY$isNil, noop as $4MPRY$noop, toSafeInteger as $4MPRY$toSafeInteger, keyBy as $4MPRY$keyBy, join as $4MPRY$join, filter as $4MPRY$filter, indexOf as $4MPRY$indexOf, find as $4MPRY$find, compact as $4MPRY$compact, forEach as $4MPRY$forEach, assign as $4MPRY$assign, includes as $4MPRY$includes, isEmpty as $4MPRY$isEmpty, some as $4MPRY$some, findIndex as $4MPRY$findIndex, last as $4MPRY$last, first as $4MPRY$first, times as $4MPRY$times, pick as $4MPRY$pick, intersection as $4MPRY$intersection, every as $4MPRY$every, uniq as $4MPRY$uniq, trim as $4MPRY$trim, lastIndexOf as $4MPRY$lastIndexOf} from "lodash";
|
|
3
3
|
import $4MPRY$react, {useState as $4MPRY$useState, useMemo as $4MPRY$useMemo, useRef as $4MPRY$useRef, Children as $4MPRY$Children, Fragment as $4MPRY$Fragment1, useCallback as $4MPRY$useCallback, useEffect as $4MPRY$useEffect, createElement as $4MPRY$createElement} from "react";
|
|
4
4
|
import $4MPRY$lodashget from "lodash/get";
|
|
5
5
|
import {library as $4MPRY$library} from "@fortawesome/fontawesome-svg-core";
|
|
@@ -12,6 +12,7 @@ import {FontAwesomeIcon as $4MPRY$FontAwesomeIcon} from "@fortawesome/react-font
|
|
|
12
12
|
import {useFloating as $4MPRY$useFloating, offset as $4MPRY$offset, flip as $4MPRY$flip, shift as $4MPRY$shift, arrow as $4MPRY$arrow, autoUpdate as $4MPRY$autoUpdate, useHover as $4MPRY$useHover, useFocus as $4MPRY$useFocus, useDismiss as $4MPRY$useDismiss, useRole as $4MPRY$useRole, useInteractions as $4MPRY$useInteractions, FloatingArrow as $4MPRY$FloatingArrow} from "@floating-ui/react";
|
|
13
13
|
import {Menu as $4MPRY$Menu, MenuButton as $4MPRY$MenuButton, Transition as $4MPRY$Transition, MenuItems as $4MPRY$MenuItems, Dialog as $4MPRY$Dialog, TransitionChild as $4MPRY$TransitionChild, Popover as $4MPRY$Popover, PopoverButton as $4MPRY$PopoverButton, PopoverPanel as $4MPRY$PopoverPanel, Switch as $4MPRY$Switch} from "@headlessui/react";
|
|
14
14
|
import {useMask as $4MPRY$useMask} from "@react-input/mask";
|
|
15
|
+
import {NumericFormat as $4MPRY$NumericFormat} from "react-number-format";
|
|
15
16
|
import {useTable as $4MPRY$useTable, flexRender as $4MPRY$flexRender, tableFeatures as $4MPRY$tableFeatures, rowSortingFeature as $4MPRY$rowSortingFeature, columnVisibilityFeature as $4MPRY$columnVisibilityFeature, columnOrderingFeature as $4MPRY$columnOrderingFeature, columnPinningFeature as $4MPRY$columnPinningFeature, columnSizingFeature as $4MPRY$columnSizingFeature, rowPaginationFeature as $4MPRY$rowPaginationFeature, columnGroupingFeature as $4MPRY$columnGroupingFeature, createGroupedRowModel as $4MPRY$createGroupedRowModel, rowExpandingFeature as $4MPRY$rowExpandingFeature, createExpandedRowModel as $4MPRY$createExpandedRowModel, rowAggregationFeature as $4MPRY$rowAggregationFeature, aggregationFn_sum as $4MPRY$aggregationFn_sum, aggregationFn_min as $4MPRY$aggregationFn_min, aggregationFn_max as $4MPRY$aggregationFn_max, aggregationFn_extent as $4MPRY$aggregationFn_extent, aggregationFn_mean as $4MPRY$aggregationFn_mean, aggregationFn_median as $4MPRY$aggregationFn_median, aggregationFn_unique as $4MPRY$aggregationFn_unique, aggregationFn_uniqueCount as $4MPRY$aggregationFn_uniqueCount, aggregationFn_count as $4MPRY$aggregationFn_count, aggregationFn_first as $4MPRY$aggregationFn_first, aggregationFn_last as $4MPRY$aggregationFn_last, createColumnHelper as $4MPRY$createColumnHelper} from "@tanstack/react-table";
|
|
16
17
|
import $4MPRY$reacttailwindcssselect from "react-tailwindcss-select";
|
|
17
18
|
import {utils as $4MPRY$utils, writeFile as $4MPRY$writeFile} from "xlsx";
|
|
@@ -1293,6 +1294,7 @@ var $49931a5175dab103$export$2e2bcd8739ae039 = $49931a5175dab103$var$ProgressTra
|
|
|
1293
1294
|
|
|
1294
1295
|
|
|
1295
1296
|
|
|
1297
|
+
|
|
1296
1298
|
const $26a2a503969671d2$var$base = {
|
|
1297
1299
|
foot: '',
|
|
1298
1300
|
hint: 'text-gray-400 text-xs mt-1',
|
|
@@ -1582,7 +1584,7 @@ var $e0479f32053e5dad$export$2e2bcd8739ae039 = $e0479f32053e5dad$var$styles;
|
|
|
1582
1584
|
|
|
1583
1585
|
|
|
1584
1586
|
const $3db4e24516b1d7c2$var$InputGroup = (props)=>{
|
|
1585
|
-
const { name: name, htmlType: htmlType = 'text', label: label, hint: hint, description: description, placeholder: placeholder, leading: leading, trailing: trailing, required: required, value: value, mask: mask, min: min, max: max, step: step, maxLength: maxLength, rows: rows, error: error, type: type = 'normal', isDisabled: isDisabled, isRequired: isRequired = false, isTouched: isTouched = false, isSolo: isSolo = false, isOptionalLabelHidden: isOptionalLabelHidden = false, onChange: onChange, onClear: onClear, onBlur: onBlur, onClick: onClick, onKeyDown: onKeyDown, setRefOnLoad: setRefOnLoad, styles: stylesOverrides } = props;
|
|
1587
|
+
const { name: name, htmlType: htmlType = 'text', label: label, hint: hint, description: description, placeholder: placeholder, leading: leading, trailing: trailing, required: required, value: value, mask: mask, min: min, max: max, step: step, maxLength: maxLength, rows: rows, error: error, precision: precision, thousandSeparator: thousandSeparator, decimalSeparator: decimalSeparator, currency: currency, type: type = 'normal', isDisabled: isDisabled, isRequired: isRequired = false, isTouched: isTouched = false, isSolo: isSolo = false, isOptionalLabelHidden: isOptionalLabelHidden = false, onChange: onChange, onClear: onClear, onBlur: onBlur, onClick: onClick, onKeyDown: onKeyDown, setRefOnLoad: setRefOnLoad, styles: stylesOverrides } = props;
|
|
1586
1588
|
const isValid = error === undefined;
|
|
1587
1589
|
const maskRef = (0, $4MPRY$useMask)({
|
|
1588
1590
|
mask: mask?.mask,
|
|
@@ -1592,6 +1594,74 @@ const $3db4e24516b1d7c2$var$InputGroup = (props)=>{
|
|
|
1592
1594
|
});
|
|
1593
1595
|
const defaultRef = (0, $4MPRY$useRef)(null);
|
|
1594
1596
|
const ref = mask ? maskRef : defaultRef;
|
|
1597
|
+
const isNumeric = htmlType === 'number' || htmlType === 'percent' || htmlType === 'currency';
|
|
1598
|
+
const numericValueRef = (0, $4MPRY$useRef)(null);
|
|
1599
|
+
const numericFormatProps = (0, $4MPRY$useMemo)(()=>{
|
|
1600
|
+
if (htmlType === 'percent') return {
|
|
1601
|
+
decimalScale: precision,
|
|
1602
|
+
suffix: '%'
|
|
1603
|
+
};
|
|
1604
|
+
if (htmlType === 'currency') {
|
|
1605
|
+
const resolvedDecimalSeparator = decimalSeparator ?? ',';
|
|
1606
|
+
return {
|
|
1607
|
+
decimalScale: precision ?? 2,
|
|
1608
|
+
fixedDecimalScale: true,
|
|
1609
|
+
thousandSeparator: thousandSeparator ?? '.',
|
|
1610
|
+
decimalSeparator: resolvedDecimalSeparator,
|
|
1611
|
+
// Numpad decimal keys are typically ".", regardless of locale. A literal "." can never be a
|
|
1612
|
+
// manually-typed thousand separator (grouping is auto-inserted), so it's safe to also accept
|
|
1613
|
+
// it as a decimal keystroke even when the configured decimal separator is something else.
|
|
1614
|
+
allowedDecimalSeparators: Array.from(new Set([
|
|
1615
|
+
resolvedDecimalSeparator,
|
|
1616
|
+
'.'
|
|
1617
|
+
])),
|
|
1618
|
+
prefix: `${currency ?? "\u20AC"} `
|
|
1619
|
+
};
|
|
1620
|
+
}
|
|
1621
|
+
// htmlType === 'number'
|
|
1622
|
+
return {
|
|
1623
|
+
decimalScale: precision,
|
|
1624
|
+
thousandSeparator: thousandSeparator,
|
|
1625
|
+
allowNegative: min === undefined || Number(min) < 0
|
|
1626
|
+
};
|
|
1627
|
+
}, [
|
|
1628
|
+
htmlType,
|
|
1629
|
+
precision,
|
|
1630
|
+
thousandSeparator,
|
|
1631
|
+
decimalSeparator,
|
|
1632
|
+
currency,
|
|
1633
|
+
min
|
|
1634
|
+
]);
|
|
1635
|
+
const handleNumericValueChange = (values, sourceInfo)=>{
|
|
1636
|
+
numericValueRef.current = values.floatValue ?? null;
|
|
1637
|
+
if (sourceInfo.source !== 'event') return;
|
|
1638
|
+
onChange(values.floatValue ?? null, values.formattedValue);
|
|
1639
|
+
};
|
|
1640
|
+
const handleNumericBlur = (e)=>{
|
|
1641
|
+
if (htmlType === 'number' && numericValueRef.current !== null) {
|
|
1642
|
+
let clamped = numericValueRef.current;
|
|
1643
|
+
if (min !== undefined) clamped = Math.max(Number(min), clamped);
|
|
1644
|
+
if (max !== undefined) clamped = Math.min(Number(max), clamped);
|
|
1645
|
+
if (clamped !== numericValueRef.current) {
|
|
1646
|
+
numericValueRef.current = clamped;
|
|
1647
|
+
onChange(clamped, String(clamped));
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
onBlur(e);
|
|
1651
|
+
};
|
|
1652
|
+
const handleNumericKeyDown = (e)=>{
|
|
1653
|
+
if (htmlType === 'number' && (e.key === 'ArrowUp' || e.key === 'ArrowDown')) {
|
|
1654
|
+
e.preventDefault();
|
|
1655
|
+
const stepValue = step !== undefined && step !== 'any' ? Number(step) : 1;
|
|
1656
|
+
const delta = stepValue * (e.key === 'ArrowUp' ? 1 : -1);
|
|
1657
|
+
let next = (numericValueRef.current ?? 0) + delta;
|
|
1658
|
+
if (min !== undefined) next = Math.max(Number(min), next);
|
|
1659
|
+
if (max !== undefined) next = Math.min(Number(max), next);
|
|
1660
|
+
numericValueRef.current = next;
|
|
1661
|
+
onChange(next, String(next));
|
|
1662
|
+
}
|
|
1663
|
+
onKeyDown?.(e);
|
|
1664
|
+
};
|
|
1595
1665
|
const handleGenerateStyle = ()=>{
|
|
1596
1666
|
const result = (0, $b3fc44f26b625a32$export$e2d2075c69d9100d)((0, $e0479f32053e5dad$export$2e2bcd8739ae039).base);
|
|
1597
1667
|
const keys = (0, $4MPRY$concat)((0, $ba1db6dce71c3f25$export$be5d6ab3c5b84767)((0, $e0479f32053e5dad$export$2e2bcd8739ae039).base), (0, $ba1db6dce71c3f25$export$be5d6ab3c5b84767)((0, $26a2a503969671d2$export$2e2bcd8739ae039).base), (0, $ba1db6dce71c3f25$export$be5d6ab3c5b84767)((0, $495392c79d755f40$export$2e2bcd8739ae039).base));
|
|
@@ -1636,7 +1706,7 @@ const $3db4e24516b1d7c2$var$InputGroup = (props)=>{
|
|
|
1636
1706
|
className: styles.leading,
|
|
1637
1707
|
children: leading
|
|
1638
1708
|
}),
|
|
1639
|
-
!htmlType || htmlType !== 'area' && (0, $4MPRY$jsxs)("div", {
|
|
1709
|
+
!htmlType || htmlType !== 'area' && !isNumeric && (0, $4MPRY$jsxs)("div", {
|
|
1640
1710
|
className: "flex items-center",
|
|
1641
1711
|
children: [
|
|
1642
1712
|
(0, $4MPRY$jsx)("input", {
|
|
@@ -1677,6 +1747,27 @@ const $3db4e24516b1d7c2$var$InputGroup = (props)=>{
|
|
|
1677
1747
|
})
|
|
1678
1748
|
]
|
|
1679
1749
|
}),
|
|
1750
|
+
isNumeric && (0, $4MPRY$jsx)("div", {
|
|
1751
|
+
className: "flex items-center",
|
|
1752
|
+
children: (0, $4MPRY$jsx)((0, $4MPRY$NumericFormat), {
|
|
1753
|
+
getInputRef: ref,
|
|
1754
|
+
name: name,
|
|
1755
|
+
id: name,
|
|
1756
|
+
"data-cy": inputDataCy,
|
|
1757
|
+
className: styles.input,
|
|
1758
|
+
placeholder: placeholder,
|
|
1759
|
+
defaultValue: isSolo ? value : undefined,
|
|
1760
|
+
value: isSolo ? undefined : value,
|
|
1761
|
+
valueIsNumericString: true,
|
|
1762
|
+
inputMode: "decimal",
|
|
1763
|
+
disabled: isDisabled,
|
|
1764
|
+
onValueChange: handleNumericValueChange,
|
|
1765
|
+
onBlur: handleNumericBlur,
|
|
1766
|
+
onClick: onClick,
|
|
1767
|
+
onKeyDown: handleNumericKeyDown,
|
|
1768
|
+
...numericFormatProps
|
|
1769
|
+
})
|
|
1770
|
+
}),
|
|
1680
1771
|
htmlType === 'area' && (0, $4MPRY$jsx)("textarea", {
|
|
1681
1772
|
rows: rows,
|
|
1682
1773
|
name: name,
|
|
@@ -2165,14 +2256,14 @@ const $5a695feeffe62190$var$base = {
|
|
|
2165
2256
|
input: 'w-full flex border',
|
|
2166
2257
|
menuButton: '',
|
|
2167
2258
|
menu: 'z-10 px-0! py-0! w-full! rounded-md overflow-hidden border mt-1! absolute bg-white',
|
|
2168
|
-
tagItem: 'bg-gray-200 px-2 py-1 flex flex-row gap-x-1 items-center justify-between rounded-
|
|
2259
|
+
tagItem: 'bg-gray-200 px-2 py-1 flex flex-row gap-x-1 items-center justify-between rounded-md',
|
|
2169
2260
|
tagItemText: 'text-xs',
|
|
2170
2261
|
tagItemIconContainer: 'p-0! rounded-full hover:bg-gray-400 text-sm hover:text-white aspect-square w-4 flex items-center justify-center cursor-pointer',
|
|
2171
2262
|
tagItemIcon: '',
|
|
2172
2263
|
list: 'px-0! w-full! *:px-0 max-h-56 overflow-scroll py-1!',
|
|
2173
2264
|
listGroupLabel: '',
|
|
2174
2265
|
listItem: 'w-full! list-none! hover:bg-primary-500 hover:text-white py-2! px-2! cursor-pointer',
|
|
2175
|
-
listDisabledItem: '',
|
|
2266
|
+
listDisabledItem: 'w-full! list-none! py-2! px-2! cursor-not-allowed text-gray-400',
|
|
2176
2267
|
searchContainer: 'w-full! px-2! py-2! border-b',
|
|
2177
2268
|
searchBox: '',
|
|
2178
2269
|
searchIcon: '',
|
|
@@ -2229,7 +2320,7 @@ var $5a695feeffe62190$export$2e2bcd8739ae039 = $5a695feeffe62190$var$styles;
|
|
|
2229
2320
|
|
|
2230
2321
|
|
|
2231
2322
|
const $0f7b65f3f54c9363$var$SelectMenu = (props)=>{
|
|
2232
|
-
const { name: name = 'select-menu-form', label: label, description: description, hint: hint, placeholder: placeholder, options: options, required: required, value: value, error: error, isRequired: isRequired = false, isLoading: isLoading, isTouched: isTouched = false, isDisabled: isDisabled, isClearable: isClearable = true, isMultiple: isMultiple = false, isSearchable: isSearchable = true, isSolo: isSolo = false, isOptionalLabelHidden: isOptionalLabelHidden = false, onChange: onChange, onSearchInputChange: onSearchInputChange, onClear: onClear, onBlur: onBlur, searchInputOptionRenderer: searchInputOptionRenderer, dataTestId: dataTestId, styles: stylesOverrides } = props;
|
|
2323
|
+
const { name: name = 'select-menu-form', label: label, description: description, hint: hint, placeholder: placeholder, options: options, required: required, value: value, error: error, isRequired: isRequired = false, isLoading: isLoading, isTouched: isTouched = false, isDisabled: isDisabled, isClearable: isClearable = true, isMultiple: isMultiple = false, isSearchable: isSearchable = true, isSolo: isSolo = false, isOptionalLabelHidden: isOptionalLabelHidden = false, onChange: onChange, onSearchInputChange: onSearchInputChange, onClear: onClear, onBlur: onBlur, optionRenderer: optionRenderer, searchInputOptionRenderer: searchInputOptionRenderer, dataTestId: dataTestId, styles: stylesOverrides } = props;
|
|
2233
2324
|
const [isFocus, setIsFocus] = (0, $4MPRY$useState)(true);
|
|
2234
2325
|
const [state, setState] = (0, $4MPRY$useState)(value ?? null);
|
|
2235
2326
|
const [searchValue, setSearchValue] = (0, $4MPRY$useState)();
|
|
@@ -2243,16 +2334,6 @@ const $0f7b65f3f54c9363$var$SelectMenu = (props)=>{
|
|
|
2243
2334
|
});
|
|
2244
2335
|
return result;
|
|
2245
2336
|
};
|
|
2246
|
-
const handleChange = (selectValue)=>{
|
|
2247
|
-
setState(selectValue);
|
|
2248
|
-
onChange && onChange(selectValue);
|
|
2249
|
-
setIsFocus(false);
|
|
2250
|
-
if (searchInputOptionRenderer) setSearchValue(null);
|
|
2251
|
-
};
|
|
2252
|
-
const handleSearchInputChange = (e)=>{
|
|
2253
|
-
if (searchInputOptionRenderer) setSearchValue(e.target.value);
|
|
2254
|
-
onSearchInputChange?.(e);
|
|
2255
|
-
};
|
|
2256
2337
|
const computedOptions = (0, $4MPRY$useMemo)(()=>{
|
|
2257
2338
|
if (!searchInputOptionRenderer || !searchValue) return options;
|
|
2258
2339
|
if (options.some((opt)=>opt.label.toLowerCase().includes(searchValue.toLowerCase()))) return options;
|
|
@@ -2269,6 +2350,26 @@ const $0f7b65f3f54c9363$var$SelectMenu = (props)=>{
|
|
|
2269
2350
|
options,
|
|
2270
2351
|
searchValue
|
|
2271
2352
|
]);
|
|
2353
|
+
const optionsByValue = (0, $4MPRY$useMemo)(()=>(0, $4MPRY$keyBy)(computedOptions, 'value'), [
|
|
2354
|
+
computedOptions
|
|
2355
|
+
]);
|
|
2356
|
+
const handleChange = (selectValue)=>{
|
|
2357
|
+
const applyValue = (nextValue)=>{
|
|
2358
|
+
setState(nextValue);
|
|
2359
|
+
onChange && onChange(nextValue);
|
|
2360
|
+
setIsFocus(false);
|
|
2361
|
+
if (searchInputOptionRenderer) setSearchValue(null);
|
|
2362
|
+
};
|
|
2363
|
+
// A single selection is handed back straight from `options`.
|
|
2364
|
+
if (!Array.isArray(selectValue)) return applyValue(selectValue);
|
|
2365
|
+
// A multiple selection echoes the value we passed in, which carries a rendered `label`
|
|
2366
|
+
// (see `libraryValue`), so resolve those entries to the options we were given.
|
|
2367
|
+
return applyValue(selectValue.map((option)=>optionsByValue[option.value] ?? option));
|
|
2368
|
+
};
|
|
2369
|
+
const handleSearchInputChange = (e)=>{
|
|
2370
|
+
if (searchInputOptionRenderer) setSearchValue(e.target.value);
|
|
2371
|
+
onSearchInputChange?.(e);
|
|
2372
|
+
};
|
|
2272
2373
|
const styles = handleGenerateStyle();
|
|
2273
2374
|
// Simulate onClear event.
|
|
2274
2375
|
(0, $4MPRY$useEffect)(()=>{
|
|
@@ -2318,8 +2419,10 @@ const $0f7b65f3f54c9363$var$SelectMenu = (props)=>{
|
|
|
2318
2419
|
name
|
|
2319
2420
|
]);
|
|
2320
2421
|
const formattedError = (0, $4MPRY$useMemo)(()=>{
|
|
2321
|
-
if (error) return
|
|
2322
|
-
return
|
|
2422
|
+
if (!error) return null;
|
|
2423
|
+
if (typeof error === 'string') return error;
|
|
2424
|
+
if ((0, $4MPRY$isArray)(error)) return (0, $4MPRY$join)((0, $4MPRY$map)(error, 'label'), ', ');
|
|
2425
|
+
return error.label;
|
|
2323
2426
|
}, [
|
|
2324
2427
|
error
|
|
2325
2428
|
]);
|
|
@@ -2338,10 +2441,30 @@ const $0f7b65f3f54c9363$var$SelectMenu = (props)=>{
|
|
|
2338
2441
|
});
|
|
2339
2442
|
}
|
|
2340
2443
|
return (0, $4MPRY$jsx)("div", {
|
|
2341
|
-
|
|
2342
|
-
|
|
2444
|
+
role: "option",
|
|
2445
|
+
"aria-selected": !!data.isSelected,
|
|
2446
|
+
className: data.disabled ? styles.listDisabledItem : styles.listItem,
|
|
2447
|
+
// Formatted options are rendered inside a wrapper that carries the select's own click
|
|
2448
|
+
// handler, which bypasses its disabled handling.
|
|
2449
|
+
onClick: (e)=>data.disabled && e.stopPropagation(),
|
|
2450
|
+
children: optionRenderer ? optionRenderer(data) : data.label
|
|
2343
2451
|
});
|
|
2344
2452
|
};
|
|
2453
|
+
// The select renders `label` as children everywhere except its search filter, which only ever
|
|
2454
|
+
// reads `options`. Rendering the value keeps the selected button and tags in sync with the list.
|
|
2455
|
+
const libraryValue = (0, $4MPRY$useMemo)(()=>{
|
|
2456
|
+
if (!optionRenderer || !state) return state;
|
|
2457
|
+
return (0, $4MPRY$isArray)(state) ? (0, $4MPRY$map)(state, (option)=>({
|
|
2458
|
+
...option,
|
|
2459
|
+
label: optionRenderer(option)
|
|
2460
|
+
})) : {
|
|
2461
|
+
...state,
|
|
2462
|
+
label: optionRenderer(state)
|
|
2463
|
+
};
|
|
2464
|
+
}, [
|
|
2465
|
+
optionRenderer,
|
|
2466
|
+
state
|
|
2467
|
+
]);
|
|
2345
2468
|
return (0, $4MPRY$jsxs)("div", {
|
|
2346
2469
|
className: styles.container,
|
|
2347
2470
|
"data-testid": selectDataTestId,
|
|
@@ -2382,11 +2505,11 @@ const $0f7b65f3f54c9363$var$SelectMenu = (props)=>{
|
|
|
2382
2505
|
//
|
|
2383
2506
|
options: computedOptions,
|
|
2384
2507
|
//
|
|
2385
|
-
value:
|
|
2508
|
+
value: libraryValue,
|
|
2386
2509
|
onChange: handleChange,
|
|
2387
2510
|
onSearchInputChange: handleSearchInputChange,
|
|
2388
2511
|
//
|
|
2389
|
-
formatOptionLabel: searchInputOptionRenderer ? handleFormatOptionLabel : undefined,
|
|
2512
|
+
formatOptionLabel: searchInputOptionRenderer || optionRenderer ? handleFormatOptionLabel : undefined,
|
|
2390
2513
|
classNames: {
|
|
2391
2514
|
menuButton: ()=>(0, $66c3dcaaa74b5389$export$4370d69198e9314a)(styles.input, `bx-select-menu-${name}`, state === null && '*:text-gray-300! ', state === null && !isValid && isTouched && '*:text-red-300!'),
|
|
2392
2515
|
menu: styles.menu,
|
|
@@ -6342,7 +6465,7 @@ var $d0f2c79aeb98cf67$export$2e2bcd8739ae039 = $d0f2c79aeb98cf67$var$styles;
|
|
|
6342
6465
|
|
|
6343
6466
|
|
|
6344
6467
|
const $1a5ad17805feb7b2$var$FileInputGroup = (props)=>{
|
|
6345
|
-
const { name: name = 'multiple-file-input', label: label, description: description, hint: hint, required: required, value: value, max: max, error: error, isDisabled: isDisabled, isRequired: isRequired = false, isTouched: isTouched = false, isMulti: isMulti = false, children: children, onChange: onChange, onBlur: onBlur, styles: stylesOverrides } = props;
|
|
6468
|
+
const { name: name = 'multiple-file-input', label: label, description: description, hint: hint, required: required, value: value, max: max, accept: accept, error: error, isDisabled: isDisabled, isRequired: isRequired = false, isTouched: isTouched = false, isMulti: isMulti = false, children: children, onChange: onChange, onBlur: onBlur, styles: stylesOverrides } = props;
|
|
6346
6469
|
const isValid = error === undefined;
|
|
6347
6470
|
const [isDragging, setIsDragging] = (0, $4MPRY$useState)(false);
|
|
6348
6471
|
const handleChangeInput = (0, $4MPRY$useCallback)((files)=>{
|
|
@@ -6381,6 +6504,7 @@ const $1a5ad17805feb7b2$var$FileInputGroup = (props)=>{
|
|
|
6381
6504
|
onDrop: onDrop,
|
|
6382
6505
|
multiple: isMulti,
|
|
6383
6506
|
disabled: isDisabled,
|
|
6507
|
+
accept: accept,
|
|
6384
6508
|
onError: ()=>{
|
|
6385
6509
|
// console.log('error');
|
|
6386
6510
|
// setFieldError('file', t('component.form.error.multipleFiles') as string);
|