@loomhq/lens 12.7.0 → 12.9.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/README.md +35 -7
- package/dist/cjs/icons/editions-icon.js +40 -0
- package/dist/cjs/icons/editions-icon.js.map +7 -0
- package/dist/cjs/icons/editions.js +9 -2
- package/dist/cjs/icons/editions.js.map +2 -2
- package/dist/cjs/icons/index.js +9 -2
- package/dist/cjs/icons/index.js.map +2 -2
- package/dist/cjs/index.js +459 -194
- package/dist/cjs/index.js.map +4 -4
- package/dist/esm/icons/chunk-SPTM4NUO.js +18 -0
- package/dist/esm/icons/chunk-SPTM4NUO.js.map +7 -0
- package/dist/esm/icons/editions-icon.js +12 -0
- package/dist/esm/icons/editions-icon.js.map +7 -0
- package/dist/esm/icons/editions.js +1 -1
- package/dist/esm/icons/index.js +57 -57
- package/dist/esm/index.js +441 -176
- package/dist/esm/index.js.map +4 -4
- package/dist/types/components/dropdown/dropdown.d.ts +3 -1
- package/dist/types/components/dropdown/dropdown.d.ts.map +1 -1
- package/dist/types/components/icon/available-icons/editions-icon.d.ts +3 -0
- package/dist/types/components/icon/available-icons/editions-icon.d.ts.map +1 -0
- package/dist/types/components/icon/available-icons/editions.d.ts +1 -1
- package/dist/types/components/icon/available-icons/editions.d.ts.map +1 -1
- package/dist/types/components/menu/menu.d.ts +4 -2
- package/dist/types/components/menu/menu.d.ts.map +1 -1
- package/dist/types/components/select/select.d.ts +7 -1
- package/dist/types/components/select/select.d.ts.map +1 -1
- package/dist/types/components/tabs/tabs.d.ts +24 -1
- package/dist/types/components/tabs/tabs.d.ts.map +1 -1
- package/dist/types/components/tooltip/tooltip.d.ts +1 -1
- package/dist/types/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/types/components/typeahead/typeahead.d.ts.map +1 -1
- package/dist/types/icons/editions-icon.d.ts +3 -0
- package/dist/types/icons/editions-icon.d.ts.map +1 -0
- package/dist/types/icons/editions.d.ts +1 -1
- package/dist/types/icons/editions.d.ts.map +1 -1
- package/dist/types/utilities/text.d.ts +3 -0
- package/dist/types/utilities/text.d.ts.map +1 -0
- package/package.json +6 -5
- package/dist/esm/icons/chunk-T4L22EHS.js +0 -11
- package/dist/esm/icons/chunk-T4L22EHS.js.map +0 -7
package/dist/esm/index.js
CHANGED
|
@@ -3465,9 +3465,9 @@ TextButton.displayName = "TextButton";
|
|
|
3465
3465
|
var text_button_default = TextButton;
|
|
3466
3466
|
|
|
3467
3467
|
// src/components/select/select.tsx
|
|
3468
|
-
import
|
|
3468
|
+
import styled19 from "@emotion/styled";
|
|
3469
3469
|
import Downshift from "downshift";
|
|
3470
|
-
import
|
|
3470
|
+
import React25, { useEffect as useEffect2, useState, useMemo } from "react";
|
|
3471
3471
|
import { useLayer } from "react-laag";
|
|
3472
3472
|
import ResizeObserver from "resize-observer-polyfill";
|
|
3473
3473
|
|
|
@@ -3493,6 +3493,29 @@ var getDownshiftEnvironment = (container) => {
|
|
|
3493
3493
|
return window;
|
|
3494
3494
|
};
|
|
3495
3495
|
|
|
3496
|
+
// src/utilities/text.ts
|
|
3497
|
+
var getTextFromNode = (node) => {
|
|
3498
|
+
if (typeof node === "string") {
|
|
3499
|
+
return node;
|
|
3500
|
+
}
|
|
3501
|
+
if (typeof node === "number" || typeof node === "boolean" || typeof node === "bigint") {
|
|
3502
|
+
return node.toString();
|
|
3503
|
+
}
|
|
3504
|
+
if (node === null || node === void 0) {
|
|
3505
|
+
return "";
|
|
3506
|
+
}
|
|
3507
|
+
if (isIterable(node)) {
|
|
3508
|
+
return Array.from(node).map(getTextFromNode).join("");
|
|
3509
|
+
}
|
|
3510
|
+
if (typeof node === "object" && "props" in node && node.props && node.props.children !== void 0) {
|
|
3511
|
+
return getTextFromNode(node.props.children);
|
|
3512
|
+
}
|
|
3513
|
+
return "";
|
|
3514
|
+
};
|
|
3515
|
+
var isIterable = (node) => {
|
|
3516
|
+
return typeof node[Symbol.iterator] === "function";
|
|
3517
|
+
};
|
|
3518
|
+
|
|
3496
3519
|
// src/components/icon/available-icons/chevron-down.tsx
|
|
3497
3520
|
import * as React20 from "react";
|
|
3498
3521
|
function SvgChevronDown() {
|
|
@@ -3593,19 +3616,24 @@ var MenuItem = (_a) => {
|
|
|
3593
3616
|
isSelected,
|
|
3594
3617
|
icon,
|
|
3595
3618
|
hasDivider,
|
|
3596
|
-
children
|
|
3619
|
+
children,
|
|
3620
|
+
menuItemRole
|
|
3597
3621
|
} = _b, props = __objRest(_b, [
|
|
3598
3622
|
"isDisabled",
|
|
3599
3623
|
"isHighlighted",
|
|
3600
3624
|
"isSelected",
|
|
3601
3625
|
"icon",
|
|
3602
3626
|
"hasDivider",
|
|
3603
|
-
"children"
|
|
3627
|
+
"children",
|
|
3628
|
+
"menuItemRole"
|
|
3604
3629
|
]);
|
|
3605
3630
|
const checkColumn = isSelected ? "auto" : "";
|
|
3606
3631
|
const iconColumn = icon ? "auto" : "";
|
|
3607
3632
|
const columns = `${iconColumn} 1fr ${checkColumn}`;
|
|
3608
3633
|
const color = isDisabled ? "disabledContent" : void 0;
|
|
3634
|
+
const updatedProps = menuItemRole ? __spreadProps(__spreadValues({}, props), {
|
|
3635
|
+
role: menuItemRole
|
|
3636
|
+
}) : props;
|
|
3609
3637
|
return /* @__PURE__ */ React22.createElement(
|
|
3610
3638
|
MenuItemWrapper,
|
|
3611
3639
|
__spreadValues({
|
|
@@ -3629,6 +3657,7 @@ var Menu = (_a) => {
|
|
|
3629
3657
|
maxWidth,
|
|
3630
3658
|
maxHeight,
|
|
3631
3659
|
children,
|
|
3660
|
+
role,
|
|
3632
3661
|
downshiftMenuProps = () => null,
|
|
3633
3662
|
search
|
|
3634
3663
|
} = _b, props = __objRest(_b, [
|
|
@@ -3638,9 +3667,13 @@ var Menu = (_a) => {
|
|
|
3638
3667
|
"maxWidth",
|
|
3639
3668
|
"maxHeight",
|
|
3640
3669
|
"children",
|
|
3670
|
+
"role",
|
|
3641
3671
|
"downshiftMenuProps",
|
|
3642
3672
|
"search"
|
|
3643
3673
|
]);
|
|
3674
|
+
const updatedDownshiftMenuProps = role ? __spreadProps(__spreadValues({}, downshiftMenuProps()), {
|
|
3675
|
+
role
|
|
3676
|
+
}) : __spreadValues({}, downshiftMenuProps());
|
|
3644
3677
|
return /* @__PURE__ */ React22.createElement(
|
|
3645
3678
|
MenuContainer,
|
|
3646
3679
|
__spreadValues(__spreadValues({
|
|
@@ -3656,11 +3689,51 @@ var Menu = (_a) => {
|
|
|
3656
3689
|
};
|
|
3657
3690
|
var menu_default = Menu;
|
|
3658
3691
|
|
|
3692
|
+
// src/components/search-bar/search-bar.tsx
|
|
3693
|
+
import styled18 from "@emotion/styled";
|
|
3694
|
+
import React24 from "react";
|
|
3695
|
+
|
|
3696
|
+
// src/components/icon/available-icons/search.tsx
|
|
3697
|
+
import SearchIcon from "@atlaskit/icon/core/search";
|
|
3698
|
+
import * as React23 from "react";
|
|
3699
|
+
function SvgSearch() {
|
|
3700
|
+
return /* @__PURE__ */ React23.createElement(SearchIcon, { label: "", testId: "ads-refreshed-icon" });
|
|
3701
|
+
}
|
|
3702
|
+
|
|
3703
|
+
// src/components/search-bar/search-bar.tsx
|
|
3704
|
+
var SearchBarContainer = styled18.div`
|
|
3705
|
+
padding: ${u(1.5)} ${u(1.5)} 0;
|
|
3706
|
+
margin-bottom: ${u(1.5)};
|
|
3707
|
+
position: sticky;
|
|
3708
|
+
top: 0;
|
|
3709
|
+
`;
|
|
3710
|
+
var SearchBar = ({
|
|
3711
|
+
ariaLabel,
|
|
3712
|
+
placeholder,
|
|
3713
|
+
value,
|
|
3714
|
+
onChange,
|
|
3715
|
+
getInputProps
|
|
3716
|
+
}) => {
|
|
3717
|
+
return /* @__PURE__ */ React24.createElement(SearchBarContainer, null, /* @__PURE__ */ React24.createElement(
|
|
3718
|
+
text_input_default,
|
|
3719
|
+
__spreadValues({
|
|
3720
|
+
"aria-label": ariaLabel,
|
|
3721
|
+
icon: /* @__PURE__ */ React24.createElement(SvgSearch, null)
|
|
3722
|
+
}, getInputProps({
|
|
3723
|
+
placeholder,
|
|
3724
|
+
value,
|
|
3725
|
+
onChange,
|
|
3726
|
+
type: "text"
|
|
3727
|
+
}))
|
|
3728
|
+
));
|
|
3729
|
+
};
|
|
3730
|
+
var search_bar_default = SearchBar;
|
|
3731
|
+
|
|
3659
3732
|
// src/components/select/select.tsx
|
|
3660
|
-
var SelectWrapper =
|
|
3733
|
+
var SelectWrapper = styled19.div`
|
|
3661
3734
|
position: relative;
|
|
3662
3735
|
`;
|
|
3663
|
-
var SelectHeaderWrapper =
|
|
3736
|
+
var SelectHeaderWrapper = styled19.button`
|
|
3664
3737
|
appearance: none;
|
|
3665
3738
|
font: inherit;
|
|
3666
3739
|
text-align: left;
|
|
@@ -3702,7 +3775,7 @@ var SelectHeaderWrapper = styled18.button`
|
|
|
3702
3775
|
cursor: default;
|
|
3703
3776
|
}
|
|
3704
3777
|
`;
|
|
3705
|
-
var Image3 =
|
|
3778
|
+
var Image3 = styled19.img`
|
|
3706
3779
|
height: 100%;
|
|
3707
3780
|
width: auto;
|
|
3708
3781
|
min-width: 100%;
|
|
@@ -3710,12 +3783,12 @@ var Image3 = styled18.img`
|
|
|
3710
3783
|
object-fit: cover;
|
|
3711
3784
|
opacity: ${({ isDisabled }) => isDisabled ? 0.5 : 1};
|
|
3712
3785
|
`;
|
|
3713
|
-
var Group =
|
|
3786
|
+
var Group = styled19.ul`
|
|
3714
3787
|
list-style: none;
|
|
3715
3788
|
margin: 0;
|
|
3716
3789
|
padding: 0;
|
|
3717
3790
|
`;
|
|
3718
|
-
var ErrorMessage =
|
|
3791
|
+
var ErrorMessage = styled19.span`
|
|
3719
3792
|
color: var(--lns-color-red);
|
|
3720
3793
|
margin-top: var(--lns-space-xsmall);
|
|
3721
3794
|
display: block;
|
|
@@ -3769,11 +3842,13 @@ var getHeaderAccessibilityProps = ({
|
|
|
3769
3842
|
selectedItem,
|
|
3770
3843
|
getInputProps,
|
|
3771
3844
|
getToggleButtonProps,
|
|
3772
|
-
ariaMenuName
|
|
3845
|
+
ariaMenuName,
|
|
3846
|
+
isOpen
|
|
3773
3847
|
}) => {
|
|
3774
3848
|
const valueLabel = selectedItem ? `selected value is ${selectedItem.title}` : "no value selected";
|
|
3775
3849
|
const toggleLabel = getToggleButtonProps == null ? void 0 : getToggleButtonProps()["aria-label"];
|
|
3776
3850
|
return {
|
|
3851
|
+
"aria-expanded": isOpen,
|
|
3777
3852
|
// Ensures all options within the list of selections can be narrated by a screen reader
|
|
3778
3853
|
"aria-activedescendant": getInputProps()["aria-activedescendant"],
|
|
3779
3854
|
// The existing aria-label includes whether or not the menu is open or closed, and we add the valueLabel to make a screen reader narrate what is selected
|
|
@@ -3790,7 +3865,8 @@ var SelectHeader = ({
|
|
|
3790
3865
|
options,
|
|
3791
3866
|
getInputProps,
|
|
3792
3867
|
ariaMenuName,
|
|
3793
|
-
hasError
|
|
3868
|
+
hasError,
|
|
3869
|
+
isOpen
|
|
3794
3870
|
}) => {
|
|
3795
3871
|
const icon = getIcon({ options, selectedItem, selectedOptionValue });
|
|
3796
3872
|
const hasIcon = Boolean(icon);
|
|
@@ -3798,33 +3874,34 @@ var SelectHeader = ({
|
|
|
3798
3874
|
const iconColumn = hasIcon ? "auto" : "";
|
|
3799
3875
|
const columns = `${iconColumn} 1fr auto`;
|
|
3800
3876
|
const color = isDisabled ? "disabledContent" : void 0;
|
|
3801
|
-
return /* @__PURE__ */
|
|
3877
|
+
return /* @__PURE__ */ React25.createElement(
|
|
3802
3878
|
SelectHeaderWrapper,
|
|
3803
3879
|
__spreadProps(__spreadValues(__spreadValues({}, getToggleButtonProps()), getHeaderAccessibilityProps({
|
|
3804
3880
|
selectedItem,
|
|
3805
3881
|
getInputProps,
|
|
3806
3882
|
getToggleButtonProps,
|
|
3807
|
-
ariaMenuName
|
|
3883
|
+
ariaMenuName,
|
|
3884
|
+
isOpen
|
|
3808
3885
|
})), {
|
|
3809
3886
|
hasValue: inputValue || selectedOptionValue,
|
|
3810
3887
|
disabled: isDisabled,
|
|
3811
3888
|
columns,
|
|
3812
3889
|
hasError
|
|
3813
3890
|
}),
|
|
3814
|
-
hasIcon && (typeof icon === "string" ? /* @__PURE__ */
|
|
3891
|
+
hasIcon && (typeof icon === "string" ? /* @__PURE__ */ React25.createElement(container_default, { radius: "50", width: 3, height: 3, overflow: "hidden" }, /* @__PURE__ */ React25.createElement(align_default, { alignment: "center" }, /* @__PURE__ */ React25.createElement(Image3, { src: icon, alt: "", isDisabled }))) : /* @__PURE__ */ React25.createElement(
|
|
3815
3892
|
icon_default,
|
|
3816
3893
|
{
|
|
3817
3894
|
icon: getIcon({ options, selectedItem, selectedOptionValue }),
|
|
3818
3895
|
color
|
|
3819
3896
|
}
|
|
3820
3897
|
)),
|
|
3821
|
-
/* @__PURE__ */
|
|
3898
|
+
/* @__PURE__ */ React25.createElement(text_default, { hasEllipsis: true, color: hasPlaceholder ? "bodyDimmed" : "inherit" }, getTitle({
|
|
3822
3899
|
options,
|
|
3823
3900
|
selectedItem,
|
|
3824
3901
|
selectedOptionValue,
|
|
3825
3902
|
selectPlaceholder
|
|
3826
3903
|
})),
|
|
3827
|
-
/* @__PURE__ */
|
|
3904
|
+
/* @__PURE__ */ React25.createElement(icon_default, { icon: /* @__PURE__ */ React25.createElement(SvgChevronDown, null), color })
|
|
3828
3905
|
);
|
|
3829
3906
|
};
|
|
3830
3907
|
var CustomHeader = ({
|
|
@@ -3838,14 +3915,16 @@ var CustomHeader = ({
|
|
|
3838
3915
|
getInputProps,
|
|
3839
3916
|
ariaMenuName,
|
|
3840
3917
|
hasError,
|
|
3841
|
-
errorMessage
|
|
3918
|
+
errorMessage,
|
|
3919
|
+
isOpen
|
|
3842
3920
|
}) => {
|
|
3843
3921
|
const buttonProps = () => {
|
|
3844
3922
|
return __spreadValues(__spreadValues({}, getToggleButtonProps()), getHeaderAccessibilityProps({
|
|
3845
3923
|
selectedItem,
|
|
3846
3924
|
getInputProps,
|
|
3847
3925
|
getToggleButtonProps,
|
|
3848
|
-
ariaMenuName
|
|
3926
|
+
ariaMenuName,
|
|
3927
|
+
isOpen
|
|
3849
3928
|
}));
|
|
3850
3929
|
};
|
|
3851
3930
|
const getSelectedItem = () => {
|
|
@@ -3883,7 +3962,7 @@ var didSelectedOptionValueChange = (selectedOptionValue, prevSelectedItem) => {
|
|
|
3883
3962
|
};
|
|
3884
3963
|
var renderOption = (item, index, selectedItem, selectedOptionValue, highlightedIndex, getItemProps) => {
|
|
3885
3964
|
const isSelected = !selectedItem && item.value === selectedOptionValue || selectedItem && selectedItem.value === item.value;
|
|
3886
|
-
return /* @__PURE__ */
|
|
3965
|
+
return /* @__PURE__ */ React25.createElement(
|
|
3887
3966
|
MenuItem,
|
|
3888
3967
|
__spreadProps(__spreadValues({
|
|
3889
3968
|
key: index,
|
|
@@ -3911,16 +3990,18 @@ var SelectMenu = (_a) => {
|
|
|
3911
3990
|
selectedItem,
|
|
3912
3991
|
selectedOptionValue,
|
|
3913
3992
|
highlightedIndex,
|
|
3914
|
-
getItemProps
|
|
3993
|
+
getItemProps,
|
|
3994
|
+
search
|
|
3915
3995
|
} = _b, menuProps = __objRest(_b, [
|
|
3916
3996
|
"options",
|
|
3917
3997
|
"selectedItem",
|
|
3918
3998
|
"selectedOptionValue",
|
|
3919
3999
|
"highlightedIndex",
|
|
3920
|
-
"getItemProps"
|
|
4000
|
+
"getItemProps",
|
|
4001
|
+
"search"
|
|
3921
4002
|
]);
|
|
3922
4003
|
if (!isGrouped(options)) {
|
|
3923
|
-
return /* @__PURE__ */
|
|
4004
|
+
return /* @__PURE__ */ React25.createElement(menu_default, __spreadValues({ search }, menuProps), options.map(
|
|
3924
4005
|
(item, index) => renderOption(
|
|
3925
4006
|
item,
|
|
3926
4007
|
index,
|
|
@@ -3932,9 +4013,9 @@ var SelectMenu = (_a) => {
|
|
|
3932
4013
|
));
|
|
3933
4014
|
}
|
|
3934
4015
|
let downshiftIndex = 0;
|
|
3935
|
-
return /* @__PURE__ */
|
|
4016
|
+
return /* @__PURE__ */ React25.createElement(menu_default, __spreadValues({ search }, menuProps), options.map((group) => {
|
|
3936
4017
|
const groupId = `group-${group.group.replace(/\s+/g, "-")}`;
|
|
3937
|
-
return /* @__PURE__ */
|
|
4018
|
+
return /* @__PURE__ */ React25.createElement("li", { key: groupId }, /* @__PURE__ */ React25.createElement(spacer_default, { left: "medium", top: "small", bottom: "xsmall" }, /* @__PURE__ */ React25.createElement(text_default, { id: groupId, size: "body-sm", fontWeight: "bold" }, group.group)), /* @__PURE__ */ React25.createElement(Group, { role: "group", "aria-labelledby": groupId }, group.items.map((item) => {
|
|
3938
4019
|
return renderOption(
|
|
3939
4020
|
item,
|
|
3940
4021
|
downshiftIndex++,
|
|
@@ -3954,6 +4035,7 @@ var Select = (_a) => {
|
|
|
3954
4035
|
menuMaxWidth,
|
|
3955
4036
|
menuMaxHeight = 34,
|
|
3956
4037
|
menuMinWidth,
|
|
4038
|
+
triggerOffset = 0,
|
|
3957
4039
|
ariaMenuName,
|
|
3958
4040
|
selectedOptionValue,
|
|
3959
4041
|
onOuterClick,
|
|
@@ -3964,7 +4046,8 @@ var Select = (_a) => {
|
|
|
3964
4046
|
onOpenChange,
|
|
3965
4047
|
trigger,
|
|
3966
4048
|
hasError,
|
|
3967
|
-
errorMessage = "Oops, that didn't work."
|
|
4049
|
+
errorMessage = "Oops, that didn't work.",
|
|
4050
|
+
search
|
|
3968
4051
|
} = _b, props = __objRest(_b, [
|
|
3969
4052
|
"container",
|
|
3970
4053
|
"onChange",
|
|
@@ -3972,6 +4055,7 @@ var Select = (_a) => {
|
|
|
3972
4055
|
"menuMaxWidth",
|
|
3973
4056
|
"menuMaxHeight",
|
|
3974
4057
|
"menuMinWidth",
|
|
4058
|
+
"triggerOffset",
|
|
3975
4059
|
"ariaMenuName",
|
|
3976
4060
|
"selectedOptionValue",
|
|
3977
4061
|
"onOuterClick",
|
|
@@ -3982,10 +4066,16 @@ var Select = (_a) => {
|
|
|
3982
4066
|
"onOpenChange",
|
|
3983
4067
|
"trigger",
|
|
3984
4068
|
"hasError",
|
|
3985
|
-
"errorMessage"
|
|
4069
|
+
"errorMessage",
|
|
4070
|
+
"search"
|
|
3986
4071
|
]);
|
|
3987
4072
|
const environment = getDownshiftEnvironment(container);
|
|
3988
4073
|
const [downshiftIsOpen, setDownshiftIsOpen] = useState(false);
|
|
4074
|
+
const [searchValue, setSearchValue] = useState("");
|
|
4075
|
+
const onSearchChange = (e) => {
|
|
4076
|
+
const value = e.target.value;
|
|
4077
|
+
setSearchValue(value);
|
|
4078
|
+
};
|
|
3989
4079
|
const [prevSelectedItem, setPrevSelectedItem] = useState(
|
|
3990
4080
|
getSelectedOption(selectedOptionValue, options)
|
|
3991
4081
|
);
|
|
@@ -4011,7 +4101,8 @@ var Select = (_a) => {
|
|
|
4011
4101
|
ResizeObserver,
|
|
4012
4102
|
placement: menuPositions[menuPosition],
|
|
4013
4103
|
auto: true,
|
|
4014
|
-
snap: true
|
|
4104
|
+
snap: true,
|
|
4105
|
+
triggerOffset
|
|
4015
4106
|
});
|
|
4016
4107
|
useEffect2(() => {
|
|
4017
4108
|
if (didSelectedOptionValueChange(selectedOptionValue, prevSelectedItem)) {
|
|
@@ -4033,7 +4124,42 @@ var Select = (_a) => {
|
|
|
4033
4124
|
}
|
|
4034
4125
|
return changes;
|
|
4035
4126
|
};
|
|
4036
|
-
|
|
4127
|
+
options = useMemo(() => {
|
|
4128
|
+
if (search) {
|
|
4129
|
+
if (isGrouped(options)) {
|
|
4130
|
+
let filteredGroups;
|
|
4131
|
+
if (search.searchType === "startsWith") {
|
|
4132
|
+
filteredGroups = options.map((group) => __spreadProps(__spreadValues({}, group), {
|
|
4133
|
+
items: group.items.filter(
|
|
4134
|
+
(item) => getTextFromNode(item.title).toLowerCase().startsWith(searchValue.toLowerCase())
|
|
4135
|
+
)
|
|
4136
|
+
}));
|
|
4137
|
+
} else {
|
|
4138
|
+
filteredGroups = options.map((group) => __spreadProps(__spreadValues({}, group), {
|
|
4139
|
+
items: group.items.filter(
|
|
4140
|
+
(item) => getTextFromNode(item.title).toLowerCase().includes(searchValue.toLowerCase())
|
|
4141
|
+
)
|
|
4142
|
+
}));
|
|
4143
|
+
}
|
|
4144
|
+
return filteredGroups.reduce((acc, group) => {
|
|
4145
|
+
if (group.items.length > 0) {
|
|
4146
|
+
acc.push(group);
|
|
4147
|
+
}
|
|
4148
|
+
return acc;
|
|
4149
|
+
}, []);
|
|
4150
|
+
}
|
|
4151
|
+
if (search.searchType === "startsWith") {
|
|
4152
|
+
return options.filter(
|
|
4153
|
+
(option) => getTextFromNode(option.title).toLowerCase().startsWith(searchValue.toLowerCase())
|
|
4154
|
+
);
|
|
4155
|
+
}
|
|
4156
|
+
return options.filter(
|
|
4157
|
+
(option) => getTextFromNode(option.title).toLowerCase().includes(searchValue.toLowerCase())
|
|
4158
|
+
);
|
|
4159
|
+
}
|
|
4160
|
+
return options;
|
|
4161
|
+
}, [options, searchValue, search]);
|
|
4162
|
+
return /* @__PURE__ */ React25.createElement(SelectWrapper, __spreadValues({}, props), /* @__PURE__ */ React25.createElement(Downshift, __spreadProps(__spreadValues({}, downshiftProps), { stateReducer }), ({
|
|
4037
4163
|
getItemProps,
|
|
4038
4164
|
getInputProps,
|
|
4039
4165
|
getMenuProps,
|
|
@@ -4045,7 +4171,7 @@ var Select = (_a) => {
|
|
|
4045
4171
|
}) => {
|
|
4046
4172
|
return (
|
|
4047
4173
|
// Don't set the role to combobox to ensure a consistent experience for screen readers
|
|
4048
|
-
/* @__PURE__ */
|
|
4174
|
+
/* @__PURE__ */ React25.createElement("div", { role: "presentation" }, /* @__PURE__ */ React25.createElement("div", __spreadValues({}, triggerProps), trigger ? /* @__PURE__ */ React25.createElement(
|
|
4049
4175
|
CustomHeader,
|
|
4050
4176
|
{
|
|
4051
4177
|
getToggleButtonProps,
|
|
@@ -4058,9 +4184,10 @@ var Select = (_a) => {
|
|
|
4058
4184
|
getInputProps,
|
|
4059
4185
|
ariaMenuName,
|
|
4060
4186
|
hasError,
|
|
4061
|
-
errorMessage
|
|
4187
|
+
errorMessage,
|
|
4188
|
+
isOpen
|
|
4062
4189
|
}
|
|
4063
|
-
) : /* @__PURE__ */
|
|
4190
|
+
) : /* @__PURE__ */ React25.createElement(
|
|
4064
4191
|
SelectHeader,
|
|
4065
4192
|
{
|
|
4066
4193
|
getToggleButtonProps,
|
|
@@ -4072,10 +4199,11 @@ var Select = (_a) => {
|
|
|
4072
4199
|
isDisabled,
|
|
4073
4200
|
getInputProps,
|
|
4074
4201
|
ariaMenuName,
|
|
4075
|
-
hasError
|
|
4202
|
+
hasError,
|
|
4203
|
+
isOpen
|
|
4076
4204
|
}
|
|
4077
4205
|
)), downshiftIsOpen && isOpen && renderLayer(
|
|
4078
|
-
/* @__PURE__ */
|
|
4206
|
+
/* @__PURE__ */ React25.createElement(
|
|
4079
4207
|
"div",
|
|
4080
4208
|
__spreadProps(__spreadValues({}, layerProps), {
|
|
4081
4209
|
style: __spreadProps(__spreadValues({}, layerProps.style), {
|
|
@@ -4083,7 +4211,7 @@ var Select = (_a) => {
|
|
|
4083
4211
|
width: menuMinWidth ? "auto" : triggerBounds == null ? void 0 : triggerBounds.width
|
|
4084
4212
|
})
|
|
4085
4213
|
}),
|
|
4086
|
-
/* @__PURE__ */
|
|
4214
|
+
/* @__PURE__ */ React25.createElement(
|
|
4087
4215
|
SelectMenu,
|
|
4088
4216
|
{
|
|
4089
4217
|
options,
|
|
@@ -4095,19 +4223,29 @@ var Select = (_a) => {
|
|
|
4095
4223
|
downshiftMenuProps: getMenuProps,
|
|
4096
4224
|
maxWidth: menuMaxWidth,
|
|
4097
4225
|
maxHeight: menuMaxHeight,
|
|
4098
|
-
minWidth: menuMinWidth
|
|
4226
|
+
minWidth: menuMinWidth,
|
|
4227
|
+
search: search && /* @__PURE__ */ React25.createElement(
|
|
4228
|
+
search_bar_default,
|
|
4229
|
+
{
|
|
4230
|
+
ariaLabel: search.searchPlaceholder,
|
|
4231
|
+
placeholder: search.searchPlaceholder,
|
|
4232
|
+
value: searchValue,
|
|
4233
|
+
onChange: onSearchChange,
|
|
4234
|
+
getInputProps
|
|
4235
|
+
}
|
|
4236
|
+
)
|
|
4099
4237
|
}
|
|
4100
4238
|
)
|
|
4101
4239
|
)
|
|
4102
|
-
), hasError && !downshiftIsOpen && /* @__PURE__ */
|
|
4240
|
+
), hasError && !downshiftIsOpen && /* @__PURE__ */ React25.createElement(ErrorMessage, null, errorMessage))
|
|
4103
4241
|
);
|
|
4104
4242
|
}));
|
|
4105
4243
|
};
|
|
4106
4244
|
var select_default = Select;
|
|
4107
4245
|
|
|
4108
4246
|
// src/components/backdrop/backdrop.tsx
|
|
4109
|
-
import
|
|
4110
|
-
import
|
|
4247
|
+
import styled20 from "@emotion/styled";
|
|
4248
|
+
import React26 from "react";
|
|
4111
4249
|
import { useTransition } from "transition-hook";
|
|
4112
4250
|
|
|
4113
4251
|
// src/hooks/use-prevent-scroll.ts
|
|
@@ -4173,7 +4311,7 @@ var use_prevent_scroll_default = usePreventScroll;
|
|
|
4173
4311
|
|
|
4174
4312
|
// src/components/backdrop/backdrop.tsx
|
|
4175
4313
|
var duration = 300;
|
|
4176
|
-
var BackdropWrapper =
|
|
4314
|
+
var BackdropWrapper = styled20.div`
|
|
4177
4315
|
position: fixed;
|
|
4178
4316
|
top: 0;
|
|
4179
4317
|
left: 0;
|
|
@@ -4183,7 +4321,7 @@ var BackdropWrapper = styled19.div`
|
|
|
4183
4321
|
z-index: ${(props) => props.zIndex};
|
|
4184
4322
|
overflow: hidden;
|
|
4185
4323
|
`;
|
|
4186
|
-
var ChildrenWrapper =
|
|
4324
|
+
var ChildrenWrapper = styled20.div`
|
|
4187
4325
|
overflow: auto;
|
|
4188
4326
|
height: 100%;
|
|
4189
4327
|
`;
|
|
@@ -4201,7 +4339,7 @@ var Backdrop = (_a) => {
|
|
|
4201
4339
|
]);
|
|
4202
4340
|
const { stage, shouldMount } = useTransition(isOpen, duration);
|
|
4203
4341
|
use_prevent_scroll_default("html", isOpen);
|
|
4204
|
-
return /* @__PURE__ */
|
|
4342
|
+
return /* @__PURE__ */ React26.createElement(React26.Fragment, null, shouldMount && /* @__PURE__ */ React26.createElement(
|
|
4205
4343
|
BackdropWrapper,
|
|
4206
4344
|
__spreadValues({
|
|
4207
4345
|
backgroundColor,
|
|
@@ -4211,31 +4349,31 @@ var Backdrop = (_a) => {
|
|
|
4211
4349
|
opacity: stage === "enter" ? 1 : 0
|
|
4212
4350
|
}
|
|
4213
4351
|
}, props),
|
|
4214
|
-
/* @__PURE__ */
|
|
4352
|
+
/* @__PURE__ */ React26.createElement(ChildrenWrapper, null, children)
|
|
4215
4353
|
));
|
|
4216
4354
|
};
|
|
4217
4355
|
var backdrop_default = Backdrop;
|
|
4218
4356
|
|
|
4219
4357
|
// src/components/modal/modal.tsx
|
|
4220
|
-
import
|
|
4358
|
+
import styled21 from "@emotion/styled";
|
|
4221
4359
|
import FocusTrap from "focus-trap-react";
|
|
4222
|
-
import
|
|
4360
|
+
import React28, { useEffect as useEffect3 } from "react";
|
|
4223
4361
|
|
|
4224
4362
|
// src/components/icon/available-icons/close.tsx
|
|
4225
4363
|
import CloseIcon from "@atlaskit/icon/core/close";
|
|
4226
|
-
import * as
|
|
4364
|
+
import * as React27 from "react";
|
|
4227
4365
|
function SvgClose() {
|
|
4228
|
-
return /* @__PURE__ */
|
|
4366
|
+
return /* @__PURE__ */ React27.createElement(CloseIcon, { label: "", testId: "ads-refreshed-icon" });
|
|
4229
4367
|
}
|
|
4230
4368
|
|
|
4231
4369
|
// src/components/modal/modal.tsx
|
|
4232
4370
|
var DEFAULT_MODAL_CARD_HEIGHT = "70vh";
|
|
4233
|
-
var ContentWrapper =
|
|
4371
|
+
var ContentWrapper = styled21.div`
|
|
4234
4372
|
display: grid;
|
|
4235
4373
|
grid-template-rows: ${(props) => props.rows};
|
|
4236
4374
|
position: relative;
|
|
4237
4375
|
`;
|
|
4238
|
-
var ModalCardWrapper =
|
|
4376
|
+
var ModalCardWrapper = styled21.dialog`
|
|
4239
4377
|
top: ${(props) => getPlacement(getSizeValue(props.maxHeight), props.placement).top};
|
|
4240
4378
|
background-color: ${getColorValue("overlay")};
|
|
4241
4379
|
color: ${getColorValue("body")};
|
|
@@ -4258,27 +4396,27 @@ var ModalCardWrapper = styled20.dialog`
|
|
|
4258
4396
|
background: var(--lns-color-overlay);
|
|
4259
4397
|
}
|
|
4260
4398
|
`;
|
|
4261
|
-
var CloseIconSection =
|
|
4399
|
+
var CloseIconSection = styled21.div`
|
|
4262
4400
|
position: absolute;
|
|
4263
4401
|
top: ${u(1.5)};
|
|
4264
4402
|
right: ${u(1.5)};
|
|
4265
4403
|
z-index: 1;
|
|
4266
4404
|
`;
|
|
4267
|
-
var RightButtonsSection =
|
|
4405
|
+
var RightButtonsSection = styled21.div`
|
|
4268
4406
|
margin-left: auto;
|
|
4269
4407
|
|
|
4270
4408
|
* {
|
|
4271
4409
|
vertical-align: middle;
|
|
4272
4410
|
}
|
|
4273
4411
|
`;
|
|
4274
|
-
var TitleSection =
|
|
4412
|
+
var TitleSection = styled21.div`
|
|
4275
4413
|
padding-left: var(--lns-space-xlarge);
|
|
4276
4414
|
padding-right: var(--lns-space-xlarge);
|
|
4277
4415
|
padding-top: var(--lns-space-xlarge);
|
|
4278
4416
|
padding-bottom: ${(props) => props.bottom};
|
|
4279
4417
|
flex-shrink: 0;
|
|
4280
4418
|
`;
|
|
4281
|
-
var ButtonsSection =
|
|
4419
|
+
var ButtonsSection = styled21.div`
|
|
4282
4420
|
padding-left: var(--lns-space-xlarge);
|
|
4283
4421
|
padding-right: var(--lns-space-xlarge);
|
|
4284
4422
|
padding-bottom: var(--lns-space-xlarge);
|
|
@@ -4288,7 +4426,7 @@ var ButtonsSection = styled20.div`
|
|
|
4288
4426
|
justify-content: space-between;
|
|
4289
4427
|
align-items: center;
|
|
4290
4428
|
`;
|
|
4291
|
-
var ChildrenSection2 =
|
|
4429
|
+
var ChildrenSection2 = styled21.div`
|
|
4292
4430
|
display: flex;
|
|
4293
4431
|
flex-direction: column;
|
|
4294
4432
|
overflow: auto;
|
|
@@ -4300,7 +4438,7 @@ var ChildrenSection2 = styled20.div`
|
|
|
4300
4438
|
border-color: ${getColorValue("border")};
|
|
4301
4439
|
border-width: ${(props) => props.hasDividers ? "1px 0" : "0"};
|
|
4302
4440
|
`;
|
|
4303
|
-
var ModalCardChildrenSection =
|
|
4441
|
+
var ModalCardChildrenSection = styled21.div`
|
|
4304
4442
|
overflow: auto;
|
|
4305
4443
|
|
|
4306
4444
|
${(props) => getMaxHeight(props.maxHeight)};
|
|
@@ -4358,7 +4496,7 @@ var ModalCard = (_a) => {
|
|
|
4358
4496
|
};
|
|
4359
4497
|
}, [isOpen, onCloseClick]);
|
|
4360
4498
|
use_prevent_scroll_default("html", isOpen);
|
|
4361
|
-
return /* @__PURE__ */
|
|
4499
|
+
return /* @__PURE__ */ React28.createElement(
|
|
4362
4500
|
FocusTrap,
|
|
4363
4501
|
{
|
|
4364
4502
|
active: isOpen,
|
|
@@ -4367,7 +4505,7 @@ var ModalCard = (_a) => {
|
|
|
4367
4505
|
allowOutsideClick: true
|
|
4368
4506
|
}, initialFocus !== void 0 ? { initialFocus } : {})
|
|
4369
4507
|
},
|
|
4370
|
-
/* @__PURE__ */
|
|
4508
|
+
/* @__PURE__ */ React28.createElement(
|
|
4371
4509
|
ModalCardWrapper,
|
|
4372
4510
|
__spreadValues({
|
|
4373
4511
|
open: isOpen,
|
|
@@ -4380,15 +4518,15 @@ var ModalCard = (_a) => {
|
|
|
4380
4518
|
"aria-modal": ariaModal,
|
|
4381
4519
|
"aria-labelledby": ariaLabelledBy
|
|
4382
4520
|
}, props),
|
|
4383
|
-
!removeClose && onCloseClick && /* @__PURE__ */
|
|
4521
|
+
!removeClose && onCloseClick && /* @__PURE__ */ React28.createElement(CloseIconSection, null, /* @__PURE__ */ React28.createElement(
|
|
4384
4522
|
icon_button_default,
|
|
4385
4523
|
{
|
|
4386
4524
|
altText: "Close",
|
|
4387
|
-
icon: /* @__PURE__ */
|
|
4525
|
+
icon: /* @__PURE__ */ React28.createElement(SvgClose, null),
|
|
4388
4526
|
onClick: onCloseClick
|
|
4389
4527
|
}
|
|
4390
4528
|
)),
|
|
4391
|
-
/* @__PURE__ */
|
|
4529
|
+
/* @__PURE__ */ React28.createElement(
|
|
4392
4530
|
ModalCardChildrenSection,
|
|
4393
4531
|
__spreadProps(__spreadValues({}, removeClose ? { tabIndex: 0 } : { tabIndex: -1 }), {
|
|
4394
4532
|
maxHeight
|
|
@@ -4398,7 +4536,7 @@ var ModalCard = (_a) => {
|
|
|
4398
4536
|
)
|
|
4399
4537
|
);
|
|
4400
4538
|
};
|
|
4401
|
-
var Modal =
|
|
4539
|
+
var Modal = React28.forwardRef(
|
|
4402
4540
|
(_a, ref) => {
|
|
4403
4541
|
var _b = _a, {
|
|
4404
4542
|
children,
|
|
@@ -4454,14 +4592,14 @@ var Modal = React26.forwardRef(
|
|
|
4454
4592
|
}
|
|
4455
4593
|
onCloseClick(e);
|
|
4456
4594
|
};
|
|
4457
|
-
return /* @__PURE__ */
|
|
4595
|
+
return /* @__PURE__ */ React28.createElement(backdrop_default, __spreadValues({ isOpen, zIndex }, props), /* @__PURE__ */ React28.createElement(
|
|
4458
4596
|
container_default,
|
|
4459
4597
|
{
|
|
4460
4598
|
height: "100%",
|
|
4461
4599
|
onClick: closeClickHandler,
|
|
4462
4600
|
onKeyDown
|
|
4463
4601
|
},
|
|
4464
|
-
/* @__PURE__ */
|
|
4602
|
+
/* @__PURE__ */ React28.createElement(
|
|
4465
4603
|
ModalCard,
|
|
4466
4604
|
{
|
|
4467
4605
|
ref,
|
|
@@ -4476,19 +4614,19 @@ var Modal = React26.forwardRef(
|
|
|
4476
4614
|
ariaLabelledBy: (_a2 = ariaLabelledBy != null ? ariaLabelledBy : titleId) != null ? _a2 : void 0,
|
|
4477
4615
|
initialFocus
|
|
4478
4616
|
},
|
|
4479
|
-
/* @__PURE__ */
|
|
4617
|
+
/* @__PURE__ */ React28.createElement(
|
|
4480
4618
|
ContentWrapper,
|
|
4481
4619
|
{
|
|
4482
4620
|
rows: `${title ? "auto " : ""} ${children ? "1fr " : ""} ${hasButtons ? "auto" : ""}`
|
|
4483
4621
|
},
|
|
4484
|
-
title && /* @__PURE__ */
|
|
4622
|
+
title && /* @__PURE__ */ React28.createElement(
|
|
4485
4623
|
TitleSection,
|
|
4486
4624
|
{
|
|
4487
4625
|
bottom: children ? "var(--lns-space-medium)" : "var(--lns-space-xlarge)"
|
|
4488
4626
|
},
|
|
4489
|
-
/* @__PURE__ */
|
|
4627
|
+
/* @__PURE__ */ React28.createElement(text_default, { htmlTag: "h1", variant: "title", id: titleId }, title)
|
|
4490
4628
|
),
|
|
4491
|
-
/* @__PURE__ */
|
|
4629
|
+
/* @__PURE__ */ React28.createElement(
|
|
4492
4630
|
ChildrenSection2,
|
|
4493
4631
|
{
|
|
4494
4632
|
noPadding,
|
|
@@ -4498,14 +4636,14 @@ var Modal = React26.forwardRef(
|
|
|
4498
4636
|
},
|
|
4499
4637
|
children && children
|
|
4500
4638
|
),
|
|
4501
|
-
hasButtons && /* @__PURE__ */
|
|
4639
|
+
hasButtons && /* @__PURE__ */ React28.createElement(
|
|
4502
4640
|
ButtonsSection,
|
|
4503
4641
|
{
|
|
4504
4642
|
top: children ? "var(--lns-space-xlarge)" : 0,
|
|
4505
4643
|
hasDividers
|
|
4506
4644
|
},
|
|
4507
4645
|
alternativeButton,
|
|
4508
|
-
/* @__PURE__ */
|
|
4646
|
+
/* @__PURE__ */ React28.createElement(RightButtonsSection, null, secondaryButton && /* @__PURE__ */ React28.createElement(spacer_default, { right: "small", isInline: true }, secondaryButton), mainButton)
|
|
4509
4647
|
)
|
|
4510
4648
|
)
|
|
4511
4649
|
)
|
|
@@ -4516,8 +4654,8 @@ var modal_default = Modal;
|
|
|
4516
4654
|
|
|
4517
4655
|
// src/components/link/link.tsx
|
|
4518
4656
|
import { css as css3 } from "@emotion/react";
|
|
4519
|
-
import
|
|
4520
|
-
import
|
|
4657
|
+
import styled22 from "@emotion/styled";
|
|
4658
|
+
import React29 from "react";
|
|
4521
4659
|
var variants2 = {
|
|
4522
4660
|
neutral: {
|
|
4523
4661
|
color: getColorValue("inherit"),
|
|
@@ -4551,7 +4689,7 @@ var buttonStyles = {
|
|
|
4551
4689
|
font: inherit;
|
|
4552
4690
|
`
|
|
4553
4691
|
};
|
|
4554
|
-
var LinkWrapper =
|
|
4692
|
+
var LinkWrapper = styled22.a`
|
|
4555
4693
|
${(props) => !props.disabled && `color: ${variants2[props.variant].color}`};
|
|
4556
4694
|
${(props) => props.disabled ? statusStyles2.disabled : statusStyles2.enabled};
|
|
4557
4695
|
${(props) => props.as === "button" && buttonStyles.isButton};
|
|
@@ -4588,7 +4726,7 @@ var Link = (_a) => {
|
|
|
4588
4726
|
"htmlTag",
|
|
4589
4727
|
"isDisabled"
|
|
4590
4728
|
]);
|
|
4591
|
-
return /* @__PURE__ */
|
|
4729
|
+
return /* @__PURE__ */ React29.createElement(
|
|
4592
4730
|
LinkWrapper,
|
|
4593
4731
|
__spreadValues({
|
|
4594
4732
|
href,
|
|
@@ -4603,8 +4741,8 @@ var availableVariants2 = Object.keys(variants2);
|
|
|
4603
4741
|
var link_default = Link;
|
|
4604
4742
|
|
|
4605
4743
|
// src/components/textarea/textarea.tsx
|
|
4606
|
-
import
|
|
4607
|
-
import
|
|
4744
|
+
import styled23 from "@emotion/styled";
|
|
4745
|
+
import React30 from "react";
|
|
4608
4746
|
var sizesStyles3 = {
|
|
4609
4747
|
small: {
|
|
4610
4748
|
padding: `${u(1.5)} ${u(1.75)}`,
|
|
@@ -4615,7 +4753,7 @@ var sizesStyles3 = {
|
|
|
4615
4753
|
textSize: "medium"
|
|
4616
4754
|
}
|
|
4617
4755
|
};
|
|
4618
|
-
var TextareaWrapper =
|
|
4756
|
+
var TextareaWrapper = styled23.textarea`
|
|
4619
4757
|
width: 100%;
|
|
4620
4758
|
border: none;
|
|
4621
4759
|
font-family: inherit;
|
|
@@ -4654,7 +4792,7 @@ var TextareaWrapper = styled22.textarea`
|
|
|
4654
4792
|
color: ${getColorValue("bodyDimmed")};
|
|
4655
4793
|
}
|
|
4656
4794
|
`;
|
|
4657
|
-
var Textarea =
|
|
4795
|
+
var Textarea = React30.forwardRef(
|
|
4658
4796
|
(_a, ref) => {
|
|
4659
4797
|
var _b = _a, {
|
|
4660
4798
|
onChange,
|
|
@@ -4675,7 +4813,7 @@ var Textarea = React28.forwardRef(
|
|
|
4675
4813
|
"resize",
|
|
4676
4814
|
"error"
|
|
4677
4815
|
]);
|
|
4678
|
-
return /* @__PURE__ */
|
|
4816
|
+
return /* @__PURE__ */ React30.createElement(React30.Fragment, null, /* @__PURE__ */ React30.createElement(
|
|
4679
4817
|
TextareaWrapper,
|
|
4680
4818
|
__spreadValues({
|
|
4681
4819
|
disabled: isDisabled,
|
|
@@ -4688,33 +4826,33 @@ var Textarea = React28.forwardRef(
|
|
|
4688
4826
|
resize,
|
|
4689
4827
|
error
|
|
4690
4828
|
}, props)
|
|
4691
|
-
), error ? /* @__PURE__ */
|
|
4829
|
+
), error ? /* @__PURE__ */ React30.createElement(React30.Fragment, null, /* @__PURE__ */ React30.createElement(spacer_default, { bottom: "xmsall" }), /* @__PURE__ */ React30.createElement(text_default, { color: "danger", fontWeight: "regular", size: "body-md" }, error)) : null);
|
|
4692
4830
|
}
|
|
4693
4831
|
);
|
|
4694
4832
|
var textarea_default = Textarea;
|
|
4695
4833
|
|
|
4696
4834
|
// src/components/typeahead/typeahead.tsx
|
|
4697
|
-
import
|
|
4835
|
+
import styled24 from "@emotion/styled";
|
|
4698
4836
|
import Downshift2 from "downshift";
|
|
4699
|
-
import
|
|
4837
|
+
import React31, {
|
|
4700
4838
|
useEffect as useEffect4,
|
|
4701
4839
|
useState as useState2,
|
|
4702
|
-
useMemo,
|
|
4840
|
+
useMemo as useMemo2,
|
|
4703
4841
|
forwardRef as forwardRef3,
|
|
4704
4842
|
useRef as useRef2,
|
|
4705
4843
|
useCallback as useCallback2
|
|
4706
4844
|
} from "react";
|
|
4707
4845
|
import { useLayer as useLayer2 } from "react-laag";
|
|
4708
4846
|
import ResizeObserver2 from "resize-observer-polyfill";
|
|
4709
|
-
var TypeaheadWrapper =
|
|
4847
|
+
var TypeaheadWrapper = styled24.div`
|
|
4710
4848
|
position: relative;
|
|
4711
4849
|
`;
|
|
4712
|
-
var Group2 =
|
|
4850
|
+
var Group2 = styled24.ul`
|
|
4713
4851
|
list-style: none;
|
|
4714
4852
|
margin: 0;
|
|
4715
4853
|
padding: 0;
|
|
4716
4854
|
`;
|
|
4717
|
-
var ErrorMessage2 =
|
|
4855
|
+
var ErrorMessage2 = styled24.span`
|
|
4718
4856
|
color: var(--lns-color-red);
|
|
4719
4857
|
margin-top: var(--lns-space-xsmall);
|
|
4720
4858
|
display: block;
|
|
@@ -4777,7 +4915,7 @@ var getHeaderAccessibilityProps2 = ({
|
|
|
4777
4915
|
"aria-label": [ariaMenuName, valueLabel].filter(Boolean).join(", ")
|
|
4778
4916
|
};
|
|
4779
4917
|
};
|
|
4780
|
-
var TypeaheadHeaderWrapper =
|
|
4918
|
+
var TypeaheadHeaderWrapper = styled24.button`
|
|
4781
4919
|
position: relative;
|
|
4782
4920
|
width: 100%;
|
|
4783
4921
|
background: none;
|
|
@@ -4792,7 +4930,7 @@ var TypeaheadHeaderWrapper = styled23.button`
|
|
|
4792
4930
|
cursor: default;
|
|
4793
4931
|
}
|
|
4794
4932
|
`;
|
|
4795
|
-
var TypeaheadInputField =
|
|
4933
|
+
var TypeaheadInputField = styled24.input`
|
|
4796
4934
|
-webkit-appearance: none;
|
|
4797
4935
|
font-family: inherit;
|
|
4798
4936
|
width: 100%;
|
|
@@ -4803,6 +4941,7 @@ var TypeaheadInputField = styled23.input`
|
|
|
4803
4941
|
transition: 0.3s box-shadow;
|
|
4804
4942
|
padding-top: 0;
|
|
4805
4943
|
padding-bottom: 0;
|
|
4944
|
+
id: ${(props) => props.id};
|
|
4806
4945
|
padding-left: ${(props) => props.hasIcon ? u(5.5) : "var(--lns-formFieldHorizontalPadding)"};
|
|
4807
4946
|
padding-right: ${(props) => props.hasAddOn ? u(5.5) : "var(--lns-formFieldHorizontalPadding)"};
|
|
4808
4947
|
border-radius: var(--lns-formFieldRadius);
|
|
@@ -4835,7 +4974,7 @@ var TypeaheadInputField = styled23.input`
|
|
|
4835
4974
|
color: ${getColorValue("bodyDimmed")};
|
|
4836
4975
|
}
|
|
4837
4976
|
`;
|
|
4838
|
-
var IconSection3 =
|
|
4977
|
+
var IconSection3 = styled24.div`
|
|
4839
4978
|
position: absolute;
|
|
4840
4979
|
pointer-events: none;
|
|
4841
4980
|
width: ${u(6)};
|
|
@@ -4845,7 +4984,7 @@ var IconSection3 = styled23.div`
|
|
|
4845
4984
|
justify-content: center;
|
|
4846
4985
|
left: 0;
|
|
4847
4986
|
`;
|
|
4848
|
-
var AddOnSection =
|
|
4987
|
+
var AddOnSection = styled24.div`
|
|
4849
4988
|
position: absolute;
|
|
4850
4989
|
height: 100%;
|
|
4851
4990
|
display: flex;
|
|
@@ -4856,7 +4995,7 @@ var AddOnSection = styled23.div`
|
|
|
4856
4995
|
top: 50%;
|
|
4857
4996
|
transform: translateY(-50%);
|
|
4858
4997
|
`;
|
|
4859
|
-
var TextOverlay =
|
|
4998
|
+
var TextOverlay = styled24.div`
|
|
4860
4999
|
position: absolute;
|
|
4861
5000
|
top: 0;
|
|
4862
5001
|
left: ${(props) => props.hasIcon ? u(5.5) : "var(--lns-formFieldHorizontalPadding)"};
|
|
@@ -4867,7 +5006,7 @@ var TextOverlay = styled23.div`
|
|
|
4867
5006
|
pointer-events: none;
|
|
4868
5007
|
color: inherit;
|
|
4869
5008
|
`;
|
|
4870
|
-
var TypeaheadImage =
|
|
5009
|
+
var TypeaheadImage = styled24.img`
|
|
4871
5010
|
height: 100%;
|
|
4872
5011
|
width: auto;
|
|
4873
5012
|
min-width: 100%;
|
|
@@ -4889,7 +5028,8 @@ var TypeaheadHeader = ({
|
|
|
4889
5028
|
hasLoader,
|
|
4890
5029
|
inputValue,
|
|
4891
5030
|
handleInputValueChange,
|
|
4892
|
-
inputRef
|
|
5031
|
+
inputRef,
|
|
5032
|
+
id
|
|
4893
5033
|
}) => {
|
|
4894
5034
|
const icon = getIcon2({ options, selectedItem, selectedOptionValue });
|
|
4895
5035
|
const hasIcon = Boolean(icon);
|
|
@@ -4909,6 +5049,8 @@ var TypeaheadHeader = ({
|
|
|
4909
5049
|
getInputProps,
|
|
4910
5050
|
ariaMenuName
|
|
4911
5051
|
})), getInputProps({
|
|
5052
|
+
id,
|
|
5053
|
+
"aria-labelledby": void 0,
|
|
4912
5054
|
disabled: isDisabled,
|
|
4913
5055
|
onFocus: handleClickAndFocus,
|
|
4914
5056
|
onClick: handleClickAndFocus,
|
|
@@ -4919,7 +5061,7 @@ var TypeaheadHeader = ({
|
|
|
4919
5061
|
onChange: (e) => handleInputValueChange(e.target.value)
|
|
4920
5062
|
}));
|
|
4921
5063
|
const showPlaceholder = !inputValue && !selectedOptionValue;
|
|
4922
|
-
return /* @__PURE__ */
|
|
5064
|
+
return /* @__PURE__ */ React31.createElement(TypeaheadHeaderWrapper, { onClick: handleClickAndFocus, disabled: isDisabled }, hasIcon && /* @__PURE__ */ React31.createElement(IconSection3, null, typeof icon === "string" ? /* @__PURE__ */ React31.createElement(container_default, { radius: "50", width: 3, height: 3, overflow: "hidden" }, /* @__PURE__ */ React31.createElement(align_default, { alignment: "center" }, /* @__PURE__ */ React31.createElement(TypeaheadImage, { src: icon, alt: "", isDisabled }))) : /* @__PURE__ */ React31.createElement(icon_default, { icon, color })), /* @__PURE__ */ React31.createElement(
|
|
4923
5065
|
TypeaheadInputField,
|
|
4924
5066
|
__spreadProps(__spreadValues({
|
|
4925
5067
|
ref: inputRef
|
|
@@ -4929,12 +5071,12 @@ var TypeaheadHeader = ({
|
|
|
4929
5071
|
hasError,
|
|
4930
5072
|
isDisabled
|
|
4931
5073
|
})
|
|
4932
|
-
), !inputValue && /* @__PURE__ */
|
|
5074
|
+
), !inputValue && /* @__PURE__ */ React31.createElement(TextOverlay, { hasIcon }, /* @__PURE__ */ React31.createElement(text_default, { hasEllipsis: true, color: showPlaceholder ? "bodyDimmed" : "inherit" }, getTitle2({
|
|
4933
5075
|
options,
|
|
4934
5076
|
selectedItem,
|
|
4935
5077
|
selectedOptionValue,
|
|
4936
5078
|
placeholder
|
|
4937
|
-
}))), /* @__PURE__ */
|
|
5079
|
+
}))), /* @__PURE__ */ React31.createElement(AddOnSection, null, hasLoader ? /* @__PURE__ */ React31.createElement(loader_default, { size: "small" }) : /* @__PURE__ */ React31.createElement(icon_default, { icon: /* @__PURE__ */ React31.createElement(SvgChevronDown, null), color })));
|
|
4938
5080
|
};
|
|
4939
5081
|
var getSelectedOption2 = (value, options) => {
|
|
4940
5082
|
var _a;
|
|
@@ -4956,7 +5098,7 @@ var didSelectedOptionValueChange2 = (selectedOptionValue, prevSelectedItem) => {
|
|
|
4956
5098
|
};
|
|
4957
5099
|
var renderOption2 = (item, index, selectedItem, selectedOptionValue, highlightedIndex, getItemProps) => {
|
|
4958
5100
|
const isSelected = !selectedItem && item.value === selectedOptionValue || selectedItem && selectedItem.value === item.value;
|
|
4959
|
-
return /* @__PURE__ */
|
|
5101
|
+
return /* @__PURE__ */ React31.createElement(
|
|
4960
5102
|
MenuItem,
|
|
4961
5103
|
__spreadProps(__spreadValues({
|
|
4962
5104
|
key: index,
|
|
@@ -5000,16 +5142,16 @@ var TypeaheadMenu = (_a) => {
|
|
|
5000
5142
|
"emptyResultsMessage",
|
|
5001
5143
|
"hasAvailableOptions"
|
|
5002
5144
|
]);
|
|
5003
|
-
const defaultLoadingMessage = loadingMessage || /* @__PURE__ */
|
|
5145
|
+
const defaultLoadingMessage = loadingMessage || /* @__PURE__ */ React31.createElement(loader_default, null);
|
|
5004
5146
|
const defaultEmptyResultsMessage = emptyResultsMessage || "No results";
|
|
5005
5147
|
if (isLoading) {
|
|
5006
|
-
return /* @__PURE__ */
|
|
5148
|
+
return /* @__PURE__ */ React31.createElement(menu_default, __spreadValues({ as: "div" }, menuProps), /* @__PURE__ */ React31.createElement(container_default, { padding: "large" }, /* @__PURE__ */ React31.createElement(align_default, { alignment: "center" }, defaultLoadingMessage)));
|
|
5007
5149
|
}
|
|
5008
5150
|
if (!hasAvailableOptions) {
|
|
5009
|
-
return /* @__PURE__ */
|
|
5151
|
+
return /* @__PURE__ */ React31.createElement(menu_default, __spreadValues({ as: "div" }, menuProps), /* @__PURE__ */ React31.createElement(container_default, { padding: "large" }, /* @__PURE__ */ React31.createElement(align_default, { alignment: "center" }, defaultEmptyResultsMessage)));
|
|
5010
5152
|
}
|
|
5011
5153
|
if (!isGrouped2(options)) {
|
|
5012
|
-
return /* @__PURE__ */
|
|
5154
|
+
return /* @__PURE__ */ React31.createElement(menu_default, __spreadValues({}, menuProps), options.map(
|
|
5013
5155
|
(item, index) => renderOption2(
|
|
5014
5156
|
item,
|
|
5015
5157
|
index,
|
|
@@ -5021,9 +5163,9 @@ var TypeaheadMenu = (_a) => {
|
|
|
5021
5163
|
));
|
|
5022
5164
|
}
|
|
5023
5165
|
let downshiftIndex = 0;
|
|
5024
|
-
return /* @__PURE__ */
|
|
5166
|
+
return /* @__PURE__ */ React31.createElement(menu_default, __spreadValues({}, menuProps), options.map((group) => {
|
|
5025
5167
|
const groupId = `group-${group.group.replace(/\s+/g, "-")}`;
|
|
5026
|
-
return /* @__PURE__ */
|
|
5168
|
+
return /* @__PURE__ */ React31.createElement("li", { key: groupId }, /* @__PURE__ */ React31.createElement(spacer_default, { left: "medium", top: "small", bottom: "xsmall" }, /* @__PURE__ */ React31.createElement(text_default, { id: groupId, size: "body-sm", fontWeight: "bold" }, group.group)), /* @__PURE__ */ React31.createElement(Group2, { role: "group", "aria-labelledby": groupId }, group.items.map((item) => {
|
|
5027
5169
|
return renderOption2(
|
|
5028
5170
|
item,
|
|
5029
5171
|
downshiftIndex++,
|
|
@@ -5056,7 +5198,8 @@ var Typeahead = forwardRef3(
|
|
|
5056
5198
|
isLoading,
|
|
5057
5199
|
loadingMessage,
|
|
5058
5200
|
emptyResultsMessage,
|
|
5059
|
-
errorMessage
|
|
5201
|
+
errorMessage,
|
|
5202
|
+
id
|
|
5060
5203
|
} = _b, props = __objRest(_b, [
|
|
5061
5204
|
"container",
|
|
5062
5205
|
"onOptionChange",
|
|
@@ -5076,7 +5219,8 @@ var Typeahead = forwardRef3(
|
|
|
5076
5219
|
"isLoading",
|
|
5077
5220
|
"loadingMessage",
|
|
5078
5221
|
"emptyResultsMessage",
|
|
5079
|
-
"errorMessage"
|
|
5222
|
+
"errorMessage",
|
|
5223
|
+
"id"
|
|
5080
5224
|
]);
|
|
5081
5225
|
const environment = getDownshiftEnvironment(container);
|
|
5082
5226
|
const internalInputRef = useRef2(null);
|
|
@@ -5140,7 +5284,7 @@ var Typeahead = forwardRef3(
|
|
|
5140
5284
|
(_a2 = internalInputRef.current) == null ? void 0 : _a2.blur();
|
|
5141
5285
|
}
|
|
5142
5286
|
}, [downshiftIsOpen, onOpenChange]);
|
|
5143
|
-
const hasAvailableOptions =
|
|
5287
|
+
const hasAvailableOptions = useMemo2(() => {
|
|
5144
5288
|
if (!Array.isArray(options)) {
|
|
5145
5289
|
return false;
|
|
5146
5290
|
}
|
|
@@ -5156,7 +5300,7 @@ var Typeahead = forwardRef3(
|
|
|
5156
5300
|
}
|
|
5157
5301
|
return changes;
|
|
5158
5302
|
};
|
|
5159
|
-
return /* @__PURE__ */
|
|
5303
|
+
return /* @__PURE__ */ React31.createElement(TypeaheadWrapper, __spreadValues({}, props), /* @__PURE__ */ React31.createElement(Downshift2, __spreadProps(__spreadValues({}, downshiftProps), { stateReducer }), ({
|
|
5160
5304
|
getItemProps,
|
|
5161
5305
|
getInputProps,
|
|
5162
5306
|
getMenuProps,
|
|
@@ -5166,7 +5310,7 @@ var Typeahead = forwardRef3(
|
|
|
5166
5310
|
}) => {
|
|
5167
5311
|
return (
|
|
5168
5312
|
// Don't set the role to combobox to ensure a consistent experience for screen readers
|
|
5169
|
-
/* @__PURE__ */
|
|
5313
|
+
/* @__PURE__ */ React31.createElement("div", { role: "presentation" }, /* @__PURE__ */ React31.createElement("div", __spreadValues({}, triggerProps), /* @__PURE__ */ React31.createElement(
|
|
5170
5314
|
TypeaheadHeader,
|
|
5171
5315
|
{
|
|
5172
5316
|
inputRef,
|
|
@@ -5184,10 +5328,11 @@ var Typeahead = forwardRef3(
|
|
|
5184
5328
|
setDownshiftIsOpen(true);
|
|
5185
5329
|
},
|
|
5186
5330
|
hasLoader: isLoading,
|
|
5187
|
-
hasError: Boolean(errorMessage)
|
|
5331
|
+
hasError: Boolean(errorMessage),
|
|
5332
|
+
id
|
|
5188
5333
|
}
|
|
5189
5334
|
)), downshiftIsOpen && isOpen && renderLayer(
|
|
5190
|
-
/* @__PURE__ */
|
|
5335
|
+
/* @__PURE__ */ React31.createElement(
|
|
5191
5336
|
"div",
|
|
5192
5337
|
__spreadProps(__spreadValues({}, layerProps), {
|
|
5193
5338
|
style: __spreadProps(__spreadValues({}, layerProps.style), {
|
|
@@ -5195,7 +5340,7 @@ var Typeahead = forwardRef3(
|
|
|
5195
5340
|
width: menuMinWidth ? "auto" : triggerBounds == null ? void 0 : triggerBounds.width
|
|
5196
5341
|
})
|
|
5197
5342
|
}),
|
|
5198
|
-
/* @__PURE__ */
|
|
5343
|
+
/* @__PURE__ */ React31.createElement(
|
|
5199
5344
|
TypeaheadMenu,
|
|
5200
5345
|
{
|
|
5201
5346
|
options,
|
|
@@ -5215,7 +5360,7 @@ var Typeahead = forwardRef3(
|
|
|
5215
5360
|
}
|
|
5216
5361
|
)
|
|
5217
5362
|
)
|
|
5218
|
-
), Boolean(errorMessage) && !downshiftIsOpen ? /* @__PURE__ */
|
|
5363
|
+
), Boolean(errorMessage) && !downshiftIsOpen ? /* @__PURE__ */ React31.createElement(ErrorMessage2, null, errorMessage) : null)
|
|
5219
5364
|
);
|
|
5220
5365
|
}));
|
|
5221
5366
|
}
|
|
@@ -5226,51 +5371,9 @@ var typeahead_default = Typeahead;
|
|
|
5226
5371
|
// src/components/dropdown/dropdown.tsx
|
|
5227
5372
|
import styled25 from "@emotion/styled";
|
|
5228
5373
|
import Downshift3 from "downshift";
|
|
5229
|
-
import React32, { useEffect as useEffect5, useMemo as
|
|
5374
|
+
import React32, { useEffect as useEffect5, useMemo as useMemo3, useState as useState3 } from "react";
|
|
5230
5375
|
import { useLayer as useLayer3 } from "react-laag";
|
|
5231
5376
|
import ResizeObserver3 from "resize-observer-polyfill";
|
|
5232
|
-
|
|
5233
|
-
// src/components/search-bar/search-bar.tsx
|
|
5234
|
-
import styled24 from "@emotion/styled";
|
|
5235
|
-
import React31 from "react";
|
|
5236
|
-
|
|
5237
|
-
// src/components/icon/available-icons/search.tsx
|
|
5238
|
-
import SearchIcon from "@atlaskit/icon/core/search";
|
|
5239
|
-
import * as React30 from "react";
|
|
5240
|
-
function SvgSearch() {
|
|
5241
|
-
return /* @__PURE__ */ React30.createElement(SearchIcon, { label: "", testId: "ads-refreshed-icon" });
|
|
5242
|
-
}
|
|
5243
|
-
|
|
5244
|
-
// src/components/search-bar/search-bar.tsx
|
|
5245
|
-
var SearchBarContainer = styled24.div`
|
|
5246
|
-
padding: ${u(1.5)} ${u(1.5)} 0;
|
|
5247
|
-
margin-bottom: ${u(1.5)};
|
|
5248
|
-
position: sticky;
|
|
5249
|
-
top: 0;
|
|
5250
|
-
`;
|
|
5251
|
-
var SearchBar = ({
|
|
5252
|
-
ariaLabel,
|
|
5253
|
-
placeholder,
|
|
5254
|
-
value,
|
|
5255
|
-
onChange,
|
|
5256
|
-
getInputProps
|
|
5257
|
-
}) => {
|
|
5258
|
-
return /* @__PURE__ */ React31.createElement(SearchBarContainer, null, /* @__PURE__ */ React31.createElement(
|
|
5259
|
-
text_input_default,
|
|
5260
|
-
__spreadValues({
|
|
5261
|
-
"aria-label": ariaLabel,
|
|
5262
|
-
icon: /* @__PURE__ */ React31.createElement(SvgSearch, null)
|
|
5263
|
-
}, getInputProps({
|
|
5264
|
-
placeholder,
|
|
5265
|
-
value,
|
|
5266
|
-
onChange,
|
|
5267
|
-
type: "text"
|
|
5268
|
-
}))
|
|
5269
|
-
));
|
|
5270
|
-
};
|
|
5271
|
-
var search_bar_default = SearchBar;
|
|
5272
|
-
|
|
5273
|
-
// src/components/dropdown/dropdown.tsx
|
|
5274
5377
|
var getAccessibilityProps = ({
|
|
5275
5378
|
ariaMenuName,
|
|
5276
5379
|
getInputProps,
|
|
@@ -5304,7 +5407,9 @@ var Dropdown = (_a) => {
|
|
|
5304
5407
|
onOuterClick,
|
|
5305
5408
|
triggerOffset = 0,
|
|
5306
5409
|
onOpenChange,
|
|
5307
|
-
search
|
|
5410
|
+
search,
|
|
5411
|
+
role,
|
|
5412
|
+
menuItemRole
|
|
5308
5413
|
} = _b, props = __objRest(_b, [
|
|
5309
5414
|
"ariaMenuName",
|
|
5310
5415
|
"menuPosition",
|
|
@@ -5320,7 +5425,9 @@ var Dropdown = (_a) => {
|
|
|
5320
5425
|
"onOuterClick",
|
|
5321
5426
|
"triggerOffset",
|
|
5322
5427
|
"onOpenChange",
|
|
5323
|
-
"search"
|
|
5428
|
+
"search",
|
|
5429
|
+
"role",
|
|
5430
|
+
"menuItemRole"
|
|
5324
5431
|
]);
|
|
5325
5432
|
const environment = getDownshiftEnvironment(container);
|
|
5326
5433
|
const [downshiftIsOpen, setDownshiftIsOpen] = useState3(false);
|
|
@@ -5348,23 +5455,19 @@ var Dropdown = (_a) => {
|
|
|
5348
5455
|
}
|
|
5349
5456
|
return changes;
|
|
5350
5457
|
};
|
|
5351
|
-
|
|
5352
|
-
if (
|
|
5458
|
+
options = useMemo3(() => {
|
|
5459
|
+
if (search) {
|
|
5460
|
+
if (search.searchType === "startsWith") {
|
|
5461
|
+
return options.filter(
|
|
5462
|
+
(option) => getTextFromNode(option.title).toLowerCase().startsWith(searchValue.toLowerCase())
|
|
5463
|
+
);
|
|
5464
|
+
}
|
|
5353
5465
|
return options.filter(
|
|
5354
|
-
(option) =>
|
|
5355
|
-
var _a2;
|
|
5356
|
-
return (_a2 = option.title) == null ? void 0 : _a2.toString().toLowerCase().startsWith(searchValue.toLowerCase());
|
|
5357
|
-
}
|
|
5466
|
+
(option) => getTextFromNode(option.title).toLowerCase().includes(searchValue.toLowerCase())
|
|
5358
5467
|
);
|
|
5359
5468
|
}
|
|
5360
|
-
return options
|
|
5361
|
-
|
|
5362
|
-
var _a2;
|
|
5363
|
-
return (_a2 = option.title) == null ? void 0 : _a2.toString().toLowerCase().includes(searchValue.toLowerCase());
|
|
5364
|
-
}
|
|
5365
|
-
);
|
|
5366
|
-
}, [options, searchValue, search == null ? void 0 : search.searchType]);
|
|
5367
|
-
options = search ? filteredOptions : options;
|
|
5469
|
+
return options;
|
|
5470
|
+
}, [options, searchValue, search]);
|
|
5368
5471
|
return /* @__PURE__ */ React32.createElement(
|
|
5369
5472
|
Downshift3,
|
|
5370
5473
|
{
|
|
@@ -5395,7 +5498,7 @@ var Dropdown = (_a) => {
|
|
|
5395
5498
|
ariaMenuName,
|
|
5396
5499
|
getInputProps,
|
|
5397
5500
|
isOpen: isOpen2
|
|
5398
|
-
}))) : /* @__PURE__ */ React32.createElement(TriggerSection, __spreadValues({}, getToggleButtonProps({})), trigger)),
|
|
5501
|
+
}))) : /* @__PURE__ */ React32.createElement(TriggerSection, __spreadValues({}, getToggleButtonProps({ tabIndex: 0 })), trigger)),
|
|
5399
5502
|
isOpen2 && renderLayer(
|
|
5400
5503
|
/* @__PURE__ */ React32.createElement(
|
|
5401
5504
|
"div",
|
|
@@ -5410,6 +5513,7 @@ var Dropdown = (_a) => {
|
|
|
5410
5513
|
maxWidth: menuMaxWidth,
|
|
5411
5514
|
maxHeight: menuMaxHeight,
|
|
5412
5515
|
downshiftMenuProps: getMenuProps,
|
|
5516
|
+
role,
|
|
5413
5517
|
search: search && /* @__PURE__ */ React32.createElement(
|
|
5414
5518
|
search_bar_default,
|
|
5415
5519
|
{
|
|
@@ -5432,6 +5536,7 @@ var Dropdown = (_a) => {
|
|
|
5432
5536
|
icon: item.icon,
|
|
5433
5537
|
hasDivider: item.hasDivider,
|
|
5434
5538
|
getItemProps,
|
|
5539
|
+
menuItemRole,
|
|
5435
5540
|
index
|
|
5436
5541
|
}, getItemProps({
|
|
5437
5542
|
key: index,
|
|
@@ -6650,16 +6755,16 @@ var CombinedLogoSvg = (_a) => {
|
|
|
6650
6755
|
), /* @__PURE__ */ React43.createElement(
|
|
6651
6756
|
"path",
|
|
6652
6757
|
{
|
|
6653
|
-
|
|
6654
|
-
|
|
6758
|
+
fillRule: "evenodd",
|
|
6759
|
+
clipRule: "evenodd",
|
|
6655
6760
|
d: "M70.3743 15.1855C71.6352 15.1855 72.7252 15.459 73.6442 16.0059C74.5709 16.5527 75.2848 17.3237 75.7861 18.3187C76.2874 19.3061 76.5381 20.4568 76.5381 21.7708C76.5381 23.0773 76.2874 24.2242 75.7861 25.2116C75.2848 26.199 74.5709 26.9661 73.6442 27.513C72.7252 28.0599 71.6352 28.3333 70.3743 28.3333C69.1135 28.3333 68.0197 28.0599 67.0931 27.513C66.174 26.9661 65.4639 26.199 64.9626 25.2116C64.4613 24.2242 64.2106 23.0773 64.2106 21.7708C64.2106 20.4568 64.4613 19.3061 64.9626 18.3187C65.4639 17.3237 66.174 16.5527 67.0931 16.0059C68.0197 15.459 69.1135 15.1855 70.3743 15.1855ZM70.3743 17.7376C69.7287 17.7376 69.1895 17.9161 68.7565 18.2731C68.3312 18.6225 68.0084 19.101 67.7881 19.7087C67.5754 20.3087 67.4691 20.9923 67.4691 21.7594C67.4691 22.519 67.5754 23.2026 67.7881 23.8102C68.0084 24.4179 68.3312 24.9002 68.7565 25.2572C69.1895 25.6066 69.7287 25.7812 70.3743 25.7812C71.02 25.7812 71.5592 25.6066 71.9922 25.2572C72.4251 24.9002 72.7479 24.4179 72.9606 23.8102C73.1733 23.2026 73.2796 22.519 73.2796 21.7594C73.2796 20.9999 73.1733 20.3163 72.9606 19.7087C72.7479 19.101 72.4251 18.6225 71.9922 18.2731C71.5592 17.9161 71.02 17.7376 70.3743 17.7376Z",
|
|
6656
6761
|
fill: wordmarkColor
|
|
6657
6762
|
}
|
|
6658
6763
|
), /* @__PURE__ */ React43.createElement(
|
|
6659
6764
|
"path",
|
|
6660
6765
|
{
|
|
6661
|
-
|
|
6662
|
-
|
|
6766
|
+
fillRule: "evenodd",
|
|
6767
|
+
clipRule: "evenodd",
|
|
6663
6768
|
d: "M84.6387 15.1855C85.8995 15.1855 86.9895 15.459 87.9085 16.0059C88.8352 16.5527 89.5491 17.3237 90.0505 18.3187C90.5518 19.3061 90.8024 20.4568 90.8024 21.7708C90.8024 23.0773 90.5518 24.2242 90.0505 25.2116C89.5491 26.199 88.8352 26.9661 87.9085 27.513C86.9895 28.0599 85.8995 28.3333 84.6387 28.3333C83.3778 28.3333 82.2841 28.0599 81.3574 27.513C80.4384 26.9661 79.7282 26.199 79.2269 25.2116C78.7256 24.2242 78.4749 23.0773 78.4749 21.7708C78.4749 20.4568 78.7256 19.3061 79.2269 18.3187C79.7282 17.3237 80.4384 16.5527 81.3574 16.0059C82.2841 15.459 83.3778 15.1855 84.6387 15.1855ZM84.6387 17.7376C83.9931 17.7376 83.4538 17.9161 83.0208 18.2731C82.5955 18.6225 82.2727 19.101 82.0524 19.7087C81.8397 20.3087 81.7334 20.9923 81.7334 21.7594C81.7334 22.519 81.8397 23.2026 82.0524 23.8102C82.2727 24.4179 82.5955 24.9002 83.0208 25.2572C83.4538 25.6066 83.9931 25.7812 84.6387 25.7812C85.2843 25.7812 85.8236 25.6066 86.2565 25.2572C86.6895 24.9002 87.0123 24.4179 87.2249 23.8102C87.4376 23.2026 87.5439 22.519 87.5439 21.7594C87.5439 20.9999 87.4376 20.3163 87.2249 19.7087C87.0123 19.101 86.6895 18.6225 86.2565 18.2731C85.8236 17.9161 85.2843 17.7376 84.6387 17.7376Z",
|
|
6664
6769
|
fill: wordmarkColor
|
|
6665
6770
|
}
|
|
@@ -7115,7 +7220,7 @@ var list_default = List;
|
|
|
7115
7220
|
|
|
7116
7221
|
// src/components/tabs/tabs.tsx
|
|
7117
7222
|
import styled36 from "@emotion/styled";
|
|
7118
|
-
import React46 from "react";
|
|
7223
|
+
import React46, { useCallback as useCallback4, useMemo as useMemo4, useRef as useRef4, useId } from "react";
|
|
7119
7224
|
var TabsContext = React46.createContext({});
|
|
7120
7225
|
var negativeScrollOffset = (scrollOffset) => `calc(-1 * ${getSizeValue(scrollOffset)})`;
|
|
7121
7226
|
var Wrapper = styled36.div`
|
|
@@ -7312,7 +7417,7 @@ var Tab = (_a) => {
|
|
|
7312
7417
|
children
|
|
7313
7418
|
);
|
|
7314
7419
|
};
|
|
7315
|
-
var
|
|
7420
|
+
var TabsDeprecated = (_a) => {
|
|
7316
7421
|
var _b = _a, {
|
|
7317
7422
|
children,
|
|
7318
7423
|
scrollOffset,
|
|
@@ -7349,6 +7454,166 @@ var Tabs = (_a) => {
|
|
|
7349
7454
|
}
|
|
7350
7455
|
return /* @__PURE__ */ React46.createElement(TabsContext.Provider, { value: { isPilledDesign } }, tabsContent);
|
|
7351
7456
|
};
|
|
7457
|
+
var ConditionalTooltip = ({
|
|
7458
|
+
tooltipProps,
|
|
7459
|
+
children,
|
|
7460
|
+
tooltipId
|
|
7461
|
+
}) => {
|
|
7462
|
+
if (tooltipProps) {
|
|
7463
|
+
return /* @__PURE__ */ React46.createElement(tooltip_default, __spreadProps(__spreadValues({}, tooltipProps), { tooltipId, tabIndex: -1 }), children);
|
|
7464
|
+
}
|
|
7465
|
+
return children;
|
|
7466
|
+
};
|
|
7467
|
+
var TabNew = React46.forwardRef(
|
|
7468
|
+
(_a, ref) => {
|
|
7469
|
+
var _b = _a, {
|
|
7470
|
+
tabContent,
|
|
7471
|
+
tooltipProps,
|
|
7472
|
+
isActive,
|
|
7473
|
+
htmlTag = "button",
|
|
7474
|
+
icon,
|
|
7475
|
+
isDisabled = false,
|
|
7476
|
+
onKeyDown,
|
|
7477
|
+
onClick
|
|
7478
|
+
} = _b, props = __objRest(_b, [
|
|
7479
|
+
"tabContent",
|
|
7480
|
+
"tooltipProps",
|
|
7481
|
+
"isActive",
|
|
7482
|
+
"htmlTag",
|
|
7483
|
+
"icon",
|
|
7484
|
+
"isDisabled",
|
|
7485
|
+
"onKeyDown",
|
|
7486
|
+
"onClick"
|
|
7487
|
+
]);
|
|
7488
|
+
const { isPilledDesign } = React46.useContext(TabsContext);
|
|
7489
|
+
const tooltipId = useId();
|
|
7490
|
+
const componentProps = __spreadValues({
|
|
7491
|
+
as: htmlTag,
|
|
7492
|
+
isActive,
|
|
7493
|
+
icon,
|
|
7494
|
+
role: "tab",
|
|
7495
|
+
"aria-selected": isActive,
|
|
7496
|
+
disabled: isDisabled,
|
|
7497
|
+
tabIndex: isActive ? 0 : -1,
|
|
7498
|
+
"aria-describedby": tooltipProps ? tooltipId : void 0,
|
|
7499
|
+
onKeyDown,
|
|
7500
|
+
onClick,
|
|
7501
|
+
ref
|
|
7502
|
+
}, props);
|
|
7503
|
+
return /* @__PURE__ */ React46.createElement(ConditionalTooltip, { tooltipProps, tooltipId }, isPilledDesign ? /* @__PURE__ */ React46.createElement(TabWrapperPilled, __spreadValues({}, componentProps), icon ? /* @__PURE__ */ React46.createElement(container_default, { htmlTag: "span", paddingRight: tabContent && "small" }, /* @__PURE__ */ React46.createElement(icon_default, { icon, color: "currentColor" })) : null, tabContent) : /* @__PURE__ */ React46.createElement(TabWrapper, __spreadValues({}, componentProps), icon ? /* @__PURE__ */ React46.createElement(container_default, { htmlTag: "span", paddingRight: tabContent && "small" }, /* @__PURE__ */ React46.createElement(icon_default, { icon, color: "currentColor" })) : null, tabContent));
|
|
7504
|
+
}
|
|
7505
|
+
);
|
|
7506
|
+
TabNew.displayName = "TabNew";
|
|
7507
|
+
var TabsNew = (_a) => {
|
|
7508
|
+
var _b = _a, {
|
|
7509
|
+
tabs,
|
|
7510
|
+
scrollOffset,
|
|
7511
|
+
hasFullTabs,
|
|
7512
|
+
isPilledDesign,
|
|
7513
|
+
hasBottomBorder = false
|
|
7514
|
+
} = _b, props = __objRest(_b, [
|
|
7515
|
+
"tabs",
|
|
7516
|
+
"scrollOffset",
|
|
7517
|
+
"hasFullTabs",
|
|
7518
|
+
"isPilledDesign",
|
|
7519
|
+
"hasBottomBorder"
|
|
7520
|
+
]);
|
|
7521
|
+
const tabRefs = useRef4({});
|
|
7522
|
+
const handleKeyDown = useCallback4(
|
|
7523
|
+
(event, currentTabIndex) => {
|
|
7524
|
+
var _a2;
|
|
7525
|
+
let newIndex = currentTabIndex;
|
|
7526
|
+
switch (event.key) {
|
|
7527
|
+
case "ArrowLeft":
|
|
7528
|
+
event.preventDefault();
|
|
7529
|
+
newIndex = currentTabIndex > 0 ? currentTabIndex - 1 : tabs.length - 1;
|
|
7530
|
+
break;
|
|
7531
|
+
case "ArrowRight":
|
|
7532
|
+
event.preventDefault();
|
|
7533
|
+
newIndex = currentTabIndex < tabs.length - 1 ? currentTabIndex + 1 : 0;
|
|
7534
|
+
break;
|
|
7535
|
+
case "Home":
|
|
7536
|
+
event.preventDefault();
|
|
7537
|
+
newIndex = 0;
|
|
7538
|
+
break;
|
|
7539
|
+
case "End":
|
|
7540
|
+
event.preventDefault();
|
|
7541
|
+
newIndex = tabs.length - 1;
|
|
7542
|
+
break;
|
|
7543
|
+
default:
|
|
7544
|
+
return;
|
|
7545
|
+
}
|
|
7546
|
+
(_a2 = tabRefs.current[newIndex]) == null ? void 0 : _a2.focus();
|
|
7547
|
+
},
|
|
7548
|
+
[tabs.length]
|
|
7549
|
+
);
|
|
7550
|
+
const setTabRef = useCallback4(
|
|
7551
|
+
(tabIndex) => (ref) => {
|
|
7552
|
+
tabRefs.current[tabIndex] = ref;
|
|
7553
|
+
},
|
|
7554
|
+
[]
|
|
7555
|
+
);
|
|
7556
|
+
const tabsToRender = useMemo4(
|
|
7557
|
+
() => tabs.map((tabProps, index) => /* @__PURE__ */ React46.createElement(
|
|
7558
|
+
TabNew,
|
|
7559
|
+
__spreadValues({
|
|
7560
|
+
key: index,
|
|
7561
|
+
ref: setTabRef(index),
|
|
7562
|
+
onKeyDown: (e) => handleKeyDown(e, index)
|
|
7563
|
+
}, tabProps)
|
|
7564
|
+
)),
|
|
7565
|
+
[tabs, handleKeyDown, setTabRef]
|
|
7566
|
+
);
|
|
7567
|
+
const tabsContent = useMemo4(
|
|
7568
|
+
() => isPilledDesign ? /* @__PURE__ */ React46.createElement(
|
|
7569
|
+
TabsNavPilled,
|
|
7570
|
+
__spreadValues({
|
|
7571
|
+
hasFullTabs,
|
|
7572
|
+
scrollOffset,
|
|
7573
|
+
role: "tablist"
|
|
7574
|
+
}, props),
|
|
7575
|
+
tabsToRender
|
|
7576
|
+
) : /* @__PURE__ */ React46.createElement(
|
|
7577
|
+
TabsNav,
|
|
7578
|
+
__spreadValues({
|
|
7579
|
+
hasFullTabs,
|
|
7580
|
+
scrollOffset,
|
|
7581
|
+
hasBottomBorder,
|
|
7582
|
+
role: "tablist"
|
|
7583
|
+
}, props),
|
|
7584
|
+
tabsToRender
|
|
7585
|
+
),
|
|
7586
|
+
[
|
|
7587
|
+
tabsToRender,
|
|
7588
|
+
hasFullTabs,
|
|
7589
|
+
scrollOffset,
|
|
7590
|
+
hasBottomBorder,
|
|
7591
|
+
isPilledDesign,
|
|
7592
|
+
props
|
|
7593
|
+
]
|
|
7594
|
+
);
|
|
7595
|
+
const wrappedContent = /* @__PURE__ */ React46.createElement(TabsContext.Provider, { value: { isPilledDesign } }, tabsContent);
|
|
7596
|
+
if (scrollOffset) {
|
|
7597
|
+
return /* @__PURE__ */ React46.createElement(Wrapper, { scrollOffset }, wrappedContent);
|
|
7598
|
+
}
|
|
7599
|
+
return wrappedContent;
|
|
7600
|
+
};
|
|
7601
|
+
var Tabs = (_a) => {
|
|
7602
|
+
var _b = _a, { children, tabs } = _b, props = __objRest(_b, ["children", "tabs"]);
|
|
7603
|
+
if (children && tabs) {
|
|
7604
|
+
console.warn(
|
|
7605
|
+
"Both children and tabs props are provided. Please use only one of them."
|
|
7606
|
+
);
|
|
7607
|
+
}
|
|
7608
|
+
if (!children && !tabs) {
|
|
7609
|
+
console.error("Either children or tabs must be provided.");
|
|
7610
|
+
return null;
|
|
7611
|
+
}
|
|
7612
|
+
if (children) {
|
|
7613
|
+
return /* @__PURE__ */ React46.createElement(TabsDeprecated, __spreadValues({}, props), children);
|
|
7614
|
+
}
|
|
7615
|
+
return /* @__PURE__ */ React46.createElement(TabsNew, __spreadValues({ tabs }, props));
|
|
7616
|
+
};
|
|
7352
7617
|
var tabs_default = Tabs;
|
|
7353
7618
|
|
|
7354
7619
|
// src/components/pill/pill.tsx
|