@hortiview/shared-components 0.0.6849 → 0.0.6927

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.
@@ -3,21 +3,36 @@
3
3
  */
4
4
  export declare enum AvailableCustomIcons {
5
5
  'battery-0' = 0,
6
- 'battery-20' = 1,
7
- 'battery-50' = 2,
8
- 'battery-80' = 3,
9
- 'battery-100' = 4,
10
- 'cloud-rain' = 5,
11
- 'cloud-sunny' = 6,
12
- 'farm-delete' = 7,
13
- 'block-delete' = 8,
14
- 'greenhouse-delete' = 9,
15
- 'season' = 10,
16
- 'season-end' = 11,
17
- block = 12,
18
- cloud = 13,
19
- farm = 14,
20
- subscription = 15,
21
- wind = 16,
22
- hortiview = 17
6
+ 'battery-100' = 1,
7
+ 'battery-20' = 2,
8
+ 'battery-50' = 3,
9
+ 'battery-80' = 4,
10
+ 'block-delete' = 5,
11
+ 'cloud-rain' = 6,
12
+ 'cloud-sunny' = 7,
13
+ 'crop-health' = 8,
14
+ 'farm-delete' = 9,
15
+ 'farm-management' = 10,
16
+ 'greenhouse-delete' = 11,
17
+ 'harvest-quality' = 12,
18
+ 'manage-labour' = 13,
19
+ 'open-field' = 14,
20
+ 'other-category' = 15,
21
+ 'pd-scouting' = 16,
22
+ 'season-end' = 17,
23
+ 'vertical-farming' = 18,
24
+ block = 19,
25
+ cloud = 20,
26
+ farm = 21,
27
+ fertigation = 22,
28
+ glasshouse = 23,
29
+ greenhouse = 24,
30
+ hortiview = 25,
31
+ orchard = 26,
32
+ potato = 27,
33
+ season = 28,
34
+ subscription = 29,
35
+ tomato = 30,
36
+ weather = 31,
37
+ wind = 32
23
38
  }
@@ -1,4 +1,4 @@
1
- var d = /* @__PURE__ */ ((r) => (r[r["battery-0"] = 0] = "battery-0", r[r["battery-20"] = 1] = "battery-20", r[r["battery-50"] = 2] = "battery-50", r[r["battery-80"] = 3] = "battery-80", r[r["battery-100"] = 4] = "battery-100", r[r["cloud-rain"] = 5] = "cloud-rain", r[r["cloud-sunny"] = 6] = "cloud-sunny", r[r["farm-delete"] = 7] = "farm-delete", r[r["block-delete"] = 8] = "block-delete", r[r["greenhouse-delete"] = 9] = "greenhouse-delete", r[r.season = 10] = "season", r[r["season-end"] = 11] = "season-end", r[r.block = 12] = "block", r[r.cloud = 13] = "cloud", r[r.farm = 14] = "farm", r[r.subscription = 15] = "subscription", r[r.wind = 16] = "wind", r[r.hortiview = 17] = "hortiview", r))(d || {});
1
+ var d = /* @__PURE__ */ ((r) => (r[r["battery-0"] = 0] = "battery-0", r[r["battery-100"] = 1] = "battery-100", r[r["battery-20"] = 2] = "battery-20", r[r["battery-50"] = 3] = "battery-50", r[r["battery-80"] = 4] = "battery-80", r[r["block-delete"] = 5] = "block-delete", r[r["cloud-rain"] = 6] = "cloud-rain", r[r["cloud-sunny"] = 7] = "cloud-sunny", r[r["crop-health"] = 8] = "crop-health", r[r["farm-delete"] = 9] = "farm-delete", r[r["farm-management"] = 10] = "farm-management", r[r["greenhouse-delete"] = 11] = "greenhouse-delete", r[r["harvest-quality"] = 12] = "harvest-quality", r[r["manage-labour"] = 13] = "manage-labour", r[r["open-field"] = 14] = "open-field", r[r["other-category"] = 15] = "other-category", r[r["pd-scouting"] = 16] = "pd-scouting", r[r["season-end"] = 17] = "season-end", r[r["vertical-farming"] = 18] = "vertical-farming", r[r.block = 19] = "block", r[r.cloud = 20] = "cloud", r[r.farm = 21] = "farm", r[r.fertigation = 22] = "fertigation", r[r.glasshouse = 23] = "glasshouse", r[r.greenhouse = 24] = "greenhouse", r[r.hortiview = 25] = "hortiview", r[r.orchard = 26] = "orchard", r[r.potato = 27] = "potato", r[r.season = 28] = "season", r[r.subscription = 29] = "subscription", r[r.tomato = 30] = "tomato", r[r.weather = 31] = "weather", r[r.wind = 32] = "wind", r))(d || {});
2
2
  export {
3
3
  d as AvailableCustomIcons
4
4
  };
@@ -7,14 +7,21 @@
7
7
  * - xl: 1024-1439px
8
8
  * - xxl: 1440px and up
