@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.cjs
CHANGED
|
@@ -61,6 +61,7 @@ var tokens = {
|
|
|
61
61
|
transitionFast: "120ms ease-out",
|
|
62
62
|
fontSizeBody: "13px",
|
|
63
63
|
fontSizeSmall: "11px",
|
|
64
|
+
fontWeightRegular: 400,
|
|
64
65
|
fontWeightMedium: 500,
|
|
65
66
|
fontWeightBold: 600
|
|
66
67
|
};
|
|
@@ -79,6 +80,8 @@ react.css`
|
|
|
79
80
|
white-space: nowrap;
|
|
80
81
|
`;
|
|
81
82
|
var Root = styled__default.default.div`
|
|
83
|
+
width: 100%;
|
|
84
|
+
min-width: 0;
|
|
82
85
|
color: ${tokens.fg};
|
|
83
86
|
font-size: ${tokens.fontSizeBody};
|
|
84
87
|
|
|
@@ -201,6 +204,11 @@ var PrimaryText = styled__default.default.span`
|
|
|
201
204
|
line-height: 1.3;
|
|
202
205
|
transition: color ${tokens.transitionFast};
|
|
203
206
|
`;
|
|
207
|
+
var SelectedTitle = styled__default.default(PrimaryText)`
|
|
208
|
+
font-weight: ${tokens.fontWeightRegular};
|
|
209
|
+
white-space: normal;
|
|
210
|
+
overflow-wrap: anywhere;
|
|
211
|
+
`;
|
|
204
212
|
var Option = styled__default.default.li`
|
|
205
213
|
display: flex;
|
|
206
214
|
align-items: center;
|
|
@@ -310,6 +318,10 @@ var ActionColumn = styled__default.default.div`
|
|
|
310
318
|
gap: ${tokens.spaceXs};
|
|
311
319
|
margin-left: auto;
|
|
312
320
|
`;
|
|
321
|
+
var ReorderStack = styled__default.default.span`
|
|
322
|
+
display: flex;
|
|
323
|
+
flex-direction: column;
|
|
324
|
+
`;
|
|
313
325
|
var SelectedListEl = styled__default.default.ul`
|
|
314
326
|
list-style: none;
|
|
315
327
|
margin: ${tokens.spaceSm} 0 0;
|
|
@@ -321,8 +333,8 @@ var SelectedListEl = styled__default.default.ul`
|
|
|
321
333
|
var SelectedRow = styled__default.default.li`
|
|
322
334
|
display: flex;
|
|
323
335
|
align-items: center;
|
|
324
|
-
gap: ${tokens.
|
|
325
|
-
padding:
|
|
336
|
+
gap: ${tokens.spaceXs};
|
|
337
|
+
padding: 6px ${tokens.spaceXs};
|
|
326
338
|
background: ${({ missing }) => missing ? tokens.dangerSoft : tokens.bg};
|
|
327
339
|
border: 1px solid ${({ missing }) => missing ? tokens.dangerLine : tokens.gray300};
|
|
328
340
|
border-radius: ${tokens.radiusMd};
|
|
@@ -1680,11 +1692,11 @@ var SelectedItem = ({
|
|
|
1680
1692
|
children: isMissing || isTrash ? /* @__PURE__ */ jsxRuntime.jsx(components.Icon, { icon: icons.caution, size: 22 }) : hasThumbImage ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: item.thumbnailUrl, alt: "", loading: "lazy" }) : resolvedIcon ? /* @__PURE__ */ jsxRuntime.jsx(components.Icon, { icon: resolvedIcon, size: 22 }) : null
|
|
1681
1693
|
}
|
|
1682
1694
|
) : null,
|
|
1683
|
-
render ? render(item) : /* @__PURE__ */ jsxRuntime.jsx(ItemBody, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1695
|
+
render ? render(item) : /* @__PURE__ */ jsxRuntime.jsx(ItemBody, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectedTitle, { muted: isMissing || isTrash, title: item.title, children: isMissing ? missingLabel : isTrash ? trashLabel : item.title }) }),
|
|
1684
1696
|
!isMissing && showTypeBadge ? /* @__PURE__ */ jsxRuntime.jsx(TypeBadge, { type: item.type, kind: item.kind }) : null,
|
|
1685
1697
|
!isMissing && hasAbnormalStatus ? /* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { status: item.status }) : null,
|
|
1686
1698
|
/* @__PURE__ */ jsxRuntime.jsxs(ActionColumn, { children: [
|
|
1687
|
-
orderable ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1699
|
+
orderable ? /* @__PURE__ */ jsxRuntime.jsxs(ReorderStack, { children: [
|
|
1688
1700
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1689
1701
|
components.Button,
|
|
1690
1702
|
{
|
|
@@ -1761,10 +1773,7 @@ var useResolvedItems = (value) => {
|
|
|
1761
1773
|
nameKey,
|
|
1762
1774
|
item.id
|
|
1763
1775
|
]);
|
|
1764
|
-
out[`${item.kind}:${item.type}:${item.id}`] =
|
|
1765
|
-
record: record ?? null,
|
|
1766
|
-
resolved
|
|
1767
|
-
};
|
|
1776
|
+
out[`${item.kind}:${item.type}:${item.id}`] = resolved ? record ?? null : void 0;
|
|
1768
1777
|
}
|
|
1769
1778
|
return out;
|
|
1770
1779
|
},
|
|
@@ -1772,10 +1781,8 @@ var useResolvedItems = (value) => {
|
|
|
1772
1781
|
);
|
|
1773
1782
|
return react$1.useMemo(
|
|
1774
1783
|
() => value.map((item) => {
|
|
1775
|
-
const
|
|
1776
|
-
if (
|
|
1777
|
-
const { record, resolved } = resolvedEntry;
|
|
1778
|
-
if (!resolved) {
|
|
1784
|
+
const record = records[`${item.kind}:${item.type}:${item.id}`];
|
|
1785
|
+
if (record === void 0) {
|
|
1779
1786
|
return item;
|
|
1780
1787
|
}
|
|
1781
1788
|
if (!record) {
|
|
@@ -2760,8 +2767,8 @@ var SelectedRow2 = styled__default.default.li`
|
|
|
2760
2767
|
container-name: valu-dp-row;
|
|
2761
2768
|
display: flex;
|
|
2762
2769
|
align-items: center;
|
|
2763
|
-
gap: ${tokens.
|
|
2764
|
-
padding:
|
|
2770
|
+
gap: ${tokens.spaceXs};
|
|
2771
|
+
padding: 6px ${tokens.spaceXs};
|
|
2765
2772
|
background: ${({ missing }) => missing ? tokens.dangerSoft : tokens.bg};
|
|
2766
2773
|
border: 1px solid ${({ missing }) => missing ? tokens.dangerLine : tokens.gray300};
|
|
2767
2774
|
border-radius: ${tokens.radiusMd};
|
|
@@ -2901,6 +2908,8 @@ var LabelEditBody = styled__default.default.div`
|
|
|
2901
2908
|
}
|
|
2902
2909
|
`;
|
|
2903
2910
|
var Root3 = styled__default.default.div`
|
|
2911
|
+
width: 100%;
|
|
2912
|
+
min-width: 0;
|
|
2904
2913
|
color: ${tokens.fg};
|
|
2905
2914
|
font-size: ${tokens.fontSizeBody};
|
|
2906
2915
|
|
|
@@ -4066,7 +4075,7 @@ var SelectedItem2 = ({
|
|
|
4066
4075
|
/* @__PURE__ */ jsxRuntime.jsx(FilenameText, { title: item.filename, children: metaParts.join(" \xB7 ") })
|
|
4067
4076
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4068
4077
|
/* @__PURE__ */ jsxRuntime.jsxs(DocRowBody, { children: [
|
|
4069
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4078
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectedTitle, { muted: isMissing, title: displayName, children: isMissing ? missingLabel : displayName }),
|
|
4070
4079
|
!isMissing ? /* @__PURE__ */ jsxRuntime.jsx(FilenameText, { title: item.filename, children: item.filename }) : null
|
|
4071
4080
|
] }),
|
|
4072
4081
|
!isMissing && (showFileSize || modified) ? /* @__PURE__ */ jsxRuntime.jsxs(DocMetaInline, { children: [
|
|
@@ -4127,7 +4136,7 @@ var useResolvedDocuments = (value) => {
|
|
|
4127
4136
|
"attachment",
|
|
4128
4137
|
item.id
|
|
4129
4138
|
]);
|
|
4130
|
-
out[item.id] =
|
|
4139
|
+
out[item.id] = resolved ? record ?? null : void 0;
|
|
4131
4140
|
}
|
|
4132
4141
|
return out;
|
|
4133
4142
|
},
|
|
@@ -4135,10 +4144,8 @@ var useResolvedDocuments = (value) => {
|
|
|
4135
4144
|
);
|
|
4136
4145
|
return react$1.useMemo(
|
|
4137
4146
|
() => value.map((item) => {
|
|
4138
|
-
const
|
|
4139
|
-
if (
|
|
4140
|
-
const { record, resolved } = entry;
|
|
4141
|
-
if (!resolved) return item;
|
|
4147
|
+
const record = records[item.id];
|
|
4148
|
+
if (record === void 0) return item;
|
|
4142
4149
|
if (!record) return { ...item, missing: "deleted" };
|
|
4143
4150
|
const fresh = mapMediaToDocumentItem(
|
|
4144
4151
|
record
|