@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.js
CHANGED
|
@@ -2438,7 +2438,7 @@ var Accordion_default = DxcAccordion;
|
|
|
2438
2438
|
|
|
2439
2439
|
// src/alert/Alert.tsx
|
|
2440
2440
|
var import_styled_components11 = __toESM(require("styled-components"));
|
|
2441
|
-
var
|
|
2441
|
+
var import_react12 = require("react");
|
|
2442
2442
|
|
|
2443
2443
|
// src/button/Button.tsx
|
|
2444
2444
|
var import_react8 = require("react");
|
|
@@ -3179,6 +3179,7 @@ var FocusLock = ({ children }) => {
|
|
|
3179
3179
|
var FocusLock_default = FocusLock;
|
|
3180
3180
|
|
|
3181
3181
|
// src/alert/ModalAlertWrapper.tsx
|
|
3182
|
+
var import_react11 = require("react");
|
|
3182
3183
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
3183
3184
|
var BodyStyle = import_styled_components10.createGlobalStyle`
|
|
3184
3185
|
body {
|
|
@@ -3211,16 +3212,24 @@ var ModalAlertContainer = import_styled_components10.default.div`
|
|
|
3211
3212
|
min-width: 92%;
|
|
3212
3213
|
}
|
|
3213
3214
|
`;
|
|
3214
|
-
var ModalAlertWrapper = ({ condition, onClose, children }) =>
|
|
3215
|
-
|
|
3216
|
-
(0,
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3215
|
+
var ModalAlertWrapper = ({ condition, onClose, children }) => {
|
|
3216
|
+
const id = (0, import_react11.useId)();
|
|
3217
|
+
const [portalContainer, setPortalContainer] = (0, import_react11.useState)(null);
|
|
3218
|
+
(0, import_react11.useEffect)(() => {
|
|
3219
|
+
setPortalContainer(document.getElementById(`dialog-${id}-portal`));
|
|
3220
|
+
}, []);
|
|
3221
|
+
return condition ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
3222
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BodyStyle, {}),
|
|
3223
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { id: `dialog-${id}-portal`, style: { position: "absolute" } }),
|
|
3224
|
+
portalContainer && (0, import_react_dom.createPortal)(
|
|
3225
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Modal, { children: [
|
|
3226
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Overlay, { onClick: onClose }),
|
|
3227
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ModalAlertContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FocusLock_default, { children }) })
|
|
3228
|
+
] }),
|
|
3229
|
+
portalContainer
|
|
3230
|
+
)
|
|
3231
|
+
] }) : children;
|
|
3232
|
+
};
|
|
3224
3233
|
var ModalAlertWrapper_default = ModalAlertWrapper;
|
|
3225
3234
|
|
|
3226
3235
|
// src/alert/Alert.tsx
|
|
@@ -3270,7 +3279,7 @@ var NavigationText = import_styled_components11.default.span`
|
|
|
3270
3279
|
${typographyStyles}
|
|
3271
3280
|
white-space: nowrap;
|
|
3272
3281
|
`;
|
|
3273
|
-
var Actions = (0,
|
|
3282
|
+
var Actions = (0, import_react12.memo)(
|
|
3274
3283
|
({
|
|
3275
3284
|
mode,
|
|
3276
3285
|
primaryAction,
|
|
@@ -3321,15 +3330,15 @@ function DxcAlert({
|
|
|
3321
3330
|
semantic = "info",
|
|
3322
3331
|
title = ""
|
|
3323
3332
|
}) {
|
|
3324
|
-
const [messages, setMessages] = (0,
|
|
3325
|
-
const [currentIndex, setCurrentIndex] = (0,
|
|
3326
|
-
const id = (0,
|
|
3327
|
-
const colorsTheme = (0,
|
|
3328
|
-
const translatedLabels = (0,
|
|
3333
|
+
const [messages, setMessages] = (0, import_react12.useState)(Array.isArray(message) ? message : [message]);
|
|
3334
|
+
const [currentIndex, setCurrentIndex] = (0, import_react12.useState)(0);
|
|
3335
|
+
const id = (0, import_react12.useId)();
|
|
3336
|
+
const colorsTheme = (0, import_react12.useContext)(HalstackContext);
|
|
3337
|
+
const translatedLabels = (0, import_react12.useContext)(HalstackLanguageContext);
|
|
3329
3338
|
const handleNextOnClick = () => {
|
|
3330
3339
|
setCurrentIndex((prevIndex) => prevIndex < messages.length ? prevIndex + 1 : prevIndex);
|
|
3331
3340
|
};
|
|
3332
|
-
const handlePrevOnClick = (0,
|
|
3341
|
+
const handlePrevOnClick = (0, import_react12.useCallback)(() => {
|
|
3333
3342
|
setCurrentIndex((prevIndex) => prevIndex > 0 ? prevIndex - 1 : prevIndex);
|
|
3334
3343
|
}, []);
|
|
3335
3344
|
const handleOnClose = () => {
|
|
@@ -3338,7 +3347,7 @@ function DxcAlert({
|
|
|
3338
3347
|
setMessages((prevMessages) => prevMessages.filter((_, index) => index !== currentIndex));
|
|
3339
3348
|
}
|
|
3340
3349
|
};
|
|
3341
|
-
(0,
|
|
3350
|
+
(0, import_react12.useEffect)(() => {
|
|
3342
3351
|
if (currentIndex === messages.length) handlePrevOnClick();
|
|
3343
3352
|
}, [currentIndex, messages, handlePrevOnClick]);
|
|
3344
3353
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_styled_components11.ThemeProvider, { theme: colorsTheme.alert, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ModalAlertWrapper_default, { condition: mode === "modal", onClose: handleOnClose, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
@@ -3427,11 +3436,11 @@ function DxcAlert({
|
|
|
3427
3436
|
}
|
|
3428
3437
|
|
|
3429
3438
|
// src/layout/ApplicationLayout.tsx
|
|
3430
|
-
var
|
|
3439
|
+
var import_react23 = require("react");
|
|
3431
3440
|
var import_styled_components19 = __toESM(require("styled-components"));
|
|
3432
3441
|
|
|
3433
3442
|
// src/footer/Footer.tsx
|
|
3434
|
-
var
|
|
3443
|
+
var import_react13 = require("react");
|
|
3435
3444
|
var import_styled_components12 = __toESM(require("styled-components"));
|
|
3436
3445
|
|
|
3437
3446
|
// src/footer/Icons.tsx
|
|
@@ -3634,9 +3643,9 @@ var DxcFooter = ({
|
|
|
3634
3643
|
tabIndex = 0,
|
|
3635
3644
|
mode = "default"
|
|
3636
3645
|
}) => {
|
|
3637
|
-
const colorsTheme = (0,
|
|
3638
|
-
const translatedLabels = (0,
|
|
3639
|
-
const footerLogo = (0,
|
|
3646
|
+
const colorsTheme = (0, import_react13.useContext)(HalstackContext);
|
|
3647
|
+
const translatedLabels = (0, import_react13.useContext)(HalstackLanguageContext);
|
|
3648
|
+
const footerLogo = (0, import_react13.useMemo)(
|
|
3640
3649
|
() => !colorsTheme.footer.logo ? mode === "default" ? dxcLogo : dxcSmallLogo : typeof colorsTheme.footer.logo === "string" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(LogoImg, { mode, alt: translatedLabels.formFields.logoAlternativeText, src: colorsTheme.footer.logo }) : colorsTheme.footer.logo,
|
|
3641
3650
|
[colorsTheme, translatedLabels]
|
|
3642
3651
|
);
|
|
@@ -3783,19 +3792,19 @@ var BottomLink = import_styled_components12.default.a`
|
|
|
3783
3792
|
var Footer_default = DxcFooter;
|
|
3784
3793
|
|
|
3785
3794
|
// src/header/Header.tsx
|
|
3786
|
-
var
|
|
3795
|
+
var import_react18 = require("react");
|
|
3787
3796
|
var import_styled_components16 = __toESM(require("styled-components"));
|
|
3788
3797
|
|
|
3789
3798
|
// src/dropdown/Dropdown.tsx
|
|
3790
3799
|
var Popover = __toESM(require("@radix-ui/react-popover"));
|
|
3791
|
-
var
|
|
3800
|
+
var import_react17 = require("react");
|
|
3792
3801
|
var import_styled_components15 = __toESM(require("styled-components"));
|
|
3793
3802
|
|
|
3794
3803
|
// src/utils/useWidth.tsx
|
|
3795
|
-
var
|
|
3804
|
+
var import_react14 = require("react");
|
|
3796
3805
|
var useWidth = (target) => {
|
|
3797
|
-
const [width, setWidth] = (0,
|
|
3798
|
-
(0,
|
|
3806
|
+
const [width, setWidth] = (0, import_react14.useState)(0);
|
|
3807
|
+
(0, import_react14.useLayoutEffect)(() => {
|
|
3799
3808
|
if (target != null) {
|
|
3800
3809
|
setWidth(target.getBoundingClientRect().width);
|
|
3801
3810
|
const triggerObserver = new ResizeObserver((entries) => {
|
|
@@ -3815,11 +3824,11 @@ var useWidth = (target) => {
|
|
|
3815
3824
|
var useWidth_default = useWidth;
|
|
3816
3825
|
|
|
3817
3826
|
// src/dropdown/DropdownMenu.tsx
|
|
3818
|
-
var
|
|
3827
|
+
var import_react16 = require("react");
|
|
3819
3828
|
var import_styled_components14 = __toESM(require("styled-components"));
|
|
3820
3829
|
|
|
3821
3830
|
// src/dropdown/DropdownMenuItem.tsx
|
|
3822
|
-
var
|
|
3831
|
+
var import_react15 = require("react");
|
|
3823
3832
|
var import_styled_components13 = __toESM(require("styled-components"));
|
|
3824
3833
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3825
3834
|
var DropdownMenuItem = ({
|
|
@@ -3884,11 +3893,11 @@ var DropdownMenuItemIcon = import_styled_components13.default.div`
|
|
|
3884
3893
|
height: ${(props) => props.theme.optionIconSize};
|
|
3885
3894
|
}
|
|
3886
3895
|
`;
|
|
3887
|
-
var DropdownMenuItem_default = (0,
|
|
3896
|
+
var DropdownMenuItem_default = (0, import_react15.memo)(DropdownMenuItem);
|
|
3888
3897
|
|
|
3889
3898
|
// src/dropdown/DropdownMenu.tsx
|
|
3890
3899
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3891
|
-
var DropdownMenu = (0,
|
|
3900
|
+
var DropdownMenu = (0, import_react16.forwardRef)(
|
|
3892
3901
|
({ id, dropdownTriggerId, iconsPosition, visualFocusIndex, menuItemOnClick, onKeyDown, options, styles }, ref) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3893
3902
|
DropdownMenuContainer,
|
|
3894
3903
|
{
|
|
@@ -3948,7 +3957,7 @@ var DropdownMenuContainer = import_styled_components14.default.ul`
|
|
|
3948
3957
|
border-radius: 6px;
|
|
3949
3958
|
}
|
|
3950
3959
|
`;
|
|
3951
|
-
var DropdownMenu_default = (0,
|
|
3960
|
+
var DropdownMenu_default = (0, import_react16.memo)(DropdownMenu);
|
|
3952
3961
|
|
|
3953
3962
|
// src/dropdown/Dropdown.tsx
|
|
3954
3963
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
@@ -3967,14 +3976,14 @@ var DxcDropdown = ({
|
|
|
3967
3976
|
tabIndex = 0,
|
|
3968
3977
|
title
|
|
3969
3978
|
}) => {
|
|
3970
|
-
const id = (0,
|
|
3979
|
+
const id = (0, import_react17.useId)();
|
|
3971
3980
|
const triggerId = `trigger-${id}`;
|
|
3972
3981
|
const menuId = `menu-${id}`;
|
|
3973
|
-
const [isOpen, changeIsOpen] = (0,
|
|
3974
|
-
const [visualFocusIndex, setVisualFocusIndex] = (0,
|
|
3975
|
-
const colorsTheme = (0,
|
|
3976
|
-
const triggerRef = (0,
|
|
3977
|
-
const menuRef = (0,
|
|
3982
|
+
const [isOpen, changeIsOpen] = (0, import_react17.useState)(false);
|
|
3983
|
+
const [visualFocusIndex, setVisualFocusIndex] = (0, import_react17.useState)(0);
|
|
3984
|
+
const colorsTheme = (0, import_react17.useContext)(HalstackContext);
|
|
3985
|
+
const triggerRef = (0, import_react17.useRef)(null);
|
|
3986
|
+
const menuRef = (0, import_react17.useRef)(null);
|
|
3978
3987
|
const width = useWidth_default(triggerRef.current);
|
|
3979
3988
|
const handleOnOpenMenu = () => {
|
|
3980
3989
|
changeIsOpen(true);
|
|
@@ -3983,7 +3992,7 @@ var DxcDropdown = ({
|
|
|
3983
3992
|
changeIsOpen(false);
|
|
3984
3993
|
setVisualFocusIndex(0);
|
|
3985
3994
|
};
|
|
3986
|
-
const handleMenuItemOnClick = (0,
|
|
3995
|
+
const handleMenuItemOnClick = (0, import_react17.useCallback)(
|
|
3987
3996
|
(value) => {
|
|
3988
3997
|
if (value) onSelectOption(value);
|
|
3989
3998
|
handleOnCloseMenu();
|
|
@@ -4030,7 +4039,7 @@ var DxcDropdown = ({
|
|
|
4030
4039
|
return index;
|
|
4031
4040
|
});
|
|
4032
4041
|
};
|
|
4033
|
-
const handleMenuOnKeyDown = (0,
|
|
4042
|
+
const handleMenuOnKeyDown = (0, import_react17.useCallback)(
|
|
4034
4043
|
(event) => {
|
|
4035
4044
|
switch (event.key) {
|
|
4036
4045
|
case "Up":
|
|
@@ -4077,79 +4086,82 @@ var DxcDropdown = ({
|
|
|
4077
4086
|
},
|
|
4078
4087
|
[onSelectOption, visualFocusIndex, options]
|
|
4079
4088
|
);
|
|
4080
|
-
(0,
|
|
4089
|
+
(0, import_react17.useLayoutEffect)(() => {
|
|
4081
4090
|
const visualFocusedMenuItem = menuRef.current?.querySelectorAll("[role='menuitem']")[visualFocusIndex];
|
|
4082
4091
|
visualFocusedMenuItem?.scrollIntoView?.({
|
|
4083
4092
|
block: "nearest",
|
|
4084
4093
|
inline: "start"
|
|
4085
4094
|
});
|
|
4086
4095
|
}, [visualFocusIndex]);
|
|
4087
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
event
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4096
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_styled_components15.ThemeProvider, { theme: colorsTheme.dropdown, children: [
|
|
4097
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4098
|
+
DropdownContainer,
|
|
4099
|
+
{
|
|
4100
|
+
onMouseEnter: !disabled && expandOnHover ? handleOnOpenMenu : void 0,
|
|
4101
|
+
onMouseLeave: !disabled && expandOnHover ? handleOnCloseMenu : void 0,
|
|
4102
|
+
onBlur: !disabled ? handleOnBlur : void 0,
|
|
4103
|
+
margin,
|
|
4104
|
+
size,
|
|
4105
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Popover.Root, { open: isOpen, children: [
|
|
4106
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Tooltip, { label: title, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Popover.Trigger, { asChild: true, type: void 0, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
4107
|
+
DropdownTrigger,
|
|
4108
|
+
{
|
|
4109
|
+
onClick: handleTriggerOnClick,
|
|
4110
|
+
onKeyDown: handleTriggerOnKeyDown,
|
|
4111
|
+
onBlur: (event) => {
|
|
4112
|
+
event.stopPropagation();
|
|
4113
|
+
},
|
|
4114
|
+
disabled,
|
|
4115
|
+
label,
|
|
4116
|
+
margin,
|
|
4117
|
+
size,
|
|
4118
|
+
id: triggerId,
|
|
4119
|
+
"aria-haspopup": "true",
|
|
4120
|
+
"aria-controls": isOpen ? menuId : void 0,
|
|
4121
|
+
"aria-expanded": isOpen ? true : void 0,
|
|
4122
|
+
"aria-label": "Show options",
|
|
4123
|
+
tabIndex,
|
|
4124
|
+
ref: triggerRef,
|
|
4125
|
+
children: [
|
|
4126
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DropdownTriggerContent, { children: [
|
|
4127
|
+
label && iconPosition === "after" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DropdownTriggerLabel, { children: label }),
|
|
4128
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4129
|
+
DropdownTriggerIcon,
|
|
4130
|
+
{
|
|
4131
|
+
disabled,
|
|
4132
|
+
role: typeof icon === "string" ? void 0 : "img",
|
|
4133
|
+
"aria-hidden": true,
|
|
4134
|
+
children: typeof icon === "string" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon_default, { icon }) : icon
|
|
4135
|
+
}
|
|
4136
|
+
),
|
|
4137
|
+
label && iconPosition === "before" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DropdownTriggerLabel, { children: label })
|
|
4138
|
+
] }),
|
|
4139
|
+
!caretHidden && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(CaretIcon, { disabled, children: [
|
|
4140
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon_default, { icon: isOpen ? "arrow_drop_up" : "arrow_drop_down" }),
|
|
4141
|
+
" "
|
|
4142
|
+
] })
|
|
4143
|
+
]
|
|
4144
|
+
}
|
|
4145
|
+
) }) }),
|
|
4146
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Popover.Portal, { container: document.getElementById(`${id}-portal`), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Popover.Content, { asChild: true, sideOffset: 1, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4147
|
+
DropdownMenu_default,
|
|
4148
|
+
{
|
|
4149
|
+
id: menuId,
|
|
4150
|
+
dropdownTriggerId: triggerId,
|
|
4151
|
+
options,
|
|
4152
|
+
iconsPosition: optionsIconPosition,
|
|
4153
|
+
visualFocusIndex,
|
|
4154
|
+
menuItemOnClick: handleMenuItemOnClick,
|
|
4155
|
+
onKeyDown: handleMenuOnKeyDown,
|
|
4156
|
+
styles: { width, zIndex: "320" },
|
|
4157
|
+
ref: menuRef
|
|
4158
|
+
}
|
|
4159
|
+
) }) })
|
|
4160
|
+
] })
|
|
4161
|
+
}
|
|
4162
|
+
),
|
|
4163
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { id: `${id}-portal`, style: { position: "absolute" } })
|
|
4164
|
+
] });
|
|
4153
4165
|
};
|
|
4154
4166
|
var sizes = {
|
|
4155
4167
|
small: "60px",
|
|
@@ -4240,7 +4252,7 @@ var CaretIcon = import_styled_components15.default.span`
|
|
|
4240
4252
|
var Dropdown_default = DxcDropdown;
|
|
4241
4253
|
|
|
4242
4254
|
// src/header/Header.tsx
|
|
4243
|
-
var
|
|
4255
|
+
var import_react19 = require("react");
|
|
4244
4256
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
4245
4257
|
var Dropdown = (props) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(HeaderDropdown, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Dropdown_default, { ...props }) });
|
|
4246
4258
|
var getLogoElement = (themeInput, logoLabel) => {
|
|
@@ -4278,11 +4290,11 @@ var DxcHeader = ({
|
|
|
4278
4290
|
margin,
|
|
4279
4291
|
tabIndex = 0
|
|
4280
4292
|
}) => {
|
|
4281
|
-
const [isResponsive, setIsResponsive] = (0,
|
|
4282
|
-
const [isMenuVisible, setIsMenuVisible] = (0,
|
|
4283
|
-
const colorsTheme = (0,
|
|
4284
|
-
const translatedLabels = (0,
|
|
4285
|
-
const ref = (0,
|
|
4293
|
+
const [isResponsive, setIsResponsive] = (0, import_react18.useState)(false);
|
|
4294
|
+
const [isMenuVisible, setIsMenuVisible] = (0, import_react18.useState)(false);
|
|
4295
|
+
const colorsTheme = (0, import_react19.useContext)(HalstackContext);
|
|
4296
|
+
const translatedLabels = (0, import_react19.useContext)(HalstackLanguageContext);
|
|
4297
|
+
const ref = (0, import_react18.useRef)(null);
|
|
4286
4298
|
const handleMenu = () => {
|
|
4287
4299
|
if (isResponsive && !isMenuVisible) {
|
|
4288
4300
|
setIsMenuVisible(!isMenuVisible);
|
|
@@ -4290,15 +4302,15 @@ var DxcHeader = ({
|
|
|
4290
4302
|
setIsMenuVisible(!isMenuVisible);
|
|
4291
4303
|
}
|
|
4292
4304
|
};
|
|
4293
|
-
const headerLogo = (0,
|
|
4305
|
+
const headerLogo = (0, import_react18.useMemo)(
|
|
4294
4306
|
() => getLogoElement(colorsTheme.header.logo, translatedLabels.formFields.logoAlternativeText),
|
|
4295
4307
|
[colorsTheme, translatedLabels]
|
|
4296
4308
|
);
|
|
4297
|
-
const headerResponsiveLogo = (0,
|
|
4309
|
+
const headerResponsiveLogo = (0, import_react18.useMemo)(
|
|
4298
4310
|
() => getLogoElement(colorsTheme.header.logoResponsive, translatedLabels.formFields.logoAlternativeText),
|
|
4299
4311
|
[colorsTheme, translatedLabels]
|
|
4300
4312
|
);
|
|
4301
|
-
(0,
|
|
4313
|
+
(0, import_react18.useEffect)(() => {
|
|
4302
4314
|
const handleResize = () => {
|
|
4303
4315
|
setIsResponsive(window.matchMedia(`(max-width: ${responsiveSizes.medium}rem)`).matches);
|
|
4304
4316
|
};
|
|
@@ -4308,7 +4320,7 @@ var DxcHeader = ({
|
|
|
4308
4320
|
window.removeEventListener("resize", handleResize);
|
|
4309
4321
|
};
|
|
4310
4322
|
}, []);
|
|
4311
|
-
(0,
|
|
4323
|
+
(0, import_react18.useEffect)(() => {
|
|
4312
4324
|
if (!isResponsive) {
|
|
4313
4325
|
setIsMenuVisible(false);
|
|
4314
4326
|
}
|
|
@@ -4505,7 +4517,7 @@ var Overlay2 = import_styled_components16.default.div`
|
|
|
4505
4517
|
var Header_default = DxcHeader;
|
|
4506
4518
|
|
|
4507
4519
|
// src/sidenav/Sidenav.tsx
|
|
4508
|
-
var
|
|
4520
|
+
var import_react21 = require("react");
|
|
4509
4521
|
var import_styled_components18 = __toESM(require("styled-components"));
|
|
4510
4522
|
|
|
4511
4523
|
// src/bleed/Bleed.tsx
|
|
@@ -4535,20 +4547,20 @@ var Bleed = ({ space, horizontal, vertical, top, right, bottom, left, children }
|
|
|
4535
4547
|
var Bleed_default = Bleed;
|
|
4536
4548
|
|
|
4537
4549
|
// src/sidenav/SidenavContext.tsx
|
|
4538
|
-
var
|
|
4539
|
-
var SidenavContext = (0,
|
|
4540
|
-
var GroupContext = (0,
|
|
4550
|
+
var import_react20 = require("react");
|
|
4551
|
+
var SidenavContext = (0, import_react20.createContext)(null);
|
|
4552
|
+
var GroupContext = (0, import_react20.createContext)(null);
|
|
4541
4553
|
var SidenavContextProvider = SidenavContext.Provider;
|
|
4542
4554
|
var GroupContextProvider = GroupContext.Provider;
|
|
4543
4555
|
var useResponsiveSidenavVisibility = () => {
|
|
4544
|
-
const changeResponsiveSidenavVisibility = (0,
|
|
4556
|
+
const changeResponsiveSidenavVisibility = (0, import_react20.useContext)(SidenavContext);
|
|
4545
4557
|
return changeResponsiveSidenavVisibility;
|
|
4546
4558
|
};
|
|
4547
4559
|
|
|
4548
4560
|
// src/sidenav/Sidenav.tsx
|
|
4549
4561
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
4550
4562
|
var DxcSidenav = ({ title, children }) => {
|
|
4551
|
-
const colorsTheme = (0,
|
|
4563
|
+
const colorsTheme = (0, import_react21.useContext)(HalstackContext);
|
|
4552
4564
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_styled_components18.ThemeProvider, { theme: colorsTheme.sidenav, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(SidenavContainer, { children: [
|
|
4553
4565
|
title,
|
|
4554
4566
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Flex_default, { direction: "column", gap: "1rem", children })
|
|
@@ -4560,8 +4572,8 @@ var Section = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(i
|
|
|
4560
4572
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Divider, {})
|
|
4561
4573
|
] });
|
|
4562
4574
|
var Group = ({ title, collapsable = false, icon, children }) => {
|
|
4563
|
-
const [collapsed, setCollapsed] = (0,
|
|
4564
|
-
const [isSelected, changeIsSelected] = (0,
|
|
4575
|
+
const [collapsed, setCollapsed] = (0, import_react21.useState)(false);
|
|
4576
|
+
const [isSelected, changeIsSelected] = (0, import_react21.useState)(false);
|
|
4565
4577
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(GroupContextProvider, { value: changeIsSelected, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(SidenavGroup, { children: [
|
|
4566
4578
|
collapsable && title ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
4567
4579
|
SidenavGroupTitleButton,
|
|
@@ -4584,15 +4596,15 @@ var Group = ({ title, collapsable = false, icon, children }) => {
|
|
|
4584
4596
|
!collapsed && children
|
|
4585
4597
|
] }) });
|
|
4586
4598
|
};
|
|
4587
|
-
var Link = (0,
|
|
4599
|
+
var Link = (0, import_react21.forwardRef)(
|
|
4588
4600
|
({ href, newWindow = false, selected = false, icon, onClick, tabIndex = 0, children, ...otherProps }, ref) => {
|
|
4589
|
-
const changeIsGroupSelected = (0,
|
|
4601
|
+
const changeIsGroupSelected = (0, import_react21.useContext)(GroupContext);
|
|
4590
4602
|
const setIsSidenavVisibleResponsive = useResponsiveSidenavVisibility();
|
|
4591
4603
|
const handleClick = ($event) => {
|
|
4592
4604
|
onClick?.($event);
|
|
4593
4605
|
setIsSidenavVisibleResponsive?.(false);
|
|
4594
4606
|
};
|
|
4595
|
-
(0,
|
|
4607
|
+
(0, import_react21.useEffect)(() => {
|
|
4596
4608
|
changeIsGroupSelected?.((isGroupSelected2) => !isGroupSelected2 ? selected : isGroupSelected2);
|
|
4597
4609
|
}, [selected, changeIsGroupSelected]);
|
|
4598
4610
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
@@ -4766,7 +4778,7 @@ DxcSidenav.Title = Title2;
|
|
|
4766
4778
|
var Sidenav_default = DxcSidenav;
|
|
4767
4779
|
|
|
4768
4780
|
// src/layout/utils.tsx
|
|
4769
|
-
var
|
|
4781
|
+
var import_react22 = require("react");
|
|
4770
4782
|
|
|
4771
4783
|
// src/layout/Icons.tsx
|
|
4772
4784
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
@@ -4853,10 +4865,10 @@ var socialLinks = [
|
|
|
4853
4865
|
title: "Facebook"
|
|
4854
4866
|
}
|
|
4855
4867
|
];
|
|
4856
|
-
var findChildType = (children, childType) =>
|
|
4868
|
+
var findChildType = (children, childType) => import_react22.Children.toArray(children).find((child) => (0, import_react22.isValidElement)(child) && child.type === childType);
|
|
4857
4869
|
var useResponsive = (breakpoint) => {
|
|
4858
|
-
const [isResponsive, setIsResponsive] = (0,
|
|
4859
|
-
(0,
|
|
4870
|
+
const [isResponsive, setIsResponsive] = (0, import_react22.useState)(false);
|
|
4871
|
+
(0, import_react22.useEffect)(() => {
|
|
4860
4872
|
const handleResize = () => {
|
|
4861
4873
|
setIsResponsive(window.matchMedia(`(max-width: ${breakpoint}rem)`).matches);
|
|
4862
4874
|
};
|
|
@@ -4968,14 +4980,14 @@ var DxcApplicationLayout = ({
|
|
|
4968
4980
|
footer,
|
|
4969
4981
|
children
|
|
4970
4982
|
}) => {
|
|
4971
|
-
const [isSidenavVisibleResponsive, setIsSidenavVisibleResponsive] = (0,
|
|
4983
|
+
const [isSidenavVisibleResponsive, setIsSidenavVisibleResponsive] = (0, import_react23.useState)(false);
|
|
4972
4984
|
const isResponsive = useResponsive(responsiveSizes.large);
|
|
4973
|
-
const ref = (0,
|
|
4974
|
-
const translatedLabels = (0,
|
|
4985
|
+
const ref = (0, import_react23.useRef)(null);
|
|
4986
|
+
const translatedLabels = (0, import_react23.useContext)(HalstackLanguageContext);
|
|
4975
4987
|
const handleSidenavVisibility = () => {
|
|
4976
4988
|
setIsSidenavVisibleResponsive((currentIsSidenavVisibleResponsive) => !currentIsSidenavVisibleResponsive);
|
|
4977
4989
|
};
|
|
4978
|
-
(0,
|
|
4990
|
+
(0, import_react23.useEffect)(() => {
|
|
4979
4991
|
if (!isResponsive) {
|
|
4980
4992
|
setIsSidenavVisibleResponsive(false);
|
|
4981
4993
|
}
|
|
@@ -5144,7 +5156,7 @@ var Label = import_styled_components20.default.span`
|
|
|
5144
5156
|
var Badge_default = DxcBadge;
|
|
5145
5157
|
|
|
5146
5158
|
// src/breadcrumbs/Breadcrumbs.tsx
|
|
5147
|
-
var
|
|
5159
|
+
var import_react25 = require("react");
|
|
5148
5160
|
var import_styled_components22 = __toESM(require("styled-components"));
|
|
5149
5161
|
|
|
5150
5162
|
// src/breadcrumbs/dropdownTheme.ts
|
|
@@ -5204,11 +5216,11 @@ var dropdownTheme_default = {
|
|
|
5204
5216
|
};
|
|
5205
5217
|
|
|
5206
5218
|
// src/breadcrumbs/Item.tsx
|
|
5207
|
-
var
|
|
5219
|
+
var import_react24 = require("react");
|
|
5208
5220
|
var import_styled_components21 = __toESM(require("styled-components"));
|
|
5209
5221
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
5210
5222
|
var Item = ({ isCurrentPage = false, href, label, onClick }) => {
|
|
5211
|
-
const currentItemRef = (0,
|
|
5223
|
+
const currentItemRef = (0, import_react24.useRef)(null);
|
|
5212
5224
|
const handleOnMouseEnter = (event) => {
|
|
5213
5225
|
const labelContainer = event.currentTarget;
|
|
5214
5226
|
const optionElement = currentItemRef.current;
|
|
@@ -5217,10 +5229,9 @@ var Item = ({ isCurrentPage = false, href, label, onClick }) => {
|
|
|
5217
5229
|
}
|
|
5218
5230
|
};
|
|
5219
5231
|
const handleOnClick = (event) => {
|
|
5232
|
+
if (typeof onClick !== "function") return;
|
|
5220
5233
|
event.preventDefault();
|
|
5221
|
-
if (href)
|
|
5222
|
-
onClick?.(href);
|
|
5223
|
-
}
|
|
5234
|
+
if (href) onClick(href);
|
|
5224
5235
|
};
|
|
5225
5236
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ListItem, { "aria-current": isCurrentPage ? "page" : void 0, isCurrentPage, children: isCurrentPage ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CurrentPage, { ref: currentItemRef, onMouseEnter: handleOnMouseEnter, children: label }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Link2, { href, onClick: handleOnClick, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Text, { children: label }) }) });
|
|
5226
5237
|
};
|
|
@@ -5270,7 +5281,7 @@ var DxcBreadcrumbs = ({
|
|
|
5270
5281
|
onItemClick,
|
|
5271
5282
|
showRoot = true
|
|
5272
5283
|
}) => {
|
|
5273
|
-
const handleOnSelectOption = (0,
|
|
5284
|
+
const handleOnSelectOption = (0, import_react25.useCallback)(
|
|
5274
5285
|
(href) => {
|
|
5275
5286
|
if (onItemClick) {
|
|
5276
5287
|
onItemClick(href);
|
|
@@ -5329,16 +5340,16 @@ var OrderedList = import_styled_components22.default.ol`
|
|
|
5329
5340
|
var Breadcrumbs_default = DxcBreadcrumbs;
|
|
5330
5341
|
|
|
5331
5342
|
// src/bulleted-list/BulletedList.tsx
|
|
5332
|
-
var
|
|
5343
|
+
var import_react28 = require("react");
|
|
5333
5344
|
var import_styled_components24 = __toESM(require("styled-components"));
|
|
5334
5345
|
|
|
5335
5346
|
// src/typography/Typography.tsx
|
|
5336
|
-
var
|
|
5347
|
+
var import_react27 = require("react");
|
|
5337
5348
|
var import_styled_components23 = __toESM(require("styled-components"));
|
|
5338
5349
|
|
|
5339
5350
|
// src/typography/TypographyContext.tsx
|
|
5340
|
-
var
|
|
5341
|
-
var TypographyContext_default = (0,
|
|
5351
|
+
var import_react26 = require("react");
|
|
5352
|
+
var TypographyContext_default = (0, import_react26.createContext)({
|
|
5342
5353
|
as: "span",
|
|
5343
5354
|
color: "#000000",
|
|
5344
5355
|
display: "inline",
|
|
@@ -5373,8 +5384,8 @@ var Typography = import_styled_components23.default.span`
|
|
|
5373
5384
|
overflow: ${({ textOverflow }) => textOverflow !== "unset" ? "hidden" : "visible"};
|
|
5374
5385
|
`;
|
|
5375
5386
|
function DxcTypography({ children, ...props }) {
|
|
5376
|
-
const componentContext = (0,
|
|
5377
|
-
const contextValue = (0,
|
|
5387
|
+
const componentContext = (0, import_react27.useContext)(TypographyContext_default);
|
|
5388
|
+
const contextValue = (0, import_react27.useMemo)(
|
|
5378
5389
|
() => ({
|
|
5379
5390
|
...componentContext,
|
|
5380
5391
|
...props
|
|
@@ -5388,8 +5399,8 @@ function DxcTypography({ children, ...props }) {
|
|
|
5388
5399
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
5389
5400
|
var BulletedListItem = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_jsx_runtime28.Fragment, { children });
|
|
5390
5401
|
var DxcBulletedList = ({ children, type = "disc", icon = "" }) => {
|
|
5391
|
-
const colorsTheme = (0,
|
|
5392
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_styled_components24.ThemeProvider, { theme: colorsTheme.bulletedList, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ListContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Flex_default, { direction: "column", as: type === "number" ? "ol" : "ul", gap: "0.125rem", children:
|
|
5402
|
+
const colorsTheme = (0, import_react28.useContext)(HalstackContext);
|
|
5403
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_styled_components24.ThemeProvider, { theme: colorsTheme.bulletedList, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ListContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Flex_default, { direction: "column", as: type === "number" ? "ol" : "ul", gap: "0.125rem", children: import_react28.Children.map(children, (child, index) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ListItem2, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(GeneralContent, { children: [
|
|
5393
5404
|
type === "number" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Number2, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(DxcTypography, { color: colorsTheme.bulletedList.fontColor, children: [
|
|
5394
5405
|
index + 1,
|
|
5395
5406
|
"."
|
|
@@ -5468,7 +5479,7 @@ var ListItem2 = import_styled_components24.default.li`
|
|
|
5468
5479
|
var BulletedList_default = DxcBulletedList;
|
|
5469
5480
|
|
|
5470
5481
|
// src/card/Card.tsx
|
|
5471
|
-
var
|
|
5482
|
+
var import_react29 = require("react");
|
|
5472
5483
|
var import_styled_components25 = __toESM(require("styled-components"));
|
|
5473
5484
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5474
5485
|
var DxcCard = ({
|
|
@@ -5484,8 +5495,8 @@ var DxcCard = ({
|
|
|
5484
5495
|
outlined = true,
|
|
5485
5496
|
children
|
|
5486
5497
|
}) => {
|
|
5487
|
-
const colorsTheme = (0,
|
|
5488
|
-
const [isHovered, changeIsHovered] = (0,
|
|
5498
|
+
const colorsTheme = (0, import_react29.useContext)(HalstackContext);
|
|
5499
|
+
const [isHovered, changeIsHovered] = (0, import_react29.useState)(false);
|
|
5489
5500
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_styled_components25.ThemeProvider, { theme: colorsTheme.card, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5490
5501
|
Card,
|
|
5491
5502
|
{
|
|
@@ -5551,11 +5562,11 @@ var CardContent = import_styled_components25.default.div`
|
|
|
5551
5562
|
var Card_default = DxcCard;
|
|
5552
5563
|
|
|
5553
5564
|
// src/checkbox/Checkbox.tsx
|
|
5554
|
-
var
|
|
5565
|
+
var import_react30 = require("react");
|
|
5555
5566
|
var import_styled_components26 = __toESM(require("styled-components"));
|
|
5556
5567
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5557
5568
|
var checkedIcon = /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("svg", { fill: "currentColor", focusable: "false", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("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" }) });
|
|
5558
|
-
var DxcCheckbox = (0,
|
|
5569
|
+
var DxcCheckbox = (0, import_react30.forwardRef)(
|
|
5559
5570
|
({
|
|
5560
5571
|
checked,
|
|
5561
5572
|
defaultChecked = false,
|
|
@@ -5572,11 +5583,11 @@ var DxcCheckbox = (0, import_react29.forwardRef)(
|
|
|
5572
5583
|
tabIndex = 0,
|
|
5573
5584
|
ariaLabel = "Checkbox"
|
|
5574
5585
|
}, ref) => {
|
|
5575
|
-
const labelId = `label-checkbox-${(0,
|
|
5576
|
-
const [innerChecked, setInnerChecked] = (0,
|
|
5577
|
-
const checkboxRef = (0,
|
|
5578
|
-
const colorsTheme = (0,
|
|
5579
|
-
const translatedLabels = (0,
|
|
5586
|
+
const labelId = `label-checkbox-${(0, import_react30.useId)()}`;
|
|
5587
|
+
const [innerChecked, setInnerChecked] = (0, import_react30.useState)(defaultChecked);
|
|
5588
|
+
const checkboxRef = (0, import_react30.useRef)(null);
|
|
5589
|
+
const colorsTheme = (0, import_react30.useContext)(HalstackContext);
|
|
5590
|
+
const translatedLabels = (0, import_react30.useContext)(HalstackLanguageContext);
|
|
5580
5591
|
const handleCheckboxChange = () => {
|
|
5581
5592
|
if (!disabled && !readOnly) {
|
|
5582
5593
|
if (document.activeElement !== checkboxRef.current) {
|
|
@@ -5773,7 +5784,7 @@ var MainContainer2 = import_styled_components26.default.div`
|
|
|
5773
5784
|
var Checkbox_default = DxcCheckbox;
|
|
5774
5785
|
|
|
5775
5786
|
// src/chip/Chip.tsx
|
|
5776
|
-
var
|
|
5787
|
+
var import_react31 = require("react");
|
|
5777
5788
|
var import_styled_components27 = __toESM(require("styled-components"));
|
|
5778
5789
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5779
5790
|
var DxcChip = ({
|
|
@@ -5786,7 +5797,7 @@ var DxcChip = ({
|
|
|
5786
5797
|
margin,
|
|
5787
5798
|
tabIndex = 0
|
|
5788
5799
|
}) => {
|
|
5789
|
-
const colorsTheme = (0,
|
|
5800
|
+
const colorsTheme = (0, import_react31.useContext)(HalstackContext);
|
|
5790
5801
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_styled_components27.ThemeProvider, { theme: colorsTheme.chip, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Chip, { disabled, margin, children: [
|
|
5791
5802
|
prefixIcon && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5792
5803
|
IconContainer5,
|
|
@@ -5878,22 +5889,22 @@ var IconContainer5 = import_styled_components27.default.div`
|
|
|
5878
5889
|
var Chip_default = DxcChip;
|
|
5879
5890
|
|
|
5880
5891
|
// src/contextual-menu/ContextualMenu.tsx
|
|
5881
|
-
var
|
|
5892
|
+
var import_react37 = require("react");
|
|
5882
5893
|
var import_styled_components31 = __toESM(require("styled-components"));
|
|
5883
5894
|
|
|
5884
5895
|
// src/contextual-menu/MenuItem.tsx
|
|
5885
5896
|
var import_styled_components29 = __toESM(require("styled-components"));
|
|
5886
5897
|
|
|
5887
5898
|
// src/contextual-menu/GroupItem.tsx
|
|
5888
|
-
var
|
|
5899
|
+
var import_react34 = require("react");
|
|
5889
5900
|
|
|
5890
5901
|
// src/contextual-menu/ItemAction.tsx
|
|
5891
|
-
var
|
|
5902
|
+
var import_react32 = require("react");
|
|
5892
5903
|
var import_styled_components28 = __toESM(require("styled-components"));
|
|
5893
5904
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
5894
5905
|
var ItemAction = ({ badge, collapseIcon, icon, label, depthLevel, ...props }) => {
|
|
5895
|
-
const [hasTooltip, setHasTooltip] = (0,
|
|
5896
|
-
const modifiedBadge = badge && (0,
|
|
5906
|
+
const [hasTooltip, setHasTooltip] = (0, import_react32.useState)(false);
|
|
5907
|
+
const modifiedBadge = badge && (0, import_react32.cloneElement)(badge, { size: "small" });
|
|
5897
5908
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipWrapper, { condition: hasTooltip, label, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Action, { depthLevel, ...props, children: [
|
|
5898
5909
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Label2, { children: [
|
|
5899
5910
|
collapseIcon && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Icon2, { children: collapseIcon }),
|
|
@@ -5969,8 +5980,8 @@ var Text2 = import_styled_components28.default.span`
|
|
|
5969
5980
|
var ItemAction_default = ItemAction;
|
|
5970
5981
|
|
|
5971
5982
|
// src/contextual-menu/ContextualMenuContext.tsx
|
|
5972
|
-
var
|
|
5973
|
-
var ContextualMenuContext_default = (0,
|
|
5983
|
+
var import_react33 = require("react");
|
|
5984
|
+
var ContextualMenuContext_default = (0, import_react33.createContext)(null);
|
|
5974
5985
|
|
|
5975
5986
|
// src/contextual-menu/GroupItem.tsx
|
|
5976
5987
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
@@ -5980,10 +5991,10 @@ var isGroupSelected = (items, selectedItemId) => items.some((item) => {
|
|
|
5980
5991
|
else return item.selectedByDefault;
|
|
5981
5992
|
});
|
|
5982
5993
|
var GroupItem = ({ items, ...props }) => {
|
|
5983
|
-
const groupMenuId = `group-menu-${(0,
|
|
5984
|
-
const { selectedItemId } = (0,
|
|
5985
|
-
const groupSelected = (0,
|
|
5986
|
-
const [isOpen, setIsOpen] = (0,
|
|
5994
|
+
const groupMenuId = `group-menu-${(0, import_react34.useId)()}`;
|
|
5995
|
+
const { selectedItemId } = (0, import_react34.useContext)(ContextualMenuContext_default) ?? {};
|
|
5996
|
+
const groupSelected = (0, import_react34.useMemo)(() => isGroupSelected(items, selectedItemId), [items, selectedItemId]);
|
|
5997
|
+
const [isOpen, setIsOpen] = (0, import_react34.useState)(groupSelected && selectedItemId === -1);
|
|
5987
5998
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
5988
5999
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5989
6000
|
ItemAction_default,
|
|
@@ -6002,18 +6013,18 @@ var GroupItem = ({ items, ...props }) => {
|
|
|
6002
6013
|
isOpen && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SubMenu, { id: groupMenuId, children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(MenuItem_default, { item, depthLevel: props.depthLevel + 1 }, `${item.label}-${index}`)) })
|
|
6003
6014
|
] });
|
|
6004
6015
|
};
|
|
6005
|
-
var GroupItem_default = (0,
|
|
6016
|
+
var GroupItem_default = (0, import_react34.memo)(GroupItem);
|
|
6006
6017
|
|
|
6007
6018
|
// src/contextual-menu/SingleItem.tsx
|
|
6008
|
-
var
|
|
6019
|
+
var import_react35 = require("react");
|
|
6009
6020
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
6010
6021
|
var SingleItem = ({ id, onSelect, selectedByDefault = false, ...props }) => {
|
|
6011
|
-
const { selectedItemId, setSelectedItemId } = (0,
|
|
6022
|
+
const { selectedItemId, setSelectedItemId } = (0, import_react35.useContext)(ContextualMenuContext_default) ?? {};
|
|
6012
6023
|
const handleClick = () => {
|
|
6013
6024
|
setSelectedItemId?.(id);
|
|
6014
6025
|
onSelect?.();
|
|
6015
6026
|
};
|
|
6016
|
-
(0,
|
|
6027
|
+
(0, import_react35.useEffect)(() => {
|
|
6017
6028
|
if (selectedItemId === -1 && selectedByDefault) {
|
|
6018
6029
|
setSelectedItemId?.(id);
|
|
6019
6030
|
}
|
|
@@ -6041,10 +6052,10 @@ var MenuItem_default = MenuItem;
|
|
|
6041
6052
|
|
|
6042
6053
|
// src/contextual-menu/Section.tsx
|
|
6043
6054
|
var import_styled_components30 = __toESM(require("styled-components"));
|
|
6044
|
-
var
|
|
6055
|
+
var import_react36 = require("react");
|
|
6045
6056
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
6046
6057
|
var Section2 = ({ section, index, length }) => {
|
|
6047
|
-
const id = `section-${(0,
|
|
6058
|
+
const id = `section-${(0, import_react36.useId)()}`;
|
|
6048
6059
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("section", { "aria-label": section.title ?? id, "aria-labelledby": id, children: [
|
|
6049
6060
|
section.title && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Title3, { id, children: section.title }),
|
|
6050
6061
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SubMenu, { children: section.items.map((item, index2) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(MenuItem_default, { item }, `${item.label}-${index2}`)) }),
|
|
@@ -6111,13 +6122,13 @@ var addIdToItems = (items) => {
|
|
|
6111
6122
|
};
|
|
6112
6123
|
var SubMenu = ({ children, id }) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(StyledSubMenu, { id, role: "menu", children });
|
|
6113
6124
|
function DxcContextualMenu({ items }) {
|
|
6114
|
-
const [selectedItemId, setSelectedItemId] = (0,
|
|
6115
|
-
const contextualMenuRef = (0,
|
|
6116
|
-
const itemsWithId = (0,
|
|
6117
|
-
const contextValue = (0,
|
|
6118
|
-
const colorsTheme = (0,
|
|
6119
|
-
const [firstUpdate, setFirstUpdate] = (0,
|
|
6120
|
-
(0,
|
|
6125
|
+
const [selectedItemId, setSelectedItemId] = (0, import_react37.useState)(-1);
|
|
6126
|
+
const contextualMenuRef = (0, import_react37.useRef)(null);
|
|
6127
|
+
const itemsWithId = (0, import_react37.useMemo)(() => addIdToItems(items), [items]);
|
|
6128
|
+
const contextValue = (0, import_react37.useMemo)(() => ({ selectedItemId, setSelectedItemId }), [selectedItemId, setSelectedItemId]);
|
|
6129
|
+
const colorsTheme = (0, import_react37.useContext)(HalstackContext);
|
|
6130
|
+
const [firstUpdate, setFirstUpdate] = (0, import_react37.useState)(true);
|
|
6131
|
+
(0, import_react37.useLayoutEffect)(() => {
|
|
6121
6132
|
if (selectedItemId !== -1 && firstUpdate) {
|
|
6122
6133
|
const contextualMenuEl = contextualMenuRef.current;
|
|
6123
6134
|
const selectedItemEl = contextualMenuEl?.querySelector("[aria-pressed='true']");
|
|
@@ -6131,17 +6142,17 @@ function DxcContextualMenu({ items }) {
|
|
|
6131
6142
|
}
|
|
6132
6143
|
|
|
6133
6144
|
// src/data-grid/DataGrid.tsx
|
|
6134
|
-
var
|
|
6145
|
+
var import_react45 = require("react");
|
|
6135
6146
|
var import_react_data_grid2 = __toESM(require("react-data-grid"));
|
|
6136
6147
|
var import_styled_components38 = __toESM(require("styled-components"));
|
|
6137
6148
|
var import_styles = require("react-data-grid/lib/styles.css");
|
|
6138
6149
|
|
|
6139
6150
|
// src/data-grid/utils.tsx
|
|
6140
|
-
var
|
|
6151
|
+
var import_react39 = require("react");
|
|
6141
6152
|
var import_react_data_grid = require("react-data-grid");
|
|
6142
6153
|
|
|
6143
6154
|
// src/spinner/Spinner.tsx
|
|
6144
|
-
var
|
|
6155
|
+
var import_react38 = require("react");
|
|
6145
6156
|
var import_styled_components32 = __toESM(require("styled-components"));
|
|
6146
6157
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
6147
6158
|
var DxcSpinner = ({
|
|
@@ -6152,9 +6163,9 @@ var DxcSpinner = ({
|
|
|
6152
6163
|
margin,
|
|
6153
6164
|
ariaLabel = "Spinner"
|
|
6154
6165
|
}) => {
|
|
6155
|
-
const labelId = (0,
|
|
6156
|
-
const colorsTheme = (0,
|
|
6157
|
-
const determinated = (0,
|
|
6166
|
+
const labelId = (0, import_react38.useId)();
|
|
6167
|
+
const colorsTheme = (0, import_react38.useContext)(HalstackContext);
|
|
6168
|
+
const determinated = (0, import_react38.useMemo)(() => value != null && value >= 0 && value <= 100, [value]);
|
|
6158
6169
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_styled_components32.ThemeProvider, { theme: colorsTheme.spinner, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(DXCSpinner, { margin, mode, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(SpinnerContainer, { mode, children: [
|
|
6159
6170
|
mode === "overlay" && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(BackOverlay, {}),
|
|
6160
6171
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(BackgroundSpinner, { children: mode === "small" ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SVGBackground, { viewBox: "0 0 16 16", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CircleBackground, { cx: "8", cy: "8", r: "6", mode }) }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SVGBackground, { viewBox: "0 0 140 140", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CircleBackground, { cx: "70", cy: "70", r: "65", mode }) }) }),
|
|
@@ -6412,7 +6423,7 @@ var renderExpandableTrigger = (row, rows, uniqueRowId, setRowsToRender) => /* @_
|
|
|
6412
6423
|
}
|
|
6413
6424
|
);
|
|
6414
6425
|
var renderHierarchyTrigger = (rows, triggerRow, uniqueRowId, columnKey, setRowsToRender, childrenTrigger) => {
|
|
6415
|
-
const [loading, setLoading] = (0,
|
|
6426
|
+
const [loading, setLoading] = (0, import_react39.useState)(false);
|
|
6416
6427
|
const onClick = async () => {
|
|
6417
6428
|
if (loading) return;
|
|
6418
6429
|
if (!triggerRow.visibleChildren) {
|
|
@@ -6691,21 +6702,21 @@ var getPaginatedNodes = (rows, uniqueRowId, start, end) => {
|
|
|
6691
6702
|
};
|
|
6692
6703
|
|
|
6693
6704
|
// src/paginator/Paginator.tsx
|
|
6694
|
-
var
|
|
6705
|
+
var import_react43 = require("react");
|
|
6695
6706
|
var import_styled_components36 = __toESM(require("styled-components"));
|
|
6696
6707
|
|
|
6697
6708
|
// src/select/Select.tsx
|
|
6698
6709
|
var Popover2 = __toESM(require("@radix-ui/react-popover"));
|
|
6699
|
-
var
|
|
6710
|
+
var import_react42 = require("react");
|
|
6700
6711
|
var import_styled_components35 = __toESM(require("styled-components"));
|
|
6701
6712
|
|
|
6702
6713
|
// src/select/Listbox.tsx
|
|
6703
|
-
var
|
|
6714
|
+
var import_react41 = require("react");
|
|
6704
6715
|
var import_styled_components34 = __toESM(require("styled-components"));
|
|
6705
6716
|
|
|
6706
6717
|
// src/select/ListOption.tsx
|
|
6707
6718
|
var import_styled_components33 = __toESM(require("styled-components"));
|
|
6708
|
-
var
|
|
6719
|
+
var import_react40 = require("react");
|
|
6709
6720
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
6710
6721
|
var ListOption = ({
|
|
6711
6722
|
id,
|
|
@@ -6717,7 +6728,7 @@ var ListOption = ({
|
|
|
6717
6728
|
isLastOption,
|
|
6718
6729
|
isSelected
|
|
6719
6730
|
}) => {
|
|
6720
|
-
const [hasTooltip, setHasTooltip] = (0,
|
|
6731
|
+
const [hasTooltip, setHasTooltip] = (0, import_react40.useState)(false);
|
|
6721
6732
|
const handleOnMouseEnter = (event) => {
|
|
6722
6733
|
const text = event.currentTarget;
|
|
6723
6734
|
setHasTooltip(text.scrollWidth > text.clientWidth);
|
|
@@ -6913,8 +6924,8 @@ var Listbox = ({
|
|
|
6913
6924
|
handleOptionOnClick,
|
|
6914
6925
|
styles
|
|
6915
6926
|
}) => {
|
|
6916
|
-
const translatedLabels = (0,
|
|
6917
|
-
const listboxRef = (0,
|
|
6927
|
+
const translatedLabels = (0, import_react41.useContext)(HalstackLanguageContext);
|
|
6928
|
+
const listboxRef = (0, import_react41.useRef)(null);
|
|
6918
6929
|
let globalIndex = optional && !multiple ? 0 : -1;
|
|
6919
6930
|
const mapOptionFunc = (option, mapIndex) => {
|
|
6920
6931
|
const groupId = `${id}-group-${mapIndex}`;
|
|
@@ -6956,7 +6967,7 @@ var Listbox = ({
|
|
|
6956
6967
|
);
|
|
6957
6968
|
}
|
|
6958
6969
|
};
|
|
6959
|
-
(0,
|
|
6970
|
+
(0, import_react41.useLayoutEffect)(() => {
|
|
6960
6971
|
if (currentValue && !multiple) {
|
|
6961
6972
|
const listEl = listboxRef?.current;
|
|
6962
6973
|
const selectedListOptionEl = listEl?.querySelector("[aria-selected='true']");
|
|
@@ -6965,7 +6976,7 @@ var Listbox = ({
|
|
|
6965
6976
|
});
|
|
6966
6977
|
}
|
|
6967
6978
|
}, [currentValue, multiple]);
|
|
6968
|
-
(0,
|
|
6979
|
+
(0, import_react41.useLayoutEffect)(() => {
|
|
6969
6980
|
const visualFocusedOptionEl = listboxRef.current?.querySelectorAll("[role='option']")[visualFocusIndex];
|
|
6970
6981
|
visualFocusedOptionEl?.scrollIntoView?.({
|
|
6971
6982
|
block: "nearest",
|
|
@@ -7055,7 +7066,7 @@ var Listbox_default = Listbox;
|
|
|
7055
7066
|
|
|
7056
7067
|
// src/select/Select.tsx
|
|
7057
7068
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
7058
|
-
var DxcSelect = (0,
|
|
7069
|
+
var DxcSelect = (0, import_react42.forwardRef)(
|
|
7059
7070
|
({
|
|
7060
7071
|
label,
|
|
7061
7072
|
name = "",
|
|
@@ -7076,27 +7087,27 @@ var DxcSelect = (0, import_react41.forwardRef)(
|
|
|
7076
7087
|
tabIndex = 0,
|
|
7077
7088
|
ariaLabel = "Select"
|
|
7078
7089
|
}, ref) => {
|
|
7079
|
-
const selectId = `select-${(0,
|
|
7090
|
+
const selectId = `select-${(0, import_react42.useId)()}`;
|
|
7080
7091
|
const selectLabelId = `label-${selectId}`;
|
|
7081
7092
|
const errorId = `error-${selectId}`;
|
|
7082
7093
|
const listboxId = `${selectId}-listbox`;
|
|
7083
|
-
const [innerValue, setInnerValue] = (0,
|
|
7084
|
-
const [searchValue, setSearchValue] = (0,
|
|
7085
|
-
const [visualFocusIndex, changeVisualFocusIndex] = (0,
|
|
7086
|
-
const [isOpen, changeIsOpen] = (0,
|
|
7087
|
-
const [hasTooltip, setHasTooltip] = (0,
|
|
7088
|
-
const selectRef = (0,
|
|
7089
|
-
const selectSearchInputRef = (0,
|
|
7094
|
+
const [innerValue, setInnerValue] = (0, import_react42.useState)(defaultValue ?? (multiple ? [] : ""));
|
|
7095
|
+
const [searchValue, setSearchValue] = (0, import_react42.useState)("");
|
|
7096
|
+
const [visualFocusIndex, changeVisualFocusIndex] = (0, import_react42.useState)(-1);
|
|
7097
|
+
const [isOpen, changeIsOpen] = (0, import_react42.useState)(false);
|
|
7098
|
+
const [hasTooltip, setHasTooltip] = (0, import_react42.useState)(false);
|
|
7099
|
+
const selectRef = (0, import_react42.useRef)(null);
|
|
7100
|
+
const selectSearchInputRef = (0, import_react42.useRef)(null);
|
|
7090
7101
|
const width = useWidth_default(selectRef.current);
|
|
7091
|
-
const colorsTheme = (0,
|
|
7092
|
-
const translatedLabels = (0,
|
|
7102
|
+
const colorsTheme = (0, import_react42.useContext)(HalstackContext);
|
|
7103
|
+
const translatedLabels = (0, import_react42.useContext)(HalstackLanguageContext);
|
|
7093
7104
|
const optionalItem = { label: placeholder, value: "" };
|
|
7094
|
-
const filteredOptions = (0,
|
|
7095
|
-
const lastOptionIndex = (0,
|
|
7105
|
+
const filteredOptions = (0, import_react42.useMemo)(() => filterOptionsBySearchValue(options, searchValue), [options, searchValue]);
|
|
7106
|
+
const lastOptionIndex = (0, import_react42.useMemo)(
|
|
7096
7107
|
() => getLastOptionIndex(options, filteredOptions, searchable, optional, multiple),
|
|
7097
7108
|
[options, filteredOptions, searchable, optional, multiple]
|
|
7098
7109
|
);
|
|
7099
|
-
const { selectedOption, singleSelectionIndex } = (0,
|
|
7110
|
+
const { selectedOption, singleSelectionIndex } = (0, import_react42.useMemo)(
|
|
7100
7111
|
() => getSelectedOption(value ?? innerValue, options, multiple, optional, optionalItem),
|
|
7101
7112
|
[value, innerValue, options, multiple, optional, optionalItem]
|
|
7102
7113
|
);
|
|
@@ -7111,7 +7122,7 @@ var DxcSelect = (0, import_react41.forwardRef)(
|
|
|
7111
7122
|
changeVisualFocusIndex(-1);
|
|
7112
7123
|
}
|
|
7113
7124
|
};
|
|
7114
|
-
const handleSelectChangeValue = (0,
|
|
7125
|
+
const handleSelectChangeValue = (0, import_react42.useCallback)(
|
|
7115
7126
|
(newOption) => {
|
|
7116
7127
|
if (newOption) {
|
|
7117
7128
|
let newValue;
|
|
@@ -7268,7 +7279,7 @@ var DxcSelect = (0, import_react41.forwardRef)(
|
|
|
7268
7279
|
event.stopPropagation();
|
|
7269
7280
|
setSearchValue("");
|
|
7270
7281
|
};
|
|
7271
|
-
const handleOptionOnClick = (0,
|
|
7282
|
+
const handleOptionOnClick = (0, import_react42.useCallback)(
|
|
7272
7283
|
(option) => {
|
|
7273
7284
|
handleSelectChangeValue(option);
|
|
7274
7285
|
if (!multiple) {
|
|
@@ -7282,148 +7293,151 @@ var DxcSelect = (0, import_react41.forwardRef)(
|
|
|
7282
7293
|
const text = event.currentTarget;
|
|
7283
7294
|
setHasTooltip(text.scrollWidth > text.clientWidth);
|
|
7284
7295
|
};
|
|
7285
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.
|
|
7286
|
-
|
|
7287
|
-
|
|
7288
|
-
|
|
7289
|
-
id: selectLabelId,
|
|
7290
|
-
disabled,
|
|
7291
|
-
onClick: () => {
|
|
7292
|
-
selectRef?.current?.focus();
|
|
7293
|
-
},
|
|
7294
|
-
helperText,
|
|
7295
|
-
children: [
|
|
7296
|
-
label,
|
|
7297
|
-
" ",
|
|
7298
|
-
optional && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(OptionalLabel, { children: translatedLabels.formFields.optionalLabel })
|
|
7299
|
-
]
|
|
7300
|
-
}
|
|
7301
|
-
),
|
|
7302
|
-
helperText && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(HelperText, { disabled, children: helperText }),
|
|
7303
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Popover2.Root, { open: isOpen, children: [
|
|
7304
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Popover2.Trigger, { asChild: true, type: void 0, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
7305
|
-
Select,
|
|
7296
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_styled_components35.ThemeProvider, { theme: colorsTheme.select, children: [
|
|
7297
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(SelectContainer, { margin, size, ref, children: [
|
|
7298
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
7299
|
+
Label3,
|
|
7306
7300
|
{
|
|
7307
|
-
id:
|
|
7301
|
+
id: selectLabelId,
|
|
7308
7302
|
disabled,
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
onKeyDown: handleSelectOnKeyDown,
|
|
7314
|
-
ref: selectRef,
|
|
7315
|
-
tabIndex: disabled ? -1 : tabIndex,
|
|
7316
|
-
role: "combobox",
|
|
7317
|
-
"aria-controls": isOpen ? listboxId : void 0,
|
|
7318
|
-
"aria-disabled": disabled,
|
|
7319
|
-
"aria-expanded": isOpen,
|
|
7320
|
-
"aria-haspopup": "listbox",
|
|
7321
|
-
"aria-labelledby": label ? selectLabelId : void 0,
|
|
7322
|
-
"aria-activedescendant": visualFocusIndex >= 0 ? `option-${visualFocusIndex}` : void 0,
|
|
7323
|
-
"aria-invalid": !!error,
|
|
7324
|
-
"aria-errormessage": error ? errorId : void 0,
|
|
7325
|
-
"aria-required": !disabled && !optional,
|
|
7326
|
-
"aria-label": label ? void 0 : ariaLabel,
|
|
7303
|
+
onClick: () => {
|
|
7304
|
+
selectRef?.current?.focus();
|
|
7305
|
+
},
|
|
7306
|
+
helperText,
|
|
7327
7307
|
children: [
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
|
|
7308
|
+
label,
|
|
7309
|
+
" ",
|
|
7310
|
+
optional && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(OptionalLabel, { children: translatedLabels.formFields.optionalLabel })
|
|
7311
|
+
]
|
|
7312
|
+
}
|
|
7313
|
+
),
|
|
7314
|
+
helperText && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(HelperText, { disabled, children: helperText }),
|
|
7315
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Popover2.Root, { open: isOpen, children: [
|
|
7316
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Popover2.Trigger, { asChild: true, type: void 0, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
7317
|
+
Select,
|
|
7318
|
+
{
|
|
7319
|
+
id: selectId,
|
|
7320
|
+
disabled,
|
|
7321
|
+
error,
|
|
7322
|
+
onBlur: handleSelectOnBlur,
|
|
7323
|
+
onClick: handleSelectOnClick,
|
|
7324
|
+
onFocus: handleSelectOnFocus,
|
|
7325
|
+
onKeyDown: handleSelectOnKeyDown,
|
|
7326
|
+
ref: selectRef,
|
|
7327
|
+
tabIndex: disabled ? -1 : tabIndex,
|
|
7328
|
+
role: "combobox",
|
|
7329
|
+
"aria-controls": isOpen ? listboxId : void 0,
|
|
7330
|
+
"aria-disabled": disabled,
|
|
7331
|
+
"aria-expanded": isOpen,
|
|
7332
|
+
"aria-haspopup": "listbox",
|
|
7333
|
+
"aria-labelledby": label ? selectLabelId : void 0,
|
|
7334
|
+
"aria-activedescendant": visualFocusIndex >= 0 ? `option-${visualFocusIndex}` : void 0,
|
|
7335
|
+
"aria-invalid": !!error,
|
|
7336
|
+
"aria-errormessage": error ? errorId : void 0,
|
|
7337
|
+
"aria-required": !disabled && !optional,
|
|
7338
|
+
"aria-label": label ? void 0 : ariaLabel,
|
|
7339
|
+
children: [
|
|
7340
|
+
multiple && Array.isArray(selectedOption) && selectedOption.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(SelectionIndicator, { children: [
|
|
7341
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SelectionNumber, { disabled, children: selectedOption.length }),
|
|
7342
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipWrapper, { condition: !disabled, label: translatedLabels.select.actionClearSelectionTitle, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7343
|
+
ClearOptionsAction,
|
|
7344
|
+
{
|
|
7345
|
+
disabled,
|
|
7346
|
+
onMouseDown: (event) => {
|
|
7347
|
+
event.preventDefault();
|
|
7348
|
+
},
|
|
7349
|
+
onClick: handleClearOptionsActionOnClick,
|
|
7350
|
+
tabIndex: -1,
|
|
7351
|
+
"aria-label": translatedLabels.select.actionClearSelectionTitle,
|
|
7352
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon_default, { icon: "clear" })
|
|
7353
|
+
}
|
|
7354
|
+
) })
|
|
7355
|
+
] }),
|
|
7356
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipWrapper, { condition: hasTooltip, label: getSelectedOptionLabel(placeholder, selectedOption), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(SearchableValueContainer, { children: [
|
|
7357
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7358
|
+
"input",
|
|
7359
|
+
{
|
|
7360
|
+
style: { display: "none" },
|
|
7361
|
+
name,
|
|
7362
|
+
disabled,
|
|
7363
|
+
value: multiple ? (Array.isArray(value) ? value : Array.isArray(innerValue) ? innerValue : []).join(",") : value ?? innerValue,
|
|
7364
|
+
readOnly: true,
|
|
7365
|
+
"aria-hidden": "true"
|
|
7366
|
+
}
|
|
7367
|
+
),
|
|
7368
|
+
searchable && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7369
|
+
SearchInput,
|
|
7370
|
+
{
|
|
7371
|
+
value: searchValue,
|
|
7372
|
+
disabled,
|
|
7373
|
+
onChange: handleSearchIOnChange,
|
|
7374
|
+
ref: selectSearchInputRef,
|
|
7375
|
+
autoComplete: "nope",
|
|
7376
|
+
autoCorrect: "nope",
|
|
7377
|
+
size: 1,
|
|
7378
|
+
"aria-labelledby": label ? selectLabelId : void 0
|
|
7379
|
+
}
|
|
7380
|
+
),
|
|
7381
|
+
(!searchable || searchValue === "") && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7382
|
+
SelectedOption,
|
|
7383
|
+
{
|
|
7384
|
+
disabled,
|
|
7385
|
+
atBackground: (multiple ? (value ?? innerValue).length === 0 : !(value ?? innerValue)) || searchable && isOpen,
|
|
7386
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SelectedOptionLabel, { onMouseEnter: handleOnMouseEnter, children: getSelectedOptionLabel(placeholder, selectedOption) })
|
|
7387
|
+
}
|
|
7388
|
+
)
|
|
7389
|
+
] }) }),
|
|
7390
|
+
!disabled && error && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ErrorIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon_default, { icon: "filled_error" }) }),
|
|
7391
|
+
searchable && searchValue.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipWrapper, { condition: !disabled, label: translatedLabels.select.actionClearSelectionTitle, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7392
|
+
ClearSearchAction,
|
|
7332
7393
|
{
|
|
7333
|
-
disabled,
|
|
7334
7394
|
onMouseDown: (event) => {
|
|
7335
7395
|
event.preventDefault();
|
|
7336
7396
|
},
|
|
7337
|
-
onClick:
|
|
7397
|
+
onClick: handleClearSearchActionOnClick,
|
|
7338
7398
|
tabIndex: -1,
|
|
7339
|
-
"aria-label": translatedLabels.select.
|
|
7399
|
+
"aria-label": translatedLabels.select.actionClearSearchTitle,
|
|
7340
7400
|
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon_default, { icon: "clear" })
|
|
7341
7401
|
}
|
|
7342
|
-
) })
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7356
|
-
|
|
7357
|
-
|
|
7358
|
-
|
|
7359
|
-
|
|
7360
|
-
disabled,
|
|
7361
|
-
onChange: handleSearchIOnChange,
|
|
7362
|
-
ref: selectSearchInputRef,
|
|
7363
|
-
autoComplete: "nope",
|
|
7364
|
-
autoCorrect: "nope",
|
|
7365
|
-
size: 1,
|
|
7366
|
-
"aria-labelledby": label ? selectLabelId : void 0
|
|
7367
|
-
}
|
|
7368
|
-
),
|
|
7369
|
-
(!searchable || searchValue === "") && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7370
|
-
SelectedOption,
|
|
7371
|
-
{
|
|
7372
|
-
disabled,
|
|
7373
|
-
atBackground: (multiple ? (value ?? innerValue).length === 0 : !(value ?? innerValue)) || searchable && isOpen,
|
|
7374
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SelectedOptionLabel, { onMouseEnter: handleOnMouseEnter, children: getSelectedOptionLabel(placeholder, selectedOption) })
|
|
7375
|
-
}
|
|
7376
|
-
)
|
|
7377
|
-
] }) }),
|
|
7378
|
-
!disabled && error && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ErrorIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon_default, { icon: "filled_error" }) }),
|
|
7379
|
-
searchable && searchValue.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Tooltip, { label: translatedLabels.select.actionClearSelectionTitle, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7380
|
-
ClearSearchAction,
|
|
7402
|
+
) }),
|
|
7403
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CollapseIndicator2, { disabled, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon_default, { icon: isOpen ? "keyboard_arrow_up" : "keyboard_arrow_down" }) })
|
|
7404
|
+
]
|
|
7405
|
+
}
|
|
7406
|
+
) }),
|
|
7407
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Popover2.Portal, { container: document.getElementById(`${selectId}-portal`), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7408
|
+
Popover2.Content,
|
|
7409
|
+
{
|
|
7410
|
+
sideOffset: 4,
|
|
7411
|
+
style: { zIndex: "310" },
|
|
7412
|
+
onOpenAutoFocus: (event) => {
|
|
7413
|
+
event.preventDefault();
|
|
7414
|
+
},
|
|
7415
|
+
onCloseAutoFocus: (event) => {
|
|
7416
|
+
event.preventDefault();
|
|
7417
|
+
},
|
|
7418
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7419
|
+
Listbox_default,
|
|
7381
7420
|
{
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
7421
|
+
id: listboxId,
|
|
7422
|
+
currentValue: value ?? innerValue,
|
|
7423
|
+
options: searchable ? filteredOptions : options,
|
|
7424
|
+
visualFocusIndex,
|
|
7425
|
+
lastOptionIndex,
|
|
7426
|
+
multiple,
|
|
7427
|
+
optional,
|
|
7428
|
+
optionalItem,
|
|
7429
|
+
searchable,
|
|
7430
|
+
handleOptionOnClick,
|
|
7431
|
+
styles: { width }
|
|
7389
7432
|
}
|
|
7390
|
-
)
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
) })
|
|
7395
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Popover2.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7396
|
-
Popover2.Content,
|
|
7397
|
-
{
|
|
7398
|
-
sideOffset: 4,
|
|
7399
|
-
style: { zIndex: "310" },
|
|
7400
|
-
onOpenAutoFocus: (event) => {
|
|
7401
|
-
event.preventDefault();
|
|
7402
|
-
},
|
|
7403
|
-
onCloseAutoFocus: (event) => {
|
|
7404
|
-
event.preventDefault();
|
|
7405
|
-
},
|
|
7406
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7407
|
-
Listbox_default,
|
|
7408
|
-
{
|
|
7409
|
-
id: listboxId,
|
|
7410
|
-
currentValue: value ?? innerValue,
|
|
7411
|
-
options: searchable ? filteredOptions : options,
|
|
7412
|
-
visualFocusIndex,
|
|
7413
|
-
lastOptionIndex,
|
|
7414
|
-
multiple,
|
|
7415
|
-
optional,
|
|
7416
|
-
optionalItem,
|
|
7417
|
-
searchable,
|
|
7418
|
-
handleOptionOnClick,
|
|
7419
|
-
styles: { width }
|
|
7420
|
-
}
|
|
7421
|
-
)
|
|
7422
|
-
}
|
|
7423
|
-
) })
|
|
7433
|
+
)
|
|
7434
|
+
}
|
|
7435
|
+
) })
|
|
7436
|
+
] }),
|
|
7437
|
+
!disabled && typeof error === "string" && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Error2, { id: errorId, role: "alert", "aria-live": error ? "assertive" : "off", children: error })
|
|
7424
7438
|
] }),
|
|
7425
|
-
|
|
7426
|
-
] })
|
|
7439
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { id: `${selectId}-portal`, style: { position: "absolute" } })
|
|
7440
|
+
] });
|
|
7427
7441
|
}
|
|
7428
7442
|
);
|
|
7429
7443
|
var sizes3 = {
|
|
@@ -7645,8 +7659,8 @@ var DxcPaginator = ({
|
|
|
7645
7659
|
const currentPageInternal = currentPage === -1 ? totalPages : currentPage;
|
|
7646
7660
|
const minItemsPerPage = currentPageInternal === 1 || currentPageInternal === 0 ? currentPageInternal : (currentPageInternal - 1) * itemsPerPage + 1;
|
|
7647
7661
|
const maxItemsPerPage = minItemsPerPage - 1 + itemsPerPage > totalItems ? totalItems : minItemsPerPage - 1 + itemsPerPage;
|
|
7648
|
-
const colorsTheme = (0,
|
|
7649
|
-
const translatedLabels = (0,
|
|
7662
|
+
const colorsTheme = (0, import_react43.useContext)(HalstackContext);
|
|
7663
|
+
const translatedLabels = (0, import_react43.useContext)(HalstackLanguageContext);
|
|
7650
7664
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_styled_components36.ThemeProvider, { theme: colorsTheme.paginator, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DxcPaginatorContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(LabelsContainer3, { children: [
|
|
7651
7665
|
itemsPerPageOptions && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(ItemsPageContainer, { children: [
|
|
7652
7666
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ItemsLabel, { children: translatedLabels.paginator.itemsPerPageText }),
|
|
@@ -7795,7 +7809,7 @@ var PageToSelectContainer = import_styled_components36.default.span`
|
|
|
7795
7809
|
var Paginator_default = DxcPaginator;
|
|
7796
7810
|
|
|
7797
7811
|
// src/table/Table.tsx
|
|
7798
|
-
var
|
|
7812
|
+
var import_react44 = require("react");
|
|
7799
7813
|
var import_styled_components37 = __toESM(require("styled-components"));
|
|
7800
7814
|
|
|
7801
7815
|
// src/table/dropdownTheme.ts
|
|
@@ -7871,7 +7885,7 @@ var DxcActionsCell = ({ actions }) => {
|
|
|
7871
7885
|
const actionIcons = actions.filter((action) => !action.options);
|
|
7872
7886
|
const actionDropdown = actions.find((action) => action.options);
|
|
7873
7887
|
const maxNumberOfActions = actionDropdown ? 2 : 3;
|
|
7874
|
-
const colorsTheme = (0,
|
|
7888
|
+
const colorsTheme = (0, import_react44.useContext)(HalstackContext);
|
|
7875
7889
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Flex_default, { gap: "0.5rem", alignItems: "center", children: [
|
|
7876
7890
|
actionIcons.map(
|
|
7877
7891
|
(action, index) => index < maxNumberOfActions && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
@@ -7900,7 +7914,7 @@ var DxcActionsCell = ({ actions }) => {
|
|
|
7900
7914
|
] });
|
|
7901
7915
|
};
|
|
7902
7916
|
var DxcTable = ({ children, margin, mode = "default" }) => {
|
|
7903
|
-
const colorsTheme = (0,
|
|
7917
|
+
const colorsTheme = (0, import_react44.useContext)(HalstackContext);
|
|
7904
7918
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_styled_components37.ThemeProvider, { theme: colorsTheme.table, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DxcTableContainer, { margin, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DxcTableContent, { mode, children }) }) });
|
|
7905
7919
|
};
|
|
7906
7920
|
var calculateWidth7 = (margin) => `calc(100% - ${getMargin(margin, "left")} - ${getMargin(margin, "right")})`;
|
|
@@ -8134,9 +8148,9 @@ var DxcDataGrid = ({
|
|
|
8134
8148
|
totalItems,
|
|
8135
8149
|
defaultPage = 1
|
|
8136
8150
|
}) => {
|
|
8137
|
-
const [rowsToRender, setRowsToRender] = (0,
|
|
8138
|
-
const colorsTheme = (0,
|
|
8139
|
-
const [page, changePage] = (0,
|
|
8151
|
+
const [rowsToRender, setRowsToRender] = (0, import_react45.useState)([...rows]);
|
|
8152
|
+
const colorsTheme = (0, import_react45.useContext)(HalstackContext);
|
|
8153
|
+
const [page, changePage] = (0, import_react45.useState)(defaultPage);
|
|
8140
8154
|
const goToPage = (newPage) => {
|
|
8141
8155
|
if (onPageChange) {
|
|
8142
8156
|
onPageChange(newPage);
|
|
@@ -8154,7 +8168,7 @@ var DxcDataGrid = ({
|
|
|
8154
8168
|
}
|
|
8155
8169
|
setSortColumns(newSortColumns);
|
|
8156
8170
|
};
|
|
8157
|
-
const columnsToRender = (0,
|
|
8171
|
+
const columnsToRender = (0, import_react45.useMemo)(() => {
|
|
8158
8172
|
let expectedColumns = columns.map((column) => convertToRDGColumns(column, summaryRow));
|
|
8159
8173
|
if (expandable) {
|
|
8160
8174
|
expectedColumns = [
|
|
@@ -8219,12 +8233,12 @@ var DxcDataGrid = ({
|
|
|
8219
8233
|
}
|
|
8220
8234
|
return expectedColumns;
|
|
8221
8235
|
}, [selectable, expandable, columns, rowsToRender, onSelectRows, rows, summaryRow, uniqueRowId, selectedRows]);
|
|
8222
|
-
const [columnsOrder, setColumnsOrder] = (0,
|
|
8223
|
-
const [sortColumns, setSortColumns] = (0,
|
|
8224
|
-
(0,
|
|
8236
|
+
const [columnsOrder, setColumnsOrder] = (0, import_react45.useState)(() => columnsToRender.map((_, index) => index));
|
|
8237
|
+
const [sortColumns, setSortColumns] = (0, import_react45.useState)([]);
|
|
8238
|
+
(0, import_react45.useEffect)(() => {
|
|
8225
8239
|
setColumnsOrder(Array.from({ length: columnsToRender.length }, (_, index) => index));
|
|
8226
8240
|
}, [columnsToRender.length]);
|
|
8227
|
-
(0,
|
|
8241
|
+
(0, import_react45.useEffect)(() => {
|
|
8228
8242
|
const finalRows = [...rows];
|
|
8229
8243
|
if (expandable) {
|
|
8230
8244
|
finalRows.filter((row) => {
|
|
@@ -8236,7 +8250,7 @@ var DxcDataGrid = ({
|
|
|
8236
8250
|
}
|
|
8237
8251
|
setRowsToRender(finalRows);
|
|
8238
8252
|
}, [rows]);
|
|
8239
|
-
const reorderedColumns = (0,
|
|
8253
|
+
const reorderedColumns = (0, import_react45.useMemo)(
|
|
8240
8254
|
() => (
|
|
8241
8255
|
// Array ordered by columnsOrder
|
|
8242
8256
|
columnsOrder.map((index) => columnsToRender[index])
|
|
@@ -8268,7 +8282,7 @@ var DxcDataGrid = ({
|
|
|
8268
8282
|
onGridRowsChange(newRows);
|
|
8269
8283
|
}
|
|
8270
8284
|
};
|
|
8271
|
-
const sortedRows = (0,
|
|
8285
|
+
const sortedRows = (0, import_react45.useMemo)(() => {
|
|
8272
8286
|
const sortFunctions = getCustomSortFn(columns);
|
|
8273
8287
|
if (!onSort) {
|
|
8274
8288
|
if (sortColumns.length > 0 && uniqueRowId) {
|
|
@@ -8297,12 +8311,12 @@ var DxcDataGrid = ({
|
|
|
8297
8311
|
}
|
|
8298
8312
|
return rowsToRender;
|
|
8299
8313
|
}, [expandable, rowsToRender, sortColumns, uniqueRowId]);
|
|
8300
|
-
const minItemsPerPageIndex = (0,
|
|
8301
|
-
const maxItemsPerPageIndex = (0,
|
|
8314
|
+
const minItemsPerPageIndex = (0, import_react45.useMemo)(() => getMinItemsPerPageIndex(page, itemsPerPage, page), [itemsPerPage, page]);
|
|
8315
|
+
const maxItemsPerPageIndex = (0, import_react45.useMemo)(
|
|
8302
8316
|
() => getMaxItemsPerPageIndex(minItemsPerPageIndex, itemsPerPage, rows, page),
|
|
8303
8317
|
[itemsPerPage, minItemsPerPageIndex, page, rows]
|
|
8304
8318
|
);
|
|
8305
|
-
const filteredRows = (0,
|
|
8319
|
+
const filteredRows = (0, import_react45.useMemo)(() => {
|
|
8306
8320
|
if (onSort && sortColumns?.length > 0) {
|
|
8307
8321
|
onSort?.(sortColumns?.[0]);
|
|
8308
8322
|
}
|
|
@@ -8346,19 +8360,19 @@ DxcDataGrid.ActionsCell = DxcActionsCell;
|
|
|
8346
8360
|
var DataGrid_default = DxcDataGrid;
|
|
8347
8361
|
|
|
8348
8362
|
// src/date-input/DateInput.tsx
|
|
8349
|
-
var
|
|
8363
|
+
var import_react53 = require("react");
|
|
8350
8364
|
var import_dayjs3 = __toESM(require("dayjs"));
|
|
8351
8365
|
var import_styled_components45 = __toESM(require("styled-components"));
|
|
8352
8366
|
var Popover4 = __toESM(require("@radix-ui/react-popover"));
|
|
8353
8367
|
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"));
|
|
8354
8368
|
|
|
8355
8369
|
// src/date-input/DatePicker.tsx
|
|
8356
|
-
var
|
|
8370
|
+
var import_react48 = require("react");
|
|
8357
8371
|
var import_dayjs2 = __toESM(require("dayjs"));
|
|
8358
8372
|
var import_styled_components41 = __toESM(require("styled-components"));
|
|
8359
8373
|
|
|
8360
8374
|
// src/date-input/Calendar.tsx
|
|
8361
|
-
var
|
|
8375
|
+
var import_react46 = require("react");
|
|
8362
8376
|
var import_styled_components39 = __toESM(require("styled-components"));
|
|
8363
8377
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
8364
8378
|
var getDays = (innerDate) => {
|
|
@@ -8402,11 +8416,11 @@ var Calendar = ({
|
|
|
8402
8416
|
onDaySelect,
|
|
8403
8417
|
today: today2
|
|
8404
8418
|
}) => {
|
|
8405
|
-
const [dateToFocus, setDateToFocus] = (0,
|
|
8406
|
-
const [isFocusable, setIsFocusable] = (0,
|
|
8407
|
-
const id = (0,
|
|
8408
|
-
const translatedLabels = (0,
|
|
8409
|
-
const dayCells = (0,
|
|
8419
|
+
const [dateToFocus, setDateToFocus] = (0, import_react46.useState)(getDateToFocus(selectedDate, innerDate, today2));
|
|
8420
|
+
const [isFocusable, setIsFocusable] = (0, import_react46.useState)(false);
|
|
8421
|
+
const id = (0, import_react46.useId)();
|
|
8422
|
+
const translatedLabels = (0, import_react46.useContext)(HalstackLanguageContext);
|
|
8423
|
+
const dayCells = (0, import_react46.useMemo)(() => getDays(innerDate), [innerDate]);
|
|
8410
8424
|
const onDateClickHandler = (date) => {
|
|
8411
8425
|
const newDate = innerDate.set("month", date.month).set("date", date.day);
|
|
8412
8426
|
onDaySelect(newDate);
|
|
@@ -8424,13 +8438,13 @@ var Calendar = ({
|
|
|
8424
8438
|
setDateToFocus(date);
|
|
8425
8439
|
setIsFocusable(true);
|
|
8426
8440
|
};
|
|
8427
|
-
(0,
|
|
8441
|
+
(0, import_react46.useEffect)(() => {
|
|
8428
8442
|
if (isFocusable) {
|
|
8429
8443
|
document.getElementById(`${id}_day_${dateToFocus.get("date")}_month${dateToFocus.get("month")}`)?.focus();
|
|
8430
8444
|
setIsFocusable(false);
|
|
8431
8445
|
}
|
|
8432
8446
|
}, [dateToFocus, isFocusable]);
|
|
8433
|
-
(0,
|
|
8447
|
+
(0, import_react46.useEffect)(() => {
|
|
8434
8448
|
if (dateToFocus.get("month") !== innerDate.get("month") || dateToFocus.get("year") !== innerDate.get("year")) {
|
|
8435
8449
|
setDateToFocus(getDateToFocus(selectedDate, innerDate, today2));
|
|
8436
8450
|
}
|
|
@@ -8591,11 +8605,11 @@ var DayCellButton = import_styled_components39.default.button`
|
|
|
8591
8605
|
background-color: ${(props) => props.selected ? props.theme.dateInput.pickerSelectedBackgroundColor : "transparent"};
|
|
8592
8606
|
color: ${(props) => props.selected ? props.theme.dateInput.pickerSelectedFontColor : props.isCurrentDay ? props.theme.dateInput.pickerCurrentDateFontColor : !props.actualMonth ? props.theme.dateInput.pickerNonCurrentMonthFontColor : props.theme.dateInput.pickerFontColor};
|
|
8593
8607
|
`;
|
|
8594
|
-
var Calendar_default = (0,
|
|
8608
|
+
var Calendar_default = (0, import_react46.memo)(Calendar);
|
|
8595
8609
|
|
|
8596
8610
|
// src/date-input/YearPicker.tsx
|
|
8597
8611
|
var import_dayjs = __toESM(require("dayjs"));
|
|
8598
|
-
var
|
|
8612
|
+
var import_react47 = require("react");
|
|
8599
8613
|
var import_styled_components40 = __toESM(require("styled-components"));
|
|
8600
8614
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
8601
8615
|
var getYearsArray = () => {
|
|
@@ -8607,9 +8621,9 @@ var getYearsArray = () => {
|
|
|
8607
8621
|
};
|
|
8608
8622
|
var yearList = getYearsArray();
|
|
8609
8623
|
var YearPicker = ({ onYearSelect, selectedDate, today: today2 }) => {
|
|
8610
|
-
const id = (0,
|
|
8611
|
-
const [yearToFocus, setYearToFocus] = (0,
|
|
8612
|
-
(0,
|
|
8624
|
+
const id = (0, import_react47.useId)();
|
|
8625
|
+
const [yearToFocus, setYearToFocus] = (0, import_react47.useState)(selectedDate ? selectedDate.get("year") : (0, import_dayjs.default)().get("year"));
|
|
8626
|
+
(0, import_react47.useEffect)(() => {
|
|
8613
8627
|
const yearToFocusEl = document.getElementById(`${id}_year_${yearToFocus}`);
|
|
8614
8628
|
yearToFocusEl?.scrollIntoView?.({ block: "nearest", inline: "start" });
|
|
8615
8629
|
yearToFocusEl?.focus();
|
|
@@ -8696,16 +8710,16 @@ var YearPickerButton = import_styled_components40.default.button`
|
|
|
8696
8710
|
background-color: ${(props) => props.theme.dateInput.pickerActiveBackgroundColor} !important;
|
|
8697
8711
|
}
|
|
8698
8712
|
`;
|
|
8699
|
-
var YearPicker_default = (0,
|
|
8713
|
+
var YearPicker_default = (0, import_react47.memo)(YearPicker);
|
|
8700
8714
|
|
|
8701
8715
|
// src/date-input/DatePicker.tsx
|
|
8702
8716
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
8703
8717
|
var today = (0, import_dayjs2.default)();
|
|
8704
8718
|
var DatePicker = ({ date, onDateSelect, id }) => {
|
|
8705
|
-
const [innerDate, setInnerDate] = (0,
|
|
8706
|
-
const [content, setContent] = (0,
|
|
8719
|
+
const [innerDate, setInnerDate] = (0, import_react48.useState)(date?.isValid() ? date : (0, import_dayjs2.default)());
|
|
8720
|
+
const [content, setContent] = (0, import_react48.useState)("calendar");
|
|
8707
8721
|
const selectedDate = date?.isValid() ? date : (0, import_dayjs2.default)(null);
|
|
8708
|
-
const translatedLabels = (0,
|
|
8722
|
+
const translatedLabels = (0, import_react48.useContext)(HalstackLanguageContext);
|
|
8709
8723
|
const handleDateSelect = (chosenDate) => {
|
|
8710
8724
|
setInnerDate(chosenDate);
|
|
8711
8725
|
onDateSelect(chosenDate);
|
|
@@ -8831,23 +8845,23 @@ var HeaderYearTriggerLabel = import_styled_components41.default.span`
|
|
|
8831
8845
|
font-family: ${(props) => props.theme.dateInput.pickerFontFamily};
|
|
8832
8846
|
font-size: ${(props) => props.theme.dateInput.pickerHeaderFontSize};
|
|
8833
8847
|
`;
|
|
8834
|
-
var DatePicker_default = (0,
|
|
8848
|
+
var DatePicker_default = (0, import_react48.memo)(DatePicker);
|
|
8835
8849
|
|
|
8836
8850
|
// src/text-input/TextInput.tsx
|
|
8837
8851
|
var Popover3 = __toESM(require("@radix-ui/react-popover"));
|
|
8838
|
-
var
|
|
8852
|
+
var import_react52 = require("react");
|
|
8839
8853
|
var import_styled_components44 = __toESM(require("styled-components"));
|
|
8840
8854
|
|
|
8841
8855
|
// src/number-input/NumberInputContext.tsx
|
|
8842
|
-
var
|
|
8843
|
-
var NumberInputContext_default = (0,
|
|
8856
|
+
var import_react49 = require("react");
|
|
8857
|
+
var NumberInputContext_default = (0, import_react49.createContext)(null);
|
|
8844
8858
|
|
|
8845
8859
|
// src/text-input/Suggestions.tsx
|
|
8846
|
-
var
|
|
8860
|
+
var import_react51 = require("react");
|
|
8847
8861
|
var import_styled_components43 = __toESM(require("styled-components"));
|
|
8848
8862
|
|
|
8849
8863
|
// src/text-input/Suggestion.tsx
|
|
8850
|
-
var
|
|
8864
|
+
var import_react50 = require("react");
|
|
8851
8865
|
var import_styled_components42 = __toESM(require("styled-components"));
|
|
8852
8866
|
|
|
8853
8867
|
// src/text-input/utils.ts
|
|
@@ -8925,7 +8939,7 @@ var Suggestion = ({
|
|
|
8925
8939
|
visuallyFocused,
|
|
8926
8940
|
highlighted
|
|
8927
8941
|
}) => {
|
|
8928
|
-
const matchedSuggestion = (0,
|
|
8942
|
+
const matchedSuggestion = (0, import_react50.useMemo)(() => {
|
|
8929
8943
|
const regEx = new RegExp(transformSpecialChars(value), "i");
|
|
8930
8944
|
return { matchedWords: suggestion.match(regEx), noMatchedWords: suggestion.replace(regEx, "") };
|
|
8931
8945
|
}, [value, suggestion]);
|
|
@@ -8946,7 +8960,7 @@ var Suggestion = ({
|
|
|
8946
8960
|
}
|
|
8947
8961
|
);
|
|
8948
8962
|
};
|
|
8949
|
-
var Suggestion_default = (0,
|
|
8963
|
+
var Suggestion_default = (0, import_react50.memo)(Suggestion);
|
|
8950
8964
|
|
|
8951
8965
|
// src/text-input/Suggestions.tsx
|
|
8952
8966
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
@@ -9002,9 +9016,9 @@ var Suggestions = ({
|
|
|
9002
9016
|
suggestionOnClick,
|
|
9003
9017
|
styles
|
|
9004
9018
|
}) => {
|
|
9005
|
-
const translatedLabels = (0,
|
|
9006
|
-
const listboxRef = (0,
|
|
9007
|
-
(0,
|
|
9019
|
+
const translatedLabels = (0, import_react51.useContext)(HalstackLanguageContext);
|
|
9020
|
+
const listboxRef = (0, import_react51.useRef)(null);
|
|
9021
|
+
(0, import_react51.useEffect)(() => {
|
|
9008
9022
|
const visualFocusedOptionEl = listboxRef?.current?.querySelectorAll("[role='option']")[visualFocusIndex];
|
|
9009
9023
|
visualFocusedOptionEl?.scrollIntoView?.({
|
|
9010
9024
|
block: "nearest",
|
|
@@ -9046,7 +9060,7 @@ var Suggestions = ({
|
|
|
9046
9060
|
}
|
|
9047
9061
|
);
|
|
9048
9062
|
};
|
|
9049
|
-
var Suggestions_default = (0,
|
|
9063
|
+
var Suggestions_default = (0, import_react51.memo)(Suggestions);
|
|
9050
9064
|
|
|
9051
9065
|
// src/text-input/TextInput.tsx
|
|
9052
9066
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
@@ -9174,7 +9188,7 @@ var ErrorMessageContainer = import_styled_components44.default.span`
|
|
|
9174
9188
|
margin-top: 0.25rem;
|
|
9175
9189
|
`;
|
|
9176
9190
|
var AutosuggestWrapper = ({ condition, wrapper, children }) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_jsx_runtime51.Fragment, { children: condition ? wrapper(children) : children });
|
|
9177
|
-
var DxcTextInput = (0,
|
|
9191
|
+
var DxcTextInput = (0, import_react52.forwardRef)(
|
|
9178
9192
|
({
|
|
9179
9193
|
alignment = "left",
|
|
9180
9194
|
label,
|
|
@@ -9203,21 +9217,21 @@ var DxcTextInput = (0, import_react51.forwardRef)(
|
|
|
9203
9217
|
tabIndex = 0,
|
|
9204
9218
|
ariaLabel = "Text input"
|
|
9205
9219
|
}, ref) => {
|
|
9206
|
-
const inputId = `input-${(0,
|
|
9220
|
+
const inputId = `input-${(0, import_react52.useId)()}`;
|
|
9207
9221
|
const autosuggestId = `suggestions-${inputId}`;
|
|
9208
9222
|
const errorId = `error-${inputId}`;
|
|
9209
|
-
const colorsTheme = (0,
|
|
9210
|
-
const translatedLabels = (0,
|
|
9211
|
-
const numberInputContext = (0,
|
|
9212
|
-
const inputRef = (0,
|
|
9213
|
-
const inputContainerRef = (0,
|
|
9214
|
-
const actionRef = (0,
|
|
9215
|
-
const [innerValue, setInnerValue] = (0,
|
|
9216
|
-
const [isOpen, changeIsOpen] = (0,
|
|
9217
|
-
const [isSearching, changeIsSearching] = (0,
|
|
9218
|
-
const [isAutosuggestError, changeIsAutosuggestError] = (0,
|
|
9219
|
-
const [filteredSuggestions, changeFilteredSuggestions] = (0,
|
|
9220
|
-
const [visualFocusIndex, changeVisualFocusIndex] = (0,
|
|
9223
|
+
const colorsTheme = (0, import_react52.useContext)(HalstackContext);
|
|
9224
|
+
const translatedLabels = (0, import_react52.useContext)(HalstackLanguageContext);
|
|
9225
|
+
const numberInputContext = (0, import_react52.useContext)(NumberInputContext_default);
|
|
9226
|
+
const inputRef = (0, import_react52.useRef)(null);
|
|
9227
|
+
const inputContainerRef = (0, import_react52.useRef)(null);
|
|
9228
|
+
const actionRef = (0, import_react52.useRef)(null);
|
|
9229
|
+
const [innerValue, setInnerValue] = (0, import_react52.useState)(defaultValue);
|
|
9230
|
+
const [isOpen, changeIsOpen] = (0, import_react52.useState)(false);
|
|
9231
|
+
const [isSearching, changeIsSearching] = (0, import_react52.useState)(false);
|
|
9232
|
+
const [isAutosuggestError, changeIsAutosuggestError] = (0, import_react52.useState)(false);
|
|
9233
|
+
const [filteredSuggestions, changeFilteredSuggestions] = (0, import_react52.useState)([]);
|
|
9234
|
+
const [visualFocusIndex, changeVisualFocusIndex] = (0, import_react52.useState)(-1);
|
|
9221
9235
|
const width = useWidth_default(inputContainerRef.current);
|
|
9222
9236
|
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;
|
|
9223
9237
|
const openSuggestions = () => {
|
|
@@ -9427,7 +9441,7 @@ var DxcTextInput = (0, import_react51.forwardRef)(
|
|
|
9427
9441
|
inputRef.current?.setAttribute("type", type);
|
|
9428
9442
|
}
|
|
9429
9443
|
};
|
|
9430
|
-
(0,
|
|
9444
|
+
(0, import_react52.useEffect)(() => {
|
|
9431
9445
|
if (typeof suggestions === "function") {
|
|
9432
9446
|
changeIsSearching(true);
|
|
9433
9447
|
changeIsAutosuggestError(false);
|
|
@@ -9463,163 +9477,166 @@ var DxcTextInput = (0, import_react51.forwardRef)(
|
|
|
9463
9477
|
}
|
|
9464
9478
|
return void 0;
|
|
9465
9479
|
}, [value, innerValue, suggestions, numberInputContext]);
|
|
9466
|
-
return /* @__PURE__ */ (0, import_jsx_runtime51.
|
|
9467
|
-
|
|
9468
|
-
label,
|
|
9469
|
-
|
|
9470
|
-
|
|
9471
|
-
|
|
9472
|
-
|
|
9473
|
-
|
|
9474
|
-
|
|
9475
|
-
|
|
9476
|
-
|
|
9477
|
-
|
|
9478
|
-
/* @__PURE__ */ (0, import_jsx_runtime51.
|
|
9479
|
-
|
|
9480
|
-
|
|
9481
|
-
|
|
9482
|
-
|
|
9483
|
-
|
|
9484
|
-
|
|
9485
|
-
|
|
9486
|
-
|
|
9487
|
-
|
|
9488
|
-
|
|
9489
|
-
|
|
9490
|
-
Popover3.
|
|
9491
|
-
|
|
9492
|
-
|
|
9493
|
-
|
|
9494
|
-
|
|
9495
|
-
event
|
|
9496
|
-
|
|
9497
|
-
|
|
9498
|
-
event
|
|
9499
|
-
|
|
9500
|
-
|
|
9501
|
-
|
|
9502
|
-
|
|
9503
|
-
id: autosuggestId,
|
|
9504
|
-
value: value ?? innerValue,
|
|
9505
|
-
suggestions: filteredSuggestions,
|
|
9506
|
-
visualFocusIndex,
|
|
9507
|
-
highlightedSuggestions: typeof suggestions !== "function",
|
|
9508
|
-
searchHasErrors: isAutosuggestError,
|
|
9509
|
-
isSearching,
|
|
9510
|
-
suggestionOnClick: (suggestion) => {
|
|
9511
|
-
changeValue(suggestion);
|
|
9512
|
-
closeSuggestions();
|
|
9513
|
-
},
|
|
9514
|
-
styles: { width }
|
|
9515
|
-
}
|
|
9516
|
-
)
|
|
9517
|
-
}
|
|
9518
|
-
) })
|
|
9519
|
-
] }),
|
|
9520
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
9521
|
-
InputContainer,
|
|
9522
|
-
{
|
|
9523
|
-
error: !!error,
|
|
9524
|
-
disabled,
|
|
9525
|
-
readOnly,
|
|
9526
|
-
onClick: handleInputContainerOnClick,
|
|
9527
|
-
onMouseDown: handleInputContainerOnMouseDown,
|
|
9528
|
-
ref: inputContainerRef,
|
|
9529
|
-
children: [
|
|
9530
|
-
prefix && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Prefix, { disabled, children: prefix }),
|
|
9531
|
-
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(Flex_default, { gap: "0.25rem", alignItems: "center", grow: 1, children: [
|
|
9532
|
-
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9533
|
-
Input,
|
|
9480
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_styled_components44.ThemeProvider, { theme: colorsTheme.textInput, children: [
|
|
9481
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(TextInputContainer, { margin, size, ref, children: [
|
|
9482
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(Label4, { htmlFor: inputId, disabled, hasHelperText: !!helperText, children: [
|
|
9483
|
+
label,
|
|
9484
|
+
" ",
|
|
9485
|
+
optional && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(OptionalLabel2, { children: translatedLabels.formFields.optionalLabel })
|
|
9486
|
+
] }),
|
|
9487
|
+
helperText && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(HelperText2, { disabled, children: helperText }),
|
|
9488
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9489
|
+
AutosuggestWrapper,
|
|
9490
|
+
{
|
|
9491
|
+
condition: hasSuggestions(suggestions),
|
|
9492
|
+
wrapper: (children) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(Popover3.Root, { open: isOpen && (filteredSuggestions.length > 0 || isSearching || isAutosuggestError), children: [
|
|
9493
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9494
|
+
Popover3.Trigger,
|
|
9495
|
+
{
|
|
9496
|
+
asChild: true,
|
|
9497
|
+
type: void 0,
|
|
9498
|
+
"aria-controls": void 0,
|
|
9499
|
+
"aria-haspopup": void 0,
|
|
9500
|
+
"aria-expanded": void 0,
|
|
9501
|
+
children
|
|
9502
|
+
}
|
|
9503
|
+
),
|
|
9504
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Popover3.Portal, { container: document.getElementById(`${inputId}-portal`), children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9505
|
+
Popover3.Content,
|
|
9506
|
+
{
|
|
9507
|
+
sideOffset: 5,
|
|
9508
|
+
style: { zIndex: "320" },
|
|
9509
|
+
onOpenAutoFocus: (event) => {
|
|
9510
|
+
event.preventDefault();
|
|
9511
|
+
},
|
|
9512
|
+
onCloseAutoFocus: (event) => {
|
|
9513
|
+
event.preventDefault();
|
|
9514
|
+
},
|
|
9515
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9516
|
+
Suggestions_default,
|
|
9534
9517
|
{
|
|
9535
|
-
|
|
9536
|
-
id: inputId,
|
|
9537
|
-
name,
|
|
9518
|
+
id: autosuggestId,
|
|
9538
9519
|
value: value ?? innerValue,
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
|
|
9545
|
-
|
|
9520
|
+
suggestions: filteredSuggestions,
|
|
9521
|
+
visualFocusIndex,
|
|
9522
|
+
highlightedSuggestions: typeof suggestions !== "function",
|
|
9523
|
+
searchHasErrors: isAutosuggestError,
|
|
9524
|
+
isSearching,
|
|
9525
|
+
suggestionOnClick: (suggestion) => {
|
|
9526
|
+
changeValue(suggestion);
|
|
9527
|
+
closeSuggestions();
|
|
9546
9528
|
},
|
|
9547
|
-
|
|
9548
|
-
disabled,
|
|
9549
|
-
readOnly,
|
|
9550
|
-
ref: inputRef,
|
|
9551
|
-
pattern,
|
|
9552
|
-
minLength,
|
|
9553
|
-
maxLength,
|
|
9554
|
-
autoComplete: autocomplete === "off" ? "nope" : autocomplete,
|
|
9555
|
-
tabIndex,
|
|
9556
|
-
type: "text",
|
|
9557
|
-
role: hasSuggestions(suggestions) ? "combobox" : void 0,
|
|
9558
|
-
"aria-autocomplete": hasSuggestions(suggestions) ? "list" : void 0,
|
|
9559
|
-
"aria-controls": hasSuggestions(suggestions) ? autosuggestId : void 0,
|
|
9560
|
-
"aria-expanded": hasSuggestions(suggestions) ? isOpen : void 0,
|
|
9561
|
-
"aria-haspopup": hasSuggestions(suggestions) ? "listbox" : void 0,
|
|
9562
|
-
"aria-activedescendant": hasSuggestions(suggestions) && isOpen && visualFocusIndex !== -1 ? `suggestion-${visualFocusIndex}` : void 0,
|
|
9563
|
-
"aria-invalid": !!error,
|
|
9564
|
-
"aria-errormessage": error ? errorId : void 0,
|
|
9565
|
-
"aria-required": !disabled && !optional,
|
|
9566
|
-
"aria-label": label ? void 0 : ariaLabel
|
|
9529
|
+
styles: { width }
|
|
9567
9530
|
}
|
|
9568
|
-
)
|
|
9569
|
-
|
|
9570
|
-
|
|
9571
|
-
|
|
9572
|
-
|
|
9573
|
-
|
|
9574
|
-
|
|
9575
|
-
|
|
9576
|
-
|
|
9577
|
-
|
|
9578
|
-
|
|
9579
|
-
|
|
9531
|
+
)
|
|
9532
|
+
}
|
|
9533
|
+
) })
|
|
9534
|
+
] }),
|
|
9535
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
9536
|
+
InputContainer,
|
|
9537
|
+
{
|
|
9538
|
+
error: !!error,
|
|
9539
|
+
disabled,
|
|
9540
|
+
readOnly,
|
|
9541
|
+
onClick: handleInputContainerOnClick,
|
|
9542
|
+
onMouseDown: handleInputContainerOnMouseDown,
|
|
9543
|
+
ref: inputContainerRef,
|
|
9544
|
+
children: [
|
|
9545
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Prefix, { disabled, children: prefix }),
|
|
9546
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(Flex_default, { gap: "0.25rem", alignItems: "center", grow: 1, children: [
|
|
9580
9547
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9548
|
+
Input,
|
|
9549
|
+
{
|
|
9550
|
+
alignment,
|
|
9551
|
+
id: inputId,
|
|
9552
|
+
name,
|
|
9553
|
+
value: value ?? innerValue,
|
|
9554
|
+
placeholder,
|
|
9555
|
+
onBlur: handleInputOnBlur,
|
|
9556
|
+
onChange: handleInputOnChange,
|
|
9557
|
+
onFocus: !readOnly ? openSuggestions : void 0,
|
|
9558
|
+
onKeyDown: !readOnly ? handleInputOnKeyDown : void 0,
|
|
9559
|
+
onMouseDown: (event) => {
|
|
9560
|
+
event.stopPropagation();
|
|
9561
|
+
},
|
|
9562
|
+
onWheel: numberInputContext?.typeNumber === "number" ? handleNumberInputWheel : void 0,
|
|
9563
|
+
disabled,
|
|
9564
|
+
readOnly,
|
|
9565
|
+
ref: inputRef,
|
|
9566
|
+
pattern,
|
|
9567
|
+
minLength,
|
|
9568
|
+
maxLength,
|
|
9569
|
+
autoComplete: autocomplete === "off" ? "nope" : autocomplete,
|
|
9570
|
+
tabIndex,
|
|
9571
|
+
type: "text",
|
|
9572
|
+
role: hasSuggestions(suggestions) ? "combobox" : void 0,
|
|
9573
|
+
"aria-autocomplete": hasSuggestions(suggestions) ? "list" : void 0,
|
|
9574
|
+
"aria-controls": hasSuggestions(suggestions) ? autosuggestId : void 0,
|
|
9575
|
+
"aria-expanded": hasSuggestions(suggestions) ? isOpen : void 0,
|
|
9576
|
+
"aria-haspopup": hasSuggestions(suggestions) ? "listbox" : void 0,
|
|
9577
|
+
"aria-activedescendant": hasSuggestions(suggestions) && isOpen && visualFocusIndex !== -1 ? `suggestion-${visualFocusIndex}` : void 0,
|
|
9578
|
+
"aria-invalid": !!error,
|
|
9579
|
+
"aria-errormessage": error ? errorId : void 0,
|
|
9580
|
+
"aria-required": !disabled && !optional,
|
|
9581
|
+
"aria-label": label ? void 0 : ariaLabel
|
|
9582
|
+
}
|
|
9583
|
+
),
|
|
9584
|
+
!disabled && error && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ErrorIcon2, { "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Icon_default, { icon: "filled_error" }) }),
|
|
9585
|
+
!disabled && !readOnly && clearable && (value ?? innerValue).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9581
9586
|
ActionIcon_default,
|
|
9582
9587
|
{
|
|
9583
|
-
onClick:
|
|
9584
|
-
icon: "
|
|
9588
|
+
onClick: handleClearActionOnClick,
|
|
9589
|
+
icon: "close",
|
|
9585
9590
|
tabIndex,
|
|
9586
|
-
|
|
9587
|
-
title: translatedLabels.numberInput.decrementValueTitle,
|
|
9588
|
-
disabled
|
|
9591
|
+
title: !disabled ? translatedLabels.textInput.clearFieldActionTitle : void 0
|
|
9589
9592
|
}
|
|
9590
9593
|
),
|
|
9591
|
-
/* @__PURE__ */ (0, import_jsx_runtime51.
|
|
9594
|
+
numberInputContext?.typeNumber === "number" && numberInputContext?.showControls && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
9595
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9596
|
+
ActionIcon_default,
|
|
9597
|
+
{
|
|
9598
|
+
onClick: !readOnly ? handleDecrementActionOnClick : void 0,
|
|
9599
|
+
icon: "remove",
|
|
9600
|
+
tabIndex,
|
|
9601
|
+
ref: actionRef,
|
|
9602
|
+
title: !disabled ? translatedLabels.numberInput.decrementValueTitle : void 0,
|
|
9603
|
+
disabled
|
|
9604
|
+
}
|
|
9605
|
+
),
|
|
9606
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9607
|
+
ActionIcon_default,
|
|
9608
|
+
{
|
|
9609
|
+
onClick: !readOnly ? handleIncrementActionOnClick : void 0,
|
|
9610
|
+
icon: "add",
|
|
9611
|
+
tabIndex,
|
|
9612
|
+
ref: actionRef,
|
|
9613
|
+
title: !disabled ? translatedLabels.numberInput.incrementValueTitle : void 0,
|
|
9614
|
+
disabled
|
|
9615
|
+
}
|
|
9616
|
+
)
|
|
9617
|
+
] }),
|
|
9618
|
+
action && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9592
9619
|
ActionIcon_default,
|
|
9593
9620
|
{
|
|
9594
|
-
onClick: !readOnly ?
|
|
9595
|
-
icon:
|
|
9621
|
+
onClick: !readOnly ? action.onClick : void 0,
|
|
9622
|
+
icon: action.icon,
|
|
9596
9623
|
tabIndex,
|
|
9597
9624
|
ref: actionRef,
|
|
9598
|
-
title:
|
|
9625
|
+
title: !disabled ? action.title ?? void 0 : void 0,
|
|
9599
9626
|
disabled
|
|
9600
9627
|
}
|
|
9601
9628
|
)
|
|
9602
9629
|
] }),
|
|
9603
|
-
|
|
9604
|
-
|
|
9605
|
-
|
|
9606
|
-
|
|
9607
|
-
|
|
9608
|
-
|
|
9609
|
-
|
|
9610
|
-
|
|
9611
|
-
|
|
9612
|
-
|
|
9613
|
-
)
|
|
9614
|
-
] }),
|
|
9615
|
-
suffix && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Suffix, { disabled, children: suffix })
|
|
9616
|
-
]
|
|
9617
|
-
}
|
|
9618
|
-
)
|
|
9619
|
-
}
|
|
9620
|
-
),
|
|
9621
|
-
!disabled && typeof error === "string" && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ErrorMessageContainer, { id: errorId, role: "alert", "aria-live": error ? "assertive" : "off", children: error })
|
|
9622
|
-
] }) });
|
|
9630
|
+
suffix && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Suffix, { disabled, children: suffix })
|
|
9631
|
+
]
|
|
9632
|
+
}
|
|
9633
|
+
)
|
|
9634
|
+
}
|
|
9635
|
+
),
|
|
9636
|
+
!disabled && typeof error === "string" && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ErrorMessageContainer, { id: errorId, role: "alert", "aria-live": error ? "assertive" : "off", children: error })
|
|
9637
|
+
] }),
|
|
9638
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { id: `${inputId}-portal`, style: { position: "absolute" } })
|
|
9639
|
+
] });
|
|
9623
9640
|
}
|
|
9624
9641
|
);
|
|
9625
9642
|
var TextInput_default = DxcTextInput;
|
|
@@ -9647,7 +9664,7 @@ var getDate = (value, format, lastValidYear, setLastValidYear) => {
|
|
|
9647
9664
|
}
|
|
9648
9665
|
return newDate;
|
|
9649
9666
|
};
|
|
9650
|
-
var DxcDateInput = (0,
|
|
9667
|
+
var DxcDateInput = (0, import_react53.forwardRef)(
|
|
9651
9668
|
({
|
|
9652
9669
|
label,
|
|
9653
9670
|
name,
|
|
@@ -9669,18 +9686,18 @@ var DxcDateInput = (0, import_react52.forwardRef)(
|
|
|
9669
9686
|
tabIndex,
|
|
9670
9687
|
ariaLabel = "Date input"
|
|
9671
9688
|
}, ref) => {
|
|
9672
|
-
const [innerValue, setInnerValue] = (0,
|
|
9673
|
-
const [isOpen, setIsOpen] = (0,
|
|
9674
|
-
const calendarId = `date-picker-${(0,
|
|
9675
|
-
const [dayjsDate, setDayjsDate] = (0,
|
|
9676
|
-
const [lastValidYear, setLastValidYear] = (0,
|
|
9689
|
+
const [innerValue, setInnerValue] = (0, import_react53.useState)(defaultValue);
|
|
9690
|
+
const [isOpen, setIsOpen] = (0, import_react53.useState)(false);
|
|
9691
|
+
const calendarId = `date-picker-${(0, import_react53.useId)()}`;
|
|
9692
|
+
const [dayjsDate, setDayjsDate] = (0, import_react53.useState)(getValueForPicker(value ?? defaultValue ?? "", format));
|
|
9693
|
+
const [lastValidYear, setLastValidYear] = (0, import_react53.useState)(
|
|
9677
9694
|
innerValue || value ? !format.toUpperCase().includes("YYYY") && +getValueForPicker(value ?? innerValue, format).format("YY") < 68 ? 2e3 : 1900 : null
|
|
9678
9695
|
);
|
|
9679
|
-
const [sideOffset, setSideOffset] = (0,
|
|
9680
|
-
const colorsTheme = (0,
|
|
9681
|
-
const translatedLabels = (0,
|
|
9682
|
-
const dateRef = (0,
|
|
9683
|
-
const popoverContentRef = (0,
|
|
9696
|
+
const [sideOffset, setSideOffset] = (0, import_react53.useState)(SIDEOFFSET);
|
|
9697
|
+
const colorsTheme = (0, import_react53.useContext)(HalstackContext);
|
|
9698
|
+
const translatedLabels = (0, import_react53.useContext)(HalstackLanguageContext);
|
|
9699
|
+
const dateRef = (0, import_react53.useRef)(null);
|
|
9700
|
+
const popoverContentRef = (0, import_react53.useRef)(null);
|
|
9684
9701
|
const handleCalendarOnClick = (newDate) => {
|
|
9685
9702
|
const newValue = newDate.format(format.toUpperCase());
|
|
9686
9703
|
if (!value) {
|
|
@@ -9737,7 +9754,7 @@ var DxcDateInput = (0, import_react52.forwardRef)(
|
|
|
9737
9754
|
onBlur?.(callbackParams);
|
|
9738
9755
|
}
|
|
9739
9756
|
};
|
|
9740
|
-
const adjustSideOffset = (0,
|
|
9757
|
+
const adjustSideOffset = (0, import_react53.useCallback)(() => {
|
|
9741
9758
|
if (error != null) {
|
|
9742
9759
|
setTimeout(() => {
|
|
9743
9760
|
if (popoverContentRef.current && dateRef.current) {
|
|
@@ -9773,18 +9790,18 @@ var DxcDateInput = (0, import_react52.forwardRef)(
|
|
|
9773
9790
|
closeCalendar();
|
|
9774
9791
|
}
|
|
9775
9792
|
};
|
|
9776
|
-
(0,
|
|
9793
|
+
(0, import_react53.useEffect)(() => {
|
|
9777
9794
|
window.addEventListener("scroll", adjustSideOffset);
|
|
9778
9795
|
return () => {
|
|
9779
9796
|
window.removeEventListener("scroll", adjustSideOffset);
|
|
9780
9797
|
};
|
|
9781
9798
|
}, [adjustSideOffset]);
|
|
9782
|
-
(0,
|
|
9799
|
+
(0, import_react53.useEffect)(() => {
|
|
9783
9800
|
if (value || value === "") {
|
|
9784
9801
|
setDayjsDate(getDate(value, format, lastValidYear, setLastValidYear));
|
|
9785
9802
|
}
|
|
9786
9803
|
}, [value, format, lastValidYear]);
|
|
9787
|
-
(0,
|
|
9804
|
+
(0, import_react53.useEffect)(() => {
|
|
9788
9805
|
if (!disabled) {
|
|
9789
9806
|
const actionButtonElement = dateRef.current?.querySelector("[aria-label='Select date']");
|
|
9790
9807
|
actionButtonElement?.setAttribute("aria-haspopup", "true");
|
|
@@ -9796,62 +9813,65 @@ var DxcDateInput = (0, import_react52.forwardRef)(
|
|
|
9796
9813
|
}
|
|
9797
9814
|
}
|
|
9798
9815
|
}, [isOpen, disabled, calendarId]);
|
|
9799
|
-
return /* @__PURE__ */ (0, import_jsx_runtime52.
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
|
|
9803
|
-
htmlFor: dateRef.current?.getElementsByTagName("input")[0]?.id,
|
|
9804
|
-
disabled,
|
|
9805
|
-
hasHelperText: !!helperText,
|
|
9806
|
-
children: [
|
|
9807
|
-
label,
|
|
9808
|
-
" ",
|
|
9809
|
-
optional && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(OptionalLabel3, { children: translatedLabels.formFields.optionalLabel })
|
|
9810
|
-
]
|
|
9811
|
-
}
|
|
9812
|
-
),
|
|
9813
|
-
helperText && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(HelperText3, { disabled, children: helperText }),
|
|
9814
|
-
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(Popover4.Root, { open: isOpen, children: [
|
|
9815
|
-
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Popover4.Trigger, { asChild: true, "aria-controls": void 0, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
9816
|
-
TextInput_default,
|
|
9816
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_styled_components45.ThemeProvider, { theme: colorsTheme, children: [
|
|
9817
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(DateInputContainer, { margin, size, ref, children: [
|
|
9818
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
9819
|
+
Label5,
|
|
9817
9820
|
{
|
|
9818
|
-
|
|
9819
|
-
defaultValue,
|
|
9820
|
-
value: value ?? innerValue,
|
|
9821
|
-
placeholder: placeholder ? format.toUpperCase() : void 0,
|
|
9822
|
-
action: {
|
|
9823
|
-
onClick: openCalendar,
|
|
9824
|
-
icon: "filled_calendar_today",
|
|
9825
|
-
title: "Select date"
|
|
9826
|
-
},
|
|
9827
|
-
clearable,
|
|
9821
|
+
htmlFor: dateRef.current?.getElementsByTagName("input")[0]?.id,
|
|
9828
9822
|
disabled,
|
|
9829
|
-
|
|
9830
|
-
|
|
9831
|
-
|
|
9832
|
-
|
|
9833
|
-
|
|
9834
|
-
|
|
9835
|
-
size,
|
|
9836
|
-
tabIndex,
|
|
9837
|
-
ref: dateRef,
|
|
9838
|
-
ariaLabel
|
|
9839
|
-
}
|
|
9840
|
-
) }),
|
|
9841
|
-
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Popover4.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
9842
|
-
StyledPopoverContent,
|
|
9843
|
-
{
|
|
9844
|
-
sideOffset,
|
|
9845
|
-
align: "end",
|
|
9846
|
-
"aria-modal": true,
|
|
9847
|
-
onBlur: handleDatePickerOnBlur,
|
|
9848
|
-
onKeyDown: handleDatePickerEscKeydown,
|
|
9849
|
-
ref: popoverContentRef,
|
|
9850
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(DatePicker_default, { id: calendarId, onDateSelect: handleCalendarOnClick, date: dayjsDate })
|
|
9823
|
+
hasHelperText: !!helperText,
|
|
9824
|
+
children: [
|
|
9825
|
+
label,
|
|
9826
|
+
" ",
|
|
9827
|
+
optional && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(OptionalLabel3, { children: translatedLabels.formFields.optionalLabel })
|
|
9828
|
+
]
|
|
9851
9829
|
}
|
|
9852
|
-
)
|
|
9853
|
-
|
|
9854
|
-
|
|
9830
|
+
),
|
|
9831
|
+
helperText && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(HelperText3, { disabled, children: helperText }),
|
|
9832
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(Popover4.Root, { open: isOpen, children: [
|
|
9833
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Popover4.Trigger, { asChild: true, "aria-controls": void 0, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
9834
|
+
TextInput_default,
|
|
9835
|
+
{
|
|
9836
|
+
name,
|
|
9837
|
+
defaultValue,
|
|
9838
|
+
value: value ?? innerValue,
|
|
9839
|
+
placeholder: placeholder ? format.toUpperCase() : void 0,
|
|
9840
|
+
action: {
|
|
9841
|
+
onClick: openCalendar,
|
|
9842
|
+
icon: "filled_calendar_today",
|
|
9843
|
+
title: "Select date"
|
|
9844
|
+
},
|
|
9845
|
+
clearable,
|
|
9846
|
+
disabled,
|
|
9847
|
+
readOnly,
|
|
9848
|
+
optional,
|
|
9849
|
+
onChange: handleOnChange,
|
|
9850
|
+
onBlur: handleOnBlur,
|
|
9851
|
+
error,
|
|
9852
|
+
autocomplete,
|
|
9853
|
+
size,
|
|
9854
|
+
tabIndex,
|
|
9855
|
+
ref: dateRef,
|
|
9856
|
+
ariaLabel
|
|
9857
|
+
}
|
|
9858
|
+
) }),
|
|
9859
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Popover4.Portal, { container: document.getElementById(`${calendarId}-portal`), children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
9860
|
+
StyledPopoverContent,
|
|
9861
|
+
{
|
|
9862
|
+
sideOffset,
|
|
9863
|
+
align: "end",
|
|
9864
|
+
"aria-modal": true,
|
|
9865
|
+
onBlur: handleDatePickerOnBlur,
|
|
9866
|
+
onKeyDown: handleDatePickerEscKeydown,
|
|
9867
|
+
ref: popoverContentRef,
|
|
9868
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(DatePicker_default, { id: calendarId, onDateSelect: handleCalendarOnClick, date: dayjsDate })
|
|
9869
|
+
}
|
|
9870
|
+
) })
|
|
9871
|
+
] })
|
|
9872
|
+
] }),
|
|
9873
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { id: `${calendarId}-portal`, style: { position: "absolute" } })
|
|
9874
|
+
] });
|
|
9855
9875
|
}
|
|
9856
9876
|
);
|
|
9857
9877
|
var sizes5 = {
|
|
@@ -9894,7 +9914,7 @@ var HelperText3 = import_styled_components45.default.span`
|
|
|
9894
9914
|
margin-bottom: 0.25rem;
|
|
9895
9915
|
`;
|
|
9896
9916
|
var StyledPopoverContent = (0, import_styled_components45.default)(Popover4.Content)`
|
|
9897
|
-
z-index:
|
|
9917
|
+
z-index: 310;
|
|
9898
9918
|
&:focus-visible {
|
|
9899
9919
|
outline: none;
|
|
9900
9920
|
}
|
|
@@ -9902,7 +9922,7 @@ var StyledPopoverContent = (0, import_styled_components45.default)(Popover4.Cont
|
|
|
9902
9922
|
var DateInput_default = DxcDateInput;
|
|
9903
9923
|
|
|
9904
9924
|
// src/dialog/Dialog.tsx
|
|
9905
|
-
var
|
|
9925
|
+
var import_react54 = require("react");
|
|
9906
9926
|
var import_react_dom2 = require("react-dom");
|
|
9907
9927
|
var import_styled_components46 = __toESM(require("styled-components"));
|
|
9908
9928
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
@@ -9918,7 +9938,7 @@ var DialogContainer = import_styled_components46.default.div`
|
|
|
9918
9938
|
align-items: center;
|
|
9919
9939
|
justify-content: center;
|
|
9920
9940
|
height: 100%;
|
|
9921
|
-
z-index:
|
|
9941
|
+
z-index: 300;
|
|
9922
9942
|
`;
|
|
9923
9943
|
var Overlay3 = import_styled_components46.default.div`
|
|
9924
9944
|
position: fixed;
|
|
@@ -9955,9 +9975,14 @@ var DxcDialog = ({
|
|
|
9955
9975
|
tabIndex = 0,
|
|
9956
9976
|
disableFocusLock = false
|
|
9957
9977
|
}) => {
|
|
9958
|
-
const
|
|
9959
|
-
const
|
|
9960
|
-
(0,
|
|
9978
|
+
const id = (0, import_react54.useId)();
|
|
9979
|
+
const colorsTheme = (0, import_react54.useContext)(HalstackContext);
|
|
9980
|
+
const translatedLabels = (0, import_react54.useContext)(HalstackLanguageContext);
|
|
9981
|
+
const [portalContainer, setPortalContainer] = (0, import_react54.useState)(null);
|
|
9982
|
+
(0, import_react54.useEffect)(() => {
|
|
9983
|
+
setPortalContainer(document.getElementById(`dialog-${id}-portal`));
|
|
9984
|
+
}, []);
|
|
9985
|
+
(0, import_react54.useEffect)(() => {
|
|
9961
9986
|
const handleKeyDown = (event) => {
|
|
9962
9987
|
if (event.key === "Escape") {
|
|
9963
9988
|
event.preventDefault();
|
|
@@ -9971,7 +9996,8 @@ var DxcDialog = ({
|
|
|
9971
9996
|
}, [onCloseClick]);
|
|
9972
9997
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_styled_components46.ThemeProvider, { theme: colorsTheme.dialog, children: [
|
|
9973
9998
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(BodyStyle2, {}),
|
|
9974
|
-
(0,
|
|
9999
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { id: `dialog-${id}-portal`, style: { position: "absolute" } }),
|
|
10000
|
+
portalContainer && (0, import_react_dom2.createPortal)(
|
|
9975
10001
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(DialogContainer, { children: [
|
|
9976
10002
|
overlay && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Overlay3, { onClick: onBackgroundClick }),
|
|
9977
10003
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Dialog, { "aria-label": "Dialog", "aria-modal": overlay, closable, role: "dialog", children: !disableFocusLock ? /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(FocusLock_default, { children: [
|
|
@@ -9998,18 +10024,18 @@ var DxcDialog = ({
|
|
|
9998
10024
|
) })
|
|
9999
10025
|
] }) })
|
|
10000
10026
|
] }),
|
|
10001
|
-
|
|
10027
|
+
portalContainer
|
|
10002
10028
|
)
|
|
10003
10029
|
] });
|
|
10004
10030
|
};
|
|
10005
10031
|
var Dialog_default = DxcDialog;
|
|
10006
10032
|
|
|
10007
10033
|
// src/file-input/FileInput.tsx
|
|
10008
|
-
var
|
|
10034
|
+
var import_react56 = require("react");
|
|
10009
10035
|
var import_styled_components48 = __toESM(require("styled-components"));
|
|
10010
10036
|
|
|
10011
10037
|
// src/file-input/FileItem.tsx
|
|
10012
|
-
var
|
|
10038
|
+
var import_react55 = require("react");
|
|
10013
10039
|
var import_styled_components47 = __toESM(require("styled-components"));
|
|
10014
10040
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
10015
10041
|
var MainContainer3 = import_styled_components47.default.div`
|
|
@@ -10093,8 +10119,8 @@ var FileItem = ({
|
|
|
10093
10119
|
onDelete,
|
|
10094
10120
|
tabIndex
|
|
10095
10121
|
}) => {
|
|
10096
|
-
const translatedLabels = (0,
|
|
10097
|
-
const fileNameId = (0,
|
|
10122
|
+
const translatedLabels = (0, import_react55.useContext)(HalstackLanguageContext);
|
|
10123
|
+
const fileNameId = (0, import_react55.useId)();
|
|
10098
10124
|
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(MainContainer3, { error, role: "listitem", singleFileMode, showPreview, children: [
|
|
10099
10125
|
showPreview && (type.includes("image") ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ImagePreview, { src: preview, alt: fileName }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(IconPreview, { "aria-labelledby": fileNameId, error, role: "img", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Icon_default, { icon: preview }) })),
|
|
10100
10126
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(FileItemContent, { children: [
|
|
@@ -10115,7 +10141,7 @@ var FileItem = ({
|
|
|
10115
10141
|
] })
|
|
10116
10142
|
] });
|
|
10117
10143
|
};
|
|
10118
|
-
var FileItem_default = (0,
|
|
10144
|
+
var FileItem_default = (0, import_react55.memo)(FileItem);
|
|
10119
10145
|
|
|
10120
10146
|
// src/file-input/utils.ts
|
|
10121
10147
|
var getFilePreview = async (file) => {
|
|
@@ -10226,7 +10252,7 @@ var ErrorMessage2 = import_styled_components48.default.div`
|
|
|
10226
10252
|
line-height: ${(props) => props.theme.errorMessageLineHeight};
|
|
10227
10253
|
margin-top: 0.25rem;
|
|
10228
10254
|
`;
|
|
10229
|
-
var DxcFileInput = (0,
|
|
10255
|
+
var DxcFileInput = (0, import_react56.forwardRef)(
|
|
10230
10256
|
({
|
|
10231
10257
|
mode = "file",
|
|
10232
10258
|
label = "",
|
|
@@ -10244,11 +10270,11 @@ var DxcFileInput = (0, import_react55.forwardRef)(
|
|
|
10244
10270
|
margin,
|
|
10245
10271
|
tabIndex = 0
|
|
10246
10272
|
}, ref) => {
|
|
10247
|
-
const [isDragging, setIsDragging] = (0,
|
|
10248
|
-
const [files, setFiles] = (0,
|
|
10249
|
-
const fileInputId = `file-input-${(0,
|
|
10250
|
-
const colorsTheme = (0,
|
|
10251
|
-
const translatedLabels = (0,
|
|
10273
|
+
const [isDragging, setIsDragging] = (0, import_react56.useState)(false);
|
|
10274
|
+
const [files, setFiles] = (0, import_react56.useState)([]);
|
|
10275
|
+
const fileInputId = `file-input-${(0, import_react56.useId)()}`;
|
|
10276
|
+
const colorsTheme = (0, import_react56.useContext)(HalstackContext);
|
|
10277
|
+
const translatedLabels = (0, import_react56.useContext)(HalstackLanguageContext);
|
|
10252
10278
|
const checkFileSize = (file) => {
|
|
10253
10279
|
if (minSize && file.size < minSize) return translatedLabels.fileInput.fileSizeGreaterThanErrorMessage;
|
|
10254
10280
|
else if (maxSize && file.size > maxSize) return translatedLabels.fileInput.fileSizeLessThanErrorMessage;
|
|
@@ -10281,7 +10307,7 @@ var DxcFileInput = (0, import_react55.forwardRef)(
|
|
|
10281
10307
|
e.target.value = "";
|
|
10282
10308
|
}
|
|
10283
10309
|
};
|
|
10284
|
-
const onDelete = (0,
|
|
10310
|
+
const onDelete = (0, import_react56.useCallback)(
|
|
10285
10311
|
(fileName) => {
|
|
10286
10312
|
const filesCopy = [...files];
|
|
10287
10313
|
const fileToRemove = filesCopy.find((file) => file.file.name === fileName);
|
|
@@ -10320,7 +10346,7 @@ var DxcFileInput = (0, import_react55.forwardRef)(
|
|
|
10320
10346
|
addFile(filesArray);
|
|
10321
10347
|
}
|
|
10322
10348
|
};
|
|
10323
|
-
(0,
|
|
10349
|
+
(0, import_react56.useEffect)(() => {
|
|
10324
10350
|
const getFiles = async () => {
|
|
10325
10351
|
if (value) {
|
|
10326
10352
|
const valueFiles = await Promise.all(
|
|
@@ -10472,10 +10498,10 @@ var Grid_default = DxcGrid;
|
|
|
10472
10498
|
|
|
10473
10499
|
// src/heading/Heading.tsx
|
|
10474
10500
|
var import_styled_components50 = __toESM(require("styled-components"));
|
|
10475
|
-
var
|
|
10501
|
+
var import_react57 = require("react");
|
|
10476
10502
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
10477
10503
|
var DxcHeading = ({ level = 1, text = "", as, weight, margin }) => {
|
|
10478
|
-
const colorsTheme = (0,
|
|
10504
|
+
const colorsTheme = (0, import_react57.useContext)(HalstackContext);
|
|
10479
10505
|
const checkValidAs = () => {
|
|
10480
10506
|
if (as === "h1" || as === "h2" || as === "h3" || as === "h4" || as === "h5") return as;
|
|
10481
10507
|
};
|
|
@@ -10542,7 +10568,7 @@ var Heading_default = DxcHeading;
|
|
|
10542
10568
|
|
|
10543
10569
|
// src/image/Image.tsx
|
|
10544
10570
|
var import_styled_components51 = __toESM(require("styled-components"));
|
|
10545
|
-
var
|
|
10571
|
+
var import_react58 = require("react");
|
|
10546
10572
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
10547
10573
|
var Figure = import_styled_components51.default.figure`
|
|
10548
10574
|
display: flex;
|
|
@@ -10578,7 +10604,7 @@ function DxcImage({
|
|
|
10578
10604
|
onLoad,
|
|
10579
10605
|
onError
|
|
10580
10606
|
}) {
|
|
10581
|
-
const colorsTheme = (0,
|
|
10607
|
+
const colorsTheme = (0, import_react58.useContext)(HalstackContext);
|
|
10582
10608
|
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_styled_components51.ThemeProvider, { theme: colorsTheme.image, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(CaptionWrapper, { caption, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
10583
10609
|
"img",
|
|
10584
10610
|
{
|
|
@@ -10625,7 +10651,7 @@ var Inset = ({ space, horizontal, vertical, top, right, bottom, left, children }
|
|
|
10625
10651
|
var Inset_default = Inset;
|
|
10626
10652
|
|
|
10627
10653
|
// src/link/Link.tsx
|
|
10628
|
-
var
|
|
10654
|
+
var import_react59 = require("react");
|
|
10629
10655
|
var import_styled_components53 = __toESM(require("styled-components"));
|
|
10630
10656
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
10631
10657
|
var StyledLink = import_styled_components53.default.a`
|
|
@@ -10690,7 +10716,7 @@ var LinkIconContainer = import_styled_components53.default.div`
|
|
|
10690
10716
|
height: ${(props) => props.theme.iconSize};
|
|
10691
10717
|
}
|
|
10692
10718
|
`;
|
|
10693
|
-
var DxcLink = (0,
|
|
10719
|
+
var DxcLink = (0, import_react59.forwardRef)(
|
|
10694
10720
|
({
|
|
10695
10721
|
inheritColor = false,
|
|
10696
10722
|
disabled = false,
|
|
@@ -10704,7 +10730,7 @@ var DxcLink = (0, import_react58.forwardRef)(
|
|
|
10704
10730
|
children,
|
|
10705
10731
|
...otherProps
|
|
10706
10732
|
}, ref) => {
|
|
10707
|
-
const colorsTheme = (0,
|
|
10733
|
+
const colorsTheme = (0, import_react59.useContext)(HalstackContext);
|
|
10708
10734
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_styled_components53.ThemeProvider, { theme: colorsTheme.link, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
10709
10735
|
StyledLink,
|
|
10710
10736
|
{
|
|
@@ -10729,20 +10755,20 @@ var DxcLink = (0, import_react58.forwardRef)(
|
|
|
10729
10755
|
var Link_default = DxcLink;
|
|
10730
10756
|
|
|
10731
10757
|
// src/nav-tabs/NavTabs.tsx
|
|
10732
|
-
var
|
|
10758
|
+
var import_react62 = require("react");
|
|
10733
10759
|
var import_styled_components55 = __toESM(require("styled-components"));
|
|
10734
10760
|
|
|
10735
10761
|
// src/nav-tabs/Tab.tsx
|
|
10736
|
-
var
|
|
10762
|
+
var import_react61 = require("react");
|
|
10737
10763
|
var import_styled_components54 = __toESM(require("styled-components"));
|
|
10738
10764
|
|
|
10739
10765
|
// src/nav-tabs/NavTabsContext.tsx
|
|
10740
|
-
var
|
|
10741
|
-
var NavTabsContext_default = (0,
|
|
10766
|
+
var import_react60 = require("react");
|
|
10767
|
+
var NavTabsContext_default = (0, import_react60.createContext)(null);
|
|
10742
10768
|
|
|
10743
10769
|
// src/nav-tabs/Tab.tsx
|
|
10744
10770
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
10745
|
-
var DxcTab = (0,
|
|
10771
|
+
var DxcTab = (0, import_react61.forwardRef)(
|
|
10746
10772
|
({
|
|
10747
10773
|
href,
|
|
10748
10774
|
active = false,
|
|
@@ -10753,11 +10779,11 @@ var DxcTab = (0, import_react60.forwardRef)(
|
|
|
10753
10779
|
children,
|
|
10754
10780
|
...otherProps
|
|
10755
10781
|
}, ref) => {
|
|
10756
|
-
const tabRef = (0,
|
|
10757
|
-
const { iconPosition, tabIndex, focusedLabel } = (0,
|
|
10758
|
-
const innerRef = (0,
|
|
10759
|
-
(0,
|
|
10760
|
-
(0,
|
|
10782
|
+
const tabRef = (0, import_react61.useRef)();
|
|
10783
|
+
const { iconPosition, tabIndex, focusedLabel } = (0, import_react61.useContext)(NavTabsContext_default) ?? {};
|
|
10784
|
+
const innerRef = (0, import_react61.useRef)(null);
|
|
10785
|
+
(0, import_react61.useImperativeHandle)(ref, () => innerRef.current, []);
|
|
10786
|
+
(0, import_react61.useEffect)(() => {
|
|
10761
10787
|
if (focusedLabel === children.toString()) {
|
|
10762
10788
|
tabRef?.current?.focus();
|
|
10763
10789
|
}
|
|
@@ -10781,8 +10807,9 @@ var DxcTab = (0, import_react60.forwardRef)(
|
|
|
10781
10807
|
disabled,
|
|
10782
10808
|
active,
|
|
10783
10809
|
href: !disabled ? href : void 0,
|
|
10810
|
+
as: href ? "a" : onClick ? "button" : "div",
|
|
10784
10811
|
iconPosition,
|
|
10785
|
-
onClick,
|
|
10812
|
+
onClick: !disabled ? onClick : void 0,
|
|
10786
10813
|
onKeyDown: handleOnKeyDown,
|
|
10787
10814
|
hasIcon: icon != null,
|
|
10788
10815
|
ref: (anchorRef) => {
|
|
@@ -10916,17 +10943,17 @@ var getNextTabIndex = (array, initialIndex) => {
|
|
|
10916
10943
|
return index;
|
|
10917
10944
|
};
|
|
10918
10945
|
var DxcNavTabs = ({ iconPosition = "top", tabIndex = 0, children }) => {
|
|
10919
|
-
const [innerFocusIndex, setInnerFocusIndex] = (0,
|
|
10920
|
-
const [underlineWidth, setUnderlineWidth] = (0,
|
|
10921
|
-
const refNavTabList = (0,
|
|
10922
|
-
const colorsTheme = (0,
|
|
10923
|
-
const childArray =
|
|
10946
|
+
const [innerFocusIndex, setInnerFocusIndex] = (0, import_react62.useState)(null);
|
|
10947
|
+
const [underlineWidth, setUnderlineWidth] = (0, import_react62.useState)(null);
|
|
10948
|
+
const refNavTabList = (0, import_react62.useRef)(null);
|
|
10949
|
+
const colorsTheme = (0, import_react62.useContext)(HalstackContext);
|
|
10950
|
+
const childArray = import_react62.Children.toArray(children).filter(
|
|
10924
10951
|
(child) => typeof child === "object" && "props" in child
|
|
10925
10952
|
);
|
|
10926
|
-
(0,
|
|
10953
|
+
(0, import_react62.useEffect)(() => {
|
|
10927
10954
|
setUnderlineWidth(refNavTabList?.current?.scrollWidth ?? null);
|
|
10928
10955
|
}, [children]);
|
|
10929
|
-
const contextValue = (0,
|
|
10956
|
+
const contextValue = (0, import_react62.useMemo)(
|
|
10930
10957
|
() => ({
|
|
10931
10958
|
iconPosition,
|
|
10932
10959
|
tabIndex,
|
|
@@ -10975,10 +11002,10 @@ var NavTabsContainer = import_styled_components55.default.div`
|
|
|
10975
11002
|
var NavTabs_default = DxcNavTabs;
|
|
10976
11003
|
|
|
10977
11004
|
// src/number-input/NumberInput.tsx
|
|
10978
|
-
var
|
|
11005
|
+
var import_react63 = require("react");
|
|
10979
11006
|
var import_styled_components56 = __toESM(require("styled-components"));
|
|
10980
11007
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
10981
|
-
var DxcNumberInput = (0,
|
|
11008
|
+
var DxcNumberInput = (0, import_react63.forwardRef)(
|
|
10982
11009
|
({
|
|
10983
11010
|
label,
|
|
10984
11011
|
name,
|
|
@@ -11004,8 +11031,8 @@ var DxcNumberInput = (0, import_react62.forwardRef)(
|
|
|
11004
11031
|
ariaLabel = "Number input",
|
|
11005
11032
|
showControls = true
|
|
11006
11033
|
}, ref) => {
|
|
11007
|
-
const numberInputRef = (0,
|
|
11008
|
-
const contextValue = (0,
|
|
11034
|
+
const numberInputRef = (0, import_react63.useRef)(null);
|
|
11035
|
+
const contextValue = (0, import_react63.useMemo)(
|
|
11009
11036
|
() => ({
|
|
11010
11037
|
maxNumber: max,
|
|
11011
11038
|
minNumber: min,
|
|
@@ -11015,7 +11042,7 @@ var DxcNumberInput = (0, import_react62.forwardRef)(
|
|
|
11015
11042
|
}),
|
|
11016
11043
|
[max, min, showControls, step]
|
|
11017
11044
|
);
|
|
11018
|
-
(0,
|
|
11045
|
+
(0, import_react63.useEffect)(() => {
|
|
11019
11046
|
const input = numberInputRef.current?.getElementsByTagName("input")[0];
|
|
11020
11047
|
const preventDefault = (event) => {
|
|
11021
11048
|
event.preventDefault();
|
|
@@ -11069,7 +11096,7 @@ var NumberInputContainer = import_styled_components56.default.div`
|
|
|
11069
11096
|
var NumberInput_default = DxcNumberInput;
|
|
11070
11097
|
|
|
11071
11098
|
// src/paragraph/Paragraph.tsx
|
|
11072
|
-
var
|
|
11099
|
+
var import_react64 = require("react");
|
|
11073
11100
|
var import_styled_components57 = __toESM(require("styled-components"));
|
|
11074
11101
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
11075
11102
|
var Paragraph = import_styled_components57.default.p`
|
|
@@ -11088,12 +11115,12 @@ var Paragraph = import_styled_components57.default.p`
|
|
|
11088
11115
|
margin: 0;
|
|
11089
11116
|
`;
|
|
11090
11117
|
function DxcParagraph({ children }) {
|
|
11091
|
-
const colorsTheme = (0,
|
|
11118
|
+
const colorsTheme = (0, import_react64.useContext)(HalstackContext);
|
|
11092
11119
|
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_styled_components57.ThemeProvider, { theme: colorsTheme.paragraph, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Paragraph, { children }) });
|
|
11093
11120
|
}
|
|
11094
11121
|
|
|
11095
11122
|
// src/password-input/PasswordInput.tsx
|
|
11096
|
-
var
|
|
11123
|
+
var import_react65 = require("react");
|
|
11097
11124
|
var import_styled_components58 = __toESM(require("styled-components"));
|
|
11098
11125
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
11099
11126
|
var setInputType = (type, element) => {
|
|
@@ -11103,7 +11130,7 @@ var setAriaAttributes = (ariaExpanded, element) => {
|
|
|
11103
11130
|
const buttonElement = element?.getElementsByTagName("button")[0];
|
|
11104
11131
|
buttonElement?.setAttribute("aria-expanded", ariaExpanded);
|
|
11105
11132
|
};
|
|
11106
|
-
var DxcPasswordInput = (0,
|
|
11133
|
+
var DxcPasswordInput = (0, import_react65.forwardRef)(
|
|
11107
11134
|
({
|
|
11108
11135
|
label,
|
|
11109
11136
|
name = "",
|
|
@@ -11122,10 +11149,10 @@ var DxcPasswordInput = (0, import_react64.forwardRef)(
|
|
|
11122
11149
|
tabIndex = 0,
|
|
11123
11150
|
ariaLabel = "Password input"
|
|
11124
11151
|
}, ref) => {
|
|
11125
|
-
const [isPasswordVisible, setIsPasswordVisible] = (0,
|
|
11126
|
-
const inputRef = (0,
|
|
11127
|
-
const { passwordInput } = (0,
|
|
11128
|
-
(0,
|
|
11152
|
+
const [isPasswordVisible, setIsPasswordVisible] = (0, import_react65.useState)(false);
|
|
11153
|
+
const inputRef = (0, import_react65.useRef)(null);
|
|
11154
|
+
const { passwordInput } = (0, import_react65.useContext)(HalstackLanguageContext);
|
|
11155
|
+
(0, import_react65.useEffect)(() => {
|
|
11129
11156
|
(() => {
|
|
11130
11157
|
if (isPasswordVisible) {
|
|
11131
11158
|
setInputType("text", inputRef.current);
|
|
@@ -11180,7 +11207,7 @@ var PasswordInput = import_styled_components58.default.div`
|
|
|
11180
11207
|
var PasswordInput_default = DxcPasswordInput;
|
|
11181
11208
|
|
|
11182
11209
|
// src/progress-bar/ProgressBar.tsx
|
|
11183
|
-
var
|
|
11210
|
+
var import_react66 = require("react");
|
|
11184
11211
|
var import_styled_components59 = __toESM(require("styled-components"));
|
|
11185
11212
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
11186
11213
|
var Overlay4 = import_styled_components59.default.div`
|
|
@@ -11300,10 +11327,10 @@ var DxcProgressBar = ({
|
|
|
11300
11327
|
margin,
|
|
11301
11328
|
ariaLabel = "Progress bar"
|
|
11302
11329
|
}) => {
|
|
11303
|
-
const colorsTheme = (0,
|
|
11304
|
-
const labelId = `label-${(0,
|
|
11305
|
-
const [innerValue, setInnerValue] = (0,
|
|
11306
|
-
(0,
|
|
11330
|
+
const colorsTheme = (0, import_react66.useContext)(HalstackContext);
|
|
11331
|
+
const labelId = `label-${(0, import_react66.useId)()}`;
|
|
11332
|
+
const [innerValue, setInnerValue] = (0, import_react66.useState)();
|
|
11333
|
+
(0, import_react66.useEffect)(() => {
|
|
11307
11334
|
if (value != null) setInnerValue(value < 0 ? 0 : value > 100 ? 100 : value);
|
|
11308
11335
|
}, [value]);
|
|
11309
11336
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_styled_components59.ThemeProvider, { theme: colorsTheme.progressBar, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Overlay4, { overlay, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(MainContainer4, { overlay, margin, children: [
|
|
@@ -11333,23 +11360,43 @@ var DxcProgressBar = ({
|
|
|
11333
11360
|
var ProgressBar_default = DxcProgressBar;
|
|
11334
11361
|
|
|
11335
11362
|
// src/quick-nav/QuickNav.tsx
|
|
11336
|
-
var
|
|
11363
|
+
var import_react67 = require("react");
|
|
11337
11364
|
var import_slugify = __toESM(require("slugify"));
|
|
11338
11365
|
var import_styled_components60 = __toESM(require("styled-components"));
|
|
11339
11366
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
11340
11367
|
var DxcQuickNav = ({ title, links }) => {
|
|
11341
|
-
const translatedLabels = (0,
|
|
11342
|
-
const colorsTheme = (0,
|
|
11368
|
+
const translatedLabels = (0, import_react67.useContext)(HalstackLanguageContext);
|
|
11369
|
+
const colorsTheme = (0, import_react67.useContext)(HalstackContext);
|
|
11370
|
+
const isHashRouter = () => {
|
|
11371
|
+
if (typeof window === "undefined") return false;
|
|
11372
|
+
return window.location.href.includes("/#/");
|
|
11373
|
+
};
|
|
11343
11374
|
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_styled_components60.ThemeProvider, { theme: colorsTheme.quickNav, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(QuickNavContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Flex_default, { direction: "column", gap: "0.5rem", children: [
|
|
11344
11375
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Heading_default, { level: 4, text: title || translatedLabels.quickNav.contentTitle }),
|
|
11345
11376
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ListColumn, { children: links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Inset_default, { space: "0.25rem", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(DxcTypography, { children: [
|
|
11346
|
-
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
11377
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
11378
|
+
Link3,
|
|
11379
|
+
{
|
|
11380
|
+
href: `#${(0, import_slugify.default)(link.label, { lower: true })}`,
|
|
11381
|
+
onClick: isHashRouter() ? (e) => {
|
|
11382
|
+
e.preventDefault();
|
|
11383
|
+
const id = (0, import_slugify.default)(link.label, { lower: true });
|
|
11384
|
+
document.getElementById(id)?.scrollIntoView();
|
|
11385
|
+
} : void 0,
|
|
11386
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { children: link.label })
|
|
11387
|
+
}
|
|
11388
|
+
),
|
|
11347
11389
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ListSecondColumn, { children: link.links?.map((sublink) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Inset_default, { horizontal: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(DxcTypography, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
11348
11390
|
Link3,
|
|
11349
11391
|
{
|
|
11350
11392
|
href: `#${(0, import_slugify.default)(link?.label, { lower: true })}-${(0, import_slugify.default)(sublink?.label, {
|
|
11351
11393
|
lower: true
|
|
11352
11394
|
})}`,
|
|
11395
|
+
onClick: isHashRouter() ? (e) => {
|
|
11396
|
+
e.preventDefault();
|
|
11397
|
+
const id = `${(0, import_slugify.default)(link.label, { lower: true })}-${(0, import_slugify.default)(sublink.label, { lower: true })}`;
|
|
11398
|
+
document.getElementById(id)?.scrollIntoView();
|
|
11399
|
+
} : void 0,
|
|
11353
11400
|
children: sublink.label
|
|
11354
11401
|
}
|
|
11355
11402
|
) }) }) }, sublink.label)) })
|
|
@@ -11405,11 +11452,11 @@ var Link3 = import_styled_components60.default.a`
|
|
|
11405
11452
|
var QuickNav_default = DxcQuickNav;
|
|
11406
11453
|
|
|
11407
11454
|
// src/radio-group/RadioGroup.tsx
|
|
11408
|
-
var
|
|
11455
|
+
var import_react69 = require("react");
|
|
11409
11456
|
var import_styled_components62 = __toESM(require("styled-components"));
|
|
11410
11457
|
|
|
11411
11458
|
// src/radio-group/Radio.tsx
|
|
11412
|
-
var
|
|
11459
|
+
var import_react68 = require("react");
|
|
11413
11460
|
var import_styled_components61 = __toESM(require("styled-components"));
|
|
11414
11461
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
11415
11462
|
var DxcRadio = ({
|
|
@@ -11422,15 +11469,15 @@ var DxcRadio = ({
|
|
|
11422
11469
|
readOnly,
|
|
11423
11470
|
tabIndex
|
|
11424
11471
|
}) => {
|
|
11425
|
-
const radioLabelId = `radio-${(0,
|
|
11426
|
-
const ref = (0,
|
|
11427
|
-
const colorsTheme = (0,
|
|
11472
|
+
const radioLabelId = `radio-${(0, import_react68.useId)()}`;
|
|
11473
|
+
const ref = (0, import_react68.useRef)(null);
|
|
11474
|
+
const colorsTheme = (0, import_react68.useContext)(HalstackContext);
|
|
11428
11475
|
const handleOnClick = () => {
|
|
11429
11476
|
onClick();
|
|
11430
11477
|
document.activeElement !== ref.current && ref.current?.focus();
|
|
11431
11478
|
};
|
|
11432
|
-
const [firstUpdate, setFirstUpdate] = (0,
|
|
11433
|
-
(0,
|
|
11479
|
+
const [firstUpdate, setFirstUpdate] = (0, import_react68.useState)(true);
|
|
11480
|
+
(0, import_react68.useEffect)(() => {
|
|
11434
11481
|
if (firstUpdate) {
|
|
11435
11482
|
setFirstUpdate(false);
|
|
11436
11483
|
return;
|
|
@@ -11535,7 +11582,7 @@ var RadioContainer = import_styled_components61.default.span`
|
|
|
11535
11582
|
}
|
|
11536
11583
|
}
|
|
11537
11584
|
`;
|
|
11538
|
-
var Radio_default = (0,
|
|
11585
|
+
var Radio_default = (0, import_react68.memo)(DxcRadio);
|
|
11539
11586
|
|
|
11540
11587
|
// src/radio-group/RadioGroup.tsx
|
|
11541
11588
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
@@ -11543,7 +11590,7 @@ var getInitialFocusIndex = (innerOptions, value) => {
|
|
|
11543
11590
|
const initialSelectedOptionIndex = innerOptions.findIndex((option) => option.value === value);
|
|
11544
11591
|
return initialSelectedOptionIndex !== -1 ? initialSelectedOptionIndex : 0;
|
|
11545
11592
|
};
|
|
11546
|
-
var DxcRadioGroup = (0,
|
|
11593
|
+
var DxcRadioGroup = (0, import_react69.forwardRef)(
|
|
11547
11594
|
({
|
|
11548
11595
|
label,
|
|
11549
11596
|
name,
|
|
@@ -11562,14 +11609,14 @@ var DxcRadioGroup = (0, import_react68.forwardRef)(
|
|
|
11562
11609
|
tabIndex = 0,
|
|
11563
11610
|
ariaLabel = "Radio group"
|
|
11564
11611
|
}, ref) => {
|
|
11565
|
-
const radioGroupId = `radio-group-${(0,
|
|
11612
|
+
const radioGroupId = `radio-group-${(0, import_react69.useId)()}`;
|
|
11566
11613
|
const radioGroupLabelId = `label-${radioGroupId}`;
|
|
11567
11614
|
const errorId = `error-${radioGroupId}`;
|
|
11568
|
-
const [innerValue, setInnerValue] = (0,
|
|
11569
|
-
const [firstTimeFocus, setFirstTimeFocus] = (0,
|
|
11570
|
-
const colorsTheme = (0,
|
|
11571
|
-
const translatedLabels = (0,
|
|
11572
|
-
const innerOptions = (0,
|
|
11615
|
+
const [innerValue, setInnerValue] = (0, import_react69.useState)(defaultValue);
|
|
11616
|
+
const [firstTimeFocus, setFirstTimeFocus] = (0, import_react69.useState)(true);
|
|
11617
|
+
const colorsTheme = (0, import_react69.useContext)(HalstackContext);
|
|
11618
|
+
const translatedLabels = (0, import_react69.useContext)(HalstackLanguageContext);
|
|
11619
|
+
const innerOptions = (0, import_react69.useMemo)(
|
|
11573
11620
|
() => optional ? [
|
|
11574
11621
|
...options,
|
|
11575
11622
|
{
|
|
@@ -11580,8 +11627,8 @@ var DxcRadioGroup = (0, import_react68.forwardRef)(
|
|
|
11580
11627
|
] : options,
|
|
11581
11628
|
[optional, options, optionalItemLabel, translatedLabels]
|
|
11582
11629
|
);
|
|
11583
|
-
const [currentFocusIndex, setCurrentFocusIndex] = (0,
|
|
11584
|
-
const handleOnChange = (0,
|
|
11630
|
+
const [currentFocusIndex, setCurrentFocusIndex] = (0, import_react69.useState)(getInitialFocusIndex(innerOptions, value ?? innerValue));
|
|
11631
|
+
const handleOnChange = (0, import_react69.useCallback)(
|
|
11585
11632
|
(newValue) => {
|
|
11586
11633
|
const currentValue = value ?? innerValue;
|
|
11587
11634
|
if (newValue !== currentValue && !readOnly) {
|
|
@@ -11760,7 +11807,7 @@ var ErrorMessageContainer2 = import_styled_components62.default.span`
|
|
|
11760
11807
|
var RadioGroup_default = DxcRadioGroup;
|
|
11761
11808
|
|
|
11762
11809
|
// src/resultset-table/ResultsetTable.tsx
|
|
11763
|
-
var
|
|
11810
|
+
var import_react70 = require("react");
|
|
11764
11811
|
var import_styled_components63 = __toESM(require("styled-components"));
|
|
11765
11812
|
|
|
11766
11813
|
// src/resultset-table/Icons.tsx
|
|
@@ -11816,22 +11863,22 @@ var DxcResultsetTable = ({
|
|
|
11816
11863
|
tabIndex = 0,
|
|
11817
11864
|
mode = "default"
|
|
11818
11865
|
}) => {
|
|
11819
|
-
const colorsTheme = (0,
|
|
11820
|
-
const [page, changePage] = (0,
|
|
11821
|
-
const [sortColumnIndex, changeSortColumnIndex] = (0,
|
|
11822
|
-
const [sortOrder, changeSortOrder] = (0,
|
|
11823
|
-
const prevRowCountRef = (0,
|
|
11824
|
-
const rowsWithIds = (0,
|
|
11825
|
-
const minItemsPerPageIndex = (0,
|
|
11826
|
-
const maxItemsPerPageIndex = (0,
|
|
11866
|
+
const colorsTheme = (0, import_react70.useContext)(HalstackContext);
|
|
11867
|
+
const [page, changePage] = (0, import_react70.useState)(1);
|
|
11868
|
+
const [sortColumnIndex, changeSortColumnIndex] = (0, import_react70.useState)(-1);
|
|
11869
|
+
const [sortOrder, changeSortOrder] = (0, import_react70.useState)("ascending");
|
|
11870
|
+
const prevRowCountRef = (0, import_react70.useRef)(rows.length);
|
|
11871
|
+
const rowsWithIds = (0, import_react70.useMemo)(() => assignIdsToRows(rows), [rows]);
|
|
11872
|
+
const minItemsPerPageIndex = (0, import_react70.useMemo)(() => getMinItemsPerPageIndex2(page, itemsPerPage, page), [itemsPerPage, page]);
|
|
11873
|
+
const maxItemsPerPageIndex = (0, import_react70.useMemo)(
|
|
11827
11874
|
() => getMaxItemsPerPageIndex2(minItemsPerPageIndex, itemsPerPage, rows, page),
|
|
11828
11875
|
[itemsPerPage, minItemsPerPageIndex, page, rows]
|
|
11829
11876
|
);
|
|
11830
|
-
const sortedResultset = (0,
|
|
11877
|
+
const sortedResultset = (0, import_react70.useMemo)(
|
|
11831
11878
|
() => sortColumnIndex !== -1 ? sortArray(sortColumnIndex, sortOrder, rowsWithIds) : rowsWithIds,
|
|
11832
11879
|
[sortColumnIndex, sortOrder, rowsWithIds]
|
|
11833
11880
|
);
|
|
11834
|
-
const filteredResultset = (0,
|
|
11881
|
+
const filteredResultset = (0, import_react70.useMemo)(
|
|
11835
11882
|
() => sortedResultset && sortedResultset.slice(minItemsPerPageIndex, maxItemsPerPageIndex + 1),
|
|
11836
11883
|
[sortedResultset, minItemsPerPageIndex, maxItemsPerPageIndex]
|
|
11837
11884
|
);
|
|
@@ -11845,7 +11892,7 @@ var DxcResultsetTable = ({
|
|
|
11845
11892
|
sortColumnIndex === -1 || sortColumnIndex !== columnIndex ? "ascending" : sortOrder === "ascending" ? "descending" : "ascending"
|
|
11846
11893
|
);
|
|
11847
11894
|
};
|
|
11848
|
-
(0,
|
|
11895
|
+
(0, import_react70.useEffect)(() => {
|
|
11849
11896
|
if (!hidePaginator) {
|
|
11850
11897
|
if (rows.length === 0) {
|
|
11851
11898
|
changePage(0);
|
|
@@ -11944,7 +11991,7 @@ DxcResultsetTable.ActionsCell = DxcActionsCell;
|
|
|
11944
11991
|
var ResultsetTable_default = DxcResultsetTable;
|
|
11945
11992
|
|
|
11946
11993
|
// src/slider/Slider.tsx
|
|
11947
|
-
var
|
|
11994
|
+
var import_react71 = require("react");
|
|
11948
11995
|
var import_styled_components64 = __toESM(require("styled-components"));
|
|
11949
11996
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
11950
11997
|
var sizes6 = {
|
|
@@ -12115,7 +12162,7 @@ var TextInputContainer2 = import_styled_components64.default.div`
|
|
|
12115
12162
|
margin-left: ${(props) => props.theme.inputMarginLeft};
|
|
12116
12163
|
max-width: 70px;
|
|
12117
12164
|
`;
|
|
12118
|
-
var DxcSlider = (0,
|
|
12165
|
+
var DxcSlider = (0, import_react71.forwardRef)(
|
|
12119
12166
|
({
|
|
12120
12167
|
label = "",
|
|
12121
12168
|
name = "",
|
|
@@ -12136,20 +12183,20 @@ var DxcSlider = (0, import_react70.forwardRef)(
|
|
|
12136
12183
|
size = "fillParent",
|
|
12137
12184
|
ariaLabel = "Slider"
|
|
12138
12185
|
}, ref) => {
|
|
12139
|
-
const labelId = `label-${(0,
|
|
12140
|
-
const [innerValue, setInnerValue] = (0,
|
|
12141
|
-
const [dragging, setDragging] = (0,
|
|
12142
|
-
const colorsTheme = (0,
|
|
12186
|
+
const labelId = `label-${(0, import_react71.useId)()}`;
|
|
12187
|
+
const [innerValue, setInnerValue] = (0, import_react71.useState)(defaultValue ?? 0);
|
|
12188
|
+
const [dragging, setDragging] = (0, import_react71.useState)(false);
|
|
12189
|
+
const colorsTheme = (0, import_react71.useContext)(HalstackContext);
|
|
12143
12190
|
const isFirefox = navigator.userAgent.indexOf("Firefox") !== -1;
|
|
12144
|
-
const minLabel = (0,
|
|
12191
|
+
const minLabel = (0, import_react71.useMemo)(
|
|
12145
12192
|
() => labelFormatCallback ? labelFormatCallback(minValue) : minValue,
|
|
12146
12193
|
[labelFormatCallback, minValue]
|
|
12147
12194
|
);
|
|
12148
|
-
const maxLabel = (0,
|
|
12195
|
+
const maxLabel = (0, import_react71.useMemo)(
|
|
12149
12196
|
() => labelFormatCallback ? labelFormatCallback(maxValue) : maxValue,
|
|
12150
12197
|
[labelFormatCallback, maxValue]
|
|
12151
12198
|
);
|
|
12152
|
-
const tickMarks = (0,
|
|
12199
|
+
const tickMarks = (0, import_react71.useMemo)(() => {
|
|
12153
12200
|
const numberOfMarks = Math.floor(maxValue / step - minValue / step);
|
|
12154
12201
|
const range = maxValue - minValue;
|
|
12155
12202
|
const ticks = [];
|
|
@@ -12275,10 +12322,10 @@ var StatusLabel = import_styled_components65.default.span`
|
|
|
12275
12322
|
var StatusLight_default = DxcStatusLight;
|
|
12276
12323
|
|
|
12277
12324
|
// src/switch/Switch.tsx
|
|
12278
|
-
var
|
|
12325
|
+
var import_react72 = require("react");
|
|
12279
12326
|
var import_styled_components66 = __toESM(require("styled-components"));
|
|
12280
12327
|
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
12281
|
-
var DxcSwitch = (0,
|
|
12328
|
+
var DxcSwitch = (0, import_react72.forwardRef)(
|
|
12282
12329
|
({
|
|
12283
12330
|
defaultChecked = false,
|
|
12284
12331
|
checked,
|
|
@@ -12294,12 +12341,12 @@ var DxcSwitch = (0, import_react71.forwardRef)(
|
|
|
12294
12341
|
tabIndex = 0,
|
|
12295
12342
|
ariaLabel = "Switch"
|
|
12296
12343
|
}, ref) => {
|
|
12297
|
-
const switchId = `switch-${(0,
|
|
12344
|
+
const switchId = `switch-${(0, import_react72.useId)()}`;
|
|
12298
12345
|
const labelId = `label-${switchId}`;
|
|
12299
|
-
const [innerChecked, setInnerChecked] = (0,
|
|
12300
|
-
const colorsTheme = (0,
|
|
12301
|
-
const translatedLabels = (0,
|
|
12302
|
-
const refTrack = (0,
|
|
12346
|
+
const [innerChecked, setInnerChecked] = (0, import_react72.useState)(defaultChecked);
|
|
12347
|
+
const colorsTheme = (0, import_react72.useContext)(HalstackContext);
|
|
12348
|
+
const translatedLabels = (0, import_react72.useContext)(HalstackLanguageContext);
|
|
12349
|
+
const refTrack = (0, import_react72.useRef)(null);
|
|
12303
12350
|
const handleOnKeyDown = (event) => {
|
|
12304
12351
|
switch (event.key) {
|
|
12305
12352
|
case "Enter":
|
|
@@ -12517,18 +12564,18 @@ var SwitchTrack = import_styled_components66.default.span`
|
|
|
12517
12564
|
var Switch_default = DxcSwitch;
|
|
12518
12565
|
|
|
12519
12566
|
// src/tabs/Tabs.tsx
|
|
12520
|
-
var
|
|
12567
|
+
var import_react77 = require("react");
|
|
12521
12568
|
var import_styled_components70 = __toESM(require("styled-components"));
|
|
12522
12569
|
|
|
12523
12570
|
// src/tabs/TabsContext.tsx
|
|
12524
|
-
var
|
|
12525
|
-
var TabsContext_default = (0,
|
|
12571
|
+
var import_react73 = require("react");
|
|
12572
|
+
var TabsContext_default = (0, import_react73.createContext)(null);
|
|
12526
12573
|
|
|
12527
12574
|
// src/tabs/Tab.tsx
|
|
12528
|
-
var
|
|
12575
|
+
var import_react74 = require("react");
|
|
12529
12576
|
var import_styled_components67 = __toESM(require("styled-components"));
|
|
12530
12577
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
12531
|
-
var DxcTab2 = (0,
|
|
12578
|
+
var DxcTab2 = (0, import_react74.forwardRef)(
|
|
12532
12579
|
({
|
|
12533
12580
|
icon,
|
|
12534
12581
|
label,
|
|
@@ -12542,7 +12589,7 @@ var DxcTab2 = (0, import_react73.forwardRef)(
|
|
|
12542
12589
|
onHover = () => {
|
|
12543
12590
|
}
|
|
12544
12591
|
}, ref) => {
|
|
12545
|
-
const tabRef = (0,
|
|
12592
|
+
const tabRef = (0, import_react74.useRef)(null);
|
|
12546
12593
|
const {
|
|
12547
12594
|
iconPosition = "top",
|
|
12548
12595
|
tabIndex = 0,
|
|
@@ -12553,19 +12600,19 @@ var DxcTab2 = (0, import_react73.forwardRef)(
|
|
|
12553
12600
|
setActiveTab,
|
|
12554
12601
|
setActiveIndicatorWidth,
|
|
12555
12602
|
setActiveIndicatorLeft
|
|
12556
|
-
} = (0,
|
|
12557
|
-
(0,
|
|
12603
|
+
} = (0, import_react74.useContext)(TabsContext_default) ?? {};
|
|
12604
|
+
(0, import_react74.useEffect)(() => {
|
|
12558
12605
|
if (focusedTab === tabId) {
|
|
12559
12606
|
tabRef?.current?.focus();
|
|
12560
12607
|
}
|
|
12561
12608
|
}, [focusedTab, tabId]);
|
|
12562
|
-
(0,
|
|
12609
|
+
(0, import_react74.useEffect)(() => {
|
|
12563
12610
|
if (activeTab === tabId) {
|
|
12564
12611
|
setActiveIndicatorWidth?.(tabRef.current?.offsetWidth ?? 0);
|
|
12565
12612
|
setActiveIndicatorLeft?.(tabRef.current?.offsetLeft ?? 0);
|
|
12566
12613
|
}
|
|
12567
12614
|
}, [activeTab, tabId, setActiveIndicatorWidth, setActiveIndicatorLeft]);
|
|
12568
|
-
(0,
|
|
12615
|
+
(0, import_react74.useEffect)(() => {
|
|
12569
12616
|
if (active) {
|
|
12570
12617
|
setActiveTab?.(tabId ?? label ?? "");
|
|
12571
12618
|
}
|
|
@@ -12741,14 +12788,14 @@ var TabIconContainer2 = import_styled_components67.default.div`
|
|
|
12741
12788
|
var Tab_default2 = DxcTab2;
|
|
12742
12789
|
|
|
12743
12790
|
// src/tabs/TabsLegacy.tsx
|
|
12744
|
-
var
|
|
12791
|
+
var import_react76 = require("react");
|
|
12745
12792
|
var import_styled_components69 = __toESM(require("styled-components"));
|
|
12746
12793
|
|
|
12747
12794
|
// src/tabs/TabLegacy.tsx
|
|
12748
|
-
var
|
|
12795
|
+
var import_react75 = require("react");
|
|
12749
12796
|
var import_styled_components68 = __toESM(require("styled-components"));
|
|
12750
12797
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
12751
|
-
var Tab2 = (0,
|
|
12798
|
+
var Tab2 = (0, import_react75.forwardRef)(
|
|
12752
12799
|
({ active, tab, tabIndex, hasLabelAndIcon, iconPosition, onClick, onMouseEnter, onMouseLeave }, ref) => /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
12753
12800
|
TabContainer3,
|
|
12754
12801
|
{
|
|
@@ -12892,16 +12939,16 @@ var TabIconContainer3 = import_styled_components68.default.div`
|
|
|
12892
12939
|
width: 22px;
|
|
12893
12940
|
}
|
|
12894
12941
|
`;
|
|
12895
|
-
var TabLegacy_default = (0,
|
|
12942
|
+
var TabLegacy_default = (0, import_react75.memo)(Tab2);
|
|
12896
12943
|
|
|
12897
12944
|
// src/tabs/TabsLegacy.tsx
|
|
12898
12945
|
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
12899
12946
|
var useResize = (refTabList) => {
|
|
12900
|
-
const [viewWidth, setViewWidth] = (0,
|
|
12901
|
-
const handleWindowSizeChange = (0,
|
|
12947
|
+
const [viewWidth, setViewWidth] = (0, import_react76.useState)(0);
|
|
12948
|
+
const handleWindowSizeChange = (0, import_react76.useCallback)(() => {
|
|
12902
12949
|
setViewWidth(refTabList.current?.offsetWidth ?? 0);
|
|
12903
12950
|
}, [refTabList]);
|
|
12904
|
-
(0,
|
|
12951
|
+
(0, import_react76.useEffect)(() => {
|
|
12905
12952
|
handleWindowSizeChange();
|
|
12906
12953
|
window.addEventListener("resize", handleWindowSizeChange);
|
|
12907
12954
|
return () => {
|
|
@@ -12920,28 +12967,28 @@ var DxcTabs = ({
|
|
|
12920
12967
|
iconPosition = "top",
|
|
12921
12968
|
tabIndex = 0
|
|
12922
12969
|
}) => {
|
|
12923
|
-
const colorsTheme = (0,
|
|
12970
|
+
const colorsTheme = (0, import_react76.useContext)(HalstackContext);
|
|
12924
12971
|
const hasLabelAndIcon = tabs != null && tabs.filter((tab) => tab.label && tab.icon).length > 0;
|
|
12925
12972
|
const firstFocus = tabs != null ? tabs.findIndex((tab) => !tab.isDisabled) : null;
|
|
12926
|
-
const [innerActiveTabIndex, setInnerActiveTabIndex] = (0,
|
|
12973
|
+
const [innerActiveTabIndex, setInnerActiveTabIndex] = (0, import_react76.useState)(
|
|
12927
12974
|
tabs != null && defaultActiveTabIndex && !tabs[defaultActiveTabIndex]?.isDisabled ? defaultActiveTabIndex : firstFocus
|
|
12928
12975
|
);
|
|
12929
|
-
const [activeIndicatorWidth, setActiveIndicatorWidth] = (0,
|
|
12930
|
-
const [activeIndicatorLeft, setActiveIndicatorLeft] = (0,
|
|
12931
|
-
const [translateScroll, setTranslateScroll] = (0,
|
|
12932
|
-
const [scrollRightEnabled, setScrollRightEnabled] = (0,
|
|
12933
|
-
const [scrollLeftEnabled, setScrollLeftEnabled] = (0,
|
|
12934
|
-
const [countClick, setCountClick] = (0,
|
|
12935
|
-
const [totalTabsWidth, setTotalTabsWidth] = (0,
|
|
12936
|
-
const [currentFocusIndex, setCurrentFocusIndex] = (0,
|
|
12937
|
-
const [temporalFocusIndex, setTemporalFocusIndex] = (0,
|
|
12938
|
-
const [minHeightTabs, setMinHeightTabs] = (0,
|
|
12939
|
-
const refTabs = (0,
|
|
12940
|
-
const refTabList = (0,
|
|
12976
|
+
const [activeIndicatorWidth, setActiveIndicatorWidth] = (0, import_react76.useState)(0);
|
|
12977
|
+
const [activeIndicatorLeft, setActiveIndicatorLeft] = (0, import_react76.useState)(0);
|
|
12978
|
+
const [translateScroll, setTranslateScroll] = (0, import_react76.useState)(0);
|
|
12979
|
+
const [scrollRightEnabled, setScrollRightEnabled] = (0, import_react76.useState)(true);
|
|
12980
|
+
const [scrollLeftEnabled, setScrollLeftEnabled] = (0, import_react76.useState)(false);
|
|
12981
|
+
const [countClick, setCountClick] = (0, import_react76.useState)(0);
|
|
12982
|
+
const [totalTabsWidth, setTotalTabsWidth] = (0, import_react76.useState)(0);
|
|
12983
|
+
const [currentFocusIndex, setCurrentFocusIndex] = (0, import_react76.useState)(activeTabIndex ?? innerActiveTabIndex);
|
|
12984
|
+
const [temporalFocusIndex, setTemporalFocusIndex] = (0, import_react76.useState)(activeTabIndex ?? innerActiveTabIndex);
|
|
12985
|
+
const [minHeightTabs, setMinHeightTabs] = (0, import_react76.useState)(0);
|
|
12986
|
+
const refTabs = (0, import_react76.useRef)([]);
|
|
12987
|
+
const refTabList = (0, import_react76.useRef)(null);
|
|
12941
12988
|
const viewWidth = useResize(refTabList);
|
|
12942
|
-
const translatedLabels = (0,
|
|
12943
|
-
const enabledIndicator = (0,
|
|
12944
|
-
(0,
|
|
12989
|
+
const translatedLabels = (0, import_react76.useContext)(HalstackLanguageContext);
|
|
12990
|
+
const enabledIndicator = (0, import_react76.useMemo)(() => viewWidth < totalTabsWidth, [viewWidth]);
|
|
12991
|
+
(0, import_react76.useEffect)(() => {
|
|
12945
12992
|
if (activeTabIndex != null || innerActiveTabIndex != null) {
|
|
12946
12993
|
const sumWidth = refTabs.current?.reduce((count, obj) => count + obj.offsetWidth, 0);
|
|
12947
12994
|
setTotalTabsWidth(sumWidth);
|
|
@@ -12949,10 +12996,10 @@ var DxcTabs = ({
|
|
|
12949
12996
|
setActiveIndicatorLeft(refTabs.current[activeTabIndex ?? innerActiveTabIndex]?.offsetLeft ?? 0);
|
|
12950
12997
|
}
|
|
12951
12998
|
}, [activeTabIndex, innerActiveTabIndex]);
|
|
12952
|
-
(0,
|
|
12999
|
+
(0, import_react76.useEffect)(() => {
|
|
12953
13000
|
setMinHeightTabs((refTabList.current?.offsetHeight ?? 0) + 1);
|
|
12954
13001
|
}, []);
|
|
12955
|
-
(0,
|
|
13002
|
+
(0, import_react76.useEffect)(() => {
|
|
12956
13003
|
if (activeTabIndex && activeTabIndex >= 0) {
|
|
12957
13004
|
setActiveIndicatorWidth(refTabs.current[activeTabIndex]?.offsetWidth ?? 0);
|
|
12958
13005
|
setActiveIndicatorLeft(refTabs.current[activeTabIndex]?.offsetLeft ?? 0);
|
|
@@ -13263,11 +13310,11 @@ var TabsLegacy_default = DxcTabs;
|
|
|
13263
13310
|
// src/tabs/Tabs.tsx
|
|
13264
13311
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
13265
13312
|
var useResize2 = (refTabList) => {
|
|
13266
|
-
const [viewWidth, setViewWidth] = (0,
|
|
13267
|
-
const handleWindowSizeChange = (0,
|
|
13313
|
+
const [viewWidth, setViewWidth] = (0, import_react77.useState)(0);
|
|
13314
|
+
const handleWindowSizeChange = (0, import_react77.useCallback)(() => {
|
|
13268
13315
|
setViewWidth(refTabList?.current?.offsetWidth ?? 0);
|
|
13269
13316
|
}, [refTabList]);
|
|
13270
|
-
(0,
|
|
13317
|
+
(0, import_react77.useEffect)(() => {
|
|
13271
13318
|
handleWindowSizeChange();
|
|
13272
13319
|
window.addEventListener("resize", handleWindowSizeChange);
|
|
13273
13320
|
return () => {
|
|
@@ -13301,51 +13348,51 @@ var DxcTabs2 = ({
|
|
|
13301
13348
|
tabIndex = 0,
|
|
13302
13349
|
children
|
|
13303
13350
|
}) => {
|
|
13304
|
-
const childrenArray = (0,
|
|
13305
|
-
() =>
|
|
13351
|
+
const childrenArray = (0, import_react77.useMemo)(
|
|
13352
|
+
() => import_react77.Children.toArray(children),
|
|
13306
13353
|
[children]
|
|
13307
13354
|
);
|
|
13308
|
-
const hasLabelAndIcon = (0,
|
|
13309
|
-
() => childrenArray.some((child) => (0,
|
|
13355
|
+
const hasLabelAndIcon = (0, import_react77.useMemo)(
|
|
13356
|
+
() => childrenArray.some((child) => (0, import_react77.isValidElement)(child) && child.props.icon && child.props.label),
|
|
13310
13357
|
[childrenArray]
|
|
13311
13358
|
);
|
|
13312
|
-
const [activeTab, setActiveTab] = (0,
|
|
13359
|
+
const [activeTab, setActiveTab] = (0, import_react77.useState)(() => {
|
|
13313
13360
|
const hasActiveChild = childrenArray.some(
|
|
13314
|
-
(child) => (0,
|
|
13361
|
+
(child) => (0, import_react77.isValidElement)(child) && (child.props.active || child.props.defaultActive) && !child.props.disabled
|
|
13315
13362
|
);
|
|
13316
13363
|
const initialActiveTab = hasActiveChild ? childrenArray.find(
|
|
13317
|
-
(child) => (0,
|
|
13318
|
-
) : childrenArray.find((child) => (0,
|
|
13319
|
-
return (0,
|
|
13364
|
+
(child) => (0, import_react77.isValidElement)(child) && (child.props.active || child.props.defaultActive) && !child.props.disabled
|
|
13365
|
+
) : childrenArray.find((child) => (0, import_react77.isValidElement)(child) && !child.props.disabled);
|
|
13366
|
+
return (0, import_react77.isValidElement)(initialActiveTab) ? initialActiveTab.props.label ?? initialActiveTab.props.tabId : "";
|
|
13320
13367
|
});
|
|
13321
|
-
const [innerFocusIndex, setInnerFocusIndex] = (0,
|
|
13322
|
-
const [activeIndicatorWidth, setActiveIndicatorWidth] = (0,
|
|
13323
|
-
const [activeIndicatorLeft, setActiveIndicatorLeft] = (0,
|
|
13324
|
-
const [countClick, setCountClick] = (0,
|
|
13325
|
-
const [totalTabsWidth, setTotalTabsWidth] = (0,
|
|
13326
|
-
const [translateScroll, setTranslateScroll] = (0,
|
|
13327
|
-
const [scrollRightEnabled, setScrollRightEnabled] = (0,
|
|
13328
|
-
const [scrollLeftEnabled, setScrollLeftEnabled] = (0,
|
|
13329
|
-
const [minHeightTabs, setMinHeightTabs] = (0,
|
|
13330
|
-
const refTabList = (0,
|
|
13331
|
-
const refTabListContainer = (0,
|
|
13332
|
-
const colorsTheme = (0,
|
|
13368
|
+
const [innerFocusIndex, setInnerFocusIndex] = (0, import_react77.useState)(null);
|
|
13369
|
+
const [activeIndicatorWidth, setActiveIndicatorWidth] = (0, import_react77.useState)(0);
|
|
13370
|
+
const [activeIndicatorLeft, setActiveIndicatorLeft] = (0, import_react77.useState)(0);
|
|
13371
|
+
const [countClick, setCountClick] = (0, import_react77.useState)(0);
|
|
13372
|
+
const [totalTabsWidth, setTotalTabsWidth] = (0, import_react77.useState)(0);
|
|
13373
|
+
const [translateScroll, setTranslateScroll] = (0, import_react77.useState)(0);
|
|
13374
|
+
const [scrollRightEnabled, setScrollRightEnabled] = (0, import_react77.useState)(true);
|
|
13375
|
+
const [scrollLeftEnabled, setScrollLeftEnabled] = (0, import_react77.useState)(false);
|
|
13376
|
+
const [minHeightTabs, setMinHeightTabs] = (0, import_react77.useState)(0);
|
|
13377
|
+
const refTabList = (0, import_react77.useRef)(null);
|
|
13378
|
+
const refTabListContainer = (0, import_react77.useRef)(null);
|
|
13379
|
+
const colorsTheme = (0, import_react77.useContext)(HalstackContext);
|
|
13333
13380
|
const viewWidth = useResize2(refTabList);
|
|
13334
|
-
const translatedLabels = (0,
|
|
13335
|
-
const enabledIndicator = (0,
|
|
13336
|
-
(0,
|
|
13381
|
+
const translatedLabels = (0, import_react77.useContext)(HalstackLanguageContext);
|
|
13382
|
+
const enabledIndicator = (0, import_react77.useMemo)(() => viewWidth < totalTabsWidth, [viewWidth]);
|
|
13383
|
+
(0, import_react77.useEffect)(() => {
|
|
13337
13384
|
if (refTabList.current) {
|
|
13338
13385
|
setTotalTabsWidth(refTabList.current.firstElementChild?.offsetWidth);
|
|
13339
13386
|
setMinHeightTabs(refTabList.current.offsetHeight + 1);
|
|
13340
13387
|
}
|
|
13341
13388
|
}, []);
|
|
13342
|
-
const contextValue = (0,
|
|
13389
|
+
const contextValue = (0, import_react77.useMemo)(() => {
|
|
13343
13390
|
const focusedChild = innerFocusIndex != null ? childrenArray[innerFocusIndex] : null;
|
|
13344
13391
|
return {
|
|
13345
13392
|
iconPosition,
|
|
13346
13393
|
tabIndex,
|
|
13347
|
-
focusedTab: (0,
|
|
13348
|
-
isControlled: childrenArray.some((child) => (0,
|
|
13394
|
+
focusedTab: (0, import_react77.isValidElement)(focusedChild) ? focusedChild.props.label ?? focusedChild.props.tabId : "",
|
|
13395
|
+
isControlled: childrenArray.some((child) => (0, import_react77.isValidElement)(child) && typeof child.props.active !== "undefined"),
|
|
13349
13396
|
activeTab,
|
|
13350
13397
|
hasLabelAndIcon,
|
|
13351
13398
|
setActiveTab,
|
|
@@ -13406,7 +13453,7 @@ var DxcTabs2 = ({
|
|
|
13406
13453
|
scrollLimitCheck();
|
|
13407
13454
|
}, 0);
|
|
13408
13455
|
};
|
|
13409
|
-
(0,
|
|
13456
|
+
(0, import_react77.useEffect)(() => {
|
|
13410
13457
|
if (refTabList.current)
|
|
13411
13458
|
setTotalTabsWidth(() => {
|
|
13412
13459
|
let total = 0;
|
|
@@ -13444,7 +13491,7 @@ var DxcTabs2 = ({
|
|
|
13444
13491
|
tabWidth: activeIndicatorWidth,
|
|
13445
13492
|
tabLeft: activeIndicatorLeft,
|
|
13446
13493
|
"aria-disabled": childrenArray.some(
|
|
13447
|
-
(child) => (0,
|
|
13494
|
+
(child) => (0, import_react77.isValidElement)(child) && activeTab === (child.props.label ?? child.props.tabId) && child.props.disabled
|
|
13448
13495
|
)
|
|
13449
13496
|
}
|
|
13450
13497
|
)
|
|
@@ -13463,8 +13510,8 @@ var DxcTabs2 = ({
|
|
|
13463
13510
|
)
|
|
13464
13511
|
] })
|
|
13465
13512
|
] }) }),
|
|
13466
|
-
|
|
13467
|
-
if ((0,
|
|
13513
|
+
import_react77.Children.map(children, (child) => {
|
|
13514
|
+
if ((0, import_react77.isValidElement)(child) && (child.props.label ?? child.props.tabId) === activeTab) {
|
|
13468
13515
|
return child.props.children;
|
|
13469
13516
|
}
|
|
13470
13517
|
return null;
|
|
@@ -13588,7 +13635,7 @@ DxcTabs2.Tab = Tab_default2;
|
|
|
13588
13635
|
var Tabs_default = DxcTabs2;
|
|
13589
13636
|
|
|
13590
13637
|
// src/tag/Tag.tsx
|
|
13591
|
-
var
|
|
13638
|
+
var import_react78 = require("react");
|
|
13592
13639
|
var import_styled_components71 = __toESM(require("styled-components"));
|
|
13593
13640
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
13594
13641
|
var TagWrapper = ({ condition, wrapper, children }) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_jsx_runtime79.Fragment, { children: condition ? wrapper(children) : children });
|
|
@@ -13604,8 +13651,8 @@ var DxcTag = ({
|
|
|
13604
13651
|
size = "fitContent",
|
|
13605
13652
|
tabIndex = 0
|
|
13606
13653
|
}) => {
|
|
13607
|
-
const colorsTheme = (0,
|
|
13608
|
-
const [isHovered, changeIsHovered] = (0,
|
|
13654
|
+
const colorsTheme = (0, import_react78.useContext)(HalstackContext);
|
|
13655
|
+
const [isHovered, changeIsHovered] = (0, import_react78.useState)(false);
|
|
13609
13656
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_styled_components71.ThemeProvider, { theme: colorsTheme.tag, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
13610
13657
|
StyledDxcTag,
|
|
13611
13658
|
{
|
|
@@ -13716,11 +13763,11 @@ var TagLabel = import_styled_components71.default.div`
|
|
|
13716
13763
|
var Tag_default = DxcTag;
|
|
13717
13764
|
|
|
13718
13765
|
// src/textarea/Textarea.tsx
|
|
13719
|
-
var
|
|
13766
|
+
var import_react79 = require("react");
|
|
13720
13767
|
var import_styled_components72 = __toESM(require("styled-components"));
|
|
13721
13768
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
13722
13769
|
var patternMatch = (pattern, value) => new RegExp(pattern).test(value);
|
|
13723
|
-
var DxcTextarea = (0,
|
|
13770
|
+
var DxcTextarea = (0, import_react79.forwardRef)(
|
|
13724
13771
|
({
|
|
13725
13772
|
label,
|
|
13726
13773
|
name = "",
|
|
@@ -13745,12 +13792,12 @@ var DxcTextarea = (0, import_react78.forwardRef)(
|
|
|
13745
13792
|
tabIndex = 0,
|
|
13746
13793
|
ariaLabel = "Text area"
|
|
13747
13794
|
}, ref) => {
|
|
13748
|
-
const [innerValue, setInnerValue] = (0,
|
|
13749
|
-
const textareaId = `textarea-${(0,
|
|
13750
|
-
const colorsTheme = (0,
|
|
13751
|
-
const translatedLabels = (0,
|
|
13752
|
-
const textareaRef = (0,
|
|
13753
|
-
const prevValueRef = (0,
|
|
13795
|
+
const [innerValue, setInnerValue] = (0, import_react79.useState)(defaultValue);
|
|
13796
|
+
const textareaId = `textarea-${(0, import_react79.useId)()}`;
|
|
13797
|
+
const colorsTheme = (0, import_react79.useContext)(HalstackContext);
|
|
13798
|
+
const translatedLabels = (0, import_react79.useContext)(HalstackLanguageContext);
|
|
13799
|
+
const textareaRef = (0, import_react79.useRef)(null);
|
|
13800
|
+
const prevValueRef = (0, import_react79.useRef)(null);
|
|
13754
13801
|
const errorId = `error-${textareaId}`;
|
|
13755
13802
|
const isNotOptional = (value2) => value2 === "" && !optional;
|
|
13756
13803
|
const isLengthIncorrect2 = (value2) => value2 !== "" && minLength && maxLength && (value2.length < minLength || value2.length > maxLength);
|
|
@@ -13800,7 +13847,7 @@ var DxcTextarea = (0, import_react78.forwardRef)(
|
|
|
13800
13847
|
const handleOnChange = (event) => {
|
|
13801
13848
|
changeValue(event.target.value);
|
|
13802
13849
|
};
|
|
13803
|
-
(0,
|
|
13850
|
+
(0, import_react79.useEffect)(() => {
|
|
13804
13851
|
if (verticalGrow === "auto" && prevValueRef.current !== (value ?? innerValue) && textareaRef.current) {
|
|
13805
13852
|
const computedStyle = window.getComputedStyle(textareaRef.current);
|
|
13806
13853
|
const textareaLineHeight = parseInt(computedStyle.lineHeight || "0", 10);
|
|
@@ -13944,24 +13991,24 @@ var ErrorMessageContainer3 = import_styled_components72.default.span`
|
|
|
13944
13991
|
var Textarea_default = DxcTextarea;
|
|
13945
13992
|
|
|
13946
13993
|
// src/toast/ToastsQueue.tsx
|
|
13947
|
-
var
|
|
13994
|
+
var import_react83 = require("react");
|
|
13948
13995
|
var import_react_dom3 = require("react-dom");
|
|
13949
13996
|
var import_styled_components74 = __toESM(require("styled-components"));
|
|
13950
13997
|
|
|
13951
13998
|
// src/toast/Toast.tsx
|
|
13952
|
-
var
|
|
13999
|
+
var import_react81 = require("react");
|
|
13953
14000
|
var import_styled_components73 = __toESM(require("styled-components"));
|
|
13954
14001
|
|
|
13955
14002
|
// src/utils/useTimeout.tsx
|
|
13956
|
-
var
|
|
14003
|
+
var import_react80 = require("react");
|
|
13957
14004
|
function useTimeout(callback, delay) {
|
|
13958
|
-
const savedCallback = (0,
|
|
13959
|
-
const timerRef = (0,
|
|
13960
|
-
const clearTimerCallback = (0,
|
|
13961
|
-
(0,
|
|
14005
|
+
const savedCallback = (0, import_react80.useRef)();
|
|
14006
|
+
const timerRef = (0, import_react80.useRef)();
|
|
14007
|
+
const clearTimerCallback = (0, import_react80.useCallback)(() => clearTimeout(timerRef.current), []);
|
|
14008
|
+
(0, import_react80.useEffect)(() => {
|
|
13962
14009
|
savedCallback.current = callback;
|
|
13963
14010
|
}, [callback]);
|
|
13964
|
-
(0,
|
|
14011
|
+
(0, import_react80.useEffect)(() => {
|
|
13965
14012
|
function tick() {
|
|
13966
14013
|
savedCallback.current?.();
|
|
13967
14014
|
}
|
|
@@ -14065,7 +14112,7 @@ var spinnerTheme = {
|
|
|
14065
14112
|
accentColor: getSemantic("info").primaryColor
|
|
14066
14113
|
}
|
|
14067
14114
|
};
|
|
14068
|
-
var ToastIcon = (0,
|
|
14115
|
+
var ToastIcon = (0, import_react81.memo)(
|
|
14069
14116
|
({
|
|
14070
14117
|
icon,
|
|
14071
14118
|
hideSemanticIcon,
|
|
@@ -14088,8 +14135,8 @@ var DxcToast = ({
|
|
|
14088
14135
|
onClear,
|
|
14089
14136
|
semantic
|
|
14090
14137
|
}) => {
|
|
14091
|
-
const [isClosing, setIsClosing] = (0,
|
|
14092
|
-
const translatedLabels = (0,
|
|
14138
|
+
const [isClosing, setIsClosing] = (0, import_react81.useState)(false);
|
|
14139
|
+
const translatedLabels = (0, import_react81.useContext)(HalstackLanguageContext);
|
|
14093
14140
|
const clearClosingAnimationTimer = useTimeout(
|
|
14094
14141
|
() => {
|
|
14095
14142
|
setIsClosing(true);
|
|
@@ -14139,11 +14186,11 @@ var DxcToast = ({
|
|
|
14139
14186
|
] })
|
|
14140
14187
|
] });
|
|
14141
14188
|
};
|
|
14142
|
-
var Toast_default = (0,
|
|
14189
|
+
var Toast_default = (0, import_react81.memo)(DxcToast);
|
|
14143
14190
|
|
|
14144
14191
|
// src/toast/ToastContext.tsx
|
|
14145
|
-
var
|
|
14146
|
-
var ToastContext_default = (0,
|
|
14192
|
+
var import_react82 = require("react");
|
|
14193
|
+
var ToastContext_default = (0, import_react82.createContext)(null);
|
|
14147
14194
|
|
|
14148
14195
|
// src/toast/ToastsQueue.tsx
|
|
14149
14196
|
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
@@ -14174,24 +14221,26 @@ var generateUniqueToastId = (toasts) => {
|
|
|
14174
14221
|
return id;
|
|
14175
14222
|
};
|
|
14176
14223
|
var DxcToastsQueue = ({ children, duration = 3e3 }) => {
|
|
14177
|
-
const [toasts, setToasts] = (0,
|
|
14178
|
-
const [isMounted, setIsMounted] = (0,
|
|
14179
|
-
const adjustedDuration = (0,
|
|
14180
|
-
const
|
|
14181
|
-
|
|
14224
|
+
const [toasts, setToasts] = (0, import_react83.useState)([]);
|
|
14225
|
+
const [isMounted, setIsMounted] = (0, import_react83.useState)(false);
|
|
14226
|
+
const adjustedDuration = (0, import_react83.useMemo)(() => duration > 5e3 ? 5e3 : duration < 3e3 ? 3e3 : duration, [duration]);
|
|
14227
|
+
const id = (0, import_react83.useId)();
|
|
14228
|
+
const remove = (0, import_react83.useCallback)((id2) => {
|
|
14229
|
+
setToasts((prevToasts) => prevToasts.filter((toast) => toast.id !== id2));
|
|
14182
14230
|
}, []);
|
|
14183
|
-
const add = (0,
|
|
14231
|
+
const add = (0, import_react83.useCallback)(
|
|
14184
14232
|
(toast, semantic) => {
|
|
14185
|
-
const
|
|
14186
|
-
setToasts((prevToasts) => [...prevToasts, { id, semantic, ...toast }].slice(-5));
|
|
14187
|
-
return () => remove(
|
|
14233
|
+
const id2 = generateUniqueToastId(toasts);
|
|
14234
|
+
setToasts((prevToasts) => [...prevToasts, { id: id2, semantic, ...toast }].slice(-5));
|
|
14235
|
+
return () => remove(id2);
|
|
14188
14236
|
},
|
|
14189
14237
|
[duration]
|
|
14190
14238
|
);
|
|
14191
|
-
(0,
|
|
14239
|
+
(0, import_react83.useEffect)(() => {
|
|
14192
14240
|
setIsMounted(true);
|
|
14193
14241
|
}, []);
|
|
14194
14242
|
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(ToastContext_default.Provider, { value: add, children: [
|
|
14243
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { id: `toasts-${id}-portal`, style: { position: "absolute" } }),
|
|
14195
14244
|
isMounted && (0, import_react_dom3.createPortal)(
|
|
14196
14245
|
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(ToastsQueue, { children: toasts.map((t) => /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
14197
14246
|
Toast_default,
|
|
@@ -14204,7 +14253,7 @@ var DxcToastsQueue = ({ children, duration = 3e3 }) => {
|
|
|
14204
14253
|
},
|
|
14205
14254
|
t.id
|
|
14206
14255
|
)) }),
|
|
14207
|
-
document.body
|
|
14256
|
+
document.getElementById(`toasts-${id}-portal`) || document.body
|
|
14208
14257
|
),
|
|
14209
14258
|
children
|
|
14210
14259
|
] });
|
|
@@ -14212,7 +14261,7 @@ var DxcToastsQueue = ({ children, duration = 3e3 }) => {
|
|
|
14212
14261
|
var ToastsQueue_default = DxcToastsQueue;
|
|
14213
14262
|
|
|
14214
14263
|
// src/toggle-group/ToggleGroup.tsx
|
|
14215
|
-
var
|
|
14264
|
+
var import_react84 = require("react");
|
|
14216
14265
|
var import_styled_components75 = __toESM(require("styled-components"));
|
|
14217
14266
|
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
14218
14267
|
var DxcToggleGroup = ({
|
|
@@ -14227,9 +14276,9 @@ var DxcToggleGroup = ({
|
|
|
14227
14276
|
multiple = false,
|
|
14228
14277
|
tabIndex = 0
|
|
14229
14278
|
}) => {
|
|
14230
|
-
const toggleGroupLabelId = `label-toggle-group-${(0,
|
|
14231
|
-
const [selectedValue, setSelectedValue] = (0,
|
|
14232
|
-
const colorsTheme = (0,
|
|
14279
|
+
const toggleGroupLabelId = `label-toggle-group-${(0, import_react84.useId)()}`;
|
|
14280
|
+
const [selectedValue, setSelectedValue] = (0, import_react84.useState)(defaultValue ?? (multiple ? [] : -1));
|
|
14281
|
+
const colorsTheme = (0, import_react84.useContext)(HalstackContext);
|
|
14233
14282
|
const handleToggleChange = (selectedOption) => {
|
|
14234
14283
|
let newSelectedOptions = [];
|
|
14235
14284
|
if (value == null) {
|
|
@@ -14381,7 +14430,7 @@ var IconContainer7 = import_styled_components75.default.div`
|
|
|
14381
14430
|
var ToggleGroup_default = DxcToggleGroup;
|
|
14382
14431
|
|
|
14383
14432
|
// src/wizard/Wizard.tsx
|
|
14384
|
-
var
|
|
14433
|
+
var import_react85 = require("react");
|
|
14385
14434
|
var import_styled_components76 = __toESM(require("styled-components"));
|
|
14386
14435
|
|
|
14387
14436
|
// src/wizard/Icons.tsx
|
|
@@ -14555,9 +14604,9 @@ var DxcWizard = ({
|
|
|
14555
14604
|
margin,
|
|
14556
14605
|
tabIndex = 0
|
|
14557
14606
|
}) => {
|
|
14558
|
-
const colorsTheme = (0,
|
|
14559
|
-
const [innerCurrent, setInnerCurrentStep] = (0,
|
|
14560
|
-
const renderedCurrent = (0,
|
|
14607
|
+
const colorsTheme = (0, import_react85.useContext)(HalstackContext);
|
|
14608
|
+
const [innerCurrent, setInnerCurrentStep] = (0, import_react85.useState)(defaultCurrentStep);
|
|
14609
|
+
const renderedCurrent = (0, import_react85.useMemo)(() => currentStep ?? innerCurrent, [currentStep, innerCurrent]);
|
|
14561
14610
|
const handleStepClick = (newValue) => {
|
|
14562
14611
|
setInnerCurrentStep(newValue);
|
|
14563
14612
|
onStepClick?.(newValue);
|
|
@@ -14593,10 +14642,10 @@ var DxcWizard = ({
|
|
|
14593
14642
|
var Wizard_default = DxcWizard;
|
|
14594
14643
|
|
|
14595
14644
|
// src/toast/useToast.tsx
|
|
14596
|
-
var
|
|
14645
|
+
var import_react86 = require("react");
|
|
14597
14646
|
var useToast = () => {
|
|
14598
|
-
const add = (0,
|
|
14599
|
-
const toast = (0,
|
|
14647
|
+
const add = (0, import_react86.useContext)(ToastContext_default);
|
|
14648
|
+
const toast = (0, import_react86.useMemo)(
|
|
14600
14649
|
() => ({
|
|
14601
14650
|
default: (toast2) => add?.(toast2, "default"),
|
|
14602
14651
|
success: (toast2) => add?.(toast2, "success"),
|