@dxc-technology/halstack-react 15.1.2 → 15.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +47 -1
- package/dist/index.d.ts +47 -1
- package/dist/index.js +1329 -1261
- package/dist/index.mjs +1106 -1038
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -731,13 +731,13 @@ var componentTokens = {
|
|
|
731
731
|
logoHeight: "40px",
|
|
732
732
|
logoWidth: "auto",
|
|
733
733
|
menuBackgroundColor: coreTokens_default.color_white,
|
|
734
|
-
menuZindex: "
|
|
734
|
+
menuZindex: "210",
|
|
735
735
|
menuTabletWidth: "60vw",
|
|
736
736
|
menuMobileWidth: "100vw",
|
|
737
737
|
minHeight: "64px",
|
|
738
738
|
overlayColor: coreTokens_default.color_grey_800_a,
|
|
739
739
|
overlayOpacity: "0.7",
|
|
740
|
-
overlayZindex: "
|
|
740
|
+
overlayZindex: "200",
|
|
741
741
|
paddingTop: coreTokens_default.spacing_0,
|
|
742
742
|
paddingBottom: coreTokens_default.spacing_0,
|
|
743
743
|
paddingRight: coreTokens_default.spacing_24,
|
|
@@ -1557,7 +1557,11 @@ var defaultTranslatedComponentLabels = {
|
|
|
1557
1557
|
itemsPerPageText: "Items per page: ",
|
|
1558
1558
|
minToMaxOfText: (minNumberOfItems, maxNumberOfItems, totalItems) => `${minNumberOfItems} to ${maxNumberOfItems} of ${totalItems}`,
|
|
1559
1559
|
goToPageText: "Go to page:",
|
|
1560
|
-
pageOfText: (pageNumber, totalPagesNumber) => `Page: ${pageNumber} of ${totalPagesNumber}
|
|
1560
|
+
pageOfText: (pageNumber, totalPagesNumber) => `Page: ${pageNumber} of ${totalPagesNumber}`,
|
|
1561
|
+
firstResultsTitle: "First results",
|
|
1562
|
+
previousResultsTitle: "Previous results",
|
|
1563
|
+
nextResultsTitle: "Next results",
|
|
1564
|
+
lastResultsTitle: "Last results"
|
|
1561
1565
|
},
|
|
1562
1566
|
passwordInput: {
|
|
1563
1567
|
inputShowPasswordTitle: "Show password",
|
|
@@ -2369,7 +2373,7 @@ var TooltipTriggerContainer = styled6.div`
|
|
|
2369
2373
|
display: inline-flex;
|
|
2370
2374
|
`;
|
|
2371
2375
|
var StyledTooltipContent = styled6(Content)`
|
|
2372
|
-
z-index:
|
|
2376
|
+
z-index: 600;
|
|
2373
2377
|
|
|
2374
2378
|
animation-duration: 0.2s;
|
|
2375
2379
|
animation-timing-function: ease-out;
|
|
@@ -3100,7 +3104,7 @@ var Modal = styled10.div`
|
|
|
3100
3104
|
align-items: center;
|
|
3101
3105
|
justify-content: center;
|
|
3102
3106
|
height: 100%;
|
|
3103
|
-
z-index:
|
|
3107
|
+
z-index: 430;
|
|
3104
3108
|
`;
|
|
3105
3109
|
var Overlay = styled10.div`
|
|
3106
3110
|
position: fixed;
|
|
@@ -3113,7 +3117,6 @@ var ModalAlertContainer = styled10.div`
|
|
|
3113
3117
|
box-sizing: border-box;
|
|
3114
3118
|
max-width: 80%;
|
|
3115
3119
|
min-width: 696px;
|
|
3116
|
-
z-index: 2147483647;
|
|
3117
3120
|
|
|
3118
3121
|
@media (max-width: ${responsiveSizes.medium}rem) {
|
|
3119
3122
|
max-width: 92%;
|
|
@@ -4052,7 +4055,7 @@ var DxcDropdown = ({
|
|
|
4052
4055
|
visualFocusIndex,
|
|
4053
4056
|
menuItemOnClick: handleMenuItemOnClick,
|
|
4054
4057
|
onKeyDown: handleMenuOnKeyDown,
|
|
4055
|
-
styles: { width, zIndex: "
|
|
4058
|
+
styles: { width, zIndex: "310" },
|
|
4056
4059
|
ref: menuRef
|
|
4057
4060
|
}
|
|
4058
4061
|
) }) })
|
|
@@ -4797,7 +4800,7 @@ var HeaderContainer2 = styled19.div`
|
|
|
4797
4800
|
top: 0;
|
|
4798
4801
|
left: 0;
|
|
4799
4802
|
right: 0;
|
|
4800
|
-
z-index:
|
|
4803
|
+
z-index: 100;
|
|
4801
4804
|
`;
|
|
4802
4805
|
var VisibilityToggle = styled19.div`
|
|
4803
4806
|
position: fixed;
|
|
@@ -4811,7 +4814,7 @@ var VisibilityToggle = styled19.div`
|
|
|
4811
4814
|
width: 100%;
|
|
4812
4815
|
background-color: #f2f2f2;
|
|
4813
4816
|
user-select: none;
|
|
4814
|
-
z-index:
|
|
4817
|
+
z-index: 1;
|
|
4815
4818
|
`;
|
|
4816
4819
|
var HamburgerTrigger2 = styled19.button`
|
|
4817
4820
|
display: flex;
|
|
@@ -4852,7 +4855,7 @@ var SidenavContainer2 = styled19.div`
|
|
|
4852
4855
|
top: 64px;
|
|
4853
4856
|
display: flex;
|
|
4854
4857
|
height: calc(100vh - 64px);
|
|
4855
|
-
z-index:
|
|
4858
|
+
z-index: 110;
|
|
4856
4859
|
|
|
4857
4860
|
@media (max-width: ${responsiveSizes.large}rem) {
|
|
4858
4861
|
position: absolute;
|
|
@@ -6040,14 +6043,223 @@ function DxcContextualMenu({ items }) {
|
|
|
6040
6043
|
}
|
|
6041
6044
|
|
|
6042
6045
|
// src/data-grid/DataGrid.tsx
|
|
6043
|
-
import { useContext as
|
|
6046
|
+
import { useContext as useContext25, useEffect as useEffect8, useMemo as useMemo11, useState as useState18 } from "react";
|
|
6044
6047
|
import DataGrid from "react-data-grid";
|
|
6045
|
-
import
|
|
6048
|
+
import styled38, { ThemeProvider as ThemeProvider18 } from "styled-components";
|
|
6046
6049
|
import "react-data-grid/lib/styles.css";
|
|
6047
6050
|
|
|
6048
6051
|
// src/data-grid/utils.tsx
|
|
6052
|
+
import { useState as useState15 } from "react";
|
|
6049
6053
|
import { textEditor } from "react-data-grid";
|
|
6054
|
+
|
|
6055
|
+
// src/spinner/Spinner.tsx
|
|
6056
|
+
import { useContext as useContext20, useId as useId7, useMemo as useMemo9 } from "react";
|
|
6057
|
+
import styled32, { ThemeProvider as ThemeProvider14 } from "styled-components";
|
|
6050
6058
|
import { jsx as jsx38, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6059
|
+
var DxcSpinner = ({
|
|
6060
|
+
label,
|
|
6061
|
+
value,
|
|
6062
|
+
showValue = false,
|
|
6063
|
+
mode = "large",
|
|
6064
|
+
margin,
|
|
6065
|
+
ariaLabel = "Spinner"
|
|
6066
|
+
}) => {
|
|
6067
|
+
const labelId = useId7();
|
|
6068
|
+
const colorsTheme = useContext20(HalstackContext);
|
|
6069
|
+
const determinated = useMemo9(() => value != null && value >= 0 && value <= 100, [value]);
|
|
6070
|
+
return /* @__PURE__ */ jsx38(ThemeProvider14, { theme: colorsTheme.spinner, children: /* @__PURE__ */ jsx38(DXCSpinner, { margin, mode, children: /* @__PURE__ */ jsxs24(SpinnerContainer, { mode, children: [
|
|
6071
|
+
mode === "overlay" && /* @__PURE__ */ jsx38(BackOverlay, {}),
|
|
6072
|
+
/* @__PURE__ */ jsx38(BackgroundSpinner, { children: mode === "small" ? /* @__PURE__ */ jsx38(SVGBackground, { viewBox: "0 0 16 16", children: /* @__PURE__ */ jsx38(CircleBackground, { cx: "8", cy: "8", r: "6", mode }) }) : /* @__PURE__ */ jsx38(SVGBackground, { viewBox: "0 0 140 140", children: /* @__PURE__ */ jsx38(CircleBackground, { cx: "70", cy: "70", r: "65", mode }) }) }),
|
|
6073
|
+
/* @__PURE__ */ jsx38(
|
|
6074
|
+
Spinner,
|
|
6075
|
+
{
|
|
6076
|
+
role: "progressbar",
|
|
6077
|
+
"aria-valuenow": determinated && showValue ? value : void 0,
|
|
6078
|
+
"aria-valuemin": determinated ? 0 : void 0,
|
|
6079
|
+
"aria-valuemax": determinated ? 100 : void 0,
|
|
6080
|
+
"aria-labelledby": label && mode !== "small" ? labelId : void 0,
|
|
6081
|
+
"aria-label": !label ? ariaLabel : mode === "small" ? ariaLabel : void 0,
|
|
6082
|
+
children: mode === "small" ? /* @__PURE__ */ jsx38(SVGSpinner, { viewBox: "0 0 16 16", determinated, children: /* @__PURE__ */ jsx38(CircleSpinner, { cx: "8", cy: "8", r: "6", mode, determinated, value }) }) : /* @__PURE__ */ jsx38(SVGSpinner, { viewBox: "0 0 140 140", determinated, children: /* @__PURE__ */ jsx38(CircleSpinner, { cx: "70", cy: "70", r: "65", mode, determinated, value }) })
|
|
6083
|
+
}
|
|
6084
|
+
),
|
|
6085
|
+
mode !== "small" && /* @__PURE__ */ jsxs24(LabelsContainer2, { children: [
|
|
6086
|
+
label && /* @__PURE__ */ jsx38(SpinnerLabel, { id: labelId, mode, children: label }),
|
|
6087
|
+
(value || value === 0) && showValue && /* @__PURE__ */ jsxs24(SpinnerProgress, { value, mode, showValue, children: [
|
|
6088
|
+
value,
|
|
6089
|
+
"%"
|
|
6090
|
+
] })
|
|
6091
|
+
] })
|
|
6092
|
+
] }) }) });
|
|
6093
|
+
};
|
|
6094
|
+
var determinateValue = (value, strokeDashArray) => {
|
|
6095
|
+
let val = 0;
|
|
6096
|
+
if (value != null && value >= 0 && value <= 100) {
|
|
6097
|
+
val = strokeDashArray * (1 - value / 100);
|
|
6098
|
+
}
|
|
6099
|
+
return val;
|
|
6100
|
+
};
|
|
6101
|
+
var DXCSpinner = styled32.div`
|
|
6102
|
+
height: ${(props) => props.mode === "overlay" ? "100vh" : ""};
|
|
6103
|
+
width: ${(props) => props.mode === "overlay" ? "100vw" : ""};
|
|
6104
|
+
display: ${(props) => props.mode === "overlay" ? "flex" : ""};
|
|
6105
|
+
position: ${(props) => props.mode === "overlay" ? "fixed" : ""};
|
|
6106
|
+
top: ${(props) => props.mode === "overlay" ? 0 : ""};
|
|
6107
|
+
left: ${(props) => props.mode === "overlay" ? 0 : ""};
|
|
6108
|
+
justify-content: ${(props) => props.mode === "overlay" ? "center" : ""};
|
|
6109
|
+
align-items: ${(props) => props.mode === "overlay" ? "center" : ""};
|
|
6110
|
+
z-index: ${(props) => props.mode === "overlay" ? 400 : ""};
|
|
6111
|
+
|
|
6112
|
+
margin: ${(props) => props.mode !== "overlay" ? props.margin && typeof props.margin !== "object" ? spaces[props.margin] : "0px" : ""};
|
|
6113
|
+
margin-top: ${(props) => props.mode !== "overlay" ? props.margin && typeof props.margin === "object" && props.margin.top ? spaces[props.margin.top] : "" : ""};
|
|
6114
|
+
margin-right: ${(props) => props.mode !== "overlay" ? props.margin && typeof props.margin === "object" && props.margin.right ? spaces[props.margin.right] : "" : ""};
|
|
6115
|
+
margin-bottom: ${(props) => props.mode !== "overlay" ? props.margin && typeof props.margin === "object" && props.margin.bottom ? spaces[props.margin.bottom] : "" : ""};
|
|
6116
|
+
margin-left: ${(props) => props.mode !== "overlay" ? props.margin && typeof props.margin === "object" && props.margin.left ? spaces[props.margin.left] : "" : ""};
|
|
6117
|
+
`;
|
|
6118
|
+
var SpinnerContainer = styled32.div`
|
|
6119
|
+
align-items: center;
|
|
6120
|
+
display: flex;
|
|
6121
|
+
height: ${(props) => props.mode === "small" ? "16px" : "140px"};
|
|
6122
|
+
width: ${(props) => props.mode === "small" ? "16px" : "140px"};
|
|
6123
|
+
justify-content: center;
|
|
6124
|
+
position: relative;
|
|
6125
|
+
background-color: transparent;
|
|
6126
|
+
|
|
6127
|
+
@keyframes spinner-svg {
|
|
6128
|
+
0% {
|
|
6129
|
+
transform: rotateZ(0deg);
|
|
6130
|
+
}
|
|
6131
|
+
100% {
|
|
6132
|
+
transform: rotateZ(360deg);
|
|
6133
|
+
}
|
|
6134
|
+
}
|
|
6135
|
+
@keyframes svg-circle-large {
|
|
6136
|
+
0% {
|
|
6137
|
+
stroke-dashoffset: 400;
|
|
6138
|
+
transform: rotate(0);
|
|
6139
|
+
}
|
|
6140
|
+
|
|
6141
|
+
50% {
|
|
6142
|
+
stroke-dashoffset: 75;
|
|
6143
|
+
transform: rotate(45deg);
|
|
6144
|
+
}
|
|
6145
|
+
|
|
6146
|
+
100% {
|
|
6147
|
+
stroke-dashoffset: 400;
|
|
6148
|
+
transform: rotate(360deg);
|
|
6149
|
+
}
|
|
6150
|
+
}
|
|
6151
|
+
@keyframes svg-circle-small {
|
|
6152
|
+
0% {
|
|
6153
|
+
stroke-dashoffset: 35;
|
|
6154
|
+
transform: rotate(0);
|
|
6155
|
+
}
|
|
6156
|
+
|
|
6157
|
+
50% {
|
|
6158
|
+
stroke-dashoffset: 8;
|
|
6159
|
+
transform: rotate(45deg);
|
|
6160
|
+
}
|
|
6161
|
+
|
|
6162
|
+
100% {
|
|
6163
|
+
stroke-dashoffset: 35;
|
|
6164
|
+
transform: rotate(360deg);
|
|
6165
|
+
}
|
|
6166
|
+
}
|
|
6167
|
+
`;
|
|
6168
|
+
var BackOverlay = styled32.div`
|
|
6169
|
+
width: 100vw;
|
|
6170
|
+
height: 100vh;
|
|
6171
|
+
opacity: 1;
|
|
6172
|
+
transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
6173
|
+
position: fixed;
|
|
6174
|
+
top: 0;
|
|
6175
|
+
left: 0;
|
|
6176
|
+
background-color: ${(props) => `${props.theme.overlayBackgroundColor}`};
|
|
6177
|
+
opacity: ${(props) => `${props.theme.overlayOpacity}`};
|
|
6178
|
+
`;
|
|
6179
|
+
var BackgroundSpinner = styled32.div`
|
|
6180
|
+
height: inherit;
|
|
6181
|
+
width: inherit;
|
|
6182
|
+
position: absolute;
|
|
6183
|
+
`;
|
|
6184
|
+
var SVGBackground = styled32.svg`
|
|
6185
|
+
height: inherit;
|
|
6186
|
+
width: inherit;
|
|
6187
|
+
`;
|
|
6188
|
+
var CircleBackground = styled32.circle`
|
|
6189
|
+
animation: none;
|
|
6190
|
+
fill: transparent;
|
|
6191
|
+
stroke: ${(props) => `${props.theme.totalCircleColor}`};
|
|
6192
|
+
stroke-dasharray: ${(props) => props.mode !== "small" ? "409" : "38"};
|
|
6193
|
+
stroke-linecap: initial;
|
|
6194
|
+
stroke-width: ${(props) => props.mode !== "small" ? "8.5px" : "2px"};
|
|
6195
|
+
transform-origin: 50% 50%;
|
|
6196
|
+
vector-effect: non-scaling-stroke;
|
|
6197
|
+
`;
|
|
6198
|
+
var Spinner = styled32.div`
|
|
6199
|
+
height: inherit;
|
|
6200
|
+
width: inherit;
|
|
6201
|
+
position: relative;
|
|
6202
|
+
`;
|
|
6203
|
+
var SVGSpinner = styled32.svg`
|
|
6204
|
+
height: inherit;
|
|
6205
|
+
width: inherit;
|
|
6206
|
+
transform: rotate(-90deg);
|
|
6207
|
+
top: 0;
|
|
6208
|
+
left: 0;
|
|
6209
|
+
transform-origin: center;
|
|
6210
|
+
overflow: visible;
|
|
6211
|
+
animation: ${(props) => !props.determinated ? "1.4s linear infinite both spinner-svg" : ""};
|
|
6212
|
+
`;
|
|
6213
|
+
var CircleSpinner = styled32.circle`
|
|
6214
|
+
fill: transparent;
|
|
6215
|
+
stroke-linecap: initial;
|
|
6216
|
+
vector-effect: non-scaling-stroke;
|
|
6217
|
+
animation: ${(props) => props.determinated ? "none" : props.mode !== "small" ? "1.4s ease-in-out infinite both svg-circle-large" : "1.4s ease-in-out infinite both svg-circle-small"};
|
|
6218
|
+
stroke: ${(props) => props.mode === "overlay" ? props.theme.trackCircleColorOverlay : props.theme.trackCircleColor};
|
|
6219
|
+
transform-origin: ${(props) => !props.determinated ? "50% 50%" : ""};
|
|
6220
|
+
stroke-dasharray: ${(props) => props.mode !== "small" ? "409" : "38"};
|
|
6221
|
+
stroke-width: ${(props) => props.mode !== "small" ? "8.5px" : "2px"};
|
|
6222
|
+
stroke-dashoffset: ${(props) => props.determinated ? props.mode !== "small" ? determinateValue(props.value, 409) : determinateValue(props.value, 38) : ""};
|
|
6223
|
+
`;
|
|
6224
|
+
var LabelsContainer2 = styled32.div`
|
|
6225
|
+
position: absolute;
|
|
6226
|
+
margin: 0 auto;
|
|
6227
|
+
width: 110px;
|
|
6228
|
+
text-align: center;
|
|
6229
|
+
`;
|
|
6230
|
+
var SpinnerLabel = styled32.p`
|
|
6231
|
+
margin: 0;
|
|
6232
|
+
width: 100%;
|
|
6233
|
+
white-space: nowrap;
|
|
6234
|
+
overflow: hidden;
|
|
6235
|
+
text-overflow: ellipsis;
|
|
6236
|
+
font-family: ${(props) => props.mode === "overlay" ? props.theme.overlayLabelFontFamily : props.theme.labelFontFamily};
|
|
6237
|
+
font-weight: ${(props) => props.mode === "overlay" ? props.theme.overlayLabelFontWeight : props.theme.labelFontWeight};
|
|
6238
|
+
font-size: ${(props) => props.mode === "overlay" ? props.theme.overlayLabelFontSize : props.theme.labelFontSize};
|
|
6239
|
+
font-style: ${(props) => props.mode === "overlay" ? props.theme.overlayLabelFontStyle : props.theme.labelFontStyle};
|
|
6240
|
+
color: ${(props) => props.mode === "overlay" ? props.theme.overlayLabelFontColor : props.theme.labelFontColor};
|
|
6241
|
+
text-align: ${(props) => props.mode === "overlay" ? props.theme.overlayLabelTextAlign : props.theme.labelTextAlign};
|
|
6242
|
+
letter-spacing: ${(props) => props.mode === "overlay" ? props.theme.overlayLabelLetterSpacing : props.theme.labelLetterSpacing};
|
|
6243
|
+
`;
|
|
6244
|
+
var SpinnerProgress = styled32.p`
|
|
6245
|
+
margin: 0;
|
|
6246
|
+
width: 100%;
|
|
6247
|
+
white-space: nowrap;
|
|
6248
|
+
overflow: hidden;
|
|
6249
|
+
text-overflow: ellipsis;
|
|
6250
|
+
display: ${(props) => props.value && props.showValue === true && "block" || "none"};
|
|
6251
|
+
font-family: ${(props) => props.mode === "overlay" ? props.theme.overlayProgressValueFontFamily : props.theme.progressValueFontFamily};
|
|
6252
|
+
font-weight: ${(props) => props.mode === "overlay" ? props.theme.overlayProgressValueFontWeight : props.theme.progressValueFontWeight};
|
|
6253
|
+
font-size: ${(props) => props.mode === "overlay" ? props.theme.overlayProgressValueFontSize : props.theme.progressValueFontSize};
|
|
6254
|
+
font-style: ${(props) => props.mode === "overlay" ? props.theme.overlayProgressValueFontStyle : props.theme.progressValueFontStyle};
|
|
6255
|
+
color: ${(props) => props.mode === "overlay" ? props.theme.overlayProgressValueFontColor : props.theme.progressValueFontColor};
|
|
6256
|
+
text-align: ${(props) => props.mode === "overlay" ? props.theme.overlayProgressValueTextAlign : props.theme.progressValueTextAlign};
|
|
6257
|
+
letter-spacing: ${(props) => props.mode === "overlay" ? props.theme.overlayProgressValueLetterSpacing : props.theme.progressValueLetterSpacing};
|
|
6258
|
+
`;
|
|
6259
|
+
var Spinner_default = DxcSpinner;
|
|
6260
|
+
|
|
6261
|
+
// src/data-grid/utils.tsx
|
|
6262
|
+
import { jsx as jsx39, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
6051
6263
|
var overwriteTheme = (theme) => {
|
|
6052
6264
|
const newTheme = {
|
|
6053
6265
|
checkbox: {
|
|
@@ -6070,11 +6282,27 @@ var convertToRDGColumns = (gridColumn, summaryRow) => ({
|
|
|
6070
6282
|
editable: gridColumn.textEditable,
|
|
6071
6283
|
headerCellClass: gridColumn.alignment ? `header-align-${gridColumn.alignment}` : `header-align-left`,
|
|
6072
6284
|
renderEditCell: gridColumn.textEditable ? textEditor : void 0,
|
|
6073
|
-
renderCell: ({ row }) => /* @__PURE__ */
|
|
6074
|
-
renderSummaryCell: () => gridColumn.summaryKey ? /* @__PURE__ */
|
|
6285
|
+
renderCell: ({ row }) => /* @__PURE__ */ jsx39("div", { className: `ellipsis-cell ${gridColumn.alignment ? `align-${gridColumn.alignment}` : "align-left"}`, children: row[gridColumn.key] }),
|
|
6286
|
+
renderSummaryCell: () => gridColumn.summaryKey ? /* @__PURE__ */ jsx39("div", { className: `ellipsis-cell ${gridColumn.alignment ? `align-${gridColumn.alignment}` : "align-left"}`, children: summaryRow?.[gridColumn.summaryKey] }) : void 0
|
|
6075
6287
|
});
|
|
6076
|
-
var renderSortStatus = ({ sortDirection }) => /* @__PURE__ */
|
|
6077
|
-
var
|
|
6288
|
+
var renderSortStatus = ({ sortDirection }) => /* @__PURE__ */ jsx39("div", { className: "sortIconContainer", children: sortDirection !== void 0 ? sortDirection === "ASC" ? /* @__PURE__ */ jsx39(Icon_default, { icon: "Keyboard_Arrow_Up" }) : /* @__PURE__ */ jsx39(Icon_default, { icon: "Keyboard_Arrow_Down" }) : /* @__PURE__ */ jsx39(Icon_default, { icon: "Expand_All" }) });
|
|
6289
|
+
var expandRow = (row, rows, uniqueRowId) => {
|
|
6290
|
+
const rowIndex = rows.findIndex((r) => r === row);
|
|
6291
|
+
addRow(rows, rowIndex + 1, {
|
|
6292
|
+
isExpandedChildContent: true,
|
|
6293
|
+
[uniqueRowId]: `${rowKeyGetter(row, uniqueRowId)}_expanded`,
|
|
6294
|
+
expandedChildContent: row.expandedContent,
|
|
6295
|
+
triggerRowKey: rowKeyGetter(row, uniqueRowId),
|
|
6296
|
+
expandedContentHeight: row.expandedContentHeight
|
|
6297
|
+
});
|
|
6298
|
+
};
|
|
6299
|
+
var collapseRow = (row, rows) => {
|
|
6300
|
+
const rowIndex = rows.findIndex((r) => r === row);
|
|
6301
|
+
const newRows = [...rows];
|
|
6302
|
+
deleteRow(newRows, rowIndex + 1);
|
|
6303
|
+
return newRows;
|
|
6304
|
+
};
|
|
6305
|
+
var renderExpandableTrigger = (row, rows, uniqueRowId, setRowsToRender) => /* @__PURE__ */ jsx39(
|
|
6078
6306
|
ActionIcon_default,
|
|
6079
6307
|
{
|
|
6080
6308
|
icon: row.contentIsExpanded ? "arrow_drop_down" : "arrow_right",
|
|
@@ -6083,50 +6311,63 @@ var renderExpandableTrigger = (row, rows, uniqueRowId, setRowsToRender) => /* @_
|
|
|
6083
6311
|
onClick: () => {
|
|
6084
6312
|
row.contentIsExpanded = !row.contentIsExpanded;
|
|
6085
6313
|
if (row.contentIsExpanded) {
|
|
6086
|
-
const rowIndex = rows.findIndex((rowToRender) => row === rowToRender);
|
|
6087
6314
|
setRowsToRender((currentRows) => {
|
|
6088
|
-
const
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
[uniqueRowId]: `${rowKeyGetter(row, uniqueRowId)}_expanded`,
|
|
6092
|
-
expandedChildContent: row.expandedContent,
|
|
6093
|
-
triggerRowKey: rowKeyGetter(row, uniqueRowId),
|
|
6094
|
-
expandedContentHeight: row.expandedContentHeight
|
|
6095
|
-
});
|
|
6096
|
-
return newRows;
|
|
6315
|
+
const finalRows = [...currentRows];
|
|
6316
|
+
expandRow(row, finalRows, uniqueRowId);
|
|
6317
|
+
return finalRows;
|
|
6097
6318
|
});
|
|
6098
6319
|
} else {
|
|
6099
|
-
|
|
6100
|
-
setRowsToRender((currentRows) => {
|
|
6101
|
-
const newRows = [...currentRows];
|
|
6102
|
-
deleteRow(newRows, rowIndex + 1);
|
|
6103
|
-
return newRows;
|
|
6104
|
-
});
|
|
6320
|
+
setRowsToRender((currentRows) => collapseRow(row, [...currentRows]));
|
|
6105
6321
|
}
|
|
6106
6322
|
},
|
|
6107
6323
|
disabled: !rows.some((row2) => uniqueRowId in row2)
|
|
6108
6324
|
}
|
|
6109
6325
|
);
|
|
6110
|
-
var renderHierarchyTrigger = (rows, triggerRow, uniqueRowId, columnKey, setRowsToRender) =>
|
|
6111
|
-
|
|
6112
|
-
{
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6326
|
+
var renderHierarchyTrigger = (rows, triggerRow, uniqueRowId, columnKey, setRowsToRender, childrenTrigger) => {
|
|
6327
|
+
const [loading, setLoading] = useState15(false);
|
|
6328
|
+
const onClick = async () => {
|
|
6329
|
+
if (loading) return;
|
|
6330
|
+
if (!triggerRow.visibleChildren) {
|
|
6331
|
+
if (childrenTrigger) {
|
|
6332
|
+
setLoading(true);
|
|
6333
|
+
triggerRow.loadingChildren = true;
|
|
6334
|
+
try {
|
|
6335
|
+
const dynamicChildren = await childrenTrigger(true, triggerRow);
|
|
6336
|
+
triggerRow.childRows = dynamicChildren;
|
|
6337
|
+
setRowsToRender((currentRows) => {
|
|
6338
|
+
const newRowsToRender = [...currentRows];
|
|
6339
|
+
if (newRowsToRender.some((row) => rowKeyGetter(row, uniqueRowId) === triggerRow[uniqueRowId])) {
|
|
6340
|
+
const rowIndex = currentRows.findIndex((row) => triggerRow === row);
|
|
6341
|
+
dynamicChildren.forEach((childRow, index) => {
|
|
6342
|
+
childRow.rowLevel = triggerRow.rowLevel && typeof triggerRow.rowLevel === "number" ? triggerRow.rowLevel + 1 : 1;
|
|
6343
|
+
childRow.parentKey = rowKeyGetter(triggerRow, uniqueRowId);
|
|
6344
|
+
addRow(newRowsToRender, rowIndex + 1 + index, childRow);
|
|
6345
|
+
});
|
|
6346
|
+
}
|
|
6347
|
+
return newRowsToRender;
|
|
6348
|
+
});
|
|
6349
|
+
} catch (error) {
|
|
6350
|
+
console.error("Error loading children:", error);
|
|
6351
|
+
} finally {
|
|
6352
|
+
setLoading(false);
|
|
6353
|
+
}
|
|
6354
|
+
} else if (triggerRow.childRows) {
|
|
6355
|
+
setRowsToRender((currentRows) => {
|
|
6356
|
+
const newRowsToRender = [...currentRows];
|
|
6357
|
+
const rowIndex = currentRows.findIndex((row) => triggerRow === row);
|
|
6358
|
+
triggerRow.childRows?.forEach((childRow, index) => {
|
|
6359
|
+
childRow.rowLevel = triggerRow.rowLevel && typeof triggerRow.rowLevel === "number" ? triggerRow.rowLevel + 1 : 1;
|
|
6360
|
+
childRow.parentKey = rowKeyGetter(triggerRow, uniqueRowId);
|
|
6361
|
+
addRow(newRowsToRender, rowIndex + 1 + index, childRow);
|
|
6362
|
+
});
|
|
6363
|
+
return newRowsToRender;
|
|
6123
6364
|
});
|
|
6124
|
-
}
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
)
|
|
6129
|
-
|
|
6365
|
+
}
|
|
6366
|
+
} else {
|
|
6367
|
+
setRowsToRender((currentRows) => {
|
|
6368
|
+
const rowsToRemove = rows.filter(
|
|
6369
|
+
(rowToRender) => rowToRender.parentKey && rowToRender.parentKey === rowKeyGetter(triggerRow, uniqueRowId)
|
|
6370
|
+
);
|
|
6130
6371
|
const rowsToCheck = [...rowsToRemove];
|
|
6131
6372
|
while (rowsToCheck.length > 0) {
|
|
6132
6373
|
const currentRow = rowsToCheck.pop();
|
|
@@ -6134,7 +6375,7 @@ var renderHierarchyTrigger = (rows, triggerRow, uniqueRowId, columnKey, setRowsT
|
|
|
6134
6375
|
rowsToRemove.push(...childRows);
|
|
6135
6376
|
rowsToCheck.push(...childRows);
|
|
6136
6377
|
}
|
|
6137
|
-
newRowsToRender =
|
|
6378
|
+
const newRowsToRender = currentRows.filter(
|
|
6138
6379
|
(row) => !rowsToRemove.map((rowToRemove) => {
|
|
6139
6380
|
if (rowToRemove.visibleChildren) {
|
|
6140
6381
|
rowToRemove.visibleChildren = false;
|
|
@@ -6142,39 +6383,40 @@ var renderHierarchyTrigger = (rows, triggerRow, uniqueRowId, columnKey, setRowsT
|
|
|
6142
6383
|
return rowKeyGetter(rowToRemove, uniqueRowId);
|
|
6143
6384
|
}).includes(rowKeyGetter(row, uniqueRowId))
|
|
6144
6385
|
);
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
]
|
|
6153
|
-
}
|
|
6154
|
-
|
|
6155
|
-
var
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
} else {
|
|
6164
|
-
selected.delete(rowKeyGetter(row, uniqueRowId));
|
|
6165
|
-
}
|
|
6166
|
-
if (row.childRows && Array.isArray(row.childRows)) {
|
|
6167
|
-
getChildrenSelection(row.childRows, uniqueRowId, selected, checked);
|
|
6168
|
-
}
|
|
6169
|
-
if (row.parentKey) {
|
|
6170
|
-
getParentSelectedState(rows, row.parentKey, uniqueRowId, selected, checked);
|
|
6171
|
-
}
|
|
6172
|
-
onSelectRows(selected);
|
|
6173
|
-
},
|
|
6174
|
-
disabled: !rows.some((row2) => uniqueRowId in row2)
|
|
6386
|
+
return newRowsToRender;
|
|
6387
|
+
});
|
|
6388
|
+
}
|
|
6389
|
+
triggerRow.visibleChildren = !triggerRow.visibleChildren;
|
|
6390
|
+
};
|
|
6391
|
+
return /* @__PURE__ */ jsxs25("button", { type: "button", disabled: !rows.some((row) => uniqueRowId in row), onClick, children: [
|
|
6392
|
+
loading ? /* @__PURE__ */ jsx39(Spinner_default, { mode: "small" }) : /* @__PURE__ */ jsx39(Icon_default, { icon: triggerRow.visibleChildren ? "Keyboard_Arrow_Down" : "Chevron_Right" }),
|
|
6393
|
+
/* @__PURE__ */ jsx39("span", { className: "ellipsis-cell", children: triggerRow[columnKey] })
|
|
6394
|
+
] });
|
|
6395
|
+
};
|
|
6396
|
+
var rowHasHierarchy = (row) => {
|
|
6397
|
+
return Array.isArray(row.childRows) && row.childRows.length > 0 || typeof row.childrenTrigger === "function";
|
|
6398
|
+
};
|
|
6399
|
+
var renderCheckbox = (rows, row, uniqueRowId, selectedRows, onSelectRows) => {
|
|
6400
|
+
const checked = selectedRows.has(rowKeyGetter(row, uniqueRowId));
|
|
6401
|
+
if (row.loadingChildren && row.childRows) {
|
|
6402
|
+
handleCheckboxUpdate(rows, row, uniqueRowId, selectedRows, checked, onSelectRows, true);
|
|
6403
|
+
row.loadingChildren = false;
|
|
6175
6404
|
}
|
|
6176
|
-
|
|
6177
|
-
|
|
6405
|
+
return /* @__PURE__ */ jsx39(
|
|
6406
|
+
Checkbox_default,
|
|
6407
|
+
{
|
|
6408
|
+
checked,
|
|
6409
|
+
onChange: (checked2) => {
|
|
6410
|
+
handleCheckboxUpdate(rows, row, uniqueRowId, selectedRows, checked2, onSelectRows);
|
|
6411
|
+
},
|
|
6412
|
+
disabled: (
|
|
6413
|
+
// row.loadingChildren ||
|
|
6414
|
+
!rows.some((row2) => uniqueRowId in row2)
|
|
6415
|
+
)
|
|
6416
|
+
}
|
|
6417
|
+
);
|
|
6418
|
+
};
|
|
6419
|
+
var renderHeaderCheckbox = (rows, uniqueRowId, selectedRows, colorsTheme, onSelectRows) => /* @__PURE__ */ jsx39(HalstackProvider, { advancedTheme: overwriteTheme(colorsTheme), children: /* @__PURE__ */ jsx39(
|
|
6178
6420
|
Checkbox_default,
|
|
6179
6421
|
{
|
|
6180
6422
|
checked: rows.length > 0 && !rows.some((row) => !selectedRows.has(rowKeyGetter(row, uniqueRowId))),
|
|
@@ -6291,15 +6533,17 @@ var rowFinderBasedOnId = (rowList, uniqueRowId, uniqueRowIdValue) => {
|
|
|
6291
6533
|
}
|
|
6292
6534
|
return void 0;
|
|
6293
6535
|
};
|
|
6294
|
-
var getChildrenSelection = (rowList, uniqueRowId, selectedRows, checked) => {
|
|
6536
|
+
var getChildrenSelection = (rowList, uniqueRowId, selectedRows, checked, hierarchyValidation) => {
|
|
6295
6537
|
rowList.forEach((row) => {
|
|
6296
6538
|
if (row.childRows) {
|
|
6297
|
-
getChildrenSelection(row.childRows, uniqueRowId, selectedRows, checked);
|
|
6539
|
+
getChildrenSelection(row.childRows, uniqueRowId, selectedRows, checked, hierarchyValidation);
|
|
6298
6540
|
}
|
|
6299
6541
|
if (checked) {
|
|
6300
6542
|
selectedRows.add(rowKeyGetter(row, uniqueRowId));
|
|
6301
6543
|
} else {
|
|
6302
|
-
|
|
6544
|
+
if (!hierarchyValidation) {
|
|
6545
|
+
selectedRows.delete(rowKeyGetter(row, uniqueRowId));
|
|
6546
|
+
}
|
|
6303
6547
|
}
|
|
6304
6548
|
});
|
|
6305
6549
|
};
|
|
@@ -6323,6 +6567,21 @@ var getParentSelectedState = (rowList, parentKeyValue, uniqueRowId, selectedRows
|
|
|
6323
6567
|
getParentSelectedState(rowList, parentRow.parentKey, uniqueRowId, selectedRows, checkedStateToMatch);
|
|
6324
6568
|
}
|
|
6325
6569
|
};
|
|
6570
|
+
var handleCheckboxUpdate = (rows, row, uniqueRowId, selectedRows, checked, onSelectRows, hierarchyValidation) => {
|
|
6571
|
+
const selected = new Set(selectedRows);
|
|
6572
|
+
if (checked) {
|
|
6573
|
+
selected.add(rowKeyGetter(row, uniqueRowId));
|
|
6574
|
+
} else if (!hierarchyValidation) {
|
|
6575
|
+
selected.delete(rowKeyGetter(row, uniqueRowId));
|
|
6576
|
+
}
|
|
6577
|
+
if (row.childRows && Array.isArray(row.childRows)) {
|
|
6578
|
+
getChildrenSelection(row.childRows, uniqueRowId, selected, checked, hierarchyValidation);
|
|
6579
|
+
}
|
|
6580
|
+
if (row.parentKey) {
|
|
6581
|
+
getParentSelectedState(rows, row.parentKey, uniqueRowId, selected, checked);
|
|
6582
|
+
}
|
|
6583
|
+
onSelectRows?.(selected);
|
|
6584
|
+
};
|
|
6326
6585
|
var getMinItemsPerPageIndex = (currentPageInternal, itemsPerPage, page) => currentPageInternal === 1 ? 0 : itemsPerPage * (page - 1);
|
|
6327
6586
|
var getMaxItemsPerPageIndex = (minItemsPerPageIndex, itemsPerPage, rows, page) => minItemsPerPageIndex + itemsPerPage > rows.length ? rows.length : itemsPerPage * page - 1;
|
|
6328
6587
|
var getPaginatedNodes = (rows, uniqueRowId, start, end) => {
|
|
@@ -6344,30 +6603,30 @@ var getPaginatedNodes = (rows, uniqueRowId, start, end) => {
|
|
|
6344
6603
|
};
|
|
6345
6604
|
|
|
6346
6605
|
// src/paginator/Paginator.tsx
|
|
6347
|
-
import { useContext as
|
|
6348
|
-
import
|
|
6606
|
+
import { useContext as useContext23 } from "react";
|
|
6607
|
+
import styled36, { ThemeProvider as ThemeProvider16 } from "styled-components";
|
|
6349
6608
|
|
|
6350
6609
|
// src/select/Select.tsx
|
|
6351
6610
|
import * as Popover2 from "@radix-ui/react-popover";
|
|
6352
6611
|
import {
|
|
6353
6612
|
forwardRef as forwardRef5,
|
|
6354
6613
|
useCallback as useCallback6,
|
|
6355
|
-
useContext as
|
|
6356
|
-
useId as
|
|
6357
|
-
useMemo as
|
|
6614
|
+
useContext as useContext22,
|
|
6615
|
+
useId as useId8,
|
|
6616
|
+
useMemo as useMemo10,
|
|
6358
6617
|
useRef as useRef9,
|
|
6359
|
-
useState as
|
|
6618
|
+
useState as useState17
|
|
6360
6619
|
} from "react";
|
|
6361
|
-
import
|
|
6620
|
+
import styled35, { ThemeProvider as ThemeProvider15 } from "styled-components";
|
|
6362
6621
|
|
|
6363
6622
|
// src/select/Listbox.tsx
|
|
6364
|
-
import { useContext as
|
|
6365
|
-
import
|
|
6623
|
+
import { useContext as useContext21, useLayoutEffect as useLayoutEffect4, useRef as useRef8 } from "react";
|
|
6624
|
+
import styled34 from "styled-components";
|
|
6366
6625
|
|
|
6367
6626
|
// src/select/ListOption.tsx
|
|
6368
|
-
import
|
|
6369
|
-
import { useState as
|
|
6370
|
-
import { jsx as
|
|
6627
|
+
import styled33 from "styled-components";
|
|
6628
|
+
import { useState as useState16 } from "react";
|
|
6629
|
+
import { jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
6371
6630
|
var ListOption = ({
|
|
6372
6631
|
id,
|
|
6373
6632
|
option,
|
|
@@ -6378,12 +6637,12 @@ var ListOption = ({
|
|
|
6378
6637
|
isLastOption,
|
|
6379
6638
|
isSelected
|
|
6380
6639
|
}) => {
|
|
6381
|
-
const [hasTooltip, setHasTooltip] =
|
|
6640
|
+
const [hasTooltip, setHasTooltip] = useState16(false);
|
|
6382
6641
|
const handleOnMouseEnter = (event) => {
|
|
6383
6642
|
const text = event.currentTarget;
|
|
6384
6643
|
setHasTooltip(text.scrollWidth > text.clientWidth);
|
|
6385
6644
|
};
|
|
6386
|
-
return /* @__PURE__ */
|
|
6645
|
+
return /* @__PURE__ */ jsx40(TooltipWrapper, { condition: hasTooltip, label: option.label, children: /* @__PURE__ */ jsx40(
|
|
6387
6646
|
OptionItem,
|
|
6388
6647
|
{
|
|
6389
6648
|
id,
|
|
@@ -6394,7 +6653,7 @@ var ListOption = ({
|
|
|
6394
6653
|
selected: isSelected,
|
|
6395
6654
|
role: "option",
|
|
6396
6655
|
"aria-selected": !multiple ? isSelected : void 0,
|
|
6397
|
-
children: /* @__PURE__ */
|
|
6656
|
+
children: /* @__PURE__ */ jsxs26(
|
|
6398
6657
|
StyledOption,
|
|
6399
6658
|
{
|
|
6400
6659
|
visualFocused,
|
|
@@ -6403,11 +6662,11 @@ var ListOption = ({
|
|
|
6403
6662
|
grouped: isGroupedOption,
|
|
6404
6663
|
multiple,
|
|
6405
6664
|
children: [
|
|
6406
|
-
multiple && /* @__PURE__ */
|
|
6407
|
-
option.icon && /* @__PURE__ */
|
|
6408
|
-
/* @__PURE__ */
|
|
6409
|
-
/* @__PURE__ */
|
|
6410
|
-
!multiple && isSelected && /* @__PURE__ */
|
|
6665
|
+
multiple && /* @__PURE__ */ jsx40("div", { style: { display: "flex", pointerEvents: "none" }, children: /* @__PURE__ */ jsx40(Checkbox_default, { checked: isSelected, tabIndex: -1 }) }),
|
|
6666
|
+
option.icon && /* @__PURE__ */ jsx40(OptionIcon, { grouped: isGroupedOption, multiple, children: typeof option.icon === "string" ? /* @__PURE__ */ jsx40(Icon_default, { icon: option.icon }) : option.icon }),
|
|
6667
|
+
/* @__PURE__ */ jsxs26(OptionContent, { grouped: isGroupedOption, hasIcon: option.icon ? true : false, multiple, children: [
|
|
6668
|
+
/* @__PURE__ */ jsx40(OptionLabel, { onMouseEnter: handleOnMouseEnter, children: option.label }),
|
|
6669
|
+
!multiple && isSelected && /* @__PURE__ */ jsx40(OptionSelectedIndicator, { children: /* @__PURE__ */ jsx40(Icon_default, { icon: "done" }) })
|
|
6411
6670
|
] })
|
|
6412
6671
|
]
|
|
6413
6672
|
}
|
|
@@ -6415,7 +6674,7 @@ var ListOption = ({
|
|
|
6415
6674
|
}
|
|
6416
6675
|
) });
|
|
6417
6676
|
};
|
|
6418
|
-
var OptionItem =
|
|
6677
|
+
var OptionItem = styled33.li`
|
|
6419
6678
|
padding: 0 0.5rem;
|
|
6420
6679
|
box-shadow: inset 0 0 0 2px transparent;
|
|
6421
6680
|
${(props) => props.visualFocused && `box-shadow: inset 0 0 0 2px ${props.theme.focusListOptionBorderColor};`}
|
|
@@ -6429,7 +6688,7 @@ var OptionItem = styled32.li`
|
|
|
6429
6688
|
${(props) => props.selected ? `background-color: ${props.theme.selectedActiveListOptionBackgroundColor};` : `background-color: ${props.theme.unselectedActiveListOptionBackgroundColor};`};
|
|
6430
6689
|
}
|
|
6431
6690
|
`;
|
|
6432
|
-
var StyledOption =
|
|
6691
|
+
var StyledOption = styled33.span`
|
|
6433
6692
|
box-sizing: border-box;
|
|
6434
6693
|
display: flex;
|
|
6435
6694
|
align-items: center;
|
|
@@ -6438,7 +6697,7 @@ var StyledOption = styled32.span`
|
|
|
6438
6697
|
${(props) => props.grouped && props.multiple && `padding-left: 16px;`}
|
|
6439
6698
|
${(props) => props.last || props.visualFocused || props.selected ? `border-bottom: 1px solid transparent` : `border-bottom: 1px solid ${props.theme.listOptionDividerColor}`};
|
|
6440
6699
|
`;
|
|
6441
|
-
var OptionIcon =
|
|
6700
|
+
var OptionIcon = styled33.span`
|
|
6442
6701
|
margin-left: ${(props) => props.grouped && !props.multiple ? "16px" : "8px"};
|
|
6443
6702
|
display: grid;
|
|
6444
6703
|
place-items: center;
|
|
@@ -6449,7 +6708,7 @@ var OptionIcon = styled32.span`
|
|
|
6449
6708
|
width: 24px;
|
|
6450
6709
|
}
|
|
6451
6710
|
`;
|
|
6452
|
-
var OptionContent =
|
|
6711
|
+
var OptionContent = styled33.span`
|
|
6453
6712
|
margin-left: ${(props) => props.grouped && !props.multiple && !props.hasIcon ? "16px" : "8px"};
|
|
6454
6713
|
display: flex;
|
|
6455
6714
|
justify-content: space-between;
|
|
@@ -6457,12 +6716,12 @@ var OptionContent = styled32.span`
|
|
|
6457
6716
|
width: 100%;
|
|
6458
6717
|
overflow: hidden;
|
|
6459
6718
|
`;
|
|
6460
|
-
var OptionLabel =
|
|
6719
|
+
var OptionLabel = styled33.span`
|
|
6461
6720
|
overflow: hidden;
|
|
6462
6721
|
text-overflow: ellipsis;
|
|
6463
6722
|
white-space: nowrap;
|
|
6464
6723
|
`;
|
|
6465
|
-
var OptionSelectedIndicator =
|
|
6724
|
+
var OptionSelectedIndicator = styled33.span`
|
|
6466
6725
|
display: flex;
|
|
6467
6726
|
align-items: center;
|
|
6468
6727
|
color: ${(props) => props.theme.selectedListOptionIconColor};
|
|
@@ -6560,7 +6819,7 @@ var getSelectedOption = (value, options, multiple, optional, optionalItem) => {
|
|
|
6560
6819
|
var getSelectedOptionLabel = (placeholder, selectedOption) => Array.isArray(selectedOption) ? selectedOption.length === 0 ? placeholder : selectedOption.map((option) => option.label).join(", ") : selectedOption.label ?? placeholder;
|
|
6561
6820
|
|
|
6562
6821
|
// src/select/Listbox.tsx
|
|
6563
|
-
import { jsx as
|
|
6822
|
+
import { jsx as jsx41, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
6564
6823
|
var Listbox = ({
|
|
6565
6824
|
id,
|
|
6566
6825
|
currentValue,
|
|
@@ -6574,17 +6833,17 @@ var Listbox = ({
|
|
|
6574
6833
|
handleOptionOnClick,
|
|
6575
6834
|
styles
|
|
6576
6835
|
}) => {
|
|
6577
|
-
const translatedLabels =
|
|
6836
|
+
const translatedLabels = useContext21(HalstackLanguageContext);
|
|
6578
6837
|
const listboxRef = useRef8(null);
|
|
6579
6838
|
let globalIndex = optional && !multiple ? 0 : -1;
|
|
6580
6839
|
const mapOptionFunc = (option, mapIndex) => {
|
|
6581
6840
|
const groupId = `${id}-group-${mapIndex}`;
|
|
6582
6841
|
if ("options" in option) {
|
|
6583
|
-
return option.options.length > 0 && /* @__PURE__ */
|
|
6584
|
-
/* @__PURE__ */
|
|
6842
|
+
return option.options.length > 0 && /* @__PURE__ */ jsx41("li", { children: /* @__PURE__ */ jsxs27("ul", { role: "listbox", "aria-labelledby": groupId, style: { padding: 0 }, children: [
|
|
6843
|
+
/* @__PURE__ */ jsx41(GroupLabel, { role: "presentation", id: groupId, children: option.label }),
|
|
6585
6844
|
option.options.map((singleOption) => {
|
|
6586
6845
|
globalIndex++;
|
|
6587
|
-
return /* @__PURE__ */
|
|
6846
|
+
return /* @__PURE__ */ jsx41(
|
|
6588
6847
|
ListOption_default,
|
|
6589
6848
|
{
|
|
6590
6849
|
id: `${id}-option-${globalIndex}`,
|
|
@@ -6602,7 +6861,7 @@ var Listbox = ({
|
|
|
6602
6861
|
] }) }, groupId);
|
|
6603
6862
|
} else {
|
|
6604
6863
|
globalIndex++;
|
|
6605
|
-
return /* @__PURE__ */
|
|
6864
|
+
return /* @__PURE__ */ jsx41(
|
|
6606
6865
|
ListOption_default,
|
|
6607
6866
|
{
|
|
6608
6867
|
id: `${id}-option-${globalIndex}`,
|
|
@@ -6634,7 +6893,7 @@ var Listbox = ({
|
|
|
6634
6893
|
});
|
|
6635
6894
|
}, [visualFocusIndex]);
|
|
6636
6895
|
const hasOptionGroups = options.some((option) => "options" in option && option.options.length > 0);
|
|
6637
|
-
return /* @__PURE__ */
|
|
6896
|
+
return /* @__PURE__ */ jsxs27(
|
|
6638
6897
|
ListboxContainer,
|
|
6639
6898
|
{
|
|
6640
6899
|
id,
|
|
@@ -6650,10 +6909,10 @@ var Listbox = ({
|
|
|
6650
6909
|
role: hasOptionGroups ? "list" : "listbox",
|
|
6651
6910
|
"aria-label": "List of options",
|
|
6652
6911
|
children: [
|
|
6653
|
-
searchable && (options.length === 0 || !groupsHaveOptions(options)) ? /* @__PURE__ */
|
|
6654
|
-
/* @__PURE__ */
|
|
6912
|
+
searchable && (options.length === 0 || !groupsHaveOptions(options)) ? /* @__PURE__ */ jsxs27(OptionsSystemMessage, { children: [
|
|
6913
|
+
/* @__PURE__ */ jsx41(NoMatchesFoundIcon, { children: /* @__PURE__ */ jsx41(Icon_default, { icon: "search_off" }) }),
|
|
6655
6914
|
translatedLabels.select.noMatchesErrorMessage
|
|
6656
|
-
] }) : optional && !multiple && /* @__PURE__ */
|
|
6915
|
+
] }) : optional && !multiple && /* @__PURE__ */ jsx41(
|
|
6657
6916
|
ListOption_default,
|
|
6658
6917
|
{
|
|
6659
6918
|
id: `${id}-option-${0}`,
|
|
@@ -6672,7 +6931,7 @@ var Listbox = ({
|
|
|
6672
6931
|
}
|
|
6673
6932
|
);
|
|
6674
6933
|
};
|
|
6675
|
-
var ListboxContainer =
|
|
6934
|
+
var ListboxContainer = styled34.ul`
|
|
6676
6935
|
box-sizing: border-box;
|
|
6677
6936
|
max-height: 304px;
|
|
6678
6937
|
overflow-y: auto;
|
|
@@ -6690,14 +6949,14 @@ var ListboxContainer = styled33.ul`
|
|
|
6690
6949
|
line-height: 24px;
|
|
6691
6950
|
cursor: default;
|
|
6692
6951
|
`;
|
|
6693
|
-
var OptionsSystemMessage =
|
|
6952
|
+
var OptionsSystemMessage = styled34.span`
|
|
6694
6953
|
display: flex;
|
|
6695
6954
|
padding: 4px 16px;
|
|
6696
6955
|
color: ${(props) => props.theme.systemMessageFontColor};
|
|
6697
6956
|
font-size: 0.875rem;
|
|
6698
6957
|
line-height: 1.715em;
|
|
6699
6958
|
`;
|
|
6700
|
-
var NoMatchesFoundIcon =
|
|
6959
|
+
var NoMatchesFoundIcon = styled34.span`
|
|
6701
6960
|
display: flex;
|
|
6702
6961
|
flex-wrap: wrap;
|
|
6703
6962
|
align-content: center;
|
|
@@ -6707,7 +6966,7 @@ var NoMatchesFoundIcon = styled33.span`
|
|
|
6707
6966
|
margin-right: 0.25rem;
|
|
6708
6967
|
font-size: 16px;
|
|
6709
6968
|
`;
|
|
6710
|
-
var GroupLabel =
|
|
6969
|
+
var GroupLabel = styled34.li`
|
|
6711
6970
|
padding: 4px 16px;
|
|
6712
6971
|
font-weight: ${(props) => props.theme.listGroupLabelFontWeight};
|
|
6713
6972
|
line-height: 1.715em;
|
|
@@ -6715,7 +6974,7 @@ var GroupLabel = styled33.li`
|
|
|
6715
6974
|
var Listbox_default = Listbox;
|
|
6716
6975
|
|
|
6717
6976
|
// src/select/Select.tsx
|
|
6718
|
-
import { jsx as
|
|
6977
|
+
import { jsx as jsx42, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
6719
6978
|
var DxcSelect = forwardRef5(
|
|
6720
6979
|
({
|
|
6721
6980
|
label,
|
|
@@ -6737,27 +6996,27 @@ var DxcSelect = forwardRef5(
|
|
|
6737
6996
|
tabIndex = 0,
|
|
6738
6997
|
ariaLabel = "Select"
|
|
6739
6998
|
}, ref) => {
|
|
6740
|
-
const selectId = `select-${
|
|
6999
|
+
const selectId = `select-${useId8()}`;
|
|
6741
7000
|
const selectLabelId = `label-${selectId}`;
|
|
6742
7001
|
const errorId = `error-${selectId}`;
|
|
6743
7002
|
const listboxId = `${selectId}-listbox`;
|
|
6744
|
-
const [innerValue, setInnerValue] =
|
|
6745
|
-
const [searchValue, setSearchValue] =
|
|
6746
|
-
const [visualFocusIndex, changeVisualFocusIndex] =
|
|
6747
|
-
const [isOpen, changeIsOpen] =
|
|
6748
|
-
const [hasTooltip, setHasTooltip] =
|
|
7003
|
+
const [innerValue, setInnerValue] = useState17(defaultValue ?? (multiple ? [] : ""));
|
|
7004
|
+
const [searchValue, setSearchValue] = useState17("");
|
|
7005
|
+
const [visualFocusIndex, changeVisualFocusIndex] = useState17(-1);
|
|
7006
|
+
const [isOpen, changeIsOpen] = useState17(false);
|
|
7007
|
+
const [hasTooltip, setHasTooltip] = useState17(false);
|
|
6749
7008
|
const selectRef = useRef9(null);
|
|
6750
7009
|
const selectSearchInputRef = useRef9(null);
|
|
6751
7010
|
const width = useWidth_default(selectRef.current);
|
|
6752
|
-
const colorsTheme =
|
|
6753
|
-
const translatedLabels =
|
|
7011
|
+
const colorsTheme = useContext22(HalstackContext);
|
|
7012
|
+
const translatedLabels = useContext22(HalstackLanguageContext);
|
|
6754
7013
|
const optionalItem = { label: placeholder, value: "" };
|
|
6755
|
-
const filteredOptions =
|
|
6756
|
-
const lastOptionIndex =
|
|
7014
|
+
const filteredOptions = useMemo10(() => filterOptionsBySearchValue(options, searchValue), [options, searchValue]);
|
|
7015
|
+
const lastOptionIndex = useMemo10(
|
|
6757
7016
|
() => getLastOptionIndex(options, filteredOptions, searchable, optional, multiple),
|
|
6758
7017
|
[options, filteredOptions, searchable, optional, multiple]
|
|
6759
7018
|
);
|
|
6760
|
-
const { selectedOption, singleSelectionIndex } =
|
|
7019
|
+
const { selectedOption, singleSelectionIndex } = useMemo10(
|
|
6761
7020
|
() => getSelectedOption(value ?? innerValue, options, multiple, optional, optionalItem),
|
|
6762
7021
|
[value, innerValue, options, multiple, optional, optionalItem]
|
|
6763
7022
|
);
|
|
@@ -6943,8 +7202,8 @@ var DxcSelect = forwardRef5(
|
|
|
6943
7202
|
const text = event.currentTarget;
|
|
6944
7203
|
setHasTooltip(text.scrollWidth > text.clientWidth);
|
|
6945
7204
|
};
|
|
6946
|
-
return /* @__PURE__ */
|
|
6947
|
-
label && /* @__PURE__ */
|
|
7205
|
+
return /* @__PURE__ */ jsx42(ThemeProvider15, { theme: colorsTheme.select, children: /* @__PURE__ */ jsxs28(SelectContainer, { margin, size, ref, children: [
|
|
7206
|
+
label && /* @__PURE__ */ jsxs28(
|
|
6948
7207
|
Label3,
|
|
6949
7208
|
{
|
|
6950
7209
|
id: selectLabelId,
|
|
@@ -6956,13 +7215,13 @@ var DxcSelect = forwardRef5(
|
|
|
6956
7215
|
children: [
|
|
6957
7216
|
label,
|
|
6958
7217
|
" ",
|
|
6959
|
-
optional && /* @__PURE__ */
|
|
7218
|
+
optional && /* @__PURE__ */ jsx42(OptionalLabel, { children: translatedLabels.formFields.optionalLabel })
|
|
6960
7219
|
]
|
|
6961
7220
|
}
|
|
6962
7221
|
),
|
|
6963
|
-
helperText && /* @__PURE__ */
|
|
6964
|
-
/* @__PURE__ */
|
|
6965
|
-
/* @__PURE__ */
|
|
7222
|
+
helperText && /* @__PURE__ */ jsx42(HelperText, { disabled, children: helperText }),
|
|
7223
|
+
/* @__PURE__ */ jsxs28(Popover2.Root, { open: isOpen, children: [
|
|
7224
|
+
/* @__PURE__ */ jsx42(Popover2.Trigger, { asChild: true, type: void 0, children: /* @__PURE__ */ jsxs28(
|
|
6966
7225
|
Select,
|
|
6967
7226
|
{
|
|
6968
7227
|
id: selectId,
|
|
@@ -6986,9 +7245,9 @@ var DxcSelect = forwardRef5(
|
|
|
6986
7245
|
"aria-required": !disabled && !optional,
|
|
6987
7246
|
"aria-label": label ? void 0 : ariaLabel,
|
|
6988
7247
|
children: [
|
|
6989
|
-
multiple && Array.isArray(selectedOption) && selectedOption.length > 0 && /* @__PURE__ */
|
|
6990
|
-
/* @__PURE__ */
|
|
6991
|
-
/* @__PURE__ */
|
|
7248
|
+
multiple && Array.isArray(selectedOption) && selectedOption.length > 0 && /* @__PURE__ */ jsxs28(SelectionIndicator, { children: [
|
|
7249
|
+
/* @__PURE__ */ jsx42(SelectionNumber, { disabled, children: selectedOption.length }),
|
|
7250
|
+
/* @__PURE__ */ jsx42(Tooltip, { label: translatedLabels.select.actionClearSelectionTitle, children: /* @__PURE__ */ jsx42(
|
|
6992
7251
|
ClearOptionsAction,
|
|
6993
7252
|
{
|
|
6994
7253
|
disabled,
|
|
@@ -6998,12 +7257,12 @@ var DxcSelect = forwardRef5(
|
|
|
6998
7257
|
onClick: handleClearOptionsActionOnClick,
|
|
6999
7258
|
tabIndex: -1,
|
|
7000
7259
|
"aria-label": translatedLabels.select.actionClearSelectionTitle,
|
|
7001
|
-
children: /* @__PURE__ */
|
|
7260
|
+
children: /* @__PURE__ */ jsx42(Icon_default, { icon: "clear" })
|
|
7002
7261
|
}
|
|
7003
7262
|
) })
|
|
7004
7263
|
] }),
|
|
7005
|
-
/* @__PURE__ */
|
|
7006
|
-
/* @__PURE__ */
|
|
7264
|
+
/* @__PURE__ */ jsx42(TooltipWrapper, { condition: hasTooltip, label: getSelectedOptionLabel(placeholder, selectedOption), children: /* @__PURE__ */ jsxs28(SearchableValueContainer, { children: [
|
|
7265
|
+
/* @__PURE__ */ jsx42(
|
|
7007
7266
|
"input",
|
|
7008
7267
|
{
|
|
7009
7268
|
style: { display: "none" },
|
|
@@ -7014,7 +7273,7 @@ var DxcSelect = forwardRef5(
|
|
|
7014
7273
|
"aria-hidden": "true"
|
|
7015
7274
|
}
|
|
7016
7275
|
),
|
|
7017
|
-
searchable && /* @__PURE__ */
|
|
7276
|
+
searchable && /* @__PURE__ */ jsx42(
|
|
7018
7277
|
SearchInput,
|
|
7019
7278
|
{
|
|
7020
7279
|
value: searchValue,
|
|
@@ -7027,17 +7286,17 @@ var DxcSelect = forwardRef5(
|
|
|
7027
7286
|
"aria-labelledby": label ? selectLabelId : void 0
|
|
7028
7287
|
}
|
|
7029
7288
|
),
|
|
7030
|
-
(!searchable || searchValue === "") && /* @__PURE__ */
|
|
7289
|
+
(!searchable || searchValue === "") && /* @__PURE__ */ jsx42(
|
|
7031
7290
|
SelectedOption,
|
|
7032
7291
|
{
|
|
7033
7292
|
disabled,
|
|
7034
7293
|
atBackground: (multiple ? (value ?? innerValue).length === 0 : !(value ?? innerValue)) || searchable && isOpen,
|
|
7035
|
-
children: /* @__PURE__ */
|
|
7294
|
+
children: /* @__PURE__ */ jsx42(SelectedOptionLabel, { onMouseEnter: handleOnMouseEnter, children: getSelectedOptionLabel(placeholder, selectedOption) })
|
|
7036
7295
|
}
|
|
7037
7296
|
)
|
|
7038
7297
|
] }) }),
|
|
7039
|
-
!disabled && error && /* @__PURE__ */
|
|
7040
|
-
searchable && searchValue.length > 0 && /* @__PURE__ */
|
|
7298
|
+
!disabled && error && /* @__PURE__ */ jsx42(ErrorIcon, { children: /* @__PURE__ */ jsx42(Icon_default, { icon: "filled_error" }) }),
|
|
7299
|
+
searchable && searchValue.length > 0 && /* @__PURE__ */ jsx42(Tooltip, { label: translatedLabels.select.actionClearSelectionTitle, children: /* @__PURE__ */ jsx42(
|
|
7041
7300
|
ClearSearchAction,
|
|
7042
7301
|
{
|
|
7043
7302
|
onMouseDown: (event) => {
|
|
@@ -7046,25 +7305,25 @@ var DxcSelect = forwardRef5(
|
|
|
7046
7305
|
onClick: handleClearSearchActionOnClick,
|
|
7047
7306
|
tabIndex: -1,
|
|
7048
7307
|
"aria-label": translatedLabels.select.actionClearSearchTitle,
|
|
7049
|
-
children: /* @__PURE__ */
|
|
7308
|
+
children: /* @__PURE__ */ jsx42(Icon_default, { icon: "clear" })
|
|
7050
7309
|
}
|
|
7051
7310
|
) }),
|
|
7052
|
-
/* @__PURE__ */
|
|
7311
|
+
/* @__PURE__ */ jsx42(CollapseIndicator2, { disabled, children: /* @__PURE__ */ jsx42(Icon_default, { icon: isOpen ? "keyboard_arrow_up" : "keyboard_arrow_down" }) })
|
|
7053
7312
|
]
|
|
7054
7313
|
}
|
|
7055
7314
|
) }),
|
|
7056
|
-
/* @__PURE__ */
|
|
7315
|
+
/* @__PURE__ */ jsx42(Popover2.Portal, { children: /* @__PURE__ */ jsx42(
|
|
7057
7316
|
Popover2.Content,
|
|
7058
7317
|
{
|
|
7059
7318
|
sideOffset: 4,
|
|
7060
|
-
style: { zIndex: "
|
|
7319
|
+
style: { zIndex: "310" },
|
|
7061
7320
|
onOpenAutoFocus: (event) => {
|
|
7062
7321
|
event.preventDefault();
|
|
7063
7322
|
},
|
|
7064
7323
|
onCloseAutoFocus: (event) => {
|
|
7065
7324
|
event.preventDefault();
|
|
7066
7325
|
},
|
|
7067
|
-
children: /* @__PURE__ */
|
|
7326
|
+
children: /* @__PURE__ */ jsx42(
|
|
7068
7327
|
Listbox_default,
|
|
7069
7328
|
{
|
|
7070
7329
|
id: listboxId,
|
|
@@ -7083,7 +7342,7 @@ var DxcSelect = forwardRef5(
|
|
|
7083
7342
|
}
|
|
7084
7343
|
) })
|
|
7085
7344
|
] }),
|
|
7086
|
-
!disabled && typeof error === "string" && /* @__PURE__ */
|
|
7345
|
+
!disabled && typeof error === "string" && /* @__PURE__ */ jsx42(Error2, { id: errorId, role: "alert", "aria-live": error ? "assertive" : "off", children: error })
|
|
7087
7346
|
] }) });
|
|
7088
7347
|
}
|
|
7089
7348
|
);
|
|
@@ -7094,7 +7353,7 @@ var sizes3 = {
|
|
|
7094
7353
|
fillParent: "100%"
|
|
7095
7354
|
};
|
|
7096
7355
|
var calculateWidth6 = (margin, size) => size === "fillParent" ? `calc(${sizes3[size]} - ${getMargin(margin, "left")} - ${getMargin(margin, "right")})` : size && sizes3[size];
|
|
7097
|
-
var SelectContainer =
|
|
7356
|
+
var SelectContainer = styled35.div`
|
|
7098
7357
|
box-sizing: border-box;
|
|
7099
7358
|
display: flex;
|
|
7100
7359
|
flex-direction: column;
|
|
@@ -7107,7 +7366,7 @@ var SelectContainer = styled34.div`
|
|
|
7107
7366
|
margin-left: ${(props) => props.margin && typeof props.margin === "object" && props.margin.left ? spaces[props.margin.left] : ""};
|
|
7108
7367
|
font-family: ${(props) => props.theme.fontFamily};
|
|
7109
7368
|
`;
|
|
7110
|
-
var Label3 =
|
|
7369
|
+
var Label3 = styled35.label`
|
|
7111
7370
|
color: ${(props) => props.disabled ? props.theme.disabledColor : props.theme.labelFontColor};
|
|
7112
7371
|
font-size: ${(props) => props.theme.labelFontSize};
|
|
7113
7372
|
font-style: ${(props) => props.theme.labelFontStyle};
|
|
@@ -7116,10 +7375,10 @@ var Label3 = styled34.label`
|
|
|
7116
7375
|
cursor: default;
|
|
7117
7376
|
${(props) => !props.helperText && `margin-bottom: 0.25rem`}
|
|
7118
7377
|
`;
|
|
7119
|
-
var OptionalLabel =
|
|
7378
|
+
var OptionalLabel = styled35.span`
|
|
7120
7379
|
font-weight: ${(props) => props.theme.optionalLabelFontWeight};
|
|
7121
7380
|
`;
|
|
7122
|
-
var HelperText =
|
|
7381
|
+
var HelperText = styled35.span`
|
|
7123
7382
|
color: ${(props) => props.disabled ? props.theme.disabledColor : props.theme.helperTextFontColor};
|
|
7124
7383
|
font-size: ${(props) => props.theme.helperTextFontSize};
|
|
7125
7384
|
font-style: ${(props) => props.theme.helperTextFontStyle};
|
|
@@ -7127,7 +7386,7 @@ var HelperText = styled34.span`
|
|
|
7127
7386
|
line-height: ${(props) => props.theme.helperTextLineHeight};
|
|
7128
7387
|
margin-bottom: 0.25rem;
|
|
7129
7388
|
`;
|
|
7130
|
-
var Select =
|
|
7389
|
+
var Select = styled35.div`
|
|
7131
7390
|
display: flex;
|
|
7132
7391
|
position: relative;
|
|
7133
7392
|
align-items: center;
|
|
@@ -7155,7 +7414,7 @@ var Select = styled34.div`
|
|
|
7155
7414
|
}
|
|
7156
7415
|
`};
|
|
7157
7416
|
`;
|
|
7158
|
-
var SelectionIndicator =
|
|
7417
|
+
var SelectionIndicator = styled35.div`
|
|
7159
7418
|
box-sizing: border-box;
|
|
7160
7419
|
display: grid;
|
|
7161
7420
|
grid-template-columns: 1fr 1fr;
|
|
@@ -7164,7 +7423,7 @@ var SelectionIndicator = styled34.div`
|
|
|
7164
7423
|
border-radius: 2px;
|
|
7165
7424
|
border: 1px solid ${(props) => props.theme.selectionIndicatorBorderColor};
|
|
7166
7425
|
`;
|
|
7167
|
-
var SelectionNumber =
|
|
7426
|
+
var SelectionNumber = styled35.span`
|
|
7168
7427
|
display: grid;
|
|
7169
7428
|
place-items: center;
|
|
7170
7429
|
border-right: 1px solid ${(props) => props.theme.selectionIndicatorBorderColor};
|
|
@@ -7176,7 +7435,7 @@ var SelectionNumber = styled34.span`
|
|
|
7176
7435
|
font-weight: ${(props) => props.theme.selectionIndicatorFontWeight};
|
|
7177
7436
|
${(props) => props.disabled ? `cursor: not-allowed;` : `cursor: default;`}
|
|
7178
7437
|
`;
|
|
7179
|
-
var ClearOptionsAction =
|
|
7438
|
+
var ClearOptionsAction = styled35.button`
|
|
7180
7439
|
display: grid;
|
|
7181
7440
|
place-items: center;
|
|
7182
7441
|
border: none;
|
|
@@ -7201,11 +7460,11 @@ var ClearOptionsAction = styled34.button`
|
|
|
7201
7460
|
}
|
|
7202
7461
|
`}
|
|
7203
7462
|
`;
|
|
7204
|
-
var SearchableValueContainer =
|
|
7463
|
+
var SearchableValueContainer = styled35.div`
|
|
7205
7464
|
display: grid;
|
|
7206
7465
|
width: 100%;
|
|
7207
7466
|
`;
|
|
7208
|
-
var SelectedOption =
|
|
7467
|
+
var SelectedOption = styled35.span`
|
|
7209
7468
|
grid-area: 1 / 1 / 1 / 1;
|
|
7210
7469
|
display: inline-flex;
|
|
7211
7470
|
align-items: center;
|
|
@@ -7221,12 +7480,12 @@ var SelectedOption = styled34.span`
|
|
|
7221
7480
|
font-style: ${(props) => props.theme.valueFontStyle};
|
|
7222
7481
|
font-weight: ${(props) => props.theme.valueFontWeight};
|
|
7223
7482
|
`;
|
|
7224
|
-
var SelectedOptionLabel =
|
|
7483
|
+
var SelectedOptionLabel = styled35.span`
|
|
7225
7484
|
overflow: hidden;
|
|
7226
7485
|
text-overflow: ellipsis;
|
|
7227
7486
|
white-space: nowrap;
|
|
7228
7487
|
`;
|
|
7229
|
-
var SearchInput =
|
|
7488
|
+
var SearchInput = styled35.input`
|
|
7230
7489
|
grid-area: 1 / 1 / 1 / 1;
|
|
7231
7490
|
height: calc(2.5rem - 2px);
|
|
7232
7491
|
background: none;
|
|
@@ -7239,7 +7498,7 @@ var SearchInput = styled34.input`
|
|
|
7239
7498
|
font-weight: ${(props) => props.theme.valueFontWeight};
|
|
7240
7499
|
line-height: 1.5em;
|
|
7241
7500
|
`;
|
|
7242
|
-
var ErrorIcon =
|
|
7501
|
+
var ErrorIcon = styled35.span`
|
|
7243
7502
|
display: flex;
|
|
7244
7503
|
flex-wrap: wrap;
|
|
7245
7504
|
align-content: center;
|
|
@@ -7250,14 +7509,14 @@ var ErrorIcon = styled34.span`
|
|
|
7250
7509
|
color: ${(props) => props.theme.errorIconColor};
|
|
7251
7510
|
font-size: 1.25rem;
|
|
7252
7511
|
`;
|
|
7253
|
-
var Error2 =
|
|
7512
|
+
var Error2 = styled35.span`
|
|
7254
7513
|
min-height: 1.5em;
|
|
7255
7514
|
color: ${(props) => props.theme.errorMessageColor};
|
|
7256
7515
|
font-size: 0.75rem;
|
|
7257
7516
|
line-height: 1.5em;
|
|
7258
7517
|
margin-top: 0.25rem;
|
|
7259
7518
|
`;
|
|
7260
|
-
var CollapseIndicator2 =
|
|
7519
|
+
var CollapseIndicator2 = styled35.span`
|
|
7261
7520
|
display: grid;
|
|
7262
7521
|
place-items: center;
|
|
7263
7522
|
padding: 4px;
|
|
@@ -7265,7 +7524,7 @@ var CollapseIndicator2 = styled34.span`
|
|
|
7265
7524
|
margin-left: 0.25rem;
|
|
7266
7525
|
color: ${(props) => props.disabled ? props.theme.disabledColor : props.theme.collapseIndicatorColor};
|
|
7267
7526
|
`;
|
|
7268
|
-
var ClearSearchAction =
|
|
7527
|
+
var ClearSearchAction = styled35.button`
|
|
7269
7528
|
display: grid;
|
|
7270
7529
|
place-items: center;
|
|
7271
7530
|
min-height: 24px;
|
|
@@ -7291,7 +7550,7 @@ var ClearSearchAction = styled34.button`
|
|
|
7291
7550
|
var Select_default = DxcSelect;
|
|
7292
7551
|
|
|
7293
7552
|
// src/paginator/Paginator.tsx
|
|
7294
|
-
import { jsx as
|
|
7553
|
+
import { jsx as jsx43, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
7295
7554
|
var DxcPaginator = ({
|
|
7296
7555
|
currentPage = 1,
|
|
7297
7556
|
itemsPerPage = 5,
|
|
@@ -7306,12 +7565,12 @@ var DxcPaginator = ({
|
|
|
7306
7565
|
const currentPageInternal = currentPage === -1 ? totalPages : currentPage;
|
|
7307
7566
|
const minItemsPerPage = currentPageInternal === 1 || currentPageInternal === 0 ? currentPageInternal : (currentPageInternal - 1) * itemsPerPage + 1;
|
|
7308
7567
|
const maxItemsPerPage = minItemsPerPage - 1 + itemsPerPage > totalItems ? totalItems : minItemsPerPage - 1 + itemsPerPage;
|
|
7309
|
-
const colorsTheme =
|
|
7310
|
-
const translatedLabels =
|
|
7311
|
-
return /* @__PURE__ */
|
|
7312
|
-
itemsPerPageOptions && /* @__PURE__ */
|
|
7313
|
-
/* @__PURE__ */
|
|
7314
|
-
/* @__PURE__ */
|
|
7568
|
+
const colorsTheme = useContext23(HalstackContext);
|
|
7569
|
+
const translatedLabels = useContext23(HalstackLanguageContext);
|
|
7570
|
+
return /* @__PURE__ */ jsx43(ThemeProvider16, { theme: colorsTheme.paginator, children: /* @__PURE__ */ jsx43(DxcPaginatorContainer, { children: /* @__PURE__ */ jsxs29(LabelsContainer3, { children: [
|
|
7571
|
+
itemsPerPageOptions && /* @__PURE__ */ jsxs29(ItemsPageContainer, { children: [
|
|
7572
|
+
/* @__PURE__ */ jsx43(ItemsLabel, { children: translatedLabels.paginator.itemsPerPageText }),
|
|
7573
|
+
/* @__PURE__ */ jsx43(SelectContainer2, { children: /* @__PURE__ */ jsx43(
|
|
7315
7574
|
Select_default,
|
|
7316
7575
|
{
|
|
7317
7576
|
options: itemsPerPageOptions.map((num) => ({
|
|
@@ -7327,8 +7586,8 @@ var DxcPaginator = ({
|
|
|
7327
7586
|
}
|
|
7328
7587
|
) })
|
|
7329
7588
|
] }),
|
|
7330
|
-
/* @__PURE__ */
|
|
7331
|
-
onPageChange && /* @__PURE__ */
|
|
7589
|
+
/* @__PURE__ */ jsx43(TotalItemsContainer, { children: translatedLabels.paginator.minToMaxOfText(minItemsPerPage, maxItemsPerPage, totalItems) }),
|
|
7590
|
+
onPageChange && /* @__PURE__ */ jsx43(
|
|
7332
7591
|
Button_default,
|
|
7333
7592
|
{
|
|
7334
7593
|
mode: "secondary",
|
|
@@ -7338,10 +7597,10 @@ var DxcPaginator = ({
|
|
|
7338
7597
|
onClick: () => {
|
|
7339
7598
|
onPageChange(1);
|
|
7340
7599
|
},
|
|
7341
|
-
title:
|
|
7600
|
+
title: translatedLabels.paginator.firstResultsTitle
|
|
7342
7601
|
}
|
|
7343
7602
|
),
|
|
7344
|
-
onPageChange && /* @__PURE__ */
|
|
7603
|
+
onPageChange && /* @__PURE__ */ jsx43(
|
|
7345
7604
|
Button_default,
|
|
7346
7605
|
{
|
|
7347
7606
|
mode: "secondary",
|
|
@@ -7351,15 +7610,15 @@ var DxcPaginator = ({
|
|
|
7351
7610
|
onClick: () => {
|
|
7352
7611
|
onPageChange(currentPage - 1);
|
|
7353
7612
|
},
|
|
7354
|
-
title:
|
|
7613
|
+
title: translatedLabels.paginator.previousResultsTitle
|
|
7355
7614
|
}
|
|
7356
7615
|
),
|
|
7357
|
-
showGoToPage ? /* @__PURE__ */
|
|
7358
|
-
/* @__PURE__ */
|
|
7616
|
+
showGoToPage ? /* @__PURE__ */ jsxs29(PageToSelectContainer, { children: [
|
|
7617
|
+
/* @__PURE__ */ jsxs29(GoToLabel, { children: [
|
|
7359
7618
|
translatedLabels.paginator.goToPageText,
|
|
7360
7619
|
" "
|
|
7361
7620
|
] }),
|
|
7362
|
-
/* @__PURE__ */
|
|
7621
|
+
/* @__PURE__ */ jsx43(SelectContainer2, { children: /* @__PURE__ */ jsx43(
|
|
7363
7622
|
Select_default,
|
|
7364
7623
|
{
|
|
7365
7624
|
options: Array.from(Array(totalPages), (e, num) => ({
|
|
@@ -7374,8 +7633,8 @@ var DxcPaginator = ({
|
|
|
7374
7633
|
tabIndex
|
|
7375
7634
|
}
|
|
7376
7635
|
) })
|
|
7377
|
-
] }) : /* @__PURE__ */
|
|
7378
|
-
onPageChange && /* @__PURE__ */
|
|
7636
|
+
] }) : /* @__PURE__ */ jsx43("span", { children: translatedLabels.paginator.pageOfText(currentPageInternal, totalPages) }),
|
|
7637
|
+
onPageChange && /* @__PURE__ */ jsx43(
|
|
7379
7638
|
Button_default,
|
|
7380
7639
|
{
|
|
7381
7640
|
mode: "secondary",
|
|
@@ -7388,7 +7647,7 @@ var DxcPaginator = ({
|
|
|
7388
7647
|
title: "Next results"
|
|
7389
7648
|
}
|
|
7390
7649
|
),
|
|
7391
|
-
onPageChange && /* @__PURE__ */
|
|
7650
|
+
onPageChange && /* @__PURE__ */ jsx43(
|
|
7392
7651
|
Button_default,
|
|
7393
7652
|
{
|
|
7394
7653
|
mode: "secondary",
|
|
@@ -7403,7 +7662,7 @@ var DxcPaginator = ({
|
|
|
7403
7662
|
)
|
|
7404
7663
|
] }) }) });
|
|
7405
7664
|
};
|
|
7406
|
-
var DxcPaginatorContainer =
|
|
7665
|
+
var DxcPaginatorContainer = styled36.div`
|
|
7407
7666
|
display: flex;
|
|
7408
7667
|
font-family: ${(props) => props.theme.fontFamily};
|
|
7409
7668
|
font-size: ${(props) => props.theme.fontSize};
|
|
@@ -7421,34 +7680,34 @@ var DxcPaginatorContainer = styled35.div`
|
|
|
7421
7680
|
}
|
|
7422
7681
|
}
|
|
7423
7682
|
`;
|
|
7424
|
-
var SelectContainer2 =
|
|
7683
|
+
var SelectContainer2 = styled36.div`
|
|
7425
7684
|
min-width: 5.25rem;
|
|
7426
7685
|
`;
|
|
7427
|
-
var ItemsPageContainer =
|
|
7686
|
+
var ItemsPageContainer = styled36.span`
|
|
7428
7687
|
display: flex;
|
|
7429
7688
|
align-items: center;
|
|
7430
7689
|
margin-right: ${(props) => props.theme.itemsPerPageSelectorMarginRight};
|
|
7431
7690
|
margin-left: ${(props) => props.theme.itemsPerPageSelectorMarginLeft};
|
|
7432
7691
|
`;
|
|
7433
|
-
var ItemsLabel =
|
|
7692
|
+
var ItemsLabel = styled36.span`
|
|
7434
7693
|
margin-right: 0.5rem;
|
|
7435
7694
|
`;
|
|
7436
|
-
var GoToLabel =
|
|
7695
|
+
var GoToLabel = styled36.span`
|
|
7437
7696
|
margin-right: 0.5rem;
|
|
7438
7697
|
margin-left: 0.5rem;
|
|
7439
7698
|
`;
|
|
7440
|
-
var TotalItemsContainer =
|
|
7699
|
+
var TotalItemsContainer = styled36.span`
|
|
7441
7700
|
margin-right: ${(props) => props.theme.totalItemsContainerMarginRight};
|
|
7442
7701
|
margin-left: ${(props) => props.theme.totalItemsContainerMarginLeft};
|
|
7443
7702
|
`;
|
|
7444
|
-
var
|
|
7703
|
+
var LabelsContainer3 = styled36.div`
|
|
7445
7704
|
display: flex;
|
|
7446
7705
|
gap: 0.5rem;
|
|
7447
7706
|
width: 100%;
|
|
7448
7707
|
justify-content: flex-end;
|
|
7449
7708
|
align-items: center;
|
|
7450
7709
|
`;
|
|
7451
|
-
var PageToSelectContainer =
|
|
7710
|
+
var PageToSelectContainer = styled36.span`
|
|
7452
7711
|
display: flex;
|
|
7453
7712
|
align-items: center;
|
|
7454
7713
|
margin-right: 0.5rem;
|
|
@@ -7456,8 +7715,8 @@ var PageToSelectContainer = styled35.span`
|
|
|
7456
7715
|
var Paginator_default = DxcPaginator;
|
|
7457
7716
|
|
|
7458
7717
|
// src/table/Table.tsx
|
|
7459
|
-
import { useContext as
|
|
7460
|
-
import
|
|
7718
|
+
import { useContext as useContext24 } from "react";
|
|
7719
|
+
import styled37, { ThemeProvider as ThemeProvider17 } from "styled-components";
|
|
7461
7720
|
|
|
7462
7721
|
// src/table/dropdownTheme.ts
|
|
7463
7722
|
var dropdownTheme_default2 = {
|
|
@@ -7517,7 +7776,7 @@ var dropdownTheme_default2 = {
|
|
|
7517
7776
|
};
|
|
7518
7777
|
|
|
7519
7778
|
// src/table/Table.tsx
|
|
7520
|
-
import { jsx as
|
|
7779
|
+
import { jsx as jsx44, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
7521
7780
|
var overwriteTheme2 = (theme) => {
|
|
7522
7781
|
const newTheme = dropdownTheme_default2;
|
|
7523
7782
|
newTheme.dropdown.buttonBackgroundColor = theme.table.actionBackgroundColor;
|
|
@@ -7532,10 +7791,10 @@ var DxcActionsCell = ({ actions }) => {
|
|
|
7532
7791
|
const actionIcons = actions.filter((action) => !action.options);
|
|
7533
7792
|
const actionDropdown = actions.find((action) => action.options);
|
|
7534
7793
|
const maxNumberOfActions = actionDropdown ? 2 : 3;
|
|
7535
|
-
const colorsTheme =
|
|
7536
|
-
return /* @__PURE__ */
|
|
7794
|
+
const colorsTheme = useContext24(HalstackContext);
|
|
7795
|
+
return /* @__PURE__ */ jsxs30(Flex_default, { gap: "0.5rem", alignItems: "center", children: [
|
|
7537
7796
|
actionIcons.map(
|
|
7538
|
-
(action, index) => index < maxNumberOfActions && /* @__PURE__ */
|
|
7797
|
+
(action, index) => index < maxNumberOfActions && /* @__PURE__ */ jsx44(
|
|
7539
7798
|
ActionIcon_default,
|
|
7540
7799
|
{
|
|
7541
7800
|
icon: action.icon,
|
|
@@ -7547,7 +7806,7 @@ var DxcActionsCell = ({ actions }) => {
|
|
|
7547
7806
|
`action-${index}`
|
|
7548
7807
|
)
|
|
7549
7808
|
),
|
|
7550
|
-
actionDropdown && /* @__PURE__ */
|
|
7809
|
+
actionDropdown && /* @__PURE__ */ jsx44(HalstackProvider, { advancedTheme: overwriteTheme2(colorsTheme), children: /* @__PURE__ */ jsx44(
|
|
7551
7810
|
Dropdown_default,
|
|
7552
7811
|
{
|
|
7553
7812
|
options: actionDropdown.options ?? [],
|
|
@@ -7561,11 +7820,11 @@ var DxcActionsCell = ({ actions }) => {
|
|
|
7561
7820
|
] });
|
|
7562
7821
|
};
|
|
7563
7822
|
var DxcTable = ({ children, margin, mode = "default" }) => {
|
|
7564
|
-
const colorsTheme =
|
|
7565
|
-
return /* @__PURE__ */
|
|
7823
|
+
const colorsTheme = useContext24(HalstackContext);
|
|
7824
|
+
return /* @__PURE__ */ jsx44(ThemeProvider17, { theme: colorsTheme.table, children: /* @__PURE__ */ jsx44(DxcTableContainer, { margin, children: /* @__PURE__ */ jsx44(DxcTableContent, { mode, children }) }) });
|
|
7566
7825
|
};
|
|
7567
7826
|
var calculateWidth7 = (margin) => `calc(100% - ${getMargin(margin, "left")} - ${getMargin(margin, "right")})`;
|
|
7568
|
-
var DxcTableContainer =
|
|
7827
|
+
var DxcTableContainer = styled37.div`
|
|
7569
7828
|
width: ${(props) => calculateWidth7(props.margin)};
|
|
7570
7829
|
margin: ${(props) => props.margin && typeof props.margin !== "object" ? spaces[props.margin] : "0px"};
|
|
7571
7830
|
margin-top: ${(props) => props.margin && typeof props.margin === "object" && props.margin.top ? spaces[props.margin.top] : ""};
|
|
@@ -7587,7 +7846,7 @@ var DxcTableContainer = styled36.div`
|
|
|
7587
7846
|
border-radius: 6px;
|
|
7588
7847
|
}
|
|
7589
7848
|
`;
|
|
7590
|
-
var DxcTableContent =
|
|
7849
|
+
var DxcTableContent = styled37.table`
|
|
7591
7850
|
border-collapse: collapse;
|
|
7592
7851
|
width: 100%;
|
|
7593
7852
|
|
|
@@ -7638,8 +7897,8 @@ DxcTable.ActionsCell = DxcActionsCell;
|
|
|
7638
7897
|
var Table_default = DxcTable;
|
|
7639
7898
|
|
|
7640
7899
|
// src/data-grid/DataGrid.tsx
|
|
7641
|
-
import { jsx as
|
|
7642
|
-
var ActionContainer =
|
|
7900
|
+
import { jsx as jsx45, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
7901
|
+
var ActionContainer = styled38.div`
|
|
7643
7902
|
display: flex;
|
|
7644
7903
|
height: 100%;
|
|
7645
7904
|
align-items: center;
|
|
@@ -7647,7 +7906,7 @@ var ActionContainer = styled37.div`
|
|
|
7647
7906
|
font-size: 14px;
|
|
7648
7907
|
width: 100%;
|
|
7649
7908
|
`;
|
|
7650
|
-
var HierarchyContainer =
|
|
7909
|
+
var HierarchyContainer = styled38.div`
|
|
7651
7910
|
padding-left: ${(props) => `calc(${props.theme.dataPaddingLeft} * ${props.level})`};
|
|
7652
7911
|
button {
|
|
7653
7912
|
display: grid;
|
|
@@ -7666,7 +7925,7 @@ var HierarchyContainer = styled37.div`
|
|
|
7666
7925
|
cursor: pointer;
|
|
7667
7926
|
}
|
|
7668
7927
|
`;
|
|
7669
|
-
var DataGridContainer =
|
|
7928
|
+
var DataGridContainer = styled38.div`
|
|
7670
7929
|
width: 100%;
|
|
7671
7930
|
height: ${(props) => props.paginatorRendered ? `calc(100% - 50px)` : `100%`};
|
|
7672
7931
|
.rdg {
|
|
@@ -7795,9 +8054,9 @@ var DxcDataGrid = ({
|
|
|
7795
8054
|
totalItems,
|
|
7796
8055
|
defaultPage = 1
|
|
7797
8056
|
}) => {
|
|
7798
|
-
const [rowsToRender, setRowsToRender] =
|
|
7799
|
-
const colorsTheme =
|
|
7800
|
-
const [page, changePage] =
|
|
8057
|
+
const [rowsToRender, setRowsToRender] = useState18([...rows]);
|
|
8058
|
+
const colorsTheme = useContext25(HalstackContext);
|
|
8059
|
+
const [page, changePage] = useState18(defaultPage);
|
|
7801
8060
|
const goToPage = (newPage) => {
|
|
7802
8061
|
if (onPageChange) {
|
|
7803
8062
|
onPageChange(newPage);
|
|
@@ -7815,7 +8074,7 @@ var DxcDataGrid = ({
|
|
|
7815
8074
|
}
|
|
7816
8075
|
setSortColumns(newSortColumns);
|
|
7817
8076
|
};
|
|
7818
|
-
const columnsToRender =
|
|
8077
|
+
const columnsToRender = useMemo11(() => {
|
|
7819
8078
|
let expectedColumns = columns.map((column) => convertToRDGColumns(column, summaryRow));
|
|
7820
8079
|
if (expandable) {
|
|
7821
8080
|
expectedColumns = [
|
|
@@ -7832,22 +8091,29 @@ var DxcDataGrid = ({
|
|
|
7832
8091
|
if (row.isExpandedChildContent) {
|
|
7833
8092
|
return row.expandedChildContent || null;
|
|
7834
8093
|
}
|
|
7835
|
-
return /* @__PURE__ */
|
|
8094
|
+
return /* @__PURE__ */ jsx45(ActionContainer, { id: "action", children: row.expandedContent && renderExpandableTrigger(row, rowsToRender, uniqueRowId, setRowsToRender) });
|
|
7836
8095
|
}
|
|
7837
8096
|
},
|
|
7838
8097
|
...expectedColumns
|
|
7839
8098
|
];
|
|
7840
8099
|
}
|
|
7841
|
-
if (!expandable && rows.some((row) =>
|
|
8100
|
+
if (!expandable && rows.some((row) => rowHasHierarchy(row)) && uniqueRowId) {
|
|
7842
8101
|
const firstColumnKey = expectedColumns[0]?.key;
|
|
7843
8102
|
if (firstColumnKey) {
|
|
7844
8103
|
expectedColumns[0] = {
|
|
7845
8104
|
...expectedColumns[0],
|
|
7846
8105
|
renderCell({ row }) {
|
|
7847
|
-
if (row
|
|
7848
|
-
return /* @__PURE__ */
|
|
8106
|
+
if (rowHasHierarchy(row)) {
|
|
8107
|
+
return /* @__PURE__ */ jsx45(HierarchyContainer, { level: typeof row.rowLevel === "number" ? row.rowLevel : 0, children: renderHierarchyTrigger(
|
|
8108
|
+
rowsToRender,
|
|
8109
|
+
row,
|
|
8110
|
+
uniqueRowId,
|
|
8111
|
+
firstColumnKey,
|
|
8112
|
+
setRowsToRender,
|
|
8113
|
+
row.childrenTrigger
|
|
8114
|
+
) });
|
|
7849
8115
|
}
|
|
7850
|
-
return /* @__PURE__ */
|
|
8116
|
+
return /* @__PURE__ */ jsx45(HierarchyContainer, { level: typeof row.rowLevel === "number" ? row.rowLevel : 0, className: "ellipsis-cell", children: row[firstColumnKey] });
|
|
7851
8117
|
}
|
|
7852
8118
|
};
|
|
7853
8119
|
}
|
|
@@ -7862,40 +8128,35 @@ var DxcDataGrid = ({
|
|
|
7862
8128
|
minWidth: 36,
|
|
7863
8129
|
renderCell({ row }) {
|
|
7864
8130
|
if (!row.isExpandedChildContent) {
|
|
7865
|
-
return /* @__PURE__ */
|
|
8131
|
+
return /* @__PURE__ */ jsx45(ActionContainer, { id: "action", children: renderCheckbox(rows, row, uniqueRowId, selectedRows, onSelectRows) });
|
|
7866
8132
|
}
|
|
7867
8133
|
return null;
|
|
7868
8134
|
},
|
|
7869
|
-
renderHeaderCell: () => /* @__PURE__ */
|
|
8135
|
+
renderHeaderCell: () => /* @__PURE__ */ jsx45(ActionContainer, { id: "action", children: renderHeaderCheckbox(rows, uniqueRowId, selectedRows, colorsTheme, onSelectRows) })
|
|
7870
8136
|
},
|
|
7871
8137
|
...expectedColumns
|
|
7872
8138
|
];
|
|
7873
8139
|
}
|
|
7874
8140
|
return expectedColumns;
|
|
7875
8141
|
}, [selectable, expandable, columns, rowsToRender, onSelectRows, rows, summaryRow, uniqueRowId, selectedRows]);
|
|
7876
|
-
const [columnsOrder, setColumnsOrder] =
|
|
7877
|
-
const [sortColumns, setSortColumns] =
|
|
8142
|
+
const [columnsOrder, setColumnsOrder] = useState18(() => columnsToRender.map((_, index) => index));
|
|
8143
|
+
const [sortColumns, setSortColumns] = useState18([]);
|
|
7878
8144
|
useEffect8(() => {
|
|
7879
8145
|
setColumnsOrder(Array.from({ length: columnsToRender.length }, (_, index) => index));
|
|
7880
8146
|
}, [columnsToRender.length]);
|
|
7881
8147
|
useEffect8(() => {
|
|
7882
8148
|
const finalRows = [...rows];
|
|
7883
8149
|
if (expandable) {
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
expandedChildContent: row.expandedContent,
|
|
7890
|
-
triggerRowKey: rowKeyGetter(row, uniqueRowId),
|
|
7891
|
-
expandedContentHeight: row.expandedContentHeight
|
|
7892
|
-
});
|
|
7893
|
-
}
|
|
8150
|
+
finalRows.filter((row) => {
|
|
8151
|
+
const rowId = rowKeyGetter(row, uniqueRowId);
|
|
8152
|
+
return row.contentIsExpanded && !rows.some((r) => r[uniqueRowId] === `${rowId}_expanded`);
|
|
8153
|
+
}).forEach((row) => {
|
|
8154
|
+
expandRow(row, finalRows, uniqueRowId);
|
|
7894
8155
|
});
|
|
7895
8156
|
}
|
|
7896
8157
|
setRowsToRender(finalRows);
|
|
7897
8158
|
}, [rows]);
|
|
7898
|
-
const reorderedColumns =
|
|
8159
|
+
const reorderedColumns = useMemo11(
|
|
7899
8160
|
() => (
|
|
7900
8161
|
// Array ordered by columnsOrder
|
|
7901
8162
|
columnsOrder.map((index) => columnsToRender[index])
|
|
@@ -7927,7 +8188,7 @@ var DxcDataGrid = ({
|
|
|
7927
8188
|
onGridRowsChange(newRows);
|
|
7928
8189
|
}
|
|
7929
8190
|
};
|
|
7930
|
-
const sortedRows =
|
|
8191
|
+
const sortedRows = useMemo11(() => {
|
|
7931
8192
|
const sortFunctions = getCustomSortFn(columns);
|
|
7932
8193
|
if (!onSort) {
|
|
7933
8194
|
if (sortColumns.length > 0 && uniqueRowId) {
|
|
@@ -7956,19 +8217,19 @@ var DxcDataGrid = ({
|
|
|
7956
8217
|
}
|
|
7957
8218
|
return rowsToRender;
|
|
7958
8219
|
}, [expandable, rowsToRender, sortColumns, uniqueRowId]);
|
|
7959
|
-
const minItemsPerPageIndex =
|
|
7960
|
-
const maxItemsPerPageIndex =
|
|
8220
|
+
const minItemsPerPageIndex = useMemo11(() => getMinItemsPerPageIndex(page, itemsPerPage, page), [itemsPerPage, page]);
|
|
8221
|
+
const maxItemsPerPageIndex = useMemo11(
|
|
7961
8222
|
() => getMaxItemsPerPageIndex(minItemsPerPageIndex, itemsPerPage, rows, page),
|
|
7962
8223
|
[itemsPerPage, minItemsPerPageIndex, page, rows]
|
|
7963
8224
|
);
|
|
7964
|
-
const filteredRows =
|
|
8225
|
+
const filteredRows = useMemo11(() => {
|
|
7965
8226
|
if (onSort && sortColumns?.length > 0) {
|
|
7966
8227
|
onSort?.(sortColumns?.[0]);
|
|
7967
8228
|
}
|
|
7968
8229
|
return !showPaginator || onPageChange ? sortedRows : getPaginatedNodes(sortedRows, uniqueRowId, minItemsPerPageIndex, maxItemsPerPageIndex + 1);
|
|
7969
8230
|
}, [sortedRows, minItemsPerPageIndex, maxItemsPerPageIndex]);
|
|
7970
|
-
return /* @__PURE__ */
|
|
7971
|
-
/* @__PURE__ */
|
|
8231
|
+
return /* @__PURE__ */ jsx45(ThemeProvider18, { theme: colorsTheme.dataGrid, children: /* @__PURE__ */ jsxs31(DataGridContainer, { paginatorRendered: showPaginator && (totalItems ?? rows.length) > itemsPerPage, children: [
|
|
8232
|
+
/* @__PURE__ */ jsx45(
|
|
7972
8233
|
DataGrid,
|
|
7973
8234
|
{
|
|
7974
8235
|
columns: reorderedColumns,
|
|
@@ -7987,7 +8248,7 @@ var DxcDataGrid = ({
|
|
|
7987
8248
|
className: "fill-grid"
|
|
7988
8249
|
}
|
|
7989
8250
|
),
|
|
7990
|
-
showPaginator && (totalItems ?? rows.length) > itemsPerPage && /* @__PURE__ */
|
|
8251
|
+
showPaginator && (itemsPerPageOptions?.some((itemsPerPage2) => (totalItems ?? rows.length) > itemsPerPage2) || (totalItems ?? rows.length) > itemsPerPage) && /* @__PURE__ */ jsx45(
|
|
7991
8252
|
Paginator_default,
|
|
7992
8253
|
{
|
|
7993
8254
|
totalItems: totalItems ?? rows.length,
|
|
@@ -8006,28 +8267,28 @@ var DataGrid_default = DxcDataGrid;
|
|
|
8006
8267
|
|
|
8007
8268
|
// src/date-input/DateInput.tsx
|
|
8008
8269
|
import {
|
|
8009
|
-
useState as
|
|
8270
|
+
useState as useState23,
|
|
8010
8271
|
useRef as useRef12,
|
|
8011
8272
|
useEffect as useEffect13,
|
|
8012
|
-
useId as
|
|
8273
|
+
useId as useId12,
|
|
8013
8274
|
useCallback as useCallback7,
|
|
8014
|
-
useContext as
|
|
8275
|
+
useContext as useContext30,
|
|
8015
8276
|
forwardRef as forwardRef7
|
|
8016
8277
|
} from "react";
|
|
8017
8278
|
import dayjs3 from "dayjs";
|
|
8018
|
-
import
|
|
8279
|
+
import styled45, { ThemeProvider as ThemeProvider20 } from "styled-components";
|
|
8019
8280
|
import * as Popover4 from "@radix-ui/react-popover";
|
|
8020
8281
|
import customParseFormat from "dayjs/plugin/customParseFormat";
|
|
8021
8282
|
|
|
8022
8283
|
// src/date-input/DatePicker.tsx
|
|
8023
|
-
import { memo as memo7, useContext as
|
|
8284
|
+
import { memo as memo7, useContext as useContext27, useState as useState21 } from "react";
|
|
8024
8285
|
import dayjs2 from "dayjs";
|
|
8025
|
-
import
|
|
8286
|
+
import styled41 from "styled-components";
|
|
8026
8287
|
|
|
8027
8288
|
// src/date-input/Calendar.tsx
|
|
8028
|
-
import { useContext as
|
|
8029
|
-
import
|
|
8030
|
-
import { jsx as
|
|
8289
|
+
import { useContext as useContext26, useState as useState19, useMemo as useMemo12, useEffect as useEffect9, useId as useId9, memo as memo5 } from "react";
|
|
8290
|
+
import styled39 from "styled-components";
|
|
8291
|
+
import { jsx as jsx46, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
8031
8292
|
var getDays = (innerDate) => {
|
|
8032
8293
|
const monthDayCells = [];
|
|
8033
8294
|
const lastMonthNumberOfDays = innerDate.set("month", innerDate.get("month") - 1).endOf("month");
|
|
@@ -8069,11 +8330,11 @@ var Calendar = ({
|
|
|
8069
8330
|
onDaySelect,
|
|
8070
8331
|
today: today2
|
|
8071
8332
|
}) => {
|
|
8072
|
-
const [dateToFocus, setDateToFocus] =
|
|
8073
|
-
const [isFocusable, setIsFocusable] =
|
|
8074
|
-
const id =
|
|
8075
|
-
const translatedLabels =
|
|
8076
|
-
const dayCells =
|
|
8333
|
+
const [dateToFocus, setDateToFocus] = useState19(getDateToFocus(selectedDate, innerDate, today2));
|
|
8334
|
+
const [isFocusable, setIsFocusable] = useState19(false);
|
|
8335
|
+
const id = useId9();
|
|
8336
|
+
const translatedLabels = useContext26(HalstackLanguageContext);
|
|
8337
|
+
const dayCells = useMemo12(() => getDays(innerDate), [innerDate]);
|
|
8077
8338
|
const onDateClickHandler = (date) => {
|
|
8078
8339
|
const newDate = innerDate.set("month", date.month).set("date", date.day);
|
|
8079
8340
|
onDaySelect(newDate);
|
|
@@ -8167,9 +8428,9 @@ var Calendar = ({
|
|
|
8167
8428
|
break;
|
|
8168
8429
|
}
|
|
8169
8430
|
};
|
|
8170
|
-
return /* @__PURE__ */
|
|
8171
|
-
/* @__PURE__ */
|
|
8172
|
-
/* @__PURE__ */
|
|
8431
|
+
return /* @__PURE__ */ jsxs32(CalendarContainer, { role: "grid", children: [
|
|
8432
|
+
/* @__PURE__ */ jsx46(CalendarHeaderRow, { role: "row", children: translatedLabels.calendar.daysShort.map((weekDay) => /* @__PURE__ */ jsx46(WeekHeaderCell, { role: "columnheader", children: weekDay }, weekDay)) }),
|
|
8433
|
+
/* @__PURE__ */ jsx46(MonthContainer, { onBlur: handleOnBlur, role: "rowgroup", children: divideDaysIntoWeeks(dayCells, translatedLabels.calendar.daysShort.length).map((week, rowIndex) => /* @__PURE__ */ jsx46(WeekContainer, { role: "row", children: week.map((date) => /* @__PURE__ */ jsx46(
|
|
8173
8434
|
DayCellButton,
|
|
8174
8435
|
{
|
|
8175
8436
|
id: `${id}_day_${date.day}_month${date.month}`,
|
|
@@ -8188,7 +8449,7 @@ var Calendar = ({
|
|
|
8188
8449
|
)) }, `${id}_week_${rowIndex}`)) })
|
|
8189
8450
|
] });
|
|
8190
8451
|
};
|
|
8191
|
-
var CalendarContainer =
|
|
8452
|
+
var CalendarContainer = styled39.div`
|
|
8192
8453
|
box-sizing: border-box;
|
|
8193
8454
|
display: flex;
|
|
8194
8455
|
flex-direction: column;
|
|
@@ -8200,34 +8461,34 @@ var CalendarContainer = styled38.div`
|
|
|
8200
8461
|
color: ${(props) => props.theme.dateInput.pickerFontColor};
|
|
8201
8462
|
font-weight: ${(props) => props.theme.dateInput.pickerFontWeight};
|
|
8202
8463
|
`;
|
|
8203
|
-
var CalendarHeaderRow =
|
|
8464
|
+
var CalendarHeaderRow = styled39.div`
|
|
8204
8465
|
display: flex;
|
|
8205
8466
|
flex-direction: row;
|
|
8206
8467
|
flex-wrap: nowrap;
|
|
8207
8468
|
justify-content: space-between;
|
|
8208
8469
|
align-items: center;
|
|
8209
8470
|
`;
|
|
8210
|
-
var WeekHeaderCell =
|
|
8471
|
+
var WeekHeaderCell = styled39.span`
|
|
8211
8472
|
display: flex;
|
|
8212
8473
|
align-items: center;
|
|
8213
8474
|
justify-content: center;
|
|
8214
8475
|
width: 36px;
|
|
8215
8476
|
height: 36px;
|
|
8216
8477
|
`;
|
|
8217
|
-
var MonthContainer =
|
|
8478
|
+
var MonthContainer = styled39.div`
|
|
8218
8479
|
box-sizing: border-box;
|
|
8219
8480
|
display: flex;
|
|
8220
8481
|
gap: 4px;
|
|
8221
8482
|
flex-direction: column;
|
|
8222
8483
|
justify-content: space-between;
|
|
8223
8484
|
`;
|
|
8224
|
-
var WeekContainer =
|
|
8485
|
+
var WeekContainer = styled39.div`
|
|
8225
8486
|
box-sizing: border-box;
|
|
8226
8487
|
display: flex;
|
|
8227
8488
|
gap: 4px;
|
|
8228
8489
|
justify-content: space-between;
|
|
8229
8490
|
`;
|
|
8230
|
-
var DayCellButton =
|
|
8491
|
+
var DayCellButton = styled39.button`
|
|
8231
8492
|
display: inline-flex;
|
|
8232
8493
|
justify-content: center;
|
|
8233
8494
|
align-items: center;
|
|
@@ -8262,9 +8523,9 @@ var Calendar_default = memo5(Calendar);
|
|
|
8262
8523
|
|
|
8263
8524
|
// src/date-input/YearPicker.tsx
|
|
8264
8525
|
import dayjs from "dayjs";
|
|
8265
|
-
import { useEffect as useEffect10, useId as
|
|
8266
|
-
import
|
|
8267
|
-
import { jsx as
|
|
8526
|
+
import { useEffect as useEffect10, useId as useId10, useState as useState20, memo as memo6 } from "react";
|
|
8527
|
+
import styled40 from "styled-components";
|
|
8528
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
8268
8529
|
var getYearsArray = () => {
|
|
8269
8530
|
const yearList2 = [];
|
|
8270
8531
|
for (let i = 1899; i <= 2100; i++) {
|
|
@@ -8274,8 +8535,8 @@ var getYearsArray = () => {
|
|
|
8274
8535
|
};
|
|
8275
8536
|
var yearList = getYearsArray();
|
|
8276
8537
|
var YearPicker = ({ onYearSelect, selectedDate, today: today2 }) => {
|
|
8277
|
-
const id =
|
|
8278
|
-
const [yearToFocus, setYearToFocus] =
|
|
8538
|
+
const id = useId10();
|
|
8539
|
+
const [yearToFocus, setYearToFocus] = useState20(selectedDate ? selectedDate.get("year") : dayjs().get("year"));
|
|
8279
8540
|
useEffect10(() => {
|
|
8280
8541
|
const yearToFocusEl = document.getElementById(`${id}_year_${yearToFocus}`);
|
|
8281
8542
|
yearToFocusEl?.scrollIntoView?.({ block: "nearest", inline: "start" });
|
|
@@ -8293,7 +8554,7 @@ var YearPicker = ({ onYearSelect, selectedDate, today: today2 }) => {
|
|
|
8293
8554
|
break;
|
|
8294
8555
|
}
|
|
8295
8556
|
};
|
|
8296
|
-
return /* @__PURE__ */
|
|
8557
|
+
return /* @__PURE__ */ jsx47(YearPickerContainer, { role: "listbox", "aria-label": "Year Picker", children: yearList.map((year2) => /* @__PURE__ */ jsx47(
|
|
8297
8558
|
YearPickerButton,
|
|
8298
8559
|
{
|
|
8299
8560
|
"aria-label": year2.toString(),
|
|
@@ -8312,7 +8573,7 @@ var YearPicker = ({ onYearSelect, selectedDate, today: today2 }) => {
|
|
|
8312
8573
|
year2
|
|
8313
8574
|
)) });
|
|
8314
8575
|
};
|
|
8315
|
-
var YearPickerContainer =
|
|
8576
|
+
var YearPickerContainer = styled40.div`
|
|
8316
8577
|
box-sizing: border-box;
|
|
8317
8578
|
display: flex;
|
|
8318
8579
|
flex-direction: column;
|
|
@@ -8323,7 +8584,7 @@ var YearPickerContainer = styled39.div`
|
|
|
8323
8584
|
height: 312px;
|
|
8324
8585
|
padding: 2px 8px 8px 8px;
|
|
8325
8586
|
`;
|
|
8326
|
-
var YearPickerButton =
|
|
8587
|
+
var YearPickerButton = styled40.button`
|
|
8327
8588
|
display: flex;
|
|
8328
8589
|
align-items: center;
|
|
8329
8590
|
justify-content: center;
|
|
@@ -8366,13 +8627,13 @@ var YearPickerButton = styled39.button`
|
|
|
8366
8627
|
var YearPicker_default = memo6(YearPicker);
|
|
8367
8628
|
|
|
8368
8629
|
// src/date-input/DatePicker.tsx
|
|
8369
|
-
import { jsx as
|
|
8630
|
+
import { jsx as jsx48, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
8370
8631
|
var today = dayjs2();
|
|
8371
8632
|
var DatePicker = ({ date, onDateSelect, id }) => {
|
|
8372
|
-
const [innerDate, setInnerDate] =
|
|
8373
|
-
const [content, setContent] =
|
|
8633
|
+
const [innerDate, setInnerDate] = useState21(date?.isValid() ? date : dayjs2());
|
|
8634
|
+
const [content, setContent] = useState21("calendar");
|
|
8374
8635
|
const selectedDate = date?.isValid() ? date : dayjs2(null);
|
|
8375
|
-
const translatedLabels =
|
|
8636
|
+
const translatedLabels = useContext27(HalstackLanguageContext);
|
|
8376
8637
|
const handleDateSelect = (chosenDate) => {
|
|
8377
8638
|
setInnerDate(chosenDate);
|
|
8378
8639
|
onDateSelect(chosenDate);
|
|
@@ -8384,41 +8645,41 @@ var DatePicker = ({ date, onDateSelect, id }) => {
|
|
|
8384
8645
|
const handleMonthChange = (chosenDate) => {
|
|
8385
8646
|
setInnerDate(chosenDate);
|
|
8386
8647
|
};
|
|
8387
|
-
return /* @__PURE__ */
|
|
8388
|
-
/* @__PURE__ */
|
|
8389
|
-
/* @__PURE__ */
|
|
8648
|
+
return /* @__PURE__ */ jsxs33(DatePickerContainer, { id, children: [
|
|
8649
|
+
/* @__PURE__ */ jsxs33(PickerHeader, { children: [
|
|
8650
|
+
/* @__PURE__ */ jsx48(Tooltip, { label: translatedLabels.calendar.previousMonthTitle, children: /* @__PURE__ */ jsx48(
|
|
8390
8651
|
HeaderButton,
|
|
8391
8652
|
{
|
|
8392
8653
|
"aria-label": translatedLabels.calendar.previousMonthTitle,
|
|
8393
8654
|
onClick: () => handleMonthChange(innerDate.set("month", innerDate.get("month") - 1)),
|
|
8394
|
-
children: /* @__PURE__ */
|
|
8655
|
+
children: /* @__PURE__ */ jsx48(Icon_default, { icon: "keyboard_arrow_left" })
|
|
8395
8656
|
}
|
|
8396
8657
|
) }),
|
|
8397
|
-
/* @__PURE__ */
|
|
8658
|
+
/* @__PURE__ */ jsxs33(
|
|
8398
8659
|
HeaderYearTrigger,
|
|
8399
8660
|
{
|
|
8400
8661
|
"aria-live": "polite",
|
|
8401
8662
|
onClick: () => setContent((currentContent) => currentContent === "yearPicker" ? "calendar" : "yearPicker"),
|
|
8402
8663
|
children: [
|
|
8403
|
-
/* @__PURE__ */
|
|
8664
|
+
/* @__PURE__ */ jsxs33(HeaderYearTriggerLabel, { children: [
|
|
8404
8665
|
translatedLabels.calendar.months[innerDate.get("month")],
|
|
8405
8666
|
" ",
|
|
8406
8667
|
innerDate.format("YYYY")
|
|
8407
8668
|
] }),
|
|
8408
|
-
/* @__PURE__ */
|
|
8669
|
+
/* @__PURE__ */ jsx48(Icon_default, { icon: content === "yearPicker" ? "arrow_drop_up" : "arrow_drop_down" })
|
|
8409
8670
|
]
|
|
8410
8671
|
}
|
|
8411
8672
|
),
|
|
8412
|
-
/* @__PURE__ */
|
|
8673
|
+
/* @__PURE__ */ jsx48(Tooltip, { label: translatedLabels.calendar.nextMonthTitle, children: /* @__PURE__ */ jsx48(
|
|
8413
8674
|
HeaderButton,
|
|
8414
8675
|
{
|
|
8415
8676
|
"aria-label": translatedLabels.calendar.nextMonthTitle,
|
|
8416
8677
|
onClick: () => handleMonthChange(innerDate.set("month", innerDate.get("month") + 1)),
|
|
8417
|
-
children: /* @__PURE__ */
|
|
8678
|
+
children: /* @__PURE__ */ jsx48(Icon_default, { icon: "keyboard_arrow_right" })
|
|
8418
8679
|
}
|
|
8419
8680
|
) })
|
|
8420
8681
|
] }),
|
|
8421
|
-
content === "calendar" && /* @__PURE__ */
|
|
8682
|
+
content === "calendar" && /* @__PURE__ */ jsx48(
|
|
8422
8683
|
Calendar_default,
|
|
8423
8684
|
{
|
|
8424
8685
|
innerDate,
|
|
@@ -8428,10 +8689,10 @@ var DatePicker = ({ date, onDateSelect, id }) => {
|
|
|
8428
8689
|
today
|
|
8429
8690
|
}
|
|
8430
8691
|
),
|
|
8431
|
-
content === "yearPicker" && /* @__PURE__ */
|
|
8692
|
+
content === "yearPicker" && /* @__PURE__ */ jsx48(YearPicker_default, { selectedDate, onYearSelect: handleOnYearSelect, today })
|
|
8432
8693
|
] });
|
|
8433
8694
|
};
|
|
8434
|
-
var DatePickerContainer =
|
|
8695
|
+
var DatePickerContainer = styled41.div`
|
|
8435
8696
|
padding-top: 16px;
|
|
8436
8697
|
background-color: ${(props) => props.theme.dateInput.pickerBackgroundColor};
|
|
8437
8698
|
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
|
|
@@ -8444,7 +8705,7 @@ var DatePickerContainer = styled40.div`
|
|
|
8444
8705
|
color: ${(props) => props.theme.dateInput.pickerFontColor};
|
|
8445
8706
|
font-weight: ${(props) => props.theme.dateInput.pickerFontWeight};
|
|
8446
8707
|
`;
|
|
8447
|
-
var PickerHeader =
|
|
8708
|
+
var PickerHeader = styled41.div`
|
|
8448
8709
|
box-sizing: border-box;
|
|
8449
8710
|
display: flex;
|
|
8450
8711
|
gap: 8px;
|
|
@@ -8452,7 +8713,7 @@ var PickerHeader = styled40.div`
|
|
|
8452
8713
|
justify-content: space-between;
|
|
8453
8714
|
padding: 0px 16px;
|
|
8454
8715
|
`;
|
|
8455
|
-
var HeaderButton =
|
|
8716
|
+
var HeaderButton = styled41.button`
|
|
8456
8717
|
display: flex;
|
|
8457
8718
|
align-items: center;
|
|
8458
8719
|
justify-content: center;
|
|
@@ -8482,7 +8743,7 @@ var HeaderButton = styled40.button`
|
|
|
8482
8743
|
font-size: 24px;
|
|
8483
8744
|
}
|
|
8484
8745
|
`;
|
|
8485
|
-
var HeaderYearTrigger =
|
|
8746
|
+
var HeaderYearTrigger = styled41(HeaderButton)`
|
|
8486
8747
|
gap: 8px;
|
|
8487
8748
|
height: 40px;
|
|
8488
8749
|
width: 172px;
|
|
@@ -8491,7 +8752,7 @@ var HeaderYearTrigger = styled40(HeaderButton)`
|
|
|
8491
8752
|
font-size: 24px;
|
|
8492
8753
|
}
|
|
8493
8754
|
`;
|
|
8494
|
-
var HeaderYearTriggerLabel =
|
|
8755
|
+
var HeaderYearTriggerLabel = styled41.span`
|
|
8495
8756
|
display: flex;
|
|
8496
8757
|
align-items: center;
|
|
8497
8758
|
justify-content: center;
|
|
@@ -8504,25 +8765,25 @@ var DatePicker_default = memo7(DatePicker);
|
|
|
8504
8765
|
import * as Popover3 from "@radix-ui/react-popover";
|
|
8505
8766
|
import {
|
|
8506
8767
|
forwardRef as forwardRef6,
|
|
8507
|
-
useContext as
|
|
8768
|
+
useContext as useContext29,
|
|
8508
8769
|
useEffect as useEffect12,
|
|
8509
|
-
useId as
|
|
8770
|
+
useId as useId11,
|
|
8510
8771
|
useRef as useRef11,
|
|
8511
|
-
useState as
|
|
8772
|
+
useState as useState22
|
|
8512
8773
|
} from "react";
|
|
8513
|
-
import
|
|
8774
|
+
import styled44, { ThemeProvider as ThemeProvider19 } from "styled-components";
|
|
8514
8775
|
|
|
8515
8776
|
// src/number-input/NumberInputContext.tsx
|
|
8516
8777
|
import { createContext as createContext7 } from "react";
|
|
8517
8778
|
var NumberInputContext_default = createContext7(null);
|
|
8518
8779
|
|
|
8519
8780
|
// src/text-input/Suggestions.tsx
|
|
8520
|
-
import { memo as memo9, useContext as
|
|
8521
|
-
import
|
|
8781
|
+
import { memo as memo9, useContext as useContext28, useEffect as useEffect11, useRef as useRef10 } from "react";
|
|
8782
|
+
import styled43 from "styled-components";
|
|
8522
8783
|
|
|
8523
8784
|
// src/text-input/Suggestion.tsx
|
|
8524
|
-
import { memo as memo8, useMemo as
|
|
8525
|
-
import
|
|
8785
|
+
import { memo as memo8, useMemo as useMemo13 } from "react";
|
|
8786
|
+
import styled42 from "styled-components";
|
|
8526
8787
|
|
|
8527
8788
|
// src/text-input/utils.ts
|
|
8528
8789
|
var sizes4 = {
|
|
@@ -8566,8 +8827,8 @@ var transformSpecialChars = (str) => {
|
|
|
8566
8827
|
};
|
|
8567
8828
|
|
|
8568
8829
|
// src/text-input/Suggestion.tsx
|
|
8569
|
-
import { Fragment as Fragment11, jsx as
|
|
8570
|
-
var SuggestionContainer =
|
|
8830
|
+
import { Fragment as Fragment11, jsx as jsx49, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
8831
|
+
var SuggestionContainer = styled42.li`
|
|
8571
8832
|
display: flex;
|
|
8572
8833
|
padding: 0 0.5rem;
|
|
8573
8834
|
line-height: 1.715em;
|
|
@@ -8582,7 +8843,7 @@ var SuggestionContainer = styled41.li`
|
|
|
8582
8843
|
background-color: ${(props) => props.theme.activeListOptionBackgroundColor};
|
|
8583
8844
|
}
|
|
8584
8845
|
`;
|
|
8585
|
-
var StyledSuggestion =
|
|
8846
|
+
var StyledSuggestion = styled42.span`
|
|
8586
8847
|
width: 100%;
|
|
8587
8848
|
overflow: hidden;
|
|
8588
8849
|
text-overflow: ellipsis;
|
|
@@ -8599,11 +8860,11 @@ var Suggestion = ({
|
|
|
8599
8860
|
visuallyFocused,
|
|
8600
8861
|
highlighted
|
|
8601
8862
|
}) => {
|
|
8602
|
-
const matchedSuggestion =
|
|
8863
|
+
const matchedSuggestion = useMemo13(() => {
|
|
8603
8864
|
const regEx = new RegExp(transformSpecialChars(value), "i");
|
|
8604
8865
|
return { matchedWords: suggestion.match(regEx), noMatchedWords: suggestion.replace(regEx, "") };
|
|
8605
8866
|
}, [value, suggestion]);
|
|
8606
|
-
return /* @__PURE__ */
|
|
8867
|
+
return /* @__PURE__ */ jsx49(
|
|
8607
8868
|
SuggestionContainer,
|
|
8608
8869
|
{
|
|
8609
8870
|
id,
|
|
@@ -8613,8 +8874,8 @@ var Suggestion = ({
|
|
|
8613
8874
|
visuallyFocused,
|
|
8614
8875
|
role: "option",
|
|
8615
8876
|
"aria-selected": visuallyFocused ? true : void 0,
|
|
8616
|
-
children: /* @__PURE__ */
|
|
8617
|
-
/* @__PURE__ */
|
|
8877
|
+
children: /* @__PURE__ */ jsx49(StyledSuggestion, { isLast, visuallyFocused, children: highlighted ? /* @__PURE__ */ jsxs34(Fragment11, { children: [
|
|
8878
|
+
/* @__PURE__ */ jsx49("strong", { children: matchedSuggestion.matchedWords }),
|
|
8618
8879
|
matchedSuggestion.noMatchedWords
|
|
8619
8880
|
] }) : suggestion })
|
|
8620
8881
|
}
|
|
@@ -8623,8 +8884,8 @@ var Suggestion = ({
|
|
|
8623
8884
|
var Suggestion_default = memo8(Suggestion);
|
|
8624
8885
|
|
|
8625
8886
|
// src/text-input/Suggestions.tsx
|
|
8626
|
-
import { jsx as
|
|
8627
|
-
var SuggestionsContainer =
|
|
8887
|
+
import { jsx as jsx50, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
8888
|
+
var SuggestionsContainer = styled43.ul`
|
|
8628
8889
|
box-sizing: border-box;
|
|
8629
8890
|
max-height: 304px;
|
|
8630
8891
|
overflow-y: auto;
|
|
@@ -8642,13 +8903,13 @@ var SuggestionsContainer = styled42.ul`
|
|
|
8642
8903
|
font-style: ${(props) => props.theme.listOptionFontStyle};
|
|
8643
8904
|
font-weight: ${(props) => props.theme.listOptionFontWeight};
|
|
8644
8905
|
`;
|
|
8645
|
-
var SuggestionsSystemMessage =
|
|
8906
|
+
var SuggestionsSystemMessage = styled43.span`
|
|
8646
8907
|
display: flex;
|
|
8647
8908
|
padding: 0.25rem 1rem;
|
|
8648
8909
|
color: ${(props) => props.theme.systemMessageFontColor};
|
|
8649
8910
|
line-height: 1.715em;
|
|
8650
8911
|
`;
|
|
8651
|
-
var SuggestionsErrorIcon =
|
|
8912
|
+
var SuggestionsErrorIcon = styled43.span`
|
|
8652
8913
|
display: flex;
|
|
8653
8914
|
flex-wrap: wrap;
|
|
8654
8915
|
align-content: center;
|
|
@@ -8658,7 +8919,7 @@ var SuggestionsErrorIcon = styled42.span`
|
|
|
8658
8919
|
font-size: 18px;
|
|
8659
8920
|
color: ${(props) => props.theme.errorIconColor};
|
|
8660
8921
|
`;
|
|
8661
|
-
var SuggestionsError =
|
|
8922
|
+
var SuggestionsError = styled43.span`
|
|
8662
8923
|
display: flex;
|
|
8663
8924
|
padding: 0.25rem 1rem;
|
|
8664
8925
|
align-items: center;
|
|
@@ -8676,7 +8937,7 @@ var Suggestions = ({
|
|
|
8676
8937
|
suggestionOnClick,
|
|
8677
8938
|
styles
|
|
8678
8939
|
}) => {
|
|
8679
|
-
const translatedLabels =
|
|
8940
|
+
const translatedLabels = useContext28(HalstackLanguageContext);
|
|
8680
8941
|
const listboxRef = useRef10(null);
|
|
8681
8942
|
useEffect11(() => {
|
|
8682
8943
|
const visualFocusedOptionEl = listboxRef?.current?.querySelectorAll("[role='option']")[visualFocusIndex];
|
|
@@ -8685,7 +8946,7 @@ var Suggestions = ({
|
|
|
8685
8946
|
inline: "start"
|
|
8686
8947
|
});
|
|
8687
8948
|
}, [visualFocusIndex]);
|
|
8688
|
-
return /* @__PURE__ */
|
|
8949
|
+
return /* @__PURE__ */ jsxs35(
|
|
8689
8950
|
SuggestionsContainer,
|
|
8690
8951
|
{
|
|
8691
8952
|
id,
|
|
@@ -8698,7 +8959,7 @@ var Suggestions = ({
|
|
|
8698
8959
|
style: styles,
|
|
8699
8960
|
"aria-label": "Suggestions",
|
|
8700
8961
|
children: [
|
|
8701
|
-
!isSearching && !searchHasErrors && suggestions.length > 0 && suggestions.map((suggestion, index) => /* @__PURE__ */
|
|
8962
|
+
!isSearching && !searchHasErrors && suggestions.length > 0 && suggestions.map((suggestion, index) => /* @__PURE__ */ jsx50(
|
|
8702
8963
|
Suggestion_default,
|
|
8703
8964
|
{
|
|
8704
8965
|
id: `${id}-suggestion-${index}`,
|
|
@@ -8711,9 +8972,9 @@ var Suggestions = ({
|
|
|
8711
8972
|
},
|
|
8712
8973
|
`${id}-suggestion-${index}`
|
|
8713
8974
|
)),
|
|
8714
|
-
isSearching && /* @__PURE__ */
|
|
8715
|
-
searchHasErrors && /* @__PURE__ */
|
|
8716
|
-
/* @__PURE__ */
|
|
8975
|
+
isSearching && /* @__PURE__ */ jsx50(SuggestionsSystemMessage, { role: "option", children: translatedLabels.textInput.searchingMessage }),
|
|
8976
|
+
searchHasErrors && /* @__PURE__ */ jsx50("span", { role: "option", children: /* @__PURE__ */ jsxs35(SuggestionsError, { role: "alert", "aria-live": "assertive", children: [
|
|
8977
|
+
/* @__PURE__ */ jsx50(SuggestionsErrorIcon, { children: /* @__PURE__ */ jsx50(Icon_default, { icon: "filled_error" }) }),
|
|
8717
8978
|
translatedLabels.textInput.fetchingDataErrorMessage
|
|
8718
8979
|
] }) })
|
|
8719
8980
|
]
|
|
@@ -8723,8 +8984,8 @@ var Suggestions = ({
|
|
|
8723
8984
|
var Suggestions_default = memo9(Suggestions);
|
|
8724
8985
|
|
|
8725
8986
|
// src/text-input/TextInput.tsx
|
|
8726
|
-
import { Fragment as Fragment12, jsx as
|
|
8727
|
-
var TextInputContainer =
|
|
8987
|
+
import { Fragment as Fragment12, jsx as jsx51, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
8988
|
+
var TextInputContainer = styled44.div`
|
|
8728
8989
|
box-sizing: border-box;
|
|
8729
8990
|
display: flex;
|
|
8730
8991
|
flex-direction: column;
|
|
@@ -8737,7 +8998,7 @@ var TextInputContainer = styled43.div`
|
|
|
8737
8998
|
margin-left: ${(props) => props.margin && typeof props.margin === "object" && props.margin.left ? spaces[props.margin.left] : ""};
|
|
8738
8999
|
font-family: ${(props) => props.theme.fontFamily};
|
|
8739
9000
|
`;
|
|
8740
|
-
var Label4 =
|
|
9001
|
+
var Label4 = styled44.label`
|
|
8741
9002
|
color: ${(props) => props.disabled ? props.theme.disabledLabelFontColor : props.theme.labelFontColor};
|
|
8742
9003
|
font-size: ${(props) => props.theme.labelFontSize};
|
|
8743
9004
|
font-style: ${(props) => props.theme.labelFontStyle};
|
|
@@ -8745,10 +9006,10 @@ var Label4 = styled43.label`
|
|
|
8745
9006
|
line-height: ${(props) => props.theme.labelLineHeight};
|
|
8746
9007
|
${(props) => !props.hasHelperText && `margin-bottom: 0.25rem`}
|
|
8747
9008
|
`;
|
|
8748
|
-
var OptionalLabel2 =
|
|
9009
|
+
var OptionalLabel2 = styled44.span`
|
|
8749
9010
|
font-weight: ${(props) => props.theme.optionalLabelFontWeight};
|
|
8750
9011
|
`;
|
|
8751
|
-
var HelperText2 =
|
|
9012
|
+
var HelperText2 = styled44.span`
|
|
8752
9013
|
color: ${(props) => props.disabled ? props.theme.disabledHelperTextFontColor : props.theme.helperTextFontColor};
|
|
8753
9014
|
font-size: ${(props) => props.theme.helperTextFontSize};
|
|
8754
9015
|
font-style: ${(props) => props.theme.helperTextFontStyle};
|
|
@@ -8756,7 +9017,7 @@ var HelperText2 = styled43.span`
|
|
|
8756
9017
|
line-height: ${(props) => props.theme.helperTextLineHeight};
|
|
8757
9018
|
margin-bottom: 0.25rem;
|
|
8758
9019
|
`;
|
|
8759
|
-
var InputContainer =
|
|
9020
|
+
var InputContainer = styled44.div`
|
|
8760
9021
|
position: relative;
|
|
8761
9022
|
display: flex;
|
|
8762
9023
|
align-items: center;
|
|
@@ -8782,7 +9043,7 @@ var InputContainer = styled43.div`
|
|
|
8782
9043
|
}
|
|
8783
9044
|
` : "cursor: not-allowed;"};
|
|
8784
9045
|
`;
|
|
8785
|
-
var Input =
|
|
9046
|
+
var Input = styled44.input`
|
|
8786
9047
|
height: calc(2.5rem - 2px);
|
|
8787
9048
|
width: 100%;
|
|
8788
9049
|
background: none;
|
|
@@ -8799,12 +9060,13 @@ var Input = styled43.input`
|
|
|
8799
9060
|
font-weight: ${(props) => props.theme.valueFontWeight};
|
|
8800
9061
|
line-height: 1.5em;
|
|
8801
9062
|
${(props) => props.disabled && `cursor: not-allowed;`}
|
|
9063
|
+
${({ alignment }) => `text-align: ${alignment}`};
|
|
8802
9064
|
|
|
8803
9065
|
::placeholder {
|
|
8804
9066
|
color: ${(props) => props.disabled ? props.theme.disabledPlaceholderFontColor : props.theme.placeholderFontColor};
|
|
8805
9067
|
}
|
|
8806
9068
|
`;
|
|
8807
|
-
var Prefix =
|
|
9069
|
+
var Prefix = styled44.span`
|
|
8808
9070
|
height: 1.5rem;
|
|
8809
9071
|
margin-left: 0.25rem;
|
|
8810
9072
|
padding-right: ${(props) => props.theme.prefixDividerPaddingRight};
|
|
@@ -8816,7 +9078,7 @@ var Prefix = styled43.span`
|
|
|
8816
9078
|
line-height: 1.5rem;
|
|
8817
9079
|
pointer-events: none;
|
|
8818
9080
|
`;
|
|
8819
|
-
var Suffix =
|
|
9081
|
+
var Suffix = styled44.span`
|
|
8820
9082
|
height: 1.5rem;
|
|
8821
9083
|
margin: 0 0.25rem;
|
|
8822
9084
|
padding-left: ${(props) => props.theme.suffixDividerPaddingLeft};
|
|
@@ -8828,7 +9090,7 @@ var Suffix = styled43.span`
|
|
|
8828
9090
|
line-height: 1.5rem;
|
|
8829
9091
|
pointer-events: none;
|
|
8830
9092
|
`;
|
|
8831
|
-
var ErrorIcon2 =
|
|
9093
|
+
var ErrorIcon2 = styled44.span`
|
|
8832
9094
|
display: flex;
|
|
8833
9095
|
flex-wrap: wrap;
|
|
8834
9096
|
align-content: center;
|
|
@@ -8838,7 +9100,7 @@ var ErrorIcon2 = styled43.span`
|
|
|
8838
9100
|
font-size: 18px;
|
|
8839
9101
|
color: ${(props) => props.theme.errorIconColor};
|
|
8840
9102
|
`;
|
|
8841
|
-
var ErrorMessageContainer =
|
|
9103
|
+
var ErrorMessageContainer = styled44.span`
|
|
8842
9104
|
min-height: 1.5em;
|
|
8843
9105
|
color: ${(props) => props.theme.errorMessageColor};
|
|
8844
9106
|
font-size: 0.75rem;
|
|
@@ -8846,9 +9108,10 @@ var ErrorMessageContainer = styled43.span`
|
|
|
8846
9108
|
line-height: 1.5em;
|
|
8847
9109
|
margin-top: 0.25rem;
|
|
8848
9110
|
`;
|
|
8849
|
-
var AutosuggestWrapper = ({ condition, wrapper, children }) => /* @__PURE__ */
|
|
9111
|
+
var AutosuggestWrapper = ({ condition, wrapper, children }) => /* @__PURE__ */ jsx51(Fragment12, { children: condition ? wrapper(children) : children });
|
|
8850
9112
|
var DxcTextInput = forwardRef6(
|
|
8851
9113
|
({
|
|
9114
|
+
alignment = "left",
|
|
8852
9115
|
label,
|
|
8853
9116
|
name = "",
|
|
8854
9117
|
defaultValue = "",
|
|
@@ -8875,21 +9138,21 @@ var DxcTextInput = forwardRef6(
|
|
|
8875
9138
|
tabIndex = 0,
|
|
8876
9139
|
ariaLabel = "Text input"
|
|
8877
9140
|
}, ref) => {
|
|
8878
|
-
const inputId = `input-${
|
|
9141
|
+
const inputId = `input-${useId11()}`;
|
|
8879
9142
|
const autosuggestId = `suggestions-${inputId}`;
|
|
8880
9143
|
const errorId = `error-${inputId}`;
|
|
8881
|
-
const colorsTheme =
|
|
8882
|
-
const translatedLabels =
|
|
8883
|
-
const numberInputContext =
|
|
9144
|
+
const colorsTheme = useContext29(HalstackContext);
|
|
9145
|
+
const translatedLabels = useContext29(HalstackLanguageContext);
|
|
9146
|
+
const numberInputContext = useContext29(NumberInputContext_default);
|
|
8884
9147
|
const inputRef = useRef11(null);
|
|
8885
9148
|
const inputContainerRef = useRef11(null);
|
|
8886
9149
|
const actionRef = useRef11(null);
|
|
8887
|
-
const [innerValue, setInnerValue] =
|
|
8888
|
-
const [isOpen, changeIsOpen] =
|
|
8889
|
-
const [isSearching, changeIsSearching] =
|
|
8890
|
-
const [isAutosuggestError, changeIsAutosuggestError] =
|
|
8891
|
-
const [filteredSuggestions, changeFilteredSuggestions] =
|
|
8892
|
-
const [visualFocusIndex, changeVisualFocusIndex] =
|
|
9150
|
+
const [innerValue, setInnerValue] = useState22(defaultValue);
|
|
9151
|
+
const [isOpen, changeIsOpen] = useState22(false);
|
|
9152
|
+
const [isSearching, changeIsSearching] = useState22(false);
|
|
9153
|
+
const [isAutosuggestError, changeIsAutosuggestError] = useState22(false);
|
|
9154
|
+
const [filteredSuggestions, changeFilteredSuggestions] = useState22([]);
|
|
9155
|
+
const [visualFocusIndex, changeVisualFocusIndex] = useState22(-1);
|
|
8893
9156
|
const width = useWidth_default(inputContainerRef.current);
|
|
8894
9157
|
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;
|
|
8895
9158
|
const openSuggestions = () => {
|
|
@@ -9135,19 +9398,19 @@ var DxcTextInput = forwardRef6(
|
|
|
9135
9398
|
}
|
|
9136
9399
|
return void 0;
|
|
9137
9400
|
}, [value, innerValue, suggestions, numberInputContext]);
|
|
9138
|
-
return /* @__PURE__ */
|
|
9139
|
-
label && /* @__PURE__ */
|
|
9401
|
+
return /* @__PURE__ */ jsx51(ThemeProvider19, { theme: colorsTheme.textInput, children: /* @__PURE__ */ jsxs36(TextInputContainer, { margin, size, ref, children: [
|
|
9402
|
+
label && /* @__PURE__ */ jsxs36(Label4, { htmlFor: inputId, disabled, hasHelperText: !!helperText, children: [
|
|
9140
9403
|
label,
|
|
9141
9404
|
" ",
|
|
9142
|
-
optional && /* @__PURE__ */
|
|
9405
|
+
optional && /* @__PURE__ */ jsx51(OptionalLabel2, { children: translatedLabels.formFields.optionalLabel })
|
|
9143
9406
|
] }),
|
|
9144
|
-
helperText && /* @__PURE__ */
|
|
9145
|
-
/* @__PURE__ */
|
|
9407
|
+
helperText && /* @__PURE__ */ jsx51(HelperText2, { disabled, children: helperText }),
|
|
9408
|
+
/* @__PURE__ */ jsx51(
|
|
9146
9409
|
AutosuggestWrapper,
|
|
9147
9410
|
{
|
|
9148
9411
|
condition: hasSuggestions(suggestions),
|
|
9149
|
-
wrapper: (children) => /* @__PURE__ */
|
|
9150
|
-
/* @__PURE__ */
|
|
9412
|
+
wrapper: (children) => /* @__PURE__ */ jsxs36(Popover3.Root, { open: isOpen && (filteredSuggestions.length > 0 || isSearching || isAutosuggestError), children: [
|
|
9413
|
+
/* @__PURE__ */ jsx51(
|
|
9151
9414
|
Popover3.Trigger,
|
|
9152
9415
|
{
|
|
9153
9416
|
asChild: true,
|
|
@@ -9158,18 +9421,18 @@ var DxcTextInput = forwardRef6(
|
|
|
9158
9421
|
children
|
|
9159
9422
|
}
|
|
9160
9423
|
),
|
|
9161
|
-
/* @__PURE__ */
|
|
9424
|
+
/* @__PURE__ */ jsx51(Popover3.Portal, { children: /* @__PURE__ */ jsx51(
|
|
9162
9425
|
Popover3.Content,
|
|
9163
9426
|
{
|
|
9164
9427
|
sideOffset: 5,
|
|
9165
|
-
style: { zIndex: "
|
|
9428
|
+
style: { zIndex: "320" },
|
|
9166
9429
|
onOpenAutoFocus: (event) => {
|
|
9167
9430
|
event.preventDefault();
|
|
9168
9431
|
},
|
|
9169
9432
|
onCloseAutoFocus: (event) => {
|
|
9170
9433
|
event.preventDefault();
|
|
9171
9434
|
},
|
|
9172
|
-
children: /* @__PURE__ */
|
|
9435
|
+
children: /* @__PURE__ */ jsx51(
|
|
9173
9436
|
Suggestions_default,
|
|
9174
9437
|
{
|
|
9175
9438
|
id: autosuggestId,
|
|
@@ -9189,7 +9452,7 @@ var DxcTextInput = forwardRef6(
|
|
|
9189
9452
|
}
|
|
9190
9453
|
) })
|
|
9191
9454
|
] }),
|
|
9192
|
-
children: /* @__PURE__ */
|
|
9455
|
+
children: /* @__PURE__ */ jsxs36(
|
|
9193
9456
|
InputContainer,
|
|
9194
9457
|
{
|
|
9195
9458
|
error: !!error,
|
|
@@ -9199,11 +9462,12 @@ var DxcTextInput = forwardRef6(
|
|
|
9199
9462
|
onMouseDown: handleInputContainerOnMouseDown,
|
|
9200
9463
|
ref: inputContainerRef,
|
|
9201
9464
|
children: [
|
|
9202
|
-
prefix && /* @__PURE__ */
|
|
9203
|
-
/* @__PURE__ */
|
|
9204
|
-
/* @__PURE__ */
|
|
9465
|
+
prefix && /* @__PURE__ */ jsx51(Prefix, { disabled, children: prefix }),
|
|
9466
|
+
/* @__PURE__ */ jsxs36(Flex_default, { gap: "0.25rem", alignItems: "center", grow: 1, children: [
|
|
9467
|
+
/* @__PURE__ */ jsx51(
|
|
9205
9468
|
Input,
|
|
9206
9469
|
{
|
|
9470
|
+
alignment,
|
|
9207
9471
|
id: inputId,
|
|
9208
9472
|
name,
|
|
9209
9473
|
value: value ?? innerValue,
|
|
@@ -9237,8 +9501,8 @@ var DxcTextInput = forwardRef6(
|
|
|
9237
9501
|
"aria-label": label ? void 0 : ariaLabel
|
|
9238
9502
|
}
|
|
9239
9503
|
),
|
|
9240
|
-
!disabled && error && /* @__PURE__ */
|
|
9241
|
-
!disabled && !readOnly && clearable && (value ?? innerValue).length > 0 && /* @__PURE__ */
|
|
9504
|
+
!disabled && error && /* @__PURE__ */ jsx51(ErrorIcon2, { "aria-hidden": "true", children: /* @__PURE__ */ jsx51(Icon_default, { icon: "filled_error" }) }),
|
|
9505
|
+
!disabled && !readOnly && clearable && (value ?? innerValue).length > 0 && /* @__PURE__ */ jsx51(
|
|
9242
9506
|
ActionIcon_default,
|
|
9243
9507
|
{
|
|
9244
9508
|
onClick: handleClearActionOnClick,
|
|
@@ -9247,8 +9511,8 @@ var DxcTextInput = forwardRef6(
|
|
|
9247
9511
|
title: translatedLabels.textInput.clearFieldActionTitle
|
|
9248
9512
|
}
|
|
9249
9513
|
),
|
|
9250
|
-
numberInputContext?.typeNumber === "number" && numberInputContext?.showControls && /* @__PURE__ */
|
|
9251
|
-
/* @__PURE__ */
|
|
9514
|
+
numberInputContext?.typeNumber === "number" && numberInputContext?.showControls && /* @__PURE__ */ jsxs36(Fragment12, { children: [
|
|
9515
|
+
/* @__PURE__ */ jsx51(
|
|
9252
9516
|
ActionIcon_default,
|
|
9253
9517
|
{
|
|
9254
9518
|
onClick: !readOnly ? handleDecrementActionOnClick : void 0,
|
|
@@ -9259,7 +9523,7 @@ var DxcTextInput = forwardRef6(
|
|
|
9259
9523
|
disabled
|
|
9260
9524
|
}
|
|
9261
9525
|
),
|
|
9262
|
-
/* @__PURE__ */
|
|
9526
|
+
/* @__PURE__ */ jsx51(
|
|
9263
9527
|
ActionIcon_default,
|
|
9264
9528
|
{
|
|
9265
9529
|
onClick: !readOnly ? handleIncrementActionOnClick : void 0,
|
|
@@ -9271,7 +9535,7 @@ var DxcTextInput = forwardRef6(
|
|
|
9271
9535
|
}
|
|
9272
9536
|
)
|
|
9273
9537
|
] }),
|
|
9274
|
-
action && /* @__PURE__ */
|
|
9538
|
+
action && /* @__PURE__ */ jsx51(
|
|
9275
9539
|
ActionIcon_default,
|
|
9276
9540
|
{
|
|
9277
9541
|
onClick: !readOnly ? action.onClick : void 0,
|
|
@@ -9283,20 +9547,20 @@ var DxcTextInput = forwardRef6(
|
|
|
9283
9547
|
}
|
|
9284
9548
|
)
|
|
9285
9549
|
] }),
|
|
9286
|
-
suffix && /* @__PURE__ */
|
|
9550
|
+
suffix && /* @__PURE__ */ jsx51(Suffix, { disabled, children: suffix })
|
|
9287
9551
|
]
|
|
9288
9552
|
}
|
|
9289
9553
|
)
|
|
9290
9554
|
}
|
|
9291
9555
|
),
|
|
9292
|
-
!disabled && typeof error === "string" && /* @__PURE__ */
|
|
9556
|
+
!disabled && typeof error === "string" && /* @__PURE__ */ jsx51(ErrorMessageContainer, { id: errorId, role: "alert", "aria-live": error ? "assertive" : "off", children: error })
|
|
9293
9557
|
] }) });
|
|
9294
9558
|
}
|
|
9295
9559
|
);
|
|
9296
9560
|
var TextInput_default = DxcTextInput;
|
|
9297
9561
|
|
|
9298
9562
|
// src/date-input/DateInput.tsx
|
|
9299
|
-
import { jsx as
|
|
9563
|
+
import { jsx as jsx52, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
9300
9564
|
dayjs3.extend(customParseFormat);
|
|
9301
9565
|
var SIDEOFFSET = 4;
|
|
9302
9566
|
var getValueForPicker = (value, format) => dayjs3(value, format.toUpperCase(), true);
|
|
@@ -9340,16 +9604,16 @@ var DxcDateInput = forwardRef7(
|
|
|
9340
9604
|
tabIndex,
|
|
9341
9605
|
ariaLabel = "Date input"
|
|
9342
9606
|
}, ref) => {
|
|
9343
|
-
const [innerValue, setInnerValue] =
|
|
9344
|
-
const [isOpen, setIsOpen] =
|
|
9345
|
-
const calendarId = `date-picker-${
|
|
9346
|
-
const [dayjsDate, setDayjsDate] =
|
|
9347
|
-
const [lastValidYear, setLastValidYear] =
|
|
9607
|
+
const [innerValue, setInnerValue] = useState23(defaultValue);
|
|
9608
|
+
const [isOpen, setIsOpen] = useState23(false);
|
|
9609
|
+
const calendarId = `date-picker-${useId12()}`;
|
|
9610
|
+
const [dayjsDate, setDayjsDate] = useState23(getValueForPicker(value ?? defaultValue ?? "", format));
|
|
9611
|
+
const [lastValidYear, setLastValidYear] = useState23(
|
|
9348
9612
|
innerValue || value ? !format.toUpperCase().includes("YYYY") && +getValueForPicker(value ?? innerValue, format).format("YY") < 68 ? 2e3 : 1900 : null
|
|
9349
9613
|
);
|
|
9350
|
-
const [sideOffset, setSideOffset] =
|
|
9351
|
-
const colorsTheme =
|
|
9352
|
-
const translatedLabels =
|
|
9614
|
+
const [sideOffset, setSideOffset] = useState23(SIDEOFFSET);
|
|
9615
|
+
const colorsTheme = useContext30(HalstackContext);
|
|
9616
|
+
const translatedLabels = useContext30(HalstackLanguageContext);
|
|
9353
9617
|
const dateRef = useRef12(null);
|
|
9354
9618
|
const popoverContentRef = useRef12(null);
|
|
9355
9619
|
const handleCalendarOnClick = (newDate) => {
|
|
@@ -9467,8 +9731,8 @@ var DxcDateInput = forwardRef7(
|
|
|
9467
9731
|
}
|
|
9468
9732
|
}
|
|
9469
9733
|
}, [isOpen, disabled, calendarId]);
|
|
9470
|
-
return /* @__PURE__ */
|
|
9471
|
-
label && /* @__PURE__ */
|
|
9734
|
+
return /* @__PURE__ */ jsx52(ThemeProvider20, { theme: colorsTheme, children: /* @__PURE__ */ jsxs37(DateInputContainer, { margin, size, ref, children: [
|
|
9735
|
+
label && /* @__PURE__ */ jsxs37(
|
|
9472
9736
|
Label5,
|
|
9473
9737
|
{
|
|
9474
9738
|
htmlFor: dateRef.current?.getElementsByTagName("input")[0]?.id,
|
|
@@ -9477,13 +9741,13 @@ var DxcDateInput = forwardRef7(
|
|
|
9477
9741
|
children: [
|
|
9478
9742
|
label,
|
|
9479
9743
|
" ",
|
|
9480
|
-
optional && /* @__PURE__ */
|
|
9744
|
+
optional && /* @__PURE__ */ jsx52(OptionalLabel3, { children: translatedLabels.formFields.optionalLabel })
|
|
9481
9745
|
]
|
|
9482
9746
|
}
|
|
9483
9747
|
),
|
|
9484
|
-
helperText && /* @__PURE__ */
|
|
9485
|
-
/* @__PURE__ */
|
|
9486
|
-
/* @__PURE__ */
|
|
9748
|
+
helperText && /* @__PURE__ */ jsx52(HelperText3, { disabled, children: helperText }),
|
|
9749
|
+
/* @__PURE__ */ jsxs37(Popover4.Root, { open: isOpen, children: [
|
|
9750
|
+
/* @__PURE__ */ jsx52(Popover4.Trigger, { asChild: true, "aria-controls": void 0, children: /* @__PURE__ */ jsx52(
|
|
9487
9751
|
TextInput_default,
|
|
9488
9752
|
{
|
|
9489
9753
|
name,
|
|
@@ -9509,7 +9773,7 @@ var DxcDateInput = forwardRef7(
|
|
|
9509
9773
|
ariaLabel
|
|
9510
9774
|
}
|
|
9511
9775
|
) }),
|
|
9512
|
-
/* @__PURE__ */
|
|
9776
|
+
/* @__PURE__ */ jsx52(Popover4.Portal, { children: /* @__PURE__ */ jsx52(
|
|
9513
9777
|
StyledPopoverContent,
|
|
9514
9778
|
{
|
|
9515
9779
|
sideOffset,
|
|
@@ -9518,7 +9782,7 @@ var DxcDateInput = forwardRef7(
|
|
|
9518
9782
|
onBlur: handleDatePickerOnBlur,
|
|
9519
9783
|
onKeyDown: handleDatePickerEscKeydown,
|
|
9520
9784
|
ref: popoverContentRef,
|
|
9521
|
-
children: /* @__PURE__ */
|
|
9785
|
+
children: /* @__PURE__ */ jsx52(DatePicker_default, { id: calendarId, onDateSelect: handleCalendarOnClick, date: dayjsDate })
|
|
9522
9786
|
}
|
|
9523
9787
|
) })
|
|
9524
9788
|
] })
|
|
@@ -9532,7 +9796,7 @@ var sizes5 = {
|
|
|
9532
9796
|
fillParent: "100%"
|
|
9533
9797
|
};
|
|
9534
9798
|
var calculateWidth9 = (margin, size) => size === "fillParent" ? `calc(${sizes5[size]} - ${getMargin(margin, "left")} - ${getMargin(margin, "right")})` : size && sizes5[size];
|
|
9535
|
-
var DateInputContainer =
|
|
9799
|
+
var DateInputContainer = styled45.div`
|
|
9536
9800
|
${(props) => props.size === "fillParent" && "width: 100%;"}
|
|
9537
9801
|
display: flex;
|
|
9538
9802
|
flex-direction: column;
|
|
@@ -9545,7 +9809,7 @@ var DateInputContainer = styled44.div`
|
|
|
9545
9809
|
margin-left: ${(props) => props.margin && typeof props.margin === "object" && props.margin.left ? spaces[props.margin.left] : ""};
|
|
9546
9810
|
font-family: ${(props) => props.theme.textInput.fontFamily};
|
|
9547
9811
|
`;
|
|
9548
|
-
var Label5 =
|
|
9812
|
+
var Label5 = styled45.label`
|
|
9549
9813
|
color: ${(props) => props.disabled ? props.theme.textInput.disabledLabelFontColor : props.theme.textInput.labelFontColor};
|
|
9550
9814
|
font-size: ${(props) => props.theme.textInput.labelFontSize};
|
|
9551
9815
|
font-style: ${(props) => props.theme.textInput.labelFontStyle};
|
|
@@ -9553,10 +9817,10 @@ var Label5 = styled44.label`
|
|
|
9553
9817
|
line-height: ${(props) => props.theme.textInput.labelLineHeight};
|
|
9554
9818
|
${(props) => !props.hasHelperText && `margin-bottom: 0.25rem`}
|
|
9555
9819
|
`;
|
|
9556
|
-
var OptionalLabel3 =
|
|
9820
|
+
var OptionalLabel3 = styled45.span`
|
|
9557
9821
|
font-weight: ${(props) => props.theme.textInput.optionalLabelFontWeight};
|
|
9558
9822
|
`;
|
|
9559
|
-
var HelperText3 =
|
|
9823
|
+
var HelperText3 = styled45.span`
|
|
9560
9824
|
color: ${(props) => props.disabled ? props.theme.textInput.disabledHelperTextFontColor : props.theme.textInput.helperTextFontColor};
|
|
9561
9825
|
font-size: ${(props) => props.theme.textInput.helperTextFontSize};
|
|
9562
9826
|
font-style: ${(props) => props.theme.textInput.helperTextFontStyle};
|
|
@@ -9564,8 +9828,8 @@ var HelperText3 = styled44.span`
|
|
|
9564
9828
|
line-height: ${(props) => props.theme.textInput.helperTextLineHeight};
|
|
9565
9829
|
margin-bottom: 0.25rem;
|
|
9566
9830
|
`;
|
|
9567
|
-
var StyledPopoverContent =
|
|
9568
|
-
z-index:
|
|
9831
|
+
var StyledPopoverContent = styled45(Popover4.Content)`
|
|
9832
|
+
z-index: 300;
|
|
9569
9833
|
&:focus-visible {
|
|
9570
9834
|
outline: none;
|
|
9571
9835
|
}
|
|
@@ -9573,31 +9837,31 @@ var StyledPopoverContent = styled44(Popover4.Content)`
|
|
|
9573
9837
|
var DateInput_default = DxcDateInput;
|
|
9574
9838
|
|
|
9575
9839
|
// src/dialog/Dialog.tsx
|
|
9576
|
-
import { useContext as
|
|
9840
|
+
import { useContext as useContext31, useEffect as useEffect14 } from "react";
|
|
9577
9841
|
import { createPortal as createPortal2 } from "react-dom";
|
|
9578
|
-
import
|
|
9579
|
-
import { jsx as
|
|
9842
|
+
import styled46, { createGlobalStyle as createGlobalStyle2, ThemeProvider as ThemeProvider21 } from "styled-components";
|
|
9843
|
+
import { Fragment as Fragment13, jsx as jsx53, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
9580
9844
|
var BodyStyle2 = createGlobalStyle2`
|
|
9581
9845
|
body {
|
|
9582
9846
|
overflow: hidden;
|
|
9583
9847
|
}
|
|
9584
9848
|
`;
|
|
9585
|
-
var DialogContainer =
|
|
9849
|
+
var DialogContainer = styled46.div`
|
|
9586
9850
|
position: fixed;
|
|
9587
9851
|
inset: 0;
|
|
9588
9852
|
display: flex;
|
|
9589
9853
|
align-items: center;
|
|
9590
9854
|
justify-content: center;
|
|
9591
9855
|
height: 100%;
|
|
9592
|
-
z-index:
|
|
9856
|
+
z-index: 420;
|
|
9593
9857
|
`;
|
|
9594
|
-
var Overlay3 =
|
|
9858
|
+
var Overlay3 = styled46.div`
|
|
9595
9859
|
position: fixed;
|
|
9596
9860
|
inset: 0;
|
|
9597
9861
|
height: 100%;
|
|
9598
9862
|
background-color: ${(props) => props.theme.overlayColor};
|
|
9599
9863
|
`;
|
|
9600
|
-
var Dialog =
|
|
9864
|
+
var Dialog = styled46.div`
|
|
9601
9865
|
position: relative;
|
|
9602
9866
|
box-sizing: border-box;
|
|
9603
9867
|
max-width: 80%;
|
|
@@ -9606,14 +9870,13 @@ var Dialog = styled45.div`
|
|
|
9606
9870
|
background-color: ${(props) => props.theme.backgroundColor};
|
|
9607
9871
|
${(props) => props.closable && "min-height: 72px;"}
|
|
9608
9872
|
box-shadow: ${(props) => `${props.theme.boxShadowOffsetX} ${props.theme.boxShadowOffsetY} ${props.theme.boxShadowBlur} ${props.theme.boxShadowColor}`};
|
|
9609
|
-
z-index: 2147483647;
|
|
9610
9873
|
|
|
9611
9874
|
@media (max-width: ${responsiveSizes.medium}rem) {
|
|
9612
9875
|
max-width: 92%;
|
|
9613
9876
|
min-width: 92%;
|
|
9614
9877
|
}
|
|
9615
9878
|
`;
|
|
9616
|
-
var CloseIconActionContainer =
|
|
9879
|
+
var CloseIconActionContainer = styled46.div`
|
|
9617
9880
|
position: absolute;
|
|
9618
9881
|
top: 24px;
|
|
9619
9882
|
right: 24px;
|
|
@@ -9624,10 +9887,11 @@ var DxcDialog = ({
|
|
|
9624
9887
|
onBackgroundClick,
|
|
9625
9888
|
onCloseClick,
|
|
9626
9889
|
overlay = true,
|
|
9627
|
-
tabIndex = 0
|
|
9890
|
+
tabIndex = 0,
|
|
9891
|
+
disableFocusLock = false
|
|
9628
9892
|
}) => {
|
|
9629
|
-
const colorsTheme =
|
|
9630
|
-
const translatedLabels =
|
|
9893
|
+
const colorsTheme = useContext31(HalstackContext);
|
|
9894
|
+
const translatedLabels = useContext31(HalstackLanguageContext);
|
|
9631
9895
|
useEffect14(() => {
|
|
9632
9896
|
const handleKeyDown = (event) => {
|
|
9633
9897
|
if (event.key === "Escape") {
|
|
@@ -9640,31 +9904,33 @@ var DxcDialog = ({
|
|
|
9640
9904
|
document.removeEventListener("keydown", handleKeyDown);
|
|
9641
9905
|
};
|
|
9642
9906
|
}, [onCloseClick]);
|
|
9643
|
-
return /* @__PURE__ */
|
|
9644
|
-
/* @__PURE__ */
|
|
9907
|
+
return /* @__PURE__ */ jsxs38(ThemeProvider21, { theme: colorsTheme.dialog, children: [
|
|
9908
|
+
/* @__PURE__ */ jsx53(BodyStyle2, {}),
|
|
9645
9909
|
createPortal2(
|
|
9646
|
-
/* @__PURE__ */
|
|
9647
|
-
overlay && /* @__PURE__ */
|
|
9648
|
-
/* @__PURE__ */
|
|
9910
|
+
/* @__PURE__ */ jsxs38(DialogContainer, { children: [
|
|
9911
|
+
overlay && /* @__PURE__ */ jsx53(Overlay3, { onClick: onBackgroundClick }),
|
|
9912
|
+
/* @__PURE__ */ jsx53(Dialog, { "aria-label": "Dialog", "aria-modal": overlay, closable, role: "dialog", children: !disableFocusLock ? /* @__PURE__ */ jsxs38(FocusLock_default, { children: [
|
|
9649
9913
|
children,
|
|
9650
|
-
closable && /* @__PURE__ */
|
|
9651
|
-
|
|
9914
|
+
closable && /* @__PURE__ */ jsx53(CloseIconActionContainer, { children: /* @__PURE__ */ jsx53(
|
|
9915
|
+
ActionIcon_default,
|
|
9652
9916
|
{
|
|
9653
|
-
|
|
9654
|
-
|
|
9655
|
-
|
|
9656
|
-
|
|
9657
|
-
children: /* @__PURE__ */ jsx52(CloseIconActionContainer, { children: /* @__PURE__ */ jsx52(
|
|
9658
|
-
ActionIcon_default,
|
|
9659
|
-
{
|
|
9660
|
-
icon: "close",
|
|
9661
|
-
onClick: onCloseClick,
|
|
9662
|
-
tabIndex,
|
|
9663
|
-
title: translatedLabels.dialog.closeIconAriaLabel
|
|
9664
|
-
}
|
|
9665
|
-
) })
|
|
9917
|
+
icon: "close",
|
|
9918
|
+
onClick: onCloseClick,
|
|
9919
|
+
tabIndex,
|
|
9920
|
+
title: translatedLabels.dialog.closeIconAriaLabel
|
|
9666
9921
|
}
|
|
9667
|
-
)
|
|
9922
|
+
) })
|
|
9923
|
+
] }) : /* @__PURE__ */ jsxs38(Fragment13, { children: [
|
|
9924
|
+
children,
|
|
9925
|
+
closable && /* @__PURE__ */ jsx53(CloseIconActionContainer, { children: /* @__PURE__ */ jsx53(
|
|
9926
|
+
ActionIcon_default,
|
|
9927
|
+
{
|
|
9928
|
+
icon: "close",
|
|
9929
|
+
onClick: onCloseClick,
|
|
9930
|
+
tabIndex,
|
|
9931
|
+
title: translatedLabels.dialog.closeIconAriaLabel
|
|
9932
|
+
}
|
|
9933
|
+
) })
|
|
9668
9934
|
] }) })
|
|
9669
9935
|
] }),
|
|
9670
9936
|
document.body
|
|
@@ -9674,14 +9940,14 @@ var DxcDialog = ({
|
|
|
9674
9940
|
var Dialog_default = DxcDialog;
|
|
9675
9941
|
|
|
9676
9942
|
// src/file-input/FileInput.tsx
|
|
9677
|
-
import { useCallback as useCallback8, useContext as
|
|
9678
|
-
import
|
|
9943
|
+
import { useCallback as useCallback8, useContext as useContext33, useEffect as useEffect15, useId as useId14, useState as useState24, forwardRef as forwardRef8 } from "react";
|
|
9944
|
+
import styled48, { ThemeProvider as ThemeProvider22 } from "styled-components";
|
|
9679
9945
|
|
|
9680
9946
|
// src/file-input/FileItem.tsx
|
|
9681
|
-
import { memo as memo10, useContext as
|
|
9682
|
-
import
|
|
9683
|
-
import { jsx as
|
|
9684
|
-
var MainContainer3 =
|
|
9947
|
+
import { memo as memo10, useContext as useContext32, useId as useId13 } from "react";
|
|
9948
|
+
import styled47 from "styled-components";
|
|
9949
|
+
import { jsx as jsx54, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
9950
|
+
var MainContainer3 = styled47.div`
|
|
9685
9951
|
box-sizing: border-box;
|
|
9686
9952
|
display: flex;
|
|
9687
9953
|
justify-content: center;
|
|
@@ -9694,13 +9960,13 @@ var MainContainer3 = styled46.div`
|
|
|
9694
9960
|
border-style: ${(props) => props.theme.fileItemBorderStyle};
|
|
9695
9961
|
border-radius: ${(props) => props.theme.fileItemBorderRadius};
|
|
9696
9962
|
`;
|
|
9697
|
-
var ImagePreview =
|
|
9963
|
+
var ImagePreview = styled47.img`
|
|
9698
9964
|
width: 48px;
|
|
9699
9965
|
height: 48px;
|
|
9700
9966
|
border-radius: 2px;
|
|
9701
9967
|
object-fit: contain;
|
|
9702
9968
|
`;
|
|
9703
|
-
var IconPreview =
|
|
9969
|
+
var IconPreview = styled47.span`
|
|
9704
9970
|
box-sizing: border-box;
|
|
9705
9971
|
display: flex;
|
|
9706
9972
|
align-items: center;
|
|
@@ -9717,14 +9983,14 @@ var IconPreview = styled46.span`
|
|
|
9717
9983
|
width: 18px;
|
|
9718
9984
|
}
|
|
9719
9985
|
`;
|
|
9720
|
-
var FileItemContent =
|
|
9986
|
+
var FileItemContent = styled47.div`
|
|
9721
9987
|
flex-grow: 1;
|
|
9722
9988
|
display: grid;
|
|
9723
9989
|
grid-template-columns: auto min-content;
|
|
9724
9990
|
grid-template-rows: min-content auto;
|
|
9725
9991
|
column-gap: 0.25rem;
|
|
9726
9992
|
`;
|
|
9727
|
-
var FileName =
|
|
9993
|
+
var FileName = styled47.span`
|
|
9728
9994
|
align-self: center;
|
|
9729
9995
|
color: ${(props) => props.theme.fileNameFontColor};
|
|
9730
9996
|
font-family: ${(props) => props.theme.fileItemFontFamily};
|
|
@@ -9735,7 +10001,7 @@ var FileName = styled46.span`
|
|
|
9735
10001
|
overflow: hidden;
|
|
9736
10002
|
text-overflow: ellipsis;
|
|
9737
10003
|
`;
|
|
9738
|
-
var ErrorIcon3 =
|
|
10004
|
+
var ErrorIcon3 = styled47.span`
|
|
9739
10005
|
display: flex;
|
|
9740
10006
|
flex-wrap: wrap;
|
|
9741
10007
|
align-content: center;
|
|
@@ -9745,7 +10011,7 @@ var ErrorIcon3 = styled46.span`
|
|
|
9745
10011
|
font-size: 18px;
|
|
9746
10012
|
color: #d0011b;
|
|
9747
10013
|
`;
|
|
9748
|
-
var ErrorMessage =
|
|
10014
|
+
var ErrorMessage = styled47.span`
|
|
9749
10015
|
color: ${(props) => props.theme.errorMessageFontColor};
|
|
9750
10016
|
font-family: ${(props) => props.theme.errorMessageFontFamily};
|
|
9751
10017
|
font-size: ${(props) => props.theme.errorMessageFontSize};
|
|
@@ -9762,15 +10028,15 @@ var FileItem = ({
|
|
|
9762
10028
|
onDelete,
|
|
9763
10029
|
tabIndex
|
|
9764
10030
|
}) => {
|
|
9765
|
-
const translatedLabels =
|
|
9766
|
-
const fileNameId =
|
|
9767
|
-
return /* @__PURE__ */
|
|
9768
|
-
showPreview && (type.includes("image") ? /* @__PURE__ */
|
|
9769
|
-
/* @__PURE__ */
|
|
9770
|
-
/* @__PURE__ */
|
|
9771
|
-
/* @__PURE__ */
|
|
9772
|
-
error && /* @__PURE__ */
|
|
9773
|
-
/* @__PURE__ */
|
|
10031
|
+
const translatedLabels = useContext32(HalstackLanguageContext);
|
|
10032
|
+
const fileNameId = useId13();
|
|
10033
|
+
return /* @__PURE__ */ jsxs39(MainContainer3, { error, role: "listitem", singleFileMode, showPreview, children: [
|
|
10034
|
+
showPreview && (type.includes("image") ? /* @__PURE__ */ jsx54(ImagePreview, { src: preview, alt: fileName }) : /* @__PURE__ */ jsx54(IconPreview, { "aria-labelledby": fileNameId, error, role: "img", children: /* @__PURE__ */ jsx54(Icon_default, { icon: preview }) })),
|
|
10035
|
+
/* @__PURE__ */ jsxs39(FileItemContent, { children: [
|
|
10036
|
+
/* @__PURE__ */ jsx54(FileName, { id: fileNameId, children: fileName }),
|
|
10037
|
+
/* @__PURE__ */ jsxs39(Flex_default, { gap: "0.25rem", children: [
|
|
10038
|
+
error && /* @__PURE__ */ jsx54(ErrorIcon3, { children: /* @__PURE__ */ jsx54(Icon_default, { icon: "filled_error" }) }),
|
|
10039
|
+
/* @__PURE__ */ jsx54(
|
|
9774
10040
|
ActionIcon_default,
|
|
9775
10041
|
{
|
|
9776
10042
|
onClick: () => onDelete(fileName),
|
|
@@ -9780,7 +10046,7 @@ var FileItem = ({
|
|
|
9780
10046
|
}
|
|
9781
10047
|
)
|
|
9782
10048
|
] }),
|
|
9783
|
-
error && !singleFileMode && /* @__PURE__ */
|
|
10049
|
+
error && !singleFileMode && /* @__PURE__ */ jsx54(ErrorMessage, { role: "alert", "aria-live": "assertive", children: error })
|
|
9784
10050
|
] })
|
|
9785
10051
|
] });
|
|
9786
10052
|
};
|
|
@@ -9791,13 +10057,7 @@ var getFilePreview = async (file) => {
|
|
|
9791
10057
|
if (file.type.includes("video")) return "filled_movie";
|
|
9792
10058
|
else if (file.type.includes("audio")) return "music_video";
|
|
9793
10059
|
else if (file.type.includes("image")) {
|
|
9794
|
-
return
|
|
9795
|
-
const reader = new FileReader();
|
|
9796
|
-
reader.readAsDataURL(file);
|
|
9797
|
-
reader.onload = (e) => {
|
|
9798
|
-
resolve(e.target?.result);
|
|
9799
|
-
};
|
|
9800
|
-
});
|
|
10060
|
+
return Promise.resolve(URL.createObjectURL(file));
|
|
9801
10061
|
} else return "draft";
|
|
9802
10062
|
};
|
|
9803
10063
|
var isFileIncluded = (file, fileList) => {
|
|
@@ -9808,8 +10068,8 @@ var isFileIncluded = (file, fileList) => {
|
|
|
9808
10068
|
};
|
|
9809
10069
|
|
|
9810
10070
|
// src/file-input/FileInput.tsx
|
|
9811
|
-
import { jsx as
|
|
9812
|
-
var FileInputContainer =
|
|
10071
|
+
import { jsx as jsx55, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
10072
|
+
var FileInputContainer = styled48.div`
|
|
9813
10073
|
display: flex;
|
|
9814
10074
|
flex-direction: column;
|
|
9815
10075
|
margin: ${(props) => props.margin && typeof props.margin !== "object" ? spaces[props.margin] : "0px"};
|
|
@@ -9819,40 +10079,40 @@ var FileInputContainer = styled47.div`
|
|
|
9819
10079
|
margin-left: ${(props) => props.margin && typeof props.margin === "object" && props.margin.left ? spaces[props.margin.left] : ""};
|
|
9820
10080
|
width: fit-content;
|
|
9821
10081
|
`;
|
|
9822
|
-
var Label6 =
|
|
10082
|
+
var Label6 = styled48.label`
|
|
9823
10083
|
color: ${(props) => props.disabled ? props.theme.disabledLabelFontColor : props.theme.labelFontColor};
|
|
9824
10084
|
font-family: ${(props) => props.theme.labelFontFamily};
|
|
9825
10085
|
font-size: ${(props) => props.theme.labelFontSize};
|
|
9826
10086
|
font-weight: ${(props) => props.theme.labelFontWeight};
|
|
9827
10087
|
line-height: ${(props) => props.theme.labelLineHeight};
|
|
9828
10088
|
`;
|
|
9829
|
-
var HelperText4 =
|
|
10089
|
+
var HelperText4 = styled48.span`
|
|
9830
10090
|
color: ${(props) => props.disabled ? props.theme.disabledHelperTextFontColor : props.theme.helperTextFontColor};
|
|
9831
10091
|
font-family: ${(props) => props.theme.helperTextFontFamily};
|
|
9832
10092
|
font-size: ${(props) => props.theme.helperTextFontSize};
|
|
9833
10093
|
font-weight: ${(props) => props.theme.helperTextFontWeight};
|
|
9834
10094
|
line-height: ${(props) => props.theme.helperTextLineHeight};
|
|
9835
10095
|
`;
|
|
9836
|
-
var FileContainer =
|
|
10096
|
+
var FileContainer = styled48.div`
|
|
9837
10097
|
display: flex;
|
|
9838
10098
|
${(props) => props.singleFileMode ? "flex-direction: row; column-gap: 0.25rem;" : "flex-direction: column; row-gap: 0.25rem;"}
|
|
9839
10099
|
margin-top: 0.25rem;
|
|
9840
10100
|
`;
|
|
9841
|
-
var ValueInput2 =
|
|
10101
|
+
var ValueInput2 = styled48.input`
|
|
9842
10102
|
display: none;
|
|
9843
10103
|
`;
|
|
9844
|
-
var FileItemListContainer =
|
|
10104
|
+
var FileItemListContainer = styled48.div`
|
|
9845
10105
|
display: flex;
|
|
9846
10106
|
flex-direction: column;
|
|
9847
10107
|
row-gap: 0.25rem;
|
|
9848
10108
|
`;
|
|
9849
|
-
var Container2 =
|
|
10109
|
+
var Container2 = styled48.div`
|
|
9850
10110
|
display: flex;
|
|
9851
10111
|
flex-direction: column;
|
|
9852
10112
|
row-gap: 0.25rem;
|
|
9853
10113
|
margin-top: 0.25rem;
|
|
9854
10114
|
`;
|
|
9855
|
-
var DragDropArea =
|
|
10115
|
+
var DragDropArea = styled48.div`
|
|
9856
10116
|
box-sizing: border-box;
|
|
9857
10117
|
display: flex;
|
|
9858
10118
|
${(props) => props.mode === "filedrop" ? "flex-direction: row; column-gap: 0.75rem; height: 48px;" : "justify-content: center; flex-direction: column; row-gap: 0.5rem; height: 160px;"}
|
|
@@ -9872,7 +10132,7 @@ var DragDropArea = styled47.div`
|
|
|
9872
10132
|
`}
|
|
9873
10133
|
cursor: ${(props) => props.disabled && "not-allowed"};
|
|
9874
10134
|
`;
|
|
9875
|
-
var DropzoneLabel =
|
|
10135
|
+
var DropzoneLabel = styled48.div`
|
|
9876
10136
|
display: -webkit-box;
|
|
9877
10137
|
-webkit-box-orient: vertical;
|
|
9878
10138
|
overflow: hidden;
|
|
@@ -9884,7 +10144,7 @@ var DropzoneLabel = styled47.div`
|
|
|
9884
10144
|
font-size: ${(props) => props.theme.dropLabelFontSize};
|
|
9885
10145
|
font-weight: ${(props) => props.theme.dropLabelFontWeight};
|
|
9886
10146
|
`;
|
|
9887
|
-
var FiledropLabel =
|
|
10147
|
+
var FiledropLabel = styled48.span`
|
|
9888
10148
|
overflow: hidden;
|
|
9889
10149
|
white-space: nowrap;
|
|
9890
10150
|
text-overflow: ellipsis;
|
|
@@ -9893,7 +10153,7 @@ var FiledropLabel = styled47.span`
|
|
|
9893
10153
|
font-size: ${(props) => props.theme.dropLabelFontSize};
|
|
9894
10154
|
font-weight: ${(props) => props.theme.dropLabelFontWeight};
|
|
9895
10155
|
`;
|
|
9896
|
-
var ErrorMessage2 =
|
|
10156
|
+
var ErrorMessage2 = styled48.div`
|
|
9897
10157
|
color: ${(props) => props.theme.errorMessageFontColor};
|
|
9898
10158
|
font-family: ${(props) => props.theme.errorMessageFontFamily};
|
|
9899
10159
|
font-size: ${(props) => props.theme.errorMessageFontSize};
|
|
@@ -9919,11 +10179,11 @@ var DxcFileInput = forwardRef8(
|
|
|
9919
10179
|
margin,
|
|
9920
10180
|
tabIndex = 0
|
|
9921
10181
|
}, ref) => {
|
|
9922
|
-
const [isDragging, setIsDragging] =
|
|
9923
|
-
const [files, setFiles] =
|
|
9924
|
-
const fileInputId = `file-input-${
|
|
9925
|
-
const colorsTheme =
|
|
9926
|
-
const translatedLabels =
|
|
10182
|
+
const [isDragging, setIsDragging] = useState24(false);
|
|
10183
|
+
const [files, setFiles] = useState24([]);
|
|
10184
|
+
const fileInputId = `file-input-${useId14()}`;
|
|
10185
|
+
const colorsTheme = useContext33(HalstackContext);
|
|
10186
|
+
const translatedLabels = useContext33(HalstackLanguageContext);
|
|
9927
10187
|
const checkFileSize = (file) => {
|
|
9928
10188
|
if (minSize && file.size < minSize) return translatedLabels.fileInput.fileSizeGreaterThanErrorMessage;
|
|
9929
10189
|
else if (maxSize && file.size > maxSize) return translatedLabels.fileInput.fileSizeLessThanErrorMessage;
|
|
@@ -10012,11 +10272,11 @@ var DxcFileInput = forwardRef8(
|
|
|
10012
10272
|
};
|
|
10013
10273
|
getFiles();
|
|
10014
10274
|
}, [value]);
|
|
10015
|
-
return /* @__PURE__ */
|
|
10016
|
-
/* @__PURE__ */
|
|
10017
|
-
/* @__PURE__ */
|
|
10018
|
-
mode === "file" ? /* @__PURE__ */
|
|
10019
|
-
/* @__PURE__ */
|
|
10275
|
+
return /* @__PURE__ */ jsx55(ThemeProvider22, { theme: colorsTheme.fileInput, children: /* @__PURE__ */ jsxs40(FileInputContainer, { margin, ref, children: [
|
|
10276
|
+
/* @__PURE__ */ jsx55(Label6, { htmlFor: fileInputId, disabled, children: label }),
|
|
10277
|
+
/* @__PURE__ */ jsx55(HelperText4, { disabled, children: helperText }),
|
|
10278
|
+
mode === "file" ? /* @__PURE__ */ jsxs40(FileContainer, { singleFileMode: !multiple && files.length === 1, children: [
|
|
10279
|
+
/* @__PURE__ */ jsx55(
|
|
10020
10280
|
ValueInput2,
|
|
10021
10281
|
{
|
|
10022
10282
|
id: fileInputId,
|
|
@@ -10028,7 +10288,7 @@ var DxcFileInput = forwardRef8(
|
|
|
10028
10288
|
readOnly: true
|
|
10029
10289
|
}
|
|
10030
10290
|
),
|
|
10031
|
-
/* @__PURE__ */
|
|
10291
|
+
/* @__PURE__ */ jsx55(
|
|
10032
10292
|
Button_default,
|
|
10033
10293
|
{
|
|
10034
10294
|
mode: "secondary",
|
|
@@ -10039,7 +10299,7 @@ var DxcFileInput = forwardRef8(
|
|
|
10039
10299
|
tabIndex
|
|
10040
10300
|
}
|
|
10041
10301
|
),
|
|
10042
|
-
files.length > 0 && /* @__PURE__ */
|
|
10302
|
+
files.length > 0 && /* @__PURE__ */ jsx55(FileItemListContainer, { role: "list", children: files.map((file, index) => /* @__PURE__ */ jsx55(
|
|
10043
10303
|
FileItem_default,
|
|
10044
10304
|
{
|
|
10045
10305
|
fileName: file.file.name,
|
|
@@ -10053,8 +10313,8 @@ var DxcFileInput = forwardRef8(
|
|
|
10053
10313
|
},
|
|
10054
10314
|
`file-${index}`
|
|
10055
10315
|
)) })
|
|
10056
|
-
] }) : /* @__PURE__ */
|
|
10057
|
-
/* @__PURE__ */
|
|
10316
|
+
] }) : /* @__PURE__ */ jsxs40(Container2, { children: [
|
|
10317
|
+
/* @__PURE__ */ jsx55(
|
|
10058
10318
|
ValueInput2,
|
|
10059
10319
|
{
|
|
10060
10320
|
id: fileInputId,
|
|
@@ -10066,7 +10326,7 @@ var DxcFileInput = forwardRef8(
|
|
|
10066
10326
|
readOnly: true
|
|
10067
10327
|
}
|
|
10068
10328
|
),
|
|
10069
|
-
/* @__PURE__ */
|
|
10329
|
+
/* @__PURE__ */ jsxs40(
|
|
10070
10330
|
DragDropArea,
|
|
10071
10331
|
{
|
|
10072
10332
|
isDragging,
|
|
@@ -10077,7 +10337,7 @@ var DxcFileInput = forwardRef8(
|
|
|
10077
10337
|
onDragOver: handleDrag,
|
|
10078
10338
|
onDragLeave: handleDragOut,
|
|
10079
10339
|
children: [
|
|
10080
|
-
/* @__PURE__ */
|
|
10340
|
+
/* @__PURE__ */ jsx55(
|
|
10081
10341
|
Button_default,
|
|
10082
10342
|
{
|
|
10083
10343
|
mode: "secondary",
|
|
@@ -10087,11 +10347,11 @@ var DxcFileInput = forwardRef8(
|
|
|
10087
10347
|
size: { width: "fitContent" }
|
|
10088
10348
|
}
|
|
10089
10349
|
),
|
|
10090
|
-
mode === "dropzone" ? /* @__PURE__ */
|
|
10350
|
+
mode === "dropzone" ? /* @__PURE__ */ jsx55(DropzoneLabel, { disabled, children: dropAreaLabel ?? (multiple ? translatedLabels.fileInput.multipleDropAreaLabelDefault : translatedLabels.fileInput.singleDropAreaLabelDefault) }) : /* @__PURE__ */ jsx55(FiledropLabel, { disabled, children: dropAreaLabel ?? (multiple ? translatedLabels.fileInput.multipleDropAreaLabelDefault : translatedLabels.fileInput.singleDropAreaLabelDefault) })
|
|
10091
10351
|
]
|
|
10092
10352
|
}
|
|
10093
10353
|
),
|
|
10094
|
-
files.length > 0 && /* @__PURE__ */
|
|
10354
|
+
files.length > 0 && /* @__PURE__ */ jsx55(FileItemListContainer, { role: "list", children: files.map((file, index) => /* @__PURE__ */ jsx55(
|
|
10095
10355
|
FileItem_default,
|
|
10096
10356
|
{
|
|
10097
10357
|
fileName: file.file.name,
|
|
@@ -10106,16 +10366,16 @@ var DxcFileInput = forwardRef8(
|
|
|
10106
10366
|
`file-${index}`
|
|
10107
10367
|
)) })
|
|
10108
10368
|
] }),
|
|
10109
|
-
mode === "file" && !multiple && files.length === 1 && files[0]?.error && /* @__PURE__ */
|
|
10369
|
+
mode === "file" && !multiple && files.length === 1 && files[0]?.error && /* @__PURE__ */ jsx55(ErrorMessage2, { children: files[0].error })
|
|
10110
10370
|
] }) });
|
|
10111
10371
|
}
|
|
10112
10372
|
);
|
|
10113
10373
|
var FileInput_default = DxcFileInput;
|
|
10114
10374
|
|
|
10115
10375
|
// src/grid/Grid.tsx
|
|
10116
|
-
import
|
|
10117
|
-
import { jsx as
|
|
10118
|
-
var Grid =
|
|
10376
|
+
import styled49 from "styled-components";
|
|
10377
|
+
import { jsx as jsx56 } from "react/jsx-runtime";
|
|
10378
|
+
var Grid = styled49.div`
|
|
10119
10379
|
display: grid;
|
|
10120
10380
|
${(props) => `
|
|
10121
10381
|
${props.templateColumns ? `grid-template-columns: ${props.templateColumns.join(" ")};` : ""}
|
|
@@ -10133,7 +10393,7 @@ var Grid = styled48.div`
|
|
|
10133
10393
|
${props.placeSelf ? typeof props.placeSelf === "string" ? `place-self: ${props.placeSelf};` : `align-self: ${props.placeSelf.alignSelf ?? ""}; justify-self: ${props.placeSelf.justifySelf ?? ""};` : ""}
|
|
10134
10394
|
`}
|
|
10135
10395
|
`;
|
|
10136
|
-
var GridItem =
|
|
10396
|
+
var GridItem = styled49.div`
|
|
10137
10397
|
${(props) => `
|
|
10138
10398
|
${props.areaName ? `grid-area: ${props.areaName};` : ""}
|
|
10139
10399
|
${props.column ? `grid-column: ${typeof props.column === "string" || typeof props.column === "number" ? props.column : `${props.column.start} / ${props.column.end};`};` : ""}
|
|
@@ -10141,29 +10401,29 @@ var GridItem = styled48.div`
|
|
|
10141
10401
|
${props.placeSelf ? typeof props.placeSelf === "string" ? `place-self: ${props.placeSelf};` : `align-self: ${props.placeSelf.alignSelf ?? ""}; justify-self: ${props.placeSelf.justifySelf ?? ""};` : ""}
|
|
10142
10402
|
`}
|
|
10143
10403
|
`;
|
|
10144
|
-
var DxcGrid = (props) => /* @__PURE__ */
|
|
10404
|
+
var DxcGrid = (props) => /* @__PURE__ */ jsx56(Grid, { ...props });
|
|
10145
10405
|
DxcGrid.Item = GridItem;
|
|
10146
10406
|
var Grid_default = DxcGrid;
|
|
10147
10407
|
|
|
10148
10408
|
// src/heading/Heading.tsx
|
|
10149
|
-
import
|
|
10150
|
-
import { useContext as
|
|
10151
|
-
import { jsx as
|
|
10409
|
+
import styled50, { ThemeProvider as ThemeProvider23 } from "styled-components";
|
|
10410
|
+
import { useContext as useContext34 } from "react";
|
|
10411
|
+
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
10152
10412
|
var DxcHeading = ({ level = 1, text = "", as, weight, margin }) => {
|
|
10153
|
-
const colorsTheme =
|
|
10413
|
+
const colorsTheme = useContext34(HalstackContext);
|
|
10154
10414
|
const checkValidAs = () => {
|
|
10155
10415
|
if (as === "h1" || as === "h2" || as === "h3" || as === "h4" || as === "h5") return as;
|
|
10156
10416
|
};
|
|
10157
|
-
return /* @__PURE__ */
|
|
10417
|
+
return /* @__PURE__ */ jsx57(ThemeProvider23, { theme: colorsTheme.heading, children: /* @__PURE__ */ jsx57(HeadingContainer, { margin, children: level === 1 ? /* @__PURE__ */ jsx57(HeadingLevel1, { as: checkValidAs(), weight, children: text }) : level === 2 ? /* @__PURE__ */ jsx57(HeadingLevel2, { as: checkValidAs(), weight, children: text }) : level === 3 ? /* @__PURE__ */ jsx57(HeadingLevel3, { as: checkValidAs(), weight, children: text }) : level === 4 ? /* @__PURE__ */ jsx57(HeadingLevel4, { as: checkValidAs(), weight, children: text }) : /* @__PURE__ */ jsx57(HeadingLevel5, { as: checkValidAs(), weight, children: text }) }) });
|
|
10158
10418
|
};
|
|
10159
|
-
var HeadingContainer =
|
|
10419
|
+
var HeadingContainer = styled50.div`
|
|
10160
10420
|
margin: ${(props) => props.margin && typeof props.margin !== "object" ? spaces[props.margin] : "0px"};
|
|
10161
10421
|
margin-top: ${(props) => props.margin && typeof props.margin === "object" && props.margin.top ? spaces[props.margin.top] : ""};
|
|
10162
10422
|
margin-right: ${(props) => props.margin && typeof props.margin === "object" && props.margin.right ? spaces[props.margin.right] : ""};
|
|
10163
10423
|
margin-bottom: ${(props) => props.margin && typeof props.margin === "object" && props.margin.bottom ? spaces[props.margin.bottom] : ""};
|
|
10164
10424
|
margin-left: ${(props) => props.margin && typeof props.margin === "object" && props.margin.left ? spaces[props.margin.left] : ""};
|
|
10165
10425
|
`;
|
|
10166
|
-
var HeadingLevel1 =
|
|
10426
|
+
var HeadingLevel1 = styled50.h1`
|
|
10167
10427
|
font-family: ${(props) => props.theme.level1FontFamily};
|
|
10168
10428
|
font-style: ${(props) => props.theme.level1FontStyle};
|
|
10169
10429
|
font-size: ${(props) => props.theme.level1FontSize};
|
|
@@ -10173,7 +10433,7 @@ var HeadingLevel1 = styled49.h1`
|
|
|
10173
10433
|
color: ${(props) => props.theme.level1FontColor};
|
|
10174
10434
|
margin: 0;
|
|
10175
10435
|
`;
|
|
10176
|
-
var HeadingLevel2 =
|
|
10436
|
+
var HeadingLevel2 = styled50.h2`
|
|
10177
10437
|
font-family: ${(props) => props.theme.level2FontFamily};
|
|
10178
10438
|
font-style: ${(props) => props.theme.level2FontStyle};
|
|
10179
10439
|
font-size: ${(props) => props.theme.level2FontSize};
|
|
@@ -10183,7 +10443,7 @@ var HeadingLevel2 = styled49.h2`
|
|
|
10183
10443
|
color: ${(props) => props.theme.level2FontColor};
|
|
10184
10444
|
margin: 0;
|
|
10185
10445
|
`;
|
|
10186
|
-
var HeadingLevel3 =
|
|
10446
|
+
var HeadingLevel3 = styled50.h3`
|
|
10187
10447
|
font-family: ${(props) => props.theme.level3FontFamily};
|
|
10188
10448
|
font-style: ${(props) => props.theme.level3FontStyle};
|
|
10189
10449
|
font-size: ${(props) => props.theme.level3FontSize};
|
|
@@ -10193,7 +10453,7 @@ var HeadingLevel3 = styled49.h3`
|
|
|
10193
10453
|
color: ${(props) => props.theme.level3FontColor};
|
|
10194
10454
|
margin: 0;
|
|
10195
10455
|
`;
|
|
10196
|
-
var HeadingLevel4 =
|
|
10456
|
+
var HeadingLevel4 = styled50.h4`
|
|
10197
10457
|
font-family: ${(props) => props.theme.level4FontFamily};
|
|
10198
10458
|
font-style: ${(props) => props.theme.level4FontStyle};
|
|
10199
10459
|
font-size: ${(props) => props.theme.level4FontSize};
|
|
@@ -10203,7 +10463,7 @@ var HeadingLevel4 = styled49.h4`
|
|
|
10203
10463
|
color: ${(props) => props.theme.level4FontColor};
|
|
10204
10464
|
margin: 0;
|
|
10205
10465
|
`;
|
|
10206
|
-
var HeadingLevel5 =
|
|
10466
|
+
var HeadingLevel5 = styled50.h5`
|
|
10207
10467
|
font-family: ${(props) => props.theme.level5FontFamily};
|
|
10208
10468
|
font-style: ${(props) => props.theme.level5FontStyle};
|
|
10209
10469
|
font-size: ${(props) => props.theme.level5FontSize};
|
|
@@ -10216,10 +10476,10 @@ var HeadingLevel5 = styled49.h5`
|
|
|
10216
10476
|
var Heading_default = DxcHeading;
|
|
10217
10477
|
|
|
10218
10478
|
// src/image/Image.tsx
|
|
10219
|
-
import
|
|
10220
|
-
import { useContext as
|
|
10221
|
-
import { jsx as
|
|
10222
|
-
var Figure =
|
|
10479
|
+
import styled51, { ThemeProvider as ThemeProvider24 } from "styled-components";
|
|
10480
|
+
import { useContext as useContext35 } from "react";
|
|
10481
|
+
import { jsx as jsx58, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
10482
|
+
var Figure = styled51.figure`
|
|
10223
10483
|
display: flex;
|
|
10224
10484
|
flex-direction: column;
|
|
10225
10485
|
gap: 1rem;
|
|
@@ -10227,7 +10487,7 @@ var Figure = styled50.figure`
|
|
|
10227
10487
|
margin: 0;
|
|
10228
10488
|
padding: 0;
|
|
10229
10489
|
`;
|
|
10230
|
-
var CaptionContainer =
|
|
10490
|
+
var CaptionContainer = styled51.figcaption`
|
|
10231
10491
|
color: ${(props) => props.theme.captionFontColor};
|
|
10232
10492
|
font-family: ${(props) => props.theme.captionFontFamily};
|
|
10233
10493
|
font-size: ${(props) => props.theme.captionFontSize};
|
|
@@ -10235,9 +10495,9 @@ var CaptionContainer = styled50.figcaption`
|
|
|
10235
10495
|
font-weight: ${(props) => props.theme.captionFontWeight};
|
|
10236
10496
|
line-height: ${(props) => props.theme.captionLineHeight};
|
|
10237
10497
|
`;
|
|
10238
|
-
var CaptionWrapper = ({ caption, children }) => caption != null ? /* @__PURE__ */
|
|
10498
|
+
var CaptionWrapper = ({ caption, children }) => caption != null ? /* @__PURE__ */ jsxs41(Figure, { children: [
|
|
10239
10499
|
children,
|
|
10240
|
-
/* @__PURE__ */
|
|
10500
|
+
/* @__PURE__ */ jsx58(CaptionContainer, { children: caption })
|
|
10241
10501
|
] }) : children;
|
|
10242
10502
|
function DxcImage({
|
|
10243
10503
|
alt,
|
|
@@ -10253,8 +10513,8 @@ function DxcImage({
|
|
|
10253
10513
|
onLoad,
|
|
10254
10514
|
onError
|
|
10255
10515
|
}) {
|
|
10256
|
-
const colorsTheme =
|
|
10257
|
-
return /* @__PURE__ */
|
|
10516
|
+
const colorsTheme = useContext35(HalstackContext);
|
|
10517
|
+
return /* @__PURE__ */ jsx58(ThemeProvider24, { theme: colorsTheme.image, children: /* @__PURE__ */ jsx58(CaptionWrapper, { caption, children: /* @__PURE__ */ jsx58(
|
|
10258
10518
|
"img",
|
|
10259
10519
|
{
|
|
10260
10520
|
alt,
|
|
@@ -10275,16 +10535,16 @@ function DxcImage({
|
|
|
10275
10535
|
}
|
|
10276
10536
|
|
|
10277
10537
|
// src/inset/Inset.tsx
|
|
10278
|
-
import
|
|
10279
|
-
import { jsx as
|
|
10538
|
+
import styled52 from "styled-components";
|
|
10539
|
+
import { jsx as jsx59 } from "react/jsx-runtime";
|
|
10280
10540
|
var getSpacingValue2 = (spacingName) => spacingName ?? "0rem";
|
|
10281
|
-
var StyledInset =
|
|
10541
|
+
var StyledInset = styled52.div`
|
|
10282
10542
|
${({ space, horizontal, vertical, top, right, bottom, left }) => `
|
|
10283
10543
|
padding: ${getSpacingValue2(top || vertical || space)} ${getSpacingValue2(right || horizontal || space)}
|
|
10284
10544
|
${getSpacingValue2(bottom || vertical || space)} ${getSpacingValue2(left || horizontal || space)};
|
|
10285
10545
|
`}
|
|
10286
10546
|
`;
|
|
10287
|
-
var Inset = ({ space, horizontal, vertical, top, right, bottom, left, children }) => /* @__PURE__ */
|
|
10547
|
+
var Inset = ({ space, horizontal, vertical, top, right, bottom, left, children }) => /* @__PURE__ */ jsx59(
|
|
10288
10548
|
StyledInset,
|
|
10289
10549
|
{
|
|
10290
10550
|
space,
|
|
@@ -10300,10 +10560,10 @@ var Inset = ({ space, horizontal, vertical, top, right, bottom, left, children }
|
|
|
10300
10560
|
var Inset_default = Inset;
|
|
10301
10561
|
|
|
10302
10562
|
// src/link/Link.tsx
|
|
10303
|
-
import { forwardRef as forwardRef9, useContext as
|
|
10304
|
-
import
|
|
10305
|
-
import { jsx as
|
|
10306
|
-
var StyledLink =
|
|
10563
|
+
import { forwardRef as forwardRef9, useContext as useContext36 } from "react";
|
|
10564
|
+
import styled53, { ThemeProvider as ThemeProvider25 } from "styled-components";
|
|
10565
|
+
import { jsx as jsx60, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
10566
|
+
var StyledLink = styled53.a`
|
|
10307
10567
|
all: unset;
|
|
10308
10568
|
display: inline-flex;
|
|
10309
10569
|
align-items: baseline;
|
|
@@ -10340,7 +10600,7 @@ var StyledLink = styled52.a`
|
|
|
10340
10600
|
${(props) => props.disabled && "outline: none"}
|
|
10341
10601
|
}
|
|
10342
10602
|
`;
|
|
10343
|
-
var LinkContainer =
|
|
10603
|
+
var LinkContainer = styled53.span`
|
|
10344
10604
|
${(props) => `border-bottom: ${props.theme.underlineThickness} ${props.theme.underlineStyle} transparent;`}
|
|
10345
10605
|
display: inline-flex;
|
|
10346
10606
|
align-items: center;
|
|
@@ -10357,7 +10617,7 @@ var LinkContainer = styled52.span`
|
|
|
10357
10617
|
border-bottom-color: ${props.theme.activeUnderlineColor} !important;`}
|
|
10358
10618
|
}
|
|
10359
10619
|
`;
|
|
10360
|
-
var LinkIconContainer =
|
|
10620
|
+
var LinkIconContainer = styled53.div`
|
|
10361
10621
|
display: flex;
|
|
10362
10622
|
font-size: ${(props) => props.theme.iconSize};
|
|
10363
10623
|
svg {
|
|
@@ -10379,8 +10639,8 @@ var DxcLink = forwardRef9(
|
|
|
10379
10639
|
children,
|
|
10380
10640
|
...otherProps
|
|
10381
10641
|
}, ref) => {
|
|
10382
|
-
const colorsTheme =
|
|
10383
|
-
return /* @__PURE__ */
|
|
10642
|
+
const colorsTheme = useContext36(HalstackContext);
|
|
10643
|
+
return /* @__PURE__ */ jsx60(ThemeProvider25, { theme: colorsTheme.link, children: /* @__PURE__ */ jsx60(
|
|
10384
10644
|
StyledLink,
|
|
10385
10645
|
{
|
|
10386
10646
|
as: onClick && !href ? "button" : "a",
|
|
@@ -10393,9 +10653,9 @@ var DxcLink = forwardRef9(
|
|
|
10393
10653
|
margin,
|
|
10394
10654
|
ref,
|
|
10395
10655
|
...otherProps,
|
|
10396
|
-
children: /* @__PURE__ */
|
|
10656
|
+
children: /* @__PURE__ */ jsxs42(LinkContainer, { iconPosition, inheritColor, children: [
|
|
10397
10657
|
children,
|
|
10398
|
-
icon && /* @__PURE__ */
|
|
10658
|
+
icon && /* @__PURE__ */ jsx60(LinkIconContainer, { children: typeof icon === "string" ? /* @__PURE__ */ jsx60(Icon_default, { icon }) : icon })
|
|
10399
10659
|
] })
|
|
10400
10660
|
}
|
|
10401
10661
|
) });
|
|
@@ -10404,23 +10664,32 @@ var DxcLink = forwardRef9(
|
|
|
10404
10664
|
var Link_default = DxcLink;
|
|
10405
10665
|
|
|
10406
10666
|
// src/nav-tabs/NavTabs.tsx
|
|
10407
|
-
import { Children as Children4, useContext as
|
|
10408
|
-
import
|
|
10667
|
+
import { Children as Children4, useContext as useContext38, useEffect as useEffect17, useMemo as useMemo14, useRef as useRef14, useState as useState25 } from "react";
|
|
10668
|
+
import styled55, { ThemeProvider as ThemeProvider26 } from "styled-components";
|
|
10409
10669
|
|
|
10410
10670
|
// src/nav-tabs/Tab.tsx
|
|
10411
|
-
import { useEffect as useEffect16, forwardRef as forwardRef10, useContext as
|
|
10412
|
-
import
|
|
10671
|
+
import { useEffect as useEffect16, forwardRef as forwardRef10, useContext as useContext37, useRef as useRef13, useImperativeHandle } from "react";
|
|
10672
|
+
import styled54 from "styled-components";
|
|
10413
10673
|
|
|
10414
10674
|
// src/nav-tabs/NavTabsContext.tsx
|
|
10415
10675
|
import { createContext as createContext8 } from "react";
|
|
10416
10676
|
var NavTabsContext_default = createContext8(null);
|
|
10417
10677
|
|
|
10418
10678
|
// src/nav-tabs/Tab.tsx
|
|
10419
|
-
import { jsx as
|
|
10679
|
+
import { jsx as jsx61, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
10420
10680
|
var DxcTab = forwardRef10(
|
|
10421
|
-
({
|
|
10681
|
+
({
|
|
10682
|
+
href,
|
|
10683
|
+
active = false,
|
|
10684
|
+
icon,
|
|
10685
|
+
disabled = false,
|
|
10686
|
+
onClick,
|
|
10687
|
+
notificationNumber = false,
|
|
10688
|
+
children,
|
|
10689
|
+
...otherProps
|
|
10690
|
+
}, ref) => {
|
|
10422
10691
|
const tabRef = useRef13();
|
|
10423
|
-
const { iconPosition, tabIndex, focusedLabel } =
|
|
10692
|
+
const { iconPosition, tabIndex, focusedLabel } = useContext37(NavTabsContext_default) ?? {};
|
|
10424
10693
|
const innerRef = useRef13(null);
|
|
10425
10694
|
useImperativeHandle(ref, () => innerRef.current, []);
|
|
10426
10695
|
useEffect16(() => {
|
|
@@ -10439,13 +10708,17 @@ var DxcTab = forwardRef10(
|
|
|
10439
10708
|
break;
|
|
10440
10709
|
}
|
|
10441
10710
|
};
|
|
10442
|
-
return /* @__PURE__ */
|
|
10711
|
+
return /* @__PURE__ */ jsx61(TabContainer, { active, children: /* @__PURE__ */ jsxs43(
|
|
10443
10712
|
Tab,
|
|
10444
10713
|
{
|
|
10445
|
-
|
|
10714
|
+
"aria-disabled": disabled,
|
|
10715
|
+
"aria-selected": active,
|
|
10446
10716
|
disabled,
|
|
10447
10717
|
active,
|
|
10718
|
+
href: !disabled ? href : void 0,
|
|
10448
10719
|
iconPosition,
|
|
10720
|
+
onClick,
|
|
10721
|
+
onKeyDown: handleOnKeyDown,
|
|
10449
10722
|
hasIcon: icon != null,
|
|
10450
10723
|
ref: (anchorRef) => {
|
|
10451
10724
|
tabRef.current = anchorRef;
|
|
@@ -10457,17 +10730,14 @@ var DxcTab = forwardRef10(
|
|
|
10457
10730
|
}
|
|
10458
10731
|
}
|
|
10459
10732
|
},
|
|
10460
|
-
onKeyDown: handleOnKeyDown,
|
|
10461
10733
|
tabIndex: active ? tabIndex : -1,
|
|
10462
10734
|
role: "tab",
|
|
10463
|
-
"aria-selected": active,
|
|
10464
|
-
"aria-disabled": disabled,
|
|
10465
10735
|
...otherProps,
|
|
10466
10736
|
children: [
|
|
10467
|
-
icon && /* @__PURE__ */
|
|
10468
|
-
/* @__PURE__ */
|
|
10469
|
-
/* @__PURE__ */
|
|
10470
|
-
notificationNumber && !disabled && /* @__PURE__ */
|
|
10737
|
+
icon && /* @__PURE__ */ jsx61(TabIconContainer, { iconPosition, active, disabled, children: typeof icon === "string" ? /* @__PURE__ */ jsx61(Icon_default, { icon }) : icon }),
|
|
10738
|
+
/* @__PURE__ */ jsxs43(Flex_default, { alignItems: "center", gap: "0.5rem", children: [
|
|
10739
|
+
/* @__PURE__ */ jsx61(Label7, { active, disabled, children }),
|
|
10740
|
+
notificationNumber && !disabled && /* @__PURE__ */ jsx61(
|
|
10471
10741
|
Badge_default,
|
|
10472
10742
|
{
|
|
10473
10743
|
mode: "notification",
|
|
@@ -10481,12 +10751,12 @@ var DxcTab = forwardRef10(
|
|
|
10481
10751
|
) });
|
|
10482
10752
|
}
|
|
10483
10753
|
);
|
|
10484
|
-
var TabContainer =
|
|
10754
|
+
var TabContainer = styled54.div`
|
|
10485
10755
|
align-items: stretch;
|
|
10486
10756
|
border-bottom: 2px solid ${(props) => props.active ? props.theme.selectedUnderlineColor : "transparent"};
|
|
10487
10757
|
padding: 0.5rem;
|
|
10488
10758
|
`;
|
|
10489
|
-
var Tab =
|
|
10759
|
+
var Tab = styled54.a`
|
|
10490
10760
|
box-sizing: border-box;
|
|
10491
10761
|
display: flex;
|
|
10492
10762
|
flex-direction: ${(props) => props.hasIcon && props.iconPosition === "top" ? "column" : "row"};
|
|
@@ -10516,7 +10786,7 @@ var Tab = styled53.a`
|
|
|
10516
10786
|
}
|
|
10517
10787
|
`}
|
|
10518
10788
|
`;
|
|
10519
|
-
var Label7 =
|
|
10789
|
+
var Label7 = styled54.span`
|
|
10520
10790
|
display: inline;
|
|
10521
10791
|
color: ${(props) => props.disabled ? props.theme.disabledFontColor : props.active ? props.theme.selectedFontColor : props.theme.unselectedFontColor};
|
|
10522
10792
|
font-family: ${(props) => props.theme.fontFamily};
|
|
@@ -10531,7 +10801,7 @@ var Label7 = styled53.span`
|
|
|
10531
10801
|
white-space: normal;
|
|
10532
10802
|
margin: 0;
|
|
10533
10803
|
`;
|
|
10534
|
-
var TabIconContainer =
|
|
10804
|
+
var TabIconContainer = styled54.div`
|
|
10535
10805
|
display: flex;
|
|
10536
10806
|
font-size: 24px;
|
|
10537
10807
|
color: ${(props) => props.active ? props.theme.selectedIconColor : props.disabled ? props.theme.disabledIconColor : props.theme.unselectedIconColor};
|
|
@@ -10543,7 +10813,7 @@ var TabIconContainer = styled53.div`
|
|
|
10543
10813
|
var Tab_default = DxcTab;
|
|
10544
10814
|
|
|
10545
10815
|
// src/nav-tabs/NavTabs.tsx
|
|
10546
|
-
import { jsx as
|
|
10816
|
+
import { jsx as jsx62, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
10547
10817
|
var getPropInChild = (child, propName) => {
|
|
10548
10818
|
if (child && typeof child === "object" && "props" in child) {
|
|
10549
10819
|
const childWithProps = child;
|
|
@@ -10581,17 +10851,17 @@ var getNextTabIndex = (array, initialIndex) => {
|
|
|
10581
10851
|
return index;
|
|
10582
10852
|
};
|
|
10583
10853
|
var DxcNavTabs = ({ iconPosition = "top", tabIndex = 0, children }) => {
|
|
10584
|
-
const [innerFocusIndex, setInnerFocusIndex] =
|
|
10585
|
-
const [underlineWidth, setUnderlineWidth] =
|
|
10854
|
+
const [innerFocusIndex, setInnerFocusIndex] = useState25(null);
|
|
10855
|
+
const [underlineWidth, setUnderlineWidth] = useState25(null);
|
|
10586
10856
|
const refNavTabList = useRef14(null);
|
|
10587
|
-
const colorsTheme =
|
|
10857
|
+
const colorsTheme = useContext38(HalstackContext);
|
|
10588
10858
|
const childArray = Children4.toArray(children).filter(
|
|
10589
10859
|
(child) => typeof child === "object" && "props" in child
|
|
10590
10860
|
);
|
|
10591
10861
|
useEffect17(() => {
|
|
10592
10862
|
setUnderlineWidth(refNavTabList?.current?.scrollWidth ?? null);
|
|
10593
10863
|
}, [children]);
|
|
10594
|
-
const contextValue =
|
|
10864
|
+
const contextValue = useMemo14(
|
|
10595
10865
|
() => ({
|
|
10596
10866
|
iconPosition,
|
|
10597
10867
|
tabIndex,
|
|
@@ -10616,12 +10886,12 @@ var DxcNavTabs = ({ iconPosition = "top", tabIndex = 0, children }) => {
|
|
|
10616
10886
|
break;
|
|
10617
10887
|
}
|
|
10618
10888
|
};
|
|
10619
|
-
return /* @__PURE__ */
|
|
10620
|
-
/* @__PURE__ */
|
|
10621
|
-
/* @__PURE__ */
|
|
10889
|
+
return /* @__PURE__ */ jsx62(ThemeProvider26, { theme: colorsTheme.navTabs, children: /* @__PURE__ */ jsxs44(NavTabsContainer, { onKeyDown: handleOnKeyDown, ref: refNavTabList, role: "tablist", "aria-label": "Navigation tabs", children: [
|
|
10890
|
+
/* @__PURE__ */ jsx62(NavTabsContext_default.Provider, { value: contextValue, children }),
|
|
10891
|
+
/* @__PURE__ */ jsx62(Underline, { underlineWidth: underlineWidth ?? 0 })
|
|
10622
10892
|
] }) });
|
|
10623
10893
|
};
|
|
10624
|
-
var Underline =
|
|
10894
|
+
var Underline = styled55.div`
|
|
10625
10895
|
position: absolute;
|
|
10626
10896
|
bottom: 0;
|
|
10627
10897
|
left: 0;
|
|
@@ -10631,7 +10901,7 @@ var Underline = styled54.div`
|
|
|
10631
10901
|
width: ${(props) => props.underlineWidth}px;
|
|
10632
10902
|
`;
|
|
10633
10903
|
DxcNavTabs.Tab = Tab_default;
|
|
10634
|
-
var NavTabsContainer =
|
|
10904
|
+
var NavTabsContainer = styled55.div`
|
|
10635
10905
|
display: flex;
|
|
10636
10906
|
position: relative;
|
|
10637
10907
|
overflow: auto;
|
|
@@ -10640,9 +10910,9 @@ var NavTabsContainer = styled54.div`
|
|
|
10640
10910
|
var NavTabs_default = DxcNavTabs;
|
|
10641
10911
|
|
|
10642
10912
|
// src/number-input/NumberInput.tsx
|
|
10643
|
-
import { forwardRef as forwardRef11, useEffect as useEffect18, useMemo as
|
|
10644
|
-
import
|
|
10645
|
-
import { jsx as
|
|
10913
|
+
import { forwardRef as forwardRef11, useEffect as useEffect18, useMemo as useMemo15, useRef as useRef15 } from "react";
|
|
10914
|
+
import styled56 from "styled-components";
|
|
10915
|
+
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
10646
10916
|
var DxcNumberInput = forwardRef11(
|
|
10647
10917
|
({
|
|
10648
10918
|
label,
|
|
@@ -10670,7 +10940,7 @@ var DxcNumberInput = forwardRef11(
|
|
|
10670
10940
|
showControls = true
|
|
10671
10941
|
}, ref) => {
|
|
10672
10942
|
const numberInputRef = useRef15(null);
|
|
10673
|
-
const contextValue =
|
|
10943
|
+
const contextValue = useMemo15(
|
|
10674
10944
|
() => ({
|
|
10675
10945
|
maxNumber: max,
|
|
10676
10946
|
minNumber: min,
|
|
@@ -10690,7 +10960,7 @@ var DxcNumberInput = forwardRef11(
|
|
|
10690
10960
|
input?.removeEventListener("wheel", preventDefault);
|
|
10691
10961
|
};
|
|
10692
10962
|
}, []);
|
|
10693
|
-
return /* @__PURE__ */
|
|
10963
|
+
return /* @__PURE__ */ jsx63(NumberInputContext_default.Provider, { value: contextValue, children: /* @__PURE__ */ jsx63(NumberInputContainer, { ref: numberInputRef, size, children: /* @__PURE__ */ jsx63(
|
|
10694
10964
|
TextInput_default,
|
|
10695
10965
|
{
|
|
10696
10966
|
label,
|
|
@@ -10717,7 +10987,7 @@ var DxcNumberInput = forwardRef11(
|
|
|
10717
10987
|
) }) });
|
|
10718
10988
|
}
|
|
10719
10989
|
);
|
|
10720
|
-
var NumberInputContainer =
|
|
10990
|
+
var NumberInputContainer = styled56.div`
|
|
10721
10991
|
${(props) => props.size === "fillParent" && "width: 100%;"}
|
|
10722
10992
|
// Chrome, Safari, Edge, Opera
|
|
10723
10993
|
input::-webkit-outer-spin-button,
|
|
@@ -10734,10 +11004,10 @@ var NumberInputContainer = styled55.div`
|
|
|
10734
11004
|
var NumberInput_default = DxcNumberInput;
|
|
10735
11005
|
|
|
10736
11006
|
// src/paragraph/Paragraph.tsx
|
|
10737
|
-
import { useContext as
|
|
10738
|
-
import
|
|
10739
|
-
import { jsx as
|
|
10740
|
-
var Paragraph =
|
|
11007
|
+
import { useContext as useContext39 } from "react";
|
|
11008
|
+
import styled57, { ThemeProvider as ThemeProvider27 } from "styled-components";
|
|
11009
|
+
import { jsx as jsx64 } from "react/jsx-runtime";
|
|
11010
|
+
var Paragraph = styled57.p`
|
|
10741
11011
|
display: ${(props) => props.theme.display};
|
|
10742
11012
|
font-family: "Open Sans", sans-serif;
|
|
10743
11013
|
font-size: ${(props) => props.theme.fontSize};
|
|
@@ -10753,14 +11023,14 @@ var Paragraph = styled56.p`
|
|
|
10753
11023
|
margin: 0;
|
|
10754
11024
|
`;
|
|
10755
11025
|
function DxcParagraph({ children }) {
|
|
10756
|
-
const colorsTheme =
|
|
10757
|
-
return /* @__PURE__ */
|
|
11026
|
+
const colorsTheme = useContext39(HalstackContext);
|
|
11027
|
+
return /* @__PURE__ */ jsx64(ThemeProvider27, { theme: colorsTheme.paragraph, children: /* @__PURE__ */ jsx64(Paragraph, { children }) });
|
|
10758
11028
|
}
|
|
10759
11029
|
|
|
10760
11030
|
// src/password-input/PasswordInput.tsx
|
|
10761
|
-
import { forwardRef as forwardRef12, useContext as
|
|
10762
|
-
import
|
|
10763
|
-
import { jsx as
|
|
11031
|
+
import { forwardRef as forwardRef12, useContext as useContext40, useEffect as useEffect19, useRef as useRef16, useState as useState26 } from "react";
|
|
11032
|
+
import styled58 from "styled-components";
|
|
11033
|
+
import { jsx as jsx65 } from "react/jsx-runtime";
|
|
10764
11034
|
var setInputType = (type, element) => {
|
|
10765
11035
|
element?.getElementsByTagName("input")[0]?.setAttribute("type", type);
|
|
10766
11036
|
};
|
|
@@ -10787,9 +11057,9 @@ var DxcPasswordInput = forwardRef12(
|
|
|
10787
11057
|
tabIndex = 0,
|
|
10788
11058
|
ariaLabel = "Password input"
|
|
10789
11059
|
}, ref) => {
|
|
10790
|
-
const [isPasswordVisible, setIsPasswordVisible] =
|
|
11060
|
+
const [isPasswordVisible, setIsPasswordVisible] = useState26(false);
|
|
10791
11061
|
const inputRef = useRef16(null);
|
|
10792
|
-
const { passwordInput } =
|
|
11062
|
+
const { passwordInput } = useContext40(HalstackLanguageContext);
|
|
10793
11063
|
useEffect19(() => {
|
|
10794
11064
|
(() => {
|
|
10795
11065
|
if (isPasswordVisible) {
|
|
@@ -10805,7 +11075,7 @@ var DxcPasswordInput = forwardRef12(
|
|
|
10805
11075
|
}
|
|
10806
11076
|
})();
|
|
10807
11077
|
}, [isPasswordVisible, passwordInput]);
|
|
10808
|
-
return /* @__PURE__ */
|
|
11078
|
+
return /* @__PURE__ */ jsx65(PasswordInput, { ref, role: "group", size, children: /* @__PURE__ */ jsx65(
|
|
10809
11079
|
TextInput_default,
|
|
10810
11080
|
{
|
|
10811
11081
|
label,
|
|
@@ -10836,7 +11106,7 @@ var DxcPasswordInput = forwardRef12(
|
|
|
10836
11106
|
) });
|
|
10837
11107
|
}
|
|
10838
11108
|
);
|
|
10839
|
-
var PasswordInput =
|
|
11109
|
+
var PasswordInput = styled58.div`
|
|
10840
11110
|
${(props) => props.size === "fillParent" && "width: 100%;"}
|
|
10841
11111
|
& ::-ms-reveal {
|
|
10842
11112
|
display: none;
|
|
@@ -10845,10 +11115,10 @@ var PasswordInput = styled57.div`
|
|
|
10845
11115
|
var PasswordInput_default = DxcPasswordInput;
|
|
10846
11116
|
|
|
10847
11117
|
// src/progress-bar/ProgressBar.tsx
|
|
10848
|
-
import { useContext as
|
|
10849
|
-
import
|
|
10850
|
-
import { jsx as
|
|
10851
|
-
var Overlay4 =
|
|
11118
|
+
import { useContext as useContext41, useEffect as useEffect20, useId as useId15, useState as useState27 } from "react";
|
|
11119
|
+
import styled59, { ThemeProvider as ThemeProvider28 } from "styled-components";
|
|
11120
|
+
import { jsx as jsx66, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
11121
|
+
var Overlay4 = styled59.div`
|
|
10852
11122
|
${({ overlay, theme }) => overlay ? `background-color: ${theme.overlayColor};
|
|
10853
11123
|
width: 100%;
|
|
10854
11124
|
justify-content: center;
|
|
@@ -10860,13 +11130,13 @@ var Overlay4 = styled58.div`
|
|
|
10860
11130
|
bottom: 0;
|
|
10861
11131
|
left: 0;
|
|
10862
11132
|
right: 0;
|
|
10863
|
-
z-index:
|
|
11133
|
+
z-index: 410;` : `background-color: transparent;`}
|
|
10864
11134
|
display: flex;
|
|
10865
11135
|
flex-wrap: wrap;
|
|
10866
11136
|
min-width: 100px;
|
|
10867
11137
|
width: 100%;
|
|
10868
11138
|
`;
|
|
10869
|
-
var MainContainer4 =
|
|
11139
|
+
var MainContainer4 = styled59.div`
|
|
10870
11140
|
width: ${(props) => props.overlay ? "80%" : "100%"};
|
|
10871
11141
|
margin: ${(props) => props.margin && typeof props.margin !== "object" ? spaces[props.margin] : "0px"};
|
|
10872
11142
|
margin-top: ${(props) => props.margin && typeof props.margin === "object" && props.margin.top ? spaces[props.margin.top] : ""};
|
|
@@ -10876,9 +11146,9 @@ var MainContainer4 = styled58.div`
|
|
|
10876
11146
|
display: flex;
|
|
10877
11147
|
flex-direction: column;
|
|
10878
11148
|
gap: 0.5rem;
|
|
10879
|
-
z-index: ${(props) => props.overlay ? "
|
|
11149
|
+
z-index: ${(props) => props.overlay ? "1" : "0"};
|
|
10880
11150
|
`;
|
|
10881
|
-
var ProgressBarLabel =
|
|
11151
|
+
var ProgressBarLabel = styled59.div`
|
|
10882
11152
|
font-family: ${(props) => props.theme.labelFontFamily};
|
|
10883
11153
|
font-style: ${(props) => props.theme.labelFontStyle};
|
|
10884
11154
|
font-size: ${(props) => props.theme.labelFontSize};
|
|
@@ -10890,7 +11160,7 @@ var ProgressBarLabel = styled58.div`
|
|
|
10890
11160
|
white-space: nowrap;
|
|
10891
11161
|
text-overflow: ellipsis;
|
|
10892
11162
|
`;
|
|
10893
|
-
var ProgressBarProgress =
|
|
11163
|
+
var ProgressBarProgress = styled59.div`
|
|
10894
11164
|
flex-shrink: 0;
|
|
10895
11165
|
color: ${(props) => props.overlay ? props.theme.overlayFontColor : props.theme.valueFontColor};
|
|
10896
11166
|
font-family: ${(props) => props.theme.valueFontFamily};
|
|
@@ -10899,7 +11169,7 @@ var ProgressBarProgress = styled58.div`
|
|
|
10899
11169
|
font-weight: ${(props) => props.theme.valueFontWeight};
|
|
10900
11170
|
text-transform: ${(props) => props.theme.valueFontTextTransform};
|
|
10901
11171
|
`;
|
|
10902
|
-
var HelperText5 =
|
|
11172
|
+
var HelperText5 = styled59.span`
|
|
10903
11173
|
color: ${(props) => props.overlay ? props.theme.overlayFontColor : props.theme.helperTextFontColor};
|
|
10904
11174
|
font-family: ${(props) => props.theme.helperTextFontFamily};
|
|
10905
11175
|
font-size: ${(props) => props.theme.helperTextFontSize};
|
|
@@ -10907,14 +11177,14 @@ var HelperText5 = styled58.span`
|
|
|
10907
11177
|
font-weight: ${(props) => props.theme.helperTextFontWeight};
|
|
10908
11178
|
line-height: 1.5em;
|
|
10909
11179
|
`;
|
|
10910
|
-
var LinearProgress =
|
|
11180
|
+
var LinearProgress = styled59.div`
|
|
10911
11181
|
position: relative;
|
|
10912
11182
|
border-radius: ${(props) => props.theme.borderRadius};
|
|
10913
11183
|
height: ${(props) => props.theme.thickness};
|
|
10914
11184
|
background-color: ${(props) => props.theme.totalLineColor};
|
|
10915
11185
|
overflow: hidden;
|
|
10916
11186
|
`;
|
|
10917
|
-
var LinearProgressBar =
|
|
11187
|
+
var LinearProgressBar = styled59.span`
|
|
10918
11188
|
position: absolute;
|
|
10919
11189
|
top: 0;
|
|
10920
11190
|
bottom: 0;
|
|
@@ -10965,21 +11235,21 @@ var DxcProgressBar = ({
|
|
|
10965
11235
|
margin,
|
|
10966
11236
|
ariaLabel = "Progress bar"
|
|
10967
11237
|
}) => {
|
|
10968
|
-
const colorsTheme =
|
|
10969
|
-
const labelId = `label-${
|
|
10970
|
-
const [innerValue, setInnerValue] =
|
|
11238
|
+
const colorsTheme = useContext41(HalstackContext);
|
|
11239
|
+
const labelId = `label-${useId15()}`;
|
|
11240
|
+
const [innerValue, setInnerValue] = useState27();
|
|
10971
11241
|
useEffect20(() => {
|
|
10972
11242
|
if (value != null) setInnerValue(value < 0 ? 0 : value > 100 ? 100 : value);
|
|
10973
11243
|
}, [value]);
|
|
10974
|
-
return /* @__PURE__ */
|
|
10975
|
-
/* @__PURE__ */
|
|
10976
|
-
label && /* @__PURE__ */
|
|
10977
|
-
innerValue != null && showValue && /* @__PURE__ */
|
|
11244
|
+
return /* @__PURE__ */ jsx66(ThemeProvider28, { theme: colorsTheme.progressBar, children: /* @__PURE__ */ jsx66(Overlay4, { overlay, children: /* @__PURE__ */ jsxs45(MainContainer4, { overlay, margin, children: [
|
|
11245
|
+
/* @__PURE__ */ jsxs45(Flex_default, { justifyContent: "space-between", gap: "0.5rem", children: [
|
|
11246
|
+
label && /* @__PURE__ */ jsx66(ProgressBarLabel, { id: labelId, overlay, children: label }),
|
|
11247
|
+
innerValue != null && showValue && /* @__PURE__ */ jsxs45(ProgressBarProgress, { overlay, children: [
|
|
10978
11248
|
innerValue,
|
|
10979
11249
|
" %"
|
|
10980
11250
|
] })
|
|
10981
11251
|
] }),
|
|
10982
|
-
/* @__PURE__ */
|
|
11252
|
+
/* @__PURE__ */ jsx66(
|
|
10983
11253
|
LinearProgress,
|
|
10984
11254
|
{
|
|
10985
11255
|
role: "progressbar",
|
|
@@ -10989,27 +11259,27 @@ var DxcProgressBar = ({
|
|
|
10989
11259
|
"aria-valuenow": innerValue,
|
|
10990
11260
|
"aria-valuemin": 0,
|
|
10991
11261
|
"aria-valuemax": 100,
|
|
10992
|
-
children: /* @__PURE__ */
|
|
11262
|
+
children: /* @__PURE__ */ jsx66(LinearProgressBar, { variant: innerValue == null ? "indeterminate" : "determinate", value: innerValue })
|
|
10993
11263
|
}
|
|
10994
11264
|
),
|
|
10995
|
-
helperText && /* @__PURE__ */
|
|
11265
|
+
helperText && /* @__PURE__ */ jsx66(HelperText5, { overlay, children: helperText })
|
|
10996
11266
|
] }) }) });
|
|
10997
11267
|
};
|
|
10998
11268
|
var ProgressBar_default = DxcProgressBar;
|
|
10999
11269
|
|
|
11000
11270
|
// src/quick-nav/QuickNav.tsx
|
|
11001
|
-
import { useContext as
|
|
11271
|
+
import { useContext as useContext42 } from "react";
|
|
11002
11272
|
import slugify from "slugify";
|
|
11003
|
-
import
|
|
11004
|
-
import { jsx as
|
|
11273
|
+
import styled60, { ThemeProvider as ThemeProvider29 } from "styled-components";
|
|
11274
|
+
import { jsx as jsx67, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
11005
11275
|
var DxcQuickNav = ({ title, links }) => {
|
|
11006
|
-
const translatedLabels =
|
|
11007
|
-
const colorsTheme =
|
|
11008
|
-
return /* @__PURE__ */
|
|
11009
|
-
/* @__PURE__ */
|
|
11010
|
-
/* @__PURE__ */
|
|
11011
|
-
/* @__PURE__ */
|
|
11012
|
-
/* @__PURE__ */
|
|
11276
|
+
const translatedLabels = useContext42(HalstackLanguageContext);
|
|
11277
|
+
const colorsTheme = useContext42(HalstackContext);
|
|
11278
|
+
return /* @__PURE__ */ jsx67(ThemeProvider29, { theme: colorsTheme.quickNav, children: /* @__PURE__ */ jsx67(QuickNavContainer, { children: /* @__PURE__ */ jsxs46(Flex_default, { direction: "column", gap: "0.5rem", children: [
|
|
11279
|
+
/* @__PURE__ */ jsx67(Heading_default, { level: 4, text: title || translatedLabels.quickNav.contentTitle }),
|
|
11280
|
+
/* @__PURE__ */ jsx67(ListColumn, { children: links.map((link) => /* @__PURE__ */ jsx67("li", { children: /* @__PURE__ */ jsx67(Inset_default, { space: "0.25rem", children: /* @__PURE__ */ jsxs46(DxcTypography, { children: [
|
|
11281
|
+
/* @__PURE__ */ jsx67(Link3, { href: `#${slugify(link.label, { lower: true })}`, children: link.label }),
|
|
11282
|
+
/* @__PURE__ */ jsx67(ListSecondColumn, { children: link.links?.map((sublink) => /* @__PURE__ */ jsx67("li", { children: /* @__PURE__ */ jsx67(Inset_default, { horizontal: "0.5rem", children: /* @__PURE__ */ jsx67(DxcTypography, { children: /* @__PURE__ */ jsx67(
|
|
11013
11283
|
Link3,
|
|
11014
11284
|
{
|
|
11015
11285
|
href: `#${slugify(link?.label, { lower: true })}-${slugify(sublink?.label, {
|
|
@@ -11021,14 +11291,14 @@ var DxcQuickNav = ({ title, links }) => {
|
|
|
11021
11291
|
] }) }) }, link.label)) })
|
|
11022
11292
|
] }) }) });
|
|
11023
11293
|
};
|
|
11024
|
-
var QuickNavContainer =
|
|
11294
|
+
var QuickNavContainer = styled60.div`
|
|
11025
11295
|
padding-top: ${(props) => props.theme.paddingTop};
|
|
11026
11296
|
padding-bottom: ${(props) => props.theme.paddingBottom};
|
|
11027
11297
|
padding-left: ${(props) => props.theme.paddingLeft};
|
|
11028
11298
|
padding-right: ${(props) => props.theme.paddingRight};
|
|
11029
11299
|
border-left: 2px solid ${(props) => props.theme.dividerBorderColor};
|
|
11030
11300
|
`;
|
|
11031
|
-
var ListColumn =
|
|
11301
|
+
var ListColumn = styled60.ul`
|
|
11032
11302
|
display: flex;
|
|
11033
11303
|
flex-direction: column;
|
|
11034
11304
|
gap: 0.5rem;
|
|
@@ -11036,14 +11306,14 @@ var ListColumn = styled59.ul`
|
|
|
11036
11306
|
padding: 0;
|
|
11037
11307
|
list-style-type: none;
|
|
11038
11308
|
`;
|
|
11039
|
-
var ListSecondColumn =
|
|
11309
|
+
var ListSecondColumn = styled60.ul`
|
|
11040
11310
|
display: flex;
|
|
11041
11311
|
flex-direction: column;
|
|
11042
11312
|
margin: 0;
|
|
11043
11313
|
padding: 0;
|
|
11044
11314
|
list-style-type: none;
|
|
11045
11315
|
`;
|
|
11046
|
-
var Link3 =
|
|
11316
|
+
var Link3 = styled60.a`
|
|
11047
11317
|
text-decoration: none;
|
|
11048
11318
|
font-size: ${(props) => props.theme.fontSize};
|
|
11049
11319
|
font-family: ${(props) => props.theme.fontFamily};
|
|
@@ -11070,13 +11340,13 @@ var Link3 = styled59.a`
|
|
|
11070
11340
|
var QuickNav_default = DxcQuickNav;
|
|
11071
11341
|
|
|
11072
11342
|
// src/radio-group/RadioGroup.tsx
|
|
11073
|
-
import { forwardRef as forwardRef13, useCallback as useCallback10, useContext as
|
|
11074
|
-
import
|
|
11343
|
+
import { forwardRef as forwardRef13, useCallback as useCallback10, useContext as useContext44, useId as useId17, useMemo as useMemo16, useState as useState29 } from "react";
|
|
11344
|
+
import styled62, { ThemeProvider as ThemeProvider31 } from "styled-components";
|
|
11075
11345
|
|
|
11076
11346
|
// src/radio-group/Radio.tsx
|
|
11077
|
-
import { memo as memo11, useContext as
|
|
11078
|
-
import
|
|
11079
|
-
import { jsx as
|
|
11347
|
+
import { memo as memo11, useContext as useContext43, useEffect as useEffect21, useId as useId16, useRef as useRef17, useState as useState28 } from "react";
|
|
11348
|
+
import styled61, { ThemeProvider as ThemeProvider30 } from "styled-components";
|
|
11349
|
+
import { jsx as jsx68, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
11080
11350
|
var DxcRadio = ({
|
|
11081
11351
|
label,
|
|
11082
11352
|
checked,
|
|
@@ -11087,14 +11357,14 @@ var DxcRadio = ({
|
|
|
11087
11357
|
readOnly,
|
|
11088
11358
|
tabIndex
|
|
11089
11359
|
}) => {
|
|
11090
|
-
const radioLabelId = `radio-${
|
|
11360
|
+
const radioLabelId = `radio-${useId16()}`;
|
|
11091
11361
|
const ref = useRef17(null);
|
|
11092
|
-
const colorsTheme =
|
|
11362
|
+
const colorsTheme = useContext43(HalstackContext);
|
|
11093
11363
|
const handleOnClick = () => {
|
|
11094
11364
|
onClick();
|
|
11095
11365
|
document.activeElement !== ref.current && ref.current?.focus();
|
|
11096
11366
|
};
|
|
11097
|
-
const [firstUpdate, setFirstUpdate] =
|
|
11367
|
+
const [firstUpdate, setFirstUpdate] = useState28(true);
|
|
11098
11368
|
useEffect21(() => {
|
|
11099
11369
|
if (firstUpdate) {
|
|
11100
11370
|
setFirstUpdate(false);
|
|
@@ -11102,7 +11372,7 @@ var DxcRadio = ({
|
|
|
11102
11372
|
}
|
|
11103
11373
|
focused && ref.current?.focus();
|
|
11104
11374
|
}, [focused]);
|
|
11105
|
-
return /* @__PURE__ */
|
|
11375
|
+
return /* @__PURE__ */ jsx68(ThemeProvider30, { theme: colorsTheme.radioGroup, children: /* @__PURE__ */ jsx68(Flex_default, { children: /* @__PURE__ */ jsxs47(
|
|
11106
11376
|
RadioContainer,
|
|
11107
11377
|
{
|
|
11108
11378
|
error,
|
|
@@ -11110,7 +11380,7 @@ var DxcRadio = ({
|
|
|
11110
11380
|
readOnly,
|
|
11111
11381
|
onClick: disabled ? void 0 : handleOnClick,
|
|
11112
11382
|
children: [
|
|
11113
|
-
/* @__PURE__ */
|
|
11383
|
+
/* @__PURE__ */ jsx68(RadioInputContainer, { children: /* @__PURE__ */ jsx68(
|
|
11114
11384
|
RadioInput,
|
|
11115
11385
|
{
|
|
11116
11386
|
error,
|
|
@@ -11122,10 +11392,10 @@ var DxcRadio = ({
|
|
|
11122
11392
|
"aria-labelledby": radioLabelId,
|
|
11123
11393
|
tabIndex: disabled ? -1 : focused ? tabIndex : -1,
|
|
11124
11394
|
ref,
|
|
11125
|
-
children: checked && /* @__PURE__ */
|
|
11395
|
+
children: checked && /* @__PURE__ */ jsx68(Dot, { disabled, readOnly, error })
|
|
11126
11396
|
}
|
|
11127
11397
|
) }),
|
|
11128
|
-
/* @__PURE__ */
|
|
11398
|
+
/* @__PURE__ */ jsx68(Label8, { id: radioLabelId, disabled, children: label })
|
|
11129
11399
|
]
|
|
11130
11400
|
}
|
|
11131
11401
|
) }) });
|
|
@@ -11140,14 +11410,14 @@ var getRadioInputStateColor = (props, state) => {
|
|
|
11140
11410
|
return props.error ? props.theme.activeErrorRadioInputColor : props.readOnly ? props.theme.activeReadOnlyRadioInputColor : props.theme.activeRadioInputColor;
|
|
11141
11411
|
}
|
|
11142
11412
|
};
|
|
11143
|
-
var RadioInputContainer =
|
|
11413
|
+
var RadioInputContainer = styled61.span`
|
|
11144
11414
|
display: flex;
|
|
11145
11415
|
align-items: center;
|
|
11146
11416
|
justify-content: center;
|
|
11147
11417
|
height: 24px;
|
|
11148
11418
|
width: 24px;
|
|
11149
11419
|
`;
|
|
11150
|
-
var RadioInput =
|
|
11420
|
+
var RadioInput = styled61.span`
|
|
11151
11421
|
box-sizing: border-box;
|
|
11152
11422
|
display: flex;
|
|
11153
11423
|
align-items: center;
|
|
@@ -11163,13 +11433,13 @@ var RadioInput = styled60.span`
|
|
|
11163
11433
|
}
|
|
11164
11434
|
${(props) => props.disabled && "pointer-events: none;"}
|
|
11165
11435
|
`;
|
|
11166
|
-
var Dot =
|
|
11436
|
+
var Dot = styled61.span`
|
|
11167
11437
|
height: 10px;
|
|
11168
11438
|
width: 10px;
|
|
11169
11439
|
border-radius: 50%;
|
|
11170
11440
|
background-color: ${(props) => getRadioInputStateColor(props, "enabled")};
|
|
11171
11441
|
`;
|
|
11172
|
-
var Label8 =
|
|
11442
|
+
var Label8 = styled61.span`
|
|
11173
11443
|
margin-left: ${(props) => props.theme.radioInputLabelMargin};
|
|
11174
11444
|
font-family: ${(props) => props.theme.fontFamily};
|
|
11175
11445
|
font-size: ${(props) => props.theme.radioInputLabelFontSize};
|
|
@@ -11178,7 +11448,7 @@ var Label8 = styled60.span`
|
|
|
11178
11448
|
line-height: ${(props) => props.theme.radioInputLabelLineHeight};
|
|
11179
11449
|
${(props) => props.disabled ? `color: ${props.theme.disabledRadioInputLabelFontColor};` : `color: ${props.theme.radioInputLabelFontColor}`}
|
|
11180
11450
|
`;
|
|
11181
|
-
var RadioContainer =
|
|
11451
|
+
var RadioContainer = styled61.span`
|
|
11182
11452
|
display: inline-flex;
|
|
11183
11453
|
align-items: center;
|
|
11184
11454
|
cursor: ${(props) => props.disabled ? "not-allowed" : props.readOnly ? "default" : "pointer"};
|
|
@@ -11203,7 +11473,7 @@ var RadioContainer = styled60.span`
|
|
|
11203
11473
|
var Radio_default = memo11(DxcRadio);
|
|
11204
11474
|
|
|
11205
11475
|
// src/radio-group/RadioGroup.tsx
|
|
11206
|
-
import { jsx as
|
|
11476
|
+
import { jsx as jsx69, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
11207
11477
|
var getInitialFocusIndex = (innerOptions, value) => {
|
|
11208
11478
|
const initialSelectedOptionIndex = innerOptions.findIndex((option) => option.value === value);
|
|
11209
11479
|
return initialSelectedOptionIndex !== -1 ? initialSelectedOptionIndex : 0;
|
|
@@ -11227,14 +11497,14 @@ var DxcRadioGroup = forwardRef13(
|
|
|
11227
11497
|
tabIndex = 0,
|
|
11228
11498
|
ariaLabel = "Radio group"
|
|
11229
11499
|
}, ref) => {
|
|
11230
|
-
const radioGroupId = `radio-group-${
|
|
11500
|
+
const radioGroupId = `radio-group-${useId17()}`;
|
|
11231
11501
|
const radioGroupLabelId = `label-${radioGroupId}`;
|
|
11232
11502
|
const errorId = `error-${radioGroupId}`;
|
|
11233
|
-
const [innerValue, setInnerValue] =
|
|
11234
|
-
const [firstTimeFocus, setFirstTimeFocus] =
|
|
11235
|
-
const colorsTheme =
|
|
11236
|
-
const translatedLabels =
|
|
11237
|
-
const innerOptions =
|
|
11503
|
+
const [innerValue, setInnerValue] = useState29(defaultValue);
|
|
11504
|
+
const [firstTimeFocus, setFirstTimeFocus] = useState29(true);
|
|
11505
|
+
const colorsTheme = useContext44(HalstackContext);
|
|
11506
|
+
const translatedLabels = useContext44(HalstackLanguageContext);
|
|
11507
|
+
const innerOptions = useMemo16(
|
|
11238
11508
|
() => optional ? [
|
|
11239
11509
|
...options,
|
|
11240
11510
|
{
|
|
@@ -11245,7 +11515,7 @@ var DxcRadioGroup = forwardRef13(
|
|
|
11245
11515
|
] : options,
|
|
11246
11516
|
[optional, options, optionalItemLabel, translatedLabels]
|
|
11247
11517
|
);
|
|
11248
|
-
const [currentFocusIndex, setCurrentFocusIndex] =
|
|
11518
|
+
const [currentFocusIndex, setCurrentFocusIndex] = useState29(getInitialFocusIndex(innerOptions, value ?? innerValue));
|
|
11249
11519
|
const handleOnChange = useCallback10(
|
|
11250
11520
|
(newValue) => {
|
|
11251
11521
|
const currentValue = value ?? innerValue;
|
|
@@ -11329,13 +11599,13 @@ var DxcRadioGroup = forwardRef13(
|
|
|
11329
11599
|
break;
|
|
11330
11600
|
}
|
|
11331
11601
|
};
|
|
11332
|
-
return /* @__PURE__ */
|
|
11333
|
-
label && /* @__PURE__ */
|
|
11602
|
+
return /* @__PURE__ */ jsx69(ThemeProvider31, { theme: colorsTheme.radioGroup, children: /* @__PURE__ */ jsxs48(RadioGroupContainer, { ref, children: [
|
|
11603
|
+
label && /* @__PURE__ */ jsxs48(Label9, { id: radioGroupLabelId, helperText, disabled, children: [
|
|
11334
11604
|
label,
|
|
11335
|
-
optional && /* @__PURE__ */
|
|
11605
|
+
optional && /* @__PURE__ */ jsx69(OptionalLabel4, { children: ` ${translatedLabels.formFields.optionalLabel}` })
|
|
11336
11606
|
] }),
|
|
11337
|
-
helperText && /* @__PURE__ */
|
|
11338
|
-
/* @__PURE__ */
|
|
11607
|
+
helperText && /* @__PURE__ */ jsx69(HelperText6, { disabled, children: helperText }),
|
|
11608
|
+
/* @__PURE__ */ jsxs48(
|
|
11339
11609
|
RadioGroup,
|
|
11340
11610
|
{
|
|
11341
11611
|
onBlur: handleOnBlur,
|
|
@@ -11352,8 +11622,8 @@ var DxcRadioGroup = forwardRef13(
|
|
|
11352
11622
|
"aria-orientation": stacking === "column" ? "vertical" : "horizontal",
|
|
11353
11623
|
"aria-label": label ? void 0 : ariaLabel,
|
|
11354
11624
|
children: [
|
|
11355
|
-
/* @__PURE__ */
|
|
11356
|
-
innerOptions.map((option, index) => /* @__PURE__ */
|
|
11625
|
+
/* @__PURE__ */ jsx69(ValueInput3, { name, disabled, value: value ?? innerValue ?? "", readOnly: true }),
|
|
11626
|
+
innerOptions.map((option, index) => /* @__PURE__ */ jsx69(
|
|
11357
11627
|
Radio_default,
|
|
11358
11628
|
{
|
|
11359
11629
|
label: option.label ?? "",
|
|
@@ -11373,16 +11643,16 @@ var DxcRadioGroup = forwardRef13(
|
|
|
11373
11643
|
]
|
|
11374
11644
|
}
|
|
11375
11645
|
),
|
|
11376
|
-
!disabled && typeof error === "string" && /* @__PURE__ */
|
|
11646
|
+
!disabled && typeof error === "string" && /* @__PURE__ */ jsx69(ErrorMessageContainer2, { id: errorId, role: "alert", "aria-live": error ? "assertive" : "off", children: error })
|
|
11377
11647
|
] }) });
|
|
11378
11648
|
}
|
|
11379
11649
|
);
|
|
11380
|
-
var RadioGroupContainer =
|
|
11650
|
+
var RadioGroupContainer = styled62.div`
|
|
11381
11651
|
box-sizing: border-box;
|
|
11382
11652
|
display: inline-flex;
|
|
11383
11653
|
flex-direction: column;
|
|
11384
11654
|
`;
|
|
11385
|
-
var Label9 =
|
|
11655
|
+
var Label9 = styled62.span`
|
|
11386
11656
|
color: ${(props) => props.disabled ? props.theme.disabledLabelFontColor : props.theme.labelFontColor};
|
|
11387
11657
|
font-family: ${(props) => props.theme.fontFamily};
|
|
11388
11658
|
font-size: ${(props) => props.theme.labelFontSize};
|
|
@@ -11391,10 +11661,10 @@ var Label9 = styled61.span`
|
|
|
11391
11661
|
line-height: ${(props) => props.theme.labelLineHeight};
|
|
11392
11662
|
${(props) => !props.helperText && `margin-bottom: ${props.theme.groupLabelMargin}`}
|
|
11393
11663
|
`;
|
|
11394
|
-
var OptionalLabel4 =
|
|
11664
|
+
var OptionalLabel4 = styled62.span`
|
|
11395
11665
|
font-weight: ${(props) => props.theme.optionalLabelFontWeight};
|
|
11396
11666
|
`;
|
|
11397
|
-
var HelperText6 =
|
|
11667
|
+
var HelperText6 = styled62.span`
|
|
11398
11668
|
color: ${(props) => props.disabled ? props.theme.disabledHelperTextFontColor : props.theme.helperTextFontColor};
|
|
11399
11669
|
font-family: ${(props) => props.theme.fontFamily};
|
|
11400
11670
|
font-size: ${(props) => props.theme.helperTextFontSize};
|
|
@@ -11403,17 +11673,17 @@ var HelperText6 = styled61.span`
|
|
|
11403
11673
|
line-height: ${(props) => props.theme.helperTextLineHeight};
|
|
11404
11674
|
margin-bottom: ${(props) => props.theme.groupLabelMargin};
|
|
11405
11675
|
`;
|
|
11406
|
-
var RadioGroup =
|
|
11676
|
+
var RadioGroup = styled62.div`
|
|
11407
11677
|
display: flex;
|
|
11408
11678
|
flex-wrap: wrap;
|
|
11409
11679
|
flex-direction: ${(props) => props.stacking};
|
|
11410
11680
|
row-gap: ${(props) => props.theme.groupVerticalGutter};
|
|
11411
11681
|
column-gap: ${(props) => props.theme.groupHorizontalGutter};
|
|
11412
11682
|
`;
|
|
11413
|
-
var ValueInput3 =
|
|
11683
|
+
var ValueInput3 = styled62.input`
|
|
11414
11684
|
display: none;
|
|
11415
11685
|
`;
|
|
11416
|
-
var ErrorMessageContainer2 =
|
|
11686
|
+
var ErrorMessageContainer2 = styled62.span`
|
|
11417
11687
|
min-height: 1.5em;
|
|
11418
11688
|
color: ${(props) => props.theme.errorMessageColor};
|
|
11419
11689
|
font-family: ${(props) => props.theme.fontFamily};
|
|
@@ -11425,29 +11695,20 @@ var ErrorMessageContainer2 = styled61.span`
|
|
|
11425
11695
|
var RadioGroup_default = DxcRadioGroup;
|
|
11426
11696
|
|
|
11427
11697
|
// src/resultset-table/ResultsetTable.tsx
|
|
11428
|
-
import { useContext as
|
|
11429
|
-
import
|
|
11698
|
+
import { useContext as useContext45, useEffect as useEffect22, useMemo as useMemo17, useRef as useRef18, useState as useState30 } from "react";
|
|
11699
|
+
import styled63, { ThemeProvider as ThemeProvider32 } from "styled-components";
|
|
11430
11700
|
|
|
11431
11701
|
// src/resultset-table/Icons.tsx
|
|
11432
|
-
import { jsx as
|
|
11702
|
+
import { jsx as jsx70 } from "react/jsx-runtime";
|
|
11433
11703
|
var icons = {
|
|
11434
|
-
arrowUp: /* @__PURE__ */
|
|
11435
|
-
|
|
11436
|
-
|
|
11437
|
-
] }),
|
|
11438
|
-
arrowDown: /* @__PURE__ */ jsxs48("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24", viewBox: "0 0 24 24", width: "24", fill: "currentColor", children: [
|
|
11439
|
-
/* @__PURE__ */ jsx69("path", { d: "M0 0h24v24H0V0z", fill: "none" }),
|
|
11440
|
-
/* @__PURE__ */ jsx69("path", { d: "M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z" })
|
|
11441
|
-
] }),
|
|
11442
|
-
bothArrows: /* @__PURE__ */ jsxs48("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24", viewBox: "0 0 24 24", width: "24", fill: "currentColor", children: [
|
|
11443
|
-
/* @__PURE__ */ jsx69("path", { d: "M0 0h24v24H0z", fill: "none" }),
|
|
11444
|
-
/* @__PURE__ */ jsx69("path", { d: "M12 5.83L15.17 9l1.41-1.41L12 3 7.41 7.59 8.83 9 12 5.83zm0 12.34L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15 12 18.17z" })
|
|
11445
|
-
] })
|
|
11704
|
+
arrowUp: /* @__PURE__ */ jsx70(Icon_default, { icon: "arrow_upward" }),
|
|
11705
|
+
arrowDown: /* @__PURE__ */ jsx70(Icon_default, { icon: "arrow_downward" }),
|
|
11706
|
+
bothArrows: /* @__PURE__ */ jsx70(Icon_default, { icon: "unfold_more" })
|
|
11446
11707
|
};
|
|
11447
11708
|
var Icons_default2 = icons;
|
|
11448
11709
|
|
|
11449
11710
|
// src/resultset-table/ResultsetTable.tsx
|
|
11450
|
-
import { jsx as
|
|
11711
|
+
import { jsx as jsx71, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
11451
11712
|
var normalizeSortValue = (sortValue) => typeof sortValue === "string" ? sortValue.toUpperCase() : sortValue;
|
|
11452
11713
|
var isDateType = (value) => value instanceof Date;
|
|
11453
11714
|
var sortArray = (index, order, resultset) => resultset.slice().sort((element1, element2) => {
|
|
@@ -11490,22 +11751,22 @@ var DxcResultsetTable = ({
|
|
|
11490
11751
|
tabIndex = 0,
|
|
11491
11752
|
mode = "default"
|
|
11492
11753
|
}) => {
|
|
11493
|
-
const colorsTheme =
|
|
11494
|
-
const [page, changePage] =
|
|
11495
|
-
const [sortColumnIndex, changeSortColumnIndex] =
|
|
11496
|
-
const [sortOrder, changeSortOrder] =
|
|
11754
|
+
const colorsTheme = useContext45(HalstackContext);
|
|
11755
|
+
const [page, changePage] = useState30(1);
|
|
11756
|
+
const [sortColumnIndex, changeSortColumnIndex] = useState30(-1);
|
|
11757
|
+
const [sortOrder, changeSortOrder] = useState30("ascending");
|
|
11497
11758
|
const prevRowCountRef = useRef18(rows.length);
|
|
11498
|
-
const rowsWithIds =
|
|
11499
|
-
const minItemsPerPageIndex =
|
|
11500
|
-
const maxItemsPerPageIndex =
|
|
11759
|
+
const rowsWithIds = useMemo17(() => assignIdsToRows(rows), [rows]);
|
|
11760
|
+
const minItemsPerPageIndex = useMemo17(() => getMinItemsPerPageIndex2(page, itemsPerPage, page), [itemsPerPage, page]);
|
|
11761
|
+
const maxItemsPerPageIndex = useMemo17(
|
|
11501
11762
|
() => getMaxItemsPerPageIndex2(minItemsPerPageIndex, itemsPerPage, rows, page),
|
|
11502
11763
|
[itemsPerPage, minItemsPerPageIndex, page, rows]
|
|
11503
11764
|
);
|
|
11504
|
-
const sortedResultset =
|
|
11765
|
+
const sortedResultset = useMemo17(
|
|
11505
11766
|
() => sortColumnIndex !== -1 ? sortArray(sortColumnIndex, sortOrder, rowsWithIds) : rowsWithIds,
|
|
11506
11767
|
[sortColumnIndex, sortOrder, rowsWithIds]
|
|
11507
11768
|
);
|
|
11508
|
-
const filteredResultset =
|
|
11769
|
+
const filteredResultset = useMemo17(
|
|
11509
11770
|
() => sortedResultset && sortedResultset.slice(minItemsPerPageIndex, maxItemsPerPageIndex + 1),
|
|
11510
11771
|
[sortedResultset, minItemsPerPageIndex, maxItemsPerPageIndex]
|
|
11511
11772
|
);
|
|
@@ -11535,9 +11796,9 @@ var DxcResultsetTable = ({
|
|
|
11535
11796
|
prevRowCountRef.current = rows.length;
|
|
11536
11797
|
}
|
|
11537
11798
|
}, [rows.length]);
|
|
11538
|
-
return /* @__PURE__ */
|
|
11799
|
+
return /* @__PURE__ */ jsx71(ThemeProvider32, { theme: colorsTheme.table, children: /* @__PURE__ */ jsxs49(DxcResultsetTableContainer, { margin, children: [
|
|
11539
11800
|
/* @__PURE__ */ jsxs49(Table_default, { mode, children: [
|
|
11540
|
-
/* @__PURE__ */
|
|
11801
|
+
/* @__PURE__ */ jsx71("thead", { children: /* @__PURE__ */ jsx71("tr", { children: columns.map((column, index) => /* @__PURE__ */ jsx71(
|
|
11541
11802
|
"th",
|
|
11542
11803
|
{
|
|
11543
11804
|
"aria-sort": column.isSortable ? sortColumnIndex === index ? sortOrder : "none" : void 0,
|
|
@@ -11555,17 +11816,17 @@ var DxcResultsetTable = ({
|
|
|
11555
11816
|
mode,
|
|
11556
11817
|
"aria-label": column.isSortable ? "Sort column" : void 0,
|
|
11557
11818
|
children: [
|
|
11558
|
-
|
|
11559
|
-
column.isSortable && /* @__PURE__ */
|
|
11819
|
+
column.displayValue,
|
|
11820
|
+
column.isSortable && /* @__PURE__ */ jsx71(SortIcon, { children: sortColumnIndex === index ? sortOrder === "ascending" ? Icons_default2.arrowUp : Icons_default2.arrowDown : Icons_default2.bothArrows })
|
|
11560
11821
|
]
|
|
11561
11822
|
}
|
|
11562
11823
|
)
|
|
11563
11824
|
},
|
|
11564
11825
|
`tableHeader_${index}`
|
|
11565
11826
|
)) }) }),
|
|
11566
|
-
/* @__PURE__ */
|
|
11827
|
+
/* @__PURE__ */ jsx71("tbody", { children: filteredResultset.map((row) => /* @__PURE__ */ jsx71("tr", { children: row.cells.map((cellContent, cellIndex) => /* @__PURE__ */ jsx71("td", { children: cellContent.displayValue }, `resultSetTableCellContent_${cellIndex}`)) }, `resultSetTableCell_${row.id}`)) })
|
|
11567
11828
|
] }),
|
|
11568
|
-
!hidePaginator && /* @__PURE__ */
|
|
11829
|
+
!hidePaginator && (itemsPerPageOptions?.some((itemsPerPage2) => rows.length > itemsPerPage2) || rows.length > itemsPerPage) && /* @__PURE__ */ jsx71(
|
|
11569
11830
|
Paginator_default,
|
|
11570
11831
|
{
|
|
11571
11832
|
totalItems: rows.length,
|
|
@@ -11581,7 +11842,7 @@ var DxcResultsetTable = ({
|
|
|
11581
11842
|
] }) });
|
|
11582
11843
|
};
|
|
11583
11844
|
var calculateWidth10 = (margin) => `calc(100% - ${getMargin(margin, "left")} - ${getMargin(margin, "right")})`;
|
|
11584
|
-
var DxcResultsetTableContainer =
|
|
11845
|
+
var DxcResultsetTableContainer = styled63.div`
|
|
11585
11846
|
width: ${(props) => calculateWidth10(props.margin)};
|
|
11586
11847
|
margin: ${(props) => props.margin && typeof props.margin !== "object" ? spaces[props.margin] : "0px"};
|
|
11587
11848
|
margin-top: ${(props) => props.margin && typeof props.margin === "object" && props.margin.top ? spaces[props.margin.top] : ""};
|
|
@@ -11589,12 +11850,12 @@ var DxcResultsetTableContainer = styled62.div`
|
|
|
11589
11850
|
margin-bottom: ${(props) => props.margin && typeof props.margin === "object" && props.margin.bottom ? spaces[props.margin.bottom] : ""};
|
|
11590
11851
|
margin-left: ${(props) => props.margin && typeof props.margin === "object" && props.margin.left ? spaces[props.margin.left] : ""};
|
|
11591
11852
|
`;
|
|
11592
|
-
var HeaderContainer3 =
|
|
11853
|
+
var HeaderContainer3 = styled63.span`
|
|
11593
11854
|
display: flex;
|
|
11594
11855
|
align-items: center;
|
|
11595
11856
|
justify-content: ${(props) => props.theme.headerTextAlign === "center" ? "center" : props.theme.headerTextAlign === "right" ? "flex-end" : "flex-start"};
|
|
11596
11857
|
gap: ${coreTokens_default.spacing_8};
|
|
11597
|
-
width:
|
|
11858
|
+
width: auto;
|
|
11598
11859
|
border: 1px solid transparent;
|
|
11599
11860
|
border-radius: 2px;
|
|
11600
11861
|
cursor: ${(props) => props.isSortable ? "pointer" : "default"};
|
|
@@ -11603,7 +11864,7 @@ var HeaderContainer3 = styled62.span`
|
|
|
11603
11864
|
outline: #0095ff solid 2px;
|
|
11604
11865
|
}`}
|
|
11605
11866
|
`;
|
|
11606
|
-
var SortIcon =
|
|
11867
|
+
var SortIcon = styled63.span`
|
|
11607
11868
|
display: flex;
|
|
11608
11869
|
height: 14px;
|
|
11609
11870
|
width: 14px;
|
|
@@ -11618,9 +11879,9 @@ DxcResultsetTable.ActionsCell = DxcActionsCell;
|
|
|
11618
11879
|
var ResultsetTable_default = DxcResultsetTable;
|
|
11619
11880
|
|
|
11620
11881
|
// src/slider/Slider.tsx
|
|
11621
|
-
import { forwardRef as forwardRef14, useContext as
|
|
11622
|
-
import
|
|
11623
|
-
import { jsx as
|
|
11882
|
+
import { forwardRef as forwardRef14, useContext as useContext46, useId as useId18, useMemo as useMemo18, useState as useState31 } from "react";
|
|
11883
|
+
import styled64, { ThemeProvider as ThemeProvider33 } from "styled-components";
|
|
11884
|
+
import { jsx as jsx72, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
11624
11885
|
var sizes6 = {
|
|
11625
11886
|
medium: "360px",
|
|
11626
11887
|
large: "480px",
|
|
@@ -11633,7 +11894,7 @@ var getChromeStyles = () => `
|
|
|
11633
11894
|
var getFirefoxStyles = () => `
|
|
11634
11895
|
width: calc(100% - 16px);
|
|
11635
11896
|
margin-right: 3px;`;
|
|
11636
|
-
var Container3 =
|
|
11897
|
+
var Container3 = styled64.div`
|
|
11637
11898
|
display: flex;
|
|
11638
11899
|
flex-direction: column;
|
|
11639
11900
|
margin: ${(props) => props.margin && typeof props.margin !== "object" ? spaces[props.margin] : "0px"};
|
|
@@ -11643,7 +11904,7 @@ var Container3 = styled63.div`
|
|
|
11643
11904
|
margin-left: ${(props) => props.margin && typeof props.margin === "object" && props.margin.left ? spaces[props.margin.left] : ""};
|
|
11644
11905
|
width: ${(props) => calculateWidth11(props.margin, props.size)};
|
|
11645
11906
|
`;
|
|
11646
|
-
var Label10 =
|
|
11907
|
+
var Label10 = styled64.label`
|
|
11647
11908
|
color: ${(props) => props.disabled ? props.theme.disabledLabelFontColor : props.theme.labelFontColor};
|
|
11648
11909
|
font-family: ${(props) => props.theme.fontFamily};
|
|
11649
11910
|
font-size: ${(props) => props.theme.labelFontSize};
|
|
@@ -11651,7 +11912,7 @@ var Label10 = styled63.label`
|
|
|
11651
11912
|
font-weight: ${(props) => props.theme.labelFontWeight};
|
|
11652
11913
|
line-height: ${(props) => props.theme.labelLineHeight};
|
|
11653
11914
|
`;
|
|
11654
|
-
var HelperText7 =
|
|
11915
|
+
var HelperText7 = styled64.span`
|
|
11655
11916
|
color: ${(props) => props.disabled ? props.theme.disabledHelperTextFontColor : props.theme.helperTextFontColor};
|
|
11656
11917
|
font-family: ${(props) => props.theme.fontFamily};
|
|
11657
11918
|
font-size: ${(props) => props.theme.helperTextFontSize};
|
|
@@ -11659,7 +11920,7 @@ var HelperText7 = styled63.span`
|
|
|
11659
11920
|
font-weight: ${(props) => props.theme.helperTextFontWeight};
|
|
11660
11921
|
line-height: ${(props) => props.theme.helperTextLineHeight};
|
|
11661
11922
|
`;
|
|
11662
|
-
var SliderInput =
|
|
11923
|
+
var SliderInput = styled64.input`
|
|
11663
11924
|
width: 100%;
|
|
11664
11925
|
min-width: 240px;
|
|
11665
11926
|
height: ${(props) => props.theme.trackLineThickness};
|
|
@@ -11737,12 +11998,12 @@ var SliderInput = styled63.input`
|
|
|
11737
11998
|
}
|
|
11738
11999
|
}
|
|
11739
12000
|
`;
|
|
11740
|
-
var SliderContainer =
|
|
12001
|
+
var SliderContainer = styled64.div`
|
|
11741
12002
|
display: flex;
|
|
11742
12003
|
height: 48px;
|
|
11743
12004
|
align-items: center;
|
|
11744
12005
|
`;
|
|
11745
|
-
var LimitLabelContainer =
|
|
12006
|
+
var LimitLabelContainer = styled64.span`
|
|
11746
12007
|
color: ${(props) => props.disabled ? props.theme.disabledLimitValuesFontColor : props.theme.limitValuesFontColor};
|
|
11747
12008
|
font-family: ${(props) => props.theme.fontFamily};
|
|
11748
12009
|
font-size: ${(props) => props.theme.limitValuesFontSize};
|
|
@@ -11751,13 +12012,13 @@ var LimitLabelContainer = styled63.span`
|
|
|
11751
12012
|
letter-spacing: ${(props) => props.theme.limitValuesFontLetterSpacing};
|
|
11752
12013
|
white-space: nowrap;
|
|
11753
12014
|
`;
|
|
11754
|
-
var MinLabelContainer =
|
|
12015
|
+
var MinLabelContainer = styled64(LimitLabelContainer)`
|
|
11755
12016
|
margin-right: ${(props) => props.theme.floorLabelMarginRight};
|
|
11756
12017
|
`;
|
|
11757
|
-
var MaxLabelContainer =
|
|
12018
|
+
var MaxLabelContainer = styled64(LimitLabelContainer)`
|
|
11758
12019
|
margin-left: ${(props) => props.step === 1 ? props.theme.ceilLabelMarginLeft : "1.25rem"};
|
|
11759
12020
|
`;
|
|
11760
|
-
var SliderInputContainer =
|
|
12021
|
+
var SliderInputContainer = styled64.div`
|
|
11761
12022
|
position: relative;
|
|
11762
12023
|
width: 100%;
|
|
11763
12024
|
height: 24px;
|
|
@@ -11768,7 +12029,7 @@ var SliderInputContainer = styled63.div`
|
|
|
11768
12029
|
padding-top: 1px;
|
|
11769
12030
|
z-index: 0;
|
|
11770
12031
|
`;
|
|
11771
|
-
var MarksContainer =
|
|
12032
|
+
var MarksContainer = styled64.div`
|
|
11772
12033
|
${(props) => props.isFirefox ? getFirefoxStyles() : getChromeStyles()}
|
|
11773
12034
|
position: absolute;
|
|
11774
12035
|
pointer-events: none;
|
|
@@ -11776,7 +12037,7 @@ var MarksContainer = styled63.div`
|
|
|
11776
12037
|
display: flex;
|
|
11777
12038
|
align-items: center;
|
|
11778
12039
|
`;
|
|
11779
|
-
var TickMark =
|
|
12040
|
+
var TickMark = styled64.span`
|
|
11780
12041
|
position: absolute;
|
|
11781
12042
|
background: ${(props) => props.disabled ? props.theme.disabledTickBackgroundColor : props.theme.tickBackgroundColor};
|
|
11782
12043
|
height: ${(props) => props.theme.tickHeight};
|
|
@@ -11785,7 +12046,7 @@ var TickMark = styled63.span`
|
|
|
11785
12046
|
left: ${(props) => `calc(${props.stepPosition} * 100%)`};
|
|
11786
12047
|
z-index: ${(props) => props.stepValue != null && `${props.stepPosition <= props.stepValue ? "-1" : "0"}`};
|
|
11787
12048
|
`;
|
|
11788
|
-
var TextInputContainer2 =
|
|
12049
|
+
var TextInputContainer2 = styled64.div`
|
|
11789
12050
|
margin-left: ${(props) => props.theme.inputMarginLeft};
|
|
11790
12051
|
max-width: 70px;
|
|
11791
12052
|
`;
|
|
@@ -11810,27 +12071,27 @@ var DxcSlider = forwardRef14(
|
|
|
11810
12071
|
size = "fillParent",
|
|
11811
12072
|
ariaLabel = "Slider"
|
|
11812
12073
|
}, ref) => {
|
|
11813
|
-
const labelId = `label-${
|
|
11814
|
-
const [innerValue, setInnerValue] =
|
|
11815
|
-
const [dragging, setDragging] =
|
|
11816
|
-
const colorsTheme =
|
|
12074
|
+
const labelId = `label-${useId18()}`;
|
|
12075
|
+
const [innerValue, setInnerValue] = useState31(defaultValue ?? 0);
|
|
12076
|
+
const [dragging, setDragging] = useState31(false);
|
|
12077
|
+
const colorsTheme = useContext46(HalstackContext);
|
|
11817
12078
|
const isFirefox = navigator.userAgent.indexOf("Firefox") !== -1;
|
|
11818
|
-
const minLabel =
|
|
12079
|
+
const minLabel = useMemo18(
|
|
11819
12080
|
() => labelFormatCallback ? labelFormatCallback(minValue) : minValue,
|
|
11820
12081
|
[labelFormatCallback, minValue]
|
|
11821
12082
|
);
|
|
11822
|
-
const maxLabel =
|
|
12083
|
+
const maxLabel = useMemo18(
|
|
11823
12084
|
() => labelFormatCallback ? labelFormatCallback(maxValue) : maxValue,
|
|
11824
12085
|
[labelFormatCallback, maxValue]
|
|
11825
12086
|
);
|
|
11826
|
-
const tickMarks =
|
|
12087
|
+
const tickMarks = useMemo18(() => {
|
|
11827
12088
|
const numberOfMarks = Math.floor(maxValue / step - minValue / step);
|
|
11828
12089
|
const range = maxValue - minValue;
|
|
11829
12090
|
const ticks = [];
|
|
11830
12091
|
if (marks) {
|
|
11831
12092
|
for (let index = 0; index <= numberOfMarks; index++) {
|
|
11832
12093
|
ticks.push(
|
|
11833
|
-
/* @__PURE__ */
|
|
12094
|
+
/* @__PURE__ */ jsx72(
|
|
11834
12095
|
TickMark,
|
|
11835
12096
|
{
|
|
11836
12097
|
disabled,
|
|
@@ -11869,13 +12130,13 @@ var DxcSlider = forwardRef14(
|
|
|
11869
12130
|
onChange?.(intValue > maxValue ? maxValue : intValue);
|
|
11870
12131
|
}
|
|
11871
12132
|
};
|
|
11872
|
-
return /* @__PURE__ */
|
|
11873
|
-
label && /* @__PURE__ */
|
|
11874
|
-
/* @__PURE__ */
|
|
12133
|
+
return /* @__PURE__ */ jsx72(ThemeProvider33, { theme: colorsTheme.slider, children: /* @__PURE__ */ jsxs50(Container3, { margin, size, ref, children: [
|
|
12134
|
+
label && /* @__PURE__ */ jsx72(Label10, { id: labelId, disabled, children: label }),
|
|
12135
|
+
/* @__PURE__ */ jsx72(HelperText7, { disabled, children: helperText }),
|
|
11875
12136
|
/* @__PURE__ */ jsxs50(SliderContainer, { children: [
|
|
11876
|
-
showLimitsValues && /* @__PURE__ */
|
|
12137
|
+
showLimitsValues && /* @__PURE__ */ jsx72(MinLabelContainer, { disabled, children: minLabel }),
|
|
11877
12138
|
/* @__PURE__ */ jsxs50(SliderInputContainer, { children: [
|
|
11878
|
-
/* @__PURE__ */
|
|
12139
|
+
/* @__PURE__ */ jsx72(
|
|
11879
12140
|
SliderInput,
|
|
11880
12141
|
{
|
|
11881
12142
|
role: "slider",
|
|
@@ -11896,10 +12157,10 @@ var DxcSlider = forwardRef14(
|
|
|
11896
12157
|
onMouseDown: handleSliderDragging
|
|
11897
12158
|
}
|
|
11898
12159
|
),
|
|
11899
|
-
marks && /* @__PURE__ */
|
|
12160
|
+
marks && /* @__PURE__ */ jsx72(MarksContainer, { isFirefox, children: tickMarks })
|
|
11900
12161
|
] }),
|
|
11901
|
-
showLimitsValues && /* @__PURE__ */
|
|
11902
|
-
showInput && /* @__PURE__ */
|
|
12162
|
+
showLimitsValues && /* @__PURE__ */ jsx72(MaxLabelContainer, { disabled, step, children: maxLabel }),
|
|
12163
|
+
showInput && /* @__PURE__ */ jsx72(TextInputContainer2, { children: /* @__PURE__ */ jsx72(
|
|
11903
12164
|
TextInput_default,
|
|
11904
12165
|
{
|
|
11905
12166
|
name,
|
|
@@ -11915,217 +12176,11 @@ var DxcSlider = forwardRef14(
|
|
|
11915
12176
|
);
|
|
11916
12177
|
var Slider_default = DxcSlider;
|
|
11917
12178
|
|
|
11918
|
-
// src/spinner/Spinner.tsx
|
|
11919
|
-
import { useContext as useContext46, useId as useId18, useMemo as useMemo18 } from "react";
|
|
11920
|
-
import styled64, { ThemeProvider as ThemeProvider33 } from "styled-components";
|
|
11921
|
-
import { jsx as jsx72, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
11922
|
-
var DxcSpinner = ({
|
|
11923
|
-
label,
|
|
11924
|
-
value,
|
|
11925
|
-
showValue = false,
|
|
11926
|
-
mode = "large",
|
|
11927
|
-
margin,
|
|
11928
|
-
ariaLabel = "Spinner"
|
|
11929
|
-
}) => {
|
|
11930
|
-
const labelId = useId18();
|
|
11931
|
-
const colorsTheme = useContext46(HalstackContext);
|
|
11932
|
-
const determinated = useMemo18(() => value != null && value >= 0 && value <= 100, [value]);
|
|
11933
|
-
return /* @__PURE__ */ jsx72(ThemeProvider33, { theme: colorsTheme.spinner, children: /* @__PURE__ */ jsx72(DXCSpinner, { margin, mode, children: /* @__PURE__ */ jsxs51(SpinnerContainer, { mode, children: [
|
|
11934
|
-
mode === "overlay" && /* @__PURE__ */ jsx72(BackOverlay, {}),
|
|
11935
|
-
/* @__PURE__ */ jsx72(BackgroundSpinner, { children: mode === "small" ? /* @__PURE__ */ jsx72(SVGBackground, { viewBox: "0 0 16 16", children: /* @__PURE__ */ jsx72(CircleBackground, { cx: "8", cy: "8", r: "6", mode }) }) : /* @__PURE__ */ jsx72(SVGBackground, { viewBox: "0 0 140 140", children: /* @__PURE__ */ jsx72(CircleBackground, { cx: "70", cy: "70", r: "65", mode }) }) }),
|
|
11936
|
-
/* @__PURE__ */ jsx72(
|
|
11937
|
-
Spinner,
|
|
11938
|
-
{
|
|
11939
|
-
role: "progressbar",
|
|
11940
|
-
"aria-valuenow": determinated && showValue ? value : void 0,
|
|
11941
|
-
"aria-valuemin": determinated ? 0 : void 0,
|
|
11942
|
-
"aria-valuemax": determinated ? 100 : void 0,
|
|
11943
|
-
"aria-labelledby": label && mode !== "small" ? labelId : void 0,
|
|
11944
|
-
"aria-label": !label ? ariaLabel : mode === "small" ? ariaLabel : void 0,
|
|
11945
|
-
children: mode === "small" ? /* @__PURE__ */ jsx72(SVGSpinner, { viewBox: "0 0 16 16", determinated, children: /* @__PURE__ */ jsx72(CircleSpinner, { cx: "8", cy: "8", r: "6", mode, determinated, value }) }) : /* @__PURE__ */ jsx72(SVGSpinner, { viewBox: "0 0 140 140", determinated, children: /* @__PURE__ */ jsx72(CircleSpinner, { cx: "70", cy: "70", r: "65", mode, determinated, value }) })
|
|
11946
|
-
}
|
|
11947
|
-
),
|
|
11948
|
-
mode !== "small" && /* @__PURE__ */ jsxs51(LabelsContainer3, { children: [
|
|
11949
|
-
label && /* @__PURE__ */ jsx72(SpinnerLabel, { id: labelId, mode, children: label }),
|
|
11950
|
-
(value || value === 0) && showValue && /* @__PURE__ */ jsxs51(SpinnerProgress, { value, mode, showValue, children: [
|
|
11951
|
-
value,
|
|
11952
|
-
"%"
|
|
11953
|
-
] })
|
|
11954
|
-
] })
|
|
11955
|
-
] }) }) });
|
|
11956
|
-
};
|
|
11957
|
-
var determinateValue = (value, strokeDashArray) => {
|
|
11958
|
-
let val = 0;
|
|
11959
|
-
if (value != null && value >= 0 && value <= 100) {
|
|
11960
|
-
val = strokeDashArray * (1 - value / 100);
|
|
11961
|
-
}
|
|
11962
|
-
return val;
|
|
11963
|
-
};
|
|
11964
|
-
var DXCSpinner = styled64.div`
|
|
11965
|
-
height: ${(props) => props.mode === "overlay" ? "100vh" : ""};
|
|
11966
|
-
width: ${(props) => props.mode === "overlay" ? "100vw" : ""};
|
|
11967
|
-
display: ${(props) => props.mode === "overlay" ? "flex" : ""};
|
|
11968
|
-
position: ${(props) => props.mode === "overlay" ? "fixed" : ""};
|
|
11969
|
-
top: ${(props) => props.mode === "overlay" ? 0 : ""};
|
|
11970
|
-
left: ${(props) => props.mode === "overlay" ? 0 : ""};
|
|
11971
|
-
justify-content: ${(props) => props.mode === "overlay" ? "center" : ""};
|
|
11972
|
-
align-items: ${(props) => props.mode === "overlay" ? "center" : ""};
|
|
11973
|
-
z-index: ${(props) => props.mode === "overlay" ? 1300 : ""};
|
|
11974
|
-
|
|
11975
|
-
margin: ${(props) => props.mode !== "overlay" ? props.margin && typeof props.margin !== "object" ? spaces[props.margin] : "0px" : ""};
|
|
11976
|
-
margin-top: ${(props) => props.mode !== "overlay" ? props.margin && typeof props.margin === "object" && props.margin.top ? spaces[props.margin.top] : "" : ""};
|
|
11977
|
-
margin-right: ${(props) => props.mode !== "overlay" ? props.margin && typeof props.margin === "object" && props.margin.right ? spaces[props.margin.right] : "" : ""};
|
|
11978
|
-
margin-bottom: ${(props) => props.mode !== "overlay" ? props.margin && typeof props.margin === "object" && props.margin.bottom ? spaces[props.margin.bottom] : "" : ""};
|
|
11979
|
-
margin-left: ${(props) => props.mode !== "overlay" ? props.margin && typeof props.margin === "object" && props.margin.left ? spaces[props.margin.left] : "" : ""};
|
|
11980
|
-
`;
|
|
11981
|
-
var SpinnerContainer = styled64.div`
|
|
11982
|
-
align-items: center;
|
|
11983
|
-
display: flex;
|
|
11984
|
-
height: ${(props) => props.mode === "small" ? "16px" : "140px"};
|
|
11985
|
-
width: ${(props) => props.mode === "small" ? "16px" : "140px"};
|
|
11986
|
-
justify-content: center;
|
|
11987
|
-
position: relative;
|
|
11988
|
-
background-color: transparent;
|
|
11989
|
-
|
|
11990
|
-
@keyframes spinner-svg {
|
|
11991
|
-
0% {
|
|
11992
|
-
transform: rotateZ(0deg);
|
|
11993
|
-
}
|
|
11994
|
-
100% {
|
|
11995
|
-
transform: rotateZ(360deg);
|
|
11996
|
-
}
|
|
11997
|
-
}
|
|
11998
|
-
@keyframes svg-circle-large {
|
|
11999
|
-
0% {
|
|
12000
|
-
stroke-dashoffset: 400;
|
|
12001
|
-
transform: rotate(0);
|
|
12002
|
-
}
|
|
12003
|
-
|
|
12004
|
-
50% {
|
|
12005
|
-
stroke-dashoffset: 75;
|
|
12006
|
-
transform: rotate(45deg);
|
|
12007
|
-
}
|
|
12008
|
-
|
|
12009
|
-
100% {
|
|
12010
|
-
stroke-dashoffset: 400;
|
|
12011
|
-
transform: rotate(360deg);
|
|
12012
|
-
}
|
|
12013
|
-
}
|
|
12014
|
-
@keyframes svg-circle-small {
|
|
12015
|
-
0% {
|
|
12016
|
-
stroke-dashoffset: 35;
|
|
12017
|
-
transform: rotate(0);
|
|
12018
|
-
}
|
|
12019
|
-
|
|
12020
|
-
50% {
|
|
12021
|
-
stroke-dashoffset: 8;
|
|
12022
|
-
transform: rotate(45deg);
|
|
12023
|
-
}
|
|
12024
|
-
|
|
12025
|
-
100% {
|
|
12026
|
-
stroke-dashoffset: 35;
|
|
12027
|
-
transform: rotate(360deg);
|
|
12028
|
-
}
|
|
12029
|
-
}
|
|
12030
|
-
`;
|
|
12031
|
-
var BackOverlay = styled64.div`
|
|
12032
|
-
width: 100vw;
|
|
12033
|
-
height: 100vh;
|
|
12034
|
-
opacity: 1;
|
|
12035
|
-
transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
12036
|
-
position: fixed;
|
|
12037
|
-
top: 0;
|
|
12038
|
-
left: 0;
|
|
12039
|
-
background-color: ${(props) => `${props.theme.overlayBackgroundColor}`};
|
|
12040
|
-
opacity: ${(props) => `${props.theme.overlayOpacity}`};
|
|
12041
|
-
`;
|
|
12042
|
-
var BackgroundSpinner = styled64.div`
|
|
12043
|
-
height: inherit;
|
|
12044
|
-
width: inherit;
|
|
12045
|
-
position: absolute;
|
|
12046
|
-
`;
|
|
12047
|
-
var SVGBackground = styled64.svg`
|
|
12048
|
-
height: inherit;
|
|
12049
|
-
width: inherit;
|
|
12050
|
-
`;
|
|
12051
|
-
var CircleBackground = styled64.circle`
|
|
12052
|
-
animation: none;
|
|
12053
|
-
fill: transparent;
|
|
12054
|
-
stroke: ${(props) => `${props.theme.totalCircleColor}`};
|
|
12055
|
-
stroke-dasharray: ${(props) => props.mode !== "small" ? "409" : "38"};
|
|
12056
|
-
stroke-linecap: initial;
|
|
12057
|
-
stroke-width: ${(props) => props.mode !== "small" ? "8.5px" : "2px"};
|
|
12058
|
-
transform-origin: 50% 50%;
|
|
12059
|
-
vector-effect: non-scaling-stroke;
|
|
12060
|
-
`;
|
|
12061
|
-
var Spinner = styled64.div`
|
|
12062
|
-
height: inherit;
|
|
12063
|
-
width: inherit;
|
|
12064
|
-
position: relative;
|
|
12065
|
-
`;
|
|
12066
|
-
var SVGSpinner = styled64.svg`
|
|
12067
|
-
height: inherit;
|
|
12068
|
-
width: inherit;
|
|
12069
|
-
transform: rotate(-90deg);
|
|
12070
|
-
top: 0;
|
|
12071
|
-
left: 0;
|
|
12072
|
-
transform-origin: center;
|
|
12073
|
-
overflow: visible;
|
|
12074
|
-
animation: ${(props) => !props.determinated ? "1.4s linear infinite both spinner-svg" : ""};
|
|
12075
|
-
`;
|
|
12076
|
-
var CircleSpinner = styled64.circle`
|
|
12077
|
-
fill: transparent;
|
|
12078
|
-
stroke-linecap: initial;
|
|
12079
|
-
vector-effect: non-scaling-stroke;
|
|
12080
|
-
animation: ${(props) => props.determinated ? "none" : props.mode !== "small" ? "1.4s ease-in-out infinite both svg-circle-large" : "1.4s ease-in-out infinite both svg-circle-small"};
|
|
12081
|
-
stroke: ${(props) => props.mode === "overlay" ? props.theme.trackCircleColorOverlay : props.theme.trackCircleColor};
|
|
12082
|
-
transform-origin: ${(props) => !props.determinated ? "50% 50%" : ""};
|
|
12083
|
-
stroke-dasharray: ${(props) => props.mode !== "small" ? "409" : "38"};
|
|
12084
|
-
stroke-width: ${(props) => props.mode !== "small" ? "8.5px" : "2px"};
|
|
12085
|
-
stroke-dashoffset: ${(props) => props.determinated ? props.mode !== "small" ? determinateValue(props.value, 409) : determinateValue(props.value, 38) : ""};
|
|
12086
|
-
`;
|
|
12087
|
-
var LabelsContainer3 = styled64.div`
|
|
12088
|
-
position: absolute;
|
|
12089
|
-
margin: 0 auto;
|
|
12090
|
-
width: 110px;
|
|
12091
|
-
text-align: center;
|
|
12092
|
-
`;
|
|
12093
|
-
var SpinnerLabel = styled64.p`
|
|
12094
|
-
margin: 0;
|
|
12095
|
-
width: 100%;
|
|
12096
|
-
white-space: nowrap;
|
|
12097
|
-
overflow: hidden;
|
|
12098
|
-
text-overflow: ellipsis;
|
|
12099
|
-
font-family: ${(props) => props.mode === "overlay" ? props.theme.overlayLabelFontFamily : props.theme.labelFontFamily};
|
|
12100
|
-
font-weight: ${(props) => props.mode === "overlay" ? props.theme.overlayLabelFontWeight : props.theme.labelFontWeight};
|
|
12101
|
-
font-size: ${(props) => props.mode === "overlay" ? props.theme.overlayLabelFontSize : props.theme.labelFontSize};
|
|
12102
|
-
font-style: ${(props) => props.mode === "overlay" ? props.theme.overlayLabelFontStyle : props.theme.labelFontStyle};
|
|
12103
|
-
color: ${(props) => props.mode === "overlay" ? props.theme.overlayLabelFontColor : props.theme.labelFontColor};
|
|
12104
|
-
text-align: ${(props) => props.mode === "overlay" ? props.theme.overlayLabelTextAlign : props.theme.labelTextAlign};
|
|
12105
|
-
letter-spacing: ${(props) => props.mode === "overlay" ? props.theme.overlayLabelLetterSpacing : props.theme.labelLetterSpacing};
|
|
12106
|
-
`;
|
|
12107
|
-
var SpinnerProgress = styled64.p`
|
|
12108
|
-
margin: 0;
|
|
12109
|
-
width: 100%;
|
|
12110
|
-
white-space: nowrap;
|
|
12111
|
-
overflow: hidden;
|
|
12112
|
-
text-overflow: ellipsis;
|
|
12113
|
-
display: ${(props) => props.value && props.showValue === true && "block" || "none"};
|
|
12114
|
-
font-family: ${(props) => props.mode === "overlay" ? props.theme.overlayProgressValueFontFamily : props.theme.progressValueFontFamily};
|
|
12115
|
-
font-weight: ${(props) => props.mode === "overlay" ? props.theme.overlayProgressValueFontWeight : props.theme.progressValueFontWeight};
|
|
12116
|
-
font-size: ${(props) => props.mode === "overlay" ? props.theme.overlayProgressValueFontSize : props.theme.progressValueFontSize};
|
|
12117
|
-
font-style: ${(props) => props.mode === "overlay" ? props.theme.overlayProgressValueFontStyle : props.theme.progressValueFontStyle};
|
|
12118
|
-
color: ${(props) => props.mode === "overlay" ? props.theme.overlayProgressValueFontColor : props.theme.progressValueFontColor};
|
|
12119
|
-
text-align: ${(props) => props.mode === "overlay" ? props.theme.overlayProgressValueTextAlign : props.theme.progressValueTextAlign};
|
|
12120
|
-
letter-spacing: ${(props) => props.mode === "overlay" ? props.theme.overlayProgressValueLetterSpacing : props.theme.progressValueLetterSpacing};
|
|
12121
|
-
`;
|
|
12122
|
-
var Spinner_default = DxcSpinner;
|
|
12123
|
-
|
|
12124
12179
|
// src/status-light/StatusLight.tsx
|
|
12125
12180
|
import styled65 from "styled-components";
|
|
12126
|
-
import { jsx as jsx73, jsxs as
|
|
12181
|
+
import { jsx as jsx73, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
12127
12182
|
var DxcStatusLight = ({ mode = "default", label, size = "medium" }) => {
|
|
12128
|
-
return /* @__PURE__ */
|
|
12183
|
+
return /* @__PURE__ */ jsxs51(StatusLightContainer, { size, "aria-label": `${mode}: ${label}`, role: "status", children: [
|
|
12129
12184
|
/* @__PURE__ */ jsx73(StatusDot, { mode, size, "aria-hidden": "true" }),
|
|
12130
12185
|
/* @__PURE__ */ jsx73(StatusLabel, { mode, size, children: label })
|
|
12131
12186
|
] });
|
|
@@ -12155,9 +12210,9 @@ var StatusLabel = styled65.span`
|
|
|
12155
12210
|
var StatusLight_default = DxcStatusLight;
|
|
12156
12211
|
|
|
12157
12212
|
// src/switch/Switch.tsx
|
|
12158
|
-
import { forwardRef as forwardRef15, useContext as useContext47, useId as useId19, useRef as useRef19, useState as
|
|
12213
|
+
import { forwardRef as forwardRef15, useContext as useContext47, useId as useId19, useRef as useRef19, useState as useState32 } from "react";
|
|
12159
12214
|
import styled66, { ThemeProvider as ThemeProvider34 } from "styled-components";
|
|
12160
|
-
import { Fragment as
|
|
12215
|
+
import { Fragment as Fragment14, jsx as jsx74, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
12161
12216
|
var DxcSwitch = forwardRef15(
|
|
12162
12217
|
({
|
|
12163
12218
|
defaultChecked = false,
|
|
@@ -12176,7 +12231,7 @@ var DxcSwitch = forwardRef15(
|
|
|
12176
12231
|
}, ref) => {
|
|
12177
12232
|
const switchId = `switch-${useId19()}`;
|
|
12178
12233
|
const labelId = `label-${switchId}`;
|
|
12179
|
-
const [innerChecked, setInnerChecked] =
|
|
12234
|
+
const [innerChecked, setInnerChecked] = useState32(defaultChecked);
|
|
12180
12235
|
const colorsTheme = useContext47(HalstackContext);
|
|
12181
12236
|
const translatedLabels = useContext47(HalstackLanguageContext);
|
|
12182
12237
|
const refTrack = useRef19(null);
|
|
@@ -12199,7 +12254,7 @@ var DxcSwitch = forwardRef15(
|
|
|
12199
12254
|
}
|
|
12200
12255
|
onChange?.(checked ? !checked : !innerChecked);
|
|
12201
12256
|
};
|
|
12202
|
-
return /* @__PURE__ */ jsx74(ThemeProvider34, { theme: colorsTheme.switch, children: /* @__PURE__ */
|
|
12257
|
+
return /* @__PURE__ */ jsx74(ThemeProvider34, { theme: colorsTheme.switch, children: /* @__PURE__ */ jsxs52(
|
|
12203
12258
|
SwitchContainer,
|
|
12204
12259
|
{
|
|
12205
12260
|
margin,
|
|
@@ -12209,10 +12264,10 @@ var DxcSwitch = forwardRef15(
|
|
|
12209
12264
|
onClick: !disabled ? handlerSwitchChange : void 0,
|
|
12210
12265
|
ref,
|
|
12211
12266
|
children: [
|
|
12212
|
-
labelPosition === "before" && label && /* @__PURE__ */
|
|
12267
|
+
labelPosition === "before" && label && /* @__PURE__ */ jsxs52(LabelContainer4, { id: labelId, labelPosition, disabled, label, children: [
|
|
12213
12268
|
label,
|
|
12214
12269
|
" ",
|
|
12215
|
-
optional && /* @__PURE__ */ jsx74(
|
|
12270
|
+
optional && /* @__PURE__ */ jsx74(Fragment14, { children: translatedLabels.formFields.optionalLabel })
|
|
12216
12271
|
] }),
|
|
12217
12272
|
/* @__PURE__ */ jsx74(
|
|
12218
12273
|
ValueInput4,
|
|
@@ -12239,8 +12294,8 @@ var DxcSwitch = forwardRef15(
|
|
|
12239
12294
|
ref: refTrack
|
|
12240
12295
|
}
|
|
12241
12296
|
) }),
|
|
12242
|
-
labelPosition === "after" && label && /* @__PURE__ */
|
|
12243
|
-
optional && /* @__PURE__ */ jsx74(
|
|
12297
|
+
labelPosition === "after" && label && /* @__PURE__ */ jsxs52(LabelContainer4, { id: labelId, labelPosition, disabled, label, children: [
|
|
12298
|
+
optional && /* @__PURE__ */ jsx74(Fragment14, { children: translatedLabels.formFields.optionalLabel }),
|
|
12244
12299
|
" ",
|
|
12245
12300
|
label
|
|
12246
12301
|
] })
|
|
@@ -12405,7 +12460,7 @@ import {
|
|
|
12405
12460
|
useEffect as useEffect25,
|
|
12406
12461
|
useMemo as useMemo20,
|
|
12407
12462
|
useRef as useRef22,
|
|
12408
|
-
useState as
|
|
12463
|
+
useState as useState34
|
|
12409
12464
|
} from "react";
|
|
12410
12465
|
import styled70, { ThemeProvider as ThemeProvider36 } from "styled-components";
|
|
12411
12466
|
|
|
@@ -12416,7 +12471,7 @@ var TabsContext_default = createContext9(null);
|
|
|
12416
12471
|
// src/tabs/Tab.tsx
|
|
12417
12472
|
import { forwardRef as forwardRef16, useContext as useContext48, useEffect as useEffect23, useRef as useRef20 } from "react";
|
|
12418
12473
|
import styled67 from "styled-components";
|
|
12419
|
-
import { jsx as jsx75, jsxs as
|
|
12474
|
+
import { jsx as jsx75, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
12420
12475
|
var DxcTab2 = forwardRef16(
|
|
12421
12476
|
({
|
|
12422
12477
|
icon,
|
|
@@ -12470,7 +12525,7 @@ var DxcTab2 = forwardRef16(
|
|
|
12470
12525
|
break;
|
|
12471
12526
|
}
|
|
12472
12527
|
};
|
|
12473
|
-
return /* @__PURE__ */ jsx75(Tooltip, { label: title, children: /* @__PURE__ */
|
|
12528
|
+
return /* @__PURE__ */ jsx75(Tooltip, { label: title, children: /* @__PURE__ */ jsxs53(
|
|
12474
12529
|
TabContainer2,
|
|
12475
12530
|
{
|
|
12476
12531
|
role: "tab",
|
|
@@ -12502,7 +12557,7 @@ var DxcTab2 = forwardRef16(
|
|
|
12502
12557
|
onMouseEnter: () => onHover(),
|
|
12503
12558
|
onKeyDown: handleOnKeyDown,
|
|
12504
12559
|
children: [
|
|
12505
|
-
/* @__PURE__ */
|
|
12560
|
+
/* @__PURE__ */ jsxs53(
|
|
12506
12561
|
MainLabelContainer,
|
|
12507
12562
|
{
|
|
12508
12563
|
notificationNumber,
|
|
@@ -12630,15 +12685,15 @@ var TabIconContainer2 = styled67.div`
|
|
|
12630
12685
|
var Tab_default2 = DxcTab2;
|
|
12631
12686
|
|
|
12632
12687
|
// src/tabs/TabsLegacy.tsx
|
|
12633
|
-
import { useCallback as useCallback11, useContext as useContext49, useEffect as useEffect24, useMemo as useMemo19, useRef as useRef21, useState as
|
|
12688
|
+
import { useCallback as useCallback11, useContext as useContext49, useEffect as useEffect24, useMemo as useMemo19, useRef as useRef21, useState as useState33 } from "react";
|
|
12634
12689
|
import styled69, { ThemeProvider as ThemeProvider35 } from "styled-components";
|
|
12635
12690
|
|
|
12636
12691
|
// src/tabs/TabLegacy.tsx
|
|
12637
12692
|
import { forwardRef as forwardRef17, memo as memo12 } from "react";
|
|
12638
12693
|
import styled68 from "styled-components";
|
|
12639
|
-
import { jsx as jsx76, jsxs as
|
|
12694
|
+
import { jsx as jsx76, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
12640
12695
|
var Tab2 = forwardRef17(
|
|
12641
|
-
({ active, tab, tabIndex, hasLabelAndIcon, iconPosition, onClick, onMouseEnter, onMouseLeave }, ref) => /* @__PURE__ */
|
|
12696
|
+
({ active, tab, tabIndex, hasLabelAndIcon, iconPosition, onClick, onMouseEnter, onMouseLeave }, ref) => /* @__PURE__ */ jsxs54(
|
|
12642
12697
|
TabContainer3,
|
|
12643
12698
|
{
|
|
12644
12699
|
role: "tab",
|
|
@@ -12659,7 +12714,7 @@ var Tab2 = forwardRef17(
|
|
|
12659
12714
|
onMouseLeave();
|
|
12660
12715
|
},
|
|
12661
12716
|
children: [
|
|
12662
|
-
/* @__PURE__ */
|
|
12717
|
+
/* @__PURE__ */ jsxs54(
|
|
12663
12718
|
MainLabelContainer2,
|
|
12664
12719
|
{
|
|
12665
12720
|
notificationNumber: tab.notificationNumber,
|
|
@@ -12784,9 +12839,9 @@ var TabIconContainer3 = styled68.div`
|
|
|
12784
12839
|
var TabLegacy_default = memo12(Tab2);
|
|
12785
12840
|
|
|
12786
12841
|
// src/tabs/TabsLegacy.tsx
|
|
12787
|
-
import { jsx as jsx77, jsxs as
|
|
12842
|
+
import { jsx as jsx77, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
12788
12843
|
var useResize = (refTabList) => {
|
|
12789
|
-
const [viewWidth, setViewWidth] =
|
|
12844
|
+
const [viewWidth, setViewWidth] = useState33(0);
|
|
12790
12845
|
const handleWindowSizeChange = useCallback11(() => {
|
|
12791
12846
|
setViewWidth(refTabList.current?.offsetWidth ?? 0);
|
|
12792
12847
|
}, [refTabList]);
|
|
@@ -12812,19 +12867,19 @@ var DxcTabs = ({
|
|
|
12812
12867
|
const colorsTheme = useContext49(HalstackContext);
|
|
12813
12868
|
const hasLabelAndIcon = tabs != null && tabs.filter((tab) => tab.label && tab.icon).length > 0;
|
|
12814
12869
|
const firstFocus = tabs != null ? tabs.findIndex((tab) => !tab.isDisabled) : null;
|
|
12815
|
-
const [innerActiveTabIndex, setInnerActiveTabIndex] =
|
|
12870
|
+
const [innerActiveTabIndex, setInnerActiveTabIndex] = useState33(
|
|
12816
12871
|
tabs != null && defaultActiveTabIndex && !tabs[defaultActiveTabIndex]?.isDisabled ? defaultActiveTabIndex : firstFocus
|
|
12817
12872
|
);
|
|
12818
|
-
const [activeIndicatorWidth, setActiveIndicatorWidth] =
|
|
12819
|
-
const [activeIndicatorLeft, setActiveIndicatorLeft] =
|
|
12820
|
-
const [translateScroll, setTranslateScroll] =
|
|
12821
|
-
const [scrollRightEnabled, setScrollRightEnabled] =
|
|
12822
|
-
const [scrollLeftEnabled, setScrollLeftEnabled] =
|
|
12823
|
-
const [countClick, setCountClick] =
|
|
12824
|
-
const [totalTabsWidth, setTotalTabsWidth] =
|
|
12825
|
-
const [currentFocusIndex, setCurrentFocusIndex] =
|
|
12826
|
-
const [temporalFocusIndex, setTemporalFocusIndex] =
|
|
12827
|
-
const [minHeightTabs, setMinHeightTabs] =
|
|
12873
|
+
const [activeIndicatorWidth, setActiveIndicatorWidth] = useState33(0);
|
|
12874
|
+
const [activeIndicatorLeft, setActiveIndicatorLeft] = useState33(0);
|
|
12875
|
+
const [translateScroll, setTranslateScroll] = useState33(0);
|
|
12876
|
+
const [scrollRightEnabled, setScrollRightEnabled] = useState33(true);
|
|
12877
|
+
const [scrollLeftEnabled, setScrollLeftEnabled] = useState33(false);
|
|
12878
|
+
const [countClick, setCountClick] = useState33(0);
|
|
12879
|
+
const [totalTabsWidth, setTotalTabsWidth] = useState33(0);
|
|
12880
|
+
const [currentFocusIndex, setCurrentFocusIndex] = useState33(activeTabIndex ?? innerActiveTabIndex);
|
|
12881
|
+
const [temporalFocusIndex, setTemporalFocusIndex] = useState33(activeTabIndex ?? innerActiveTabIndex);
|
|
12882
|
+
const [minHeightTabs, setMinHeightTabs] = useState33(0);
|
|
12828
12883
|
const refTabs = useRef21([]);
|
|
12829
12884
|
const refTabList = useRef21(null);
|
|
12830
12885
|
const viewWidth = useResize(refTabList);
|
|
@@ -12981,9 +13036,9 @@ var DxcTabs = ({
|
|
|
12981
13036
|
};
|
|
12982
13037
|
const isTabActive = (index) => activeTabIndex != null && activeTabIndex >= 0 ? activeTabIndex === index : innerActiveTabIndex === index;
|
|
12983
13038
|
const isActiveIndicatorDisabled = firstFocus === -1 || tabs != null && activeTabIndex !== void 0 && activeTabIndex >= 0 && !!tabs[activeTabIndex]?.isDisabled;
|
|
12984
|
-
return /* @__PURE__ */ jsx77(ThemeProvider35, { theme: colorsTheme.tabs, children: /* @__PURE__ */
|
|
13039
|
+
return /* @__PURE__ */ jsx77(ThemeProvider35, { theme: colorsTheme.tabs, children: /* @__PURE__ */ jsxs55(TabsContainer, { margin, children: [
|
|
12985
13040
|
/* @__PURE__ */ jsx77(Underline2, {}),
|
|
12986
|
-
/* @__PURE__ */
|
|
13041
|
+
/* @__PURE__ */ jsxs55(Tabs, { hasLabelAndIcon, iconPosition, children: [
|
|
12987
13042
|
/* @__PURE__ */ jsx77(
|
|
12988
13043
|
ScrollIndicator,
|
|
12989
13044
|
{
|
|
@@ -12996,7 +13051,7 @@ var DxcTabs = ({
|
|
|
12996
13051
|
children: /* @__PURE__ */ jsx77(Icon_default, { icon: "keyboard_arrow_left" })
|
|
12997
13052
|
}
|
|
12998
13053
|
),
|
|
12999
|
-
/* @__PURE__ */ jsx77(TabsContent, { children: /* @__PURE__ */
|
|
13054
|
+
/* @__PURE__ */ jsx77(TabsContent, { children: /* @__PURE__ */ jsxs55(TabsContentScroll, { translateScroll, ref: refTabList, enabled: enabledIndicator, children: [
|
|
13000
13055
|
/* @__PURE__ */ jsx77(TabList, { role: "tablist", onKeyDown: handleOnKeyDown, minHeightTabs, children: tabs?.map((tab, i) => /* @__PURE__ */ jsx77(
|
|
13001
13056
|
TabLegacy_default,
|
|
13002
13057
|
{
|
|
@@ -13150,9 +13205,9 @@ var TabsContentScroll = styled69.div`
|
|
|
13150
13205
|
var TabsLegacy_default = DxcTabs;
|
|
13151
13206
|
|
|
13152
13207
|
// src/tabs/Tabs.tsx
|
|
13153
|
-
import { Fragment as
|
|
13208
|
+
import { Fragment as Fragment15, jsx as jsx78, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
13154
13209
|
var useResize2 = (refTabList) => {
|
|
13155
|
-
const [viewWidth, setViewWidth] =
|
|
13210
|
+
const [viewWidth, setViewWidth] = useState34(0);
|
|
13156
13211
|
const handleWindowSizeChange = useCallback12(() => {
|
|
13157
13212
|
setViewWidth(refTabList?.current?.offsetWidth ?? 0);
|
|
13158
13213
|
}, [refTabList]);
|
|
@@ -13198,7 +13253,7 @@ var DxcTabs2 = ({
|
|
|
13198
13253
|
() => childrenArray.some((child) => isValidElement2(child) && child.props.icon && child.props.label),
|
|
13199
13254
|
[childrenArray]
|
|
13200
13255
|
);
|
|
13201
|
-
const [activeTab, setActiveTab] =
|
|
13256
|
+
const [activeTab, setActiveTab] = useState34(() => {
|
|
13202
13257
|
const hasActiveChild = childrenArray.some(
|
|
13203
13258
|
(child) => isValidElement2(child) && (child.props.active || child.props.defaultActive) && !child.props.disabled
|
|
13204
13259
|
);
|
|
@@ -13207,16 +13262,17 @@ var DxcTabs2 = ({
|
|
|
13207
13262
|
) : childrenArray.find((child) => isValidElement2(child) && !child.props.disabled);
|
|
13208
13263
|
return isValidElement2(initialActiveTab) ? initialActiveTab.props.label ?? initialActiveTab.props.tabId : "";
|
|
13209
13264
|
});
|
|
13210
|
-
const [innerFocusIndex, setInnerFocusIndex] =
|
|
13211
|
-
const [activeIndicatorWidth, setActiveIndicatorWidth] =
|
|
13212
|
-
const [activeIndicatorLeft, setActiveIndicatorLeft] =
|
|
13213
|
-
const [countClick, setCountClick] =
|
|
13214
|
-
const [totalTabsWidth, setTotalTabsWidth] =
|
|
13215
|
-
const [translateScroll, setTranslateScroll] =
|
|
13216
|
-
const [scrollRightEnabled, setScrollRightEnabled] =
|
|
13217
|
-
const [scrollLeftEnabled, setScrollLeftEnabled] =
|
|
13218
|
-
const [minHeightTabs, setMinHeightTabs] =
|
|
13265
|
+
const [innerFocusIndex, setInnerFocusIndex] = useState34(null);
|
|
13266
|
+
const [activeIndicatorWidth, setActiveIndicatorWidth] = useState34(0);
|
|
13267
|
+
const [activeIndicatorLeft, setActiveIndicatorLeft] = useState34(0);
|
|
13268
|
+
const [countClick, setCountClick] = useState34(0);
|
|
13269
|
+
const [totalTabsWidth, setTotalTabsWidth] = useState34(0);
|
|
13270
|
+
const [translateScroll, setTranslateScroll] = useState34(0);
|
|
13271
|
+
const [scrollRightEnabled, setScrollRightEnabled] = useState34(true);
|
|
13272
|
+
const [scrollLeftEnabled, setScrollLeftEnabled] = useState34(false);
|
|
13273
|
+
const [minHeightTabs, setMinHeightTabs] = useState34(0);
|
|
13219
13274
|
const refTabList = useRef22(null);
|
|
13275
|
+
const refTabListContainer = useRef22(null);
|
|
13220
13276
|
const colorsTheme = useContext50(HalstackContext);
|
|
13221
13277
|
const viewWidth = useResize2(refTabList);
|
|
13222
13278
|
const translatedLabels = useContext50(HalstackLanguageContext);
|
|
@@ -13241,51 +13297,46 @@ var DxcTabs2 = ({
|
|
|
13241
13297
|
setActiveIndicatorLeft
|
|
13242
13298
|
};
|
|
13243
13299
|
}, [iconPosition, tabIndex, innerFocusIndex, activeTab, childrenArray, hasLabelAndIcon]);
|
|
13300
|
+
const scrollLimitCheck = () => {
|
|
13301
|
+
const container = refTabListContainer.current;
|
|
13302
|
+
if (container) {
|
|
13303
|
+
const currentScroll = container.scrollLeft;
|
|
13304
|
+
const scrollingLength = container.scrollWidth - container.offsetWidth;
|
|
13305
|
+
const startingScroll = currentScroll <= 1;
|
|
13306
|
+
const endScroll = currentScroll >= scrollingLength - 1;
|
|
13307
|
+
setScrollLeftEnabled(!startingScroll);
|
|
13308
|
+
setScrollRightEnabled(!endScroll);
|
|
13309
|
+
}
|
|
13310
|
+
};
|
|
13244
13311
|
const scrollLeft = () => {
|
|
13245
|
-
|
|
13246
|
-
|
|
13247
|
-
|
|
13248
|
-
moveX = 0;
|
|
13249
|
-
setScrollLeftEnabled(false);
|
|
13250
|
-
setScrollRightEnabled(true);
|
|
13251
|
-
} else {
|
|
13252
|
-
moveX = countClick - scrollWidth;
|
|
13253
|
-
setScrollRightEnabled(true);
|
|
13254
|
-
setScrollLeftEnabled(true);
|
|
13312
|
+
if (refTabListContainer.current) {
|
|
13313
|
+
refTabListContainer.current.scrollLeft -= 100;
|
|
13314
|
+
scrollLimitCheck();
|
|
13255
13315
|
}
|
|
13256
|
-
setTranslateScroll(-moveX);
|
|
13257
|
-
setCountClick(moveX);
|
|
13258
13316
|
};
|
|
13259
13317
|
const scrollRight = () => {
|
|
13260
|
-
|
|
13261
|
-
|
|
13262
|
-
|
|
13263
|
-
if (countClick + scrollWidth + offsetHeight >= totalTabsWidth) {
|
|
13264
|
-
moveX = totalTabsWidth - offsetHeight;
|
|
13265
|
-
setScrollRightEnabled(false);
|
|
13266
|
-
setScrollLeftEnabled(true);
|
|
13267
|
-
} else {
|
|
13268
|
-
moveX = countClick + scrollWidth;
|
|
13269
|
-
setScrollLeftEnabled(true);
|
|
13270
|
-
setScrollRightEnabled(true);
|
|
13318
|
+
if (refTabListContainer.current) {
|
|
13319
|
+
refTabListContainer.current.scrollLeft += 100;
|
|
13320
|
+
scrollLimitCheck();
|
|
13271
13321
|
}
|
|
13272
|
-
setTranslateScroll(-moveX);
|
|
13273
|
-
setCountClick(moveX);
|
|
13274
13322
|
};
|
|
13275
13323
|
const handleOnKeyDown = (event) => {
|
|
13276
13324
|
const active = childrenArray.findIndex(
|
|
13277
13325
|
(child) => child.props.label ?? child.props.tabId === activeTab
|
|
13278
13326
|
);
|
|
13327
|
+
let index;
|
|
13279
13328
|
switch (event.key) {
|
|
13280
13329
|
case "Left":
|
|
13281
13330
|
case "ArrowLeft":
|
|
13282
13331
|
event.preventDefault();
|
|
13283
|
-
|
|
13332
|
+
index = getPreviousTabIndex2(childrenArray, innerFocusIndex === null ? active : innerFocusIndex);
|
|
13333
|
+
setInnerFocusIndex(index);
|
|
13284
13334
|
break;
|
|
13285
13335
|
case "Right":
|
|
13286
13336
|
case "ArrowRight":
|
|
13287
13337
|
event.preventDefault();
|
|
13288
|
-
|
|
13338
|
+
index = getNextTabIndex2(childrenArray, innerFocusIndex === null ? active : innerFocusIndex);
|
|
13339
|
+
setInnerFocusIndex(index);
|
|
13289
13340
|
break;
|
|
13290
13341
|
case "Tab":
|
|
13291
13342
|
if (active !== innerFocusIndex) {
|
|
@@ -13295,11 +13346,28 @@ var DxcTabs2 = ({
|
|
|
13295
13346
|
default:
|
|
13296
13347
|
break;
|
|
13297
13348
|
}
|
|
13349
|
+
setTimeout(() => {
|
|
13350
|
+
scrollLimitCheck();
|
|
13351
|
+
}, 0);
|
|
13298
13352
|
};
|
|
13299
|
-
|
|
13300
|
-
|
|
13353
|
+
useEffect25(() => {
|
|
13354
|
+
if (refTabList.current)
|
|
13355
|
+
setTotalTabsWidth(() => {
|
|
13356
|
+
let total = 0;
|
|
13357
|
+
refTabList.current?.querySelectorAll('[role="tab"]').forEach((tab, index) => {
|
|
13358
|
+
if (tab.ariaSelected === "true" && viewWidth && viewWidth < totalTabsWidth) {
|
|
13359
|
+
setInnerFocusIndex(index);
|
|
13360
|
+
}
|
|
13361
|
+
total += tab.offsetWidth;
|
|
13362
|
+
});
|
|
13363
|
+
return total;
|
|
13364
|
+
});
|
|
13365
|
+
scrollLimitCheck();
|
|
13366
|
+
}, [viewWidth, totalTabsWidth]);
|
|
13367
|
+
return children ? /* @__PURE__ */ jsxs56(Fragment15, { children: [
|
|
13368
|
+
/* @__PURE__ */ jsx78(ThemeProvider36, { theme: colorsTheme.tabs, children: /* @__PURE__ */ jsxs56(TabsContainer2, { margin, children: [
|
|
13301
13369
|
/* @__PURE__ */ jsx78(Underline3, {}),
|
|
13302
|
-
/* @__PURE__ */
|
|
13370
|
+
/* @__PURE__ */ jsxs56(Tabs2, { hasLabelAndIcon, iconPosition, children: [
|
|
13303
13371
|
/* @__PURE__ */ jsx78(
|
|
13304
13372
|
ScrollIndicator2,
|
|
13305
13373
|
{
|
|
@@ -13312,7 +13380,7 @@ var DxcTabs2 = ({
|
|
|
13312
13380
|
children: /* @__PURE__ */ jsx78(Icon_default, { icon: "keyboard_arrow_left" })
|
|
13313
13381
|
}
|
|
13314
13382
|
),
|
|
13315
|
-
/* @__PURE__ */ jsx78(TabsContent2, { children: /* @__PURE__ */
|
|
13383
|
+
/* @__PURE__ */ jsx78(TabsContent2, { ref: refTabListContainer, children: /* @__PURE__ */ jsxs56(TabsContentScroll2, { translateScroll, ref: refTabList, enabled: enabledIndicator, children: [
|
|
13316
13384
|
/* @__PURE__ */ jsx78(TabList2, { role: "tablist", onKeyDown: handleOnKeyDown, minHeightTabs, children: /* @__PURE__ */ jsx78(TabsContext_default.Provider, { value: contextValue, children }) }),
|
|
13317
13385
|
/* @__PURE__ */ jsx78(
|
|
13318
13386
|
ActiveIndicator2,
|
|
@@ -13464,10 +13532,10 @@ DxcTabs2.Tab = Tab_default2;
|
|
|
13464
13532
|
var Tabs_default = DxcTabs2;
|
|
13465
13533
|
|
|
13466
13534
|
// src/tag/Tag.tsx
|
|
13467
|
-
import { useContext as useContext51, useState as
|
|
13535
|
+
import { useContext as useContext51, useState as useState35 } from "react";
|
|
13468
13536
|
import styled71, { ThemeProvider as ThemeProvider37 } from "styled-components";
|
|
13469
|
-
import { Fragment as
|
|
13470
|
-
var TagWrapper = ({ condition, wrapper, children }) => /* @__PURE__ */ jsx79(
|
|
13537
|
+
import { Fragment as Fragment16, jsx as jsx79, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
13538
|
+
var TagWrapper = ({ condition, wrapper, children }) => /* @__PURE__ */ jsx79(Fragment16, { children: condition ? wrapper(children) : children });
|
|
13471
13539
|
var DxcTag = ({
|
|
13472
13540
|
icon,
|
|
13473
13541
|
label = "",
|
|
@@ -13481,7 +13549,7 @@ var DxcTag = ({
|
|
|
13481
13549
|
tabIndex = 0
|
|
13482
13550
|
}) => {
|
|
13483
13551
|
const colorsTheme = useContext51(HalstackContext);
|
|
13484
|
-
const [isHovered, changeIsHovered] =
|
|
13552
|
+
const [isHovered, changeIsHovered] = useState35(false);
|
|
13485
13553
|
return /* @__PURE__ */ jsx79(ThemeProvider37, { theme: colorsTheme.tag, children: /* @__PURE__ */ jsx79(
|
|
13486
13554
|
StyledDxcTag,
|
|
13487
13555
|
{
|
|
@@ -13498,8 +13566,8 @@ var DxcTag = ({
|
|
|
13498
13566
|
TagWrapper,
|
|
13499
13567
|
{
|
|
13500
13568
|
condition: !!onClick || !!linkHref,
|
|
13501
|
-
wrapper: (children) => onClick ? /* @__PURE__ */ jsx79(StyledButton, { tabIndex, children }) : linkHref ? /* @__PURE__ */ jsx79(StyledLink2, { tabIndex, href: linkHref, target: newWindow ? "_blank" : "_self", children }) : /* @__PURE__ */ jsx79(
|
|
13502
|
-
children: /* @__PURE__ */
|
|
13569
|
+
wrapper: (children) => onClick ? /* @__PURE__ */ jsx79(StyledButton, { tabIndex, children }) : linkHref ? /* @__PURE__ */ jsx79(StyledLink2, { tabIndex, href: linkHref, target: newWindow ? "_blank" : "_self", children }) : /* @__PURE__ */ jsx79(Fragment16, {}),
|
|
13570
|
+
children: /* @__PURE__ */ jsxs57(TagContent, { children: [
|
|
13503
13571
|
labelPosition === "before" && size !== "small" && label && /* @__PURE__ */ jsx79(TagLabel, { children: label }),
|
|
13504
13572
|
icon && /* @__PURE__ */ jsx79(IconContainer6, { iconBgColor, children: typeof icon === "string" ? /* @__PURE__ */ jsx79(Icon_default, { icon }) : icon }),
|
|
13505
13573
|
labelPosition === "after" && size !== "small" && label && /* @__PURE__ */ jsx79(TagLabel, { children: label })
|
|
@@ -13592,9 +13660,9 @@ var TagLabel = styled71.div`
|
|
|
13592
13660
|
var Tag_default = DxcTag;
|
|
13593
13661
|
|
|
13594
13662
|
// src/textarea/Textarea.tsx
|
|
13595
|
-
import { forwardRef as forwardRef18, useContext as useContext52, useEffect as useEffect26, useId as useId20, useRef as useRef23, useState as
|
|
13663
|
+
import { forwardRef as forwardRef18, useContext as useContext52, useEffect as useEffect26, useId as useId20, useRef as useRef23, useState as useState36 } from "react";
|
|
13596
13664
|
import styled72, { ThemeProvider as ThemeProvider38 } from "styled-components";
|
|
13597
|
-
import { jsx as jsx80, jsxs as
|
|
13665
|
+
import { jsx as jsx80, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
13598
13666
|
var patternMatch = (pattern, value) => new RegExp(pattern).test(value);
|
|
13599
13667
|
var DxcTextarea = forwardRef18(
|
|
13600
13668
|
({
|
|
@@ -13621,7 +13689,7 @@ var DxcTextarea = forwardRef18(
|
|
|
13621
13689
|
tabIndex = 0,
|
|
13622
13690
|
ariaLabel = "Text area"
|
|
13623
13691
|
}, ref) => {
|
|
13624
|
-
const [innerValue, setInnerValue] =
|
|
13692
|
+
const [innerValue, setInnerValue] = useState36(defaultValue);
|
|
13625
13693
|
const textareaId = `textarea-${useId20()}`;
|
|
13626
13694
|
const colorsTheme = useContext52(HalstackContext);
|
|
13627
13695
|
const translatedLabels = useContext52(HalstackLanguageContext);
|
|
@@ -13687,8 +13755,8 @@ var DxcTextarea = forwardRef18(
|
|
|
13687
13755
|
prevValueRef.current = value ?? innerValue;
|
|
13688
13756
|
}
|
|
13689
13757
|
}, [verticalGrow, value, innerValue, rows]);
|
|
13690
|
-
return /* @__PURE__ */ jsx80(ThemeProvider38, { theme: colorsTheme.textarea, children: /* @__PURE__ */
|
|
13691
|
-
label && /* @__PURE__ */
|
|
13758
|
+
return /* @__PURE__ */ jsx80(ThemeProvider38, { theme: colorsTheme.textarea, children: /* @__PURE__ */ jsxs58(TextareaContainer, { margin, size, ref, children: [
|
|
13759
|
+
label && /* @__PURE__ */ jsxs58(Label12, { htmlFor: textareaId, disabled, helperText, children: [
|
|
13692
13760
|
label,
|
|
13693
13761
|
" ",
|
|
13694
13762
|
optional && /* @__PURE__ */ jsx80(OptionalLabel5, { children: translatedLabels.formFields.optionalLabel })
|
|
@@ -13820,12 +13888,12 @@ var ErrorMessageContainer3 = styled72.span`
|
|
|
13820
13888
|
var Textarea_default = DxcTextarea;
|
|
13821
13889
|
|
|
13822
13890
|
// src/toast/ToastsQueue.tsx
|
|
13823
|
-
import { useCallback as useCallback14, useEffect as useEffect28, useMemo as useMemo21, useState as
|
|
13891
|
+
import { useCallback as useCallback14, useEffect as useEffect28, useMemo as useMemo21, useState as useState38 } from "react";
|
|
13824
13892
|
import { createPortal as createPortal3 } from "react-dom";
|
|
13825
13893
|
import styled74 from "styled-components";
|
|
13826
13894
|
|
|
13827
13895
|
// src/toast/Toast.tsx
|
|
13828
|
-
import { memo as memo13, useContext as useContext53, useState as
|
|
13896
|
+
import { memo as memo13, useContext as useContext53, useState as useState37 } from "react";
|
|
13829
13897
|
import styled73, { keyframes } from "styled-components";
|
|
13830
13898
|
|
|
13831
13899
|
// src/utils/useTimeout.tsx
|
|
@@ -13850,7 +13918,7 @@ function useTimeout(callback, delay) {
|
|
|
13850
13918
|
}
|
|
13851
13919
|
|
|
13852
13920
|
// src/toast/Toast.tsx
|
|
13853
|
-
import { jsx as jsx81, jsxs as
|
|
13921
|
+
import { jsx as jsx81, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
13854
13922
|
var fadeInUp = keyframes`
|
|
13855
13923
|
0% {
|
|
13856
13924
|
transform: translateY(100%);
|
|
@@ -13964,7 +14032,7 @@ var DxcToast = ({
|
|
|
13964
14032
|
onClear,
|
|
13965
14033
|
semantic
|
|
13966
14034
|
}) => {
|
|
13967
|
-
const [isClosing, setIsClosing] =
|
|
14035
|
+
const [isClosing, setIsClosing] = useState37(false);
|
|
13968
14036
|
const translatedLabels = useContext53(HalstackLanguageContext);
|
|
13969
14037
|
const clearClosingAnimationTimer = useTimeout(
|
|
13970
14038
|
() => {
|
|
@@ -13978,12 +14046,12 @@ var DxcToast = ({
|
|
|
13978
14046
|
},
|
|
13979
14047
|
loading ? void 0 : duration
|
|
13980
14048
|
);
|
|
13981
|
-
return /* @__PURE__ */
|
|
13982
|
-
/* @__PURE__ */
|
|
14049
|
+
return /* @__PURE__ */ jsxs59(Toast, { semantic, isClosing, role: "status", children: [
|
|
14050
|
+
/* @__PURE__ */ jsxs59(ContentContainer2, { loading, semantic, children: [
|
|
13983
14051
|
/* @__PURE__ */ jsx81(ToastIcon, { hideSemanticIcon, icon, loading, semantic }),
|
|
13984
14052
|
/* @__PURE__ */ jsx81(Message2, { children: message })
|
|
13985
14053
|
] }),
|
|
13986
|
-
/* @__PURE__ */
|
|
14054
|
+
/* @__PURE__ */ jsxs59(Flex_default, { alignItems: "center", gap: "0.25rem", children: [
|
|
13987
14055
|
action && /* @__PURE__ */ jsx81(
|
|
13988
14056
|
Button_default,
|
|
13989
14057
|
{
|
|
@@ -14022,13 +14090,13 @@ import { createContext as createContext10 } from "react";
|
|
|
14022
14090
|
var ToastContext_default = createContext10(null);
|
|
14023
14091
|
|
|
14024
14092
|
// src/toast/ToastsQueue.tsx
|
|
14025
|
-
import { jsx as jsx82, jsxs as
|
|
14093
|
+
import { jsx as jsx82, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
14026
14094
|
var ToastsQueue = styled74.section`
|
|
14027
14095
|
box-sizing: border-box;
|
|
14028
14096
|
position: fixed;
|
|
14029
14097
|
bottom: 0;
|
|
14030
14098
|
right: 0;
|
|
14031
|
-
z-index:
|
|
14099
|
+
z-index: 500;
|
|
14032
14100
|
display: flex;
|
|
14033
14101
|
flex-direction: column;
|
|
14034
14102
|
align-items: flex-end;
|
|
@@ -14050,8 +14118,8 @@ var generateUniqueToastId = (toasts) => {
|
|
|
14050
14118
|
return id;
|
|
14051
14119
|
};
|
|
14052
14120
|
var DxcToastsQueue = ({ children, duration = 3e3 }) => {
|
|
14053
|
-
const [toasts, setToasts] =
|
|
14054
|
-
const [isMounted, setIsMounted] =
|
|
14121
|
+
const [toasts, setToasts] = useState38([]);
|
|
14122
|
+
const [isMounted, setIsMounted] = useState38(false);
|
|
14055
14123
|
const adjustedDuration = useMemo21(() => duration > 5e3 ? 5e3 : duration < 3e3 ? 3e3 : duration, [duration]);
|
|
14056
14124
|
const remove = useCallback14((id) => {
|
|
14057
14125
|
setToasts((prevToasts) => prevToasts.filter((toast) => toast.id !== id));
|
|
@@ -14067,7 +14135,7 @@ var DxcToastsQueue = ({ children, duration = 3e3 }) => {
|
|
|
14067
14135
|
useEffect28(() => {
|
|
14068
14136
|
setIsMounted(true);
|
|
14069
14137
|
}, []);
|
|
14070
|
-
return /* @__PURE__ */
|
|
14138
|
+
return /* @__PURE__ */ jsxs60(ToastContext_default.Provider, { value: add, children: [
|
|
14071
14139
|
isMounted && createPortal3(
|
|
14072
14140
|
/* @__PURE__ */ jsx82(ToastsQueue, { children: toasts.map((t) => /* @__PURE__ */ jsx82(
|
|
14073
14141
|
Toast_default,
|
|
@@ -14088,9 +14156,9 @@ var DxcToastsQueue = ({ children, duration = 3e3 }) => {
|
|
|
14088
14156
|
var ToastsQueue_default = DxcToastsQueue;
|
|
14089
14157
|
|
|
14090
14158
|
// src/toggle-group/ToggleGroup.tsx
|
|
14091
|
-
import { useContext as useContext54, useId as useId21, useState as
|
|
14159
|
+
import { useContext as useContext54, useId as useId21, useState as useState39 } from "react";
|
|
14092
14160
|
import styled75, { ThemeProvider as ThemeProvider39 } from "styled-components";
|
|
14093
|
-
import { jsx as jsx83, jsxs as
|
|
14161
|
+
import { jsx as jsx83, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
14094
14162
|
var DxcToggleGroup = ({
|
|
14095
14163
|
label,
|
|
14096
14164
|
helperText,
|
|
@@ -14104,7 +14172,7 @@ var DxcToggleGroup = ({
|
|
|
14104
14172
|
tabIndex = 0
|
|
14105
14173
|
}) => {
|
|
14106
14174
|
const toggleGroupLabelId = `label-toggle-group-${useId21()}`;
|
|
14107
|
-
const [selectedValue, setSelectedValue] =
|
|
14175
|
+
const [selectedValue, setSelectedValue] = useState39(defaultValue ?? (multiple ? [] : -1));
|
|
14108
14176
|
const colorsTheme = useContext54(HalstackContext);
|
|
14109
14177
|
const handleToggleChange = (selectedOption) => {
|
|
14110
14178
|
let newSelectedOptions = [];
|
|
@@ -14143,7 +14211,7 @@ var DxcToggleGroup = ({
|
|
|
14143
14211
|
break;
|
|
14144
14212
|
}
|
|
14145
14213
|
};
|
|
14146
|
-
return /* @__PURE__ */ jsx83(ThemeProvider39, { theme: colorsTheme.toggleGroup, children: /* @__PURE__ */
|
|
14214
|
+
return /* @__PURE__ */ jsx83(ThemeProvider39, { theme: colorsTheme.toggleGroup, children: /* @__PURE__ */ jsxs61(ToggleGroup, { margin, children: [
|
|
14147
14215
|
/* @__PURE__ */ jsx83(Label13, { id: toggleGroupLabelId, disabled, children: label }),
|
|
14148
14216
|
/* @__PURE__ */ jsx83(HelperText9, { disabled, children: helperText }),
|
|
14149
14217
|
/* @__PURE__ */ jsx83(OptionsContainer, { "aria-labelledby": toggleGroupLabelId, children: options.map((option, i) => /* @__PURE__ */ jsx83(Tooltip, { label: option.title, children: /* @__PURE__ */ jsx83(
|
|
@@ -14162,7 +14230,7 @@ var DxcToggleGroup = ({
|
|
|
14162
14230
|
hasIcon: option.icon,
|
|
14163
14231
|
optionLabel: option.label ?? "",
|
|
14164
14232
|
selected: multiple ? value ? Array.isArray(value) && value.includes(option.value) : Array.isArray(selectedValue) && selectedValue.includes(option.value) : value ? option.value === value : option.value === selectedValue,
|
|
14165
|
-
children: /* @__PURE__ */
|
|
14233
|
+
children: /* @__PURE__ */ jsxs61(Flex_default, { alignItems: "center", children: [
|
|
14166
14234
|
option.icon && /* @__PURE__ */ jsx83(IconContainer7, { optionLabel: option.label ?? "", children: typeof option.icon === "string" ? /* @__PURE__ */ jsx83(Icon_default, { icon: option.icon }) : option.icon }),
|
|
14167
14235
|
option.label && /* @__PURE__ */ jsx83(LabelContainer6, { children: option.label })
|
|
14168
14236
|
] })
|
|
@@ -14257,13 +14325,13 @@ var IconContainer7 = styled75.div`
|
|
|
14257
14325
|
var ToggleGroup_default = DxcToggleGroup;
|
|
14258
14326
|
|
|
14259
14327
|
// src/wizard/Wizard.tsx
|
|
14260
|
-
import { useContext as useContext55, useMemo as useMemo22, useState as
|
|
14328
|
+
import { useContext as useContext55, useMemo as useMemo22, useState as useState40 } from "react";
|
|
14261
14329
|
import styled76, { ThemeProvider as ThemeProvider40 } from "styled-components";
|
|
14262
14330
|
|
|
14263
14331
|
// src/wizard/Icons.tsx
|
|
14264
|
-
import { jsx as jsx84, jsxs as
|
|
14332
|
+
import { jsx as jsx84, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
14265
14333
|
var icons2 = {
|
|
14266
|
-
valid: /* @__PURE__ */
|
|
14334
|
+
valid: /* @__PURE__ */ jsxs62("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 18 18", children: [
|
|
14267
14335
|
/* @__PURE__ */ jsx84("path", { "data-name": "Path 2946", d: "M0,0H18V18H0Z", fill: "none" }),
|
|
14268
14336
|
/* @__PURE__ */ jsx84(
|
|
14269
14337
|
"path",
|
|
@@ -14285,7 +14353,7 @@ var icons2 = {
|
|
|
14285
14353
|
}
|
|
14286
14354
|
)
|
|
14287
14355
|
] }),
|
|
14288
|
-
invalid: /* @__PURE__ */
|
|
14356
|
+
invalid: /* @__PURE__ */ jsxs62("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 18 18", children: [
|
|
14289
14357
|
/* @__PURE__ */ jsx84("path", { "data-name": "Path 2943", d: "M0,0H18V18H0Z", fill: "none" }),
|
|
14290
14358
|
/* @__PURE__ */ jsx84(
|
|
14291
14359
|
"path",
|
|
@@ -14310,7 +14378,7 @@ var icons2 = {
|
|
|
14310
14378
|
var Icons_default3 = icons2;
|
|
14311
14379
|
|
|
14312
14380
|
// src/wizard/Wizard.tsx
|
|
14313
|
-
import { jsx as jsx85, jsxs as
|
|
14381
|
+
import { jsx as jsx85, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
14314
14382
|
var StepsContainer = styled76.div`
|
|
14315
14383
|
display: flex;
|
|
14316
14384
|
flex-direction: ${(props) => props.mode === "vertical" ? "column" : "row"};
|
|
@@ -14432,14 +14500,14 @@ var DxcWizard = ({
|
|
|
14432
14500
|
tabIndex = 0
|
|
14433
14501
|
}) => {
|
|
14434
14502
|
const colorsTheme = useContext55(HalstackContext);
|
|
14435
|
-
const [innerCurrent, setInnerCurrentStep] =
|
|
14503
|
+
const [innerCurrent, setInnerCurrentStep] = useState40(defaultCurrentStep);
|
|
14436
14504
|
const renderedCurrent = useMemo22(() => currentStep ?? innerCurrent, [currentStep, innerCurrent]);
|
|
14437
14505
|
const handleStepClick = (newValue) => {
|
|
14438
14506
|
setInnerCurrentStep(newValue);
|
|
14439
14507
|
onStepClick?.(newValue);
|
|
14440
14508
|
};
|
|
14441
|
-
return /* @__PURE__ */ jsx85(ThemeProvider40, { theme: colorsTheme.wizard, children: /* @__PURE__ */ jsx85(StepsContainer, { mode, margin, role: "group", children: steps.map((step, i) => /* @__PURE__ */
|
|
14442
|
-
/* @__PURE__ */
|
|
14509
|
+
return /* @__PURE__ */ jsx85(ThemeProvider40, { theme: colorsTheme.wizard, children: /* @__PURE__ */ jsx85(StepsContainer, { mode, margin, role: "group", children: steps.map((step, i) => /* @__PURE__ */ jsxs63(StepContainer, { mode, lastStep: i === steps.length - 1, children: [
|
|
14510
|
+
/* @__PURE__ */ jsxs63(
|
|
14443
14511
|
Step,
|
|
14444
14512
|
{
|
|
14445
14513
|
onClick: () => {
|
|
@@ -14452,11 +14520,11 @@ var DxcWizard = ({
|
|
|
14452
14520
|
"aria-current": renderedCurrent === i ? "step" : "false",
|
|
14453
14521
|
tabIndex,
|
|
14454
14522
|
children: [
|
|
14455
|
-
/* @__PURE__ */
|
|
14523
|
+
/* @__PURE__ */ jsxs63(StepHeader, { validityIcon: step.valid != null, children: [
|
|
14456
14524
|
/* @__PURE__ */ jsx85(IconContainer8, { current: i === renderedCurrent, visited: i < renderedCurrent, disabled: step.disabled, children: step.icon ? typeof step.icon === "string" ? /* @__PURE__ */ jsx85(Icon_default, { icon: step.icon }) : step.icon : /* @__PURE__ */ jsx85(Number3, { children: i + 1 }) }),
|
|
14457
14525
|
step.valid != null && /* @__PURE__ */ jsx85(ValidityIconContainer, { children: step.valid ? Icons_default3.valid : Icons_default3.invalid })
|
|
14458
14526
|
] }),
|
|
14459
|
-
(step.label || step.description) && /* @__PURE__ */
|
|
14527
|
+
(step.label || step.description) && /* @__PURE__ */ jsxs63("div", { children: [
|
|
14460
14528
|
step.label && /* @__PURE__ */ jsx85(Label14, { current: i === renderedCurrent, disabled: step.disabled, visited: i <= innerCurrent, children: step.label }),
|
|
14461
14529
|
step.description && /* @__PURE__ */ jsx85(Description, { current: i === renderedCurrent, disabled: step.disabled, visited: i <= innerCurrent, children: step.description })
|
|
14462
14530
|
] })
|