@dxc-technology/halstack-react 15.2.1 → 15.2.2
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/index.js +901 -852
- package/dist/index.mjs +665 -616
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2350,7 +2350,7 @@ var Accordion_default = DxcAccordion;
|
|
|
2350
2350
|
|
|
2351
2351
|
// src/alert/Alert.tsx
|
|
2352
2352
|
import styled11, { css, ThemeProvider as ThemeProvider4 } from "styled-components";
|
|
2353
|
-
import { useState as
|
|
2353
|
+
import { useState as useState4, memo, useId as useId3, useEffect as useEffect3, useCallback as useCallback3, useContext as useContext5 } from "react";
|
|
2354
2354
|
|
|
2355
2355
|
// src/button/Button.tsx
|
|
2356
2356
|
import { useContext as useContext4 } from "react";
|
|
@@ -3091,6 +3091,7 @@ var FocusLock = ({ children }) => {
|
|
|
3091
3091
|
var FocusLock_default = FocusLock;
|
|
3092
3092
|
|
|
3093
3093
|
// src/alert/ModalAlertWrapper.tsx
|
|
3094
|
+
import { useEffect as useEffect2, useId as useId2, useState as useState3 } from "react";
|
|
3094
3095
|
import { Fragment as Fragment4, jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3095
3096
|
var BodyStyle = createGlobalStyle`
|
|
3096
3097
|
body {
|
|
@@ -3123,16 +3124,24 @@ var ModalAlertContainer = styled10.div`
|
|
|
3123
3124
|
min-width: 92%;
|
|
3124
3125
|
}
|
|
3125
3126
|
`;
|
|
3126
|
-
var ModalAlertWrapper = ({ condition, onClose, children }) =>
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3127
|
+
var ModalAlertWrapper = ({ condition, onClose, children }) => {
|
|
3128
|
+
const id = useId2();
|
|
3129
|
+
const [portalContainer, setPortalContainer] = useState3(null);
|
|
3130
|
+
useEffect2(() => {
|
|
3131
|
+
setPortalContainer(document.getElementById(`dialog-${id}-portal`));
|
|
3132
|
+
}, []);
|
|
3133
|
+
return condition ? /* @__PURE__ */ jsxs5(Fragment4, { children: [
|
|
3134
|
+
/* @__PURE__ */ jsx12(BodyStyle, {}),
|
|
3135
|
+
/* @__PURE__ */ jsx12("div", { id: `dialog-${id}-portal`, style: { position: "absolute" } }),
|
|
3136
|
+
portalContainer && createPortal(
|
|
3137
|
+
/* @__PURE__ */ jsxs5(Modal, { children: [
|
|
3138
|
+
/* @__PURE__ */ jsx12(Overlay, { onClick: onClose }),
|
|
3139
|
+
/* @__PURE__ */ jsx12(ModalAlertContainer, { children: /* @__PURE__ */ jsx12(FocusLock_default, { children }) })
|
|
3140
|
+
] }),
|
|
3141
|
+
portalContainer
|
|
3142
|
+
)
|
|
3143
|
+
] }) : children;
|
|
3144
|
+
};
|
|
3136
3145
|
var ModalAlertWrapper_default = ModalAlertWrapper;
|
|
3137
3146
|
|
|
3138
3147
|
// src/alert/Alert.tsx
|
|
@@ -3233,9 +3242,9 @@ function DxcAlert({
|
|
|
3233
3242
|
semantic = "info",
|
|
3234
3243
|
title = ""
|
|
3235
3244
|
}) {
|
|
3236
|
-
const [messages, setMessages] =
|
|
3237
|
-
const [currentIndex, setCurrentIndex] =
|
|
3238
|
-
const id =
|
|
3245
|
+
const [messages, setMessages] = useState4(Array.isArray(message) ? message : [message]);
|
|
3246
|
+
const [currentIndex, setCurrentIndex] = useState4(0);
|
|
3247
|
+
const id = useId3();
|
|
3239
3248
|
const colorsTheme = useContext5(HalstackContext);
|
|
3240
3249
|
const translatedLabels = useContext5(HalstackLanguageContext);
|
|
3241
3250
|
const handleNextOnClick = () => {
|
|
@@ -3250,7 +3259,7 @@ function DxcAlert({
|
|
|
3250
3259
|
setMessages((prevMessages) => prevMessages.filter((_, index) => index !== currentIndex));
|
|
3251
3260
|
}
|
|
3252
3261
|
};
|
|
3253
|
-
|
|
3262
|
+
useEffect3(() => {
|
|
3254
3263
|
if (currentIndex === messages.length) handlePrevOnClick();
|
|
3255
3264
|
}, [currentIndex, messages, handlePrevOnClick]);
|
|
3256
3265
|
return /* @__PURE__ */ jsx13(ThemeProvider4, { theme: colorsTheme.alert, children: /* @__PURE__ */ jsx13(ModalAlertWrapper_default, { condition: mode === "modal", onClose: handleOnClose, children: /* @__PURE__ */ jsxs6(
|
|
@@ -3339,7 +3348,7 @@ function DxcAlert({
|
|
|
3339
3348
|
}
|
|
3340
3349
|
|
|
3341
3350
|
// src/layout/ApplicationLayout.tsx
|
|
3342
|
-
import { useContext as useContext11, useEffect as
|
|
3351
|
+
import { useContext as useContext11, useEffect as useEffect7, useRef as useRef4, useState as useState10 } from "react";
|
|
3343
3352
|
import styled19 from "styled-components";
|
|
3344
3353
|
|
|
3345
3354
|
// src/footer/Footer.tsx
|
|
@@ -3695,18 +3704,18 @@ var BottomLink = styled12.a`
|
|
|
3695
3704
|
var Footer_default = DxcFooter;
|
|
3696
3705
|
|
|
3697
3706
|
// src/header/Header.tsx
|
|
3698
|
-
import { useEffect as
|
|
3707
|
+
import { useEffect as useEffect4, useMemo as useMemo5, useRef as useRef3, useState as useState7 } from "react";
|
|
3699
3708
|
import styled16, { ThemeProvider as ThemeProvider7 } from "styled-components";
|
|
3700
3709
|
|
|
3701
3710
|
// src/dropdown/Dropdown.tsx
|
|
3702
3711
|
import * as Popover from "@radix-ui/react-popover";
|
|
3703
|
-
import { useCallback as useCallback4, useId as
|
|
3712
|
+
import { useCallback as useCallback4, useId as useId4, useLayoutEffect as useLayoutEffect2, useRef as useRef2, useState as useState6, useContext as useContext7 } from "react";
|
|
3704
3713
|
import styled15, { ThemeProvider as ThemeProvider6 } from "styled-components";
|
|
3705
3714
|
|
|
3706
3715
|
// src/utils/useWidth.tsx
|
|
3707
|
-
import { useLayoutEffect, useState as
|
|
3716
|
+
import { useLayoutEffect, useState as useState5 } from "react";
|
|
3708
3717
|
var useWidth = (target) => {
|
|
3709
|
-
const [width, setWidth] =
|
|
3718
|
+
const [width, setWidth] = useState5(0);
|
|
3710
3719
|
useLayoutEffect(() => {
|
|
3711
3720
|
if (target != null) {
|
|
3712
3721
|
setWidth(target.getBoundingClientRect().width);
|
|
@@ -3879,11 +3888,11 @@ var DxcDropdown = ({
|
|
|
3879
3888
|
tabIndex = 0,
|
|
3880
3889
|
title
|
|
3881
3890
|
}) => {
|
|
3882
|
-
const id =
|
|
3891
|
+
const id = useId4();
|
|
3883
3892
|
const triggerId = `trigger-${id}`;
|
|
3884
3893
|
const menuId = `menu-${id}`;
|
|
3885
|
-
const [isOpen, changeIsOpen] =
|
|
3886
|
-
const [visualFocusIndex, setVisualFocusIndex] =
|
|
3894
|
+
const [isOpen, changeIsOpen] = useState6(false);
|
|
3895
|
+
const [visualFocusIndex, setVisualFocusIndex] = useState6(0);
|
|
3887
3896
|
const colorsTheme = useContext7(HalstackContext);
|
|
3888
3897
|
const triggerRef = useRef2(null);
|
|
3889
3898
|
const menuRef = useRef2(null);
|
|
@@ -3996,72 +4005,75 @@ var DxcDropdown = ({
|
|
|
3996
4005
|
inline: "start"
|
|
3997
4006
|
});
|
|
3998
4007
|
}, [visualFocusIndex]);
|
|
3999
|
-
return /* @__PURE__ */
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
event
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
/* @__PURE__ */
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4008
|
+
return /* @__PURE__ */ jsxs10(ThemeProvider6, { theme: colorsTheme.dropdown, children: [
|
|
4009
|
+
/* @__PURE__ */ jsx18(
|
|
4010
|
+
DropdownContainer,
|
|
4011
|
+
{
|
|
4012
|
+
onMouseEnter: !disabled && expandOnHover ? handleOnOpenMenu : void 0,
|
|
4013
|
+
onMouseLeave: !disabled && expandOnHover ? handleOnCloseMenu : void 0,
|
|
4014
|
+
onBlur: !disabled ? handleOnBlur : void 0,
|
|
4015
|
+
margin,
|
|
4016
|
+
size,
|
|
4017
|
+
children: /* @__PURE__ */ jsxs10(Popover.Root, { open: isOpen, children: [
|
|
4018
|
+
/* @__PURE__ */ jsx18(Tooltip, { label: title, children: /* @__PURE__ */ jsx18(Popover.Trigger, { asChild: true, type: void 0, children: /* @__PURE__ */ jsxs10(
|
|
4019
|
+
DropdownTrigger,
|
|
4020
|
+
{
|
|
4021
|
+
onClick: handleTriggerOnClick,
|
|
4022
|
+
onKeyDown: handleTriggerOnKeyDown,
|
|
4023
|
+
onBlur: (event) => {
|
|
4024
|
+
event.stopPropagation();
|
|
4025
|
+
},
|
|
4026
|
+
disabled,
|
|
4027
|
+
label,
|
|
4028
|
+
margin,
|
|
4029
|
+
size,
|
|
4030
|
+
id: triggerId,
|
|
4031
|
+
"aria-haspopup": "true",
|
|
4032
|
+
"aria-controls": isOpen ? menuId : void 0,
|
|
4033
|
+
"aria-expanded": isOpen ? true : void 0,
|
|
4034
|
+
"aria-label": "Show options",
|
|
4035
|
+
tabIndex,
|
|
4036
|
+
ref: triggerRef,
|
|
4037
|
+
children: [
|
|
4038
|
+
/* @__PURE__ */ jsxs10(DropdownTriggerContent, { children: [
|
|
4039
|
+
label && iconPosition === "after" && /* @__PURE__ */ jsx18(DropdownTriggerLabel, { children: label }),
|
|
4040
|
+
icon && /* @__PURE__ */ jsx18(
|
|
4041
|
+
DropdownTriggerIcon,
|
|
4042
|
+
{
|
|
4043
|
+
disabled,
|
|
4044
|
+
role: typeof icon === "string" ? void 0 : "img",
|
|
4045
|
+
"aria-hidden": true,
|
|
4046
|
+
children: typeof icon === "string" ? /* @__PURE__ */ jsx18(Icon_default, { icon }) : icon
|
|
4047
|
+
}
|
|
4048
|
+
),
|
|
4049
|
+
label && iconPosition === "before" && /* @__PURE__ */ jsx18(DropdownTriggerLabel, { children: label })
|
|
4050
|
+
] }),
|
|
4051
|
+
!caretHidden && /* @__PURE__ */ jsxs10(CaretIcon, { disabled, children: [
|
|
4052
|
+
/* @__PURE__ */ jsx18(Icon_default, { icon: isOpen ? "arrow_drop_up" : "arrow_drop_down" }),
|
|
4053
|
+
" "
|
|
4054
|
+
] })
|
|
4055
|
+
]
|
|
4056
|
+
}
|
|
4057
|
+
) }) }),
|
|
4058
|
+
/* @__PURE__ */ jsx18(Popover.Portal, { container: document.getElementById(`${id}-portal`), children: /* @__PURE__ */ jsx18(Popover.Content, { asChild: true, sideOffset: 1, children: /* @__PURE__ */ jsx18(
|
|
4059
|
+
DropdownMenu_default,
|
|
4060
|
+
{
|
|
4061
|
+
id: menuId,
|
|
4062
|
+
dropdownTriggerId: triggerId,
|
|
4063
|
+
options,
|
|
4064
|
+
iconsPosition: optionsIconPosition,
|
|
4065
|
+
visualFocusIndex,
|
|
4066
|
+
menuItemOnClick: handleMenuItemOnClick,
|
|
4067
|
+
onKeyDown: handleMenuOnKeyDown,
|
|
4068
|
+
styles: { width, zIndex: "320" },
|
|
4069
|
+
ref: menuRef
|
|
4070
|
+
}
|
|
4071
|
+
) }) })
|
|
4072
|
+
] })
|
|
4073
|
+
}
|
|
4074
|
+
),
|
|
4075
|
+
/* @__PURE__ */ jsx18("div", { id: `${id}-portal`, style: { position: "absolute" } })
|
|
4076
|
+
] });
|
|
4065
4077
|
};
|
|
4066
4078
|
var sizes = {
|
|
4067
4079
|
small: "60px",
|
|
@@ -4190,8 +4202,8 @@ var DxcHeader = ({
|
|
|
4190
4202
|
margin,
|
|
4191
4203
|
tabIndex = 0
|
|
4192
4204
|
}) => {
|
|
4193
|
-
const [isResponsive, setIsResponsive] =
|
|
4194
|
-
const [isMenuVisible, setIsMenuVisible] =
|
|
4205
|
+
const [isResponsive, setIsResponsive] = useState7(false);
|
|
4206
|
+
const [isMenuVisible, setIsMenuVisible] = useState7(false);
|
|
4195
4207
|
const colorsTheme = useContext8(HalstackContext);
|
|
4196
4208
|
const translatedLabels = useContext8(HalstackLanguageContext);
|
|
4197
4209
|
const ref = useRef3(null);
|
|
@@ -4210,7 +4222,7 @@ var DxcHeader = ({
|
|
|
4210
4222
|
() => getLogoElement(colorsTheme.header.logoResponsive, translatedLabels.formFields.logoAlternativeText),
|
|
4211
4223
|
[colorsTheme, translatedLabels]
|
|
4212
4224
|
);
|
|
4213
|
-
|
|
4225
|
+
useEffect4(() => {
|
|
4214
4226
|
const handleResize = () => {
|
|
4215
4227
|
setIsResponsive(window.matchMedia(`(max-width: ${responsiveSizes.medium}rem)`).matches);
|
|
4216
4228
|
};
|
|
@@ -4220,7 +4232,7 @@ var DxcHeader = ({
|
|
|
4220
4232
|
window.removeEventListener("resize", handleResize);
|
|
4221
4233
|
};
|
|
4222
4234
|
}, []);
|
|
4223
|
-
|
|
4235
|
+
useEffect4(() => {
|
|
4224
4236
|
if (!isResponsive) {
|
|
4225
4237
|
setIsMenuVisible(false);
|
|
4226
4238
|
}
|
|
@@ -4417,7 +4429,7 @@ var Overlay2 = styled16.div`
|
|
|
4417
4429
|
var Header_default = DxcHeader;
|
|
4418
4430
|
|
|
4419
4431
|
// src/sidenav/Sidenav.tsx
|
|
4420
|
-
import { forwardRef as forwardRef3, useContext as useContext10, useEffect as
|
|
4432
|
+
import { forwardRef as forwardRef3, useContext as useContext10, useEffect as useEffect5, useState as useState8 } from "react";
|
|
4421
4433
|
import styled18, { ThemeProvider as ThemeProvider8 } from "styled-components";
|
|
4422
4434
|
|
|
4423
4435
|
// src/bleed/Bleed.tsx
|
|
@@ -4472,8 +4484,8 @@ var Section = ({ children }) => /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
|
4472
4484
|
/* @__PURE__ */ jsx21(Divider, {})
|
|
4473
4485
|
] });
|
|
4474
4486
|
var Group = ({ title, collapsable = false, icon, children }) => {
|
|
4475
|
-
const [collapsed, setCollapsed] =
|
|
4476
|
-
const [isSelected, changeIsSelected] =
|
|
4487
|
+
const [collapsed, setCollapsed] = useState8(false);
|
|
4488
|
+
const [isSelected, changeIsSelected] = useState8(false);
|
|
4477
4489
|
return /* @__PURE__ */ jsx21(GroupContextProvider, { value: changeIsSelected, children: /* @__PURE__ */ jsxs12(SidenavGroup, { children: [
|
|
4478
4490
|
collapsable && title ? /* @__PURE__ */ jsxs12(
|
|
4479
4491
|
SidenavGroupTitleButton,
|
|
@@ -4504,7 +4516,7 @@ var Link = forwardRef3(
|
|
|
4504
4516
|
onClick?.($event);
|
|
4505
4517
|
setIsSidenavVisibleResponsive?.(false);
|
|
4506
4518
|
};
|
|
4507
|
-
|
|
4519
|
+
useEffect5(() => {
|
|
4508
4520
|
changeIsGroupSelected?.((isGroupSelected2) => !isGroupSelected2 ? selected : isGroupSelected2);
|
|
4509
4521
|
}, [selected, changeIsGroupSelected]);
|
|
4510
4522
|
return /* @__PURE__ */ jsxs12(
|
|
@@ -4678,7 +4690,7 @@ DxcSidenav.Title = Title2;
|
|
|
4678
4690
|
var Sidenav_default = DxcSidenav;
|
|
4679
4691
|
|
|
4680
4692
|
// src/layout/utils.tsx
|
|
4681
|
-
import { Children as Children2, isValidElement, useState as
|
|
4693
|
+
import { Children as Children2, isValidElement, useState as useState9, useEffect as useEffect6 } from "react";
|
|
4682
4694
|
|
|
4683
4695
|
// src/layout/Icons.tsx
|
|
4684
4696
|
import { jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
@@ -4767,8 +4779,8 @@ var socialLinks = [
|
|
|
4767
4779
|
];
|
|
4768
4780
|
var findChildType = (children, childType) => Children2.toArray(children).find((child) => isValidElement(child) && child.type === childType);
|
|
4769
4781
|
var useResponsive = (breakpoint) => {
|
|
4770
|
-
const [isResponsive, setIsResponsive] =
|
|
4771
|
-
|
|
4782
|
+
const [isResponsive, setIsResponsive] = useState9(false);
|
|
4783
|
+
useEffect6(() => {
|
|
4772
4784
|
const handleResize = () => {
|
|
4773
4785
|
setIsResponsive(window.matchMedia(`(max-width: ${breakpoint}rem)`).matches);
|
|
4774
4786
|
};
|
|
@@ -4880,14 +4892,14 @@ var DxcApplicationLayout = ({
|
|
|
4880
4892
|
footer,
|
|
4881
4893
|
children
|
|
4882
4894
|
}) => {
|
|
4883
|
-
const [isSidenavVisibleResponsive, setIsSidenavVisibleResponsive] =
|
|
4895
|
+
const [isSidenavVisibleResponsive, setIsSidenavVisibleResponsive] = useState10(false);
|
|
4884
4896
|
const isResponsive = useResponsive(responsiveSizes.large);
|
|
4885
4897
|
const ref = useRef4(null);
|
|
4886
4898
|
const translatedLabels = useContext11(HalstackLanguageContext);
|
|
4887
4899
|
const handleSidenavVisibility = () => {
|
|
4888
4900
|
setIsSidenavVisibleResponsive((currentIsSidenavVisibleResponsive) => !currentIsSidenavVisibleResponsive);
|
|
4889
4901
|
};
|
|
4890
|
-
|
|
4902
|
+
useEffect7(() => {
|
|
4891
4903
|
if (!isResponsive) {
|
|
4892
4904
|
setIsSidenavVisibleResponsive(false);
|
|
4893
4905
|
}
|
|
@@ -5129,10 +5141,9 @@ var Item = ({ isCurrentPage = false, href, label, onClick }) => {
|
|
|
5129
5141
|
}
|
|
5130
5142
|
};
|
|
5131
5143
|
const handleOnClick = (event) => {
|
|
5144
|
+
if (typeof onClick !== "function") return;
|
|
5132
5145
|
event.preventDefault();
|
|
5133
|
-
if (href)
|
|
5134
|
-
onClick?.(href);
|
|
5135
|
-
}
|
|
5146
|
+
if (href) onClick(href);
|
|
5136
5147
|
};
|
|
5137
5148
|
return /* @__PURE__ */ jsx25(ListItem, { "aria-current": isCurrentPage ? "page" : void 0, isCurrentPage, children: isCurrentPage ? /* @__PURE__ */ jsx25(CurrentPage, { ref: currentItemRef, onMouseEnter: handleOnMouseEnter, children: label }) : /* @__PURE__ */ jsx25(Link2, { href, onClick: handleOnClick, children: /* @__PURE__ */ jsx25(Text, { children: label }) }) });
|
|
5138
5149
|
};
|
|
@@ -5380,7 +5391,7 @@ var ListItem2 = styled24.li`
|
|
|
5380
5391
|
var BulletedList_default = DxcBulletedList;
|
|
5381
5392
|
|
|
5382
5393
|
// src/card/Card.tsx
|
|
5383
|
-
import { useContext as useContext14, useState as
|
|
5394
|
+
import { useContext as useContext14, useState as useState11 } from "react";
|
|
5384
5395
|
import styled25, { ThemeProvider as ThemeProvider10 } from "styled-components";
|
|
5385
5396
|
import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
5386
5397
|
var DxcCard = ({
|
|
@@ -5397,7 +5408,7 @@ var DxcCard = ({
|
|
|
5397
5408
|
children
|
|
5398
5409
|
}) => {
|
|
5399
5410
|
const colorsTheme = useContext14(HalstackContext);
|
|
5400
|
-
const [isHovered, changeIsHovered] =
|
|
5411
|
+
const [isHovered, changeIsHovered] = useState11(false);
|
|
5401
5412
|
return /* @__PURE__ */ jsx29(ThemeProvider10, { theme: colorsTheme.card, children: /* @__PURE__ */ jsx29(
|
|
5402
5413
|
Card,
|
|
5403
5414
|
{
|
|
@@ -5463,7 +5474,7 @@ var CardContent = styled25.div`
|
|
|
5463
5474
|
var Card_default = DxcCard;
|
|
5464
5475
|
|
|
5465
5476
|
// src/checkbox/Checkbox.tsx
|
|
5466
|
-
import { useContext as useContext15, useState as
|
|
5477
|
+
import { useContext as useContext15, useState as useState12, useRef as useRef6, useId as useId5, forwardRef as forwardRef4 } from "react";
|
|
5467
5478
|
import styled26, { ThemeProvider as ThemeProvider11 } from "styled-components";
|
|
5468
5479
|
import { jsx as jsx30, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
5469
5480
|
var checkedIcon = /* @__PURE__ */ jsx30("svg", { fill: "currentColor", focusable: "false", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx30("path", { d: "M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" }) });
|
|
@@ -5484,8 +5495,8 @@ var DxcCheckbox = forwardRef4(
|
|
|
5484
5495
|
tabIndex = 0,
|
|
5485
5496
|
ariaLabel = "Checkbox"
|
|
5486
5497
|
}, ref) => {
|
|
5487
|
-
const labelId = `label-checkbox-${
|
|
5488
|
-
const [innerChecked, setInnerChecked] =
|
|
5498
|
+
const labelId = `label-checkbox-${useId5()}`;
|
|
5499
|
+
const [innerChecked, setInnerChecked] = useState12(defaultChecked);
|
|
5489
5500
|
const checkboxRef = useRef6(null);
|
|
5490
5501
|
const colorsTheme = useContext15(HalstackContext);
|
|
5491
5502
|
const translatedLabels = useContext15(HalstackLanguageContext);
|
|
@@ -5790,21 +5801,21 @@ var IconContainer5 = styled27.div`
|
|
|
5790
5801
|
var Chip_default = DxcChip;
|
|
5791
5802
|
|
|
5792
5803
|
// src/contextual-menu/ContextualMenu.tsx
|
|
5793
|
-
import { useContext as useContext19, useLayoutEffect as useLayoutEffect3, useMemo as useMemo8, useRef as useRef7, useState as
|
|
5804
|
+
import { useContext as useContext19, useLayoutEffect as useLayoutEffect3, useMemo as useMemo8, useRef as useRef7, useState as useState15 } from "react";
|
|
5794
5805
|
import styled31, { ThemeProvider as ThemeProvider13 } from "styled-components";
|
|
5795
5806
|
|
|
5796
5807
|
// src/contextual-menu/MenuItem.tsx
|
|
5797
5808
|
import styled29 from "styled-components";
|
|
5798
5809
|
|
|
5799
5810
|
// src/contextual-menu/GroupItem.tsx
|
|
5800
|
-
import { useContext as useContext17, useMemo as useMemo7, useState as
|
|
5811
|
+
import { useContext as useContext17, useMemo as useMemo7, useState as useState14, memo as memo4, useId as useId6 } from "react";
|
|
5801
5812
|
|
|
5802
5813
|
// src/contextual-menu/ItemAction.tsx
|
|
5803
|
-
import { cloneElement as cloneElement2, useState as
|
|
5814
|
+
import { cloneElement as cloneElement2, useState as useState13 } from "react";
|
|
5804
5815
|
import styled28 from "styled-components";
|
|
5805
5816
|
import { jsx as jsx32, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5806
5817
|
var ItemAction = ({ badge, collapseIcon, icon, label, depthLevel, ...props }) => {
|
|
5807
|
-
const [hasTooltip, setHasTooltip] =
|
|
5818
|
+
const [hasTooltip, setHasTooltip] = useState13(false);
|
|
5808
5819
|
const modifiedBadge = badge && cloneElement2(badge, { size: "small" });
|
|
5809
5820
|
return /* @__PURE__ */ jsx32(TooltipWrapper, { condition: hasTooltip, label, children: /* @__PURE__ */ jsxs21(Action, { depthLevel, ...props, children: [
|
|
5810
5821
|
/* @__PURE__ */ jsxs21(Label2, { children: [
|
|
@@ -5892,10 +5903,10 @@ var isGroupSelected = (items, selectedItemId) => items.some((item) => {
|
|
|
5892
5903
|
else return item.selectedByDefault;
|
|
5893
5904
|
});
|
|
5894
5905
|
var GroupItem = ({ items, ...props }) => {
|
|
5895
|
-
const groupMenuId = `group-menu-${
|
|
5906
|
+
const groupMenuId = `group-menu-${useId6()}`;
|
|
5896
5907
|
const { selectedItemId } = useContext17(ContextualMenuContext_default) ?? {};
|
|
5897
5908
|
const groupSelected = useMemo7(() => isGroupSelected(items, selectedItemId), [items, selectedItemId]);
|
|
5898
|
-
const [isOpen, setIsOpen] =
|
|
5909
|
+
const [isOpen, setIsOpen] = useState14(groupSelected && selectedItemId === -1);
|
|
5899
5910
|
return /* @__PURE__ */ jsxs22(Fragment10, { children: [
|
|
5900
5911
|
/* @__PURE__ */ jsx33(
|
|
5901
5912
|
ItemAction_default,
|
|
@@ -5917,7 +5928,7 @@ var GroupItem = ({ items, ...props }) => {
|
|
|
5917
5928
|
var GroupItem_default = memo4(GroupItem);
|
|
5918
5929
|
|
|
5919
5930
|
// src/contextual-menu/SingleItem.tsx
|
|
5920
|
-
import { useContext as useContext18, useEffect as
|
|
5931
|
+
import { useContext as useContext18, useEffect as useEffect8 } from "react";
|
|
5921
5932
|
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
5922
5933
|
var SingleItem = ({ id, onSelect, selectedByDefault = false, ...props }) => {
|
|
5923
5934
|
const { selectedItemId, setSelectedItemId } = useContext18(ContextualMenuContext_default) ?? {};
|
|
@@ -5925,7 +5936,7 @@ var SingleItem = ({ id, onSelect, selectedByDefault = false, ...props }) => {
|
|
|
5925
5936
|
setSelectedItemId?.(id);
|
|
5926
5937
|
onSelect?.();
|
|
5927
5938
|
};
|
|
5928
|
-
|
|
5939
|
+
useEffect8(() => {
|
|
5929
5940
|
if (selectedItemId === -1 && selectedByDefault) {
|
|
5930
5941
|
setSelectedItemId?.(id);
|
|
5931
5942
|
}
|
|
@@ -5953,10 +5964,10 @@ var MenuItem_default = MenuItem;
|
|
|
5953
5964
|
|
|
5954
5965
|
// src/contextual-menu/Section.tsx
|
|
5955
5966
|
import styled30 from "styled-components";
|
|
5956
|
-
import { useId as
|
|
5967
|
+
import { useId as useId7 } from "react";
|
|
5957
5968
|
import { jsx as jsx36, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5958
5969
|
var Section2 = ({ section, index, length }) => {
|
|
5959
|
-
const id = `section-${
|
|
5970
|
+
const id = `section-${useId7()}`;
|
|
5960
5971
|
return /* @__PURE__ */ jsxs23("section", { "aria-label": section.title ?? id, "aria-labelledby": id, children: [
|
|
5961
5972
|
section.title && /* @__PURE__ */ jsx36(Title3, { id, children: section.title }),
|
|
5962
5973
|
/* @__PURE__ */ jsx36(SubMenu, { children: section.items.map((item, index2) => /* @__PURE__ */ jsx36(MenuItem_default, { item }, `${item.label}-${index2}`)) }),
|
|
@@ -6023,12 +6034,12 @@ var addIdToItems = (items) => {
|
|
|
6023
6034
|
};
|
|
6024
6035
|
var SubMenu = ({ children, id }) => /* @__PURE__ */ jsx37(StyledSubMenu, { id, role: "menu", children });
|
|
6025
6036
|
function DxcContextualMenu({ items }) {
|
|
6026
|
-
const [selectedItemId, setSelectedItemId] =
|
|
6037
|
+
const [selectedItemId, setSelectedItemId] = useState15(-1);
|
|
6027
6038
|
const contextualMenuRef = useRef7(null);
|
|
6028
6039
|
const itemsWithId = useMemo8(() => addIdToItems(items), [items]);
|
|
6029
6040
|
const contextValue = useMemo8(() => ({ selectedItemId, setSelectedItemId }), [selectedItemId, setSelectedItemId]);
|
|
6030
6041
|
const colorsTheme = useContext19(HalstackContext);
|
|
6031
|
-
const [firstUpdate, setFirstUpdate] =
|
|
6042
|
+
const [firstUpdate, setFirstUpdate] = useState15(true);
|
|
6032
6043
|
useLayoutEffect3(() => {
|
|
6033
6044
|
if (selectedItemId !== -1 && firstUpdate) {
|
|
6034
6045
|
const contextualMenuEl = contextualMenuRef.current;
|
|
@@ -6043,17 +6054,17 @@ function DxcContextualMenu({ items }) {
|
|
|
6043
6054
|
}
|
|
6044
6055
|
|
|
6045
6056
|
// src/data-grid/DataGrid.tsx
|
|
6046
|
-
import { useContext as useContext25, useEffect as
|
|
6057
|
+
import { useContext as useContext25, useEffect as useEffect9, useMemo as useMemo11, useState as useState19 } from "react";
|
|
6047
6058
|
import DataGrid from "react-data-grid";
|
|
6048
6059
|
import styled38, { ThemeProvider as ThemeProvider18 } from "styled-components";
|
|
6049
6060
|
import "react-data-grid/lib/styles.css";
|
|
6050
6061
|
|
|
6051
6062
|
// src/data-grid/utils.tsx
|
|
6052
|
-
import { useState as
|
|
6063
|
+
import { useState as useState16 } from "react";
|
|
6053
6064
|
import { textEditor } from "react-data-grid";
|
|
6054
6065
|
|
|
6055
6066
|
// src/spinner/Spinner.tsx
|
|
6056
|
-
import { useContext as useContext20, useId as
|
|
6067
|
+
import { useContext as useContext20, useId as useId8, useMemo as useMemo9 } from "react";
|
|
6057
6068
|
import styled32, { ThemeProvider as ThemeProvider14 } from "styled-components";
|
|
6058
6069
|
import { jsx as jsx38, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6059
6070
|
var DxcSpinner = ({
|
|
@@ -6064,7 +6075,7 @@ var DxcSpinner = ({
|
|
|
6064
6075
|
margin,
|
|
6065
6076
|
ariaLabel = "Spinner"
|
|
6066
6077
|
}) => {
|
|
6067
|
-
const labelId =
|
|
6078
|
+
const labelId = useId8();
|
|
6068
6079
|
const colorsTheme = useContext20(HalstackContext);
|
|
6069
6080
|
const determinated = useMemo9(() => value != null && value >= 0 && value <= 100, [value]);
|
|
6070
6081
|
return /* @__PURE__ */ jsx38(ThemeProvider14, { theme: colorsTheme.spinner, children: /* @__PURE__ */ jsx38(DXCSpinner, { margin, mode, children: /* @__PURE__ */ jsxs24(SpinnerContainer, { mode, children: [
|
|
@@ -6324,7 +6335,7 @@ var renderExpandableTrigger = (row, rows, uniqueRowId, setRowsToRender) => /* @_
|
|
|
6324
6335
|
}
|
|
6325
6336
|
);
|
|
6326
6337
|
var renderHierarchyTrigger = (rows, triggerRow, uniqueRowId, columnKey, setRowsToRender, childrenTrigger) => {
|
|
6327
|
-
const [loading, setLoading] =
|
|
6338
|
+
const [loading, setLoading] = useState16(false);
|
|
6328
6339
|
const onClick = async () => {
|
|
6329
6340
|
if (loading) return;
|
|
6330
6341
|
if (!triggerRow.visibleChildren) {
|
|
@@ -6612,10 +6623,10 @@ import {
|
|
|
6612
6623
|
forwardRef as forwardRef5,
|
|
6613
6624
|
useCallback as useCallback6,
|
|
6614
6625
|
useContext as useContext22,
|
|
6615
|
-
useId as
|
|
6626
|
+
useId as useId9,
|
|
6616
6627
|
useMemo as useMemo10,
|
|
6617
6628
|
useRef as useRef9,
|
|
6618
|
-
useState as
|
|
6629
|
+
useState as useState18
|
|
6619
6630
|
} from "react";
|
|
6620
6631
|
import styled35, { ThemeProvider as ThemeProvider15 } from "styled-components";
|
|
6621
6632
|
|
|
@@ -6625,7 +6636,7 @@ import styled34 from "styled-components";
|
|
|
6625
6636
|
|
|
6626
6637
|
// src/select/ListOption.tsx
|
|
6627
6638
|
import styled33 from "styled-components";
|
|
6628
|
-
import { useState as
|
|
6639
|
+
import { useState as useState17 } from "react";
|
|
6629
6640
|
import { jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
6630
6641
|
var ListOption = ({
|
|
6631
6642
|
id,
|
|
@@ -6637,7 +6648,7 @@ var ListOption = ({
|
|
|
6637
6648
|
isLastOption,
|
|
6638
6649
|
isSelected
|
|
6639
6650
|
}) => {
|
|
6640
|
-
const [hasTooltip, setHasTooltip] =
|
|
6651
|
+
const [hasTooltip, setHasTooltip] = useState17(false);
|
|
6641
6652
|
const handleOnMouseEnter = (event) => {
|
|
6642
6653
|
const text = event.currentTarget;
|
|
6643
6654
|
setHasTooltip(text.scrollWidth > text.clientWidth);
|
|
@@ -6996,15 +7007,15 @@ var DxcSelect = forwardRef5(
|
|
|
6996
7007
|
tabIndex = 0,
|
|
6997
7008
|
ariaLabel = "Select"
|
|
6998
7009
|
}, ref) => {
|
|
6999
|
-
const selectId = `select-${
|
|
7010
|
+
const selectId = `select-${useId9()}`;
|
|
7000
7011
|
const selectLabelId = `label-${selectId}`;
|
|
7001
7012
|
const errorId = `error-${selectId}`;
|
|
7002
7013
|
const listboxId = `${selectId}-listbox`;
|
|
7003
|
-
const [innerValue, setInnerValue] =
|
|
7004
|
-
const [searchValue, setSearchValue] =
|
|
7005
|
-
const [visualFocusIndex, changeVisualFocusIndex] =
|
|
7006
|
-
const [isOpen, changeIsOpen] =
|
|
7007
|
-
const [hasTooltip, setHasTooltip] =
|
|
7014
|
+
const [innerValue, setInnerValue] = useState18(defaultValue ?? (multiple ? [] : ""));
|
|
7015
|
+
const [searchValue, setSearchValue] = useState18("");
|
|
7016
|
+
const [visualFocusIndex, changeVisualFocusIndex] = useState18(-1);
|
|
7017
|
+
const [isOpen, changeIsOpen] = useState18(false);
|
|
7018
|
+
const [hasTooltip, setHasTooltip] = useState18(false);
|
|
7008
7019
|
const selectRef = useRef9(null);
|
|
7009
7020
|
const selectSearchInputRef = useRef9(null);
|
|
7010
7021
|
const width = useWidth_default(selectRef.current);
|
|
@@ -7202,148 +7213,151 @@ var DxcSelect = forwardRef5(
|
|
|
7202
7213
|
const text = event.currentTarget;
|
|
7203
7214
|
setHasTooltip(text.scrollWidth > text.clientWidth);
|
|
7204
7215
|
};
|
|
7205
|
-
return /* @__PURE__ */
|
|
7206
|
-
|
|
7207
|
-
|
|
7208
|
-
|
|
7209
|
-
id: selectLabelId,
|
|
7210
|
-
disabled,
|
|
7211
|
-
onClick: () => {
|
|
7212
|
-
selectRef?.current?.focus();
|
|
7213
|
-
},
|
|
7214
|
-
helperText,
|
|
7215
|
-
children: [
|
|
7216
|
-
label,
|
|
7217
|
-
" ",
|
|
7218
|
-
optional && /* @__PURE__ */ jsx42(OptionalLabel, { children: translatedLabels.formFields.optionalLabel })
|
|
7219
|
-
]
|
|
7220
|
-
}
|
|
7221
|
-
),
|
|
7222
|
-
helperText && /* @__PURE__ */ jsx42(HelperText, { disabled, children: helperText }),
|
|
7223
|
-
/* @__PURE__ */ jsxs28(Popover2.Root, { open: isOpen, children: [
|
|
7224
|
-
/* @__PURE__ */ jsx42(Popover2.Trigger, { asChild: true, type: void 0, children: /* @__PURE__ */ jsxs28(
|
|
7225
|
-
Select,
|
|
7216
|
+
return /* @__PURE__ */ jsxs28(ThemeProvider15, { theme: colorsTheme.select, children: [
|
|
7217
|
+
/* @__PURE__ */ jsxs28(SelectContainer, { margin, size, ref, children: [
|
|
7218
|
+
label && /* @__PURE__ */ jsxs28(
|
|
7219
|
+
Label3,
|
|
7226
7220
|
{
|
|
7227
|
-
id:
|
|
7221
|
+
id: selectLabelId,
|
|
7228
7222
|
disabled,
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
onKeyDown: handleSelectOnKeyDown,
|
|
7234
|
-
ref: selectRef,
|
|
7235
|
-
tabIndex: disabled ? -1 : tabIndex,
|
|
7236
|
-
role: "combobox",
|
|
7237
|
-
"aria-controls": isOpen ? listboxId : void 0,
|
|
7238
|
-
"aria-disabled": disabled,
|
|
7239
|
-
"aria-expanded": isOpen,
|
|
7240
|
-
"aria-haspopup": "listbox",
|
|
7241
|
-
"aria-labelledby": label ? selectLabelId : void 0,
|
|
7242
|
-
"aria-activedescendant": visualFocusIndex >= 0 ? `option-${visualFocusIndex}` : void 0,
|
|
7243
|
-
"aria-invalid": !!error,
|
|
7244
|
-
"aria-errormessage": error ? errorId : void 0,
|
|
7245
|
-
"aria-required": !disabled && !optional,
|
|
7246
|
-
"aria-label": label ? void 0 : ariaLabel,
|
|
7223
|
+
onClick: () => {
|
|
7224
|
+
selectRef?.current?.focus();
|
|
7225
|
+
},
|
|
7226
|
+
helperText,
|
|
7247
7227
|
children: [
|
|
7248
|
-
|
|
7249
|
-
|
|
7250
|
-
|
|
7251
|
-
|
|
7228
|
+
label,
|
|
7229
|
+
" ",
|
|
7230
|
+
optional && /* @__PURE__ */ jsx42(OptionalLabel, { children: translatedLabels.formFields.optionalLabel })
|
|
7231
|
+
]
|
|
7232
|
+
}
|
|
7233
|
+
),
|
|
7234
|
+
helperText && /* @__PURE__ */ jsx42(HelperText, { disabled, children: helperText }),
|
|
7235
|
+
/* @__PURE__ */ jsxs28(Popover2.Root, { open: isOpen, children: [
|
|
7236
|
+
/* @__PURE__ */ jsx42(Popover2.Trigger, { asChild: true, type: void 0, children: /* @__PURE__ */ jsxs28(
|
|
7237
|
+
Select,
|
|
7238
|
+
{
|
|
7239
|
+
id: selectId,
|
|
7240
|
+
disabled,
|
|
7241
|
+
error,
|
|
7242
|
+
onBlur: handleSelectOnBlur,
|
|
7243
|
+
onClick: handleSelectOnClick,
|
|
7244
|
+
onFocus: handleSelectOnFocus,
|
|
7245
|
+
onKeyDown: handleSelectOnKeyDown,
|
|
7246
|
+
ref: selectRef,
|
|
7247
|
+
tabIndex: disabled ? -1 : tabIndex,
|
|
7248
|
+
role: "combobox",
|
|
7249
|
+
"aria-controls": isOpen ? listboxId : void 0,
|
|
7250
|
+
"aria-disabled": disabled,
|
|
7251
|
+
"aria-expanded": isOpen,
|
|
7252
|
+
"aria-haspopup": "listbox",
|
|
7253
|
+
"aria-labelledby": label ? selectLabelId : void 0,
|
|
7254
|
+
"aria-activedescendant": visualFocusIndex >= 0 ? `option-${visualFocusIndex}` : void 0,
|
|
7255
|
+
"aria-invalid": !!error,
|
|
7256
|
+
"aria-errormessage": error ? errorId : void 0,
|
|
7257
|
+
"aria-required": !disabled && !optional,
|
|
7258
|
+
"aria-label": label ? void 0 : ariaLabel,
|
|
7259
|
+
children: [
|
|
7260
|
+
multiple && Array.isArray(selectedOption) && selectedOption.length > 0 && /* @__PURE__ */ jsxs28(SelectionIndicator, { children: [
|
|
7261
|
+
/* @__PURE__ */ jsx42(SelectionNumber, { disabled, children: selectedOption.length }),
|
|
7262
|
+
/* @__PURE__ */ jsx42(TooltipWrapper, { condition: !disabled, label: translatedLabels.select.actionClearSelectionTitle, children: /* @__PURE__ */ jsx42(
|
|
7263
|
+
ClearOptionsAction,
|
|
7264
|
+
{
|
|
7265
|
+
disabled,
|
|
7266
|
+
onMouseDown: (event) => {
|
|
7267
|
+
event.preventDefault();
|
|
7268
|
+
},
|
|
7269
|
+
onClick: handleClearOptionsActionOnClick,
|
|
7270
|
+
tabIndex: -1,
|
|
7271
|
+
"aria-label": translatedLabels.select.actionClearSelectionTitle,
|
|
7272
|
+
children: /* @__PURE__ */ jsx42(Icon_default, { icon: "clear" })
|
|
7273
|
+
}
|
|
7274
|
+
) })
|
|
7275
|
+
] }),
|
|
7276
|
+
/* @__PURE__ */ jsx42(TooltipWrapper, { condition: hasTooltip, label: getSelectedOptionLabel(placeholder, selectedOption), children: /* @__PURE__ */ jsxs28(SearchableValueContainer, { children: [
|
|
7277
|
+
/* @__PURE__ */ jsx42(
|
|
7278
|
+
"input",
|
|
7279
|
+
{
|
|
7280
|
+
style: { display: "none" },
|
|
7281
|
+
name,
|
|
7282
|
+
disabled,
|
|
7283
|
+
value: multiple ? (Array.isArray(value) ? value : Array.isArray(innerValue) ? innerValue : []).join(",") : value ?? innerValue,
|
|
7284
|
+
readOnly: true,
|
|
7285
|
+
"aria-hidden": "true"
|
|
7286
|
+
}
|
|
7287
|
+
),
|
|
7288
|
+
searchable && /* @__PURE__ */ jsx42(
|
|
7289
|
+
SearchInput,
|
|
7290
|
+
{
|
|
7291
|
+
value: searchValue,
|
|
7292
|
+
disabled,
|
|
7293
|
+
onChange: handleSearchIOnChange,
|
|
7294
|
+
ref: selectSearchInputRef,
|
|
7295
|
+
autoComplete: "nope",
|
|
7296
|
+
autoCorrect: "nope",
|
|
7297
|
+
size: 1,
|
|
7298
|
+
"aria-labelledby": label ? selectLabelId : void 0
|
|
7299
|
+
}
|
|
7300
|
+
),
|
|
7301
|
+
(!searchable || searchValue === "") && /* @__PURE__ */ jsx42(
|
|
7302
|
+
SelectedOption,
|
|
7303
|
+
{
|
|
7304
|
+
disabled,
|
|
7305
|
+
atBackground: (multiple ? (value ?? innerValue).length === 0 : !(value ?? innerValue)) || searchable && isOpen,
|
|
7306
|
+
children: /* @__PURE__ */ jsx42(SelectedOptionLabel, { onMouseEnter: handleOnMouseEnter, children: getSelectedOptionLabel(placeholder, selectedOption) })
|
|
7307
|
+
}
|
|
7308
|
+
)
|
|
7309
|
+
] }) }),
|
|
7310
|
+
!disabled && error && /* @__PURE__ */ jsx42(ErrorIcon, { children: /* @__PURE__ */ jsx42(Icon_default, { icon: "filled_error" }) }),
|
|
7311
|
+
searchable && searchValue.length > 0 && /* @__PURE__ */ jsx42(TooltipWrapper, { condition: !disabled, label: translatedLabels.select.actionClearSelectionTitle, children: /* @__PURE__ */ jsx42(
|
|
7312
|
+
ClearSearchAction,
|
|
7252
7313
|
{
|
|
7253
|
-
disabled,
|
|
7254
7314
|
onMouseDown: (event) => {
|
|
7255
7315
|
event.preventDefault();
|
|
7256
7316
|
},
|
|
7257
|
-
onClick:
|
|
7317
|
+
onClick: handleClearSearchActionOnClick,
|
|
7258
7318
|
tabIndex: -1,
|
|
7259
|
-
"aria-label": translatedLabels.select.
|
|
7319
|
+
"aria-label": translatedLabels.select.actionClearSearchTitle,
|
|
7260
7320
|
children: /* @__PURE__ */ jsx42(Icon_default, { icon: "clear" })
|
|
7261
7321
|
}
|
|
7262
|
-
) })
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
disabled,
|
|
7281
|
-
onChange: handleSearchIOnChange,
|
|
7282
|
-
ref: selectSearchInputRef,
|
|
7283
|
-
autoComplete: "nope",
|
|
7284
|
-
autoCorrect: "nope",
|
|
7285
|
-
size: 1,
|
|
7286
|
-
"aria-labelledby": label ? selectLabelId : void 0
|
|
7287
|
-
}
|
|
7288
|
-
),
|
|
7289
|
-
(!searchable || searchValue === "") && /* @__PURE__ */ jsx42(
|
|
7290
|
-
SelectedOption,
|
|
7291
|
-
{
|
|
7292
|
-
disabled,
|
|
7293
|
-
atBackground: (multiple ? (value ?? innerValue).length === 0 : !(value ?? innerValue)) || searchable && isOpen,
|
|
7294
|
-
children: /* @__PURE__ */ jsx42(SelectedOptionLabel, { onMouseEnter: handleOnMouseEnter, children: getSelectedOptionLabel(placeholder, selectedOption) })
|
|
7295
|
-
}
|
|
7296
|
-
)
|
|
7297
|
-
] }) }),
|
|
7298
|
-
!disabled && error && /* @__PURE__ */ jsx42(ErrorIcon, { children: /* @__PURE__ */ jsx42(Icon_default, { icon: "filled_error" }) }),
|
|
7299
|
-
searchable && searchValue.length > 0 && /* @__PURE__ */ jsx42(Tooltip, { label: translatedLabels.select.actionClearSelectionTitle, children: /* @__PURE__ */ jsx42(
|
|
7300
|
-
ClearSearchAction,
|
|
7322
|
+
) }),
|
|
7323
|
+
/* @__PURE__ */ jsx42(CollapseIndicator2, { disabled, children: /* @__PURE__ */ jsx42(Icon_default, { icon: isOpen ? "keyboard_arrow_up" : "keyboard_arrow_down" }) })
|
|
7324
|
+
]
|
|
7325
|
+
}
|
|
7326
|
+
) }),
|
|
7327
|
+
/* @__PURE__ */ jsx42(Popover2.Portal, { container: document.getElementById(`${selectId}-portal`), children: /* @__PURE__ */ jsx42(
|
|
7328
|
+
Popover2.Content,
|
|
7329
|
+
{
|
|
7330
|
+
sideOffset: 4,
|
|
7331
|
+
style: { zIndex: "310" },
|
|
7332
|
+
onOpenAutoFocus: (event) => {
|
|
7333
|
+
event.preventDefault();
|
|
7334
|
+
},
|
|
7335
|
+
onCloseAutoFocus: (event) => {
|
|
7336
|
+
event.preventDefault();
|
|
7337
|
+
},
|
|
7338
|
+
children: /* @__PURE__ */ jsx42(
|
|
7339
|
+
Listbox_default,
|
|
7301
7340
|
{
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7341
|
+
id: listboxId,
|
|
7342
|
+
currentValue: value ?? innerValue,
|
|
7343
|
+
options: searchable ? filteredOptions : options,
|
|
7344
|
+
visualFocusIndex,
|
|
7345
|
+
lastOptionIndex,
|
|
7346
|
+
multiple,
|
|
7347
|
+
optional,
|
|
7348
|
+
optionalItem,
|
|
7349
|
+
searchable,
|
|
7350
|
+
handleOptionOnClick,
|
|
7351
|
+
styles: { width }
|
|
7309
7352
|
}
|
|
7310
|
-
)
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
/* @__PURE__ */ jsx42(Popover2.Portal, { children: /* @__PURE__ */ jsx42(
|
|
7316
|
-
Popover2.Content,
|
|
7317
|
-
{
|
|
7318
|
-
sideOffset: 4,
|
|
7319
|
-
style: { zIndex: "310" },
|
|
7320
|
-
onOpenAutoFocus: (event) => {
|
|
7321
|
-
event.preventDefault();
|
|
7322
|
-
},
|
|
7323
|
-
onCloseAutoFocus: (event) => {
|
|
7324
|
-
event.preventDefault();
|
|
7325
|
-
},
|
|
7326
|
-
children: /* @__PURE__ */ jsx42(
|
|
7327
|
-
Listbox_default,
|
|
7328
|
-
{
|
|
7329
|
-
id: listboxId,
|
|
7330
|
-
currentValue: value ?? innerValue,
|
|
7331
|
-
options: searchable ? filteredOptions : options,
|
|
7332
|
-
visualFocusIndex,
|
|
7333
|
-
lastOptionIndex,
|
|
7334
|
-
multiple,
|
|
7335
|
-
optional,
|
|
7336
|
-
optionalItem,
|
|
7337
|
-
searchable,
|
|
7338
|
-
handleOptionOnClick,
|
|
7339
|
-
styles: { width }
|
|
7340
|
-
}
|
|
7341
|
-
)
|
|
7342
|
-
}
|
|
7343
|
-
) })
|
|
7353
|
+
)
|
|
7354
|
+
}
|
|
7355
|
+
) })
|
|
7356
|
+
] }),
|
|
7357
|
+
!disabled && typeof error === "string" && /* @__PURE__ */ jsx42(Error2, { id: errorId, role: "alert", "aria-live": error ? "assertive" : "off", children: error })
|
|
7344
7358
|
] }),
|
|
7345
|
-
|
|
7346
|
-
] })
|
|
7359
|
+
/* @__PURE__ */ jsx42("div", { id: `${selectId}-portal`, style: { position: "absolute" } })
|
|
7360
|
+
] });
|
|
7347
7361
|
}
|
|
7348
7362
|
);
|
|
7349
7363
|
var sizes3 = {
|
|
@@ -8054,9 +8068,9 @@ var DxcDataGrid = ({
|
|
|
8054
8068
|
totalItems,
|
|
8055
8069
|
defaultPage = 1
|
|
8056
8070
|
}) => {
|
|
8057
|
-
const [rowsToRender, setRowsToRender] =
|
|
8071
|
+
const [rowsToRender, setRowsToRender] = useState19([...rows]);
|
|
8058
8072
|
const colorsTheme = useContext25(HalstackContext);
|
|
8059
|
-
const [page, changePage] =
|
|
8073
|
+
const [page, changePage] = useState19(defaultPage);
|
|
8060
8074
|
const goToPage = (newPage) => {
|
|
8061
8075
|
if (onPageChange) {
|
|
8062
8076
|
onPageChange(newPage);
|
|
@@ -8139,12 +8153,12 @@ var DxcDataGrid = ({
|
|
|
8139
8153
|
}
|
|
8140
8154
|
return expectedColumns;
|
|
8141
8155
|
}, [selectable, expandable, columns, rowsToRender, onSelectRows, rows, summaryRow, uniqueRowId, selectedRows]);
|
|
8142
|
-
const [columnsOrder, setColumnsOrder] =
|
|
8143
|
-
const [sortColumns, setSortColumns] =
|
|
8144
|
-
|
|
8156
|
+
const [columnsOrder, setColumnsOrder] = useState19(() => columnsToRender.map((_, index) => index));
|
|
8157
|
+
const [sortColumns, setSortColumns] = useState19([]);
|
|
8158
|
+
useEffect9(() => {
|
|
8145
8159
|
setColumnsOrder(Array.from({ length: columnsToRender.length }, (_, index) => index));
|
|
8146
8160
|
}, [columnsToRender.length]);
|
|
8147
|
-
|
|
8161
|
+
useEffect9(() => {
|
|
8148
8162
|
const finalRows = [...rows];
|
|
8149
8163
|
if (expandable) {
|
|
8150
8164
|
finalRows.filter((row) => {
|
|
@@ -8267,10 +8281,10 @@ var DataGrid_default = DxcDataGrid;
|
|
|
8267
8281
|
|
|
8268
8282
|
// src/date-input/DateInput.tsx
|
|
8269
8283
|
import {
|
|
8270
|
-
useState as
|
|
8284
|
+
useState as useState24,
|
|
8271
8285
|
useRef as useRef12,
|
|
8272
|
-
useEffect as
|
|
8273
|
-
useId as
|
|
8286
|
+
useEffect as useEffect14,
|
|
8287
|
+
useId as useId13,
|
|
8274
8288
|
useCallback as useCallback7,
|
|
8275
8289
|
useContext as useContext30,
|
|
8276
8290
|
forwardRef as forwardRef7
|
|
@@ -8281,12 +8295,12 @@ import * as Popover4 from "@radix-ui/react-popover";
|
|
|
8281
8295
|
import customParseFormat from "dayjs/plugin/customParseFormat";
|
|
8282
8296
|
|
|
8283
8297
|
// src/date-input/DatePicker.tsx
|
|
8284
|
-
import { memo as memo7, useContext as useContext27, useState as
|
|
8298
|
+
import { memo as memo7, useContext as useContext27, useState as useState22 } from "react";
|
|
8285
8299
|
import dayjs2 from "dayjs";
|
|
8286
8300
|
import styled41 from "styled-components";
|
|
8287
8301
|
|
|
8288
8302
|
// src/date-input/Calendar.tsx
|
|
8289
|
-
import { useContext as useContext26, useState as
|
|
8303
|
+
import { useContext as useContext26, useState as useState20, useMemo as useMemo12, useEffect as useEffect10, useId as useId10, memo as memo5 } from "react";
|
|
8290
8304
|
import styled39 from "styled-components";
|
|
8291
8305
|
import { jsx as jsx46, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
8292
8306
|
var getDays = (innerDate) => {
|
|
@@ -8330,9 +8344,9 @@ var Calendar = ({
|
|
|
8330
8344
|
onDaySelect,
|
|
8331
8345
|
today: today2
|
|
8332
8346
|
}) => {
|
|
8333
|
-
const [dateToFocus, setDateToFocus] =
|
|
8334
|
-
const [isFocusable, setIsFocusable] =
|
|
8335
|
-
const id =
|
|
8347
|
+
const [dateToFocus, setDateToFocus] = useState20(getDateToFocus(selectedDate, innerDate, today2));
|
|
8348
|
+
const [isFocusable, setIsFocusable] = useState20(false);
|
|
8349
|
+
const id = useId10();
|
|
8336
8350
|
const translatedLabels = useContext26(HalstackLanguageContext);
|
|
8337
8351
|
const dayCells = useMemo12(() => getDays(innerDate), [innerDate]);
|
|
8338
8352
|
const onDateClickHandler = (date) => {
|
|
@@ -8352,13 +8366,13 @@ var Calendar = ({
|
|
|
8352
8366
|
setDateToFocus(date);
|
|
8353
8367
|
setIsFocusable(true);
|
|
8354
8368
|
};
|
|
8355
|
-
|
|
8369
|
+
useEffect10(() => {
|
|
8356
8370
|
if (isFocusable) {
|
|
8357
8371
|
document.getElementById(`${id}_day_${dateToFocus.get("date")}_month${dateToFocus.get("month")}`)?.focus();
|
|
8358
8372
|
setIsFocusable(false);
|
|
8359
8373
|
}
|
|
8360
8374
|
}, [dateToFocus, isFocusable]);
|
|
8361
|
-
|
|
8375
|
+
useEffect10(() => {
|
|
8362
8376
|
if (dateToFocus.get("month") !== innerDate.get("month") || dateToFocus.get("year") !== innerDate.get("year")) {
|
|
8363
8377
|
setDateToFocus(getDateToFocus(selectedDate, innerDate, today2));
|
|
8364
8378
|
}
|
|
@@ -8523,7 +8537,7 @@ var Calendar_default = memo5(Calendar);
|
|
|
8523
8537
|
|
|
8524
8538
|
// src/date-input/YearPicker.tsx
|
|
8525
8539
|
import dayjs from "dayjs";
|
|
8526
|
-
import { useEffect as
|
|
8540
|
+
import { useEffect as useEffect11, useId as useId11, useState as useState21, memo as memo6 } from "react";
|
|
8527
8541
|
import styled40 from "styled-components";
|
|
8528
8542
|
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
8529
8543
|
var getYearsArray = () => {
|
|
@@ -8535,9 +8549,9 @@ var getYearsArray = () => {
|
|
|
8535
8549
|
};
|
|
8536
8550
|
var yearList = getYearsArray();
|
|
8537
8551
|
var YearPicker = ({ onYearSelect, selectedDate, today: today2 }) => {
|
|
8538
|
-
const id =
|
|
8539
|
-
const [yearToFocus, setYearToFocus] =
|
|
8540
|
-
|
|
8552
|
+
const id = useId11();
|
|
8553
|
+
const [yearToFocus, setYearToFocus] = useState21(selectedDate ? selectedDate.get("year") : dayjs().get("year"));
|
|
8554
|
+
useEffect11(() => {
|
|
8541
8555
|
const yearToFocusEl = document.getElementById(`${id}_year_${yearToFocus}`);
|
|
8542
8556
|
yearToFocusEl?.scrollIntoView?.({ block: "nearest", inline: "start" });
|
|
8543
8557
|
yearToFocusEl?.focus();
|
|
@@ -8630,8 +8644,8 @@ var YearPicker_default = memo6(YearPicker);
|
|
|
8630
8644
|
import { jsx as jsx48, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
8631
8645
|
var today = dayjs2();
|
|
8632
8646
|
var DatePicker = ({ date, onDateSelect, id }) => {
|
|
8633
|
-
const [innerDate, setInnerDate] =
|
|
8634
|
-
const [content, setContent] =
|
|
8647
|
+
const [innerDate, setInnerDate] = useState22(date?.isValid() ? date : dayjs2());
|
|
8648
|
+
const [content, setContent] = useState22("calendar");
|
|
8635
8649
|
const selectedDate = date?.isValid() ? date : dayjs2(null);
|
|
8636
8650
|
const translatedLabels = useContext27(HalstackLanguageContext);
|
|
8637
8651
|
const handleDateSelect = (chosenDate) => {
|
|
@@ -8766,10 +8780,10 @@ import * as Popover3 from "@radix-ui/react-popover";
|
|
|
8766
8780
|
import {
|
|
8767
8781
|
forwardRef as forwardRef6,
|
|
8768
8782
|
useContext as useContext29,
|
|
8769
|
-
useEffect as
|
|
8770
|
-
useId as
|
|
8783
|
+
useEffect as useEffect13,
|
|
8784
|
+
useId as useId12,
|
|
8771
8785
|
useRef as useRef11,
|
|
8772
|
-
useState as
|
|
8786
|
+
useState as useState23
|
|
8773
8787
|
} from "react";
|
|
8774
8788
|
import styled44, { ThemeProvider as ThemeProvider19 } from "styled-components";
|
|
8775
8789
|
|
|
@@ -8778,7 +8792,7 @@ import { createContext as createContext7 } from "react";
|
|
|
8778
8792
|
var NumberInputContext_default = createContext7(null);
|
|
8779
8793
|
|
|
8780
8794
|
// src/text-input/Suggestions.tsx
|
|
8781
|
-
import { memo as memo9, useContext as useContext28, useEffect as
|
|
8795
|
+
import { memo as memo9, useContext as useContext28, useEffect as useEffect12, useRef as useRef10 } from "react";
|
|
8782
8796
|
import styled43 from "styled-components";
|
|
8783
8797
|
|
|
8784
8798
|
// src/text-input/Suggestion.tsx
|
|
@@ -8939,7 +8953,7 @@ var Suggestions = ({
|
|
|
8939
8953
|
}) => {
|
|
8940
8954
|
const translatedLabels = useContext28(HalstackLanguageContext);
|
|
8941
8955
|
const listboxRef = useRef10(null);
|
|
8942
|
-
|
|
8956
|
+
useEffect12(() => {
|
|
8943
8957
|
const visualFocusedOptionEl = listboxRef?.current?.querySelectorAll("[role='option']")[visualFocusIndex];
|
|
8944
8958
|
visualFocusedOptionEl?.scrollIntoView?.({
|
|
8945
8959
|
block: "nearest",
|
|
@@ -9138,7 +9152,7 @@ var DxcTextInput = forwardRef6(
|
|
|
9138
9152
|
tabIndex = 0,
|
|
9139
9153
|
ariaLabel = "Text input"
|
|
9140
9154
|
}, ref) => {
|
|
9141
|
-
const inputId = `input-${
|
|
9155
|
+
const inputId = `input-${useId12()}`;
|
|
9142
9156
|
const autosuggestId = `suggestions-${inputId}`;
|
|
9143
9157
|
const errorId = `error-${inputId}`;
|
|
9144
9158
|
const colorsTheme = useContext29(HalstackContext);
|
|
@@ -9147,12 +9161,12 @@ var DxcTextInput = forwardRef6(
|
|
|
9147
9161
|
const inputRef = useRef11(null);
|
|
9148
9162
|
const inputContainerRef = useRef11(null);
|
|
9149
9163
|
const actionRef = useRef11(null);
|
|
9150
|
-
const [innerValue, setInnerValue] =
|
|
9151
|
-
const [isOpen, changeIsOpen] =
|
|
9152
|
-
const [isSearching, changeIsSearching] =
|
|
9153
|
-
const [isAutosuggestError, changeIsAutosuggestError] =
|
|
9154
|
-
const [filteredSuggestions, changeFilteredSuggestions] =
|
|
9155
|
-
const [visualFocusIndex, changeVisualFocusIndex] =
|
|
9164
|
+
const [innerValue, setInnerValue] = useState23(defaultValue);
|
|
9165
|
+
const [isOpen, changeIsOpen] = useState23(false);
|
|
9166
|
+
const [isSearching, changeIsSearching] = useState23(false);
|
|
9167
|
+
const [isAutosuggestError, changeIsAutosuggestError] = useState23(false);
|
|
9168
|
+
const [filteredSuggestions, changeFilteredSuggestions] = useState23([]);
|
|
9169
|
+
const [visualFocusIndex, changeVisualFocusIndex] = useState23(-1);
|
|
9156
9170
|
const width = useWidth_default(inputContainerRef.current);
|
|
9157
9171
|
const getNumberErrorMessage = (checkedValue) => numberInputContext?.minNumber != null && checkedValue < numberInputContext?.minNumber ? translatedLabels.numberInput.valueGreaterThanOrEqualToErrorMessage?.(numberInputContext.minNumber) : numberInputContext?.maxNumber != null && checkedValue > numberInputContext?.maxNumber ? translatedLabels.numberInput.valueLessThanOrEqualToErrorMessage?.(numberInputContext.maxNumber) : void 0;
|
|
9158
9172
|
const openSuggestions = () => {
|
|
@@ -9362,7 +9376,7 @@ var DxcTextInput = forwardRef6(
|
|
|
9362
9376
|
inputRef.current?.setAttribute("type", type);
|
|
9363
9377
|
}
|
|
9364
9378
|
};
|
|
9365
|
-
|
|
9379
|
+
useEffect13(() => {
|
|
9366
9380
|
if (typeof suggestions === "function") {
|
|
9367
9381
|
changeIsSearching(true);
|
|
9368
9382
|
changeIsAutosuggestError(false);
|
|
@@ -9398,163 +9412,166 @@ var DxcTextInput = forwardRef6(
|
|
|
9398
9412
|
}
|
|
9399
9413
|
return void 0;
|
|
9400
9414
|
}, [value, innerValue, suggestions, numberInputContext]);
|
|
9401
|
-
return /* @__PURE__ */
|
|
9402
|
-
|
|
9403
|
-
label,
|
|
9404
|
-
|
|
9405
|
-
|
|
9406
|
-
|
|
9407
|
-
|
|
9408
|
-
|
|
9409
|
-
|
|
9410
|
-
|
|
9411
|
-
|
|
9412
|
-
|
|
9413
|
-
/* @__PURE__ */
|
|
9414
|
-
|
|
9415
|
-
|
|
9416
|
-
|
|
9417
|
-
|
|
9418
|
-
|
|
9419
|
-
|
|
9420
|
-
|
|
9421
|
-
|
|
9422
|
-
|
|
9423
|
-
|
|
9424
|
-
|
|
9425
|
-
Popover3.
|
|
9426
|
-
|
|
9427
|
-
|
|
9428
|
-
|
|
9429
|
-
|
|
9430
|
-
event
|
|
9431
|
-
|
|
9432
|
-
|
|
9433
|
-
event
|
|
9434
|
-
|
|
9435
|
-
|
|
9436
|
-
|
|
9437
|
-
|
|
9438
|
-
id: autosuggestId,
|
|
9439
|
-
value: value ?? innerValue,
|
|
9440
|
-
suggestions: filteredSuggestions,
|
|
9441
|
-
visualFocusIndex,
|
|
9442
|
-
highlightedSuggestions: typeof suggestions !== "function",
|
|
9443
|
-
searchHasErrors: isAutosuggestError,
|
|
9444
|
-
isSearching,
|
|
9445
|
-
suggestionOnClick: (suggestion) => {
|
|
9446
|
-
changeValue(suggestion);
|
|
9447
|
-
closeSuggestions();
|
|
9448
|
-
},
|
|
9449
|
-
styles: { width }
|
|
9450
|
-
}
|
|
9451
|
-
)
|
|
9452
|
-
}
|
|
9453
|
-
) })
|
|
9454
|
-
] }),
|
|
9455
|
-
children: /* @__PURE__ */ jsxs36(
|
|
9456
|
-
InputContainer,
|
|
9457
|
-
{
|
|
9458
|
-
error: !!error,
|
|
9459
|
-
disabled,
|
|
9460
|
-
readOnly,
|
|
9461
|
-
onClick: handleInputContainerOnClick,
|
|
9462
|
-
onMouseDown: handleInputContainerOnMouseDown,
|
|
9463
|
-
ref: inputContainerRef,
|
|
9464
|
-
children: [
|
|
9465
|
-
prefix && /* @__PURE__ */ jsx51(Prefix, { disabled, children: prefix }),
|
|
9466
|
-
/* @__PURE__ */ jsxs36(Flex_default, { gap: "0.25rem", alignItems: "center", grow: 1, children: [
|
|
9467
|
-
/* @__PURE__ */ jsx51(
|
|
9468
|
-
Input,
|
|
9415
|
+
return /* @__PURE__ */ jsxs36(ThemeProvider19, { theme: colorsTheme.textInput, children: [
|
|
9416
|
+
/* @__PURE__ */ jsxs36(TextInputContainer, { margin, size, ref, children: [
|
|
9417
|
+
label && /* @__PURE__ */ jsxs36(Label4, { htmlFor: inputId, disabled, hasHelperText: !!helperText, children: [
|
|
9418
|
+
label,
|
|
9419
|
+
" ",
|
|
9420
|
+
optional && /* @__PURE__ */ jsx51(OptionalLabel2, { children: translatedLabels.formFields.optionalLabel })
|
|
9421
|
+
] }),
|
|
9422
|
+
helperText && /* @__PURE__ */ jsx51(HelperText2, { disabled, children: helperText }),
|
|
9423
|
+
/* @__PURE__ */ jsx51(
|
|
9424
|
+
AutosuggestWrapper,
|
|
9425
|
+
{
|
|
9426
|
+
condition: hasSuggestions(suggestions),
|
|
9427
|
+
wrapper: (children) => /* @__PURE__ */ jsxs36(Popover3.Root, { open: isOpen && (filteredSuggestions.length > 0 || isSearching || isAutosuggestError), children: [
|
|
9428
|
+
/* @__PURE__ */ jsx51(
|
|
9429
|
+
Popover3.Trigger,
|
|
9430
|
+
{
|
|
9431
|
+
asChild: true,
|
|
9432
|
+
type: void 0,
|
|
9433
|
+
"aria-controls": void 0,
|
|
9434
|
+
"aria-haspopup": void 0,
|
|
9435
|
+
"aria-expanded": void 0,
|
|
9436
|
+
children
|
|
9437
|
+
}
|
|
9438
|
+
),
|
|
9439
|
+
/* @__PURE__ */ jsx51(Popover3.Portal, { container: document.getElementById(`${inputId}-portal`), children: /* @__PURE__ */ jsx51(
|
|
9440
|
+
Popover3.Content,
|
|
9441
|
+
{
|
|
9442
|
+
sideOffset: 5,
|
|
9443
|
+
style: { zIndex: "320" },
|
|
9444
|
+
onOpenAutoFocus: (event) => {
|
|
9445
|
+
event.preventDefault();
|
|
9446
|
+
},
|
|
9447
|
+
onCloseAutoFocus: (event) => {
|
|
9448
|
+
event.preventDefault();
|
|
9449
|
+
},
|
|
9450
|
+
children: /* @__PURE__ */ jsx51(
|
|
9451
|
+
Suggestions_default,
|
|
9469
9452
|
{
|
|
9470
|
-
|
|
9471
|
-
id: inputId,
|
|
9472
|
-
name,
|
|
9453
|
+
id: autosuggestId,
|
|
9473
9454
|
value: value ?? innerValue,
|
|
9474
|
-
|
|
9475
|
-
|
|
9476
|
-
|
|
9477
|
-
|
|
9478
|
-
|
|
9479
|
-
|
|
9480
|
-
|
|
9455
|
+
suggestions: filteredSuggestions,
|
|
9456
|
+
visualFocusIndex,
|
|
9457
|
+
highlightedSuggestions: typeof suggestions !== "function",
|
|
9458
|
+
searchHasErrors: isAutosuggestError,
|
|
9459
|
+
isSearching,
|
|
9460
|
+
suggestionOnClick: (suggestion) => {
|
|
9461
|
+
changeValue(suggestion);
|
|
9462
|
+
closeSuggestions();
|
|
9481
9463
|
},
|
|
9482
|
-
|
|
9483
|
-
disabled,
|
|
9484
|
-
readOnly,
|
|
9485
|
-
ref: inputRef,
|
|
9486
|
-
pattern,
|
|
9487
|
-
minLength,
|
|
9488
|
-
maxLength,
|
|
9489
|
-
autoComplete: autocomplete === "off" ? "nope" : autocomplete,
|
|
9490
|
-
tabIndex,
|
|
9491
|
-
type: "text",
|
|
9492
|
-
role: hasSuggestions(suggestions) ? "combobox" : void 0,
|
|
9493
|
-
"aria-autocomplete": hasSuggestions(suggestions) ? "list" : void 0,
|
|
9494
|
-
"aria-controls": hasSuggestions(suggestions) ? autosuggestId : void 0,
|
|
9495
|
-
"aria-expanded": hasSuggestions(suggestions) ? isOpen : void 0,
|
|
9496
|
-
"aria-haspopup": hasSuggestions(suggestions) ? "listbox" : void 0,
|
|
9497
|
-
"aria-activedescendant": hasSuggestions(suggestions) && isOpen && visualFocusIndex !== -1 ? `suggestion-${visualFocusIndex}` : void 0,
|
|
9498
|
-
"aria-invalid": !!error,
|
|
9499
|
-
"aria-errormessage": error ? errorId : void 0,
|
|
9500
|
-
"aria-required": !disabled && !optional,
|
|
9501
|
-
"aria-label": label ? void 0 : ariaLabel
|
|
9502
|
-
}
|
|
9503
|
-
),
|
|
9504
|
-
!disabled && error && /* @__PURE__ */ jsx51(ErrorIcon2, { "aria-hidden": "true", children: /* @__PURE__ */ jsx51(Icon_default, { icon: "filled_error" }) }),
|
|
9505
|
-
!disabled && !readOnly && clearable && (value ?? innerValue).length > 0 && /* @__PURE__ */ jsx51(
|
|
9506
|
-
ActionIcon_default,
|
|
9507
|
-
{
|
|
9508
|
-
onClick: handleClearActionOnClick,
|
|
9509
|
-
icon: "close",
|
|
9510
|
-
tabIndex,
|
|
9511
|
-
title: translatedLabels.textInput.clearFieldActionTitle
|
|
9464
|
+
styles: { width }
|
|
9512
9465
|
}
|
|
9513
|
-
)
|
|
9514
|
-
|
|
9466
|
+
)
|
|
9467
|
+
}
|
|
9468
|
+
) })
|
|
9469
|
+
] }),
|
|
9470
|
+
children: /* @__PURE__ */ jsxs36(
|
|
9471
|
+
InputContainer,
|
|
9472
|
+
{
|
|
9473
|
+
error: !!error,
|
|
9474
|
+
disabled,
|
|
9475
|
+
readOnly,
|
|
9476
|
+
onClick: handleInputContainerOnClick,
|
|
9477
|
+
onMouseDown: handleInputContainerOnMouseDown,
|
|
9478
|
+
ref: inputContainerRef,
|
|
9479
|
+
children: [
|
|
9480
|
+
prefix && /* @__PURE__ */ jsx51(Prefix, { disabled, children: prefix }),
|
|
9481
|
+
/* @__PURE__ */ jsxs36(Flex_default, { gap: "0.25rem", alignItems: "center", grow: 1, children: [
|
|
9515
9482
|
/* @__PURE__ */ jsx51(
|
|
9483
|
+
Input,
|
|
9484
|
+
{
|
|
9485
|
+
alignment,
|
|
9486
|
+
id: inputId,
|
|
9487
|
+
name,
|
|
9488
|
+
value: value ?? innerValue,
|
|
9489
|
+
placeholder,
|
|
9490
|
+
onBlur: handleInputOnBlur,
|
|
9491
|
+
onChange: handleInputOnChange,
|
|
9492
|
+
onFocus: !readOnly ? openSuggestions : void 0,
|
|
9493
|
+
onKeyDown: !readOnly ? handleInputOnKeyDown : void 0,
|
|
9494
|
+
onMouseDown: (event) => {
|
|
9495
|
+
event.stopPropagation();
|
|
9496
|
+
},
|
|
9497
|
+
onWheel: numberInputContext?.typeNumber === "number" ? handleNumberInputWheel : void 0,
|
|
9498
|
+
disabled,
|
|
9499
|
+
readOnly,
|
|
9500
|
+
ref: inputRef,
|
|
9501
|
+
pattern,
|
|
9502
|
+
minLength,
|
|
9503
|
+
maxLength,
|
|
9504
|
+
autoComplete: autocomplete === "off" ? "nope" : autocomplete,
|
|
9505
|
+
tabIndex,
|
|
9506
|
+
type: "text",
|
|
9507
|
+
role: hasSuggestions(suggestions) ? "combobox" : void 0,
|
|
9508
|
+
"aria-autocomplete": hasSuggestions(suggestions) ? "list" : void 0,
|
|
9509
|
+
"aria-controls": hasSuggestions(suggestions) ? autosuggestId : void 0,
|
|
9510
|
+
"aria-expanded": hasSuggestions(suggestions) ? isOpen : void 0,
|
|
9511
|
+
"aria-haspopup": hasSuggestions(suggestions) ? "listbox" : void 0,
|
|
9512
|
+
"aria-activedescendant": hasSuggestions(suggestions) && isOpen && visualFocusIndex !== -1 ? `suggestion-${visualFocusIndex}` : void 0,
|
|
9513
|
+
"aria-invalid": !!error,
|
|
9514
|
+
"aria-errormessage": error ? errorId : void 0,
|
|
9515
|
+
"aria-required": !disabled && !optional,
|
|
9516
|
+
"aria-label": label ? void 0 : ariaLabel
|
|
9517
|
+
}
|
|
9518
|
+
),
|
|
9519
|
+
!disabled && error && /* @__PURE__ */ jsx51(ErrorIcon2, { "aria-hidden": "true", children: /* @__PURE__ */ jsx51(Icon_default, { icon: "filled_error" }) }),
|
|
9520
|
+
!disabled && !readOnly && clearable && (value ?? innerValue).length > 0 && /* @__PURE__ */ jsx51(
|
|
9516
9521
|
ActionIcon_default,
|
|
9517
9522
|
{
|
|
9518
|
-
onClick:
|
|
9519
|
-
icon: "
|
|
9523
|
+
onClick: handleClearActionOnClick,
|
|
9524
|
+
icon: "close",
|
|
9520
9525
|
tabIndex,
|
|
9521
|
-
|
|
9522
|
-
title: translatedLabels.numberInput.decrementValueTitle,
|
|
9523
|
-
disabled
|
|
9526
|
+
title: !disabled ? translatedLabels.textInput.clearFieldActionTitle : void 0
|
|
9524
9527
|
}
|
|
9525
9528
|
),
|
|
9526
|
-
/* @__PURE__ */
|
|
9529
|
+
numberInputContext?.typeNumber === "number" && numberInputContext?.showControls && /* @__PURE__ */ jsxs36(Fragment12, { children: [
|
|
9530
|
+
/* @__PURE__ */ jsx51(
|
|
9531
|
+
ActionIcon_default,
|
|
9532
|
+
{
|
|
9533
|
+
onClick: !readOnly ? handleDecrementActionOnClick : void 0,
|
|
9534
|
+
icon: "remove",
|
|
9535
|
+
tabIndex,
|
|
9536
|
+
ref: actionRef,
|
|
9537
|
+
title: !disabled ? translatedLabels.numberInput.decrementValueTitle : void 0,
|
|
9538
|
+
disabled
|
|
9539
|
+
}
|
|
9540
|
+
),
|
|
9541
|
+
/* @__PURE__ */ jsx51(
|
|
9542
|
+
ActionIcon_default,
|
|
9543
|
+
{
|
|
9544
|
+
onClick: !readOnly ? handleIncrementActionOnClick : void 0,
|
|
9545
|
+
icon: "add",
|
|
9546
|
+
tabIndex,
|
|
9547
|
+
ref: actionRef,
|
|
9548
|
+
title: !disabled ? translatedLabels.numberInput.incrementValueTitle : void 0,
|
|
9549
|
+
disabled
|
|
9550
|
+
}
|
|
9551
|
+
)
|
|
9552
|
+
] }),
|
|
9553
|
+
action && /* @__PURE__ */ jsx51(
|
|
9527
9554
|
ActionIcon_default,
|
|
9528
9555
|
{
|
|
9529
|
-
onClick: !readOnly ?
|
|
9530
|
-
icon:
|
|
9556
|
+
onClick: !readOnly ? action.onClick : void 0,
|
|
9557
|
+
icon: action.icon,
|
|
9531
9558
|
tabIndex,
|
|
9532
9559
|
ref: actionRef,
|
|
9533
|
-
title:
|
|
9560
|
+
title: !disabled ? action.title ?? void 0 : void 0,
|
|
9534
9561
|
disabled
|
|
9535
9562
|
}
|
|
9536
9563
|
)
|
|
9537
9564
|
] }),
|
|
9538
|
-
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
|
|
9545
|
-
|
|
9546
|
-
|
|
9547
|
-
|
|
9548
|
-
)
|
|
9549
|
-
] }),
|
|
9550
|
-
suffix && /* @__PURE__ */ jsx51(Suffix, { disabled, children: suffix })
|
|
9551
|
-
]
|
|
9552
|
-
}
|
|
9553
|
-
)
|
|
9554
|
-
}
|
|
9555
|
-
),
|
|
9556
|
-
!disabled && typeof error === "string" && /* @__PURE__ */ jsx51(ErrorMessageContainer, { id: errorId, role: "alert", "aria-live": error ? "assertive" : "off", children: error })
|
|
9557
|
-
] }) });
|
|
9565
|
+
suffix && /* @__PURE__ */ jsx51(Suffix, { disabled, children: suffix })
|
|
9566
|
+
]
|
|
9567
|
+
}
|
|
9568
|
+
)
|
|
9569
|
+
}
|
|
9570
|
+
),
|
|
9571
|
+
!disabled && typeof error === "string" && /* @__PURE__ */ jsx51(ErrorMessageContainer, { id: errorId, role: "alert", "aria-live": error ? "assertive" : "off", children: error })
|
|
9572
|
+
] }),
|
|
9573
|
+
/* @__PURE__ */ jsx51("div", { id: `${inputId}-portal`, style: { position: "absolute" } })
|
|
9574
|
+
] });
|
|
9558
9575
|
}
|
|
9559
9576
|
);
|
|
9560
9577
|
var TextInput_default = DxcTextInput;
|
|
@@ -9604,14 +9621,14 @@ var DxcDateInput = forwardRef7(
|
|
|
9604
9621
|
tabIndex,
|
|
9605
9622
|
ariaLabel = "Date input"
|
|
9606
9623
|
}, ref) => {
|
|
9607
|
-
const [innerValue, setInnerValue] =
|
|
9608
|
-
const [isOpen, setIsOpen] =
|
|
9609
|
-
const calendarId = `date-picker-${
|
|
9610
|
-
const [dayjsDate, setDayjsDate] =
|
|
9611
|
-
const [lastValidYear, setLastValidYear] =
|
|
9624
|
+
const [innerValue, setInnerValue] = useState24(defaultValue);
|
|
9625
|
+
const [isOpen, setIsOpen] = useState24(false);
|
|
9626
|
+
const calendarId = `date-picker-${useId13()}`;
|
|
9627
|
+
const [dayjsDate, setDayjsDate] = useState24(getValueForPicker(value ?? defaultValue ?? "", format));
|
|
9628
|
+
const [lastValidYear, setLastValidYear] = useState24(
|
|
9612
9629
|
innerValue || value ? !format.toUpperCase().includes("YYYY") && +getValueForPicker(value ?? innerValue, format).format("YY") < 68 ? 2e3 : 1900 : null
|
|
9613
9630
|
);
|
|
9614
|
-
const [sideOffset, setSideOffset] =
|
|
9631
|
+
const [sideOffset, setSideOffset] = useState24(SIDEOFFSET);
|
|
9615
9632
|
const colorsTheme = useContext30(HalstackContext);
|
|
9616
9633
|
const translatedLabels = useContext30(HalstackLanguageContext);
|
|
9617
9634
|
const dateRef = useRef12(null);
|
|
@@ -9708,18 +9725,18 @@ var DxcDateInput = forwardRef7(
|
|
|
9708
9725
|
closeCalendar();
|
|
9709
9726
|
}
|
|
9710
9727
|
};
|
|
9711
|
-
|
|
9728
|
+
useEffect14(() => {
|
|
9712
9729
|
window.addEventListener("scroll", adjustSideOffset);
|
|
9713
9730
|
return () => {
|
|
9714
9731
|
window.removeEventListener("scroll", adjustSideOffset);
|
|
9715
9732
|
};
|
|
9716
9733
|
}, [adjustSideOffset]);
|
|
9717
|
-
|
|
9734
|
+
useEffect14(() => {
|
|
9718
9735
|
if (value || value === "") {
|
|
9719
9736
|
setDayjsDate(getDate(value, format, lastValidYear, setLastValidYear));
|
|
9720
9737
|
}
|
|
9721
9738
|
}, [value, format, lastValidYear]);
|
|
9722
|
-
|
|
9739
|
+
useEffect14(() => {
|
|
9723
9740
|
if (!disabled) {
|
|
9724
9741
|
const actionButtonElement = dateRef.current?.querySelector("[aria-label='Select date']");
|
|
9725
9742
|
actionButtonElement?.setAttribute("aria-haspopup", "true");
|
|
@@ -9731,62 +9748,65 @@ var DxcDateInput = forwardRef7(
|
|
|
9731
9748
|
}
|
|
9732
9749
|
}
|
|
9733
9750
|
}, [isOpen, disabled, calendarId]);
|
|
9734
|
-
return /* @__PURE__ */
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
htmlFor: dateRef.current?.getElementsByTagName("input")[0]?.id,
|
|
9739
|
-
disabled,
|
|
9740
|
-
hasHelperText: !!helperText,
|
|
9741
|
-
children: [
|
|
9742
|
-
label,
|
|
9743
|
-
" ",
|
|
9744
|
-
optional && /* @__PURE__ */ jsx52(OptionalLabel3, { children: translatedLabels.formFields.optionalLabel })
|
|
9745
|
-
]
|
|
9746
|
-
}
|
|
9747
|
-
),
|
|
9748
|
-
helperText && /* @__PURE__ */ jsx52(HelperText3, { disabled, children: helperText }),
|
|
9749
|
-
/* @__PURE__ */ jsxs37(Popover4.Root, { open: isOpen, children: [
|
|
9750
|
-
/* @__PURE__ */ jsx52(Popover4.Trigger, { asChild: true, "aria-controls": void 0, children: /* @__PURE__ */ jsx52(
|
|
9751
|
-
TextInput_default,
|
|
9751
|
+
return /* @__PURE__ */ jsxs37(ThemeProvider20, { theme: colorsTheme, children: [
|
|
9752
|
+
/* @__PURE__ */ jsxs37(DateInputContainer, { margin, size, ref, children: [
|
|
9753
|
+
label && /* @__PURE__ */ jsxs37(
|
|
9754
|
+
Label5,
|
|
9752
9755
|
{
|
|
9753
|
-
|
|
9754
|
-
defaultValue,
|
|
9755
|
-
value: value ?? innerValue,
|
|
9756
|
-
placeholder: placeholder ? format.toUpperCase() : void 0,
|
|
9757
|
-
action: {
|
|
9758
|
-
onClick: openCalendar,
|
|
9759
|
-
icon: "filled_calendar_today",
|
|
9760
|
-
title: "Select date"
|
|
9761
|
-
},
|
|
9762
|
-
clearable,
|
|
9756
|
+
htmlFor: dateRef.current?.getElementsByTagName("input")[0]?.id,
|
|
9763
9757
|
disabled,
|
|
9764
|
-
|
|
9765
|
-
|
|
9766
|
-
|
|
9767
|
-
|
|
9768
|
-
|
|
9769
|
-
|
|
9770
|
-
size,
|
|
9771
|
-
tabIndex,
|
|
9772
|
-
ref: dateRef,
|
|
9773
|
-
ariaLabel
|
|
9774
|
-
}
|
|
9775
|
-
) }),
|
|
9776
|
-
/* @__PURE__ */ jsx52(Popover4.Portal, { children: /* @__PURE__ */ jsx52(
|
|
9777
|
-
StyledPopoverContent,
|
|
9778
|
-
{
|
|
9779
|
-
sideOffset,
|
|
9780
|
-
align: "end",
|
|
9781
|
-
"aria-modal": true,
|
|
9782
|
-
onBlur: handleDatePickerOnBlur,
|
|
9783
|
-
onKeyDown: handleDatePickerEscKeydown,
|
|
9784
|
-
ref: popoverContentRef,
|
|
9785
|
-
children: /* @__PURE__ */ jsx52(DatePicker_default, { id: calendarId, onDateSelect: handleCalendarOnClick, date: dayjsDate })
|
|
9758
|
+
hasHelperText: !!helperText,
|
|
9759
|
+
children: [
|
|
9760
|
+
label,
|
|
9761
|
+
" ",
|
|
9762
|
+
optional && /* @__PURE__ */ jsx52(OptionalLabel3, { children: translatedLabels.formFields.optionalLabel })
|
|
9763
|
+
]
|
|
9786
9764
|
}
|
|
9787
|
-
)
|
|
9788
|
-
|
|
9789
|
-
|
|
9765
|
+
),
|
|
9766
|
+
helperText && /* @__PURE__ */ jsx52(HelperText3, { disabled, children: helperText }),
|
|
9767
|
+
/* @__PURE__ */ jsxs37(Popover4.Root, { open: isOpen, children: [
|
|
9768
|
+
/* @__PURE__ */ jsx52(Popover4.Trigger, { asChild: true, "aria-controls": void 0, children: /* @__PURE__ */ jsx52(
|
|
9769
|
+
TextInput_default,
|
|
9770
|
+
{
|
|
9771
|
+
name,
|
|
9772
|
+
defaultValue,
|
|
9773
|
+
value: value ?? innerValue,
|
|
9774
|
+
placeholder: placeholder ? format.toUpperCase() : void 0,
|
|
9775
|
+
action: {
|
|
9776
|
+
onClick: openCalendar,
|
|
9777
|
+
icon: "filled_calendar_today",
|
|
9778
|
+
title: "Select date"
|
|
9779
|
+
},
|
|
9780
|
+
clearable,
|
|
9781
|
+
disabled,
|
|
9782
|
+
readOnly,
|
|
9783
|
+
optional,
|
|
9784
|
+
onChange: handleOnChange,
|
|
9785
|
+
onBlur: handleOnBlur,
|
|
9786
|
+
error,
|
|
9787
|
+
autocomplete,
|
|
9788
|
+
size,
|
|
9789
|
+
tabIndex,
|
|
9790
|
+
ref: dateRef,
|
|
9791
|
+
ariaLabel
|
|
9792
|
+
}
|
|
9793
|
+
) }),
|
|
9794
|
+
/* @__PURE__ */ jsx52(Popover4.Portal, { container: document.getElementById(`${calendarId}-portal`), children: /* @__PURE__ */ jsx52(
|
|
9795
|
+
StyledPopoverContent,
|
|
9796
|
+
{
|
|
9797
|
+
sideOffset,
|
|
9798
|
+
align: "end",
|
|
9799
|
+
"aria-modal": true,
|
|
9800
|
+
onBlur: handleDatePickerOnBlur,
|
|
9801
|
+
onKeyDown: handleDatePickerEscKeydown,
|
|
9802
|
+
ref: popoverContentRef,
|
|
9803
|
+
children: /* @__PURE__ */ jsx52(DatePicker_default, { id: calendarId, onDateSelect: handleCalendarOnClick, date: dayjsDate })
|
|
9804
|
+
}
|
|
9805
|
+
) })
|
|
9806
|
+
] })
|
|
9807
|
+
] }),
|
|
9808
|
+
/* @__PURE__ */ jsx52("div", { id: `${calendarId}-portal`, style: { position: "absolute" } })
|
|
9809
|
+
] });
|
|
9790
9810
|
}
|
|
9791
9811
|
);
|
|
9792
9812
|
var sizes5 = {
|
|
@@ -9829,7 +9849,7 @@ var HelperText3 = styled45.span`
|
|
|
9829
9849
|
margin-bottom: 0.25rem;
|
|
9830
9850
|
`;
|
|
9831
9851
|
var StyledPopoverContent = styled45(Popover4.Content)`
|
|
9832
|
-
z-index:
|
|
9852
|
+
z-index: 310;
|
|
9833
9853
|
&:focus-visible {
|
|
9834
9854
|
outline: none;
|
|
9835
9855
|
}
|
|
@@ -9837,7 +9857,7 @@ var StyledPopoverContent = styled45(Popover4.Content)`
|
|
|
9837
9857
|
var DateInput_default = DxcDateInput;
|
|
9838
9858
|
|
|
9839
9859
|
// src/dialog/Dialog.tsx
|
|
9840
|
-
import { useContext as useContext31, useEffect as
|
|
9860
|
+
import { useContext as useContext31, useEffect as useEffect15, useId as useId14, useState as useState25 } from "react";
|
|
9841
9861
|
import { createPortal as createPortal2 } from "react-dom";
|
|
9842
9862
|
import styled46, { createGlobalStyle as createGlobalStyle2, ThemeProvider as ThemeProvider21 } from "styled-components";
|
|
9843
9863
|
import { Fragment as Fragment13, jsx as jsx53, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
@@ -9853,7 +9873,7 @@ var DialogContainer = styled46.div`
|
|
|
9853
9873
|
align-items: center;
|
|
9854
9874
|
justify-content: center;
|
|
9855
9875
|
height: 100%;
|
|
9856
|
-
z-index:
|
|
9876
|
+
z-index: 300;
|
|
9857
9877
|
`;
|
|
9858
9878
|
var Overlay3 = styled46.div`
|
|
9859
9879
|
position: fixed;
|
|
@@ -9890,9 +9910,14 @@ var DxcDialog = ({
|
|
|
9890
9910
|
tabIndex = 0,
|
|
9891
9911
|
disableFocusLock = false
|
|
9892
9912
|
}) => {
|
|
9913
|
+
const id = useId14();
|
|
9893
9914
|
const colorsTheme = useContext31(HalstackContext);
|
|
9894
9915
|
const translatedLabels = useContext31(HalstackLanguageContext);
|
|
9895
|
-
|
|
9916
|
+
const [portalContainer, setPortalContainer] = useState25(null);
|
|
9917
|
+
useEffect15(() => {
|
|
9918
|
+
setPortalContainer(document.getElementById(`dialog-${id}-portal`));
|
|
9919
|
+
}, []);
|
|
9920
|
+
useEffect15(() => {
|
|
9896
9921
|
const handleKeyDown = (event) => {
|
|
9897
9922
|
if (event.key === "Escape") {
|
|
9898
9923
|
event.preventDefault();
|
|
@@ -9906,7 +9931,8 @@ var DxcDialog = ({
|
|
|
9906
9931
|
}, [onCloseClick]);
|
|
9907
9932
|
return /* @__PURE__ */ jsxs38(ThemeProvider21, { theme: colorsTheme.dialog, children: [
|
|
9908
9933
|
/* @__PURE__ */ jsx53(BodyStyle2, {}),
|
|
9909
|
-
|
|
9934
|
+
/* @__PURE__ */ jsx53("div", { id: `dialog-${id}-portal`, style: { position: "absolute" } }),
|
|
9935
|
+
portalContainer && createPortal2(
|
|
9910
9936
|
/* @__PURE__ */ jsxs38(DialogContainer, { children: [
|
|
9911
9937
|
overlay && /* @__PURE__ */ jsx53(Overlay3, { onClick: onBackgroundClick }),
|
|
9912
9938
|
/* @__PURE__ */ jsx53(Dialog, { "aria-label": "Dialog", "aria-modal": overlay, closable, role: "dialog", children: !disableFocusLock ? /* @__PURE__ */ jsxs38(FocusLock_default, { children: [
|
|
@@ -9933,18 +9959,18 @@ var DxcDialog = ({
|
|
|
9933
9959
|
) })
|
|
9934
9960
|
] }) })
|
|
9935
9961
|
] }),
|
|
9936
|
-
|
|
9962
|
+
portalContainer
|
|
9937
9963
|
)
|
|
9938
9964
|
] });
|
|
9939
9965
|
};
|
|
9940
9966
|
var Dialog_default = DxcDialog;
|
|
9941
9967
|
|
|
9942
9968
|
// src/file-input/FileInput.tsx
|
|
9943
|
-
import { useCallback as useCallback8, useContext as useContext33, useEffect as
|
|
9969
|
+
import { useCallback as useCallback8, useContext as useContext33, useEffect as useEffect16, useId as useId16, useState as useState26, forwardRef as forwardRef8 } from "react";
|
|
9944
9970
|
import styled48, { ThemeProvider as ThemeProvider22 } from "styled-components";
|
|
9945
9971
|
|
|
9946
9972
|
// src/file-input/FileItem.tsx
|
|
9947
|
-
import { memo as memo10, useContext as useContext32, useId as
|
|
9973
|
+
import { memo as memo10, useContext as useContext32, useId as useId15 } from "react";
|
|
9948
9974
|
import styled47 from "styled-components";
|
|
9949
9975
|
import { jsx as jsx54, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
9950
9976
|
var MainContainer3 = styled47.div`
|
|
@@ -10029,7 +10055,7 @@ var FileItem = ({
|
|
|
10029
10055
|
tabIndex
|
|
10030
10056
|
}) => {
|
|
10031
10057
|
const translatedLabels = useContext32(HalstackLanguageContext);
|
|
10032
|
-
const fileNameId =
|
|
10058
|
+
const fileNameId = useId15();
|
|
10033
10059
|
return /* @__PURE__ */ jsxs39(MainContainer3, { error, role: "listitem", singleFileMode, showPreview, children: [
|
|
10034
10060
|
showPreview && (type.includes("image") ? /* @__PURE__ */ jsx54(ImagePreview, { src: preview, alt: fileName }) : /* @__PURE__ */ jsx54(IconPreview, { "aria-labelledby": fileNameId, error, role: "img", children: /* @__PURE__ */ jsx54(Icon_default, { icon: preview }) })),
|
|
10035
10061
|
/* @__PURE__ */ jsxs39(FileItemContent, { children: [
|
|
@@ -10179,9 +10205,9 @@ var DxcFileInput = forwardRef8(
|
|
|
10179
10205
|
margin,
|
|
10180
10206
|
tabIndex = 0
|
|
10181
10207
|
}, ref) => {
|
|
10182
|
-
const [isDragging, setIsDragging] =
|
|
10183
|
-
const [files, setFiles] =
|
|
10184
|
-
const fileInputId = `file-input-${
|
|
10208
|
+
const [isDragging, setIsDragging] = useState26(false);
|
|
10209
|
+
const [files, setFiles] = useState26([]);
|
|
10210
|
+
const fileInputId = `file-input-${useId16()}`;
|
|
10185
10211
|
const colorsTheme = useContext33(HalstackContext);
|
|
10186
10212
|
const translatedLabels = useContext33(HalstackLanguageContext);
|
|
10187
10213
|
const checkFileSize = (file) => {
|
|
@@ -10255,7 +10281,7 @@ var DxcFileInput = forwardRef8(
|
|
|
10255
10281
|
addFile(filesArray);
|
|
10256
10282
|
}
|
|
10257
10283
|
};
|
|
10258
|
-
|
|
10284
|
+
useEffect16(() => {
|
|
10259
10285
|
const getFiles = async () => {
|
|
10260
10286
|
if (value) {
|
|
10261
10287
|
const valueFiles = await Promise.all(
|
|
@@ -10664,11 +10690,11 @@ var DxcLink = forwardRef9(
|
|
|
10664
10690
|
var Link_default = DxcLink;
|
|
10665
10691
|
|
|
10666
10692
|
// src/nav-tabs/NavTabs.tsx
|
|
10667
|
-
import { Children as Children4, useContext as useContext38, useEffect as
|
|
10693
|
+
import { Children as Children4, useContext as useContext38, useEffect as useEffect18, useMemo as useMemo14, useRef as useRef14, useState as useState27 } from "react";
|
|
10668
10694
|
import styled55, { ThemeProvider as ThemeProvider26 } from "styled-components";
|
|
10669
10695
|
|
|
10670
10696
|
// src/nav-tabs/Tab.tsx
|
|
10671
|
-
import { useEffect as
|
|
10697
|
+
import { useEffect as useEffect17, forwardRef as forwardRef10, useContext as useContext37, useRef as useRef13, useImperativeHandle } from "react";
|
|
10672
10698
|
import styled54 from "styled-components";
|
|
10673
10699
|
|
|
10674
10700
|
// src/nav-tabs/NavTabsContext.tsx
|
|
@@ -10692,7 +10718,7 @@ var DxcTab = forwardRef10(
|
|
|
10692
10718
|
const { iconPosition, tabIndex, focusedLabel } = useContext37(NavTabsContext_default) ?? {};
|
|
10693
10719
|
const innerRef = useRef13(null);
|
|
10694
10720
|
useImperativeHandle(ref, () => innerRef.current, []);
|
|
10695
|
-
|
|
10721
|
+
useEffect17(() => {
|
|
10696
10722
|
if (focusedLabel === children.toString()) {
|
|
10697
10723
|
tabRef?.current?.focus();
|
|
10698
10724
|
}
|
|
@@ -10716,8 +10742,9 @@ var DxcTab = forwardRef10(
|
|
|
10716
10742
|
disabled,
|
|
10717
10743
|
active,
|
|
10718
10744
|
href: !disabled ? href : void 0,
|
|
10745
|
+
as: href ? "a" : onClick ? "button" : "div",
|
|
10719
10746
|
iconPosition,
|
|
10720
|
-
onClick,
|
|
10747
|
+
onClick: !disabled ? onClick : void 0,
|
|
10721
10748
|
onKeyDown: handleOnKeyDown,
|
|
10722
10749
|
hasIcon: icon != null,
|
|
10723
10750
|
ref: (anchorRef) => {
|
|
@@ -10851,14 +10878,14 @@ var getNextTabIndex = (array, initialIndex) => {
|
|
|
10851
10878
|
return index;
|
|
10852
10879
|
};
|
|
10853
10880
|
var DxcNavTabs = ({ iconPosition = "top", tabIndex = 0, children }) => {
|
|
10854
|
-
const [innerFocusIndex, setInnerFocusIndex] =
|
|
10855
|
-
const [underlineWidth, setUnderlineWidth] =
|
|
10881
|
+
const [innerFocusIndex, setInnerFocusIndex] = useState27(null);
|
|
10882
|
+
const [underlineWidth, setUnderlineWidth] = useState27(null);
|
|
10856
10883
|
const refNavTabList = useRef14(null);
|
|
10857
10884
|
const colorsTheme = useContext38(HalstackContext);
|
|
10858
10885
|
const childArray = Children4.toArray(children).filter(
|
|
10859
10886
|
(child) => typeof child === "object" && "props" in child
|
|
10860
10887
|
);
|
|
10861
|
-
|
|
10888
|
+
useEffect18(() => {
|
|
10862
10889
|
setUnderlineWidth(refNavTabList?.current?.scrollWidth ?? null);
|
|
10863
10890
|
}, [children]);
|
|
10864
10891
|
const contextValue = useMemo14(
|
|
@@ -10910,7 +10937,7 @@ var NavTabsContainer = styled55.div`
|
|
|
10910
10937
|
var NavTabs_default = DxcNavTabs;
|
|
10911
10938
|
|
|
10912
10939
|
// src/number-input/NumberInput.tsx
|
|
10913
|
-
import { forwardRef as forwardRef11, useEffect as
|
|
10940
|
+
import { forwardRef as forwardRef11, useEffect as useEffect19, useMemo as useMemo15, useRef as useRef15 } from "react";
|
|
10914
10941
|
import styled56 from "styled-components";
|
|
10915
10942
|
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
10916
10943
|
var DxcNumberInput = forwardRef11(
|
|
@@ -10950,7 +10977,7 @@ var DxcNumberInput = forwardRef11(
|
|
|
10950
10977
|
}),
|
|
10951
10978
|
[max, min, showControls, step]
|
|
10952
10979
|
);
|
|
10953
|
-
|
|
10980
|
+
useEffect19(() => {
|
|
10954
10981
|
const input = numberInputRef.current?.getElementsByTagName("input")[0];
|
|
10955
10982
|
const preventDefault = (event) => {
|
|
10956
10983
|
event.preventDefault();
|
|
@@ -11028,7 +11055,7 @@ function DxcParagraph({ children }) {
|
|
|
11028
11055
|
}
|
|
11029
11056
|
|
|
11030
11057
|
// src/password-input/PasswordInput.tsx
|
|
11031
|
-
import { forwardRef as forwardRef12, useContext as useContext40, useEffect as
|
|
11058
|
+
import { forwardRef as forwardRef12, useContext as useContext40, useEffect as useEffect20, useRef as useRef16, useState as useState28 } from "react";
|
|
11032
11059
|
import styled58 from "styled-components";
|
|
11033
11060
|
import { jsx as jsx65 } from "react/jsx-runtime";
|
|
11034
11061
|
var setInputType = (type, element) => {
|
|
@@ -11057,10 +11084,10 @@ var DxcPasswordInput = forwardRef12(
|
|
|
11057
11084
|
tabIndex = 0,
|
|
11058
11085
|
ariaLabel = "Password input"
|
|
11059
11086
|
}, ref) => {
|
|
11060
|
-
const [isPasswordVisible, setIsPasswordVisible] =
|
|
11087
|
+
const [isPasswordVisible, setIsPasswordVisible] = useState28(false);
|
|
11061
11088
|
const inputRef = useRef16(null);
|
|
11062
11089
|
const { passwordInput } = useContext40(HalstackLanguageContext);
|
|
11063
|
-
|
|
11090
|
+
useEffect20(() => {
|
|
11064
11091
|
(() => {
|
|
11065
11092
|
if (isPasswordVisible) {
|
|
11066
11093
|
setInputType("text", inputRef.current);
|
|
@@ -11115,7 +11142,7 @@ var PasswordInput = styled58.div`
|
|
|
11115
11142
|
var PasswordInput_default = DxcPasswordInput;
|
|
11116
11143
|
|
|
11117
11144
|
// src/progress-bar/ProgressBar.tsx
|
|
11118
|
-
import { useContext as useContext41, useEffect as
|
|
11145
|
+
import { useContext as useContext41, useEffect as useEffect21, useId as useId17, useState as useState29 } from "react";
|
|
11119
11146
|
import styled59, { ThemeProvider as ThemeProvider28 } from "styled-components";
|
|
11120
11147
|
import { jsx as jsx66, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
11121
11148
|
var Overlay4 = styled59.div`
|
|
@@ -11236,9 +11263,9 @@ var DxcProgressBar = ({
|
|
|
11236
11263
|
ariaLabel = "Progress bar"
|
|
11237
11264
|
}) => {
|
|
11238
11265
|
const colorsTheme = useContext41(HalstackContext);
|
|
11239
|
-
const labelId = `label-${
|
|
11240
|
-
const [innerValue, setInnerValue] =
|
|
11241
|
-
|
|
11266
|
+
const labelId = `label-${useId17()}`;
|
|
11267
|
+
const [innerValue, setInnerValue] = useState29();
|
|
11268
|
+
useEffect21(() => {
|
|
11242
11269
|
if (value != null) setInnerValue(value < 0 ? 0 : value > 100 ? 100 : value);
|
|
11243
11270
|
}, [value]);
|
|
11244
11271
|
return /* @__PURE__ */ jsx66(ThemeProvider28, { theme: colorsTheme.progressBar, children: /* @__PURE__ */ jsx66(Overlay4, { overlay, children: /* @__PURE__ */ jsxs45(MainContainer4, { overlay, margin, children: [
|
|
@@ -11275,16 +11302,36 @@ import { jsx as jsx67, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
|
11275
11302
|
var DxcQuickNav = ({ title, links }) => {
|
|
11276
11303
|
const translatedLabels = useContext42(HalstackLanguageContext);
|
|
11277
11304
|
const colorsTheme = useContext42(HalstackContext);
|
|
11305
|
+
const isHashRouter = () => {
|
|
11306
|
+
if (typeof window === "undefined") return false;
|
|
11307
|
+
return window.location.href.includes("/#/");
|
|
11308
|
+
};
|
|
11278
11309
|
return /* @__PURE__ */ jsx67(ThemeProvider29, { theme: colorsTheme.quickNav, children: /* @__PURE__ */ jsx67(QuickNavContainer, { children: /* @__PURE__ */ jsxs46(Flex_default, { direction: "column", gap: "0.5rem", children: [
|
|
11279
11310
|
/* @__PURE__ */ jsx67(Heading_default, { level: 4, text: title || translatedLabels.quickNav.contentTitle }),
|
|
11280
11311
|
/* @__PURE__ */ jsx67(ListColumn, { children: links.map((link) => /* @__PURE__ */ jsx67("li", { children: /* @__PURE__ */ jsx67(Inset_default, { space: "0.25rem", children: /* @__PURE__ */ jsxs46(DxcTypography, { children: [
|
|
11281
|
-
/* @__PURE__ */ jsx67(
|
|
11312
|
+
/* @__PURE__ */ jsx67(
|
|
11313
|
+
Link3,
|
|
11314
|
+
{
|
|
11315
|
+
href: `#${slugify(link.label, { lower: true })}`,
|
|
11316
|
+
onClick: isHashRouter() ? (e) => {
|
|
11317
|
+
e.preventDefault();
|
|
11318
|
+
const id = slugify(link.label, { lower: true });
|
|
11319
|
+
document.getElementById(id)?.scrollIntoView();
|
|
11320
|
+
} : void 0,
|
|
11321
|
+
children: /* @__PURE__ */ jsx67("span", { children: link.label })
|
|
11322
|
+
}
|
|
11323
|
+
),
|
|
11282
11324
|
/* @__PURE__ */ jsx67(ListSecondColumn, { children: link.links?.map((sublink) => /* @__PURE__ */ jsx67("li", { children: /* @__PURE__ */ jsx67(Inset_default, { horizontal: "0.5rem", children: /* @__PURE__ */ jsx67(DxcTypography, { children: /* @__PURE__ */ jsx67(
|
|
11283
11325
|
Link3,
|
|
11284
11326
|
{
|
|
11285
11327
|
href: `#${slugify(link?.label, { lower: true })}-${slugify(sublink?.label, {
|
|
11286
11328
|
lower: true
|
|
11287
11329
|
})}`,
|
|
11330
|
+
onClick: isHashRouter() ? (e) => {
|
|
11331
|
+
e.preventDefault();
|
|
11332
|
+
const id = `${slugify(link.label, { lower: true })}-${slugify(sublink.label, { lower: true })}`;
|
|
11333
|
+
document.getElementById(id)?.scrollIntoView();
|
|
11334
|
+
} : void 0,
|
|
11288
11335
|
children: sublink.label
|
|
11289
11336
|
}
|
|
11290
11337
|
) }) }) }, sublink.label)) })
|
|
@@ -11340,11 +11387,11 @@ var Link3 = styled60.a`
|
|
|
11340
11387
|
var QuickNav_default = DxcQuickNav;
|
|
11341
11388
|
|
|
11342
11389
|
// src/radio-group/RadioGroup.tsx
|
|
11343
|
-
import { forwardRef as forwardRef13, useCallback as useCallback10, useContext as useContext44, useId as
|
|
11390
|
+
import { forwardRef as forwardRef13, useCallback as useCallback10, useContext as useContext44, useId as useId19, useMemo as useMemo16, useState as useState31 } from "react";
|
|
11344
11391
|
import styled62, { ThemeProvider as ThemeProvider31 } from "styled-components";
|
|
11345
11392
|
|
|
11346
11393
|
// src/radio-group/Radio.tsx
|
|
11347
|
-
import { memo as memo11, useContext as useContext43, useEffect as
|
|
11394
|
+
import { memo as memo11, useContext as useContext43, useEffect as useEffect22, useId as useId18, useRef as useRef17, useState as useState30 } from "react";
|
|
11348
11395
|
import styled61, { ThemeProvider as ThemeProvider30 } from "styled-components";
|
|
11349
11396
|
import { jsx as jsx68, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
11350
11397
|
var DxcRadio = ({
|
|
@@ -11357,15 +11404,15 @@ var DxcRadio = ({
|
|
|
11357
11404
|
readOnly,
|
|
11358
11405
|
tabIndex
|
|
11359
11406
|
}) => {
|
|
11360
|
-
const radioLabelId = `radio-${
|
|
11407
|
+
const radioLabelId = `radio-${useId18()}`;
|
|
11361
11408
|
const ref = useRef17(null);
|
|
11362
11409
|
const colorsTheme = useContext43(HalstackContext);
|
|
11363
11410
|
const handleOnClick = () => {
|
|
11364
11411
|
onClick();
|
|
11365
11412
|
document.activeElement !== ref.current && ref.current?.focus();
|
|
11366
11413
|
};
|
|
11367
|
-
const [firstUpdate, setFirstUpdate] =
|
|
11368
|
-
|
|
11414
|
+
const [firstUpdate, setFirstUpdate] = useState30(true);
|
|
11415
|
+
useEffect22(() => {
|
|
11369
11416
|
if (firstUpdate) {
|
|
11370
11417
|
setFirstUpdate(false);
|
|
11371
11418
|
return;
|
|
@@ -11497,11 +11544,11 @@ var DxcRadioGroup = forwardRef13(
|
|
|
11497
11544
|
tabIndex = 0,
|
|
11498
11545
|
ariaLabel = "Radio group"
|
|
11499
11546
|
}, ref) => {
|
|
11500
|
-
const radioGroupId = `radio-group-${
|
|
11547
|
+
const radioGroupId = `radio-group-${useId19()}`;
|
|
11501
11548
|
const radioGroupLabelId = `label-${radioGroupId}`;
|
|
11502
11549
|
const errorId = `error-${radioGroupId}`;
|
|
11503
|
-
const [innerValue, setInnerValue] =
|
|
11504
|
-
const [firstTimeFocus, setFirstTimeFocus] =
|
|
11550
|
+
const [innerValue, setInnerValue] = useState31(defaultValue);
|
|
11551
|
+
const [firstTimeFocus, setFirstTimeFocus] = useState31(true);
|
|
11505
11552
|
const colorsTheme = useContext44(HalstackContext);
|
|
11506
11553
|
const translatedLabels = useContext44(HalstackLanguageContext);
|
|
11507
11554
|
const innerOptions = useMemo16(
|
|
@@ -11515,7 +11562,7 @@ var DxcRadioGroup = forwardRef13(
|
|
|
11515
11562
|
] : options,
|
|
11516
11563
|
[optional, options, optionalItemLabel, translatedLabels]
|
|
11517
11564
|
);
|
|
11518
|
-
const [currentFocusIndex, setCurrentFocusIndex] =
|
|
11565
|
+
const [currentFocusIndex, setCurrentFocusIndex] = useState31(getInitialFocusIndex(innerOptions, value ?? innerValue));
|
|
11519
11566
|
const handleOnChange = useCallback10(
|
|
11520
11567
|
(newValue) => {
|
|
11521
11568
|
const currentValue = value ?? innerValue;
|
|
@@ -11695,7 +11742,7 @@ var ErrorMessageContainer2 = styled62.span`
|
|
|
11695
11742
|
var RadioGroup_default = DxcRadioGroup;
|
|
11696
11743
|
|
|
11697
11744
|
// src/resultset-table/ResultsetTable.tsx
|
|
11698
|
-
import { useContext as useContext45, useEffect as
|
|
11745
|
+
import { useContext as useContext45, useEffect as useEffect23, useMemo as useMemo17, useRef as useRef18, useState as useState32 } from "react";
|
|
11699
11746
|
import styled63, { ThemeProvider as ThemeProvider32 } from "styled-components";
|
|
11700
11747
|
|
|
11701
11748
|
// src/resultset-table/Icons.tsx
|
|
@@ -11752,9 +11799,9 @@ var DxcResultsetTable = ({
|
|
|
11752
11799
|
mode = "default"
|
|
11753
11800
|
}) => {
|
|
11754
11801
|
const colorsTheme = useContext45(HalstackContext);
|
|
11755
|
-
const [page, changePage] =
|
|
11756
|
-
const [sortColumnIndex, changeSortColumnIndex] =
|
|
11757
|
-
const [sortOrder, changeSortOrder] =
|
|
11802
|
+
const [page, changePage] = useState32(1);
|
|
11803
|
+
const [sortColumnIndex, changeSortColumnIndex] = useState32(-1);
|
|
11804
|
+
const [sortOrder, changeSortOrder] = useState32("ascending");
|
|
11758
11805
|
const prevRowCountRef = useRef18(rows.length);
|
|
11759
11806
|
const rowsWithIds = useMemo17(() => assignIdsToRows(rows), [rows]);
|
|
11760
11807
|
const minItemsPerPageIndex = useMemo17(() => getMinItemsPerPageIndex2(page, itemsPerPage, page), [itemsPerPage, page]);
|
|
@@ -11780,7 +11827,7 @@ var DxcResultsetTable = ({
|
|
|
11780
11827
|
sortColumnIndex === -1 || sortColumnIndex !== columnIndex ? "ascending" : sortOrder === "ascending" ? "descending" : "ascending"
|
|
11781
11828
|
);
|
|
11782
11829
|
};
|
|
11783
|
-
|
|
11830
|
+
useEffect23(() => {
|
|
11784
11831
|
if (!hidePaginator) {
|
|
11785
11832
|
if (rows.length === 0) {
|
|
11786
11833
|
changePage(0);
|
|
@@ -11879,7 +11926,7 @@ DxcResultsetTable.ActionsCell = DxcActionsCell;
|
|
|
11879
11926
|
var ResultsetTable_default = DxcResultsetTable;
|
|
11880
11927
|
|
|
11881
11928
|
// src/slider/Slider.tsx
|
|
11882
|
-
import { forwardRef as forwardRef14, useContext as useContext46, useId as
|
|
11929
|
+
import { forwardRef as forwardRef14, useContext as useContext46, useId as useId20, useMemo as useMemo18, useState as useState33 } from "react";
|
|
11883
11930
|
import styled64, { ThemeProvider as ThemeProvider33 } from "styled-components";
|
|
11884
11931
|
import { jsx as jsx72, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
11885
11932
|
var sizes6 = {
|
|
@@ -12071,9 +12118,9 @@ var DxcSlider = forwardRef14(
|
|
|
12071
12118
|
size = "fillParent",
|
|
12072
12119
|
ariaLabel = "Slider"
|
|
12073
12120
|
}, ref) => {
|
|
12074
|
-
const labelId = `label-${
|
|
12075
|
-
const [innerValue, setInnerValue] =
|
|
12076
|
-
const [dragging, setDragging] =
|
|
12121
|
+
const labelId = `label-${useId20()}`;
|
|
12122
|
+
const [innerValue, setInnerValue] = useState33(defaultValue ?? 0);
|
|
12123
|
+
const [dragging, setDragging] = useState33(false);
|
|
12077
12124
|
const colorsTheme = useContext46(HalstackContext);
|
|
12078
12125
|
const isFirefox = navigator.userAgent.indexOf("Firefox") !== -1;
|
|
12079
12126
|
const minLabel = useMemo18(
|
|
@@ -12210,7 +12257,7 @@ var StatusLabel = styled65.span`
|
|
|
12210
12257
|
var StatusLight_default = DxcStatusLight;
|
|
12211
12258
|
|
|
12212
12259
|
// src/switch/Switch.tsx
|
|
12213
|
-
import { forwardRef as forwardRef15, useContext as useContext47, useId as
|
|
12260
|
+
import { forwardRef as forwardRef15, useContext as useContext47, useId as useId21, useRef as useRef19, useState as useState34 } from "react";
|
|
12214
12261
|
import styled66, { ThemeProvider as ThemeProvider34 } from "styled-components";
|
|
12215
12262
|
import { Fragment as Fragment14, jsx as jsx74, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
12216
12263
|
var DxcSwitch = forwardRef15(
|
|
@@ -12229,9 +12276,9 @@ var DxcSwitch = forwardRef15(
|
|
|
12229
12276
|
tabIndex = 0,
|
|
12230
12277
|
ariaLabel = "Switch"
|
|
12231
12278
|
}, ref) => {
|
|
12232
|
-
const switchId = `switch-${
|
|
12279
|
+
const switchId = `switch-${useId21()}`;
|
|
12233
12280
|
const labelId = `label-${switchId}`;
|
|
12234
|
-
const [innerChecked, setInnerChecked] =
|
|
12281
|
+
const [innerChecked, setInnerChecked] = useState34(defaultChecked);
|
|
12235
12282
|
const colorsTheme = useContext47(HalstackContext);
|
|
12236
12283
|
const translatedLabels = useContext47(HalstackLanguageContext);
|
|
12237
12284
|
const refTrack = useRef19(null);
|
|
@@ -12457,10 +12504,10 @@ import {
|
|
|
12457
12504
|
isValidElement as isValidElement2,
|
|
12458
12505
|
useCallback as useCallback12,
|
|
12459
12506
|
useContext as useContext50,
|
|
12460
|
-
useEffect as
|
|
12507
|
+
useEffect as useEffect26,
|
|
12461
12508
|
useMemo as useMemo20,
|
|
12462
12509
|
useRef as useRef22,
|
|
12463
|
-
useState as
|
|
12510
|
+
useState as useState36
|
|
12464
12511
|
} from "react";
|
|
12465
12512
|
import styled70, { ThemeProvider as ThemeProvider36 } from "styled-components";
|
|
12466
12513
|
|
|
@@ -12469,7 +12516,7 @@ import { createContext as createContext9 } from "react";
|
|
|
12469
12516
|
var TabsContext_default = createContext9(null);
|
|
12470
12517
|
|
|
12471
12518
|
// src/tabs/Tab.tsx
|
|
12472
|
-
import { forwardRef as forwardRef16, useContext as useContext48, useEffect as
|
|
12519
|
+
import { forwardRef as forwardRef16, useContext as useContext48, useEffect as useEffect24, useRef as useRef20 } from "react";
|
|
12473
12520
|
import styled67 from "styled-components";
|
|
12474
12521
|
import { jsx as jsx75, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
12475
12522
|
var DxcTab2 = forwardRef16(
|
|
@@ -12498,18 +12545,18 @@ var DxcTab2 = forwardRef16(
|
|
|
12498
12545
|
setActiveIndicatorWidth,
|
|
12499
12546
|
setActiveIndicatorLeft
|
|
12500
12547
|
} = useContext48(TabsContext_default) ?? {};
|
|
12501
|
-
|
|
12548
|
+
useEffect24(() => {
|
|
12502
12549
|
if (focusedTab === tabId) {
|
|
12503
12550
|
tabRef?.current?.focus();
|
|
12504
12551
|
}
|
|
12505
12552
|
}, [focusedTab, tabId]);
|
|
12506
|
-
|
|
12553
|
+
useEffect24(() => {
|
|
12507
12554
|
if (activeTab === tabId) {
|
|
12508
12555
|
setActiveIndicatorWidth?.(tabRef.current?.offsetWidth ?? 0);
|
|
12509
12556
|
setActiveIndicatorLeft?.(tabRef.current?.offsetLeft ?? 0);
|
|
12510
12557
|
}
|
|
12511
12558
|
}, [activeTab, tabId, setActiveIndicatorWidth, setActiveIndicatorLeft]);
|
|
12512
|
-
|
|
12559
|
+
useEffect24(() => {
|
|
12513
12560
|
if (active) {
|
|
12514
12561
|
setActiveTab?.(tabId ?? label ?? "");
|
|
12515
12562
|
}
|
|
@@ -12685,7 +12732,7 @@ var TabIconContainer2 = styled67.div`
|
|
|
12685
12732
|
var Tab_default2 = DxcTab2;
|
|
12686
12733
|
|
|
12687
12734
|
// src/tabs/TabsLegacy.tsx
|
|
12688
|
-
import { useCallback as useCallback11, useContext as useContext49, useEffect as
|
|
12735
|
+
import { useCallback as useCallback11, useContext as useContext49, useEffect as useEffect25, useMemo as useMemo19, useRef as useRef21, useState as useState35 } from "react";
|
|
12689
12736
|
import styled69, { ThemeProvider as ThemeProvider35 } from "styled-components";
|
|
12690
12737
|
|
|
12691
12738
|
// src/tabs/TabLegacy.tsx
|
|
@@ -12841,11 +12888,11 @@ var TabLegacy_default = memo12(Tab2);
|
|
|
12841
12888
|
// src/tabs/TabsLegacy.tsx
|
|
12842
12889
|
import { jsx as jsx77, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
12843
12890
|
var useResize = (refTabList) => {
|
|
12844
|
-
const [viewWidth, setViewWidth] =
|
|
12891
|
+
const [viewWidth, setViewWidth] = useState35(0);
|
|
12845
12892
|
const handleWindowSizeChange = useCallback11(() => {
|
|
12846
12893
|
setViewWidth(refTabList.current?.offsetWidth ?? 0);
|
|
12847
12894
|
}, [refTabList]);
|
|
12848
|
-
|
|
12895
|
+
useEffect25(() => {
|
|
12849
12896
|
handleWindowSizeChange();
|
|
12850
12897
|
window.addEventListener("resize", handleWindowSizeChange);
|
|
12851
12898
|
return () => {
|
|
@@ -12867,25 +12914,25 @@ var DxcTabs = ({
|
|
|
12867
12914
|
const colorsTheme = useContext49(HalstackContext);
|
|
12868
12915
|
const hasLabelAndIcon = tabs != null && tabs.filter((tab) => tab.label && tab.icon).length > 0;
|
|
12869
12916
|
const firstFocus = tabs != null ? tabs.findIndex((tab) => !tab.isDisabled) : null;
|
|
12870
|
-
const [innerActiveTabIndex, setInnerActiveTabIndex] =
|
|
12917
|
+
const [innerActiveTabIndex, setInnerActiveTabIndex] = useState35(
|
|
12871
12918
|
tabs != null && defaultActiveTabIndex && !tabs[defaultActiveTabIndex]?.isDisabled ? defaultActiveTabIndex : firstFocus
|
|
12872
12919
|
);
|
|
12873
|
-
const [activeIndicatorWidth, setActiveIndicatorWidth] =
|
|
12874
|
-
const [activeIndicatorLeft, setActiveIndicatorLeft] =
|
|
12875
|
-
const [translateScroll, setTranslateScroll] =
|
|
12876
|
-
const [scrollRightEnabled, setScrollRightEnabled] =
|
|
12877
|
-
const [scrollLeftEnabled, setScrollLeftEnabled] =
|
|
12878
|
-
const [countClick, setCountClick] =
|
|
12879
|
-
const [totalTabsWidth, setTotalTabsWidth] =
|
|
12880
|
-
const [currentFocusIndex, setCurrentFocusIndex] =
|
|
12881
|
-
const [temporalFocusIndex, setTemporalFocusIndex] =
|
|
12882
|
-
const [minHeightTabs, setMinHeightTabs] =
|
|
12920
|
+
const [activeIndicatorWidth, setActiveIndicatorWidth] = useState35(0);
|
|
12921
|
+
const [activeIndicatorLeft, setActiveIndicatorLeft] = useState35(0);
|
|
12922
|
+
const [translateScroll, setTranslateScroll] = useState35(0);
|
|
12923
|
+
const [scrollRightEnabled, setScrollRightEnabled] = useState35(true);
|
|
12924
|
+
const [scrollLeftEnabled, setScrollLeftEnabled] = useState35(false);
|
|
12925
|
+
const [countClick, setCountClick] = useState35(0);
|
|
12926
|
+
const [totalTabsWidth, setTotalTabsWidth] = useState35(0);
|
|
12927
|
+
const [currentFocusIndex, setCurrentFocusIndex] = useState35(activeTabIndex ?? innerActiveTabIndex);
|
|
12928
|
+
const [temporalFocusIndex, setTemporalFocusIndex] = useState35(activeTabIndex ?? innerActiveTabIndex);
|
|
12929
|
+
const [minHeightTabs, setMinHeightTabs] = useState35(0);
|
|
12883
12930
|
const refTabs = useRef21([]);
|
|
12884
12931
|
const refTabList = useRef21(null);
|
|
12885
12932
|
const viewWidth = useResize(refTabList);
|
|
12886
12933
|
const translatedLabels = useContext49(HalstackLanguageContext);
|
|
12887
12934
|
const enabledIndicator = useMemo19(() => viewWidth < totalTabsWidth, [viewWidth]);
|
|
12888
|
-
|
|
12935
|
+
useEffect25(() => {
|
|
12889
12936
|
if (activeTabIndex != null || innerActiveTabIndex != null) {
|
|
12890
12937
|
const sumWidth = refTabs.current?.reduce((count, obj) => count + obj.offsetWidth, 0);
|
|
12891
12938
|
setTotalTabsWidth(sumWidth);
|
|
@@ -12893,10 +12940,10 @@ var DxcTabs = ({
|
|
|
12893
12940
|
setActiveIndicatorLeft(refTabs.current[activeTabIndex ?? innerActiveTabIndex]?.offsetLeft ?? 0);
|
|
12894
12941
|
}
|
|
12895
12942
|
}, [activeTabIndex, innerActiveTabIndex]);
|
|
12896
|
-
|
|
12943
|
+
useEffect25(() => {
|
|
12897
12944
|
setMinHeightTabs((refTabList.current?.offsetHeight ?? 0) + 1);
|
|
12898
12945
|
}, []);
|
|
12899
|
-
|
|
12946
|
+
useEffect25(() => {
|
|
12900
12947
|
if (activeTabIndex && activeTabIndex >= 0) {
|
|
12901
12948
|
setActiveIndicatorWidth(refTabs.current[activeTabIndex]?.offsetWidth ?? 0);
|
|
12902
12949
|
setActiveIndicatorLeft(refTabs.current[activeTabIndex]?.offsetLeft ?? 0);
|
|
@@ -13207,11 +13254,11 @@ var TabsLegacy_default = DxcTabs;
|
|
|
13207
13254
|
// src/tabs/Tabs.tsx
|
|
13208
13255
|
import { Fragment as Fragment15, jsx as jsx78, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
13209
13256
|
var useResize2 = (refTabList) => {
|
|
13210
|
-
const [viewWidth, setViewWidth] =
|
|
13257
|
+
const [viewWidth, setViewWidth] = useState36(0);
|
|
13211
13258
|
const handleWindowSizeChange = useCallback12(() => {
|
|
13212
13259
|
setViewWidth(refTabList?.current?.offsetWidth ?? 0);
|
|
13213
13260
|
}, [refTabList]);
|
|
13214
|
-
|
|
13261
|
+
useEffect26(() => {
|
|
13215
13262
|
handleWindowSizeChange();
|
|
13216
13263
|
window.addEventListener("resize", handleWindowSizeChange);
|
|
13217
13264
|
return () => {
|
|
@@ -13253,7 +13300,7 @@ var DxcTabs2 = ({
|
|
|
13253
13300
|
() => childrenArray.some((child) => isValidElement2(child) && child.props.icon && child.props.label),
|
|
13254
13301
|
[childrenArray]
|
|
13255
13302
|
);
|
|
13256
|
-
const [activeTab, setActiveTab] =
|
|
13303
|
+
const [activeTab, setActiveTab] = useState36(() => {
|
|
13257
13304
|
const hasActiveChild = childrenArray.some(
|
|
13258
13305
|
(child) => isValidElement2(child) && (child.props.active || child.props.defaultActive) && !child.props.disabled
|
|
13259
13306
|
);
|
|
@@ -13262,22 +13309,22 @@ var DxcTabs2 = ({
|
|
|
13262
13309
|
) : childrenArray.find((child) => isValidElement2(child) && !child.props.disabled);
|
|
13263
13310
|
return isValidElement2(initialActiveTab) ? initialActiveTab.props.label ?? initialActiveTab.props.tabId : "";
|
|
13264
13311
|
});
|
|
13265
|
-
const [innerFocusIndex, setInnerFocusIndex] =
|
|
13266
|
-
const [activeIndicatorWidth, setActiveIndicatorWidth] =
|
|
13267
|
-
const [activeIndicatorLeft, setActiveIndicatorLeft] =
|
|
13268
|
-
const [countClick, setCountClick] =
|
|
13269
|
-
const [totalTabsWidth, setTotalTabsWidth] =
|
|
13270
|
-
const [translateScroll, setTranslateScroll] =
|
|
13271
|
-
const [scrollRightEnabled, setScrollRightEnabled] =
|
|
13272
|
-
const [scrollLeftEnabled, setScrollLeftEnabled] =
|
|
13273
|
-
const [minHeightTabs, setMinHeightTabs] =
|
|
13312
|
+
const [innerFocusIndex, setInnerFocusIndex] = useState36(null);
|
|
13313
|
+
const [activeIndicatorWidth, setActiveIndicatorWidth] = useState36(0);
|
|
13314
|
+
const [activeIndicatorLeft, setActiveIndicatorLeft] = useState36(0);
|
|
13315
|
+
const [countClick, setCountClick] = useState36(0);
|
|
13316
|
+
const [totalTabsWidth, setTotalTabsWidth] = useState36(0);
|
|
13317
|
+
const [translateScroll, setTranslateScroll] = useState36(0);
|
|
13318
|
+
const [scrollRightEnabled, setScrollRightEnabled] = useState36(true);
|
|
13319
|
+
const [scrollLeftEnabled, setScrollLeftEnabled] = useState36(false);
|
|
13320
|
+
const [minHeightTabs, setMinHeightTabs] = useState36(0);
|
|
13274
13321
|
const refTabList = useRef22(null);
|
|
13275
13322
|
const refTabListContainer = useRef22(null);
|
|
13276
13323
|
const colorsTheme = useContext50(HalstackContext);
|
|
13277
13324
|
const viewWidth = useResize2(refTabList);
|
|
13278
13325
|
const translatedLabels = useContext50(HalstackLanguageContext);
|
|
13279
13326
|
const enabledIndicator = useMemo20(() => viewWidth < totalTabsWidth, [viewWidth]);
|
|
13280
|
-
|
|
13327
|
+
useEffect26(() => {
|
|
13281
13328
|
if (refTabList.current) {
|
|
13282
13329
|
setTotalTabsWidth(refTabList.current.firstElementChild?.offsetWidth);
|
|
13283
13330
|
setMinHeightTabs(refTabList.current.offsetHeight + 1);
|
|
@@ -13350,7 +13397,7 @@ var DxcTabs2 = ({
|
|
|
13350
13397
|
scrollLimitCheck();
|
|
13351
13398
|
}, 0);
|
|
13352
13399
|
};
|
|
13353
|
-
|
|
13400
|
+
useEffect26(() => {
|
|
13354
13401
|
if (refTabList.current)
|
|
13355
13402
|
setTotalTabsWidth(() => {
|
|
13356
13403
|
let total = 0;
|
|
@@ -13532,7 +13579,7 @@ DxcTabs2.Tab = Tab_default2;
|
|
|
13532
13579
|
var Tabs_default = DxcTabs2;
|
|
13533
13580
|
|
|
13534
13581
|
// src/tag/Tag.tsx
|
|
13535
|
-
import { useContext as useContext51, useState as
|
|
13582
|
+
import { useContext as useContext51, useState as useState37 } from "react";
|
|
13536
13583
|
import styled71, { ThemeProvider as ThemeProvider37 } from "styled-components";
|
|
13537
13584
|
import { Fragment as Fragment16, jsx as jsx79, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
13538
13585
|
var TagWrapper = ({ condition, wrapper, children }) => /* @__PURE__ */ jsx79(Fragment16, { children: condition ? wrapper(children) : children });
|
|
@@ -13549,7 +13596,7 @@ var DxcTag = ({
|
|
|
13549
13596
|
tabIndex = 0
|
|
13550
13597
|
}) => {
|
|
13551
13598
|
const colorsTheme = useContext51(HalstackContext);
|
|
13552
|
-
const [isHovered, changeIsHovered] =
|
|
13599
|
+
const [isHovered, changeIsHovered] = useState37(false);
|
|
13553
13600
|
return /* @__PURE__ */ jsx79(ThemeProvider37, { theme: colorsTheme.tag, children: /* @__PURE__ */ jsx79(
|
|
13554
13601
|
StyledDxcTag,
|
|
13555
13602
|
{
|
|
@@ -13660,7 +13707,7 @@ var TagLabel = styled71.div`
|
|
|
13660
13707
|
var Tag_default = DxcTag;
|
|
13661
13708
|
|
|
13662
13709
|
// src/textarea/Textarea.tsx
|
|
13663
|
-
import { forwardRef as forwardRef18, useContext as useContext52, useEffect as
|
|
13710
|
+
import { forwardRef as forwardRef18, useContext as useContext52, useEffect as useEffect27, useId as useId22, useRef as useRef23, useState as useState38 } from "react";
|
|
13664
13711
|
import styled72, { ThemeProvider as ThemeProvider38 } from "styled-components";
|
|
13665
13712
|
import { jsx as jsx80, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
13666
13713
|
var patternMatch = (pattern, value) => new RegExp(pattern).test(value);
|
|
@@ -13689,8 +13736,8 @@ var DxcTextarea = forwardRef18(
|
|
|
13689
13736
|
tabIndex = 0,
|
|
13690
13737
|
ariaLabel = "Text area"
|
|
13691
13738
|
}, ref) => {
|
|
13692
|
-
const [innerValue, setInnerValue] =
|
|
13693
|
-
const textareaId = `textarea-${
|
|
13739
|
+
const [innerValue, setInnerValue] = useState38(defaultValue);
|
|
13740
|
+
const textareaId = `textarea-${useId22()}`;
|
|
13694
13741
|
const colorsTheme = useContext52(HalstackContext);
|
|
13695
13742
|
const translatedLabels = useContext52(HalstackLanguageContext);
|
|
13696
13743
|
const textareaRef = useRef23(null);
|
|
@@ -13744,7 +13791,7 @@ var DxcTextarea = forwardRef18(
|
|
|
13744
13791
|
const handleOnChange = (event) => {
|
|
13745
13792
|
changeValue(event.target.value);
|
|
13746
13793
|
};
|
|
13747
|
-
|
|
13794
|
+
useEffect27(() => {
|
|
13748
13795
|
if (verticalGrow === "auto" && prevValueRef.current !== (value ?? innerValue) && textareaRef.current) {
|
|
13749
13796
|
const computedStyle = window.getComputedStyle(textareaRef.current);
|
|
13750
13797
|
const textareaLineHeight = parseInt(computedStyle.lineHeight || "0", 10);
|
|
@@ -13888,24 +13935,24 @@ var ErrorMessageContainer3 = styled72.span`
|
|
|
13888
13935
|
var Textarea_default = DxcTextarea;
|
|
13889
13936
|
|
|
13890
13937
|
// src/toast/ToastsQueue.tsx
|
|
13891
|
-
import { useCallback as useCallback14, useEffect as
|
|
13938
|
+
import { useCallback as useCallback14, useEffect as useEffect29, useId as useId23, useMemo as useMemo21, useState as useState40 } from "react";
|
|
13892
13939
|
import { createPortal as createPortal3 } from "react-dom";
|
|
13893
13940
|
import styled74 from "styled-components";
|
|
13894
13941
|
|
|
13895
13942
|
// src/toast/Toast.tsx
|
|
13896
|
-
import { memo as memo13, useContext as useContext53, useState as
|
|
13943
|
+
import { memo as memo13, useContext as useContext53, useState as useState39 } from "react";
|
|
13897
13944
|
import styled73, { keyframes } from "styled-components";
|
|
13898
13945
|
|
|
13899
13946
|
// src/utils/useTimeout.tsx
|
|
13900
|
-
import { useRef as useRef24, useCallback as useCallback13, useEffect as
|
|
13947
|
+
import { useRef as useRef24, useCallback as useCallback13, useEffect as useEffect28 } from "react";
|
|
13901
13948
|
function useTimeout(callback, delay) {
|
|
13902
13949
|
const savedCallback = useRef24();
|
|
13903
13950
|
const timerRef = useRef24();
|
|
13904
13951
|
const clearTimerCallback = useCallback13(() => clearTimeout(timerRef.current), []);
|
|
13905
|
-
|
|
13952
|
+
useEffect28(() => {
|
|
13906
13953
|
savedCallback.current = callback;
|
|
13907
13954
|
}, [callback]);
|
|
13908
|
-
|
|
13955
|
+
useEffect28(() => {
|
|
13909
13956
|
function tick() {
|
|
13910
13957
|
savedCallback.current?.();
|
|
13911
13958
|
}
|
|
@@ -14032,7 +14079,7 @@ var DxcToast = ({
|
|
|
14032
14079
|
onClear,
|
|
14033
14080
|
semantic
|
|
14034
14081
|
}) => {
|
|
14035
|
-
const [isClosing, setIsClosing] =
|
|
14082
|
+
const [isClosing, setIsClosing] = useState39(false);
|
|
14036
14083
|
const translatedLabels = useContext53(HalstackLanguageContext);
|
|
14037
14084
|
const clearClosingAnimationTimer = useTimeout(
|
|
14038
14085
|
() => {
|
|
@@ -14118,24 +14165,26 @@ var generateUniqueToastId = (toasts) => {
|
|
|
14118
14165
|
return id;
|
|
14119
14166
|
};
|
|
14120
14167
|
var DxcToastsQueue = ({ children, duration = 3e3 }) => {
|
|
14121
|
-
const [toasts, setToasts] =
|
|
14122
|
-
const [isMounted, setIsMounted] =
|
|
14168
|
+
const [toasts, setToasts] = useState40([]);
|
|
14169
|
+
const [isMounted, setIsMounted] = useState40(false);
|
|
14123
14170
|
const adjustedDuration = useMemo21(() => duration > 5e3 ? 5e3 : duration < 3e3 ? 3e3 : duration, [duration]);
|
|
14124
|
-
const
|
|
14125
|
-
|
|
14171
|
+
const id = useId23();
|
|
14172
|
+
const remove = useCallback14((id2) => {
|
|
14173
|
+
setToasts((prevToasts) => prevToasts.filter((toast) => toast.id !== id2));
|
|
14126
14174
|
}, []);
|
|
14127
14175
|
const add = useCallback14(
|
|
14128
14176
|
(toast, semantic) => {
|
|
14129
|
-
const
|
|
14130
|
-
setToasts((prevToasts) => [...prevToasts, { id, semantic, ...toast }].slice(-5));
|
|
14131
|
-
return () => remove(
|
|
14177
|
+
const id2 = generateUniqueToastId(toasts);
|
|
14178
|
+
setToasts((prevToasts) => [...prevToasts, { id: id2, semantic, ...toast }].slice(-5));
|
|
14179
|
+
return () => remove(id2);
|
|
14132
14180
|
},
|
|
14133
14181
|
[duration]
|
|
14134
14182
|
);
|
|
14135
|
-
|
|
14183
|
+
useEffect29(() => {
|
|
14136
14184
|
setIsMounted(true);
|
|
14137
14185
|
}, []);
|
|
14138
14186
|
return /* @__PURE__ */ jsxs60(ToastContext_default.Provider, { value: add, children: [
|
|
14187
|
+
/* @__PURE__ */ jsx82("div", { id: `toasts-${id}-portal`, style: { position: "absolute" } }),
|
|
14139
14188
|
isMounted && createPortal3(
|
|
14140
14189
|
/* @__PURE__ */ jsx82(ToastsQueue, { children: toasts.map((t) => /* @__PURE__ */ jsx82(
|
|
14141
14190
|
Toast_default,
|
|
@@ -14148,7 +14197,7 @@ var DxcToastsQueue = ({ children, duration = 3e3 }) => {
|
|
|
14148
14197
|
},
|
|
14149
14198
|
t.id
|
|
14150
14199
|
)) }),
|
|
14151
|
-
document.body
|
|
14200
|
+
document.getElementById(`toasts-${id}-portal`) || document.body
|
|
14152
14201
|
),
|
|
14153
14202
|
children
|
|
14154
14203
|
] });
|
|
@@ -14156,7 +14205,7 @@ var DxcToastsQueue = ({ children, duration = 3e3 }) => {
|
|
|
14156
14205
|
var ToastsQueue_default = DxcToastsQueue;
|
|
14157
14206
|
|
|
14158
14207
|
// src/toggle-group/ToggleGroup.tsx
|
|
14159
|
-
import { useContext as useContext54, useId as
|
|
14208
|
+
import { useContext as useContext54, useId as useId24, useState as useState41 } from "react";
|
|
14160
14209
|
import styled75, { ThemeProvider as ThemeProvider39 } from "styled-components";
|
|
14161
14210
|
import { jsx as jsx83, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
14162
14211
|
var DxcToggleGroup = ({
|
|
@@ -14171,8 +14220,8 @@ var DxcToggleGroup = ({
|
|
|
14171
14220
|
multiple = false,
|
|
14172
14221
|
tabIndex = 0
|
|
14173
14222
|
}) => {
|
|
14174
|
-
const toggleGroupLabelId = `label-toggle-group-${
|
|
14175
|
-
const [selectedValue, setSelectedValue] =
|
|
14223
|
+
const toggleGroupLabelId = `label-toggle-group-${useId24()}`;
|
|
14224
|
+
const [selectedValue, setSelectedValue] = useState41(defaultValue ?? (multiple ? [] : -1));
|
|
14176
14225
|
const colorsTheme = useContext54(HalstackContext);
|
|
14177
14226
|
const handleToggleChange = (selectedOption) => {
|
|
14178
14227
|
let newSelectedOptions = [];
|
|
@@ -14325,7 +14374,7 @@ var IconContainer7 = styled75.div`
|
|
|
14325
14374
|
var ToggleGroup_default = DxcToggleGroup;
|
|
14326
14375
|
|
|
14327
14376
|
// src/wizard/Wizard.tsx
|
|
14328
|
-
import { useContext as useContext55, useMemo as useMemo22, useState as
|
|
14377
|
+
import { useContext as useContext55, useMemo as useMemo22, useState as useState42 } from "react";
|
|
14329
14378
|
import styled76, { ThemeProvider as ThemeProvider40 } from "styled-components";
|
|
14330
14379
|
|
|
14331
14380
|
// src/wizard/Icons.tsx
|
|
@@ -14500,7 +14549,7 @@ var DxcWizard = ({
|
|
|
14500
14549
|
tabIndex = 0
|
|
14501
14550
|
}) => {
|
|
14502
14551
|
const colorsTheme = useContext55(HalstackContext);
|
|
14503
|
-
const [innerCurrent, setInnerCurrentStep] =
|
|
14552
|
+
const [innerCurrent, setInnerCurrentStep] = useState42(defaultCurrentStep);
|
|
14504
14553
|
const renderedCurrent = useMemo22(() => currentStep ?? innerCurrent, [currentStep, innerCurrent]);
|
|
14505
14554
|
const handleStepClick = (newValue) => {
|
|
14506
14555
|
setInnerCurrentStep(newValue);
|