@luscii-healthtech/web-ui 42.7.0 → 42.8.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.development.js +164 -163
- package/dist/index.development.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/web-ui-tailwind.css +0 -3
- package/dist/web-ui.esm.js +1 -1
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -26,8 +26,8 @@ require('react-datepicker/dist/react-datepicker.min.css');
|
|
|
26
26
|
var PropTypes = require('prop-types');
|
|
27
27
|
var FlyOutMenuPrimitive = require('@radix-ui/react-dropdown-menu');
|
|
28
28
|
var RadixHC = require('@radix-ui/react-hover-card');
|
|
29
|
-
var ReactSelect = require('react-select');
|
|
30
29
|
var groupBy = require('lodash/groupBy');
|
|
30
|
+
var ReactSelect = require('react-select');
|
|
31
31
|
var RadixSwitch = require('@radix-ui/react-switch');
|
|
32
32
|
var Quill = require('quill');
|
|
33
33
|
require('quill-paste-smart');
|
|
@@ -71,8 +71,8 @@ var ReactDatePicker__default = /*#__PURE__*/_interopDefault(ReactDatePicker);
|
|
|
71
71
|
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
72
72
|
var FlyOutMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(FlyOutMenuPrimitive);
|
|
73
73
|
var RadixHC__namespace = /*#__PURE__*/_interopNamespace(RadixHC);
|
|
74
|
-
var ReactSelect__default = /*#__PURE__*/_interopDefault(ReactSelect);
|
|
75
74
|
var groupBy__default = /*#__PURE__*/_interopDefault(groupBy);
|
|
75
|
+
var ReactSelect__default = /*#__PURE__*/_interopDefault(ReactSelect);
|
|
76
76
|
var RadixSwitch__namespace = /*#__PURE__*/_interopNamespace(RadixSwitch);
|
|
77
77
|
var Quill__default = /*#__PURE__*/_interopDefault(Quill);
|
|
78
78
|
var isFunction__default = /*#__PURE__*/_interopDefault(isFunction);
|
|
@@ -3429,126 +3429,49 @@ const PaginationMenuSmall = (props) => {
|
|
|
3429
3429
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(TertiaryButton, { "data-test-id": "prev-button", icon: LeftArrowIcon, "data-page": props.currentPageNumber - 1, onClick: handleOnChange, isDisabled: props.currentPageNumber === 1 }), jsxRuntime.jsx(Text, { className: "ui:ml-4", text: `${props.currentPageNumber} / ${props.pageCount}`, type: "sm", color: "slate-500" }), jsxRuntime.jsx(TertiaryButton, { className: "ui:ml-4", "data-test-id": "next-button", icon: ChevronRightIcon, isDisabled: props.currentPageNumber === props.pageCount, "data-page": props.currentPageNumber + 1, onClick: handleOnChange })] });
|
|
3430
3430
|
};
|
|
3431
3431
|
|
|
3432
|
-
var css_248z$8 = ".
|
|
3432
|
+
var css_248z$8 = ".styled-select {\n appearance: none;\n}\n.styled-select::picker-icon {\n appearance: none;\n}";
|
|
3433
3433
|
styleInject(css_248z$8);
|
|
3434
3434
|
|
|
3435
|
-
const
|
|
3436
|
-
|
|
3437
|
-
const
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
fontWeight: state.isSelected ? "bold" : "normal",
|
|
3444
|
-
fontSize: "14px",
|
|
3445
|
-
// tailwind blue-50
|
|
3446
|
-
backgroundColor: state.isFocused ? "#F2FAFD" : "none",
|
|
3447
|
-
color: "inherit",
|
|
3448
|
-
position: "relative",
|
|
3449
|
-
padding: "0.75rem",
|
|
3450
|
-
opacity: state.isDisabled ? "0.5" : 1,
|
|
3451
|
-
"&:after": {
|
|
3452
|
-
visibility: state.isSelected ? "visible" : "hidden"
|
|
3453
|
-
},
|
|
3454
|
-
transition: "background-color 0.3s ease-in-out",
|
|
3455
|
-
"&:hover": {
|
|
3456
|
-
// tailwind blue-50
|
|
3457
|
-
backgroundColor: state.isSelected ? "transparent" : "#F2FAFD"
|
|
3458
|
-
},
|
|
3459
|
-
pointerEvents: state.isDisabled ? "none" : "auto"
|
|
3460
|
-
});
|
|
3461
|
-
},
|
|
3462
|
-
container: (baseStyles) => {
|
|
3463
|
-
return Object.assign(Object.assign({}, baseStyles), { flexGrow: "initial" });
|
|
3464
|
-
},
|
|
3465
|
-
input: (baseStyles) => {
|
|
3466
|
-
return Object.assign(Object.assign({}, baseStyles), { padding: 0, margin: 0 });
|
|
3467
|
-
},
|
|
3468
|
-
multiValue: (baseStyles) => {
|
|
3469
|
-
return Object.assign(Object.assign({}, baseStyles), { lineHeight: "1rem" });
|
|
3470
|
-
},
|
|
3471
|
-
valueContainer: (baseStyles) => {
|
|
3472
|
-
return Object.assign(Object.assign({}, baseStyles), { padding: ".5rem", margin: 0 });
|
|
3473
|
-
},
|
|
3474
|
-
control: (baseStyles, state) => {
|
|
3475
|
-
const navyBlue = "rgb(30 64 175)";
|
|
3476
|
-
const lightGray = "#D1D5DB";
|
|
3477
|
-
const red = "#c53030";
|
|
3478
|
-
const lightRedTransparent = "rgba(255, 98, 102, 0.3)";
|
|
3479
|
-
const darkBlue = "#1e40af";
|
|
3480
|
-
const mediumGray = "#9CA3AF";
|
|
3481
|
-
const lightShadow = "rgba(0, 0, 0, 0.05)";
|
|
3482
|
-
const defaultBorderColor = state.isFocused || state.menuIsOpen ? navyBlue : lightGray;
|
|
3483
|
-
const validatedBorderColor = hasError ? red : defaultBorderColor;
|
|
3484
|
-
const defaultOutline = hasError ? lightRedTransparent : darkBlue;
|
|
3485
|
-
const validatedOutline = `2px solid ${state.isFocused ? defaultOutline : "transparent"}`;
|
|
3486
|
-
return Object.assign(Object.assign({}, baseStyles), {
|
|
3487
|
-
fontSize: "14px",
|
|
3488
|
-
transition: "border 0.3s ease-in-out",
|
|
3489
|
-
// primary outline
|
|
3490
|
-
outline: validatedOutline,
|
|
3491
|
-
outlineOffset: "-2px",
|
|
3492
|
-
borderColor: validatedBorderColor,
|
|
3493
|
-
borderWidth: "1px !important",
|
|
3494
|
-
borderStyle: "solid",
|
|
3495
|
-
borderRadius: "4px",
|
|
3496
|
-
minHeight: state.isMulti ? "44px" : void 0,
|
|
3497
|
-
height: state.isMulti ? void 0 : "44px",
|
|
3498
|
-
boxShadow: `0px 1px 2px ${lightShadow}`,
|
|
3499
|
-
"&:hover": {
|
|
3500
|
-
borderColor: mediumGray,
|
|
3501
|
-
// selector for the chevron
|
|
3502
|
-
'> [class*="IndicatorsContainer"]': {
|
|
3503
|
-
opacity: 1
|
|
3504
|
-
}
|
|
3505
|
-
}
|
|
3506
|
-
});
|
|
3507
|
-
},
|
|
3508
|
-
// The placeholder has the following css prop: grid-area: 1/1/2/3;
|
|
3509
|
-
// And grid-area doesn't work on IE11, so we need to style it slightly different.
|
|
3510
|
-
placeholder: (baseStyles) => Object.assign(Object.assign({}, baseStyles), { fontWeight: 100, color: "#6B7280", margin: 0 }),
|
|
3511
|
-
singleValue: (baseStyles) => {
|
|
3512
|
-
return Object.assign(Object.assign({}, baseStyles), { fontSize: "14px" });
|
|
3513
|
-
},
|
|
3514
|
-
indicatorSeparator: () => ({
|
|
3515
|
-
display: "none"
|
|
3516
|
-
}),
|
|
3517
|
-
menu: (baseStyles) => Object.assign(Object.assign({}, baseStyles), { zIndex: 20 })
|
|
3518
|
-
};
|
|
3519
|
-
}
|
|
3520
|
-
const Select = React__namespace.default.forwardRef((_a, innerRef) => {
|
|
3521
|
-
var { isError = false, styles, options, onChange, value, width = "full", isMulti, className, skipValueProcessing } = _a, otherProps = __rest(_a, ["isError", "styles", "options", "onChange", "value", "width", "isMulti", "className", "skipValueProcessing"]);
|
|
3522
|
-
const customStyles = generateCustomStyles(isError);
|
|
3523
|
-
const mergedStyles = ReactSelect.mergeStyles(customStyles, styles);
|
|
3524
|
-
const isOptionsGrouped = !options ? false : options.reduce((acc, o) => acc || "options" in o && !("values" in o), false);
|
|
3525
|
-
const flatmappedOptions = !options ? [] : isOptionsGrouped ? options.flatMap((g) => g.options) : options;
|
|
3526
|
-
const onChangeWrapped = !onChange ? void 0 : isMulti ? (val, a) => onChange(val.map((v) => v.value), a) : (val, a) => onChange(val === null || val === void 0 ? void 0 : val.value, a);
|
|
3527
|
-
const valueWrapped = !value || !options ? value : isMulti ? flatmappedOptions.filter((o) => value.includes(o.value)) : flatmappedOptions.find((o) => o.value === value);
|
|
3528
|
-
const getDataAttributes = () => {
|
|
3529
|
-
const dataProps = {};
|
|
3530
|
-
for (const prop in otherProps) {
|
|
3531
|
-
if (prop.includes("data-")) {
|
|
3532
|
-
dataProps[prop] = otherProps[prop];
|
|
3533
|
-
}
|
|
3534
|
-
}
|
|
3535
|
-
return dataProps;
|
|
3435
|
+
const StyledSelect = React__namespace.default.forwardRef((_a, ref) => {
|
|
3436
|
+
var { children, suffix, prefix, className, width = "full", height = "lg", isError } = _a, attributes = __rest(_a, ["children", "suffix", "prefix", "className", "width", "height", "isError"]);
|
|
3437
|
+
const hasPrefix = !!prefix;
|
|
3438
|
+
const hasSuffix = !!suffix;
|
|
3439
|
+
const hasNoExtraContent = !hasPrefix && !hasSuffix;
|
|
3440
|
+
const heightClasses = {
|
|
3441
|
+
md: "ui:h-form-md",
|
|
3442
|
+
lg: "ui:h-form-lg"
|
|
3536
3443
|
};
|
|
3537
|
-
const
|
|
3538
|
-
|
|
3539
|
-
|
|
3444
|
+
const paddingClasses = {
|
|
3445
|
+
md: "ui:px-3 py-2 ui:pr-10",
|
|
3446
|
+
// pr-10 to account for the chevron icon
|
|
3447
|
+
lg: "ui:p-3 ui:pr-10"
|
|
3540
3448
|
};
|
|
3541
|
-
return jsxRuntime.
|
|
3542
|
-
"ui:
|
|
3543
|
-
"ui:
|
|
3544
|
-
"ui:
|
|
3545
|
-
"ui:
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3449
|
+
return jsxRuntime.jsxs(FlexRow, { spacing: "none", "data-test-id": "input-component-container", stretch: false, children: [jsxRuntime.jsx("span", { className: classNames__default.default(heightClasses[height], "ui:border-b ui:border-t ui:border-solid ui:border-input-border", {
|
|
3450
|
+
"ui:hidden": hasNoExtraContent,
|
|
3451
|
+
"ui:order-1": hasSuffix,
|
|
3452
|
+
"ui:rounded-l ui:border-l": hasPrefix,
|
|
3453
|
+
"ui:rounded-r ui:border-r": hasSuffix
|
|
3454
|
+
}, "ui:flex ui:flex-col ui:items-center ui:p-3", "ui:text-sm", "ui:text-slate-500", "ui:bg-main-background"), children: suffix || prefix }), jsxRuntime.jsxs("div", { className: classNames__default.default("ui:relative", {
|
|
3455
|
+
"ui:flex ui:grow": width === "full"
|
|
3456
|
+
}), children: [jsxRuntime.jsx("select", Object.assign({ ref, className: classNames__default.default("styled-select", "ui:block ui:min-w-[4rem]", calculateResponsiveWidthClasses(width), {
|
|
3457
|
+
"ui:bg-slate-50 ui:text-slate-400": attributes.disabled,
|
|
3458
|
+
"ui:text-slate-800": !attributes.disabled,
|
|
3459
|
+
"ui:border-input-border": !attributes.disabled && !isError,
|
|
3460
|
+
"ui:hover:border-input-border-dark": !attributes.disabled,
|
|
3461
|
+
"ui:border-red-700": isError,
|
|
3462
|
+
"ui:focus:outline-negative": isError,
|
|
3463
|
+
"ui:focus:border-primary": !isError,
|
|
3464
|
+
"ui:focus:outline-primary": !isError,
|
|
3465
|
+
"ui:bg-white": !attributes.disabled
|
|
3466
|
+
}, heightClasses[height], paddingClasses[height], "ui:border", "ui:text-base ui:sm:text-sm", "ui:placeholder-slate-500", "ui:border-solid", "ui:transition-colors", "ui:duration-300", {
|
|
3467
|
+
"ui:rounded": hasNoExtraContent,
|
|
3468
|
+
"ui:rounded-l": hasSuffix,
|
|
3469
|
+
"ui:rounded-r": hasPrefix,
|
|
3470
|
+
"ui:order-2": hasPrefix,
|
|
3471
|
+
"ui:order-1": hasSuffix
|
|
3472
|
+
}, "ui:shadow-default", className) }, attributes, { children })), jsxRuntime.jsx("div", { className: "ui:pointer-events-none ui:absolute ui:right-0 ui:top-1/2 ui:z-20", style: {
|
|
3473
|
+
transform: "translateY(-50%)"
|
|
3474
|
+
}, children: jsxRuntime.jsx(ChevronDownIcon, { className: classNames__default.default("ui:mr-3 ui:h-6 ui:w-6 ui:text-slate-300") }) })] })] });
|
|
3552
3475
|
});
|
|
3553
3476
|
|
|
3554
3477
|
const PAGE_SIZES = [25, 50, 75, 100];
|
|
@@ -3579,18 +3502,19 @@ const getSummaryText = (pageCount, currentPageNumber, localization, pageSize, re
|
|
|
3579
3502
|
};
|
|
3580
3503
|
|
|
3581
3504
|
const PaginationMenuLarge = (props) => {
|
|
3582
|
-
const handleOnPageNumberSelect = (
|
|
3583
|
-
props.onChange(value, props.pageSize);
|
|
3505
|
+
const handleOnPageNumberSelect = (e) => {
|
|
3506
|
+
props.onChange(Number.parseInt(e.target.value, 10), props.pageSize);
|
|
3584
3507
|
};
|
|
3585
|
-
const handleOnPageSizeSelect = (
|
|
3508
|
+
const handleOnPageSizeSelect = (e) => {
|
|
3509
|
+
const value = Number.parseInt(e.target.value, 10);
|
|
3586
3510
|
const pageSize = PAGE_SIZE_OPTIONS.find((option) => option.value === value);
|
|
3587
3511
|
pageSize && props.onChange(1, pageSize.value);
|
|
3588
3512
|
};
|
|
3589
3513
|
const handleOnPrevNextButtonClick = (event) => {
|
|
3590
3514
|
const newPage = event.currentTarget.dataset.page;
|
|
3591
|
-
newPage && props.onChange(parseInt(newPage, 10), props.pageSize);
|
|
3515
|
+
newPage && props.onChange(Number.parseInt(newPage, 10), props.pageSize);
|
|
3592
3516
|
};
|
|
3593
|
-
return jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(
|
|
3517
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(Stack, { axis: "x", align: "center", gap: "s", justify: "start", width: "full", children: [props.pageSize && props.resultCount && jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Text, { children: props.localization.display }), jsxRuntime.jsx(StyledSelect, { onChange: handleOnPageSizeSelect, value: props.pageSize, children: PAGE_SIZE_OPTIONS.map((option) => jsxRuntime.jsx("option", { value: option.value, children: option.label }, option.value)) })] }), jsxRuntime.jsx(Text, { children: props.localization.page }), jsxRuntime.jsx(StyledSelect, { onChange: handleOnPageNumberSelect, value: props.currentPageNumber, disabled: props.pageCount < 2, children: getPageNumberOptions(props.pageCount).map((option) => jsxRuntime.jsx("option", { value: option.value, children: option.label }, option.value)) })] }), jsxRuntime.jsxs(Stack, { axis: "x", align: "center", justify: "end", width: "full", children: [jsxRuntime.jsx(Text, { color: "slate-500", children: getSummaryText(props.pageCount, props.currentPageNumber, props.localization, props.pageSize, props.resultCount) }), jsxRuntime.jsx(SecondaryButton, { "data-test-id": "prev-button", "data-page": props.currentPageNumber - 1, onClick: handleOnPrevNextButtonClick, disabled: props.currentPageNumber === 1, className: "ui:ml-4", children: props.localization.previous }), jsxRuntime.jsx(SecondaryButton, { "data-test-id": "next-button", disabled: props.currentPageNumber === props.pageCount, "data-page": props.currentPageNumber + 1, onClick: handleOnPrevNextButtonClick, className: "ui:ml-4", children: props.localization.next })] })] });
|
|
3594
3518
|
};
|
|
3595
3519
|
|
|
3596
3520
|
const PaginationMenuCursor = (props) => {
|
|
@@ -3601,7 +3525,7 @@ const PaginationMenuCursor = (props) => {
|
|
|
3601
3525
|
return jsxRuntime.jsxs(Stack, { axis: "x", gap: "m", justify: "end", width: "full", children: [jsxRuntime.jsx(SecondaryButton, { "data-test-id": "prev-button", leadingIcon: jsxRuntime.jsx(LeftArrowIcon, {}), "data-cursor": props.previousCursor, isDisabled: !props.previousCursor, onClick: handleOnChange, children: props.localization.previous }), jsxRuntime.jsx(SecondaryButton, { "data-test-id": "next-button", trailingIcon: jsxRuntime.jsx(ChevronRightIcon, {}), "data-cursor": props.nextCursor, isDisabled: !props.nextCursor, onClick: handleOnChange, children: props.localization.next })] });
|
|
3602
3526
|
};
|
|
3603
3527
|
|
|
3604
|
-
const Wrapper = ({ className, children }) => jsxRuntime.jsx("
|
|
3528
|
+
const Wrapper = ({ className, children }) => jsxRuntime.jsx(Stack, { axis: "x", align: "center", className: classNames__default.default(className), justify: "between", width: "full", children });
|
|
3605
3529
|
const PaginationMenu = (props) => {
|
|
3606
3530
|
if (props.type === "small" || props.small) {
|
|
3607
3531
|
return jsxRuntime.jsx(Wrapper, { className: props.className, children: jsxRuntime.jsx(PaginationMenuSmall, { pageCount: props.pageCount, currentPageNumber: props.currentPageNumber, pageSize: props.pageSize, onChange: props.onChange }) });
|
|
@@ -4535,49 +4459,126 @@ function SectionItemWithContent(props) {
|
|
|
4535
4459
|
return jsxRuntime.jsxs(SectionItem, Object.assign({ className: mergedClasses, onClick }, rest, { children: [icon && jsxRuntime.jsx("img", { className: iconClasses, src: icon, alt: "" }), jsxRuntime.jsx(Text, { text })] }));
|
|
4536
4460
|
}
|
|
4537
4461
|
|
|
4538
|
-
var css_248z$3 = ".
|
|
4462
|
+
var css_248z$3 = ".customized-select [class*=MenuList] [class*=option]::after {\n position: absolute;\n content: \"\";\n background: url(\"data:image/svg+xml,%3Csvg xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 width%3D%2216%22 height%3D%2216%22 viewBox%3D%220 0 16 16%22%3E %3Cg transform%3D%22translate(1.5%2C 0.5)%22%3E %3Cpath fill%3D%22none%22 fill-rule%3D%22evenodd%22 stroke%3D%22%230074DD%22 stroke-linecap%3D%22round%22 stroke-linejoin%3D%22round%22 stroke-width%3D%222%22 d%3D%22M12.643 3.357L6.03 9.97l-2.674 2.674L0 9.286%22%2F%3E %3C%2Fg%3E%3C%2Fsvg%3E\") no-repeat center;\n right: 12px;\n height: 1rem;\n width: 1rem;\n}";
|
|
4539
4463
|
styleInject(css_248z$3);
|
|
4540
4464
|
|
|
4541
|
-
const
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4465
|
+
const SelectDropdownIndicator = (props) => jsxRuntime.jsx(ReactSelect.components.DropdownIndicator, Object.assign({}, props, { children: jsxRuntime.jsx(ChevronDownIcon, {}) }));
|
|
4466
|
+
|
|
4467
|
+
const SelectLoadingIndicator = (props) => jsxRuntime.jsx(LoadingIndicator, Object.assign({ asSpinner: true, spinnerColor: "gray" }, props.innerProps, { style: props.getStyles("loadingIndicator", props) }));
|
|
4468
|
+
|
|
4469
|
+
function generateCustomStyles(hasError) {
|
|
4470
|
+
return {
|
|
4471
|
+
option: (baseStyles, state) => {
|
|
4472
|
+
return Object.assign(Object.assign({}, baseStyles), {
|
|
4473
|
+
fontWeight: state.isSelected ? "bold" : "normal",
|
|
4474
|
+
fontSize: "14px",
|
|
4475
|
+
// tailwind blue-50
|
|
4476
|
+
backgroundColor: state.isFocused ? "#F2FAFD" : "none",
|
|
4477
|
+
color: "inherit",
|
|
4478
|
+
position: "relative",
|
|
4479
|
+
padding: "0.75rem",
|
|
4480
|
+
opacity: state.isDisabled ? "0.5" : 1,
|
|
4481
|
+
"&:after": {
|
|
4482
|
+
visibility: state.isSelected ? "visible" : "hidden"
|
|
4483
|
+
},
|
|
4484
|
+
transition: "background-color 0.3s ease-in-out",
|
|
4485
|
+
"&:hover": {
|
|
4486
|
+
// tailwind blue-50
|
|
4487
|
+
backgroundColor: state.isSelected ? "transparent" : "#F2FAFD"
|
|
4488
|
+
},
|
|
4489
|
+
pointerEvents: state.isDisabled ? "none" : "auto"
|
|
4490
|
+
});
|
|
4491
|
+
},
|
|
4492
|
+
container: (baseStyles) => {
|
|
4493
|
+
return Object.assign(Object.assign({}, baseStyles), { flexGrow: "initial" });
|
|
4494
|
+
},
|
|
4495
|
+
input: (baseStyles) => {
|
|
4496
|
+
return Object.assign(Object.assign({}, baseStyles), { padding: 0, margin: 0 });
|
|
4497
|
+
},
|
|
4498
|
+
multiValue: (baseStyles) => {
|
|
4499
|
+
return Object.assign(Object.assign({}, baseStyles), { lineHeight: "1rem" });
|
|
4500
|
+
},
|
|
4501
|
+
valueContainer: (baseStyles) => {
|
|
4502
|
+
return Object.assign(Object.assign({}, baseStyles), { padding: ".5rem", margin: 0 });
|
|
4503
|
+
},
|
|
4504
|
+
control: (baseStyles, state) => {
|
|
4505
|
+
const navyBlue = "rgb(30 64 175)";
|
|
4506
|
+
const lightGray = "#D1D5DB";
|
|
4507
|
+
const red = "#c53030";
|
|
4508
|
+
const lightRedTransparent = "rgba(255, 98, 102, 0.3)";
|
|
4509
|
+
const darkBlue = "#1e40af";
|
|
4510
|
+
const mediumGray = "#9CA3AF";
|
|
4511
|
+
const lightShadow = "rgba(0, 0, 0, 0.05)";
|
|
4512
|
+
const defaultBorderColor = state.isFocused || state.menuIsOpen ? navyBlue : lightGray;
|
|
4513
|
+
const validatedBorderColor = hasError ? red : defaultBorderColor;
|
|
4514
|
+
const defaultOutline = hasError ? lightRedTransparent : darkBlue;
|
|
4515
|
+
const validatedOutline = `2px solid ${state.isFocused ? defaultOutline : "transparent"}`;
|
|
4516
|
+
return Object.assign(Object.assign({}, baseStyles), {
|
|
4517
|
+
fontSize: "14px",
|
|
4518
|
+
transition: "border 0.3s ease-in-out",
|
|
4519
|
+
// primary outline
|
|
4520
|
+
outline: validatedOutline,
|
|
4521
|
+
outlineOffset: "-2px",
|
|
4522
|
+
borderColor: validatedBorderColor,
|
|
4523
|
+
borderWidth: "1px !important",
|
|
4524
|
+
borderStyle: "solid",
|
|
4525
|
+
borderRadius: "4px",
|
|
4526
|
+
minHeight: state.isMulti ? "44px" : void 0,
|
|
4527
|
+
height: state.isMulti ? void 0 : "44px",
|
|
4528
|
+
boxShadow: `0px 1px 2px ${lightShadow}`,
|
|
4529
|
+
"&:hover": {
|
|
4530
|
+
borderColor: mediumGray,
|
|
4531
|
+
// selector for the chevron
|
|
4532
|
+
'> [class*="IndicatorsContainer"]': {
|
|
4533
|
+
opacity: 1
|
|
4534
|
+
}
|
|
4535
|
+
}
|
|
4536
|
+
});
|
|
4537
|
+
},
|
|
4538
|
+
// The placeholder has the following css prop: grid-area: 1/1/2/3;
|
|
4539
|
+
// And grid-area doesn't work on IE11, so we need to style it slightly different.
|
|
4540
|
+
placeholder: (baseStyles) => Object.assign(Object.assign({}, baseStyles), { fontWeight: 100, color: "#6B7280", margin: 0 }),
|
|
4541
|
+
singleValue: (baseStyles) => {
|
|
4542
|
+
return Object.assign(Object.assign({}, baseStyles), { fontSize: "14px" });
|
|
4543
|
+
},
|
|
4544
|
+
indicatorSeparator: () => ({
|
|
4545
|
+
display: "none"
|
|
4546
|
+
}),
|
|
4547
|
+
menu: (baseStyles) => Object.assign(Object.assign({}, baseStyles), { zIndex: 20 })
|
|
4549
4548
|
};
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4549
|
+
}
|
|
4550
|
+
const Select = React__namespace.default.forwardRef((_a, innerRef) => {
|
|
4551
|
+
var { isError = false, styles, options, onChange, value, width = "full", isMulti, className, skipValueProcessing } = _a, otherProps = __rest(_a, ["isError", "styles", "options", "onChange", "value", "width", "isMulti", "className", "skipValueProcessing"]);
|
|
4552
|
+
const customStyles = generateCustomStyles(isError);
|
|
4553
|
+
const mergedStyles = ReactSelect.mergeStyles(customStyles, styles);
|
|
4554
|
+
const isOptionsGrouped = !options ? false : options.reduce((acc, o) => acc || "options" in o && !("values" in o), false);
|
|
4555
|
+
const flatmappedOptions = !options ? [] : isOptionsGrouped ? options.flatMap((g) => g.options) : options;
|
|
4556
|
+
const onChangeWrapped = !onChange ? void 0 : isMulti ? (val, a) => onChange(val.map((v) => v.value), a) : (val, a) => onChange(val === null || val === void 0 ? void 0 : val.value, a);
|
|
4557
|
+
const valueWrapped = !value || !options ? value : isMulti ? flatmappedOptions.filter((o) => value.includes(o.value)) : flatmappedOptions.find((o) => o.value === value);
|
|
4558
|
+
const getDataAttributes = () => {
|
|
4559
|
+
const dataProps = {};
|
|
4560
|
+
for (const prop in otherProps) {
|
|
4561
|
+
if (prop.includes("data-")) {
|
|
4562
|
+
dataProps[prop] = otherProps[prop];
|
|
4563
|
+
}
|
|
4564
|
+
}
|
|
4565
|
+
return dataProps;
|
|
4554
4566
|
};
|
|
4555
|
-
|
|
4556
|
-
"
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
"ui:
|
|
4562
|
-
|
|
4563
|
-
"ui:
|
|
4564
|
-
"ui:
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
"ui:focus:outline-primary": !isError,
|
|
4571
|
-
"ui:bg-white": !attributes.disabled
|
|
4572
|
-
}, heightClasses[height], paddingClasses[height], "ui:border", "ui:text-base ui:sm:text-sm", "ui:placeholder-slate-500", "ui:border-solid", "ui:transition-colors", "ui:duration-300", {
|
|
4573
|
-
"ui:rounded": hasNoExtraContent,
|
|
4574
|
-
"ui:rounded-l": hasSuffix,
|
|
4575
|
-
"ui:rounded-r": hasPrefix,
|
|
4576
|
-
"ui:order-2": hasPrefix,
|
|
4577
|
-
"ui:order-1": hasSuffix
|
|
4578
|
-
}, "ui:shadow-default", className) }, attributes, { children })), jsxRuntime.jsx("div", { className: "ui:pointer-events-none ui:absolute ui:right-0 ui:top-1/2 ui:z-20", style: {
|
|
4579
|
-
transform: "translateY(-50%)"
|
|
4580
|
-
}, children: jsxRuntime.jsx(ChevronDownIcon, { className: classNames__default.default("ui:mr-3 ui:h-6 ui:w-6 ui:text-slate-300") }) })] })] });
|
|
4567
|
+
const CustomContainer = (_a2) => {
|
|
4568
|
+
var { children } = _a2, commonProps = __rest(_a2, ["children"]);
|
|
4569
|
+
return jsxRuntime.jsx(ReactSelect.components.SelectContainer, Object.assign({}, commonProps, { innerProps: Object.assign({}, commonProps.innerProps, Object.assign({}, getDataAttributes())), children }));
|
|
4570
|
+
};
|
|
4571
|
+
return jsxRuntime.jsx(ReactSelect__default.default, Object.assign({}, otherProps, { ref: innerRef, styles: mergedStyles, options, onChange: skipValueProcessing ? onChange : onChangeWrapped, value: skipValueProcessing ? value : valueWrapped, isMulti, className: classNames__default.default("customized-select", className, {
|
|
4572
|
+
"ui:w-16": width === "sm",
|
|
4573
|
+
"ui:w-32": width === "md",
|
|
4574
|
+
"ui:w-56": width === "lg",
|
|
4575
|
+
"ui:w-80": width === "xl",
|
|
4576
|
+
"ui:grow": width === "full"
|
|
4577
|
+
}), components: {
|
|
4578
|
+
SelectContainer: CustomContainer,
|
|
4579
|
+
DropdownIndicator: SelectDropdownIndicator,
|
|
4580
|
+
LoadingIndicator: SelectLoadingIndicator
|
|
4581
|
+
} }));
|
|
4581
4582
|
});
|
|
4582
4583
|
|
|
4583
4584
|
const LabeledSelect = React__namespace.default.forwardRef((props, ref) => {
|