@hortiview/shared-components 2.21.0 → 2.22.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,20 @@
1
+ ## [2.22.0](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v2.21.0...v2.22.0) (2026-04-13)
2
+
3
+ ### Features
4
+
5
+ * add ErrorBanner component with styling and storybook integration ([22029ee](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/22029eeb746c4c4ad325d5ce5ace3c7ed0bb0a91))
6
+ * add sentiment-very-dissatisfied icon and update related components ([4a12a29](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/4a12a293d210fc1391c4439665884f00a39693cd))
7
+ * export ErrorBanner component in main module ([2372df8](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/2372df8227645fc5b5ff4755e231af024d54af20))
8
+ * integrate ErrorBanner into Modal and add useContainerWidth hook for responsive design ([9e503e9](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/9e503e9f46ef0758dc63ede5330796e551cb03a5))
9
+
10
+ ### Bug Fixes
11
+
12
+ * remove unused test ([b213a2e](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/b213a2e8f2940a27b028364ee2aee08e966c593d))
13
+
14
+ ### Code Refactoring
15
+
16
+ * changes after review ([9a6b586](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/9a6b58619a2d4dba76e6d93b1d2cc452a5ab9bdd))
17
+
1
18
  ## [2.21.0](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v2.20.1...v2.21.0) (2026-04-13)
2
19
 
3
20
  ### Features
