@valu/block-components 0.4.0 → 0.5.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/README.md +17 -3
- package/dist/components/content-picker/index.cjs +19 -12
- package/dist/components/content-picker/index.cjs.map +1 -1
- package/dist/components/content-picker/index.js +19 -12
- package/dist/components/content-picker/index.js.map +1 -1
- package/dist/components/document-picker/index.cjs +22 -10
- package/dist/components/document-picker/index.cjs.map +1 -1
- package/dist/components/document-picker/index.js +22 -10
- package/dist/components/document-picker/index.js.map +1 -1
- package/dist/index.cjs +27 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +27 -20
- package/dist/index.js.map +1 -1
- package/package.json +2 -14
package/dist/index.js
CHANGED
|
@@ -53,6 +53,7 @@ var tokens = {
|
|
|
53
53
|
transitionFast: "120ms ease-out",
|
|
54
54
|
fontSizeBody: "13px",
|
|
55
55
|
fontSizeSmall: "11px",
|
|
56
|
+
fontWeightRegular: 400,
|
|
56
57
|
fontWeightMedium: 500,
|
|
57
58
|
fontWeightBold: 600
|
|
58
59
|
};
|
|
@@ -71,6 +72,8 @@ css`
|
|
|
71
72
|
white-space: nowrap;
|
|
72
73
|
`;
|
|
73
74
|
var Root = styled.div`
|
|
75
|
+
width: 100%;
|
|
76
|
+
min-width: 0;
|
|
74
77
|
color: ${tokens.fg};
|
|
75
78
|
font-size: ${tokens.fontSizeBody};
|
|
76
79
|
|
|
@@ -193,6 +196,11 @@ var PrimaryText = styled.span`
|
|
|
193
196
|
line-height: 1.3;
|
|
194
197
|
transition: color ${tokens.transitionFast};
|
|
195
198
|
`;
|
|
199
|
+
var SelectedTitle = styled(PrimaryText)`
|
|
200
|
+
font-weight: ${tokens.fontWeightRegular};
|
|
201
|
+
white-space: normal;
|
|
202
|
+
overflow-wrap: anywhere;
|
|
203
|
+
`;
|
|
196
204
|
var Option = styled.li`
|
|
197
205
|
display: flex;
|
|
198
206
|
align-items: center;
|
|
@@ -302,6 +310,10 @@ var ActionColumn = styled.div`
|
|
|
302
310
|
gap: ${tokens.spaceXs};
|
|
303
311
|
margin-left: auto;
|
|
304
312
|
`;
|
|
313
|
+
var ReorderStack = styled.span`
|
|
314
|
+
display: flex;
|
|
315
|
+
flex-direction: column;
|
|
316
|
+
`;
|
|
305
317
|
var SelectedListEl = styled.ul`
|
|
306
318
|
list-style: none;
|
|
307
319
|
margin: ${tokens.spaceSm} 0 0;
|
|
@@ -313,8 +325,8 @@ var SelectedListEl = styled.ul`
|
|
|
313
325
|
var SelectedRow = styled.li`
|
|
314
326
|
display: flex;
|
|
315
327
|
align-items: center;
|
|
316
|
-
gap: ${tokens.
|
|
317
|
-
padding:
|
|
328
|
+
gap: ${tokens.spaceXs};
|
|
329
|
+
padding: 6px ${tokens.spaceXs};
|
|
318
330
|
background: ${({ missing }) => missing ? tokens.dangerSoft : tokens.bg};
|
|
319
331
|
border: 1px solid ${({ missing }) => missing ? tokens.dangerLine : tokens.gray300};
|
|
320
332
|
border-radius: ${tokens.radiusMd};
|
|
@@ -1672,11 +1684,11 @@ var SelectedItem = ({
|
|
|
1672
1684
|
children: isMissing || isTrash ? /* @__PURE__ */ jsx(Icon, { icon: caution, size: 22 }) : hasThumbImage ? /* @__PURE__ */ jsx("img", { src: item.thumbnailUrl, alt: "", loading: "lazy" }) : resolvedIcon ? /* @__PURE__ */ jsx(Icon, { icon: resolvedIcon, size: 22 }) : null
|
|
1673
1685
|
}
|
|
1674
1686
|
) : null,
|
|
1675
|
-
render ? render(item) : /* @__PURE__ */ jsx(ItemBody, { children: /* @__PURE__ */ jsx(
|
|
1687
|
+
render ? render(item) : /* @__PURE__ */ jsx(ItemBody, { children: /* @__PURE__ */ jsx(SelectedTitle, { muted: isMissing || isTrash, title: item.title, children: isMissing ? missingLabel : isTrash ? trashLabel : item.title }) }),
|
|
1676
1688
|
!isMissing && showTypeBadge ? /* @__PURE__ */ jsx(TypeBadge, { type: item.type, kind: item.kind }) : null,
|
|
1677
1689
|
!isMissing && hasAbnormalStatus ? /* @__PURE__ */ jsx(StatusBadge, { status: item.status }) : null,
|
|
1678
1690
|
/* @__PURE__ */ jsxs(ActionColumn, { children: [
|
|
1679
|
-
orderable ? /* @__PURE__ */ jsxs(
|
|
1691
|
+
orderable ? /* @__PURE__ */ jsxs(ReorderStack, { children: [
|
|
1680
1692
|
/* @__PURE__ */ jsx(
|
|
1681
1693
|
Button,
|
|
1682
1694
|
{
|
|
@@ -1753,10 +1765,7 @@ var useResolvedItems = (value) => {
|
|
|
1753
1765
|
nameKey,
|
|
1754
1766
|
item.id
|
|
1755
1767
|
]);
|
|
1756
|
-
out[`${item.kind}:${item.type}:${item.id}`] =
|
|
1757
|
-
record: record ?? null,
|
|
1758
|
-
resolved
|
|
1759
|
-
};
|
|
1768
|
+
out[`${item.kind}:${item.type}:${item.id}`] = resolved ? record ?? null : void 0;
|
|
1760
1769
|
}
|
|
1761
1770
|
return out;
|
|
1762
1771
|
},
|
|
@@ -1764,10 +1773,8 @@ var useResolvedItems = (value) => {
|
|
|
1764
1773
|
);
|
|
1765
1774
|
return useMemo(
|
|
1766
1775
|
() => value.map((item) => {
|
|
1767
|
-
const
|
|
1768
|
-
if (
|
|
1769
|
-
const { record, resolved } = resolvedEntry;
|
|
1770
|
-
if (!resolved) {
|
|
1776
|
+
const record = records[`${item.kind}:${item.type}:${item.id}`];
|
|
1777
|
+
if (record === void 0) {
|
|
1771
1778
|
return item;
|
|
1772
1779
|
}
|
|
1773
1780
|
if (!record) {
|
|
@@ -2752,8 +2759,8 @@ var SelectedRow2 = styled.li`
|
|
|
2752
2759
|
container-name: valu-dp-row;
|
|
2753
2760
|
display: flex;
|
|
2754
2761
|
align-items: center;
|
|
2755
|
-
gap: ${tokens.
|
|
2756
|
-
padding:
|
|
2762
|
+
gap: ${tokens.spaceXs};
|
|
2763
|
+
padding: 6px ${tokens.spaceXs};
|
|
2757
2764
|
background: ${({ missing }) => missing ? tokens.dangerSoft : tokens.bg};
|
|
2758
2765
|
border: 1px solid ${({ missing }) => missing ? tokens.dangerLine : tokens.gray300};
|
|
2759
2766
|
border-radius: ${tokens.radiusMd};
|
|
@@ -2893,6 +2900,8 @@ var LabelEditBody = styled.div`
|
|
|
2893
2900
|
}
|
|
2894
2901
|
`;
|
|
2895
2902
|
var Root3 = styled.div`
|
|
2903
|
+
width: 100%;
|
|
2904
|
+
min-width: 0;
|
|
2896
2905
|
color: ${tokens.fg};
|
|
2897
2906
|
font-size: ${tokens.fontSizeBody};
|
|
2898
2907
|
|
|
@@ -4058,7 +4067,7 @@ var SelectedItem2 = ({
|
|
|
4058
4067
|
/* @__PURE__ */ jsx(FilenameText, { title: item.filename, children: metaParts.join(" \xB7 ") })
|
|
4059
4068
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4060
4069
|
/* @__PURE__ */ jsxs(DocRowBody, { children: [
|
|
4061
|
-
/* @__PURE__ */ jsx(
|
|
4070
|
+
/* @__PURE__ */ jsx(SelectedTitle, { muted: isMissing, title: displayName, children: isMissing ? missingLabel : displayName }),
|
|
4062
4071
|
!isMissing ? /* @__PURE__ */ jsx(FilenameText, { title: item.filename, children: item.filename }) : null
|
|
4063
4072
|
] }),
|
|
4064
4073
|
!isMissing && (showFileSize || modified) ? /* @__PURE__ */ jsxs(DocMetaInline, { children: [
|
|
@@ -4119,7 +4128,7 @@ var useResolvedDocuments = (value) => {
|
|
|
4119
4128
|
"attachment",
|
|
4120
4129
|
item.id
|
|
4121
4130
|
]);
|
|
4122
|
-
out[item.id] =
|
|
4131
|
+
out[item.id] = resolved ? record ?? null : void 0;
|
|
4123
4132
|
}
|
|
4124
4133
|
return out;
|
|
4125
4134
|
},
|
|
@@ -4127,10 +4136,8 @@ var useResolvedDocuments = (value) => {
|
|
|
4127
4136
|
);
|
|
4128
4137
|
return useMemo(
|
|
4129
4138
|
() => value.map((item) => {
|
|
4130
|
-
const
|
|
4131
|
-
if (
|
|
4132
|
-
const { record, resolved } = entry;
|
|
4133
|
-
if (!resolved) return item;
|
|
4139
|
+
const record = records[item.id];
|
|
4140
|
+
if (record === void 0) return item;
|
|
4134
4141
|
if (!record) return { ...item, missing: "deleted" };
|
|
4135
4142
|
const fresh = mapMediaToDocumentItem(
|
|
4136
4143
|
record
|