kiban-design-system 1.1.5-hotfix.0 → 1.1.7-hotfix.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AlphaMultiSelectionPicker/AlphaMultiSelectionPicker.d.ts +4 -0
- package/dist/components/AlphaMultiSelectionPicker/AlphaMultiSelectionPicker.props.d.ts +14 -0
- package/dist/components/AlphaMultiSelectionPicker/components/Picker/Picker.d.ts +5 -0
- package/dist/components/{AlphaTimeSelector/components/TimePicker/TimePicker.props.d.ts → AlphaMultiSelectionPicker/components/Picker/Picker.props.d.ts} +3 -3
- package/dist/components/AlphaMultiSelectionPicker/components/Picker/components/List/List.props.d.ts +6 -0
- package/dist/components/AlphaMultiSelectionPicker/components/Picker/index.d.ts +3 -0
- package/dist/components/AlphaMultiSelectionPicker/components/index.d.ts +1 -0
- package/dist/components/AlphaMultiSelectionPicker/index.d.ts +3 -0
- package/dist/components/AlphaSegmentedControl/AlphaSegmentedControl.d.ts +5 -0
- package/dist/components/AlphaSegmentedControl/AlphaSegmentedControl.props.d.ts +14 -0
- package/dist/components/AlphaSegmentedControl/index.d.ts +3 -0
- package/dist/components/AlphaTimeSelector/TimeSelector.d.ts +1 -1
- package/dist/components/AlphaTimeSelector/TimeSelector.props.d.ts +14 -8
- package/dist/components/AlphaZipCodeInput/AlphaZipCodeInput.d.ts +5 -0
- package/dist/components/AlphaZipCodeInput/AlphaZipCodeInput.props.d.ts +17 -0
- package/dist/components/AlphaZipCodeInput/index.d.ts +3 -0
- package/dist/components/Select/Select.d.ts +1 -1
- package/dist/components/Select/Select.props.d.ts +6 -8
- package/dist/components/index.d.ts +3 -0
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/index.js +354 -196
- package/dist/index.js.map +1 -1
- package/dist/utils/formatFileSize.d.ts +2 -0
- package/dist/utils/index.d.ts +2 -1
- package/package.json +1 -1
- package/dist/components/AlphaTimeSelector/components/TimePicker/TimePicker.d.ts +0 -5
- package/dist/components/AlphaTimeSelector/components/TimePicker/TimePicker.test.d.ts +0 -1
- package/dist/components/AlphaTimeSelector/components/TimePicker/components/List/List.props.d.ts +0 -6
- package/dist/components/AlphaTimeSelector/components/TimePicker/components/List/List.test.d.ts +0 -1
- package/dist/components/AlphaTimeSelector/components/TimePicker/index.d.ts +0 -3
- package/dist/components/AlphaTimeSelector/components/index.d.ts +0 -1
- /package/dist/components/{AlphaTimeSelector/TimeSelector.test.d.ts → AlphaMultiSelectionPicker/AlphaMultiSelectionPicker.test.d.ts} +0 -0
- /package/dist/components/{AlphaTimeSelector/components/TimePicker → AlphaMultiSelectionPicker/components/Picker}/components/List/List.d.ts +0 -0
- /package/dist/components/{AlphaTimeSelector/components/TimePicker → AlphaMultiSelectionPicker/components/Picker}/components/List/index.d.ts +0 -0
- /package/dist/components/{AlphaTimeSelector/components/TimePicker → AlphaMultiSelectionPicker/components/Picker}/components/index.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -1032,6 +1032,19 @@ const isComponentTypeOf = (childComponent, parentComponent) => {
|
|
|
1032
1032
|
return Components.some((Component) => typeof type !== 'string' && type === Component);
|
|
1033
1033
|
};
|
|
1034
1034
|
|
|
1035
|
+
function formatFileSize(bytes) {
|
|
1036
|
+
const units = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
|
1037
|
+
let unitIndex = 0;
|
|
1038
|
+
let size = bytes;
|
|
1039
|
+
while (size >= 1024 && unitIndex < units.length - 1) {
|
|
1040
|
+
size /= 1024;
|
|
1041
|
+
unitIndex += 1;
|
|
1042
|
+
}
|
|
1043
|
+
return `${size.toFixed(2)} ${units[unitIndex]}`;
|
|
1044
|
+
}
|
|
1045
|
+
// eslint-disable-next-line
|
|
1046
|
+
// code end
|
|
1047
|
+
|
|
1035
1048
|
const cssClassName = (mainClass, ...classes) => {
|
|
1036
1049
|
const filteredClasses = classes
|
|
1037
1050
|
.filter(Boolean)
|
|
@@ -1061,10 +1074,10 @@ const PendingIcon = () => (jsxs("svg", Object.assign({ width: '24', height: '24'
|
|
|
1061
1074
|
|
|
1062
1075
|
const WarningIcon = () => (jsxs("svg", Object.assign({ width: '24', height: '24', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '2', strokeLinecap: 'round', strokeLinejoin: 'round' }, { children: [jsx("path", { d: 'M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z' }, void 0), jsx("line", { x1: '12', y1: '9', x2: '12', y2: '13' }, void 0), jsx("line", { x1: '12', y1: '17', x2: '12.01', y2: '17' }, void 0)] }), void 0));
|
|
1063
1076
|
|
|
1064
|
-
const COMPONENT_NAME$
|
|
1077
|
+
const COMPONENT_NAME$B = 'AlphaAttributeInput';
|
|
1065
1078
|
const AlphaAttributeInput = ({ items, divider, label, isRequired, }) => {
|
|
1066
1079
|
const [isFocused, setIsFocused] = useState(false);
|
|
1067
|
-
const className = cssClassName(COMPONENT_NAME$
|
|
1080
|
+
const className = cssClassName(COMPONENT_NAME$B, isFocused && 'isFocused');
|
|
1068
1081
|
const handleBlur = (callback) => {
|
|
1069
1082
|
setIsFocused(false);
|
|
1070
1083
|
if (callback) {
|
|
@@ -1083,25 +1096,25 @@ const AlphaAttributeInput = ({ items, divider, label, isRequired, }) => {
|
|
|
1083
1096
|
item.onChange(event.target.value);
|
|
1084
1097
|
}
|
|
1085
1098
|
};
|
|
1086
|
-
const itemLabelMarkup = item.label ? (jsx("label", Object.assign({ className: `${COMPONENT_NAME$
|
|
1087
|
-
const dividerMarkup = divider && index < items.length - 1 ? (jsx("span", Object.assign({ className: `${COMPONENT_NAME$
|
|
1088
|
-
return (jsxs(Fragment$1, { children: [jsxs("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
1099
|
+
const itemLabelMarkup = item.label ? (jsx("label", Object.assign({ className: `${COMPONENT_NAME$B}__ItemLabelWrapper` }, { children: item.label }), void 0)) : null;
|
|
1100
|
+
const dividerMarkup = divider && index < items.length - 1 ? (jsx("span", Object.assign({ className: `${COMPONENT_NAME$B}__Divider` }, { children: divider }), void 0)) : null;
|
|
1101
|
+
return (jsxs(Fragment$1, { children: [jsxs("div", Object.assign({ className: `${COMPONENT_NAME$B}__Item` }, { children: [itemLabelMarkup, jsx("input", { type: item.type, value: item.value, onChange: handleChange, onBlur: () => handleBlur(item.onBlur), onFocus: () => handleFocus(item.onFocus), placeholder: item.placeholder, min: item.min, max: item.max, minLength: item.minLength, maxLength: item.maxLength }, void 0)] }), index), dividerMarkup] }, index));
|
|
1089
1102
|
};
|
|
1090
|
-
const labelMarkup = label ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
1091
|
-
const itemsMarkup = (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
1103
|
+
const labelMarkup = label ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$B}__LabelWrapper` }, { children: jsxs("label", Object.assign({ className: `${COMPONENT_NAME$B}__Label` }, { children: [label, isRequired ? (jsx("span", Object.assign({ className: `${COMPONENT_NAME$B}__IsRequiredSign` }, { children: "*" }), void 0)) : null] }), void 0) }), void 0)) : null;
|
|
1104
|
+
const itemsMarkup = (jsx("div", Object.assign({ className: `${COMPONENT_NAME$B}__ItemsWrapper` }, { children: items.map(renderItem) }), void 0));
|
|
1092
1105
|
return (jsxs("div", Object.assign({ className: className }, { children: [labelMarkup, itemsMarkup] }), void 0));
|
|
1093
1106
|
};
|
|
1094
1107
|
|
|
1095
|
-
const COMPONENT_NAME$
|
|
1108
|
+
const COMPONENT_NAME$A = 'AlphaBadge';
|
|
1096
1109
|
const AlphaBadge = ({ theme: themeProp, children, isSuccess, isWarning, isDanger, isPrimary, }) => {
|
|
1097
1110
|
const { theme } = useTheme();
|
|
1098
1111
|
const THEME_CLASS = `${theme}`;
|
|
1099
|
-
const className = cssClassName(COMPONENT_NAME$
|
|
1100
|
-
const childrenMarkup = children && (jsx("span", Object.assign({ className: `${COMPONENT_NAME$
|
|
1112
|
+
const className = cssClassName(COMPONENT_NAME$A, !themeProp && THEME_CLASS, isPrimary && 'isPrimary', isDanger && 'isDanger', isSuccess && 'isSuccess', isWarning && 'isWarning', themeProp && `${themeProp.toUpperCase()}`);
|
|
1113
|
+
const childrenMarkup = children && (jsx("span", Object.assign({ className: `${COMPONENT_NAME$A}__TextWrapper` }, { children: children }), void 0));
|
|
1101
1114
|
return jsx("span", Object.assign({ className: className }, { children: childrenMarkup }), void 0);
|
|
1102
1115
|
};
|
|
1103
1116
|
|
|
1104
|
-
const COMPONENT_NAME$
|
|
1117
|
+
const COMPONENT_NAME$z = 'AlphaIcon';
|
|
1105
1118
|
const ICON_COLOR_VARIANTS = [
|
|
1106
1119
|
'danger',
|
|
1107
1120
|
'darkGray',
|
|
@@ -1128,9 +1141,9 @@ const AlphaIcon = ({ source, size, color, filled, hasBackdrop, outlined, }) => {
|
|
|
1128
1141
|
if (color && !ICON_COLOR_VARIANTS.includes(color)) {
|
|
1129
1142
|
console.warn(`The color ${color} is not supported for the AlphaIcon component when hasBackdrop is true.`);
|
|
1130
1143
|
}
|
|
1131
|
-
const className = cssClassName(COMPONENT_NAME$
|
|
1144
|
+
const className = cssClassName(COMPONENT_NAME$z, color && `is-${color}`, filled && 'isFilled', outlined && 'isOutlined', size && `is-${size}`, hasBackdrop && 'hasBackdrop', source && `source-${sourceType}`);
|
|
1132
1145
|
const Source = source;
|
|
1133
|
-
const StringSource = (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
1146
|
+
const StringSource = (jsx("div", Object.assign({ className: `${COMPONENT_NAME$z}__StringSource` }, { children: jsx("span", { children: source }, void 0) }), void 0));
|
|
1134
1147
|
const content = {
|
|
1135
1148
|
function: jsx(Source, {}, void 0),
|
|
1136
1149
|
string: StringSource,
|
|
@@ -1138,9 +1151,9 @@ const AlphaIcon = ({ source, size, color, filled, hasBackdrop, outlined, }) => {
|
|
|
1138
1151
|
return jsx("span", Object.assign({ className: className }, { children: content[sourceType] }), void 0);
|
|
1139
1152
|
};
|
|
1140
1153
|
|
|
1141
|
-
const COMPONENT_NAME$
|
|
1154
|
+
const COMPONENT_NAME$y = 'AlphaSpinner';
|
|
1142
1155
|
const AlphaSpinner = ({ icon, size }) => {
|
|
1143
|
-
const className = cssClassName(COMPONENT_NAME$
|
|
1156
|
+
const className = cssClassName(COMPONENT_NAME$y);
|
|
1144
1157
|
let iconSource;
|
|
1145
1158
|
if (icon) {
|
|
1146
1159
|
if (isValidIcon(icon.icon)) {
|
|
@@ -1150,16 +1163,16 @@ const AlphaSpinner = ({ icon, size }) => {
|
|
|
1150
1163
|
iconSource = icon.icon;
|
|
1151
1164
|
}
|
|
1152
1165
|
}
|
|
1153
|
-
const iconMarkup = icon ? (jsx("span", Object.assign({ className: `${COMPONENT_NAME$
|
|
1166
|
+
const iconMarkup = icon ? (jsx("span", Object.assign({ className: `${COMPONENT_NAME$y}__IconWrapper` }, { children: iconSource }), void 0)) : null;
|
|
1154
1167
|
return jsx("div", Object.assign({ className: className }, { children: iconMarkup }), void 0);
|
|
1155
1168
|
};
|
|
1156
1169
|
|
|
1157
|
-
const COMPONENT_NAME$
|
|
1170
|
+
const COMPONENT_NAME$x = 'AlphaButton';
|
|
1158
1171
|
const AlphaButton = ({ ariaLabel, children, icon, spinnerIcon, iconPosition = 'left', id, isDanger, isDisabled, isFullWidth, isLink, isLoading, isPrimary, isSubmit, isTertiary, size = 'medium', textAlign = 'center', isRounded, theme: themeProp, onClick, onFocus, onBlur, onKeyPress, onKeyUp, onKeyDown, onMouseEnter, onMouseLeave, onTouchStart, onTouchEnd, }) => {
|
|
1159
1172
|
const { theme } = useTheme();
|
|
1160
1173
|
const THEME_CLASS = `${theme}`;
|
|
1161
1174
|
const isIconOnly = !children && icon;
|
|
1162
|
-
const className = cssClassName(COMPONENT_NAME$
|
|
1175
|
+
const className = cssClassName(COMPONENT_NAME$x, !themeProp && THEME_CLASS, isPrimary && 'isPrimary', isDanger && 'isDanger', isTertiary && 'isTertiary', isFullWidth && 'isFullWidth', isLink && 'isLink', isDisabled && 'isDisabled', isLoading && 'isLoading', size && `is-${size}`, textAlign && `has-text-${textAlign}`, icon && `has-icon-${iconPosition}`, isIconOnly && 'onlyIcon', isIconOnly && isRounded && 'isRounded', themeProp && `${themeProp.toUpperCase()}`);
|
|
1163
1176
|
const buttonProps = {
|
|
1164
1177
|
id,
|
|
1165
1178
|
type: isSubmit ? 'submit' : 'button',
|
|
@@ -1176,7 +1189,7 @@ const AlphaButton = ({ ariaLabel, children, icon, spinnerIcon, iconPosition = 'l
|
|
|
1176
1189
|
onTouchStart,
|
|
1177
1190
|
onTouchEnd,
|
|
1178
1191
|
};
|
|
1179
|
-
const childrenMarkup = children ? (jsx("span", Object.assign({ className: `${COMPONENT_NAME$
|
|
1192
|
+
const childrenMarkup = children ? (jsx("span", Object.assign({ className: `${COMPONENT_NAME$x}__TextWrapper` }, { children: children }), void 0)) : null;
|
|
1180
1193
|
let iconSource;
|
|
1181
1194
|
let spinnerIconSource;
|
|
1182
1195
|
if (icon) {
|
|
@@ -1195,18 +1208,18 @@ const AlphaButton = ({ ariaLabel, children, icon, spinnerIcon, iconPosition = 'l
|
|
|
1195
1208
|
spinnerIconSource = spinnerIcon.icon;
|
|
1196
1209
|
}
|
|
1197
1210
|
}
|
|
1198
|
-
const iconMarkup = icon ? (jsx("span", Object.assign({ className: `${COMPONENT_NAME$
|
|
1199
|
-
const spinnerMarkup = isLoading && (jsx("span", Object.assign({ className: `${COMPONENT_NAME$
|
|
1211
|
+
const iconMarkup = icon ? (jsx("span", Object.assign({ className: `${COMPONENT_NAME$x}__IconWrapper` }, { children: iconSource }), void 0)) : null;
|
|
1212
|
+
const spinnerMarkup = isLoading && (jsx("span", Object.assign({ className: `${COMPONENT_NAME$x}__SpinnerWrapper` }, { children: spinnerIconSource }), void 0));
|
|
1200
1213
|
return (jsxs("button", Object.assign({ className: className }, buttonProps, { children: [spinnerMarkup, iconMarkup, childrenMarkup] }), void 0));
|
|
1201
1214
|
};
|
|
1202
1215
|
|
|
1203
|
-
const COMPONENT_NAME$
|
|
1216
|
+
const COMPONENT_NAME$w = 'AlphaChip';
|
|
1204
1217
|
const AlphaChip = ({ children, hasError, removeButtonIcon, isDisabled, theme, onRemove, }) => {
|
|
1205
1218
|
const { theme: currentTheme } = useTheme();
|
|
1206
1219
|
const THEME_CLASS = `${currentTheme}`;
|
|
1207
|
-
const className = cssClassName(COMPONENT_NAME$
|
|
1208
|
-
const childrenMarkup = children ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
1209
|
-
const closeButtonMarkup = removeButtonIcon && (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
1220
|
+
const className = cssClassName(COMPONENT_NAME$w, hasError && 'hasError', isDisabled && 'isDisabled', theme && `${theme.toUpperCase()}`, THEME_CLASS);
|
|
1221
|
+
const childrenMarkup = children ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$w}__TextWrapper` }, { children: children }), void 0)) : null;
|
|
1222
|
+
const closeButtonMarkup = removeButtonIcon && (jsx("div", Object.assign({ className: `${COMPONENT_NAME$w}__CloseButtonWrapper` }, { children: jsx(AlphaButton, { onClick: onRemove, icon: removeButtonIcon }, void 0) }), void 0));
|
|
1210
1223
|
return (jsxs("div", Object.assign({ className: className }, { children: [childrenMarkup, closeButtonMarkup] }), void 0));
|
|
1211
1224
|
};
|
|
1212
1225
|
|
|
@@ -1406,10 +1419,10 @@ const Panel$1 = ({ id, children, isHidden }) => {
|
|
|
1406
1419
|
return (jsx("div", Object.assign({ className: className, id: id }, { children: children }), void 0));
|
|
1407
1420
|
};
|
|
1408
1421
|
|
|
1409
|
-
const COMPONENT_NAME$
|
|
1422
|
+
const COMPONENT_NAME$v = 'Tabs';
|
|
1410
1423
|
const Tabs = ({ onSelect, selected, tabs, children, className, areFitted, }) => {
|
|
1411
1424
|
const { theme } = useTheme();
|
|
1412
|
-
const classNames = cssClassName(COMPONENT_NAME$
|
|
1425
|
+
const classNames = cssClassName(COMPONENT_NAME$v, `is${themeClassConverter(theme)}`);
|
|
1413
1426
|
const panelMarkup = children
|
|
1414
1427
|
? tabs.map((tab, index) => selected === index ? (jsx(Panel$1, Object.assign({ id: tab.panelID || `${tab.id}-panel` }, { children: children }), tab.id)) : (jsx(Panel$1, { id: tab.panelID || `${tab.id}-panel`, isHidden: true }, tab.id)))
|
|
1415
1428
|
: null;
|
|
@@ -1567,10 +1580,10 @@ const getPosition = (activator, tooltip, alignment) => {
|
|
|
1567
1580
|
};
|
|
1568
1581
|
};
|
|
1569
1582
|
|
|
1570
|
-
const COMPONENT_NAME$
|
|
1583
|
+
const COMPONENT_NAME$u = 'Alpha__TooltipOverlay';
|
|
1571
1584
|
const Overlay = ({ children, activator, active, zIndexOverride, position = 'bottom', appearance = 'default', width, parentTooltip, theme, onClick, }) => {
|
|
1572
1585
|
const tooltipRef = useRef(null);
|
|
1573
|
-
const overlayClassName = cssClassName(COMPONENT_NAME$
|
|
1586
|
+
const overlayClassName = cssClassName(COMPONENT_NAME$u, position && `is-${position}`, appearance && `is-${appearance}`, theme && appearance === 'default' && `is-${theme}`);
|
|
1574
1587
|
const [positionStyles, setPositionStyles] = useState({
|
|
1575
1588
|
'--tooltip-overlay-top': 0,
|
|
1576
1589
|
'--tooltip-overlay-left': 0,
|
|
@@ -1606,7 +1619,7 @@ const Overlay = ({ children, activator, active, zIndexOverride, position = 'bott
|
|
|
1606
1619
|
return markup;
|
|
1607
1620
|
};
|
|
1608
1621
|
|
|
1609
|
-
const COMPONENT_NAME$
|
|
1622
|
+
const COMPONENT_NAME$t = 'AlphaTooltip';
|
|
1610
1623
|
const AlphaTooltip = ({ content, children, activatorWrapper = 'span', isActive: isActiveProp = false, onClose, onOpen, position, width, parentTooltip, zIndexOverride, appearance, persistence, theme, }) => {
|
|
1611
1624
|
const [activatorNode, setActivatorNode] = useState(null);
|
|
1612
1625
|
const [isActive, setIsActive] = useState(isActiveProp);
|
|
@@ -1614,7 +1627,7 @@ const AlphaTooltip = ({ content, children, activatorWrapper = 'span', isActive:
|
|
|
1614
1627
|
const isMouseOver = useRef(false);
|
|
1615
1628
|
const activatorContainer = useRef(null);
|
|
1616
1629
|
const WrapperComponent = activatorWrapper;
|
|
1617
|
-
const className = cssClassName(COMPONENT_NAME$
|
|
1630
|
+
const className = cssClassName(COMPONENT_NAME$t);
|
|
1618
1631
|
const handleOpen = useCallback(() => {
|
|
1619
1632
|
if (!isActivePersistence) {
|
|
1620
1633
|
setIsActive(true);
|
|
@@ -2193,10 +2206,10 @@ const Popover$1 = ({ activator, children, isActive, onClose, isFullWidth = false
|
|
|
2193
2206
|
};
|
|
2194
2207
|
Popover$1.Pane = Pane$1;
|
|
2195
2208
|
|
|
2196
|
-
const COMPONENT_NAME$
|
|
2209
|
+
const COMPONENT_NAME$s = 'Divider';
|
|
2197
2210
|
const Divider = ({ alignment = 'left', label }) => {
|
|
2198
|
-
const className = cssClassName(COMPONENT_NAME$
|
|
2199
|
-
const labelMarkup = label ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
2211
|
+
const className = cssClassName(COMPONENT_NAME$s, alignment, !label && 'no-label');
|
|
2212
|
+
const labelMarkup = label ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$s}__LabelWrapper` }, { children: jsx("span", Object.assign({ className: `${COMPONENT_NAME$s}__Label` }, { children: label }), void 0) }), void 0)) : null;
|
|
2200
2213
|
return jsx("div", Object.assign({ className: className }, { children: labelMarkup }), void 0);
|
|
2201
2214
|
};
|
|
2202
2215
|
|
|
@@ -2247,11 +2260,53 @@ const useTheme = () => {
|
|
|
2247
2260
|
* @param {string} InputTextProps.ariaLabel - Label to use in automatic tests
|
|
2248
2261
|
* @returns {symbol} - Element Select
|
|
2249
2262
|
*/
|
|
2250
|
-
const Select = ({ ariaLabel, items, sections, isMultiple, placeholder, label, selected, onChange, searchPlaceholder, searchLabel, helperText, isHelperMode, isDisabled = false,
|
|
2263
|
+
const Select = ({ ariaLabel, items, sections, isMultiple, placeholder, label, selected, onChange, searchPlaceholder, searchLabel, helperText, isHelperMode, isDisabled = false, tooltip, isDanger, isReadOnly = false, id, emptyState, onBlur, isRequired, tooltipLabel, action, showSearch = true, }) => {
|
|
2251
2264
|
const [isActivePopover, setIsActive] = useState(false);
|
|
2252
2265
|
const selectActivatorRef = useRef(null);
|
|
2253
2266
|
const [parentCoord, setParentCoords] = useState();
|
|
2267
|
+
const [search, setSearch] = useState('');
|
|
2268
|
+
const [sectionsFiltered, setSectionsFiltered] = useState(sections);
|
|
2269
|
+
const [itemsFiltered, setItemsFiltered] = useState(items);
|
|
2254
2270
|
const { theme } = useTheme();
|
|
2271
|
+
const handleOnSearch = (value) => {
|
|
2272
|
+
setSearch(value || '');
|
|
2273
|
+
if (value) {
|
|
2274
|
+
if (sections) {
|
|
2275
|
+
const newSections = [];
|
|
2276
|
+
sections.forEach((section) => {
|
|
2277
|
+
const { items: itemsSection } = section;
|
|
2278
|
+
if (!itemsSection)
|
|
2279
|
+
newSections.push(section);
|
|
2280
|
+
else {
|
|
2281
|
+
const newItems = itemsSection.filter((item) => item.label
|
|
2282
|
+
.toLocaleLowerCase()
|
|
2283
|
+
.includes(search.toLocaleLowerCase()));
|
|
2284
|
+
newSections.push(Object.assign(Object.assign({}, section), { items: newItems }));
|
|
2285
|
+
}
|
|
2286
|
+
});
|
|
2287
|
+
setSectionsFiltered(newSections);
|
|
2288
|
+
}
|
|
2289
|
+
if (items) {
|
|
2290
|
+
const newItems = items.filter((item) => item.label
|
|
2291
|
+
.toLocaleLowerCase()
|
|
2292
|
+
.includes(search.toLocaleLowerCase()));
|
|
2293
|
+
setItemsFiltered(newItems);
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2296
|
+
else {
|
|
2297
|
+
setSectionsFiltered(sections);
|
|
2298
|
+
setItemsFiltered(items);
|
|
2299
|
+
}
|
|
2300
|
+
};
|
|
2301
|
+
let totalItems = 0;
|
|
2302
|
+
if (sections) {
|
|
2303
|
+
sections.forEach((section) => {
|
|
2304
|
+
if (section.items)
|
|
2305
|
+
totalItems += section.items.length;
|
|
2306
|
+
});
|
|
2307
|
+
}
|
|
2308
|
+
if (items)
|
|
2309
|
+
totalItems = items.length;
|
|
2255
2310
|
const handleClickSelectReadOnlyOutside = (event) => {
|
|
2256
2311
|
if (selectActivatorRef.current &&
|
|
2257
2312
|
!selectActivatorRef.current.contains(event.target)) {
|
|
@@ -2266,6 +2321,12 @@ const Select = ({ ariaLabel, items, sections, isMultiple, placeholder, label, se
|
|
|
2266
2321
|
};
|
|
2267
2322
|
}
|
|
2268
2323
|
}, [isActivePopover]);
|
|
2324
|
+
useEffect(() => {
|
|
2325
|
+
setSectionsFiltered(sections);
|
|
2326
|
+
}, [sections]);
|
|
2327
|
+
useEffect(() => {
|
|
2328
|
+
setItemsFiltered(items);
|
|
2329
|
+
}, [items]);
|
|
2269
2330
|
const handleOpenPopover = () => setIsActive(!isActivePopover);
|
|
2270
2331
|
const removeTag = (event, value) => {
|
|
2271
2332
|
event.stopPropagation();
|
|
@@ -2357,9 +2418,10 @@ const Select = ({ ariaLabel, items, sections, isMultiple, placeholder, label, se
|
|
|
2357
2418
|
}, [action]);
|
|
2358
2419
|
const actionIconProp = action && action.icon ? { icon: action.icon, outlined: true } : undefined;
|
|
2359
2420
|
const actionMarkup = action ? (jsxs(Fragment, { children: [(items === null || items === void 0 ? void 0 : items.length) ? jsx(Divider, {}, void 0) : null, jsx(AlphaButton, Object.assign({ isLink: true, isTertiary: true, onClick: handleActionClick, icon: actionIconProp, iconPosition: action.iconPosition, theme: (theme === null || theme === void 0 ? void 0 : theme.toLowerCase()) || undefined }, { children: action.content }), void 0)] }, void 0)) : null;
|
|
2421
|
+
const searchMarkup = totalItems > 10 && showSearch ? (jsx("div", Object.assign({ className: 'Select__search' }, { children: jsx(InputText, { placeholder: searchPlaceholder, icon: 'Search', value: search, label: searchLabel, onChange: handleOnSearch }, void 0) }), void 0)) : null;
|
|
2360
2422
|
const renderInput = () => (jsx("div", Object.assign({ id: id }, { children: jsxs(Popover$1, Object.assign({ isActive: isReadOnly ? false : isActivePopover, activator: jsxs("div", Object.assign({ "aria-label": ariaLabel, tabIndex: 0, className: clasessSelect, id: `select-${id}`, onKeyDown: onKeyDown, onClick: handleClickSelect, onBlur: onBlur }, { children: [selected && selected.length > 0 && (jsx("div", Object.assign({ className: 'Select__selected' }, { children: isMultiple
|
|
2361
2423
|
? selected === null || selected === void 0 ? void 0 : selected.map((option, index) => (jsx("div", Object.assign({ className: 'Select__tag-container' }, { children: jsx(Tag, Object.assign({ onRemove: (evt) => removeTag(evt, option), isDisabled: isDisabled, isDanger: isDanger }, { children: getLabelOption(option) }), void 0) }), `Select-tag--${index}`)))
|
|
2362
|
-
: selected === null || selected === void 0 ? void 0 : selected.map((option, index) => (jsx("span", { children: getLabelOption(option) }, `option-${index}`))) }), void 0)), (!selected || selected.length <= 0) && placeholder && (jsx("div", Object.assign({ className: 'Select__placeholder' }, { children: placeholder }), void 0)), jsx("div", Object.assign({ className: 'Select__icon', onClick: handleOnClickIcon }, { children: jsx(Icon, { name: isActivePopover && !isReadOnly ? 'ChevronUp' : 'ChevronDown' }, void 0) }), void 0)] }), void 0), isFullWidth: true, onClose: () => setIsActive(false) }, { children: [
|
|
2424
|
+
: selected === null || selected === void 0 ? void 0 : selected.map((option, index) => (jsx("span", { children: getLabelOption(option) }, `option-${index}`))) }), void 0)), (!selected || selected.length <= 0) && placeholder && (jsx("div", Object.assign({ className: 'Select__placeholder' }, { children: placeholder }), void 0)), jsx("div", Object.assign({ className: 'Select__icon', onClick: handleOnClickIcon }, { children: jsx(Icon, { name: isActivePopover && !isReadOnly ? 'ChevronUp' : 'ChevronDown' }, void 0) }), void 0)] }), void 0), isFullWidth: true, onClose: () => setIsActive(false) }, { children: [searchMarkup, emptyState && (jsx(Popover$1.Pane, { children: jsx("div", Object.assign({ className: 'emptyState__container' }, { children: emptyState }), void 0) }, void 0)), !emptyState && (jsxs(Popover$1.Pane, { children: [jsx(OptionList, { sections: sectionsFiltered, items: itemsFiltered, isMultiple: isMultiple, onChange: (value) => {
|
|
2363
2425
|
if (!isMultiple) {
|
|
2364
2426
|
handleOpenPopover();
|
|
2365
2427
|
}
|
|
@@ -9641,7 +9703,7 @@ function formatDate(date, toISO) {
|
|
|
9641
9703
|
return DateTime.fromJSDate(date).toFormat('dd/MM/yyyy');
|
|
9642
9704
|
}
|
|
9643
9705
|
|
|
9644
|
-
const COMPONENT_NAME$
|
|
9706
|
+
const COMPONENT_NAME$r = 'DateInput';
|
|
9645
9707
|
const AlphaInputDate = ({ ariaLabel, disabled, label, onChange, value, isRequired, placeholder, onBlur, errorMessage, months, weekdays, }) => {
|
|
9646
9708
|
const [isPopoverActive, setIsPopoverActive] = useState(false);
|
|
9647
9709
|
const [{ month, year }, setDate] = useState({
|
|
@@ -9652,7 +9714,7 @@ const AlphaInputDate = ({ ariaLabel, disabled, label, onChange, value, isRequire
|
|
|
9652
9714
|
const [isErrorTooltipActive, setIsErrorTooltipActive] = useState(false);
|
|
9653
9715
|
const [selectedDate, setSelectedDate] = useState();
|
|
9654
9716
|
const inputRef = useRef(null);
|
|
9655
|
-
const className = cssClassName(COMPONENT_NAME$
|
|
9717
|
+
const className = cssClassName(COMPONENT_NAME$r);
|
|
9656
9718
|
const handleMonthChange = (monthValue, yearValue) => {
|
|
9657
9719
|
setDate({ month: monthValue, year: yearValue });
|
|
9658
9720
|
};
|
|
@@ -9774,7 +9836,7 @@ const AlphaInputDate = ({ ariaLabel, disabled, label, onChange, value, isRequire
|
|
|
9774
9836
|
}
|
|
9775
9837
|
}, [selectedDate]);
|
|
9776
9838
|
const datePickerMarkup = (jsx(DatePicker, { weekStartsOn: 1, month: month, year: year, onMonthChange: handleMonthChange, onChange: handleDateChange, selected: selectedDate || undefined, months: months, weekDays: weekdays }, void 0));
|
|
9777
|
-
const inputMarkup = (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
9839
|
+
const inputMarkup = (jsx("div", Object.assign({ className: `${COMPONENT_NAME$r}__InputWrapper`, onClick: () => setIsPopoverActive(true), ref: inputRef }, { children: jsx(AlphaTooltip, Object.assign({ persistence: true, isActive: isErrorTooltipActive, content: errorMessage, appearance: 'error' }, { children: jsx(InputText, { ariaLabel: ariaLabel, disabled: disabled, label: label, onChange: handleInputChange, value: inputValue, maxLength: 10, placeholder: placeholder, onBlur: handleInputBlur, icon: 'Calendar', isRequired: isRequired }, void 0) }), void 0) }), void 0));
|
|
9778
9840
|
const popoverMarkup = (jsx(Popover$1, Object.assign({ activator: inputMarkup, isActive: isPopoverActive, isFullWidth: true, onClose: () => setIsPopoverActive(false) }, { children: datePickerMarkup }), void 0));
|
|
9779
9841
|
return jsx("div", Object.assign({ className: className }, { children: popoverMarkup }), void 0);
|
|
9780
9842
|
};
|
|
@@ -9864,9 +9926,9 @@ const AlphaFilterControl = ({ primaryAction, secondaryActions, sections, title,
|
|
|
9864
9926
|
return (jsxs("div", Object.assign({ className: `${MAIN_CLASS$k}` }, { children: [headerMarkup, bodyMarkup, actionsMarkup] }), void 0));
|
|
9865
9927
|
};
|
|
9866
9928
|
|
|
9867
|
-
const COMPONENT_NAME$
|
|
9929
|
+
const COMPONENT_NAME$q = 'AlphaInlineError';
|
|
9868
9930
|
const AlphaInlineError = ({ icon, children }) => {
|
|
9869
|
-
const className = cssClassName(COMPONENT_NAME$
|
|
9931
|
+
const className = cssClassName(COMPONENT_NAME$q);
|
|
9870
9932
|
let iconSource;
|
|
9871
9933
|
if (icon) {
|
|
9872
9934
|
if (isValidIcon(icon.icon)) {
|
|
@@ -9876,23 +9938,23 @@ const AlphaInlineError = ({ icon, children }) => {
|
|
|
9876
9938
|
iconSource = icon.icon;
|
|
9877
9939
|
}
|
|
9878
9940
|
}
|
|
9879
|
-
const iconMarkup = icon ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
9880
|
-
const messageMarkup = children ? (jsx("span", Object.assign({ className: `${COMPONENT_NAME$
|
|
9941
|
+
const iconMarkup = icon ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$q}__IconWrapper` }, { children: iconSource }), void 0)) : null;
|
|
9942
|
+
const messageMarkup = children ? (jsx("span", Object.assign({ className: `${COMPONENT_NAME$q}__MessageWrapper` }, { children: children }), void 0)) : null;
|
|
9881
9943
|
return (jsxs("div", Object.assign({ className: className }, { children: [iconMarkup, messageMarkup] }), void 0));
|
|
9882
9944
|
};
|
|
9883
9945
|
|
|
9884
|
-
const COMPONENT_NAME$
|
|
9885
|
-
const className$1 = cssClassName(COMPONENT_NAME$
|
|
9946
|
+
const COMPONENT_NAME$p = 'AlphaLabel';
|
|
9947
|
+
const className$1 = cssClassName(COMPONENT_NAME$p);
|
|
9886
9948
|
const AlphaLabel = ({ children, isRequired, action, id }) => {
|
|
9887
|
-
const requiredSignMarkup = isRequired ? (jsx("span", Object.assign({ className: `${COMPONENT_NAME$
|
|
9949
|
+
const requiredSignMarkup = isRequired ? (jsx("span", Object.assign({ className: `${COMPONENT_NAME$p}__RequiredSign` }, { children: "*" }), void 0)) : null;
|
|
9888
9950
|
const labelMarkup = (jsxs("label", Object.assign({ htmlFor: id }, { children: [children, requiredSignMarkup] }), void 0));
|
|
9889
|
-
const actionMarkup = action ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
9951
|
+
const actionMarkup = action ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$p}__ActionWrapper` }, { children: jsx(AlphaButton, Object.assign({ id: action.id, isDanger: action.isDanger, onMouseEnter: action.onMouseEnter, onTouchStart: action.onTouchStart, isLink: true, onClick: action.onClick, isDisabled: action.isDisabled }, { children: action.content }), void 0) }), void 0)) : null;
|
|
9890
9952
|
return (jsxs("div", Object.assign({ className: className$1 }, { children: [labelMarkup, actionMarkup] }), void 0));
|
|
9891
9953
|
};
|
|
9892
9954
|
|
|
9893
|
-
const COMPONENT_NAME$
|
|
9955
|
+
const COMPONENT_NAME$o = 'AlphaLabelledField__HelpText';
|
|
9894
9956
|
const HelpText = ({ message, icon }) => {
|
|
9895
|
-
const className = cssClassName(COMPONENT_NAME$
|
|
9957
|
+
const className = cssClassName(COMPONENT_NAME$o);
|
|
9896
9958
|
let iconSource;
|
|
9897
9959
|
if (icon) {
|
|
9898
9960
|
if (isValidIcon(icon.icon)) {
|
|
@@ -9902,24 +9964,24 @@ const HelpText = ({ message, icon }) => {
|
|
|
9902
9964
|
iconSource = icon.icon;
|
|
9903
9965
|
}
|
|
9904
9966
|
}
|
|
9905
|
-
const iconMarkup = iconSource ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
9906
|
-
const messageMarkup = message ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
9967
|
+
const iconMarkup = iconSource ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$o}__IconWrapper` }, { children: iconSource }), void 0)) : null;
|
|
9968
|
+
const messageMarkup = message ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$o}__MessageWrapper` }, { children: message }), void 0)) : null;
|
|
9907
9969
|
return (jsxs("div", Object.assign({ className: className }, { children: [iconMarkup, messageMarkup] }), void 0));
|
|
9908
9970
|
};
|
|
9909
9971
|
|
|
9910
|
-
const COMPONENT_NAME$
|
|
9972
|
+
const COMPONENT_NAME$n = 'AlphaLabelledField';
|
|
9911
9973
|
const AlphaLabelledField = ({ label, children, action, error, helpText, id, isRequired, }) => {
|
|
9912
|
-
const className = cssClassName(COMPONENT_NAME$
|
|
9913
|
-
const labelMarkup = label ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
9914
|
-
const errorMarkup = error ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
9974
|
+
const className = cssClassName(COMPONENT_NAME$n);
|
|
9975
|
+
const labelMarkup = label ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$n}__LabelWrapper` }, { children: jsx(AlphaLabel, Object.assign({ action: action, id: id, isRequired: isRequired }, { children: label }), void 0) }), void 0)) : null;
|
|
9976
|
+
const errorMarkup = error ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$n}__ErrorWrapper` }, { children: jsx(AlphaInlineError, Object.assign({ icon: error.icon }, { children: error.message }), void 0) }), void 0)) : null;
|
|
9915
9977
|
const helpTextMarkup = helpText ? (jsx(HelpText, { message: helpText.message, icon: helpText.icon }, void 0)) : null;
|
|
9916
|
-
const contentMarkup = errorMarkup ? (jsx(AlphaTooltip, Object.assign({ persistence: true, content: errorMarkup, isActive: Boolean(errorMarkup), appearance: 'error' }, { children: jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
9978
|
+
const contentMarkup = errorMarkup ? (jsx(AlphaTooltip, Object.assign({ persistence: true, content: errorMarkup, isActive: Boolean(errorMarkup), appearance: 'error' }, { children: jsx("div", Object.assign({ className: `${COMPONENT_NAME$n}__ContentWrapper` }, { children: children }), void 0) }), void 0)) : (children);
|
|
9917
9979
|
return (jsxs("div", Object.assign({ className: className }, { children: [labelMarkup, contentMarkup, helpTextMarkup] }), void 0));
|
|
9918
9980
|
};
|
|
9919
9981
|
|
|
9920
|
-
const COMPONENT_NAME$
|
|
9982
|
+
const COMPONENT_NAME$m = 'AlphaInputText';
|
|
9921
9983
|
const AlphaInputText = ({ isDisabled, label }) => {
|
|
9922
|
-
const className = cssClassName(COMPONENT_NAME$
|
|
9984
|
+
const className = cssClassName(COMPONENT_NAME$m, isDisabled && 'isDisabled');
|
|
9923
9985
|
return (jsx(AlphaLabelledField, Object.assign({ label: label }, { children: jsx("div", { className: className }, void 0) }), void 0));
|
|
9924
9986
|
};
|
|
9925
9987
|
|
|
@@ -9927,14 +9989,14 @@ const StepDefault = {
|
|
|
9927
9989
|
status: 'incomplete',
|
|
9928
9990
|
};
|
|
9929
9991
|
|
|
9930
|
-
const COMPONENT_NAME$
|
|
9992
|
+
const COMPONENT_NAME$l = 'AlphaStepper__Step';
|
|
9931
9993
|
const Step = ({ iconMarkup, label, isComplete, isInactive, isSuccess, isLastStepComplete, isLastStepInactive, }) => {
|
|
9932
9994
|
const { theme } = useTheme();
|
|
9933
|
-
const itemClassName = cssClassName(`${COMPONENT_NAME$
|
|
9934
|
-
return (jsxs("div", Object.assign({ className: COMPONENT_NAME$
|
|
9995
|
+
const itemClassName = cssClassName(`${COMPONENT_NAME$l}__Item`, isComplete && `is-${theme}-light-after`, isInactive && 'is-inactive-light-after', isSuccess && 'is-success-light-after', isSuccess && 'is-success-light-before', isLastStepComplete && `is-${theme}-light-before`, isLastStepInactive && 'is-inactive-light-before');
|
|
9996
|
+
return (jsxs("div", Object.assign({ className: COMPONENT_NAME$l }, { children: [jsx("div", Object.assign({ className: itemClassName }, { children: iconMarkup }), void 0), jsx("div", Object.assign({ className: `${COMPONENT_NAME$l}__Label` }, { children: label }), void 0)] }), void 0));
|
|
9935
9997
|
};
|
|
9936
9998
|
|
|
9937
|
-
const COMPONENT_NAME$
|
|
9999
|
+
const COMPONENT_NAME$k = 'AlphaStepper';
|
|
9938
10000
|
const getSourceIcon = (icon) => {
|
|
9939
10001
|
if (icon) {
|
|
9940
10002
|
if (isValidIcon(icon.icon)) {
|
|
@@ -9949,7 +10011,7 @@ const AlphaStepper = ({ isSuccess, steps = [], completeIcon, incompleteIcon, err
|
|
|
9949
10011
|
const { theme } = useTheme();
|
|
9950
10012
|
const renderStep = (step = Object.assign({}, StepDefault), index) => {
|
|
9951
10013
|
const lastStepStatus = steps[index - 1] ? steps[index - 1].status : '';
|
|
9952
|
-
const iconClassName = cssClassName(`${COMPONENT_NAME$
|
|
10014
|
+
const iconClassName = cssClassName(`${COMPONENT_NAME$k}__IconWrapper`, (step.status === 'complete' || step.status === 'active') && `is-${theme}`, step.status !== 'complete' && `is-inactive`, step.hasError && errorIcon && 'is-danger', isSuccess && `is-success`);
|
|
9953
10015
|
let iconSource = getSourceIcon(incompleteIcon);
|
|
9954
10016
|
if (step.hasError && errorIcon)
|
|
9955
10017
|
iconSource = getSourceIcon(errorIcon);
|
|
@@ -9960,16 +10022,16 @@ const AlphaStepper = ({ isSuccess, steps = [], completeIcon, incompleteIcon, err
|
|
|
9960
10022
|
const isInactive = step.status === 'incomplete' || step.status === 'active';
|
|
9961
10023
|
const isLastStepComplete = lastStepStatus === 'complete';
|
|
9962
10024
|
const isLastStepInactive = lastStepStatus === 'incomplete' || lastStepStatus === 'active';
|
|
9963
|
-
return (jsx(Step, { iconMarkup: iconMarkup, label: step.label, isComplete: isComplete, isInactive: isInactive, isSuccess: isSuccess, isLastStepComplete: isLastStepComplete, isLastStepInactive: isLastStepInactive }, `${COMPONENT_NAME$
|
|
10025
|
+
return (jsx(Step, { iconMarkup: iconMarkup, label: step.label, isComplete: isComplete, isInactive: isInactive, isSuccess: isSuccess, isLastStepComplete: isLastStepComplete, isLastStepInactive: isLastStepInactive }, `${COMPONENT_NAME$k}-${index}`));
|
|
9964
10026
|
};
|
|
9965
10027
|
const stepsMarkup = steps ? steps.map(renderStep) : null;
|
|
9966
|
-
return jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
10028
|
+
return jsx("div", Object.assign({ className: `${COMPONENT_NAME$k}__Container` }, { children: stepsMarkup }), void 0);
|
|
9967
10029
|
};
|
|
9968
10030
|
|
|
9969
|
-
const COMPONENT_NAME$
|
|
10031
|
+
const COMPONENT_NAME$j = 'AlphaTag';
|
|
9970
10032
|
const AlphaTag = ({ color, children }) => {
|
|
9971
|
-
const className = cssClassName(COMPONENT_NAME$
|
|
9972
|
-
const childrenMarkup = (jsx("span", Object.assign({ className: `${COMPONENT_NAME$
|
|
10033
|
+
const className = cssClassName(COMPONENT_NAME$j, color && `is-${color.color}-${color.intensity}`);
|
|
10034
|
+
const childrenMarkup = (jsx("span", Object.assign({ className: `${COMPONENT_NAME$j}__TextWrapper` }, { children: children }), void 0));
|
|
9973
10035
|
return jsx("div", Object.assign({ className: className }, { children: childrenMarkup }), void 0);
|
|
9974
10036
|
};
|
|
9975
10037
|
|
|
@@ -9980,11 +10042,11 @@ const StatusIcon = {
|
|
|
9980
10042
|
Warning: WarningIcon,
|
|
9981
10043
|
};
|
|
9982
10044
|
|
|
9983
|
-
const COMPONENT_NAME$
|
|
10045
|
+
const COMPONENT_NAME$i = 'AlphaTile';
|
|
9984
10046
|
const AlphaTile = ({ isSelected, icon, status, theme: themeProp, title, onClick, }) => {
|
|
9985
10047
|
const { theme } = useTheme();
|
|
9986
|
-
const className = cssClassName(COMPONENT_NAME$
|
|
9987
|
-
const statusWrapperClassName = cssClassName(`${COMPONENT_NAME$
|
|
10048
|
+
const className = cssClassName(COMPONENT_NAME$i, `is${themeClassConverter(themeProp || theme)}`, isSelected && 'isSelected');
|
|
10049
|
+
const statusWrapperClassName = cssClassName(`${COMPONENT_NAME$i}--StatusWrapper`, status && `is${status}`);
|
|
9988
10050
|
let iconSource;
|
|
9989
10051
|
if (icon) {
|
|
9990
10052
|
if (isValidIcon(icon.icon)) {
|
|
@@ -9994,10 +10056,10 @@ const AlphaTile = ({ isSelected, icon, status, theme: themeProp, title, onClick,
|
|
|
9994
10056
|
iconSource = icon.icon;
|
|
9995
10057
|
}
|
|
9996
10058
|
}
|
|
9997
|
-
const iconWrapper = icon ? (jsx("span", Object.assign({ className: `${COMPONENT_NAME$
|
|
9998
|
-
const mediaMarkup = icon ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
9999
|
-
const titleWrapper = title ? (jsx("div", { children: jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
10000
|
-
const HeaderWrapper = (jsxs("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
10059
|
+
const iconWrapper = icon ? (jsx("span", Object.assign({ className: `${COMPONENT_NAME$i}__IconWrapper` }, { children: iconSource }), void 0)) : null;
|
|
10060
|
+
const mediaMarkup = icon ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$i}__MediaWrapper` }, { children: iconWrapper }), void 0)) : null;
|
|
10061
|
+
const titleWrapper = title ? (jsx("div", { children: jsx("div", Object.assign({ className: `${COMPONENT_NAME$i}__TitleWrapper` }, { children: title }), void 0) }, void 0)) : null;
|
|
10062
|
+
const HeaderWrapper = (jsxs("div", Object.assign({ className: `${COMPONENT_NAME$i}__HeaderWrapper` }, { children: [mediaMarkup, titleWrapper] }), void 0));
|
|
10001
10063
|
const statusIcon = status ? StatusIcon[status] : '';
|
|
10002
10064
|
const statusWrapper = status ? (jsx("div", Object.assign({ className: statusWrapperClassName }, { children: jsx(AlphaIcon, { source: statusIcon, size: 'medium', outlined: true }, void 0) }), void 0)) : null;
|
|
10003
10065
|
return (jsxs("div", Object.assign({ className: className, onClick: onClick }, { children: [HeaderWrapper, statusWrapper] }), void 0));
|
|
@@ -16640,9 +16702,9 @@ function getRangeDate(range, date) {
|
|
|
16640
16702
|
};
|
|
16641
16703
|
}
|
|
16642
16704
|
|
|
16643
|
-
const COMPONENT_NAME$
|
|
16705
|
+
const COMPONENT_NAME$h = 'DatePicker__Day';
|
|
16644
16706
|
const Day = memo(function Day({ day, isDisabled, isFirstSelectedDay, isLastSelectedDay, isInRange, isSelected, onClick, theme: themeProp, }) {
|
|
16645
|
-
const emptyDayClassName = cssClassName(COMPONENT_NAME$
|
|
16707
|
+
const emptyDayClassName = cssClassName(COMPONENT_NAME$h, !day && 'isEmpty');
|
|
16646
16708
|
if (!day) {
|
|
16647
16709
|
return jsx("td", { className: emptyDayClassName }, void 0);
|
|
16648
16710
|
}
|
|
@@ -16653,14 +16715,14 @@ const Day = memo(function Day({ day, isDisabled, isFirstSelectedDay, isLastSelec
|
|
|
16653
16715
|
}
|
|
16654
16716
|
};
|
|
16655
16717
|
const today = isToday(new Date(), day);
|
|
16656
|
-
const className = cssClassName(COMPONENT_NAME$
|
|
16718
|
+
const className = cssClassName(COMPONENT_NAME$h, today && 'isToday', `theme-${themeProp || theme}`, isSelected && 'isSelected', isDisabled && 'isDisabled', isInRange && 'isInRange', isFirstSelectedDay && 'isFirstSelectedDay', isLastSelectedDay && 'isLastSelectedDay');
|
|
16657
16719
|
const date = day.getDate();
|
|
16658
16720
|
return (jsx("td", Object.assign({ className: className }, { children: jsx("button", Object.assign({ onClick: handleClick }, { children: date }), void 0) }), void 0));
|
|
16659
16721
|
});
|
|
16660
16722
|
|
|
16661
|
-
const COMPONENT_NAME$
|
|
16723
|
+
const COMPONENT_NAME$g = 'DatePicker__Month';
|
|
16662
16724
|
const Month = ({ month = new Date().getMonth(), year = new Date().getFullYear(), allowRange, disableAfterDate, disableBeforeDate, onChange, selected, weekStartsOn = 0, disableDates, weekDays, }) => {
|
|
16663
|
-
const className = cssClassName(COMPONENT_NAME$
|
|
16725
|
+
const className = cssClassName(COMPONENT_NAME$g);
|
|
16664
16726
|
const weeks = useMemo(() => getWeeksByMonth(month, year, weekStartsOn), [month, year, weekStartsOn]);
|
|
16665
16727
|
const handleDateClick = useCallback((selectedDate) => {
|
|
16666
16728
|
if (onChange) {
|
|
@@ -16685,9 +16747,9 @@ const Month = ({ month = new Date().getMonth(), year = new Date().getFullYear(),
|
|
|
16685
16747
|
return jsx("div", Object.assign({ className: className }, { children: calendarGridMarkup }), void 0);
|
|
16686
16748
|
};
|
|
16687
16749
|
|
|
16688
|
-
const COMPONENT_NAME$
|
|
16750
|
+
const COMPONENT_NAME$f = 'DatePIcker__YearField';
|
|
16689
16751
|
const YearField = ({ onChange, value, min, max, onBlur, onFocus, onKeyDown, onKeyUp, }) => {
|
|
16690
|
-
const className = cssClassName(COMPONENT_NAME$
|
|
16752
|
+
const className = cssClassName(COMPONENT_NAME$f);
|
|
16691
16753
|
const handleChange = (event) => {
|
|
16692
16754
|
if (onChange) {
|
|
16693
16755
|
const value = event.target.value.trim();
|
|
@@ -16731,10 +16793,10 @@ const IconButton = (_a) => {
|
|
|
16731
16793
|
return (jsx("button", Object.assign({ className: className, onClick: onClick, onBlur: onBlur, onFocus: onFocus }, rest, { children: icon && jsx(Icon, { name: icon }, void 0) }), void 0));
|
|
16732
16794
|
};
|
|
16733
16795
|
|
|
16734
|
-
const COMPONENT_NAME$
|
|
16796
|
+
const COMPONENT_NAME$e = 'DatePicker__Header';
|
|
16735
16797
|
const Header$2 = ({ month, year, onChange, months }) => {
|
|
16736
16798
|
const [yearValue, setYearValue] = useState(year);
|
|
16737
|
-
const headerClassName = cssClassName(COMPONENT_NAME$
|
|
16799
|
+
const headerClassName = cssClassName(COMPONENT_NAME$e);
|
|
16738
16800
|
const handleMonthChange = useCallback((month, year) => {
|
|
16739
16801
|
if (onChange) {
|
|
16740
16802
|
onChange(month, year);
|
|
@@ -16764,10 +16826,10 @@ const Header$2 = ({ month, year, onChange, months }) => {
|
|
|
16764
16826
|
const previousYear = getPreviousYear(month, year);
|
|
16765
16827
|
const nextMonth = getNextMonth(month);
|
|
16766
16828
|
const nextYear = getNextYear(month, year);
|
|
16767
|
-
return (jsxs("div", Object.assign({ className: headerClassName }, { children: [jsx(IconButton, { icon: 'ArrowLeft', size: 'small', appearance: 'secondary', onClick: () => handleMonthChange(previousMonth, previousYear) }, void 0), jsxs("span", Object.assign({ className: `${COMPONENT_NAME$
|
|
16829
|
+
return (jsxs("div", Object.assign({ className: headerClassName }, { children: [jsx(IconButton, { icon: 'ArrowLeft', size: 'small', appearance: 'secondary', onClick: () => handleMonthChange(previousMonth, previousYear) }, void 0), jsxs("span", Object.assign({ className: `${COMPONENT_NAME$e}__DateLabel` }, { children: [montName, jsx(YearField, { value: yearValue, onChange: setYearValue, onBlur: handleYearBlur, min: MINIMUM_SELECTABLE_YEAR }, void 0)] }), void 0), jsx(IconButton, { icon: 'ArrowRight', size: 'small', appearance: 'secondary', onClick: () => handleMonthChange(nextMonth, nextYear) }, void 0)] }), void 0));
|
|
16768
16830
|
};
|
|
16769
16831
|
|
|
16770
|
-
const COMPONENT_NAME$
|
|
16832
|
+
const COMPONENT_NAME$d = 'DatePicker';
|
|
16771
16833
|
function getMonthSelectedDate(selected) {
|
|
16772
16834
|
return selected instanceof Date
|
|
16773
16835
|
? {
|
|
@@ -16777,7 +16839,7 @@ function getMonthSelectedDate(selected) {
|
|
|
16777
16839
|
: selected;
|
|
16778
16840
|
}
|
|
16779
16841
|
const DatePicker = ({ allowRange, disableAfterDate, disableBeforeDate, id, month = new Date().getMonth(), year = new Date().getFullYear(), onChange, selected, onMonthChange, weekStartsOn, disableDates, months, weekDays, }) => {
|
|
16780
|
-
const className = cssClassName(COMPONENT_NAME$
|
|
16842
|
+
const className = cssClassName(COMPONENT_NAME$d);
|
|
16781
16843
|
const handleDateChange = useCallback((dateRange) => {
|
|
16782
16844
|
if (onChange) {
|
|
16783
16845
|
onChange(dateRange);
|
|
@@ -16792,19 +16854,19 @@ const TrashIcon = () => (jsxs("svg", Object.assign({ width: '24', height: '24',
|
|
|
16792
16854
|
// eslint-disable-next-line max-len
|
|
16793
16855
|
d: 'M8 6V4C8 3.46957 8.21071 2.96086 8.58579 2.58579C8.96086 2.21071 9.46957 2 10 2H14C14.5304 2 15.0391 2.21071 15.4142 2.58579C15.7893 2.96086 16 3.46957 16 4V6M19 6V20C19 20.5304 18.7893 21.0391 18.4142 21.4142C18.0391 21.7893 17.5304 22 17 22H7C6.46957 22 5.96086 21.7893 5.58579 21.4142C5.21071 21.0391 5 20.5304 5 20V6H19Z', strokeWidth: '2', strokeLinecap: 'round', strokeLinejoin: 'round' }, void 0), jsx("path", { d: 'M10 11V17', strokeWidth: '2', strokeLinecap: 'round', strokeLinejoin: 'round' }, void 0), jsx("path", { d: 'M14 11V17', strokeWidth: '2', strokeLinecap: 'round', strokeLinejoin: 'round' }, void 0)] }), void 0));
|
|
16794
16856
|
|
|
16795
|
-
const COMPONENT_NAME$
|
|
16857
|
+
const COMPONENT_NAME$c = 'DeletableSection';
|
|
16796
16858
|
const DeletableSection = ({ ariaLabel, children, onDelete, iconDeletable, isDeletable, }) => {
|
|
16797
16859
|
const { theme } = useTheme();
|
|
16798
16860
|
const THEME_CLASS = `${theme}`;
|
|
16799
|
-
const className = cssClassName(COMPONENT_NAME$
|
|
16800
|
-
const classNameButton = cssClassName(`${COMPONENT_NAME$
|
|
16861
|
+
const className = cssClassName(COMPONENT_NAME$c);
|
|
16862
|
+
const classNameButton = cssClassName(`${COMPONENT_NAME$c}__DeleteButtonWrapper`, THEME_CLASS);
|
|
16801
16863
|
const icon = iconDeletable || TrashIcon;
|
|
16802
|
-
const deleteButtonMarkup = onDelete && isDeletable ? (jsx("div", Object.assign({ className: classNameButton }, { children: jsx("button", Object.assign({ "aria-label": ariaLabel ? `${ariaLabel}-removeForm` : ariaLabel, className: `${COMPONENT_NAME$
|
|
16803
|
-
const contentMarkup = children ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
16864
|
+
const deleteButtonMarkup = onDelete && isDeletable ? (jsx("div", Object.assign({ className: classNameButton }, { children: jsx("button", Object.assign({ "aria-label": ariaLabel ? `${ariaLabel}-removeForm` : ariaLabel, className: `${COMPONENT_NAME$c}__DeleteButton`, onClick: onDelete }, { children: jsx(AlphaIcon, { source: icon, outlined: true }, void 0) }), void 0) }), void 0)) : null;
|
|
16865
|
+
const contentMarkup = children ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$c}__ContentWrapper` }, { children: children }), void 0)) : null;
|
|
16804
16866
|
return (jsxs("div", Object.assign({ className: className }, { children: [deleteButtonMarkup, contentMarkup] }), void 0));
|
|
16805
16867
|
};
|
|
16806
16868
|
|
|
16807
|
-
const COMPONENT_NAME$
|
|
16869
|
+
const COMPONENT_NAME$b = 'AlphaInputTag';
|
|
16808
16870
|
const InputTag$1 = ({ ariaLabel, id, inputTextPlaceholder, inputTextValue, isRequired, label, onChange, onInputTextChange, addedTags = [], triggerKeys = ['Enter'], onBlur, onFocus, isDisabled, hasError, tagRemoveIcon, helpText, }) => {
|
|
16809
16871
|
const [isFocused, setIsFocused] = useState(false);
|
|
16810
16872
|
const inputRef = useRef(null);
|
|
@@ -16847,10 +16909,10 @@ const InputTag$1 = ({ ariaLabel, id, inputTextPlaceholder, inputTextValue, isReq
|
|
|
16847
16909
|
}
|
|
16848
16910
|
};
|
|
16849
16911
|
const renderTag = (tag, index) => {
|
|
16850
|
-
return (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
16912
|
+
return (jsx("div", Object.assign({ className: `${COMPONENT_NAME$b}__TagWrapper` }, { children: jsx(AlphaChip, Object.assign({ removeButtonIcon: tagRemoveIcon, onRemove: () => handleRemoveTag(index) }, { children: tag }), void 0) }), index));
|
|
16851
16913
|
};
|
|
16852
|
-
const className = cssClassName(COMPONENT_NAME$
|
|
16853
|
-
const inputWrapperClassName = cssClassName(`${COMPONENT_NAME$
|
|
16914
|
+
const className = cssClassName(COMPONENT_NAME$b);
|
|
16915
|
+
const inputWrapperClassName = cssClassName(`${COMPONENT_NAME$b}__InputWrapper`, isFocused && 'isFocused', isDisabled && 'isDisabled', hasError && 'hasError');
|
|
16854
16916
|
const handleInputChange = (event) => {
|
|
16855
16917
|
if (onInputTextChange) {
|
|
16856
16918
|
onInputTextChange(event.target.value);
|
|
@@ -23584,7 +23646,7 @@ var pako = {
|
|
|
23584
23646
|
* @returns {symbol} - Element FileItem
|
|
23585
23647
|
* @param {string} InputTextProps.ariaLabel - Label to use in automatic tests
|
|
23586
23648
|
*/
|
|
23587
|
-
const FileItem = ({ ariaLabel, name, addon, onDelete, size = 0, }) => (jsxs("div", Object.assign({ className: 'File' }, { children: [jsxs("div", Object.assign({ className: 'File__content__left' }, { children: [jsx(Icon, { name: 'Paperclip' }, void 0), jsx("p", Object.assign({ className: ' File__content__nameFile' }, { children: name }), void 0)] }), void 0), jsxs("div", Object.assign({ className: 'File__content__right' }, { children: [jsxs("button", Object.assign({ "aria-label": `${ariaLabel}-delete`, className: 'ButtonDeleteFile', onClick: onDelete }, { children: [jsx(Fragment, { children: addon }, void 0), jsx(Icon, { name: 'Close' }, void 0)] }), void 0),
|
|
23649
|
+
const FileItem = ({ ariaLabel, name, addon, onDelete, size = 0, }) => (jsxs("div", Object.assign({ className: 'File' }, { children: [jsxs("div", Object.assign({ className: 'File__content__left' }, { children: [jsx(Icon, { name: 'Paperclip' }, void 0), jsx("p", Object.assign({ className: ' File__content__nameFile' }, { children: name }), void 0)] }), void 0), jsxs("div", Object.assign({ className: 'File__content__right' }, { children: [jsxs("button", Object.assign({ "aria-label": `${ariaLabel}-delete`, className: 'ButtonDeleteFile', onClick: onDelete }, { children: [jsx(Fragment, { children: addon }, void 0), jsx(Icon, { name: 'Close' }, void 0)] }), void 0), jsx("p", Object.assign({ className: 'File__content__fileSize' }, { children: formatFileSize(size) }), void 0)] }), void 0)] }), void 0));
|
|
23588
23650
|
|
|
23589
23651
|
/**
|
|
23590
23652
|
* FileDrop is a component to upload files in any project
|
|
@@ -24529,7 +24591,7 @@ const SectionForm = ({ ariaLabel, data, fields, fieldsSection, iconDeletable, ic
|
|
|
24529
24591
|
return (jsx(DeletableSection, Object.assign({ ariaLabel: ariaLabel, onDelete: onDelete, iconDeletable: iconDeletable, isDeletable: isDeletable }, { children: gridMarkup }), void 0));
|
|
24530
24592
|
};
|
|
24531
24593
|
|
|
24532
|
-
const COMPONENT_NAME$
|
|
24594
|
+
const COMPONENT_NAME$a = 'DynamicForm';
|
|
24533
24595
|
const DynamicForm = ({ ariaLabel, dataFormArray = [], fields, fieldsSection, iconDeletable, iconHelperText, labelDivider, onChange, onAddForm, tagRemoveIcon, deletableFormArray, extraPropsFieldsArray, }) => {
|
|
24534
24596
|
const { theme } = useTheme();
|
|
24535
24597
|
const handleChange = (contact, id) => {
|
|
@@ -24557,11 +24619,11 @@ const DynamicForm = ({ ariaLabel, dataFormArray = [], fields, fieldsSection, ico
|
|
|
24557
24619
|
: undefined;
|
|
24558
24620
|
return (jsx(SectionForm, { ariaLabel: ariaLabel, data: form, fields: fields, fieldsSection: fieldsSection, iconDeletable: iconDeletable, iconHelperText: iconHelperText, onChange: (formData) => handleChange(formData, form.id || ''), onDelete: () => handleDelete(form.id || ''), tagRemoveIcon: tagRemoveIcon, isDeletable: isDeletable, extraPropsField: extraProps }, `DynamicForm-${form.id}-${index}}`));
|
|
24559
24621
|
};
|
|
24560
|
-
const contactsMarkup = (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
24622
|
+
const contactsMarkup = (jsx("div", Object.assign({ className: `${COMPONENT_NAME$a}__SectionFormWrapper` }, { children: dataFormArray.map(renderForm) }), void 0));
|
|
24561
24623
|
const dividerMarkup = labelDivider && jsx(Divider, { label: labelDivider }, void 0);
|
|
24562
24624
|
const addContactButtonMarkup = onAddForm && (jsx(AlphaButton, Object.assign({ ariaLabel: ariaLabel ? `${ariaLabel}--addNewForm` : ariaLabel, isTertiary: true, onClick: onAddForm.onClick }, { children: onAddForm.label }), void 0));
|
|
24563
24625
|
const THEME_CLASS = `${theme}`;
|
|
24564
|
-
const className = cssClassName(COMPONENT_NAME$
|
|
24626
|
+
const className = cssClassName(COMPONENT_NAME$a, THEME_CLASS);
|
|
24565
24627
|
return (jsxs("div", Object.assign({ className: className }, { children: [dividerMarkup, contactsMarkup, addContactButtonMarkup] }), void 0));
|
|
24566
24628
|
};
|
|
24567
24629
|
|
|
@@ -27757,19 +27819,19 @@ Sortable.mount(Remove, Revert);
|
|
|
27757
27819
|
|
|
27758
27820
|
const Context = createContext({});
|
|
27759
27821
|
|
|
27760
|
-
const COMPONENT_NAME$
|
|
27822
|
+
const COMPONENT_NAME$9 = 'SortableList__Item';
|
|
27761
27823
|
const Item$2 = ({ children }) => {
|
|
27762
27824
|
const { hasHandle } = useContext(Context);
|
|
27763
|
-
const className = cssClassName(COMPONENT_NAME$
|
|
27764
|
-
const handleMarkup = hasHandle ? (jsxs("span", Object.assign({ className: `${COMPONENT_NAME$
|
|
27765
|
-
const contentMarkup = (jsx("span", Object.assign({ className: `${COMPONENT_NAME$
|
|
27825
|
+
const className = cssClassName(COMPONENT_NAME$9, !hasHandle && 'no-handle');
|
|
27826
|
+
const handleMarkup = hasHandle ? (jsxs("span", Object.assign({ className: `${COMPONENT_NAME$9}__Handle` }, { children: [jsx(Icon, { name: 'MoreVertical' }, void 0), jsx(Icon, { name: 'MoreVertical' }, void 0)] }), void 0)) : null;
|
|
27827
|
+
const contentMarkup = (jsx("span", Object.assign({ className: `${COMPONENT_NAME$9}__Content` }, { children: children }), void 0));
|
|
27766
27828
|
return (jsxs("li", Object.assign({ className: className }, { children: [handleMarkup, contentMarkup] }), void 0));
|
|
27767
27829
|
};
|
|
27768
27830
|
|
|
27769
|
-
const COMPONENT_NAME$
|
|
27831
|
+
const COMPONENT_NAME$8 = 'SortableList';
|
|
27770
27832
|
const SortableList = function ({ renderItem, items, onSort, hasHandle, }) {
|
|
27771
27833
|
const listRef = useRef(null);
|
|
27772
|
-
const className = cssClassName(COMPONENT_NAME$
|
|
27834
|
+
const className = cssClassName(COMPONENT_NAME$8);
|
|
27773
27835
|
const hasItems = items && items.length > 0;
|
|
27774
27836
|
const handleSortEnd = (event) => {
|
|
27775
27837
|
const { newIndex, oldIndex } = event;
|
|
@@ -27800,7 +27862,7 @@ const SortableList = function ({ renderItem, items, onSort, hasHandle, }) {
|
|
|
27800
27862
|
}
|
|
27801
27863
|
return itemComponent;
|
|
27802
27864
|
};
|
|
27803
|
-
const listClassName = cssClassName(`${COMPONENT_NAME$
|
|
27865
|
+
const listClassName = cssClassName(`${COMPONENT_NAME$8}__List`);
|
|
27804
27866
|
const listMarkup = hasItems ? (jsx("ul", Object.assign({ ref: listRef, className: listClassName }, { children: Children.toArray(items.map(renderItemElement)) }), void 0)) : null;
|
|
27805
27867
|
const contextValue = {
|
|
27806
27868
|
hasHandle,
|
|
@@ -28683,6 +28745,13 @@ const Content = ({ children, hasPane = false, height }) => (jsx("div", Object.as
|
|
|
28683
28745
|
* @param {boolean} ModalProps.hasPane - Validate if it has Pane
|
|
28684
28746
|
*/
|
|
28685
28747
|
const Modal = ({ ariaLabel, children, isOpen, media, onClose, position, primaryAction, secondaryActions, extraAction, hideFooter = false, hideHeader = false, size = 'medium', title, hasPane = false, id, mediaTheme, height, }) => {
|
|
28748
|
+
const handleOnKeyUp = (event) => {
|
|
28749
|
+
if (isOpen && event.key == 'Escape' && onClose)
|
|
28750
|
+
onClose();
|
|
28751
|
+
};
|
|
28752
|
+
useEffect(() => {
|
|
28753
|
+
document.addEventListener('keyup', handleOnKeyUp);
|
|
28754
|
+
});
|
|
28686
28755
|
useEffect(() => {
|
|
28687
28756
|
if (isOpen)
|
|
28688
28757
|
document.body.style.overflow = 'hidden';
|
|
@@ -28890,13 +28959,15 @@ const PanelHeader = ({ alt = '', icon, image, title, onClose, headerExtraActions
|
|
|
28890
28959
|
|
|
28891
28960
|
const MAIN_CLASS$4 = 'Panel';
|
|
28892
28961
|
const Panel = ({ children, position, height, isOpen, id, alt = '', icon, image, title, onClose, headerExtraActions, theme = 'CLOUD', positionButtons = 'flex-end', primaryAction, secondaryActions, extraAction, }) => {
|
|
28893
|
-
const className =
|
|
28894
|
-
`${MAIN_CLASS$4}__container`,
|
|
28895
|
-
position && `${MAIN_CLASS$4}__container--is-${position}`,
|
|
28896
|
-
]
|
|
28897
|
-
.filter(Boolean)
|
|
28898
|
-
.join(' ');
|
|
28962
|
+
const className = cssClassName(`${MAIN_CLASS$4}__container`, position && `is-${position}`);
|
|
28899
28963
|
const maxHeightStyle = { height: height };
|
|
28964
|
+
const handleOnKeyUp = (event) => {
|
|
28965
|
+
if (isOpen && event.key == 'Escape' && onClose)
|
|
28966
|
+
onClose();
|
|
28967
|
+
};
|
|
28968
|
+
useEffect(() => {
|
|
28969
|
+
document.addEventListener('keyup', handleOnKeyUp);
|
|
28970
|
+
});
|
|
28900
28971
|
return (jsx(Fragment, { children: isOpen &&
|
|
28901
28972
|
createPortal(jsxs("div", Object.assign({ id: id, className: className, style: maxHeightStyle }, { children: [jsx(PanelHeader, { alt: alt, icon: icon, image: image, title: title, onClose: onClose, theme: theme, headerExtraActions: headerExtraActions }, void 0), jsx("div", Object.assign({ className: `${MAIN_CLASS$4}__body` }, { children: children }), void 0), jsx(PanelFooter, { positionButtons: positionButtons, primaryAction: primaryAction, secondaryActions: secondaryActions, extraAction: extraAction }, void 0)] }), void 0), document.querySelector('body')) }, void 0));
|
|
28902
28973
|
};
|
|
@@ -30119,12 +30190,12 @@ const Tile = ({ isSelected, media, onClick, title, value, subtitle = '', mediaSi
|
|
|
30119
30190
|
return (jsxs("div", Object.assign({ className: classes, onClick: handleOnClick }, { children: [jsxs("div", Object.assign({ className: 'Tile__Wrapper' }, { children: [jsxs("div", Object.assign({ className: 'Tile__TitleWrapper' }, { children: [jsx("div", Object.assign({ className: 'Tile__Media' }, { children: jsx(Media, { icon: media, size: mediaSize, appearance: 'info' }, void 0) }), void 0), jsxs("div", { children: [jsx("div", Object.assign({ className: 'Tile__Title' }, { children: title }), void 0), subtitle ? jsx("div", Object.assign({ className: 'Tile__Subtitle' }, { children: subtitle }), void 0) : null] }, void 0)] }), void 0), jsx("div", Object.assign({ className: 'Tile__RightMediaWrapper' }, { children: rightMedia !== null && rightMedia }), void 0)] }), void 0), tagsMarkup] }), void 0));
|
|
30120
30191
|
};
|
|
30121
30192
|
|
|
30122
|
-
const COMPONENT_NAME$
|
|
30193
|
+
const COMPONENT_NAME$7 = 'Totalizer';
|
|
30123
30194
|
const Totalizer = ({ action, direction, icon, isDisabled, isFocused, label, placeholderValue, value, theme: themeProp, }) => {
|
|
30124
30195
|
const { theme } = useTheme();
|
|
30125
30196
|
const themeClass = `has-Theme${themeProp ? themeProp.toUpperCase() : theme.toUpperCase()}`;
|
|
30126
|
-
const className = cssClassName(COMPONENT_NAME$
|
|
30127
|
-
const titleMarkup = label ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
30197
|
+
const className = cssClassName(COMPONENT_NAME$7, themeClass, isDisabled && 'isDisabled', isFocused && 'isFocused', direction && `has-${direction}Direction`);
|
|
30198
|
+
const titleMarkup = label ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$7}__TitleWrapper` }, { children: label }), void 0)) : null;
|
|
30128
30199
|
let iconSource;
|
|
30129
30200
|
if (icon) {
|
|
30130
30201
|
if (isValidIcon(icon.icon)) {
|
|
@@ -30134,25 +30205,25 @@ const Totalizer = ({ action, direction, icon, isDisabled, isFocused, label, plac
|
|
|
30134
30205
|
iconSource = icon.icon;
|
|
30135
30206
|
}
|
|
30136
30207
|
}
|
|
30137
|
-
const iconMarkup = icon ? (jsx("span", Object.assign({ className: `${COMPONENT_NAME$
|
|
30138
|
-
const headerMarkup = titleMarkup || iconMarkup ? (jsxs("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
30139
|
-
const valueMarkup = value ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
30140
|
-
const placeholderValueMarkup = placeholderValue ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
30208
|
+
const iconMarkup = icon ? (jsx("span", Object.assign({ className: `${COMPONENT_NAME$7}__IconWrapper` }, { children: iconSource }), void 0)) : null;
|
|
30209
|
+
const headerMarkup = titleMarkup || iconMarkup ? (jsxs("div", Object.assign({ className: `${COMPONENT_NAME$7}__HeaderWrapper` }, { children: [titleMarkup, iconMarkup] }), void 0)) : null;
|
|
30210
|
+
const valueMarkup = value ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$7}__ValueWrapper` }, { children: value }), void 0)) : null;
|
|
30211
|
+
const placeholderValueMarkup = placeholderValue ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$7}__PlaceholderValueWrapper` }, { children: placeholderValue }), void 0)) : null;
|
|
30141
30212
|
const valueContentToRender = (!valueMarkup && placeholderValueMarkup) || valueMarkup;
|
|
30142
|
-
const valueContainerMarkup = valueMarkup || placeholderValueMarkup ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
30143
|
-
const actionMarkup = action ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
30144
|
-
const contentClassName = cssClassName(`${COMPONENT_NAME$
|
|
30213
|
+
const valueContainerMarkup = valueMarkup || placeholderValueMarkup ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$7}__ValueContainerWrapper` }, { children: valueContentToRender }), void 0)) : null;
|
|
30214
|
+
const actionMarkup = action ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$7}__ActionWrapper` }, { children: jsx(AlphaButton, Object.assign({ id: action.id, onClick: action.onClick, onMouseEnter: action.onMouseEnter, onTouchStart: action.onTouchStart, isDisabled: action.isDisabled || isDisabled, isLoading: action.isLoading, isDanger: action.isDanger, icon: action.icon ? { icon: action.icon } : undefined, isPrimary: true }, { children: action.content }), void 0) }), void 0)) : null;
|
|
30215
|
+
const contentClassName = cssClassName(`${COMPONENT_NAME$7}__ContentWrapper`, action && 'has-Action');
|
|
30145
30216
|
const contentMarkup = valueContainerMarkup || actionMarkup ? (jsxs("div", Object.assign({ className: contentClassName }, { children: [valueContainerMarkup, actionMarkup] }), void 0)) : null;
|
|
30146
30217
|
return (jsxs("div", Object.assign({ className: className }, { children: [headerMarkup, contentMarkup] }), void 0));
|
|
30147
30218
|
};
|
|
30148
30219
|
|
|
30149
|
-
const COMPONENT_NAME$
|
|
30220
|
+
const COMPONENT_NAME$6 = 'AlphaMultiSelectionPicker__Picker__List';
|
|
30150
30221
|
const List = ({ items, selected, onChange }) => {
|
|
30151
30222
|
const listWrapperRef = useRef(null);
|
|
30152
30223
|
const scrollToSelected = () => {
|
|
30153
30224
|
const listWrapper = listWrapperRef.current;
|
|
30154
30225
|
if (listWrapper) {
|
|
30155
|
-
const selectedElement = listWrapper.querySelector(`.${COMPONENT_NAME$
|
|
30226
|
+
const selectedElement = listWrapper.querySelector(`.${COMPONENT_NAME$6}__ListItem--selected`);
|
|
30156
30227
|
if (selectedElement) {
|
|
30157
30228
|
const { top } = selectedElement.getBoundingClientRect();
|
|
30158
30229
|
const { top: listWrapperTop } = listWrapper.getBoundingClientRect();
|
|
@@ -30174,17 +30245,17 @@ const List = ({ items, selected, onChange }) => {
|
|
|
30174
30245
|
const renderItem = (item, index) => {
|
|
30175
30246
|
const { label, value } = item;
|
|
30176
30247
|
const isSelected = Boolean(selected !== null && selected !== undefined && selected === value);
|
|
30177
|
-
const className = cssClassName(`${COMPONENT_NAME$
|
|
30248
|
+
const className = cssClassName(`${COMPONENT_NAME$6}__ListItem`, isSelected && 'selected');
|
|
30178
30249
|
const handleClick = () => handleChange(value);
|
|
30179
|
-
return (jsx("li", Object.assign({ className: className, onClick: handleClick }, { children: label }), `${COMPONENT_NAME$
|
|
30250
|
+
return (jsx("li", Object.assign({ className: className, onClick: handleClick }, { children: label }), `${COMPONENT_NAME$6}__ListItem-${index}`));
|
|
30180
30251
|
};
|
|
30181
30252
|
const itemsMarkup = items ? items.map(renderItem) : null;
|
|
30182
|
-
const className = cssClassName(COMPONENT_NAME$
|
|
30253
|
+
const className = cssClassName(COMPONENT_NAME$6);
|
|
30183
30254
|
return (jsx("div", Object.assign({ className: className, ref: listWrapperRef }, { children: jsx("ul", { children: itemsMarkup }, void 0) }), void 0));
|
|
30184
30255
|
};
|
|
30185
30256
|
|
|
30186
|
-
const COMPONENT_NAME$
|
|
30187
|
-
const
|
|
30257
|
+
const COMPONENT_NAME$5 = 'AlphaMultiSelectionPicker__Picker';
|
|
30258
|
+
const Picker = ({ headers, items, onChange, selected, theme: ThemeProp, }) => {
|
|
30188
30259
|
const { theme: themeValue } = useTheme();
|
|
30189
30260
|
const theme = ThemeProp || themeValue;
|
|
30190
30261
|
if (!theme) {
|
|
@@ -30197,46 +30268,93 @@ const TimePicker = ({ headers, items, onChange, selected, theme: ThemeProp, }) =
|
|
|
30197
30268
|
onChange(selectedValues);
|
|
30198
30269
|
}
|
|
30199
30270
|
};
|
|
30200
|
-
const renderHeader = (header, index) => (jsx("span", Object.assign({ className: `${COMPONENT_NAME$
|
|
30201
|
-
const headersMarkup = headers ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
30271
|
+
const renderHeader = (header, index) => (jsx("span", Object.assign({ className: `${COMPONENT_NAME$5}__HeaderItem` }, { children: capitalize(header) }), `${COMPONENT_NAME$5}__HeaderItem-${index}`));
|
|
30272
|
+
const headersMarkup = headers ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$5}__HeadersMarkup` }, { children: headers.map(renderHeader) }), void 0)) : null;
|
|
30202
30273
|
const renderList = (listItems, index) => {
|
|
30203
30274
|
const selectedValue = selected ? selected[index] : undefined;
|
|
30204
|
-
return (jsx(List, { items: listItems, onChange: (value) => handleChange(value, index), selected: selectedValue }, `${COMPONENT_NAME$
|
|
30275
|
+
return (jsx(List, { items: listItems, onChange: (value) => handleChange(value, index), selected: selectedValue }, `${COMPONENT_NAME$5}__List-${index}`));
|
|
30205
30276
|
};
|
|
30206
|
-
const itemsListsMarkup = items ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
30207
|
-
const className = cssClassName(COMPONENT_NAME$
|
|
30277
|
+
const itemsListsMarkup = items ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$5}__ItemsListWrapper` }, { children: items.map(renderList) }), void 0)) : null;
|
|
30278
|
+
const className = cssClassName(COMPONENT_NAME$5, theme);
|
|
30208
30279
|
return (jsxs("div", Object.assign({ className: className }, { children: [headersMarkup, itemsListsMarkup] }), void 0));
|
|
30209
30280
|
};
|
|
30210
30281
|
|
|
30211
|
-
const
|
|
30212
|
-
const
|
|
30282
|
+
const AlphaMultiSelectionPicker = ({ items, onChange, theme, }) => {
|
|
30283
|
+
const getLabel = (value) => {
|
|
30284
|
+
return value < 10 ? `0${value}` : `${value}`;
|
|
30285
|
+
};
|
|
30286
|
+
const getListItem = (min, max) => {
|
|
30287
|
+
const numbersArray = Array.from({ length: max - min + 1 }, (_, i) => i + min);
|
|
30288
|
+
return numbersArray.map((number) => ({
|
|
30289
|
+
label: getLabel(number),
|
|
30290
|
+
value: number,
|
|
30291
|
+
}));
|
|
30292
|
+
};
|
|
30293
|
+
const headersPicker = useMemo(() => items.map((item) => item.plural), [items]);
|
|
30294
|
+
const itemsPicker = useMemo(() => items.map((item) => getListItem(item.min, item.max)), [items]);
|
|
30295
|
+
const valuesSelected = useMemo(() => items.map((item) => item.value), [items]);
|
|
30296
|
+
const pickerMarkup = (jsx(Picker, { items: itemsPicker, headers: headersPicker, onChange: onChange, selected: valuesSelected, theme: theme }, void 0));
|
|
30297
|
+
return jsx("div", { children: pickerMarkup }, void 0);
|
|
30298
|
+
};
|
|
30299
|
+
|
|
30300
|
+
const COMPONENT_NAME$4 = 'TimeSelector';
|
|
30301
|
+
const TimeSelector = ({ plurals, singulars, value, disabled, error, helpText, label, onChange, readOnly, placeholderValues, minMaxYears, minMaxMonths, minMaxDays, minMaxHours, minMaxMinutes, minMaxSeconds, theme: themeProp, isRequired, }) => {
|
|
30213
30302
|
const { theme: themeValue } = useTheme();
|
|
30214
30303
|
const theme = themeProp || themeValue;
|
|
30215
30304
|
if (!theme) {
|
|
30216
30305
|
return null;
|
|
30217
30306
|
}
|
|
30307
|
+
const [items, setItems] = useState([]);
|
|
30308
|
+
const [keysValues, setKeysValues] = useState([]);
|
|
30218
30309
|
const fieldRef = useRef(null);
|
|
30219
30310
|
const [isFocused, setIsFocused] = useState(false);
|
|
30220
30311
|
const [isActive, setIsActive] = useState(false);
|
|
30221
30312
|
const toggleTimePicker = () => setIsActive(!isActive);
|
|
30222
30313
|
const hasError = !!error;
|
|
30223
|
-
const
|
|
30224
|
-
|
|
30225
|
-
|
|
30226
|
-
|
|
30314
|
+
const getMaxMins = () => {
|
|
30315
|
+
const maxMins = {
|
|
30316
|
+
years: minMaxYears,
|
|
30317
|
+
months: minMaxMonths,
|
|
30318
|
+
days: minMaxDays,
|
|
30319
|
+
hours: minMaxHours,
|
|
30320
|
+
minutes: minMaxMinutes,
|
|
30321
|
+
seconds: minMaxSeconds,
|
|
30322
|
+
};
|
|
30323
|
+
return maxMins;
|
|
30324
|
+
};
|
|
30325
|
+
const getItemMultiSelectionPicker = (key, minMax) => ({
|
|
30326
|
+
id: key,
|
|
30327
|
+
plural: plurals[key] || '',
|
|
30328
|
+
singular: singulars[key] || '',
|
|
30329
|
+
min: minMax[0],
|
|
30330
|
+
max: minMax[1],
|
|
30331
|
+
value: value ? value[key] : 0,
|
|
30332
|
+
});
|
|
30333
|
+
const getItemsMultiSelectionPicker = () => {
|
|
30334
|
+
const catalogMinMax = getMaxMins();
|
|
30335
|
+
const items = [];
|
|
30336
|
+
const keys = [];
|
|
30337
|
+
Object.keys(catalogMinMax).forEach((key) => {
|
|
30338
|
+
const valueMinMax = catalogMinMax[key];
|
|
30339
|
+
if (valueMinMax) {
|
|
30340
|
+
keys.push(key);
|
|
30341
|
+
items.push(getItemMultiSelectionPicker(key, valueMinMax));
|
|
30342
|
+
}
|
|
30343
|
+
});
|
|
30344
|
+
setKeysValues(keys);
|
|
30345
|
+
return items;
|
|
30346
|
+
};
|
|
30227
30347
|
const handleClosePopover = () => {
|
|
30228
30348
|
if (isActive) {
|
|
30229
30349
|
toggleTimePicker();
|
|
30230
30350
|
}
|
|
30231
30351
|
};
|
|
30232
30352
|
const handleTimePickerChange = (values) => {
|
|
30233
|
-
const
|
|
30234
|
-
|
|
30235
|
-
|
|
30236
|
-
|
|
30237
|
-
|
|
30238
|
-
seconds: seconds || 0,
|
|
30239
|
-
};
|
|
30353
|
+
const newValue = {};
|
|
30354
|
+
keysValues.forEach((key, index) => {
|
|
30355
|
+
const valueByKey = values[index];
|
|
30356
|
+
newValue[key] = valueByKey || 0;
|
|
30357
|
+
});
|
|
30240
30358
|
if (onChange) {
|
|
30241
30359
|
onChange(newValue);
|
|
30242
30360
|
}
|
|
@@ -30277,15 +30395,6 @@ const TimeSelector = ({ plurals, singulars, value, disabled, error, helpText, la
|
|
|
30277
30395
|
fullValue[fieldName] = fieldVal;
|
|
30278
30396
|
return fullValue;
|
|
30279
30397
|
};
|
|
30280
|
-
const getMaxMins = () => {
|
|
30281
|
-
const maxMins = {
|
|
30282
|
-
days: minMaxDays,
|
|
30283
|
-
hours: minMaxHours,
|
|
30284
|
-
minutes: minMaxMinutes,
|
|
30285
|
-
seconds: minMaxSeconds,
|
|
30286
|
-
};
|
|
30287
|
-
return maxMins;
|
|
30288
|
-
};
|
|
30289
30398
|
const renderField = (field, index) => {
|
|
30290
30399
|
const label = !value || (value && value[field] !== 1)
|
|
30291
30400
|
? plurals[field]
|
|
@@ -30297,50 +30406,46 @@ const TimeSelector = ({ plurals, singulars, value, disabled, error, helpText, la
|
|
|
30297
30406
|
? getTimeValue(value[field])
|
|
30298
30407
|
: '';
|
|
30299
30408
|
const separator = index === Object.keys(singulars).length - 1 ? '' : ', ';
|
|
30300
|
-
const
|
|
30301
|
-
|
|
30302
|
-
|
|
30409
|
+
const valuesMaxMin = getMaxMins()[field];
|
|
30410
|
+
let max;
|
|
30411
|
+
let min;
|
|
30412
|
+
if (valuesMaxMin)
|
|
30413
|
+
[min, max] = valuesMaxMin;
|
|
30414
|
+
return (jsxs("div", Object.assign({ className: `${COMPONENT_NAME$4}__InnerField` }, { children: [jsx("input", { type: 'number', value: elValue, placeholder: placeholderValue, onFocus: handleFocusField, onBlur: handleBlurField, disabled: disabled, onChange: handleInputChange, name: field, min: min, max: max }, void 0), jsxs("span", { children: [label, separator] }, void 0)] }), index));
|
|
30303
30415
|
};
|
|
30304
30416
|
const fieldsMarkup = Object.keys(singulars).map(renderField);
|
|
30305
|
-
const fieldClass = cssClassName(`${COMPONENT_NAME$
|
|
30306
|
-
const labelMarkup = label ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
30417
|
+
const fieldClass = cssClassName(`${COMPONENT_NAME$4}__Field`, (isFocused || isActive) && 'isFocused');
|
|
30418
|
+
const labelMarkup = label ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$4}__LabelWrapper` }, { children: jsx(AlphaLabel, Object.assign({ isRequired: isRequired }, { children: label }), void 0) }), void 0)) : null;
|
|
30307
30419
|
const helpTextMarkup = helpText
|
|
30308
|
-
? helpText && (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
30420
|
+
? helpText && (jsx("div", Object.assign({ className: `${COMPONENT_NAME$4}__HelpTextWrapper` }, { children: helpText }), void 0))
|
|
30309
30421
|
: null;
|
|
30310
|
-
const fieldMarkup = (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
30311
|
-
const
|
|
30312
|
-
if (value) {
|
|
30313
|
-
const { days, hours, minutes, seconds } = value;
|
|
30314
|
-
return [days, hours, minutes, seconds];
|
|
30315
|
-
}
|
|
30316
|
-
return undefined;
|
|
30317
|
-
}, [value]);
|
|
30318
|
-
const timePickerHeaders = useMemo(() => [plurals.days, plurals.hours, plurals.minutes, plurals.seconds], [plurals]);
|
|
30319
|
-
const timePickerMarkup = (jsx(TimePicker, { items: [daysList, hoursList, minutesList, secondsList], headers: timePickerHeaders, onChange: handleTimePickerChange, selected: timePickerValue, theme: theme }, void 0));
|
|
30422
|
+
const fieldMarkup = (jsx("div", Object.assign({ className: `${COMPONENT_NAME$4}__FieldWrapper` }, { children: jsxs(AlphaTooltip, Object.assign({ content: error, appearance: 'error', persistence: true, isActive: hasError }, { children: [labelMarkup, jsx("div", Object.assign({ className: fieldClass, onClick: handleFieldClick, ref: fieldRef }, { children: fieldsMarkup }), void 0)] }), void 0) }), void 0));
|
|
30423
|
+
const timePickerMarkup = (jsx(AlphaMultiSelectionPicker, { items: items, onChange: handleTimePickerChange, theme: themeProp }, void 0));
|
|
30320
30424
|
const popoverMarkup = (jsx(Popover$1, Object.assign({ activator: fieldMarkup, isActive: isActive, isFullWidth: true, onClose: handleClosePopover }, { children: timePickerMarkup }), void 0));
|
|
30321
|
-
|
|
30425
|
+
useEffect(() => {
|
|
30426
|
+
setItems(getItemsMultiSelectionPicker());
|
|
30427
|
+
}, []);
|
|
30428
|
+
useEffect(() => {
|
|
30429
|
+
setItems(getItemsMultiSelectionPicker());
|
|
30430
|
+
}, [value]);
|
|
30431
|
+
const className = cssClassName(COMPONENT_NAME$4, theme, !value && 'isEmpty');
|
|
30322
30432
|
return (jsxs("div", Object.assign({ className: className }, { children: [popoverMarkup, helpTextMarkup] }), void 0));
|
|
30323
30433
|
};
|
|
30324
30434
|
function getTimeValue(value) {
|
|
30435
|
+
if (value === undefined)
|
|
30436
|
+
return '';
|
|
30325
30437
|
return value < 10 ? `0${value}` : `${value}`;
|
|
30326
|
-
}
|
|
30327
|
-
function getTimeList(min, max) {
|
|
30328
|
-
const numbersArray = Array.from({ length: max - min + 1 }, (_, i) => i + min);
|
|
30329
|
-
return numbersArray.map((number) => ({
|
|
30330
|
-
label: getTimeValue(number),
|
|
30331
|
-
value: number,
|
|
30332
|
-
}));
|
|
30333
30438
|
}
|
|
30334
30439
|
|
|
30335
|
-
const COMPONENT_NAME$
|
|
30440
|
+
const COMPONENT_NAME$3 = 'FilterField';
|
|
30336
30441
|
const FilterField = ({ label, isRequired = false, field, onRemove, name, }) => {
|
|
30337
|
-
const labelMarkup = label ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
30338
|
-
const filterFieldMarkup = (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
30339
|
-
const removeButtonMarkup = onRemove && !isRequired ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
30340
|
-
return (jsxs("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
30442
|
+
const labelMarkup = label ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$3}__LabelWrapper` }, { children: label }), void 0)) : null;
|
|
30443
|
+
const filterFieldMarkup = (jsx("div", Object.assign({ className: `${COMPONENT_NAME$3}__FieldWrapper`, id: name }, { children: field }), void 0));
|
|
30444
|
+
const removeButtonMarkup = onRemove && !isRequired ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$3}__RemoveButtonWrapper` }, { children: jsx("button", Object.assign({ type: 'button', className: `${COMPONENT_NAME$3}__RemoveButton`, onClick: onRemove }, { children: jsx(Icon, { name: 'X' }, void 0) }), void 0) }), void 0)) : null;
|
|
30445
|
+
return (jsxs("div", Object.assign({ className: `${COMPONENT_NAME$3}` }, { children: [labelMarkup, filterFieldMarkup, removeButtonMarkup] }), void 0));
|
|
30341
30446
|
};
|
|
30342
30447
|
|
|
30343
|
-
const COMPONENT_NAME$
|
|
30448
|
+
const COMPONENT_NAME$2 = 'Filters';
|
|
30344
30449
|
const Filters = ({ ariaLabel, filters = [], onApplyFilters, onRemoveFilter, appliedFilters, onCleanFilters, onAddFilter, addFilterButtonIcon, addFilterButtonLabel, clearButtonLabel, searchButtonLabel, extraActions, selectedFilters = [], }) => {
|
|
30345
30450
|
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
|
|
30346
30451
|
const mainContainerRef = useRef(null);
|
|
@@ -30364,8 +30469,8 @@ const Filters = ({ ariaLabel, filters = [], onApplyFilters, onRemoveFilter, appl
|
|
|
30364
30469
|
const extraActionsMarkup = extraActions
|
|
30365
30470
|
? extraActions.map((extraAction, index) => (createElement(AlphaButton, Object.assign({}, extraAction, { key: `extra-action-${index}` }), extraAction.label)))
|
|
30366
30471
|
: null;
|
|
30367
|
-
const secondaryActionsMarkup = (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
30368
|
-
const mainActionsMarkup = (jsxs("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
30472
|
+
const secondaryActionsMarkup = (jsx("div", Object.assign({ className: `${COMPONENT_NAME$2}__SecondaryActionsWrapper` }, { children: availableFiltersPopoverMarkup }), void 0));
|
|
30473
|
+
const mainActionsMarkup = (jsxs("div", Object.assign({ className: `${COMPONENT_NAME$2}__MainActionsWrapper` }, { children: [extraActionsMarkup, jsx(AlphaButton, Object.assign({ ariaLabel: `${ariaLabel}-cleanFilters`, onClick: onCleanFilters, isDisabled: !appliedFilters.length && !selectedFilters.length }, { children: clearButtonLabel }), void 0), jsx(AlphaButton, Object.assign({ ariaLabel: `${ariaLabel}-searchFilters`, isDisabled: !appliedFilters.length && !selectedFilters.length, isPrimary: true, onClick: onApplyFilters }, { children: searchButtonLabel }), void 0)] }), void 0));
|
|
30369
30474
|
const handleRemoveFilter = (filter) => {
|
|
30370
30475
|
onRemoveFilter === null || onRemoveFilter === void 0 ? void 0 : onRemoveFilter(filter);
|
|
30371
30476
|
};
|
|
@@ -30376,17 +30481,17 @@ const Filters = ({ ariaLabel, filters = [], onApplyFilters, onRemoveFilter, appl
|
|
|
30376
30481
|
const handleRemove = () => {
|
|
30377
30482
|
handleRemoveFilter(filter);
|
|
30378
30483
|
};
|
|
30379
|
-
return (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
30484
|
+
return (jsx("div", Object.assign({ className: `${COMPONENT_NAME$2}__SelectedFilter` }, { children: jsx(FilterField, { label: foundFilter.label, field: foundFilter.filter, isRequired: foundFilter.isRequired, onRemove: handleRemove, name: filter }, void 0) }), index));
|
|
30380
30485
|
};
|
|
30381
|
-
const selectedFiltersMarkup = selectedFilters.length ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
30382
|
-
const actionsContainerMarkup = (jsxs("div", Object.assign({ className: `${COMPONENT_NAME$
|
|
30383
|
-
return (jsxs("div", Object.assign({ className: COMPONENT_NAME$
|
|
30486
|
+
const selectedFiltersMarkup = selectedFilters.length ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME$2}__SelectedFiltersWrapper` }, { children: selectedFilters.map(renderSelectedFilter) }), void 0)) : null;
|
|
30487
|
+
const actionsContainerMarkup = (jsxs("div", Object.assign({ className: `${COMPONENT_NAME$2}__ActionsWrapper` }, { children: [secondaryActionsMarkup, mainActionsMarkup] }), void 0));
|
|
30488
|
+
return (jsxs("div", Object.assign({ className: COMPONENT_NAME$2, ref: mainContainerRef }, { children: [selectedFiltersMarkup, actionsContainerMarkup] }), void 0));
|
|
30384
30489
|
};
|
|
30385
30490
|
|
|
30386
|
-
const COMPONENT_NAME = 'Link';
|
|
30491
|
+
const COMPONENT_NAME$1 = 'Link';
|
|
30387
30492
|
const Link = ({ children, className: classNameProp, component, to, target, }) => {
|
|
30388
30493
|
const Component = component;
|
|
30389
|
-
const className = cssClassName(COMPONENT_NAME, classNameProp);
|
|
30494
|
+
const className = cssClassName(COMPONENT_NAME$1, classNameProp);
|
|
30390
30495
|
return (jsx(Component, Object.assign({ className: className, to: to, target: target }, { children: children }), void 0));
|
|
30391
30496
|
};
|
|
30392
30497
|
|
|
@@ -30422,5 +30527,58 @@ const AlphaGraphicCard = ({ data }) => {
|
|
|
30422
30527
|
return jsx("div", Object.assign({ className: MAIN_CLASS }, { children: data.map(renderContainer) }), void 0);
|
|
30423
30528
|
};
|
|
30424
30529
|
|
|
30425
|
-
|
|
30530
|
+
const COMPONENT_NAME = 'AlphaZipCodeInput';
|
|
30531
|
+
const AlphaZipCodeInput = ({ label, isRequired, items, onBlur, onFocus, onChange, value, labelEmpty, }) => {
|
|
30532
|
+
const [isFocusActive, setIsFocusActive] = useState(false);
|
|
30533
|
+
const [showPopover, setShowPopover] = useState(false);
|
|
30534
|
+
const handleOnBlur = () => {
|
|
30535
|
+
setIsFocusActive(false);
|
|
30536
|
+
if (onBlur)
|
|
30537
|
+
onBlur();
|
|
30538
|
+
};
|
|
30539
|
+
const handleOnFocus = () => {
|
|
30540
|
+
setIsFocusActive(true);
|
|
30541
|
+
setShowPopover(Boolean(value && (value === null || value === void 0 ? void 0 : value.length) > 2));
|
|
30542
|
+
if (onFocus)
|
|
30543
|
+
onFocus();
|
|
30544
|
+
};
|
|
30545
|
+
const handleOnChange = (event) => {
|
|
30546
|
+
const isValid = /^[0-9]+$/i.test(event.target.value) || event.target.value === '';
|
|
30547
|
+
if (isValid && onChange) {
|
|
30548
|
+
setShowPopover(event.target.value.length > 2);
|
|
30549
|
+
onChange(event.target.value);
|
|
30550
|
+
}
|
|
30551
|
+
};
|
|
30552
|
+
const labelMarkup = label ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME}__LabelWrapper` }, { children: jsxs("label", Object.assign({ className: `${COMPONENT_NAME}__Label` }, { children: [label, isRequired ? (jsx("span", Object.assign({ className: `${COMPONENT_NAME}__Label--isRequired` }, { children: "*" }), void 0)) : null] }), void 0) }), void 0)) : null;
|
|
30553
|
+
const classesInput = cssClassName(`${COMPONENT_NAME}__InputWrapper`, isFocusActive && 'isFocus');
|
|
30554
|
+
const inputMarkup = (jsx("div", Object.assign({ className: classesInput }, { children: jsx("input", { className: `${COMPONENT_NAME}__InputWrapper--input`, onBlur: handleOnBlur, onFocus: handleOnFocus, onChange: handleOnChange, maxLength: 5, value: value }, void 0) }), void 0));
|
|
30555
|
+
const handleOnSelectItem = (item) => {
|
|
30556
|
+
if (onChange)
|
|
30557
|
+
onChange(item[0]);
|
|
30558
|
+
setShowPopover(false);
|
|
30559
|
+
};
|
|
30560
|
+
const renderLabelItem = (item) => (jsxs("div", Object.assign({ className: `${COMPONENT_NAME}__ItemWrapper` }, { children: [jsx("div", Object.assign({ className: `${COMPONENT_NAME}__Item__Value` }, { children: item.cp }), void 0), jsxs("div", Object.assign({ className: `${COMPONENT_NAME}__Item__Description` }, { children: [item.municipality, ", ", item.city, ", ", item.state] }), void 0)] }), void 0));
|
|
30561
|
+
const itemsOptions = items.map((item) => ({
|
|
30562
|
+
label: renderLabelItem(item),
|
|
30563
|
+
value: item.cp,
|
|
30564
|
+
}));
|
|
30565
|
+
const optionListMarkup = items.length > 0 ? (jsx(OptionList, { items: itemsOptions, selected: [''], onChange: handleOnSelectItem }, void 0)) : null;
|
|
30566
|
+
const emptyItemsMarkup = items.length === 0 ? (jsx("div", Object.assign({ className: `${COMPONENT_NAME}__EmptyItems` }, { children: labelEmpty }), void 0)) : null;
|
|
30567
|
+
const popoverMarkup = useMemo(() => (jsx(Popover$1, Object.assign({ activator: inputMarkup, isActive: showPopover, isFullWidth: true, onClose: () => setShowPopover(false), isFixed: true }, { children: jsxs(Popover$1.Pane, { children: [optionListMarkup, emptyItemsMarkup] }, void 0) }), void 0)), [items, value, showPopover]);
|
|
30568
|
+
return (jsxs("div", Object.assign({ className: `${COMPONENT_NAME}__Wrapper` }, { children: [labelMarkup, popoverMarkup] }), void 0));
|
|
30569
|
+
};
|
|
30570
|
+
|
|
30571
|
+
const MAINCLASS = 'SegmentedControl';
|
|
30572
|
+
const AlphaSegmentedControl = ({ children, title, segments, selected, onSelected, }) => {
|
|
30573
|
+
const renderSegment = (segment, index) => {
|
|
30574
|
+
const classesControl = cssClassName(`${MAINCLASS}__ControlItem`, index === selected && 'isSelected');
|
|
30575
|
+
return (jsx("div", Object.assign({ className: classesControl, id: segment.panelID, "aria-label": segment.ariaLabel, onClick: () => onSelected(index) }, { children: segment.content }), `segmentControl-${index}`));
|
|
30576
|
+
};
|
|
30577
|
+
const controlMarkup = (jsx("div", Object.assign({ className: `${MAINCLASS}__ControlWrapper` }, { children: segments.map(renderSegment) }), void 0));
|
|
30578
|
+
const headerMarkup = (jsxs("div", Object.assign({ className: `${MAINCLASS}__HeaderWrapper` }, { children: [jsx("div", Object.assign({ className: `${MAINCLASS}__Title` }, { children: title }), void 0), controlMarkup] }), void 0));
|
|
30579
|
+
const contentMarkup = children ? (jsx("div", Object.assign({ className: `${MAINCLASS}__ContentWrapper` }, { children: children }), void 0)) : null;
|
|
30580
|
+
return (jsxs("div", Object.assign({ className: `${MAINCLASS}__Container` }, { children: [headerMarkup, contentMarkup] }), void 0));
|
|
30581
|
+
};
|
|
30582
|
+
|
|
30583
|
+
export { ActionList, Alert, AlertProvider, AlphaAttributeInput, AlphaBadge, AlphaButton, AlphaChip, AlphaFilterControl, AlphaGraphicCard, AlphaIcon, AlphaInlineError, AlphaInputDate, InputTag$1 as AlphaInputTag, AlphaInputText, AlphaLabel, AlphaLabelledField, AlphaMultiSelectionPicker, AlphaSegmentedControl, AlphaSpinner, AlphaStepper, AlphaTag, AlphaTile, AlphaTooltip, Totalizer as AlphaTotalizer, AlphaZipCodeInput, AnnotatedSection, Avatar, Badge, Banner, Button, CalendarPicker, Card, Checkbox, ChoiceList, Collapsible, Connector, Container, Cover, DataTable, DatePicker, DeletableSection, Divider, DynamicForm, EmptyState, ErrorIcon, FileDownloader, Filedrop, FilterControl, Filters, Footer, Form, FormField, FormLayout, Frame, Grid, GridItem, Header$1 as Header, Icon, IconButton, IndexList, InlineEdit, InputPhoneNumber, InputTag, InputText, JsonViewer, Label, Link, ListInfo, Loader, Logo, Media, Modal, ModalHeader, Nip, OptionList, Page, PageActions, Pagination, Pane, Panel, PanelFooter, PanelHeader, PendingIcon, Popover$1 as Popover, Progress, RadioButton, SectionForm, Select, SideMenu, SkeletonInput, SkeletonMedia, SkeletonTabs, SkeletonText, SkeletonTitle, SortableList, Spinner, Stack, StepDefault, SuccessIcon, Table, Tabs, Tag, ThemeProvider, ThreadItem, Thumbnail, Tile, TimeSelector, Title, Toggle, Tooltip, WarningIcon, capitalize, cssClassName, formatDate, formatFileSize, isComponentTypeOf, isValidIcon, themeClassConverter, useShowAlert, useTheme };
|
|
30426
30584
|
//# sourceMappingURL=index.js.map
|