@cayuse-test/react 1.0.6 → 1.0.8
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/{chunk-QRWUG2FO.js → chunk-SYDHZCBD.js} +111 -38
- package/dist/chunk-SYDHZCBD.js.map +1 -0
- package/dist/components/index.d.ts +35 -1
- package/dist/components/index.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +16 -13
- package/dist/chunk-QRWUG2FO.js.map +0 -1
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
isNonEmptyString,
|
|
21
21
|
isNumber,
|
|
22
22
|
isObject,
|
|
23
|
-
isObjectWithKey,
|
|
24
23
|
isUrl,
|
|
25
24
|
loginWithRedirect,
|
|
26
25
|
request
|
|
@@ -3325,7 +3324,7 @@ var Combobox = React28.forwardRef(
|
|
|
3325
3324
|
const isAsync = isAsyncComponent(props);
|
|
3326
3325
|
const loadOptionsWithHiddenOptionsCount = (inputValue, ...args) => {
|
|
3327
3326
|
return loadOptions(inputValue, ...args).then((result) => {
|
|
3328
|
-
if (
|
|
3327
|
+
if ("options" in result) {
|
|
3329
3328
|
return buildOptions(result.options, {
|
|
3330
3329
|
inputValue,
|
|
3331
3330
|
showNarrowCriteriaHint,
|
|
@@ -3334,8 +3333,36 @@ var Combobox = React28.forwardRef(
|
|
|
3334
3333
|
});
|
|
3335
3334
|
}
|
|
3336
3335
|
return buildOptions(result, { inputValue });
|
|
3336
|
+
}).catch((error) => {
|
|
3337
|
+
console.error("Error loading options:", error);
|
|
3338
|
+
return { options: [] };
|
|
3337
3339
|
});
|
|
3338
3340
|
};
|
|
3341
|
+
const openMenu = (focusOption2) => {
|
|
3342
|
+
const select = selectRef.current;
|
|
3343
|
+
const { selectValue, isFocused } = select.state;
|
|
3344
|
+
const focusableOptions = select.buildFocusableOptions();
|
|
3345
|
+
let openAtIndex = focusOption2 === "first" ? 0 : focusableOptions.length - 1;
|
|
3346
|
+
if (!select.props.isMulti) {
|
|
3347
|
+
const selectedIndex = focusableOptions.indexOf(selectValue[0]);
|
|
3348
|
+
if (selectedIndex > -1) {
|
|
3349
|
+
openAtIndex = selectedIndex;
|
|
3350
|
+
}
|
|
3351
|
+
}
|
|
3352
|
+
while (isNonEmptyString(focusableOptions[openAtIndex]?.subType)) {
|
|
3353
|
+
openAtIndex++;
|
|
3354
|
+
}
|
|
3355
|
+
select.scrollToFocusedOptionOnUpdate = !(isFocused && select.menuListRef);
|
|
3356
|
+
select.setState(
|
|
3357
|
+
{
|
|
3358
|
+
inputIsHiddenAfterUpdate: false,
|
|
3359
|
+
focusedValue: null,
|
|
3360
|
+
focusedOption: focusableOptions[openAtIndex],
|
|
3361
|
+
focusedOptionId: select.getFocusedOptionId(focusableOptions[openAtIndex])
|
|
3362
|
+
},
|
|
3363
|
+
() => select.onMenuOpen()
|
|
3364
|
+
);
|
|
3365
|
+
};
|
|
3339
3366
|
const selectedValueFocusOption = () => {
|
|
3340
3367
|
const select = selectRef.current;
|
|
3341
3368
|
if (!select) return;
|
|
@@ -3373,24 +3400,65 @@ var Combobox = React28.forwardRef(
|
|
|
3373
3400
|
});
|
|
3374
3401
|
}
|
|
3375
3402
|
};
|
|
3403
|
+
const focusOption = (direction) => {
|
|
3404
|
+
const pageSize = selectRef.current.props.pageSize;
|
|
3405
|
+
const focusedOption = selectRef.current.state.focusedOption;
|
|
3406
|
+
const options = selectRef.current.getFocusableOptions();
|
|
3407
|
+
if (!options.length) return;
|
|
3408
|
+
let nextFocus = 0;
|
|
3409
|
+
let focusedIndex = options.indexOf(focusedOption);
|
|
3410
|
+
if (!focusedOption) {
|
|
3411
|
+
focusedIndex = -1;
|
|
3412
|
+
}
|
|
3413
|
+
while (true) {
|
|
3414
|
+
if (direction === "up") {
|
|
3415
|
+
nextFocus = focusedIndex > 0 ? focusedIndex - 1 : options.length - 1;
|
|
3416
|
+
focusedIndex--;
|
|
3417
|
+
} else if (direction === "down") {
|
|
3418
|
+
nextFocus = (focusedIndex + 1) % options.length;
|
|
3419
|
+
focusedIndex++;
|
|
3420
|
+
} else if (direction === "pageup") {
|
|
3421
|
+
nextFocus = focusedIndex - pageSize;
|
|
3422
|
+
if (nextFocus < 0) nextFocus = 0;
|
|
3423
|
+
} else if (direction === "pagedown") {
|
|
3424
|
+
nextFocus = focusedIndex + pageSize;
|
|
3425
|
+
if (nextFocus > options.length - 1) nextFocus = options.length - 1;
|
|
3426
|
+
} else if (direction === "last") {
|
|
3427
|
+
nextFocus = options.length - 1;
|
|
3428
|
+
focusedIndex--;
|
|
3429
|
+
}
|
|
3430
|
+
if (!options[nextFocus]?.subType) {
|
|
3431
|
+
break;
|
|
3432
|
+
}
|
|
3433
|
+
}
|
|
3434
|
+
selectRef.current.scrollToFocusedOptionOnUpdate = true;
|
|
3435
|
+
selectRef.current.setState({
|
|
3436
|
+
focusedOption: options[nextFocus],
|
|
3437
|
+
focusedValue: null,
|
|
3438
|
+
focusedOptionId: selectRef.current.getFocusedOptionId(options[nextFocus])
|
|
3439
|
+
});
|
|
3440
|
+
};
|
|
3376
3441
|
const asyncProps = isAsync ? {
|
|
3377
|
-
cacheOptions: rest.cacheOptions
|
|
3378
|
-
defaultOptions: rest.defaultOptions
|
|
3379
|
-
loadOptions: loadOptions ? loadOptionsWithHiddenOptionsCount : void 0
|
|
3442
|
+
cacheOptions: typeof rest.cacheOptions === "boolean" ? rest.cacheOptions : false,
|
|
3443
|
+
defaultOptions: typeof rest.defaultOptions === "boolean" ? rest.defaultOptions : false,
|
|
3444
|
+
loadOptions: typeof loadOptions === "function" ? loadOptionsWithHiddenOptionsCount : void 0
|
|
3380
3445
|
} : {};
|
|
3381
3446
|
const selectProps = {
|
|
3447
|
+
"aria-label": label,
|
|
3382
3448
|
...rest,
|
|
3383
3449
|
...asyncProps,
|
|
3384
3450
|
ref: (instance) => {
|
|
3385
3451
|
if (instance) {
|
|
3386
3452
|
selectRef.current = instance;
|
|
3453
|
+
selectRef.current.focusOption = focusOption;
|
|
3454
|
+
selectRef.current.openMenu = openMenu;
|
|
3387
3455
|
}
|
|
3388
3456
|
},
|
|
3389
3457
|
selectedValueFocusOption,
|
|
3390
3458
|
allExpanded,
|
|
3391
3459
|
onExpandAllToggle,
|
|
3392
3460
|
updateFocusedOption,
|
|
3393
|
-
describedById: errorMessage || description ? describedById : void 0,
|
|
3461
|
+
describedById: Boolean(errorMessage) || Boolean(description) ? describedById : void 0,
|
|
3394
3462
|
inputId: id ?? internalId,
|
|
3395
3463
|
isInvalid: invalid,
|
|
3396
3464
|
isDisabled: disabled,
|
|
@@ -3413,8 +3481,7 @@ var Combobox = React28.forwardRef(
|
|
|
3413
3481
|
},
|
|
3414
3482
|
noOptionsMessage: noOptionsMessage ? typeof noOptionsMessage === "function" ? noOptionsMessage : () => noOptionsMessage : void 0,
|
|
3415
3483
|
loadingMessage: loadingMessage ? typeof loadingMessage === "function" ? loadingMessage : () => loadingMessage : void 0,
|
|
3416
|
-
unstyled: true
|
|
3417
|
-
"aria-label": label
|
|
3484
|
+
unstyled: true
|
|
3418
3485
|
};
|
|
3419
3486
|
return /* @__PURE__ */ jsxs29(
|
|
3420
3487
|
"fieldset",
|
|
@@ -3669,25 +3736,25 @@ function normalizeUserToOption(userOrPersonObject) {
|
|
|
3669
3736
|
};
|
|
3670
3737
|
}
|
|
3671
3738
|
function UserComboboxOption(props) {
|
|
3672
|
-
const { data, selectProps } = props;
|
|
3739
|
+
const { value, data, selectProps } = props;
|
|
3673
3740
|
const { isSearchable, allExpanded, onExpandAllToggle } = selectProps;
|
|
3741
|
+
const isExpandAllOption = value === "expand-all";
|
|
3674
3742
|
const [isExpanded, setIsExpanded] = useState5(allExpanded);
|
|
3675
|
-
const { isExpandAll } = data;
|
|
3676
3743
|
const innerProps = {
|
|
3677
3744
|
...props.innerProps,
|
|
3678
3745
|
"data-searchable": Boolean(isSearchable)
|
|
3679
3746
|
};
|
|
3680
|
-
if (
|
|
3747
|
+
if (isExpandAllOption) {
|
|
3681
3748
|
innerProps.onClick = (e) => {
|
|
3682
3749
|
e.stopPropagation();
|
|
3683
|
-
onExpandAllToggle(
|
|
3750
|
+
onExpandAllToggle();
|
|
3684
3751
|
};
|
|
3685
3752
|
}
|
|
3686
3753
|
useEffect10(() => {
|
|
3687
|
-
if (!
|
|
3754
|
+
if (!isExpandAllOption) {
|
|
3688
3755
|
setIsExpanded(allExpanded);
|
|
3689
3756
|
}
|
|
3690
|
-
}, [allExpanded,
|
|
3757
|
+
}, [allExpanded, isExpandAllOption]);
|
|
3691
3758
|
if (data.subType === "narrow-criteria-hint") {
|
|
3692
3759
|
innerProps["data-group"] = true;
|
|
3693
3760
|
innerProps.onClick = void 0;
|
|
@@ -3696,37 +3763,43 @@ function UserComboboxOption(props) {
|
|
|
3696
3763
|
}
|
|
3697
3764
|
const handleExpandClick = (e) => {
|
|
3698
3765
|
e.stopPropagation();
|
|
3699
|
-
if (
|
|
3700
|
-
onExpandAllToggle(
|
|
3766
|
+
if (isExpandAllOption) {
|
|
3767
|
+
onExpandAllToggle();
|
|
3701
3768
|
} else {
|
|
3702
3769
|
setIsExpanded(!isExpanded);
|
|
3703
3770
|
}
|
|
3704
3771
|
};
|
|
3705
|
-
const optionLabelText =
|
|
3706
|
-
const optionLabel = /* @__PURE__ */ jsxs31(
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3772
|
+
const optionLabelText = isExpandAllOption ? allExpanded ? "Collapse All" : "Expand All" : data.label;
|
|
3773
|
+
const optionLabel = /* @__PURE__ */ jsxs31(
|
|
3774
|
+
"span",
|
|
3775
|
+
{
|
|
3776
|
+
className: !isExpandAllOption ? "combobox__option-container--indented" : "",
|
|
3777
|
+
children: [
|
|
3778
|
+
/* @__PURE__ */ jsx48("span", { onClick: handleExpandClick, children: /* @__PURE__ */ jsx48(
|
|
3779
|
+
Icon,
|
|
3780
|
+
{
|
|
3781
|
+
color: "grey",
|
|
3782
|
+
name: `chevron-${isExpandAllOption ? allExpanded ? "down" : "right" : isExpanded ? "down" : "right"}`
|
|
3783
|
+
}
|
|
3784
|
+
) }),
|
|
3785
|
+
/* @__PURE__ */ jsx48(
|
|
3786
|
+
"span",
|
|
3787
|
+
{
|
|
3788
|
+
className: isExpandAllOption ? "combobox__option--expand-all-label" : "combobox__option--text",
|
|
3789
|
+
children: optionLabelText
|
|
3790
|
+
}
|
|
3791
|
+
)
|
|
3792
|
+
]
|
|
3793
|
+
}
|
|
3794
|
+
);
|
|
3722
3795
|
return /* @__PURE__ */ jsx48(components2.Option, { ...props, innerProps, children: /* @__PURE__ */ jsxs31("div", { className: "combobox__option-container", children: [
|
|
3723
3796
|
optionLabel,
|
|
3724
|
-
!
|
|
3797
|
+
!isExpandAllOption && isExpanded ? /* @__PURE__ */ jsxs31("div", { className: "combobox__option--expanded", children: [
|
|
3725
3798
|
/* @__PURE__ */ jsx48("div", { children: data.user.email }),
|
|
3726
3799
|
/* @__PURE__ */ jsx48("div", { children: data.user.unitName }),
|
|
3727
3800
|
/* @__PURE__ */ jsx48("div", { children: data.user.profileTypes })
|
|
3728
|
-
] })
|
|
3729
|
-
] }) });
|
|
3801
|
+
] }) : null
|
|
3802
|
+
] }, data.value) });
|
|
3730
3803
|
}
|
|
3731
3804
|
|
|
3732
3805
|
// packages/components/form/user-select/user-select.tsx
|
|
@@ -6424,7 +6497,7 @@ function UserComboboxOption2(props) {
|
|
|
6424
6497
|
Icon,
|
|
6425
6498
|
{
|
|
6426
6499
|
color: "grey",
|
|
6427
|
-
name: `chevron
|
|
6500
|
+
name: `chevron-${isExpandAll ? allExpanded ? "down" : "right" : isExpanded ? "down" : "right"}`
|
|
6428
6501
|
}
|
|
6429
6502
|
) }),
|
|
6430
6503
|
/* @__PURE__ */ jsx67(
|
|
@@ -10334,4 +10407,4 @@ export {
|
|
|
10334
10407
|
MilestoneProgress2 as MilestoneProgress,
|
|
10335
10408
|
TaskFormHeader
|
|
10336
10409
|
};
|
|
10337
|
-
//# sourceMappingURL=chunk-
|
|
10410
|
+
//# sourceMappingURL=chunk-SYDHZCBD.js.map
|