@fiscozen/card-list 1.1.2 → 1.2.1
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 +20 -0
- package/dist/card-list.js +32 -29
- package/dist/card-list.umd.cjs +1 -1
- package/dist/src/components/types.d.ts +5 -0
- package/dist/src/types.d.ts +5 -0
- package/package.json +5 -5
- package/src/__tests__/FzCardListItem.spec.ts +51 -0
- package/src/components/FzCardActionLink.vue +1 -1
- package/src/components/FzCardMultiActions.vue +1 -1
- package/src/components/FzCardNoAction.vue +1 -1
- package/src/components/types.ts +5 -0
- package/src/types.ts +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @fiscozen/card-list
|
|
2
2
|
|
|
3
|
+
## 1.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [5be1040]
|
|
8
|
+
- @fiscozen/container@0.5.0
|
|
9
|
+
- @fiscozen/button@3.1.1
|
|
10
|
+
- @fiscozen/dropdown@1.0.10
|
|
11
|
+
|
|
12
|
+
## 1.2.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- b717ba3: FzCardList / FzCardListItem: support an optional `icon` on the `badge` object.
|
|
17
|
+
|
|
18
|
+
When provided it is forwarded to `FzBadge.leftIcon`, rendering a Font Awesome
|
|
19
|
+
icon to the left of the badge text. Existing badge usages without `icon` are
|
|
20
|
+
unchanged. Works across the three internal rendering variants (no-action,
|
|
21
|
+
single-link action, multi-actions dropdown).
|
|
22
|
+
|
|
3
23
|
## 1.1.2
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/card-list.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as b, resolveDirective as w, createBlock as l, openBlock as e, unref as i, withCtx as s, withDirectives as I, createCommentVNode as f, createElementBlock as g, createTextVNode as y, toDisplayString as k, createVNode as o, Fragment as F, renderList as O, computed as z, useId as N, createElementVNode as E } from "vue";
|
|
2
2
|
import { FzBadge as B } from "@fiscozen/badge";
|
|
3
3
|
import { FzContainer as h } from "@fiscozen/container";
|
|
4
4
|
import { FzDivider as T } from "@fiscozen/divider";
|
|
5
5
|
import { FzIcon as D } from "@fiscozen/icons";
|
|
6
|
-
import { FzIconDropdown as
|
|
7
|
-
const
|
|
6
|
+
import { FzIconDropdown as V } from "@fiscozen/dropdown";
|
|
7
|
+
const M = ["id"], A = /* @__PURE__ */ b({
|
|
8
8
|
__name: "FzCardTitle",
|
|
9
9
|
props: {
|
|
10
10
|
showIndicator: { type: Boolean },
|
|
@@ -13,7 +13,7 @@ const V = ["id"], A = /* @__PURE__ */ w({
|
|
|
13
13
|
},
|
|
14
14
|
setup(t) {
|
|
15
15
|
return (m, r) => {
|
|
16
|
-
const d =
|
|
16
|
+
const d = w("color"), a = w("bold");
|
|
17
17
|
return e(), l(i(h), {
|
|
18
18
|
horizontal: "",
|
|
19
19
|
gap: "xs",
|
|
@@ -34,7 +34,7 @@ const V = ["id"], A = /* @__PURE__ */ w({
|
|
|
34
34
|
id: t.titleId
|
|
35
35
|
}, [
|
|
36
36
|
y(k(t.title), 1)
|
|
37
|
-
], 8,
|
|
37
|
+
], 8, M)), [
|
|
38
38
|
[a]
|
|
39
39
|
])
|
|
40
40
|
]),
|
|
@@ -42,10 +42,10 @@ const V = ["id"], A = /* @__PURE__ */ w({
|
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
}),
|
|
45
|
+
}), K = {
|
|
46
46
|
key: 0,
|
|
47
47
|
class: "text-base whitespace-nowrap"
|
|
48
|
-
}, x = /* @__PURE__ */
|
|
48
|
+
}, x = /* @__PURE__ */ b({
|
|
49
49
|
__name: "FzCardHeader",
|
|
50
50
|
props: {
|
|
51
51
|
hasTitleOnly: { type: Boolean },
|
|
@@ -56,7 +56,7 @@ const V = ["id"], A = /* @__PURE__ */ w({
|
|
|
56
56
|
},
|
|
57
57
|
setup(t) {
|
|
58
58
|
return (m, r) => {
|
|
59
|
-
const d =
|
|
59
|
+
const d = w("bold"), a = w("color");
|
|
60
60
|
return t.hasTitleOnly ? (e(), l(i(h), {
|
|
61
61
|
key: 0,
|
|
62
62
|
horizontal: "",
|
|
@@ -85,7 +85,7 @@ const V = ["id"], A = /* @__PURE__ */ w({
|
|
|
85
85
|
title: t.title,
|
|
86
86
|
"title-id": t.titleId
|
|
87
87
|
}, null, 8, ["show-indicator", "title", "title-id"]),
|
|
88
|
-
t.value ? I((e(), g("p",
|
|
88
|
+
t.value ? I((e(), g("p", K, [
|
|
89
89
|
y(k(t.value), 1)
|
|
90
90
|
])), [
|
|
91
91
|
[d],
|
|
@@ -96,7 +96,7 @@ const V = ["id"], A = /* @__PURE__ */ w({
|
|
|
96
96
|
}));
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
-
}), $ = /* @__PURE__ */
|
|
99
|
+
}), $ = /* @__PURE__ */ b({
|
|
100
100
|
__name: "FzCardFooter",
|
|
101
101
|
props: {
|
|
102
102
|
descriptions: {}
|
|
@@ -104,7 +104,7 @@ const V = ["id"], A = /* @__PURE__ */ w({
|
|
|
104
104
|
setup(t) {
|
|
105
105
|
return (m, r) => {
|
|
106
106
|
var u;
|
|
107
|
-
const d =
|
|
107
|
+
const d = w("small"), a = w("color");
|
|
108
108
|
return (u = t.descriptions) != null && u.length ? (e(), l(i(h), {
|
|
109
109
|
key: 0,
|
|
110
110
|
gap: "none"
|
|
@@ -121,10 +121,10 @@ const V = ["id"], A = /* @__PURE__ */ w({
|
|
|
121
121
|
})) : f("", !0);
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
|
-
}),
|
|
124
|
+
}), H = {
|
|
125
125
|
class: "inline-flex shrink-0 text-inherit",
|
|
126
126
|
"aria-hidden": "true"
|
|
127
|
-
},
|
|
127
|
+
}, P = /* @__PURE__ */ b({
|
|
128
128
|
__name: "FzCardActionLink",
|
|
129
129
|
props: {
|
|
130
130
|
action: {},
|
|
@@ -149,7 +149,7 @@ const V = ["id"], A = /* @__PURE__ */ w({
|
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
return (v, C) => {
|
|
152
|
-
const L =
|
|
152
|
+
const L = w("color");
|
|
153
153
|
return e(), g(F, null, [
|
|
154
154
|
o(i(h), {
|
|
155
155
|
gap: "xs",
|
|
@@ -168,6 +168,7 @@ const V = ["id"], A = /* @__PURE__ */ w({
|
|
|
168
168
|
default: s(() => [
|
|
169
169
|
t.badge ? (e(), l(i(B), {
|
|
170
170
|
key: 0,
|
|
171
|
+
"left-icon": t.badge.icon,
|
|
171
172
|
tone: t.badge.tone,
|
|
172
173
|
variant: "text"
|
|
173
174
|
}, {
|
|
@@ -175,7 +176,7 @@ const V = ["id"], A = /* @__PURE__ */ w({
|
|
|
175
176
|
y(k(t.badge.text), 1)
|
|
176
177
|
]),
|
|
177
178
|
_: 1
|
|
178
|
-
}, 8, ["tone"])) : a.value ? (e(), l(x, {
|
|
179
|
+
}, 8, ["left-icon", "tone"])) : a.value ? (e(), l(x, {
|
|
179
180
|
key: 1,
|
|
180
181
|
"has-title-only": "",
|
|
181
182
|
"show-indicator": t.showIndicator,
|
|
@@ -191,7 +192,7 @@ const V = ["id"], A = /* @__PURE__ */ w({
|
|
|
191
192
|
class: "shrink-0 ml-auto"
|
|
192
193
|
}, {
|
|
193
194
|
default: s(() => [
|
|
194
|
-
|
|
195
|
+
E("span", H, [
|
|
195
196
|
I(o(i(D), {
|
|
196
197
|
name: "chevron-right",
|
|
197
198
|
size: "md",
|
|
@@ -221,7 +222,7 @@ const V = ["id"], A = /* @__PURE__ */ w({
|
|
|
221
222
|
], 64);
|
|
222
223
|
};
|
|
223
224
|
}
|
|
224
|
-
}),
|
|
225
|
+
}), R = /* @__PURE__ */ b({
|
|
225
226
|
__name: "FzCardMultiActions",
|
|
226
227
|
props: {
|
|
227
228
|
actions: {},
|
|
@@ -252,6 +253,7 @@ const V = ["id"], A = /* @__PURE__ */ w({
|
|
|
252
253
|
default: s(() => [
|
|
253
254
|
t.badge ? (e(), l(i(B), {
|
|
254
255
|
key: 0,
|
|
256
|
+
"left-icon": t.badge.icon,
|
|
255
257
|
tone: t.badge.tone,
|
|
256
258
|
variant: "text"
|
|
257
259
|
}, {
|
|
@@ -259,7 +261,7 @@ const V = ["id"], A = /* @__PURE__ */ w({
|
|
|
259
261
|
y(k(t.badge.text), 1)
|
|
260
262
|
]),
|
|
261
263
|
_: 1
|
|
262
|
-
}, 8, ["tone"])) : a.value ? (e(), l(x, {
|
|
264
|
+
}, 8, ["left-icon", "tone"])) : a.value ? (e(), l(x, {
|
|
263
265
|
key: 1,
|
|
264
266
|
"has-title-only": "",
|
|
265
267
|
"show-indicator": t.showIndicator,
|
|
@@ -273,7 +275,7 @@ const V = ["id"], A = /* @__PURE__ */ w({
|
|
|
273
275
|
class: "shrink-0 ml-auto"
|
|
274
276
|
}, {
|
|
275
277
|
default: s(() => [
|
|
276
|
-
o(i(
|
|
278
|
+
o(i(V), {
|
|
277
279
|
actions: t.actions,
|
|
278
280
|
iconName: "ellipsis-vertical",
|
|
279
281
|
variant: "invisible",
|
|
@@ -299,7 +301,7 @@ const V = ["id"], A = /* @__PURE__ */ w({
|
|
|
299
301
|
o(i(T), { margin: "none" })
|
|
300
302
|
], 64));
|
|
301
303
|
}
|
|
302
|
-
}),
|
|
304
|
+
}), S = /* @__PURE__ */ b({
|
|
303
305
|
__name: "FzCardNoAction",
|
|
304
306
|
props: {
|
|
305
307
|
badge: {},
|
|
@@ -324,6 +326,7 @@ const V = ["id"], A = /* @__PURE__ */ w({
|
|
|
324
326
|
}, {
|
|
325
327
|
default: s(() => [
|
|
326
328
|
o(i(B), {
|
|
329
|
+
"left-icon": t.badge.icon,
|
|
327
330
|
tone: t.badge.tone,
|
|
328
331
|
variant: "text"
|
|
329
332
|
}, {
|
|
@@ -331,7 +334,7 @@ const V = ["id"], A = /* @__PURE__ */ w({
|
|
|
331
334
|
y(k(t.badge.text), 1)
|
|
332
335
|
]),
|
|
333
336
|
_: 1
|
|
334
|
-
}, 8, ["tone"])
|
|
337
|
+
}, 8, ["left-icon", "tone"])
|
|
335
338
|
]),
|
|
336
339
|
_: 1
|
|
337
340
|
})) : f("", !0),
|
|
@@ -347,7 +350,7 @@ const V = ["id"], A = /* @__PURE__ */ w({
|
|
|
347
350
|
o(i(T), { margin: "none" })
|
|
348
351
|
], 64));
|
|
349
352
|
}
|
|
350
|
-
}),
|
|
353
|
+
}), j = /* @__PURE__ */ b({
|
|
351
354
|
__name: "FzCardListItem",
|
|
352
355
|
props: {
|
|
353
356
|
badge: {},
|
|
@@ -365,14 +368,14 @@ const V = ["id"], A = /* @__PURE__ */ w({
|
|
|
365
368
|
return ((n = r.actions) == null ? void 0 : n.filter((c) => c.type !== "section")) ?? [];
|
|
366
369
|
}
|
|
367
370
|
), u = z(() => a.value.length ? a.value.length === 1 && a.value[0].type === "link" ? "link" : "actions" : "none");
|
|
368
|
-
return (n, c) => u.value === "none" ? (e(), l(
|
|
371
|
+
return (n, c) => u.value === "none" ? (e(), l(S, {
|
|
369
372
|
key: 0,
|
|
370
373
|
badge: t.badge,
|
|
371
374
|
title: t.title,
|
|
372
375
|
"show-indicator": t.showIndicator,
|
|
373
376
|
value: t.value,
|
|
374
377
|
descriptions: t.descriptions
|
|
375
|
-
}, null, 8, ["badge", "title", "show-indicator", "value", "descriptions"])) : u.value === "link" ? (e(), l(
|
|
378
|
+
}, null, 8, ["badge", "title", "show-indicator", "value", "descriptions"])) : u.value === "link" ? (e(), l(P, {
|
|
376
379
|
key: 1,
|
|
377
380
|
badge: t.badge,
|
|
378
381
|
title: t.title,
|
|
@@ -381,7 +384,7 @@ const V = ["id"], A = /* @__PURE__ */ w({
|
|
|
381
384
|
descriptions: t.descriptions,
|
|
382
385
|
action: a.value[0],
|
|
383
386
|
"onFzaction:click": c[0] || (c[0] = (v) => d("fzaction:click", 0, v))
|
|
384
|
-
}, null, 8, ["badge", "title", "show-indicator", "value", "descriptions", "action"])) : (e(), l(
|
|
387
|
+
}, null, 8, ["badge", "title", "show-indicator", "value", "descriptions", "action"])) : (e(), l(R, {
|
|
385
388
|
key: 2,
|
|
386
389
|
badge: t.badge,
|
|
387
390
|
title: t.title,
|
|
@@ -392,7 +395,7 @@ const V = ["id"], A = /* @__PURE__ */ w({
|
|
|
392
395
|
"onFzaction:click": c[1] || (c[1] = (v, C) => d("fzaction:click", v, C))
|
|
393
396
|
}, null, 8, ["badge", "title", "show-indicator", "value", "descriptions", "actions"]));
|
|
394
397
|
}
|
|
395
|
-
}),
|
|
398
|
+
}), X = /* @__PURE__ */ b({
|
|
396
399
|
__name: "FzCardList",
|
|
397
400
|
props: {
|
|
398
401
|
items: {}
|
|
@@ -405,7 +408,7 @@ const V = ["id"], A = /* @__PURE__ */ w({
|
|
|
405
408
|
}
|
|
406
409
|
return (a, u) => (e(), l(i(h), { gap: "xs" }, {
|
|
407
410
|
default: s(() => [
|
|
408
|
-
(e(!0), g(F, null, O(t.items, (n, c) => (e(), l(
|
|
411
|
+
(e(!0), g(F, null, O(t.items, (n, c) => (e(), l(j, {
|
|
409
412
|
key: c,
|
|
410
413
|
badge: n.badge,
|
|
411
414
|
title: n.title,
|
|
@@ -421,6 +424,6 @@ const V = ["id"], A = /* @__PURE__ */ w({
|
|
|
421
424
|
}
|
|
422
425
|
});
|
|
423
426
|
export {
|
|
424
|
-
|
|
425
|
-
|
|
427
|
+
X as FzCardList,
|
|
428
|
+
j as FzCardListItem
|
|
426
429
|
};
|
package/dist/card-list.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(l,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@fiscozen/badge"),require("@fiscozen/container"),require("@fiscozen/divider"),require("@fiscozen/icons"),require("@fiscozen/dropdown")):typeof define=="function"&&define.amd?define(["exports","vue","@fiscozen/badge","@fiscozen/container","@fiscozen/divider","@fiscozen/icons","@fiscozen/dropdown"],t):(l=typeof globalThis<"u"?globalThis:l||self,t(l.FzCardList={},l.Vue,l.badge,l.container,l.divider,l.icons,l.dropdown))})(this,function(l,t,k,r,w,z,C){"use strict";const x=["id"],B=t.defineComponent({__name:"FzCardTitle",props:{showIndicator:{type:Boolean},title:{},titleId:{}},setup(e){return(f,c)=>{const a=t.resolveDirective("color"),n=t.resolveDirective("bold");return t.openBlock(),t.createBlock(t.unref(r.FzContainer),{horizontal:"",gap:"xs",alignItems:"center",class:"min-w-0"},{default:t.withCtx(()=>[e.showIndicator?t.withDirectives((t.openBlock(),t.createBlock(t.unref(z.FzIcon),{key:0,name:"circle-small",size:"xs",variant:"fas"},null,512)),[[a,void 0,"blue"]]):t.createCommentVNode("",!0),t.withDirectives((t.openBlock(),t.createElementBlock("p",{class:"min-w-0 flex-1 truncate",id:e.titleId},[t.createTextVNode(t.toDisplayString(e.title),1)],8,x)),[[n]])]),_:1})}}}),b={key:0,class:"text-base whitespace-nowrap"},h=t.defineComponent({__name:"FzCardHeader",props:{hasTitleOnly:{type:Boolean},value:{},showIndicator:{type:Boolean},title:{},titleId:{}},setup(e){return(f,c)=>{const a=t.resolveDirective("bold"),n=t.resolveDirective("color");return e.hasTitleOnly?(t.openBlock(),t.createBlock(t.unref(r.FzContainer),{key:0,horizontal:"",gap:"xs",alignItems:"center",class:"min-w-0 flex-1"},{default:t.withCtx(()=>[t.createVNode(B,{"show-indicator":e.showIndicator,title:e.title,"title-id":e.titleId},null,8,["show-indicator","title","title-id"])]),_:1})):(t.openBlock(),t.createBlock(t.unref(r.FzContainer),{key:1,horizontal:"",gap:"sm",alignItems:"center",layout:"space-between"},{default:t.withCtx(()=>[t.createVNode(B,{"show-indicator":e.showIndicator,title:e.title,"title-id":e.titleId},null,8,["show-indicator","title","title-id"]),e.value?t.withDirectives((t.openBlock(),t.createElementBlock("p",b,[t.createTextVNode(t.toDisplayString(e.value),1)])),[[a],[n,void 0,"blue"]]):t.createCommentVNode("",!0)]),_:1}))}}}),g=t.defineComponent({__name:"FzCardFooter",props:{descriptions:{}},setup(e){return(f,c)=>{var d;const a=t.resolveDirective("small"),n=t.resolveDirective("color");return(d=e.descriptions)!=null&&d.length?(t.openBlock(),t.createBlock(t.unref(r.FzContainer),{key:0,gap:"none"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.descriptions,(i,o)=>t.withDirectives((t.openBlock(),t.createElementBlock("p",{key:o},[t.createTextVNode(t.toDisplayString(i),1)])),[[a],[n,void 0,"grey"]])),128))]),_:1})):t.createCommentVNode("",!0)}}}),
|
|
1
|
+
(function(l,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@fiscozen/badge"),require("@fiscozen/container"),require("@fiscozen/divider"),require("@fiscozen/icons"),require("@fiscozen/dropdown")):typeof define=="function"&&define.amd?define(["exports","vue","@fiscozen/badge","@fiscozen/container","@fiscozen/divider","@fiscozen/icons","@fiscozen/dropdown"],t):(l=typeof globalThis<"u"?globalThis:l||self,t(l.FzCardList={},l.Vue,l.badge,l.container,l.divider,l.icons,l.dropdown))})(this,function(l,t,k,r,w,z,C){"use strict";const x=["id"],B=t.defineComponent({__name:"FzCardTitle",props:{showIndicator:{type:Boolean},title:{},titleId:{}},setup(e){return(f,c)=>{const a=t.resolveDirective("color"),n=t.resolveDirective("bold");return t.openBlock(),t.createBlock(t.unref(r.FzContainer),{horizontal:"",gap:"xs",alignItems:"center",class:"min-w-0"},{default:t.withCtx(()=>[e.showIndicator?t.withDirectives((t.openBlock(),t.createBlock(t.unref(z.FzIcon),{key:0,name:"circle-small",size:"xs",variant:"fas"},null,512)),[[a,void 0,"blue"]]):t.createCommentVNode("",!0),t.withDirectives((t.openBlock(),t.createElementBlock("p",{class:"min-w-0 flex-1 truncate",id:e.titleId},[t.createTextVNode(t.toDisplayString(e.title),1)],8,x)),[[n]])]),_:1})}}}),b={key:0,class:"text-base whitespace-nowrap"},h=t.defineComponent({__name:"FzCardHeader",props:{hasTitleOnly:{type:Boolean},value:{},showIndicator:{type:Boolean},title:{},titleId:{}},setup(e){return(f,c)=>{const a=t.resolveDirective("bold"),n=t.resolveDirective("color");return e.hasTitleOnly?(t.openBlock(),t.createBlock(t.unref(r.FzContainer),{key:0,horizontal:"",gap:"xs",alignItems:"center",class:"min-w-0 flex-1"},{default:t.withCtx(()=>[t.createVNode(B,{"show-indicator":e.showIndicator,title:e.title,"title-id":e.titleId},null,8,["show-indicator","title","title-id"])]),_:1})):(t.openBlock(),t.createBlock(t.unref(r.FzContainer),{key:1,horizontal:"",gap:"sm",alignItems:"center",layout:"space-between"},{default:t.withCtx(()=>[t.createVNode(B,{"show-indicator":e.showIndicator,title:e.title,"title-id":e.titleId},null,8,["show-indicator","title","title-id"]),e.value?t.withDirectives((t.openBlock(),t.createElementBlock("p",b,[t.createTextVNode(t.toDisplayString(e.value),1)])),[[a],[n,void 0,"blue"]]):t.createCommentVNode("",!0)]),_:1}))}}}),g=t.defineComponent({__name:"FzCardFooter",props:{descriptions:{}},setup(e){return(f,c)=>{var d;const a=t.resolveDirective("small"),n=t.resolveDirective("color");return(d=e.descriptions)!=null&&d.length?(t.openBlock(),t.createBlock(t.unref(r.FzContainer),{key:0,gap:"none"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.descriptions,(i,o)=>t.withDirectives((t.openBlock(),t.createElementBlock("p",{key:o},[t.createTextVNode(t.toDisplayString(i),1)])),[[a],[n,void 0,"grey"]])),128))]),_:1})):t.createCommentVNode("",!0)}}}),I={class:"inline-flex shrink-0 text-inherit","aria-hidden":"true"},F=t.defineComponent({__name:"FzCardActionLink",props:{action:{},hasTitleOnly:{type:Boolean},value:{},showIndicator:{type:Boolean},title:{},titleId:{},descriptions:{},badge:{}},emits:["fzaction:click"],setup(e,{emit:f}){const c=e,a=f,n=t.computed(()=>!c.badge&&!c.value),d=t.computed(()=>!c.action),i=t.useId();function o(s){if(!d.value){if(s instanceof KeyboardEvent){if(s.key!=="Enter"&&s.key!==" ")return;s.preventDefault()}s.stopPropagation(),a("fzaction:click",c.action)}}return(s,m)=>{const u=t.resolveDirective("color");return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(t.unref(r.FzContainer),{gap:"xs",role:"button",tabindex:"0","aria-labelledby":t.unref(i),class:"p-8 hover:bg-semantic-info-50 hover:rounded cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-blue-200 focus-visible:rounded",onClick:o,onKeydown:o},{default:t.withCtx(()=>[t.createVNode(t.unref(r.FzContainer),{horizontal:"",alignItems:"center"},{default:t.withCtx(()=>[e.badge?(t.openBlock(),t.createBlock(t.unref(k.FzBadge),{key:0,"left-icon":e.badge.icon,tone:e.badge.tone,variant:"text"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.badge.text),1)]),_:1},8,["left-icon","tone"])):n.value?(t.openBlock(),t.createBlock(h,{key:1,"has-title-only":"","show-indicator":e.showIndicator,title:e.title,"title-id":t.unref(i)},null,8,["show-indicator","title","title-id"])):t.createCommentVNode("",!0),d.value?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(t.unref(r.FzContainer),{key:2,horizontal:"",gap:"xs",alignItems:"center",layout:"expand-last",class:"shrink-0 ml-auto"},{default:t.withCtx(()=>[t.createElementVNode("span",I,[t.withDirectives(t.createVNode(t.unref(z.FzIcon),{name:"chevron-right",size:"md",variant:"far"},null,512),[[u,void 0,"grey"]])])]),_:1}))]),_:1}),n.value?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(h,{key:0,"show-indicator":e.showIndicator,title:e.title,value:e.value,"title-id":t.unref(i)},null,8,["show-indicator","title","value","title-id"])),t.createVNode(g,{descriptions:e.descriptions},null,8,["descriptions"])]),_:1},8,["aria-labelledby"]),t.createVNode(t.unref(w.FzDivider),{margin:"none"})],64)}}}),p=t.defineComponent({__name:"FzCardMultiActions",props:{actions:{},hasTitleOnly:{type:Boolean},value:{},showIndicator:{type:Boolean},title:{},titleId:{},descriptions:{},badge:{}},emits:["fzaction:click"],setup(e,{emit:f}){const c=e,a=f,n=t.computed(()=>!c.badge&&!c.value);function d(i,o){a("fzaction:click",i,o)}return(i,o)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(t.unref(r.FzContainer),{gap:"xs",class:"p-8 hover:bg-semantic-info-50 hover:rounded"},{default:t.withCtx(()=>[t.createVNode(t.unref(r.FzContainer),{horizontal:"",alignItems:"center"},{default:t.withCtx(()=>[e.badge?(t.openBlock(),t.createBlock(t.unref(k.FzBadge),{key:0,"left-icon":e.badge.icon,tone:e.badge.tone,variant:"text"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.badge.text),1)]),_:1},8,["left-icon","tone"])):n.value?(t.openBlock(),t.createBlock(h,{key:1,"has-title-only":"","show-indicator":e.showIndicator,title:e.title},null,8,["show-indicator","title"])):t.createCommentVNode("",!0),t.createVNode(t.unref(r.FzContainer),{horizontal:"",gap:"xs",alignItems:"center",layout:"expand-last",class:"shrink-0 ml-auto"},{default:t.withCtx(()=>[t.createVNode(t.unref(C.FzIconDropdown),{actions:e.actions,iconName:"ellipsis-vertical",variant:"invisible","aria-label":"Mostra azioni","onFzaction:click":d},null,8,["actions"])]),_:1})]),_:1}),n.value?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(h,{key:0,"show-indicator":e.showIndicator,title:e.title,value:e.value},null,8,["show-indicator","title","value"])),t.createVNode(g,{descriptions:e.descriptions},null,8,["descriptions"])]),_:1}),t.createVNode(t.unref(w.FzDivider),{margin:"none"})],64))}}),N=t.defineComponent({__name:"FzCardNoAction",props:{badge:{},hasTitleOnly:{type:Boolean},value:{},showIndicator:{type:Boolean},title:{},titleId:{},descriptions:{}},setup(e){return(f,c)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(t.unref(r.FzContainer),{gap:"xs",class:"p-8"},{default:t.withCtx(()=>[e.badge?(t.openBlock(),t.createBlock(t.unref(r.FzContainer),{key:0,horizontal:"",alignItems:"center"},{default:t.withCtx(()=>[t.createVNode(t.unref(k.FzBadge),{"left-icon":e.badge.icon,tone:e.badge.tone,variant:"text"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.badge.text),1)]),_:1},8,["left-icon","tone"])]),_:1})):t.createCommentVNode("",!0),t.createVNode(h,{"show-indicator":e.showIndicator,title:e.title,value:e.value},null,8,["show-indicator","title","value"]),t.createVNode(g,{descriptions:e.descriptions},null,8,["descriptions"])]),_:1}),t.createVNode(t.unref(w.FzDivider),{margin:"none"})],64))}}),y=t.defineComponent({__name:"FzCardListItem",props:{badge:{},title:{},value:{},descriptions:{},showIndicator:{type:Boolean},actions:{}},emits:["fzaction:click"],setup(e,{emit:f}){const c=e,a=f,n=t.computed(()=>{var i;return((i=c.actions)==null?void 0:i.filter(o=>o.type!=="section"))??[]}),d=t.computed(()=>n.value.length?n.value.length===1&&n.value[0].type==="link"?"link":"actions":"none");return(i,o)=>d.value==="none"?(t.openBlock(),t.createBlock(N,{key:0,badge:e.badge,title:e.title,"show-indicator":e.showIndicator,value:e.value,descriptions:e.descriptions},null,8,["badge","title","show-indicator","value","descriptions"])):d.value==="link"?(t.openBlock(),t.createBlock(F,{key:1,badge:e.badge,title:e.title,"show-indicator":e.showIndicator,value:e.value,descriptions:e.descriptions,action:n.value[0],"onFzaction:click":o[0]||(o[0]=s=>a("fzaction:click",0,s))},null,8,["badge","title","show-indicator","value","descriptions","action"])):(t.openBlock(),t.createBlock(p,{key:2,badge:e.badge,title:e.title,"show-indicator":e.showIndicator,value:e.value,descriptions:e.descriptions,actions:e.actions,"onFzaction:click":o[1]||(o[1]=(s,m)=>a("fzaction:click",s,m))},null,8,["badge","title","show-indicator","value","descriptions","actions"]))}}),V=t.defineComponent({__name:"FzCardList",props:{items:{}},emits:["fzaction:click"],setup(e,{emit:f}){const c=f;function a(n,d,i){c("fzaction:click",n,d,i)}return(n,d)=>(t.openBlock(),t.createBlock(t.unref(r.FzContainer),{gap:"xs"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.items,(i,o)=>(t.openBlock(),t.createBlock(y,{key:o,badge:i.badge,title:i.title,value:i.value,descriptions:i.descriptions,showIndicator:i.showIndicator,actions:i.actions,"onFzaction:click":(s,m)=>a(o,s,m)},null,8,["badge","title","value","descriptions","showIndicator","actions","onFzaction:click"]))),128))]),_:1}))}});l.FzCardList=V,l.FzCardListItem=y,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -5,6 +5,11 @@ import { FzCardListItemAction } from '../types';
|
|
|
5
5
|
export type FzCardBadge = {
|
|
6
6
|
text: string;
|
|
7
7
|
tone: FzBadgeTone;
|
|
8
|
+
/**
|
|
9
|
+
* Optional Font Awesome icon name rendered to the left of the badge text.
|
|
10
|
+
* Forwarded to `FzBadge.leftIcon`.
|
|
11
|
+
*/
|
|
12
|
+
icon?: string;
|
|
8
13
|
};
|
|
9
14
|
export interface FzCardTitleProps {
|
|
10
15
|
showIndicator?: boolean;
|
package/dist/src/types.d.ts
CHANGED
|
@@ -25,6 +25,11 @@ export interface FzCardListItemProps {
|
|
|
25
25
|
* Tone of the badge.
|
|
26
26
|
*/
|
|
27
27
|
tone: FzBadgeTone;
|
|
28
|
+
/**
|
|
29
|
+
* Optional Font Awesome icon name rendered to the left of the badge text.
|
|
30
|
+
* Forwarded to `FzBadge.leftIcon`.
|
|
31
|
+
*/
|
|
32
|
+
icon?: string;
|
|
28
33
|
};
|
|
29
34
|
/**
|
|
30
35
|
* Main title of the item, displayed in bold.
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiscozen/card-list",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Design System CardList component",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"keywords": [],
|
|
8
8
|
"author": "Francesca Vago",
|
|
9
9
|
"dependencies": {
|
|
10
|
+
"@fiscozen/button": "3.1.1",
|
|
11
|
+
"@fiscozen/dropdown": "1.0.10",
|
|
12
|
+
"@fiscozen/container": "0.5.0",
|
|
10
13
|
"@fiscozen/action": "3.0.1",
|
|
11
14
|
"@fiscozen/badge": "3.0.1",
|
|
12
|
-
"@fiscozen/
|
|
13
|
-
"@fiscozen/divider": "1.0.1",
|
|
14
|
-
"@fiscozen/container": "0.4.2",
|
|
15
|
-
"@fiscozen/dropdown": "1.0.9"
|
|
15
|
+
"@fiscozen/divider": "1.0.1"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"tailwindcss": "^3.4.1",
|
|
@@ -326,6 +326,57 @@ describe("FzCardListItem", () => {
|
|
|
326
326
|
expect(badge.props("tone")).toBe("success");
|
|
327
327
|
expect(badge.props("variant")).toBe("text");
|
|
328
328
|
});
|
|
329
|
+
|
|
330
|
+
it("should forward badge.icon to FzBadge.leftIcon when provided", async () => {
|
|
331
|
+
const wrapper = mount(FzCardListItem, {
|
|
332
|
+
props: {
|
|
333
|
+
title: "Item",
|
|
334
|
+
badge: { text: "In revisione", tone: "warning", icon: "clock" },
|
|
335
|
+
},
|
|
336
|
+
});
|
|
337
|
+
await wrapper.vm.$nextTick();
|
|
338
|
+
const badge = wrapper.findComponent({ name: "FzBadge" });
|
|
339
|
+
expect(badge.exists()).toBe(true);
|
|
340
|
+
expect(badge.props("leftIcon")).toBe("clock");
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
it("should omit leftIcon when badge.icon is not provided", async () => {
|
|
344
|
+
const wrapper = mount(FzCardListItem, {
|
|
345
|
+
props: {
|
|
346
|
+
title: "Item",
|
|
347
|
+
badge: { text: "Tag", tone: "success" },
|
|
348
|
+
},
|
|
349
|
+
});
|
|
350
|
+
await wrapper.vm.$nextTick();
|
|
351
|
+
const badge = wrapper.findComponent({ name: "FzBadge" });
|
|
352
|
+
expect(badge.props("leftIcon")).toBeUndefined();
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
it("should forward badge.icon through the link-action variant", async () => {
|
|
356
|
+
const wrapper = mount(FzCardListItem, {
|
|
357
|
+
props: {
|
|
358
|
+
title: "Item",
|
|
359
|
+
actions: [linkAction],
|
|
360
|
+
badge: { text: "In revisione", tone: "warning", icon: "clock" },
|
|
361
|
+
},
|
|
362
|
+
});
|
|
363
|
+
await wrapper.vm.$nextTick();
|
|
364
|
+
const badge = wrapper.findComponent({ name: "FzBadge" });
|
|
365
|
+
expect(badge.props("leftIcon")).toBe("clock");
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
it("should forward badge.icon through the multi-actions variant", async () => {
|
|
369
|
+
const wrapper = mount(FzCardListItem, {
|
|
370
|
+
props: {
|
|
371
|
+
title: "Item",
|
|
372
|
+
actions: [linkAction, linkAction],
|
|
373
|
+
badge: { text: "In revisione", tone: "warning", icon: "clock" },
|
|
374
|
+
},
|
|
375
|
+
});
|
|
376
|
+
await wrapper.vm.$nextTick();
|
|
377
|
+
const badge = wrapper.findComponent({ name: "FzBadge" });
|
|
378
|
+
expect(badge.props("leftIcon")).toBe("clock");
|
|
379
|
+
});
|
|
329
380
|
});
|
|
330
381
|
});
|
|
331
382
|
|
|
@@ -46,7 +46,7 @@ function handleRowInteraction(e: MouseEvent | KeyboardEvent) {
|
|
|
46
46
|
-->
|
|
47
47
|
<FzContainer horizontal alignItems="center">
|
|
48
48
|
<!-- Badge -->
|
|
49
|
-
<FzBadge v-if="badge" :tone="badge.tone" variant="text">
|
|
49
|
+
<FzBadge v-if="badge" :left-icon="badge.icon" :tone="badge.tone" variant="text">
|
|
50
50
|
{{ badge.text }}
|
|
51
51
|
</FzBadge>
|
|
52
52
|
<!-- Title only (inline with action) -->
|
|
@@ -30,7 +30,7 @@ function emitActionClick(actionIndex: number, action: FzActionProps) {
|
|
|
30
30
|
-->
|
|
31
31
|
<FzContainer horizontal alignItems="center">
|
|
32
32
|
<!-- Badge -->
|
|
33
|
-
<FzBadge v-if="badge" :tone="badge.tone" variant="text">
|
|
33
|
+
<FzBadge v-if="badge" :left-icon="badge.icon" :tone="badge.tone" variant="text">
|
|
34
34
|
{{ badge.text }}
|
|
35
35
|
</FzBadge>
|
|
36
36
|
<!-- Title only (inline with actions) -->
|
|
@@ -13,7 +13,7 @@ const props = defineProps<FzCardNoActionProps>();
|
|
|
13
13
|
<FzContainer gap="xs" class="p-8">
|
|
14
14
|
<FzContainer v-if="badge" horizontal alignItems="center">
|
|
15
15
|
<!-- Badge -->
|
|
16
|
-
<FzBadge :tone="badge.tone" variant="text">
|
|
16
|
+
<FzBadge :left-icon="badge.icon" :tone="badge.tone" variant="text">
|
|
17
17
|
{{ badge.text }}
|
|
18
18
|
</FzBadge>
|
|
19
19
|
</FzContainer>
|
package/src/components/types.ts
CHANGED
|
@@ -5,6 +5,11 @@ import type { FzCardListItemAction } from "../types";
|
|
|
5
5
|
export type FzCardBadge = {
|
|
6
6
|
text: string;
|
|
7
7
|
tone: FzBadgeTone;
|
|
8
|
+
/**
|
|
9
|
+
* Optional Font Awesome icon name rendered to the left of the badge text.
|
|
10
|
+
* Forwarded to `FzBadge.leftIcon`.
|
|
11
|
+
*/
|
|
12
|
+
icon?: string;
|
|
8
13
|
};
|
|
9
14
|
|
|
10
15
|
export interface FzCardTitleProps {
|
package/src/types.ts
CHANGED
|
@@ -27,6 +27,11 @@ export interface FzCardListItemProps {
|
|
|
27
27
|
* Tone of the badge.
|
|
28
28
|
*/
|
|
29
29
|
tone: FzBadgeTone;
|
|
30
|
+
/**
|
|
31
|
+
* Optional Font Awesome icon name rendered to the left of the badge text.
|
|
32
|
+
* Forwarded to `FzBadge.leftIcon`.
|
|
33
|
+
*/
|
|
34
|
+
icon?: string;
|
|
30
35
|
};
|
|
31
36
|
/**
|
|
32
37
|
* Main title of the item, displayed in bold.
|