@hortiview/shared-components 1.0.1 → 1.1.0

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,3 +1,17 @@
1
+ # [1.1.0](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v1.0.1...v1.1.0) (2025-03-26)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * helpertext does not display form error correctly ([2fb2bcd](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/2fb2bcda65e0172e4b278345a975ed077f8ce926))
7
+ * validation of date values ([380e4cf](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/380e4cffcc8c9547f2c7886f7752b32d5d4f11e8))
8
+
9
+
10
+ ### Features
11
+
12
+ * add emptyView description to BlockViewComponent ([403fad8](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/403fad8ce3307e3f7f5a07fb54ac81d15fd608e2))
13
+ * add emtpy view to block view ([45a2045](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/45a204586211b42323be1a3cd5988ac5d57caf4c))
14
+
1
15
  ## [1.0.1](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v1.0.0...v1.0.1) (2025-03-25)
2
16
 
3
17
 
@@ -1 +1 @@
1
- ._grid_lihp2_1{display:flex;padding-bottom:0;flex-direction:column;justify-content:center;align-items:center;gap:1rem;align-self:stretch}._black_lihp2_11{color:#000}._blockLayout_lihp2_15{padding:.5rem;gap:.5rem;display:flex;flex-direction:column;border-radius:.5rem;background:var(--lmnt-theme-secondary-200);width:15rem;height:15rem}._blockRow_lihp2_27{display:flex;flex-direction:row;gap:.5rem;height:100%;align-self:stretch}._block_lihp2_15{flex:auto;border-radius:.25rem;background:var(--lmnt-theme-secondary-600);align-items:center;display:flex;justify-content:center;position:relative}._block_lihp2_15._active_lihp2_46{border:2px solid var(--lmnt-theme-primary);background:var(--lmnt-theme-primary-100);margin:-2px}._block_lihp2_15._error_lihp2_52{border:2px solid var(--lmnt-theme-danger);background:var(--lmnt-theme-danger-50);margin:-2px}._block_lihp2_15._empty_lihp2_58{background:var(--lmnt-theme-secondary-200)}._blockText_lihp2_62{display:flex;justify-content:center;position:absolute;width:1vw;height:1vh;align-items:center}
1
+ ._grid_17o13_1{display:flex;padding-bottom:0;flex-direction:column;justify-content:center;align-items:center;gap:1rem;align-self:stretch}._black_17o13_11{color:#000}._blockLayout_17o13_15{padding:.5rem;gap:.5rem;display:flex;flex-direction:column;border-radius:.5rem;background:var(--lmnt-theme-secondary-200);width:15rem;height:15rem}._blockRow_17o13_26{display:flex;flex-direction:row;gap:.5rem;height:100%;align-self:stretch}._block_17o13_15{flex:auto;border-radius:.25rem;background:var(--lmnt-theme-secondary-600);align-items:center;display:flex;justify-content:center;position:relative}._block_17o13_15._active_17o13_45{border:2px solid var(--lmnt-theme-primary);background:var(--lmnt-theme-primary-100);margin:-2px}._block_17o13_15._error_17o13_51{border:2px solid var(--lmnt-theme-danger);background:var(--lmnt-theme-danger-50);margin:-2px}._block_17o13_15._empty_17o13_57{background:var(--lmnt-theme-secondary-200)}._blockText_17o13_61{display:flex;justify-content:center;position:absolute;width:1vw;height:1vh;align-items:center}._emptyLayout_17o13_70{display:flex;justify-content:center;align-items:center;background:var(--lmnt-theme-surface-variant);border-radius:.5rem}
@@ -52,9 +52,13 @@ type BlockViewProps<T extends Block> = {
52
52
  * the label of the block, normally 'Block', shown when `hideText` is false
53
53
  */
54
54
  blockLabel: string;
55
+ /**
56
+ * an empty view title to be shown when there are no blocks
57
+ */
58
+ emptyViewTitle?: string;
55
59
  };
56
60
  /**
57
61
  * A component that renders a grid of blocks
58
62
  */
59
- export declare const BlockView: <T extends Block>({ rows, columns, hideText, errorBlocks, showNumbers, clickable, size, onClick, currentBlock, blocks, blockViewTitle, blockLabel, }: BlockViewProps<T>) => import("react/jsx-runtime").JSX.Element;
63
+ export declare const BlockView: <T extends Block>({ rows, columns, hideText, errorBlocks, showNumbers, clickable, size, onClick, currentBlock, blocks, blockViewTitle, blockLabel, emptyViewTitle, }: BlockViewProps<T>) => import("react/jsx-runtime").JSX.Element;
60
64
  export {};
@@ -1,71 +1,80 @@
1
- import { jsxs as h, jsx as c } from "react/jsx-runtime";
2
- import { d as T, T as L } from "../../index.es-CF_xy2ns.js";
3
- import { useState as R, useEffect as B, useMemo as C } from "react";
4
- import { getBlockNumberByDto as E } from "../../services/BlockService.js";
5
- import '../../assets/BlockView.css';const A = "_grid_lihp2_1", D = "_black_lihp2_11", S = "_blockLayout_lihp2_15", M = "_blockRow_lihp2_27", V = "_block_lihp2_15", j = "_active_lihp2_46", q = "_error_lihp2_52", F = "_empty_lihp2_58", G = "_blockText_lihp2_62", o = {
6
- grid: A,
7
- black: D,
8
- blockLayout: S,
9
- blockRow: M,
10
- block: V,
11
- active: j,
12
- error: q,
13
- empty: F,
14
- blockText: G
15
- }, O = ({
16
- rows: s,
17
- columns: e,
18
- hideText: b = !1,
19
- errorBlocks: y = [],
20
- showNumbers: v = !0,
21
- clickable: f = !0,
22
- size: m = 15,
23
- onClick: k = null,
24
- currentBlock: i,
25
- blocks: _,
26
- blockViewTitle: N,
27
- blockLabel: g
1
+ import { jsxs as h, jsx as t, Fragment as v } from "react/jsx-runtime";
2
+ import { d as C, T as R, a as B } from "../../index.es-CF_xy2ns.js";
3
+ import { useState as A, useEffect as D, useMemo as S } from "react";
4
+ import { getBlockNumberByDto as F } from "../../services/BlockService.js";
5
+ import '../../assets/BlockView.css';const M = "_grid_17o13_1", V = "_black_17o13_11", j = "_blockLayout_17o13_15", q = "_blockRow_17o13_26", G = "_block_17o13_15", H = "_active_17o13_45", I = "_error_17o13_51", J = "_empty_17o13_57", K = "_blockText_17o13_61", O = "_emptyLayout_17o13_70", o = {
6
+ grid: M,
7
+ black: V,
8
+ blockLayout: j,
9
+ blockRow: q,
10
+ block: G,
11
+ active: H,
12
+ error: I,
13
+ empty: J,
14
+ blockText: K,
15
+ emptyLayout: O
16
+ }, Y = ({
17
+ rows: e,
18
+ columns: r,
19
+ hideText: m = !1,
20
+ errorBlocks: f = [],
21
+ showNumbers: g = !0,
22
+ clickable: N = !0,
23
+ size: b = 15,
24
+ onClick: _ = null,
25
+ currentBlock: a,
26
+ blocks: d,
27
+ blockViewTitle: $,
28
+ blockLabel: w,
29
+ emptyViewTitle: x
28
30
  }) => {
29
- const [d, p] = R(0);
30
- B(() => {
31
- if (!i) return;
32
- const l = E(i, e);
33
- p(l);
34
- }, [i, e]);
35
- const w = C(() => s * e, [s, e]), $ = (l) => {
36
- k && k(l, i ?? void 0);
37
- }, x = ({ row: l, column: r }) => _.length === 0 ? !0 : _.some((a) => a.position?.row === l && a.position?.column === r);
31
+ const [u, k] = A(0);
32
+ D(() => {
33
+ if (!a) return;
34
+ const l = F(a, r);
35
+ k(l);
36
+ }, [a, r]);
37
+ const L = S(() => e * r, [e, r]), T = (l) => {
38
+ _ && _(l, a ?? void 0);
39
+ }, E = ({ row: l, column: i }) => d.length === 0 ? !0 : d.some((n) => n.position?.row === l && n.position?.column === i), y = !e && !r;
38
40
  return /* @__PURE__ */ h("div", { "data-testid": "block-view-container", className: o.grid, children: [
39
- !b && /* @__PURE__ */ c(T, { level: 1, bold: !0, className: o.black, children: N }),
40
- /* @__PURE__ */ c("div", { className: o.blockLayout, style: { width: `${m}rem`, height: `${m}rem` }, children: Array.from({ length: s }).map((l, r) => /* @__PURE__ */ c("div", { className: o.blockRow, children: Array.from({ length: e }).map((a, n) => {
41
- const t = e * r + n + 1, u = x({ row: r + 1, column: n + 1 });
42
- return /* @__PURE__ */ c(
43
- "div",
44
- {
45
- "data-testid": "block-view-block",
46
- className: `${o.block} ${d === t ? o.active : ""} ${u ? "" : o.empty} ${y.includes(t) ? o.error : ""}`,
47
- id: `block${t}`,
48
- onClick: f ? () => {
49
- p(t), $({ row: r + 1, column: n + 1 });
50
- } : void 0,
51
- children: v && u && /* @__PURE__ */ c(
41
+ !m && /* @__PURE__ */ t(C, { level: 1, bold: !0, className: o.black, children: $ }),
42
+ /* @__PURE__ */ t(
43
+ "div",
44
+ {
45
+ className: y ? o.emptyLayout : o.blockLayout,
46
+ style: { width: `${b}rem`, height: `${b}rem` },
47
+ children: y ? /* @__PURE__ */ t(P, { emptyViewTitle: x }) : /* @__PURE__ */ t(v, { children: Array.from({ length: e }).map((l, i) => /* @__PURE__ */ t("div", { className: o.blockRow, children: Array.from({ length: r }).map((n, s) => {
48
+ const c = r * i + s + 1, p = E({ row: i + 1, column: s + 1 });
49
+ return /* @__PURE__ */ t(
52
50
  "div",
53
51
  {
54
- className: `${o.blockText} ${d === t ? o.black : ""}`,
55
- children: t
56
- }
57
- )
58
- },
59
- t
60
- );
61
- }) }, r)) }),
62
- !b && /* @__PURE__ */ h(L, { themeColor: "primary", level: 6, children: [
63
- w,
52
+ "data-testid": "block-view-block",
53
+ className: `${o.block} ${u === c ? o.active : ""} ${p ? "" : o.empty} ${f.includes(c) ? o.error : ""}`,
54
+ id: `block${c}`,
55
+ onClick: N ? () => {
56
+ k(c), T({ row: i + 1, column: s + 1 });
57
+ } : void 0,
58
+ children: g && p && /* @__PURE__ */ t(
59
+ "div",
60
+ {
61
+ className: `${o.blockText} ${u === c ? o.black : ""}`,
62
+ children: c
63
+ }
64
+ )
65
+ },
66
+ c
67
+ );
68
+ }) }, i)) })
69
+ }
70
+ ),
71
+ !m && /* @__PURE__ */ h(R, { themeColor: "primary", level: 6, children: [
72
+ L,
64
73
  " ",
65
- g
74
+ w
66
75
  ] })
67
76
  ] });
68
- };
77
+ }, P = ({ emptyViewTitle: e }) => e ? /* @__PURE__ */ t(B, { bold: !0, children: e }) : /* @__PURE__ */ t(v, {});
69
78
  export {
70
- O as BlockView
79
+ Y as BlockView
71
80
  };
@@ -43,5 +43,5 @@ type DatePickerProps<T extends FieldValues> = {
43
43
  *
44
44
  * @returns A JSX element that renders a date picker form input.
45
45
  */
46
- export declare const FormDatePicker: <T extends FieldValues>({ propertyName, label, closeLabel, className, minRangeYear, maxRangeYear, locale, rules, ...props }: Omit<ElementDatePickerProps, "locale"> & DatePickerProps<T>) => import("react/jsx-runtime").JSX.Element;
46
+ export declare const FormDatePicker: <T extends FieldValues>({ propertyName, label, closeLabel, className, minRangeYear, maxRangeYear, locale, rules, helperText, ...props }: Omit<ElementDatePickerProps, "locale"> & DatePickerProps<T>) => import("react/jsx-runtime").JSX.Element;
47
47
  export {};