@arthurzakharov/ui-kit 1.9.4 → 1.9.5

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.
@@ -0,0 +1 @@
1
+ ._FormRow_qe4e4_1{display:flex;flex-direction:column;align-items:stretch}._XXS_qe4e4_7{gap:var(--rm-ui-padding-xxs)}._XS_qe4e4_11{gap:var(--rm-ui-padding-xs)}._SM_qe4e4_15{gap:var(--rm-ui-padding-sm)}._MD_qe4e4_19{gap:var(--rm-ui-padding-md)}._LG_qe4e4_23,._XL_qe4e4_27{gap:var(--rm-ui-padding-xl)}._XXL_qe4e4_31{gap:var(--rm-ui-padding-xxl)}._XXXL_qe4e4_35{gap:var(--rm-ui-padding-xxxl)}._Child_qe4e4_39{flex-grow:1}@media screen and (min-width:768px){._FormRow_qe4e4_1{flex-direction:row}._Child_qe4e4_39[data-children-quantity="1"]{width:100%}._Child_qe4e4_39[data-children-quantity="2"]{width:50%}._Child_qe4e4_39[data-children-quantity="3"]{width:calc(100% / 3)}._Child_qe4e4_39[data-children-quantity="4"]{width:25%}._Child_qe4e4_39[data-width="1"]{width:100%}._Child_qe4e4_39[data-width="1/2"]{width:50%}._Child_qe4e4_39[data-width="1/3"]{width:calc(100% / 3)}._Child_qe4e4_39[data-width="2/3"]{width:calc(200% / 3)}._Child_qe4e4_39[data-width="1/4"]{width:25%}._Child_qe4e4_39[data-width="2/4"]{width:50%}._Child_qe4e4_39[data-width="3/4"]{width:75%}}
@@ -1,6 +1,23 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { Base, Size } from '../../utils/types';
3
+ export type FormRowWidth = '1/2' | '1/3' | '2/3' | '1/4' | '2/4' | '3/4' | '1';
3
4
  export interface FormRowProps extends PropsWithChildren<Base> {
4
5
  gap: Size;
6
+ /**
7
+ * Force the desktop width of each child individually.
8
+ *
9
+ * Pass an array of fractions, one per valid child, in order. Supported values
10
+ * cover every valid fraction of a four-column grid:
11
+ * `'1/2'`, `'1/3'`, `'2/3'`, `'1/4'`, `'2/4'`, `'3/4'` and `'1'`.
12
+ *
13
+ * If the array length does not match the number of valid children, the array
14
+ * contains an unknown value, or the fractions sum to more than 1, a warning
15
+ * is logged and the prop is ignored — the row falls back to the default
16
+ * behaviour where all children share the row width equally.
17
+ *
18
+ * On mobile (< 768px) the row stacks vertically as usual; this prop only
19
+ * affects the desktop layout.
20
+ */
21
+ widths?: FormRowWidth[];
5
22
  }
