@hortiview/shared-components 1.12.0 → 2.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.
@@ -1,350 +0,0 @@
1
- import { jsx as n, jsxs as C, Fragment as B } from "react/jsx-runtime";
2
- import { C as W, a as z, b as D, c as E, d as M } from "./index.es-6TJ1S8Jr.js";
3
- import { c as x, _ as P, P as e } from "./identity-DLWZln-X.js";
4
- import b, { forwardRef as $, useMemo as f, useRef as j, useImperativeHandle as q, createContext as F, useContext as I } from "react";
5
- import { d as U } from "./index.es-da0cf7oE.js";
6
- import { d as O } from "./index.es-D54RuMc_.js";
7
- import { OverflowTooltip as k } from "./components/OverflowTooltip/OverflowTooltip.js";
8
- import './assets/GenericCard.css';const R = /* @__PURE__ */ F({}), V = {
9
- /**
10
- * @deprecated _Use `variant`='airy' instead._
11
- *
12
- * Applies extra padding to each column.
13
- *
14
- * Defaults to **undefined**.
15
- */
16
- airy: U(e.bool, "Grid", 'Use `variant`="airy" instead.'),
17
- /**
18
- * Accepts GridCol or GridRow.
19
- *
20
- * Defaults to **null**.
21
- */
22
- children: e.node.isRequired,
23
- /**
24
- * The css class name to be passed through to the component markup.
25
- *
26
- * Defaults to **undefined**.
27
- */
28
- className: e.string,
29
- /**
30
- * Sets the column gap for the grid.
31
- *
32
- * Defaults to **'16px'**.
33
- */
34
- columnGap: e.oneOfType([e.string, e.number]),
35
- /**
36
- * Applies 100% height to the grid and direct children rows. Useful when creating a page layout. Be aware all direct children rows will have a 100% height.
37
- *
38
- * Defaults to **null**.
39
- */
40
- fullHeight: e.bool,
41
- /**
42
- * Applies 100% width to the grid and direct children rows. Useful to maintain full width in a flex container.
43
- *
44
- * Defaults to **null**.
45
- */
46
- fullWidth: e.bool,
47
- /**
48
- * Alignment of entire grid: left and right.
49
- *
50
- * Defaults to **'center'**.
51
- */
52
- gridAlign: e.oneOf(["center", "left", "right"]),
53
- /**
54
- * Sets the row gap for the grid.
55
- *
56
- * Defaults to **'16px'**.
57
- */
58
- rowGap: e.oneOfType([e.string, e.number]),
59
- /**
60
- * Styles for the grid.
61
- *
62
- * Defaults to **undefined**.
63
- */
64
- style: e.object,
65
- /**
66
- * If true the grid will have a max width according to your theme's breakpoints.
67
- *
68
- * Defaults to **false**.
69
- */
70
- useMaxWidth: e.bool,
71
- /**
72
- * Select `airy` or `standard` padding.
73
- *
74
- * Defaults to **'standard'**.
75
- */
76
- variant: e.oneOf(["standard", "airy", "none"])
77
- }, J = {
78
- airy: void 0,
79
- children: null,
80
- className: void 0,
81
- columnGap: "16px",
82
- fullHeight: null,
83
- fullWidth: null,
84
- gridAlign: "center",
85
- rowGap: "16px",
86
- style: void 0,
87
- useMaxWidth: !1,
88
- variant: "standard"
89
- }, K = {
90
- /**
91
- * Alignment of cell within the row: top, middle, bottom. If omitted the col will stretch to the height of the row.
92
- *
93
- * Defaults to **undefined**.
94
- */
95
- align: e.oneOf(["", "top", "middle", "bottom"]),
96
- /**
97
- * Content to be rendered inside the GridCol. Accepts any valid markup.
98
- *
99
- * Defaults to **null**.
100
- */
101
- children: e.node,
102
- /**
103
- * The css class name to be passed through to the component markup.
104
- *
105
- * Defaults to **undefined**.
106
- */
107
- className: e.string,
108
- /**
109
- * Specifies the number of columns the cell spans.
110
- *
111
- * Defaults to **null**.
112
- */
113
- desktopCol: e.number,
114
- /**
115
- * Specifies a grid item's start position within the grid column by contributing a line, a span, or nothing (automatic) to its grid placement. Set to any valid `grid-column-start`.
116
- *
117
- * Defaults to **null**.
118
- */
119
- gridColStart: e.oneOfType([e.string, e.number]),
120
- /**
121
- * Horizontal alignment of the cell contents of cell content: top, middle, bottom.
122
- *
123
- * Defaults to **'left'**.
124
- */
125
- horizontalAlign: e.oneOf(["left", "center", "right"]),
126
- /**
127
- * Specifies the order of the cell.
128
- *
129
- * Defaults to **null**.
130
- */
131
- order: e.number,
132
- /**
133
- * Specifies the number of columns the cell spans on a phone.
134
- *
135
- * Defaults to **null**.
136
- */
137
- phoneCol: e.number,
138
- /**
139
- * Specifies the number of columns the cell spans on a tablet.
140
- *
141
- * Defaults to **null**.
142
- */
143
- tabletCol: e.number,
144
- /**
145
- * Vertical alignment of cell content: top, middle, bottom.
146
- *
147
- * Defaults to **'top'**.
148
- */
149
- verticalAlign: e.oneOf(["top", "middle", "bottom"])
150
- }, L = {
151
- align: void 0,
152
- children: null,
153
- className: void 0,
154
- desktopCol: null,
155
- gridColStart: null,
156
- horizontalAlign: "left",
157
- order: null,
158
- phoneCol: null,
159
- tabletCol: null,
160
- verticalAlign: "top"
161
- }, Q = {
162
- /**
163
- * Content to be rendered inside the GridRow. Accepts any valid markup.
164
- *
165
- * Defaults to **null**.
166
- */
167
- children: e.node.isRequired,
168
- /**
169
- * The css class name to be passed through to the component markup.
170
- *
171
- * Defaults to **undefined**.
172
- */
173
- className: e.string
174
- }, X = {
175
- children: null,
176
- className: void 0
177
- }, v = /* @__PURE__ */ $((l, t) => {
178
- const {
179
- airy: a,
180
- children: o,
181
- className: d,
182
- columnGap: i,
183
- fullHeight: r,
184
- fullWidth: s,
185
- gridAlign: u,
186
- rowGap: m,
187
- style: c,
188
- useMaxWidth: g,
189
- variant: y,
190
- ...w
191
- } = l, h = a ? "airy" : y, G = f(() => ({
192
- fullHeight: r,
193
- rowGap: m,
194
- columnGap: i
195
- }), [i, r, m]), A = j();
196
- q(t, () => A.current, []);
197
- const S = f(() => x("lmnt", "mdc-layout-grid", "lmnt-layout-grid", `mdc-layout-grid mdc-layout-grid--align-${u}`, (h === "airy" || a) && "mdc-grid-cell-wrapper-airy-tablet mdc-grid-cell-wrapper-airy-desktop", y === "none" && "mdc-grid-cell-wrapper-none-tablet mdc-grid-cell-wrapper-none-desktop mdc-grid-cell-wrapper-none-phone ", s && "lmnt-layout-grid--full-width", r && "lmnt-layout-grid--full-height", g && "lmnt-layout-grid--with-max-width", d), [a, d, h, r, s, u, g, y]);
198
- return /* @__PURE__ */ b.createElement(R.Provider, {
199
- value: G
200
- }, /* @__PURE__ */ b.createElement("div", P({
201
- ref: A,
202
- className: S
203
- }, w), o));
204
- });
205
- v.displayName = "Grid";
206
- v.propTypes = V;
207
- v.defaultProps = J;
208
- const _ = /* @__PURE__ */ $((l, t) => {
209
- const {
210
- align: a,
211
- children: o,
212
- className: d,
213
- columns: i,
214
- desktopCol: r,
215
- gridColStart: s,
216
- horizontalAlign: u,
217
- order: m,
218
- phoneCol: c,
219
- style: g,
220
- tabletCol: y,
221
- verticalAlign: w,
222
- ...h
223
- } = l, G = f(() => ({
224
- ...g,
225
- gridColumnStart: s
226
- }), [s, g]);
227
- return /* @__PURE__ */ b.createElement("div", P({
228
- ref: t,
229
- style: G,
230
- className: x("lmnt", `lmnt-layout-grid__cell--vertical-align-${w}`, `lmnt-layout-grid__cell--horizontal-align-${u}`, "mdc-layout-grid__cell", !i && !c && !y && !r && ["mdc-layout-grid__cell"], m && `mdc-layout-grid__cell--order-${m}`, a && `mdc-layout-grid__cell--align-${a}`, i && [`mdc-layout-grid__cell--span-${i}`], c && [`mdc-layout-grid__cell--span-${c}-phone`], y && [`mdc-layout-grid__cell--span-${y}-tablet`], r && [`mdc-layout-grid__cell--span-${r}-desktop`], "lmnt-layout-grid__cell", d)
231
- }, h), o);
232
- });
233
- _.displayName = "GridCol";
234
- _.propTypes = K;
235
- _.defaultProps = L;
236
- const T = /* @__PURE__ */ $((l, t) => {
237
- const {
238
- children: a,
239
- className: o,
240
- style: d,
241
- ...i
242
- } = l, {
243
- fullHeight: r,
244
- rowGap: s,
245
- columnGap: u
246
- } = I(R), m = f(() => {
247
- let c = {
248
- rowGap: s,
249
- columnGap: u
250
- };
251
- return r && (c = {
252
- ...c,
253
- height: "100%"
254
- }), {
255
- ...d,
256
- ...c
257
- };
258
- }, [d, r, s, u]);
259
- return /* @__PURE__ */ b.createElement("div", P({
260
- ref: t,
261
- className: x("lmnt", "mdc-layout-grid__inner", "lmnt-layout-grid__inner", o),
262
- style: m
263
- }, i), a);
264
- });
265
- T.displayName = "GridRow";
266
- T.propTypes = Q;
267
- T.defaultProps = X;
268
- const Y = "_cardTitle_ny9m0_1", Z = "_cardBody_ny9m0_5", ee = "_cardContent_ny9m0_10", te = "_row_ny9m0_14", re = "_font_ny9m0_18", le = "_fontHeader_ny9m0_23", ae = "_title_ny9m0_27", ne = "_emptyContainer_ny9m0_33", oe = "_empty_ny9m0_33", p = {
269
- cardTitle: Y,
270
- cardBody: Z,
271
- cardContent: ee,
272
- row: te,
273
- font: re,
274
- fontHeader: le,
275
- title: ae,
276
- emptyContainer: ne,
277
- empty: oe
278
- }, H = {
279
- desktopCol: 6,
280
- phoneCol: 2,
281
- tabletCol: 4,
282
- verticalAlign: "bottom"
283
- }, ge = ({ item: l, columns: t, hiddenColumns: a }) => {
284
- const o = t.find((r) => r.asCardTitle), d = t.find((r) => r.asCardSubtitle), i = f(
285
- () => t.filter(
286
- (r) => !r.asCardTitle && !r.asCardSubtitle && r.id !== "actions"
287
- ),
288
- [t]
289
- );
290
- return /* @__PURE__ */ n(
291
- W,
292
- {
293
- variant: "raised",
294
- "data-testid": `card${o ? "-" + l[o.accessor] : ""}`,
295
- children: /* @__PURE__ */ C(z, { className: p.cardContent, "data-testid": "card-content", children: [
296
- /* @__PURE__ */ n(ie, { item: l, titleColumn: o, subTitleColumn: d }),
297
- /* @__PURE__ */ n(D, { className: p.cardBody, "data-testid": "card-body", children: /* @__PURE__ */ n(v, { fullHeight: !0, fullWidth: !0, variant: "none", children: i.map((r) => a?.includes(r.id) ? null : /* @__PURE__ */ C(T, { className: p.row, "data-testid": "row", children: [
298
- /* @__PURE__ */ n(_, { horizontalAlign: "right", ...H, children: /* @__PURE__ */ C(
299
- O,
300
- {
301
- level: 2,
302
- themeColor: "text-secondary-on-background",
303
- className: `${p.font} ${p.fontHeader}`,
304
- tag: "div",
305
- children: [
306
- r.header,
307
- ":"
308
- ]
309
- }
310
- ) }),
311
- /* @__PURE__ */ n(_, { horizontalAlign: "left", ...H, children: /* @__PURE__ */ n(N, { column: r, item: l }) })
312
- ] }, r.id)) }) })
313
- ] })
314
- }
315
- );
316
- }, ie = ({ item: l, titleColumn: t, subTitleColumn: a }) => {
317
- const o = l.actions;
318
- return !t && !a && !o ? null : /* @__PURE__ */ C(B, { children: [
319
- /* @__PURE__ */ n(
320
- E,
321
- {
322
- "data-testid": "card-title",
323
- className: p.cardTitle,
324
- primaryText: t !== void 0 && /* @__PURE__ */ n(N, { column: t, item: l, isTitle: !0 }),
325
- secondaryText: a !== void 0 && /* @__PURE__ */ n(N, { column: a, item: l, isTitle: !0 }),
326
- trailingBlock: o,
327
- trailingBlockType: o ? "title-actions" : void 0
328
- }
329
- ),
330
- /* @__PURE__ */ n(M, {})
331
- ] });
332
- }, N = ({ item: l, column: t, isTitle: a = !1 }) => t.cellTemplate ? t.cellTemplate({ row: { original: l } }) : a ? /* @__PURE__ */ n(
333
- k,
334
- {
335
- id: `tip_${t.id}_${l[t.accessor]}`,
336
- text: l[t.accessor],
337
- children: /* @__PURE__ */ n("span", { className: p.title, children: l[t.accessor] })
338
- }
339
- ) : /* @__PURE__ */ n(
340
- k,
341
- {
342
- id: `tip_${t.id}_${l[t.accessor]}`,
343
- text: l[t.accessor],
344
- children: /* @__PURE__ */ n(O, { level: 2, themeColor: "text-primary-on-background", className: p.font, children: l[t.accessor] })
345
- }
346
- );
347
- export {
348
- ge as G,
349
- p as s
350
- };
@@ -1 +0,0 @@
1
- @import"https://fonts.googleapis.com/css?family=Roboto:300,400,400i,500,700|Roboto+Mono:400,500|Material+Icons";