@loomhq/lens 12.8.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 +241 -33
- 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 +242 -34
- 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.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
|
@@ -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({
|
|
@@ -3809,11 +3842,13 @@ var getHeaderAccessibilityProps = ({
|
|
|
3809
3842
|
selectedItem,
|
|
3810
3843
|
getInputProps,
|
|
3811
3844
|
getToggleButtonProps,
|
|
3812
|
-
ariaMenuName
|
|
3845
|
+
ariaMenuName,
|
|
3846
|
+
isOpen
|
|
3813
3847
|
}) => {
|
|
3814
3848
|
const valueLabel = selectedItem ? `selected value is ${selectedItem.title}` : "no value selected";
|
|
3815
3849
|
const toggleLabel = getToggleButtonProps == null ? void 0 : getToggleButtonProps()["aria-label"];
|
|
3816
3850
|
return {
|
|
3851
|
+
"aria-expanded": isOpen,
|
|
3817
3852
|
// Ensures all options within the list of selections can be narrated by a screen reader
|
|
3818
3853
|
"aria-activedescendant": getInputProps()["aria-activedescendant"],
|
|
3819
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
|
|
@@ -3830,7 +3865,8 @@ var SelectHeader = ({
|
|
|
3830
3865
|
options,
|
|
3831
3866
|
getInputProps,
|
|
3832
3867
|
ariaMenuName,
|
|
3833
|
-
hasError
|
|
3868
|
+
hasError,
|
|
3869
|
+
isOpen
|
|
3834
3870
|
}) => {
|
|
3835
3871
|
const icon = getIcon({ options, selectedItem, selectedOptionValue });
|
|
3836
3872
|
const hasIcon = Boolean(icon);
|
|
@@ -3844,7 +3880,8 @@ var SelectHeader = ({
|
|
|
3844
3880
|
selectedItem,
|
|
3845
3881
|
getInputProps,
|
|
3846
3882
|
getToggleButtonProps,
|
|
3847
|
-
ariaMenuName
|
|
3883
|
+
ariaMenuName,
|
|
3884
|
+
isOpen
|
|
3848
3885
|
})), {
|
|
3849
3886
|
hasValue: inputValue || selectedOptionValue,
|
|
3850
3887
|
disabled: isDisabled,
|
|
@@ -3878,14 +3915,16 @@ var CustomHeader = ({
|
|
|
3878
3915
|
getInputProps,
|
|
3879
3916
|
ariaMenuName,
|
|
3880
3917
|
hasError,
|
|
3881
|
-
errorMessage
|
|
3918
|
+
errorMessage,
|
|
3919
|
+
isOpen
|
|
3882
3920
|
}) => {
|
|
3883
3921
|
const buttonProps = () => {
|
|
3884
3922
|
return __spreadValues(__spreadValues({}, getToggleButtonProps()), getHeaderAccessibilityProps({
|
|
3885
3923
|
selectedItem,
|
|
3886
3924
|
getInputProps,
|
|
3887
3925
|
getToggleButtonProps,
|
|
3888
|
-
ariaMenuName
|
|
3926
|
+
ariaMenuName,
|
|
3927
|
+
isOpen
|
|
3889
3928
|
}));
|
|
3890
3929
|
};
|
|
3891
3930
|
const getSelectedItem = () => {
|
|
@@ -4092,13 +4131,13 @@ var Select = (_a) => {
|
|
|
4092
4131
|
if (search.searchType === "startsWith") {
|
|
4093
4132
|
filteredGroups = options.map((group) => __spreadProps(__spreadValues({}, group), {
|
|
4094
4133
|
items: group.items.filter(
|
|
4095
|
-
(item) => item.title
|
|
4134
|
+
(item) => getTextFromNode(item.title).toLowerCase().startsWith(searchValue.toLowerCase())
|
|
4096
4135
|
)
|
|
4097
4136
|
}));
|
|
4098
4137
|
} else {
|
|
4099
4138
|
filteredGroups = options.map((group) => __spreadProps(__spreadValues({}, group), {
|
|
4100
4139
|
items: group.items.filter(
|
|
4101
|
-
(item) => item.title
|
|
4140
|
+
(item) => getTextFromNode(item.title).toLowerCase().includes(searchValue.toLowerCase())
|
|
4102
4141
|
)
|
|
4103
4142
|
}));
|
|
4104
4143
|
}
|
|
@@ -4111,11 +4150,11 @@ var Select = (_a) => {
|
|
|
4111
4150
|
}
|
|
4112
4151
|
if (search.searchType === "startsWith") {
|
|
4113
4152
|
return options.filter(
|
|
4114
|
-
(option) => option.title
|
|
4153
|
+
(option) => getTextFromNode(option.title).toLowerCase().startsWith(searchValue.toLowerCase())
|
|
4115
4154
|
);
|
|
4116
4155
|
}
|
|
4117
4156
|
return options.filter(
|
|
4118
|
-
(option) => option.title
|
|
4157
|
+
(option) => getTextFromNode(option.title).toLowerCase().includes(searchValue.toLowerCase())
|
|
4119
4158
|
);
|
|
4120
4159
|
}
|
|
4121
4160
|
return options;
|
|
@@ -4145,7 +4184,8 @@ var Select = (_a) => {
|
|
|
4145
4184
|
getInputProps,
|
|
4146
4185
|
ariaMenuName,
|
|
4147
4186
|
hasError,
|
|
4148
|
-
errorMessage
|
|
4187
|
+
errorMessage,
|
|
4188
|
+
isOpen
|
|
4149
4189
|
}
|
|
4150
4190
|
) : /* @__PURE__ */ React25.createElement(
|
|
4151
4191
|
SelectHeader,
|
|
@@ -4159,7 +4199,8 @@ var Select = (_a) => {
|
|
|
4159
4199
|
isDisabled,
|
|
4160
4200
|
getInputProps,
|
|
4161
4201
|
ariaMenuName,
|
|
4162
|
-
hasError
|
|
4202
|
+
hasError,
|
|
4203
|
+
isOpen
|
|
4163
4204
|
}
|
|
4164
4205
|
)), downshiftIsOpen && isOpen && renderLayer(
|
|
4165
4206
|
/* @__PURE__ */ React25.createElement(
|
|
@@ -4900,6 +4941,7 @@ var TypeaheadInputField = styled24.input`
|
|
|
4900
4941
|
transition: 0.3s box-shadow;
|
|
4901
4942
|
padding-top: 0;
|
|
4902
4943
|
padding-bottom: 0;
|
|
4944
|
+
id: ${(props) => props.id};
|
|
4903
4945
|
padding-left: ${(props) => props.hasIcon ? u(5.5) : "var(--lns-formFieldHorizontalPadding)"};
|
|
4904
4946
|
padding-right: ${(props) => props.hasAddOn ? u(5.5) : "var(--lns-formFieldHorizontalPadding)"};
|
|
4905
4947
|
border-radius: var(--lns-formFieldRadius);
|
|
@@ -4986,7 +5028,8 @@ var TypeaheadHeader = ({
|
|
|
4986
5028
|
hasLoader,
|
|
4987
5029
|
inputValue,
|
|
4988
5030
|
handleInputValueChange,
|
|
4989
|
-
inputRef
|
|
5031
|
+
inputRef,
|
|
5032
|
+
id
|
|
4990
5033
|
}) => {
|
|
4991
5034
|
const icon = getIcon2({ options, selectedItem, selectedOptionValue });
|
|
4992
5035
|
const hasIcon = Boolean(icon);
|
|
@@ -5006,6 +5049,8 @@ var TypeaheadHeader = ({
|
|
|
5006
5049
|
getInputProps,
|
|
5007
5050
|
ariaMenuName
|
|
5008
5051
|
})), getInputProps({
|
|
5052
|
+
id,
|
|
5053
|
+
"aria-labelledby": void 0,
|
|
5009
5054
|
disabled: isDisabled,
|
|
5010
5055
|
onFocus: handleClickAndFocus,
|
|
5011
5056
|
onClick: handleClickAndFocus,
|
|
@@ -5153,7 +5198,8 @@ var Typeahead = forwardRef3(
|
|
|
5153
5198
|
isLoading,
|
|
5154
5199
|
loadingMessage,
|
|
5155
5200
|
emptyResultsMessage,
|
|
5156
|
-
errorMessage
|
|
5201
|
+
errorMessage,
|
|
5202
|
+
id
|
|
5157
5203
|
} = _b, props = __objRest(_b, [
|
|
5158
5204
|
"container",
|
|
5159
5205
|
"onOptionChange",
|
|
@@ -5173,7 +5219,8 @@ var Typeahead = forwardRef3(
|
|
|
5173
5219
|
"isLoading",
|
|
5174
5220
|
"loadingMessage",
|
|
5175
5221
|
"emptyResultsMessage",
|
|
5176
|
-
"errorMessage"
|
|
5222
|
+
"errorMessage",
|
|
5223
|
+
"id"
|
|
5177
5224
|
]);
|
|
5178
5225
|
const environment = getDownshiftEnvironment(container);
|
|
5179
5226
|
const internalInputRef = useRef2(null);
|
|
@@ -5281,7 +5328,8 @@ var Typeahead = forwardRef3(
|
|
|
5281
5328
|
setDownshiftIsOpen(true);
|
|
5282
5329
|
},
|
|
5283
5330
|
hasLoader: isLoading,
|
|
5284
|
-
hasError: Boolean(errorMessage)
|
|
5331
|
+
hasError: Boolean(errorMessage),
|
|
5332
|
+
id
|
|
5285
5333
|
}
|
|
5286
5334
|
)), downshiftIsOpen && isOpen && renderLayer(
|
|
5287
5335
|
/* @__PURE__ */ React31.createElement(
|
|
@@ -5359,7 +5407,9 @@ var Dropdown = (_a) => {
|
|
|
5359
5407
|
onOuterClick,
|
|
5360
5408
|
triggerOffset = 0,
|
|
5361
5409
|
onOpenChange,
|
|
5362
|
-
search
|
|
5410
|
+
search,
|
|
5411
|
+
role,
|
|
5412
|
+
menuItemRole
|
|
5363
5413
|
} = _b, props = __objRest(_b, [
|
|
5364
5414
|
"ariaMenuName",
|
|
5365
5415
|
"menuPosition",
|
|
@@ -5375,7 +5425,9 @@ var Dropdown = (_a) => {
|
|
|
5375
5425
|
"onOuterClick",
|
|
5376
5426
|
"triggerOffset",
|
|
5377
5427
|
"onOpenChange",
|
|
5378
|
-
"search"
|
|
5428
|
+
"search",
|
|
5429
|
+
"role",
|
|
5430
|
+
"menuItemRole"
|
|
5379
5431
|
]);
|
|
5380
5432
|
const environment = getDownshiftEnvironment(container);
|
|
5381
5433
|
const [downshiftIsOpen, setDownshiftIsOpen] = useState3(false);
|
|
@@ -5407,17 +5459,11 @@ var Dropdown = (_a) => {
|
|
|
5407
5459
|
if (search) {
|
|
5408
5460
|
if (search.searchType === "startsWith") {
|
|
5409
5461
|
return options.filter(
|
|
5410
|
-
(option) =>
|
|
5411
|
-
var _a2;
|
|
5412
|
-
return (_a2 = option.title) == null ? void 0 : _a2.toString().toLowerCase().startsWith(searchValue.toLowerCase());
|
|
5413
|
-
}
|
|
5462
|
+
(option) => getTextFromNode(option.title).toLowerCase().startsWith(searchValue.toLowerCase())
|
|
5414
5463
|
);
|
|
5415
5464
|
}
|
|
5416
5465
|
return options.filter(
|
|
5417
|
-
(option) =>
|
|
5418
|
-
var _a2;
|
|
5419
|
-
return (_a2 = option.title) == null ? void 0 : _a2.toString().toLowerCase().includes(searchValue.toLowerCase());
|
|
5420
|
-
}
|
|
5466
|
+
(option) => getTextFromNode(option.title).toLowerCase().includes(searchValue.toLowerCase())
|
|
5421
5467
|
);
|
|
5422
5468
|
}
|
|
5423
5469
|
return options;
|
|
@@ -5452,7 +5498,7 @@ var Dropdown = (_a) => {
|
|
|
5452
5498
|
ariaMenuName,
|
|
5453
5499
|
getInputProps,
|
|
5454
5500
|
isOpen: isOpen2
|
|
5455
|
-
}))) : /* @__PURE__ */ React32.createElement(TriggerSection, __spreadValues({}, getToggleButtonProps({})), trigger)),
|
|
5501
|
+
}))) : /* @__PURE__ */ React32.createElement(TriggerSection, __spreadValues({}, getToggleButtonProps({ tabIndex: 0 })), trigger)),
|
|
5456
5502
|
isOpen2 && renderLayer(
|
|
5457
5503
|
/* @__PURE__ */ React32.createElement(
|
|
5458
5504
|
"div",
|
|
@@ -5467,6 +5513,7 @@ var Dropdown = (_a) => {
|
|
|
5467
5513
|
maxWidth: menuMaxWidth,
|
|
5468
5514
|
maxHeight: menuMaxHeight,
|
|
5469
5515
|
downshiftMenuProps: getMenuProps,
|
|
5516
|
+
role,
|
|
5470
5517
|
search: search && /* @__PURE__ */ React32.createElement(
|
|
5471
5518
|
search_bar_default,
|
|
5472
5519
|
{
|
|
@@ -5489,6 +5536,7 @@ var Dropdown = (_a) => {
|
|
|
5489
5536
|
icon: item.icon,
|
|
5490
5537
|
hasDivider: item.hasDivider,
|
|
5491
5538
|
getItemProps,
|
|
5539
|
+
menuItemRole,
|
|
5492
5540
|
index
|
|
5493
5541
|
}, getItemProps({
|
|
5494
5542
|
key: index,
|
|
@@ -6707,16 +6755,16 @@ var CombinedLogoSvg = (_a) => {
|
|
|
6707
6755
|
), /* @__PURE__ */ React43.createElement(
|
|
6708
6756
|
"path",
|
|
6709
6757
|
{
|
|
6710
|
-
|
|
6711
|
-
|
|
6758
|
+
fillRule: "evenodd",
|
|
6759
|
+
clipRule: "evenodd",
|
|
6712
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",
|
|
6713
6761
|
fill: wordmarkColor
|
|
6714
6762
|
}
|
|
6715
6763
|
), /* @__PURE__ */ React43.createElement(
|
|
6716
6764
|
"path",
|
|
6717
6765
|
{
|
|
6718
|
-
|
|
6719
|
-
|
|
6766
|
+
fillRule: "evenodd",
|
|
6767
|
+
clipRule: "evenodd",
|
|
6720
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",
|
|
6721
6769
|
fill: wordmarkColor
|
|
6722
6770
|
}
|
|
@@ -7172,7 +7220,7 @@ var list_default = List;
|
|
|
7172
7220
|
|
|
7173
7221
|
// src/components/tabs/tabs.tsx
|
|
7174
7222
|
import styled36 from "@emotion/styled";
|
|
7175
|
-
import React46 from "react";
|
|
7223
|
+
import React46, { useCallback as useCallback4, useMemo as useMemo4, useRef as useRef4, useId } from "react";
|
|
7176
7224
|
var TabsContext = React46.createContext({});
|
|
7177
7225
|
var negativeScrollOffset = (scrollOffset) => `calc(-1 * ${getSizeValue(scrollOffset)})`;
|
|
7178
7226
|
var Wrapper = styled36.div`
|
|
@@ -7369,7 +7417,7 @@ var Tab = (_a) => {
|
|
|
7369
7417
|
children
|
|
7370
7418
|
);
|
|
7371
7419
|
};
|
|
7372
|
-
var
|
|
7420
|
+
var TabsDeprecated = (_a) => {
|
|
7373
7421
|
var _b = _a, {
|
|
7374
7422
|
children,
|
|
7375
7423
|
scrollOffset,
|
|
@@ -7406,6 +7454,166 @@ var Tabs = (_a) => {
|
|
|
7406
7454
|
}
|
|
7407
7455
|
return /* @__PURE__ */ React46.createElement(TabsContext.Provider, { value: { isPilledDesign } }, tabsContent);
|
|
7408
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
|
+
};
|
|
7409
7617
|
var tabs_default = Tabs;
|
|
7410
7618
|
|
|
7411
7619
|
// src/components/pill/pill.tsx
|