@plitzi/sdk-elements 0.38.2 → 0.38.4
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 +335 -0
- package/dist/Element/RootElement.mjs +58 -50
- package/dist/Element/helpers/renderStaticTag.d.ts +8 -2
- package/dist/Element/helpers/renderStaticTag.mjs +5 -4
- package/dist/canvas/index.d.ts +6 -0
- package/dist/canvas/index.mjs +5 -0
- package/dist/canvas/shaders.d.ts +16 -0
- package/dist/canvas/shaders.mjs +25 -0
- package/dist/canvas/useAnimationFrame.d.ts +27 -0
- package/dist/canvas/useAnimationFrame.mjs +42 -0
- package/dist/canvas/useCanvas.d.ts +51 -0
- package/dist/canvas/useCanvas.mjs +133 -0
- package/dist/canvas/useReducedMotion.d.ts +6 -0
- package/dist/canvas/useReducedMotion.mjs +15 -0
- package/dist/elements/basic/Button/Button.d.ts +6 -1
- package/dist/elements/basic/Button/Button.mjs +9 -8
- package/dist/elements/basic/Button/declaration.d.ts +1 -0
- package/dist/elements/basic/Button/index.d.ts +1 -0
- package/dist/elements/declarations/index.d.ts +6 -2
- package/dist/elements/form/FormControl/FormControl.d.ts +5 -1
- package/dist/elements/form/FormControl/FormControl.mjs +3 -0
- package/dist/elements/form/FormControl/Settings.d.ts +1 -1
- package/dist/elements/form/FormControl/Settings.mjs +16 -1
- package/dist/elements/form/FormControl/declaration.mjs +3 -0
- package/dist/elements/media/Image/Image.d.ts +7 -1
- package/dist/elements/media/Image/Image.mjs +10 -10
- package/dist/elements/media/Image/declaration.d.ts +2 -1
- package/dist/elements/media/Image/declaration.mjs +1 -1
- package/dist/elements/media/Image/index.d.ts +2 -1
- package/dist/elements/provider/ApiContainer/ApiContainer.d.ts +1 -1
- package/dist/elements/provider/ApiContainer/ApiContainer.mjs +123 -131
- package/dist/elements/provider/ApiContainer/helpers/serverMock.d.ts +10 -0
- package/dist/elements/provider/ApiContainer/helpers/serverMock.mjs +17 -0
- package/dist/elements/structure/Container/Container.d.ts +8 -2
- package/dist/elements/structure/Container/Container.mjs +6 -5
- package/dist/elements/structure/Container/declaration.d.ts +3 -1
- package/dist/elements/structure/Container/declaration.mjs +31 -23
- package/dist/elements/structure/Container/index.d.ts +3 -1
- package/dist/elements/structure/List/List.mjs +1 -0
- package/dist/elements/structure/List/Settings.mjs +1 -1
- package/dist/elements/structure/List/declaration.mjs +1 -1
- package/dist/elements/structure/List/modes/ListControlled/ListControlled.d.ts +3 -1
- package/dist/elements/structure/List/modes/ListControlled/ListControlled.mjs +18 -17
- package/dist/index.d.ts +6 -2
- package/package.json +36 -8
|
@@ -7,132 +7,124 @@ import { isEmptyAnswer as ne } from "./helpers/isEmptyAnswer.mjs";
|
|
|
7
7
|
import { childrenWhile as re } from "./helpers/loadingSlot.mjs";
|
|
8
8
|
import ie from "./helpers/providerOutcome.mjs";
|
|
9
9
|
import { queryInputOf as ae } from "./helpers/queryInput.mjs";
|
|
10
|
+
import { serverMock as oe } from "./helpers/serverMock.mjs";
|
|
10
11
|
import r from "./hooks/useApi.mjs";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import { use as
|
|
16
|
-
import
|
|
17
|
-
import { useSdkStore as
|
|
18
|
-
import { StoreProvider as
|
|
19
|
-
import { emptyObject as
|
|
20
|
-
import { jsx as
|
|
21
|
-
import { currentRscLocation as
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import { QueryBuilderEvaluator as
|
|
12
|
+
import se from "./hooks/useAutoRefresh.mjs";
|
|
13
|
+
import ce from "./hooks/useProviderPagination.mjs";
|
|
14
|
+
import le from "./hooks/useProviderWrite.mjs";
|
|
15
|
+
import ue from "../../../dataSource/pathFields.mjs";
|
|
16
|
+
import { use as de, useCallback as i, useEffect as fe, useMemo as a, useRef as pe } from "react";
|
|
17
|
+
import me from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
|
|
18
|
+
import { useSdkStore as he } from "@plitzi/sdk-shared/store";
|
|
19
|
+
import { StoreProvider as ge } from "@plitzi/nexus/react";
|
|
20
|
+
import { emptyObject as o } from "@plitzi/sdk-shared/helpers/utils";
|
|
21
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
22
|
+
import { currentRscLocation as _e } from "@plitzi/sdk-shared/server/rsc/refreshRsc";
|
|
23
|
+
import ve from "clsx";
|
|
24
|
+
import ye from "@plitzi/sdk-shared/dataSource/helpers/getSourceName";
|
|
25
|
+
import be from "@plitzi/sdk-shared/dataSource/hooks/useRegisterSource";
|
|
26
|
+
import { QueryBuilderEvaluator as xe } from "@plitzi/plitzi-ui/QueryBuilder";
|
|
26
27
|
//#region src/elements/provider/ApiContainer/ApiContainer.tsx
|
|
27
|
-
var
|
|
28
|
-
let { id:
|
|
28
|
+
var c = ({ ref: e, className: c = "", children: l, query: u = "", method: d = "get", accessToken: f = "", when: p = o, headers: m = o, mockData: h = "{}", subType: Se = "", credentials: Ce = "same-origin", singleRecord: g = !1, pagination: we = "none", pageParam: Te = "page", renderWhileLoading: Ee = !1, loadingSlot: _ = "", cache: De = !1, staleTime: Oe = 30, gcTime: ke = 300, refreshSeconds: Ae = 0, connector: je = "", action: Me = "" }) => {
|
|
29
|
+
let { id: v, visible: y, definition: { label: b = "Api Container", runtime: x, items: Ne } } = t(), S = x === "server", { loaded: C, stale: w, location: T, elementData: E, refresh: D } = ee(), O = ye(n.sourceType, v), { settings: { previewMode: k }, contexts: { InteractionsContext: Pe } } = me(), { interactionsManager: A } = de(Pe), [[j, M, Fe]] = he([
|
|
29
30
|
"navigation.routeParams",
|
|
30
31
|
"navigation.queryParams",
|
|
31
32
|
"navigation.navigate"
|
|
32
|
-
]),
|
|
33
|
-
...
|
|
34
|
-
Authorization: `Bearer ${
|
|
35
|
-
} :
|
|
36
|
-
...
|
|
37
|
-
...
|
|
38
|
-
})) || !
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
]), Ie = a(() => f ? {
|
|
34
|
+
...m,
|
|
35
|
+
Authorization: `Bearer ${f}`
|
|
36
|
+
} : m, [m, f]), N = a(() => S || !y ? !1 : !!(k && u && (p === o || xe(p, {
|
|
37
|
+
...j,
|
|
38
|
+
...M
|
|
39
|
+
})) || !k && (u || h && h !== "{}" && h !== o)), [
|
|
40
|
+
S,
|
|
41
|
+
y,
|
|
42
|
+
k,
|
|
43
|
+
u,
|
|
44
|
+
p,
|
|
45
|
+
j,
|
|
44
46
|
M,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (w) return c;
|
|
62
|
-
if (typeof _ != "string") return _;
|
|
63
|
-
try {
|
|
64
|
-
return JSON.parse(_ || "{}");
|
|
65
|
-
} catch {
|
|
66
|
-
return c;
|
|
67
|
-
}
|
|
68
|
-
}, [
|
|
47
|
+
h
|
|
48
|
+
]), Le = a(() => [v], [v]), { isLoading: Re, isFetching: ze, data: P, refetch: F, isSuccess: Be, isError: Ve } = r({
|
|
49
|
+
url: u,
|
|
50
|
+
method: d,
|
|
51
|
+
credentials: Ce,
|
|
52
|
+
mock: k ? void 0 : h,
|
|
53
|
+
customHeaders: Ie,
|
|
54
|
+
enabled: N,
|
|
55
|
+
cache: De,
|
|
56
|
+
staleTime: Oe,
|
|
57
|
+
gcTime: ke,
|
|
58
|
+
tags: Le
|
|
59
|
+
}), I = S && !!T && T !== _e(), L = S && C && !I && E === null, R = S && !je && !Me, z = a(() => S ? E || (C ? o : oe(h, R)) : P ?? o, [
|
|
60
|
+
S,
|
|
61
|
+
P,
|
|
62
|
+
E,
|
|
69
63
|
C,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
_
|
|
74
|
-
]), B = C ? L : Fe, V = C ? L : Pe, H = de({}), U = a((e, t) => O(e, {
|
|
64
|
+
h,
|
|
65
|
+
R
|
|
66
|
+
]), B = S ? I : ze, V = S ? I : Re, H = pe({}), U = i((e, t) => D(e, {
|
|
75
67
|
...H.current,
|
|
76
68
|
...t
|
|
77
|
-
}), [
|
|
78
|
-
if (!
|
|
79
|
-
|
|
69
|
+
}), [D]), W = i(async () => {
|
|
70
|
+
if (!S) {
|
|
71
|
+
F();
|
|
80
72
|
return;
|
|
81
73
|
}
|
|
82
|
-
await U([
|
|
74
|
+
await U([v]);
|
|
83
75
|
}, [
|
|
84
|
-
|
|
85
|
-
|
|
76
|
+
S,
|
|
77
|
+
F,
|
|
86
78
|
U,
|
|
87
|
-
|
|
88
|
-
]), G =
|
|
79
|
+
v
|
|
80
|
+
]), G = i(async ({ input: e } = {}) => {
|
|
89
81
|
let t = ae(e);
|
|
90
82
|
t && (H.current = t), await W();
|
|
91
83
|
}, [W]);
|
|
92
|
-
|
|
93
|
-
seconds:
|
|
94
|
-
enabled:
|
|
84
|
+
se({
|
|
85
|
+
seconds: Ae,
|
|
86
|
+
enabled: y && (S ? C && !I : N),
|
|
95
87
|
refresh: W
|
|
96
88
|
});
|
|
97
|
-
let K = z,
|
|
98
|
-
elementId:
|
|
99
|
-
mode:
|
|
100
|
-
pageParam:
|
|
101
|
-
records:
|
|
89
|
+
let K = z, He = a(() => Array.isArray(K.records) ? K.records : [], [K.records]), { records: q, isLoadingMore: J, goToPage: Y, loadMore: X } = ce({
|
|
90
|
+
elementId: v,
|
|
91
|
+
mode: we,
|
|
92
|
+
pageParam: Te,
|
|
93
|
+
records: He,
|
|
102
94
|
page: K.pageInfo?.page ?? 1,
|
|
103
95
|
refresh: U,
|
|
104
|
-
navigate:
|
|
96
|
+
navigate: Fe
|
|
105
97
|
}), Z = ie({
|
|
106
|
-
serverMode:
|
|
107
|
-
isSuccess:
|
|
108
|
-
isError:
|
|
109
|
-
rscResolved:
|
|
110
|
-
rscPending:
|
|
111
|
-
elementData:
|
|
98
|
+
serverMode: S,
|
|
99
|
+
isSuccess: Be,
|
|
100
|
+
isError: Ve,
|
|
101
|
+
rscResolved: C,
|
|
102
|
+
rscPending: I,
|
|
103
|
+
elementData: E
|
|
112
104
|
});
|
|
113
|
-
|
|
114
|
-
!B &&
|
|
115
|
-
url:
|
|
116
|
-
method:
|
|
105
|
+
fe(() => {
|
|
106
|
+
!B && v && Z && A.interactionTrigger(v, Z === "success" ? "onApiSuccess" : "onApiError", {
|
|
107
|
+
url: u,
|
|
108
|
+
method: d,
|
|
117
109
|
...z
|
|
118
110
|
});
|
|
119
111
|
}, [
|
|
120
112
|
z,
|
|
121
|
-
|
|
122
|
-
|
|
113
|
+
v,
|
|
114
|
+
A,
|
|
123
115
|
B,
|
|
124
|
-
|
|
116
|
+
d,
|
|
125
117
|
Z,
|
|
126
|
-
|
|
118
|
+
u
|
|
127
119
|
]);
|
|
128
|
-
let Q =
|
|
120
|
+
let Q = a(() => ({
|
|
129
121
|
...z,
|
|
130
|
-
...Array.isArray(K.records) ? { records: q } :
|
|
122
|
+
...Array.isArray(K.records) ? { records: q } : o,
|
|
131
123
|
isLoading: B || J,
|
|
132
|
-
isEmpty: ne(K, q,
|
|
133
|
-
hasError:
|
|
134
|
-
errorMessage:
|
|
135
|
-
isStale:
|
|
124
|
+
isEmpty: ne(K, q, g),
|
|
125
|
+
hasError: L,
|
|
126
|
+
errorMessage: L ? "The data provider could not be reached" : "",
|
|
127
|
+
isStale: S && w
|
|
136
128
|
}), [
|
|
137
129
|
z,
|
|
138
130
|
K.records,
|
|
@@ -140,70 +132,70 @@ var u = ({ ref: e, className: u = "", children: d, query: f = "", method: p = "g
|
|
|
140
132
|
q,
|
|
141
133
|
B,
|
|
142
134
|
J,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
]),
|
|
148
|
-
|
|
149
|
-
id:
|
|
150
|
-
source:
|
|
151
|
-
name:
|
|
152
|
-
fields:
|
|
135
|
+
g,
|
|
136
|
+
L,
|
|
137
|
+
S,
|
|
138
|
+
w
|
|
139
|
+
]), Ue = i(() => ue(Q), [Q]);
|
|
140
|
+
be({
|
|
141
|
+
id: v,
|
|
142
|
+
source: O,
|
|
143
|
+
name: b || `API - ${v}`,
|
|
144
|
+
fields: Ue
|
|
153
145
|
});
|
|
154
|
-
let { writeRecord: $ } =
|
|
155
|
-
elementId:
|
|
156
|
-
enabled:
|
|
146
|
+
let { writeRecord: $ } = le({
|
|
147
|
+
elementId: v,
|
|
148
|
+
enabled: S,
|
|
157
149
|
onDone: W
|
|
158
|
-
}),
|
|
150
|
+
}), We = a(() => {
|
|
159
151
|
let e = {
|
|
160
152
|
performQuery: {
|
|
161
153
|
...n.callbacks.performQuery,
|
|
162
|
-
title: `Perform Query ${
|
|
154
|
+
title: `Perform Query ${b}`,
|
|
163
155
|
callback: G
|
|
164
156
|
},
|
|
165
157
|
loadMore: {
|
|
166
158
|
...n.callbacks.loadMore,
|
|
167
|
-
title: `Load More ${
|
|
159
|
+
title: `Load More ${b}`,
|
|
168
160
|
callback: X
|
|
169
161
|
},
|
|
170
162
|
goToPage: {
|
|
171
163
|
...n.callbacks.goToPage,
|
|
172
|
-
title: `Go To Page ${
|
|
164
|
+
title: `Go To Page ${b}`,
|
|
173
165
|
callback: ({ page: e }) => Y(Number(e) || 1)
|
|
174
166
|
}
|
|
175
167
|
};
|
|
176
|
-
return
|
|
168
|
+
return S && (e.writeRecord = {
|
|
177
169
|
...n.callbacks.writeRecord,
|
|
178
|
-
title: `Write Record ${
|
|
170
|
+
title: `Write Record ${b}`,
|
|
179
171
|
callback: $
|
|
180
172
|
}), e;
|
|
181
173
|
}, [
|
|
182
|
-
|
|
174
|
+
b,
|
|
183
175
|
G,
|
|
184
176
|
X,
|
|
185
177
|
Y,
|
|
186
|
-
|
|
178
|
+
S,
|
|
187
179
|
$
|
|
188
|
-
]),
|
|
189
|
-
|
|
180
|
+
]), Ge = a(() => _ && k ? re(l, _, V) : l, [
|
|
181
|
+
l,
|
|
190
182
|
V,
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
]),
|
|
194
|
-
return /* @__PURE__ */
|
|
183
|
+
_,
|
|
184
|
+
k
|
|
185
|
+
]), Ke = a(() => O ? { runtime: { sources: { [O]: Q } } } : o, [Q, O]);
|
|
186
|
+
return /* @__PURE__ */ s(te, {
|
|
195
187
|
ref: e,
|
|
196
|
-
tag: !
|
|
197
|
-
className:
|
|
188
|
+
tag: !k && !Ne?.length ? "div" : Se,
|
|
189
|
+
className: ve("plitzi-component__api-container", c),
|
|
198
190
|
interactionTriggers: n.triggers,
|
|
199
|
-
interactionCallbacks:
|
|
200
|
-
children: (!V ||
|
|
191
|
+
interactionCallbacks: We,
|
|
192
|
+
children: (!V || Ee || _) && /* @__PURE__ */ s(ge, {
|
|
201
193
|
inherit: "live",
|
|
202
|
-
name: `Api:${
|
|
203
|
-
value:
|
|
204
|
-
children:
|
|
194
|
+
name: `Api:${v}`,
|
|
195
|
+
value: Ke,
|
|
196
|
+
children: Ge
|
|
205
197
|
})
|
|
206
198
|
});
|
|
207
|
-
},
|
|
199
|
+
}, l = e(c);
|
|
208
200
|
//#endregion
|
|
209
|
-
export {
|
|
201
|
+
export { c as ApiContainer, l as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a server provider renders from in the builder, which has no `/_rsc` to ask: its mock data, in the shape the
|
|
3
|
+
* server answers it with.
|
|
4
|
+
*
|
|
5
|
+
* A provider that only has a `query` is answered as a browser request publishes — `{ status, data }`, the body under
|
|
6
|
+
* `data` — so its mock is that body under `data` too: `<source>.data.<field>` in the browser, on the server and in the
|
|
7
|
+
* builder alike. A connector's or an action's answer is its own slice (`records`, an action's output), and so is its
|
|
8
|
+
* mock. Mock data that is not JSON renders nothing, as an empty answer would.
|
|
9
|
+
*/
|
|
10
|
+
export declare const serverMock: (mockData: Record<string, unknown> | string, queryShaped: boolean) => Record<string, unknown>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { emptyObject as e } from "@plitzi/sdk-shared/helpers/utils";
|
|
2
|
+
//#region src/elements/provider/ApiContainer/helpers/serverMock.ts
|
|
3
|
+
var t = (t, n) => {
|
|
4
|
+
let r;
|
|
5
|
+
if (typeof t != "string") r = t;
|
|
6
|
+
else try {
|
|
7
|
+
r = JSON.parse(t || "{}");
|
|
8
|
+
} catch {
|
|
9
|
+
return e;
|
|
10
|
+
}
|
|
11
|
+
return n ? {
|
|
12
|
+
status: 200,
|
|
13
|
+
data: r
|
|
14
|
+
} : r;
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { t as serverMock };
|
|
@@ -2,7 +2,7 @@ import { ReactNode, RefObject } from 'react';
|
|
|
2
2
|
export type ContainerProps = {
|
|
3
3
|
ref?: RefObject<HTMLElement>;
|
|
4
4
|
className?: string;
|
|
5
|
-
subType?: 'div' | 'header' | 'footer' | 'nav' | 'main' | 'section' | 'article' | 'aside' | 'address' | 'figure' | 'dl' | 'dt' | 'dd' | 'li' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span';
|
|
5
|
+
subType?: 'div' | 'header' | 'footer' | 'nav' | 'main' | 'section' | 'article' | 'aside' | 'address' | 'figure' | 'dl' | 'dt' | 'dd' | 'li' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span';
|
|
6
6
|
/**
|
|
7
7
|
* The name of the part of the page this is — "Main navigation", "Search results", "Your cart" — for screen readers
|
|
8
8
|
* and browser agents, which list the page by its landmarks and regions and jump between them.
|
|
@@ -17,9 +17,15 @@ export type ContainerProps = {
|
|
|
17
17
|
* control inside it can still be tabbed to, and is then announced as nothing.
|
|
18
18
|
*/
|
|
19
19
|
decorative?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* A part of the page whose words change while somebody is on it — a count, a total, a status — said aloud when they
|
|
22
|
+
* do (`aria-live`): `polite` once the reader is idle, `assertive` at once, for what cannot wait. Left out, a change is
|
|
23
|
+
* silent to a screen reader, which reads only what it is moved to.
|
|
24
|
+
*/
|
|
25
|
+
live?: 'polite' | 'assertive' | '';
|
|
20
26
|
children?: ReactNode;
|
|
21
27
|
};
|
|
22
|
-
declare const Container: ({ ref, className, subType, label, decorative, children }: ContainerProps) => import('react').JSX.Element;
|
|
28
|
+
declare const Container: ({ ref, className, subType, label, decorative, live, children }: ContainerProps) => import('react').JSX.Element;
|
|
23
29
|
declare const _default: {
|
|
24
30
|
(props: import('../../../Element/hocs/withElement').WithElementProps<ContainerProps>): import('react').JSX.Element;
|
|
25
31
|
displayName: string;
|
|
@@ -4,18 +4,19 @@ import { NAMEABLE_CONTAINER_TAGS as n } from "./declaration.mjs";
|
|
|
4
4
|
import { jsx as r } from "react/jsx-runtime";
|
|
5
5
|
import i from "clsx";
|
|
6
6
|
//#region src/elements/structure/Container/Container.tsx
|
|
7
|
-
var a = ({ ref: e, className: a = "", subType: o = "div", label: s = "", decorative: c = !1,
|
|
8
|
-
let
|
|
7
|
+
var a = ({ ref: e, className: a = "", subType: o = "div", label: s = "", decorative: c = !1, live: l = "", children: u }) => {
|
|
8
|
+
let d = !c && s && n.includes(o) ? {
|
|
9
9
|
"aria-label": s,
|
|
10
10
|
...o === "div" ? { role: "group" } : {}
|
|
11
|
-
} : {},
|
|
11
|
+
} : {}, f = c ? { "aria-hidden": !0 } : {}, p = l ? { "aria-live": l } : {};
|
|
12
12
|
return /* @__PURE__ */ r(t, {
|
|
13
13
|
ref: e,
|
|
14
14
|
tag: o,
|
|
15
15
|
className: i(`plitzi-component__container plitzi-component__container-${o}`, a),
|
|
16
|
-
...u,
|
|
17
16
|
...d,
|
|
18
|
-
|
|
17
|
+
...f,
|
|
18
|
+
...p,
|
|
19
|
+
children: u
|
|
19
20
|
});
|
|
20
21
|
}, o = e(a);
|
|
21
22
|
//#endregion
|
|
@@ -12,6 +12,7 @@ declare const declaration: {
|
|
|
12
12
|
readonly type: "container";
|
|
13
13
|
readonly attributeValues: {
|
|
14
14
|
readonly subType: readonly string[];
|
|
15
|
+
readonly live: readonly string[];
|
|
15
16
|
};
|
|
16
17
|
readonly content: {
|
|
17
18
|
readonly attributes: {
|
|
@@ -62,7 +63,8 @@ declare const declaration: {
|
|
|
62
63
|
};
|
|
63
64
|
} & import('@plitzi/sdk-shared/authoring/declare').ElementAttributesBrand<Partial<{
|
|
64
65
|
label?: string | undefined;
|
|
65
|
-
subType?: "div" | "header" | "footer" | "nav" | "main" | "section" | "article" | "aside" | "address" | "figure" | "dl" | "dt" | "dd" | "li" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "span" | undefined;
|
|
66
|
+
subType?: "div" | "header" | "footer" | "nav" | "main" | "section" | "article" | "aside" | "address" | "figure" | "dl" | "dt" | "dd" | "li" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | undefined;
|
|
67
|
+
live?: "polite" | "assertive" | "" | undefined;
|
|
66
68
|
decorative?: boolean | undefined;
|
|
67
69
|
}>>;
|
|
68
70
|
export default declaration;
|
|
@@ -12,29 +12,37 @@ var n = [
|
|
|
12
12
|
"figure"
|
|
13
13
|
], r = e()({
|
|
14
14
|
type: "container",
|
|
15
|
-
attributeValues: {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
15
|
+
attributeValues: {
|
|
16
|
+
subType: t()([
|
|
17
|
+
"div",
|
|
18
|
+
"header",
|
|
19
|
+
"footer",
|
|
20
|
+
"nav",
|
|
21
|
+
"main",
|
|
22
|
+
"section",
|
|
23
|
+
"article",
|
|
24
|
+
"aside",
|
|
25
|
+
"address",
|
|
26
|
+
"figure",
|
|
27
|
+
"dl",
|
|
28
|
+
"dt",
|
|
29
|
+
"dd",
|
|
30
|
+
"li",
|
|
31
|
+
"h1",
|
|
32
|
+
"h2",
|
|
33
|
+
"h3",
|
|
34
|
+
"h4",
|
|
35
|
+
"h5",
|
|
36
|
+
"h6",
|
|
37
|
+
"p",
|
|
38
|
+
"span"
|
|
39
|
+
]),
|
|
40
|
+
live: t()([
|
|
41
|
+
"",
|
|
42
|
+
"polite",
|
|
43
|
+
"assertive"
|
|
44
|
+
])
|
|
45
|
+
},
|
|
38
46
|
content: {
|
|
39
47
|
attributes: { subType: "div" },
|
|
40
48
|
definition: {
|
|
@@ -5,6 +5,7 @@ declare const Container: {
|
|
|
5
5
|
readonly type: "container";
|
|
6
6
|
readonly attributeValues: {
|
|
7
7
|
readonly subType: readonly string[];
|
|
8
|
+
readonly live: readonly string[];
|
|
8
9
|
};
|
|
9
10
|
readonly content: {
|
|
10
11
|
readonly attributes: {
|
|
@@ -55,7 +56,8 @@ declare const Container: {
|
|
|
55
56
|
};
|
|
56
57
|
} & import('@plitzi/sdk-shared/authoring/declare').ElementAttributesBrand<Partial<{
|
|
57
58
|
label?: string | undefined;
|
|
58
|
-
subType?: "div" | "header" | "footer" | "nav" | "main" | "section" | "article" | "aside" | "address" | "figure" | "dl" | "dt" | "dd" | "li" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "span" | undefined;
|
|
59
|
+
subType?: "div" | "header" | "footer" | "nav" | "main" | "section" | "article" | "aside" | "address" | "figure" | "dl" | "dt" | "dd" | "li" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | undefined;
|
|
60
|
+
live?: "polite" | "assertive" | "" | undefined;
|
|
59
61
|
decorative?: boolean | undefined;
|
|
60
62
|
}>>;
|
|
61
63
|
export default Container;
|
|
@@ -29,7 +29,7 @@ var a = ({ subType: a = "ul", source: o = "none", itemKey: s = "", onUpdate: c }
|
|
|
29
29
|
title: "The field of each item that names it, so a row stays with its item when the list is filtered.",
|
|
30
30
|
onChange: l("itemKey")
|
|
31
31
|
}),
|
|
32
|
-
|
|
32
|
+
/* @__PURE__ */ n(i, {
|
|
33
33
|
label: "List Type",
|
|
34
34
|
value: a,
|
|
35
35
|
onChange: l("subType"),
|
|
@@ -16,7 +16,7 @@ var n = e()({
|
|
|
16
16
|
definition: {
|
|
17
17
|
label: "List",
|
|
18
18
|
type: "list",
|
|
19
|
-
description: "Repeats a template (its listItem
|
|
19
|
+
description: "Repeats a template (its row: a listItem, or a container with subType \"li\") once per entry of a data array — the way to render a dynamic collection, as a <ul> (subType \"ol\" for a numbered one). Bind its items to a data source (e.g. an apiContainer response).",
|
|
20
20
|
items: [],
|
|
21
21
|
bindings: {},
|
|
22
22
|
styleSelectors: { base: "" },
|
|
@@ -2,9 +2,11 @@ import { ReactNode, RefObject } from 'react';
|
|
|
2
2
|
export type ListControlledProps<T = unknown> = {
|
|
3
3
|
ref?: RefObject<HTMLElement>;
|
|
4
4
|
className: string;
|
|
5
|
+
/** The list's own tag: a list of data is a list, and each row — an `<li>` — renders straight into it. */
|
|
6
|
+
subType?: 'ul' | 'ol';
|
|
5
7
|
children: ReactNode;
|
|
6
8
|
items: T[];
|
|
7
9
|
itemKey?: string;
|
|
8
10
|
};
|
|
9
|
-
declare const ListControlled: ({ ref, className, children, items, itemKey }: ListControlledProps) => import('react').JSX.Element;
|
|
11
|
+
declare const ListControlled: ({ ref, className, subType, children, items, itemKey }: ListControlledProps) => import('react').JSX.Element;
|
|
10
12
|
export default ListControlled;
|
|
@@ -13,27 +13,28 @@ import m from "clsx";
|
|
|
13
13
|
import h from "@plitzi/sdk-shared/dataSource/helpers/getSourceName";
|
|
14
14
|
import g from "@plitzi/sdk-shared/dataSource/hooks/useRegisterSource";
|
|
15
15
|
//#region src/elements/structure/List/modes/ListControlled/ListControlled.tsx
|
|
16
|
-
var _ = ({ ref: _, className: v = "",
|
|
17
|
-
let { id:
|
|
18
|
-
item: c(
|
|
16
|
+
var _ = ({ ref: _, className: v = "", subType: y = "ul", children: b, items: x = [], itemKey: S }) => {
|
|
17
|
+
let { id: C, definition: { label: w } } = e(), T = h(i.sourceType, C), { settings: { previewMode: E } } = s(), D = o(() => Array.isArray(x) ? x : [], [x]), O = o(() => n(D, S), [D, S]), k = a(() => d({
|
|
18
|
+
item: c(D, "0", {}),
|
|
19
19
|
index: 0
|
|
20
20
|
}).reduce((e, t) => [...e, {
|
|
21
21
|
path: t,
|
|
22
22
|
name: t
|
|
23
|
-
}], []), [
|
|
23
|
+
}], []), [D]), A = o(() => T ? { runtime: { sources: { [T]: { items: D } } } } : u, [T, D]);
|
|
24
24
|
return g({
|
|
25
|
-
id:
|
|
26
|
-
source:
|
|
27
|
-
name:
|
|
28
|
-
fields:
|
|
25
|
+
id: C,
|
|
26
|
+
source: T,
|
|
27
|
+
name: w || `List - ${C}`,
|
|
28
|
+
fields: k
|
|
29
29
|
}), /* @__PURE__ */ p(t, {
|
|
30
30
|
ref: _,
|
|
31
|
-
|
|
31
|
+
tag: y,
|
|
32
|
+
className: m("plitzi-component__controlled-list", v, { "controlled-list--build-mode": !E }),
|
|
32
33
|
children: [/* @__PURE__ */ f(l, {
|
|
33
34
|
inherit: "live",
|
|
34
|
-
name: `List:${
|
|
35
|
-
value:
|
|
36
|
-
children:
|
|
35
|
+
name: `List:${C}`,
|
|
36
|
+
value: A,
|
|
37
|
+
children: D.map((e, t) => !b || Array.isArray(b) && b.length === 0 ? /* @__PURE__ */ f("div", {
|
|
37
38
|
className: "plitzi-component__controlled-list-item controlled-list--empty",
|
|
38
39
|
children: /* @__PURE__ */ f("div", {
|
|
39
40
|
className: "controlled-list-item__counter",
|
|
@@ -41,12 +42,12 @@ var _ = ({ ref: _, className: v = "", children: y, items: b = [], itemKey: x })
|
|
|
41
42
|
})
|
|
42
43
|
}, t) : /* @__PURE__ */ f(r, {
|
|
43
44
|
index: t,
|
|
44
|
-
isTemplate: t !== 0 && !
|
|
45
|
+
isTemplate: t !== 0 && !E,
|
|
45
46
|
record: e,
|
|
46
|
-
source:
|
|
47
|
-
children:
|
|
48
|
-
},
|
|
49
|
-
}), !
|
|
47
|
+
source: T,
|
|
48
|
+
children: b
|
|
49
|
+
}, O[t]))
|
|
50
|
+
}), !E && D.length === 0 && /* @__PURE__ */ f("div", {
|
|
50
51
|
className: "controlled-list controlled-list--empty",
|
|
51
52
|
children: "This list does not contain any items"
|
|
52
53
|
})]
|