@player-ui/reference-assets-plugin-react 0.3.0-next.3 → 0.3.0-next.5
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 +14 -15
- package/dist/index.d.ts +3 -3
- package/dist/index.esm.js +13 -14
- package/package.json +6 -6
- package/src/assets/action/Action.tsx +2 -2
- package/src/assets/action/hooks.tsx +2 -2
- package/src/assets/collection/Collection.tsx +3 -3
- package/src/assets/info/Info.tsx +6 -6
- package/src/assets/input/Input.tsx +3 -3
- package/src/assets/text/hooks.tsx +1 -1
- package/src/intro.stories.mdx +5 -5
- package/src/plugin.tsx +5 -5
package/dist/index.cjs.js
CHANGED
|
@@ -6,10 +6,9 @@ var React = require('react');
|
|
|
6
6
|
var assetProviderPluginReact = require('@player-ui/asset-provider-plugin-react');
|
|
7
7
|
var react = require('@chakra-ui/react');
|
|
8
8
|
var referenceAssetsPlugin = require('@player-ui/reference-assets-plugin');
|
|
9
|
-
var
|
|
9
|
+
var react$1 = require('@player-ui/react');
|
|
10
10
|
var beaconPluginReact = require('@player-ui/beacon-plugin-react');
|
|
11
11
|
var makeClass = require('clsx');
|
|
12
|
-
var reactUtils = require('@player-ui/react-utils');
|
|
13
12
|
var icons = require('@chakra-ui/icons');
|
|
14
13
|
|
|
15
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -223,10 +222,10 @@ const Input = (props) => {
|
|
|
223
222
|
isInvalid: Boolean(validation)
|
|
224
223
|
}, label && /* @__PURE__ */ React__default["default"].createElement(react.FormLabel, {
|
|
225
224
|
htmlFor: id
|
|
226
|
-
}, /* @__PURE__ */ React__default["default"].createElement(
|
|
225
|
+
}, /* @__PURE__ */ React__default["default"].createElement(react$1.ReactAsset, __spreadValues$6({}, label))), /* @__PURE__ */ React__default["default"].createElement(react.Input, __spreadValues$6({
|
|
227
226
|
id,
|
|
228
227
|
size: "md"
|
|
229
|
-
}, 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(
|
|
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$6({}, note))));
|
|
230
229
|
};
|
|
231
230
|
|
|
232
231
|
var __defProp$5 = Object.defineProperty;
|
|
@@ -255,7 +254,7 @@ const useText = (props) => {
|
|
|
255
254
|
if (props.modifiers && (modifierContext == null ? void 0 : modifierContext.getClassForModifier)) {
|
|
256
255
|
className = makeClass__default["default"](...props.modifiers.map(modifierContext.getClassForModifier));
|
|
257
256
|
}
|
|
258
|
-
return __spreadProps(__spreadValues$5({},
|
|
257
|
+
return __spreadProps(__spreadValues$5({}, react$1.useAssetProps(props)), {
|
|
259
258
|
className,
|
|
260
259
|
children: props.value
|
|
261
260
|
});
|
|
@@ -317,7 +316,7 @@ const Collection = (props) => {
|
|
|
317
316
|
return /* @__PURE__ */ React__default["default"].createElement(react.Flex, {
|
|
318
317
|
direction: "column",
|
|
319
318
|
gap: "5"
|
|
320
|
-
}, props.label && /* @__PURE__ */ React__default["default"].createElement("h3", null, /* @__PURE__ */ React__default["default"].createElement(
|
|
319
|
+
}, props.label && /* @__PURE__ */ React__default["default"].createElement("h3", null, /* @__PURE__ */ React__default["default"].createElement(react$1.ReactAsset, __spreadValues$3({}, props.label))), (_a = props.values) == null ? void 0 : _a.map((a) => /* @__PURE__ */ React__default["default"].createElement(react$1.ReactAsset, __spreadValues$3({
|
|
321
320
|
key: a.asset.id
|
|
322
321
|
}, a))));
|
|
323
322
|
};
|
|
@@ -351,7 +350,7 @@ const useAction = (props) => {
|
|
|
351
350
|
beacon();
|
|
352
351
|
props.run();
|
|
353
352
|
},
|
|
354
|
-
children: (label == null ? void 0 : label.asset) ? /* @__PURE__ */ React__default["default"].createElement(
|
|
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
|
|
355
354
|
};
|
|
356
355
|
};
|
|
357
356
|
|
|
@@ -376,7 +375,7 @@ const Action = (props) => {
|
|
|
376
375
|
const buttonProps = useAction(props);
|
|
377
376
|
return /* @__PURE__ */ React__default["default"].createElement("div", null, /* @__PURE__ */ React__default["default"].createElement(react.Button, __spreadValues$1({
|
|
378
377
|
variant: referenceAssetsPlugin.isBackAction(props) ? "ghost" : "solid"
|
|
379
|
-
}, 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(
|
|
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)))));
|
|
380
379
|
};
|
|
381
380
|
|
|
382
381
|
var __defProp = Object.defineProperty;
|
|
@@ -414,20 +413,20 @@ const Info = (props) => {
|
|
|
414
413
|
}, props.title && /* @__PURE__ */ React__default["default"].createElement(react.Heading, {
|
|
415
414
|
size: "lg",
|
|
416
415
|
as: "h1"
|
|
417
|
-
}, /* @__PURE__ */ React__default["default"].createElement(
|
|
416
|
+
}, /* @__PURE__ */ React__default["default"].createElement(react$1.ReactAsset, __spreadValues({}, props.title))), props.subTitle && /* @__PURE__ */ React__default["default"].createElement(react.Heading, {
|
|
418
417
|
size: "md",
|
|
419
418
|
as: "h3"
|
|
420
|
-
}, /* @__PURE__ */ React__default["default"].createElement(
|
|
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, {
|
|
421
420
|
gap: "4"
|
|
422
421
|
}, segmentedActions && /* @__PURE__ */ React__default["default"].createElement(react.Divider, null), /* @__PURE__ */ React__default["default"].createElement(react.HStack, {
|
|
423
422
|
justifyContent: "space-between"
|
|
424
423
|
}, /* @__PURE__ */ React__default["default"].createElement(react.ButtonGroup, {
|
|
425
424
|
spacing: "6"
|
|
426
|
-
}, (_a = segmentedActions == null ? void 0 : segmentedActions.prev) == null ? void 0 : _a.map((a) => /* @__PURE__ */ React__default["default"].createElement(
|
|
425
|
+
}, (_a = segmentedActions == null ? void 0 : segmentedActions.prev) == null ? void 0 : _a.map((a) => /* @__PURE__ */ React__default["default"].createElement(react$1.ReactAsset, __spreadValues({
|
|
427
426
|
key: a.asset.id
|
|
428
427
|
}, a)))), /* @__PURE__ */ React__default["default"].createElement(react.ButtonGroup, {
|
|
429
428
|
spacing: "6"
|
|
430
|
-
}, (_b = segmentedActions == null ? void 0 : segmentedActions.next) == null ? void 0 : _b.map((a) => /* @__PURE__ */ React__default["default"].createElement(
|
|
429
|
+
}, (_b = segmentedActions == null ? void 0 : segmentedActions.next) == null ? void 0 : _b.map((a) => /* @__PURE__ */ React__default["default"].createElement(react$1.ReactAsset, __spreadValues({
|
|
431
430
|
key: a.asset.id
|
|
432
431
|
}, a))))))));
|
|
433
432
|
};
|
|
@@ -443,15 +442,15 @@ class ReferenceAssetsPlugin {
|
|
|
443
442
|
constructor() {
|
|
444
443
|
this.name = "reference-assets-web-plugin";
|
|
445
444
|
}
|
|
446
|
-
|
|
447
|
-
|
|
445
|
+
applyReact(reactPlayer) {
|
|
446
|
+
reactPlayer.registerPlugin(new assetProviderPluginReact.AssetProviderPlugin([
|
|
448
447
|
["input", Input],
|
|
449
448
|
["text", Text],
|
|
450
449
|
["action", Action],
|
|
451
450
|
["info", Info],
|
|
452
451
|
["collection", Collection]
|
|
453
452
|
]));
|
|
454
|
-
|
|
453
|
+
reactPlayer.hooks.webComponent.tap(this.name, (Comp) => {
|
|
455
454
|
return () => {
|
|
456
455
|
return /* @__PURE__ */ React__default["default"].createElement(OptionalChakraThemeProvider, null, /* @__PURE__ */ React__default["default"].createElement(Comp, null));
|
|
457
456
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactPlayerPlugin, ReactPlayer } from '@player-ui/react';
|
|
2
2
|
import { Player } from '@player-ui/player';
|
|
3
3
|
import { TransformedInput, TextAsset, LinkModifier, CollectionAsset, TransformedAction, InfoAsset } from '@player-ui/reference-assets-plugin';
|
|
4
4
|
import React from 'react';
|
|
@@ -6,9 +6,9 @@ import React from 'react';
|
|
|
6
6
|
/**
|
|
7
7
|
* A plugin to register the base reference assets
|
|
8
8
|
*/
|
|
9
|
-
declare class ReferenceAssetsPlugin implements
|
|
9
|
+
declare class ReferenceAssetsPlugin implements ReactPlayerPlugin {
|
|
10
10
|
name: string;
|
|
11
|
-
|
|
11
|
+
applyReact(reactPlayer: ReactPlayer): void;
|
|
12
12
|
apply(player: Player): void;
|
|
13
13
|
}
|
|
14
14
|
|
package/dist/index.esm.js
CHANGED
|
@@ -2,10 +2,9 @@ import React, { useContext } from 'react';
|
|
|
2
2
|
import { AssetProviderPlugin } from '@player-ui/asset-provider-plugin-react';
|
|
3
3
|
import { FormControl, FormLabel, Input as Input$1, FormErrorMessage, FormHelperText, Link, Flex, Button, Text as Text$1, Box, Stack, Heading, Divider, HStack, ButtonGroup, useTheme, ChakraProvider } from '@chakra-ui/react';
|
|
4
4
|
import { isBackAction, ReferenceAssetsPlugin as ReferenceAssetsPlugin$1 } from '@player-ui/reference-assets-plugin';
|
|
5
|
-
import {
|
|
5
|
+
import { ReactAsset, useAssetProps } from '@player-ui/react';
|
|
6
6
|
import { useBeacon } from '@player-ui/beacon-plugin-react';
|
|
7
7
|
import makeClass from 'clsx';
|
|
8
|
-
import { useAssetProps } from '@player-ui/react-utils';
|
|
9
8
|
import { ChevronLeftIcon } from '@chakra-ui/icons';
|
|
10
9
|
|
|
11
10
|
var __defProp$7 = Object.defineProperty;
|
|
@@ -214,10 +213,10 @@ const Input = (props) => {
|
|
|
214
213
|
isInvalid: Boolean(validation)
|
|
215
214
|
}, label && /* @__PURE__ */ React.createElement(FormLabel, {
|
|
216
215
|
htmlFor: id
|
|
217
|
-
}, /* @__PURE__ */ React.createElement(
|
|
216
|
+
}, /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues$6({}, label))), /* @__PURE__ */ React.createElement(Input$1, __spreadValues$6({
|
|
218
217
|
id,
|
|
219
218
|
size: "md"
|
|
220
|
-
}, inputProps)), validation && /* @__PURE__ */ React.createElement(FormErrorMessage, null, validation.message), note && /* @__PURE__ */ React.createElement(FormHelperText, null, /* @__PURE__ */ React.createElement(
|
|
219
|
+
}, inputProps)), validation && /* @__PURE__ */ React.createElement(FormErrorMessage, null, validation.message), note && /* @__PURE__ */ React.createElement(FormHelperText, null, /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues$6({}, note))));
|
|
221
220
|
};
|
|
222
221
|
|
|
223
222
|
var __defProp$5 = Object.defineProperty;
|
|
@@ -308,7 +307,7 @@ const Collection = (props) => {
|
|
|
308
307
|
return /* @__PURE__ */ React.createElement(Flex, {
|
|
309
308
|
direction: "column",
|
|
310
309
|
gap: "5"
|
|
311
|
-
}, props.label && /* @__PURE__ */ React.createElement("h3", null, /* @__PURE__ */ React.createElement(
|
|
310
|
+
}, props.label && /* @__PURE__ */ React.createElement("h3", null, /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues$3({}, props.label))), (_a = props.values) == null ? void 0 : _a.map((a) => /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues$3({
|
|
312
311
|
key: a.asset.id
|
|
313
312
|
}, a))));
|
|
314
313
|
};
|
|
@@ -342,7 +341,7 @@ const useAction = (props) => {
|
|
|
342
341
|
beacon();
|
|
343
342
|
props.run();
|
|
344
343
|
},
|
|
345
|
-
children: (label == null ? void 0 : label.asset) ? /* @__PURE__ */ React.createElement(
|
|
344
|
+
children: (label == null ? void 0 : label.asset) ? /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues$2({}, label == null ? void 0 : label.asset)) : null
|
|
346
345
|
};
|
|
347
346
|
};
|
|
348
347
|
|
|
@@ -367,7 +366,7 @@ const Action = (props) => {
|
|
|
367
366
|
const buttonProps = useAction(props);
|
|
368
367
|
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Button, __spreadValues$1({
|
|
369
368
|
variant: isBackAction(props) ? "ghost" : "solid"
|
|
370
|
-
}, buttonProps), isBackAction(props) && /* @__PURE__ */ React.createElement(ChevronLeftIcon, null), label && /* @__PURE__ */ React.createElement(Text$1, null, /* @__PURE__ */ React.createElement(
|
|
369
|
+
}, buttonProps), isBackAction(props) && /* @__PURE__ */ React.createElement(ChevronLeftIcon, null), label && /* @__PURE__ */ React.createElement(Text$1, null, /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues$1({}, label)))));
|
|
371
370
|
};
|
|
372
371
|
|
|
373
372
|
var __defProp = Object.defineProperty;
|
|
@@ -405,20 +404,20 @@ const Info = (props) => {
|
|
|
405
404
|
}, props.title && /* @__PURE__ */ React.createElement(Heading, {
|
|
406
405
|
size: "lg",
|
|
407
406
|
as: "h1"
|
|
408
|
-
}, /* @__PURE__ */ React.createElement(
|
|
407
|
+
}, /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues({}, props.title))), props.subTitle && /* @__PURE__ */ React.createElement(Heading, {
|
|
409
408
|
size: "md",
|
|
410
409
|
as: "h3"
|
|
411
|
-
}, /* @__PURE__ */ React.createElement(
|
|
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, {
|
|
412
411
|
gap: "4"
|
|
413
412
|
}, segmentedActions && /* @__PURE__ */ React.createElement(Divider, null), /* @__PURE__ */ React.createElement(HStack, {
|
|
414
413
|
justifyContent: "space-between"
|
|
415
414
|
}, /* @__PURE__ */ React.createElement(ButtonGroup, {
|
|
416
415
|
spacing: "6"
|
|
417
|
-
}, (_a = segmentedActions == null ? void 0 : segmentedActions.prev) == null ? void 0 : _a.map((a) => /* @__PURE__ */ React.createElement(
|
|
416
|
+
}, (_a = segmentedActions == null ? void 0 : segmentedActions.prev) == null ? void 0 : _a.map((a) => /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues({
|
|
418
417
|
key: a.asset.id
|
|
419
418
|
}, a)))), /* @__PURE__ */ React.createElement(ButtonGroup, {
|
|
420
419
|
spacing: "6"
|
|
421
|
-
}, (_b = segmentedActions == null ? void 0 : segmentedActions.next) == null ? void 0 : _b.map((a) => /* @__PURE__ */ React.createElement(
|
|
420
|
+
}, (_b = segmentedActions == null ? void 0 : segmentedActions.next) == null ? void 0 : _b.map((a) => /* @__PURE__ */ React.createElement(ReactAsset, __spreadValues({
|
|
422
421
|
key: a.asset.id
|
|
423
422
|
}, a))))))));
|
|
424
423
|
};
|
|
@@ -434,15 +433,15 @@ class ReferenceAssetsPlugin {
|
|
|
434
433
|
constructor() {
|
|
435
434
|
this.name = "reference-assets-web-plugin";
|
|
436
435
|
}
|
|
437
|
-
|
|
438
|
-
|
|
436
|
+
applyReact(reactPlayer) {
|
|
437
|
+
reactPlayer.registerPlugin(new AssetProviderPlugin([
|
|
439
438
|
["input", Input],
|
|
440
439
|
["text", Text],
|
|
441
440
|
["action", Action],
|
|
442
441
|
["info", Info],
|
|
443
442
|
["collection", Collection]
|
|
444
443
|
]));
|
|
445
|
-
|
|
444
|
+
reactPlayer.hooks.webComponent.tap(this.name, (Comp) => {
|
|
446
445
|
return () => {
|
|
447
446
|
return /* @__PURE__ */ React.createElement(OptionalChakraThemeProvider, null, /* @__PURE__ */ React.createElement(Comp, null));
|
|
448
447
|
};
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@player-ui/reference-assets-plugin-react",
|
|
3
|
-
"version": "0.3.0-next.
|
|
3
|
+
"version": "0.3.0-next.5",
|
|
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.3.0-next.
|
|
10
|
+
"@player-ui/react": "0.3.0-next.5"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@player-ui/reference-assets-plugin": "0.3.0-next.
|
|
14
|
-
"@player-ui/partial-match-registry": "0.3.0-next.
|
|
15
|
-
"@player-ui/asset-provider-plugin-react": "0.3.0-next.
|
|
16
|
-
"@player-ui/beacon-plugin-react": "0.3.0-next.
|
|
13
|
+
"@player-ui/reference-assets-plugin": "0.3.0-next.5",
|
|
14
|
+
"@player-ui/partial-match-registry": "0.3.0-next.5",
|
|
15
|
+
"@player-ui/asset-provider-plugin-react": "0.3.0-next.5",
|
|
16
|
+
"@player-ui/beacon-plugin-react": "0.3.0-next.5",
|
|
17
17
|
"clsx": "^1.1.1",
|
|
18
18
|
"@chakra-ui/react": "^1.7.3",
|
|
19
19
|
"@chakra-ui/icons": "^1.1.1",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ReactAsset } from '@player-ui/react';
|
|
3
3
|
import { Button, Text } from '@chakra-ui/react';
|
|
4
4
|
import { ChevronLeftIcon } from '@chakra-ui/icons';
|
|
5
5
|
import type { TransformedAction } from '@player-ui/reference-assets-plugin';
|
|
@@ -22,7 +22,7 @@ export const Action = (props: TransformedAction) => {
|
|
|
22
22
|
{isBackAction(props) && <ChevronLeftIcon />}
|
|
23
23
|
{label && (
|
|
24
24
|
<Text>
|
|
25
|
-
<
|
|
25
|
+
<ReactAsset {...label} />
|
|
26
26
|
</Text>
|
|
27
27
|
)}
|
|
28
28
|
</Button>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ReactAsset } from '@player-ui/react';
|
|
3
3
|
import { useBeacon } from '@player-ui/beacon-plugin-react';
|
|
4
4
|
import type { TransformedAction } from '@player-ui/reference-assets-plugin';
|
|
5
5
|
|
|
@@ -18,6 +18,6 @@ export const useAction = (props: TransformedAction) => {
|
|
|
18
18
|
beacon();
|
|
19
19
|
props.run();
|
|
20
20
|
},
|
|
21
|
-
children: label?.asset ? <
|
|
21
|
+
children: label?.asset ? <ReactAsset {...label?.asset} /> : null,
|
|
22
22
|
} as const;
|
|
23
23
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Flex } from '@chakra-ui/react';
|
|
3
|
-
import {
|
|
3
|
+
import { ReactAsset } from '@player-ui/react';
|
|
4
4
|
import type { CollectionAsset } from '@player-ui/reference-assets-plugin';
|
|
5
5
|
|
|
6
6
|
export const Collection = (props: CollectionAsset) => {
|
|
@@ -8,11 +8,11 @@ export const Collection = (props: CollectionAsset) => {
|
|
|
8
8
|
<Flex direction="column" gap="5">
|
|
9
9
|
{props.label && (
|
|
10
10
|
<h3>
|
|
11
|
-
<
|
|
11
|
+
<ReactAsset {...props.label} />
|
|
12
12
|
</h3>
|
|
13
13
|
)}
|
|
14
14
|
{props.values?.map((a) => (
|
|
15
|
-
<
|
|
15
|
+
<ReactAsset key={a.asset.id} {...a} />
|
|
16
16
|
))}
|
|
17
17
|
</Flex>
|
|
18
18
|
);
|
package/src/assets/info/Info.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import type {
|
|
|
4
4
|
InfoAsset,
|
|
5
5
|
} from '@player-ui/reference-assets-plugin';
|
|
6
6
|
import { isBackAction } from '@player-ui/reference-assets-plugin';
|
|
7
|
-
import {
|
|
7
|
+
import { ReactAsset } from '@player-ui/react';
|
|
8
8
|
import {
|
|
9
9
|
ButtonGroup,
|
|
10
10
|
Box,
|
|
@@ -41,26 +41,26 @@ export const Info = (props: InfoAsset) => {
|
|
|
41
41
|
<Stack gap="10">
|
|
42
42
|
{props.title && (
|
|
43
43
|
<Heading size="lg" as="h1">
|
|
44
|
-
<
|
|
44
|
+
<ReactAsset {...props.title} />
|
|
45
45
|
</Heading>
|
|
46
46
|
)}
|
|
47
47
|
{props.subTitle && (
|
|
48
48
|
<Heading size="md" as="h3">
|
|
49
|
-
<
|
|
49
|
+
<ReactAsset {...props.subTitle} />
|
|
50
50
|
</Heading>
|
|
51
51
|
)}
|
|
52
|
-
<Box>{props.primaryInfo && <
|
|
52
|
+
<Box>{props.primaryInfo && <ReactAsset {...props.primaryInfo} />}</Box>
|
|
53
53
|
<Stack gap="4">
|
|
54
54
|
{segmentedActions && <Divider />}
|
|
55
55
|
<HStack justifyContent="space-between">
|
|
56
56
|
<ButtonGroup spacing="6">
|
|
57
57
|
{segmentedActions?.prev?.map((a) => (
|
|
58
|
-
<
|
|
58
|
+
<ReactAsset key={a.asset.id} {...a} />
|
|
59
59
|
))}
|
|
60
60
|
</ButtonGroup>
|
|
61
61
|
<ButtonGroup spacing="6">
|
|
62
62
|
{segmentedActions?.next?.map((a) => (
|
|
63
|
-
<
|
|
63
|
+
<ReactAsset key={a.asset.id} {...a} />
|
|
64
64
|
))}
|
|
65
65
|
</ButtonGroup>
|
|
66
66
|
</HStack>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ReactAsset } from '@player-ui/react';
|
|
3
3
|
import type { TransformedInput } from '@player-ui/reference-assets-plugin';
|
|
4
4
|
import {
|
|
5
5
|
Input as ChakraInput,
|
|
@@ -19,14 +19,14 @@ export const Input = (props: TransformedInput) => {
|
|
|
19
19
|
<FormControl isInvalid={Boolean(validation)}>
|
|
20
20
|
{label && (
|
|
21
21
|
<FormLabel htmlFor={id}>
|
|
22
|
-
<
|
|
22
|
+
<ReactAsset {...label} />
|
|
23
23
|
</FormLabel>
|
|
24
24
|
)}
|
|
25
25
|
<ChakraInput id={id} size="md" {...inputProps} />
|
|
26
26
|
{validation && <FormErrorMessage>{validation.message}</FormErrorMessage>}
|
|
27
27
|
{note && (
|
|
28
28
|
<FormHelperText>
|
|
29
|
-
<
|
|
29
|
+
<ReactAsset {...note} />
|
|
30
30
|
</FormHelperText>
|
|
31
31
|
)}
|
|
32
32
|
</FormControl>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import makeClass from 'clsx';
|
|
3
|
-
import { useAssetProps } from '@player-ui/react
|
|
3
|
+
import { useAssetProps } from '@player-ui/react';
|
|
4
4
|
import type { TextAsset } from '@player-ui/reference-assets-plugin';
|
|
5
5
|
|
|
6
6
|
export interface TextModifierContextType {
|
package/src/intro.stories.mdx
CHANGED
|
@@ -19,22 +19,22 @@ Each of the Asset components follows the same basic pattern:
|
|
|
19
19
|
To import and use these Assets in your App, simply import the `plugin` and attach it to Player:
|
|
20
20
|
|
|
21
21
|
```tsx
|
|
22
|
-
import {
|
|
22
|
+
import { useReactPlayer, ReactPlayerPlugin } from '@player-ui/react';
|
|
23
23
|
import ReferenceAssetsPlugin from '@player-ui/reference-assets/plugin-react';
|
|
24
24
|
|
|
25
|
-
const plugins: Array<
|
|
25
|
+
const plugins: Array<ReactPlayerPlugin> = [new ReferenceAssetsPlugin()];
|
|
26
26
|
|
|
27
27
|
export const App = () => {
|
|
28
28
|
// Create Player with our plugins
|
|
29
|
-
const {
|
|
29
|
+
const { reactPlayer } = useReactPlayer({ plugins });
|
|
30
30
|
|
|
31
31
|
// Start the flow.
|
|
32
32
|
|
|
33
33
|
React.useEffect(() => {
|
|
34
|
-
|
|
34
|
+
reactPlayer.start(/** Insert your player content */);
|
|
35
35
|
}, []);
|
|
36
36
|
|
|
37
37
|
// Render Player
|
|
38
|
-
return <
|
|
38
|
+
return <ReactPlayer.Component />;
|
|
39
39
|
};
|
|
40
40
|
```
|
package/src/plugin.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ReactPlayer, ReactPlayerPlugin } from '@player-ui/react';
|
|
3
3
|
import type { Player } from '@player-ui/player';
|
|
4
4
|
import { AssetProviderPlugin } from '@player-ui/asset-provider-plugin-react';
|
|
5
5
|
import { ChakraProvider, useTheme } from '@chakra-ui/react';
|
|
@@ -22,11 +22,11 @@ const OptionalChakraThemeProvider = (
|
|
|
22
22
|
/**
|
|
23
23
|
* A plugin to register the base reference assets
|
|
24
24
|
*/
|
|
25
|
-
export class ReferenceAssetsPlugin implements
|
|
25
|
+
export class ReferenceAssetsPlugin implements ReactPlayerPlugin {
|
|
26
26
|
name = 'reference-assets-web-plugin';
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
applyReact(reactPlayer: ReactPlayer) {
|
|
29
|
+
reactPlayer.registerPlugin(
|
|
30
30
|
new AssetProviderPlugin([
|
|
31
31
|
['input', Input],
|
|
32
32
|
['text', Text],
|
|
@@ -36,7 +36,7 @@ export class ReferenceAssetsPlugin implements WebPlayerPlugin {
|
|
|
36
36
|
])
|
|
37
37
|
);
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
reactPlayer.hooks.webComponent.tap(this.name, (Comp) => {
|
|
40
40
|
return () => {
|
|
41
41
|
return (
|
|
42
42
|
<OptionalChakraThemeProvider>
|