9
9
  *
10
+ * Additional breakpoints considering the navbar width
11
+ * - lg-nav: (840 + 256) - (1023 + 256)px
12
+ * - xl-nav: (1024 + 256) - (1439 + 256)px
13
+ * - xxl-nav: (1440 + 256)px and up
14
+ *
10
15
  * They are combined as follows:
11
16
  * - isMobile: xs
12
17
  * - isTablet: sm, md
13
18
  * - isDesktop: lg, xl, xxl
19
+ * - isDesktopNavbar: lg-nav, xl-nav, xxl-nav
14
20
  * @returns {Object} An object with the current breakpoint
15
21
  */
16
- export declare const useBreakpoints: () => {
22
+ export declare const useBreakpoints: (navBarWidth?: number) => {
17
23
  isMobile: boolean;
18
24
  isTablet: boolean;
19
25
  isDesktop: boolean;
26
+ isDesktopNavbar: boolean;
20
27
  };
@@ -1,5 +1,5 @@
1
1
  import "react";
2
- import { u as p } from "../useBreakpoint-2MH8ICuE.js";
2
+ import { u as p } from "../useBreakpoint-BNeVhjjZ.js";
3
3
  export {
4
4
  p as useBreakpoints
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import { r as t, w as s } from "../react.esm-DoZanrUz.js";
2
- import { u as o } from "../useBreakpoint-2MH8ICuE.js";
2
+ import { u as o } from "../useBreakpoint-BNeVhjjZ.js";
3
3
  import { d as a, t as i, g as r } from "../vi.JYQecGiw-BbUbJcT8.js";
4
4
  a("useBreakpoint Test", () => {
5
5
  i("returns object", () => {
package/dist/main.js CHANGED
@@ -24,7 +24,7 @@ import { FormSelect as N } from "./components/FormComponents/FormSelect/FormSele
24
24
  import { FormSlider as Q } from "./components/FormComponents/FormSlider/FormSlider.js";
25
25
  import { FormText as W } from "./components/FormComponents/FormText/FormText.js";
26
26
  import { AvailableCustomIcons as _ } from "./enums/AvailableCustomIcons.js";
27
- import { u as rr } from "./useBreakpoint-2MH8ICuE.js";
27
+ import { u as rr } from "./useBreakpoint-BNeVhjjZ.js";
28
28
  import { capitalizeFirstLetters as er } from "./services/UtilService.js";
29
29
  export {
30
30
  t as AlertBanner,
@@ -0,0 +1,33 @@
1
+ import { useState as p, useEffect as r } from "react";
2
+ const t = (s) => {
3
+ const [a, i] = p(!1);
4
+ return r(
5
+ () => {
6
+ const e = window.matchMedia(s);
7
+ i(e.matches);
8
+ const n = (o) => i(o.matches);
9
+ return e.addEventListener("change", n), () => e.removeEventListener("change", n);
10
+ },
11
+ []
12
+ // Empty array ensures effect is only run on mount and unmount
13
+ ), a;
14
+ }, h = (s = 256) => {
15
+ const a = t("(max-width: 599px)"), i = t("(min-width: 600px) and (max-width: 719px)"), e = t("(min-width: 720px) and (max-width: 839px)"), n = t("(min-width: 840px) and (max-width: 1023px)"), o = t("(min-width: 1024px) and (max-width: 1439px)"), d = t("(min-width: 1440px)"), c = t(
16
+ `(min-width: ${840 + s}px) and (max-width: ${1023 + s}px)`
17
+ ), x = t(
18
+ `(min-width: ${1024 + s}px) and (max-width: ${1439 + s}px)`
19
+ ), m = t(`(min-width: ${1440 + s}px)`);
20
+ return {
21
+ isMobile: a,
22
+ isTablet: i || e,
23
+ isDesktop: n || o || d,
24
+ isDesktopNavbar: c || x || m
25
+ };
26
+ }, u = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
27
+ __proto__: null,
28
+ useBreakpoints: h
29
+ }, Symbol.toStringTag, { value: "Module" }));
30
+ export {
31
+ u as a,
32
+ h as u
33
+ };
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": "0.0.6849",
4
+ "version": "0.0.6927",
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>",
@@ -1,100 +0,0 @@
1
- import "./assets/ListAreaService.css";
2
- import { jsx as r, jsxs as C } from "react/jsx-runtime";
3
- import { TypoButton as N, Group as O, TypoSubtitle as k, TypoBody as $, Icon as L } from "@element/react-components";
4
- import { Iconify as E } from "./components/Iconify/Iconify.js";
5
- import { AvailableCustomIcons as j } from "./enums/AvailableCustomIcons.js";
6
- const W = "_fullWidth_1l0gd_1", G = "_mainElevation_1l0gd_5", S = "_searchbar_1l0gd_11", w = "_roundedBottom_1l0gd_19", A = "_primaryText_1l0gd_24", P = "_noOverlineText_1l0gd_28", q = "_list_1l0gd_32", z = "_listItem_1l0gd_60", D = "_trailingIcon_1l0gd_64", F = "_groupedListItem_1l0gd_76", H = "_iconColor_1l0gd_80", J = "_overlineTitle_1l0gd_84", K = "_truncate_1l0gd_89", M = "_truncateOverlineText_1l0gd_98", i = {
7
- fullWidth: W,
8
- mainElevation: G,
9
- searchbar: S,
10
- roundedBottom: w,
11
- primaryText: A,
12
- noOverlineText: P,
13
- list: q,
14
- listItem: z,
15
- trailingIcon: D,
16
- groupedListItem: F,
17
- iconColor: H,
18
- overlineTitle: J,
19
- truncate: K,
20
- truncateOverlineText: M
21
- }, tt = (e, l, c, a) => {
22
- const o = e.reduce((n, s) => {
23
- const { groupName: t, ...m } = s;
24
- return !t || typeof t != "string" || (n[t] || (n[t] = {
25
- groupName: /* @__PURE__ */ r(N, { children: t }),
26
- id: t,
27
- items: []
28
- }), n[t].items = [
29
- ...n[t].items,
30
- T(m, l, c, a)
31
- ]), n;
32
- }, {});
33
- return Object.values(o);
34
- }, et = (e, l, c, a) => e.map((o) => T(o, l, c, a)), T = (e, l, c, a) => {
35
- const {
36
- id: o,
37
- title: n,
38
- subTitle: s,
39
- route: t,
40
- value: m,
41
- noNavigation: g,
42
- disabled: d,
43
- icon: y,
44
- iconType: u,
45
- trailingIcon: I,
46
- trailingIconType: x,
47
- actionButton: f,
48
- onClick: h,
49
- customTitle: p,
50
- listItemClassName: B,
51
- overlineTitle: v
52
- } = e, _ = l === t;
53
- return {
54
- id: o,
55
- key: o,
56
- select: _,
57
- primaryText: o,
58
- secondaryText: /* @__PURE__ */ C(O, { direction: "vertical", gap: "none", children: [
59
- p ?? /* @__PURE__ */ r(
60
- k,
61
- {
62
- level: 1,
63
- bold: _,
64
- className: `${i.truncate} lmnt-theme-on-surface-active`,
65
- children: n
66
- }
67
- ),
68
- s && !p ? /* @__PURE__ */ r(
69
- $,
70
- {
71
- level: 2,
72
- themeColor: _ ? "primary" : void 0,
73
- className: `${i.truncate} lmnt-theme-on-surface-inactive`,
74
- children: s
75
- }
76
- ) : void 0
77
- ] }),
78
- overlineText: /* @__PURE__ */ r("span", { className: `${i.truncate} ${i.truncateOverlineText}`, children: v }),
79
- trailingBlock: f ?? I ?? /* @__PURE__ */ r(L, { icon: "arrow_right", className: i.iconColor }),
80
- leadingBlock: Q(y),
81
- value: m,
82
- componentProps: {
83
- id: o,
84
- key: o,
85
- leadingBlockType: u ?? "icon",
86
- trailingBlockType: x ?? "icon",
87
- className: `${u === "avatar" ? "" : i.listItem} ${c} ${B ?? ""} ${v ? i.overlineTitle : i.noOverlineText}`,
88
- onClick: (R, b) => h?.(b),
89
- tag: d || g ? void 0 : a ?? "a",
90
- to: d || g ? void 0 : t,
91
- disabled: d
92
- }
93
- };
94
- }, Q = (e) => typeof e == "string" && e in j ? /* @__PURE__ */ r(E, { icon: e }) : e;
95
- export {
96
- et as a,
97
- tt as g,
98
- T as m,
99
- i as s
100
- };
@@ -1,28 +0,0 @@
1
- import { useState as d, useEffect as c } from "react";
2
- const t = (i) => {
3
- const [a, s] = d(!1);
4
- return c(
5
- () => {
6
- const e = window.matchMedia(i);
7
- s(e.matches);
8
- const n = (o) => s(o.matches);
9
- return e.addEventListener("change", n), () => e.removeEventListener("change", n);
10
- },
11
- []
12
- // Empty array ensures effect is only run on mount and unmount
13
- ), a;
14
- }, r = () => {
15
- const i = t("(max-width: 599px)"), a = t("(min-width: 600px) and (max-width: 719px)"), s = t("(min-width: 720px) and (max-width: 839px)"), e = t("(min-width: 840px) and (max-width: 1023px)"), n = t("(min-width: 1024px) and (max-width: 1439px)"), o = t("(min-width: 1440px)");
16
- return {
17
- isMobile: i,
18
- isTablet: a || s,
19
- isDesktop: e || n || o
20
- };
21
- }, m = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
22
- __proto__: null,
23
- useBreakpoints: r
24
- }, Symbol.toStringTag, { value: "Module" }));
25
- export {
26
- m as a,
27
- r as u
28
- };