@webority/ui-react 0.8.1 → 0.8.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.
package/README.md CHANGED
@@ -20,4 +20,4 @@ import { AppButton } from '@webority/ui-react';
20
20
  <AppButton variant="primary">Save changes</AppButton>;
21
21
  ```
22
22
 
23
- Component catalogue: <https://ui.webority.dev>
23
+ Component catalogue: <https://ui-react.webority.dev>
@@ -15,13 +15,17 @@
15
15
  * @param {'plain'|'filled'|'accent'|'spotlight'} [props.variant='plain'] The tile surface/layout:
16
16
  * plain (today's bordered card), filled (a subtle surface fill), accent (a brand-tinted fill),
17
17
  * spotlight (editorial feature tile — icon pinned top-right, serif value, caption below).
18
- * @param {'md'|'lg'} [props.size='md'] Tile scale: md (default), lg (a hero tile with an
19
- * enlarged value — for the single headline stat above a dashboard).
18
+ * @param {'sm'|'md'|'lg'} [props.size='md'] Tile scale: sm (compact), md (default), lg (a hero
19
+ * tile with an enlarged value — for the single headline stat above a dashboard).
20
+ * @param {number} [props.valueSize] Custom value ("main heading") font-size in px. Overrides the
21
+ * size/variant default — use it to tame a too-large headline (e.g. the spotlight serif).
20
22
  * @param {boolean} [props.inline=false] Put the icon beside the text instead of above it.
21
23
  * @param {boolean} [props.attention=false] Marks the tile as needing action (warning-tinted).
22
24
  * @param {string} [props.href] Renders the whole tile as a link to this URL.
23
25
  * @param {import('react').ElementType} [props.linkComponent] Router link; receives `to` instead of `href`.
24
26
  * @param {string} [props.className] Extra class(es) on the tile root.
27
+ * @param {import('react').CSSProperties} [props.style] Inline style on the tile root; the
28
+ * `valueSize` var is merged into it.
25
29
  * @param {string} [props.iconClassName] Extra class(es) on the icon chip.
26
30
  * @param {string} [props.labelClassName] Extra class(es) on the label.
27
31
  * @param {string} [props.valueClassName] Extra class(es) on the value.
@@ -29,7 +33,7 @@
29
33
  * @param {string} [props.deltaClassName] Extra class(es) on the delta.
30
34
  * @param {string} [props.sparklineClassName] Extra class(es) on the sparkline.
31
35
  */
32
- export default function AppKpiTile({ label, value, caption, icon, iconTone, delta, deltaDirection, sparkline, variant, size, inline, attention, href, linkComponent: Link, className, iconClassName, labelClassName, valueClassName, captionClassName, deltaClassName, sparklineClassName, ...rest }: {
36
+ export default function AppKpiTile({ label, value, caption, icon, iconTone, delta, deltaDirection, sparkline, variant, size, valueSize, inline, attention, href, linkComponent: Link, className, style, iconClassName, labelClassName, valueClassName, captionClassName, deltaClassName, sparklineClassName, ...rest }: {
33
37
  label: string;
34
38
  value: import('react').ReactNode;
35
39
  caption?: import('react').ReactNode;
@@ -39,12 +43,14 @@ export default function AppKpiTile({ label, value, caption, icon, iconTone, delt
39
43
  deltaDirection?: 'up' | 'down' | 'flat';
40
44
  sparkline?: number[];
41
45
  variant?: 'plain' | 'filled' | 'accent' | 'spotlight';
42
- size?: 'md' | 'lg';
46
+ size?: 'sm' | 'md' | 'lg';
47
+ valueSize?: number;
43
48
  inline?: boolean;
44
49
  attention?: boolean;
45
50
  href?: string;
46
51
  linkComponent?: import('react').ElementType;
47
52
  className?: string;
53
+ style?: import('react').CSSProperties;
48
54
  iconClassName?: string;
49
55
  labelClassName?: string;
50
56
  valueClassName?: string;
@@ -23,6 +23,9 @@
23
23
  * @param {boolean} [props.required=false]
24
24
  * @param {string} [props.error]
25
25
  * @param {string} [props.hint]
26
+ * @param {import('react').ReactNode} [props.help] Content for the label info-tip (decoupled:
27
+ * the caller supplies the node; a glossary-backed app wraps its lookup here). Mirrors AppInput.
28
+ * @param {string} [props.helpLabel="More information"] aria-label for the info-tip button.
26
29
  * @param {number} [props.min] Minimum value (inclusive)
27
30
  * @param {number} [props.max] Maximum value (inclusive)
28
31
  * @param {number} [props.step=1] Increment by this amount
package/dist/ui-react.js CHANGED
@@ -13,7 +13,7 @@ function j(e, t) {
13
13
  if (!(!O() || !t) && !("as" in t)) for (let n of Object.keys(t)) {
14
14
  if (k(n) || D.has(n)) continue;
15
15
  let t = `${e}.${n}`;
16
- A.has(t) || (A.add(t), console.warn(`[@webority/ui-react] <${e}> received an unknown prop "${n}". It is not part of the component's API and is not a valid HTML attribute, so it will either be dropped or land on the DOM — check the prop name against the component catalogue at https://ui.webority.dev.`));
16
+ A.has(t) || (A.add(t), console.warn(`[@webority/ui-react] <${e}> received an unknown prop "${n}". It is not part of the component's API and is not a valid HTML attribute, so it will either be dropped or land on the DOM — check the prop name against the component catalogue at https://ui-react.webority.dev.`));
17
17
  }
