asma-ui-core 3.128.1 → 3.129.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.
Files changed (34) hide show
  1. package/dist/asma-ui-core.css +1 -1
  2. package/dist/components/custom/widget/widget/StyledWidget.js +4 -4
  3. package/dist/components/data-display/card/Card.js +327 -0
  4. package/dist/components/data-display/card/Card.module.js +7 -0
  5. package/dist/components/data-display/card/Card.types.js +21 -0
  6. package/dist/components/data-display/card/CardList.js +85 -0
  7. package/dist/components/data-display/card/CardParts.js +97 -0
  8. package/dist/components/data-display/card/cardModel.js +46 -0
  9. package/dist/components/data-display/interactive-chip/StyledInteractiveChip.js +4 -4
  10. package/dist/components/feedback/dialog/StyledDialog.js +5 -5
  11. package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +7 -7
  12. package/dist/components/inputs/button/StyledButton.js +1 -1
  13. package/dist/components/inputs/dynamic-select/components/DynamicInteractiveChipGroup.js +4 -4
  14. package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +1 -1
  15. package/dist/components/inputs/emoji-choice/StyledEmojiChoice.js +1 -1
  16. package/dist/components/inputs/phone-field/CountryCodeSelect.js +4 -4
  17. package/dist/components/inputs/select-autocomplete/SelectAutocompletePicker.js +1 -1
  18. package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +4 -4
  19. package/dist/components/navigation/menu/StyledMenuList.js +1 -1
  20. package/dist/components/utils/bottom-sheet/StyledBottomSheet.js +9 -9
  21. package/dist/components/utils/popover/PopoverAnatomy.js +10 -10
  22. package/dist/components/utils/popover/PopoverSheet.js +11 -11
  23. package/dist/index.js +632 -619
  24. package/dist/src/components/data-display/card/Card.d.ts +9 -0
  25. package/dist/src/components/data-display/card/Card.types.d.ts +193 -0
  26. package/dist/src/components/data-display/card/CardList.d.ts +45 -0
  27. package/dist/src/components/data-display/card/CardParts.d.ts +44 -0
  28. package/dist/src/components/data-display/card/cardModel.d.ts +61 -0
  29. package/dist/src/components/data-display/card/cardModel.test.d.ts +1 -0
  30. package/dist/src/components/data-display/card/index.d.ts +5 -0
  31. package/dist/src/components/data-display/card/story/cardStoryFixtures.d.ts +95 -0
  32. package/dist/src/components/utils/popover/PopoverAnatomy.d.ts +5 -2
  33. package/dist/src/index.d.ts +1 -0
  34. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { cn as s } from "../../../../helpers/cn.js";
2
- import N from "../icons/ChevronDownIcon.js";
3
- import { StyledButton as b } from "../../../inputs/button/StyledButton.js";
2
+ import { StyledButton as N } from "../../../inputs/button/StyledButton.js";
3
+ import b from "../icons/ChevronDownIcon.js";
4
4
  import { StyledEmptyPage as C } from "../../../feedback/empty-page/StyledEmptyPage.js";
5
5
  import { StyledLoading as I } from "../../../feedback/loading/StyledLoading.js";
6
6
  import { StyledLink as v } from "../../../navigation/link/StyledLink.js";
