@dxc-technology/halstack-react 15.2.1 → 15.3.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/README.md +1 -1
- package/dist/index.d.mts +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.js +963 -916
- package/dist/index.mjs +722 -675
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -41,7 +41,7 @@ __export(index_exports, {
|
|
|
41
41
|
DxcCard: () => Card_default,
|
|
42
42
|
DxcCheckbox: () => Checkbox_default,
|
|
43
43
|
DxcChip: () => Chip_default,
|
|
44
|
-
DxcContainer: () =>
|
|
44
|
+
DxcContainer: () => Container_default,
|
|
45
45
|
DxcContextualMenu: () => DxcContextualMenu,
|
|
46
46
|
DxcDataGrid: () => DataGrid_default,
|
|
47
47
|
DxcDateInput: () => DateInput_default,
|
|
@@ -112,7 +112,7 @@ function styleInject(css2, { insertAt } = {}) {
|
|
|
112
112
|
styleInject('@import "https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,600;0,700;0,800;1,300;1,400;1,600;1,700;1,800&display=swap&family=Material+Symbols+Outlined:FILL@0..1";\n');
|
|
113
113
|
|
|
114
114
|
// src/accordion/Accordion.tsx
|
|
115
|
-
var
|
|
115
|
+
var import_react6 = require("react");
|
|
116
116
|
var import_styled_components5 = __toESM(require("styled-components"));
|
|
117
117
|
|
|
118
118
|
// src/common/coreTokens.ts
|
|
@@ -1998,7 +1998,7 @@ var HalstackProvider = ({ theme, advancedTheme, labels, children }) => {
|
|
|
1998
1998
|
};
|
|
1999
1999
|
|
|
2000
2000
|
// src/accordion/AccordionItem.tsx
|
|
2001
|
-
var
|
|
2001
|
+
var import_react4 = require("react");
|
|
2002
2002
|
var import_styled_components4 = __toESM(require("styled-components"));
|
|
2003
2003
|
|
|
2004
2004
|
// src/icon/Icon.tsx
|
|
@@ -2047,6 +2047,7 @@ var Flex = import_styled_components2.default.div`
|
|
|
2047
2047
|
${typeof props.alignSelf === "string" ? `align-self: ${props.alignSelf};` : ""}
|
|
2048
2048
|
${typeof props.$basis === "string" ? `flex-basis: ${props.$basis};` : ""}
|
|
2049
2049
|
${typeof props.$direction === "string" ? `flex-direction: ${props.$direction};` : ""}
|
|
2050
|
+
${props.$fullHeight ? "height: 100%;" : ""}
|
|
2050
2051
|
${typeof props.$gap === "string" ? `gap: ${props.$gap};` : ""}
|
|
2051
2052
|
${typeof props.$gap === "object" ? `column-gap: ${props.$gap.columnGap}; row-gap: ${props.$gap.rowGap};` : ""}
|
|
2052
2053
|
${typeof props.$grow === "number" ? `flex-grow: ${props.$grow};` : ""}
|
|
@@ -2056,16 +2057,7 @@ var Flex = import_styled_components2.default.div`
|
|
|
2056
2057
|
${typeof props.$wrap === "string" ? `flex-wrap: ${props.$wrap};` : ""}
|
|
2057
2058
|
`}
|
|
2058
2059
|
`;
|
|
2059
|
-
var DxcFlex = ({
|
|
2060
|
-
basis,
|
|
2061
|
-
direction,
|
|
2062
|
-
gap,
|
|
2063
|
-
grow,
|
|
2064
|
-
order,
|
|
2065
|
-
shrink,
|
|
2066
|
-
wrap,
|
|
2067
|
-
...props
|
|
2068
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2060
|
+
var DxcFlex = ({ basis, direction, fullHeight = false, gap, grow, order, shrink, wrap, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2069
2061
|
Flex,
|
|
2070
2062
|
{
|
|
2071
2063
|
$basis: basis,
|
|
@@ -2075,6 +2067,7 @@ var DxcFlex = ({
|
|
|
2075
2067
|
$order: order,
|
|
2076
2068
|
$shrink: shrink,
|
|
2077
2069
|
$wrap: wrap,
|
|
2070
|
+
$fullHeight: fullHeight,
|
|
2078
2071
|
...props
|
|
2079
2072
|
}
|
|
2080
2073
|
);
|
|
@@ -2082,6 +2075,7 @@ var Flex_default = DxcFlex;
|
|
|
2082
2075
|
|
|
2083
2076
|
// src/container/Container.tsx
|
|
2084
2077
|
var import_styled_components3 = __toESM(require("styled-components"));
|
|
2078
|
+
var import_react3 = require("react");
|
|
2085
2079
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
2086
2080
|
var getBorderStyles = (direction, borderProperties) => `border-${direction}: ${borderProperties.width ?? ""} ${borderProperties.style ?? ""} ${borderProperties.color ? getCoreColorToken(borderProperties.color) : ""};`;
|
|
2087
2081
|
var Container = import_styled_components3.default.div`
|
|
@@ -2145,12 +2139,15 @@ var Container = import_styled_components3.default.div`
|
|
|
2145
2139
|
padding-bottom: ${({ padding }) => typeof padding === "object" && padding.bottom ? spaces[padding.bottom] : ""};
|
|
2146
2140
|
padding-left: ${({ padding }) => typeof padding === "object" && padding.left ? spaces[padding.left] : ""};
|
|
2147
2141
|
`;
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
}
|
|
2142
|
+
var DxcContainer = (0, import_react3.forwardRef)(
|
|
2143
|
+
({ display, width, height, overflow, ...props }, ref) => {
|
|
2144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Container, { ref, $display: display, $width: width, $height: height, $overflow: overflow, ...props });
|
|
2145
|
+
}
|
|
2146
|
+
);
|
|
2147
|
+
var Container_default = DxcContainer;
|
|
2151
2148
|
|
|
2152
2149
|
// src/accordion/AccordionItem.tsx
|
|
2153
|
-
var
|
|
2150
|
+
var import_react5 = __toESM(require("react"));
|
|
2154
2151
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
2155
2152
|
var AccordionItem = ({
|
|
2156
2153
|
label = "",
|
|
@@ -2163,10 +2160,10 @@ var AccordionItem = ({
|
|
|
2163
2160
|
children,
|
|
2164
2161
|
tabIndex = 0
|
|
2165
2162
|
}) => {
|
|
2166
|
-
const id = (0,
|
|
2167
|
-
const colorsTheme = (0,
|
|
2168
|
-
const { activeIndex, handlerActiveChange, index, independent } = (0,
|
|
2169
|
-
const isItemExpanded = (0,
|
|
2163
|
+
const id = (0, import_react4.useId)();
|
|
2164
|
+
const colorsTheme = (0, import_react4.useContext)(HalstackContext);
|
|
2165
|
+
const { activeIndex, handlerActiveChange, index, independent } = (0, import_react4.useContext)(AccordionContext_default) ?? {};
|
|
2166
|
+
const isItemExpanded = (0, import_react4.useMemo)(() => {
|
|
2170
2167
|
return independent ? activeIndex === index : Array.isArray(activeIndex) && index !== void 0 && activeIndex.includes(index);
|
|
2171
2168
|
}, [independent, activeIndex, index]);
|
|
2172
2169
|
const handleAccordionState = () => {
|
|
@@ -2182,9 +2179,9 @@ var AccordionItem = ({
|
|
|
2182
2179
|
tabIndex: disabled ? -1 : tabIndex,
|
|
2183
2180
|
"aria-expanded": isItemExpanded,
|
|
2184
2181
|
"aria-controls": `accordion-panel-${id}`,
|
|
2185
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2182
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Container_default, { width: "100%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Flex_default, { gap: "1.5rem", children: [
|
|
2186
2183
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LeftSideContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Flex_default, { gap: "0.75rem", children: [
|
|
2187
|
-
(icon || badge?.position === "before") && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OptionalElement, { children: icon ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IconContainer2, { disabled, children: typeof icon === "string" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon_default, { icon }) : icon }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(StatusContainer, { subLabel, children: disabled ? (0,
|
|
2184
|
+
(icon || badge?.position === "before") && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OptionalElement, { children: icon ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IconContainer2, { disabled, children: typeof icon === "string" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon_default, { icon }) : icon }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(StatusContainer, { subLabel, children: disabled ? (0, import_react4.cloneElement)(badge?.element, { color: "grey" }) : badge?.element }) }),
|
|
2188
2185
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(LabelsContainer, { children: [
|
|
2189
2186
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AccordionLabel, { disabled, children: label }),
|
|
2190
2187
|
subLabel && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SubLabel, { disabled, children: subLabel })
|
|
@@ -2192,8 +2189,8 @@ var AccordionItem = ({
|
|
|
2192
2189
|
] }) }),
|
|
2193
2190
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(RightSideContainer, { children: [
|
|
2194
2191
|
assistiveText && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AssistiveText, { disabled, subLabel, children: assistiveText }),
|
|
2195
|
-
badge && badge?.position === "after" && !assistiveText && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(StatusContainer, { subLabel, children: disabled ?
|
|
2196
|
-
badge?.position !== "after" && statusLight && !assistiveText && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(StatusContainer, { subLabel, children: disabled ?
|
|
2192
|
+
badge && badge?.position === "after" && !assistiveText && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(StatusContainer, { subLabel, children: disabled ? import_react5.default.cloneElement(badge.element, { color: "grey" }) : badge.element }),
|
|
2193
|
+
badge?.position !== "after" && statusLight && !assistiveText && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(StatusContainer, { subLabel, children: disabled ? import_react5.default.cloneElement(statusLight, { mode: "default" }) : statusLight }),
|
|
2197
2194
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CollapseIndicator, { disabled, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon_default, { icon: isItemExpanded ? "expand_less" : "expand_more" }) })
|
|
2198
2195
|
] })
|
|
2199
2196
|
] }) })
|
|
@@ -2331,11 +2328,11 @@ var AccordionItem_default = AccordionItem;
|
|
|
2331
2328
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
2332
2329
|
var DxcAccordion = (props) => {
|
|
2333
2330
|
const { children, margin, onActiveChange } = props;
|
|
2334
|
-
const colorsTheme = (0,
|
|
2335
|
-
const [innerIndexActive, setInnerIndexActive] = (0,
|
|
2331
|
+
const colorsTheme = (0, import_react6.useContext)(HalstackContext);
|
|
2332
|
+
const [innerIndexActive, setInnerIndexActive] = (0, import_react6.useState)(
|
|
2336
2333
|
props.independent ? props.defaultIndexActive ?? -1 : Array.isArray(props.defaultIndexActive) ? props.defaultIndexActive.filter((i) => i !== void 0) : []
|
|
2337
2334
|
);
|
|
2338
|
-
const handlerActiveChange = (0,
|
|
2335
|
+
const handlerActiveChange = (0, import_react6.useCallback)(
|
|
2339
2336
|
(index) => {
|
|
2340
2337
|
if (props.indexActive == null) {
|
|
2341
2338
|
setInnerIndexActive((prev) => {
|
|
@@ -2350,7 +2347,7 @@ var DxcAccordion = (props) => {
|
|
|
2350
2347
|
},
|
|
2351
2348
|
[props.indexActive, props.independent, onActiveChange, innerIndexActive]
|
|
2352
2349
|
);
|
|
2353
|
-
const contextValue = (0,
|
|
2350
|
+
const contextValue = (0, import_react6.useMemo)(
|
|
2354
2351
|
() => ({
|
|
2355
2352
|
activeIndex: props.indexActive ?? innerIndexActive,
|
|
2356
2353
|
handlerActiveChange,
|
|
@@ -2358,7 +2355,7 @@ var DxcAccordion = (props) => {
|
|
|
2358
2355
|
}),
|
|
2359
2356
|
[props.indexActive, innerIndexActive, handlerActiveChange, props.independent]
|
|
2360
2357
|
);
|
|
2361
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_styled_components5.ThemeProvider, { theme: colorsTheme.accordion, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AccordionContainer2, { margin, children:
|
|
2358
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_styled_components5.ThemeProvider, { theme: colorsTheme.accordion, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AccordionContainer2, { margin, children: import_react6.Children.map(children, (accordion, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AccordionContext_default.Provider, { value: { index, ...contextValue }, children: accordion }, `accordion-${index}`)) }) });
|
|
2362
2359
|
};
|
|
2363
2360
|
DxcAccordion.AccordionItem = AccordionItem_default;
|
|
2364
2361
|
var calculateWidth = (margin) => `calc(100% - ${getMargin(margin, "left")} - ${getMargin(margin, "right")})`;
|
|
@@ -2438,21 +2435,21 @@ var Accordion_default = DxcAccordion;
|
|
|
2438
2435
|
|
|
2439
2436
|
// src/alert/Alert.tsx
|
|
2440
2437
|
var import_styled_components11 = __toESM(require("styled-components"));
|
|
2441
|
-
var
|
|
2438
|
+
var import_react13 = require("react");
|
|
2442
2439
|
|
|
2443
2440
|
// src/button/Button.tsx
|
|
2444
|
-
var
|
|
2441
|
+
var import_react9 = require("react");
|
|
2445
2442
|
var import_styled_components7 = __toESM(require("styled-components"));
|
|
2446
2443
|
|
|
2447
2444
|
// src/tooltip/Tooltip.tsx
|
|
2448
2445
|
var import_styled_components6 = __toESM(require("styled-components"));
|
|
2449
|
-
var
|
|
2446
|
+
var import_react8 = require("react");
|
|
2450
2447
|
var import_react_tooltip = require("@radix-ui/react-tooltip");
|
|
2451
2448
|
var import_react_tooltip2 = require("@radix-ui/react-tooltip");
|
|
2452
2449
|
|
|
2453
2450
|
// src/tooltip/TooltipContext.tsx
|
|
2454
|
-
var
|
|
2455
|
-
var TooltipContext = (0,
|
|
2451
|
+
var import_react7 = require("react");
|
|
2452
|
+
var TooltipContext = (0, import_react7.createContext)(false);
|
|
2456
2453
|
|
|
2457
2454
|
// src/tooltip/Tooltip.tsx
|
|
2458
2455
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
@@ -2559,7 +2556,7 @@ var Tooltip = ({
|
|
|
2559
2556
|
position = "bottom",
|
|
2560
2557
|
children
|
|
2561
2558
|
}) => {
|
|
2562
|
-
const hasTooltip = (0,
|
|
2559
|
+
const hasTooltip = (0, import_react8.useContext)(TooltipContext);
|
|
2563
2560
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TooltipContext.Provider, { value: true, children: label && !hasTooltip ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_tooltip2.Provider, { delayDuration: 300, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_tooltip.Root, { children: [
|
|
2564
2561
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_tooltip.Trigger, { asChild: true, children: hasAdditionalContainer ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TooltipTriggerContainer, { children }) : children }),
|
|
2565
2562
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_tooltip.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(StyledTooltipContent, { side: position, sideOffset: 8, children: [
|
|
@@ -2590,7 +2587,7 @@ var DxcButton = ({
|
|
|
2590
2587
|
size = { height: "large", width: "fitContent" },
|
|
2591
2588
|
tabIndex = 0
|
|
2592
2589
|
}) => {
|
|
2593
|
-
const colorsTheme = (0,
|
|
2590
|
+
const colorsTheme = (0, import_react9.useContext)(HalstackContext);
|
|
2594
2591
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_styled_components7.ThemeProvider, { theme: colorsTheme.button, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Tooltip, { label: title, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2595
2592
|
Button,
|
|
2596
2593
|
{
|
|
@@ -3016,7 +3013,7 @@ var StyledDivider = import_styled_components8.default.hr`
|
|
|
3016
3013
|
var Divider_default = DxcDivider;
|
|
3017
3014
|
|
|
3018
3015
|
// src/action-icon/ActionIcon.tsx
|
|
3019
|
-
var
|
|
3016
|
+
var import_react10 = require("react");
|
|
3020
3017
|
var import_styled_components9 = __toESM(require("styled-components"));
|
|
3021
3018
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
3022
3019
|
var ActionIcon = import_styled_components9.default.button`
|
|
@@ -3056,7 +3053,7 @@ var ActionIcon = import_styled_components9.default.button`
|
|
|
3056
3053
|
height: 16px;
|
|
3057
3054
|
}
|
|
3058
3055
|
`;
|
|
3059
|
-
var ActionIcon_default = (0,
|
|
3056
|
+
var ActionIcon_default = (0, import_react10.forwardRef)(
|
|
3060
3057
|
({ disabled = false, title, icon, onClick, tabIndex }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Tooltip, { label: title, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3061
3058
|
ActionIcon,
|
|
3062
3059
|
{
|
|
@@ -3079,7 +3076,7 @@ var import_react_dom = require("react-dom");
|
|
|
3079
3076
|
var import_styled_components10 = __toESM(require("styled-components"));
|
|
3080
3077
|
|
|
3081
3078
|
// src/utils/FocusLock.tsx
|
|
3082
|
-
var
|
|
3079
|
+
var import_react11 = require("react");
|
|
3083
3080
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
3084
3081
|
var not = {
|
|
3085
3082
|
negTabIndex: ':not([tabindex^="-"])',
|
|
@@ -3112,8 +3109,8 @@ var radixPortalContains = (activeElement) => {
|
|
|
3112
3109
|
return Array.prototype.slice.call(radixPortals).some((portal) => portal.contains(activeElement)) || Array.prototype.slice.call(radixPoppers).some((popper) => popper.contains(activeElement));
|
|
3113
3110
|
};
|
|
3114
3111
|
var useFocusableElements = (ref) => {
|
|
3115
|
-
const [focusableElements, setFocusableElements] = (0,
|
|
3116
|
-
(0,
|
|
3112
|
+
const [focusableElements, setFocusableElements] = (0, import_react11.useState)(null);
|
|
3113
|
+
(0, import_react11.useEffect)(() => {
|
|
3117
3114
|
if (ref.current != null) {
|
|
3118
3115
|
setFocusableElements(getFocusableElements(ref.current));
|
|
3119
3116
|
const observer = new MutationObserver(() => {
|
|
@@ -3128,10 +3125,10 @@ var useFocusableElements = (ref) => {
|
|
|
3128
3125
|
return focusableElements;
|
|
3129
3126
|
};
|
|
3130
3127
|
var FocusLock = ({ children }) => {
|
|
3131
|
-
const childrenContainerRef = (0,
|
|
3128
|
+
const childrenContainerRef = (0, import_react11.useRef)(null);
|
|
3132
3129
|
const focusableElements = useFocusableElements(childrenContainerRef);
|
|
3133
|
-
const initialFocus = (0,
|
|
3134
|
-
const focusFirst = (0,
|
|
3130
|
+
const initialFocus = (0, import_react11.useRef)(false);
|
|
3131
|
+
const focusFirst = (0, import_react11.useCallback)(() => {
|
|
3135
3132
|
if (focusableElements != null) {
|
|
3136
3133
|
if (focusableElements.length === 0) childrenContainerRef.current?.focus();
|
|
3137
3134
|
else if (focusableElements.length > 0) focusableElements.some((element) => attemptFocus(element));
|
|
@@ -3143,13 +3140,13 @@ var FocusLock = ({ children }) => {
|
|
|
3143
3140
|
const focusLock = (event) => {
|
|
3144
3141
|
if (event.key === "Tab" && focusableElements?.length === 0) event.preventDefault();
|
|
3145
3142
|
};
|
|
3146
|
-
(0,
|
|
3143
|
+
(0, import_react11.useEffect)(() => {
|
|
3147
3144
|
if (focusableElements != null && !initialFocus.current) {
|
|
3148
3145
|
initialFocus.current = true;
|
|
3149
3146
|
focusFirst();
|
|
3150
3147
|
}
|
|
3151
3148
|
}, [focusableElements, focusFirst]);
|
|
3152
|
-
(0,
|
|
3149
|
+
(0, import_react11.useEffect)(() => {
|
|
3153
3150
|
const focusGuardHandler = (event) => {
|
|
3154
3151
|
const target = event.relatedTarget;
|
|
3155
3152
|
const container = childrenContainerRef.current;
|
|
@@ -3179,6 +3176,7 @@ var FocusLock = ({ children }) => {
|
|
|
3179
3176
|
var FocusLock_default = FocusLock;
|
|
3180
3177
|
|
|
3181
3178
|
// src/alert/ModalAlertWrapper.tsx
|
|
3179
|
+
var import_react12 = require("react");
|
|
3182
3180
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
3183
3181
|
var BodyStyle = import_styled_components10.createGlobalStyle`
|
|
3184
3182
|
body {
|
|
@@ -3211,16 +3209,24 @@ var ModalAlertContainer = import_styled_components10.default.div`
|
|
|
3211
3209
|
min-width: 92%;
|
|
3212
3210
|
}
|
|
3213
3211
|
`;
|
|
3214
|
-
var ModalAlertWrapper = ({ condition, onClose, children }) =>
|
|
3215
|
-
|
|
3216
|
-
(0,
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3212
|
+
var ModalAlertWrapper = ({ condition, onClose, children }) => {
|
|
3213
|
+
const id = (0, import_react12.useId)();
|
|
3214
|
+
const [portalContainer, setPortalContainer] = (0, import_react12.useState)(null);
|
|
3215
|
+
(0, import_react12.useEffect)(() => {
|
|
3216
|
+
setPortalContainer(document.getElementById(`dialog-${id}-portal`));
|
|
3217
|
+
}, []);
|
|
3218
|
+
return condition ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
3219
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BodyStyle, {}),
|
|
3220
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { id: `dialog-${id}-portal`, style: { position: "absolute" } }),
|
|
3221
|
+
portalContainer && (0, import_react_dom.createPortal)(
|
|
3222
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Modal, { children: [
|
|
3223
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Overlay, { onClick: onClose }),
|
|
3224
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ModalAlertContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FocusLock_default, { children }) })
|
|
3225
|
+
] }),
|
|
3226
|
+
portalContainer
|
|
3227
|
+
)
|
|
3228
|
+
] }) : children;
|
|
3229
|
+
};
|
|
3224
3230
|
var ModalAlertWrapper_default = ModalAlertWrapper;
|
|
3225
3231
|
|
|
3226
3232
|
// src/alert/Alert.tsx
|
|
@@ -3270,7 +3276,7 @@ var NavigationText = import_styled_components11.default.span`
|
|
|
3270
3276
|
${typographyStyles}
|
|
3271
3277
|
white-space: nowrap;
|
|
3272
3278
|
`;
|
|
3273
|
-
var Actions = (0,
|
|
3279
|
+
var Actions = (0, import_react13.memo)(
|
|
3274
3280
|
({
|
|
3275
3281
|
mode,
|
|
3276
3282
|
primaryAction,
|
|
@@ -3321,15 +3327,15 @@ function DxcAlert({
|
|
|
3321
3327
|
semantic = "info",
|
|
3322
3328
|
title = ""
|
|
3323
3329
|
}) {
|
|
3324
|
-
const [messages, setMessages] = (0,
|
|
3325
|
-
const [currentIndex, setCurrentIndex] = (0,
|
|
3326
|
-
const id = (0,
|
|
3327
|
-
const colorsTheme = (0,
|
|
3328
|
-
const translatedLabels = (0,
|
|
3330
|
+
const [messages, setMessages] = (0, import_react13.useState)(Array.isArray(message) ? message : [message]);
|
|
3331
|
+
const [currentIndex, setCurrentIndex] = (0, import_react13.useState)(0);
|
|
3332
|
+
const id = (0, import_react13.useId)();
|
|
3333
|
+
const colorsTheme = (0, import_react13.useContext)(HalstackContext);
|
|
3334
|
+
const translatedLabels = (0, import_react13.useContext)(HalstackLanguageContext);
|
|
3329
3335
|
const handleNextOnClick = () => {
|
|
3330
3336
|
setCurrentIndex((prevIndex) => prevIndex < messages.length ? prevIndex + 1 : prevIndex);
|
|
3331
3337
|
};
|
|
3332
|
-
const handlePrevOnClick = (0,
|
|
3338
|
+
const handlePrevOnClick = (0, import_react13.useCallback)(() => {
|
|
3333
3339
|
setCurrentIndex((prevIndex) => prevIndex > 0 ? prevIndex - 1 : prevIndex);
|
|
3334
3340
|
}, []);
|
|
3335
3341
|
const handleOnClose = () => {
|
|
@@ -3338,7 +3344,7 @@ function DxcAlert({
|
|
|
3338
3344
|
setMessages((prevMessages) => prevMessages.filter((_, index) => index !== currentIndex));
|
|
3339
3345
|
}
|
|
3340
3346
|
};
|
|
3341
|
-
(0,
|
|
3347
|
+
(0, import_react13.useEffect)(() => {
|
|
3342
3348
|
if (currentIndex === messages.length) handlePrevOnClick();
|
|
3343
3349
|
}, [currentIndex, messages, handlePrevOnClick]);
|
|
3344
3350
|
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 +3433,11 @@ function DxcAlert({
|
|
|
3427
3433
|
}
|
|
3428
3434
|
|
|
3429
3435
|
// src/layout/ApplicationLayout.tsx
|
|
3430
|
-
var
|
|
3436
|
+
var import_react24 = require("react");
|
|
3431
3437
|
var import_styled_components19 = __toESM(require("styled-components"));
|
|
3432
3438
|
|
|
3433
3439
|
// src/footer/Footer.tsx
|
|
3434
|
-
var
|
|
3440
|
+
var import_react14 = require("react");
|
|
3435
3441
|
var import_styled_components12 = __toESM(require("styled-components"));
|
|
3436
3442
|
|
|
3437
3443
|
// src/footer/Icons.tsx
|
|
@@ -3634,9 +3640,9 @@ var DxcFooter = ({
|
|
|
3634
3640
|
tabIndex = 0,
|
|
3635
3641
|
mode = "default"
|
|
3636
3642
|
}) => {
|
|
3637
|
-
const colorsTheme = (0,
|
|
3638
|
-
const translatedLabels = (0,
|
|
3639
|
-
const footerLogo = (0,
|
|
3643
|
+
const colorsTheme = (0, import_react14.useContext)(HalstackContext);
|
|
3644
|
+
const translatedLabels = (0, import_react14.useContext)(HalstackLanguageContext);
|
|
3645
|
+
const footerLogo = (0, import_react14.useMemo)(
|
|
3640
3646
|
() => !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
3647
|
[colorsTheme, translatedLabels]
|
|
3642
3648
|
);
|
|
@@ -3783,19 +3789,19 @@ var BottomLink = import_styled_components12.default.a`
|
|
|
3783
3789
|
var Footer_default = DxcFooter;
|
|
3784
3790
|
|
|
3785
3791
|
// src/header/Header.tsx
|
|
3786
|
-
var
|
|
3792
|
+
var import_react19 = require("react");
|
|
3787
3793
|
var import_styled_components16 = __toESM(require("styled-components"));
|
|
3788
3794
|
|
|
3789
3795
|
// src/dropdown/Dropdown.tsx
|
|
3790
3796
|
var Popover = __toESM(require("@radix-ui/react-popover"));
|
|
3791
|
-
var
|
|
3797
|
+
var import_react18 = require("react");
|
|
3792
3798
|
var import_styled_components15 = __toESM(require("styled-components"));
|
|
3793
3799
|
|
|
3794
3800
|
// src/utils/useWidth.tsx
|
|
3795
|
-
var
|
|
3801
|
+
var import_react15 = require("react");
|
|
3796
3802
|
var useWidth = (target) => {
|
|
3797
|
-
const [width, setWidth] = (0,
|
|
3798
|
-
(0,
|
|
3803
|
+
const [width, setWidth] = (0, import_react15.useState)(0);
|
|
3804
|
+
(0, import_react15.useLayoutEffect)(() => {
|
|
3799
3805
|
if (target != null) {
|
|
3800
3806
|
setWidth(target.getBoundingClientRect().width);
|
|
3801
3807
|
const triggerObserver = new ResizeObserver((entries) => {
|
|
@@ -3815,11 +3821,11 @@ var useWidth = (target) => {
|
|
|
3815
3821
|
var useWidth_default = useWidth;
|
|
3816
3822
|
|
|
3817
3823
|
// src/dropdown/DropdownMenu.tsx
|
|
3818
|
-
var
|
|
3824
|
+
var import_react17 = require("react");
|
|
3819
3825
|
var import_styled_components14 = __toESM(require("styled-components"));
|
|
3820
3826
|
|
|
3821
3827
|
// src/dropdown/DropdownMenuItem.tsx
|
|
3822
|
-
var
|
|
3828
|
+
var import_react16 = require("react");
|
|
3823
3829
|
var import_styled_components13 = __toESM(require("styled-components"));
|
|
3824
3830
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3825
3831
|
var DropdownMenuItem = ({
|
|
@@ -3884,11 +3890,11 @@ var DropdownMenuItemIcon = import_styled_components13.default.div`
|
|
|
3884
3890
|
height: ${(props) => props.theme.optionIconSize};
|
|
3885
3891
|
}
|
|
3886
3892
|
`;
|
|
3887
|
-
var DropdownMenuItem_default = (0,
|
|
3893
|
+
var DropdownMenuItem_default = (0, import_react16.memo)(DropdownMenuItem);
|
|
3888
3894
|
|
|
3889
3895
|
// src/dropdown/DropdownMenu.tsx
|
|
3890
3896
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3891
|
-
var DropdownMenu = (0,
|
|
3897
|
+
var DropdownMenu = (0, import_react17.forwardRef)(
|
|
3892
3898
|
({ id, dropdownTriggerId, iconsPosition, visualFocusIndex, menuItemOnClick, onKeyDown, options, styles }, ref) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3893
3899
|
DropdownMenuContainer,
|
|
3894
3900
|
{
|
|
@@ -3948,7 +3954,7 @@ var DropdownMenuContainer = import_styled_components14.default.ul`
|
|
|
3948
3954
|
border-radius: 6px;
|
|
3949
3955
|
}
|
|
3950
3956
|
`;
|
|
3951
|
-
var DropdownMenu_default = (0,
|
|
3957
|
+
var DropdownMenu_default = (0, import_react17.memo)(DropdownMenu);
|
|
3952
3958
|
|
|
3953
3959
|
// src/dropdown/Dropdown.tsx
|
|
3954
3960
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
@@ -3967,14 +3973,14 @@ var DxcDropdown = ({
|
|
|
3967
3973
|
tabIndex = 0,
|
|
3968
3974
|
title
|
|
3969
3975
|
}) => {
|
|
3970
|
-
const id = (0,
|
|
3976
|
+
const id = (0, import_react18.useId)();
|
|
3971
3977
|
const triggerId = `trigger-${id}`;
|
|
3972
3978
|
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,
|
|
3979
|
+
const [isOpen, changeIsOpen] = (0, import_react18.useState)(false);
|
|
3980
|
+
const [visualFocusIndex, setVisualFocusIndex] = (0, import_react18.useState)(0);
|
|
3981
|
+
const colorsTheme = (0, import_react18.useContext)(HalstackContext);
|
|
3982
|
+
const triggerRef = (0, import_react18.useRef)(null);
|
|
3983
|
+
const menuRef = (0, import_react18.useRef)(null);
|
|
3978
3984
|
const width = useWidth_default(triggerRef.current);
|
|
3979
3985
|
const handleOnOpenMenu = () => {
|
|
3980
3986
|
changeIsOpen(true);
|
|
@@ -3983,7 +3989,7 @@ var DxcDropdown = ({
|
|
|
3983
3989
|
changeIsOpen(false);
|
|
3984
3990
|
setVisualFocusIndex(0);
|
|
3985
3991
|
};
|
|
3986
|
-
const handleMenuItemOnClick = (0,
|
|
3992
|
+
const handleMenuItemOnClick = (0, import_react18.useCallback)(
|
|
3987
3993
|
(value) => {
|
|
3988
3994
|
if (value) onSelectOption(value);
|
|
3989
3995
|
handleOnCloseMenu();
|
|
@@ -4030,7 +4036,7 @@ var DxcDropdown = ({
|
|
|
4030
4036
|
return index;
|
|
4031
4037
|
});
|
|
4032
4038
|
};
|
|
4033
|
-
const handleMenuOnKeyDown = (0,
|
|
4039
|
+
const handleMenuOnKeyDown = (0, import_react18.useCallback)(
|
|
4034
4040
|
(event) => {
|
|
4035
4041
|
switch (event.key) {
|
|
4036
4042
|
case "Up":
|
|
@@ -4077,79 +4083,82 @@ var DxcDropdown = ({
|
|
|
4077
4083
|
},
|
|
4078
4084
|
[onSelectOption, visualFocusIndex, options]
|
|
4079
4085
|
);
|
|
4080
|
-
(0,
|
|
4086
|
+
(0, import_react18.useLayoutEffect)(() => {
|
|
4081
4087
|
const visualFocusedMenuItem = menuRef.current?.querySelectorAll("[role='menuitem']")[visualFocusIndex];
|
|
4082
4088
|
visualFocusedMenuItem?.scrollIntoView?.({
|
|
4083
4089
|
block: "nearest",
|
|
4084
4090
|
inline: "start"
|
|
4085
4091
|
});
|
|
4086
4092
|
}, [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
|
-
|
|
4093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_styled_components15.ThemeProvider, { theme: colorsTheme.dropdown, children: [
|
|
4094
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4095
|
+
DropdownContainer,
|
|
4096
|
+
{
|
|
4097
|
+
onMouseEnter: !disabled && expandOnHover ? handleOnOpenMenu : void 0,
|
|
4098
|
+
onMouseLeave: !disabled && expandOnHover ? handleOnCloseMenu : void 0,
|
|
4099
|
+
onBlur: !disabled ? handleOnBlur : void 0,
|
|
4100
|
+
margin,
|
|
4101
|
+
size,
|
|
4102
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Popover.Root, { open: isOpen, children: [
|
|
4103
|
+
/* @__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)(
|
|
4104
|
+
DropdownTrigger,
|
|
4105
|
+
{
|
|
4106
|
+
onClick: handleTriggerOnClick,
|
|
4107
|
+
onKeyDown: handleTriggerOnKeyDown,
|
|
4108
|
+
onBlur: (event) => {
|
|
4109
|
+
event.stopPropagation();
|
|
4110
|
+
},
|
|
4111
|
+
disabled,
|
|
4112
|
+
label,
|
|
4113
|
+
margin,
|
|
4114
|
+
size,
|
|
4115
|
+
id: triggerId,
|
|
4116
|
+
"aria-haspopup": "true",
|
|
4117
|
+
"aria-controls": isOpen ? menuId : void 0,
|
|
4118
|
+
"aria-expanded": isOpen ? true : void 0,
|
|
4119
|
+
"aria-label": "Show options",
|
|
4120
|
+
tabIndex,
|
|
4121
|
+
ref: triggerRef,
|
|
4122
|
+
children: [
|
|
4123
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DropdownTriggerContent, { children: [
|
|
4124
|
+
label && iconPosition === "after" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DropdownTriggerLabel, { children: label }),
|
|
4125
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4126
|
+
DropdownTriggerIcon,
|
|
4127
|
+
{
|
|
4128
|
+
disabled,
|
|
4129
|
+
role: typeof icon === "string" ? void 0 : "img",
|
|
4130
|
+
"aria-hidden": true,
|
|
4131
|
+
children: typeof icon === "string" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon_default, { icon }) : icon
|
|
4132
|
+
}
|
|
4133
|
+
),
|
|
4134
|
+
label && iconPosition === "before" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DropdownTriggerLabel, { children: label })
|
|
4135
|
+
] }),
|
|
4136
|
+
!caretHidden && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(CaretIcon, { disabled, children: [
|
|
4137
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon_default, { icon: isOpen ? "arrow_drop_up" : "arrow_drop_down" }),
|
|
4138
|
+
" "
|
|
4139
|
+
] })
|
|
4140
|
+
]
|
|
4141
|
+
}
|
|
4142
|
+
) }) }),
|
|
4143
|
+
/* @__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)(
|
|
4144
|
+
DropdownMenu_default,
|
|
4145
|
+
{
|
|
4146
|
+
id: menuId,
|
|
4147
|
+
dropdownTriggerId: triggerId,
|
|
4148
|
+
options,
|
|
4149
|
+
iconsPosition: optionsIconPosition,
|
|
4150
|
+
visualFocusIndex,
|
|
4151
|
+
menuItemOnClick: handleMenuItemOnClick,
|
|
4152
|
+
onKeyDown: handleMenuOnKeyDown,
|
|
4153
|
+
styles: { width, zIndex: "320" },
|
|
4154
|
+
ref: menuRef
|
|
4155
|
+
}
|
|
4156
|
+
) }) })
|
|
4157
|
+
] })
|
|
4158
|
+
}
|
|
4159
|
+
),
|
|
4160
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { id: `${id}-portal`, style: { position: "absolute" } })
|
|
4161
|
+
] });
|
|
4153
4162
|
};
|
|
4154
4163
|
var sizes = {
|
|
4155
4164
|
small: "60px",
|
|
@@ -4240,7 +4249,7 @@ var CaretIcon = import_styled_components15.default.span`
|
|
|
4240
4249
|
var Dropdown_default = DxcDropdown;
|
|
4241
4250
|
|
|
4242
4251
|
// src/header/Header.tsx
|
|
4243
|
-
var
|
|
4252
|
+
var import_react20 = require("react");
|
|
4244
4253
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
4245
4254
|
var Dropdown = (props) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(HeaderDropdown, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Dropdown_default, { ...props }) });
|
|
4246
4255
|
var getLogoElement = (themeInput, logoLabel) => {
|
|
@@ -4278,11 +4287,11 @@ var DxcHeader = ({
|
|
|
4278
4287
|
margin,
|
|
4279
4288
|
tabIndex = 0
|
|
4280
4289
|
}) => {
|
|
4281
|
-
const [isResponsive, setIsResponsive] = (0,
|
|
4282
|
-
const [isMenuVisible, setIsMenuVisible] = (0,
|
|
4283
|
-
const colorsTheme = (0,
|
|
4284
|
-
const translatedLabels = (0,
|
|
4285
|
-
const ref = (0,
|
|
4290
|
+
const [isResponsive, setIsResponsive] = (0, import_react19.useState)(false);
|
|
4291
|
+
const [isMenuVisible, setIsMenuVisible] = (0, import_react19.useState)(false);
|
|
4292
|
+
const colorsTheme = (0, import_react20.useContext)(HalstackContext);
|
|
4293
|
+
const translatedLabels = (0, import_react20.useContext)(HalstackLanguageContext);
|
|
4294
|
+
const ref = (0, import_react19.useRef)(null);
|
|
4286
4295
|
const handleMenu = () => {
|
|
4287
4296
|
if (isResponsive && !isMenuVisible) {
|
|
4288
4297
|
setIsMenuVisible(!isMenuVisible);
|
|
@@ -4290,15 +4299,15 @@ var DxcHeader = ({
|
|
|
4290
4299
|
setIsMenuVisible(!isMenuVisible);
|
|
4291
4300
|
}
|
|
4292
4301
|
};
|
|
4293
|
-
const headerLogo = (0,
|
|
4302
|
+
const headerLogo = (0, import_react19.useMemo)(
|
|
4294
4303
|
() => getLogoElement(colorsTheme.header.logo, translatedLabels.formFields.logoAlternativeText),
|
|
4295
4304
|
[colorsTheme, translatedLabels]
|
|
4296
4305
|
);
|
|
4297
|
-
const headerResponsiveLogo = (0,
|
|
4306
|
+
const headerResponsiveLogo = (0, import_react19.useMemo)(
|
|
4298
4307
|
() => getLogoElement(colorsTheme.header.logoResponsive, translatedLabels.formFields.logoAlternativeText),
|
|
4299
4308
|
[colorsTheme, translatedLabels]
|
|
4300
4309
|
);
|
|
4301
|
-
(0,
|
|
4310
|
+
(0, import_react19.useEffect)(() => {
|
|
4302
4311
|
const handleResize = () => {
|
|
4303
4312
|
setIsResponsive(window.matchMedia(`(max-width: ${responsiveSizes.medium}rem)`).matches);
|
|
4304
4313
|
};
|
|
@@ -4308,7 +4317,7 @@ var DxcHeader = ({
|
|
|
4308
4317
|
window.removeEventListener("resize", handleResize);
|
|
4309
4318
|
};
|
|
4310
4319
|
}, []);
|
|
4311
|
-
(0,
|
|
4320
|
+
(0, import_react19.useEffect)(() => {
|
|
4312
4321
|
if (!isResponsive) {
|
|
4313
4322
|
setIsMenuVisible(false);
|
|
4314
4323
|
}
|
|
@@ -4505,7 +4514,7 @@ var Overlay2 = import_styled_components16.default.div`
|
|
|
4505
4514
|
var Header_default = DxcHeader;
|
|
4506
4515
|
|
|
4507
4516
|
// src/sidenav/Sidenav.tsx
|
|
4508
|
-
var
|
|
4517
|
+
var import_react22 = require("react");
|
|
4509
4518
|
var import_styled_components18 = __toESM(require("styled-components"));
|
|
4510
4519
|
|
|
4511
4520
|
// src/bleed/Bleed.tsx
|
|
@@ -4535,20 +4544,20 @@ var Bleed = ({ space, horizontal, vertical, top, right, bottom, left, children }
|
|
|
4535
4544
|
var Bleed_default = Bleed;
|
|
4536
4545
|
|
|
4537
4546
|
// src/sidenav/SidenavContext.tsx
|
|
4538
|
-
var
|
|
4539
|
-
var SidenavContext = (0,
|
|
4540
|
-
var GroupContext = (0,
|
|
4547
|
+
var import_react21 = require("react");
|
|
4548
|
+
var SidenavContext = (0, import_react21.createContext)(null);
|
|
4549
|
+
var GroupContext = (0, import_react21.createContext)(null);
|
|
4541
4550
|
var SidenavContextProvider = SidenavContext.Provider;
|
|
4542
4551
|
var GroupContextProvider = GroupContext.Provider;
|
|
4543
4552
|
var useResponsiveSidenavVisibility = () => {
|
|
4544
|
-
const changeResponsiveSidenavVisibility = (0,
|
|
4553
|
+
const changeResponsiveSidenavVisibility = (0, import_react21.useContext)(SidenavContext);
|
|
4545
4554
|
return changeResponsiveSidenavVisibility;
|
|
4546
4555
|
};
|
|
4547
4556
|
|
|
4548
4557
|
// src/sidenav/Sidenav.tsx
|
|
4549
4558
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
4550
4559
|
var DxcSidenav = ({ title, children }) => {
|
|
4551
|
-
const colorsTheme = (0,
|
|
4560
|
+
const colorsTheme = (0, import_react22.useContext)(HalstackContext);
|
|
4552
4561
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_styled_components18.ThemeProvider, { theme: colorsTheme.sidenav, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(SidenavContainer, { children: [
|
|
4553
4562
|
title,
|
|
4554
4563
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Flex_default, { direction: "column", gap: "1rem", children })
|
|
@@ -4560,8 +4569,8 @@ var Section = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(i
|
|
|
4560
4569
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Divider, {})
|
|
4561
4570
|
] });
|
|
4562
4571
|
var Group = ({ title, collapsable = false, icon, children }) => {
|
|
4563
|
-
const [collapsed, setCollapsed] = (0,
|
|
4564
|
-
const [isSelected, changeIsSelected] = (0,
|
|
4572
|
+
const [collapsed, setCollapsed] = (0, import_react22.useState)(false);
|
|
4573
|
+
const [isSelected, changeIsSelected] = (0, import_react22.useState)(false);
|
|
4565
4574
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(GroupContextProvider, { value: changeIsSelected, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(SidenavGroup, { children: [
|
|
4566
4575
|
collapsable && title ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
4567
4576
|
SidenavGroupTitleButton,
|
|
@@ -4584,15 +4593,15 @@ var Group = ({ title, collapsable = false, icon, children }) => {
|
|
|
4584
4593
|
!collapsed && children
|
|
4585
4594
|
] }) });
|
|
4586
4595
|
};
|
|
4587
|
-
var Link = (0,
|
|
4596
|
+
var Link = (0, import_react22.forwardRef)(
|
|
4588
4597
|
({ href, newWindow = false, selected = false, icon, onClick, tabIndex = 0, children, ...otherProps }, ref) => {
|
|
4589
|
-
const changeIsGroupSelected = (0,
|
|
4598
|
+
const changeIsGroupSelected = (0, import_react22.useContext)(GroupContext);
|
|
4590
4599
|
const setIsSidenavVisibleResponsive = useResponsiveSidenavVisibility();
|
|
4591
4600
|
const handleClick = ($event) => {
|
|
4592
4601
|
onClick?.($event);
|
|
4593
4602
|
setIsSidenavVisibleResponsive?.(false);
|
|
4594
4603
|
};
|
|
4595
|
-
(0,
|
|
4604
|
+
(0, import_react22.useEffect)(() => {
|
|
4596
4605
|
changeIsGroupSelected?.((isGroupSelected2) => !isGroupSelected2 ? selected : isGroupSelected2);
|
|
4597
4606
|
}, [selected, changeIsGroupSelected]);
|
|
4598
4607
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
@@ -4766,7 +4775,7 @@ DxcSidenav.Title = Title2;
|
|
|
4766
4775
|
var Sidenav_default = DxcSidenav;
|
|
4767
4776
|
|
|
4768
4777
|
// src/layout/utils.tsx
|
|
4769
|
-
var
|
|
4778
|
+
var import_react23 = require("react");
|
|
4770
4779
|
|
|
4771
4780
|
// src/layout/Icons.tsx
|
|
4772
4781
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
@@ -4853,10 +4862,10 @@ var socialLinks = [
|
|
|
4853
4862
|
title: "Facebook"
|
|
4854
4863
|
}
|
|
4855
4864
|
];
|
|
4856
|
-
var findChildType = (children, childType) =>
|
|
4865
|
+
var findChildType = (children, childType) => import_react23.Children.toArray(children).find((child) => (0, import_react23.isValidElement)(child) && child.type === childType);
|
|
4857
4866
|
var useResponsive = (breakpoint) => {
|
|
4858
|
-
const [isResponsive, setIsResponsive] = (0,
|
|
4859
|
-
(0,
|
|
4867
|
+
const [isResponsive, setIsResponsive] = (0, import_react23.useState)(false);
|
|
4868
|
+
(0, import_react23.useEffect)(() => {
|
|
4860
4869
|
const handleResize = () => {
|
|
4861
4870
|
setIsResponsive(window.matchMedia(`(max-width: ${breakpoint}rem)`).matches);
|
|
4862
4871
|
};
|
|
@@ -4968,14 +4977,14 @@ var DxcApplicationLayout = ({
|
|
|
4968
4977
|
footer,
|
|
4969
4978
|
children
|
|
4970
4979
|
}) => {
|
|
4971
|
-
const [isSidenavVisibleResponsive, setIsSidenavVisibleResponsive] = (0,
|
|
4980
|
+
const [isSidenavVisibleResponsive, setIsSidenavVisibleResponsive] = (0, import_react24.useState)(false);
|
|
4972
4981
|
const isResponsive = useResponsive(responsiveSizes.large);
|
|
4973
|
-
const ref = (0,
|
|
4974
|
-
const translatedLabels = (0,
|
|
4982
|
+
const ref = (0, import_react24.useRef)(null);
|
|
4983
|
+
const translatedLabels = (0, import_react24.useContext)(HalstackLanguageContext);
|
|
4975
4984
|
const handleSidenavVisibility = () => {
|
|
4976
4985
|
setIsSidenavVisibleResponsive((currentIsSidenavVisibleResponsive) => !currentIsSidenavVisibleResponsive);
|
|
4977
4986
|
};
|
|
4978
|
-
(0,
|
|
4987
|
+
(0, import_react24.useEffect)(() => {
|
|
4979
4988
|
if (!isResponsive) {
|
|
4980
4989
|
setIsSidenavVisibleResponsive(false);
|
|
4981
4990
|
}
|
|
@@ -5144,7 +5153,7 @@ var Label = import_styled_components20.default.span`
|
|
|
5144
5153
|
var Badge_default = DxcBadge;
|
|
5145
5154
|
|
|
5146
5155
|
// src/breadcrumbs/Breadcrumbs.tsx
|
|
5147
|
-
var
|
|
5156
|
+
var import_react26 = require("react");
|
|
5148
5157
|
var import_styled_components22 = __toESM(require("styled-components"));
|
|
5149
5158
|
|
|
5150
5159
|
// src/breadcrumbs/dropdownTheme.ts
|
|
@@ -5204,11 +5213,11 @@ var dropdownTheme_default = {
|
|
|
5204
5213
|
};
|
|
5205
5214
|
|
|
5206
5215
|
// src/breadcrumbs/Item.tsx
|
|
5207
|
-
var
|
|
5216
|
+
var import_react25 = require("react");
|
|
5208
5217
|
var import_styled_components21 = __toESM(require("styled-components"));
|
|
5209
5218
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
5210
5219
|
var Item = ({ isCurrentPage = false, href, label, onClick }) => {
|
|
5211
|
-
const currentItemRef = (0,
|
|
5220
|
+
const currentItemRef = (0, import_react25.useRef)(null);
|
|
5212
5221
|
const handleOnMouseEnter = (event) => {
|
|
5213
5222
|
const labelContainer = event.currentTarget;
|
|
5214
5223
|
const optionElement = currentItemRef.current;
|
|
@@ -5217,10 +5226,9 @@ var Item = ({ isCurrentPage = false, href, label, onClick }) => {
|
|
|
5217
5226
|
}
|
|
5218
5227
|
};
|
|
5219
5228
|
const handleOnClick = (event) => {
|
|
5229
|
+
if (typeof onClick !== "function") return;
|
|
5220
5230
|
event.preventDefault();
|
|
5221
|
-
if (href)
|
|
5222
|
-
onClick?.(href);
|
|
5223
|
-
}
|
|
5231
|
+
if (href) onClick(href);
|
|
5224
5232
|
};
|
|
5225
5233
|
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
5234
|
};
|
|
@@ -5270,7 +5278,7 @@ var DxcBreadcrumbs = ({
|
|
|
5270
5278
|
onItemClick,
|
|
5271
5279
|
showRoot = true
|
|
5272
5280
|
}) => {
|
|
5273
|
-
const handleOnSelectOption = (0,
|
|
5281
|
+
const handleOnSelectOption = (0, import_react26.useCallback)(
|
|
5274
5282
|
(href) => {
|
|
5275
5283
|
if (onItemClick) {
|
|
5276
5284
|
onItemClick(href);
|
|
@@ -5329,16 +5337,16 @@ var OrderedList = import_styled_components22.default.ol`
|
|
|
5329
5337
|
var Breadcrumbs_default = DxcBreadcrumbs;
|
|
5330
5338
|
|
|
5331
5339
|
// src/bulleted-list/BulletedList.tsx
|
|
5332
|
-
var
|
|
5340
|
+
var import_react29 = require("react");
|
|
5333
5341
|
var import_styled_components24 = __toESM(require("styled-components"));
|
|
5334
5342
|
|
|
5335
5343
|
// src/typography/Typography.tsx
|
|
5336
|
-
var
|
|
5344
|
+
var import_react28 = require("react");
|
|
5337
5345
|
var import_styled_components23 = __toESM(require("styled-components"));
|
|
5338
5346
|
|
|
5339
5347
|
// src/typography/TypographyContext.tsx
|
|
5340
|
-
var
|
|
5341
|
-
var TypographyContext_default = (0,
|
|
5348
|
+
var import_react27 = require("react");
|
|
5349
|
+
var TypographyContext_default = (0, import_react27.createContext)({
|
|
5342
5350
|
as: "span",
|
|
5343
5351
|
color: "#000000",
|
|
5344
5352
|
display: "inline",
|
|
@@ -5373,8 +5381,8 @@ var Typography = import_styled_components23.default.span`
|
|
|
5373
5381
|
overflow: ${({ textOverflow }) => textOverflow !== "unset" ? "hidden" : "visible"};
|
|
5374
5382
|
`;
|
|
5375
5383
|
function DxcTypography({ children, ...props }) {
|
|
5376
|
-
const componentContext = (0,
|
|
5377
|
-
const contextValue = (0,
|
|
5384
|
+
const componentContext = (0, import_react28.useContext)(TypographyContext_default);
|
|
5385
|
+
const contextValue = (0, import_react28.useMemo)(
|
|
5378
5386
|
() => ({
|
|
5379
5387
|
...componentContext,
|
|
5380
5388
|
...props
|
|
@@ -5388,8 +5396,8 @@ function DxcTypography({ children, ...props }) {
|
|
|
5388
5396
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
5389
5397
|
var BulletedListItem = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_jsx_runtime28.Fragment, { children });
|
|
5390
5398
|
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:
|
|
5399
|
+
const colorsTheme = (0, import_react29.useContext)(HalstackContext);
|
|
5400
|
+
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_react29.Children.map(children, (child, index) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ListItem2, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(GeneralContent, { children: [
|
|
5393
5401
|
type === "number" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Number2, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(DxcTypography, { color: colorsTheme.bulletedList.fontColor, children: [
|
|
5394
5402
|
index + 1,
|
|
5395
5403
|
"."
|
|
@@ -5468,7 +5476,7 @@ var ListItem2 = import_styled_components24.default.li`
|
|
|
5468
5476
|
var BulletedList_default = DxcBulletedList;
|
|
5469
5477
|
|
|
5470
5478
|
// src/card/Card.tsx
|
|
5471
|
-
var
|
|
5479
|
+
var import_react30 = require("react");
|
|
5472
5480
|
var import_styled_components25 = __toESM(require("styled-components"));
|
|
5473
5481
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5474
5482
|
var DxcCard = ({
|
|
@@ -5484,8 +5492,8 @@ var DxcCard = ({
|
|
|
5484
5492
|
outlined = true,
|
|
5485
5493
|
children
|
|
5486
5494
|
}) => {
|
|
5487
|
-
const colorsTheme = (0,
|
|
5488
|
-
const [isHovered, changeIsHovered] = (0,
|
|
5495
|
+
const colorsTheme = (0, import_react30.useContext)(HalstackContext);
|
|
5496
|
+
const [isHovered, changeIsHovered] = (0, import_react30.useState)(false);
|
|
5489
5497
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_styled_components25.ThemeProvider, { theme: colorsTheme.card, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5490
5498
|
Card,
|
|
5491
5499
|
{
|
|
@@ -5551,11 +5559,11 @@ var CardContent = import_styled_components25.default.div`
|
|
|
5551
5559
|
var Card_default = DxcCard;
|
|
5552
5560
|
|
|
5553
5561
|
// src/checkbox/Checkbox.tsx
|
|
5554
|
-
var
|
|
5562
|
+
var import_react31 = require("react");
|
|
5555
5563
|
var import_styled_components26 = __toESM(require("styled-components"));
|
|
5556
5564
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5557
5565
|
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,
|
|
5566
|
+
var DxcCheckbox = (0, import_react31.forwardRef)(
|
|
5559
5567
|
({
|
|
5560
5568
|
checked,
|
|
5561
5569
|
defaultChecked = false,
|
|
@@ -5572,11 +5580,11 @@ var DxcCheckbox = (0, import_react29.forwardRef)(
|
|
|
5572
5580
|
tabIndex = 0,
|
|
5573
5581
|
ariaLabel = "Checkbox"
|
|
5574
5582
|
}, ref) => {
|
|
5575
|
-
const labelId = `label-checkbox-${(0,
|
|
5576
|
-
const [innerChecked, setInnerChecked] = (0,
|
|
5577
|
-
const checkboxRef = (0,
|
|
5578
|
-
const colorsTheme = (0,
|
|
5579
|
-
const translatedLabels = (0,
|
|
5583
|
+
const labelId = `label-checkbox-${(0, import_react31.useId)()}`;
|
|
5584
|
+
const [innerChecked, setInnerChecked] = (0, import_react31.useState)(defaultChecked);
|
|
5585
|
+
const checkboxRef = (0, import_react31.useRef)(null);
|
|
5586
|
+
const colorsTheme = (0, import_react31.useContext)(HalstackContext);
|
|
5587
|
+
const translatedLabels = (0, import_react31.useContext)(HalstackLanguageContext);
|
|
5580
5588
|
const handleCheckboxChange = () => {
|
|
5581
5589
|
if (!disabled && !readOnly) {
|
|
5582
5590
|
if (document.activeElement !== checkboxRef.current) {
|
|
@@ -5773,7 +5781,7 @@ var MainContainer2 = import_styled_components26.default.div`
|
|
|
5773
5781
|
var Checkbox_default = DxcCheckbox;
|
|
5774
5782
|
|
|
5775
5783
|
// src/chip/Chip.tsx
|
|
5776
|
-
var
|
|
5784
|
+
var import_react32 = require("react");
|
|
5777
5785
|
var import_styled_components27 = __toESM(require("styled-components"));
|
|
5778
5786
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5779
5787
|
var DxcChip = ({
|
|
@@ -5786,7 +5794,7 @@ var DxcChip = ({
|
|
|
5786
5794
|
margin,
|
|
5787
5795
|
tabIndex = 0
|
|
5788
5796
|
}) => {
|
|
5789
|
-
const colorsTheme = (0,
|
|
5797
|
+
const colorsTheme = (0, import_react32.useContext)(HalstackContext);
|
|
5790
5798
|
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
5799
|
prefixIcon && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5792
5800
|
IconContainer5,
|
|
@@ -5878,22 +5886,22 @@ var IconContainer5 = import_styled_components27.default.div`
|
|
|
5878
5886
|
var Chip_default = DxcChip;
|
|
5879
5887
|
|
|
5880
5888
|
// src/contextual-menu/ContextualMenu.tsx
|
|
5881
|
-
var
|
|
5889
|
+
var import_react38 = require("react");
|
|
5882
5890
|
var import_styled_components31 = __toESM(require("styled-components"));
|
|
5883
5891
|
|
|
5884
5892
|
// src/contextual-menu/MenuItem.tsx
|
|
5885
5893
|
var import_styled_components29 = __toESM(require("styled-components"));
|
|
5886
5894
|
|
|
5887
5895
|
// src/contextual-menu/GroupItem.tsx
|
|
5888
|
-
var
|
|
5896
|
+
var import_react35 = require("react");
|
|
5889
5897
|
|
|
5890
5898
|
// src/contextual-menu/ItemAction.tsx
|
|
5891
|
-
var
|
|
5899
|
+
var import_react33 = require("react");
|
|
5892
5900
|
var import_styled_components28 = __toESM(require("styled-components"));
|
|
5893
5901
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
5894
5902
|
var ItemAction = ({ badge, collapseIcon, icon, label, depthLevel, ...props }) => {
|
|
5895
|
-
const [hasTooltip, setHasTooltip] = (0,
|
|
5896
|
-
const modifiedBadge = badge && (0,
|
|
5903
|
+
const [hasTooltip, setHasTooltip] = (0, import_react33.useState)(false);
|
|
5904
|
+
const modifiedBadge = badge && (0, import_react33.cloneElement)(badge, { size: "small" });
|
|
5897
5905
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipWrapper, { condition: hasTooltip, label, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Action, { depthLevel, ...props, children: [
|
|
5898
5906
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Label2, { children: [
|
|
5899
5907
|
collapseIcon && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Icon2, { children: collapseIcon }),
|
|
@@ -5969,8 +5977,8 @@ var Text2 = import_styled_components28.default.span`
|
|
|
5969
5977
|
var ItemAction_default = ItemAction;
|
|
5970
5978
|
|
|
5971
5979
|
// src/contextual-menu/ContextualMenuContext.tsx
|
|
5972
|
-
var
|
|
5973
|
-
var ContextualMenuContext_default = (0,
|
|
5980
|
+
var import_react34 = require("react");
|
|
5981
|
+
var ContextualMenuContext_default = (0, import_react34.createContext)(null);
|
|
5974
5982
|
|
|
5975
5983
|
// src/contextual-menu/GroupItem.tsx
|
|
5976
5984
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
@@ -5980,10 +5988,10 @@ var isGroupSelected = (items, selectedItemId) => items.some((item) => {
|
|
|
5980
5988
|
else return item.selectedByDefault;
|
|
5981
5989
|
});
|
|
5982
5990
|
var GroupItem = ({ items, ...props }) => {
|
|
5983
|
-
const groupMenuId = `group-menu-${(0,
|
|
5984
|
-
const { selectedItemId } = (0,
|
|
5985
|
-
const groupSelected = (0,
|
|
5986
|
-
const [isOpen, setIsOpen] = (0,
|
|
5991
|
+
const groupMenuId = `group-menu-${(0, import_react35.useId)()}`;
|
|
5992
|
+
const { selectedItemId } = (0, import_react35.useContext)(ContextualMenuContext_default) ?? {};
|
|
5993
|
+
const groupSelected = (0, import_react35.useMemo)(() => isGroupSelected(items, selectedItemId), [items, selectedItemId]);
|
|
5994
|
+
const [isOpen, setIsOpen] = (0, import_react35.useState)(groupSelected && selectedItemId === -1);
|
|
5987
5995
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
5988
5996
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5989
5997
|
ItemAction_default,
|
|
@@ -6002,18 +6010,18 @@ var GroupItem = ({ items, ...props }) => {
|
|
|
6002
6010
|
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
6011
|
] });
|
|
6004
6012
|
};
|
|
6005
|
-
var GroupItem_default = (0,
|
|
6013
|
+
var GroupItem_default = (0, import_react35.memo)(GroupItem);
|
|
6006
6014
|
|
|
6007
6015
|
// src/contextual-menu/SingleItem.tsx
|
|
6008
|
-
var
|
|
6016
|
+
var import_react36 = require("react");
|
|
6009
6017
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
6010
6018
|
var SingleItem = ({ id, onSelect, selectedByDefault = false, ...props }) => {
|
|
6011
|
-
const { selectedItemId, setSelectedItemId } = (0,
|
|
6019
|
+
const { selectedItemId, setSelectedItemId } = (0, import_react36.useContext)(ContextualMenuContext_default) ?? {};
|
|
6012
6020
|
const handleClick = () => {
|
|
6013
6021
|
setSelectedItemId?.(id);
|
|
6014
6022
|
onSelect?.();
|
|
6015
6023
|
};
|
|
6016
|
-
(0,
|
|
6024
|
+
(0, import_react36.useEffect)(() => {
|
|
6017
6025
|
if (selectedItemId === -1 && selectedByDefault) {
|
|
6018
6026
|
setSelectedItemId?.(id);
|
|
6019
6027
|
}
|
|
@@ -6041,10 +6049,10 @@ var MenuItem_default = MenuItem;
|
|
|
6041
6049
|
|
|
6042
6050
|
// src/contextual-menu/Section.tsx
|
|
6043
6051
|
var import_styled_components30 = __toESM(require("styled-components"));
|
|
6044
|
-
var
|
|
6052
|
+
var import_react37 = require("react");
|
|
6045
6053
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
6046
6054
|
var Section2 = ({ section, index, length }) => {
|
|
6047
|
-
const id = `section-${(0,
|
|
6055
|
+
const id = `section-${(0, import_react37.useId)()}`;
|
|
6048
6056
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("section", { "aria-label": section.title ?? id, "aria-labelledby": id, children: [
|
|
6049
6057
|
section.title && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Title3, { id, children: section.title }),
|
|
6050
6058
|
/* @__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 +6119,13 @@ var addIdToItems = (items) => {
|
|
|
6111
6119
|
};
|
|
6112
6120
|
var SubMenu = ({ children, id }) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(StyledSubMenu, { id, role: "menu", children });
|
|
6113
6121
|
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,
|
|
6122
|
+
const [selectedItemId, setSelectedItemId] = (0, import_react38.useState)(-1);
|
|
6123
|
+
const contextualMenuRef = (0, import_react38.useRef)(null);
|
|
6124
|
+
const itemsWithId = (0, import_react38.useMemo)(() => addIdToItems(items), [items]);
|
|
6125
|
+
const contextValue = (0, import_react38.useMemo)(() => ({ selectedItemId, setSelectedItemId }), [selectedItemId, setSelectedItemId]);
|
|
6126
|
+
const colorsTheme = (0, import_react38.useContext)(HalstackContext);
|
|
6127
|
+
const [firstUpdate, setFirstUpdate] = (0, import_react38.useState)(true);
|
|
6128
|
+
(0, import_react38.useLayoutEffect)(() => {
|
|
6121
6129
|
if (selectedItemId !== -1 && firstUpdate) {
|
|
6122
6130
|
const contextualMenuEl = contextualMenuRef.current;
|
|
6123
6131
|
const selectedItemEl = contextualMenuEl?.querySelector("[aria-pressed='true']");
|
|
@@ -6131,17 +6139,17 @@ function DxcContextualMenu({ items }) {
|
|
|
6131
6139
|
}
|
|
6132
6140
|
|
|
6133
6141
|
// src/data-grid/DataGrid.tsx
|
|
6134
|
-
var
|
|
6142
|
+
var import_react46 = require("react");
|
|
6135
6143
|
var import_react_data_grid2 = __toESM(require("react-data-grid"));
|
|
6136
6144
|
var import_styled_components38 = __toESM(require("styled-components"));
|
|
6137
6145
|
var import_styles = require("react-data-grid/lib/styles.css");
|
|
6138
6146
|
|
|
6139
6147
|
// src/data-grid/utils.tsx
|
|
6140
|
-
var
|
|
6148
|
+
var import_react40 = require("react");
|
|
6141
6149
|
var import_react_data_grid = require("react-data-grid");
|
|
6142
6150
|
|
|
6143
6151
|
// src/spinner/Spinner.tsx
|
|
6144
|
-
var
|
|
6152
|
+
var import_react39 = require("react");
|
|
6145
6153
|
var import_styled_components32 = __toESM(require("styled-components"));
|
|
6146
6154
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
6147
6155
|
var DxcSpinner = ({
|
|
@@ -6152,9 +6160,9 @@ var DxcSpinner = ({
|
|
|
6152
6160
|
margin,
|
|
6153
6161
|
ariaLabel = "Spinner"
|
|
6154
6162
|
}) => {
|
|
6155
|
-
const labelId = (0,
|
|
6156
|
-
const colorsTheme = (0,
|
|
6157
|
-
const determinated = (0,
|
|
6163
|
+
const labelId = (0, import_react39.useId)();
|
|
6164
|
+
const colorsTheme = (0, import_react39.useContext)(HalstackContext);
|
|
6165
|
+
const determinated = (0, import_react39.useMemo)(() => value != null && value >= 0 && value <= 100, [value]);
|
|
6158
6166
|
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
6167
|
mode === "overlay" && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(BackOverlay, {}),
|
|
6160
6168
|
/* @__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 +6420,7 @@ var renderExpandableTrigger = (row, rows, uniqueRowId, setRowsToRender) => /* @_
|
|
|
6412
6420
|
}
|
|
6413
6421
|
);
|
|
6414
6422
|
var renderHierarchyTrigger = (rows, triggerRow, uniqueRowId, columnKey, setRowsToRender, childrenTrigger) => {
|
|
6415
|
-
const [loading, setLoading] = (0,
|
|
6423
|
+
const [loading, setLoading] = (0, import_react40.useState)(false);
|
|
6416
6424
|
const onClick = async () => {
|
|
6417
6425
|
if (loading) return;
|
|
6418
6426
|
if (!triggerRow.visibleChildren) {
|
|
@@ -6691,21 +6699,21 @@ var getPaginatedNodes = (rows, uniqueRowId, start, end) => {
|
|
|
6691
6699
|
};
|
|
6692
6700
|
|
|
6693
6701
|
// src/paginator/Paginator.tsx
|
|
6694
|
-
var
|
|
6702
|
+
var import_react44 = require("react");
|
|
6695
6703
|
var import_styled_components36 = __toESM(require("styled-components"));
|
|
6696
6704
|
|
|
6697
6705
|
// src/select/Select.tsx
|
|
6698
6706
|
var Popover2 = __toESM(require("@radix-ui/react-popover"));
|
|
6699
|
-
var
|
|
6707
|
+
var import_react43 = require("react");
|
|
6700
6708
|
var import_styled_components35 = __toESM(require("styled-components"));
|
|
6701
6709
|
|
|
6702
6710
|
// src/select/Listbox.tsx
|
|
6703
|
-
var
|
|
6711
|
+
var import_react42 = require("react");
|
|
6704
6712
|
var import_styled_components34 = __toESM(require("styled-components"));
|
|
6705
6713
|
|
|
6706
6714
|
// src/select/ListOption.tsx
|
|
6707
6715
|
var import_styled_components33 = __toESM(require("styled-components"));
|
|
6708
|
-
var
|
|
6716
|
+
var import_react41 = require("react");
|
|
6709
6717
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
6710
6718
|
var ListOption = ({
|
|
6711
6719
|
id,
|
|
@@ -6717,7 +6725,7 @@ var ListOption = ({
|
|
|
6717
6725
|
isLastOption,
|
|
6718
6726
|
isSelected
|
|
6719
6727
|
}) => {
|
|
6720
|
-
const [hasTooltip, setHasTooltip] = (0,
|
|
6728
|
+
const [hasTooltip, setHasTooltip] = (0, import_react41.useState)(false);
|
|
6721
6729
|
const handleOnMouseEnter = (event) => {
|
|
6722
6730
|
const text = event.currentTarget;
|
|
6723
6731
|
setHasTooltip(text.scrollWidth > text.clientWidth);
|
|
@@ -6815,22 +6823,21 @@ var isOptionGroup = (option) => "options" in option && option.options != null;
|
|
|
6815
6823
|
var isArrayOfOptionGroups = (options) => options[0] != null && isOptionGroup(options[0]);
|
|
6816
6824
|
var groupsHaveOptions = (options) => isArrayOfOptionGroups(options) ? options.some((groupOption) => groupOption.options.length > 0) : true;
|
|
6817
6825
|
var canOpenListbox = (options, disabled) => !disabled && options.length > 0 && groupsHaveOptions(options);
|
|
6818
|
-
var filterOptionsBySearchValue = (options, searchValue) => {
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6825
|
-
|
|
6826
|
-
|
|
6827
|
-
|
|
6828
|
-
|
|
6829
|
-
|
|
6830
|
-
|
|
6831
|
-
|
|
6832
|
-
|
|
6833
|
-
}
|
|
6826
|
+
var filterOptionsBySearchValue = (options, searchValue, searchByStartsWith = false) => {
|
|
6827
|
+
const matchesSearch = (label, search, searchByStartsWith2) => {
|
|
6828
|
+
const upperLabel = label.toUpperCase();
|
|
6829
|
+
const upperSearch = search.toUpperCase();
|
|
6830
|
+
return searchByStartsWith2 ? upperLabel.startsWith(upperSearch) : upperLabel.includes(upperSearch);
|
|
6831
|
+
};
|
|
6832
|
+
return options.length > 0 ? isArrayOfOptionGroups(options) ? options.map((optionGroup) => {
|
|
6833
|
+
const group = {
|
|
6834
|
+
label: optionGroup.label,
|
|
6835
|
+
options: optionGroup.options.filter(
|
|
6836
|
+
(option) => matchesSearch(option.label, searchValue, searchByStartsWith)
|
|
6837
|
+
)
|
|
6838
|
+
};
|
|
6839
|
+
return group;
|
|
6840
|
+
}) : options.filter((option) => matchesSearch(option.label, searchValue, searchByStartsWith)) : [];
|
|
6834
6841
|
};
|
|
6835
6842
|
var getLastOptionIndex = (options, filteredOptions, searchable, optional, multiple) => {
|
|
6836
6843
|
let last = 0;
|
|
@@ -6913,8 +6920,8 @@ var Listbox = ({
|
|
|
6913
6920
|
handleOptionOnClick,
|
|
6914
6921
|
styles
|
|
6915
6922
|
}) => {
|
|
6916
|
-
const translatedLabels = (0,
|
|
6917
|
-
const listboxRef = (0,
|
|
6923
|
+
const translatedLabels = (0, import_react42.useContext)(HalstackLanguageContext);
|
|
6924
|
+
const listboxRef = (0, import_react42.useRef)(null);
|
|
6918
6925
|
let globalIndex = optional && !multiple ? 0 : -1;
|
|
6919
6926
|
const mapOptionFunc = (option, mapIndex) => {
|
|
6920
6927
|
const groupId = `${id}-group-${mapIndex}`;
|
|
@@ -6956,7 +6963,7 @@ var Listbox = ({
|
|
|
6956
6963
|
);
|
|
6957
6964
|
}
|
|
6958
6965
|
};
|
|
6959
|
-
(0,
|
|
6966
|
+
(0, import_react42.useLayoutEffect)(() => {
|
|
6960
6967
|
if (currentValue && !multiple) {
|
|
6961
6968
|
const listEl = listboxRef?.current;
|
|
6962
6969
|
const selectedListOptionEl = listEl?.querySelector("[aria-selected='true']");
|
|
@@ -6965,7 +6972,7 @@ var Listbox = ({
|
|
|
6965
6972
|
});
|
|
6966
6973
|
}
|
|
6967
6974
|
}, [currentValue, multiple]);
|
|
6968
|
-
(0,
|
|
6975
|
+
(0, import_react42.useLayoutEffect)(() => {
|
|
6969
6976
|
const visualFocusedOptionEl = listboxRef.current?.querySelectorAll("[role='option']")[visualFocusIndex];
|
|
6970
6977
|
visualFocusedOptionEl?.scrollIntoView?.({
|
|
6971
6978
|
block: "nearest",
|
|
@@ -7055,7 +7062,7 @@ var Listbox_default = Listbox;
|
|
|
7055
7062
|
|
|
7056
7063
|
// src/select/Select.tsx
|
|
7057
7064
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
7058
|
-
var DxcSelect = (0,
|
|
7065
|
+
var DxcSelect = (0, import_react43.forwardRef)(
|
|
7059
7066
|
({
|
|
7060
7067
|
label,
|
|
7061
7068
|
name = "",
|
|
@@ -7068,6 +7075,7 @@ var DxcSelect = (0, import_react41.forwardRef)(
|
|
|
7068
7075
|
multiple = false,
|
|
7069
7076
|
optional = false,
|
|
7070
7077
|
searchable = false,
|
|
7078
|
+
searchByStartsWith = false,
|
|
7071
7079
|
onChange,
|
|
7072
7080
|
onBlur,
|
|
7073
7081
|
error,
|
|
@@ -7076,27 +7084,27 @@ var DxcSelect = (0, import_react41.forwardRef)(
|
|
|
7076
7084
|
tabIndex = 0,
|
|
7077
7085
|
ariaLabel = "Select"
|
|
7078
7086
|
}, ref) => {
|
|
7079
|
-
const selectId = `select-${(0,
|
|
7087
|
+
const selectId = `select-${(0, import_react43.useId)()}`;
|
|
7080
7088
|
const selectLabelId = `label-${selectId}`;
|
|
7081
7089
|
const errorId = `error-${selectId}`;
|
|
7082
7090
|
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,
|
|
7091
|
+
const [innerValue, setInnerValue] = (0, import_react43.useState)(defaultValue ?? (multiple ? [] : ""));
|
|
7092
|
+
const [searchValue, setSearchValue] = (0, import_react43.useState)("");
|
|
7093
|
+
const [visualFocusIndex, changeVisualFocusIndex] = (0, import_react43.useState)(-1);
|
|
7094
|
+
const [isOpen, changeIsOpen] = (0, import_react43.useState)(false);
|
|
7095
|
+
const [hasTooltip, setHasTooltip] = (0, import_react43.useState)(false);
|
|
7096
|
+
const selectRef = (0, import_react43.useRef)(null);
|
|
7097
|
+
const selectSearchInputRef = (0, import_react43.useRef)(null);
|
|
7090
7098
|
const width = useWidth_default(selectRef.current);
|
|
7091
|
-
const colorsTheme = (0,
|
|
7092
|
-
const translatedLabels = (0,
|
|
7099
|
+
const colorsTheme = (0, import_react43.useContext)(HalstackContext);
|
|
7100
|
+
const translatedLabels = (0, import_react43.useContext)(HalstackLanguageContext);
|
|
7093
7101
|
const optionalItem = { label: placeholder, value: "" };
|
|
7094
|
-
const filteredOptions = (0,
|
|
7095
|
-
const lastOptionIndex = (0,
|
|
7102
|
+
const filteredOptions = (0, import_react43.useMemo)(() => filterOptionsBySearchValue(options, searchValue, searchByStartsWith), [options, searchValue, searchByStartsWith]);
|
|
7103
|
+
const lastOptionIndex = (0, import_react43.useMemo)(
|
|
7096
7104
|
() => getLastOptionIndex(options, filteredOptions, searchable, optional, multiple),
|
|
7097
7105
|
[options, filteredOptions, searchable, optional, multiple]
|
|
7098
7106
|
);
|
|
7099
|
-
const { selectedOption, singleSelectionIndex } = (0,
|
|
7107
|
+
const { selectedOption, singleSelectionIndex } = (0, import_react43.useMemo)(
|
|
7100
7108
|
() => getSelectedOption(value ?? innerValue, options, multiple, optional, optionalItem),
|
|
7101
7109
|
[value, innerValue, options, multiple, optional, optionalItem]
|
|
7102
7110
|
);
|
|
@@ -7111,7 +7119,7 @@ var DxcSelect = (0, import_react41.forwardRef)(
|
|
|
7111
7119
|
changeVisualFocusIndex(-1);
|
|
7112
7120
|
}
|
|
7113
7121
|
};
|
|
7114
|
-
const handleSelectChangeValue = (0,
|
|
7122
|
+
const handleSelectChangeValue = (0, import_react43.useCallback)(
|
|
7115
7123
|
(newOption) => {
|
|
7116
7124
|
if (newOption) {
|
|
7117
7125
|
let newValue;
|
|
@@ -7268,7 +7276,7 @@ var DxcSelect = (0, import_react41.forwardRef)(
|
|
|
7268
7276
|
event.stopPropagation();
|
|
7269
7277
|
setSearchValue("");
|
|
7270
7278
|
};
|
|
7271
|
-
const handleOptionOnClick = (0,
|
|
7279
|
+
const handleOptionOnClick = (0, import_react43.useCallback)(
|
|
7272
7280
|
(option) => {
|
|
7273
7281
|
handleSelectChangeValue(option);
|
|
7274
7282
|
if (!multiple) {
|
|
@@ -7282,148 +7290,151 @@ var DxcSelect = (0, import_react41.forwardRef)(
|
|
|
7282
7290
|
const text = event.currentTarget;
|
|
7283
7291
|
setHasTooltip(text.scrollWidth > text.clientWidth);
|
|
7284
7292
|
};
|
|
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,
|
|
7293
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_styled_components35.ThemeProvider, { theme: colorsTheme.select, children: [
|
|
7294
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(SelectContainer, { margin, size, ref, children: [
|
|
7295
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
7296
|
+
Label3,
|
|
7306
7297
|
{
|
|
7307
|
-
id:
|
|
7298
|
+
id: selectLabelId,
|
|
7308
7299
|
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,
|
|
7300
|
+
onClick: () => {
|
|
7301
|
+
selectRef?.current?.focus();
|
|
7302
|
+
},
|
|
7303
|
+
helperText,
|
|
7327
7304
|
children: [
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
|
|
7305
|
+
label,
|
|
7306
|
+
" ",
|
|
7307
|
+
optional && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(OptionalLabel, { children: translatedLabels.formFields.optionalLabel })
|
|
7308
|
+
]
|
|
7309
|
+
}
|
|
7310
|
+
),
|
|
7311
|
+
helperText && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(HelperText, { disabled, children: helperText }),
|
|
7312
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Popover2.Root, { open: isOpen, children: [
|
|
7313
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Popover2.Trigger, { asChild: true, type: void 0, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
7314
|
+
Select,
|
|
7315
|
+
{
|
|
7316
|
+
id: selectId,
|
|
7317
|
+
disabled,
|
|
7318
|
+
error,
|
|
7319
|
+
onBlur: handleSelectOnBlur,
|
|
7320
|
+
onClick: handleSelectOnClick,
|
|
7321
|
+
onFocus: handleSelectOnFocus,
|
|
7322
|
+
onKeyDown: handleSelectOnKeyDown,
|
|
7323
|
+
ref: selectRef,
|
|
7324
|
+
tabIndex: disabled ? -1 : tabIndex,
|
|
7325
|
+
role: "combobox",
|
|
7326
|
+
"aria-controls": isOpen ? listboxId : void 0,
|
|
7327
|
+
"aria-disabled": disabled,
|
|
7328
|
+
"aria-expanded": isOpen,
|
|
7329
|
+
"aria-haspopup": "listbox",
|
|
7330
|
+
"aria-labelledby": label ? selectLabelId : void 0,
|
|
7331
|
+
"aria-activedescendant": visualFocusIndex >= 0 ? `option-${visualFocusIndex}` : void 0,
|
|
7332
|
+
"aria-invalid": !!error,
|
|
7333
|
+
"aria-errormessage": error ? errorId : void 0,
|
|
7334
|
+
"aria-required": !disabled && !optional,
|
|
7335
|
+
"aria-label": label ? void 0 : ariaLabel,
|
|
7336
|
+
children: [
|
|
7337
|
+
multiple && Array.isArray(selectedOption) && selectedOption.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(SelectionIndicator, { children: [
|
|
7338
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SelectionNumber, { disabled, children: selectedOption.length }),
|
|
7339
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipWrapper, { condition: !disabled, label: translatedLabels.select.actionClearSelectionTitle, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7340
|
+
ClearOptionsAction,
|
|
7341
|
+
{
|
|
7342
|
+
disabled,
|
|
7343
|
+
onMouseDown: (event) => {
|
|
7344
|
+
event.preventDefault();
|
|
7345
|
+
},
|
|
7346
|
+
onClick: handleClearOptionsActionOnClick,
|
|
7347
|
+
tabIndex: -1,
|
|
7348
|
+
"aria-label": translatedLabels.select.actionClearSelectionTitle,
|
|
7349
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon_default, { icon: "clear" })
|
|
7350
|
+
}
|
|
7351
|
+
) })
|
|
7352
|
+
] }),
|
|
7353
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipWrapper, { condition: hasTooltip, label: getSelectedOptionLabel(placeholder, selectedOption), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(SearchableValueContainer, { children: [
|
|
7354
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7355
|
+
"input",
|
|
7356
|
+
{
|
|
7357
|
+
style: { display: "none" },
|
|
7358
|
+
name,
|
|
7359
|
+
disabled,
|
|
7360
|
+
value: multiple ? (Array.isArray(value) ? value : Array.isArray(innerValue) ? innerValue : []).join(",") : value ?? innerValue,
|
|
7361
|
+
readOnly: true,
|
|
7362
|
+
"aria-hidden": "true"
|
|
7363
|
+
}
|
|
7364
|
+
),
|
|
7365
|
+
searchable && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7366
|
+
SearchInput,
|
|
7367
|
+
{
|
|
7368
|
+
value: searchValue,
|
|
7369
|
+
disabled,
|
|
7370
|
+
onChange: handleSearchIOnChange,
|
|
7371
|
+
ref: selectSearchInputRef,
|
|
7372
|
+
autoComplete: "nope",
|
|
7373
|
+
autoCorrect: "nope",
|
|
7374
|
+
size: 1,
|
|
7375
|
+
"aria-labelledby": label ? selectLabelId : void 0
|
|
7376
|
+
}
|
|
7377
|
+
),
|
|
7378
|
+
(!searchable || searchValue === "") && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7379
|
+
SelectedOption,
|
|
7380
|
+
{
|
|
7381
|
+
disabled,
|
|
7382
|
+
atBackground: (multiple ? (value ?? innerValue).length === 0 : !(value ?? innerValue)) || searchable && isOpen,
|
|
7383
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SelectedOptionLabel, { onMouseEnter: handleOnMouseEnter, children: getSelectedOptionLabel(placeholder, selectedOption) })
|
|
7384
|
+
}
|
|
7385
|
+
)
|
|
7386
|
+
] }) }),
|
|
7387
|
+
!disabled && error && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ErrorIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon_default, { icon: "filled_error" }) }),
|
|
7388
|
+
searchable && searchValue.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipWrapper, { condition: !disabled, label: translatedLabels.select.actionClearSelectionTitle, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7389
|
+
ClearSearchAction,
|
|
7332
7390
|
{
|
|
7333
|
-
disabled,
|
|
7334
7391
|
onMouseDown: (event) => {
|
|
7335
7392
|
event.preventDefault();
|
|
7336
7393
|
},
|
|
7337
|
-
onClick:
|
|
7394
|
+
onClick: handleClearSearchActionOnClick,
|
|
7338
7395
|
tabIndex: -1,
|
|
7339
|
-
"aria-label": translatedLabels.select.
|
|
7396
|
+
"aria-label": translatedLabels.select.actionClearSearchTitle,
|
|
7340
7397
|
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon_default, { icon: "clear" })
|
|
7341
7398
|
}
|
|
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,
|
|
7399
|
+
) }),
|
|
7400
|
+
/* @__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" }) })
|
|
7401
|
+
]
|
|
7402
|
+
}
|
|
7403
|
+
) }),
|
|
7404
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Popover2.Portal, { container: document.getElementById(`${selectId}-portal`), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7405
|
+
Popover2.Content,
|
|
7406
|
+
{
|
|
7407
|
+
sideOffset: 4,
|
|
7408
|
+
style: { zIndex: "310" },
|
|
7409
|
+
onOpenAutoFocus: (event) => {
|
|
7410
|
+
event.preventDefault();
|
|
7411
|
+
},
|
|
7412
|
+
onCloseAutoFocus: (event) => {
|
|
7413
|
+
event.preventDefault();
|
|
7414
|
+
},
|
|
7415
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7416
|
+
Listbox_default,
|
|
7381
7417
|
{
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
7418
|
+
id: listboxId,
|
|
7419
|
+
currentValue: value ?? innerValue,
|
|
7420
|
+
options: searchable ? filteredOptions : options,
|
|
7421
|
+
visualFocusIndex,
|
|
7422
|
+
lastOptionIndex,
|
|
7423
|
+
multiple,
|
|
7424
|
+
optional,
|
|
7425
|
+
optionalItem,
|
|
7426
|
+
searchable,
|
|
7427
|
+
handleOptionOnClick,
|
|
7428
|
+
styles: { width }
|
|
7389
7429
|
}
|
|
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
|
-
) })
|
|
7430
|
+
)
|
|
7431
|
+
}
|
|
7432
|
+
) })
|
|
7433
|
+
] }),
|
|
7434
|
+
!disabled && typeof error === "string" && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Error2, { id: errorId, role: "alert", "aria-live": error ? "assertive" : "off", children: error })
|
|
7424
7435
|
] }),
|
|
7425
|
-
|
|
7426
|
-
] })
|
|
7436
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { id: `${selectId}-portal`, style: { position: "absolute" } })
|
|
7437
|
+
] });
|
|
7427
7438
|
}
|
|
7428
7439
|
);
|
|
7429
7440
|
var sizes3 = {
|
|
@@ -7645,8 +7656,8 @@ var DxcPaginator = ({
|
|
|
7645
7656
|
const currentPageInternal = currentPage === -1 ? totalPages : currentPage;
|
|
7646
7657
|
const minItemsPerPage = currentPageInternal === 1 || currentPageInternal === 0 ? currentPageInternal : (currentPageInternal - 1) * itemsPerPage + 1;
|
|
7647
7658
|
const maxItemsPerPage = minItemsPerPage - 1 + itemsPerPage > totalItems ? totalItems : minItemsPerPage - 1 + itemsPerPage;
|
|
7648
|
-
const colorsTheme = (0,
|
|
7649
|
-
const translatedLabels = (0,
|
|
7659
|
+
const colorsTheme = (0, import_react44.useContext)(HalstackContext);
|
|
7660
|
+
const translatedLabels = (0, import_react44.useContext)(HalstackLanguageContext);
|
|
7650
7661
|
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
7662
|
itemsPerPageOptions && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(ItemsPageContainer, { children: [
|
|
7652
7663
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ItemsLabel, { children: translatedLabels.paginator.itemsPerPageText }),
|
|
@@ -7795,7 +7806,7 @@ var PageToSelectContainer = import_styled_components36.default.span`
|
|
|
7795
7806
|
var Paginator_default = DxcPaginator;
|
|
7796
7807
|
|
|
7797
7808
|
// src/table/Table.tsx
|
|
7798
|
-
var
|
|
7809
|
+
var import_react45 = require("react");
|
|
7799
7810
|
var import_styled_components37 = __toESM(require("styled-components"));
|
|
7800
7811
|
|
|
7801
7812
|
// src/table/dropdownTheme.ts
|
|
@@ -7871,7 +7882,7 @@ var DxcActionsCell = ({ actions }) => {
|
|
|
7871
7882
|
const actionIcons = actions.filter((action) => !action.options);
|
|
7872
7883
|
const actionDropdown = actions.find((action) => action.options);
|
|
7873
7884
|
const maxNumberOfActions = actionDropdown ? 2 : 3;
|
|
7874
|
-
const colorsTheme = (0,
|
|
7885
|
+
const colorsTheme = (0, import_react45.useContext)(HalstackContext);
|
|
7875
7886
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Flex_default, { gap: "0.5rem", alignItems: "center", children: [
|
|
7876
7887
|
actionIcons.map(
|
|
7877
7888
|
(action, index) => index < maxNumberOfActions && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
@@ -7900,7 +7911,7 @@ var DxcActionsCell = ({ actions }) => {
|
|
|
7900
7911
|
] });
|
|
7901
7912
|
};
|
|
7902
7913
|
var DxcTable = ({ children, margin, mode = "default" }) => {
|
|
7903
|
-
const colorsTheme = (0,
|
|
7914
|
+
const colorsTheme = (0, import_react45.useContext)(HalstackContext);
|
|
7904
7915
|
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
7916
|
};
|
|
7906
7917
|
var calculateWidth7 = (margin) => `calc(100% - ${getMargin(margin, "left")} - ${getMargin(margin, "right")})`;
|
|
@@ -8134,9 +8145,9 @@ var DxcDataGrid = ({
|
|
|
8134
8145
|
totalItems,
|
|
8135
8146
|
defaultPage = 1
|
|
8136
8147
|
}) => {
|
|
8137
|
-
const [rowsToRender, setRowsToRender] = (0,
|
|
8138
|
-
const colorsTheme = (0,
|
|
8139
|
-
const [page, changePage] = (0,
|
|
8148
|
+
const [rowsToRender, setRowsToRender] = (0, import_react46.useState)([...rows]);
|
|
8149
|
+
const colorsTheme = (0, import_react46.useContext)(HalstackContext);
|
|
8150
|
+
const [page, changePage] = (0, import_react46.useState)(defaultPage);
|
|
8140
8151
|
const goToPage = (newPage) => {
|
|
8141
8152
|
if (onPageChange) {
|
|
8142
8153
|
onPageChange(newPage);
|
|
@@ -8154,7 +8165,7 @@ var DxcDataGrid = ({
|
|
|
8154
8165
|
}
|
|
8155
8166
|
setSortColumns(newSortColumns);
|
|
8156
8167
|
};
|
|
8157
|
-
const columnsToRender = (0,
|
|
8168
|
+
const columnsToRender = (0, import_react46.useMemo)(() => {
|
|
8158
8169
|
let expectedColumns = columns.map((column) => convertToRDGColumns(column, summaryRow));
|
|
8159
8170
|
if (expandable) {
|
|
8160
8171
|
expectedColumns = [
|
|
@@ -8219,12 +8230,12 @@ var DxcDataGrid = ({
|
|
|
8219
8230
|
}
|
|
8220
8231
|
return expectedColumns;
|
|
8221
8232
|
}, [selectable, expandable, columns, rowsToRender, onSelectRows, rows, summaryRow, uniqueRowId, selectedRows]);
|
|
8222
|
-
const [columnsOrder, setColumnsOrder] = (0,
|
|
8223
|
-
const [sortColumns, setSortColumns] = (0,
|
|
8224
|
-
(0,
|
|
8233
|
+
const [columnsOrder, setColumnsOrder] = (0, import_react46.useState)(() => columnsToRender.map((_, index) => index));
|
|
8234
|
+
const [sortColumns, setSortColumns] = (0, import_react46.useState)([]);
|
|
8235
|
+
(0, import_react46.useEffect)(() => {
|
|
8225
8236
|
setColumnsOrder(Array.from({ length: columnsToRender.length }, (_, index) => index));
|
|
8226
8237
|
}, [columnsToRender.length]);
|
|
8227
|
-
(0,
|
|
8238
|
+
(0, import_react46.useEffect)(() => {
|
|
8228
8239
|
const finalRows = [...rows];
|
|
8229
8240
|
if (expandable) {
|
|
8230
8241
|
finalRows.filter((row) => {
|
|
@@ -8236,7 +8247,7 @@ var DxcDataGrid = ({
|
|
|
8236
8247
|
}
|
|
8237
8248
|
setRowsToRender(finalRows);
|
|
8238
8249
|
}, [rows]);
|
|
8239
|
-
const reorderedColumns = (0,
|
|
8250
|
+
const reorderedColumns = (0, import_react46.useMemo)(
|
|
8240
8251
|
() => (
|
|
8241
8252
|
// Array ordered by columnsOrder
|
|
8242
8253
|
columnsOrder.map((index) => columnsToRender[index])
|
|
@@ -8268,7 +8279,7 @@ var DxcDataGrid = ({
|
|
|
8268
8279
|
onGridRowsChange(newRows);
|
|
8269
8280
|
}
|
|
8270
8281
|
};
|
|
8271
|
-
const sortedRows = (0,
|
|
8282
|
+
const sortedRows = (0, import_react46.useMemo)(() => {
|
|
8272
8283
|
const sortFunctions = getCustomSortFn(columns);
|
|
8273
8284
|
if (!onSort) {
|
|
8274
8285
|
if (sortColumns.length > 0 && uniqueRowId) {
|
|
@@ -8297,12 +8308,12 @@ var DxcDataGrid = ({
|
|
|
8297
8308
|
}
|
|
8298
8309
|
return rowsToRender;
|
|
8299
8310
|
}, [expandable, rowsToRender, sortColumns, uniqueRowId]);
|
|
8300
|
-
const minItemsPerPageIndex = (0,
|
|
8301
|
-
const maxItemsPerPageIndex = (0,
|
|
8311
|
+
const minItemsPerPageIndex = (0, import_react46.useMemo)(() => getMinItemsPerPageIndex(page, itemsPerPage, page), [itemsPerPage, page]);
|
|
8312
|
+
const maxItemsPerPageIndex = (0, import_react46.useMemo)(
|
|
8302
8313
|
() => getMaxItemsPerPageIndex(minItemsPerPageIndex, itemsPerPage, rows, page),
|
|
8303
8314
|
[itemsPerPage, minItemsPerPageIndex, page, rows]
|
|
8304
8315
|
);
|
|
8305
|
-
const filteredRows = (0,
|
|
8316
|
+
const filteredRows = (0, import_react46.useMemo)(() => {
|
|
8306
8317
|
if (onSort && sortColumns?.length > 0) {
|
|
8307
8318
|
onSort?.(sortColumns?.[0]);
|
|
8308
8319
|
}
|
|
@@ -8346,19 +8357,19 @@ DxcDataGrid.ActionsCell = DxcActionsCell;
|
|
|
8346
8357
|
var DataGrid_default = DxcDataGrid;
|
|
8347
8358
|
|
|
8348
8359
|
// src/date-input/DateInput.tsx
|
|
8349
|
-
var
|
|
8360
|
+
var import_react54 = require("react");
|
|
8350
8361
|
var import_dayjs3 = __toESM(require("dayjs"));
|
|
8351
8362
|
var import_styled_components45 = __toESM(require("styled-components"));
|
|
8352
8363
|
var Popover4 = __toESM(require("@radix-ui/react-popover"));
|
|
8353
8364
|
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"));
|
|
8354
8365
|
|
|
8355
8366
|
// src/date-input/DatePicker.tsx
|
|
8356
|
-
var
|
|
8367
|
+
var import_react49 = require("react");
|
|
8357
8368
|
var import_dayjs2 = __toESM(require("dayjs"));
|
|
8358
8369
|
var import_styled_components41 = __toESM(require("styled-components"));
|
|
8359
8370
|
|
|
8360
8371
|
// src/date-input/Calendar.tsx
|
|
8361
|
-
var
|
|
8372
|
+
var import_react47 = require("react");
|
|
8362
8373
|
var import_styled_components39 = __toESM(require("styled-components"));
|
|
8363
8374
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
8364
8375
|
var getDays = (innerDate) => {
|
|
@@ -8402,11 +8413,11 @@ var Calendar = ({
|
|
|
8402
8413
|
onDaySelect,
|
|
8403
8414
|
today: today2
|
|
8404
8415
|
}) => {
|
|
8405
|
-
const [dateToFocus, setDateToFocus] = (0,
|
|
8406
|
-
const [isFocusable, setIsFocusable] = (0,
|
|
8407
|
-
const id = (0,
|
|
8408
|
-
const translatedLabels = (0,
|
|
8409
|
-
const dayCells = (0,
|
|
8416
|
+
const [dateToFocus, setDateToFocus] = (0, import_react47.useState)(getDateToFocus(selectedDate, innerDate, today2));
|
|
8417
|
+
const [isFocusable, setIsFocusable] = (0, import_react47.useState)(false);
|
|
8418
|
+
const id = (0, import_react47.useId)();
|
|
8419
|
+
const translatedLabels = (0, import_react47.useContext)(HalstackLanguageContext);
|
|
8420
|
+
const dayCells = (0, import_react47.useMemo)(() => getDays(innerDate), [innerDate]);
|
|
8410
8421
|
const onDateClickHandler = (date) => {
|
|
8411
8422
|
const newDate = innerDate.set("month", date.month).set("date", date.day);
|
|
8412
8423
|
onDaySelect(newDate);
|
|
@@ -8424,13 +8435,13 @@ var Calendar = ({
|
|
|
8424
8435
|
setDateToFocus(date);
|
|
8425
8436
|
setIsFocusable(true);
|
|
8426
8437
|
};
|
|
8427
|
-
(0,
|
|
8438
|
+
(0, import_react47.useEffect)(() => {
|
|
8428
8439
|
if (isFocusable) {
|
|
8429
8440
|
document.getElementById(`${id}_day_${dateToFocus.get("date")}_month${dateToFocus.get("month")}`)?.focus();
|
|
8430
8441
|
setIsFocusable(false);
|
|
8431
8442
|
}
|
|
8432
8443
|
}, [dateToFocus, isFocusable]);
|
|
8433
|
-
(0,
|
|
8444
|
+
(0, import_react47.useEffect)(() => {
|
|
8434
8445
|
if (dateToFocus.get("month") !== innerDate.get("month") || dateToFocus.get("year") !== innerDate.get("year")) {
|
|
8435
8446
|
setDateToFocus(getDateToFocus(selectedDate, innerDate, today2));
|
|
8436
8447
|
}
|
|
@@ -8591,11 +8602,11 @@ var DayCellButton = import_styled_components39.default.button`
|
|
|
8591
8602
|
background-color: ${(props) => props.selected ? props.theme.dateInput.pickerSelectedBackgroundColor : "transparent"};
|
|
8592
8603
|
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
8604
|
`;
|
|
8594
|
-
var Calendar_default = (0,
|
|
8605
|
+
var Calendar_default = (0, import_react47.memo)(Calendar);
|
|
8595
8606
|
|
|
8596
8607
|
// src/date-input/YearPicker.tsx
|
|
8597
8608
|
var import_dayjs = __toESM(require("dayjs"));
|
|
8598
|
-
var
|
|
8609
|
+
var import_react48 = require("react");
|
|
8599
8610
|
var import_styled_components40 = __toESM(require("styled-components"));
|
|
8600
8611
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
8601
8612
|
var getYearsArray = () => {
|
|
@@ -8607,9 +8618,9 @@ var getYearsArray = () => {
|
|
|
8607
8618
|
};
|
|
8608
8619
|
var yearList = getYearsArray();
|
|
8609
8620
|
var YearPicker = ({ onYearSelect, selectedDate, today: today2 }) => {
|
|
8610
|
-
const id = (0,
|
|
8611
|
-
const [yearToFocus, setYearToFocus] = (0,
|
|
8612
|
-
(0,
|
|
8621
|
+
const id = (0, import_react48.useId)();
|
|
8622
|
+
const [yearToFocus, setYearToFocus] = (0, import_react48.useState)(selectedDate ? selectedDate.get("year") : (0, import_dayjs.default)().get("year"));
|
|
8623
|
+
(0, import_react48.useEffect)(() => {
|
|
8613
8624
|
const yearToFocusEl = document.getElementById(`${id}_year_${yearToFocus}`);
|
|
8614
8625
|
yearToFocusEl?.scrollIntoView?.({ block: "nearest", inline: "start" });
|
|
8615
8626
|
yearToFocusEl?.focus();
|
|
@@ -8696,16 +8707,16 @@ var YearPickerButton = import_styled_components40.default.button`
|
|
|
8696
8707
|
background-color: ${(props) => props.theme.dateInput.pickerActiveBackgroundColor} !important;
|
|
8697
8708
|
}
|
|
8698
8709
|
`;
|
|
8699
|
-
var YearPicker_default = (0,
|
|
8710
|
+
var YearPicker_default = (0, import_react48.memo)(YearPicker);
|
|
8700
8711
|
|
|
8701
8712
|
// src/date-input/DatePicker.tsx
|
|
8702
8713
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
8703
8714
|
var today = (0, import_dayjs2.default)();
|
|
8704
8715
|
var DatePicker = ({ date, onDateSelect, id }) => {
|
|
8705
|
-
const [innerDate, setInnerDate] = (0,
|
|
8706
|
-
const [content, setContent] = (0,
|
|
8716
|
+
const [innerDate, setInnerDate] = (0, import_react49.useState)(date?.isValid() ? date : (0, import_dayjs2.default)());
|
|
8717
|
+
const [content, setContent] = (0, import_react49.useState)("calendar");
|
|
8707
8718
|
const selectedDate = date?.isValid() ? date : (0, import_dayjs2.default)(null);
|
|
8708
|
-
const translatedLabels = (0,
|
|
8719
|
+
const translatedLabels = (0, import_react49.useContext)(HalstackLanguageContext);
|
|
8709
8720
|
const handleDateSelect = (chosenDate) => {
|
|
8710
8721
|
setInnerDate(chosenDate);
|
|
8711
8722
|
onDateSelect(chosenDate);
|
|
@@ -8831,23 +8842,23 @@ var HeaderYearTriggerLabel = import_styled_components41.default.span`
|
|
|
8831
8842
|
font-family: ${(props) => props.theme.dateInput.pickerFontFamily};
|
|
8832
8843
|
font-size: ${(props) => props.theme.dateInput.pickerHeaderFontSize};
|
|
8833
8844
|
`;
|
|
8834
|
-
var DatePicker_default = (0,
|
|
8845
|
+
var DatePicker_default = (0, import_react49.memo)(DatePicker);
|
|
8835
8846
|
|
|
8836
8847
|
// src/text-input/TextInput.tsx
|
|
8837
8848
|
var Popover3 = __toESM(require("@radix-ui/react-popover"));
|
|
8838
|
-
var
|
|
8849
|
+
var import_react53 = require("react");
|
|
8839
8850
|
var import_styled_components44 = __toESM(require("styled-components"));
|
|
8840
8851
|
|
|
8841
8852
|
// src/number-input/NumberInputContext.tsx
|
|
8842
|
-
var
|
|
8843
|
-
var NumberInputContext_default = (0,
|
|
8853
|
+
var import_react50 = require("react");
|
|
8854
|
+
var NumberInputContext_default = (0, import_react50.createContext)(null);
|
|
8844
8855
|
|
|
8845
8856
|
// src/text-input/Suggestions.tsx
|
|
8846
|
-
var
|
|
8857
|
+
var import_react52 = require("react");
|
|
8847
8858
|
var import_styled_components43 = __toESM(require("styled-components"));
|
|
8848
8859
|
|
|
8849
8860
|
// src/text-input/Suggestion.tsx
|
|
8850
|
-
var
|
|
8861
|
+
var import_react51 = require("react");
|
|
8851
8862
|
var import_styled_components42 = __toESM(require("styled-components"));
|
|
8852
8863
|
|
|
8853
8864
|
// src/text-input/utils.ts
|
|
@@ -8925,7 +8936,7 @@ var Suggestion = ({
|
|
|
8925
8936
|
visuallyFocused,
|
|
8926
8937
|
highlighted
|
|
8927
8938
|
}) => {
|
|
8928
|
-
const matchedSuggestion = (0,
|
|
8939
|
+
const matchedSuggestion = (0, import_react51.useMemo)(() => {
|
|
8929
8940
|
const regEx = new RegExp(transformSpecialChars(value), "i");
|
|
8930
8941
|
return { matchedWords: suggestion.match(regEx), noMatchedWords: suggestion.replace(regEx, "") };
|
|
8931
8942
|
}, [value, suggestion]);
|
|
@@ -8946,7 +8957,7 @@ var Suggestion = ({
|
|
|
8946
8957
|
}
|
|
8947
8958
|
);
|
|
8948
8959
|
};
|
|
8949
|
-
var Suggestion_default = (0,
|
|
8960
|
+
var Suggestion_default = (0, import_react51.memo)(Suggestion);
|
|
8950
8961
|
|
|
8951
8962
|
// src/text-input/Suggestions.tsx
|
|
8952
8963
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
@@ -9002,9 +9013,9 @@ var Suggestions = ({
|
|
|
9002
9013
|
suggestionOnClick,
|
|
9003
9014
|
styles
|
|
9004
9015
|
}) => {
|
|
9005
|
-
const translatedLabels = (0,
|
|
9006
|
-
const listboxRef = (0,
|
|
9007
|
-
(0,
|
|
9016
|
+
const translatedLabels = (0, import_react52.useContext)(HalstackLanguageContext);
|
|
9017
|
+
const listboxRef = (0, import_react52.useRef)(null);
|
|
9018
|
+
(0, import_react52.useEffect)(() => {
|
|
9008
9019
|
const visualFocusedOptionEl = listboxRef?.current?.querySelectorAll("[role='option']")[visualFocusIndex];
|
|
9009
9020
|
visualFocusedOptionEl?.scrollIntoView?.({
|
|
9010
9021
|
block: "nearest",
|
|
@@ -9046,7 +9057,7 @@ var Suggestions = ({
|
|
|
9046
9057
|
}
|
|
9047
9058
|
);
|
|
9048
9059
|
};
|
|
9049
|
-
var Suggestions_default = (0,
|
|
9060
|
+
var Suggestions_default = (0, import_react52.memo)(Suggestions);
|
|
9050
9061
|
|
|
9051
9062
|
// src/text-input/TextInput.tsx
|
|
9052
9063
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
@@ -9174,7 +9185,7 @@ var ErrorMessageContainer = import_styled_components44.default.span`
|
|
|
9174
9185
|
margin-top: 0.25rem;
|
|
9175
9186
|
`;
|
|
9176
9187
|
var AutosuggestWrapper = ({ condition, wrapper, children }) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_jsx_runtime51.Fragment, { children: condition ? wrapper(children) : children });
|
|
9177
|
-
var DxcTextInput = (0,
|
|
9188
|
+
var DxcTextInput = (0, import_react53.forwardRef)(
|
|
9178
9189
|
({
|
|
9179
9190
|
alignment = "left",
|
|
9180
9191
|
label,
|
|
@@ -9203,21 +9214,21 @@ var DxcTextInput = (0, import_react51.forwardRef)(
|
|
|
9203
9214
|
tabIndex = 0,
|
|
9204
9215
|
ariaLabel = "Text input"
|
|
9205
9216
|
}, ref) => {
|
|
9206
|
-
const inputId = `input-${(0,
|
|
9217
|
+
const inputId = `input-${(0, import_react53.useId)()}`;
|
|
9207
9218
|
const autosuggestId = `suggestions-${inputId}`;
|
|
9208
9219
|
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,
|
|
9220
|
+
const colorsTheme = (0, import_react53.useContext)(HalstackContext);
|
|
9221
|
+
const translatedLabels = (0, import_react53.useContext)(HalstackLanguageContext);
|
|
9222
|
+
const numberInputContext = (0, import_react53.useContext)(NumberInputContext_default);
|
|
9223
|
+
const inputRef = (0, import_react53.useRef)(null);
|
|
9224
|
+
const inputContainerRef = (0, import_react53.useRef)(null);
|
|
9225
|
+
const actionRef = (0, import_react53.useRef)(null);
|
|
9226
|
+
const [innerValue, setInnerValue] = (0, import_react53.useState)(defaultValue);
|
|
9227
|
+
const [isOpen, changeIsOpen] = (0, import_react53.useState)(false);
|
|
9228
|
+
const [isSearching, changeIsSearching] = (0, import_react53.useState)(false);
|
|
9229
|
+
const [isAutosuggestError, changeIsAutosuggestError] = (0, import_react53.useState)(false);
|
|
9230
|
+
const [filteredSuggestions, changeFilteredSuggestions] = (0, import_react53.useState)([]);
|
|
9231
|
+
const [visualFocusIndex, changeVisualFocusIndex] = (0, import_react53.useState)(-1);
|
|
9221
9232
|
const width = useWidth_default(inputContainerRef.current);
|
|
9222
9233
|
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
9234
|
const openSuggestions = () => {
|
|
@@ -9427,7 +9438,7 @@ var DxcTextInput = (0, import_react51.forwardRef)(
|
|
|
9427
9438
|
inputRef.current?.setAttribute("type", type);
|
|
9428
9439
|
}
|
|
9429
9440
|
};
|
|
9430
|
-
(0,
|
|
9441
|
+
(0, import_react53.useEffect)(() => {
|
|
9431
9442
|
if (typeof suggestions === "function") {
|
|
9432
9443
|
changeIsSearching(true);
|
|
9433
9444
|
changeIsAutosuggestError(false);
|
|
@@ -9463,163 +9474,166 @@ var DxcTextInput = (0, import_react51.forwardRef)(
|
|
|
9463
9474
|
}
|
|
9464
9475
|
return void 0;
|
|
9465
9476
|
}, [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,
|
|
9477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_styled_components44.ThemeProvider, { theme: colorsTheme.textInput, children: [
|
|
9478
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(TextInputContainer, { margin, size, ref, children: [
|
|
9479
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(Label4, { htmlFor: inputId, disabled, hasHelperText: !!helperText, children: [
|
|
9480
|
+
label,
|
|
9481
|
+
" ",
|
|
9482
|
+
optional && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(OptionalLabel2, { children: translatedLabels.formFields.optionalLabel })
|
|
9483
|
+
] }),
|
|
9484
|
+
helperText && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(HelperText2, { disabled, children: helperText }),
|
|
9485
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9486
|
+
AutosuggestWrapper,
|
|
9487
|
+
{
|
|
9488
|
+
condition: hasSuggestions(suggestions),
|
|
9489
|
+
wrapper: (children) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(Popover3.Root, { open: isOpen && (filteredSuggestions.length > 0 || isSearching || isAutosuggestError), children: [
|
|
9490
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9491
|
+
Popover3.Trigger,
|
|
9492
|
+
{
|
|
9493
|
+
asChild: true,
|
|
9494
|
+
type: void 0,
|
|
9495
|
+
"aria-controls": void 0,
|
|
9496
|
+
"aria-haspopup": void 0,
|
|
9497
|
+
"aria-expanded": void 0,
|
|
9498
|
+
children
|
|
9499
|
+
}
|
|
9500
|
+
),
|
|
9501
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Popover3.Portal, { container: document.getElementById(`${inputId}-portal`), children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9502
|
+
Popover3.Content,
|
|
9503
|
+
{
|
|
9504
|
+
sideOffset: 5,
|
|
9505
|
+
style: { zIndex: "320" },
|
|
9506
|
+
onOpenAutoFocus: (event) => {
|
|
9507
|
+
event.preventDefault();
|
|
9508
|
+
},
|
|
9509
|
+
onCloseAutoFocus: (event) => {
|
|
9510
|
+
event.preventDefault();
|
|
9511
|
+
},
|
|
9512
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9513
|
+
Suggestions_default,
|
|
9534
9514
|
{
|
|
9535
|
-
|
|
9536
|
-
id: inputId,
|
|
9537
|
-
name,
|
|
9515
|
+
id: autosuggestId,
|
|
9538
9516
|
value: value ?? innerValue,
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
|
|
9545
|
-
|
|
9517
|
+
suggestions: filteredSuggestions,
|
|
9518
|
+
visualFocusIndex,
|
|
9519
|
+
highlightedSuggestions: typeof suggestions !== "function",
|
|
9520
|
+
searchHasErrors: isAutosuggestError,
|
|
9521
|
+
isSearching,
|
|
9522
|
+
suggestionOnClick: (suggestion) => {
|
|
9523
|
+
changeValue(suggestion);
|
|
9524
|
+
closeSuggestions();
|
|
9546
9525
|
},
|
|
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
|
|
9567
|
-
}
|
|
9568
|
-
),
|
|
9569
|
-
!disabled && error && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ErrorIcon2, { "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Icon_default, { icon: "filled_error" }) }),
|
|
9570
|
-
!disabled && !readOnly && clearable && (value ?? innerValue).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9571
|
-
ActionIcon_default,
|
|
9572
|
-
{
|
|
9573
|
-
onClick: handleClearActionOnClick,
|
|
9574
|
-
icon: "close",
|
|
9575
|
-
tabIndex,
|
|
9576
|
-
title: translatedLabels.textInput.clearFieldActionTitle
|
|
9526
|
+
styles: { width }
|
|
9577
9527
|
}
|
|
9578
|
-
)
|
|
9579
|
-
|
|
9528
|
+
)
|
|
9529
|
+
}
|
|
9530
|
+
) })
|
|
9531
|
+
] }),
|
|
9532
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
9533
|
+
InputContainer,
|
|
9534
|
+
{
|
|
9535
|
+
error: !!error,
|
|
9536
|
+
disabled,
|
|
9537
|
+
readOnly,
|
|
9538
|
+
onClick: handleInputContainerOnClick,
|
|
9539
|
+
onMouseDown: handleInputContainerOnMouseDown,
|
|
9540
|
+
ref: inputContainerRef,
|
|
9541
|
+
children: [
|
|
9542
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Prefix, { disabled, children: prefix }),
|
|
9543
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(Flex_default, { gap: "0.25rem", alignItems: "center", grow: 1, children: [
|
|
9580
9544
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9545
|
+
Input,
|
|
9546
|
+
{
|
|
9547
|
+
alignment,
|
|
9548
|
+
id: inputId,
|
|
9549
|
+
name,
|
|
9550
|
+
value: value ?? innerValue,
|
|
9551
|
+
placeholder,
|
|
9552
|
+
onBlur: handleInputOnBlur,
|
|
9553
|
+
onChange: handleInputOnChange,
|
|
9554
|
+
onFocus: !readOnly ? openSuggestions : void 0,
|
|
9555
|
+
onKeyDown: !readOnly ? handleInputOnKeyDown : void 0,
|
|
9556
|
+
onMouseDown: (event) => {
|
|
9557
|
+
event.stopPropagation();
|
|
9558
|
+
},
|
|
9559
|
+
onWheel: numberInputContext?.typeNumber === "number" ? handleNumberInputWheel : void 0,
|
|
9560
|
+
disabled,
|
|
9561
|
+
readOnly,
|
|
9562
|
+
ref: inputRef,
|
|
9563
|
+
pattern,
|
|
9564
|
+
minLength,
|
|
9565
|
+
maxLength,
|
|
9566
|
+
autoComplete: autocomplete === "off" ? "nope" : autocomplete,
|
|
9567
|
+
tabIndex,
|
|
9568
|
+
type: "text",
|
|
9569
|
+
role: hasSuggestions(suggestions) ? "combobox" : void 0,
|
|
9570
|
+
"aria-autocomplete": hasSuggestions(suggestions) ? "list" : void 0,
|
|
9571
|
+
"aria-controls": hasSuggestions(suggestions) ? autosuggestId : void 0,
|
|
9572
|
+
"aria-expanded": hasSuggestions(suggestions) ? isOpen : void 0,
|
|
9573
|
+
"aria-haspopup": hasSuggestions(suggestions) ? "listbox" : void 0,
|
|
9574
|
+
"aria-activedescendant": hasSuggestions(suggestions) && isOpen && visualFocusIndex !== -1 ? `suggestion-${visualFocusIndex}` : void 0,
|
|
9575
|
+
"aria-invalid": !!error,
|
|
9576
|
+
"aria-errormessage": error ? errorId : void 0,
|
|
9577
|
+
"aria-required": !disabled && !optional,
|
|
9578
|
+
"aria-label": label ? void 0 : ariaLabel
|
|
9579
|
+
}
|
|
9580
|
+
),
|
|
9581
|
+
!disabled && error && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ErrorIcon2, { "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Icon_default, { icon: "filled_error" }) }),
|
|
9582
|
+
!disabled && !readOnly && clearable && (value ?? innerValue).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9581
9583
|
ActionIcon_default,
|
|
9582
9584
|
{
|
|
9583
|
-
onClick:
|
|
9584
|
-
icon: "
|
|
9585
|
+
onClick: handleClearActionOnClick,
|
|
9586
|
+
icon: "close",
|
|
9585
9587
|
tabIndex,
|
|
9586
|
-
|
|
9587
|
-
title: translatedLabels.numberInput.decrementValueTitle,
|
|
9588
|
-
disabled
|
|
9588
|
+
title: translatedLabels.textInput.clearFieldActionTitle
|
|
9589
9589
|
}
|
|
9590
9590
|
),
|
|
9591
|
-
/* @__PURE__ */ (0, import_jsx_runtime51.
|
|
9591
|
+
numberInputContext?.typeNumber === "number" && numberInputContext?.showControls && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
9592
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9593
|
+
ActionIcon_default,
|
|
9594
|
+
{
|
|
9595
|
+
onClick: !readOnly ? handleDecrementActionOnClick : void 0,
|
|
9596
|
+
icon: "remove",
|
|
9597
|
+
tabIndex,
|
|
9598
|
+
ref: actionRef,
|
|
9599
|
+
title: translatedLabels.numberInput.decrementValueTitle,
|
|
9600
|
+
disabled
|
|
9601
|
+
}
|
|
9602
|
+
),
|
|
9603
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9604
|
+
ActionIcon_default,
|
|
9605
|
+
{
|
|
9606
|
+
onClick: !readOnly ? handleIncrementActionOnClick : void 0,
|
|
9607
|
+
icon: "add",
|
|
9608
|
+
tabIndex,
|
|
9609
|
+
ref: actionRef,
|
|
9610
|
+
title: translatedLabels.numberInput.incrementValueTitle,
|
|
9611
|
+
disabled
|
|
9612
|
+
}
|
|
9613
|
+
)
|
|
9614
|
+
] }),
|
|
9615
|
+
action && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9592
9616
|
ActionIcon_default,
|
|
9593
9617
|
{
|
|
9594
|
-
onClick: !readOnly ?
|
|
9595
|
-
icon:
|
|
9618
|
+
onClick: !readOnly ? action.onClick : void 0,
|
|
9619
|
+
icon: action.icon,
|
|
9596
9620
|
tabIndex,
|
|
9597
9621
|
ref: actionRef,
|
|
9598
|
-
title:
|
|
9622
|
+
title: action.title ?? void 0,
|
|
9599
9623
|
disabled
|
|
9600
9624
|
}
|
|
9601
9625
|
)
|
|
9602
9626
|
] }),
|
|
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
|
-
] }) });
|
|
9627
|
+
suffix && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Suffix, { disabled, children: suffix })
|
|
9628
|
+
]
|
|
9629
|
+
}
|
|
9630
|
+
)
|
|
9631
|
+
}
|
|
9632
|
+
),
|
|
9633
|
+
!disabled && typeof error === "string" && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ErrorMessageContainer, { id: errorId, role: "alert", "aria-live": error ? "assertive" : "off", children: error })
|
|
9634
|
+
] }),
|
|
9635
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { id: `${inputId}-portal`, style: { position: "absolute" } })
|
|
9636
|
+
] });
|
|
9623
9637
|
}
|
|
9624
9638
|
);
|
|
9625
9639
|
var TextInput_default = DxcTextInput;
|
|
@@ -9647,7 +9661,7 @@ var getDate = (value, format, lastValidYear, setLastValidYear) => {
|
|
|
9647
9661
|
}
|
|
9648
9662
|
return newDate;
|
|
9649
9663
|
};
|
|
9650
|
-
var DxcDateInput = (0,
|
|
9664
|
+
var DxcDateInput = (0, import_react54.forwardRef)(
|
|
9651
9665
|
({
|
|
9652
9666
|
label,
|
|
9653
9667
|
name,
|
|
@@ -9669,18 +9683,18 @@ var DxcDateInput = (0, import_react52.forwardRef)(
|
|
|
9669
9683
|
tabIndex,
|
|
9670
9684
|
ariaLabel = "Date input"
|
|
9671
9685
|
}, 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,
|
|
9686
|
+
const [innerValue, setInnerValue] = (0, import_react54.useState)(defaultValue);
|
|
9687
|
+
const [isOpen, setIsOpen] = (0, import_react54.useState)(false);
|
|
9688
|
+
const calendarId = `date-picker-${(0, import_react54.useId)()}`;
|
|
9689
|
+
const [dayjsDate, setDayjsDate] = (0, import_react54.useState)(getValueForPicker(value ?? defaultValue ?? "", format));
|
|
9690
|
+
const [lastValidYear, setLastValidYear] = (0, import_react54.useState)(
|
|
9677
9691
|
innerValue || value ? !format.toUpperCase().includes("YYYY") && +getValueForPicker(value ?? innerValue, format).format("YY") < 68 ? 2e3 : 1900 : null
|
|
9678
9692
|
);
|
|
9679
|
-
const [sideOffset, setSideOffset] = (0,
|
|
9680
|
-
const colorsTheme = (0,
|
|
9681
|
-
const translatedLabels = (0,
|
|
9682
|
-
const dateRef = (0,
|
|
9683
|
-
const popoverContentRef = (0,
|
|
9693
|
+
const [sideOffset, setSideOffset] = (0, import_react54.useState)(SIDEOFFSET);
|
|
9694
|
+
const colorsTheme = (0, import_react54.useContext)(HalstackContext);
|
|
9695
|
+
const translatedLabels = (0, import_react54.useContext)(HalstackLanguageContext);
|
|
9696
|
+
const dateRef = (0, import_react54.useRef)(null);
|
|
9697
|
+
const popoverContentRef = (0, import_react54.useRef)(null);
|
|
9684
9698
|
const handleCalendarOnClick = (newDate) => {
|
|
9685
9699
|
const newValue = newDate.format(format.toUpperCase());
|
|
9686
9700
|
if (!value) {
|
|
@@ -9737,7 +9751,7 @@ var DxcDateInput = (0, import_react52.forwardRef)(
|
|
|
9737
9751
|
onBlur?.(callbackParams);
|
|
9738
9752
|
}
|
|
9739
9753
|
};
|
|
9740
|
-
const adjustSideOffset = (0,
|
|
9754
|
+
const adjustSideOffset = (0, import_react54.useCallback)(() => {
|
|
9741
9755
|
if (error != null) {
|
|
9742
9756
|
setTimeout(() => {
|
|
9743
9757
|
if (popoverContentRef.current && dateRef.current) {
|
|
@@ -9773,18 +9787,18 @@ var DxcDateInput = (0, import_react52.forwardRef)(
|
|
|
9773
9787
|
closeCalendar();
|
|
9774
9788
|
}
|
|
9775
9789
|
};
|
|
9776
|
-
(0,
|
|
9790
|
+
(0, import_react54.useEffect)(() => {
|
|
9777
9791
|
window.addEventListener("scroll", adjustSideOffset);
|
|
9778
9792
|
return () => {
|
|
9779
9793
|
window.removeEventListener("scroll", adjustSideOffset);
|
|
9780
9794
|
};
|
|
9781
9795
|
}, [adjustSideOffset]);
|
|
9782
|
-
(0,
|
|
9796
|
+
(0, import_react54.useEffect)(() => {
|
|
9783
9797
|
if (value || value === "") {
|
|
9784
9798
|
setDayjsDate(getDate(value, format, lastValidYear, setLastValidYear));
|
|
9785
9799
|
}
|
|
9786
9800
|
}, [value, format, lastValidYear]);
|
|
9787
|
-
(0,
|
|
9801
|
+
(0, import_react54.useEffect)(() => {
|
|
9788
9802
|
if (!disabled) {
|
|
9789
9803
|
const actionButtonElement = dateRef.current?.querySelector("[aria-label='Select date']");
|
|
9790
9804
|
actionButtonElement?.setAttribute("aria-haspopup", "true");
|
|
@@ -9796,62 +9810,65 @@ var DxcDateInput = (0, import_react52.forwardRef)(
|
|
|
9796
9810
|
}
|
|
9797
9811
|
}
|
|
9798
9812
|
}, [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,
|
|
9813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_styled_components45.ThemeProvider, { theme: colorsTheme, children: [
|
|
9814
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(DateInputContainer, { margin, size, ref, children: [
|
|
9815
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
9816
|
+
Label5,
|
|
9817
9817
|
{
|
|
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,
|
|
9818
|
+
htmlFor: dateRef.current?.getElementsByTagName("input")[0]?.id,
|
|
9828
9819
|
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 })
|
|
9820
|
+
hasHelperText: !!helperText,
|
|
9821
|
+
children: [
|
|
9822
|
+
label,
|
|
9823
|
+
" ",
|
|
9824
|
+
optional && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(OptionalLabel3, { children: translatedLabels.formFields.optionalLabel })
|
|
9825
|
+
]
|
|
9851
9826
|
}
|
|
9852
|
-
)
|
|
9853
|
-
|
|
9854
|
-
|
|
9827
|
+
),
|
|
9828
|
+
helperText && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(HelperText3, { disabled, children: helperText }),
|
|
9829
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(Popover4.Root, { open: isOpen, children: [
|
|
9830
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Popover4.Trigger, { asChild: true, "aria-controls": void 0, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
9831
|
+
TextInput_default,
|
|
9832
|
+
{
|
|
9833
|
+
name,
|
|
9834
|
+
defaultValue,
|
|
9835
|
+
value: value ?? innerValue,
|
|
9836
|
+
placeholder: placeholder ? format.toUpperCase() : void 0,
|
|
9837
|
+
action: {
|
|
9838
|
+
onClick: openCalendar,
|
|
9839
|
+
icon: "filled_calendar_today",
|
|
9840
|
+
title: "Select date"
|
|
9841
|
+
},
|
|
9842
|
+
clearable,
|
|
9843
|
+
disabled,
|
|
9844
|
+
readOnly,
|
|
9845
|
+
optional,
|
|
9846
|
+
onChange: handleOnChange,
|
|
9847
|
+
onBlur: handleOnBlur,
|
|
9848
|
+
error,
|
|
9849
|
+
autocomplete,
|
|
9850
|
+
size,
|
|
9851
|
+
tabIndex,
|
|
9852
|
+
ref: dateRef,
|
|
9853
|
+
ariaLabel
|
|
9854
|
+
}
|
|
9855
|
+
) }),
|
|
9856
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Popover4.Portal, { container: document.getElementById(`${calendarId}-portal`), children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
9857
|
+
StyledPopoverContent,
|
|
9858
|
+
{
|
|
9859
|
+
sideOffset,
|
|
9860
|
+
align: "end",
|
|
9861
|
+
"aria-modal": true,
|
|
9862
|
+
onBlur: handleDatePickerOnBlur,
|
|
9863
|
+
onKeyDown: handleDatePickerEscKeydown,
|
|
9864
|
+
ref: popoverContentRef,
|
|
9865
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(DatePicker_default, { id: calendarId, onDateSelect: handleCalendarOnClick, date: dayjsDate })
|
|
9866
|
+
}
|
|
9867
|
+
) })
|
|
9868
|
+
] })
|
|
9869
|
+
] }),
|
|
9870
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { id: `${calendarId}-portal`, style: { position: "absolute" } })
|
|
9871
|
+
] });
|
|
9855
9872
|
}
|
|
9856
9873
|
);
|
|
9857
9874
|
var sizes5 = {
|
|
@@ -9894,7 +9911,7 @@ var HelperText3 = import_styled_components45.default.span`
|
|
|
9894
9911
|
margin-bottom: 0.25rem;
|
|
9895
9912
|
`;
|
|
9896
9913
|
var StyledPopoverContent = (0, import_styled_components45.default)(Popover4.Content)`
|
|
9897
|
-
z-index:
|
|
9914
|
+
z-index: 310;
|
|
9898
9915
|
&:focus-visible {
|
|
9899
9916
|
outline: none;
|
|
9900
9917
|
}
|
|
@@ -9902,7 +9919,7 @@ var StyledPopoverContent = (0, import_styled_components45.default)(Popover4.Cont
|
|
|
9902
9919
|
var DateInput_default = DxcDateInput;
|
|
9903
9920
|
|
|
9904
9921
|
// src/dialog/Dialog.tsx
|
|
9905
|
-
var
|
|
9922
|
+
var import_react55 = require("react");
|
|
9906
9923
|
var import_react_dom2 = require("react-dom");
|
|
9907
9924
|
var import_styled_components46 = __toESM(require("styled-components"));
|
|
9908
9925
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
@@ -9918,7 +9935,7 @@ var DialogContainer = import_styled_components46.default.div`
|
|
|
9918
9935
|
align-items: center;
|
|
9919
9936
|
justify-content: center;
|
|
9920
9937
|
height: 100%;
|
|
9921
|
-
z-index:
|
|
9938
|
+
z-index: 300;
|
|
9922
9939
|
`;
|
|
9923
9940
|
var Overlay3 = import_styled_components46.default.div`
|
|
9924
9941
|
position: fixed;
|
|
@@ -9955,9 +9972,14 @@ var DxcDialog = ({
|
|
|
9955
9972
|
tabIndex = 0,
|
|
9956
9973
|
disableFocusLock = false
|
|
9957
9974
|
}) => {
|
|
9958
|
-
const
|
|
9959
|
-
const
|
|
9960
|
-
(0,
|
|
9975
|
+
const id = (0, import_react55.useId)();
|
|
9976
|
+
const colorsTheme = (0, import_react55.useContext)(HalstackContext);
|
|
9977
|
+
const translatedLabels = (0, import_react55.useContext)(HalstackLanguageContext);
|
|
9978
|
+
const [portalContainer, setPortalContainer] = (0, import_react55.useState)(null);
|
|
9979
|
+
(0, import_react55.useEffect)(() => {
|
|
9980
|
+
setPortalContainer(document.getElementById(`dialog-${id}-portal`));
|
|
9981
|
+
}, []);
|
|
9982
|
+
(0, import_react55.useEffect)(() => {
|
|
9961
9983
|
const handleKeyDown = (event) => {
|
|
9962
9984
|
if (event.key === "Escape") {
|
|
9963
9985
|
event.preventDefault();
|
|
@@ -9971,7 +9993,8 @@ var DxcDialog = ({
|
|
|
9971
9993
|
}, [onCloseClick]);
|
|
9972
9994
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_styled_components46.ThemeProvider, { theme: colorsTheme.dialog, children: [
|
|
9973
9995
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(BodyStyle2, {}),
|
|
9974
|
-
(0,
|
|
9996
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { id: `dialog-${id}-portal`, style: { position: "absolute" } }),
|
|
9997
|
+
portalContainer && (0, import_react_dom2.createPortal)(
|
|
9975
9998
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(DialogContainer, { children: [
|
|
9976
9999
|
overlay && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Overlay3, { onClick: onBackgroundClick }),
|
|
9977
10000
|
/* @__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 +10021,18 @@ var DxcDialog = ({
|
|
|
9998
10021
|
) })
|
|
9999
10022
|
] }) })
|
|
10000
10023
|
] }),
|
|
10001
|
-
|
|
10024
|
+
portalContainer
|
|
10002
10025
|
)
|
|
10003
10026
|
] });
|
|
10004
10027
|
};
|
|
10005
10028
|
var Dialog_default = DxcDialog;
|
|
10006
10029
|
|
|
10007
10030
|
// src/file-input/FileInput.tsx
|
|
10008
|
-
var
|
|
10031
|
+
var import_react57 = require("react");
|
|
10009
10032
|
var import_styled_components48 = __toESM(require("styled-components"));
|
|
10010
10033
|
|
|
10011
10034
|
// src/file-input/FileItem.tsx
|
|
10012
|
-
var
|
|
10035
|
+
var import_react56 = require("react");
|
|
10013
10036
|
var import_styled_components47 = __toESM(require("styled-components"));
|
|
10014
10037
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
10015
10038
|
var MainContainer3 = import_styled_components47.default.div`
|
|
@@ -10093,8 +10116,8 @@ var FileItem = ({
|
|
|
10093
10116
|
onDelete,
|
|
10094
10117
|
tabIndex
|
|
10095
10118
|
}) => {
|
|
10096
|
-
const translatedLabels = (0,
|
|
10097
|
-
const fileNameId = (0,
|
|
10119
|
+
const translatedLabels = (0, import_react56.useContext)(HalstackLanguageContext);
|
|
10120
|
+
const fileNameId = (0, import_react56.useId)();
|
|
10098
10121
|
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(MainContainer3, { error, role: "listitem", singleFileMode, showPreview, children: [
|
|
10099
10122
|
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
10123
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(FileItemContent, { children: [
|
|
@@ -10115,7 +10138,7 @@ var FileItem = ({
|
|
|
10115
10138
|
] })
|
|
10116
10139
|
] });
|
|
10117
10140
|
};
|
|
10118
|
-
var FileItem_default = (0,
|
|
10141
|
+
var FileItem_default = (0, import_react56.memo)(FileItem);
|
|
10119
10142
|
|
|
10120
10143
|
// src/file-input/utils.ts
|
|
10121
10144
|
var getFilePreview = async (file) => {
|
|
@@ -10226,7 +10249,7 @@ var ErrorMessage2 = import_styled_components48.default.div`
|
|
|
10226
10249
|
line-height: ${(props) => props.theme.errorMessageLineHeight};
|
|
10227
10250
|
margin-top: 0.25rem;
|
|
10228
10251
|
`;
|
|
10229
|
-
var DxcFileInput = (0,
|
|
10252
|
+
var DxcFileInput = (0, import_react57.forwardRef)(
|
|
10230
10253
|
({
|
|
10231
10254
|
mode = "file",
|
|
10232
10255
|
label = "",
|
|
@@ -10244,11 +10267,11 @@ var DxcFileInput = (0, import_react55.forwardRef)(
|
|
|
10244
10267
|
margin,
|
|
10245
10268
|
tabIndex = 0
|
|
10246
10269
|
}, 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,
|
|
10270
|
+
const [isDragging, setIsDragging] = (0, import_react57.useState)(false);
|
|
10271
|
+
const [files, setFiles] = (0, import_react57.useState)([]);
|
|
10272
|
+
const fileInputId = `file-input-${(0, import_react57.useId)()}`;
|
|
10273
|
+
const colorsTheme = (0, import_react57.useContext)(HalstackContext);
|
|
10274
|
+
const translatedLabels = (0, import_react57.useContext)(HalstackLanguageContext);
|
|
10252
10275
|
const checkFileSize = (file) => {
|
|
10253
10276
|
if (minSize && file.size < minSize) return translatedLabels.fileInput.fileSizeGreaterThanErrorMessage;
|
|
10254
10277
|
else if (maxSize && file.size > maxSize) return translatedLabels.fileInput.fileSizeLessThanErrorMessage;
|
|
@@ -10281,7 +10304,7 @@ var DxcFileInput = (0, import_react55.forwardRef)(
|
|
|
10281
10304
|
e.target.value = "";
|
|
10282
10305
|
}
|
|
10283
10306
|
};
|
|
10284
|
-
const onDelete = (0,
|
|
10307
|
+
const onDelete = (0, import_react57.useCallback)(
|
|
10285
10308
|
(fileName) => {
|
|
10286
10309
|
const filesCopy = [...files];
|
|
10287
10310
|
const fileToRemove = filesCopy.find((file) => file.file.name === fileName);
|
|
@@ -10320,7 +10343,7 @@ var DxcFileInput = (0, import_react55.forwardRef)(
|
|
|
10320
10343
|
addFile(filesArray);
|
|
10321
10344
|
}
|
|
10322
10345
|
};
|
|
10323
|
-
(0,
|
|
10346
|
+
(0, import_react57.useEffect)(() => {
|
|
10324
10347
|
const getFiles = async () => {
|
|
10325
10348
|
if (value) {
|
|
10326
10349
|
const valueFiles = await Promise.all(
|
|
@@ -10472,10 +10495,10 @@ var Grid_default = DxcGrid;
|
|
|
10472
10495
|
|
|
10473
10496
|
// src/heading/Heading.tsx
|
|
10474
10497
|
var import_styled_components50 = __toESM(require("styled-components"));
|
|
10475
|
-
var
|
|
10498
|
+
var import_react58 = require("react");
|
|
10476
10499
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
10477
10500
|
var DxcHeading = ({ level = 1, text = "", as, weight, margin }) => {
|
|
10478
|
-
const colorsTheme = (0,
|
|
10501
|
+
const colorsTheme = (0, import_react58.useContext)(HalstackContext);
|
|
10479
10502
|
const checkValidAs = () => {
|
|
10480
10503
|
if (as === "h1" || as === "h2" || as === "h3" || as === "h4" || as === "h5") return as;
|
|
10481
10504
|
};
|
|
@@ -10542,7 +10565,7 @@ var Heading_default = DxcHeading;
|
|
|
10542
10565
|
|
|
10543
10566
|
// src/image/Image.tsx
|
|
10544
10567
|
var import_styled_components51 = __toESM(require("styled-components"));
|
|
10545
|
-
var
|
|
10568
|
+
var import_react59 = require("react");
|
|
10546
10569
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
10547
10570
|
var Figure = import_styled_components51.default.figure`
|
|
10548
10571
|
display: flex;
|
|
@@ -10578,7 +10601,7 @@ function DxcImage({
|
|
|
10578
10601
|
onLoad,
|
|
10579
10602
|
onError
|
|
10580
10603
|
}) {
|
|
10581
|
-
const colorsTheme = (0,
|
|
10604
|
+
const colorsTheme = (0, import_react59.useContext)(HalstackContext);
|
|
10582
10605
|
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
10606
|
"img",
|
|
10584
10607
|
{
|
|
@@ -10625,7 +10648,7 @@ var Inset = ({ space, horizontal, vertical, top, right, bottom, left, children }
|
|
|
10625
10648
|
var Inset_default = Inset;
|
|
10626
10649
|
|
|
10627
10650
|
// src/link/Link.tsx
|
|
10628
|
-
var
|
|
10651
|
+
var import_react60 = require("react");
|
|
10629
10652
|
var import_styled_components53 = __toESM(require("styled-components"));
|
|
10630
10653
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
10631
10654
|
var StyledLink = import_styled_components53.default.a`
|
|
@@ -10690,7 +10713,7 @@ var LinkIconContainer = import_styled_components53.default.div`
|
|
|
10690
10713
|
height: ${(props) => props.theme.iconSize};
|
|
10691
10714
|
}
|
|
10692
10715
|
`;
|
|
10693
|
-
var DxcLink = (0,
|
|
10716
|
+
var DxcLink = (0, import_react60.forwardRef)(
|
|
10694
10717
|
({
|
|
10695
10718
|
inheritColor = false,
|
|
10696
10719
|
disabled = false,
|
|
@@ -10704,7 +10727,7 @@ var DxcLink = (0, import_react58.forwardRef)(
|
|
|
10704
10727
|
children,
|
|
10705
10728
|
...otherProps
|
|
10706
10729
|
}, ref) => {
|
|
10707
|
-
const colorsTheme = (0,
|
|
10730
|
+
const colorsTheme = (0, import_react60.useContext)(HalstackContext);
|
|
10708
10731
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_styled_components53.ThemeProvider, { theme: colorsTheme.link, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
10709
10732
|
StyledLink,
|
|
10710
10733
|
{
|
|
@@ -10729,20 +10752,20 @@ var DxcLink = (0, import_react58.forwardRef)(
|
|
|
10729
10752
|
var Link_default = DxcLink;
|
|
10730
10753
|
|
|
10731
10754
|
// src/nav-tabs/NavTabs.tsx
|
|
10732
|
-
var
|
|
10755
|
+
var import_react63 = require("react");
|
|
10733
10756
|
var import_styled_components55 = __toESM(require("styled-components"));
|
|
10734
10757
|
|
|
10735
10758
|
// src/nav-tabs/Tab.tsx
|
|
10736
|
-
var
|
|
10759
|
+
var import_react62 = require("react");
|
|
10737
10760
|
var import_styled_components54 = __toESM(require("styled-components"));
|
|
10738
10761
|
|
|
10739
10762
|
// src/nav-tabs/NavTabsContext.tsx
|
|
10740
|
-
var
|
|
10741
|
-
var NavTabsContext_default = (0,
|
|
10763
|
+
var import_react61 = require("react");
|
|
10764
|
+
var NavTabsContext_default = (0, import_react61.createContext)(null);
|
|
10742
10765
|
|
|
10743
10766
|
// src/nav-tabs/Tab.tsx
|
|
10744
10767
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
10745
|
-
var DxcTab = (0,
|
|
10768
|
+
var DxcTab = (0, import_react62.forwardRef)(
|
|
10746
10769
|
({
|
|
10747
10770
|
href,
|
|
10748
10771
|
active = false,
|
|
@@ -10753,11 +10776,11 @@ var DxcTab = (0, import_react60.forwardRef)(
|
|
|
10753
10776
|
children,
|
|
10754
10777
|
...otherProps
|
|
10755
10778
|
}, ref) => {
|
|
10756
|
-
const tabRef = (0,
|
|
10757
|
-
const { iconPosition, tabIndex, focusedLabel } = (0,
|
|
10758
|
-
const innerRef = (0,
|
|
10759
|
-
(0,
|
|
10760
|
-
(0,
|
|
10779
|
+
const tabRef = (0, import_react62.useRef)();
|
|
10780
|
+
const { iconPosition, tabIndex, focusedLabel } = (0, import_react62.useContext)(NavTabsContext_default) ?? {};
|
|
10781
|
+
const innerRef = (0, import_react62.useRef)(null);
|
|
10782
|
+
(0, import_react62.useImperativeHandle)(ref, () => innerRef.current, []);
|
|
10783
|
+
(0, import_react62.useEffect)(() => {
|
|
10761
10784
|
if (focusedLabel === children.toString()) {
|
|
10762
10785
|
tabRef?.current?.focus();
|
|
10763
10786
|
}
|
|
@@ -10781,8 +10804,9 @@ var DxcTab = (0, import_react60.forwardRef)(
|
|
|
10781
10804
|
disabled,
|
|
10782
10805
|
active,
|
|
10783
10806
|
href: !disabled ? href : void 0,
|
|
10807
|
+
as: href ? "a" : onClick ? "button" : "div",
|
|
10784
10808
|
iconPosition,
|
|
10785
|
-
onClick,
|
|
10809
|
+
onClick: !disabled ? onClick : void 0,
|
|
10786
10810
|
onKeyDown: handleOnKeyDown,
|
|
10787
10811
|
hasIcon: icon != null,
|
|
10788
10812
|
ref: (anchorRef) => {
|
|
@@ -10916,17 +10940,17 @@ var getNextTabIndex = (array, initialIndex) => {
|
|
|
10916
10940
|
return index;
|
|
10917
10941
|
};
|
|
10918
10942
|
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 =
|
|
10943
|
+
const [innerFocusIndex, setInnerFocusIndex] = (0, import_react63.useState)(null);
|
|
10944
|
+
const [underlineWidth, setUnderlineWidth] = (0, import_react63.useState)(null);
|
|
10945
|
+
const refNavTabList = (0, import_react63.useRef)(null);
|
|
10946
|
+
const colorsTheme = (0, import_react63.useContext)(HalstackContext);
|
|
10947
|
+
const childArray = import_react63.Children.toArray(children).filter(
|
|
10924
10948
|
(child) => typeof child === "object" && "props" in child
|
|
10925
10949
|
);
|
|
10926
|
-
(0,
|
|
10950
|
+
(0, import_react63.useEffect)(() => {
|
|
10927
10951
|
setUnderlineWidth(refNavTabList?.current?.scrollWidth ?? null);
|
|
10928
10952
|
}, [children]);
|
|
10929
|
-
const contextValue = (0,
|
|
10953
|
+
const contextValue = (0, import_react63.useMemo)(
|
|
10930
10954
|
() => ({
|
|
10931
10955
|
iconPosition,
|
|
10932
10956
|
tabIndex,
|
|
@@ -10975,10 +10999,10 @@ var NavTabsContainer = import_styled_components55.default.div`
|
|
|
10975
10999
|
var NavTabs_default = DxcNavTabs;
|
|
10976
11000
|
|
|
10977
11001
|
// src/number-input/NumberInput.tsx
|
|
10978
|
-
var
|
|
11002
|
+
var import_react64 = require("react");
|
|
10979
11003
|
var import_styled_components56 = __toESM(require("styled-components"));
|
|
10980
11004
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
10981
|
-
var DxcNumberInput = (0,
|
|
11005
|
+
var DxcNumberInput = (0, import_react64.forwardRef)(
|
|
10982
11006
|
({
|
|
10983
11007
|
label,
|
|
10984
11008
|
name,
|
|
@@ -11004,8 +11028,8 @@ var DxcNumberInput = (0, import_react62.forwardRef)(
|
|
|
11004
11028
|
ariaLabel = "Number input",
|
|
11005
11029
|
showControls = true
|
|
11006
11030
|
}, ref) => {
|
|
11007
|
-
const numberInputRef = (0,
|
|
11008
|
-
const contextValue = (0,
|
|
11031
|
+
const numberInputRef = (0, import_react64.useRef)(null);
|
|
11032
|
+
const contextValue = (0, import_react64.useMemo)(
|
|
11009
11033
|
() => ({
|
|
11010
11034
|
maxNumber: max,
|
|
11011
11035
|
minNumber: min,
|
|
@@ -11015,7 +11039,7 @@ var DxcNumberInput = (0, import_react62.forwardRef)(
|
|
|
11015
11039
|
}),
|
|
11016
11040
|
[max, min, showControls, step]
|
|
11017
11041
|
);
|
|
11018
|
-
(0,
|
|
11042
|
+
(0, import_react64.useEffect)(() => {
|
|
11019
11043
|
const input = numberInputRef.current?.getElementsByTagName("input")[0];
|
|
11020
11044
|
const preventDefault = (event) => {
|
|
11021
11045
|
event.preventDefault();
|
|
@@ -11069,7 +11093,7 @@ var NumberInputContainer = import_styled_components56.default.div`
|
|
|
11069
11093
|
var NumberInput_default = DxcNumberInput;
|
|
11070
11094
|
|
|
11071
11095
|
// src/paragraph/Paragraph.tsx
|
|
11072
|
-
var
|
|
11096
|
+
var import_react65 = require("react");
|
|
11073
11097
|
var import_styled_components57 = __toESM(require("styled-components"));
|
|
11074
11098
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
11075
11099
|
var Paragraph = import_styled_components57.default.p`
|
|
@@ -11088,12 +11112,12 @@ var Paragraph = import_styled_components57.default.p`
|
|
|
11088
11112
|
margin: 0;
|
|
11089
11113
|
`;
|
|
11090
11114
|
function DxcParagraph({ children }) {
|
|
11091
|
-
const colorsTheme = (0,
|
|
11115
|
+
const colorsTheme = (0, import_react65.useContext)(HalstackContext);
|
|
11092
11116
|
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_styled_components57.ThemeProvider, { theme: colorsTheme.paragraph, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Paragraph, { children }) });
|
|
11093
11117
|
}
|
|
11094
11118
|
|
|
11095
11119
|
// src/password-input/PasswordInput.tsx
|
|
11096
|
-
var
|
|
11120
|
+
var import_react66 = require("react");
|
|
11097
11121
|
var import_styled_components58 = __toESM(require("styled-components"));
|
|
11098
11122
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
11099
11123
|
var setInputType = (type, element) => {
|
|
@@ -11103,7 +11127,7 @@ var setAriaAttributes = (ariaExpanded, element) => {
|
|
|
11103
11127
|
const buttonElement = element?.getElementsByTagName("button")[0];
|
|
11104
11128
|
buttonElement?.setAttribute("aria-expanded", ariaExpanded);
|
|
11105
11129
|
};
|
|
11106
|
-
var DxcPasswordInput = (0,
|
|
11130
|
+
var DxcPasswordInput = (0, import_react66.forwardRef)(
|
|
11107
11131
|
({
|
|
11108
11132
|
label,
|
|
11109
11133
|
name = "",
|
|
@@ -11122,10 +11146,10 @@ var DxcPasswordInput = (0, import_react64.forwardRef)(
|
|
|
11122
11146
|
tabIndex = 0,
|
|
11123
11147
|
ariaLabel = "Password input"
|
|
11124
11148
|
}, ref) => {
|
|
11125
|
-
const [isPasswordVisible, setIsPasswordVisible] = (0,
|
|
11126
|
-
const inputRef = (0,
|
|
11127
|
-
const { passwordInput } = (0,
|
|
11128
|
-
(0,
|
|
11149
|
+
const [isPasswordVisible, setIsPasswordVisible] = (0, import_react66.useState)(false);
|
|
11150
|
+
const inputRef = (0, import_react66.useRef)(null);
|
|
11151
|
+
const { passwordInput } = (0, import_react66.useContext)(HalstackLanguageContext);
|
|
11152
|
+
(0, import_react66.useEffect)(() => {
|
|
11129
11153
|
(() => {
|
|
11130
11154
|
if (isPasswordVisible) {
|
|
11131
11155
|
setInputType("text", inputRef.current);
|
|
@@ -11180,7 +11204,7 @@ var PasswordInput = import_styled_components58.default.div`
|
|
|
11180
11204
|
var PasswordInput_default = DxcPasswordInput;
|
|
11181
11205
|
|
|
11182
11206
|
// src/progress-bar/ProgressBar.tsx
|
|
11183
|
-
var
|
|
11207
|
+
var import_react67 = require("react");
|
|
11184
11208
|
var import_styled_components59 = __toESM(require("styled-components"));
|
|
11185
11209
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
11186
11210
|
var Overlay4 = import_styled_components59.default.div`
|
|
@@ -11300,10 +11324,10 @@ var DxcProgressBar = ({
|
|
|
11300
11324
|
margin,
|
|
11301
11325
|
ariaLabel = "Progress bar"
|
|
11302
11326
|
}) => {
|
|
11303
|
-
const colorsTheme = (0,
|
|
11304
|
-
const labelId = `label-${(0,
|
|
11305
|
-
const [innerValue, setInnerValue] = (0,
|
|
11306
|
-
(0,
|
|
11327
|
+
const colorsTheme = (0, import_react67.useContext)(HalstackContext);
|
|
11328
|
+
const labelId = `label-${(0, import_react67.useId)()}`;
|
|
11329
|
+
const [innerValue, setInnerValue] = (0, import_react67.useState)();
|
|
11330
|
+
(0, import_react67.useEffect)(() => {
|
|
11307
11331
|
if (value != null) setInnerValue(value < 0 ? 0 : value > 100 ? 100 : value);
|
|
11308
11332
|
}, [value]);
|
|
11309
11333
|
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 +11357,43 @@ var DxcProgressBar = ({
|
|
|
11333
11357
|
var ProgressBar_default = DxcProgressBar;
|
|
11334
11358
|
|
|
11335
11359
|
// src/quick-nav/QuickNav.tsx
|
|
11336
|
-
var
|
|
11360
|
+
var import_react68 = require("react");
|
|
11337
11361
|
var import_slugify = __toESM(require("slugify"));
|
|
11338
11362
|
var import_styled_components60 = __toESM(require("styled-components"));
|
|
11339
11363
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
11340
11364
|
var DxcQuickNav = ({ title, links }) => {
|
|
11341
|
-
const translatedLabels = (0,
|
|
11342
|
-
const colorsTheme = (0,
|
|
11365
|
+
const translatedLabels = (0, import_react68.useContext)(HalstackLanguageContext);
|
|
11366
|
+
const colorsTheme = (0, import_react68.useContext)(HalstackContext);
|
|
11367
|
+
const isHashRouter = () => {
|
|
11368
|
+
if (typeof window === "undefined") return false;
|
|
11369
|
+
return window.location.href.includes("/#/");
|
|
11370
|
+
};
|
|
11343
11371
|
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
11372
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Heading_default, { level: 4, text: title || translatedLabels.quickNav.contentTitle }),
|
|
11345
11373
|
/* @__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)(
|
|
11374
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
11375
|
+
Link3,
|
|
11376
|
+
{
|
|
11377
|
+
href: `#${(0, import_slugify.default)(link.label, { lower: true })}`,
|
|
11378
|
+
onClick: isHashRouter() ? (e) => {
|
|
11379
|
+
e.preventDefault();
|
|
11380
|
+
const id = (0, import_slugify.default)(link.label, { lower: true });
|
|
11381
|
+
document.getElementById(id)?.scrollIntoView();
|
|
11382
|
+
} : void 0,
|
|
11383
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { children: link.label })
|
|
11384
|
+
}
|
|
11385
|
+
),
|
|
11347
11386
|
/* @__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
11387
|
Link3,
|
|
11349
11388
|
{
|
|
11350
11389
|
href: `#${(0, import_slugify.default)(link?.label, { lower: true })}-${(0, import_slugify.default)(sublink?.label, {
|
|
11351
11390
|
lower: true
|
|
11352
11391
|
})}`,
|
|
11392
|
+
onClick: isHashRouter() ? (e) => {
|
|
11393
|
+
e.preventDefault();
|
|
11394
|
+
const id = `${(0, import_slugify.default)(link.label, { lower: true })}-${(0, import_slugify.default)(sublink.label, { lower: true })}`;
|
|
11395
|
+
document.getElementById(id)?.scrollIntoView();
|
|
11396
|
+
} : void 0,
|
|
11353
11397
|
children: sublink.label
|
|
11354
11398
|
}
|
|
11355
11399
|
) }) }) }, sublink.label)) })
|
|
@@ -11405,11 +11449,11 @@ var Link3 = import_styled_components60.default.a`
|
|
|
11405
11449
|
var QuickNav_default = DxcQuickNav;
|
|
11406
11450
|
|
|
11407
11451
|
// src/radio-group/RadioGroup.tsx
|
|
11408
|
-
var
|
|
11452
|
+
var import_react70 = require("react");
|
|
11409
11453
|
var import_styled_components62 = __toESM(require("styled-components"));
|
|
11410
11454
|
|
|
11411
11455
|
// src/radio-group/Radio.tsx
|
|
11412
|
-
var
|
|
11456
|
+
var import_react69 = require("react");
|
|
11413
11457
|
var import_styled_components61 = __toESM(require("styled-components"));
|
|
11414
11458
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
11415
11459
|
var DxcRadio = ({
|
|
@@ -11422,15 +11466,15 @@ var DxcRadio = ({
|
|
|
11422
11466
|
readOnly,
|
|
11423
11467
|
tabIndex
|
|
11424
11468
|
}) => {
|
|
11425
|
-
const radioLabelId = `radio-${(0,
|
|
11426
|
-
const ref = (0,
|
|
11427
|
-
const colorsTheme = (0,
|
|
11469
|
+
const radioLabelId = `radio-${(0, import_react69.useId)()}`;
|
|
11470
|
+
const ref = (0, import_react69.useRef)(null);
|
|
11471
|
+
const colorsTheme = (0, import_react69.useContext)(HalstackContext);
|
|
11428
11472
|
const handleOnClick = () => {
|
|
11429
11473
|
onClick();
|
|
11430
11474
|
document.activeElement !== ref.current && ref.current?.focus();
|
|
11431
11475
|
};
|
|
11432
|
-
const [firstUpdate, setFirstUpdate] = (0,
|
|
11433
|
-
(0,
|
|
11476
|
+
const [firstUpdate, setFirstUpdate] = (0, import_react69.useState)(true);
|
|
11477
|
+
(0, import_react69.useEffect)(() => {
|
|
11434
11478
|
if (firstUpdate) {
|
|
11435
11479
|
setFirstUpdate(false);
|
|
11436
11480
|
return;
|
|
@@ -11535,7 +11579,7 @@ var RadioContainer = import_styled_components61.default.span`
|
|
|
11535
11579
|
}
|
|
11536
11580
|
}
|
|
11537
11581
|
`;
|
|
11538
|
-
var Radio_default = (0,
|
|
11582
|
+
var Radio_default = (0, import_react69.memo)(DxcRadio);
|
|
11539
11583
|
|
|
11540
11584
|
// src/radio-group/RadioGroup.tsx
|
|
11541
11585
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
@@ -11543,7 +11587,7 @@ var getInitialFocusIndex = (innerOptions, value) => {
|
|
|
11543
11587
|
const initialSelectedOptionIndex = innerOptions.findIndex((option) => option.value === value);
|
|
11544
11588
|
return initialSelectedOptionIndex !== -1 ? initialSelectedOptionIndex : 0;
|
|
11545
11589
|
};
|
|
11546
|
-
var DxcRadioGroup = (0,
|
|
11590
|
+
var DxcRadioGroup = (0, import_react70.forwardRef)(
|
|
11547
11591
|
({
|
|
11548
11592
|
label,
|
|
11549
11593
|
name,
|
|
@@ -11562,14 +11606,14 @@ var DxcRadioGroup = (0, import_react68.forwardRef)(
|
|
|
11562
11606
|
tabIndex = 0,
|
|
11563
11607
|
ariaLabel = "Radio group"
|
|
11564
11608
|
}, ref) => {
|
|
11565
|
-
const radioGroupId = `radio-group-${(0,
|
|
11609
|
+
const radioGroupId = `radio-group-${(0, import_react70.useId)()}`;
|
|
11566
11610
|
const radioGroupLabelId = `label-${radioGroupId}`;
|
|
11567
11611
|
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,
|
|
11612
|
+
const [innerValue, setInnerValue] = (0, import_react70.useState)(defaultValue);
|
|
11613
|
+
const [firstTimeFocus, setFirstTimeFocus] = (0, import_react70.useState)(true);
|
|
11614
|
+
const colorsTheme = (0, import_react70.useContext)(HalstackContext);
|
|
11615
|
+
const translatedLabels = (0, import_react70.useContext)(HalstackLanguageContext);
|
|
11616
|
+
const innerOptions = (0, import_react70.useMemo)(
|
|
11573
11617
|
() => optional ? [
|
|
11574
11618
|
...options,
|
|
11575
11619
|
{
|
|
@@ -11580,8 +11624,8 @@ var DxcRadioGroup = (0, import_react68.forwardRef)(
|
|
|
11580
11624
|
] : options,
|
|
11581
11625
|
[optional, options, optionalItemLabel, translatedLabels]
|
|
11582
11626
|
);
|
|
11583
|
-
const [currentFocusIndex, setCurrentFocusIndex] = (0,
|
|
11584
|
-
const handleOnChange = (0,
|
|
11627
|
+
const [currentFocusIndex, setCurrentFocusIndex] = (0, import_react70.useState)(getInitialFocusIndex(innerOptions, value ?? innerValue));
|
|
11628
|
+
const handleOnChange = (0, import_react70.useCallback)(
|
|
11585
11629
|
(newValue) => {
|
|
11586
11630
|
const currentValue = value ?? innerValue;
|
|
11587
11631
|
if (newValue !== currentValue && !readOnly) {
|
|
@@ -11760,7 +11804,7 @@ var ErrorMessageContainer2 = import_styled_components62.default.span`
|
|
|
11760
11804
|
var RadioGroup_default = DxcRadioGroup;
|
|
11761
11805
|
|
|
11762
11806
|
// src/resultset-table/ResultsetTable.tsx
|
|
11763
|
-
var
|
|
11807
|
+
var import_react71 = require("react");
|
|
11764
11808
|
var import_styled_components63 = __toESM(require("styled-components"));
|
|
11765
11809
|
|
|
11766
11810
|
// src/resultset-table/Icons.tsx
|
|
@@ -11816,22 +11860,22 @@ var DxcResultsetTable = ({
|
|
|
11816
11860
|
tabIndex = 0,
|
|
11817
11861
|
mode = "default"
|
|
11818
11862
|
}) => {
|
|
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,
|
|
11863
|
+
const colorsTheme = (0, import_react71.useContext)(HalstackContext);
|
|
11864
|
+
const [page, changePage] = (0, import_react71.useState)(1);
|
|
11865
|
+
const [sortColumnIndex, changeSortColumnIndex] = (0, import_react71.useState)(-1);
|
|
11866
|
+
const [sortOrder, changeSortOrder] = (0, import_react71.useState)("ascending");
|
|
11867
|
+
const prevRowCountRef = (0, import_react71.useRef)(rows.length);
|
|
11868
|
+
const rowsWithIds = (0, import_react71.useMemo)(() => assignIdsToRows(rows), [rows]);
|
|
11869
|
+
const minItemsPerPageIndex = (0, import_react71.useMemo)(() => getMinItemsPerPageIndex2(page, itemsPerPage, page), [itemsPerPage, page]);
|
|
11870
|
+
const maxItemsPerPageIndex = (0, import_react71.useMemo)(
|
|
11827
11871
|
() => getMaxItemsPerPageIndex2(minItemsPerPageIndex, itemsPerPage, rows, page),
|
|
11828
11872
|
[itemsPerPage, minItemsPerPageIndex, page, rows]
|
|
11829
11873
|
);
|
|
11830
|
-
const sortedResultset = (0,
|
|
11874
|
+
const sortedResultset = (0, import_react71.useMemo)(
|
|
11831
11875
|
() => sortColumnIndex !== -1 ? sortArray(sortColumnIndex, sortOrder, rowsWithIds) : rowsWithIds,
|
|
11832
11876
|
[sortColumnIndex, sortOrder, rowsWithIds]
|
|
11833
11877
|
);
|
|
11834
|
-
const filteredResultset = (0,
|
|
11878
|
+
const filteredResultset = (0, import_react71.useMemo)(
|
|
11835
11879
|
() => sortedResultset && sortedResultset.slice(minItemsPerPageIndex, maxItemsPerPageIndex + 1),
|
|
11836
11880
|
[sortedResultset, minItemsPerPageIndex, maxItemsPerPageIndex]
|
|
11837
11881
|
);
|
|
@@ -11845,7 +11889,7 @@ var DxcResultsetTable = ({
|
|
|
11845
11889
|
sortColumnIndex === -1 || sortColumnIndex !== columnIndex ? "ascending" : sortOrder === "ascending" ? "descending" : "ascending"
|
|
11846
11890
|
);
|
|
11847
11891
|
};
|
|
11848
|
-
(0,
|
|
11892
|
+
(0, import_react71.useEffect)(() => {
|
|
11849
11893
|
if (!hidePaginator) {
|
|
11850
11894
|
if (rows.length === 0) {
|
|
11851
11895
|
changePage(0);
|
|
@@ -11944,7 +11988,7 @@ DxcResultsetTable.ActionsCell = DxcActionsCell;
|
|
|
11944
11988
|
var ResultsetTable_default = DxcResultsetTable;
|
|
11945
11989
|
|
|
11946
11990
|
// src/slider/Slider.tsx
|
|
11947
|
-
var
|
|
11991
|
+
var import_react72 = require("react");
|
|
11948
11992
|
var import_styled_components64 = __toESM(require("styled-components"));
|
|
11949
11993
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
11950
11994
|
var sizes6 = {
|
|
@@ -12115,7 +12159,7 @@ var TextInputContainer2 = import_styled_components64.default.div`
|
|
|
12115
12159
|
margin-left: ${(props) => props.theme.inputMarginLeft};
|
|
12116
12160
|
max-width: 70px;
|
|
12117
12161
|
`;
|
|
12118
|
-
var DxcSlider = (0,
|
|
12162
|
+
var DxcSlider = (0, import_react72.forwardRef)(
|
|
12119
12163
|
({
|
|
12120
12164
|
label = "",
|
|
12121
12165
|
name = "",
|
|
@@ -12136,20 +12180,20 @@ var DxcSlider = (0, import_react70.forwardRef)(
|
|
|
12136
12180
|
size = "fillParent",
|
|
12137
12181
|
ariaLabel = "Slider"
|
|
12138
12182
|
}, ref) => {
|
|
12139
|
-
const labelId = `label-${(0,
|
|
12140
|
-
const [innerValue, setInnerValue] = (0,
|
|
12141
|
-
const [dragging, setDragging] = (0,
|
|
12142
|
-
const colorsTheme = (0,
|
|
12183
|
+
const labelId = `label-${(0, import_react72.useId)()}`;
|
|
12184
|
+
const [innerValue, setInnerValue] = (0, import_react72.useState)(defaultValue ?? 0);
|
|
12185
|
+
const [dragging, setDragging] = (0, import_react72.useState)(false);
|
|
12186
|
+
const colorsTheme = (0, import_react72.useContext)(HalstackContext);
|
|
12143
12187
|
const isFirefox = navigator.userAgent.indexOf("Firefox") !== -1;
|
|
12144
|
-
const minLabel = (0,
|
|
12188
|
+
const minLabel = (0, import_react72.useMemo)(
|
|
12145
12189
|
() => labelFormatCallback ? labelFormatCallback(minValue) : minValue,
|
|
12146
12190
|
[labelFormatCallback, minValue]
|
|
12147
12191
|
);
|
|
12148
|
-
const maxLabel = (0,
|
|
12192
|
+
const maxLabel = (0, import_react72.useMemo)(
|
|
12149
12193
|
() => labelFormatCallback ? labelFormatCallback(maxValue) : maxValue,
|
|
12150
12194
|
[labelFormatCallback, maxValue]
|
|
12151
12195
|
);
|
|
12152
|
-
const tickMarks = (0,
|
|
12196
|
+
const tickMarks = (0, import_react72.useMemo)(() => {
|
|
12153
12197
|
const numberOfMarks = Math.floor(maxValue / step - minValue / step);
|
|
12154
12198
|
const range = maxValue - minValue;
|
|
12155
12199
|
const ticks = [];
|
|
@@ -12275,10 +12319,10 @@ var StatusLabel = import_styled_components65.default.span`
|
|
|
12275
12319
|
var StatusLight_default = DxcStatusLight;
|
|
12276
12320
|
|
|
12277
12321
|
// src/switch/Switch.tsx
|
|
12278
|
-
var
|
|
12322
|
+
var import_react73 = require("react");
|
|
12279
12323
|
var import_styled_components66 = __toESM(require("styled-components"));
|
|
12280
12324
|
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
12281
|
-
var DxcSwitch = (0,
|
|
12325
|
+
var DxcSwitch = (0, import_react73.forwardRef)(
|
|
12282
12326
|
({
|
|
12283
12327
|
defaultChecked = false,
|
|
12284
12328
|
checked,
|
|
@@ -12294,12 +12338,12 @@ var DxcSwitch = (0, import_react71.forwardRef)(
|
|
|
12294
12338
|
tabIndex = 0,
|
|
12295
12339
|
ariaLabel = "Switch"
|
|
12296
12340
|
}, ref) => {
|
|
12297
|
-
const switchId = `switch-${(0,
|
|
12341
|
+
const switchId = `switch-${(0, import_react73.useId)()}`;
|
|
12298
12342
|
const labelId = `label-${switchId}`;
|
|
12299
|
-
const [innerChecked, setInnerChecked] = (0,
|
|
12300
|
-
const colorsTheme = (0,
|
|
12301
|
-
const translatedLabels = (0,
|
|
12302
|
-
const refTrack = (0,
|
|
12343
|
+
const [innerChecked, setInnerChecked] = (0, import_react73.useState)(defaultChecked);
|
|
12344
|
+
const colorsTheme = (0, import_react73.useContext)(HalstackContext);
|
|
12345
|
+
const translatedLabels = (0, import_react73.useContext)(HalstackLanguageContext);
|
|
12346
|
+
const refTrack = (0, import_react73.useRef)(null);
|
|
12303
12347
|
const handleOnKeyDown = (event) => {
|
|
12304
12348
|
switch (event.key) {
|
|
12305
12349
|
case "Enter":
|
|
@@ -12517,18 +12561,18 @@ var SwitchTrack = import_styled_components66.default.span`
|
|
|
12517
12561
|
var Switch_default = DxcSwitch;
|
|
12518
12562
|
|
|
12519
12563
|
// src/tabs/Tabs.tsx
|
|
12520
|
-
var
|
|
12564
|
+
var import_react78 = require("react");
|
|
12521
12565
|
var import_styled_components70 = __toESM(require("styled-components"));
|
|
12522
12566
|
|
|
12523
12567
|
// src/tabs/TabsContext.tsx
|
|
12524
|
-
var
|
|
12525
|
-
var TabsContext_default = (0,
|
|
12568
|
+
var import_react74 = require("react");
|
|
12569
|
+
var TabsContext_default = (0, import_react74.createContext)(null);
|
|
12526
12570
|
|
|
12527
12571
|
// src/tabs/Tab.tsx
|
|
12528
|
-
var
|
|
12572
|
+
var import_react75 = require("react");
|
|
12529
12573
|
var import_styled_components67 = __toESM(require("styled-components"));
|
|
12530
12574
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
12531
|
-
var DxcTab2 = (0,
|
|
12575
|
+
var DxcTab2 = (0, import_react75.forwardRef)(
|
|
12532
12576
|
({
|
|
12533
12577
|
icon,
|
|
12534
12578
|
label,
|
|
@@ -12542,7 +12586,7 @@ var DxcTab2 = (0, import_react73.forwardRef)(
|
|
|
12542
12586
|
onHover = () => {
|
|
12543
12587
|
}
|
|
12544
12588
|
}, ref) => {
|
|
12545
|
-
const tabRef = (0,
|
|
12589
|
+
const tabRef = (0, import_react75.useRef)(null);
|
|
12546
12590
|
const {
|
|
12547
12591
|
iconPosition = "top",
|
|
12548
12592
|
tabIndex = 0,
|
|
@@ -12553,19 +12597,19 @@ var DxcTab2 = (0, import_react73.forwardRef)(
|
|
|
12553
12597
|
setActiveTab,
|
|
12554
12598
|
setActiveIndicatorWidth,
|
|
12555
12599
|
setActiveIndicatorLeft
|
|
12556
|
-
} = (0,
|
|
12557
|
-
(0,
|
|
12600
|
+
} = (0, import_react75.useContext)(TabsContext_default) ?? {};
|
|
12601
|
+
(0, import_react75.useEffect)(() => {
|
|
12558
12602
|
if (focusedTab === tabId) {
|
|
12559
12603
|
tabRef?.current?.focus();
|
|
12560
12604
|
}
|
|
12561
12605
|
}, [focusedTab, tabId]);
|
|
12562
|
-
(0,
|
|
12606
|
+
(0, import_react75.useEffect)(() => {
|
|
12563
12607
|
if (activeTab === tabId) {
|
|
12564
12608
|
setActiveIndicatorWidth?.(tabRef.current?.offsetWidth ?? 0);
|
|
12565
12609
|
setActiveIndicatorLeft?.(tabRef.current?.offsetLeft ?? 0);
|
|
12566
12610
|
}
|
|
12567
12611
|
}, [activeTab, tabId, setActiveIndicatorWidth, setActiveIndicatorLeft]);
|
|
12568
|
-
(0,
|
|
12612
|
+
(0, import_react75.useEffect)(() => {
|
|
12569
12613
|
if (active) {
|
|
12570
12614
|
setActiveTab?.(tabId ?? label ?? "");
|
|
12571
12615
|
}
|
|
@@ -12741,14 +12785,14 @@ var TabIconContainer2 = import_styled_components67.default.div`
|
|
|
12741
12785
|
var Tab_default2 = DxcTab2;
|
|
12742
12786
|
|
|
12743
12787
|
// src/tabs/TabsLegacy.tsx
|
|
12744
|
-
var
|
|
12788
|
+
var import_react77 = require("react");
|
|
12745
12789
|
var import_styled_components69 = __toESM(require("styled-components"));
|
|
12746
12790
|
|
|
12747
12791
|
// src/tabs/TabLegacy.tsx
|
|
12748
|
-
var
|
|
12792
|
+
var import_react76 = require("react");
|
|
12749
12793
|
var import_styled_components68 = __toESM(require("styled-components"));
|
|
12750
12794
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
12751
|
-
var Tab2 = (0,
|
|
12795
|
+
var Tab2 = (0, import_react76.forwardRef)(
|
|
12752
12796
|
({ active, tab, tabIndex, hasLabelAndIcon, iconPosition, onClick, onMouseEnter, onMouseLeave }, ref) => /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
12753
12797
|
TabContainer3,
|
|
12754
12798
|
{
|
|
@@ -12892,16 +12936,16 @@ var TabIconContainer3 = import_styled_components68.default.div`
|
|
|
12892
12936
|
width: 22px;
|
|
12893
12937
|
}
|
|
12894
12938
|
`;
|
|
12895
|
-
var TabLegacy_default = (0,
|
|
12939
|
+
var TabLegacy_default = (0, import_react76.memo)(Tab2);
|
|
12896
12940
|
|
|
12897
12941
|
// src/tabs/TabsLegacy.tsx
|
|
12898
12942
|
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
12899
12943
|
var useResize = (refTabList) => {
|
|
12900
|
-
const [viewWidth, setViewWidth] = (0,
|
|
12901
|
-
const handleWindowSizeChange = (0,
|
|
12944
|
+
const [viewWidth, setViewWidth] = (0, import_react77.useState)(0);
|
|
12945
|
+
const handleWindowSizeChange = (0, import_react77.useCallback)(() => {
|
|
12902
12946
|
setViewWidth(refTabList.current?.offsetWidth ?? 0);
|
|
12903
12947
|
}, [refTabList]);
|
|
12904
|
-
(0,
|
|
12948
|
+
(0, import_react77.useEffect)(() => {
|
|
12905
12949
|
handleWindowSizeChange();
|
|
12906
12950
|
window.addEventListener("resize", handleWindowSizeChange);
|
|
12907
12951
|
return () => {
|
|
@@ -12920,28 +12964,28 @@ var DxcTabs = ({
|
|
|
12920
12964
|
iconPosition = "top",
|
|
12921
12965
|
tabIndex = 0
|
|
12922
12966
|
}) => {
|
|
12923
|
-
const colorsTheme = (0,
|
|
12967
|
+
const colorsTheme = (0, import_react77.useContext)(HalstackContext);
|
|
12924
12968
|
const hasLabelAndIcon = tabs != null && tabs.filter((tab) => tab.label && tab.icon).length > 0;
|
|
12925
12969
|
const firstFocus = tabs != null ? tabs.findIndex((tab) => !tab.isDisabled) : null;
|
|
12926
|
-
const [innerActiveTabIndex, setInnerActiveTabIndex] = (0,
|
|
12970
|
+
const [innerActiveTabIndex, setInnerActiveTabIndex] = (0, import_react77.useState)(
|
|
12927
12971
|
tabs != null && defaultActiveTabIndex && !tabs[defaultActiveTabIndex]?.isDisabled ? defaultActiveTabIndex : firstFocus
|
|
12928
12972
|
);
|
|
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,
|
|
12973
|
+
const [activeIndicatorWidth, setActiveIndicatorWidth] = (0, import_react77.useState)(0);
|
|
12974
|
+
const [activeIndicatorLeft, setActiveIndicatorLeft] = (0, import_react77.useState)(0);
|
|
12975
|
+
const [translateScroll, setTranslateScroll] = (0, import_react77.useState)(0);
|
|
12976
|
+
const [scrollRightEnabled, setScrollRightEnabled] = (0, import_react77.useState)(true);
|
|
12977
|
+
const [scrollLeftEnabled, setScrollLeftEnabled] = (0, import_react77.useState)(false);
|
|
12978
|
+
const [countClick, setCountClick] = (0, import_react77.useState)(0);
|
|
12979
|
+
const [totalTabsWidth, setTotalTabsWidth] = (0, import_react77.useState)(0);
|
|
12980
|
+
const [currentFocusIndex, setCurrentFocusIndex] = (0, import_react77.useState)(activeTabIndex ?? innerActiveTabIndex);
|
|
12981
|
+
const [temporalFocusIndex, setTemporalFocusIndex] = (0, import_react77.useState)(activeTabIndex ?? innerActiveTabIndex);
|
|
12982
|
+
const [minHeightTabs, setMinHeightTabs] = (0, import_react77.useState)(0);
|
|
12983
|
+
const refTabs = (0, import_react77.useRef)([]);
|
|
12984
|
+
const refTabList = (0, import_react77.useRef)(null);
|
|
12941
12985
|
const viewWidth = useResize(refTabList);
|
|
12942
|
-
const translatedLabels = (0,
|
|
12943
|
-
const enabledIndicator = (0,
|
|
12944
|
-
(0,
|
|
12986
|
+
const translatedLabels = (0, import_react77.useContext)(HalstackLanguageContext);
|
|
12987
|
+
const enabledIndicator = (0, import_react77.useMemo)(() => viewWidth < totalTabsWidth, [viewWidth]);
|
|
12988
|
+
(0, import_react77.useEffect)(() => {
|
|
12945
12989
|
if (activeTabIndex != null || innerActiveTabIndex != null) {
|
|
12946
12990
|
const sumWidth = refTabs.current?.reduce((count, obj) => count + obj.offsetWidth, 0);
|
|
12947
12991
|
setTotalTabsWidth(sumWidth);
|
|
@@ -12949,10 +12993,10 @@ var DxcTabs = ({
|
|
|
12949
12993
|
setActiveIndicatorLeft(refTabs.current[activeTabIndex ?? innerActiveTabIndex]?.offsetLeft ?? 0);
|
|
12950
12994
|
}
|
|
12951
12995
|
}, [activeTabIndex, innerActiveTabIndex]);
|
|
12952
|
-
(0,
|
|
12996
|
+
(0, import_react77.useEffect)(() => {
|
|
12953
12997
|
setMinHeightTabs((refTabList.current?.offsetHeight ?? 0) + 1);
|
|
12954
12998
|
}, []);
|
|
12955
|
-
(0,
|
|
12999
|
+
(0, import_react77.useEffect)(() => {
|
|
12956
13000
|
if (activeTabIndex && activeTabIndex >= 0) {
|
|
12957
13001
|
setActiveIndicatorWidth(refTabs.current[activeTabIndex]?.offsetWidth ?? 0);
|
|
12958
13002
|
setActiveIndicatorLeft(refTabs.current[activeTabIndex]?.offsetLeft ?? 0);
|
|
@@ -13263,11 +13307,11 @@ var TabsLegacy_default = DxcTabs;
|
|
|
13263
13307
|
// src/tabs/Tabs.tsx
|
|
13264
13308
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
13265
13309
|
var useResize2 = (refTabList) => {
|
|
13266
|
-
const [viewWidth, setViewWidth] = (0,
|
|
13267
|
-
const handleWindowSizeChange = (0,
|
|
13310
|
+
const [viewWidth, setViewWidth] = (0, import_react78.useState)(0);
|
|
13311
|
+
const handleWindowSizeChange = (0, import_react78.useCallback)(() => {
|
|
13268
13312
|
setViewWidth(refTabList?.current?.offsetWidth ?? 0);
|
|
13269
13313
|
}, [refTabList]);
|
|
13270
|
-
(0,
|
|
13314
|
+
(0, import_react78.useEffect)(() => {
|
|
13271
13315
|
handleWindowSizeChange();
|
|
13272
13316
|
window.addEventListener("resize", handleWindowSizeChange);
|
|
13273
13317
|
return () => {
|
|
@@ -13301,51 +13345,50 @@ var DxcTabs2 = ({
|
|
|
13301
13345
|
tabIndex = 0,
|
|
13302
13346
|
children
|
|
13303
13347
|
}) => {
|
|
13304
|
-
const childrenArray = (0,
|
|
13305
|
-
() =>
|
|
13348
|
+
const childrenArray = (0, import_react78.useMemo)(
|
|
13349
|
+
() => import_react78.Children.toArray(children),
|
|
13306
13350
|
[children]
|
|
13307
13351
|
);
|
|
13308
|
-
const hasLabelAndIcon = (0,
|
|
13309
|
-
() => childrenArray.some((child) => (0,
|
|
13352
|
+
const hasLabelAndIcon = (0, import_react78.useMemo)(
|
|
13353
|
+
() => childrenArray.some((child) => (0, import_react78.isValidElement)(child) && child.props.icon && child.props.label),
|
|
13310
13354
|
[childrenArray]
|
|
13311
13355
|
);
|
|
13312
|
-
const [activeTab, setActiveTab] = (0,
|
|
13356
|
+
const [activeTab, setActiveTab] = (0, import_react78.useState)(() => {
|
|
13313
13357
|
const hasActiveChild = childrenArray.some(
|
|
13314
|
-
(child) => (0,
|
|
13358
|
+
(child) => (0, import_react78.isValidElement)(child) && (child.props.active || child.props.defaultActive) && !child.props.disabled
|
|
13315
13359
|
);
|
|
13316
13360
|
const initialActiveTab = hasActiveChild ? childrenArray.find(
|
|
13317
|
-
(child) => (0,
|
|
13318
|
-
) : childrenArray.find((child) => (0,
|
|
13319
|
-
return (0,
|
|
13361
|
+
(child) => (0, import_react78.isValidElement)(child) && (child.props.active || child.props.defaultActive) && !child.props.disabled
|
|
13362
|
+
) : childrenArray.find((child) => (0, import_react78.isValidElement)(child) && !child.props.disabled);
|
|
13363
|
+
return (0, import_react78.isValidElement)(initialActiveTab) ? initialActiveTab.props.label ?? initialActiveTab.props.tabId : "";
|
|
13320
13364
|
});
|
|
13321
|
-
const [innerFocusIndex, setInnerFocusIndex] = (0,
|
|
13322
|
-
const [activeIndicatorWidth, setActiveIndicatorWidth] = (0,
|
|
13323
|
-
const [activeIndicatorLeft, setActiveIndicatorLeft] = (0,
|
|
13324
|
-
const [
|
|
13325
|
-
const [
|
|
13326
|
-
const [
|
|
13327
|
-
const [
|
|
13328
|
-
const [
|
|
13329
|
-
const
|
|
13330
|
-
const
|
|
13331
|
-
const
|
|
13332
|
-
const colorsTheme = (0, import_react76.useContext)(HalstackContext);
|
|
13365
|
+
const [innerFocusIndex, setInnerFocusIndex] = (0, import_react78.useState)(null);
|
|
13366
|
+
const [activeIndicatorWidth, setActiveIndicatorWidth] = (0, import_react78.useState)(0);
|
|
13367
|
+
const [activeIndicatorLeft, setActiveIndicatorLeft] = (0, import_react78.useState)(0);
|
|
13368
|
+
const [totalTabsWidth, setTotalTabsWidth] = (0, import_react78.useState)(0);
|
|
13369
|
+
const [translateScroll, setTranslateScroll] = (0, import_react78.useState)(0);
|
|
13370
|
+
const [scrollRightEnabled, setScrollRightEnabled] = (0, import_react78.useState)(true);
|
|
13371
|
+
const [scrollLeftEnabled, setScrollLeftEnabled] = (0, import_react78.useState)(false);
|
|
13372
|
+
const [minHeightTabs, setMinHeightTabs] = (0, import_react78.useState)(0);
|
|
13373
|
+
const refTabList = (0, import_react78.useRef)(null);
|
|
13374
|
+
const refTabListContainer = (0, import_react78.useRef)(null);
|
|
13375
|
+
const colorsTheme = (0, import_react78.useContext)(HalstackContext);
|
|
13333
13376
|
const viewWidth = useResize2(refTabList);
|
|
13334
|
-
const translatedLabels = (0,
|
|
13335
|
-
const enabledIndicator = (0,
|
|
13336
|
-
(0,
|
|
13377
|
+
const translatedLabels = (0, import_react78.useContext)(HalstackLanguageContext);
|
|
13378
|
+
const enabledIndicator = (0, import_react78.useMemo)(() => viewWidth < totalTabsWidth, [viewWidth]);
|
|
13379
|
+
(0, import_react78.useEffect)(() => {
|
|
13337
13380
|
if (refTabList.current) {
|
|
13338
13381
|
setTotalTabsWidth(refTabList.current.firstElementChild?.offsetWidth);
|
|
13339
13382
|
setMinHeightTabs(refTabList.current.offsetHeight + 1);
|
|
13340
13383
|
}
|
|
13341
13384
|
}, []);
|
|
13342
|
-
const contextValue = (0,
|
|
13385
|
+
const contextValue = (0, import_react78.useMemo)(() => {
|
|
13343
13386
|
const focusedChild = innerFocusIndex != null ? childrenArray[innerFocusIndex] : null;
|
|
13344
13387
|
return {
|
|
13345
13388
|
iconPosition,
|
|
13346
13389
|
tabIndex,
|
|
13347
|
-
focusedTab: (0,
|
|
13348
|
-
isControlled: childrenArray.some((child) => (0,
|
|
13390
|
+
focusedTab: (0, import_react78.isValidElement)(focusedChild) ? focusedChild.props.label ?? focusedChild.props.tabId : "",
|
|
13391
|
+
isControlled: childrenArray.some((child) => (0, import_react78.isValidElement)(child) && typeof child.props.active !== "undefined"),
|
|
13349
13392
|
activeTab,
|
|
13350
13393
|
hasLabelAndIcon,
|
|
13351
13394
|
setActiveTab,
|
|
@@ -13406,7 +13449,7 @@ var DxcTabs2 = ({
|
|
|
13406
13449
|
scrollLimitCheck();
|
|
13407
13450
|
}, 0);
|
|
13408
13451
|
};
|
|
13409
|
-
(0,
|
|
13452
|
+
(0, import_react78.useEffect)(() => {
|
|
13410
13453
|
if (refTabList.current)
|
|
13411
13454
|
setTotalTabsWidth(() => {
|
|
13412
13455
|
let total = 0;
|
|
@@ -13418,8 +13461,10 @@ var DxcTabs2 = ({
|
|
|
13418
13461
|
});
|
|
13419
13462
|
return total;
|
|
13420
13463
|
});
|
|
13421
|
-
|
|
13422
|
-
|
|
13464
|
+
setTimeout(() => {
|
|
13465
|
+
scrollLimitCheck();
|
|
13466
|
+
}, 0);
|
|
13467
|
+
}, [viewWidth, totalTabsWidth, activeTab]);
|
|
13423
13468
|
return children ? /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_jsx_runtime78.Fragment, { children: [
|
|
13424
13469
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_styled_components70.ThemeProvider, { theme: colorsTheme.tabs, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(TabsContainer2, { margin, children: [
|
|
13425
13470
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Underline3, {}),
|
|
@@ -13444,7 +13489,7 @@ var DxcTabs2 = ({
|
|
|
13444
13489
|
tabWidth: activeIndicatorWidth,
|
|
13445
13490
|
tabLeft: activeIndicatorLeft,
|
|
13446
13491
|
"aria-disabled": childrenArray.some(
|
|
13447
|
-
(child) => (0,
|
|
13492
|
+
(child) => (0, import_react78.isValidElement)(child) && activeTab === (child.props.label ?? child.props.tabId) && child.props.disabled
|
|
13448
13493
|
)
|
|
13449
13494
|
}
|
|
13450
13495
|
)
|
|
@@ -13463,8 +13508,8 @@ var DxcTabs2 = ({
|
|
|
13463
13508
|
)
|
|
13464
13509
|
] })
|
|
13465
13510
|
] }) }),
|
|
13466
|
-
|
|
13467
|
-
if ((0,
|
|
13511
|
+
import_react78.Children.map(children, (child) => {
|
|
13512
|
+
if ((0, import_react78.isValidElement)(child) && (child.props.label ?? child.props.tabId) === activeTab) {
|
|
13468
13513
|
return child.props.children;
|
|
13469
13514
|
}
|
|
13470
13515
|
return null;
|
|
@@ -13588,7 +13633,7 @@ DxcTabs2.Tab = Tab_default2;
|
|
|
13588
13633
|
var Tabs_default = DxcTabs2;
|
|
13589
13634
|
|
|
13590
13635
|
// src/tag/Tag.tsx
|
|
13591
|
-
var
|
|
13636
|
+
var import_react79 = require("react");
|
|
13592
13637
|
var import_styled_components71 = __toESM(require("styled-components"));
|
|
13593
13638
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
13594
13639
|
var TagWrapper = ({ condition, wrapper, children }) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_jsx_runtime79.Fragment, { children: condition ? wrapper(children) : children });
|
|
@@ -13604,8 +13649,8 @@ var DxcTag = ({
|
|
|
13604
13649
|
size = "fitContent",
|
|
13605
13650
|
tabIndex = 0
|
|
13606
13651
|
}) => {
|
|
13607
|
-
const colorsTheme = (0,
|
|
13608
|
-
const [isHovered, changeIsHovered] = (0,
|
|
13652
|
+
const colorsTheme = (0, import_react79.useContext)(HalstackContext);
|
|
13653
|
+
const [isHovered, changeIsHovered] = (0, import_react79.useState)(false);
|
|
13609
13654
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_styled_components71.ThemeProvider, { theme: colorsTheme.tag, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
13610
13655
|
StyledDxcTag,
|
|
13611
13656
|
{
|
|
@@ -13716,11 +13761,11 @@ var TagLabel = import_styled_components71.default.div`
|
|
|
13716
13761
|
var Tag_default = DxcTag;
|
|
13717
13762
|
|
|
13718
13763
|
// src/textarea/Textarea.tsx
|
|
13719
|
-
var
|
|
13764
|
+
var import_react80 = require("react");
|
|
13720
13765
|
var import_styled_components72 = __toESM(require("styled-components"));
|
|
13721
13766
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
13722
13767
|
var patternMatch = (pattern, value) => new RegExp(pattern).test(value);
|
|
13723
|
-
var DxcTextarea = (0,
|
|
13768
|
+
var DxcTextarea = (0, import_react80.forwardRef)(
|
|
13724
13769
|
({
|
|
13725
13770
|
label,
|
|
13726
13771
|
name = "",
|
|
@@ -13745,12 +13790,12 @@ var DxcTextarea = (0, import_react78.forwardRef)(
|
|
|
13745
13790
|
tabIndex = 0,
|
|
13746
13791
|
ariaLabel = "Text area"
|
|
13747
13792
|
}, 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,
|
|
13793
|
+
const [innerValue, setInnerValue] = (0, import_react80.useState)(defaultValue);
|
|
13794
|
+
const textareaId = `textarea-${(0, import_react80.useId)()}`;
|
|
13795
|
+
const colorsTheme = (0, import_react80.useContext)(HalstackContext);
|
|
13796
|
+
const translatedLabels = (0, import_react80.useContext)(HalstackLanguageContext);
|
|
13797
|
+
const textareaRef = (0, import_react80.useRef)(null);
|
|
13798
|
+
const prevValueRef = (0, import_react80.useRef)(null);
|
|
13754
13799
|
const errorId = `error-${textareaId}`;
|
|
13755
13800
|
const isNotOptional = (value2) => value2 === "" && !optional;
|
|
13756
13801
|
const isLengthIncorrect2 = (value2) => value2 !== "" && minLength && maxLength && (value2.length < minLength || value2.length > maxLength);
|
|
@@ -13800,7 +13845,7 @@ var DxcTextarea = (0, import_react78.forwardRef)(
|
|
|
13800
13845
|
const handleOnChange = (event) => {
|
|
13801
13846
|
changeValue(event.target.value);
|
|
13802
13847
|
};
|
|
13803
|
-
(0,
|
|
13848
|
+
(0, import_react80.useEffect)(() => {
|
|
13804
13849
|
if (verticalGrow === "auto" && prevValueRef.current !== (value ?? innerValue) && textareaRef.current) {
|
|
13805
13850
|
const computedStyle = window.getComputedStyle(textareaRef.current);
|
|
13806
13851
|
const textareaLineHeight = parseInt(computedStyle.lineHeight || "0", 10);
|
|
@@ -13944,24 +13989,24 @@ var ErrorMessageContainer3 = import_styled_components72.default.span`
|
|
|
13944
13989
|
var Textarea_default = DxcTextarea;
|
|
13945
13990
|
|
|
13946
13991
|
// src/toast/ToastsQueue.tsx
|
|
13947
|
-
var
|
|
13992
|
+
var import_react84 = require("react");
|
|
13948
13993
|
var import_react_dom3 = require("react-dom");
|
|
13949
13994
|
var import_styled_components74 = __toESM(require("styled-components"));
|
|
13950
13995
|
|
|
13951
13996
|
// src/toast/Toast.tsx
|
|
13952
|
-
var
|
|
13997
|
+
var import_react82 = require("react");
|
|
13953
13998
|
var import_styled_components73 = __toESM(require("styled-components"));
|
|
13954
13999
|
|
|
13955
14000
|
// src/utils/useTimeout.tsx
|
|
13956
|
-
var
|
|
14001
|
+
var import_react81 = require("react");
|
|
13957
14002
|
function useTimeout(callback, delay) {
|
|
13958
|
-
const savedCallback = (0,
|
|
13959
|
-
const timerRef = (0,
|
|
13960
|
-
const clearTimerCallback = (0,
|
|
13961
|
-
(0,
|
|
14003
|
+
const savedCallback = (0, import_react81.useRef)();
|
|
14004
|
+
const timerRef = (0, import_react81.useRef)();
|
|
14005
|
+
const clearTimerCallback = (0, import_react81.useCallback)(() => clearTimeout(timerRef.current), []);
|
|
14006
|
+
(0, import_react81.useEffect)(() => {
|
|
13962
14007
|
savedCallback.current = callback;
|
|
13963
14008
|
}, [callback]);
|
|
13964
|
-
(0,
|
|
14009
|
+
(0, import_react81.useEffect)(() => {
|
|
13965
14010
|
function tick() {
|
|
13966
14011
|
savedCallback.current?.();
|
|
13967
14012
|
}
|
|
@@ -14065,7 +14110,7 @@ var spinnerTheme = {
|
|
|
14065
14110
|
accentColor: getSemantic("info").primaryColor
|
|
14066
14111
|
}
|
|
14067
14112
|
};
|
|
14068
|
-
var ToastIcon = (0,
|
|
14113
|
+
var ToastIcon = (0, import_react82.memo)(
|
|
14069
14114
|
({
|
|
14070
14115
|
icon,
|
|
14071
14116
|
hideSemanticIcon,
|
|
@@ -14088,8 +14133,8 @@ var DxcToast = ({
|
|
|
14088
14133
|
onClear,
|
|
14089
14134
|
semantic
|
|
14090
14135
|
}) => {
|
|
14091
|
-
const [isClosing, setIsClosing] = (0,
|
|
14092
|
-
const translatedLabels = (0,
|
|
14136
|
+
const [isClosing, setIsClosing] = (0, import_react82.useState)(false);
|
|
14137
|
+
const translatedLabels = (0, import_react82.useContext)(HalstackLanguageContext);
|
|
14093
14138
|
const clearClosingAnimationTimer = useTimeout(
|
|
14094
14139
|
() => {
|
|
14095
14140
|
setIsClosing(true);
|
|
@@ -14139,11 +14184,11 @@ var DxcToast = ({
|
|
|
14139
14184
|
] })
|
|
14140
14185
|
] });
|
|
14141
14186
|
};
|
|
14142
|
-
var Toast_default = (0,
|
|
14187
|
+
var Toast_default = (0, import_react82.memo)(DxcToast);
|
|
14143
14188
|
|
|
14144
14189
|
// src/toast/ToastContext.tsx
|
|
14145
|
-
var
|
|
14146
|
-
var ToastContext_default = (0,
|
|
14190
|
+
var import_react83 = require("react");
|
|
14191
|
+
var ToastContext_default = (0, import_react83.createContext)(null);
|
|
14147
14192
|
|
|
14148
14193
|
// src/toast/ToastsQueue.tsx
|
|
14149
14194
|
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
@@ -14174,24 +14219,26 @@ var generateUniqueToastId = (toasts) => {
|
|
|
14174
14219
|
return id;
|
|
14175
14220
|
};
|
|
14176
14221
|
var DxcToastsQueue = ({ children, duration = 3e3 }) => {
|
|
14177
|
-
const [toasts, setToasts] = (0,
|
|
14178
|
-
const [isMounted, setIsMounted] = (0,
|
|
14179
|
-
const adjustedDuration = (0,
|
|
14180
|
-
const
|
|
14181
|
-
|
|
14222
|
+
const [toasts, setToasts] = (0, import_react84.useState)([]);
|
|
14223
|
+
const [isMounted, setIsMounted] = (0, import_react84.useState)(false);
|
|
14224
|
+
const adjustedDuration = (0, import_react84.useMemo)(() => duration > 5e3 ? 5e3 : duration < 3e3 ? 3e3 : duration, [duration]);
|
|
14225
|
+
const id = (0, import_react84.useId)();
|
|
14226
|
+
const remove = (0, import_react84.useCallback)((id2) => {
|
|
14227
|
+
setToasts((prevToasts) => prevToasts.filter((toast) => toast.id !== id2));
|
|
14182
14228
|
}, []);
|
|
14183
|
-
const add = (0,
|
|
14229
|
+
const add = (0, import_react84.useCallback)(
|
|
14184
14230
|
(toast, semantic) => {
|
|
14185
|
-
const
|
|
14186
|
-
setToasts((prevToasts) => [...prevToasts, { id, semantic, ...toast }].slice(-5));
|
|
14187
|
-
return () => remove(
|
|
14231
|
+
const id2 = generateUniqueToastId(toasts);
|
|
14232
|
+
setToasts((prevToasts) => [...prevToasts, { id: id2, semantic, ...toast }].slice(-5));
|
|
14233
|
+
return () => remove(id2);
|
|
14188
14234
|
},
|
|
14189
14235
|
[duration]
|
|
14190
14236
|
);
|
|
14191
|
-
(0,
|
|
14237
|
+
(0, import_react84.useEffect)(() => {
|
|
14192
14238
|
setIsMounted(true);
|
|
14193
14239
|
}, []);
|
|
14194
14240
|
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(ToastContext_default.Provider, { value: add, children: [
|
|
14241
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { id: `toasts-${id}-portal`, style: { position: "absolute" } }),
|
|
14195
14242
|
isMounted && (0, import_react_dom3.createPortal)(
|
|
14196
14243
|
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(ToastsQueue, { children: toasts.map((t) => /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
14197
14244
|
Toast_default,
|
|
@@ -14204,7 +14251,7 @@ var DxcToastsQueue = ({ children, duration = 3e3 }) => {
|
|
|
14204
14251
|
},
|
|
14205
14252
|
t.id
|
|
14206
14253
|
)) }),
|
|
14207
|
-
document.body
|
|
14254
|
+
document.getElementById(`toasts-${id}-portal`) || document.body
|
|
14208
14255
|
),
|
|
14209
14256
|
children
|
|
14210
14257
|
] });
|
|
@@ -14212,7 +14259,7 @@ var DxcToastsQueue = ({ children, duration = 3e3 }) => {
|
|
|
14212
14259
|
var ToastsQueue_default = DxcToastsQueue;
|
|
14213
14260
|
|
|
14214
14261
|
// src/toggle-group/ToggleGroup.tsx
|
|
14215
|
-
var
|
|
14262
|
+
var import_react85 = require("react");
|
|
14216
14263
|
var import_styled_components75 = __toESM(require("styled-components"));
|
|
14217
14264
|
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
14218
14265
|
var DxcToggleGroup = ({
|
|
@@ -14227,9 +14274,9 @@ var DxcToggleGroup = ({
|
|
|
14227
14274
|
multiple = false,
|
|
14228
14275
|
tabIndex = 0
|
|
14229
14276
|
}) => {
|
|
14230
|
-
const toggleGroupLabelId = `label-toggle-group-${(0,
|
|
14231
|
-
const [selectedValue, setSelectedValue] = (0,
|
|
14232
|
-
const colorsTheme = (0,
|
|
14277
|
+
const toggleGroupLabelId = `label-toggle-group-${(0, import_react85.useId)()}`;
|
|
14278
|
+
const [selectedValue, setSelectedValue] = (0, import_react85.useState)(defaultValue ?? (multiple ? [] : -1));
|
|
14279
|
+
const colorsTheme = (0, import_react85.useContext)(HalstackContext);
|
|
14233
14280
|
const handleToggleChange = (selectedOption) => {
|
|
14234
14281
|
let newSelectedOptions = [];
|
|
14235
14282
|
if (value == null) {
|
|
@@ -14381,7 +14428,7 @@ var IconContainer7 = import_styled_components75.default.div`
|
|
|
14381
14428
|
var ToggleGroup_default = DxcToggleGroup;
|
|
14382
14429
|
|
|
14383
14430
|
// src/wizard/Wizard.tsx
|
|
14384
|
-
var
|
|
14431
|
+
var import_react86 = require("react");
|
|
14385
14432
|
var import_styled_components76 = __toESM(require("styled-components"));
|
|
14386
14433
|
|
|
14387
14434
|
// src/wizard/Icons.tsx
|
|
@@ -14555,9 +14602,9 @@ var DxcWizard = ({
|
|
|
14555
14602
|
margin,
|
|
14556
14603
|
tabIndex = 0
|
|
14557
14604
|
}) => {
|
|
14558
|
-
const colorsTheme = (0,
|
|
14559
|
-
const [innerCurrent, setInnerCurrentStep] = (0,
|
|
14560
|
-
const renderedCurrent = (0,
|
|
14605
|
+
const colorsTheme = (0, import_react86.useContext)(HalstackContext);
|
|
14606
|
+
const [innerCurrent, setInnerCurrentStep] = (0, import_react86.useState)(defaultCurrentStep);
|
|
14607
|
+
const renderedCurrent = (0, import_react86.useMemo)(() => currentStep ?? innerCurrent, [currentStep, innerCurrent]);
|
|
14561
14608
|
const handleStepClick = (newValue) => {
|
|
14562
14609
|
setInnerCurrentStep(newValue);
|
|
14563
14610
|
onStepClick?.(newValue);
|
|
@@ -14593,10 +14640,10 @@ var DxcWizard = ({
|
|
|
14593
14640
|
var Wizard_default = DxcWizard;
|
|
14594
14641
|
|
|
14595
14642
|
// src/toast/useToast.tsx
|
|
14596
|
-
var
|
|
14643
|
+
var import_react87 = require("react");
|
|
14597
14644
|
var useToast = () => {
|
|
14598
|
-
const add = (0,
|
|
14599
|
-
const toast = (0,
|
|
14645
|
+
const add = (0, import_react87.useContext)(ToastContext_default);
|
|
14646
|
+
const toast = (0, import_react87.useMemo)(
|
|
14600
14647
|
() => ({
|
|
14601
14648
|
default: (toast2) => add?.(toast2, "default"),
|
|
14602
14649
|
success: (toast2) => add?.(toast2, "success"),
|