@hortiview/shared-components 2.26.1 → 2.26.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/CHANGELOG.md CHANGED
@@ -1,19 +1,8 @@
1
- ## [2.26.1](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v2.26.0...v2.26.1) (2026-05-22)
2
-
3
- ### Bug Fixes
4
-
5
- * add permission provider to broken stories ([6677f7f](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/6677f7fb9cfc4b5e256ea16fce429b95348f55d0))
6
- * add workaround for element bug on textKey = 'value' and multiSelect = true ([4926a72](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/4926a726b75b422f6f7bd8cacf71b86565d32b14))
7
- * fix search functionality on multi select component ([5a01163](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/5a011636eeef5c5296d2959a1307425256fed706))
1
+ ## [2.26.2](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v2.26.1...v2.26.2) (2026-05-26)
8
2
 
9
3
  ### Code Refactoring
10
4
 
11
- * improve title and label of FormSelect story ([29d6f78](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/29d6f780eefce628d459af1d7773b79a0af553dd))
12
-
13
- ### Styles
14
-
15
- * improve positioning of search cursor in multi select ([d71bff9](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/d71bff9f3abda3a3a3466bb16850b67f3aa11bfc))
16
- * improve stories by adding width ([de089f8](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/de089f84d720f6bd47b1b22900259f007d6b1a1e))
5
+ * adjust BlockView size props, minor styling achanges ([c2dca99](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/c2dca9979c41025c00a14330094aea081cc44c23)), closes [#20844](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/issues/20844)
17
6
 
18
7
  ## [2.26.1](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v2.26.0...v2.26.1) (2026-05-22)
19
8
 
@@ -1 +1 @@
1
- ._grid_gfk3g_1{display:flex;padding-bottom:0;flex-direction:column;justify-content:center;align-items:center;gap:1rem;align-self:stretch}._blockLayout_gfk3g_11{padding:.5rem;gap:.5rem;display:flex;flex-direction:column;border-radius:.5rem;background:var(--lmnt-theme-secondary-100);width:15rem;height:15rem}._blockRow_gfk3g_22{display:flex;flex-direction:row;gap:.5rem;height:100%;align-self:stretch}._block_gfk3g_11{flex:auto;border-radius:.25rem;background:var(--lmnt-theme-secondary);align-items:center;display:flex;justify-content:center;position:relative}._block_gfk3g_11._active_gfk3g_41{background:var(--lmnt-theme-primary);margin:-2px}._block_gfk3g_11._error_gfk3g_46{border:2px solid var(--lmnt-theme-danger);background:var(--lmnt-theme-danger-50);margin:-2px}._block_gfk3g_11._empty_gfk3g_52{background:var(--lmnt-theme-secondary-200);cursor:default}._activeBlock_gfk3g_57{background:var(--lmnt-theme-primary)}._block_gfk3g_11._clickable_gfk3g_61{cursor:pointer}._blockText_gfk3g_65{display:flex;justify-content:center;position:absolute;width:1vw;height:1vh;align-items:center;color:var(--lmnt-theme-on-primary)}._emptyLayout_gfk3g_75{display:flex;justify-content:center;align-items:center;background:var(--lmnt-theme-surface-variant);border-radius:.5rem}
1
+ ._grid_otqrz_1{display:flex;padding-bottom:0;flex-direction:column;justify-content:center;align-items:center;gap:1rem;align-self:stretch;height:100%}._blockLayout_otqrz_13{padding:.5rem;gap:.5rem;display:flex;flex-direction:column;border-radius:.5rem;background:var(--lmnt-theme-secondary-100)}._absoluteSize_otqrz_22{height:15rem;width:15rem}._relativeSize_otqrz_27{height:70%;width:50%;max-height:50vh;max-width:50vw;min-height:10rem;min-width:10rem}._relativeSize_otqrz_27._mobile_otqrz_38{height:70%;width:60%;max-height:50vh;max-width:75vw}._blockRow_otqrz_46{display:flex;flex-direction:row;gap:.5rem;height:100%;align-self:stretch}._block_otqrz_13{flex:auto;justify-content:center;border-radius:.25rem;background:var(--lmnt-theme-secondary);align-items:center;display:flex;position:relative;-webkit-tap-highlight-color:transparent;transition:background .2s ease-in-out,box-shadow .2s ease-in-out,transform .2s ease-in-out}._block_otqrz_13._clickable_otqrz_70{cursor:pointer}._block_otqrz_13._empty_otqrz_74{background:var(--lmnt-theme-secondary-200);cursor:default}._block_otqrz_13._active_otqrz_79{background:var(--lmnt-theme-primary)}._block_otqrz_13._error_otqrz_83{box-shadow:inset 0 0 0 3px var(--lmnt-theme-danger)}._block_otqrz_13._hoverEffects_otqrz_87._active_otqrz_79:hover{background:var(--lmnt-theme-primary-600)}._block_otqrz_13._hoverEffects_otqrz_87._clickable_otqrz_70:hover:not(._active_otqrz_79){background:var(--lmnt-theme-secondary-500)}._block_otqrz_13._hoverEffects_otqrz_87._clickable_otqrz_70:hover{transform:scale(1.02)}._blockText_otqrz_99{display:flex;justify-content:center;position:absolute;width:1vw;height:1vh;align-items:center;color:var(--lmnt-theme-on-primary)}._emptyLayout_otqrz_109{display:flex;justify-content:center;align-items:center;background:var(--lmnt-theme-surface-variant);border-radius:.5rem}
@@ -47,9 +47,15 @@ type BlockViewProps<T extends Block & {
47
47
  */
48
48
  clickable?: boolean;
49
49
  /**
50
- * the size of the block in rem (default is 15x15)
50
+ * Set the size for the block view
51
+ * @remarks
52
+ * - 'absolute' - For containers without fixed dimensions (size depending on content) </br>Uses: { height: '15rem', width: '15rem' }
53
+ * - 'relative' - For containers with fixed size constraints (like modals with fixed dimensions) </br>Uses: { height: '70%', width: '50%' }
54
+ * - IMPORTANT: For 'relative' the parent container of the BlockView needs to have a fixed height and width. Otherwise you'll run into css issues
55
+ *
56
+ * @default 'absolute'
51
57
  */
52
- size?: number;
58
+ size?: 'absolute' | 'relative';
53
59
  /**
54
60
  * the title of the block view, shown when `hideText` is false
55
61
  */
@@ -1,95 +1,98 @@
1
- import { jsxs as f, jsx as o, Fragment as v } from "react/jsx-runtime";
2
- import { c as D, b as S, a as F } from "../../index.es-EXzC8zuP.js";
3
- import { c as M } from "../../index-_-9ybP20.js";
4
- import { useState as V, useEffect as q, useMemo as G } from "react";
1
+ import { jsxs as z, jsx as o, Fragment as q } from "react/jsx-runtime";
2
+ import { c as A, b as F, a as M } from "../../index.es-EXzC8zuP.js";
3
+ import { c as h } from "../../index-_-9ybP20.js";
4
+ import { useState as V, useEffect as $, useMemo as G } from "react";
5
5
  import { getBlockNumberByDto as H } from "../../services/BlockService.js";
6
- import '../../assets/BlockView.css';const I = "_grid_gfk3g_1", J = "_blockLayout_gfk3g_11", K = "_blockRow_gfk3g_22", O = "_block_gfk3g_11", P = "_active_gfk3g_41", Q = "_error_gfk3g_46", U = "_empty_gfk3g_52", W = "_activeBlock_gfk3g_57", X = "_clickable_gfk3g_61", Y = "_blockText_gfk3g_65", Z = "_emptyLayout_gfk3g_75", t = {
7
- grid: I,
8
- blockLayout: J,
9
- blockRow: K,
10
- block: O,
11
- active: P,
12
- error: Q,
13
- empty: U,
14
- activeBlock: W,
6
+ import { useBreakpoints as I } from "../../hooks/useBreakpoints.js";
7
+ import '../../assets/BlockView.css';const J = "_grid_otqrz_1", K = "_blockLayout_otqrz_13", O = "_absoluteSize_otqrz_22", P = "_relativeSize_otqrz_27", Q = "_mobile_otqrz_38", U = "_blockRow_otqrz_46", W = "_block_otqrz_13", X = "_clickable_otqrz_70", Y = "_empty_otqrz_74", Z = "_active_otqrz_79", j = "_error_otqrz_83", tt = "_hoverEffects_otqrz_87", ot = "_blockText_otqrz_99", et = "_emptyLayout_otqrz_109", t = {
8
+ grid: J,
9
+ blockLayout: K,
10
+ absoluteSize: O,
11
+ relativeSize: P,
12
+ mobile: Q,
13
+ blockRow: U,
14
+ block: W,
15
15
  clickable: X,
16
- blockText: Y,
17
- emptyLayout: Z
18
- }, rt = ({
16
+ empty: Y,
17
+ active: Z,
18
+ error: j,
19
+ hoverEffects: tt,
20
+ blockText: ot,
21
+ emptyLayout: et
22
+ }, bt = ({
19
23
  rows: e,
20
- columns: c,
21
- hideText: h = !1,
22
- hideBlockCountText: w = !1,
23
- errorBlocks: N = [],
24
+ columns: r,
25
+ hideText: w = !1,
26
+ hideBlockCountText: N = !1,
27
+ errorBlocks: g = [],
24
28
  showNumbers: x = !0,
25
- clickable: b = !0,
26
- size: _ = 15,
27
- onClick: u = null,
28
- currentBlock: a,
29
- activeBlocks: g,
29
+ clickable: d = !1,
30
+ size: k = "absolute",
31
+ onClick: p = null,
32
+ currentBlock: s,
33
+ activeBlocks: v,
30
34
  blocks: m,
31
- blockViewTitle: L,
32
- blockLabel: T,
33
- emptyViewTitle: B
35
+ blockViewTitle: S,
36
+ blockLabel: E,
37
+ emptyViewTitle: L
34
38
  }) => {
35
- const [C, y] = V(0);
36
- q(() => {
37
- if (!a) return;
38
- const l = H(a, c);
39
- y(l);
40
- }, [a, c]);
41
- const E = G(() => e * c, [e, c]), R = (l) => {
42
- u && u(l, a ?? void 0);
43
- }, $ = ({ row: l, column: r }) => m.length === 0 ? !0 : m.some((d) => d.position?.row === l && d.position?.column === r), p = !e && !c;
44
- return /* @__PURE__ */ f("div", { "data-testid": "block-view-container", className: t.grid, children: [
45
- !h && /* @__PURE__ */ o(D, { level: 1, bold: !0, className: t.black, children: L }),
39
+ const [T, y] = V(0), { isDesktop: f } = I();
40
+ $(() => {
41
+ if (!s) return;
42
+ const c = H(s, r);
43
+ y(c);
44
+ }, [s, r]);
45
+ const C = G(() => e * r, [e, r]), R = (c) => {
46
+ p && p(c, s ?? void 0);
47
+ }, B = ({ row: c, column: i }) => m.length === 0 ? !0 : m.some((u) => u.position?.row === c && u.position?.column === i), _ = !e && !r;
48
+ return /* @__PURE__ */ z("div", { "data-testid": "block-view-container", className: t.grid, children: [
49
+ !w && /* @__PURE__ */ o(A, { level: 1, bold: !0, className: t.black, children: S }),
46
50
  /* @__PURE__ */ o(
47
51
  "div",
48
52
  {
49
53
  "data-testid": "block-view-layout",
50
- className: p ? t.emptyLayout : t.blockLayout,
51
- style: { width: `${_}rem`, height: `${_}rem` },
52
- children: p ? /* @__PURE__ */ o(j, { emptyViewTitle: B }) : /* @__PURE__ */ o(v, { children: Array.from({ length: e }).map((l, r) => /* @__PURE__ */ o("div", { "data-testid": "block-view-row", className: t.blockRow, children: Array.from({ length: c }).map((d, s) => {
53
- const i = c * r + s + 1, n = $({ row: r + 1, column: s + 1 }), A = M(
54
+ className: h(
55
+ _ && t.emptyLayout,
56
+ !_ && t.blockLayout,
57
+ k === "absolute" && t.absoluteSize,
58
+ k === "relative" && t.relativeSize,
59
+ !f && t.mobile
60
+ ),
61
+ children: _ ? /* @__PURE__ */ o(rt, { emptyViewTitle: L }) : /* @__PURE__ */ o(q, { children: Array.from({ length: e }).map((c, i) => /* @__PURE__ */ o("div", { "data-testid": "block-view-row", className: t.blockRow, children: Array.from({ length: r }).map((u, a) => {
62
+ const l = r * i + a + 1, n = B({ row: i + 1, column: a + 1 }), D = h(
54
63
  t.block,
55
- b && n && t.clickable,
56
- C === i && t.active,
64
+ f && t.hoverEffects,
65
+ d && n && t.clickable,
66
+ T === l && t.active,
57
67
  !n && t.empty,
58
- N.includes(i) && t.error,
59
- g && m.some(
60
- (k) => k.id && g.includes(k.id) && k.position?.row === r + 1 && k.position?.column === s + 1
61
- ) && t.activeBlock
68
+ g.includes(l) && t.error,
69
+ v && m.some(
70
+ (b) => b.id && v.includes(b.id) && b.position?.row === i + 1 && b.position?.column === a + 1
71
+ ) && t.active
62
72
  );
63
73
  return /* @__PURE__ */ o(
64
74
  "div",
65
75
  {
66
76
  "data-testid": "block-view-block",
67
- className: A,
68
- id: `block${i}`,
69
- onClick: b && n ? () => {
70
- y(i), R({ row: r + 1, column: s + 1 });
77
+ className: D,
78
+ id: `block${l}`,
79
+ onClick: d && n ? () => {
80
+ y(l), R({ row: i + 1, column: a + 1 });
71
81
  } : void 0,
72
- children: x && n && /* @__PURE__ */ o(
73
- "div",
74
- {
75
- "data-testid": "block-view-block-number",
76
- className: t.blockText,
77
- children: i
78
- }
79
- )
82
+ children: x && n && /* @__PURE__ */ o("div", { "data-testid": "block-view-block-number", className: t.blockText, children: l })
80
83
  },
81
- i
84
+ l
82
85
  );
83
- }) }, r)) })
86
+ }) }, i)) })
84
87
  }
85
88
  ),
86
- !w && /* @__PURE__ */ f(S, { themeColor: "primary", level: 6, children: [
87
- E,
89
+ !N && /* @__PURE__ */ z(F, { themeColor: "primary", level: 6, children: [
90
+ C,
88
91
  " ",
89
- T
92
+ E
90
93
  ] })
91
94
  ] });
92
- }, j = ({ emptyViewTitle: e }) => e ? /* @__PURE__ */ o(F, { bold: !0, children: e }) : /* @__PURE__ */ o(v, {});
95
+ }, rt = ({ emptyViewTitle: e }) => e ? /* @__PURE__ */ o(M, { bold: !0, children: e }) : /* @__PURE__ */ o(q, {});
93
96
  export {
94
- rt as BlockView
97
+ bt as BlockView
95
98
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hortiview/shared-components",
3
3
  "description": "This is a shared component library. It should used in the HortiView platform and its modules.",
4
- "version": "2.26.1",
4
+ "version": "2.26.2",
5
5
  "type": "module",
6
6
  "repository": "https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared",
7
7
  "author": "Falk Menge <falk.menge.ext@bayer.com>",