@loomhq/lens 12.12.4 → 12.13.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/icons/diagram-symbol-decision.js +45 -0
- package/dist/cjs/icons/diagram-symbol-decision.js.map +7 -0
- package/dist/cjs/icons/index.js +669 -656
- package/dist/cjs/icons/index.js.map +4 -4
- package/dist/cjs/index.js +162 -60
- package/dist/cjs/index.js.map +4 -4
- package/dist/esm/icons/chunk-VG3SGXWL.js +16 -0
- package/dist/esm/icons/chunk-VG3SGXWL.js.map +7 -0
- package/dist/esm/icons/diagram-symbol-decision.js +8 -0
- package/dist/esm/icons/diagram-symbol-decision.js.map +7 -0
- package/dist/esm/icons/index.js +63 -59
- package/dist/esm/index.js +191 -89
- package/dist/esm/index.js.map +4 -4
- package/dist/types/icons/diagram-symbol-decision.d.ts +3 -0
- package/dist/types/icons/diagram-symbol-decision.d.ts.map +1 -0
- package/dist/types/icons/index.d.ts +1 -0
- package/dist/types/icons/index.d.ts.map +1 -1
- package/dist/types/src/components/container/container.d.ts +1 -1
- package/dist/types/src/components/container/container.d.ts.map +1 -1
- package/dist/types/src/components/icon/available-icons/diagram-symbol-decision.d.ts +3 -0
- package/dist/types/src/components/icon/available-icons/diagram-symbol-decision.d.ts.map +1 -0
- package/dist/types/src/components/icon/available-icons/index.d.ts +1 -0
- package/dist/types/src/components/icon/available-icons/index.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/menu/menu.d.ts +2 -1
- package/dist/types/src/components/menu/menu.d.ts.map +1 -1
- package/dist/types/src/components/modal/modal.d.ts +3 -1
- package/dist/types/src/components/modal/modal.d.ts.map +1 -1
- package/dist/types/src/components/search-bar/search-bar.d.ts.map +1 -1
- package/dist/types/src/components/select/select.d.ts +22 -3
- package/dist/types/src/components/select/select.d.ts.map +1 -1
- package/dist/types/src/components/skeleton/skeleton.d.ts +1 -1
- package/dist/types/src/components/skeleton/skeleton.d.ts.map +1 -1
- package/dist/types/src/components/text/text.d.ts +7 -1
- package/dist/types/src/components/text/text.d.ts.map +1 -1
- package/dist/types/src/components/tooltip/tooltip.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/esm/index.js
CHANGED
|
@@ -878,6 +878,11 @@ var layoutDeprecatedWarning = `Lens: Layout component is deprecated. Use Arrange
|
|
|
878
878
|
|
|
879
879
|
// src/components/text/text.tsx
|
|
880
880
|
var dimAmount = 0.6;
|
|
881
|
+
var FontFamily = /* @__PURE__ */ ((FontFamily2) => {
|
|
882
|
+
FontFamily2["sans-serif"] = "inherit";
|
|
883
|
+
FontFamily2["mono"] = "Atlassian Mono";
|
|
884
|
+
return FontFamily2;
|
|
885
|
+
})(FontFamily || {});
|
|
881
886
|
var variants = {
|
|
882
887
|
body: {
|
|
883
888
|
size: "body-md",
|
|
@@ -908,6 +913,7 @@ var TextWrapper = styled.span`
|
|
|
908
913
|
${(props) => props.fontSetting && `font-feature-settings: ${getFontSetting(props.fontSetting)}`};
|
|
909
914
|
${(props) => props.isDimmed && `opacity: ${dimAmount}`};
|
|
910
915
|
${(props) => props.alignment && `text-align: ${props.alignment}`};
|
|
916
|
+
${(props) => props.overflowWrap && `overflow-wrap: ${props.overflowWrap};`};
|
|
911
917
|
${(props) => props.hasEllipsis && !props.ellipsisLines && `
|
|
912
918
|
overflow: hidden;
|
|
913
919
|
text-overflow: ellipsis;
|
|
@@ -920,6 +926,7 @@ var TextWrapper = styled.span`
|
|
|
920
926
|
-webkit-line-clamp: ${props.ellipsisLines};
|
|
921
927
|
`};
|
|
922
928
|
${(props) => !props.hasEllipsis && props.noWrap && "white-space: nowrap; overflow: hidden;"};
|
|
929
|
+
${(props) => props.fontFamily && `font-family: ${FontFamily[props.fontFamily]};`};
|
|
923
930
|
${(props) => props.sizeMinMax && `
|
|
924
931
|
min-height: 0vw;
|
|
925
932
|
font-size: clamp(
|
|
@@ -952,6 +959,7 @@ var Text = (_a) => {
|
|
|
952
959
|
color,
|
|
953
960
|
isInline,
|
|
954
961
|
isDimmed,
|
|
962
|
+
fontFamily = "sans-serif",
|
|
955
963
|
fontWeight = "regular",
|
|
956
964
|
hasEllipsis,
|
|
957
965
|
ellipsisLines,
|
|
@@ -960,13 +968,15 @@ var Text = (_a) => {
|
|
|
960
968
|
htmlTag = "span",
|
|
961
969
|
alignment,
|
|
962
970
|
sizeMinMax,
|
|
963
|
-
fontSetting = "normal"
|
|
971
|
+
fontSetting = "normal",
|
|
972
|
+
overflowWrap
|
|
964
973
|
} = _b, props = __objRest(_b, [
|
|
965
974
|
"children",
|
|
966
975
|
"size",
|
|
967
976
|
"color",
|
|
968
977
|
"isInline",
|
|
969
978
|
"isDimmed",
|
|
979
|
+
"fontFamily",
|
|
970
980
|
"fontWeight",
|
|
971
981
|
"hasEllipsis",
|
|
972
982
|
"ellipsisLines",
|
|
@@ -975,7 +985,8 @@ var Text = (_a) => {
|
|
|
975
985
|
"htmlTag",
|
|
976
986
|
"alignment",
|
|
977
987
|
"sizeMinMax",
|
|
978
|
-
"fontSetting"
|
|
988
|
+
"fontSetting",
|
|
989
|
+
"overflowWrap"
|
|
979
990
|
]);
|
|
980
991
|
if (isDimmed) {
|
|
981
992
|
console.warn(textIsDimmedDeprecated);
|
|
@@ -991,6 +1002,7 @@ var Text = (_a) => {
|
|
|
991
1002
|
isInline,
|
|
992
1003
|
isDimmed,
|
|
993
1004
|
fontWeight: variant ? variants[variant].fontWeight : fontWeight,
|
|
1005
|
+
fontFamily,
|
|
994
1006
|
hasEllipsis,
|
|
995
1007
|
ellipsisLines,
|
|
996
1008
|
noWrap,
|
|
@@ -998,7 +1010,8 @@ var Text = (_a) => {
|
|
|
998
1010
|
as: htmlTag,
|
|
999
1011
|
alignment,
|
|
1000
1012
|
sizeMinMax,
|
|
1001
|
-
fontSetting
|
|
1013
|
+
fontSetting,
|
|
1014
|
+
overflowWrap
|
|
1002
1015
|
}, props),
|
|
1003
1016
|
children
|
|
1004
1017
|
);
|
|
@@ -3471,7 +3484,7 @@ var text_button_default = TextButton;
|
|
|
3471
3484
|
// src/components/select/select.tsx
|
|
3472
3485
|
import styled19 from "@emotion/styled";
|
|
3473
3486
|
import Downshift from "downshift";
|
|
3474
|
-
import
|
|
3487
|
+
import React27, {
|
|
3475
3488
|
useEffect as useEffect2,
|
|
3476
3489
|
useState,
|
|
3477
3490
|
useMemo
|
|
@@ -3541,7 +3554,7 @@ function SvgChevronDown() {
|
|
|
3541
3554
|
|
|
3542
3555
|
// src/components/menu/menu.tsx
|
|
3543
3556
|
import styled17 from "@emotion/styled";
|
|
3544
|
-
import
|
|
3557
|
+
import React24 from "react";
|
|
3545
3558
|
|
|
3546
3559
|
// src/components/icon/available-icons/check.tsx
|
|
3547
3560
|
import CheckMarkIcon from "@atlaskit/icon/core/check-mark";
|
|
@@ -3550,6 +3563,13 @@ function SvgCheck() {
|
|
|
3550
3563
|
return /* @__PURE__ */ React22.createElement(CheckMarkIcon, { label: "", testId: "ads-refreshed-icon" });
|
|
3551
3564
|
}
|
|
3552
3565
|
|
|
3566
|
+
// src/components/icon/available-icons/close.tsx
|
|
3567
|
+
import CloseIcon from "@atlaskit/icon/core/close";
|
|
3568
|
+
import * as React23 from "react";
|
|
3569
|
+
function SvgClose() {
|
|
3570
|
+
return /* @__PURE__ */ React23.createElement(CloseIcon, { label: "", testId: "ads-refreshed-icon" });
|
|
3571
|
+
}
|
|
3572
|
+
|
|
3553
3573
|
// src/components/menu/menu.tsx
|
|
3554
3574
|
var menuPositions = {
|
|
3555
3575
|
left: "bottom-start",
|
|
@@ -3557,7 +3577,9 @@ var menuPositions = {
|
|
|
3557
3577
|
["topLeft"]: "top-start",
|
|
3558
3578
|
["topRight"]: "top-end",
|
|
3559
3579
|
leftSide: "left-start",
|
|
3560
|
-
rightSide: "right-start"
|
|
3580
|
+
rightSide: "right-start",
|
|
3581
|
+
rightTop: "right-start",
|
|
3582
|
+
leftTop: "left-start"
|
|
3561
3583
|
};
|
|
3562
3584
|
var MenuContainer = styled17.div`
|
|
3563
3585
|
background-color: ${getColorValue("overlay")};
|
|
@@ -3571,12 +3593,18 @@ var MenuContainer = styled17.div`
|
|
|
3571
3593
|
border: 1px solid ${getColorValue("border")};
|
|
3572
3594
|
${getShadow("medium")};
|
|
3573
3595
|
${getRadius("250")};
|
|
3596
|
+
overflow: hidden;
|
|
3597
|
+
`;
|
|
3598
|
+
var SearchWrapper = styled17.div`
|
|
3599
|
+
flex-shrink: 0;
|
|
3574
3600
|
`;
|
|
3575
3601
|
var MenuWrapper = styled17.ul`
|
|
3576
3602
|
padding: ${(props) => props.search ? `0 ${u(1.5)} ${u(1.5)} ${u(1.5)}` : u(1.5)};
|
|
3577
3603
|
list-style: none;
|
|
3578
3604
|
overflow: auto;
|
|
3579
3605
|
margin: 0;
|
|
3606
|
+
flex: 1 1 auto;
|
|
3607
|
+
min-height: 0;
|
|
3580
3608
|
`;
|
|
3581
3609
|
var MenuItemWrapper = styled17.li`
|
|
3582
3610
|
display: ${({ hidden }) => hidden ? "none" : "grid"};
|
|
@@ -3611,6 +3639,25 @@ var MenuItemWrapper = styled17.li`
|
|
|
3611
3639
|
width: calc(100% + ${u(3)});
|
|
3612
3640
|
}
|
|
3613
3641
|
`};
|
|
3642
|
+
|
|
3643
|
+
/* Default state: show checkmark for selected items */
|
|
3644
|
+
.check-icon {
|
|
3645
|
+
display: block;
|
|
3646
|
+
}
|
|
3647
|
+
|
|
3648
|
+
.deselect-icon {
|
|
3649
|
+
display: none;
|
|
3650
|
+
}
|
|
3651
|
+
|
|
3652
|
+
/* When highlighted (mouse hover OR keyboard navigation) and allowsDeselect: swap to X */
|
|
3653
|
+
${(props) => props.showDeselectIcon && props.isHighlighted ? `
|
|
3654
|
+
.check-icon {
|
|
3655
|
+
display: none;
|
|
3656
|
+
}
|
|
3657
|
+
.deselect-icon {
|
|
3658
|
+
display: block;
|
|
3659
|
+
}
|
|
3660
|
+
` : ""}
|
|
3614
3661
|
`;
|
|
3615
3662
|
var Image2 = styled17.img`
|
|
3616
3663
|
height: 100%;
|
|
@@ -3629,7 +3676,8 @@ var MenuItem = (_a) => {
|
|
|
3629
3676
|
hasDivider,
|
|
3630
3677
|
children,
|
|
3631
3678
|
menuItemRole,
|
|
3632
|
-
keyboardMove
|
|
3679
|
+
keyboardMove,
|
|
3680
|
+
showDeselectIcon = false
|
|
3633
3681
|
} = _b, props = __objRest(_b, [
|
|
3634
3682
|
"isDisabled",
|
|
3635
3683
|
"isHighlighted",
|
|
@@ -3638,7 +3686,8 @@ var MenuItem = (_a) => {
|
|
|
3638
3686
|
"hasDivider",
|
|
3639
3687
|
"children",
|
|
3640
3688
|
"menuItemRole",
|
|
3641
|
-
"keyboardMove"
|
|
3689
|
+
"keyboardMove",
|
|
3690
|
+
"showDeselectIcon"
|
|
3642
3691
|
]);
|
|
3643
3692
|
const checkColumn = isSelected ? "auto" : "";
|
|
3644
3693
|
const iconColumn = icon ? "auto" : "";
|
|
@@ -3647,7 +3696,7 @@ var MenuItem = (_a) => {
|
|
|
3647
3696
|
const updatedProps = menuItemRole ? __spreadProps(__spreadValues({}, props), {
|
|
3648
3697
|
role: menuItemRole
|
|
3649
3698
|
}) : props;
|
|
3650
|
-
return /* @__PURE__ */
|
|
3699
|
+
return /* @__PURE__ */ React24.createElement(
|
|
3651
3700
|
MenuItemWrapper,
|
|
3652
3701
|
__spreadValues({
|
|
3653
3702
|
isHighlighted,
|
|
@@ -3656,11 +3705,12 @@ var MenuItem = (_a) => {
|
|
|
3656
3705
|
columns,
|
|
3657
3706
|
hasDivider,
|
|
3658
3707
|
tabIndex: isDisabled ? -1 : 0,
|
|
3659
|
-
"data-highlighted": isHighlighted || void 0
|
|
3708
|
+
"data-highlighted": isHighlighted || void 0,
|
|
3709
|
+
showDeselectIcon
|
|
3660
3710
|
}, updatedProps),
|
|
3661
|
-
icon && (typeof icon === "string" ? /* @__PURE__ */
|
|
3662
|
-
/* @__PURE__ */
|
|
3663
|
-
isSelected && /* @__PURE__ */
|
|
3711
|
+
icon && (typeof icon === "string" ? /* @__PURE__ */ React24.createElement(container_default, { radius: "50", width: 3, height: 3, overflow: "hidden" }, /* @__PURE__ */ React24.createElement(align_default, { alignment: "center" }, /* @__PURE__ */ React24.createElement(Image2, { src: icon, alt: "", isDisabled }))) : /* @__PURE__ */ React24.createElement(icon_default, { icon, color })),
|
|
3712
|
+
/* @__PURE__ */ React24.createElement(text_default, { color, hasEllipsis: true }, children),
|
|
3713
|
+
isSelected && /* @__PURE__ */ React24.createElement(React24.Fragment, null, /* @__PURE__ */ React24.createElement("span", { className: "check-icon", "aria-hidden": "true" }, /* @__PURE__ */ React24.createElement(icon_default, { icon: /* @__PURE__ */ React24.createElement(SvgCheck, null), color })), /* @__PURE__ */ React24.createElement("span", { className: "deselect-icon", "aria-hidden": "true" }, /* @__PURE__ */ React24.createElement(icon_default, { icon: /* @__PURE__ */ React24.createElement(SvgClose, null), color })))
|
|
3664
3714
|
);
|
|
3665
3715
|
};
|
|
3666
3716
|
var Menu = (_a) => {
|
|
@@ -3688,7 +3738,7 @@ var Menu = (_a) => {
|
|
|
3688
3738
|
const updatedDownshiftMenuProps = role ? __spreadProps(__spreadValues({}, downshiftMenuProps()), {
|
|
3689
3739
|
role
|
|
3690
3740
|
}) : __spreadValues({}, downshiftMenuProps());
|
|
3691
|
-
return /* @__PURE__ */
|
|
3741
|
+
return /* @__PURE__ */ React24.createElement(
|
|
3692
3742
|
MenuContainer,
|
|
3693
3743
|
__spreadValues(__spreadValues({
|
|
3694
3744
|
minWidth,
|
|
@@ -3697,21 +3747,21 @@ var Menu = (_a) => {
|
|
|
3697
3747
|
zIndex,
|
|
3698
3748
|
position
|
|
3699
3749
|
}, updatedDownshiftMenuProps), props),
|
|
3700
|
-
search && search,
|
|
3701
|
-
/* @__PURE__ */
|
|
3750
|
+
search && /* @__PURE__ */ React24.createElement(SearchWrapper, null, search),
|
|
3751
|
+
/* @__PURE__ */ React24.createElement(MenuWrapper, { search }, children)
|
|
3702
3752
|
);
|
|
3703
3753
|
};
|
|
3704
3754
|
var menu_default = Menu;
|
|
3705
3755
|
|
|
3706
3756
|
// src/components/search-bar/search-bar.tsx
|
|
3707
3757
|
import styled18 from "@emotion/styled";
|
|
3708
|
-
import
|
|
3758
|
+
import React26 from "react";
|
|
3709
3759
|
|
|
3710
3760
|
// src/components/icon/available-icons/search.tsx
|
|
3711
3761
|
import SearchIcon from "@atlaskit/icon/core/search";
|
|
3712
|
-
import * as
|
|
3762
|
+
import * as React25 from "react";
|
|
3713
3763
|
function SvgSearch() {
|
|
3714
|
-
return /* @__PURE__ */
|
|
3764
|
+
return /* @__PURE__ */ React25.createElement(SearchIcon, { label: "", testId: "ads-refreshed-icon" });
|
|
3715
3765
|
}
|
|
3716
3766
|
|
|
3717
3767
|
// src/components/search-bar/search-bar.tsx
|
|
@@ -3728,22 +3778,31 @@ var SearchBar = ({
|
|
|
3728
3778
|
onChange,
|
|
3729
3779
|
getInputProps
|
|
3730
3780
|
}) => {
|
|
3731
|
-
|
|
3781
|
+
const inputProps = getInputProps ? getInputProps({
|
|
3782
|
+
placeholder,
|
|
3783
|
+
value,
|
|
3784
|
+
type: "text"
|
|
3785
|
+
}) : { placeholder, value, type: "text" };
|
|
3786
|
+
const handleChange = (e) => {
|
|
3787
|
+
if (inputProps.onChange) {
|
|
3788
|
+
inputProps.onChange(e);
|
|
3789
|
+
}
|
|
3790
|
+
onChange(e);
|
|
3791
|
+
};
|
|
3792
|
+
return /* @__PURE__ */ React26.createElement(SearchBarContainer, null, /* @__PURE__ */ React26.createElement(
|
|
3732
3793
|
text_input_default,
|
|
3733
|
-
__spreadValues({
|
|
3794
|
+
__spreadProps(__spreadValues({
|
|
3734
3795
|
"aria-label": ariaLabel,
|
|
3735
|
-
icon: /* @__PURE__ */
|
|
3736
|
-
},
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
onChange,
|
|
3740
|
-
type: "text"
|
|
3741
|
-
}))
|
|
3796
|
+
icon: /* @__PURE__ */ React26.createElement(SvgSearch, null)
|
|
3797
|
+
}, inputProps), {
|
|
3798
|
+
onChange: handleChange
|
|
3799
|
+
})
|
|
3742
3800
|
));
|
|
3743
3801
|
};
|
|
3744
3802
|
var search_bar_default = SearchBar;
|
|
3745
3803
|
|
|
3746
3804
|
// src/components/select/select.tsx
|
|
3805
|
+
var SIDE_MENU_PADDING_UNITS = 2;
|
|
3747
3806
|
var SelectWrapper = styled19.div`
|
|
3748
3807
|
position: relative;
|
|
3749
3808
|
`;
|
|
@@ -3888,7 +3947,7 @@ var SelectHeader = ({
|
|
|
3888
3947
|
const iconColumn = hasIcon ? "auto" : "";
|
|
3889
3948
|
const columns = `${iconColumn} 1fr auto`;
|
|
3890
3949
|
const color = isDisabled ? "disabledContent" : void 0;
|
|
3891
|
-
return /* @__PURE__ */
|
|
3950
|
+
return /* @__PURE__ */ React27.createElement(
|
|
3892
3951
|
SelectHeaderWrapper,
|
|
3893
3952
|
__spreadProps(__spreadValues(__spreadValues({}, getToggleButtonProps()), getHeaderAccessibilityProps({
|
|
3894
3953
|
selectedItem,
|
|
@@ -3902,20 +3961,20 @@ var SelectHeader = ({
|
|
|
3902
3961
|
columns,
|
|
3903
3962
|
hasError
|
|
3904
3963
|
}),
|
|
3905
|
-
hasIcon && (typeof icon === "string" ? /* @__PURE__ */
|
|
3964
|
+
hasIcon && (typeof icon === "string" ? /* @__PURE__ */ React27.createElement(container_default, { radius: "50", width: 3, height: 3, overflow: "hidden" }, /* @__PURE__ */ React27.createElement(align_default, { alignment: "center" }, /* @__PURE__ */ React27.createElement(Image3, { src: icon, alt: "", isDisabled }))) : /* @__PURE__ */ React27.createElement(
|
|
3906
3965
|
icon_default,
|
|
3907
3966
|
{
|
|
3908
3967
|
icon: getIcon({ options, selectedItem, selectedOptionValue }),
|
|
3909
3968
|
color
|
|
3910
3969
|
}
|
|
3911
3970
|
)),
|
|
3912
|
-
/* @__PURE__ */
|
|
3971
|
+
/* @__PURE__ */ React27.createElement(text_default, { hasEllipsis: true, color: hasPlaceholder ? "bodyDimmed" : "inherit" }, getTitle({
|
|
3913
3972
|
options,
|
|
3914
3973
|
selectedItem,
|
|
3915
3974
|
selectedOptionValue,
|
|
3916
3975
|
selectPlaceholder
|
|
3917
3976
|
})),
|
|
3918
|
-
/* @__PURE__ */
|
|
3977
|
+
/* @__PURE__ */ React27.createElement(icon_default, { icon: /* @__PURE__ */ React27.createElement(SvgChevronDown, null), color })
|
|
3919
3978
|
);
|
|
3920
3979
|
};
|
|
3921
3980
|
var CustomHeader = ({
|
|
@@ -3969,9 +4028,9 @@ var getSelectedOption = (value, options) => {
|
|
|
3969
4028
|
return options.find((item) => item.value === value);
|
|
3970
4029
|
}
|
|
3971
4030
|
};
|
|
3972
|
-
var renderOption = (item, index, selectedItem, selectedOptionValue, highlightedIndex, getItemProps, keyboardMove, setKeyboardMove) => {
|
|
4031
|
+
var renderOption = (item, index, selectedItem, selectedOptionValue, highlightedIndex, getItemProps, keyboardMove, setKeyboardMove, allowsDeselect = false) => {
|
|
3973
4032
|
const isSelected = !selectedItem && item.value === selectedOptionValue || selectedItem && selectedItem.value === item.value;
|
|
3974
|
-
return /* @__PURE__ */
|
|
4033
|
+
return /* @__PURE__ */ React27.createElement(
|
|
3975
4034
|
MenuItem,
|
|
3976
4035
|
__spreadProps(__spreadValues({
|
|
3977
4036
|
key: index,
|
|
@@ -3994,7 +4053,8 @@ var renderOption = (item, index, selectedItem, selectedOptionValue, highlightedI
|
|
|
3994
4053
|
hasDivider: item.hasDivider,
|
|
3995
4054
|
isHighlighted: highlightedIndex === index,
|
|
3996
4055
|
keyboardMove: keyboardMove && highlightedIndex === index,
|
|
3997
|
-
isSelected
|
|
4056
|
+
isSelected,
|
|
4057
|
+
showDeselectIcon: allowsDeselect && isSelected
|
|
3998
4058
|
}),
|
|
3999
4059
|
item.title
|
|
4000
4060
|
);
|
|
@@ -4008,7 +4068,8 @@ var SelectMenu = (_a) => {
|
|
|
4008
4068
|
getItemProps,
|
|
4009
4069
|
search,
|
|
4010
4070
|
keyboardMove,
|
|
4011
|
-
setKeyboardMove
|
|
4071
|
+
setKeyboardMove,
|
|
4072
|
+
allowsDeselect
|
|
4012
4073
|
} = _b, menuProps = __objRest(_b, [
|
|
4013
4074
|
"options",
|
|
4014
4075
|
"selectedItem",
|
|
@@ -4017,10 +4078,11 @@ var SelectMenu = (_a) => {
|
|
|
4017
4078
|
"getItemProps",
|
|
4018
4079
|
"search",
|
|
4019
4080
|
"keyboardMove",
|
|
4020
|
-
"setKeyboardMove"
|
|
4081
|
+
"setKeyboardMove",
|
|
4082
|
+
"allowsDeselect"
|
|
4021
4083
|
]);
|
|
4022
4084
|
if (!isGrouped(options)) {
|
|
4023
|
-
return /* @__PURE__ */
|
|
4085
|
+
return /* @__PURE__ */ React27.createElement(menu_default, __spreadValues({ search }, menuProps), options.map(
|
|
4024
4086
|
(item, index) => renderOption(
|
|
4025
4087
|
item,
|
|
4026
4088
|
index,
|
|
@@ -4029,14 +4091,15 @@ var SelectMenu = (_a) => {
|
|
|
4029
4091
|
highlightedIndex,
|
|
4030
4092
|
getItemProps,
|
|
4031
4093
|
keyboardMove,
|
|
4032
|
-
setKeyboardMove
|
|
4094
|
+
setKeyboardMove,
|
|
4095
|
+
allowsDeselect
|
|
4033
4096
|
)
|
|
4034
4097
|
));
|
|
4035
4098
|
}
|
|
4036
4099
|
let downshiftIndex = 0;
|
|
4037
|
-
return /* @__PURE__ */
|
|
4100
|
+
return /* @__PURE__ */ React27.createElement(menu_default, __spreadValues({ search }, menuProps), options.map((group) => {
|
|
4038
4101
|
const groupId = `group-${group.group.replace(/\s+/g, "-")}`;
|
|
4039
|
-
return /* @__PURE__ */
|
|
4102
|
+
return /* @__PURE__ */ React27.createElement("li", { key: groupId }, /* @__PURE__ */ React27.createElement(spacer_default, { left: "medium", top: "small", bottom: "xsmall" }, /* @__PURE__ */ React27.createElement(text_default, { id: groupId, size: "body-sm", fontWeight: "bold" }, group.group)), /* @__PURE__ */ React27.createElement(Group, { role: "group", "aria-labelledby": groupId }, group.items.map((item) => {
|
|
4040
4103
|
return renderOption(
|
|
4041
4104
|
item,
|
|
4042
4105
|
downshiftIndex++,
|
|
@@ -4045,7 +4108,8 @@ var SelectMenu = (_a) => {
|
|
|
4045
4108
|
highlightedIndex,
|
|
4046
4109
|
getItemProps,
|
|
4047
4110
|
keyboardMove,
|
|
4048
|
-
setKeyboardMove
|
|
4111
|
+
setKeyboardMove,
|
|
4112
|
+
allowsDeselect
|
|
4049
4113
|
);
|
|
4050
4114
|
})));
|
|
4051
4115
|
}));
|
|
@@ -4070,7 +4134,8 @@ var Select = (_a) => {
|
|
|
4070
4134
|
trigger,
|
|
4071
4135
|
hasError,
|
|
4072
4136
|
errorMessage = "Oops, that didn't work.",
|
|
4073
|
-
search
|
|
4137
|
+
search,
|
|
4138
|
+
allowsDeselect = false
|
|
4074
4139
|
} = _b, props = __objRest(_b, [
|
|
4075
4140
|
"container",
|
|
4076
4141
|
"onChange",
|
|
@@ -4090,26 +4155,47 @@ var Select = (_a) => {
|
|
|
4090
4155
|
"trigger",
|
|
4091
4156
|
"hasError",
|
|
4092
4157
|
"errorMessage",
|
|
4093
|
-
"search"
|
|
4158
|
+
"search",
|
|
4159
|
+
"allowsDeselect"
|
|
4094
4160
|
]);
|
|
4161
|
+
var _a2;
|
|
4095
4162
|
const environment = getDownshiftEnvironment(container);
|
|
4096
4163
|
const [downshiftIsOpen, setDownshiftIsOpen] = useState(false);
|
|
4097
4164
|
const [keyboardMove, setKeyboardMove] = useState(false);
|
|
4098
4165
|
const [searchValue, setSearchValue] = useState("");
|
|
4099
4166
|
const onSearchChange = (e) => {
|
|
4167
|
+
var _a3;
|
|
4100
4168
|
const value = e.target.value;
|
|
4101
4169
|
setSearchValue(value);
|
|
4170
|
+
(_a3 = search == null ? void 0 : search.onSearch) == null ? void 0 : _a3.call(search, value);
|
|
4102
4171
|
};
|
|
4103
4172
|
const [selectedItem, setSelectedItem] = useState(
|
|
4104
|
-
getSelectedOption(selectedOptionValue, options)
|
|
4173
|
+
(_a2 = getSelectedOption(selectedOptionValue, options)) != null ? _a2 : null
|
|
4105
4174
|
);
|
|
4106
4175
|
const onDownshiftChange = (item) => {
|
|
4107
|
-
|
|
4108
|
-
|
|
4176
|
+
const isCurrentlySelected = selectedItem && item && item.value === selectedItem.value || !selectedItem && item && item.value === selectedOptionValue;
|
|
4177
|
+
if (allowsDeselect && isCurrentlySelected) {
|
|
4178
|
+
setSelectedItem(null);
|
|
4179
|
+
setDownshiftIsOpen(false);
|
|
4180
|
+
onChange && onChange(null);
|
|
4181
|
+
} else {
|
|
4182
|
+
setSelectedItem(item != null ? item : null);
|
|
4183
|
+
if (item) {
|
|
4184
|
+
onChange && onChange(item);
|
|
4185
|
+
} else if (allowsDeselect) {
|
|
4186
|
+
onChange && onChange(null);
|
|
4187
|
+
}
|
|
4188
|
+
}
|
|
4189
|
+
};
|
|
4190
|
+
const onStateChange = (changes) => {
|
|
4191
|
+
if (changes.isOpen !== void 0) {
|
|
4192
|
+
setDownshiftIsOpen(changes.isOpen);
|
|
4193
|
+
}
|
|
4109
4194
|
};
|
|
4110
4195
|
const downshiftProps = {
|
|
4111
4196
|
itemToString: (item) => item ? item.value : "",
|
|
4112
4197
|
onChange: onDownshiftChange,
|
|
4198
|
+
onStateChange,
|
|
4113
4199
|
onOuterClick,
|
|
4114
4200
|
environment,
|
|
4115
4201
|
selectedItem,
|
|
@@ -4118,34 +4204,52 @@ var Select = (_a) => {
|
|
|
4118
4204
|
if (environment) {
|
|
4119
4205
|
downshiftProps.environment = environment;
|
|
4120
4206
|
}
|
|
4207
|
+
const isSideMenu = menuPosition === "leftTop" || menuPosition === "rightTop";
|
|
4121
4208
|
const { layerProps, triggerProps, renderLayer, triggerBounds } = useLayer({
|
|
4122
4209
|
isOpen: downshiftIsOpen,
|
|
4123
4210
|
container,
|
|
4124
4211
|
ResizeObserver,
|
|
4125
4212
|
placement: menuPositions[menuPosition],
|
|
4126
|
-
auto:
|
|
4127
|
-
snap:
|
|
4213
|
+
auto: !isSideMenu,
|
|
4214
|
+
snap: !isSideMenu,
|
|
4128
4215
|
triggerOffset
|
|
4129
4216
|
});
|
|
4217
|
+
const effectiveMenuMaxHeight = useMemo(() => {
|
|
4218
|
+
if (isSideMenu && typeof window !== "undefined" && triggerBounds) {
|
|
4219
|
+
const viewportHeight = window.innerHeight;
|
|
4220
|
+
const availableHeight = viewportHeight - triggerBounds.top;
|
|
4221
|
+
const paddingReserve = SIDE_MENU_PADDING_UNITS * unit;
|
|
4222
|
+
const calculatedMaxHeight = Math.floor(
|
|
4223
|
+
Math.max(0, availableHeight - paddingReserve) / unit
|
|
4224
|
+
);
|
|
4225
|
+
return menuMaxHeight ? Math.min(menuMaxHeight, calculatedMaxHeight) : calculatedMaxHeight;
|
|
4226
|
+
}
|
|
4227
|
+
return menuMaxHeight;
|
|
4228
|
+
}, [isSideMenu, menuMaxHeight, triggerBounds]);
|
|
4130
4229
|
useEffect2(() => {
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
options
|
|
4134
|
-
);
|
|
4230
|
+
var _a3;
|
|
4231
|
+
const expectedSelectedItem = (_a3 = getSelectedOption(selectedOptionValue, options)) != null ? _a3 : null;
|
|
4135
4232
|
if ((expectedSelectedItem == null ? void 0 : expectedSelectedItem.value) !== (selectedItem == null ? void 0 : selectedItem.value)) {
|
|
4136
4233
|
setSelectedItem(expectedSelectedItem);
|
|
4137
4234
|
}
|
|
4138
4235
|
}, [selectedOptionValue, options, selectedItem]);
|
|
4139
4236
|
useEffect2(() => {
|
|
4237
|
+
var _a3;
|
|
4140
4238
|
onOpenChange && onOpenChange(downshiftIsOpen);
|
|
4141
|
-
|
|
4239
|
+
if (!downshiftIsOpen) {
|
|
4240
|
+
setSearchValue("");
|
|
4241
|
+
(_a3 = search == null ? void 0 : search.onSearch) == null ? void 0 : _a3.call(search, "");
|
|
4242
|
+
}
|
|
4243
|
+
}, [downshiftIsOpen, onOpenChange, search == null ? void 0 : search.onSearch]);
|
|
4142
4244
|
const stateReducer = (state, changes) => {
|
|
4143
|
-
if (changes.
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
return { isOpen: false };
|
|
4245
|
+
if (allowsDeselect && changes.type === Downshift.stateChangeTypes.clickItem && changes.selectedItem) {
|
|
4246
|
+
const isCurrentlySelected = state.selectedItem && changes.selectedItem.value === state.selectedItem.value || !state.selectedItem && changes.selectedItem.value === selectedOptionValue;
|
|
4247
|
+
if (isCurrentlySelected) {
|
|
4248
|
+
return __spreadProps(__spreadValues({}, changes), { selectedItem: null, isOpen: false });
|
|
4147
4249
|
}
|
|
4148
|
-
|
|
4250
|
+
}
|
|
4251
|
+
if (changes.type === Downshift.stateChangeTypes.keyDownEscape) {
|
|
4252
|
+
return { isOpen: false };
|
|
4149
4253
|
}
|
|
4150
4254
|
return changes;
|
|
4151
4255
|
};
|
|
@@ -4167,6 +4271,9 @@ var Select = (_a) => {
|
|
|
4167
4271
|
};
|
|
4168
4272
|
options = useMemo(() => {
|
|
4169
4273
|
if (search) {
|
|
4274
|
+
if (search.onSearch) {
|
|
4275
|
+
return options;
|
|
4276
|
+
}
|
|
4170
4277
|
if (isGrouped(options)) {
|
|
4171
4278
|
let filteredGroups;
|
|
4172
4279
|
if (search.searchType === "startsWith") {
|
|
@@ -4199,8 +4306,8 @@ var Select = (_a) => {
|
|
|
4199
4306
|
);
|
|
4200
4307
|
}
|
|
4201
4308
|
return options;
|
|
4202
|
-
}, [options, searchValue, search]);
|
|
4203
|
-
return /* @__PURE__ */
|
|
4309
|
+
}, [options, searchValue, search == null ? void 0 : search.onSearch, search == null ? void 0 : search.searchType]);
|
|
4310
|
+
return /* @__PURE__ */ React27.createElement(SelectWrapper, __spreadValues({}, props), /* @__PURE__ */ React27.createElement(Downshift, __spreadProps(__spreadValues({}, downshiftProps), { stateReducer }), ({
|
|
4204
4311
|
getItemProps,
|
|
4205
4312
|
getInputProps,
|
|
4206
4313
|
getMenuProps,
|
|
@@ -4212,7 +4319,7 @@ var Select = (_a) => {
|
|
|
4212
4319
|
}) => {
|
|
4213
4320
|
return (
|
|
4214
4321
|
// Don't set the role to combobox to ensure a consistent experience for screen readers
|
|
4215
|
-
/* @__PURE__ */
|
|
4322
|
+
/* @__PURE__ */ React27.createElement("div", { role: "presentation", "aria-expanded": void 0 }, /* @__PURE__ */ React27.createElement("div", __spreadValues({}, triggerProps), trigger ? /* @__PURE__ */ React27.createElement(
|
|
4216
4323
|
CustomHeader,
|
|
4217
4324
|
{
|
|
4218
4325
|
getToggleButtonProps: () => __spreadValues({}, getToggleButtonProps({ onKeyDown })),
|
|
@@ -4228,7 +4335,7 @@ var Select = (_a) => {
|
|
|
4228
4335
|
errorMessage,
|
|
4229
4336
|
isOpen
|
|
4230
4337
|
}
|
|
4231
|
-
) : /* @__PURE__ */
|
|
4338
|
+
) : /* @__PURE__ */ React27.createElement(
|
|
4232
4339
|
SelectHeader,
|
|
4233
4340
|
{
|
|
4234
4341
|
getToggleButtonProps: () => __spreadValues({}, getToggleButtonProps({ onKeyDown })),
|
|
@@ -4244,7 +4351,7 @@ var Select = (_a) => {
|
|
|
4244
4351
|
isOpen
|
|
4245
4352
|
}
|
|
4246
4353
|
)), downshiftIsOpen && isOpen && renderLayer(
|
|
4247
|
-
/* @__PURE__ */
|
|
4354
|
+
/* @__PURE__ */ React27.createElement(
|
|
4248
4355
|
"div",
|
|
4249
4356
|
__spreadProps(__spreadValues({}, layerProps), {
|
|
4250
4357
|
style: __spreadProps(__spreadValues({}, layerProps.style), {
|
|
@@ -4252,7 +4359,7 @@ var Select = (_a) => {
|
|
|
4252
4359
|
width: menuMinWidth ? "auto" : triggerBounds == null ? void 0 : triggerBounds.width
|
|
4253
4360
|
})
|
|
4254
4361
|
}),
|
|
4255
|
-
/* @__PURE__ */
|
|
4362
|
+
/* @__PURE__ */ React27.createElement(
|
|
4256
4363
|
SelectMenu,
|
|
4257
4364
|
{
|
|
4258
4365
|
options,
|
|
@@ -4263,9 +4370,9 @@ var Select = (_a) => {
|
|
|
4263
4370
|
position: menuPosition,
|
|
4264
4371
|
downshiftMenuProps: () => getMenuProps({ onKeyDown }),
|
|
4265
4372
|
maxWidth: menuMaxWidth,
|
|
4266
|
-
maxHeight:
|
|
4373
|
+
maxHeight: effectiveMenuMaxHeight,
|
|
4267
4374
|
minWidth: menuMinWidth,
|
|
4268
|
-
search: search && /* @__PURE__ */
|
|
4375
|
+
search: search && /* @__PURE__ */ React27.createElement(
|
|
4269
4376
|
search_bar_default,
|
|
4270
4377
|
{
|
|
4271
4378
|
ariaLabel: search.searchPlaceholder,
|
|
@@ -4276,11 +4383,12 @@ var Select = (_a) => {
|
|
|
4276
4383
|
}
|
|
4277
4384
|
),
|
|
4278
4385
|
keyboardMove,
|
|
4279
|
-
setKeyboardMove
|
|
4386
|
+
setKeyboardMove,
|
|
4387
|
+
allowsDeselect
|
|
4280
4388
|
}
|
|
4281
4389
|
)
|
|
4282
4390
|
)
|
|
4283
|
-
), hasError && !downshiftIsOpen && /* @__PURE__ */
|
|
4391
|
+
), hasError && !downshiftIsOpen && /* @__PURE__ */ React27.createElement(ErrorMessage, null, errorMessage))
|
|
4284
4392
|
);
|
|
4285
4393
|
}));
|
|
4286
4394
|
};
|
|
@@ -4288,7 +4396,7 @@ var select_default = Select;
|
|
|
4288
4396
|
|
|
4289
4397
|
// src/components/backdrop/backdrop.tsx
|
|
4290
4398
|
import styled20 from "@emotion/styled";
|
|
4291
|
-
import
|
|
4399
|
+
import React28 from "react";
|
|
4292
4400
|
import { useTransition } from "transition-hook";
|
|
4293
4401
|
|
|
4294
4402
|
// src/hooks/use-prevent-scroll.ts
|
|
@@ -4370,7 +4478,7 @@ var ChildrenWrapper = styled20.div`
|
|
|
4370
4478
|
overflow: auto;
|
|
4371
4479
|
height: 100%;
|
|
4372
4480
|
`;
|
|
4373
|
-
var Backdrop =
|
|
4481
|
+
var Backdrop = React28.forwardRef(
|
|
4374
4482
|
(_a, ref) => {
|
|
4375
4483
|
var _b = _a, {
|
|
4376
4484
|
children,
|
|
@@ -4385,7 +4493,7 @@ var Backdrop = React27.forwardRef(
|
|
|
4385
4493
|
]);
|
|
4386
4494
|
const { stage, shouldMount } = useTransition(isOpen, duration);
|
|
4387
4495
|
use_prevent_scroll_default("html", isOpen);
|
|
4388
|
-
return /* @__PURE__ */
|
|
4496
|
+
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, shouldMount && /* @__PURE__ */ React28.createElement(
|
|
4389
4497
|
BackdropWrapper,
|
|
4390
4498
|
__spreadValues({
|
|
4391
4499
|
ref,
|
|
@@ -4396,7 +4504,7 @@ var Backdrop = React27.forwardRef(
|
|
|
4396
4504
|
opacity: stage === "enter" ? 1 : 0
|
|
4397
4505
|
}
|
|
4398
4506
|
}, props),
|
|
4399
|
-
/* @__PURE__ */
|
|
4507
|
+
/* @__PURE__ */ React28.createElement(ChildrenWrapper, null, children)
|
|
4400
4508
|
));
|
|
4401
4509
|
}
|
|
4402
4510
|
);
|
|
@@ -4407,15 +4515,6 @@ var backdrop_default = Backdrop;
|
|
|
4407
4515
|
import styled21 from "@emotion/styled";
|
|
4408
4516
|
import FocusTrap from "focus-trap-react";
|
|
4409
4517
|
import React29, { useEffect as useEffect3, useRef as useRef2 } from "react";
|
|
4410
|
-
|
|
4411
|
-
// src/components/icon/available-icons/close.tsx
|
|
4412
|
-
import CloseIcon from "@atlaskit/icon/core/close";
|
|
4413
|
-
import * as React28 from "react";
|
|
4414
|
-
function SvgClose() {
|
|
4415
|
-
return /* @__PURE__ */ React28.createElement(CloseIcon, { label: "", testId: "ads-refreshed-icon" });
|
|
4416
|
-
}
|
|
4417
|
-
|
|
4418
|
-
// src/components/modal/modal.tsx
|
|
4419
4518
|
var DEFAULT_MODAL_CARD_HEIGHT = "70vh";
|
|
4420
4519
|
var ContentWrapper = styled21.div`
|
|
4421
4520
|
display: grid;
|
|
@@ -4515,7 +4614,8 @@ var ModalCard = (_a) => {
|
|
|
4515
4614
|
ariaLabelledBy,
|
|
4516
4615
|
ref,
|
|
4517
4616
|
removeClose,
|
|
4518
|
-
initialFocus
|
|
4617
|
+
initialFocus,
|
|
4618
|
+
closeOnEscape = true
|
|
4519
4619
|
} = _b, props = __objRest(_b, [
|
|
4520
4620
|
"children",
|
|
4521
4621
|
"onCloseClick",
|
|
@@ -4528,10 +4628,11 @@ var ModalCard = (_a) => {
|
|
|
4528
4628
|
"ariaLabelledBy",
|
|
4529
4629
|
"ref",
|
|
4530
4630
|
"removeClose",
|
|
4531
|
-
"initialFocus"
|
|
4631
|
+
"initialFocus",
|
|
4632
|
+
"closeOnEscape"
|
|
4532
4633
|
]);
|
|
4533
4634
|
const keyListener = (e) => {
|
|
4534
|
-
if (e.key === "Escape") {
|
|
4635
|
+
if (e.key === "Escape" && closeOnEscape) {
|
|
4535
4636
|
e.preventDefault();
|
|
4536
4637
|
if (!removeClose) {
|
|
4537
4638
|
onCloseClick(e);
|
|
@@ -6450,7 +6551,7 @@ var Tooltip = (_a) => {
|
|
|
6450
6551
|
content,
|
|
6451
6552
|
shortcut,
|
|
6452
6553
|
placement = "topCenter",
|
|
6453
|
-
keepOpen,
|
|
6554
|
+
keepOpen = true,
|
|
6454
6555
|
triggerOffset = 4,
|
|
6455
6556
|
maxWidth = 26,
|
|
6456
6557
|
isInline = true,
|
|
@@ -6527,12 +6628,13 @@ var Tooltip = (_a) => {
|
|
|
6527
6628
|
const keyListener = (e) => {
|
|
6528
6629
|
if (e.key === "Escape") {
|
|
6529
6630
|
e.preventDefault();
|
|
6631
|
+
e.stopPropagation();
|
|
6530
6632
|
handleBlur();
|
|
6531
6633
|
}
|
|
6532
6634
|
};
|
|
6533
|
-
window.addEventListener("keydown", keyListener);
|
|
6635
|
+
window.addEventListener("keydown", keyListener, true);
|
|
6534
6636
|
return () => {
|
|
6535
|
-
window.removeEventListener("keydown", keyListener);
|
|
6637
|
+
window.removeEventListener("keydown", keyListener, true);
|
|
6536
6638
|
};
|
|
6537
6639
|
}, [isOpen, setIsOpen]);
|
|
6538
6640
|
const { layerProps, triggerProps, renderLayer } = useLayer4({
|
|
@@ -7080,7 +7182,7 @@ var Logo = (_a) => {
|
|
|
7080
7182
|
maxWidth,
|
|
7081
7183
|
symbolColor,
|
|
7082
7184
|
wordmarkColor = "body",
|
|
7083
|
-
brand = "
|
|
7185
|
+
brand = "product",
|
|
7084
7186
|
customId = ""
|
|
7085
7187
|
} = _b, props = __objRest(_b, [
|
|
7086
7188
|
"variant",
|