18
18
  }
19
19
  //#endregion
@@ -3104,7 +3104,7 @@ var We = class extends HTMLElement {
3104
3104
  this.innerHTML = `
3105
3105
  <div class="phone-input-wrap">
3106
3106
  <div class="phone-country-adornment">
3107
- <button type="button" class="country-toggle" aria-haspopup="listbox" aria-expanded="false" aria-controls="${Ge(t)}"${this.hasAttribute("disabled") ? " disabled" : ""}>
3107
+ <button type="button" class="country-toggle" aria-label="Choose country" aria-haspopup="listbox" aria-expanded="false" aria-controls="${Ge(t)}"${this.hasAttribute("disabled") ? " disabled" : ""}>
3108
3108
  <span class="${Ie(this._country)}" data-flag aria-hidden="true"></span>
3109
3109
  <i class="bi bi-chevron-down phone-chevron" aria-hidden="true"></i>
3110
3110
  <span class="phone-dial" data-dial>+${Fe(this._country)}</span>
@@ -6477,45 +6477,49 @@ function Yn(e) {
6477
6477
  let t = e.trim();
6478
6478
  return t.startsWith("+") ? "up" : t.startsWith("-") || t.startsWith("−") ? "down" : "flat";
6479
6479
  }
6480
- function Xn({ label: e, value: t, caption: n, icon: r, iconTone: i, delta: a, deltaDirection: o, sparkline: s, variant: c = "plain", size: l = "md", inline: u = !1, attention: d = !1, href: f, linkComponent: h, className: g = "", iconClassName: _ = "", labelClassName: v = "", valueClassName: y = "", captionClassName: b = "", deltaClassName: x = "", sparklineClassName: S = "", ...C }) {
6481
- j("AppKpiTile", C);
6482
- let w = `kpi${u ? " kpi-inline" : ""}${c === "filled" ? " kpi-filled" : c === "accent" ? " kpi-accent" : c === "spotlight" ? " kpi-spotlight" : ""}${l === "lg" ? " kpi-lg" : ""}${d ? " kpi-attention" : ""}${g ? ` ${g}` : ""}`, T = o ?? Yn(a), E = T === "up" ? "arrow-up" : T === "down" ? "arrow-down" : null, D = {};
6483
- return f != null && (D = h ? {
6484
- as: h,
6485
- to: f
6480
+ function Xn({ label: e, value: t, caption: n, icon: r, iconTone: i, delta: a, deltaDirection: o, sparkline: s, variant: c = "plain", size: l = "md", valueSize: u, inline: d = !1, attention: f = !1, href: h, linkComponent: g, className: _ = "", style: v, iconClassName: y = "", labelClassName: b = "", valueClassName: x = "", captionClassName: S = "", deltaClassName: C = "", sparklineClassName: w = "", ...T }) {
6481
+ j("AppKpiTile", T);
6482
+ let E = `kpi${d ? " kpi-inline" : ""}${c === "filled" ? " kpi-filled" : c === "accent" ? " kpi-accent" : c === "spotlight" ? " kpi-spotlight" : ""}${l === "lg" ? " kpi-lg" : l === "sm" ? " kpi-sm" : ""}${f ? " kpi-attention" : ""}${_ ? ` ${_}` : ""}`, D = typeof u == "number" && u > 0 ? {
6483
+ ...v,
6484
+ "--wui-kpi-value-size": `${u}px`
6485
+ } : v, O = o ?? Yn(a), k = O === "up" ? "arrow-up" : O === "down" ? "arrow-down" : null, A = {};
6486
+ return h != null && (A = g ? {
6487
+ as: g,
6488
+ to: h
6486
6489
  } : {
6487
6490
  as: "a",
6488
- href: f
6489
- }), /* @__PURE__ */ m(D.as || "div", {
6490
- className: w,
6491
- ...C,
6492
- ...D,
6491
+ href: h
6492
+ }), /* @__PURE__ */ m(A.as || "div", {
6493
+ className: E,
6494
+ style: D,
6495
+ ...T,
6496
+ ...A,
6493
6497
  children: [
6494
6498
  r && /* @__PURE__ */ p("span", {
6495
- className: `kpi-icon${i ? ` kpi-icon-${i}` : ""}${_ ? ` ${_}` : ""}`,
6499
+ className: `kpi-icon${i ? ` kpi-icon-${i}` : ""}${y ? ` ${y}` : ""}`,
6496
6500
  children: L(r, { size: 20 })
6497
6501
  }),
6498
6502
  /* @__PURE__ */ p("div", {
6499
- className: `kpi-label${v ? ` ${v}` : ""}`,
6503
+ className: `kpi-label${b ? ` ${b}` : ""}`,
6500
6504
  children: e
6501
6505
  }),
6502
6506
  /* @__PURE__ */ p("div", {
6503
- className: `kpi-value${y ? ` ${y}` : ""}`,
6507
+ className: `kpi-value${x ? ` ${x}` : ""}`,
6504
6508
  children: t
6505
6509
  }),
6506
6510
  n && /* @__PURE__ */ p("div", {
6507
- className: `kpi-caption${b ? ` ${b}` : ""}`,
6511
+ className: `kpi-caption${S ? ` ${S}` : ""}`,
6508
6512
  children: n
6509
6513
  }),
6510
6514
  a && /* @__PURE__ */ m("div", {
6511
- className: `kpi-delta${T === "flat" ? "" : ` ${T}`}${x ? ` ${x}` : ""}`,
6512
- children: [E && /* @__PURE__ */ p(I, {
6513
- name: E,
6515
+ className: `kpi-delta${O === "flat" ? "" : ` ${O}`}${C ? ` ${C}` : ""}`,
6516
+ children: [k && /* @__PURE__ */ p(I, {
6517
+ name: k,
6514
6518
  size: 13
6515
6519
  }), a]
6516
6520
  }),
6517
6521
  s && s.length > 0 && /* @__PURE__ */ p("svg", {
6518
- className: `kpi-sparkline${S ? ` ${S}` : ""}`,
6522
+ className: `kpi-sparkline${w ? ` ${w}` : ""}`,
6519
6523
  width: Kn,
6520
6524
  height: qn,
6521
6525
  viewBox: `0 0 ${Kn} ${qn}`,
@@ -6758,91 +6762,95 @@ var rr = i(function({ values: e, onChange: t, options: n, placeholder: r = "Sele
6758
6762
  }) : null
6759
6763
  ]
6760
6764
  });
6761
- }), ir = i(function({ label: e, required: t = !1, error: n, hint: r, value: i, onChange: a, min: c, max: l, step: u = 1, precision: f = 0, unit: h, size: g = "md", id: _, name: v, className: y = "", fieldClassName: b = "", disabled: S = !1, ...C }, w) {
6762
- j("AppNumberInput", C);
6763
- let T = s(), E = _ || T, D = (e) => {
6764
- if (f === 0) return Math.round(e);
6765
- let t = 10 ** f;
6765
+ }), ir = i(function({ label: e, required: t = !1, error: n, hint: r, help: i, helpLabel: a = "More information", value: c, onChange: l, min: u, max: f, step: h = 1, precision: g = 0, unit: _, size: v = "md", id: y, name: b, className: S = "", fieldClassName: C = "", disabled: w = !1, ...T }, E) {
6766
+ j("AppNumberInput", T);
6767
+ let D = s(), O = y || D, k = (e) => {
6768
+ if (g === 0) return Math.round(e);
6769
+ let t = 10 ** g;
6766
6770
  return Math.round(e * t) / t;
6767
- }, O = (e) => {
6771
+ }, A = (e) => {
6768
6772
  let t = e;
6769
- return typeof c == "number" && (t = Math.max(t, c)), typeof l == "number" && (t = Math.min(t, l)), t;
6770
- }, k = (e) => {
6773
+ return typeof u == "number" && (t = Math.max(t, u)), typeof f == "number" && (t = Math.min(t, f)), t;
6774
+ }, M = (e) => {
6771
6775
  if (e === "" || e === null) return null;
6772
6776
  let t = parseFloat(e);
6773
6777
  return Number.isNaN(t) ? null : t;
6774
- }, [A, M] = d(i ?? "");
6778
+ }, [N, P] = d(c ?? "");
6775
6779
  o(() => {
6776
- M(i ?? "");
6777
- }, [i]);
6778
- let N = (e) => {
6779
- let t = (k(A) ?? O(0)) + e * u, n = O(D(t));
6780
- M(String(n)), a?.(n);
6781
- }, P = k(A), F = S || P !== null && typeof c == "number" && P <= c, L = S || P !== null && typeof l == "number" && P >= l, R = n && E ? `${E}-error` : void 0, z = r && E ? `${E}-hint` : void 0, B = R || z, ee = [
6780
+ P(c ?? "");
6781
+ }, [c]);
6782
+ let F = (e) => {
6783
+ let t = (M(N) ?? A(0)) + e * h, n = A(k(t));
6784
+ P(String(n)), l?.(n);
6785
+ }, L = M(N), R = w || L !== null && typeof u == "number" && L <= u, z = w || L !== null && typeof f == "number" && L >= f, B = n && O ? `${O}-error` : void 0, ee = r && O ? `${O}-hint` : void 0, te = B || ee, ne = [
6782
6786
  "input",
6783
- g === "sm" ? "input-sm" : "",
6784
- g === "lg" ? "input-lg" : "",
6787
+ v === "sm" ? "input-sm" : "",
6788
+ v === "lg" ? "input-lg" : "",
6785
6789
  n ? "error" : "",
6786
6790
  "num-input",
6787
- y
6788
- ].filter(Boolean).join(" "), te = (e) => {
6791
+ S
6792
+ ].filter(Boolean).join(" "), re = (e) => {
6789
6793
  let t = e.target.value;
6790
- M(t);
6791
- let n = k(t);
6792
- n !== null && a?.(n);
6793
- }, ne = (e) => {
6794
- let t = k(e.target.value);
6795
- if (t === null) M(""), a?.("");
6794
+ P(t);
6795
+ let n = M(t);
6796
+ n !== null && l?.(n);
6797
+ }, V = (e) => {
6798
+ let t = M(e.target.value);
6799
+ if (t === null) P(""), l?.("");
6796
6800
  else {
6797
- let e = O(D(t));
6798
- M(String(e)), a?.(e);
6801
+ let e = A(k(t));
6802
+ P(String(e)), l?.(e);
6799
6803
  }
6800
- C.onBlur?.(e);
6801
- }, re = (e) => {
6802
- e.key === "ArrowUp" ? (e.preventDefault(), N(1)) : e.key === "ArrowDown" && (e.preventDefault(), N(-1)), C.onKeyDown?.(e);
6803
- }, V = /* @__PURE__ */ p(x.Control, {
6804
- ...C,
6805
- id: E,
6806
- name: v,
6804
+ T.onBlur?.(e);
6805
+ }, ie = (e) => {
6806
+ e.key === "ArrowUp" ? (e.preventDefault(), F(1)) : e.key === "ArrowDown" && (e.preventDefault(), F(-1)), T.onKeyDown?.(e);
6807
+ }, ae = /* @__PURE__ */ p(x.Control, {
6808
+ ...T,
6809
+ id: O,
6810
+ name: b,
6807
6811
  type: "text",
6808
- inputMode: f > 0 ? "decimal" : "numeric",
6809
- className: ee,
6810
- disabled: S,
6812
+ inputMode: g > 0 ? "decimal" : "numeric",
6813
+ className: ne,
6814
+ disabled: w,
6811
6815
  required: t,
6812
6816
  "aria-invalid": n ? "true" : "false",
6813
- "aria-describedby": B,
6814
- value: A,
6815
- ref: w,
6816
- onChange: te,
6817
- onBlur: ne,
6818
- onKeyDown: re
6819
- }), ie = /* @__PURE__ */ m("div", {
6820
- className: "num-wrap",
6817
+ "aria-describedby": te,
6818
+ value: N,
6819
+ ref: E,
6820
+ onChange: re,
6821
+ onBlur: V,
6822
+ onKeyDown: ie
6823
+ }), oe = /* @__PURE__ */ m("div", {
6824
+ className: [
6825
+ "num-wrap",
6826
+ v === "sm" ? "num-wrap-sm" : "",
6827
+ v === "lg" ? "num-wrap-lg" : ""
6828
+ ].filter(Boolean).join(" "),
6821
6829
  children: [
6822
6830
  /* @__PURE__ */ p("button", {
6823
6831
  type: "button",
6824
6832
  className: "num-btn",
6825
6833
  "aria-label": "Decrease",
6826
6834
  tabIndex: -1,
6827
- disabled: F,
6828
- onClick: () => N(-1),
6835
+ disabled: R,
6836
+ onClick: () => F(-1),
6829
6837
  children: /* @__PURE__ */ p(I, {
6830
6838
  name: "minus",
6831
6839
  size: 16
6832
6840
  })
6833
6841
  }),
6834
- V,
6835
- h && /* @__PURE__ */ p("span", {
6842
+ ae,
6843
+ _ && /* @__PURE__ */ p("span", {
6836
6844
  className: "affix",
6837
- children: h
6845
+ children: _
6838
6846
  }),
6839
6847
  /* @__PURE__ */ p("button", {
6840
6848
  type: "button",
6841
6849
  className: "num-btn",
6842
6850
  "aria-label": "Increase",
6843
6851
  tabIndex: -1,
6844
- disabled: L,
6845
- onClick: () => N(1),
6852
+ disabled: z,
6853
+ onClick: () => F(1),
6846
6854
  children: /* @__PURE__ */ p(I, {
6847
6855
  name: "plus",
6848
6856
  size: 16
@@ -6851,21 +6859,28 @@ var rr = i(function({ values: e, onChange: t, options: n, placeholder: r = "Sele
6851
6859
  ]
6852
6860
  });
6853
6861
  return /* @__PURE__ */ m(x.Group, {
6854
- className: `field${b ? ` ${b}` : ""}`,
6862
+ className: `field${C ? ` ${C}` : ""}`,
6855
6863
  children: [
6856
6864
  e && /* @__PURE__ */ m(x.Label, {
6857
6865
  className: "label",
6858
- htmlFor: E,
6859
- children: [e, t && /* @__PURE__ */ p(Z, {})]
6866
+ htmlFor: O,
6867
+ children: [
6868
+ e,
6869
+ t && /* @__PURE__ */ p(Z, {}),
6870
+ i && /* @__PURE__ */ p(St, {
6871
+ label: a,
6872
+ children: i
6873
+ })
6874
+ ]
6860
6875
  }),
6861
- ie,
6876
+ oe,
6862
6877
  n ? /* @__PURE__ */ p("div", {
6863
6878
  className: "field-error",
6864
- id: R,
6879
+ id: B,
6865
6880
  children: n
6866
6881
  }) : r ? /* @__PURE__ */ p("div", {
6867
6882
  className: "field-hint",
6868
- id: z,
6883
+ id: ee,
6869
6884
  children: r
6870
6885
  }) : null
6871
6886
  ]
@@ -7036,36 +7051,38 @@ function sr({ page: e, totalPages: t, onChange: n, siblings: r = 1, size: i = "m
7036
7051
  }
7037
7052
  //#endregion
7038
7053
  //#region src/components/AppPhoneNumberInput.jsx
7039
- var cr = i(function({ value: e, onChange: t, country: n, disabled: r = !1, name: i, label: a = "Phone number", placeholder: o, required: c = !1, error: l, fieldClassName: u = "", ...d }, f) {
7040
- j("AppPhoneNumberInput", d);
7041
- let h = s(), g = i || h, _ = l && g ? `${g}-error` : void 0, { setRef: v } = Q({
7042
- ref: f,
7054
+ var cr = i(function({ value: e, onChange: t, country: n, disabled: r = !1, name: i, label: a = "Phone number", placeholder: o, required: c = !1, error: l, showFlag: u = !0, showDialCode: d = !0, fieldClassName: f = "", ...h }, g) {
7055
+ j("AppPhoneNumberInput", h);
7056
+ let _ = s(), v = i || _, y = l && v ? `${v}-error` : void 0, { setRef: b } = Q({
7057
+ ref: g,
7043
7058
  value: e ?? "",
7044
7059
  onChange: t,
7045
7060
  events: ["input", "change"]
7046
7061
  });
7047
7062
  return /* @__PURE__ */ m("div", {
7048
- className: `field app-phone-number-input${u ? ` ${u}` : ""}`,
7063
+ className: `field app-phone-number-input${f ? ` ${f}` : ""}`,
7049
7064
  children: [
7050
7065
  a && /* @__PURE__ */ m("label", {
7051
7066
  className: "label",
7052
- htmlFor: g,
7067
+ htmlFor: v,
7053
7068
  children: [a, c && /* @__PURE__ */ p(Z, {})]
7054
7069
  }),
7055
7070
  /* @__PURE__ */ p("wui-phone", {
7056
7071
  "aria-label": typeof a == "string" ? a : void 0,
7057
- "aria-describedby": _,
7058
- ref: v,
7072
+ "aria-describedby": y,
7073
+ ref: b,
7059
7074
  name: i,
7060
7075
  country: n,
7061
7076
  placeholder: o,
7062
7077
  required: c ? "" : void 0,
7063
7078
  disabled: r ? "" : void 0,
7064
- ...d
7079
+ "hide-flag": u ? void 0 : "",
7080
+ "hide-dial": d ? void 0 : "",
7081
+ ...h
7065
7082
  }),
7066
7083
  l && /* @__PURE__ */ p("div", {
7067
7084
  className: "field-error",
7068
- id: _,
7085
+ id: y,
7069
7086
  children: l
7070
7087
  })
7071
7088
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/ui-react",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "Webority shared React component library — App* primitives on react-bootstrap + the @webority/theme design system.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
@@ -28,8 +28,8 @@
28
28
  },
29
29
  "sideEffects": false,
30
30
  "dependencies": {
31
- "@webority/theme": "^0.8.1",
32
- "@webority/ui-elements": "^0.8.1"
31
+ "@webority/theme": "^0.8.2",
32
+ "@webority/ui-elements": "^0.8.2"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "bootstrap": "5.3.3",