@typeolymp/ui-components 1.16.1 → 1.16.2

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.
@@ -3,6 +3,7 @@ declare type PropsType = {
3
3
  size?: "small" | "medium" | "large";
4
4
  align?: "left" | "center" | "right";
5
5
  color?: "black" | "white" | "gray";
6
+ as?: "div";
6
7
  children: ReactNode;
7
8
  };
8
9
  declare const Subheading: FC<PropsType>;
@@ -2,7 +2,7 @@ import { FC } from "react";
2
2
  export declare type PropsType = {
3
3
  items: Array<{
4
4
  title: string;
5
- content: string;
5
+ content: string | JSX.Element;
6
6
  }>;
7
7
  };
8
8
  declare const Collapse: FC<PropsType>;
@@ -54,7 +54,7 @@ declare type RangeFieldType = {
54
54
  export declare type FormFieldType = InputFieldType | PasswordInputFieldType | DateInputFieldType | TextareaFieldType | RadioGroupFieldType | NumberFieldType | CheckboxesFieldType | SelectFieldType | ToggleFieldType | RangeFieldType;
55
55
  export declare type PropsType = {
56
56
  title?: string;
57
- description?: string;
57
+ description?: string | JSX.Element;
58
58
  fields: FormFieldType[];
59
59
  button?: ButtonPropsType;
60
60
  onChangeFields?(newValues: {
package/build/index.es.js CHANGED
@@ -3488,7 +3488,11 @@ var Button = forwardRef(function (_a, ref) {
3488
3488
  var buttonRef = useRef(null);
3489
3489
  var _b = useState(false), isLoading = _b[0], setIsLoading = _b[1];
3490
3490
  var as = href || asAnchor ? "a" : "button";
3491
- var onClick = function () {
3491
+ var onClick = function (e) {
3492
+ if (props.onClickAsync || props.onClick) {
3493
+ e.stopPropagation();
3494
+ e.preventDefault();
3495
+ }
3492
3496
  if (props.onClickAsync) {
3493
3497
  setIsLoading(true);
3494
3498
  new Promise(function (resolve) {
@@ -11234,7 +11238,7 @@ var Checkboxes = function (props) {
11234
11238
  };
11235
11239
 
11236
11240
  var Container$i = styled.div(templateObject_1$x || (templateObject_1$x = __makeTemplateObject$1(["\n width: 100%;\n background-color: ", ";\n box-shadow: 0px 4px 0px rgba(0, 0, 0, 20%);\n border-radius: 6px;\n padding: 10px 20px;\n"], ["\n width: 100%;\n background-color: ", ";\n box-shadow: 0px 4px 0px rgba(0, 0, 0, 20%);\n border-radius: 6px;\n padding: 10px 20px;\n"])), theme.colors.lightGray.light);
11237
- var Item = styled.div(templateObject_2$s || (templateObject_2$s = __makeTemplateObject$1(["\n padding: 10px 0;\n cursor: pointer;\n\n > div:first-child {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 5px;\n }\n\n p {\n display: ", ";\n }\n\n :not(:last-child) {\n border-bottom: 1px solid ", ";\n }\n"], ["\n padding: 10px 0;\n cursor: pointer;\n\n > div:first-child {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 5px;\n }\n\n p {\n display: ", ";\n }\n\n :not(:last-child) {\n border-bottom: 1px solid ", ";\n }\n"])), function (_a) {
11241
+ var Item = styled.div(templateObject_2$s || (templateObject_2$s = __makeTemplateObject$1(["\n padding: 10px 0;\n cursor: pointer;\n\n > div:first-child {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 5px;\n }\n\n p, > div:last-child {\n display: ", ";\n margin: 0;\n }\n\n :not(:last-child) {\n border-bottom: 1px solid ", ";\n }\n"], ["\n padding: 10px 0;\n cursor: pointer;\n\n > div:first-child {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 5px;\n }\n\n p, > div:last-child {\n display: ", ";\n margin: 0;\n }\n\n :not(:last-child) {\n border-bottom: 1px solid ", ";\n }\n"])), function (_a) {
11238
11242
  var isOpen = _a.isOpen;
11239
11243
  return (isOpen ? "" : "none");
11240
11244
  }, theme.colors.lightGray.dark);
@@ -11252,7 +11256,7 @@ var Collapse = function (props) {
11252
11256
  };
11253
11257
  return (jsx$1(Container$i, __assign$2({}, props, { children: props.items.map(function (item, index) {
11254
11258
  var isOpen = openItems.includes(index);
11255
- return (jsxs(Item, __assign$2({ isOpen: isOpen, onClick: function () { return onClickItem(index, isOpen); } }, { children: [jsxs("div", { children: [jsx$1(Heading, __assign$2({ type: "h6" }, { children: item.title })), jsx$1(Icon, { type: isOpen ? "chevronUp" : "chevronDown", color: "blue" })] }), jsx$1(Paragraph, __assign$2({ weight: "regular" }, { children: item.content }))] }), "".concat(item.title, "-").concat(index)));
11259
+ return (jsxs(Item, __assign$2({ isOpen: isOpen, onClick: function () { return onClickItem(index, isOpen); } }, { children: [jsxs("div", { children: [jsx$1(Heading, __assign$2({ type: "h6" }, { children: item.title })), jsx$1(Icon, { type: isOpen ? "chevronUp" : "chevronDown", color: "blue" })] }), jsx$1(Paragraph, __assign$2({ weight: "regular", as: typeof item.content !== "string" ? "div" : undefined }, { children: item.content }))] }), "".concat(item.title, "-").concat(index)));
11256
11260
  }) })));
11257
11261
  };
11258
11262
 
@@ -12102,7 +12106,7 @@ var Form = forwardRef(function (props, ref) {
12102
12106
  props.onError(feedback);
12103
12107
  }
12104
12108
  };
12105
- return (jsxs(Fragment$1, { children: [props.title && (jsxs(Fragment$1, { children: [jsx$1(Heading, __assign$2({ type: "h4" }, { children: props.title })), jsx$1(Spacer, { vertical: 15 })] })), props.description && (jsx$1(DescriptionWrapper, { children: jsx$1(Paragraph, __assign$2({ color: "darkGray", weight: "regular" }, { children: htmlReactParser(props.description) })) })), jsx$1(FormWrapper, { children: props.fields.map(function (field, index) {
12109
+ return (jsxs(Fragment$1, { children: [props.title && (jsxs(Fragment$1, { children: [jsx$1(Heading, __assign$2({ type: "h4" }, { children: props.title })), jsx$1(Spacer, { vertical: 15 })] })), props.description && (jsx$1(DescriptionWrapper, { children: typeof props.description === "string" ? (jsx$1(Paragraph, __assign$2({ color: "darkGray", weight: "regular" }, { children: htmlReactParser(props.description) }))) : (props.description) })), jsx$1(FormWrapper, { children: props.fields.map(function (field, index) {
12106
12110
  switch (field.type) {
12107
12111
  case "text":
12108
12112
  return (createElement(WithValidation, __assign$2({}, feedback[field.name], { key: "field-".concat(index) }),