react-better-html 1.1.54 → 1.1.55

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.
@@ -4,6 +4,11 @@ import { ComponentMarginProps, ComponentPropWithRef } from "../types/components"
4
4
  import { LoaderName } from "../types/loader";
5
5
  export type FormRowProps = {
6
6
  oneItemOnly?: boolean;
7
+ /**
8
+ * @description Weather to break the two items into two separate lines on mobile or not
9
+ * @default false
10
+ */
11
+ noBreakingPoint?: boolean;
7
12
  gap?: React.CSSProperties["gap"];
8
13
  children?: React.ReactNode;
9
14
  } & ComponentMarginProps;
@@ -15,6 +20,7 @@ type FormRowComponentType = {
15
20
  description?: string;
16
21
  withActions?: boolean;
17
22
  saveButtonLoaderName?: LoaderName | AnyOtherString;
23
+ resetButtonLoaderName?: LoaderName | AnyOtherString;
18
24
  onClickSave?: () => void;
19
25
  onClickReset?: () => void;
20
26
  }>) => React.ReactElement;
@@ -11,16 +11,16 @@ const Icon_1 = __importDefault(require("./Icon"));
11
11
  const Text_1 = __importDefault(require("./Text"));
12
12
  const Button_1 = __importDefault(require("./Button"));
13
13
  const BetterHtmlProvider_1 = require("./BetterHtmlProvider");
14
- const FormRowComponent = (0, react_1.forwardRef)(function FormRow({ oneItemOnly, gap, children, ...props }, ref) {
14
+ const FormRowComponent = (0, react_1.forwardRef)(function FormRow({ oneItemOnly, noBreakingPoint, gap, children, ...props }, ref) {
15
15
  const theme = (0, BetterHtmlProvider_1.useTheme)();
16
16
  const mediaQuery = (0, hooks_1.useMediaQuery)();
17
- const breakingPoint = mediaQuery.size900;
18
- const readyGap = breakingPoint ? theme.styles.gap : theme.styles.space * 2;
17
+ const breakingPoint = !noBreakingPoint ? mediaQuery.size900 : false;
18
+ const readyGap = breakingPoint || (noBreakingPoint && mediaQuery.size900) ? theme.styles.gap : theme.styles.space * 2;
19
19
  return ((0, jsx_runtime_1.jsxs)(Div_1.default.row, { alignItems: "center", gap: gap ?? readyGap, invertFlexDirection: breakingPoint, ...props, ref: ref, children: [children, oneItemOnly && (0, jsx_runtime_1.jsx)(Div_1.default, { width: "100%" })] }));
20
20
  });
21
- FormRowComponent.withTitle = (0, react_1.forwardRef)(function WithTitle({ icon, title, description, withActions, onClickSave, onClickReset, children, ...props }, ref) {
21
+ FormRowComponent.withTitle = (0, react_1.forwardRef)(function WithTitle({ icon, title, description, withActions, saveButtonLoaderName, resetButtonLoaderName, onClickSave, onClickReset, children, ...props }, ref) {
22
22
  const theme = (0, BetterHtmlProvider_1.useTheme)();
23
- return ((0, jsx_runtime_1.jsxs)(FormRowComponent, { ...props, ref: ref, children: [(0, jsx_runtime_1.jsxs)(Div_1.default.row, { width: "100%", alignItems: "center", gap: theme.styles.space, children: [icon && (0, jsx_runtime_1.jsx)(Icon_1.default, { name: icon }), (0, jsx_runtime_1.jsxs)(Div_1.default.column, { flex: 1, gap: theme.styles.gap / 2, children: [(0, jsx_runtime_1.jsx)(Text_1.default, { as: "h3", children: title }), description && (0, jsx_runtime_1.jsx)(Text_1.default, { color: theme.colors.textSecondary, children: description })] })] }), (0, jsx_runtime_1.jsxs)(Div_1.default.row, { width: "100%", alignItems: "center", gap: theme.styles.gap, children: [children, withActions && ((0, jsx_runtime_1.jsxs)(Div_1.default.row, { alignItems: "center", gap: theme.styles.gap, children: [onClickReset && (0, jsx_runtime_1.jsx)(Button_1.default.icon, { icon: "XMark", onClick: onClickReset }), (0, jsx_runtime_1.jsx)(Button_1.default.icon, { icon: "check", onClick: onClickSave })] }))] })] }));
23
+ return ((0, jsx_runtime_1.jsxs)(FormRowComponent, { ...props, ref: ref, children: [(0, jsx_runtime_1.jsxs)(Div_1.default.row, { width: "100%", alignItems: "center", gap: theme.styles.space, children: [icon && (0, jsx_runtime_1.jsx)(Icon_1.default, { name: icon }), (0, jsx_runtime_1.jsxs)(Div_1.default.column, { flex: 1, gap: theme.styles.gap / 2, children: [(0, jsx_runtime_1.jsx)(Text_1.default, { as: "h3", children: title }), description && (0, jsx_runtime_1.jsx)(Text_1.default, { color: theme.colors.textSecondary, children: description })] })] }), (0, jsx_runtime_1.jsxs)(Div_1.default.row, { width: "100%", alignItems: "center", gap: theme.styles.gap, children: [children, withActions && ((0, jsx_runtime_1.jsxs)(Div_1.default.row, { alignItems: "center", gap: theme.styles.gap, children: [onClickReset && ((0, jsx_runtime_1.jsx)(Button_1.default.icon, { icon: "XMark", loaderName: resetButtonLoaderName, onClick: onClickReset })), (0, jsx_runtime_1.jsx)(Button_1.default.icon, { icon: "check", loaderName: saveButtonLoaderName, onClick: onClickSave })] }))] })] }));
24
24
  });
25
25
  const FormRow = (0, react_1.memo)(FormRowComponent);
26
26
  FormRow.withTitle = FormRowComponent.withTitle;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-better-html",
3
- "version": "1.1.54",
3
+ "version": "1.1.55",
4
4
  "description": "A component library for react that is as close to plane html as possible",
5
5
  "main": "dist/index.js",
6
6
  "files": [