package/README.md CHANGED
@@ -31,6 +31,7 @@ Additionally the library provides form components using [react-hook-form](https:
31
31
  1. [DeleteModal](#deletemodal)
32
32
  1. [Disclaimer](#disclaimer)
33
33
  1. [EmptyView](#emptyview)
34
+ 1. [ErrorBanner] (#errorbanner)
34
35
  1. [Filter](#filter)
35
36
  1. [FormattedNumberDisplay](#formattednumberdisplay)
36
37
  1. [FormComponents](#formcomponents)
@@ -258,6 +259,31 @@ import { EmptyView } from '@hortiview/shared-components';
258
259
  <EmptyView title='No Content' subtitle='nothing' icon='grass' />;
259
260
  ```
260
261
 
262
+ ### ErrorBanner
263
+
264
+ Displays an error message with optional actions. Can be used below a header (default) or as a standalone banner (e.g., in a modal).
265
+
266
+ ```jsx
267
+ import { ErrorBanner } from '@hortiview/shared-components';
268
+
269
+ <ErrorBanner
270
+ title='Something went wrong'
271
+ description='An unexpected error occurred. Please try again or contact support.'
272
+ showBanner={true}
273
+ isOpen={true}
274
+ isStandalone={false} // set true for standalone usage
275
+ primaryActionLabel='Retry'
276
+ onPrimaryAction={() => alert('Retry clicked')}
277
+ secondaryActionLabel='Contact Support'
278
+ onSecondaryAction={() => alert('Support clicked')}
279
+ />;
280
+ ```
281
+
282
+ **Usage notes:**
283
+
284
+ - Use `isStandalone` for modal usage. Default style is for inline placement below a header.
285
+ - Both action buttons are optional; omit their labels to hide them.
286
+
261
287
  ### Filter
262
288
 
263
289
  A filter component, which provides a well designed filter experience. It contains a filter button and a modal for different select inputs.
@@ -0,0 +1 @@
1
+ ._bannerPadding_1ka2b_1{width:100%;box-sizing:border-box;background-color:var(--lmnt-theme-secondary-50)}._bottomBorder_1ka2b_7{border-top:1px solid var(--lmnt-theme-secondary-100);border-bottom:1px solid var(--lmnt-theme-secondary-100)}._standaloneBorder_1ka2b_12{border-color:var(--lmnt-theme-secondary-100);border-width:1px;border-style:solid;border-radius:.5rem}
@@ -1 +1 @@
1
- ._modal_mu9y6_1 div[class*=lmnt-modal__surface]{max-height:100svh!important;max-width:100svw!important}._modal_mu9y6_1 div:not([class*=mdc-dialog--fullscreen]) div[class*=lmnt-modal__surface]{border-radius:1rem!important}._modal_mu9y6_1 footer{margin-bottom:0!important}._gap_mu9y6_14{gap:4px!important}._title_mu9y6_18{header{display:flex;justify-content:start;padding-left:.5rem!important;>div{width:100%;margin-left:0!important}}}._titleWithoutCloseIcon_mu9y6_31{margin-left:1rem!important}._closeButton_mu9y6_35{color:var(--lmnt-theme-on-surface-inactive)}._closeButton_mu9y6_35:before{display:none!important}._closeButton_mu9y6_35:hover{background-color:var(--lmnt-theme-surface-variant)!important}
1
+ ._modal_1yn30_1 div[class*=lmnt-modal__surface]{max-height:100svh!important;max-width:100svw!important}._modal_1yn30_1 div:not([class*=mdc-dialog--fullscreen]) div[class*=lmnt-modal__surface]{border-radius:1rem!important}._modal_1yn30_1 footer{margin-bottom:0!important}._gap_1yn30_14{gap:4px!important}._title_1yn30_18{header{display:flex;justify-content:start;padding-left:.5rem!important;>div{width:100%;margin-left:0!important}}}._titleWithoutCloseIcon_1yn30_31{margin-left:1rem!important}._closeButton_1yn30_35{color:var(--lmnt-theme-on-surface-inactive)}._closeButton_1yn30_35:before{display:none!important}._closeButton_1yn30_35:hover{background-color:var(--lmnt-theme-surface-variant)!important}._errorBanner_1yn30_47{margin:-20px -24px 20px}
@@ -0,0 +1,25 @@
1
+ export type ErrorBannerProps = {
2
+ title?: string;
3
+ description?: string;
4
+ isOpen?: boolean;
5
+ primaryActionLabel?: string;
6
+ onPrimaryAction?: () => void;
7
+ secondaryActionLabel?: string;
8
+ onSecondaryAction?: () => void;
9
+ isStandalone?: boolean;
10
+ };
11
+ /**
12
+ * Error banner component to display error messages with optional actions.
13
+ * Designed to be used below a header or as a standalone banner in a modal.
14
+ *
15
+ * @param {string} title - Title text displayed in the banner
16
+ * @param {string} description - Description text displayed below the title
17
+ * @param {boolean} isOpen - Controls the open/visible state of the banner
18
+ * @param {string} primaryActionLabel - Label for the primary action button. If not provided, button will not be rendered.
19
+ * @param {() => void} onPrimaryAction - Handler for the primary action button
20
+ * @param {string} secondaryActionLabel - Label for the secondary action button. If not provided, button will not be rendered.
21
+ * @param {() => void} onSecondaryAction - Handler for the secondary action button
22
+ * @param {boolean} isStandalone - When true, renders the banner with a rounded border instead of a bottom border
23
+ * @returns {JSX.Element|null} The rendered ErrorBanner component or null if not visible
24
+ */
25
+ export declare const ErrorBanner: ({ title, description, isOpen, isStandalone, ...props }: ErrorBannerProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,70 @@
1
+ import { jsx as r, jsxs as o } from "react/jsx-runtime";
2
+ import { B as c } from "../../index.es-B19PQgzU.js";
3
+ import { G as t } from "../../index.es-Z0aF-7Cn.js";
4
+ import { P as f } from "../../index.es-DgncYOqO.js";
5
+ import { T as u, a as b } from "../../index.es-DUrjyxNI.js";
6
+ import { c as h } from "../../index-Df2FYN-K.js";
7
+ import { useContainerWidth as B } from "../../hooks/useContainerWidth.js";
8
+ import { Iconify as g } from "../Iconify/Iconify.js";
9
+ import '../../assets/ErrorBanner.css';const y = "_bannerPadding_1ka2b_1", _ = "_bottomBorder_1ka2b_7", P = "_standaloneBorder_1ka2b_12", s = {
10
+ bannerPadding: y,
11
+ bottomBorder: _,
12
+ standaloneBorder: P
13
+ }, E = ({
14
+ title: n,
15
+ description: a,
16
+ isOpen: e,
17
+ isStandalone: i,
18
+ ...d
19
+ }) => {
20
+ const { ref: m, isWide: l } = B(), p = h(
21
+ s.bannerPadding,
22
+ i ? s.standaloneBorder : s.bottomBorder
23
+ );
24
+ return e ? /* @__PURE__ */ r(f, { customPadding: "0.5rem 1rem", className: p, "data-testid": "error-banner", children: /* @__PURE__ */ o(
25
+ t,
26
+ {
27
+ ref: m,
28
+ fullWidth: !0,
29
+ direction: l ? "horizontal" : "vertical",
30
+ secondaryAlign: "center",
31
+ children: [
32
+ /* @__PURE__ */ o(t, { fullWidth: !0, primaryAlign: "space-between", secondaryAlign: l ? "center" : "start", children: [
33
+ /* @__PURE__ */ r(g, { icon: "sentiment-very-dissatisfied", iconSize: "large", variant: "color-primary" }),
34
+ /* @__PURE__ */ o(t, { direction: "vertical", fullWidth: !0, gap: "none", children: [
35
+ /* @__PURE__ */ r(u, { bold: !0, level: 2, themeColor: "primary", children: n }),
36
+ /* @__PURE__ */ r(b, { children: a })
37
+ ] })
38
+ ] }),
39
+ /* @__PURE__ */ r(v, { ...d, isWide: l })
40
+ ]
41
+ }
42
+ ) }) : null;
43
+ }, v = ({
44
+ primaryActionLabel: n,
45
+ onPrimaryAction: a,
46
+ secondaryActionLabel: e,
47
+ onSecondaryAction: i,
48
+ isWide: d
49
+ }) => /* @__PURE__ */ o(t, { fullWidth: !d, primaryAlign: "end", secondaryAlign: "center", children: [
50
+ n && /* @__PURE__ */ r(
51
+ c,
52
+ {
53
+ label: n,
54
+ onClick: a,
55
+ "data-testid": "error-banner-primary-action"
56
+ }
57
+ ),
58
+ e && /* @__PURE__ */ r(
59
+ c,
60
+ {
61
+ label: e,
62
+ variant: "outlined",
63
+ onClick: i,
64
+ "data-testid": "error-banner-secondary-action"
65
+ }
66
+ )
67
+ ] });
68
+ export {
69
+ E as ErrorBanner
70
+ };