@ballistix.digital/react-components 0.6.0 → 0.7.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/index.d.ts +4 -0
- package/dist/index.esm.js +50 -44
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +50 -44
- package/dist/index.js.map +1 -1
- package/dist/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -405,7 +405,7 @@ var styles$s = {
|
|
|
405
405
|
};
|
|
406
406
|
|
|
407
407
|
var BadgeElement = function (props) {
|
|
408
|
-
var children = props.children, _a = props.color, color = _a === void 0 ? 'gray' : _a, _b = props.type, type = _b === void 0 ? 'normal' : _b, _c = props.size, size = _c === void 0 ? 'sm' : _c, _d = props.figure, figure = _d === void 0 ? 'block' : _d, isDisabled = props.isDisabled, isLoading = props.isLoading, onClose = props.onClose, stylesOverrides = props.styles;
|
|
408
|
+
var children = props.children, _a = props.color, color = _a === void 0 ? 'gray' : _a, _b = props.type, type = _b === void 0 ? 'normal' : _b, _c = props.size, size = _c === void 0 ? 'sm' : _c, _d = props.figure, figure = _d === void 0 ? 'block' : _d, isDisabled = props.isDisabled, isLoading = props.isLoading, onClose = props.onClose, stylesOverrides = props.styles, dataCy = props.dataCy;
|
|
409
409
|
var handleGenerateStyle = function () {
|
|
410
410
|
var result = deepCopyObject(styles$r.base);
|
|
411
411
|
var keys = calculateNestedKeys(styles$r.base);
|
|
@@ -419,7 +419,7 @@ var BadgeElement = function (props) {
|
|
|
419
419
|
if (isLoading) {
|
|
420
420
|
return (jsxRuntime.jsx("span", { className: toClassName(styles.container, 'h-4 w-12 animate-pulse'), children: type === 'indicator' && (jsxRuntime.jsx("svg", { className: styles.indicator, fill: "currentColor", viewBox: "0 0 8 8", children: jsxRuntime.jsx("circle", { cx: 4, cy: 4, r: 3 }) })) }));
|
|
421
421
|
}
|
|
422
|
-
return (jsxRuntime.jsxs("span", { className: styles.container, children: [type === 'indicator' && (jsxRuntime.jsx("svg", { className: styles.indicator, fill: "currentColor", viewBox: "0 0 8 8", children: jsxRuntime.jsx("circle", { cx: 4, cy: 4, r: 3 }) })), children, type === 'close' && (jsxRuntime.jsxs("button", { type: "button", className: styles.button, onClick: onClose, children: [jsxRuntime.jsx("span", { className: "sr-only", children: "Remove large option" }), xIcon] }))] }));
|
|
422
|
+
return (jsxRuntime.jsxs("span", { className: styles.container, "data-cy": dataCy, children: [type === 'indicator' && (jsxRuntime.jsx("svg", { className: styles.indicator, fill: "currentColor", viewBox: "0 0 8 8", children: jsxRuntime.jsx("circle", { cx: 4, cy: 4, r: 3 }) })), children, type === 'close' && (jsxRuntime.jsxs("button", { type: "button", className: styles.button, onClick: onClose, children: [jsxRuntime.jsx("span", { className: "sr-only", children: "Remove large option" }), xIcon] }))] }));
|
|
423
423
|
};
|
|
424
424
|
|
|
425
425
|
var base$o = {
|
|
@@ -530,7 +530,7 @@ var styles$r = {
|
|
|
530
530
|
};
|
|
531
531
|
|
|
532
532
|
var ButtonElement = function (props) {
|
|
533
|
-
var children = props.children, innerRef = props.innerRef, _a = props.htmlType, htmlType = _a === void 0 ? 'button' : _a, _b = props.type, type = _b === void 0 ? 'primary' : _b, _c = props.size, size = _c === void 0 ? 'md' : _c, _d = props.figure, figure = _d === void 0 ? 'block' : _d, _e = props.status, status = _e === void 0 ? 'idle' : _e, isDisabled = props.isDisabled, stylesOverrides = props.styles, onClick = props.onClick;
|
|
533
|
+
var children = props.children, innerRef = props.innerRef, _a = props.htmlType, htmlType = _a === void 0 ? 'button' : _a, dataCy = props.dataCy, _b = props.type, type = _b === void 0 ? 'primary' : _b, _c = props.size, size = _c === void 0 ? 'md' : _c, _d = props.figure, figure = _d === void 0 ? 'block' : _d, _e = props.status, status = _e === void 0 ? 'idle' : _e, isDisabled = props.isDisabled, stylesOverrides = props.styles, onClick = props.onClick;
|
|
534
534
|
var handleGenerateStyle = function () {
|
|
535
535
|
var result = deepCopyObject(styles$q.base);
|
|
536
536
|
var keys = calculateNestedKeys(styles$q.base);
|
|
@@ -542,7 +542,7 @@ var ButtonElement = function (props) {
|
|
|
542
542
|
var styles = handleGenerateStyle();
|
|
543
543
|
return (jsxRuntime.jsxs("button", { type: htmlType, className: styles.container, disabled: isDisabled || status !== 'idle', onClick: function (e) {
|
|
544
544
|
onClick && onClick(e);
|
|
545
|
-
}, ref: innerRef, children: [status === 'idle' && children, status === 'loading' && (jsxRuntime.jsxs("div", { className: styles.content, children: [jsxRuntime.jsx(IconElement, { type: "regular", accessor: "spinner", className: styles.spinner }), jsxRuntime.jsx("div", { children: children })] })), status === 'error' && (jsxRuntime.jsxs("div", { className: styles.content, children: [jsxRuntime.jsx(IconElement, { type: "regular", accessor: "circle-exclamation", className: styles.icon }), jsxRuntime.jsx("div", { children: children })] })), status === 'success' && (jsxRuntime.jsxs("div", { className: styles.content, children: [jsxRuntime.jsx(IconElement, { type: "regular", accessor: "circle-check", className: styles.icon }), jsxRuntime.jsx("div", { children: children })] }))] }));
|
|
545
|
+
}, ref: innerRef, "data-cy": dataCy, children: [status === 'idle' && children, status === 'loading' && (jsxRuntime.jsxs("div", { className: styles.content, children: [jsxRuntime.jsx(IconElement, { type: "regular", accessor: "spinner", className: styles.spinner }), jsxRuntime.jsx("div", { children: children })] })), status === 'error' && (jsxRuntime.jsxs("div", { className: styles.content, children: [jsxRuntime.jsx(IconElement, { type: "regular", accessor: "circle-exclamation", className: styles.icon }), jsxRuntime.jsx("div", { children: children })] })), status === 'success' && (jsxRuntime.jsxs("div", { className: styles.content, children: [jsxRuntime.jsx(IconElement, { type: "regular", accessor: "circle-check", className: styles.icon }), jsxRuntime.jsx("div", { children: children })] }))] }));
|
|
546
546
|
};
|
|
547
547
|
|
|
548
548
|
var base$n = {
|
|
@@ -651,7 +651,7 @@ var styles$p = {
|
|
|
651
651
|
};
|
|
652
652
|
|
|
653
653
|
var Container$3 = function (props) {
|
|
654
|
-
var children = props.children, label = props.label, trigger = props.trigger, _a = props.type, type = _a === void 0 ? 'button' : _a, _b = props.direction, direction = _b === void 0 ? 'bottom-left' : _b, _c = props.isEscapingOverflow, isEscapingOverflow = _c === void 0 ? false : _c, stylesOverrides = props.styles;
|
|
654
|
+
var children = props.children, label = props.label, trigger = props.trigger, dataCy = props.dataCy, _a = props.type, type = _a === void 0 ? 'button' : _a, _b = props.direction, direction = _b === void 0 ? 'bottom-left' : _b, _c = props.isEscapingOverflow, isEscapingOverflow = _c === void 0 ? false : _c, stylesOverrides = props.styles;
|
|
655
655
|
var handleGenerateStyle = function () {
|
|
656
656
|
var result = deepCopyObject(styles$o.base);
|
|
657
657
|
var keys = calculateNestedKeys(styles$o.base);
|
|
@@ -662,7 +662,7 @@ var Container$3 = function (props) {
|
|
|
662
662
|
};
|
|
663
663
|
var styles = handleGenerateStyle();
|
|
664
664
|
return (jsxRuntime.jsxs(react.Menu, { as: "div", className: toClassName(styles.container, !isEscapingOverflow && 'relative'), children: [jsxRuntime.jsxs("div", { children: [type === 'button' &&
|
|
665
|
-
(!trigger ? (jsxRuntime.jsxs(react.Menu.Button, { className: styles.button, children: [label, jsxRuntime.jsx(solid.ChevronDownIcon, { className: "-mr-1 ml-2 h-5 w-5", "aria-hidden": "true" })] })) : (jsxRuntime.jsx(react.Menu.Button, { children: trigger }))), type === 'compact' && (jsxRuntime.jsxs(react.Menu.Button, { className: styles.compact, children: [jsxRuntime.jsx("span", { className: "sr-only", children: label }), jsxRuntime.jsx(solid.EllipsisVerticalIcon, { className: styles.dots, "aria-hidden": "true" })] }))] }), jsxRuntime.jsx(react.Transition, { as: React.Fragment, enter: "transition ease-out duration-100", enterFrom: "transform opacity-0 scale-95", enterTo: "transform opacity-100 scale-100", leave: "transition ease-in duration-75", leaveFrom: "transform opacity-100 scale-100", leaveTo: "transform opacity-0 scale-95", children: jsxRuntime.jsx(react.Menu.Items, { className: styles.items, children: children }) })] }));
|
|
665
|
+
(!trigger ? (jsxRuntime.jsxs(react.Menu.Button, { className: styles.button, "data-cy": dataCy, children: [label, jsxRuntime.jsx(solid.ChevronDownIcon, { className: "-mr-1 ml-2 h-5 w-5", "aria-hidden": "true" })] })) : (jsxRuntime.jsx(react.Menu.Button, { "data-cy": dataCy, children: trigger }))), type === 'compact' && (jsxRuntime.jsxs(react.Menu.Button, { className: styles.compact, "data-cy": dataCy, children: [jsxRuntime.jsx("span", { className: "sr-only", children: label }), jsxRuntime.jsx(solid.EllipsisVerticalIcon, { className: styles.dots, "aria-hidden": "true" })] }))] }), jsxRuntime.jsx(react.Transition, { as: React.Fragment, enter: "transition ease-out duration-100", enterFrom: "transform opacity-0 scale-95", enterTo: "transform opacity-100 scale-100", leave: "transition ease-in duration-75", leaveFrom: "transform opacity-100 scale-100", leaveTo: "transform opacity-0 scale-95", children: jsxRuntime.jsx(react.Menu.Items, { className: styles.items, children: children }) })] }));
|
|
666
666
|
};
|
|
667
667
|
var DropdownElement = {
|
|
668
668
|
Container: Container$3,
|
|
@@ -720,8 +720,10 @@ var InputGroupForm = function (props) {
|
|
|
720
720
|
var styles = handleGenerateStyle();
|
|
721
721
|
var invalidIcon = (jsxRuntime.jsx(solid.ExclamationCircleIcon, { className: "h-5 w-5 text-red-500", "aria-hidden": "true" }));
|
|
722
722
|
var isClearable = !trailing && isValid && onClear && value !== '' && value;
|
|
723
|
+
var inputDataCy = "form-input-".concat(name);
|
|
724
|
+
var errorDataCy = "form-input-error-".concat(name);
|
|
723
725
|
return (jsxRuntime.jsxs("div", { className: styles.container, children: [jsxRuntime.jsxs("div", { className: styles.head, children: [label && (jsxRuntime.jsx("label", { htmlFor: name, className: styles.label, children: label })), !required && !isRequired && typeof label === 'string' && (jsxRuntime.jsx("span", { className: styles.hint, children: "Optional" })), required && required({ isRequired: isRequired })] }), jsxRuntime.jsxs("div", { className: styles.body, children: [leading && jsxRuntime.jsx("div", { className: styles.leading, children: leading }), !htmlType ||
|
|
724
|
-
(htmlType !== 'area' && (jsxRuntime.jsxs("div", { className: "flex items-center", children: [jsxRuntime.jsx("input", { type: mask$1 !== undefined ? 'text' : htmlType, ref: mask$1 && ref, name: name, id: name, className: toClassName(styles.input, htmlType === 'color' && '!h-10'), placeholder: placeholder, defaultValue: isSolo ? value : undefined, value: isSolo ? undefined : value, min: min, max: max, maxLength: maxLength, disabled: isDisabled, onChange: onChange, onBlur: onBlur }), htmlType === 'text' && isClearable && (jsxRuntime.jsx("div", { className: "right-5 px-2 absolute cursor-pointer hover:opacity-60", onClick: onClear, children: jsxRuntime.jsx(IconElement, { accessor: "times", className: "text-gray-500" }) })), htmlType === 'date' && isClearable && (jsxRuntime.jsx("div", { className: "right-10 px-2 absolute cursor-pointer hover:opacity-60", onClick: onClear, children: jsxRuntime.jsx(IconElement, { accessor: "times", className: "text-gray-500" }) }))] }))), htmlType === 'area' && (jsxRuntime.jsx("textarea", { rows: rows, name: name, id: name, className: styles.input, placeholder: placeholder, defaultValue: isSolo ? value : undefined, value: isSolo ? undefined : value, maxLength: maxLength, disabled: isDisabled, onChange: onChange, onBlur: onBlur })), type === 'floored' && (jsxRuntime.jsx("div", { className: "absolute inset-x-0 bottom-0 border-t border-gray-300 peer-focus:border-t-2 peer-focus:border-primary-600", "aria-hidden": "true" })), trailing && isValid && (jsxRuntime.jsx("div", { className: styles.trailing, children: trailing })), isTouched && !isValid && (jsxRuntime.jsx("div", { className: styles.trailing, children: invalidIcon }))] }), jsxRuntime.jsxs("div", { className: styles.foot, children: [description && !(error && isTouched) && (jsxRuntime.jsx("p", { className: styles.description, children: description })), error && isTouched && jsxRuntime.jsx("p", { className: styles.error, children: error })] })] }));
|
|
726
|
+
(htmlType !== 'area' && (jsxRuntime.jsxs("div", { className: "flex items-center", children: [jsxRuntime.jsx("input", { type: mask$1 !== undefined ? 'text' : htmlType, ref: mask$1 && ref, name: name, id: name, "data-cy": inputDataCy, className: toClassName(styles.input, htmlType === 'color' && '!h-10'), placeholder: placeholder, defaultValue: isSolo ? value : undefined, value: isSolo ? undefined : value, min: min, max: max, maxLength: maxLength, disabled: isDisabled, onChange: onChange, onBlur: onBlur }), htmlType === 'text' && isClearable && (jsxRuntime.jsx("div", { className: "right-5 px-2 absolute cursor-pointer hover:opacity-60", onClick: onClear, children: jsxRuntime.jsx(IconElement, { accessor: "times", className: "text-gray-500" }) })), htmlType === 'date' && isClearable && (jsxRuntime.jsx("div", { className: "right-10 px-2 absolute cursor-pointer hover:opacity-60", onClick: onClear, children: jsxRuntime.jsx(IconElement, { accessor: "times", className: "text-gray-500" }) }))] }))), htmlType === 'area' && (jsxRuntime.jsx("textarea", { rows: rows, name: name, id: name, "data-cy": inputDataCy, className: styles.input, placeholder: placeholder, defaultValue: isSolo ? value : undefined, value: isSolo ? undefined : value, maxLength: maxLength, disabled: isDisabled, onChange: onChange, onBlur: onBlur })), type === 'floored' && (jsxRuntime.jsx("div", { className: "absolute inset-x-0 bottom-0 border-t border-gray-300 peer-focus:border-t-2 peer-focus:border-primary-600", "aria-hidden": "true" })), trailing && isValid && (jsxRuntime.jsx("div", { className: styles.trailing, children: trailing })), isTouched && !isValid && (jsxRuntime.jsx("div", { className: styles.trailing, children: invalidIcon }))] }), jsxRuntime.jsxs("div", { className: styles.foot, children: [description && !(error && isTouched) && (jsxRuntime.jsx("p", { className: styles.description, children: description })), error && isTouched && (jsxRuntime.jsx("p", { className: styles.error, "data-cy": errorDataCy, children: error }))] })] }));
|
|
725
727
|
};
|
|
726
728
|
|
|
727
729
|
var base$k = {
|
|
@@ -1284,6 +1286,8 @@ var SelectMenuForm = function (props) {
|
|
|
1284
1286
|
var _j = React.useState(true), isFocus = _j[0], setIsFocus = _j[1];
|
|
1285
1287
|
var _k = React.useState(value !== null && value !== void 0 ? value : null), state = _k[0], setState = _k[1];
|
|
1286
1288
|
var isValid = error === undefined;
|
|
1289
|
+
var selectDataCy = "form-select-".concat(name);
|
|
1290
|
+
var errorDataCy = "form-select-error-".concat(name);
|
|
1287
1291
|
var handleGenerateStyle = function () {
|
|
1288
1292
|
var result = deepCopyObject(styles$h.base);
|
|
1289
1293
|
var keys = calculateNestedKeys(styles$h.base);
|
|
@@ -1316,37 +1320,37 @@ var SelectMenuForm = function (props) {
|
|
|
1316
1320
|
React.useEffect(function () {
|
|
1317
1321
|
setState(value);
|
|
1318
1322
|
}, [value]);
|
|
1319
|
-
return (jsxRuntime.jsxs("div", { className: styles.container, children: [jsxRuntime.jsxs("div", { className: styles.head, children: [label && (jsxRuntime.jsx("label", { htmlFor: name, className: styles.label, children: label })), !required && !isRequired && typeof label === 'string' && (jsxRuntime.jsx("span", { className: styles.hint, children: "Optional" })), required && required({ isRequired: isRequired })] }), jsxRuntime.jsxs("div", { className: styles.container, children: [jsxRuntime.jsx(Select, { primaryColor: "primary",
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1323
|
+
return (jsxRuntime.jsxs("div", { className: styles.container, children: [jsxRuntime.jsxs("div", { className: styles.head, children: [label && (jsxRuntime.jsx("label", { htmlFor: name, className: styles.label, children: label })), !required && !isRequired && typeof label === 'string' && (jsxRuntime.jsx("span", { className: styles.hint, children: "Optional" })), required && required({ isRequired: isRequired })] }), jsxRuntime.jsxs("div", { className: styles.container, children: [jsxRuntime.jsx("div", { "data-cy": selectDataCy, children: jsxRuntime.jsx(Select, { primaryColor: "primary",
|
|
1324
|
+
//
|
|
1325
|
+
placeholder: placeholder === null || placeholder === void 0 ? void 0 : placeholder.select, noOptionsMessage: (jsxRuntime.jsx("p", { className: styles.emptyState, children: (_a = placeholder === null || placeholder === void 0 ? void 0 : placeholder.emptyState) !== null && _a !== void 0 ? _a : 'No results found' })), searchInputPlaceholder: placeholder === null || placeholder === void 0 ? void 0 : placeholder.searchInput,
|
|
1326
|
+
//
|
|
1327
|
+
loading: isLoading, isDisabled: isDisabled, isClearable: isClearable, isMultiple: isMultiple, isSearchable: isSearchable,
|
|
1328
|
+
//
|
|
1329
|
+
options: options,
|
|
1330
|
+
//
|
|
1331
|
+
value: state, onChange: handleChange, onSearchInputChange: onSearchInputChange,
|
|
1332
|
+
//
|
|
1333
|
+
classNames: {
|
|
1334
|
+
menuButton: function () {
|
|
1335
|
+
return toClassName(styles.input, state === null && '[&>*]:!text-gray-300 ', state === null &&
|
|
1336
|
+
!isValid &&
|
|
1337
|
+
isTouched &&
|
|
1338
|
+
'[&>*]:!text-red-300');
|
|
1339
|
+
},
|
|
1340
|
+
menu: styles.menu,
|
|
1341
|
+
tagItem: function () { return styles.tagItem; },
|
|
1342
|
+
tagItemText: styles.tagItemText,
|
|
1343
|
+
tagItemIconContainer: styles.tagItemIconContainer,
|
|
1344
|
+
tagItemIcon: styles.tagItemIcon,
|
|
1345
|
+
list: styles.list,
|
|
1346
|
+
listItem: function () { return styles.listItem; },
|
|
1347
|
+
listDisabledItem: styles.listDisabledItem,
|
|
1348
|
+
listGroupLabel: styles.listGroupLabel,
|
|
1349
|
+
searchContainer: styles.searchContainer,
|
|
1350
|
+
searchBox: styles.searchBox,
|
|
1351
|
+
searchIcon: styles.searchIcon,
|
|
1352
|
+
closeIcon: styles.closeIcon,
|
|
1353
|
+
} }) }), !isSolo && (jsxRuntime.jsxs("div", { className: styles.foot, children: [description && !(error && isTouched) && (jsxRuntime.jsx("p", { className: styles.description, children: description })), error && isTouched && (jsxRuntime.jsx("p", { className: styles.error, "data-cy": errorDataCy, children: JSON.stringify(error).replaceAll('"', '') }))] }))] })] }));
|
|
1350
1354
|
};
|
|
1351
1355
|
|
|
1352
1356
|
var PanelPaginationNavigation = function (props) {
|
|
@@ -1838,7 +1842,7 @@ var TableList2 = function (props) {
|
|
|
1838
1842
|
setTableState(id, state);
|
|
1839
1843
|
}
|
|
1840
1844
|
}, [id, state]);
|
|
1841
|
-
return (jsxRuntime.jsxs("div", { className: styles.container, children: [jsxRuntime.jsx("div", { className: styles.head, children: head && head(state) }), jsxRuntime.jsx("div", { className: styles.body.content, children: jsxRuntime.jsx("div", { className: styles.body.wrapper, children: jsxRuntime.jsx("div", { className: styles.body.styleWrapper, children: jsxRuntime.jsxs("div", { className: styles.body.tableWrapper, children: [jsxRuntime.jsxs("table", { className: styles.body.table.container, children: [jsxRuntime.jsx("thead", { className: styles.body.table.head.container, children: table === null || table === void 0 ? void 0 : table.getHeaderGroups().map(function (headerGroup) { return (jsxRuntime.jsx("tr", { children: headerGroup.headers.map(function (header) {
|
|
1845
|
+
return (jsxRuntime.jsxs("div", { className: styles.container, "data-cy": "table-list-".concat(id), children: [jsxRuntime.jsx("div", { className: styles.head, children: head && head(state) }), jsxRuntime.jsx("div", { className: styles.body.content, children: jsxRuntime.jsx("div", { className: styles.body.wrapper, children: jsxRuntime.jsx("div", { className: styles.body.styleWrapper, children: jsxRuntime.jsxs("div", { className: styles.body.tableWrapper, children: [jsxRuntime.jsxs("table", { className: styles.body.table.container, children: [jsxRuntime.jsx("thead", { className: styles.body.table.head.container, children: table === null || table === void 0 ? void 0 : table.getHeaderGroups().map(function (headerGroup) { return (jsxRuntime.jsx("tr", { children: headerGroup.headers.map(function (header) {
|
|
1842
1846
|
// Default sort icon to show a user that the column is sortable
|
|
1843
1847
|
var SortIconElement = solid.ChevronUpDownIcon;
|
|
1844
1848
|
if (header.column.getIsSorted()) {
|
|
@@ -2314,7 +2318,7 @@ var styles$a = {
|
|
|
2314
2318
|
};
|
|
2315
2319
|
|
|
2316
2320
|
var ModalOverlay = function (props) {
|
|
2317
|
-
var children = props.children, trigger = props.trigger, _a = props.size, size = _a === void 0 ? 'md' : _a, stylesOverrides = props.styles, onOpen = props.onOpen, onClose = props.onClose;
|
|
2321
|
+
var children = props.children, trigger = props.trigger, _a = props.size, size = _a === void 0 ? 'md' : _a, stylesOverrides = props.styles, dataCy = props.dataCy, onOpen = props.onOpen, onClose = props.onClose;
|
|
2318
2322
|
var _b = React.useState(trigger ? false : true), isOpen = _b[0], setIsOpen = _b[1];
|
|
2319
2323
|
var options = React.useMemo(function () { return ({
|
|
2320
2324
|
handleOpen: function () { return setIsOpen(true); },
|
|
@@ -2339,7 +2343,7 @@ var ModalOverlay = function (props) {
|
|
|
2339
2343
|
onClose && onClose();
|
|
2340
2344
|
}
|
|
2341
2345
|
}, [isOpen, onClose]);
|
|
2342
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(react.Transition.Root, { show: isOpen, as: React.Fragment, children: jsxRuntime.jsxs(react.Dialog, { as: "div", className: styles.container, onClose: setIsOpen, children: [jsxRuntime.jsx(react.Transition.Child, { as: React.Fragment, enter: styles.background.transition.enter, enterFrom: styles.background.transition.enterFrom, enterTo: styles.background.transition.enterTo, leave: styles.background.transition.leave, leaveFrom: styles.background.transition.leaveFrom, leaveTo: styles.background.transition.leaveTo, children: jsxRuntime.jsx("div", { className: styles.background.container }) }), jsxRuntime.jsx("div", { className: styles.layout.container, children: jsxRuntime.jsx("div", { className: styles.layout.content, children: jsxRuntime.jsx(react.Transition.Child, { as: React.Fragment, enter: styles.panel.transition.enter, enterFrom: styles.panel.transition.enterFrom, enterTo: styles.panel.transition.enterTo, leave: styles.panel.transition.leave, leaveFrom: styles.panel.transition.leaveFrom, leaveTo: styles.panel.transition.leaveTo, children: jsxRuntime.jsx(react.Dialog.Panel, { className: styles.panel.container, children: children(options) }) }) }) })] }) }), trigger && trigger(options)] }));
|
|
2346
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(react.Transition.Root, { show: isOpen, as: React.Fragment, children: jsxRuntime.jsxs(react.Dialog, { as: "div", className: styles.container, onClose: setIsOpen, children: [jsxRuntime.jsx(react.Transition.Child, { as: React.Fragment, enter: styles.background.transition.enter, enterFrom: styles.background.transition.enterFrom, enterTo: styles.background.transition.enterTo, leave: styles.background.transition.leave, leaveFrom: styles.background.transition.leaveFrom, leaveTo: styles.background.transition.leaveTo, children: jsxRuntime.jsx("div", { className: styles.background.container }) }), jsxRuntime.jsx("div", { className: styles.layout.container, "data-cy": dataCy, children: jsxRuntime.jsx("div", { className: styles.layout.content, children: jsxRuntime.jsx(react.Transition.Child, { as: React.Fragment, enter: styles.panel.transition.enter, enterFrom: styles.panel.transition.enterFrom, enterTo: styles.panel.transition.enterTo, leave: styles.panel.transition.leave, leaveFrom: styles.panel.transition.leaveFrom, leaveTo: styles.panel.transition.leaveTo, children: jsxRuntime.jsx(react.Dialog.Panel, { className: styles.panel.container, children: children(options) }) }) }) })] }) }), trigger && trigger(options)] }));
|
|
2343
2347
|
};
|
|
2344
2348
|
|
|
2345
2349
|
var base$7 = {
|
|
@@ -2674,6 +2678,8 @@ var DateMenuForm = function (props) {
|
|
|
2674
2678
|
return result;
|
|
2675
2679
|
};
|
|
2676
2680
|
var styles = handleGenerateStyle();
|
|
2681
|
+
var inputDataCy = "form-input-date-".concat(name);
|
|
2682
|
+
var errorDataCy = "form-input-date-error-".concat(name);
|
|
2677
2683
|
// Simulate onClear event.
|
|
2678
2684
|
React.useEffect(function () {
|
|
2679
2685
|
if (state.startDate === null && state.endDate === null) {
|
|
@@ -2681,13 +2687,13 @@ var DateMenuForm = function (props) {
|
|
|
2681
2687
|
}
|
|
2682
2688
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2683
2689
|
}, [state]);
|
|
2684
|
-
return (jsxRuntime.jsxs("div", { className: styles.container, children: [jsxRuntime.jsxs("div", { className: styles.head, children: [label && (jsxRuntime.jsx("label", { htmlFor: name, className: styles.label, children: label })), !required && !isRequired && typeof label === 'string' && (jsxRuntime.jsx("span", { className: styles.hint, children: "Optional" })), required && required({ isRequired: isRequired })] }), jsxRuntime.jsxs("div", { className: styles.container, children: [jsxRuntime.jsx(Datepicker, { inputName: name, inputId: name, i18n: i18n, useRange: size === 'expanded', placeholder: placeholder, asSingle: !isRanged, separator: separator, startFrom: startFrom, displayFormat: displayFormat, disabled: isDisabled, popoverDirection: direction, minDate: minDate, maxDate: maxDate, toggleIcon: icon,
|
|
2690
|
+
return (jsxRuntime.jsxs("div", { className: styles.container, children: [jsxRuntime.jsxs("div", { className: styles.head, children: [label && (jsxRuntime.jsx("label", { htmlFor: name, className: styles.label, children: label })), !required && !isRequired && typeof label === 'string' && (jsxRuntime.jsx("span", { className: styles.hint, children: "Optional" })), required && required({ isRequired: isRequired })] }), jsxRuntime.jsxs("div", { className: styles.container, "data-cy": inputDataCy, children: [jsxRuntime.jsx(Datepicker, { inputName: name, inputId: name, i18n: i18n, useRange: size === 'expanded', placeholder: placeholder, asSingle: !isRanged, separator: separator, startFrom: startFrom, displayFormat: displayFormat, disabled: isDisabled, popoverDirection: direction, minDate: minDate, maxDate: maxDate, toggleIcon: icon,
|
|
2685
2691
|
//
|
|
2686
2692
|
value: state,
|
|
2687
2693
|
//
|
|
2688
2694
|
onChange: handleValueChange,
|
|
2689
2695
|
//
|
|
2690
|
-
inputClassName: styles.input, startWeekOn: startWeekOn }), !isSolo && (jsxRuntime.jsxs("div", { className: styles.foot, children: [description && !(error && isTouched) && (jsxRuntime.jsx("p", { className: styles.description, children: description })), error && isTouched && (jsxRuntime.jsx("p", { className: styles.error, children: typeof error === 'string'
|
|
2696
|
+
inputClassName: styles.input, startWeekOn: startWeekOn }), !isSolo && (jsxRuntime.jsxs("div", { className: styles.foot, children: [description && !(error && isTouched) && (jsxRuntime.jsx("p", { className: styles.description, children: description })), error && isTouched && (jsxRuntime.jsx("p", { className: styles.error, "data-cy": errorDataCy, children: typeof error === 'string'
|
|
2691
2697
|
? error
|
|
2692
2698
|
: (_a = error === null || error === void 0 ? void 0 : error.startDate) !== null && _a !== void 0 ? _a : error === null || error === void 0 ? void 0 : error.endDate }))] }))] })] }));
|
|
2693
2699
|
};
|
|
@@ -2783,7 +2789,7 @@ var CheckboxInputGroupForm = function (props) {
|
|
|
2783
2789
|
var styles = handleGenerateStyle();
|
|
2784
2790
|
return (jsxRuntime.jsx(formik.FormikProvider, { value: form, children: jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("legend", { className: styles.sr, children: name }), jsxRuntime.jsx("div", { className: styles.list, children: jsxRuntime.jsx(formik.FieldArray, { name: name, render: function (_a) {
|
|
2785
2791
|
var remove = _a.remove, push = _a.push;
|
|
2786
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: options === null || options === void 0 ? void 0 : options.map(function (option) { return (jsxRuntime.jsxs("div", { className: styles.item.container, children: [jsxRuntime.jsx("div", { className: styles.item.head, children: jsxRuntime.jsx("input", { id: option.value, name: option.value, "aria-describedby": "".concat(option.value, "-description"), type: "checkbox", checked: values === null || values === void 0 ? void 0 : values.includes(option.value), className: styles.item.input, disabled: isDisabled, onChange: function (value) {
|
|
2792
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: options === null || options === void 0 ? void 0 : options.map(function (option) { return (jsxRuntime.jsxs("div", { className: styles.item.container, children: [jsxRuntime.jsx("div", { className: styles.item.head, children: jsxRuntime.jsx("input", { id: option.value, name: option.value, "data-cy": "form-".concat(name, "-checkbox-").concat(option.value), "aria-describedby": "".concat(option.value, "-description"), type: "checkbox", checked: values === null || values === void 0 ? void 0 : values.includes(option.value), className: styles.item.input, disabled: isDisabled, onChange: function (value) {
|
|
2787
2793
|
var isChecked = value.currentTarget.checked;
|
|
2788
2794
|
if (isChecked) {
|
|
2789
2795
|
push(option.value);
|