@hortiview/shared-components 2.6.0 → 2.7.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 +22 -0
- package/README.md +13 -0
- package/dist/OfflineView-BUSWAKez.js +48 -0
- package/dist/assets/OfflineView.css +1 -1
- package/dist/components/BaseView/BaseView.js +1 -1
- package/dist/components/ContextMenu/ContextMenu.js +1 -1
- package/dist/components/Filter/Filter.js +3 -2
- package/dist/components/GenericTable/GenericTable.js +4 -3
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/ModulePadding/ModulePadding.js +3 -2
- package/dist/components/OfflineView/OfflineView.js +1 -1
- package/dist/components/OfflineView/OfflineView.test.js +1 -1
- package/dist/main.d.ts +2 -1
- package/dist/main.js +71 -66
- package/dist/services/UtilService.d.ts +21 -0
- package/dist/services/UtilService.js +16 -12
- package/dist/services/services.test.js +70 -23
- package/dist/types/Time.d.ts +21 -0
- package/dist/types/Time.js +17 -0
- package/package.json +1 -1
- package/dist/OfflineView-HbuDPpQL.js +0 -48
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
## [2.7.0](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v2.6.1...v2.7.0) (2025-10-24)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* create getFormattedDateTime function ([2c0bee8](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/2c0bee8ab990f28cf4d9cbc198863ca411070b6c))
|
|
6
|
+
|
|
7
|
+
### Documentation
|
|
8
|
+
|
|
9
|
+
* mention using formats from Time.ts for consistency ([0026a3a](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/0026a3acb5422cfdda722b69020c9cbc1521ebd8))
|
|
10
|
+
* update README ([846bca1](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/846bca135f16d3f673ef1db3a8c37700371eb115))
|
|
11
|
+
|
|
12
|
+
### Code Refactoring
|
|
13
|
+
|
|
14
|
+
* add Date prop ([f962c7c](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/f962c7c106c66e0a55dcd7f49642233cf69344fe))
|
|
15
|
+
* create Time file and import/export date formats ([d7b6fd9](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/d7b6fd974bf4634d8300426ece110881090e2653))
|
|
16
|
+
|
|
17
|
+
## [2.6.1](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v2.6.0...v2.6.1) (2025-10-02)
|
|
18
|
+
|
|
19
|
+
### Styles
|
|
20
|
+
|
|
21
|
+
* adjust title and subtitle ([3aab84c](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/3aab84c8bd07f6d01c21a5653ab609cd41de7e4f))
|
|
22
|
+
|
|
1
23
|
## [2.6.0](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v2.5.0...v2.6.0) (2025-09-30)
|
|
2
24
|
|
|
3
25
|
### Features
|
package/README.md
CHANGED
|
@@ -66,6 +66,7 @@ Additionally the library provides form components using [react-hook-form](https:
|
|
|
66
66
|
1. [capitalizeFirstLetters](#capitalizefirstletters)
|
|
67
67
|
1. [trimLeadingAndTrailingSpaces](#trimleadingandtrailingspaces)
|
|
68
68
|
1. [getNumberAsLocaleString](#getnumberaslocalestring)
|
|
69
|
+
1. [getFormattedDateTime](#getformatteddatetime)
|
|
69
70
|
|
|
70
71
|
## Available constants
|
|
71
72
|
|
|
@@ -1108,6 +1109,18 @@ const overlineTitle = `${getNumberAsLocaleString(userLocale, totalArea, 5)} ${t(
|
|
|
1108
1109
|
)}`;
|
|
1109
1110
|
```
|
|
1110
1111
|
|
|
1112
|
+
### getFormattedDateTime
|
|
1113
|
+
|
|
1114
|
+
Formats a date (string) with Intl.DateTimeFormat.
|
|
1115
|
+
If locale is a plain code ("en" | "es" | "tr"), it’s mapped to a regional tag ("en-US", "es-MX", "tr-TR").
|
|
1116
|
+
|
|
1117
|
+
For consistency, please use the date and time formats defined in `Time.ts`.
|
|
1118
|
+
|
|
1119
|
+
```typescript
|
|
1120
|
+
getFormattedDateTime('2025-10-02T14:30:00Z', 'en-US', { dateStyle: 'medium' })
|
|
1121
|
+
// -> Oct 2, 2025
|
|
1122
|
+
```
|
|
1123
|
+
|
|
1111
1124
|
## Available constants
|
|
1112
1125
|
|
|
1113
1126
|
### Languages and countries
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { G as o } from "./index.es-CbBdaRO2.js";
|
|
3
|
+
import { Iconify as _ } from "./components/Iconify/Iconify.js";
|
|
4
|
+
import { b as m, d as y, T as h } from "./index.es--yyG47az.js";
|
|
5
|
+
import { B as A } from "./index.es-Bx1E5MPK.js";
|
|
6
|
+
import './assets/OfflineView.css';const T = "_gapAndTextAlign_10nts_1", v = "_container_10nts_6", x = "_bgWhite_10nts_12", G = "_bgGrey_10nts_17", W = "_subtitle_10nts_22", t = {
|
|
7
|
+
gapAndTextAlign: T,
|
|
8
|
+
container: v,
|
|
9
|
+
bgWhite: x,
|
|
10
|
+
bgGrey: G,
|
|
11
|
+
subtitle: W
|
|
12
|
+
}, j = ({
|
|
13
|
+
title: i = "You’re currently offline",
|
|
14
|
+
subtitle: n = "This feature is unavailable until you reconnect",
|
|
15
|
+
icon: l = "cloud_off",
|
|
16
|
+
size: c = "large",
|
|
17
|
+
variant: d = "basic",
|
|
18
|
+
"data-testid": g = "offline-view-container",
|
|
19
|
+
buttonLabel: a,
|
|
20
|
+
fullWidth: f = !1,
|
|
21
|
+
className: b,
|
|
22
|
+
onClick: p
|
|
23
|
+
}) => {
|
|
24
|
+
const s = c === "large", u = d === "filled";
|
|
25
|
+
return /* @__PURE__ */ r(
|
|
26
|
+
o,
|
|
27
|
+
{
|
|
28
|
+
className: `${b} ${t.container} ${u ? t.bgGrey : t.bgWhite}`,
|
|
29
|
+
gap: "standard",
|
|
30
|
+
direction: "vertical",
|
|
31
|
+
"data-testid": g,
|
|
32
|
+
secondaryAlign: "center",
|
|
33
|
+
fullWidth: f,
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ r(o, { direction: "vertical", secondaryAlign: "center", className: t.gapAndTextAlign, children: [
|
|
36
|
+
/* @__PURE__ */ e(_, { icon: l, iconSize: s ? "xlarge" : "medium" }),
|
|
37
|
+
s ? /* @__PURE__ */ e(m, { level: 6, children: i }) : /* @__PURE__ */ e(y, { level: 1, bold: !0, children: i })
|
|
38
|
+
] }),
|
|
39
|
+
n && /* @__PURE__ */ e(h, { className: t.subtitle, level: 2, children: n }),
|
|
40
|
+
a && /* @__PURE__ */ e(A, { "data-testid": "offline-view-action-button", label: a, onClick: p })
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
j as O,
|
|
47
|
+
t as s
|
|
48
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._gapAndTextAlign_10nts_1{gap:.125rem!important;text-align:center}._container_10nts_6{border-radius:.5rem;padding:2.5rem 2rem;width:auto}._bgWhite_10nts_12{background:var(--lmnt-theme-surface);color:var(--lmnt-theme-on-surface-active)}._bgGrey_10nts_17{background:var(--lmnt-theme-surface-variant);color:var(--lmnt-theme-on-surface-active)}._subtitle_10nts_22{color:var(--on-colors-on-surface-inactive-medium, #000000BA);font-weight:500;text-align:center}
|
|
@@ -6,7 +6,7 @@ import { EmptyView as N } from "../EmptyView/EmptyView.js";
|
|
|
6
6
|
import { ListArea as A } from "../ListArea/ListArea.js";
|
|
7
7
|
import { u as H } from "../../useBreakpoints-MzTZ0tCT.js";
|
|
8
8
|
import { VerticalDivider as V } from "../VerticalDivider/VerticalDivider.js";
|
|
9
|
-
import { O as j } from "../../OfflineView-
|
|
9
|
+
import { O as j } from "../../OfflineView-BUSWAKez.js";
|
|
10
10
|
import '../../assets/BaseView.css';const E = "_parentGroup_w7vsz_1", I = "_divider_w7vsz_5", $ = "_maxWidth_w7vsz_10", y = "_desktopList_w7vsz_14", F = "_mobileList_w7vsz_19", M = "_desktopDetail_w7vsz_23", O = "_mobileDetail_w7vsz_28", o = {
|
|
11
11
|
parentGroup: E,
|
|
12
12
|
divider: I,
|
|
@@ -3,7 +3,7 @@ import { I as _ } from "../../index.es-Kg9soDed.js";
|
|
|
3
3
|
import { M as k, L as p, a as w } from "../../index.es-CPqaUyn3.js";
|
|
4
4
|
import { useState as I, useCallback as a, useEffect as M } from "react";
|
|
5
5
|
import { u as x } from "../../uniqueId-NU3-C36A.js";
|
|
6
|
-
import { O as C } from "../../OfflineView-
|
|
6
|
+
import { O as C } from "../../OfflineView-BUSWAKez.js";
|
|
7
7
|
import '../../assets/ContextMenu.css';const v = "_menu_1xwk3_1", y = "_icon_1xwk3_5", V = "_listItem_1xwk3_9", g = "_offlineViewMargin_1xwk3_19", s = {
|
|
8
8
|
menu: v,
|
|
9
9
|
icon: y,
|
|
@@ -18,12 +18,13 @@ import "../../get-B8c-T4F8.js";
|
|
|
18
18
|
import "../../omit-1Eom1PmQ.js";
|
|
19
19
|
import "../../isArray-Dub1wGJM.js";
|
|
20
20
|
import "../../isString-BW9UHONv.js";
|
|
21
|
+
import "../../types/Time.js";
|
|
21
22
|
import '../../assets/Filter.css';const K = "_filterButton_qtl7a_1", T = "_relativeParent_qtl7a_6", V = "_filterBadge_qtl7a_10", E = "_dense_qtl7a_17", u = {
|
|
22
23
|
filterButton: K,
|
|
23
24
|
relativeParent: T,
|
|
24
25
|
filterBadge: V,
|
|
25
26
|
dense: E
|
|
26
|
-
},
|
|
27
|
+
}, ut = ({
|
|
27
28
|
clearFilterText: m,
|
|
28
29
|
closeCallback: s,
|
|
29
30
|
currentFilter: i,
|
|
@@ -184,5 +185,5 @@ import '../../assets/Filter.css';const K = "_filterButton_qtl7a_1", T = "_relati
|
|
|
184
185
|
);
|
|
185
186
|
};
|
|
186
187
|
export {
|
|
187
|
-
|
|
188
|
+
ut as Filter
|
|
188
189
|
};
|
|
@@ -23,12 +23,13 @@ import { a as hl } from "../../util-DA21pZXj.js";
|
|
|
23
23
|
import "../../isEmpty-DsdC9UUD.js";
|
|
24
24
|
import { u as ml } from "../../useBreakpoints-MzTZ0tCT.js";
|
|
25
25
|
import "../../react-tooltip.min-DSY6KDqS.js";
|
|
26
|
-
import { O as Fa } from "../../OfflineView-
|
|
26
|
+
import { O as Fa } from "../../OfflineView-BUSWAKez.js";
|
|
27
27
|
import "../../uniqueId-NU3-C36A.js";
|
|
28
28
|
import "react-hook-form";
|
|
29
29
|
import "../../get-B8c-T4F8.js";
|
|
30
30
|
import "../../isArray-Dub1wGJM.js";
|
|
31
31
|
import "../../isString-BW9UHONv.js";
|
|
32
|
+
import "../../types/Time.js";
|
|
32
33
|
import { useGenerateColumns as yl, useGenerateTableData as bl } from "./GenericTableService.js";
|
|
33
34
|
import { GenericCardList as wl } from "./Mobile/GenericCardList.js";
|
|
34
35
|
import '../../assets/GenericTable.css';function Rl(r, o) {
|
|
@@ -10407,7 +10408,7 @@ const cd = "_topBar_1tmb3_1", fd = "_filterBar_1tmb3_5", pd = "_start_1tmb3_10",
|
|
|
10407
10408
|
elevation: vd,
|
|
10408
10409
|
table: hd,
|
|
10409
10410
|
noBorder: md
|
|
10410
|
-
},
|
|
10411
|
+
}, Qd = ({
|
|
10411
10412
|
data: r = [],
|
|
10412
10413
|
hiddenColumns: o = [],
|
|
10413
10414
|
order: e = [],
|
|
@@ -10527,5 +10528,5 @@ const cd = "_topBar_1tmb3_1", fd = "_filterBar_1tmb3_5", pd = "_start_1tmb3_10",
|
|
|
10527
10528
|
);
|
|
10528
10529
|
};
|
|
10529
10530
|
export {
|
|
10530
|
-
|
|
10531
|
+
Qd as GenericTable
|
|
10531
10532
|
};
|
|
@@ -11,7 +11,7 @@ import { A as Dt } from "../../animationframe-EMBh6XeO.js";
|
|
|
11
11
|
import { P as It } from "../../index.es-D-ph6ImM.js";
|
|
12
12
|
import { b as Nt } from "../../index.es--yyG47az.js";
|
|
13
13
|
import { Iconify as Lt } from "../Iconify/Iconify.js";
|
|
14
|
-
import { O as Ft } from "../../OfflineView-
|
|
14
|
+
import { O as Ft } from "../../OfflineView-BUSWAKez.js";
|
|
15
15
|
import '../../assets/Modal.css';/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2016 Google Inc.
|
|
@@ -11,7 +11,8 @@ import "../../get-B8c-T4F8.js";
|
|
|
11
11
|
import "../../omit-1Eom1PmQ.js";
|
|
12
12
|
import "../../isArray-Dub1wGJM.js";
|
|
13
13
|
import "../../isString-BW9UHONv.js";
|
|
14
|
-
|
|
14
|
+
import "../../types/Time.js";
|
|
15
|
+
const j = ({ children: o }) => {
|
|
15
16
|
const { isDesktop: t } = m();
|
|
16
17
|
return /* @__PURE__ */ i(
|
|
17
18
|
r,
|
|
@@ -24,5 +25,5 @@ const x = ({ children: o }) => {
|
|
|
24
25
|
);
|
|
25
26
|
};
|
|
26
27
|
export {
|
|
27
|
-
|
|
28
|
+
j as ModulePadding
|
|
28
29
|
};
|
|
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
|
|
|
2
2
|
import "../../index.es-CbBdaRO2.js";
|
|
3
3
|
import "../Iconify/Iconify.js";
|
|
4
4
|
import "../../index.es--yyG47az.js";
|
|
5
|
-
import { O as f } from "../../OfflineView-
|
|
5
|
+
import { O as f } from "../../OfflineView-BUSWAKez.js";
|
|
6
6
|
import "../../index.es-Bx1E5MPK.js";
|
|
7
7
|
export {
|
|
8
8
|
f as OfflineView
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { a as n, s as t, f as u } from "../../react.esm-CX1WJ2Pp.js";
|
|
3
|
-
import { s as r, O as i } from "../../OfflineView-
|
|
3
|
+
import { s as r, O as i } from "../../OfflineView-BUSWAKez.js";
|
|
4
4
|
import { d as B, t as l, g as e, a as c } from "../../vi.CjhMlMwf-CKxPQtd6.js";
|
|
5
5
|
B("OfflineView", () => {
|
|
6
6
|
l("should render OfflineView with title and subtitle", () => {
|
package/dist/main.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ export { FormToggle } from './components/FormComponents/FormToggle/FormToggle';
|
|
|
42
42
|
export { AvailableCustomIcons } from './enums/AvailableCustomIcons';
|
|
43
43
|
export { ThemeColor } from './enums/ThemeColor';
|
|
44
44
|
export { useBreakpoints } from './hooks/useBreakpoints';
|
|
45
|
-
export { capitalizeFirstLetters, getNumberAsLocaleString, trimLeadingAndTrailingSpaces, } from './services/UtilService';
|
|
45
|
+
export { capitalizeFirstLetters, getFormattedDateTime, getNumberAsLocaleString, trimLeadingAndTrailingSpaces, } from './services/UtilService';
|
|
46
46
|
export type { ActionProps } from './components/ContextMenu/ContextMenu';
|
|
47
47
|
export type { FormSelectOption, FormSelectProps, } from './components/FormComponents/FormSelect/FormSelect';
|
|
48
48
|
export type { FormTextProps } from './components/FormComponents/FormText/FormText';
|
|
@@ -54,5 +54,6 @@ export type { FilterData, FilterOption, FilterSelection } from './types/Filter';
|
|
|
54
54
|
export type { CellTemplate, CellTemplateProps, TableLayoutProps } from './types/GenericTable';
|
|
55
55
|
export type { HashTab } from './types/HashTab';
|
|
56
56
|
export type { BaseListElement, ListElement } from './types/ListElement';
|
|
57
|
+
export { DATE_FORMAT, TIME_FORMAT, DATE_TIME_FORMAT } from './types/Time';
|
|
57
58
|
export { AVAILABLE_COUNTRY_KEYS, AVAILABLE_LOCALES, ENGLISH_LANGUAGE_ID, GERMAN_LANGUAGE_ID, LANGUAGE_CODES_MAPPER, LANGUAGE_ID_MAPPER, SPANISH_LANGUAGE_ID, TURKISH_LANGUAGE_ID, } from './types/Languages';
|
|
58
59
|
export type { AVAILABLE_LANGUAGE_CODES, LANGUAGE_COUNTRY_CODES } from './types/Languages';
|
package/dist/main.js
CHANGED
|
@@ -2,26 +2,26 @@ import { A as e } from "./AlertBanner-JnX0tJGC.js";
|
|
|
2
2
|
import { LinkBanner as m } from "./components/AlertBanner/LinkBanner.js";
|
|
3
3
|
import { BaseView as f } from "./components/BaseView/BaseView.js";
|
|
4
4
|
import { BasicHeading as a } from "./components/BasicHeading/BasicHeading.js";
|
|
5
|
-
import { BlockView as
|
|
6
|
-
import { ChipCard as
|
|
7
|
-
import { ContextMenu as
|
|
8
|
-
import { DeleteModal as
|
|
9
|
-
import { DetailContentWrapper as
|
|
10
|
-
import { Disclaimer as
|
|
11
|
-
import { EmptyView as
|
|
5
|
+
import { BlockView as A } from "./components/BlockView/BlockView.js";
|
|
6
|
+
import { ChipCard as n } from "./components/ChipCard/ChipCard.js";
|
|
7
|
+
import { ContextMenu as E } from "./components/ContextMenu/ContextMenu.js";
|
|
8
|
+
import { DeleteModal as L } from "./components/DeleteModal/DeleteModal.js";
|
|
9
|
+
import { DetailContentWrapper as _ } from "./components/DetailContentWrapper/DetailContentWrapper.js";
|
|
10
|
+
import { Disclaimer as F } from "./components/Disclaimer/Disclaimer.js";
|
|
11
|
+
import { EmptyView as G } from "./components/EmptyView/EmptyView.js";
|
|
12
12
|
import { Filter as D } from "./components/Filter/Filter.js";
|
|
13
|
-
import { FormattedNumberDisplay as
|
|
14
|
-
import { GenericTable as
|
|
15
|
-
import { HashTabView as
|
|
16
|
-
import { HeaderFilter as
|
|
17
|
-
import { HealthCheckFailed as
|
|
18
|
-
import { Iconify as
|
|
19
|
-
import { InfoGroup as
|
|
20
|
-
import { ListArea as
|
|
13
|
+
import { FormattedNumberDisplay as M } from "./components/FormattedNumberDisplay/FormattedNumberDisplay.js";
|
|
14
|
+
import { GenericTable as B } from "./components/GenericTable/GenericTable.js";
|
|
15
|
+
import { HashTabView as O } from "./components/HashTabView/HashTabView.js";
|
|
16
|
+
import { HeaderFilter as u } from "./components/HeaderFilter/HeaderFilter.js";
|
|
17
|
+
import { HealthCheckFailed as H } from "./components/HealthCheckFailed/HealthCheckFailed.js";
|
|
18
|
+
import { Iconify as V } from "./components/Iconify/Iconify.js";
|
|
19
|
+
import { InfoGroup as P } from "./components/InfoGroup/InfoGroup.js";
|
|
20
|
+
import { ListArea as w } from "./components/ListArea/ListArea.js";
|
|
21
21
|
import { LoadingSpinner as y } from "./components/LoadingSpinner/Default/LoadingSpinner.js";
|
|
22
22
|
import { Modal as K } from "./components/Modal/Modal.js";
|
|
23
23
|
import { ModulePadding as W } from "./components/ModulePadding/ModulePadding.js";
|
|
24
|
-
import { O as j } from "./OfflineView-
|
|
24
|
+
import { O as j } from "./OfflineView-BUSWAKez.js";
|
|
25
25
|
import { OnboardingBanner as J } from "./components/OnboardingBanner/OnboardingBanner.js";
|
|
26
26
|
import { OverflowTooltip as Z } from "./components/OverflowTooltip/OverflowTooltip.js";
|
|
27
27
|
import { ScrollbarX as rr, ScrollbarY as or } from "./components/Scrollbar/Scrollbar.js";
|
|
@@ -29,76 +29,81 @@ import { SearchBar as tr } from "./components/SearchBar/SearchBar.js";
|
|
|
29
29
|
import { Select as pr } from "./components/Select/Select.js";
|
|
30
30
|
import { StepperHeader as xr } from "./components/Stepper/components/StepperHeader.js";
|
|
31
31
|
import { StepperIndicator as ir } from "./components/Stepper/components/StepperIndicator.js";
|
|
32
|
-
import { Stepper as
|
|
33
|
-
import { VerticalDivider as
|
|
34
|
-
import { FormCheckBox as
|
|
35
|
-
import { FormDatePicker as
|
|
36
|
-
import { FormNumber as
|
|
37
|
-
import { FormRadio as
|
|
38
|
-
import { FormSelect as
|
|
39
|
-
import { FormSlider as
|
|
32
|
+
import { Stepper as lr } from "./components/Stepper/Stepper.js";
|
|
33
|
+
import { VerticalDivider as dr } from "./components/VerticalDivider/VerticalDivider.js";
|
|
34
|
+
import { FormCheckBox as cr } from "./components/FormComponents/FormCheckBox/FormCheckBox.js";
|
|
35
|
+
import { FormDatePicker as Sr } from "./components/FormComponents/FormDatePicker/FormDatePicker.js";
|
|
36
|
+
import { FormNumber as sr } from "./components/FormComponents/FormNumber/FormNumber.js";
|
|
37
|
+
import { FormRadio as Tr } from "./components/FormComponents/FormRadio/FormRadio.js";
|
|
38
|
+
import { FormSelect as Ir } from "./components/FormComponents/FormSelect/FormSelect.js";
|
|
39
|
+
import { FormSlider as Nr } from "./components/FormComponents/FormSlider/FormSlider.js";
|
|
40
40
|
import { FormText as gr } from "./components/FormComponents/FormText/FormText.js";
|
|
41
|
-
import { FormToggle as
|
|
42
|
-
import { AvailableCustomIcons as
|
|
43
|
-
import { ThemeColor as
|
|
44
|
-
import { u as
|
|
45
|
-
import { capitalizeFirstLetters as Pr, getNumberAsLocaleString as kr, trimLeadingAndTrailingSpaces as wr } from "./services/UtilService.js";
|
|
46
|
-
import {
|
|
41
|
+
import { FormToggle as Cr } from "./components/FormComponents/FormToggle/FormToggle.js";
|
|
42
|
+
import { AvailableCustomIcons as br } from "./enums/AvailableCustomIcons.js";
|
|
43
|
+
import { ThemeColor as Rr } from "./enums/ThemeColor.js";
|
|
44
|
+
import { u as Ur } from "./useBreakpoints-MzTZ0tCT.js";
|
|
45
|
+
import { capitalizeFirstLetters as hr, getFormattedDateTime as Pr, getNumberAsLocaleString as kr, trimLeadingAndTrailingSpaces as wr } from "./services/UtilService.js";
|
|
46
|
+
import { DATE_FORMAT as yr, DATE_TIME_FORMAT as Yr, TIME_FORMAT as Kr } from "./types/Time.js";
|
|
47
|
+
import { AVAILABLE_COUNTRY_KEYS as Wr, AVAILABLE_LOCALES as Xr, ENGLISH_LANGUAGE_ID as jr, GERMAN_LANGUAGE_ID as qr, LANGUAGE_CODES_MAPPER as Jr, LANGUAGE_ID_MAPPER as Qr, SPANISH_LANGUAGE_ID as Zr, TURKISH_LANGUAGE_ID as $r } from "./types/Languages.js";
|
|
47
48
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
Wr as AVAILABLE_COUNTRY_KEYS,
|
|
50
|
+
Xr as AVAILABLE_LOCALES,
|
|
50
51
|
e as AlertBanner,
|
|
51
|
-
|
|
52
|
+
br as AvailableCustomIcons,
|
|
52
53
|
f as BaseView,
|
|
53
54
|
a as BasicHeading,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
F as
|
|
55
|
+
A as BlockView,
|
|
56
|
+
n as ChipCard,
|
|
57
|
+
E as ContextMenu,
|
|
58
|
+
yr as DATE_FORMAT,
|
|
59
|
+
Yr as DATE_TIME_FORMAT,
|
|
60
|
+
L as DeleteModal,
|
|
61
|
+
_ as DetailContentWrapper,
|
|
62
|
+
F as Disclaimer,
|
|
63
|
+
jr as ENGLISH_LANGUAGE_ID,
|
|
64
|
+
G as EmptyView,
|
|
62
65
|
D as Filter,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
cr as FormCheckBox,
|
|
67
|
+
Sr as FormDatePicker,
|
|
68
|
+
sr as FormNumber,
|
|
69
|
+
Tr as FormRadio,
|
|
70
|
+
Ir as FormSelect,
|
|
71
|
+
Nr as FormSlider,
|
|
69
72
|
gr as FormText,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
73
|
+
Cr as FormToggle,
|
|
74
|
+
M as FormattedNumberDisplay,
|
|
75
|
+
qr as GERMAN_LANGUAGE_ID,
|
|
76
|
+
B as GenericTable,
|
|
77
|
+
O as HashTabView,
|
|
78
|
+
u as HeaderFilter,
|
|
79
|
+
H as HealthCheckFailed,
|
|
80
|
+
V as Iconify,
|
|
81
|
+
P as InfoGroup,
|
|
82
|
+
Jr as LANGUAGE_CODES_MAPPER,
|
|
83
|
+
Qr as LANGUAGE_ID_MAPPER,
|
|
81
84
|
m as LinkBanner,
|
|
82
|
-
|
|
85
|
+
w as ListArea,
|
|
83
86
|
y as LoadingSpinner,
|
|
84
87
|
K as Modal,
|
|
85
88
|
W as ModulePadding,
|
|
86
89
|
j as OfflineView,
|
|
87
90
|
J as OnboardingBanner,
|
|
88
91
|
Z as OverflowTooltip,
|
|
89
|
-
|
|
92
|
+
Zr as SPANISH_LANGUAGE_ID,
|
|
90
93
|
rr as ScrollbarX,
|
|
91
94
|
or as ScrollbarY,
|
|
92
95
|
tr as SearchBar,
|
|
93
96
|
pr as Select,
|
|
94
|
-
|
|
97
|
+
lr as Stepper,
|
|
95
98
|
xr as StepperHeader,
|
|
96
99
|
ir as StepperIndicator,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
Kr as TIME_FORMAT,
|
|
101
|
+
$r as TURKISH_LANGUAGE_ID,
|
|
102
|
+
Rr as ThemeColor,
|
|
103
|
+
dr as VerticalDivider,
|
|
104
|
+
hr as capitalizeFirstLetters,
|
|
105
|
+
Pr as getFormattedDateTime,
|
|
101
106
|
kr as getNumberAsLocaleString,
|
|
102
107
|
wr as trimLeadingAndTrailingSpaces,
|
|
103
|
-
|
|
108
|
+
Ur as useBreakpoints
|
|
104
109
|
};
|
|
@@ -23,3 +23,24 @@ export declare const trimLeadingAndTrailingSpaces: <T extends Record<string, unk
|
|
|
23
23
|
* @returns The language-specific formatted number.
|
|
24
24
|
*/
|
|
25
25
|
export declare const getNumberAsLocaleString: (locale: AVAILABLE_LANGUAGE_CODES, value?: number, maximumFractionDigits?: number) => string;
|
|
26
|
+
/**
|
|
27
|
+
* Formats a date using `Intl.DateTimeFormat`.
|
|
28
|
+
*
|
|
29
|
+
* @param date - The date to format (ISO string or any valid date string).
|
|
30
|
+
* @param locale - Locale to use. Defaults to `"en-US"`.
|
|
31
|
+
* - If it matches an entry in `AVAILABLE_LOCALES` (e.g. `"en"`, `"es"`, `"tr"`),
|
|
32
|
+
* it's mapped via `LANGUAGE_CODES_MAPPER` to a full tag (e.g. `"en-US"`).
|
|
33
|
+
* - Otherwise, used directly as a BCP-47 locale (e.g. `"fr-FR"`).
|
|
34
|
+
* @param options - Optional `Intl.DateTimeFormatOptions`.
|
|
35
|
+
* @returns The formatted date/time string.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* // Uses the default locale "en-US"
|
|
39
|
+
* getFormattedDateTime('2025-10-02T14:30:00Z', undefined, { dateStyle: 'medium' });
|
|
40
|
+
* // → "Oct 2, 2025"
|
|
41
|
+
*
|
|
42
|
+
* // Short code is mapped via LANGUAGE_CODES_MAPPER (e.g., "es" → "es-MX")
|
|
43
|
+
* getFormattedDateTime('2025-10-02', 'es', { dateStyle: 'long' });
|
|
44
|
+
* // → "2 de octubre de 2025"
|
|
45
|
+
*/
|
|
46
|
+
export declare const getFormattedDateTime: (date: Date | string, locale?: string, options?: Intl.DateTimeFormatOptions) => string;
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import { i as
|
|
1
|
+
import { i as m } from "../isArray-Dub1wGJM.js";
|
|
2
2
|
import { i as s, a } from "../isString-BW9UHONv.js";
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
5
|
-
Object.entries(
|
|
6
|
-
),
|
|
7
|
-
if (!
|
|
8
|
-
const
|
|
9
|
-
return
|
|
10
|
-
}
|
|
3
|
+
import { AVAILABLE_LOCALES as c, LANGUAGE_CODES_MAPPER as n } from "../types/Languages.js";
|
|
4
|
+
const L = (t) => t.split(" ").map((r) => r.charAt(0).toUpperCase() + r.slice(1).toLowerCase()).join(" "), f = (t) => Object.fromEntries(
|
|
5
|
+
Object.entries(t).map(([r, e]) => [r, i(e)])
|
|
6
|
+
), i = (t) => m(t) ? t.map(i) : s(t) ? f(t) : a(t) ? t.trim() : t, S = (t, r, e = 2) => {
|
|
7
|
+
if (!r) return "0";
|
|
8
|
+
const o = n[t];
|
|
9
|
+
return r.toLocaleString(o, { maximumFractionDigits: e });
|
|
10
|
+
}, u = (t, r = "en-US", e) => c.includes(r) ? new Intl.DateTimeFormat(
|
|
11
|
+
n[r],
|
|
12
|
+
e
|
|
13
|
+
).format(new Date(t)) : new Intl.DateTimeFormat(r, e).format(new Date(t));
|
|
11
14
|
export {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
L as capitalizeFirstLetters,
|
|
16
|
+
u as getFormattedDateTime,
|
|
17
|
+
S as getNumberAsLocaleString,
|
|
18
|
+
f as trimLeadingAndTrailingSpaces
|
|
15
19
|
};
|
|
@@ -1,47 +1,48 @@
|
|
|
1
|
-
import { getBlockNumberByDto as
|
|
2
|
-
import { capitalizeFirstLetters as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { getBlockNumberByDto as i } from "./BlockService.js";
|
|
2
|
+
import { capitalizeFirstLetters as d, trimLeadingAndTrailingSpaces as a, getFormattedDateTime as r } from "./UtilService.js";
|
|
3
|
+
import { DATE_FORMAT as n, TIME_FORMAT as l } from "../types/Time.js";
|
|
4
|
+
import { d as c, t as e, g as o } from "../vi.CjhMlMwf-CKxPQtd6.js";
|
|
5
|
+
c("Services Test", () => {
|
|
6
|
+
c("capitalizeFirstLetters", () => {
|
|
6
7
|
e("should capitalize first letters of a lower case string", () => {
|
|
7
|
-
const t =
|
|
8
|
-
|
|
8
|
+
const t = d("farm location");
|
|
9
|
+
o(t).toBe("Farm Location");
|
|
9
10
|
}), e("should turn other letters of an all caps string into lower case", () => {
|
|
10
|
-
const t =
|
|
11
|
-
|
|
11
|
+
const t = d("FARM LOCATION");
|
|
12
|
+
o(t).toBe("Farm Location");
|
|
12
13
|
});
|
|
13
|
-
}),
|
|
14
|
+
}), c("getBlockNumberByDto", () => {
|
|
14
15
|
e("should get zero", () => {
|
|
15
|
-
const t =
|
|
16
|
-
|
|
16
|
+
const t = i({ position: void 0 }, 3);
|
|
17
|
+
o(t).toBe(0);
|
|
17
18
|
}), e("should get 3", () => {
|
|
18
|
-
const t =
|
|
19
|
-
|
|
19
|
+
const t = i({ position: { row: 1, column: 3 } }, 3);
|
|
20
|
+
o(t).toBe(3);
|
|
20
21
|
});
|
|
21
|
-
}),
|
|
22
|
+
}), c("Test trimLeadingAndTrailingSpaces", () => {
|
|
22
23
|
e("should remove leading spaces", () => {
|
|
23
|
-
|
|
24
|
+
o(a({ test: " test-1" })).toEqual({ test: "test-1" });
|
|
24
25
|
}), e("should remove trailing spaces", () => {
|
|
25
|
-
|
|
26
|
+
o(a({ test: "test-1 " })).toEqual({ test: "test-1" });
|
|
26
27
|
}), e("should not remove other spaces than the leading and trailing once", () => {
|
|
27
|
-
|
|
28
|
+
o(a({ test: " t e s t 1 " })).toEqual({ test: "t e s t 1" });
|
|
28
29
|
}), e("should remove leading and trailing spaces", () => {
|
|
29
|
-
|
|
30
|
+
o(a({ test1: " test-1 ", test2: "test-2 " })).toEqual({
|
|
30
31
|
test1: "test-1",
|
|
31
32
|
test2: "test-2"
|
|
32
33
|
});
|
|
33
34
|
}), e("should not change other values than strings", () => {
|
|
34
|
-
|
|
35
|
+
o(a({ test1: " test-1 ", test2: 123456 })).toEqual({
|
|
35
36
|
test1: "test-1",
|
|
36
37
|
test2: 123456
|
|
37
38
|
});
|
|
38
39
|
}), e("should remove spaces from strings in an nested object", () => {
|
|
39
|
-
|
|
40
|
+
o(a({ test1: " test-1 ", test2: { nestedObjectKey: "test-2 " } })).toEqual({
|
|
40
41
|
test1: "test-1",
|
|
41
42
|
test2: { nestedObjectKey: "test-2" }
|
|
42
43
|
});
|
|
43
44
|
}), e("should remove spaces from strings of an array", () => {
|
|
44
|
-
|
|
45
|
+
o(a({
|
|
45
46
|
test1: " test-1 ",
|
|
46
47
|
test2: { nestedObjectKey: ["test-2 ", " test-3 ", 2345] }
|
|
47
48
|
})).toEqual({
|
|
@@ -50,7 +51,53 @@ n("Services Test", () => {
|
|
|
50
51
|
});
|
|
51
52
|
}), e("should not trim date instances", () => {
|
|
52
53
|
const t = { date: /* @__PURE__ */ new Date() };
|
|
53
|
-
|
|
54
|
+
o(a(t)).toEqual(t);
|
|
55
|
+
});
|
|
56
|
+
}), c("getFormattedDateTime", () => {
|
|
57
|
+
const t = "2025-01-20T16:01:50.097Z";
|
|
58
|
+
e('should format date correctly for locale "undefined"', () => {
|
|
59
|
+
const s = r(t, void 0, n);
|
|
60
|
+
o(s).toBe("01/20/2025");
|
|
61
|
+
}), e('should format date correctly for locale "de"', () => {
|
|
62
|
+
const s = r(t, "de", {
|
|
63
|
+
day: "2-digit",
|
|
64
|
+
month: "2-digit",
|
|
65
|
+
year: "numeric"
|
|
66
|
+
});
|
|
67
|
+
o(s).toBe("20.01.2025");
|
|
68
|
+
}), e('should format date correctly for locale "en"', () => {
|
|
69
|
+
const s = r(t, "en", n);
|
|
70
|
+
o(s).toBe("01/20/2025");
|
|
71
|
+
}), e('should format datetime correctly for local "en"', () => {
|
|
72
|
+
const s = r(t, "en", {
|
|
73
|
+
...l,
|
|
74
|
+
timeZone: "America/New_York"
|
|
75
|
+
});
|
|
76
|
+
o(s).toBe("11:01 AM");
|
|
77
|
+
}), e('should format date correctly for locale "es', () => {
|
|
78
|
+
const s = r(t, "es", n);
|
|
79
|
+
o(s).toBe("20/01/2025");
|
|
80
|
+
}), e('should format datetime correctly for local "es"', () => {
|
|
81
|
+
const s = r(t, "es", {
|
|
82
|
+
...l,
|
|
83
|
+
timeZone: "America/Mexico_City"
|
|
84
|
+
});
|
|
85
|
+
o(s).toBe("10:01 a.m.");
|
|
86
|
+
}), e('should format date correctly for locale "tr', () => {
|
|
87
|
+
const s = r(t, "tr", n);
|
|
88
|
+
o(s).toBe("20.01.2025");
|
|
89
|
+
}), e('should format datetime correctly for local "tr"', () => {
|
|
90
|
+
const s = r(t, "tr", {
|
|
91
|
+
...l,
|
|
92
|
+
timeZone: "Europe/Istanbul"
|
|
93
|
+
});
|
|
94
|
+
o(s).toBe("ÖS 07:01");
|
|
95
|
+
}), e('should format date correctly for locale "gb', () => {
|
|
96
|
+
const s = r(t, "en-GB", n);
|
|
97
|
+
o(s).toBe("20/01/2025");
|
|
98
|
+
}), e('should format date correctly for locale "fr', () => {
|
|
99
|
+
const s = r(t, "fr", n);
|
|
100
|
+
o(s).toBe("20/01/2025");
|
|
54
101
|
});
|
|
55
102
|
});
|
|
56
103
|
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Date and time format options to be used in the {@link getFormattedDateTime} function.
|
|
3
|
+
*/
|
|
4
|
+
export declare const DATE_FORMAT: {
|
|
5
|
+
readonly day: "2-digit";
|
|
6
|
+
readonly month: "2-digit";
|
|
7
|
+
readonly year: "numeric";
|
|
8
|
+
};
|
|
9
|
+
export declare const TIME_FORMAT: {
|
|
10
|
+
readonly hour: "2-digit";
|
|
11
|
+
readonly minute: "2-digit";
|
|
12
|
+
readonly hour12: true;
|
|
13
|
+
};
|
|
14
|
+
export declare const DATE_TIME_FORMAT: {
|
|
15
|
+
readonly hour: "2-digit";
|
|
16
|
+
readonly minute: "2-digit";
|
|
17
|
+
readonly hour12: true;
|
|
18
|
+
readonly day: "2-digit";
|
|
19
|
+
readonly month: "2-digit";
|
|
20
|
+
readonly year: "numeric";
|
|
21
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const t = {
|
|
2
|
+
day: "2-digit",
|
|
3
|
+
month: "2-digit",
|
|
4
|
+
year: "numeric"
|
|
5
|
+
}, i = {
|
|
6
|
+
hour: "2-digit",
|
|
7
|
+
minute: "2-digit",
|
|
8
|
+
hour12: !0
|
|
9
|
+
}, o = {
|
|
10
|
+
...t,
|
|
11
|
+
...i
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
t as DATE_FORMAT,
|
|
15
|
+
o as DATE_TIME_FORMAT,
|
|
16
|
+
i as TIME_FORMAT
|
|
17
|
+
};
|
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.
|
|
4
|
+
"version": "2.7.0",
|
|
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,48 +0,0 @@
|
|
|
1
|
-
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { G as s } from "./index.es-CbBdaRO2.js";
|
|
3
|
-
import { Iconify as _ } from "./components/Iconify/Iconify.js";
|
|
4
|
-
import { b as m, d as y, T as h } from "./index.es--yyG47az.js";
|
|
5
|
-
import { B as v } from "./index.es-Bx1E5MPK.js";
|
|
6
|
-
import './assets/OfflineView.css';const w = "_gap_18we6_1", G = "_container_18we6_5", T = "_bgWhite_18we6_11", x = "_bgGrey_18we6_16", W = "_subtitle_18we6_21", i = {
|
|
7
|
-
gap: w,
|
|
8
|
-
container: G,
|
|
9
|
-
bgWhite: T,
|
|
10
|
-
bgGrey: x,
|
|
11
|
-
subtitle: W
|
|
12
|
-
}, z = ({
|
|
13
|
-
title: t = "You’re currently offline",
|
|
14
|
-
subtitle: a = "This feature is unavailable until you reconnect",
|
|
15
|
-
icon: l = "cloud_off",
|
|
16
|
-
size: c = "large",
|
|
17
|
-
variant: d = "basic",
|
|
18
|
-
"data-testid": f = "offline-view-container",
|
|
19
|
-
buttonLabel: n,
|
|
20
|
-
fullWidth: g = !1,
|
|
21
|
-
className: b,
|
|
22
|
-
onClick: p
|
|
23
|
-
}) => {
|
|
24
|
-
const r = c === "large", u = d === "filled";
|
|
25
|
-
return /* @__PURE__ */ o(
|
|
26
|
-
s,
|
|
27
|
-
{
|
|
28
|
-
className: `${b} ${i.container} ${u ? i.bgGrey : i.bgWhite}`,
|
|
29
|
-
gap: "standard",
|
|
30
|
-
direction: "vertical",
|
|
31
|
-
"data-testid": f,
|
|
32
|
-
secondaryAlign: "center",
|
|
33
|
-
fullWidth: g,
|
|
34
|
-
children: [
|
|
35
|
-
/* @__PURE__ */ o(s, { direction: "vertical", secondaryAlign: "center", className: i.gap, children: [
|
|
36
|
-
/* @__PURE__ */ e(_, { icon: l, iconSize: r ? "xlarge" : "medium" }),
|
|
37
|
-
r ? /* @__PURE__ */ e(m, { level: 6, children: t }) : /* @__PURE__ */ e(y, { level: 1, bold: !0, children: t })
|
|
38
|
-
] }),
|
|
39
|
-
a && /* @__PURE__ */ e(h, { className: i.subtitle, level: 2, children: a }),
|
|
40
|
-
n && /* @__PURE__ */ e(v, { "data-testid": "offline-view-action-button", label: n, onClick: p })
|
|
41
|
-
]
|
|
42
|
-
}
|
|
43
|
-
);
|
|
44
|
-
};
|
|
45
|
-
export {
|
|
46
|
-
z as O,
|
|
47
|
-
i as s
|
|
48
|
-
};
|