@player-ui/reference-assets-plugin-react 0.4.0-next.9 → 0.4.1-next.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.
- package/dist/index.cjs.js +140 -116
- package/dist/index.d.ts +7 -4
- package/dist/index.esm.js +140 -117
- package/dist/xlr/ActionAsset.json +10 -2
- package/dist/xlr/CollectionAsset.json +1 -1
- package/dist/xlr/InfoAsset.json +1 -1
- package/dist/xlr/InputAsset.json +2 -2
- package/dist/xlr/TextAsset.json +4 -4
- package/dist/xlr/manifest.js +11 -7
- package/dist/xlr/manifest.json +12 -2
- package/package.json +6 -6
- package/src/assets/action/Action.tsx +1 -1
- package/src/assets/image/Image.tsx +18 -0
- package/src/assets/image/index.tsx +1 -0
- package/src/assets/index.tsx +1 -0
- package/src/assets/info/Info.tsx +5 -29
- package/src/plugin.tsx +4 -2
package/dist/index.cjs.js
CHANGED
|
@@ -16,19 +16,19 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
16
16
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
17
17
|
var makeClass__default = /*#__PURE__*/_interopDefaultLegacy(makeClass);
|
|
18
18
|
|
|
19
|
-
var __defProp$
|
|
20
|
-
var __getOwnPropSymbols$
|
|
21
|
-
var __hasOwnProp$
|
|
22
|
-
var __propIsEnum$
|
|
23
|
-
var __defNormalProp$
|
|
24
|
-
var __spreadValues$
|
|
19
|
+
var __defProp$8 = Object.defineProperty;
|
|
20
|
+
var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
|
|
21
|
+
var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
|
|
22
|
+
var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
|
|
23
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
24
|
+
var __spreadValues$8 = (a, b) => {
|
|
25
25
|
for (var prop in b || (b = {}))
|
|
26
|
-
if (__hasOwnProp$
|
|
27
|
-
__defNormalProp$
|
|
28
|
-
if (__getOwnPropSymbols$
|
|
29
|
-
for (var prop of __getOwnPropSymbols$
|
|
30
|
-
if (__propIsEnum$
|
|
31
|
-
__defNormalProp$
|
|
26
|
+
if (__hasOwnProp$8.call(b, prop))
|
|
27
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
28
|
+
if (__getOwnPropSymbols$8)
|
|
29
|
+
for (var prop of __getOwnPropSymbols$8(b)) {
|
|
30
|
+
if (__propIsEnum$8.call(b, prop))
|
|
31
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
32
32
|
}
|
|
33
33
|
return a;
|
|
34
34
|
};
|
|
@@ -45,7 +45,7 @@ const defaultKeyStrings = [
|
|
|
45
45
|
"Escape"
|
|
46
46
|
];
|
|
47
47
|
const getConfig = (userConfig = {}) => {
|
|
48
|
-
return __spreadValues$
|
|
48
|
+
return __spreadValues$8({
|
|
49
49
|
liveFormat: true,
|
|
50
50
|
suppressBeacons: false,
|
|
51
51
|
quickFormatDelay: 200,
|
|
@@ -199,19 +199,19 @@ const useInputAsset = (props, config) => {
|
|
|
199
199
|
};
|
|
200
200
|
};
|
|
201
201
|
|
|
202
|
-
var __defProp$
|
|
203
|
-
var __getOwnPropSymbols$
|
|
204
|
-
var __hasOwnProp$
|
|
205
|
-
var __propIsEnum$
|
|
206
|
-
var __defNormalProp$
|
|
207
|
-
var __spreadValues$
|
|
202
|
+
var __defProp$7 = Object.defineProperty;
|
|
203
|
+
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
204
|
+
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
205
|
+
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
206
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
207
|
+
var __spreadValues$7 = (a, b) => {
|
|
208
208
|
for (var prop in b || (b = {}))
|
|
209
|
-
if (__hasOwnProp$
|
|
210
|
-
__defNormalProp$
|
|
211
|
-
if (__getOwnPropSymbols$
|
|
212
|
-
for (var prop of __getOwnPropSymbols$
|
|
213
|
-
if (__propIsEnum$
|
|
214
|
-
__defNormalProp$
|
|
209
|
+
if (__hasOwnProp$7.call(b, prop))
|
|
210
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
211
|
+
if (__getOwnPropSymbols$7)
|
|
212
|
+
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
213
|
+
if (__propIsEnum$7.call(b, prop))
|
|
214
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
215
215
|
}
|
|
216
216
|
return a;
|
|
217
217
|
};
|
|
@@ -222,27 +222,27 @@ const Input = (props) => {
|
|
|
222
222
|
isInvalid: Boolean(validation)
|
|
223
223
|
}, label && /* @__PURE__ */ React__default["default"].createElement(react.FormLabel, {
|
|
224
224
|
htmlFor: id
|
|
225
|
-
}, /* @__PURE__ */ React__default["default"].createElement(react$1.ReactAsset, __spreadValues$
|
|
225
|
+
}, /* @__PURE__ */ React__default["default"].createElement(react$1.ReactAsset, __spreadValues$7({}, label))), /* @__PURE__ */ React__default["default"].createElement(react.Input, __spreadValues$7({
|
|
226
226
|
id,
|
|
227
227
|
size: "md"
|
|
228
|
-
}, inputProps)), validation && /* @__PURE__ */ React__default["default"].createElement(react.FormErrorMessage, null, validation.message), note && /* @__PURE__ */ React__default["default"].createElement(react.FormHelperText, null, /* @__PURE__ */ React__default["default"].createElement(react$1.ReactAsset, __spreadValues$
|
|
228
|
+
}, inputProps)), validation && /* @__PURE__ */ React__default["default"].createElement(react.FormErrorMessage, null, validation.message), note && /* @__PURE__ */ React__default["default"].createElement(react.FormHelperText, null, /* @__PURE__ */ React__default["default"].createElement(react$1.ReactAsset, __spreadValues$7({}, note))));
|
|
229
229
|
};
|
|
230
230
|
|
|
231
|
-
var __defProp$
|
|
231
|
+
var __defProp$6 = Object.defineProperty;
|
|
232
232
|
var __defProps = Object.defineProperties;
|
|
233
233
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
234
|
-
var __getOwnPropSymbols$
|
|
235
|
-
var __hasOwnProp$
|
|
236
|
-
var __propIsEnum$
|
|
237
|
-
var __defNormalProp$
|
|
238
|
-
var __spreadValues$
|
|
234
|
+
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
235
|
+
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
236
|
+
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
237
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
238
|
+
var __spreadValues$6 = (a, b) => {
|
|
239
239
|
for (var prop in b || (b = {}))
|
|
240
|
-
if (__hasOwnProp$
|
|
241
|
-
__defNormalProp$
|
|
242
|
-
if (__getOwnPropSymbols$
|
|
243
|
-
for (var prop of __getOwnPropSymbols$
|
|
244
|
-
if (__propIsEnum$
|
|
245
|
-
__defNormalProp$
|
|
240
|
+
if (__hasOwnProp$6.call(b, prop))
|
|
241
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
242
|
+
if (__getOwnPropSymbols$6)
|
|
243
|
+
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
244
|
+
if (__propIsEnum$6.call(b, prop))
|
|
245
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
246
246
|
}
|
|
247
247
|
return a;
|
|
248
248
|
};
|
|
@@ -254,25 +254,25 @@ const useText = (props) => {
|
|
|
254
254
|
if (props.modifiers && (modifierContext == null ? void 0 : modifierContext.getClassForModifier)) {
|
|
255
255
|
className = makeClass__default["default"](...props.modifiers.map(modifierContext.getClassForModifier));
|
|
256
256
|
}
|
|
257
|
-
return __spreadProps(__spreadValues$
|
|
257
|
+
return __spreadProps(__spreadValues$6({}, react$1.useAssetProps(props)), {
|
|
258
258
|
className,
|
|
259
259
|
children: props.value
|
|
260
260
|
});
|
|
261
261
|
};
|
|
262
262
|
|
|
263
|
-
var __defProp$
|
|
264
|
-
var __getOwnPropSymbols$
|
|
265
|
-
var __hasOwnProp$
|
|
266
|
-
var __propIsEnum$
|
|
267
|
-
var __defNormalProp$
|
|
268
|
-
var __spreadValues$
|
|
263
|
+
var __defProp$5 = Object.defineProperty;
|
|
264
|
+
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
265
|
+
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
266
|
+
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
267
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
268
|
+
var __spreadValues$5 = (a, b) => {
|
|
269
269
|
for (var prop in b || (b = {}))
|
|
270
|
-
if (__hasOwnProp$
|
|
271
|
-
__defNormalProp$
|
|
272
|
-
if (__getOwnPropSymbols$
|
|
273
|
-
for (var prop of __getOwnPropSymbols$
|
|
274
|
-
if (__propIsEnum$
|
|
275
|
-
__defNormalProp$
|
|
270
|
+
if (__hasOwnProp$5.call(b, prop))
|
|
271
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
272
|
+
if (__getOwnPropSymbols$5)
|
|
273
|
+
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
274
|
+
if (__propIsEnum$5.call(b, prop))
|
|
275
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
276
276
|
}
|
|
277
277
|
return a;
|
|
278
278
|
};
|
|
@@ -292,7 +292,33 @@ const Text = (props) => {
|
|
|
292
292
|
href: linkModifier.metaData.ref
|
|
293
293
|
}, value);
|
|
294
294
|
}
|
|
295
|
-
return /* @__PURE__ */ React__default["default"].createElement("span", __spreadValues$
|
|
295
|
+
return /* @__PURE__ */ React__default["default"].createElement("span", __spreadValues$5({}, spanProps), value);
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
var __defProp$4 = Object.defineProperty;
|
|
299
|
+
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
300
|
+
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
301
|
+
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
302
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
303
|
+
var __spreadValues$4 = (a, b) => {
|
|
304
|
+
for (var prop in b || (b = {}))
|
|
305
|
+
if (__hasOwnProp$4.call(b, prop))
|
|
306
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
307
|
+
if (__getOwnPropSymbols$4)
|
|
308
|
+
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
309
|
+
if (__propIsEnum$4.call(b, prop))
|
|
310
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
311
|
+
}
|
|
312
|
+
return a;
|
|
313
|
+
};
|
|
314
|
+
const Collection = (props) => {
|
|
315
|
+
var _a;
|
|
316
|
+
return /* @__PURE__ */ React__default["default"].createElement(react.Flex, {
|
|
317
|
+
direction: "column",
|
|
318
|
+
gap: "5"
|
|
319
|
+
}, props.label && /* @__PURE__ */ React__default["default"].createElement("h3", null, /* @__PURE__ */ React__default["default"].createElement(react$1.ReactAsset, __spreadValues$4({}, props.label))), (_a = props.values) == null ? void 0 : _a.map((a) => /* @__PURE__ */ React__default["default"].createElement(react$1.ReactAsset, __spreadValues$4({
|
|
320
|
+
key: a.asset.id
|
|
321
|
+
}, a))));
|
|
296
322
|
};
|
|
297
323
|
|
|
298
324
|
var __defProp$3 = Object.defineProperty;
|
|
@@ -311,14 +337,21 @@ var __spreadValues$3 = (a, b) => {
|
|
|
311
337
|
}
|
|
312
338
|
return a;
|
|
313
339
|
};
|
|
314
|
-
const
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
340
|
+
const useAction = (props) => {
|
|
341
|
+
const { label } = props;
|
|
342
|
+
const beacon = beaconPluginReact.useBeacon({
|
|
343
|
+
asset: props,
|
|
344
|
+
action: "clicked",
|
|
345
|
+
element: "button"
|
|
346
|
+
});
|
|
347
|
+
return {
|
|
348
|
+
id: props.id,
|
|
349
|
+
onClick: () => {
|
|
350
|
+
beacon();
|
|
351
|
+
props.run();
|
|
352
|
+
},
|
|
353
|
+
children: (label == null ? void 0 : label.asset) ? /* @__PURE__ */ React__default["default"].createElement(react$1.ReactAsset, __spreadValues$3({}, label == null ? void 0 : label.asset)) : null
|
|
354
|
+
};
|
|
322
355
|
};
|
|
323
356
|
|
|
324
357
|
var __defProp$2 = Object.defineProperty;
|
|
@@ -337,21 +370,13 @@ var __spreadValues$2 = (a, b) => {
|
|
|
337
370
|
}
|
|
338
371
|
return a;
|
|
339
372
|
};
|
|
340
|
-
const
|
|
373
|
+
const Action = (props) => {
|
|
374
|
+
var _a;
|
|
341
375
|
const { label } = props;
|
|
342
|
-
const
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
});
|
|
347
|
-
return {
|
|
348
|
-
id: props.id,
|
|
349
|
-
onClick: () => {
|
|
350
|
-
beacon();
|
|
351
|
-
props.run();
|
|
352
|
-
},
|
|
353
|
-
children: (label == null ? void 0 : label.asset) ? /* @__PURE__ */ React__default["default"].createElement(react$1.ReactAsset, __spreadValues$2({}, label == null ? void 0 : label.asset)) : null
|
|
354
|
-
};
|
|
376
|
+
const buttonProps = useAction(props);
|
|
377
|
+
return /* @__PURE__ */ React__default["default"].createElement("div", null, /* @__PURE__ */ React__default["default"].createElement(react.Button, __spreadValues$2({
|
|
378
|
+
variant: referenceAssetsPlugin.isBackAction(props) ? "ghost" : "solid"
|
|
379
|
+
}, buttonProps), ((_a = props == null ? void 0 : props.metaData) == null ? void 0 : _a.role) === "back" && /* @__PURE__ */ React__default["default"].createElement(icons.ChevronLeftIcon, null), label && /* @__PURE__ */ React__default["default"].createElement(react.Text, null, /* @__PURE__ */ React__default["default"].createElement(react$1.ReactAsset, __spreadValues$2({}, label)))));
|
|
355
380
|
};
|
|
356
381
|
|
|
357
382
|
var __defProp$1 = Object.defineProperty;
|
|
@@ -370,42 +395,8 @@ var __spreadValues$1 = (a, b) => {
|
|
|
370
395
|
}
|
|
371
396
|
return a;
|
|
372
397
|
};
|
|
373
|
-
const Action = (props) => {
|
|
374
|
-
const { label } = props;
|
|
375
|
-
const buttonProps = useAction(props);
|
|
376
|
-
return /* @__PURE__ */ React__default["default"].createElement("div", null, /* @__PURE__ */ React__default["default"].createElement(react.Button, __spreadValues$1({
|
|
377
|
-
variant: referenceAssetsPlugin.isBackAction(props) ? "ghost" : "solid"
|
|
378
|
-
}, buttonProps), referenceAssetsPlugin.isBackAction(props) && /* @__PURE__ */ React__default["default"].createElement(icons.ChevronLeftIcon, null), label && /* @__PURE__ */ React__default["default"].createElement(react.Text, null, /* @__PURE__ */ React__default["default"].createElement(react$1.ReactAsset, __spreadValues$1({}, label)))));
|
|
379
|
-
};
|
|
380
|
-
|
|
381
|
-
var __defProp = Object.defineProperty;
|
|
382
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
383
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
384
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
385
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
386
|
-
var __spreadValues = (a, b) => {
|
|
387
|
-
for (var prop in b || (b = {}))
|
|
388
|
-
if (__hasOwnProp.call(b, prop))
|
|
389
|
-
__defNormalProp(a, prop, b[prop]);
|
|
390
|
-
if (__getOwnPropSymbols)
|
|
391
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
392
|
-
if (__propIsEnum.call(b, prop))
|
|
393
|
-
__defNormalProp(a, prop, b[prop]);
|
|
394
|
-
}
|
|
395
|
-
return a;
|
|
396
|
-
};
|
|
397
398
|
const Info = (props) => {
|
|
398
|
-
var _a, _b;
|
|
399
|
-
const segmentedActions = React__default["default"].useMemo(() => {
|
|
400
|
-
var _a2, _b2;
|
|
401
|
-
if (!((_a2 = props.actions) == null ? void 0 : _a2.length)) {
|
|
402
|
-
return;
|
|
403
|
-
}
|
|
404
|
-
return (_b2 = props.actions) == null ? void 0 : _b2.reduce((memo, next) => {
|
|
405
|
-
memo[referenceAssetsPlugin.isBackAction(next.asset) ? "prev" : "next"].push(next);
|
|
406
|
-
return memo;
|
|
407
|
-
}, { prev: [], next: [] });
|
|
408
|
-
}, [props.actions]);
|
|
399
|
+
var _a, _b, _c, _d;
|
|
409
400
|
return /* @__PURE__ */ React__default["default"].createElement(react.Box, {
|
|
410
401
|
minW: { base: void 0, md: "md" }
|
|
411
402
|
}, /* @__PURE__ */ React__default["default"].createElement(react.Stack, {
|
|
@@ -413,24 +404,55 @@ const Info = (props) => {
|
|
|
413
404
|
}, props.title && /* @__PURE__ */ React__default["default"].createElement(react.Heading, {
|
|
414
405
|
size: "lg",
|
|
415
406
|
as: "h1"
|
|
416
|
-
}, /* @__PURE__ */ React__default["default"].createElement(react$1.ReactAsset, __spreadValues({}, props.title))), props.subTitle && /* @__PURE__ */ React__default["default"].createElement(react.Heading, {
|
|
407
|
+
}, /* @__PURE__ */ React__default["default"].createElement(react$1.ReactAsset, __spreadValues$1({}, props.title))), props.subTitle && /* @__PURE__ */ React__default["default"].createElement(react.Heading, {
|
|
417
408
|
size: "md",
|
|
418
409
|
as: "h3"
|
|
419
|
-
}, /* @__PURE__ */ React__default["default"].createElement(react$1.ReactAsset, __spreadValues({}, props.subTitle))), /* @__PURE__ */ React__default["default"].createElement(react.Box, null, props.primaryInfo && /* @__PURE__ */ React__default["default"].createElement(react$1.ReactAsset, __spreadValues({}, props.primaryInfo))), /* @__PURE__ */ React__default["default"].createElement(react.Stack, {
|
|
410
|
+
}, /* @__PURE__ */ React__default["default"].createElement(react$1.ReactAsset, __spreadValues$1({}, props.subTitle))), /* @__PURE__ */ React__default["default"].createElement(react.Box, null, props.primaryInfo && /* @__PURE__ */ React__default["default"].createElement(react$1.ReactAsset, __spreadValues$1({}, props.primaryInfo))), /* @__PURE__ */ React__default["default"].createElement(react.Stack, {
|
|
420
411
|
gap: "4"
|
|
421
|
-
}, segmentedActions && /* @__PURE__ */ React__default["default"].createElement(react.Divider, null), /* @__PURE__ */ React__default["default"].createElement(react.HStack, {
|
|
412
|
+
}, (props == null ? void 0 : props.segmentedActions) && /* @__PURE__ */ React__default["default"].createElement(react.Divider, null), /* @__PURE__ */ React__default["default"].createElement(react.HStack, {
|
|
422
413
|
justifyContent: "space-between"
|
|
423
414
|
}, /* @__PURE__ */ React__default["default"].createElement(react.ButtonGroup, {
|
|
424
415
|
spacing: "6"
|
|
425
|
-
}, (_a = segmentedActions == null ? void 0 :
|
|
416
|
+
}, (_b = (_a = props == null ? void 0 : props.segmentedActions) == null ? void 0 : _a.prev) == null ? void 0 : _b.map((a) => /* @__PURE__ */ React__default["default"].createElement(react$1.ReactAsset, __spreadValues$1({
|
|
426
417
|
key: a.asset.id
|
|
427
418
|
}, a)))), /* @__PURE__ */ React__default["default"].createElement(react.ButtonGroup, {
|
|
428
419
|
spacing: "6"
|
|
429
|
-
}, (
|
|
420
|
+
}, (_d = (_c = props == null ? void 0 : props.segmentedActions) == null ? void 0 : _c.next) == null ? void 0 : _d.map((a) => /* @__PURE__ */ React__default["default"].createElement(react$1.ReactAsset, __spreadValues$1({
|
|
430
421
|
key: a.asset.id
|
|
431
422
|
}, a))))))));
|
|
432
423
|
};
|
|
433
424
|
|
|
425
|
+
var __defProp = Object.defineProperty;
|
|
426
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
427
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
428
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
429
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
430
|
+
var __spreadValues = (a, b) => {
|
|
431
|
+
for (var prop in b || (b = {}))
|
|
432
|
+
if (__hasOwnProp.call(b, prop))
|
|
433
|
+
__defNormalProp(a, prop, b[prop]);
|
|
434
|
+
if (__getOwnPropSymbols)
|
|
435
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
436
|
+
if (__propIsEnum.call(b, prop))
|
|
437
|
+
__defNormalProp(a, prop, b[prop]);
|
|
438
|
+
}
|
|
439
|
+
return a;
|
|
440
|
+
};
|
|
441
|
+
const Image = (props) => {
|
|
442
|
+
const { metaData, caption, altText } = props;
|
|
443
|
+
console.log(props);
|
|
444
|
+
return /* @__PURE__ */ React__default["default"].createElement("figure", {
|
|
445
|
+
className: "figure"
|
|
446
|
+
}, /* @__PURE__ */ React__default["default"].createElement("img", {
|
|
447
|
+
className: "figure-img img-fluid",
|
|
448
|
+
src: metaData.ref,
|
|
449
|
+
alt: altText
|
|
450
|
+
}), caption && /* @__PURE__ */ React__default["default"].createElement("figcaption", {
|
|
451
|
+
className: "figure-caption",
|
|
452
|
+
style: { marginTop: 15 }
|
|
453
|
+
}, /* @__PURE__ */ React__default["default"].createElement(react$1.ReactAsset, __spreadValues({}, caption))));
|
|
454
|
+
};
|
|
455
|
+
|
|
434
456
|
const OptionalChakraThemeProvider = (props) => {
|
|
435
457
|
const theme = react.useTheme();
|
|
436
458
|
if (theme) {
|
|
@@ -448,7 +470,8 @@ class ReferenceAssetsPlugin {
|
|
|
448
470
|
["text", Text],
|
|
449
471
|
["action", Action],
|
|
450
472
|
["info", Info],
|
|
451
|
-
["collection", Collection]
|
|
473
|
+
["collection", Collection],
|
|
474
|
+
["image", Image]
|
|
452
475
|
]));
|
|
453
476
|
reactPlayer.hooks.webComponent.tap(this.name, (Comp) => {
|
|
454
477
|
return () => {
|
|
@@ -463,6 +486,7 @@ class ReferenceAssetsPlugin {
|
|
|
463
486
|
|
|
464
487
|
exports.Action = Action;
|
|
465
488
|
exports.Collection = Collection;
|
|
489
|
+
exports.Image = Image;
|
|
466
490
|
exports.Info = Info;
|
|
467
491
|
exports.Input = Input;
|
|
468
492
|
exports.ReferenceAssetsPlugin = ReferenceAssetsPlugin;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactPlayerPlugin, ReactPlayer } from '@player-ui/react';
|
|
2
2
|
import { ExtendedPlayerPlugin, Player } from '@player-ui/player';
|
|
3
|
-
import { InputAsset, TextAsset, ActionAsset,
|
|
3
|
+
import { InputAsset, TextAsset, ActionAsset, CollectionAsset, InfoAsset, TransformedInput, LinkModifier, TransformedAction, InfoAssetTransform, TransformedImage } from '@player-ui/reference-assets-plugin';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -10,8 +10,9 @@ declare class ReferenceAssetsPlugin implements ReactPlayerPlugin, ExtendedPlayer
|
|
|
10
10
|
InputAsset,
|
|
11
11
|
TextAsset,
|
|
12
12
|
ActionAsset,
|
|
13
|
-
InfoAsset,
|
|
14
13
|
CollectionAsset
|
|
14
|
+
], [
|
|
15
|
+
InfoAsset
|
|
15
16
|
]> {
|
|
16
17
|
name: string;
|
|
17
18
|
applyReact(reactPlayer: ReactPlayer): void;
|
|
@@ -86,6 +87,8 @@ declare const useAction: (props: TransformedAction) => {
|
|
|
86
87
|
};
|
|
87
88
|
|
|
88
89
|
/** The info view type is used to show information to the user */
|
|
89
|
-
declare const Info: (props:
|
|
90
|
+
declare const Info: (props: InfoAssetTransform) => JSX.Element;
|
|
90
91
|
|
|
91
|
-
|
|
92
|
+
declare const Image: (props: TransformedImage) => JSX.Element;
|
|
93
|
+
|
|
94
|
+
export { Action, Collection, Image, Info, Input, InputHookConfig, ReferenceAssetsPlugin, Text, TextModifierContext, TextModifierContextType, getConfig, getLinkModifier, useAction, useInputAsset, useInputBeacon, useText };
|
package/dist/index.esm.js
CHANGED
|
@@ -7,19 +7,19 @@ import { useBeacon } from '@player-ui/beacon-plugin-react';
|
|
|
7
7
|
import makeClass from 'clsx';
|
|
8
8
|
import { ChevronLeftIcon } from '@chakra-ui/icons';
|
|
9
9
|
|
|
10
|
-
var __defProp$
|
|
11
|
-
var __getOwnPropSymbols$
|
|
12
|
-
var __hasOwnProp$
|
|
13
|
-
var __propIsEnum$
|
|
14
|
-
var __defNormalProp$
|
|
15
|
-
var __spreadValues$
|
|
10
|
+
var __defProp$8 = Object.defineProperty;
|
|
11
|
+
var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
|
|
12
|
+
var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
|
|
13
|
+
var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
|
|
14
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15
|
+
var __spreadValues$8 = (a, b) => {
|
|
16
16
|
for (var prop in b || (b = {}))
|
|
17
|
-
if (__hasOwnProp$
|
|
18
|
-
__defNormalProp$
|
|
19
|
-
if (__getOwnPropSymbols$
|
|
20
|
-
for (var prop of __getOwnPropSymbols$
|
|
21
|
-
if (__propIsEnum$
|
|
22
|
-
__defNormalProp$
|
|
17
|
+
if (__hasOwnProp$8.call(b, prop))
|
|
18
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
19
|
+
if (__getOwnPropSymbols$8)
|
|
20
|
+
for (var prop of __getOwnPropSymbols$8(b)) {
|
|
21
|
+
if (__propIsEnum$8.call(b, prop))
|
|
22
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
23
23
|
}
|
|
24
24
|
return a;
|
|
25
25
|
};
|
|
@@ -36,7 +36,7 @@ const defaultKeyStrings = [
|
|
|
36
36
|
"Escape"
|
|
37
37
|
];
|
|
38
38
|
const getConfig = (userConfig = {}) => {
|
|
39
|
-
return __spreadValues$
|
|
39
|
+
return __spreadValues$8({
|
|
40
40
|
liveFormat: true,
|
|
41
41
|
suppressBeacons: false,
|
|
42
42
|
quickFormatDelay: 200,
|
|
@@ -190,19 +190,19 @@ const useInputAsset = (props, config) => {
|
|
|
190
190
|
};
|
|
191
191
|
};
|
|
192
192
|
|
|
193
|
-
var __defProp$
|
|
194
|
-
var __getOwnPropSymbols$
|
|
195
|
-
var __hasOwnProp$
|
|
196
|
-
var __propIsEnum$
|
|
197
|
-
var __defNormalProp$
|
|
198
|
-
var __spreadValues$
|
|
193
|
+
var __defProp$7 = Object.defineProperty;
|
|
194
|
+
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
195
|
+
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
196
|
+
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
197
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
198
|
+
var __spreadValues$7 = (a, b) => {
|
|
199
199
|
for (var prop in b || (b = {}))
|
|
200
|
-
if (__hasOwnProp$
|
|
201
|
-
__defNormalProp$
|
|
202
|
-
if (__getOwnPropSymbols$
|
|
203
|
-
for (var prop of __getOwnPropSymbols$
|
|
204
|
-
if (__propIsEnum$
|
|
205
|
-
__defNormalProp$
|
|
200
|
+
if (__hasOwnProp$7.call(b, prop))
|
|
201
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
202
|
+
if (__getOwnPropSymbols$7)
|
|
203
|
+
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
204
|
+
if (__propIsEnum$7.call(b, prop))
|
|
205
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
206
206
|
}
|
|
207
207
|
return a;
|
|
208
208
|
};
|
|
@@ -213,27 +213,27 @@ const Input = (props) => {
|
|
|
213
213
|
isInvalid: Boolean(validation)
|
|
214
214
|
}, label && /* @__PURE__ */ React.createElement(FormLabel, {
|
|
215
215
|
htmlFor: id
|
|
216
|
-
}, /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues$
|
|
216
|
+
}, /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues$7({}, label))), /* @__PURE__ */ React.createElement(Input$1, __spreadValues$7({
|
|
217
217
|
id,
|
|
218
218
|
size: "md"
|
|
219
|
-
}, inputProps)), validation && /* @__PURE__ */ React.createElement(FormErrorMessage, null, validation.message), note && /* @__PURE__ */ React.createElement(FormHelperText, null, /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues$
|
|
219
|
+
}, inputProps)), validation && /* @__PURE__ */ React.createElement(FormErrorMessage, null, validation.message), note && /* @__PURE__ */ React.createElement(FormHelperText, null, /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues$7({}, note))));
|
|
220
220
|
};
|
|
221
221
|
|
|
222
|
-
var __defProp$
|
|
222
|
+
var __defProp$6 = Object.defineProperty;
|
|
223
223
|
var __defProps = Object.defineProperties;
|
|
224
224
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
225
|
-
var __getOwnPropSymbols$
|
|
226
|
-
var __hasOwnProp$
|
|
227
|
-
var __propIsEnum$
|
|
228
|
-
var __defNormalProp$
|
|
229
|
-
var __spreadValues$
|
|
225
|
+
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
226
|
+
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
227
|
+
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
228
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
229
|
+
var __spreadValues$6 = (a, b) => {
|
|
230
230
|
for (var prop in b || (b = {}))
|
|
231
|
-
if (__hasOwnProp$
|
|
232
|
-
__defNormalProp$
|
|
233
|
-
if (__getOwnPropSymbols$
|
|
234
|
-
for (var prop of __getOwnPropSymbols$
|
|
235
|
-
if (__propIsEnum$
|
|
236
|
-
__defNormalProp$
|
|
231
|
+
if (__hasOwnProp$6.call(b, prop))
|
|
232
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
233
|
+
if (__getOwnPropSymbols$6)
|
|
234
|
+
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
235
|
+
if (__propIsEnum$6.call(b, prop))
|
|
236
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
237
237
|
}
|
|
238
238
|
return a;
|
|
239
239
|
};
|
|
@@ -245,25 +245,25 @@ const useText = (props) => {
|
|
|
245
245
|
if (props.modifiers && (modifierContext == null ? void 0 : modifierContext.getClassForModifier)) {
|
|
246
246
|
className = makeClass(...props.modifiers.map(modifierContext.getClassForModifier));
|
|
247
247
|
}
|
|
248
|
-
return __spreadProps(__spreadValues$
|
|
248
|
+
return __spreadProps(__spreadValues$6({}, useAssetProps(props)), {
|
|
249
249
|
className,
|
|
250
250
|
children: props.value
|
|
251
251
|
});
|
|
252
252
|
};
|
|
253
253
|
|
|
254
|
-
var __defProp$
|
|
255
|
-
var __getOwnPropSymbols$
|
|
256
|
-
var __hasOwnProp$
|
|
257
|
-
var __propIsEnum$
|
|
258
|
-
var __defNormalProp$
|
|
259
|
-
var __spreadValues$
|
|
254
|
+
var __defProp$5 = Object.defineProperty;
|
|
255
|
+
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
256
|
+
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
257
|
+
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
258
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
259
|
+
var __spreadValues$5 = (a, b) => {
|
|
260
260
|
for (var prop in b || (b = {}))
|
|
261
|
-
if (__hasOwnProp$
|
|
262
|
-
__defNormalProp$
|
|
263
|
-
if (__getOwnPropSymbols$
|
|
264
|
-
for (var prop of __getOwnPropSymbols$
|
|
265
|
-
if (__propIsEnum$
|
|
266
|
-
__defNormalProp$
|
|
261
|
+
if (__hasOwnProp$5.call(b, prop))
|
|
262
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
263
|
+
if (__getOwnPropSymbols$5)
|
|
264
|
+
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
265
|
+
if (__propIsEnum$5.call(b, prop))
|
|
266
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
267
267
|
}
|
|
268
268
|
return a;
|
|
269
269
|
};
|
|
@@ -283,7 +283,33 @@ const Text = (props) => {
|
|
|
283
283
|
href: linkModifier.metaData.ref
|
|
284
284
|
}, value);
|
|
285
285
|
}
|
|
286
|
-
return /* @__PURE__ */ React.createElement("span", __spreadValues$
|
|
286
|
+
return /* @__PURE__ */ React.createElement("span", __spreadValues$5({}, spanProps), value);
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
var __defProp$4 = Object.defineProperty;
|
|
290
|
+
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
291
|
+
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
292
|
+
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
293
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
294
|
+
var __spreadValues$4 = (a, b) => {
|
|
295
|
+
for (var prop in b || (b = {}))
|
|
296
|
+
if (__hasOwnProp$4.call(b, prop))
|
|
297
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
298
|
+
if (__getOwnPropSymbols$4)
|
|
299
|
+
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
300
|
+
if (__propIsEnum$4.call(b, prop))
|
|
301
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
302
|
+
}
|
|
303
|
+
return a;
|
|
304
|
+
};
|
|
305
|
+
const Collection = (props) => {
|
|
306
|
+
var _a;
|
|
307
|
+
return /* @__PURE__ */ React.createElement(Flex, {
|
|
308
|
+
direction: "column",
|
|
309
|
+
gap: "5"
|
|
310
|
+
}, props.label && /* @__PURE__ */ React.createElement("h3", null, /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues$4({}, props.label))), (_a = props.values) == null ? void 0 : _a.map((a) => /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues$4({
|
|
311
|
+
key: a.asset.id
|
|
312
|
+
}, a))));
|
|
287
313
|
};
|
|
288
314
|
|
|
289
315
|
var __defProp$3 = Object.defineProperty;
|
|
@@ -302,14 +328,21 @@ var __spreadValues$3 = (a, b) => {
|
|
|
302
328
|
}
|
|
303
329
|
return a;
|
|
304
330
|
};
|
|
305
|
-
const
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
331
|
+
const useAction = (props) => {
|
|
332
|
+
const { label } = props;
|
|
333
|
+
const beacon = useBeacon({
|
|
334
|
+
asset: props,
|
|
335
|
+
action: "clicked",
|
|
336
|
+
element: "button"
|
|
337
|
+
});
|
|
338
|
+
return {
|
|
339
|
+
id: props.id,
|
|
340
|
+
onClick: () => {
|
|
341
|
+
beacon();
|
|
342
|
+
props.run();
|
|
343
|
+
},
|
|
344
|
+
children: (label == null ? void 0 : label.asset) ? /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues$3({}, label == null ? void 0 : label.asset)) : null
|
|
345
|
+
};
|
|
313
346
|
};
|
|
314
347
|
|
|
315
348
|
var __defProp$2 = Object.defineProperty;
|
|
@@ -328,21 +361,13 @@ var __spreadValues$2 = (a, b) => {
|
|
|
328
361
|
}
|
|
329
362
|
return a;
|
|
330
363
|
};
|
|
331
|
-
const
|
|
364
|
+
const Action = (props) => {
|
|
365
|
+
var _a;
|
|
332
366
|
const { label } = props;
|
|
333
|
-
const
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
});
|
|
338
|
-
return {
|
|
339
|
-
id: props.id,
|
|
340
|
-
onClick: () => {
|
|
341
|
-
beacon();
|
|
342
|
-
props.run();
|
|
343
|
-
},
|
|
344
|
-
children: (label == null ? void 0 : label.asset) ? /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues$2({}, label == null ? void 0 : label.asset)) : null
|
|
345
|
-
};
|
|
367
|
+
const buttonProps = useAction(props);
|
|
368
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Button, __spreadValues$2({
|
|
369
|
+
variant: isBackAction(props) ? "ghost" : "solid"
|
|
370
|
+
}, buttonProps), ((_a = props == null ? void 0 : props.metaData) == null ? void 0 : _a.role) === "back" && /* @__PURE__ */ React.createElement(ChevronLeftIcon, null), label && /* @__PURE__ */ React.createElement(Text$1, null, /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues$2({}, label)))));
|
|
346
371
|
};
|
|
347
372
|
|
|
348
373
|
var __defProp$1 = Object.defineProperty;
|
|
@@ -361,42 +386,8 @@ var __spreadValues$1 = (a, b) => {
|
|
|
361
386
|
}
|
|
362
387
|
return a;
|
|
363
388
|
};
|
|
364
|
-
const Action = (props) => {
|
|
365
|
-
const { label } = props;
|
|
366
|
-
const buttonProps = useAction(props);
|
|
367
|
-
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Button, __spreadValues$1({
|
|
368
|
-
variant: isBackAction(props) ? "ghost" : "solid"
|
|
369
|
-
}, buttonProps), isBackAction(props) && /* @__PURE__ */ React.createElement(ChevronLeftIcon, null), label && /* @__PURE__ */ React.createElement(Text$1, null, /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues$1({}, label)))));
|
|
370
|
-
};
|
|
371
|
-
|
|
372
|
-
var __defProp = Object.defineProperty;
|
|
373
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
374
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
375
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
376
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
377
|
-
var __spreadValues = (a, b) => {
|
|
378
|
-
for (var prop in b || (b = {}))
|
|
379
|
-
if (__hasOwnProp.call(b, prop))
|
|
380
|
-
__defNormalProp(a, prop, b[prop]);
|
|
381
|
-
if (__getOwnPropSymbols)
|
|
382
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
383
|
-
if (__propIsEnum.call(b, prop))
|
|
384
|
-
__defNormalProp(a, prop, b[prop]);
|
|
385
|
-
}
|
|
386
|
-
return a;
|
|
387
|
-
};
|
|
388
389
|
const Info = (props) => {
|
|
389
|
-
var _a, _b;
|
|
390
|
-
const segmentedActions = React.useMemo(() => {
|
|
391
|
-
var _a2, _b2;
|
|
392
|
-
if (!((_a2 = props.actions) == null ? void 0 : _a2.length)) {
|
|
393
|
-
return;
|
|
394
|
-
}
|
|
395
|
-
return (_b2 = props.actions) == null ? void 0 : _b2.reduce((memo, next) => {
|
|
396
|
-
memo[isBackAction(next.asset) ? "prev" : "next"].push(next);
|
|
397
|
-
return memo;
|
|
398
|
-
}, { prev: [], next: [] });
|
|
399
|
-
}, [props.actions]);
|
|
390
|
+
var _a, _b, _c, _d;
|
|
400
391
|
return /* @__PURE__ */ React.createElement(Box, {
|
|
401
392
|
minW: { base: void 0, md: "md" }
|
|
402
393
|
}, /* @__PURE__ */ React.createElement(Stack, {
|
|
@@ -404,24 +395,55 @@ const Info = (props) => {
|
|
|
404
395
|
}, props.title && /* @__PURE__ */ React.createElement(Heading, {
|
|
405
396
|
size: "lg",
|
|
406
397
|
as: "h1"
|
|
407
|
-
}, /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues({}, props.title))), props.subTitle && /* @__PURE__ */ React.createElement(Heading, {
|
|
398
|
+
}, /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues$1({}, props.title))), props.subTitle && /* @__PURE__ */ React.createElement(Heading, {
|
|
408
399
|
size: "md",
|
|
409
400
|
as: "h3"
|
|
410
|
-
}, /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues({}, props.subTitle))), /* @__PURE__ */ React.createElement(Box, null, props.primaryInfo && /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues({}, props.primaryInfo))), /* @__PURE__ */ React.createElement(Stack, {
|
|
401
|
+
}, /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues$1({}, props.subTitle))), /* @__PURE__ */ React.createElement(Box, null, props.primaryInfo && /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues$1({}, props.primaryInfo))), /* @__PURE__ */ React.createElement(Stack, {
|
|
411
402
|
gap: "4"
|
|
412
|
-
}, segmentedActions && /* @__PURE__ */ React.createElement(Divider, null), /* @__PURE__ */ React.createElement(HStack, {
|
|
403
|
+
}, (props == null ? void 0 : props.segmentedActions) && /* @__PURE__ */ React.createElement(Divider, null), /* @__PURE__ */ React.createElement(HStack, {
|
|
413
404
|
justifyContent: "space-between"
|
|
414
405
|
}, /* @__PURE__ */ React.createElement(ButtonGroup, {
|
|
415
406
|
spacing: "6"
|
|
416
|
-
}, (_a = segmentedActions == null ? void 0 :
|
|
407
|
+
}, (_b = (_a = props == null ? void 0 : props.segmentedActions) == null ? void 0 : _a.prev) == null ? void 0 : _b.map((a) => /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues$1({
|
|
417
408
|
key: a.asset.id
|
|
418
409
|
}, a)))), /* @__PURE__ */ React.createElement(ButtonGroup, {
|
|
419
410
|
spacing: "6"
|
|
420
|
-
}, (
|
|
411
|
+
}, (_d = (_c = props == null ? void 0 : props.segmentedActions) == null ? void 0 : _c.next) == null ? void 0 : _d.map((a) => /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues$1({
|
|
421
412
|
key: a.asset.id
|
|
422
413
|
}, a))))))));
|
|
423
414
|
};
|
|
424
415
|
|
|
416
|
+
var __defProp = Object.defineProperty;
|
|
417
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
418
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
419
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
420
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
421
|
+
var __spreadValues = (a, b) => {
|
|
422
|
+
for (var prop in b || (b = {}))
|
|
423
|
+
if (__hasOwnProp.call(b, prop))
|
|
424
|
+
__defNormalProp(a, prop, b[prop]);
|
|
425
|
+
if (__getOwnPropSymbols)
|
|
426
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
427
|
+
if (__propIsEnum.call(b, prop))
|
|
428
|
+
__defNormalProp(a, prop, b[prop]);
|
|
429
|
+
}
|
|
430
|
+
return a;
|
|
431
|
+
};
|
|
432
|
+
const Image = (props) => {
|
|
433
|
+
const { metaData, caption, altText } = props;
|
|
434
|
+
console.log(props);
|
|
435
|
+
return /* @__PURE__ */ React.createElement("figure", {
|
|
436
|
+
className: "figure"
|
|
437
|
+
}, /* @__PURE__ */ React.createElement("img", {
|
|
438
|
+
className: "figure-img img-fluid",
|
|
439
|
+
src: metaData.ref,
|
|
440
|
+
alt: altText
|
|
441
|
+
}), caption && /* @__PURE__ */ React.createElement("figcaption", {
|
|
442
|
+
className: "figure-caption",
|
|
443
|
+
style: { marginTop: 15 }
|
|
444
|
+
}, /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues({}, caption))));
|
|
445
|
+
};
|
|
446
|
+
|
|
425
447
|
const OptionalChakraThemeProvider = (props) => {
|
|
426
448
|
const theme = useTheme();
|
|
427
449
|
if (theme) {
|
|
@@ -439,7 +461,8 @@ class ReferenceAssetsPlugin {
|
|
|
439
461
|
["text", Text],
|
|
440
462
|
["action", Action],
|
|
441
463
|
["info", Info],
|
|
442
|
-
["collection", Collection]
|
|
464
|
+
["collection", Collection],
|
|
465
|
+
["image", Image]
|
|
443
466
|
]));
|
|
444
467
|
reactPlayer.hooks.webComponent.tap(this.name, (Comp) => {
|
|
445
468
|
return () => {
|
|
@@ -452,5 +475,5 @@ class ReferenceAssetsPlugin {
|
|
|
452
475
|
}
|
|
453
476
|
}
|
|
454
477
|
|
|
455
|
-
export { Action, Collection, Info, Input, ReferenceAssetsPlugin, Text, TextModifierContext, getConfig, getLinkModifier, useAction, useInputAsset, useInputBeacon, useText };
|
|
478
|
+
export { Action, Collection, Image, Info, Input, ReferenceAssetsPlugin, Text, TextModifierContext, getConfig, getLinkModifier, useAction, useInputAsset, useInputBeacon, useText };
|
|
456
479
|
//# sourceMappingURL=index.esm.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/
|
|
2
|
+
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2798/execroot/player/node_modules/@player-ui/reference-assets-plugin/dist/index.d.ts",
|
|
3
3
|
"name": "ActionAsset",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"properties": {
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"beacon": {
|
|
52
52
|
"required": false,
|
|
53
53
|
"node": {
|
|
54
|
-
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/
|
|
54
|
+
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2798/execroot/player/node_modules/@player-ui/beacon-plugin/dist/index.d.ts",
|
|
55
55
|
"name": "BeaconDataType",
|
|
56
56
|
"type": "or",
|
|
57
57
|
"or": [
|
|
@@ -81,6 +81,14 @@
|
|
|
81
81
|
"title": "ActionAsset.metaData.skipValidation",
|
|
82
82
|
"description": "Force transition to the next view without checking for validation"
|
|
83
83
|
}
|
|
84
|
+
},
|
|
85
|
+
"role": {
|
|
86
|
+
"required": false,
|
|
87
|
+
"node": {
|
|
88
|
+
"type": "string",
|
|
89
|
+
"title": "ActionAsset.metaData.role",
|
|
90
|
+
"description": "string value to decide for the left anchor sign"
|
|
91
|
+
}
|
|
84
92
|
}
|
|
85
93
|
},
|
|
86
94
|
"additionalProperties": false,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/
|
|
2
|
+
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2798/execroot/player/node_modules/@player-ui/reference-assets-plugin/dist/index.d.ts",
|
|
3
3
|
"name": "CollectionAsset",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"properties": {
|
package/dist/xlr/InfoAsset.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/
|
|
2
|
+
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2798/execroot/player/node_modules/@player-ui/reference-assets-plugin/dist/index.d.ts",
|
|
3
3
|
"name": "InfoAsset",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"properties": {
|
package/dist/xlr/InputAsset.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/
|
|
2
|
+
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2798/execroot/player/node_modules/@player-ui/reference-assets-plugin/dist/index.d.ts",
|
|
3
3
|
"name": "InputAsset",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"properties": {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"beacon": {
|
|
51
51
|
"required": false,
|
|
52
52
|
"node": {
|
|
53
|
-
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/
|
|
53
|
+
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2798/execroot/player/node_modules/@player-ui/beacon-plugin/dist/index.d.ts",
|
|
54
54
|
"name": "BeaconDataType",
|
|
55
55
|
"type": "or",
|
|
56
56
|
"or": [
|
package/dist/xlr/TextAsset.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/
|
|
2
|
+
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2798/execroot/player/node_modules/@player-ui/reference-assets-plugin/dist/index.d.ts",
|
|
3
3
|
"name": "TextAsset",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"properties": {
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"node": {
|
|
17
17
|
"type": "array",
|
|
18
18
|
"elementType": {
|
|
19
|
-
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/
|
|
19
|
+
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2798/execroot/player/node_modules/@player-ui/reference-assets-plugin/dist/index.d.ts",
|
|
20
20
|
"name": "TextModifier",
|
|
21
21
|
"type": "or",
|
|
22
22
|
"or": [
|
|
23
23
|
{
|
|
24
|
-
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/
|
|
24
|
+
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2798/execroot/player/node_modules/@player-ui/reference-assets-plugin/dist/index.d.ts",
|
|
25
25
|
"name": "BasicTextModifier",
|
|
26
26
|
"type": "object",
|
|
27
27
|
"properties": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"title": "BasicTextModifier"
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
|
-
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/
|
|
51
|
+
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2798/execroot/player/node_modules/@player-ui/reference-assets-plugin/dist/index.d.ts",
|
|
52
52
|
"name": "LinkModifier",
|
|
53
53
|
"type": "object",
|
|
54
54
|
"properties": {
|
package/dist/xlr/manifest.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
const InputAsset = require('./InputAsset.json')
|
|
2
2
|
const TextAsset = require('./TextAsset.json')
|
|
3
3
|
const ActionAsset = require('./ActionAsset.json')
|
|
4
|
-
const InfoAsset = require('./InfoAsset.json')
|
|
5
4
|
const CollectionAsset = require('./CollectionAsset.json')
|
|
5
|
+
const InfoAsset = require('./InfoAsset.json')
|
|
6
6
|
|
|
7
|
-
module.exports = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
7
|
+
module.exports = {
|
|
8
|
+
"pluginName": "reference-assets-web-plugin",
|
|
9
|
+
"capabilities": {
|
|
10
|
+
"Assets":[InputAsset,TextAsset,ActionAsset,CollectionAsset],
|
|
11
|
+
"Views":[InfoAsset],
|
|
12
|
+
},
|
|
13
|
+
"customPrimitives": [
|
|
14
|
+
'Expression','Asset','Binding','AssetWrapper','Schema.DataType','ExpressionHandler'
|
|
15
|
+
]
|
|
16
|
+
}
|
package/dist/xlr/manifest.json
CHANGED
|
@@ -5,8 +5,18 @@
|
|
|
5
5
|
"InputAsset",
|
|
6
6
|
"TextAsset",
|
|
7
7
|
"ActionAsset",
|
|
8
|
-
"InfoAsset",
|
|
9
8
|
"CollectionAsset"
|
|
9
|
+
],
|
|
10
|
+
"Views": [
|
|
11
|
+
"InfoAsset"
|
|
10
12
|
]
|
|
11
|
-
}
|
|
13
|
+
},
|
|
14
|
+
"customPrimitives": [
|
|
15
|
+
"Expression",
|
|
16
|
+
"Asset",
|
|
17
|
+
"Binding",
|
|
18
|
+
"AssetWrapper",
|
|
19
|
+
"Schema.DataType",
|
|
20
|
+
"ExpressionHandler"
|
|
21
|
+
]
|
|
12
22
|
}
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@player-ui/reference-assets-plugin-react",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1-next.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
7
7
|
},
|
|
8
8
|
"peerDependencies": {
|
|
9
9
|
"@types/node": "^16.11.12",
|
|
10
|
-
"@player-ui/react": "0.4.
|
|
10
|
+
"@player-ui/react": "0.4.1-next.0"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@player-ui/reference-assets-plugin": "0.4.
|
|
14
|
-
"@player-ui/partial-match-registry": "0.4.
|
|
15
|
-
"@player-ui/asset-provider-plugin-react": "0.4.
|
|
16
|
-
"@player-ui/beacon-plugin-react": "0.4.
|
|
13
|
+
"@player-ui/reference-assets-plugin": "0.4.1-next.0",
|
|
14
|
+
"@player-ui/partial-match-registry": "0.4.1-next.0",
|
|
15
|
+
"@player-ui/asset-provider-plugin-react": "0.4.1-next.0",
|
|
16
|
+
"@player-ui/beacon-plugin-react": "0.4.1-next.0",
|
|
17
17
|
"clsx": "^1.1.1",
|
|
18
18
|
"@chakra-ui/react": "^1.7.3",
|
|
19
19
|
"@chakra-ui/icons": "^1.1.1",
|
|
@@ -19,7 +19,7 @@ export const Action = (props: TransformedAction) => {
|
|
|
19
19
|
variant={isBackAction(props) ? 'ghost' : 'solid'}
|
|
20
20
|
{...buttonProps}
|
|
21
21
|
>
|
|
22
|
-
{
|
|
22
|
+
{props?.metaData?.role === 'back' && <ChevronLeftIcon />}
|
|
23
23
|
{label && (
|
|
24
24
|
<Text>
|
|
25
25
|
<ReactAsset {...label} />
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ReactAsset } from '@player-ui/react';
|
|
3
|
+
import type { TransformedImage } from '@player-ui/reference-assets-plugin';
|
|
4
|
+
|
|
5
|
+
export const Image = (props: TransformedImage) => {
|
|
6
|
+
const { metaData, caption, altText } = props;
|
|
7
|
+
console.log(props);
|
|
8
|
+
return (
|
|
9
|
+
<figure className="figure">
|
|
10
|
+
<img className="figure-img img-fluid" src={metaData.ref} alt={altText} />
|
|
11
|
+
{caption && (
|
|
12
|
+
<figcaption className="figure-caption" style={{ marginTop: 15 }}>
|
|
13
|
+
<ReactAsset {...caption} />
|
|
14
|
+
</figcaption>
|
|
15
|
+
)}
|
|
16
|
+
</figure>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Image';
|
package/src/assets/index.tsx
CHANGED
package/src/assets/info/Info.tsx
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
ActionAsset,
|
|
4
|
-
InfoAsset,
|
|
5
|
-
} from '@player-ui/reference-assets-plugin';
|
|
6
|
-
import { isBackAction } from '@player-ui/reference-assets-plugin';
|
|
2
|
+
import type { InfoAssetTransform } from '@player-ui/reference-assets-plugin';
|
|
7
3
|
import { ReactAsset } from '@player-ui/react';
|
|
8
4
|
import {
|
|
9
5
|
ButtonGroup,
|
|
@@ -13,29 +9,9 @@ import {
|
|
|
13
9
|
Stack,
|
|
14
10
|
HStack,
|
|
15
11
|
} from '@chakra-ui/react';
|
|
16
|
-
import type { AssetWrapper } from '@player-ui/react';
|
|
17
12
|
|
|
18
13
|
/** The info view type is used to show information to the user */
|
|
19
|
-
export const Info = (props:
|
|
20
|
-
const segmentedActions = React.useMemo(() => {
|
|
21
|
-
if (!props.actions?.length) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return props.actions?.reduce(
|
|
26
|
-
(memo, next) => {
|
|
27
|
-
memo[isBackAction(next.asset as ActionAsset) ? 'prev' : 'next'].push(
|
|
28
|
-
next as AssetWrapper<ActionAsset>
|
|
29
|
-
);
|
|
30
|
-
return memo;
|
|
31
|
-
},
|
|
32
|
-
{ prev: [], next: [] } as {
|
|
33
|
-
prev: Array<AssetWrapper<ActionAsset>>;
|
|
34
|
-
next: Array<AssetWrapper<ActionAsset>>;
|
|
35
|
-
}
|
|
36
|
-
);
|
|
37
|
-
}, [props.actions]);
|
|
38
|
-
|
|
14
|
+
export const Info = (props: InfoAssetTransform) => {
|
|
39
15
|
return (
|
|
40
16
|
<Box minW={{ base: undefined, md: 'md' }}>
|
|
41
17
|
<Stack gap="10">
|
|
@@ -51,15 +27,15 @@ export const Info = (props: InfoAsset) => {
|
|
|
51
27
|
)}
|
|
52
28
|
<Box>{props.primaryInfo && <ReactAsset {...props.primaryInfo} />}</Box>
|
|
53
29
|
<Stack gap="4">
|
|
54
|
-
{segmentedActions && <Divider />}
|
|
30
|
+
{props?.segmentedActions && <Divider />}
|
|
55
31
|
<HStack justifyContent="space-between">
|
|
56
32
|
<ButtonGroup spacing="6">
|
|
57
|
-
{segmentedActions?.prev?.map((a) => (
|
|
33
|
+
{props?.segmentedActions?.prev?.map((a) => (
|
|
58
34
|
<ReactAsset key={a.asset.id} {...a} />
|
|
59
35
|
))}
|
|
60
36
|
</ButtonGroup>
|
|
61
37
|
<ButtonGroup spacing="6">
|
|
62
|
-
{segmentedActions?.next?.map((a) => (
|
|
38
|
+
{props?.segmentedActions?.next?.map((a) => (
|
|
63
39
|
<ReactAsset key={a.asset.id} {...a} />
|
|
64
40
|
))}
|
|
65
41
|
</ButtonGroup>
|
package/src/plugin.tsx
CHANGED
|
@@ -11,7 +11,7 @@ import type {
|
|
|
11
11
|
InfoAsset,
|
|
12
12
|
} from '@player-ui/reference-assets-plugin';
|
|
13
13
|
import { ReferenceAssetsPlugin as ReferenceAssetsCorePlugin } from '@player-ui/reference-assets-plugin';
|
|
14
|
-
import { Input, Text, Collection, Action, Info } from './assets';
|
|
14
|
+
import { Input, Text, Collection, Action, Info, Image } from './assets';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
*
|
|
@@ -36,7 +36,8 @@ export class ReferenceAssetsPlugin
|
|
|
36
36
|
implements
|
|
37
37
|
ReactPlayerPlugin,
|
|
38
38
|
ExtendedPlayerPlugin<
|
|
39
|
-
[InputAsset, TextAsset, ActionAsset,
|
|
39
|
+
[InputAsset, TextAsset, ActionAsset, CollectionAsset],
|
|
40
|
+
[InfoAsset]
|
|
40
41
|
>
|
|
41
42
|
{
|
|
42
43
|
name = 'reference-assets-web-plugin';
|
|
@@ -49,6 +50,7 @@ export class ReferenceAssetsPlugin
|
|
|
49
50
|
['action', Action],
|
|
50
51
|
['info', Info],
|
|
51
52
|
['collection', Collection],
|
|
53
|
+
['image', Image],
|
|
52
54
|
])
|
|
53
55
|
);
|
|
54
56
|
|