6
- export declare const FormRow: ({ children, gap, ...base }: FormRowProps) => import("react/jsx-runtime").JSX.Element | null;
23
+ export declare const FormRow: ({ children, gap, widths, ...base }: FormRowProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,35 +1,70 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import { Children as _, isValidElement as m } from "react";
3
- import c from "clsx";
4
- import { baseProps as n } from "../../utils/functions/functions.util.js";
5
- import '../../assets/form-row-C_CTS-Xj.css';const i = "_FormRow_v16lb_1", L = "_XXS_v16lb_7", d = "_XS_v16lb_11", e = "_SM_v16lb_15", v = "_MD_v16lb_19", x = "_LG_v16lb_23", S = "_XL_v16lb_27", b = "_XXL_v16lb_31", u = "_XXXL_v16lb_35", a = "_Child_v16lb_39", o = {
6
- FormRow: i,
7
- XXS: L,
8
- XS: d,
9
- SM: e,
10
- MD: v,
1
+ import { jsx as X } from "react/jsx-runtime";
2
+ import { Children as d, isValidElement as u } from "react";
3
+ import f from "clsx";
4
+ import { baseProps as _ } from "../../utils/functions/functions.util.js";
5
+ import '../../assets/form-row-BIcA2L8w.css';const L = "_FormRow_qe4e4_1", w = "_XXS_qe4e4_7", q = "_XS_qe4e4_11", S = "_SM_qe4e4_15", F = "_MD_qe4e4_19", x = "_LG_qe4e4_23", v = "_XL_qe4e4_27", b = "_XXL_qe4e4_31", M = "_XXXL_qe4e4_35", R = "_Child_qe4e4_39", e = {
6
+ FormRow: L,
7
+ XXS: w,
8
+ XS: q,
9
+ SM: S,
10
+ MD: F,
11
11
  LG: x,
12
- XL: S,
12
+ XL: v,
13
13
  XXL: b,
14
- XXXL: u,
15
- Child: a
16
- }, C = ({ children: t, gap: X = "sm", ...l }) => _.count(t) === 0 ? null : /* @__PURE__ */ r(
17
- "div",
18
- {
19
- "data-testid": n(l, "data-testid", "form-row"),
20
- className: c(o.FormRow, n(l, "className"), {
21
- [o.XXS]: X === "xxs",
22
- [o.XS]: X === "xs",
23
- [o.SM]: X === "sm",
24
- [o.MD]: X === "md",
25
- [o.LG]: X === "lg",
26
- [o.XL]: X === "xl",
27
- [o.XXL]: X === "xxl",
28
- [o.XXXL]: X === "xxxl"
29
- }),
30
- children: _.map(t, (s) => m(s) ? /* @__PURE__ */ r("div", { "data-children-quantity": _.count(t), className: o.Child, children: s }) : null)
31
- }
32
- );
14
+ XXXL: M,
15
+ Child: R
16
+ }, r = {
17
+ 1: 12,
18
+ "1/2": 6,
19
+ "1/3": 4,
20
+ "2/3": 8,
21
+ "1/4": 3,
22
+ "2/4": 6,
23
+ "3/4": 9
24
+ }, k = r[1], j = ({ children: i, gap: o = "sm", widths: t, ...a }) => {
25
+ if (d.count(i) === 0) return null;
26
+ const l = d.toArray(i).filter(u);
27
+ let c = !1;
28
+ if (t)
29
+ if (t.length !== l.length)
30
+ console.warn(
31
+ `[FormRow] \`widths\` length (${t.length}) does not match the number of children (${l.length}). Falling back to default equal-width behaviour.`
32
+ );
33
+ else {
34
+ const s = t.find((n) => !(n in r));
35
+ s !== void 0 ? console.warn(
36
+ `[FormRow] \`widths\` contains unknown value "${s}". Supported values are: ${Object.keys(r).join(", ")}. Falling back to default equal-width behaviour.`
37
+ ) : t.reduce((m, h) => m + r[h], 0) > k ? console.warn(
38
+ `[FormRow] \`widths\` total (${t.join(" + ")}) exceeds 1. Falling back to default equal-width behaviour.`
39
+ ) : c = !0;
40
+ }
41
+ return /* @__PURE__ */ X(
42
+ "div",
43
+ {
44
+ "data-testid": _(a, "data-testid", "form-row"),
45
+ className: f(e.FormRow, _(a, "className"), {
46
+ [e.XXS]: o === "xxs",
47
+ [e.XS]: o === "xs",
48
+ [e.SM]: o === "sm",
49
+ [e.MD]: o === "md",
50
+ [e.LG]: o === "lg",
51
+ [e.XL]: o === "xl",
52
+ [e.XXL]: o === "xxl",
53
+ [e.XXXL]: o === "xxxl"
54
+ }),
55
+ children: l.map((s, n) => /* @__PURE__ */ X(
56
+ "div",
57
+ {
58
+ "data-children-quantity": l.length,
59
+ "data-width": c ? t[n] : void 0,
60
+ className: e.Child,
61
+ children: s
62
+ },
63
+ n
64
+ ))
65
+ }
66
+ );
67
+ };
33
68
  export {
34
- C as FormRow
69
+ j as FormRow
35
70
  };
package/dist/main.d.ts CHANGED
@@ -31,7 +31,7 @@ export { Dialog, type DialogProps, type DialogSize, type DialogPosition } from '
31
31
  export { DialogArticle } from './components/dialog-article';
32
32
  export { Expenses, type ExpensesProps } from './components/expenses';
33
33
  export { Footer, type FooterProps } from './components/footer';
34
- export { FormRow, type FormRowProps } from './components/form-row/form-row.component';
34
+ export { FormRow, type FormRowProps, type FormRowWidth } from './components/form-row/form-row.component';
35
35
  export { Header, type HeaderProps, type HeaderDescription } from './components/header/header.component';
36
36
  export { InfoPanel, type InfoPanelProps } from './components/info-panel';
37
37
  export { Information } from './components/information';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arthurzakharov/ui-kit",
3
3
  "private": false,
4
- "version": "1.9.4",
4
+ "version": "1.9.5",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
7
7
  "types": "dist/main.d.ts",
@@ -1 +0,0 @@
1
- ._FormRow_v16lb_1{display:flex;flex-direction:column;align-items:stretch}._XXS_v16lb_7{gap:var(--rm-ui-padding-xxs)}._XS_v16lb_11{gap:var(--rm-ui-padding-xs)}._SM_v16lb_15{gap:var(--rm-ui-padding-sm)}._MD_v16lb_19{gap:var(--rm-ui-padding-md)}._LG_v16lb_23,._XL_v16lb_27{gap:var(--rm-ui-padding-xl)}._XXL_v16lb_31{gap:var(--rm-ui-padding-xxl)}._XXXL_v16lb_35{gap:var(--rm-ui-padding-xxxl)}._Child_v16lb_39{flex-grow:1}@media screen and (min-width:768px){._FormRow_v16lb_1{flex-direction:row}._Child_v16lb_39[data-children-quantity="1"]{width:100%}._Child_v16lb_39[data-children-quantity="2"]{width:50%}._Child_v16lb_39[data-children-quantity="3"]{width:calc(100% / 3)}._Child_v16lb_39[data-children-quantity="4"]{width:25%}}