@loomhq/lens 12.7.0 → 12.8.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/cjs/index.js +227 -170
- package/dist/cjs/index.js.map +4 -4
- package/dist/esm/index.js +208 -151
- package/dist/esm/index.js.map +4 -4
- package/dist/types/components/dropdown/dropdown.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/package.json +1 -1
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
|
|
|
@@ -3656,11 +3656,51 @@ var Menu = (_a) => {
|
|
|
3656
3656
|
};
|
|
3657
3657
|
var menu_default = Menu;
|
|
3658
3658
|
|
|
3659
|
+
// src/components/search-bar/search-bar.tsx
|
|
3660
|
+
import styled18 from "@emotion/styled";
|
|
3661
|
+
import React24 from "react";
|
|
3662
|
+
|
|
3663
|
+
// src/components/icon/available-icons/search.tsx
|
|
3664
|
+
import SearchIcon from "@atlaskit/icon/core/search";
|
|
3665
|
+
import * as React23 from "react";
|
|
3666
|
+
function SvgSearch() {
|
|
3667
|
+
return /* @__PURE__ */ React23.createElement(SearchIcon, { label: "", testId: "ads-refreshed-icon" });
|
|
3668
|
+
}
|
|
3669
|
+
|
|
3670
|
+
// src/components/search-bar/search-bar.tsx
|
|
3671
|
+
var SearchBarContainer = styled18.div`
|
|
3672
|
+
padding: ${u(1.5)} ${u(1.5)} 0;
|
|
3673
|
+
margin-bottom: ${u(1.5)};
|
|
3674
|
+
position: sticky;
|
|
3675
|
+
top: 0;
|
|
3676
|
+
`;
|
|
3677
|
+
var SearchBar = ({
|
|
3678
|
+
ariaLabel,
|
|
3679
|
+
placeholder,
|
|
3680
|
+
value,
|
|
3681
|
+
onChange,
|
|
3682
|
+
getInputProps
|
|
3683
|
+
}) => {
|
|
3684
|
+
return /* @__PURE__ */ React24.createElement(SearchBarContainer, null, /* @__PURE__ */ React24.createElement(
|
|
3685
|
+
text_input_default,
|
|
3686
|
+
__spreadValues({
|
|
3687
|
+
"aria-label": ariaLabel,
|
|
3688
|
+
icon: /* @__PURE__ */ React24.createElement(SvgSearch, null)
|
|
3689
|
+
}, getInputProps({
|
|
3690
|
+
placeholder,
|
|
3691
|
+
value,
|
|
3692
|
+
onChange,
|
|
3693
|
+
type: "text"
|
|
3694
|
+
}))
|
|
3695
|
+
));
|
|
3696
|
+
};
|
|
3697
|
+
var search_bar_default = SearchBar;
|
|
3698
|
+
|
|
3659
3699
|
// src/components/select/select.tsx
|
|
3660
|
-
var SelectWrapper =
|
|
3700
|
+
var SelectWrapper = styled19.div`
|
|
3661
3701
|
position: relative;
|
|
3662
3702
|
`;
|
|
3663
|
-
var SelectHeaderWrapper =
|
|
3703
|
+
var SelectHeaderWrapper = styled19.button`
|
|
3664
3704
|
appearance: none;
|
|
3665
3705
|
font: inherit;
|
|
3666
3706
|
text-align: left;
|
|
@@ -3702,7 +3742,7 @@ var SelectHeaderWrapper = styled18.button`
|
|
|
3702
3742
|
cursor: default;
|
|
3703
3743
|
}
|
|
3704
3744
|
`;
|
|
3705
|
-
var Image3 =
|
|
3745
|
+
var Image3 = styled19.img`
|
|
3706
3746
|
height: 100%;
|
|
3707
3747
|
width: auto;
|
|
3708
3748
|
min-width: 100%;
|
|
@@ -3710,12 +3750,12 @@ var Image3 = styled18.img`
|
|
|
3710
3750
|
object-fit: cover;
|
|
3711
3751
|
opacity: ${({ isDisabled }) => isDisabled ? 0.5 : 1};
|
|
3712
3752
|
`;
|
|
3713
|
-
var Group =
|
|
3753
|
+
var Group = styled19.ul`
|
|
3714
3754
|
list-style: none;
|
|
3715
3755
|
margin: 0;
|
|
3716
3756
|
padding: 0;
|
|
3717
3757
|
`;
|
|
3718
|
-
var ErrorMessage =
|
|
3758
|
+
var ErrorMessage = styled19.span`
|
|
3719
3759
|
color: var(--lns-color-red);
|
|
3720
3760
|
margin-top: var(--lns-space-xsmall);
|
|
3721
3761
|
display: block;
|
|
@@ -3798,7 +3838,7 @@ var SelectHeader = ({
|
|
|
3798
3838
|
const iconColumn = hasIcon ? "auto" : "";
|
|
3799
3839
|
const columns = `${iconColumn} 1fr auto`;
|
|
3800
3840
|
const color = isDisabled ? "disabledContent" : void 0;
|
|
3801
|
-
return /* @__PURE__ */
|
|
3841
|
+
return /* @__PURE__ */ React25.createElement(
|
|
3802
3842
|
SelectHeaderWrapper,
|
|
3803
3843
|
__spreadProps(__spreadValues(__spreadValues({}, getToggleButtonProps()), getHeaderAccessibilityProps({
|
|
3804
3844
|
selectedItem,
|
|
@@ -3811,20 +3851,20 @@ var SelectHeader = ({
|
|
|
3811
3851
|
columns,
|
|
3812
3852
|
hasError
|
|
3813
3853
|
}),
|
|
3814
|
-
hasIcon && (typeof icon === "string" ? /* @__PURE__ */
|
|
3854
|
+
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
3855
|
icon_default,
|
|
3816
3856
|
{
|
|
3817
3857
|
icon: getIcon({ options, selectedItem, selectedOptionValue }),
|
|
3818
3858
|
color
|
|
3819
3859
|
}
|
|
3820
3860
|
)),
|
|
3821
|
-
/* @__PURE__ */
|
|
3861
|
+
/* @__PURE__ */ React25.createElement(text_default, { hasEllipsis: true, color: hasPlaceholder ? "bodyDimmed" : "inherit" }, getTitle({
|
|
3822
3862
|
options,
|
|
3823
3863
|
selectedItem,
|
|
3824
3864
|
selectedOptionValue,
|
|
3825
3865
|
selectPlaceholder
|
|
3826
3866
|
})),
|
|
3827
|
-
/* @__PURE__ */
|
|
3867
|
+
/* @__PURE__ */ React25.createElement(icon_default, { icon: /* @__PURE__ */ React25.createElement(SvgChevronDown, null), color })
|
|
3828
3868
|
);
|
|
3829
3869
|
};
|
|
3830
3870
|
var CustomHeader = ({
|
|
@@ -3883,7 +3923,7 @@ var didSelectedOptionValueChange = (selectedOptionValue, prevSelectedItem) => {
|
|
|
3883
3923
|
};
|
|
3884
3924
|
var renderOption = (item, index, selectedItem, selectedOptionValue, highlightedIndex, getItemProps) => {
|
|
3885
3925
|
const isSelected = !selectedItem && item.value === selectedOptionValue || selectedItem && selectedItem.value === item.value;
|
|
3886
|
-
return /* @__PURE__ */
|
|
3926
|
+
return /* @__PURE__ */ React25.createElement(
|
|
3887
3927
|
MenuItem,
|
|
3888
3928
|
__spreadProps(__spreadValues({
|
|
3889
3929
|
key: index,
|
|
@@ -3911,16 +3951,18 @@ var SelectMenu = (_a) => {
|
|
|
3911
3951
|
selectedItem,
|
|
3912
3952
|
selectedOptionValue,
|
|
3913
3953
|
highlightedIndex,
|
|
3914
|
-
getItemProps
|
|
3954
|
+
getItemProps,
|
|
3955
|
+
search
|
|
3915
3956
|
} = _b, menuProps = __objRest(_b, [
|
|
3916
3957
|
"options",
|
|
3917
3958
|
"selectedItem",
|
|
3918
3959
|
"selectedOptionValue",
|
|
3919
3960
|
"highlightedIndex",
|
|
3920
|
-
"getItemProps"
|
|
3961
|
+
"getItemProps",
|
|
3962
|
+
"search"
|
|
3921
3963
|
]);
|
|
3922
3964
|
if (!isGrouped(options)) {
|
|
3923
|
-
return /* @__PURE__ */
|
|
3965
|
+
return /* @__PURE__ */ React25.createElement(menu_default, __spreadValues({ search }, menuProps), options.map(
|
|
3924
3966
|
(item, index) => renderOption(
|
|
3925
3967
|
item,
|
|
3926
3968
|
index,
|
|
@@ -3932,9 +3974,9 @@ var SelectMenu = (_a) => {
|
|
|
3932
3974
|
));
|
|
3933
3975
|
}
|
|
3934
3976
|
let downshiftIndex = 0;
|
|
3935
|
-
return /* @__PURE__ */
|
|
3977
|
+
return /* @__PURE__ */ React25.createElement(menu_default, __spreadValues({ search }, menuProps), options.map((group) => {
|
|
3936
3978
|
const groupId = `group-${group.group.replace(/\s+/g, "-")}`;
|
|
3937
|
-
return /* @__PURE__ */
|
|
3979
|
+
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
3980
|
return renderOption(
|
|
3939
3981
|
item,
|
|
3940
3982
|
downshiftIndex++,
|
|
@@ -3954,6 +3996,7 @@ var Select = (_a) => {
|
|
|
3954
3996
|
menuMaxWidth,
|
|
3955
3997
|
menuMaxHeight = 34,
|
|
3956
3998
|
menuMinWidth,
|
|
3999
|
+
triggerOffset = 0,
|
|
3957
4000
|
ariaMenuName,
|
|
3958
4001
|
selectedOptionValue,
|
|
3959
4002
|
onOuterClick,
|
|
@@ -3964,7 +4007,8 @@ var Select = (_a) => {
|
|
|
3964
4007
|
onOpenChange,
|
|
3965
4008
|
trigger,
|
|
3966
4009
|
hasError,
|
|
3967
|
-
errorMessage = "Oops, that didn't work."
|
|
4010
|
+
errorMessage = "Oops, that didn't work.",
|
|
4011
|
+
search
|
|
3968
4012
|
} = _b, props = __objRest(_b, [
|
|
3969
4013
|
"container",
|
|
3970
4014
|
"onChange",
|
|
@@ -3972,6 +4016,7 @@ var Select = (_a) => {
|
|
|
3972
4016
|
"menuMaxWidth",
|
|
3973
4017
|
"menuMaxHeight",
|
|
3974
4018
|
"menuMinWidth",
|
|
4019
|
+
"triggerOffset",
|
|
3975
4020
|
"ariaMenuName",
|
|
3976
4021
|
"selectedOptionValue",
|
|
3977
4022
|
"onOuterClick",
|
|
@@ -3982,10 +4027,16 @@ var Select = (_a) => {
|
|
|
3982
4027
|
"onOpenChange",
|
|
3983
4028
|
"trigger",
|
|
3984
4029
|
"hasError",
|
|
3985
|
-
"errorMessage"
|
|
4030
|
+
"errorMessage",
|
|
4031
|
+
"search"
|
|
3986
4032
|
]);
|
|
3987
4033
|
const environment = getDownshiftEnvironment(container);
|
|
3988
4034
|
const [downshiftIsOpen, setDownshiftIsOpen] = useState(false);
|
|
4035
|
+
const [searchValue, setSearchValue] = useState("");
|
|
4036
|
+
const onSearchChange = (e) => {
|
|
4037
|
+
const value = e.target.value;
|
|
4038
|
+
setSearchValue(value);
|
|
4039
|
+
};
|
|
3989
4040
|
const [prevSelectedItem, setPrevSelectedItem] = useState(
|
|
3990
4041
|
getSelectedOption(selectedOptionValue, options)
|
|
3991
4042
|
);
|
|
@@ -4011,7 +4062,8 @@ var Select = (_a) => {
|
|
|
4011
4062
|
ResizeObserver,
|
|
4012
4063
|
placement: menuPositions[menuPosition],
|
|
4013
4064
|
auto: true,
|
|
4014
|
-
snap: true
|
|
4065
|
+
snap: true,
|
|
4066
|
+
triggerOffset
|
|
4015
4067
|
});
|
|
4016
4068
|
useEffect2(() => {
|
|
4017
4069
|
if (didSelectedOptionValueChange(selectedOptionValue, prevSelectedItem)) {
|
|
@@ -4033,7 +4085,42 @@ var Select = (_a) => {
|
|
|
4033
4085
|
}
|
|
4034
4086
|
return changes;
|
|
4035
4087
|
};
|
|
4036
|
-
|
|
4088
|
+
options = useMemo(() => {
|
|
4089
|
+
if (search) {
|
|
4090
|
+
if (isGrouped(options)) {
|
|
4091
|
+
let filteredGroups;
|
|
4092
|
+
if (search.searchType === "startsWith") {
|
|
4093
|
+
filteredGroups = options.map((group) => __spreadProps(__spreadValues({}, group), {
|
|
4094
|
+
items: group.items.filter(
|
|
4095
|
+
(item) => item.title.toString().toLowerCase().startsWith(searchValue.toLowerCase())
|
|
4096
|
+
)
|
|
4097
|
+
}));
|
|
4098
|
+
} else {
|
|
4099
|
+
filteredGroups = options.map((group) => __spreadProps(__spreadValues({}, group), {
|
|
4100
|
+
items: group.items.filter(
|
|
4101
|
+
(item) => item.title.toString().toLowerCase().includes(searchValue.toLowerCase())
|
|
4102
|
+
)
|
|
4103
|
+
}));
|
|
4104
|
+
}
|
|
4105
|
+
return filteredGroups.reduce((acc, group) => {
|
|
4106
|
+
if (group.items.length > 0) {
|
|
4107
|
+
acc.push(group);
|
|
4108
|
+
}
|
|
4109
|
+
return acc;
|
|
4110
|
+
}, []);
|
|
4111
|
+
}
|
|
4112
|
+
if (search.searchType === "startsWith") {
|
|
4113
|
+
return options.filter(
|
|
4114
|
+
(option) => option.title.toString().toLowerCase().startsWith(searchValue.toLowerCase())
|
|
4115
|
+
);
|
|
4116
|
+
}
|
|
4117
|
+
return options.filter(
|
|
4118
|
+
(option) => option.title.toString().toLowerCase().includes(searchValue.toLowerCase())
|
|
4119
|
+
);
|
|
4120
|
+
}
|
|
4121
|
+
return options;
|
|
4122
|
+
}, [options, searchValue, search]);
|
|
4123
|
+
return /* @__PURE__ */ React25.createElement(SelectWrapper, __spreadValues({}, props), /* @__PURE__ */ React25.createElement(Downshift, __spreadProps(__spreadValues({}, downshiftProps), { stateReducer }), ({
|
|
4037
4124
|
getItemProps,
|
|
4038
4125
|
getInputProps,
|
|
4039
4126
|
getMenuProps,
|
|
@@ -4045,7 +4132,7 @@ var Select = (_a) => {
|
|
|
4045
4132
|
}) => {
|
|
4046
4133
|
return (
|
|
4047
4134
|
// Don't set the role to combobox to ensure a consistent experience for screen readers
|
|
4048
|
-
/* @__PURE__ */
|
|
4135
|
+
/* @__PURE__ */ React25.createElement("div", { role: "presentation" }, /* @__PURE__ */ React25.createElement("div", __spreadValues({}, triggerProps), trigger ? /* @__PURE__ */ React25.createElement(
|
|
4049
4136
|
CustomHeader,
|
|
4050
4137
|
{
|
|
4051
4138
|
getToggleButtonProps,
|
|
@@ -4060,7 +4147,7 @@ var Select = (_a) => {
|
|
|
4060
4147
|
hasError,
|
|
4061
4148
|
errorMessage
|
|
4062
4149
|
}
|
|
4063
|
-
) : /* @__PURE__ */
|
|
4150
|
+
) : /* @__PURE__ */ React25.createElement(
|
|
4064
4151
|
SelectHeader,
|
|
4065
4152
|
{
|
|
4066
4153
|
getToggleButtonProps,
|
|
@@ -4075,7 +4162,7 @@ var Select = (_a) => {
|
|
|
4075
4162
|
hasError
|
|
4076
4163
|
}
|
|
4077
4164
|
)), downshiftIsOpen && isOpen && renderLayer(
|
|
4078
|
-
/* @__PURE__ */
|
|
4165
|
+
/* @__PURE__ */ React25.createElement(
|
|
4079
4166
|
"div",
|
|
4080
4167
|
__spreadProps(__spreadValues({}, layerProps), {
|
|
4081
4168
|
style: __spreadProps(__spreadValues({}, layerProps.style), {
|
|
@@ -4083,7 +4170,7 @@ var Select = (_a) => {
|
|
|
4083
4170
|
width: menuMinWidth ? "auto" : triggerBounds == null ? void 0 : triggerBounds.width
|
|
4084
4171
|
})
|
|
4085
4172
|
}),
|
|
4086
|
-
/* @__PURE__ */
|
|
4173
|
+
/* @__PURE__ */ React25.createElement(
|
|
4087
4174
|
SelectMenu,
|
|
4088
4175
|
{
|
|
4089
4176
|
options,
|
|
@@ -4095,19 +4182,29 @@ var Select = (_a) => {
|
|
|
4095
4182
|
downshiftMenuProps: getMenuProps,
|
|
4096
4183
|
maxWidth: menuMaxWidth,
|
|
4097
4184
|
maxHeight: menuMaxHeight,
|
|
4098
|
-
minWidth: menuMinWidth
|
|
4185
|
+
minWidth: menuMinWidth,
|
|
4186
|
+
search: search && /* @__PURE__ */ React25.createElement(
|
|
4187
|
+
search_bar_default,
|
|
4188
|
+
{
|
|
4189
|
+
ariaLabel: search.searchPlaceholder,
|
|
4190
|
+
placeholder: search.searchPlaceholder,
|
|
4191
|
+
value: searchValue,
|
|
4192
|
+
onChange: onSearchChange,
|
|
4193
|
+
getInputProps
|
|
4194
|
+
}
|
|
4195
|
+
)
|
|
4099
4196
|
}
|
|
4100
4197
|
)
|
|
4101
4198
|
)
|
|
4102
|
-
), hasError && !downshiftIsOpen && /* @__PURE__ */
|
|
4199
|
+
), hasError && !downshiftIsOpen && /* @__PURE__ */ React25.createElement(ErrorMessage, null, errorMessage))
|
|
4103
4200
|
);
|
|
4104
4201
|
}));
|
|
4105
4202
|
};
|
|
4106
4203
|
var select_default = Select;
|
|
4107
4204
|
|
|
4108
4205
|
// src/components/backdrop/backdrop.tsx
|
|
4109
|
-
import
|
|
4110
|
-
import
|
|
4206
|
+
import styled20 from "@emotion/styled";
|
|
4207
|
+
import React26 from "react";
|
|
4111
4208
|
import { useTransition } from "transition-hook";
|
|
4112
4209
|
|
|
4113
4210
|
// src/hooks/use-prevent-scroll.ts
|
|
@@ -4173,7 +4270,7 @@ var use_prevent_scroll_default = usePreventScroll;
|
|
|
4173
4270
|
|
|
4174
4271
|
// src/components/backdrop/backdrop.tsx
|
|
4175
4272
|
var duration = 300;
|
|
4176
|
-
var BackdropWrapper =
|
|
4273
|
+
var BackdropWrapper = styled20.div`
|
|
4177
4274
|
position: fixed;
|
|
4178
4275
|
top: 0;
|
|
4179
4276
|
left: 0;
|
|
@@ -4183,7 +4280,7 @@ var BackdropWrapper = styled19.div`
|
|
|
4183
4280
|
z-index: ${(props) => props.zIndex};
|
|
4184
4281
|
overflow: hidden;
|
|
4185
4282
|
`;
|
|
4186
|
-
var ChildrenWrapper =
|
|
4283
|
+
var ChildrenWrapper = styled20.div`
|
|
4187
4284
|
overflow: auto;
|
|
4188
4285
|
height: 100%;
|
|
4189
4286
|
`;
|
|
@@ -4201,7 +4298,7 @@ var Backdrop = (_a) => {
|
|
|
4201
4298
|
]);
|
|
4202
4299
|
const { stage, shouldMount } = useTransition(isOpen, duration);
|
|
4203
4300
|
use_prevent_scroll_default("html", isOpen);
|
|
4204
|
-
return /* @__PURE__ */
|
|
4301
|
+
return /* @__PURE__ */ React26.createElement(React26.Fragment, null, shouldMount && /* @__PURE__ */ React26.createElement(
|
|
4205
4302
|
BackdropWrapper,
|
|
4206
4303
|
__spreadValues({
|
|
4207
4304
|
backgroundColor,
|
|
@@ -4211,31 +4308,31 @@ var Backdrop = (_a) => {
|
|
|
4211
4308
|
opacity: stage === "enter" ? 1 : 0
|
|
4212
4309
|
}
|
|
4213
4310
|
}, props),
|
|
4214
|
-
/* @__PURE__ */
|
|
4311
|
+
/* @__PURE__ */ React26.createElement(ChildrenWrapper, null, children)
|
|
4215
4312
|
));
|
|
4216
4313
|
};
|
|
4217
4314
|
var backdrop_default = Backdrop;
|
|
4218
4315
|
|
|
4219
4316
|
// src/components/modal/modal.tsx
|
|
4220
|
-
import
|
|
4317
|
+
import styled21 from "@emotion/styled";
|
|
4221
4318
|
import FocusTrap from "focus-trap-react";
|
|
4222
|
-
import
|
|
4319
|
+
import React28, { useEffect as useEffect3 } from "react";
|
|
4223
4320
|
|
|
4224
4321
|
// src/components/icon/available-icons/close.tsx
|
|
4225
4322
|
import CloseIcon from "@atlaskit/icon/core/close";
|
|
4226
|
-
import * as
|
|
4323
|
+
import * as React27 from "react";
|
|
4227
4324
|
function SvgClose() {
|
|
4228
|
-
return /* @__PURE__ */
|
|
4325
|
+
return /* @__PURE__ */ React27.createElement(CloseIcon, { label: "", testId: "ads-refreshed-icon" });
|
|
4229
4326
|
}
|
|
4230
4327
|
|
|
4231
4328
|
// src/components/modal/modal.tsx
|
|
4232
4329
|
var DEFAULT_MODAL_CARD_HEIGHT = "70vh";
|
|
4233
|
-
var ContentWrapper =
|
|
4330
|
+
var ContentWrapper = styled21.div`
|
|
4234
4331
|
display: grid;
|
|
4235
4332
|
grid-template-rows: ${(props) => props.rows};
|
|
4236
4333
|
position: relative;
|
|
4237
4334
|
`;
|
|
4238
|
-
var ModalCardWrapper =
|
|
4335
|
+
var ModalCardWrapper = styled21.dialog`
|
|
4239
4336
|
top: ${(props) => getPlacement(getSizeValue(props.maxHeight), props.placement).top};
|
|
4240
4337
|
background-color: ${getColorValue("overlay")};
|
|
4241
4338
|
color: ${getColorValue("body")};
|
|
@@ -4258,27 +4355,27 @@ var ModalCardWrapper = styled20.dialog`
|
|
|
4258
4355
|
background: var(--lns-color-overlay);
|
|
4259
4356
|
}
|
|
4260
4357
|
`;
|
|
4261
|
-
var CloseIconSection =
|
|
4358
|
+
var CloseIconSection = styled21.div`
|
|
4262
4359
|
position: absolute;
|
|
4263
4360
|
top: ${u(1.5)};
|
|
4264
4361
|
right: ${u(1.5)};
|
|
4265
4362
|
z-index: 1;
|
|
4266
4363
|
`;
|
|
4267
|
-
var RightButtonsSection =
|
|
4364
|
+
var RightButtonsSection = styled21.div`
|
|
4268
4365
|
margin-left: auto;
|
|
4269
4366
|
|
|
4270
4367
|
* {
|
|
4271
4368
|
vertical-align: middle;
|
|
4272
4369
|
}
|
|
4273
4370
|
`;
|
|
4274
|
-
var TitleSection =
|
|
4371
|
+
var TitleSection = styled21.div`
|
|
4275
4372
|
padding-left: var(--lns-space-xlarge);
|
|
4276
4373
|
padding-right: var(--lns-space-xlarge);
|
|
4277
4374
|
padding-top: var(--lns-space-xlarge);
|
|
4278
4375
|
padding-bottom: ${(props) => props.bottom};
|
|
4279
4376
|
flex-shrink: 0;
|
|
4280
4377
|
`;
|
|
4281
|
-
var ButtonsSection =
|
|
4378
|
+
var ButtonsSection = styled21.div`
|
|
4282
4379
|
padding-left: var(--lns-space-xlarge);
|
|
4283
4380
|
padding-right: var(--lns-space-xlarge);
|
|
4284
4381
|
padding-bottom: var(--lns-space-xlarge);
|
|
@@ -4288,7 +4385,7 @@ var ButtonsSection = styled20.div`
|
|
|
4288
4385
|
justify-content: space-between;
|
|
4289
4386
|
align-items: center;
|
|
4290
4387
|
`;
|
|
4291
|
-
var ChildrenSection2 =
|
|
4388
|
+
var ChildrenSection2 = styled21.div`
|
|
4292
4389
|
display: flex;
|
|
4293
4390
|
flex-direction: column;
|
|
4294
4391
|
overflow: auto;
|
|
@@ -4300,7 +4397,7 @@ var ChildrenSection2 = styled20.div`
|
|
|
4300
4397
|
border-color: ${getColorValue("border")};
|
|
4301
4398
|
border-width: ${(props) => props.hasDividers ? "1px 0" : "0"};
|
|
4302
4399
|
`;
|
|
4303
|
-
var ModalCardChildrenSection =
|
|
4400
|
+
var ModalCardChildrenSection = styled21.div`
|
|
4304
4401
|
overflow: auto;
|
|
4305
4402
|
|
|
4306
4403
|
${(props) => getMaxHeight(props.maxHeight)};
|
|
@@ -4358,7 +4455,7 @@ var ModalCard = (_a) => {
|
|
|
4358
4455
|
};
|
|
4359
4456
|
}, [isOpen, onCloseClick]);
|
|
4360
4457
|
use_prevent_scroll_default("html", isOpen);
|
|
4361
|
-
return /* @__PURE__ */
|
|
4458
|
+
return /* @__PURE__ */ React28.createElement(
|
|
4362
4459
|
FocusTrap,
|
|
4363
4460
|
{
|
|
4364
4461
|
active: isOpen,
|
|
@@ -4367,7 +4464,7 @@ var ModalCard = (_a) => {
|
|
|
4367
4464
|
allowOutsideClick: true
|
|
4368
4465
|
}, initialFocus !== void 0 ? { initialFocus } : {})
|
|
4369
4466
|
},
|
|
4370
|
-
/* @__PURE__ */
|
|
4467
|
+
/* @__PURE__ */ React28.createElement(
|
|
4371
4468
|
ModalCardWrapper,
|
|
4372
4469
|
__spreadValues({
|
|
4373
4470
|
open: isOpen,
|
|
@@ -4380,15 +4477,15 @@ var ModalCard = (_a) => {
|
|
|
4380
4477
|
"aria-modal": ariaModal,
|
|
4381
4478
|
"aria-labelledby": ariaLabelledBy
|
|
4382
4479
|
}, props),
|
|
4383
|
-
!removeClose && onCloseClick && /* @__PURE__ */
|
|
4480
|
+
!removeClose && onCloseClick && /* @__PURE__ */ React28.createElement(CloseIconSection, null, /* @__PURE__ */ React28.createElement(
|
|
4384
4481
|
icon_button_default,
|
|
4385
4482
|
{
|
|
4386
4483
|
altText: "Close",
|
|
4387
|
-
icon: /* @__PURE__ */
|
|
4484
|
+
icon: /* @__PURE__ */ React28.createElement(SvgClose, null),
|
|
4388
4485
|
onClick: onCloseClick
|
|
4389
4486
|
}
|
|
4390
4487
|
)),
|
|
4391
|
-
/* @__PURE__ */
|
|
4488
|
+
/* @__PURE__ */ React28.createElement(
|
|
4392
4489
|
ModalCardChildrenSection,
|
|
4393
4490
|
__spreadProps(__spreadValues({}, removeClose ? { tabIndex: 0 } : { tabIndex: -1 }), {
|
|
4394
4491
|
maxHeight
|
|
@@ -4398,7 +4495,7 @@ var ModalCard = (_a) => {
|
|
|
4398
4495
|
)
|
|
4399
4496
|
);
|
|
4400
4497
|
};
|
|
4401
|
-
var Modal =
|
|
4498
|
+
var Modal = React28.forwardRef(
|
|
4402
4499
|
(_a, ref) => {
|
|
4403
4500
|
var _b = _a, {
|
|
4404
4501
|
children,
|
|
@@ -4454,14 +4551,14 @@ var Modal = React26.forwardRef(
|
|
|
4454
4551
|
}
|
|
4455
4552
|
onCloseClick(e);
|
|
4456
4553
|
};
|
|
4457
|
-
return /* @__PURE__ */
|
|
4554
|
+
return /* @__PURE__ */ React28.createElement(backdrop_default, __spreadValues({ isOpen, zIndex }, props), /* @__PURE__ */ React28.createElement(
|
|
4458
4555
|
container_default,
|
|
4459
4556
|
{
|
|
4460
4557
|
height: "100%",
|
|
4461
4558
|
onClick: closeClickHandler,
|
|
4462
4559
|
onKeyDown
|
|
4463
4560
|
},
|
|
4464
|
-
/* @__PURE__ */
|
|
4561
|
+
/* @__PURE__ */ React28.createElement(
|
|
4465
4562
|
ModalCard,
|
|
4466
4563
|
{
|
|
4467
4564
|
ref,
|
|
@@ -4476,19 +4573,19 @@ var Modal = React26.forwardRef(
|
|
|
4476
4573
|
ariaLabelledBy: (_a2 = ariaLabelledBy != null ? ariaLabelledBy : titleId) != null ? _a2 : void 0,
|
|
4477
4574
|
initialFocus
|
|
4478
4575
|
},
|
|
4479
|
-
/* @__PURE__ */
|
|
4576
|
+
/* @__PURE__ */ React28.createElement(
|
|
4480
4577
|
ContentWrapper,
|
|
4481
4578
|
{
|
|
4482
4579
|
rows: `${title ? "auto " : ""} ${children ? "1fr " : ""} ${hasButtons ? "auto" : ""}`
|
|
4483
4580
|
},
|
|
4484
|
-
title && /* @__PURE__ */
|
|
4581
|
+
title && /* @__PURE__ */ React28.createElement(
|
|
4485
4582
|
TitleSection,
|
|
4486
4583
|
{
|
|
4487
4584
|
bottom: children ? "var(--lns-space-medium)" : "var(--lns-space-xlarge)"
|
|
4488
4585
|
},
|
|
4489
|
-
/* @__PURE__ */
|
|
4586
|
+
/* @__PURE__ */ React28.createElement(text_default, { htmlTag: "h1", variant: "title", id: titleId }, title)
|
|
4490
4587
|
),
|
|
4491
|
-
/* @__PURE__ */
|
|
4588
|
+
/* @__PURE__ */ React28.createElement(
|
|
4492
4589
|
ChildrenSection2,
|
|
4493
4590
|
{
|
|
4494
4591
|
noPadding,
|
|
@@ -4498,14 +4595,14 @@ var Modal = React26.forwardRef(
|
|
|
4498
4595
|
},
|
|
4499
4596
|
children && children
|
|
4500
4597
|
),
|
|
4501
|
-
hasButtons && /* @__PURE__ */
|
|
4598
|
+
hasButtons && /* @__PURE__ */ React28.createElement(
|
|
4502
4599
|
ButtonsSection,
|
|
4503
4600
|
{
|
|
4504
4601
|
top: children ? "var(--lns-space-xlarge)" : 0,
|
|
4505
4602
|
hasDividers
|
|
4506
4603
|
},
|
|
4507
4604
|
alternativeButton,
|
|
4508
|
-
/* @__PURE__ */
|
|
4605
|
+
/* @__PURE__ */ React28.createElement(RightButtonsSection, null, secondaryButton && /* @__PURE__ */ React28.createElement(spacer_default, { right: "small", isInline: true }, secondaryButton), mainButton)
|
|
4509
4606
|
)
|
|
4510
4607
|
)
|
|
4511
4608
|
)
|
|
@@ -4516,8 +4613,8 @@ var modal_default = Modal;
|
|
|
4516
4613
|
|
|
4517
4614
|
// src/components/link/link.tsx
|
|
4518
4615
|
import { css as css3 } from "@emotion/react";
|
|
4519
|
-
import
|
|
4520
|
-
import
|
|
4616
|
+
import styled22 from "@emotion/styled";
|
|
4617
|
+
import React29 from "react";
|
|
4521
4618
|
var variants2 = {
|
|
4522
4619
|
neutral: {
|
|
4523
4620
|
color: getColorValue("inherit"),
|
|
@@ -4551,7 +4648,7 @@ var buttonStyles = {
|
|
|
4551
4648
|
font: inherit;
|
|
4552
4649
|
`
|
|
4553
4650
|
};
|
|
4554
|
-
var LinkWrapper =
|
|
4651
|
+
var LinkWrapper = styled22.a`
|
|
4555
4652
|
${(props) => !props.disabled && `color: ${variants2[props.variant].color}`};
|
|
4556
4653
|
${(props) => props.disabled ? statusStyles2.disabled : statusStyles2.enabled};
|
|
4557
4654
|
${(props) => props.as === "button" && buttonStyles.isButton};
|
|
@@ -4588,7 +4685,7 @@ var Link = (_a) => {
|
|
|
4588
4685
|
"htmlTag",
|
|
4589
4686
|
"isDisabled"
|
|
4590
4687
|
]);
|
|
4591
|
-
return /* @__PURE__ */
|
|
4688
|
+
return /* @__PURE__ */ React29.createElement(
|
|
4592
4689
|
LinkWrapper,
|
|
4593
4690
|
__spreadValues({
|
|
4594
4691
|
href,
|
|
@@ -4603,8 +4700,8 @@ var availableVariants2 = Object.keys(variants2);
|
|
|
4603
4700
|
var link_default = Link;
|
|
4604
4701
|
|
|
4605
4702
|
// src/components/textarea/textarea.tsx
|
|
4606
|
-
import
|
|
4607
|
-
import
|
|
4703
|
+
import styled23 from "@emotion/styled";
|
|
4704
|
+
import React30 from "react";
|
|
4608
4705
|
var sizesStyles3 = {
|
|
4609
4706
|
small: {
|
|
4610
4707
|
padding: `${u(1.5)} ${u(1.75)}`,
|
|
@@ -4615,7 +4712,7 @@ var sizesStyles3 = {
|
|
|
4615
4712
|
textSize: "medium"
|
|
4616
4713
|
}
|
|
4617
4714
|
};
|
|
4618
|
-
var TextareaWrapper =
|
|
4715
|
+
var TextareaWrapper = styled23.textarea`
|
|
4619
4716
|
width: 100%;
|
|
4620
4717
|
border: none;
|
|
4621
4718
|
font-family: inherit;
|
|
@@ -4654,7 +4751,7 @@ var TextareaWrapper = styled22.textarea`
|
|
|
4654
4751
|
color: ${getColorValue("bodyDimmed")};
|
|
4655
4752
|
}
|
|
4656
4753
|
`;
|
|
4657
|
-
var Textarea =
|
|
4754
|
+
var Textarea = React30.forwardRef(
|
|
4658
4755
|
(_a, ref) => {
|
|
4659
4756
|
var _b = _a, {
|
|
4660
4757
|
onChange,
|
|
@@ -4675,7 +4772,7 @@ var Textarea = React28.forwardRef(
|
|
|
4675
4772
|
"resize",
|
|
4676
4773
|
"error"
|
|
4677
4774
|
]);
|
|
4678
|
-
return /* @__PURE__ */
|
|
4775
|
+
return /* @__PURE__ */ React30.createElement(React30.Fragment, null, /* @__PURE__ */ React30.createElement(
|
|
4679
4776
|
TextareaWrapper,
|
|
4680
4777
|
__spreadValues({
|
|
4681
4778
|
disabled: isDisabled,
|
|
@@ -4688,33 +4785,33 @@ var Textarea = React28.forwardRef(
|
|
|
4688
4785
|
resize,
|
|
4689
4786
|
error
|
|
4690
4787
|
}, props)
|
|
4691
|
-
), error ? /* @__PURE__ */
|
|
4788
|
+
), 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
4789
|
}
|
|
4693
4790
|
);
|
|
4694
4791
|
var textarea_default = Textarea;
|
|
4695
4792
|
|
|
4696
4793
|
// src/components/typeahead/typeahead.tsx
|
|
4697
|
-
import
|
|
4794
|
+
import styled24 from "@emotion/styled";
|
|
4698
4795
|
import Downshift2 from "downshift";
|
|
4699
|
-
import
|
|
4796
|
+
import React31, {
|
|
4700
4797
|
useEffect as useEffect4,
|
|
4701
4798
|
useState as useState2,
|
|
4702
|
-
useMemo,
|
|
4799
|
+
useMemo as useMemo2,
|
|
4703
4800
|
forwardRef as forwardRef3,
|
|
4704
4801
|
useRef as useRef2,
|
|
4705
4802
|
useCallback as useCallback2
|
|
4706
4803
|
} from "react";
|
|
4707
4804
|
import { useLayer as useLayer2 } from "react-laag";
|
|
4708
4805
|
import ResizeObserver2 from "resize-observer-polyfill";
|
|
4709
|
-
var TypeaheadWrapper =
|
|
4806
|
+
var TypeaheadWrapper = styled24.div`
|
|
4710
4807
|
position: relative;
|
|
4711
4808
|
`;
|
|
4712
|
-
var Group2 =
|
|
4809
|
+
var Group2 = styled24.ul`
|
|
4713
4810
|
list-style: none;
|
|
4714
4811
|
margin: 0;
|
|
4715
4812
|
padding: 0;
|
|
4716
4813
|
`;
|
|
4717
|
-
var ErrorMessage2 =
|
|
4814
|
+
var ErrorMessage2 = styled24.span`
|
|
4718
4815
|
color: var(--lns-color-red);
|
|
4719
4816
|
margin-top: var(--lns-space-xsmall);
|
|
4720
4817
|
display: block;
|
|
@@ -4777,7 +4874,7 @@ var getHeaderAccessibilityProps2 = ({
|
|
|
4777
4874
|
"aria-label": [ariaMenuName, valueLabel].filter(Boolean).join(", ")
|
|
4778
4875
|
};
|
|
4779
4876
|
};
|
|
4780
|
-
var TypeaheadHeaderWrapper =
|
|
4877
|
+
var TypeaheadHeaderWrapper = styled24.button`
|
|
4781
4878
|
position: relative;
|
|
4782
4879
|
width: 100%;
|
|
4783
4880
|
background: none;
|
|
@@ -4792,7 +4889,7 @@ var TypeaheadHeaderWrapper = styled23.button`
|
|
|
4792
4889
|
cursor: default;
|
|
4793
4890
|
}
|
|
4794
4891
|
`;
|
|
4795
|
-
var TypeaheadInputField =
|
|
4892
|
+
var TypeaheadInputField = styled24.input`
|
|
4796
4893
|
-webkit-appearance: none;
|
|
4797
4894
|
font-family: inherit;
|
|
4798
4895
|
width: 100%;
|
|
@@ -4835,7 +4932,7 @@ var TypeaheadInputField = styled23.input`
|
|
|
4835
4932
|
color: ${getColorValue("bodyDimmed")};
|
|
4836
4933
|
}
|
|
4837
4934
|
`;
|
|
4838
|
-
var IconSection3 =
|
|
4935
|
+
var IconSection3 = styled24.div`
|
|
4839
4936
|
position: absolute;
|
|
4840
4937
|
pointer-events: none;
|
|
4841
4938
|
width: ${u(6)};
|
|
@@ -4845,7 +4942,7 @@ var IconSection3 = styled23.div`
|
|
|
4845
4942
|
justify-content: center;
|
|
4846
4943
|
left: 0;
|
|
4847
4944
|
`;
|
|
4848
|
-
var AddOnSection =
|
|
4945
|
+
var AddOnSection = styled24.div`
|
|
4849
4946
|
position: absolute;
|
|
4850
4947
|
height: 100%;
|
|
4851
4948
|
display: flex;
|
|
@@ -4856,7 +4953,7 @@ var AddOnSection = styled23.div`
|
|
|
4856
4953
|
top: 50%;
|
|
4857
4954
|
transform: translateY(-50%);
|
|
4858
4955
|
`;
|
|
4859
|
-
var TextOverlay =
|
|
4956
|
+
var TextOverlay = styled24.div`
|
|
4860
4957
|
position: absolute;
|
|
4861
4958
|
top: 0;
|
|
4862
4959
|
left: ${(props) => props.hasIcon ? u(5.5) : "var(--lns-formFieldHorizontalPadding)"};
|
|
@@ -4867,7 +4964,7 @@ var TextOverlay = styled23.div`
|
|
|
4867
4964
|
pointer-events: none;
|
|
4868
4965
|
color: inherit;
|
|
4869
4966
|
`;
|
|
4870
|
-
var TypeaheadImage =
|
|
4967
|
+
var TypeaheadImage = styled24.img`
|
|
4871
4968
|
height: 100%;
|
|
4872
4969
|
width: auto;
|
|
4873
4970
|
min-width: 100%;
|
|
@@ -4919,7 +5016,7 @@ var TypeaheadHeader = ({
|
|
|
4919
5016
|
onChange: (e) => handleInputValueChange(e.target.value)
|
|
4920
5017
|
}));
|
|
4921
5018
|
const showPlaceholder = !inputValue && !selectedOptionValue;
|
|
4922
|
-
return /* @__PURE__ */
|
|
5019
|
+
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
5020
|
TypeaheadInputField,
|
|
4924
5021
|
__spreadProps(__spreadValues({
|
|
4925
5022
|
ref: inputRef
|
|
@@ -4929,12 +5026,12 @@ var TypeaheadHeader = ({
|
|
|
4929
5026
|
hasError,
|
|
4930
5027
|
isDisabled
|
|
4931
5028
|
})
|
|
4932
|
-
), !inputValue && /* @__PURE__ */
|
|
5029
|
+
), !inputValue && /* @__PURE__ */ React31.createElement(TextOverlay, { hasIcon }, /* @__PURE__ */ React31.createElement(text_default, { hasEllipsis: true, color: showPlaceholder ? "bodyDimmed" : "inherit" }, getTitle2({
|
|
4933
5030
|
options,
|
|
4934
5031
|
selectedItem,
|
|
4935
5032
|
selectedOptionValue,
|
|
4936
5033
|
placeholder
|
|
4937
|
-
}))), /* @__PURE__ */
|
|
5034
|
+
}))), /* @__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
5035
|
};
|
|
4939
5036
|
var getSelectedOption2 = (value, options) => {
|
|
4940
5037
|
var _a;
|
|
@@ -4956,7 +5053,7 @@ var didSelectedOptionValueChange2 = (selectedOptionValue, prevSelectedItem) => {
|
|
|
4956
5053
|
};
|
|
4957
5054
|
var renderOption2 = (item, index, selectedItem, selectedOptionValue, highlightedIndex, getItemProps) => {
|
|
4958
5055
|
const isSelected = !selectedItem && item.value === selectedOptionValue || selectedItem && selectedItem.value === item.value;
|
|
4959
|
-
return /* @__PURE__ */
|
|
5056
|
+
return /* @__PURE__ */ React31.createElement(
|
|
4960
5057
|
MenuItem,
|
|
4961
5058
|
__spreadProps(__spreadValues({
|
|
4962
5059
|
key: index,
|
|
@@ -5000,16 +5097,16 @@ var TypeaheadMenu = (_a) => {
|
|
|
5000
5097
|
"emptyResultsMessage",
|
|
5001
5098
|
"hasAvailableOptions"
|
|
5002
5099
|
]);
|
|
5003
|
-
const defaultLoadingMessage = loadingMessage || /* @__PURE__ */
|
|
5100
|
+
const defaultLoadingMessage = loadingMessage || /* @__PURE__ */ React31.createElement(loader_default, null);
|
|
5004
5101
|
const defaultEmptyResultsMessage = emptyResultsMessage || "No results";
|
|
5005
5102
|
if (isLoading) {
|
|
5006
|
-
return /* @__PURE__ */
|
|
5103
|
+
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
5104
|
}
|
|
5008
5105
|
if (!hasAvailableOptions) {
|
|
5009
|
-
return /* @__PURE__ */
|
|
5106
|
+
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
5107
|
}
|
|
5011
5108
|
if (!isGrouped2(options)) {
|
|
5012
|
-
return /* @__PURE__ */
|
|
5109
|
+
return /* @__PURE__ */ React31.createElement(menu_default, __spreadValues({}, menuProps), options.map(
|
|
5013
5110
|
(item, index) => renderOption2(
|
|
5014
5111
|
item,
|
|
5015
5112
|
index,
|
|
@@ -5021,9 +5118,9 @@ var TypeaheadMenu = (_a) => {
|
|
|
5021
5118
|
));
|
|
5022
5119
|
}
|
|
5023
5120
|
let downshiftIndex = 0;
|
|
5024
|
-
return /* @__PURE__ */
|
|
5121
|
+
return /* @__PURE__ */ React31.createElement(menu_default, __spreadValues({}, menuProps), options.map((group) => {
|
|
5025
5122
|
const groupId = `group-${group.group.replace(/\s+/g, "-")}`;
|
|
5026
|
-
return /* @__PURE__ */
|
|
5123
|
+
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
5124
|
return renderOption2(
|
|
5028
5125
|
item,
|
|
5029
5126
|
downshiftIndex++,
|
|
@@ -5140,7 +5237,7 @@ var Typeahead = forwardRef3(
|
|
|
5140
5237
|
(_a2 = internalInputRef.current) == null ? void 0 : _a2.blur();
|
|
5141
5238
|
}
|
|
5142
5239
|
}, [downshiftIsOpen, onOpenChange]);
|
|
5143
|
-
const hasAvailableOptions =
|
|
5240
|
+
const hasAvailableOptions = useMemo2(() => {
|
|
5144
5241
|
if (!Array.isArray(options)) {
|
|
5145
5242
|
return false;
|
|
5146
5243
|
}
|
|
@@ -5156,7 +5253,7 @@ var Typeahead = forwardRef3(
|
|
|
5156
5253
|
}
|
|
5157
5254
|
return changes;
|
|
5158
5255
|
};
|
|
5159
|
-
return /* @__PURE__ */
|
|
5256
|
+
return /* @__PURE__ */ React31.createElement(TypeaheadWrapper, __spreadValues({}, props), /* @__PURE__ */ React31.createElement(Downshift2, __spreadProps(__spreadValues({}, downshiftProps), { stateReducer }), ({
|
|
5160
5257
|
getItemProps,
|
|
5161
5258
|
getInputProps,
|
|
5162
5259
|
getMenuProps,
|
|
@@ -5166,7 +5263,7 @@ var Typeahead = forwardRef3(
|
|
|
5166
5263
|
}) => {
|
|
5167
5264
|
return (
|
|
5168
5265
|
// Don't set the role to combobox to ensure a consistent experience for screen readers
|
|
5169
|
-
/* @__PURE__ */
|
|
5266
|
+
/* @__PURE__ */ React31.createElement("div", { role: "presentation" }, /* @__PURE__ */ React31.createElement("div", __spreadValues({}, triggerProps), /* @__PURE__ */ React31.createElement(
|
|
5170
5267
|
TypeaheadHeader,
|
|
5171
5268
|
{
|
|
5172
5269
|
inputRef,
|
|
@@ -5187,7 +5284,7 @@ var Typeahead = forwardRef3(
|
|
|
5187
5284
|
hasError: Boolean(errorMessage)
|
|
5188
5285
|
}
|
|
5189
5286
|
)), downshiftIsOpen && isOpen && renderLayer(
|
|
5190
|
-
/* @__PURE__ */
|
|
5287
|
+
/* @__PURE__ */ React31.createElement(
|
|
5191
5288
|
"div",
|
|
5192
5289
|
__spreadProps(__spreadValues({}, layerProps), {
|
|
5193
5290
|
style: __spreadProps(__spreadValues({}, layerProps.style), {
|
|
@@ -5195,7 +5292,7 @@ var Typeahead = forwardRef3(
|
|
|
5195
5292
|
width: menuMinWidth ? "auto" : triggerBounds == null ? void 0 : triggerBounds.width
|
|
5196
5293
|
})
|
|
5197
5294
|
}),
|
|
5198
|
-
/* @__PURE__ */
|
|
5295
|
+
/* @__PURE__ */ React31.createElement(
|
|
5199
5296
|
TypeaheadMenu,
|
|
5200
5297
|
{
|
|
5201
5298
|
options,
|
|
@@ -5215,7 +5312,7 @@ var Typeahead = forwardRef3(
|
|
|
5215
5312
|
}
|
|
5216
5313
|
)
|
|
5217
5314
|
)
|
|
5218
|
-
), Boolean(errorMessage) && !downshiftIsOpen ? /* @__PURE__ */
|
|
5315
|
+
), Boolean(errorMessage) && !downshiftIsOpen ? /* @__PURE__ */ React31.createElement(ErrorMessage2, null, errorMessage) : null)
|
|
5219
5316
|
);
|
|
5220
5317
|
}));
|
|
5221
5318
|
}
|
|
@@ -5226,51 +5323,9 @@ var typeahead_default = Typeahead;
|
|
|
5226
5323
|
// src/components/dropdown/dropdown.tsx
|
|
5227
5324
|
import styled25 from "@emotion/styled";
|
|
5228
5325
|
import Downshift3 from "downshift";
|
|
5229
|
-
import React32, { useEffect as useEffect5, useMemo as
|
|
5326
|
+
import React32, { useEffect as useEffect5, useMemo as useMemo3, useState as useState3 } from "react";
|
|
5230
5327
|
import { useLayer as useLayer3 } from "react-laag";
|
|
5231
5328
|
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
5329
|
var getAccessibilityProps = ({
|
|
5275
5330
|
ariaMenuName,
|
|
5276
5331
|
getInputProps,
|
|
@@ -5348,23 +5403,25 @@ var Dropdown = (_a) => {
|
|
|
5348
5403
|
}
|
|
5349
5404
|
return changes;
|
|
5350
5405
|
};
|
|
5351
|
-
|
|
5352
|
-
if (
|
|
5406
|
+
options = useMemo3(() => {
|
|
5407
|
+
if (search) {
|
|
5408
|
+
if (search.searchType === "startsWith") {
|
|
5409
|
+
return options.filter(
|
|
5410
|
+
(option) => {
|
|
5411
|
+
var _a2;
|
|
5412
|
+
return (_a2 = option.title) == null ? void 0 : _a2.toString().toLowerCase().startsWith(searchValue.toLowerCase());
|
|
5413
|
+
}
|
|
5414
|
+
);
|
|
5415
|
+
}
|
|
5353
5416
|
return options.filter(
|
|
5354
5417
|
(option) => {
|
|
5355
5418
|
var _a2;
|
|
5356
|
-
return (_a2 = option.title) == null ? void 0 : _a2.toString().toLowerCase().
|
|
5419
|
+
return (_a2 = option.title) == null ? void 0 : _a2.toString().toLowerCase().includes(searchValue.toLowerCase());
|
|
5357
5420
|
}
|
|
5358
5421
|
);
|
|
5359
5422
|
}
|
|
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;
|
|
5423
|
+
return options;
|
|
5424
|
+
}, [options, searchValue, search]);
|
|
5368
5425
|
return /* @__PURE__ */ React32.createElement(
|
|
5369
5426
|
Downshift3,
|
|
5370
5427
|
{
|