@luscii-healthtech/web-ui 2.4.0 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Form/Form.d.ts +15 -5
- package/dist/components/Form/form.types.d.ts +6 -2
- package/dist/index.d.ts +5 -2
- package/dist/web-ui.cjs.development.js +344 -319
- package/dist/web-ui.cjs.development.js.map +1 -1
- package/dist/web-ui.cjs.production.min.js +1 -1
- package/dist/web-ui.cjs.production.min.js.map +1 -1
- package/dist/web-ui.esm.js +341 -320
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Form/Form.tsx +100 -68
- package/src/components/Form/form.types.ts +8 -1
- package/src/index.tsx +8 -2
|
@@ -4267,10 +4267,96 @@ RadioGroup.propTypes = {
|
|
|
4267
4267
|
onChange: PropTypes.func
|
|
4268
4268
|
};
|
|
4269
4269
|
|
|
4270
|
-
var css_248z$m = ".
|
|
4270
|
+
var css_248z$m = ".radio-form-field-label input[type=\"radio\"]:checked + .radio-circle {\n --bg-opacity: 1;\n background-color: #0074DD;\n background-color: rgba(0, 116, 221, var(--bg-opacity));\n}\n\n.radio-form-field-label[data-has-error=\"true\"] .radio-circle {\n --border-opacity: 1;\n border-color: #c53030;\n border-color: rgba(197, 48, 48, var(--border-opacity));\n outline: 4px solid rgba(255, 98, 102, 0.3);\n outline-offset: 0;\n}\n\n.radio-form-field-label\n input[type=\"radio\"]:checked\n + .radio-circle\n .radio-inner-circle {\n --bg-opacity: 1;\n background-color: #fff;\n background-color: rgba(255, 255, 255, var(--bg-opacity));\n}\n";
|
|
4271
4271
|
styleInject(css_248z$m);
|
|
4272
4272
|
|
|
4273
|
-
var _excluded$c = ["
|
|
4273
|
+
var _excluded$c = ["text", "info", "isError", "innerRef", "className"];
|
|
4274
|
+
|
|
4275
|
+
function RadioInner(_ref) {
|
|
4276
|
+
var text = _ref.text,
|
|
4277
|
+
info = _ref.info,
|
|
4278
|
+
isError = _ref.isError,
|
|
4279
|
+
innerRef = _ref.innerRef,
|
|
4280
|
+
className = _ref.className,
|
|
4281
|
+
otherProps = _objectWithoutPropertiesLoose(_ref, _excluded$c);
|
|
4282
|
+
|
|
4283
|
+
var value = otherProps.value,
|
|
4284
|
+
disabled = otherProps.disabled;
|
|
4285
|
+
var nameHtmlFor = "field-" + value;
|
|
4286
|
+
return /*#__PURE__*/React__default.createElement("label", {
|
|
4287
|
+
className: "radio-form-field-label leading-tight",
|
|
4288
|
+
htmlFor: nameHtmlFor,
|
|
4289
|
+
"data-has-error": isError,
|
|
4290
|
+
"data-test-id": nameHtmlFor
|
|
4291
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
4292
|
+
className: "flex flex-row items-center "
|
|
4293
|
+
}, /*#__PURE__*/React__default.createElement("input", Object.assign({}, otherProps, {
|
|
4294
|
+
className: classNames("appearance-none", className),
|
|
4295
|
+
ref: innerRef,
|
|
4296
|
+
type: "radio",
|
|
4297
|
+
id: nameHtmlFor,
|
|
4298
|
+
disabled: disabled
|
|
4299
|
+
})), /*#__PURE__*/React__default.createElement("span", {
|
|
4300
|
+
className: classNames("flex flex-col items-center justify-center w-4 h-4 transition-colors duration-300 ease-in-out border radio-circle rounded-xl border-slate-300")
|
|
4301
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
4302
|
+
className: "block transition-colors duration-300 ease-in-out radio-inner-circle w-1.5 h-1.5 rounded-xl"
|
|
4303
|
+
})), text && /*#__PURE__*/React__default.createElement("div", {
|
|
4304
|
+
className: "ml-2"
|
|
4305
|
+
}, /*#__PURE__*/React__default.createElement(Text, {
|
|
4306
|
+
inline: true,
|
|
4307
|
+
text: text,
|
|
4308
|
+
type: "base",
|
|
4309
|
+
color: disabled ? "slate-500" : undefined
|
|
4310
|
+
}))), info && /*#__PURE__*/React__default.createElement(Text, {
|
|
4311
|
+
inline: true,
|
|
4312
|
+
className: "ml-6",
|
|
4313
|
+
text: info,
|
|
4314
|
+
type: "sm",
|
|
4315
|
+
color: disabled ? "slate-200" : "slate-500"
|
|
4316
|
+
}));
|
|
4317
|
+
}
|
|
4318
|
+
/**
|
|
4319
|
+
* TODO: The CSS styling is all messed up, including isError
|
|
4320
|
+
* Warning: don't use this prop before this is resolved
|
|
4321
|
+
* Issue to track: https://github.com/Luscii/web-ui/issues/57
|
|
4322
|
+
* TODO: remove this comment once this is resolved
|
|
4323
|
+
*/
|
|
4324
|
+
|
|
4325
|
+
|
|
4326
|
+
var RadioV2 = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
4327
|
+
return /*#__PURE__*/React__default.createElement(RadioInner, Object.assign({}, props, {
|
|
4328
|
+
innerRef: ref
|
|
4329
|
+
}));
|
|
4330
|
+
});
|
|
4331
|
+
|
|
4332
|
+
var _excluded$d = ["innerRef", "options"];
|
|
4333
|
+
|
|
4334
|
+
function RadioGroupInner(_ref) {
|
|
4335
|
+
var innerRef = _ref.innerRef,
|
|
4336
|
+
options = _ref.options,
|
|
4337
|
+
registerProps = _objectWithoutPropertiesLoose(_ref, _excluded$d);
|
|
4338
|
+
|
|
4339
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
4340
|
+
className: classNames("flex flex-col space-y-2")
|
|
4341
|
+
}, options.map(function (option) {
|
|
4342
|
+
return /*#__PURE__*/React__default.createElement(RadioV2, Object.assign({
|
|
4343
|
+
key: option.value
|
|
4344
|
+
}, option, registerProps, {
|
|
4345
|
+
ref: innerRef
|
|
4346
|
+
}));
|
|
4347
|
+
}));
|
|
4348
|
+
}
|
|
4349
|
+
|
|
4350
|
+
var RadioGroupV2 = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
4351
|
+
return /*#__PURE__*/React__default.createElement(RadioGroupInner, Object.assign({}, props, {
|
|
4352
|
+
innerRef: ref
|
|
4353
|
+
}));
|
|
4354
|
+
});
|
|
4355
|
+
|
|
4356
|
+
var css_248z$n = ".cweb-section .cweb-button:last-of-type {\n margin-right: 24px;\n}\n\n.cweb-section .cweb-button:not(:last-of-type) {\n margin-right: 8px;\n}\n\n.cweb-section .cweb-button.add-button, .cweb-section .cweb-button.edit-button, .cweb-section .cweb-button.delete-button {\n margin-left: auto;\n width: 32px;\n height: 32px;\n}\n\n.cweb-section .cweb-button.add-button {\n background: url(\"data:image/svg+xml,%3Csvg width%3D%2244%22 height%3D%2244%22 viewBox%3D%220 0 44 44%22 fill%3D%22none%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ccircle cx%3D%2222%22 cy%3D%2222%22 r%3D%2222%22 fill%3D%22white%22%2F%3E%3Crect x%3D%220.5%22 y%3D%220.5%22 width%3D%2243%22 height%3D%2243%22 rx%3D%2221.5%22 stroke%3D%22%23009FE3%22%2F%3E%3Cpath fill-rule%3D%22evenodd%22 clip-rule%3D%22evenodd%22 d%3D%22M22 32C23.1046 32 24 31.1046 24 30L24 24H30C31.1046 24 32 23.1046 32 22C32 20.8954 31.1046 20 30 20H24L24 14C24 12.8954 23.1046 12 22 12C20.8954 12 20 12.8954 20 14L20 20H14C12.8954 20 12 20.8954 12 22C12 23.1046 12.8954 24 14 24H20L20 30C20 31.1046 20.8954 32 22 32Z%22 fill%3D%22%23009FE3%22%2F%3E%3C%2Fsvg%3E\") no-repeat center;\n background-size: contain;\n}\n\n.cweb-section .cweb-button.add-button:hover, .cweb-section .cweb-button.add-button:active, .cweb-section .cweb-button.add-button:focus {\n background: url(\"data:image/svg+xml,%3Csvg width%3D%2244%22 height%3D%2244%22 viewBox%3D%220 0 44 44%22 fill%3D%22none%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect x%3D%220.5%22 y%3D%220.5%22 width%3D%2243%22 height%3D%2243%22 rx%3D%2221.5%22 stroke%3D%22%230A78B2%22%2F%3E%3Cpath fill-rule%3D%22evenodd%22 clip-rule%3D%22evenodd%22 d%3D%22M21 12C19.8954 12 19 12.8954 19 14V19L14 19C12.8954 19 12 19.8954 12 21V23C12 24.1046 12.8954 25 14 25H19V30C19 31.1046 19.8954 32 21 32H23C24.1046 32 25 31.1046 25 30V25H30C31.1046 25 32 24.1046 32 23V21C32 19.8954 31.1046 19 30 19L25 19V14C25 12.8954 24.1046 12 23 12H21Z%22 fill%3D%22%23007BBB%22%2F%3E%3C%2Fsvg%3E\") no-repeat center;\n background-size: contain;\n}\n\n.cweb-section .cweb-button.edit-button {\n background: url(\"data:image/svg+xml,%3Csvg width%3D%2244%22 height%3D%2244%22 viewBox%3D%220 0 44 44%22 fill%3D%22none%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect x%3D%220.5%22 y%3D%220.5%22 width%3D%2243%22 height%3D%2243%22 rx%3D%2221.5%22 stroke%3D%22%23009FE3%22%2F%3E%3Cpath d%3D%22M13.5643 27.1001C13.4169 26.9527 13.1433 27.0159 13.1012 27.2266L12.0065 31.6507C11.9644 31.8614 12.1328 32.051 12.3433 31.9878L16.7851 30.9134C16.9956 30.8712 17.0799 30.5973 16.9114 30.4499L13.5643 27.1001Z%22 fill%3D%22%23009FE3%22%2F%3E%3Cpath d%3D%22M26.2161 14.1222C26.1109 14.0169 25.9214 14.0169 25.8161 14.1222L14.4484 25.4987C14.3432 25.604 14.3432 25.7936 14.4484 25.8989L18.1114 29.5647C18.2166 29.67 18.4061 29.67 18.5113 29.5647L29.879 18.1882C29.9843 18.0829 29.9843 17.8933 29.879 17.788L26.2161 14.1222Z%22 fill%3D%22%23009FE3%22%2F%3E%3Cpath d%3D%22M31.1633 12.8374C30.0475 11.7209 28.2161 11.7209 27.1004 12.8374C27.0583 12.8796 27.0583 12.9217 27.1004 12.9638L31.037 16.9035C31.0791 16.9456 31.1212 16.9456 31.1633 16.9035C32.279 15.7869 32.279 13.954 31.1633 12.8374Z%22 fill%3D%22%23009FE3%22%2F%3E%3C%2Fsvg%3E\") no-repeat center;\n background-size: contain;\n}\n\n.cweb-section .cweb-button.edit-button:hover, .cweb-section .cweb-button.edit-button:active, .cweb-section .cweb-button.edit-button:focus {\n background: url(\"data:image/svg+xml,%3Csvg width%3D%2244%22 height%3D%2244%22 viewBox%3D%220 0 44 44%22 fill%3D%22none%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect x%3D%220.5%22 y%3D%220.5%22 width%3D%2243%22 height%3D%2243%22 rx%3D%2221.5%22 stroke%3D%22%23007BBB%22%2F%3E%3Cpath d%3D%22M13.5643 27.1001C13.4169 26.9527 13.1433 27.0159 13.1012 27.2266L12.0065 31.6507C11.9644 31.8614 12.1328 32.051 12.3433 31.9878L16.7851 30.9134C16.9956 30.8712 17.0799 30.5973 16.9114 30.4499L13.5643 27.1001Z%22 fill%3D%22%230A78B2%22%2F%3E%3Cpath d%3D%22M26.2161 14.1222C26.1109 14.0169 25.9214 14.0169 25.8161 14.1222L14.4484 25.4987C14.3432 25.604 14.3432 25.7936 14.4484 25.8989L18.1114 29.5647C18.2166 29.67 18.4061 29.67 18.5113 29.5647L29.879 18.1882C29.9843 18.0829 29.9843 17.8933 29.879 17.788L26.2161 14.1222Z%22 fill%3D%22%230A78B2%22%2F%3E%3Cpath d%3D%22M31.1633 12.8374C30.0475 11.7209 28.2161 11.7209 27.1004 12.8374C27.0583 12.8796 27.0583 12.9217 27.1004 12.9638L31.037 16.9035C31.0791 16.9456 31.1212 16.9456 31.1633 16.9035C32.279 15.7869 32.279 13.954 31.1633 12.8374Z%22 fill%3D%22%230A78B2%22%2F%3E%3C%2Fsvg%3E\") no-repeat center;\n background-size: contain;\n}\n\n.cweb-section .cweb-button.delete-button {\n background: url(\"data:image/svg+xml,%3Csvg width%3D%2244%22 height%3D%2244%22 viewBox%3D%220 0 44 44%22 fill%3D%22none%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect x%3D%220.5%22 y%3D%220.5%22 width%3D%2243%22 height%3D%2243%22 rx%3D%2221.5%22 stroke%3D%22%23FF6266%22%2F%3E%3Cpath fill-rule%3D%22evenodd%22 clip-rule%3D%22evenodd%22 d%3D%22M13 12C12.4477 12 12 12.4477 12 13C12 13.5523 12.4477 14 13 14H31C31.5523 14 32 13.5523 32 13C32 12.4477 31.5523 12 31 12H13ZM14 16H30V30C30 31.1046 29.1046 32 28 32H16C14.8954 32 14 31.1046 14 30V16ZM17 18H19V30H17V18ZM21 18H23V30H21V18ZM27 18H25V30H27V18Z%22 fill%3D%22%23FF6266%22%2F%3E%3C%2Fsvg%3E\") no-repeat center;\n background-size: contain;\n}\n\n.cweb-section .cweb-button.delete-button:hover, .cweb-section .cweb-button.delete-button:active, .cweb-section .cweb-button.delete-button:focus {\n background: url(\"data:image/svg+xml,%3Csvg width%3D%2244%22 height%3D%2244%22 viewBox%3D%220 0 44 44%22 fill%3D%22none%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath fill-rule%3D%22evenodd%22 clip-rule%3D%22evenodd%22 d%3D%22M13 12C12.4477 12 12 12.4477 12 13C12 13.5523 12.4477 14 13 14H31C31.5523 14 32 13.5523 32 13C32 12.4477 31.5523 12 31 12H13ZM14 16H30V30C30 31.1046 29.1046 32 28 32H16C14.8954 32 14 31.1046 14 30V16ZM17 18H19V30H17V18ZM21 18H23V30H21V18ZM27 18H25V30H27V18Z%22 fill%3D%22%23FC494E%22%2F%3E%3Crect x%3D%220.5%22 y%3D%220.5%22 width%3D%2243%22 height%3D%2243%22 rx%3D%2221.5%22 stroke%3D%22%23FC494E%22%2F%3E%3C%2Fsvg%3E\") no-repeat center;\n background-size: contain;\n}\n\n.cweb-section > .cweb-section-header {\n display: flex;\n justify-content: space-between;\n flex-direction: row;\n align-items: center;\n border-bottom: 1px solid #eeeeee;\n width: 100%;\n padding: 18px 24px;\n}\n\n.cweb-section > .cweb-section-footer {\n display: flex;\n justify-content: space-between;\n flex-direction: row;\n align-items: center;\n border-top: 1px solid #eeeeee;\n width: 100%;\n padding: 1rem 24px 1rem 24px;\n}\n\n.cweb-section > .cweb-section-footer img {\n width: 32px;\n height: 32px;\n}\n";
|
|
4357
|
+
styleInject(css_248z$n);
|
|
4358
|
+
|
|
4359
|
+
var _excluded$e = ["title", "buttons", "footer", "children", "className", "isLoading", "loadingIndicatorProps"];
|
|
4274
4360
|
function Section(_ref) {
|
|
4275
4361
|
var title = _ref.title,
|
|
4276
4362
|
buttons = _ref.buttons,
|
|
@@ -4280,7 +4366,7 @@ function Section(_ref) {
|
|
|
4280
4366
|
_ref$isLoading = _ref.isLoading,
|
|
4281
4367
|
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
4282
4368
|
loadingIndicatorProps = _ref.loadingIndicatorProps,
|
|
4283
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
4369
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$e);
|
|
4284
4370
|
|
|
4285
4371
|
return /*#__PURE__*/React__default.createElement("div", Object.assign({}, restProps, {
|
|
4286
4372
|
className: classNames("cweb-section", "flex justify-start flex-col items-start", "rounded-lg", "mx-0 my-4", "bg-white", "w-full", className)
|
|
@@ -4308,15 +4394,15 @@ function Section(_ref) {
|
|
|
4308
4394
|
}, footer));
|
|
4309
4395
|
}
|
|
4310
4396
|
|
|
4311
|
-
var css_248z$
|
|
4312
|
-
styleInject(css_248z$
|
|
4397
|
+
var css_248z$o = ".cweb-list-item {\n display: flex;\n justify-content: flex-start;\n flex-direction: row;\n align-items: center;\n padding: 16px 0 16px 0;\n border-bottom: 1px solid #eeeeee;\n}\n\n.cweb-list-item:last-child {\n border-bottom: none;\n}\n\n.cweb-list-item.cweb-list-item-clickable {\n cursor: pointer;\n}\n\n.cweb-list-item.cweb-list-item-clickable:hover {\n background-color: #f2fafd;\n}\n";
|
|
4398
|
+
styleInject(css_248z$o);
|
|
4313
4399
|
|
|
4314
|
-
var _excluded$
|
|
4400
|
+
var _excluded$f = ["children", "className", "onClick"];
|
|
4315
4401
|
var SectionItem = function SectionItem(props) {
|
|
4316
4402
|
var children = props.children,
|
|
4317
4403
|
className = props.className,
|
|
4318
4404
|
onClick = props.onClick,
|
|
4319
|
-
rest = _objectWithoutPropertiesLoose(props, _excluded$
|
|
4405
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded$f);
|
|
4320
4406
|
|
|
4321
4407
|
var classes = classNames("cweb-list-item", className, {
|
|
4322
4408
|
"cweb-list-item-clickable": !!onClick
|
|
@@ -4327,7 +4413,7 @@ var SectionItem = function SectionItem(props) {
|
|
|
4327
4413
|
}, rest), children);
|
|
4328
4414
|
};
|
|
4329
4415
|
|
|
4330
|
-
var _excluded$
|
|
4416
|
+
var _excluded$g = ["text", "icon", "className", "iconClass", "onClick"];
|
|
4331
4417
|
|
|
4332
4418
|
function SectionItemWithContent(props) {
|
|
4333
4419
|
var text = props.text,
|
|
@@ -4335,7 +4421,7 @@ function SectionItemWithContent(props) {
|
|
|
4335
4421
|
className = props.className,
|
|
4336
4422
|
iconClass = props.iconClass,
|
|
4337
4423
|
onClick = props.onClick,
|
|
4338
|
-
rest = _objectWithoutPropertiesLoose(props, _excluded$
|
|
4424
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded$g);
|
|
4339
4425
|
|
|
4340
4426
|
var mergedClasses = classNames("cweb-section-text-item", className);
|
|
4341
4427
|
var iconClasses = classNames("w-6 h-6 mr-4", iconClass);
|
|
@@ -4351,6 +4437,150 @@ function SectionItemWithContent(props) {
|
|
|
4351
4437
|
}));
|
|
4352
4438
|
}
|
|
4353
4439
|
|
|
4440
|
+
var _excluded$h = ["isError", "styles", "options", "onChange", "value", "isMulti", "className"];
|
|
4441
|
+
|
|
4442
|
+
function generateCustomStyles$1(hasError, isIE11) {
|
|
4443
|
+
return {
|
|
4444
|
+
option: function option(baseStyles, state) {
|
|
4445
|
+
return _extends({}, baseStyles, {
|
|
4446
|
+
fontWeight: state.isSelected ? "bold" : "normal",
|
|
4447
|
+
fontSize: "14px",
|
|
4448
|
+
backgroundColor: "none",
|
|
4449
|
+
color: "inherit",
|
|
4450
|
+
position: "relative",
|
|
4451
|
+
padding: "0.75rem",
|
|
4452
|
+
opacity: state.isDisabled ? "0.5" : 1,
|
|
4453
|
+
"&:after": {
|
|
4454
|
+
visibility: state.isSelected ? "visible" : "hidden"
|
|
4455
|
+
},
|
|
4456
|
+
transition: "background-color 0.3s ease-in-out",
|
|
4457
|
+
"&:hover": {
|
|
4458
|
+
// tailwind blue-50
|
|
4459
|
+
backgroundColor: state.isSelected ? "transparent" : "#F2FAFD"
|
|
4460
|
+
},
|
|
4461
|
+
pointerEvents: state.isDisabled ? "none" : "auto"
|
|
4462
|
+
});
|
|
4463
|
+
},
|
|
4464
|
+
container: function container(baseStyles) {
|
|
4465
|
+
return _extends({}, baseStyles, {
|
|
4466
|
+
flexGrow: isIE11 ? 0.5 : "initial"
|
|
4467
|
+
});
|
|
4468
|
+
},
|
|
4469
|
+
control: function control(baseStyles, state) {
|
|
4470
|
+
var defaultBorderColor = state.isFocused ? "#045baa" : "#D1D5DB";
|
|
4471
|
+
var validatedBorderColor = hasError ? "#c53030" : defaultBorderColor;
|
|
4472
|
+
var defaultOutline = hasError ? "rgba(255, 98, 102, 0.3)" : "rgba(0, 159, 227, 0.3)";
|
|
4473
|
+
var validatedOutline = "4px solid " + (state.isFocused ? defaultOutline : "transparent");
|
|
4474
|
+
return _extends({}, baseStyles, {
|
|
4475
|
+
fontSize: "14px",
|
|
4476
|
+
transition: "border 0.3s ease-in-out",
|
|
4477
|
+
height: isIE11 ? "50px" : "2.75rem",
|
|
4478
|
+
// primary outline
|
|
4479
|
+
outline: validatedOutline,
|
|
4480
|
+
borderColor: validatedBorderColor,
|
|
4481
|
+
borderWidth: "1px !important",
|
|
4482
|
+
borderStyle: "solid",
|
|
4483
|
+
borderRadius: "4px",
|
|
4484
|
+
boxShadow: "0px 1px 2px rgba(0, 0, 0, 0.05)",
|
|
4485
|
+
"&:hover": {
|
|
4486
|
+
borderColor: "#9CA3AF",
|
|
4487
|
+
// selector for the chevron
|
|
4488
|
+
"> [class*=\"IndicatorsContainer\"]": {
|
|
4489
|
+
opacity: 1
|
|
4490
|
+
}
|
|
4491
|
+
}
|
|
4492
|
+
});
|
|
4493
|
+
},
|
|
4494
|
+
// The placeholder has the following css prop: grid-area: 1/1/2/3;
|
|
4495
|
+
// And grid-area doesn't work on IE11, so we need to style it slightly different.
|
|
4496
|
+
placeholder: function placeholder(baseStyles) {
|
|
4497
|
+
return _extends({}, baseStyles, {
|
|
4498
|
+
fontWeight: 100,
|
|
4499
|
+
color: "#6B7280",
|
|
4500
|
+
paddingTop: isIE11 ? "1.2rem" : undefined
|
|
4501
|
+
});
|
|
4502
|
+
},
|
|
4503
|
+
singleValue: function singleValue(baseStyles) {
|
|
4504
|
+
return _extends({}, baseStyles, {
|
|
4505
|
+
paddingTop: isIE11 ? "1.2rem" : undefined,
|
|
4506
|
+
fontSize: "14px"
|
|
4507
|
+
});
|
|
4508
|
+
},
|
|
4509
|
+
indicatorSeparator: function indicatorSeparator() {
|
|
4510
|
+
return {
|
|
4511
|
+
display: "none"
|
|
4512
|
+
};
|
|
4513
|
+
},
|
|
4514
|
+
menu: function menu(baseStyles) {
|
|
4515
|
+
return _extends({}, baseStyles, {
|
|
4516
|
+
zIndex: 20
|
|
4517
|
+
});
|
|
4518
|
+
}
|
|
4519
|
+
};
|
|
4520
|
+
}
|
|
4521
|
+
/**
|
|
4522
|
+
* A wrapper around react-select to style it according to our design specification.
|
|
4523
|
+
*
|
|
4524
|
+
* In addition, the value is taken out of the option, instead of returning the complete option.
|
|
4525
|
+
*
|
|
4526
|
+
* Care when using grouped options: the value of the options overspanning all groups need to be unique!
|
|
4527
|
+
* For instance, if you have an option with value "chocolate" in both the groups "flavor" and "dip", then you get unforeseen errors.
|
|
4528
|
+
* This is a problem within react-select itself, not our wrapper.
|
|
4529
|
+
*
|
|
4530
|
+
* Care when using defaultValue: this still requires the complete Option (instead of the value of the Option).
|
|
4531
|
+
* So far there wasn't a use-case for this.
|
|
4532
|
+
*/
|
|
4533
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4534
|
+
|
|
4535
|
+
|
|
4536
|
+
var Select = /*#__PURE__*/React__default.forwardRef(function (_ref, innerRef) {
|
|
4537
|
+
var _ref$isError = _ref.isError,
|
|
4538
|
+
isError = _ref$isError === void 0 ? false : _ref$isError,
|
|
4539
|
+
styles = _ref.styles,
|
|
4540
|
+
options = _ref.options,
|
|
4541
|
+
onChange = _ref.onChange,
|
|
4542
|
+
value = _ref.value,
|
|
4543
|
+
isMulti = _ref.isMulti,
|
|
4544
|
+
className = _ref.className,
|
|
4545
|
+
otherProps = _objectWithoutPropertiesLoose(_ref, _excluded$h);
|
|
4546
|
+
|
|
4547
|
+
var isIE11 = "MSInputMethodContext" in window && "documentMode" in document;
|
|
4548
|
+
var customStyles = generateCustomStyles$1(isError, isIE11);
|
|
4549
|
+
var mergedStyles = ReactSelect.mergeStyles(customStyles, styles); // the options can be either a list of options or a grouped list of options
|
|
4550
|
+
// this is a typechecker to verify it is the case.
|
|
4551
|
+
|
|
4552
|
+
var isOptionsGrouped = !options ? false : options.reduce(function (acc, o) {
|
|
4553
|
+
return acc || "options" in o && !("values" in o);
|
|
4554
|
+
}, false); // we subsequently flatmap to ensure it's always a list of options
|
|
4555
|
+
|
|
4556
|
+
var flatmappedOptions = !options ? [] : isOptionsGrouped ? options.flatMap(function (g) {
|
|
4557
|
+
return g.options;
|
|
4558
|
+
}) : options; // based on: https://stackoverflow.com/a/70022957
|
|
4559
|
+
|
|
4560
|
+
var onChangeWrapped = !onChange ? undefined : isMulti ? function (val, a) {
|
|
4561
|
+
return onChange(val.map(function (v) {
|
|
4562
|
+
return v.value;
|
|
4563
|
+
}), a);
|
|
4564
|
+
} : function (val, a) {
|
|
4565
|
+
return onChange(val == null ? void 0 : val.value, a);
|
|
4566
|
+
}; // TODO: how can we report the error if a value was given that is not within the options?
|
|
4567
|
+
|
|
4568
|
+
var valueWrapped = !value || !options ? value : isMulti ? flatmappedOptions.filter(function (o) {
|
|
4569
|
+
return value.includes(o.value);
|
|
4570
|
+
}) : flatmappedOptions.find(function (o) {
|
|
4571
|
+
return o.value === value;
|
|
4572
|
+
});
|
|
4573
|
+
return /*#__PURE__*/React__default.createElement(ReactSelect__default, Object.assign({}, otherProps, {
|
|
4574
|
+
ref: innerRef,
|
|
4575
|
+
styles: mergedStyles,
|
|
4576
|
+
options: options,
|
|
4577
|
+
onChange: onChangeWrapped,
|
|
4578
|
+
value: valueWrapped,
|
|
4579
|
+
isMulti: isMulti,
|
|
4580
|
+
className: classNames("customized-select", className)
|
|
4581
|
+
}));
|
|
4582
|
+
});
|
|
4583
|
+
|
|
4354
4584
|
var useOutsideClick = function useOutsideClick(ref, callback) {
|
|
4355
4585
|
var handleClick = function handleClick(e) {
|
|
4356
4586
|
if (ref.current && !ref.current.contains(e.target)) {
|
|
@@ -4457,8 +4687,8 @@ var SettingsMenuButton = function SettingsMenuButton(props) {
|
|
|
4457
4687
|
})));
|
|
4458
4688
|
};
|
|
4459
4689
|
|
|
4460
|
-
var css_248z$
|
|
4461
|
-
styleInject(css_248z$
|
|
4690
|
+
var css_248z$p = ".cweb-switcher-item {\n display: flex;\n justify-content: center;\n flex-direction: row;\n align-items: center;\n}\n\n.cweb-switcher-item .cweb-switcher-item-link {\n display: flex;\n align-items: center;\n text-decoration: none;\n padding: 0.5rem 1rem;\n cursor: pointer;\n}\n\n.cweb-switcher-item .cweb-switcher-item-link .cweb-switcher-item-link-icon {\n display: flex;\n align-items: center;\n}\n\n.cweb-switcher-item .cweb-switcher-item-link .cweb-switcher-item-link-icon .cweb-switcher-item-link-icon-default,\n .cweb-switcher-item .cweb-switcher-item-link .cweb-switcher-item-link-icon .cweb-switcher-item-link-icon-active {\n width: 20px;\n height: 20px;\n}\n\n.cweb-switcher-item .cweb-switcher-item-link .cweb-switcher-item-link-icon .cweb-switcher-item-link-icon-active {\n display: none;\n}\n\n.cweb-switcher-item .cweb-switcher-item-link .cweb-switcher-item-link-text {\n color: #737373;\n transition: color 0.4s ease;\n padding-bottom: 0;\n}\n\n.cweb-switcher-item .cweb-switcher-item-link .cweb-switcher-item-link-icon + .cweb-switcher-item-link-text {\n margin-left: 8px;\n padding: 0;\n}\n\n.cweb-switcher-item.is-selected, .cweb-switcher-item:hover, .cweb-switcher-item:active {\n border-color: #0074dd;\n z-index: 1;\n}\n\n.cweb-switcher-item.is-selected .cweb-switcher-item-link .cweb-switcher-item-link-icon .cweb-switcher-item-link-icon-default, .cweb-switcher-item:hover .cweb-switcher-item-link .cweb-switcher-item-link-icon .cweb-switcher-item-link-icon-default, .cweb-switcher-item:active .cweb-switcher-item-link .cweb-switcher-item-link-icon .cweb-switcher-item-link-icon-default {\n display: none;\n}\n\n.cweb-switcher-item.is-selected .cweb-switcher-item-link .cweb-switcher-item-link-icon .cweb-switcher-item-link-icon-active, .cweb-switcher-item:hover .cweb-switcher-item-link .cweb-switcher-item-link-icon .cweb-switcher-item-link-icon-active, .cweb-switcher-item:active .cweb-switcher-item-link .cweb-switcher-item-link-icon .cweb-switcher-item-link-icon-active {\n display: inherit;\n}\n\n.cweb-switcher-item.is-selected .cweb-switcher-item-link .cweb-switcher-item-link-text, .cweb-switcher-item:hover .cweb-switcher-item-link .cweb-switcher-item-link-text, .cweb-switcher-item:active .cweb-switcher-item-link .cweb-switcher-item-link-text {\n color: #0074dd;\n}\n\n.cweb-switcher-item.is-disabled {\n pointer-events: none;\n}\n";
|
|
4691
|
+
styleInject(css_248z$p);
|
|
4462
4692
|
|
|
4463
4693
|
SwitcherItem.propTypes = {
|
|
4464
4694
|
name: PropTypes.string,
|
|
@@ -4791,10 +5021,10 @@ var TagGroup = function TagGroup(_ref) {
|
|
|
4791
5021
|
}));
|
|
4792
5022
|
};
|
|
4793
5023
|
|
|
4794
|
-
var css_248z$
|
|
4795
|
-
styleInject(css_248z$
|
|
5024
|
+
var css_248z$q = ".cweb-textarea {\n border: 1px solid #cccccc;\n border-radius: 4px;\n outline: none;\n background-color: #ffffff;\n resize: none;\n}\n\n.cweb-textarea.has-icon {\n background-size: 24px;\n background-position: 10px 10px;\n background-repeat: no-repeat;\n padding-left: 44px;\n}\n\n.cweb-textarea.resizable {\n resize: both;\n}\n\n.cweb-textarea.resizable-x {\n resize: horizontal;\n}\n\n.cweb-textarea.resizable-y {\n resize: vertical;\n}\n\n.cweb-textarea:-ms-input-placeholder {\n color: #737373;\n}\n\n.cweb-textarea::placeholder {\n color: #737373;\n}\n\n.cweb-textarea:-ms-input-placeholder {\n color: #64748b !important;\n}\n\n.cweb-textarea::-ms-input-placeholder {\n color: #64748b;\n}\n\n.cweb-textarea:focus {\n border-color: #0074dd;\n}\n\n.cweb-textarea:disabled {\n cursor: not-allowed;\n}\n\n.cweb-textarea.has-error {\n border: 1px solid #ff6266;\n color: #ff6266;\n}\n";
|
|
5025
|
+
styleInject(css_248z$q);
|
|
4796
5026
|
|
|
4797
|
-
var _excluded$
|
|
5027
|
+
var _excluded$i = ["className", "value", "name", "placeholder", "maxLength", "rows", "resizable", "isDisabled", "icon", "onChange", "onBlur", "onFocus", "onKeyPress", "onKeyDown", "onCtrlEnter"];
|
|
4798
5028
|
var RESIZE_TYPES = {
|
|
4799
5029
|
NONE: "none",
|
|
4800
5030
|
BOTH: "both",
|
|
@@ -4838,7 +5068,7 @@ function Textarea(props) {
|
|
|
4838
5068
|
onKeyPress = props.onKeyPress,
|
|
4839
5069
|
_onKeyDown = props.onKeyDown,
|
|
4840
5070
|
onCtrlEnter = props.onCtrlEnter,
|
|
4841
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
5071
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$i);
|
|
4842
5072
|
|
|
4843
5073
|
var style;
|
|
4844
5074
|
|
|
@@ -4879,8 +5109,8 @@ function Textarea(props) {
|
|
|
4879
5109
|
}));
|
|
4880
5110
|
}
|
|
4881
5111
|
|
|
4882
|
-
var css_248z$
|
|
4883
|
-
styleInject(css_248z$
|
|
5112
|
+
var css_248z$r = ".ql-editor {\n resize: vertical;\n min-height: 10rem;\n}\n\n.ql-snow.ql-toolbar {\n display: block;\n background: #f1f5f9;\n border-top-left-radius: 0.5em;\n border-top-right-radius: 0.5em;\n margin-top: 0.5em;\n}\n";
|
|
5113
|
+
styleInject(css_248z$r);
|
|
4884
5114
|
|
|
4885
5115
|
function TextEditor(_ref) {
|
|
4886
5116
|
var defaultValue = _ref.defaultValue,
|
|
@@ -4934,8 +5164,8 @@ TextEditor.propTypes = {
|
|
|
4934
5164
|
onValueChange: PropTypes.func.isRequired
|
|
4935
5165
|
};
|
|
4936
5166
|
|
|
4937
|
-
var css_248z$
|
|
4938
|
-
styleInject(css_248z$
|
|
5167
|
+
var css_248z$s = ".editor .rdw-editor {\n overflow-y: auto;\n}\n\n.editor .rdw-editor .rdw-link-modal {\n width: 20rem;\n height: 19rem;\n}\n\n.editor .rdw-editor .rdw-link-modal .rdw-link-modal-label,\n .editor .rdw-editor .rdw-link-modal .rdw-link-modal-target-option {\n font-weight: normal;\n}\n\n.editor .rdw-editor .rdw-link-modal .rdw-link-modal-input {\n margin-bottom: 1rem;\n font-size: 16px;\n font-weight: normal;\n line-height: 21px;\n color: #2d2d2d;\n height: 44px;\n border: 1px solid #cccccc;\n border-radius: 4px;\n outline: none;\n background-color: #ffffff;\n padding: 12px;\n caret-color: #0a78b2;\n}\n\n.editor .rdw-editor .rdw-link-modal .rdw-link-modal-buttonsection {\n display: flex;\n flex-direction: row-reverse;\n align-items: center;\n}\n\n.editor .rdw-editor .rdw-link-modal .rdw-link-modal-buttonsection .rdw-link-modal-btn {\n border-radius: 1.375rem;\n width: 6.5rem;\n height: 2.75rem;\n border: 1px solid #009fe3;\n background-color: transparent;\n color: #009fe3;\n}\n\n.editor .rdw-editor .rdw-link-modal .rdw-link-modal-buttonsection .rdw-link-modal-btn:first-child,\n .editor .rdw-editor .rdw-link-modal .rdw-link-modal-buttonsection .rdw-link-modal-btn:disabled {\n background: #009fe3;\n color: #ffffff;\n}\n\n.editor .rdw-editor .rdw-embedded-modal {\n width: 22rem;\n height: 15rem;\n}\n\n.editor .rdw-editor .rdw-embedded-modal .rdw-embedded-modal-link-input,\n .editor .rdw-editor .rdw-embedded-modal .rdw-embedded-modal-size-input {\n font-size: 16px;\n font-weight: normal;\n line-height: 21px;\n color: #2d2d2d;\n height: 44px;\n border: 1px solid #cccccc;\n border-radius: 4px;\n outline: none;\n background-color: #ffffff;\n padding: 12px;\n caret-color: #0a78b2;\n}\n\n.editor .rdw-editor .rdw-embedded-modal .rdw-embedded-modal-link-input {\n width: 100%;\n}\n\n.editor .rdw-editor .rdw-embedded-modal .rdw-embedded-modal-size-input {\n width: 90%;\n}\n\n.editor .rdw-editor .rdw-embedded-modal .rdw-embedded-modal-btn-section {\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n\n.editor .rdw-editor .rdw-embedded-modal .rdw-embedded-modal-btn-section .rdw-embedded-modal-btn {\n border-radius: 1.375rem;\n width: 6.5rem;\n height: 2.75rem;\n border: 1px solid #009fe3;\n background-color: transparent;\n color: #009fe3;\n}\n\n.editor .rdw-editor .rdw-embedded-modal .rdw-embedded-modal-btn-section .rdw-embedded-modal-btn:first-child,\n .editor .rdw-editor .rdw-embedded-modal .rdw-embedded-modal-btn-section .rdw-embedded-modal-btn:disabled {\n background: #009fe3;\n color: #ffffff;\n}\n\n.editor .rdw-editor .rdw-editor-main {\n min-height: 14rem;\n overflow: hidden;\n}\n\n.editor .rdw-editor .rdw-editor-main .DraftEditor-root {\n margin: 0 12px;\n}\n";
|
|
5168
|
+
styleInject(css_248z$s);
|
|
4939
5169
|
|
|
4940
5170
|
var TextEditorV2 = function TextEditorV2(_ref) {
|
|
4941
5171
|
var defaultValue = _ref.defaultValue,
|
|
@@ -5014,7 +5244,7 @@ var Timeline = function Timeline(props) {
|
|
|
5014
5244
|
}, props.loadMoreButtonProps)));
|
|
5015
5245
|
};
|
|
5016
5246
|
|
|
5017
|
-
var _excluded$
|
|
5247
|
+
var _excluded$j = ["titleProps", "title", "titleAccessory", "contentProps", "content", "defaultContent", "className", "buttons"];
|
|
5018
5248
|
function ViewItem(_ref) {
|
|
5019
5249
|
var titleProps = _ref.titleProps,
|
|
5020
5250
|
title = _ref.title,
|
|
@@ -5025,7 +5255,7 @@ function ViewItem(_ref) {
|
|
|
5025
5255
|
defaultContent = _ref$defaultContent === void 0 ? "-" : _ref$defaultContent,
|
|
5026
5256
|
className = _ref.className,
|
|
5027
5257
|
buttons = _ref.buttons,
|
|
5028
|
-
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
5258
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$j);
|
|
5029
5259
|
|
|
5030
5260
|
var titlePropsMerged = titleProps != null ? titleProps : {
|
|
5031
5261
|
text: title != null ? title : defaultContent
|
|
@@ -5143,7 +5373,7 @@ var isRequired = function isRequired(options) {
|
|
|
5143
5373
|
return !!(options && "required" in options);
|
|
5144
5374
|
};
|
|
5145
5375
|
|
|
5146
|
-
var _excluded$
|
|
5376
|
+
var _excluded$k = ["name", "fieldErrors", "fieldRequired", "label", "info", "decoratorClassname"];
|
|
5147
5377
|
/**
|
|
5148
5378
|
* Input field that can be used in any react-hook-form context.
|
|
5149
5379
|
*/
|
|
@@ -5155,7 +5385,7 @@ var FormInputInner = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
|
5155
5385
|
label = _ref.label,
|
|
5156
5386
|
info = _ref.info,
|
|
5157
5387
|
decoratorClassname = _ref.decoratorClassname,
|
|
5158
|
-
fieldProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
5388
|
+
fieldProps = _objectWithoutPropertiesLoose(_ref, _excluded$k);
|
|
5159
5389
|
|
|
5160
5390
|
return /*#__PURE__*/React__default.createElement(FormFieldDecorator, {
|
|
5161
5391
|
name: name,
|
|
@@ -5176,93 +5406,7 @@ var FormInput = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
|
5176
5406
|
}));
|
|
5177
5407
|
});
|
|
5178
5408
|
|
|
5179
|
-
var
|
|
5180
|
-
styleInject(css_248z$s);
|
|
5181
|
-
|
|
5182
|
-
var _excluded$i = ["text", "info", "isError", "innerRef", "className"];
|
|
5183
|
-
|
|
5184
|
-
function RadioInner(_ref) {
|
|
5185
|
-
var text = _ref.text,
|
|
5186
|
-
info = _ref.info,
|
|
5187
|
-
isError = _ref.isError,
|
|
5188
|
-
innerRef = _ref.innerRef,
|
|
5189
|
-
className = _ref.className,
|
|
5190
|
-
otherProps = _objectWithoutPropertiesLoose(_ref, _excluded$i);
|
|
5191
|
-
|
|
5192
|
-
var value = otherProps.value,
|
|
5193
|
-
disabled = otherProps.disabled;
|
|
5194
|
-
var nameHtmlFor = "field-" + value;
|
|
5195
|
-
return /*#__PURE__*/React__default.createElement("label", {
|
|
5196
|
-
className: "radio-form-field-label leading-tight",
|
|
5197
|
-
htmlFor: nameHtmlFor,
|
|
5198
|
-
"data-has-error": isError,
|
|
5199
|
-
"data-test-id": nameHtmlFor
|
|
5200
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
5201
|
-
className: "flex flex-row items-center "
|
|
5202
|
-
}, /*#__PURE__*/React__default.createElement("input", Object.assign({}, otherProps, {
|
|
5203
|
-
className: classNames("appearance-none", className),
|
|
5204
|
-
ref: innerRef,
|
|
5205
|
-
type: "radio",
|
|
5206
|
-
id: nameHtmlFor,
|
|
5207
|
-
disabled: disabled
|
|
5208
|
-
})), /*#__PURE__*/React__default.createElement("span", {
|
|
5209
|
-
className: classNames("flex flex-col items-center justify-center w-4 h-4 transition-colors duration-300 ease-in-out border radio-circle rounded-xl border-slate-300")
|
|
5210
|
-
}, /*#__PURE__*/React__default.createElement("span", {
|
|
5211
|
-
className: "block transition-colors duration-300 ease-in-out radio-inner-circle w-1.5 h-1.5 rounded-xl"
|
|
5212
|
-
})), text && /*#__PURE__*/React__default.createElement("div", {
|
|
5213
|
-
className: "ml-2"
|
|
5214
|
-
}, /*#__PURE__*/React__default.createElement(Text, {
|
|
5215
|
-
inline: true,
|
|
5216
|
-
text: text,
|
|
5217
|
-
type: "base",
|
|
5218
|
-
color: disabled ? "slate-500" : undefined
|
|
5219
|
-
}))), info && /*#__PURE__*/React__default.createElement(Text, {
|
|
5220
|
-
inline: true,
|
|
5221
|
-
className: "ml-6",
|
|
5222
|
-
text: info,
|
|
5223
|
-
type: "sm",
|
|
5224
|
-
color: disabled ? "slate-200" : "slate-500"
|
|
5225
|
-
}));
|
|
5226
|
-
}
|
|
5227
|
-
/**
|
|
5228
|
-
* TODO: The CSS styling is all messed up, including isError
|
|
5229
|
-
* Warning: don't use this prop before this is resolved
|
|
5230
|
-
* Issue to track: https://github.com/Luscii/web-ui/issues/57
|
|
5231
|
-
* TODO: remove this comment once this is resolved
|
|
5232
|
-
*/
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
var RadioV2 = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
5236
|
-
return /*#__PURE__*/React__default.createElement(RadioInner, Object.assign({}, props, {
|
|
5237
|
-
innerRef: ref
|
|
5238
|
-
}));
|
|
5239
|
-
});
|
|
5240
|
-
|
|
5241
|
-
var _excluded$j = ["innerRef", "options"];
|
|
5242
|
-
|
|
5243
|
-
function RadioGroupInner(_ref) {
|
|
5244
|
-
var innerRef = _ref.innerRef,
|
|
5245
|
-
options = _ref.options,
|
|
5246
|
-
registerProps = _objectWithoutPropertiesLoose(_ref, _excluded$j);
|
|
5247
|
-
|
|
5248
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
5249
|
-
className: classNames("flex flex-col space-y-2")
|
|
5250
|
-
}, options.map(function (option) {
|
|
5251
|
-
return /*#__PURE__*/React__default.createElement(RadioV2, Object.assign({
|
|
5252
|
-
key: option.value
|
|
5253
|
-
}, option, registerProps, {
|
|
5254
|
-
ref: innerRef
|
|
5255
|
-
}));
|
|
5256
|
-
}));
|
|
5257
|
-
}
|
|
5258
|
-
|
|
5259
|
-
var RadioGroupV2 = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
5260
|
-
return /*#__PURE__*/React__default.createElement(RadioGroupInner, Object.assign({}, props, {
|
|
5261
|
-
innerRef: ref
|
|
5262
|
-
}));
|
|
5263
|
-
});
|
|
5264
|
-
|
|
5265
|
-
var _excluded$k = ["innerRef", "name", "fieldErrors", "fieldRequired", "label", "info", "decoratorClassname"];
|
|
5409
|
+
var _excluded$l = ["innerRef", "name", "fieldErrors", "fieldRequired", "label", "info", "decoratorClassname"];
|
|
5266
5410
|
/**
|
|
5267
5411
|
* Input field that can be used in any react-hook-form context.
|
|
5268
5412
|
*/
|
|
@@ -5275,7 +5419,7 @@ function FormRadioGroupInner(_ref) {
|
|
|
5275
5419
|
label = _ref.label,
|
|
5276
5420
|
info = _ref.info,
|
|
5277
5421
|
decoratorClassname = _ref.decoratorClassname,
|
|
5278
|
-
fieldProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
5422
|
+
fieldProps = _objectWithoutPropertiesLoose(_ref, _excluded$l);
|
|
5279
5423
|
|
|
5280
5424
|
return /*#__PURE__*/React__default.createElement(FormFieldDecorator, {
|
|
5281
5425
|
name: name,
|
|
@@ -5297,150 +5441,6 @@ var FormRadioGroup = /*#__PURE__*/React__default.forwardRef(function (props, ref
|
|
|
5297
5441
|
}));
|
|
5298
5442
|
});
|
|
5299
5443
|
|
|
5300
|
-
var _excluded$l = ["isError", "styles", "options", "onChange", "value", "isMulti", "className"];
|
|
5301
|
-
|
|
5302
|
-
function generateCustomStyles$1(hasError, isIE11) {
|
|
5303
|
-
return {
|
|
5304
|
-
option: function option(baseStyles, state) {
|
|
5305
|
-
return _extends({}, baseStyles, {
|
|
5306
|
-
fontWeight: state.isSelected ? "bold" : "normal",
|
|
5307
|
-
fontSize: "14px",
|
|
5308
|
-
backgroundColor: "none",
|
|
5309
|
-
color: "inherit",
|
|
5310
|
-
position: "relative",
|
|
5311
|
-
padding: "0.75rem",
|
|
5312
|
-
opacity: state.isDisabled ? "0.5" : 1,
|
|
5313
|
-
"&:after": {
|
|
5314
|
-
visibility: state.isSelected ? "visible" : "hidden"
|
|
5315
|
-
},
|
|
5316
|
-
transition: "background-color 0.3s ease-in-out",
|
|
5317
|
-
"&:hover": {
|
|
5318
|
-
// tailwind blue-50
|
|
5319
|
-
backgroundColor: state.isSelected ? "transparent" : "#F2FAFD"
|
|
5320
|
-
},
|
|
5321
|
-
pointerEvents: state.isDisabled ? "none" : "auto"
|
|
5322
|
-
});
|
|
5323
|
-
},
|
|
5324
|
-
container: function container(baseStyles) {
|
|
5325
|
-
return _extends({}, baseStyles, {
|
|
5326
|
-
flexGrow: isIE11 ? 0.5 : "initial"
|
|
5327
|
-
});
|
|
5328
|
-
},
|
|
5329
|
-
control: function control(baseStyles, state) {
|
|
5330
|
-
var defaultBorderColor = state.isFocused ? "#045baa" : "#D1D5DB";
|
|
5331
|
-
var validatedBorderColor = hasError ? "#c53030" : defaultBorderColor;
|
|
5332
|
-
var defaultOutline = hasError ? "rgba(255, 98, 102, 0.3)" : "rgba(0, 159, 227, 0.3)";
|
|
5333
|
-
var validatedOutline = "4px solid " + (state.isFocused ? defaultOutline : "transparent");
|
|
5334
|
-
return _extends({}, baseStyles, {
|
|
5335
|
-
fontSize: "14px",
|
|
5336
|
-
transition: "border 0.3s ease-in-out",
|
|
5337
|
-
height: isIE11 ? "50px" : "2.75rem",
|
|
5338
|
-
// primary outline
|
|
5339
|
-
outline: validatedOutline,
|
|
5340
|
-
borderColor: validatedBorderColor,
|
|
5341
|
-
borderWidth: "1px !important",
|
|
5342
|
-
borderStyle: "solid",
|
|
5343
|
-
borderRadius: "4px",
|
|
5344
|
-
boxShadow: "0px 1px 2px rgba(0, 0, 0, 0.05)",
|
|
5345
|
-
"&:hover": {
|
|
5346
|
-
borderColor: "#9CA3AF",
|
|
5347
|
-
// selector for the chevron
|
|
5348
|
-
"> [class*=\"IndicatorsContainer\"]": {
|
|
5349
|
-
opacity: 1
|
|
5350
|
-
}
|
|
5351
|
-
}
|
|
5352
|
-
});
|
|
5353
|
-
},
|
|
5354
|
-
// The placeholder has the following css prop: grid-area: 1/1/2/3;
|
|
5355
|
-
// And grid-area doesn't work on IE11, so we need to style it slightly different.
|
|
5356
|
-
placeholder: function placeholder(baseStyles) {
|
|
5357
|
-
return _extends({}, baseStyles, {
|
|
5358
|
-
fontWeight: 100,
|
|
5359
|
-
color: "#6B7280",
|
|
5360
|
-
paddingTop: isIE11 ? "1.2rem" : undefined
|
|
5361
|
-
});
|
|
5362
|
-
},
|
|
5363
|
-
singleValue: function singleValue(baseStyles) {
|
|
5364
|
-
return _extends({}, baseStyles, {
|
|
5365
|
-
paddingTop: isIE11 ? "1.2rem" : undefined,
|
|
5366
|
-
fontSize: "14px"
|
|
5367
|
-
});
|
|
5368
|
-
},
|
|
5369
|
-
indicatorSeparator: function indicatorSeparator() {
|
|
5370
|
-
return {
|
|
5371
|
-
display: "none"
|
|
5372
|
-
};
|
|
5373
|
-
},
|
|
5374
|
-
menu: function menu(baseStyles) {
|
|
5375
|
-
return _extends({}, baseStyles, {
|
|
5376
|
-
zIndex: 20
|
|
5377
|
-
});
|
|
5378
|
-
}
|
|
5379
|
-
};
|
|
5380
|
-
}
|
|
5381
|
-
/**
|
|
5382
|
-
* A wrapper around react-select to style it according to our design specification.
|
|
5383
|
-
*
|
|
5384
|
-
* In addition, the value is taken out of the option, instead of returning the complete option.
|
|
5385
|
-
*
|
|
5386
|
-
* Care when using grouped options: the value of the options overspanning all groups need to be unique!
|
|
5387
|
-
* For instance, if you have an option with value "chocolate" in both the groups "flavor" and "dip", then you get unforeseen errors.
|
|
5388
|
-
* This is a problem within react-select itself, not our wrapper.
|
|
5389
|
-
*
|
|
5390
|
-
* Care when using defaultValue: this still requires the complete Option (instead of the value of the Option).
|
|
5391
|
-
* So far there wasn't a use-case for this.
|
|
5392
|
-
*/
|
|
5393
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
var Select = /*#__PURE__*/React__default.forwardRef(function (_ref, innerRef) {
|
|
5397
|
-
var _ref$isError = _ref.isError,
|
|
5398
|
-
isError = _ref$isError === void 0 ? false : _ref$isError,
|
|
5399
|
-
styles = _ref.styles,
|
|
5400
|
-
options = _ref.options,
|
|
5401
|
-
onChange = _ref.onChange,
|
|
5402
|
-
value = _ref.value,
|
|
5403
|
-
isMulti = _ref.isMulti,
|
|
5404
|
-
className = _ref.className,
|
|
5405
|
-
otherProps = _objectWithoutPropertiesLoose(_ref, _excluded$l);
|
|
5406
|
-
|
|
5407
|
-
var isIE11 = "MSInputMethodContext" in window && "documentMode" in document;
|
|
5408
|
-
var customStyles = generateCustomStyles$1(isError, isIE11);
|
|
5409
|
-
var mergedStyles = ReactSelect.mergeStyles(customStyles, styles); // the options can be either a list of options or a grouped list of options
|
|
5410
|
-
// this is a typechecker to verify it is the case.
|
|
5411
|
-
|
|
5412
|
-
var isOptionsGrouped = !options ? false : options.reduce(function (acc, o) {
|
|
5413
|
-
return acc || "options" in o && !("values" in o);
|
|
5414
|
-
}, false); // we subsequently flatmap to ensure it's always a list of options
|
|
5415
|
-
|
|
5416
|
-
var flatmappedOptions = !options ? [] : isOptionsGrouped ? options.flatMap(function (g) {
|
|
5417
|
-
return g.options;
|
|
5418
|
-
}) : options; // based on: https://stackoverflow.com/a/70022957
|
|
5419
|
-
|
|
5420
|
-
var onChangeWrapped = !onChange ? undefined : isMulti ? function (val, a) {
|
|
5421
|
-
return onChange(val.map(function (v) {
|
|
5422
|
-
return v.value;
|
|
5423
|
-
}), a);
|
|
5424
|
-
} : function (val, a) {
|
|
5425
|
-
return onChange(val == null ? void 0 : val.value, a);
|
|
5426
|
-
}; // TODO: how can we report the error if a value was given that is not within the options?
|
|
5427
|
-
|
|
5428
|
-
var valueWrapped = !value || !options ? value : isMulti ? flatmappedOptions.filter(function (o) {
|
|
5429
|
-
return value.includes(o.value);
|
|
5430
|
-
}) : flatmappedOptions.find(function (o) {
|
|
5431
|
-
return o.value === value;
|
|
5432
|
-
});
|
|
5433
|
-
return /*#__PURE__*/React__default.createElement(ReactSelect__default, Object.assign({}, otherProps, {
|
|
5434
|
-
ref: innerRef,
|
|
5435
|
-
styles: mergedStyles,
|
|
5436
|
-
options: options,
|
|
5437
|
-
onChange: onChangeWrapped,
|
|
5438
|
-
value: valueWrapped,
|
|
5439
|
-
isMulti: isMulti,
|
|
5440
|
-
className: classNames("customized-select", className)
|
|
5441
|
-
}));
|
|
5442
|
-
});
|
|
5443
|
-
|
|
5444
5444
|
var _excluded$m = ["control", "name", "rules", "fieldErrors", "fieldRequired", "label", "info", "decoratorClassname"];
|
|
5445
5445
|
|
|
5446
5446
|
var FormSelect = /*#__PURE__*/React__default.forwardRef(function (_ref, innerRef) {
|
|
@@ -5477,74 +5477,45 @@ var FormSelect = /*#__PURE__*/React__default.forwardRef(function (_ref, innerRef
|
|
|
5477
5477
|
|
|
5478
5478
|
var _excluded$n = ["type", "name", "options", "fieldProps"];
|
|
5479
5479
|
/**
|
|
5480
|
-
* Create a straight forward Form.
|
|
5480
|
+
* Create a straight forward Form, which takes away the 'overhead' of react-hook-form.
|
|
5481
5481
|
*
|
|
5482
|
-
*
|
|
5483
|
-
*
|
|
5482
|
+
* You will probably don't want to use this component for now, given that the button is hardcoded.
|
|
5483
|
+
* This is an example for the Form for now, though it could be improved to enforce further unification.
|
|
5484
|
+
*
|
|
5485
|
+
* TODO: make the buttons configurable.
|
|
5484
5486
|
*/
|
|
5485
5487
|
|
|
5486
|
-
function
|
|
5488
|
+
function GenericForm(_ref) {
|
|
5487
5489
|
var fields = _ref.fields,
|
|
5488
5490
|
onValid = _ref.onValid,
|
|
5489
5491
|
onError = _ref.onError,
|
|
5490
5492
|
defaultValues = _ref.defaultValues;
|
|
5491
|
-
|
|
5492
|
-
var _useForm = reactHookForm.useForm({
|
|
5493
|
+
var useFormReturn = reactHookForm.useForm({
|
|
5493
5494
|
criteriaMode: "all",
|
|
5494
5495
|
defaultValues: defaultValues
|
|
5495
|
-
})
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
return /*#__PURE__*/React__default.createElement(FormInput, Object.assign({
|
|
5515
|
-
key: name
|
|
5516
|
-
}, decoratorProps, {
|
|
5517
|
-
fieldRequired: isRequired(options),
|
|
5518
|
-
fieldErrors: errors
|
|
5519
|
-
}, fieldProps, register(name, options), {
|
|
5520
|
-
type: type || "text"
|
|
5521
|
-
}));
|
|
5522
|
-
|
|
5523
|
-
case "select":
|
|
5524
|
-
return /*#__PURE__*/React__default.createElement(FormSelect, Object.assign({
|
|
5525
|
-
key: name
|
|
5526
|
-
}, decoratorProps, {
|
|
5527
|
-
fieldRequired: isRequired(options),
|
|
5528
|
-
fieldErrors: errors
|
|
5529
|
-
}, fieldProps, {
|
|
5530
|
-
control: control,
|
|
5531
|
-
rules: options,
|
|
5532
|
-
name: name
|
|
5533
|
-
}));
|
|
5534
|
-
|
|
5535
|
-
case "radioGroup":
|
|
5536
|
-
return /*#__PURE__*/React__default.createElement(FormRadioGroup, Object.assign({
|
|
5537
|
-
key: name
|
|
5538
|
-
}, decoratorProps, {
|
|
5539
|
-
fieldRequired: isRequired(options),
|
|
5540
|
-
fieldErrors: errors
|
|
5541
|
-
}, fieldProps, register(name, options)));
|
|
5542
|
-
|
|
5543
|
-
default:
|
|
5544
|
-
return undefined;
|
|
5545
|
-
}
|
|
5546
|
-
};
|
|
5496
|
+
});
|
|
5497
|
+
var handleSubmit = useFormReturn.handleSubmit;
|
|
5498
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
5499
|
+
className: "space-y-4"
|
|
5500
|
+
}, /*#__PURE__*/React__default.createElement(Form, {
|
|
5501
|
+
fields: fields,
|
|
5502
|
+
useFormReturn: useFormReturn
|
|
5503
|
+
}), /*#__PURE__*/React__default.createElement(PrimaryButton, {
|
|
5504
|
+
onClick: handleSubmit(onValid, onError),
|
|
5505
|
+
text: "submit"
|
|
5506
|
+
}));
|
|
5507
|
+
}
|
|
5508
|
+
/**
|
|
5509
|
+
* Creates a Form based on the fields input.
|
|
5510
|
+
*
|
|
5511
|
+
* Expects the results of the useForm hook to be injected into the useFormReturn parameter.
|
|
5512
|
+
*
|
|
5513
|
+
* This allows you to use and modify the useFormReturn before injecting it here.
|
|
5514
|
+
*/
|
|
5547
5515
|
|
|
5516
|
+
function Form(_ref2) {
|
|
5517
|
+
var fields = _ref2.fields,
|
|
5518
|
+
useFormReturn = _ref2.useFormReturn;
|
|
5548
5519
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
5549
5520
|
className: "space-y-4"
|
|
5550
5521
|
}, fields.map(function (props) {
|
|
@@ -5552,18 +5523,68 @@ function Form(_ref) {
|
|
|
5552
5523
|
var rowFields = props.fields,
|
|
5553
5524
|
key = props.key;
|
|
5554
5525
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
5555
|
-
className: "flex flex-row",
|
|
5526
|
+
className: "flex flex-row space-x-4",
|
|
5556
5527
|
key: key
|
|
5557
|
-
}, rowFields.map(
|
|
5528
|
+
}, rowFields.map(function (field) {
|
|
5529
|
+
return FormFieldMapper(field, useFormReturn);
|
|
5530
|
+
}));
|
|
5558
5531
|
}
|
|
5559
5532
|
|
|
5560
|
-
return
|
|
5561
|
-
}), /*#__PURE__*/React__default.createElement(PrimaryButton, {
|
|
5562
|
-
onClick: handleSubmit(onValid, onError),
|
|
5563
|
-
text: "submit"
|
|
5533
|
+
return FormFieldMapper(props, useFormReturn);
|
|
5564
5534
|
}));
|
|
5565
5535
|
}
|
|
5566
5536
|
|
|
5537
|
+
function FormFieldMapper(formFieldProps, useFormReturn) {
|
|
5538
|
+
var type = formFieldProps.type,
|
|
5539
|
+
name = formFieldProps.name,
|
|
5540
|
+
options = formFieldProps.options,
|
|
5541
|
+
_formFieldProps$field = formFieldProps.fieldProps,
|
|
5542
|
+
fieldProps = _formFieldProps$field === void 0 ? {} : _formFieldProps$field,
|
|
5543
|
+
decoratorProps = _objectWithoutPropertiesLoose(formFieldProps, _excluded$n);
|
|
5544
|
+
|
|
5545
|
+
var register = useFormReturn.register,
|
|
5546
|
+
control = useFormReturn.control,
|
|
5547
|
+
errors = useFormReturn.formState.errors;
|
|
5548
|
+
|
|
5549
|
+
switch (type) {
|
|
5550
|
+
case "text":
|
|
5551
|
+
case "number":
|
|
5552
|
+
case "email":
|
|
5553
|
+
case "password":
|
|
5554
|
+
return /*#__PURE__*/React__default.createElement(FormInput, Object.assign({
|
|
5555
|
+
key: name
|
|
5556
|
+
}, decoratorProps, {
|
|
5557
|
+
fieldRequired: isRequired(options),
|
|
5558
|
+
fieldErrors: errors
|
|
5559
|
+
}, fieldProps, register(name, options), {
|
|
5560
|
+
type: type || "text"
|
|
5561
|
+
}));
|
|
5562
|
+
|
|
5563
|
+
case "select":
|
|
5564
|
+
return /*#__PURE__*/React__default.createElement(FormSelect, Object.assign({
|
|
5565
|
+
key: name
|
|
5566
|
+
}, decoratorProps, {
|
|
5567
|
+
fieldRequired: isRequired(options),
|
|
5568
|
+
fieldErrors: errors
|
|
5569
|
+
}, fieldProps, {
|
|
5570
|
+
control: control,
|
|
5571
|
+
rules: options,
|
|
5572
|
+
name: name
|
|
5573
|
+
}));
|
|
5574
|
+
|
|
5575
|
+
case "radioGroup":
|
|
5576
|
+
return /*#__PURE__*/React__default.createElement(FormRadioGroup, Object.assign({
|
|
5577
|
+
key: name
|
|
5578
|
+
}, decoratorProps, {
|
|
5579
|
+
fieldRequired: isRequired(options),
|
|
5580
|
+
fieldErrors: errors
|
|
5581
|
+
}, fieldProps, register(name, options)));
|
|
5582
|
+
|
|
5583
|
+
default:
|
|
5584
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null);
|
|
5585
|
+
}
|
|
5586
|
+
}
|
|
5587
|
+
|
|
5567
5588
|
var AlertsIcon = function AlertsIcon(props) {
|
|
5568
5589
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
5569
5590
|
className: props.className,
|
|
@@ -6347,6 +6368,7 @@ exports.ExclamationMarkIcon = ExclamationMarkIcon;
|
|
|
6347
6368
|
exports.EyeIcon = EyeIcon;
|
|
6348
6369
|
exports.Form = Form;
|
|
6349
6370
|
exports.GearIcon = GearIcon;
|
|
6371
|
+
exports.GenericForm = GenericForm;
|
|
6350
6372
|
exports.GroupIcon = GroupIcon;
|
|
6351
6373
|
exports.HamburgerIcon = HamburgerIcon;
|
|
6352
6374
|
exports.HeartIcon = HeartIcon;
|
|
@@ -6376,6 +6398,8 @@ exports.PrimaryButton = PrimaryButton;
|
|
|
6376
6398
|
exports.PrintIcon = PrintIcon;
|
|
6377
6399
|
exports.Radio = Radio;
|
|
6378
6400
|
exports.RadioGroup = RadioGroup;
|
|
6401
|
+
exports.RadioGroupV2 = RadioGroupV2;
|
|
6402
|
+
exports.RadioV2 = RadioV2;
|
|
6379
6403
|
exports.RightArrowIcon = RightArrowIcon;
|
|
6380
6404
|
exports.SearchCancelIcon = SearchCancelIcon;
|
|
6381
6405
|
exports.SearchIcon = SearchIcon;
|
|
@@ -6384,6 +6408,7 @@ exports.SecondaryButton = SecondaryButton;
|
|
|
6384
6408
|
exports.Section = Section;
|
|
6385
6409
|
exports.SectionItem = SectionItem;
|
|
6386
6410
|
exports.SectionItemWithContent = SectionItemWithContent;
|
|
6411
|
+
exports.Select = Select;
|
|
6387
6412
|
exports.SettingsMenuButton = SettingsMenuButton;
|
|
6388
6413
|
exports.SmallCircleIcon = SmallCircleIcon;
|
|
6389
6414
|
exports.SmallDiamondIcon = SmallDiamondIcon;
|