@@ -48,7 +48,7 @@ var V = ({ children: m, title: c, titleNode: h, icon: n, link: l, viewMore: t, p
48
48
  className: a["widget-all-shown"],
49
49
  "data-testid": "all-items-shown",
50
50
  children: t.disabledReason
51
- }) : /* @__PURE__ */ e(b, {
51
+ }) : /* @__PURE__ */ e(N, {
52
52
  dataTest: "view-more",
53
53
  variant: "text",
54
54
  disabled: !!t.disabled && !d,
@@ -56,7 +56,7 @@ var V = ({ children: m, title: c, titleNode: h, icon: n, link: l, viewMore: t, p
56
56
  endIcon: d ? /* @__PURE__ */ e(k, {
57
57
  width: 20,
58
58
  height: 20
59
- }) : /* @__PURE__ */ e(N, {
59
+ }) : /* @__PURE__ */ e(b, {
60
60
  width: 20,
61
61
  height: 20
62
62
  }),
@@ -0,0 +1,327 @@
1
+ import { cn as s } from "../../../helpers/cn.js";
2
+ import { StyledBadge as D } from "../badge/StyledBadge.js";
3
+ import { ChevronRightIcon as U } from "../../icons/chevron-right-icon/ChevronRightIcon.js";
4
+ import { VisibilityOutlineIcon as G } from "../../icons/visibility-outline-icon/VisibilityOutlineIcon.js";
5
+ import { WarningAmberOutlineIcon as J } from "../../icons/warning-icon/WarningAmberOutlineIcon.js";
6
+ import { CARD_LABELS as K } from "./Card.types.js";
7
+ import { CardContext as Q, CardListItemContext as X, resolveCardModel as Y, usePressedHold as Z } from "./cardModel.js";
8
+ import { CardCheckboxControl as ee, CardControl as S, CardMenuControl as ae, CardTag as te } from "./CardParts.js";
9
+ import M from "./Card.module.js";
10
+ import { Fragment as ne, isValidElement as ie, useCallback as le, useContext as re, useEffect as se, useId as de, useMemo as ce, useState as oe } from "react";
11
+ import { Fragment as me, jsx as a, jsxs as l } from "react/jsx-runtime";
12
+ var he = ({ unread: e, labels: t, id: n, dataTest: i }) => {
13
+ const r = typeof e == "object" && e.visibleLabel;
14
+ return /* @__PURE__ */ l("span", {
15
+ className: "inline-flex items-center gap-1",
16
+ children: [
17
+ /* @__PURE__ */ a(D, {
18
+ dataTest: `${i}-unread`,
19
+ variant: "dot",
20
+ purpose: "unread",
21
+ "aria-hidden": "true"
22
+ }),
23
+ /* @__PURE__ */ a("span", {
24
+ id: n,
25
+ hidden: !0,
26
+ children: t.unread
27
+ }),
28
+ r && /* @__PURE__ */ a("span", {
29
+ "aria-hidden": "true",
30
+ className: "text-[0.6875rem] font-semibold uppercase leading-3 tracking-[0.034375rem] text-gama-600",
31
+ children: t.unread
32
+ })
33
+ ]
34
+ });
35
+ }, ue = ({ checkbox: e, unread: t, tags: n, menu: i, titleText: r, labels: c, unreadId: o, dataTest: u }) => /* @__PURE__ */ l("div", {
36
+ className: s("flex flex-wrap items-center gap-2", !e && "pl-3", !e && !i && "pb-1 pt-2"),
37
+ children: [
38
+ e && /* @__PURE__ */ a(ee, {
39
+ checkbox: e,
40
+ titleText: r,
41
+ labels: c,
42
+ dataTest: u
43
+ }),
44
+ t && /* @__PURE__ */ a(he, {
45
+ unread: t,
46
+ labels: c,
47
+ id: o,
48
+ dataTest: u
49
+ }),
50
+ !!n?.length && /* @__PURE__ */ a("span", {
51
+ className: s("inline-flex flex-wrap gap-2", !!(e ?? t) && "pl-1"),
52
+ children: n?.map((m, d) => /* @__PURE__ */ a(ne, { children: typeof m == "string" ? /* @__PURE__ */ a(te, { children: m }) : m }, d))
53
+ }),
54
+ i && /* @__PURE__ */ a(ae, {
55
+ menu: i,
56
+ titleText: r,
57
+ labels: c,
58
+ dataTest: u
59
+ })
60
+ ]
61
+ }), fe = ({ type: e, status: t, overdue: n, ids: i, hasTopRow: r, isDisabled: c }) => !e && !t && !n ? null : /* @__PURE__ */ l("div", {
62
+ className: s("flex flex-wrap items-start justify-between gap-x-4 gap-y-2", !r && "pt-2"),
63
+ children: [e && /* @__PURE__ */ l("span", {
64
+ id: i.type,
65
+ className: s("inline-flex min-w-0 items-center [overflow-wrap:anywhere]", e.size === "body" ? "gap-1 text-base leading-6" : "gap-[3px] text-sm leading-5", n && "text-warning-800"),
66
+ style: { color: n ? void 0 : e.color },
67
+ children: [e.icon && /* @__PURE__ */ a("span", {
68
+ "aria-hidden": "true",
69
+ className: s("inline-flex items-center justify-center", e.size === "body" ? "h-5 w-5 [&>svg]:h-5 [&>svg]:w-5" : "h-4 w-4 [&>svg]:h-4 [&>svg]:w-4"),
70
+ children: e.icon
71
+ }), /* @__PURE__ */ a("span", {
72
+ "data-card-type-label": "",
73
+ className: "min-w-0",
74
+ children: e.label
75
+ })]
76
+ }), /* @__PURE__ */ l("span", {
77
+ id: i.status,
78
+ className: s("ml-auto inline-flex min-w-0 flex-wrap items-center justify-end gap-x-2 text-right text-sm leading-5 [overflow-wrap:anywhere]", c ? "text-delta-600" : "text-delta-700"),
79
+ children: [t && /* @__PURE__ */ l("span", {
80
+ className: "inline-flex min-w-0 items-center gap-2",
81
+ children: [t.label, t.squareColor && /* @__PURE__ */ a("span", {
82
+ "aria-hidden": "true",
83
+ className: "h-3 w-3 shrink-0 rounded-sm",
84
+ style: { backgroundColor: t.squareColor }
85
+ })]
86
+ }), n && /* @__PURE__ */ l("span", {
87
+ className: "inline-flex min-w-0 items-center gap-2 text-warning-700",
88
+ children: [n.label, /* @__PURE__ */ a(J, {
89
+ "aria-hidden": "true",
90
+ className: "h-5 w-5 shrink-0"
91
+ })]
92
+ })]
93
+ })]
94
+ }), ve = {
95
+ 1: "min-w-0 truncate",
96
+ 2: "line-clamp-2 [overflow-wrap:anywhere]"
97
+ }, $ = () => /* @__PURE__ */ l("span", {
98
+ "aria-hidden": "true",
99
+ "data-card-chevron": "",
100
+ className: "inline-block whitespace-nowrap align-top",
101
+ children: ["⁠", /* @__PURE__ */ a(U, { className: "-my-px inline-block h-6 w-6 align-top" })]
102
+ }), _ = ({ title: e, titleId: t, titleClamp: n, titleChevron: i }) => n ? /* @__PURE__ */ l("span", {
103
+ className: "inline-flex max-w-full items-start",
104
+ children: [/* @__PURE__ */ a("span", {
105
+ id: t,
106
+ className: ve[n],
107
+ children: e
108
+ }), i && /* @__PURE__ */ a($, {})]
109
+ }) : /* @__PURE__ */ l(me, { children: [/* @__PURE__ */ a("span", {
110
+ id: t,
111
+ className: "[overflow-wrap:anywhere]",
112
+ children: e
113
+ }), i && /* @__PURE__ */ a($, {})] }), xe = ({ level: e, model: t, open: n, labelledBy: i, describedBy: r, selected: c, disabled: o, className: u, ...m }) => {
114
+ const d = `h${e}`, f = s("m-0 min-w-0 text-base font-semibold leading-6 text-delta-800", u);
115
+ if (t === "static" || !n) return /* @__PURE__ */ a(d, {
116
+ className: f,
117
+ "data-card-title": "",
118
+ children: /* @__PURE__ */ a(_, {
119
+ ...m,
120
+ titleChevron: !1,
121
+ titleClamp: void 0
122
+ })
123
+ });
124
+ const h = {
125
+ className: M.link ?? "",
126
+ "aria-labelledby": i,
127
+ "aria-describedby": r,
128
+ "aria-current": c ? "true" : void 0,
129
+ "data-card-link": "",
130
+ children: /* @__PURE__ */ a(_, { ...m })
131
+ };
132
+ if (o) return /* @__PURE__ */ a(d, {
133
+ className: f,
134
+ "data-card-title": "",
135
+ children: "onOpen" in n ? /* @__PURE__ */ a("button", {
136
+ type: "button",
137
+ "aria-haspopup": "dialog",
138
+ "aria-disabled": "true",
139
+ ...h
140
+ }) : /* @__PURE__ */ a("a", {
141
+ role: "link",
142
+ tabIndex: 0,
143
+ "aria-disabled": "true",
144
+ ...h,
145
+ children: h.children
146
+ })
147
+ });
148
+ if ("onOpen" in n) return /* @__PURE__ */ a(d, {
149
+ className: f,
150
+ "data-card-title": "",
151
+ children: /* @__PURE__ */ a("button", {
152
+ type: "button",
153
+ "aria-haspopup": "dialog",
154
+ onClick: n.onOpen,
155
+ ...h
156
+ })
157
+ });
158
+ const w = {
159
+ ...h,
160
+ href: n.href,
161
+ target: n.target,
162
+ onClick: n.onClick
163
+ };
164
+ return /* @__PURE__ */ a(d, {
165
+ className: f,
166
+ "data-card-title": "",
167
+ children: n.renderLink ? n.renderLink(w) : /* @__PURE__ */ a("a", {
168
+ ...w,
169
+ children: w.children
170
+ })
171
+ });
172
+ }, P = "inline-flex items-center pb-2 text-base font-semibold leading-6", ge = ({ ctaContent: e, ctaId: t, selected: n, overdue: i, labels: r }) => n ? /* @__PURE__ */ l("span", {
173
+ "aria-hidden": "true",
174
+ "data-card-viewing-now": "",
175
+ className: s(P, "gap-1 pr-3", i ? "text-warning-800" : "text-gama-500"),
176
+ children: [/* @__PURE__ */ a(G, { className: "h-6 w-6" }), r.viewingNow]
177
+ }) : e === void 0 ? null : /* @__PURE__ */ a("span", {
178
+ id: t,
179
+ "aria-hidden": "true",
180
+ className: s(P, "pr-1", i ? "text-warning-800" : "text-gama-500"),
181
+ children: e
182
+ }), we = ({ footerAction: e, ctaAction: t, className: n, ...i }) => !(i.selected || i.ctaContent !== void 0 || t) && !e ? null : /* @__PURE__ */ l("div", {
183
+ className: s("mt-auto flex flex-wrap items-end gap-x-4 pl-3", n),
184
+ children: [e && /* @__PURE__ */ a(S, {
185
+ className: "gap-x-4",
186
+ children: e
187
+ }), /* @__PURE__ */ a("div", {
188
+ className: "ml-auto flex flex-wrap items-end justify-end gap-x-4",
189
+ children: t && !i.selected ? /* @__PURE__ */ a(S, { children: t }) : /* @__PURE__ */ a(ge, { ...i })
190
+ })]
191
+ }), B = (e) => typeof e == "string" || typeof e == "number" ? String(e) : Array.isArray(e) ? e.map(B).join("") : ie(e) ? B(e.props.children) : "", be = (e) => {
192
+ const t = e.filter(Boolean);
193
+ return t.length ? t.join(" ") : void 0;
194
+ }, Ce = () => {
195
+ const [e, t] = oe(0);
196
+ return [e, le(() => (t((n) => n + 1), () => t((n) => n - 1)), [])];
197
+ }, Ne = ({ missingTitleText: e, staticWithControls: t }) => {
198
+ se(() => {
199
+ }, [e, t]);
200
+ }, $e = (e) => {
201
+ const { title: t, titleText: n, open: i, cta: r, titleChevron: c, overdue: o, accentColor: u, dataTest: m } = e, d = re(X), f = {
202
+ ...K[e.locale ?? d.locale ?? "en"],
203
+ ...e.labels
204
+ }, h = e.checkbox ?? d.checkbox, w = e.headingLevel ?? d.headingLevel ?? 3, b = n ?? B(t).trim(), [R, k] = Ce(), A = {
205
+ checkbox: !!h,
206
+ menu: !!e.menu,
207
+ footerAction: !!e.footerAction,
208
+ ctaAction: !!e.ctaAction
209
+ }, N = Y({
210
+ open: i,
211
+ readOnly: e.readOnly,
212
+ ...A
213
+ }, R), v = N === "static", x = !!e.disabled && !v, p = !!e.selected && !v && !x, { isPressed: E, handlers: F } = Z();
214
+ Ne({
215
+ missingTitleText: !b,
216
+ staticWithControls: v && Object.values(A).some(Boolean)
217
+ });
218
+ const C = de(), g = {
219
+ title: `${C}-title`,
220
+ cta: `${C}-cta`,
221
+ type: `${C}-type`,
222
+ status: `${C}-status`,
223
+ unread: `${C}-unread`
224
+ }, y = v || x, T = y ? void 0 : e.ctaAction, L = y || T || r === null || r === !1 ? void 0 : r, H = N === "full" || L !== void 0 ? "card" : "title", V = be([
225
+ e.type && g.type,
226
+ (!!e.status || !!o) && g.status,
227
+ e.unread && g.unread
228
+ ]), { withTitle: j } = f, W = ce(() => ({
229
+ titleText: b,
230
+ composeName: (z) => j(z, b),
231
+ registerControl: k
232
+ }), [
233
+ b,
234
+ j,
235
+ k
236
+ ]), I = !!u && !o, q = I ? { "--card-accent": x ? "var(--colors-delta-300)" : u } : void 0, O = [
237
+ h,
238
+ e.unread,
239
+ e.tags?.length,
240
+ e.menu
241
+ ].some(Boolean);
242
+ return /* @__PURE__ */ a(Q.Provider, {
243
+ value: W,
244
+ children: /* @__PURE__ */ l("div", {
245
+ className: s(M.card, e.className, e.classes?.root),
246
+ "data-testid": m,
247
+ "data-model": N,
248
+ "data-hit-area": v ? void 0 : H,
249
+ "data-accent": I ? "" : void 0,
250
+ "data-selected": p ? "" : void 0,
251
+ "data-disabled": x ? "" : void 0,
252
+ "data-overdue": o ? "" : void 0,
253
+ "data-pressed": E && !v && !x ? "" : void 0,
254
+ style: q,
255
+ ...v || x ? {} : F,
256
+ children: [
257
+ O && /* @__PURE__ */ a(ue, {
258
+ checkbox: h,
259
+ unread: e.unread,
260
+ tags: e.tags,
261
+ menu: e.menu,
262
+ titleText: b,
263
+ labels: f,
264
+ unreadId: g.unread,
265
+ dataTest: m
266
+ }),
267
+ /* @__PURE__ */ l("div", {
268
+ className: s("flex flex-col gap-2 px-3 py-1", e.classes?.body),
269
+ children: [
270
+ /* @__PURE__ */ a(fe, {
271
+ type: e.type,
272
+ status: e.status,
273
+ overdue: o,
274
+ ids: g,
275
+ hasTopRow: O,
276
+ isDisabled: x
277
+ }),
278
+ /* @__PURE__ */ l("div", {
279
+ className: "flex flex-wrap items-start gap-2",
280
+ children: [/* @__PURE__ */ l("div", {
281
+ className: "flex min-w-[min(12rem,100%)] flex-[1_1_12rem] flex-col",
282
+ children: [/* @__PURE__ */ a("div", {
283
+ "data-card-title-row": "",
284
+ className: "flex items-start gap-1",
285
+ children: /* @__PURE__ */ a(xe, {
286
+ title: t,
287
+ level: w,
288
+ model: N,
289
+ open: i,
290
+ titleId: g.title,
291
+ labelledBy: g.title,
292
+ describedBy: V,
293
+ selected: p,
294
+ disabled: x,
295
+ titleChevron: !!c && !v,
296
+ titleClamp: e.titleClamp,
297
+ className: e.classes?.title
298
+ })
299
+ }), e.subtitle && /* @__PURE__ */ a("div", {
300
+ className: "text-base leading-6 text-delta-700 [overflow-wrap:anywhere]",
301
+ children: e.subtitle
302
+ })]
303
+ }), e.media && /* @__PURE__ */ a("div", {
304
+ className: "shrink-0",
305
+ children: e.media
306
+ })]
307
+ }),
308
+ e.children
309
+ ]
310
+ }),
311
+ /* @__PURE__ */ a(we, {
312
+ ctaContent: L,
313
+ ctaId: g.cta,
314
+ selected: p,
315
+ overdue: !!o,
316
+ footerAction: y ? void 0 : e.footerAction,
317
+ ctaAction: T,
318
+ labels: f,
319
+ className: e.classes?.footer
320
+ })
321
+ ]
322
+ })
323
+ });
324
+ };
325
+ export {
326
+ $e as Card
327
+ };
@@ -0,0 +1,7 @@
1
+ var a = "_card_8knfo_1", _ = "_link_8knfo_37", r = {
2
+ card: a,
3
+ link: _
4
+ };
5
+ export {
6
+ r as default
7
+ };
@@ -0,0 +1,21 @@
1
+ var r = {
2
+ no: {
3
+ select: "Velg",
4
+ viewingNow: "Vises nå",
5
+ unread: "Ulest",
6
+ selectFor: (e) => `Velg «${e}»`,
7
+ moreActionsFor: (e) => `Flere handlinger for «${e}»`,
8
+ withTitle: (e, o) => `${e}, «${o}»`
9
+ },
10
+ en: {
11
+ select: "Select",
12
+ viewingNow: "Viewing now",
13
+ unread: "Unread",
14
+ selectFor: (e) => `Select “${e}”`,
15
+ moreActionsFor: (e) => `More actions for “${e}”`,
16
+ withTitle: (e, o) => `${e}, “${o}”`
17
+ }
18
+ };
19
+ export {
20
+ r as CARD_LABELS
21
+ };
@@ -0,0 +1,85 @@
1
+ import { cn as s } from "../../../helpers/cn.js";
2
+ import { CardListItemContext as w } from "./cardModel.js";
3
+ import { firstTabbable as k } from "../../../helpers/focusable.js";
4
+ import { useEffect as y, useLayoutEffect as N, useMemo as p, useRef as m } from "react";
5
+ import { jsx as l, jsxs as f } from "react/jsx-runtime";
6
+ var L = () => /* @__PURE__ */ f("div", {
7
+ "aria-hidden": "true",
8
+ className: "box-border flex w-full max-w-[37.5rem] flex-col gap-3 rounded-xl border border-solid border-delta-300 bg-white px-4 py-3",
9
+ children: [
10
+ /* @__PURE__ */ l("div", { className: "h-4 w-1/3 animate-pulse rounded bg-delta-100 motion-reduce:animate-none" }),
11
+ /* @__PURE__ */ l("div", { className: "h-5 w-4/5 animate-pulse rounded bg-delta-100 motion-reduce:animate-none" }),
12
+ /* @__PURE__ */ l("div", { className: "h-4 w-1/2 animate-pulse rounded bg-delta-100 motion-reduce:animate-none" })
13
+ ]
14
+ }), g = (e) => {
15
+ if (!(e instanceof HTMLElement)) return;
16
+ const a = e.querySelector("[data-card-link]") ?? k(e);
17
+ a?.focus(), a?.scrollIntoView?.({ block: "nearest" });
18
+ }, E = (e, a) => {
19
+ const t = m(null);
20
+ return N(() => {
21
+ const n = t.current;
22
+ if (!n || a.includes(n.id) || (t.current = null, document.activeElement && document.activeElement !== document.body)) return;
23
+ const r = Math.min(n.index, a.length - 1);
24
+ r >= 0 && g(e.current?.children[r]);
25
+ }, [a, e]), (n) => {
26
+ const r = n.target.closest("[data-card-id]")?.getAttribute("data-card-id");
27
+ r && (t.current = {
28
+ id: r,
29
+ index: a.indexOf(r)
30
+ });
31
+ };
32
+ }, S = (e, a, t) => {
33
+ y(() => {
34
+ !a || !t || g(e.current?.querySelector(`[data-card-id="${CSS.escape(a)}"]`));
35
+ }, [
36
+ a,
37
+ t,
38
+ e
39
+ ]);
40
+ }, F = (e, a, t, n) => ({
41
+ headingLevel: a,
42
+ locale: n,
43
+ checkbox: t && {
44
+ checked: t.checkedIds.includes(e),
45
+ onChange: (r) => t.onCheckedChange(e, r),
46
+ disabledReason: t.disabledReason?.(e)
47
+ }
48
+ }), q = (e) => {
49
+ const { items: a, getId: t, renderCard: n, cardHeadingLevel: r, selection: x, loading: o = !1, layout: u = "grid", dataTest: h } = e, c = m(null), b = E(c, p(() => a.map(t), [a, t]));
50
+ S(c, e.restoreFocusId, !o);
51
+ const v = !o && a.length === 0, C = u === "grid" ? "grid grid-cols-[repeat(auto-fill,minmax(min(18rem,100%),1fr))] gap-2" : "flex flex-col items-start gap-2";
52
+ return /* @__PURE__ */ f("div", {
53
+ className: s("flex flex-col gap-2", e.className),
54
+ "data-testid": h,
55
+ children: [/* @__PURE__ */ l("div", {
56
+ role: "status",
57
+ className: "sr-only",
58
+ children: e.statusMessage
59
+ }), v ? e.empty : /* @__PURE__ */ l("ul", {
60
+ ref: c,
61
+ "aria-label": e.ariaLabel,
62
+ "aria-busy": o || void 0,
63
+ className: s("m-0 list-none p-0", C),
64
+ onFocus: b,
65
+ children: o ? Array.from({ length: e.skeletonCount ?? 3 }, (i, d) => /* @__PURE__ */ l("li", {
66
+ className: "w-full max-w-[37.5rem]",
67
+ children: /* @__PURE__ */ l(L, {})
68
+ }, `skeleton-${d}`)) : a.map((i) => {
69
+ const d = t(i);
70
+ return /* @__PURE__ */ l("li", {
71
+ "data-card-id": d,
72
+ className: s("w-full max-w-[37.5rem]", u === "grid" && "flex"),
73
+ children: /* @__PURE__ */ l(w.Provider, {
74
+ value: F(d, r, x, e.locale),
75
+ children: n(i)
76
+ })
77
+ }, d);
78
+ })
79
+ })]
80
+ });
81
+ };
82
+ export {
83
+ q as CardList,
84
+ L as CardSkeleton
85
+ };
@@ -0,0 +1,97 @@
1
+ import { cn as m } from "../../../helpers/cn.js";
2
+ import { CardContext as h } from "./cardModel.js";
3
+ import { StyledTooltip as f } from "../tooltip/StyledTooltip.js";
4
+ import { DotsVerticalIcon as g } from "../../icons/dots-vertical-icon/DotsVerticalIcon.js";
5
+ import { StyledButton as C } from "../../inputs/button/StyledButton.js";
6
+ import { StyledCheckbox as b } from "../../inputs/checkbox/base-ui/StyledCheckbox.js";
7
+ import { StyledMenu as x } from "../../navigation/menu/StyledMenu.js";
8
+ import { StyledMenuItem as v } from "../../navigation/menu/StyledMenuItem.js";
9
+ import { useCallback as y, useContext as N, useEffect as S, useId as k, useLayoutEffect as z, useState as I } from "react";
10
+ import { jsx as r, jsxs as c } from "react/jsx-runtime";
11
+ var p = ({ children: e, className: i }) => {
12
+ const a = N(h);
13
+ return z(() => a?.registerControl(), [a]), /* @__PURE__ */ r("div", {
14
+ "data-card-control": "",
15
+ className: m("relative z-[1] inline-flex min-h-10 min-w-10 max-w-full select-text items-center self-start", i),
16
+ children: e
17
+ });
18
+ }, A = ({ children: e }) => /* @__PURE__ */ r("span", {
19
+ className: "inline-flex min-h-4 items-center rounded-[0.1875rem] bg-success-300 px-[0.375rem] text-[0.6875rem] font-semibold uppercase leading-3 tracking-[0.034375rem] text-black",
20
+ children: e
21
+ }), D = ({ checkbox: e, titleText: i, labels: a, dataTest: s }) => {
22
+ const o = k(), l = !!e.disabledReason, n = /* @__PURE__ */ c("span", {
23
+ className: "inline-flex items-center",
24
+ children: [/* @__PURE__ */ r(b, {
25
+ dataTest: `${s}-checkbox`,
26
+ id: o,
27
+ checked: e.checked,
28
+ readOnly: l,
29
+ "aria-disabled": l || void 0,
30
+ "aria-label": a.selectFor(i),
31
+ size: e.size,
32
+ onChange: (d, t) => e.onChange(t)
33
+ }), !e.hideLabel && /* @__PURE__ */ r("label", {
34
+ htmlFor: o,
35
+ className: "cursor-pointer select-none pr-2 text-base leading-6 text-delta-700",
36
+ children: a.select
37
+ })]
38
+ });
39
+ return /* @__PURE__ */ r(p, { children: l ? /* @__PURE__ */ r(f, {
40
+ title: e.disabledReason,
41
+ openOnTap: !0,
42
+ persistentDescription: !0,
43
+ children: n
44
+ }) : n });
45
+ }, L = ({ menu: e, titleText: i, labels: a, dataTest: s }) => {
46
+ const [o, l] = I(null), n = !!o, d = y(() => l(null), []);
47
+ return S(() => {
48
+ }, [e.actions?.length ?? 0]), /* @__PURE__ */ c(p, {
49
+ className: "ml-auto",
50
+ children: [/* @__PURE__ */ r(C, {
51
+ dataTest: `${s}-menu-trigger`,
52
+ type: "button",
53
+ variant: "textGray",
54
+ startIcon: /* @__PURE__ */ r(g, {
55
+ width: 24,
56
+ height: 24
57
+ }),
58
+ className: "px-[7px]",
59
+ "aria-label": a.moreActionsFor(i),
60
+ "aria-haspopup": e.actions ? "menu" : "dialog",
61
+ "aria-expanded": n,
62
+ onClick: (t) => l(n ? null : t.currentTarget)
63
+ }), e.render ? e.render({
64
+ anchorEl: o,
65
+ open: n,
66
+ close: d
67
+ }) : /* @__PURE__ */ r(x, {
68
+ open: n,
69
+ anchorEl: o,
70
+ onClose: d,
71
+ anchorOrigin: {
72
+ vertical: "bottom",
73
+ horizontal: "right"
74
+ },
75
+ transformOrigin: {
76
+ vertical: "top",
77
+ horizontal: "right"
78
+ },
79
+ children: e.actions.map((t, u) => /* @__PURE__ */ c(v, {
80
+ "data-testid": `${s}-menu-action-${u}`,
81
+ className: m(t.icon && "gap-2", t.danger && "text-error-500"),
82
+ disabled: !!t.disabledReason,
83
+ disabledReason: t.disabledReason,
84
+ onClick: () => {
85
+ d(), t.onSelect();
86
+ },
87
+ children: [t.icon, t.label]
88
+ }, t.label))
89
+ })]
90
+ });
91
+ };
92
+ export {
93
+ D as CardCheckboxControl,
94
+ p as CardControl,
95
+ L as CardMenuControl,
96
+ A as CardTag
97
+ };
@@ -0,0 +1,46 @@
1
+ import { createContext as C, useCallback as o, useContext as m, useEffect as f, useRef as u, useState as v } from "react";
2
+ var h = (e, r) => !e.open || e.readOnly ? "static" : [
3
+ e.checkbox,
4
+ e.menu,
5
+ e.footerAction,
6
+ e.ctaAction
7
+ ].some(Boolean) || r > 0 ? "partial" : "full", i = (e) => Date.UTC(e.getFullYear(), e.getMonth(), e.getDate()), D = 864e5, w = (e, r = /* @__PURE__ */ new Date()) => {
8
+ const n = Math.round((i(r) - i(e)) / D);
9
+ return Math.max(0, n);
10
+ }, x = C(null), y = () => {
11
+ const e = m(x);
12
+ if (!e) throw new Error("useCardContext must be used inside a Card");
13
+ return e;
14
+ }, E = C({}), P = 100, d = (e) => e instanceof Element && e.closest("[data-card-control]") === null && e.closest("[data-card-link]") !== null, T = () => {
15
+ const [e, r] = v(!1), n = u(0), a = u(), s = o(() => {
16
+ clearTimeout(a.current), n.current = Date.now(), r(!0);
17
+ }, []), c = o(() => {
18
+ const t = P - (Date.now() - n.current);
19
+ clearTimeout(a.current), a.current = setTimeout(() => r(!1), Math.max(0, t));
20
+ }, []), l = o(() => {
21
+ clearTimeout(a.current), r(!1);
22
+ }, []);
23
+ return f(() => () => clearTimeout(a.current), []), {
24
+ isPressed: e,
25
+ handlers: {
26
+ onPointerDown: (t) => {
27
+ d(t.target) && s();
28
+ },
29
+ onPointerUp: c,
30
+ onPointerLeave: l,
31
+ onPointerCancel: l,
32
+ onKeyDown: (t) => {
33
+ t.key === "Enter" && d(t.target) && s();
34
+ },
35
+ onKeyUp: c
36
+ }
37
+ };
38
+ };
39
+ export {
40
+ x as CardContext,
41
+ E as CardListItemContext,
42
+ w as getOverdueDays,
43
+ h as resolveCardModel,
44
+ y as useCardContext,
45
+ T as usePressedHold
46
+ };
@@ -1,12 +1,12 @@
1
1
  import { cn as o } from "../../../helpers/cn.js";
2
- import { StyledChip as v } from "../chip/StyledChip.js";
3
- import { StyledCheckbox as f } from "../../inputs/checkbox/base-ui/StyledCheckbox.js";
2
+ import { StyledCheckbox as v } from "../../inputs/checkbox/base-ui/StyledCheckbox.js";
3
+ import { StyledChip as f } from "../chip/StyledChip.js";
4
4
  import { StyledRadio as y } from "../../inputs/radio-button/base-ui/StyledRadio.js";
5
5
  import i from "./StyledInteractiveChip.module.js";
6
6
  import { forwardRef as x } from "react";
7
7
  import { jsx as r } from "react/jsx-runtime";
8
8
  var _ = "[&[data-testid][role]]:border-gama-400 [&[data-testid][role]]:shadow-[inset_0_0_0_1px_var(--colors-gama-400)] [&[data-testid][role]]:bg-gama-25", S = { paddingLeft: "6px" }, R = x(({ type: l = "checkbox", checked: e, size: d = "small", ariaLabel: n, ...a }, c) => {
9
- const t = l === "checkbox", m = n ?? (typeof a.label == "string" ? a.label : void 0), s = !a.readOnly && !t && !!e, b = t ? /* @__PURE__ */ r(f, {
9
+ const t = l === "checkbox", m = n ?? (typeof a.label == "string" ? a.label : void 0), s = !a.readOnly && !t && !!e, b = t ? /* @__PURE__ */ r(v, {
10
10
  dataTest: a.dataTest,
11
11
  disableRipple: !0,
12
12
  checked: e,
@@ -22,7 +22,7 @@ var _ = "[&[data-testid][role]]:border-gama-400 [&[data-testid][role]]:shadow-[i
22
22
  decorative: !0,
23
23
  className: o("pointer-events-none", i.control)
24
24
  });
25
- return /* @__PURE__ */ r(v, {
25
+ return /* @__PURE__ */ r(f, {
26
26
  ref: c,
27
27
  "aria-label": m,
28
28
  role: l,
@@ -4,8 +4,8 @@ import { registerOpenModalDialog as he } from "../../../hooks/useTopLayer.hook.j
4
4
  import { CloseIcon as we } from "../../icons/close-icon/CloseIcon.js";
5
5
  import { DialogBusyContext as pe, useDialogBusyBoundary as ye } from "./DialogBusyContext.js";
6
6
  import { StyledButton as ve } from "../../inputs/button/StyledButton.js";
7
- import { useMobileMediaQuery as ge } from "../../../hooks/useMediaQuery.hook.js";
8
- import { OverlayBackOwnerContext as be, isOverlayBackEnabled as T, requestCloseTopOverlayBack as D, useBackCloses as ke } from "../../../hooks/useBackCloses.hook.js";
7
+ import { OverlayBackOwnerContext as ge, isOverlayBackEnabled as T, requestCloseTopOverlayBack as D, useBackCloses as be } from "../../../hooks/useBackCloses.hook.js";
8
+ import { useMobileMediaQuery as ke } from "../../../hooks/useMediaQuery.hook.js";
9
9
  import { warnUnnamedDialog as Ce } from "../../../helpers/warnUnnamedDialog.js";
10
10
  import Ee from "./StyledDialog.module.js";
11
11
  import { StyledDialogTitleContext as Be } from "./dialogTitleContext.js";
@@ -21,7 +21,7 @@ var Ie = {
21
21
  const w = I(), P = I(), [ne, oe] = X(), se = De(() => ({
22
22
  titleId: w,
23
23
  setTitleId: oe
24
- }), [w]), p = h ? w : ne ?? (i ? P : void 0), ae = ge(), l = s(null), k = s(null), C = s(!1), E = s(!1), u = s(!1), _ = s(t);
24
+ }), [w]), p = h ? w : ne ?? (i ? P : void 0), ae = ke(), l = s(null), k = s(null), C = s(!1), E = s(!1), u = s(!1), _ = s(t);
25
25
  d(() => {
26
26
  _.current = t;
27
27
  }, [t]);
@@ -73,7 +73,7 @@ var Ie = {
73
73
  }, F = (e) => C.current ? !1 : (C.current = !0, window.setTimeout(() => {
74
74
  C.current = !1;
75
75
  }, 0), A(e, "escapeKeyDown"));
76
- ke({
76
+ be({
77
77
  active: t,
78
78
  requestClose: (e) => !R || H || v || u.current ? !1 : F(e ?? new Event("overlayBack")),
79
79
  ownerRef: l
@@ -192,7 +192,7 @@ var Ie = {
192
192
  children: q
193
193
  })]
194
194
  })]
195
- }), /* @__PURE__ */ a(be.Provider, {
195
+ }), /* @__PURE__ */ a(ge.Provider, {
196
196
  value: l,
197
197
  children: /* @__PURE__ */ a(Be.Provider, {
198
198
  value: se,