@devtools-ui/radio-group 0.4.1--canary.62.3837 → 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.
Files changed (2) hide show
  1. package/README.md +109 -0
  2. package/package.json +9 -9
package/README.md ADDED
@@ -0,0 +1,109 @@
1
+ # @devtools-ui/radio-group
2
+
3
+ ## Overview
4
+
5
+ `@devtools-ui/radio-group` is a component package designed to be leveraged by a [Player-UI assets plugin](https://player-ui.github.io/next/plugins).
6
+
7
+ It provides a `RadioGroup` component that can present a way to input one of multiple choices.
8
+
9
+ This package is part of a mono-repo built with Bazel, ensuring fast and reliable builds.
10
+
11
+ ## Installation
12
+
13
+ To install `@devtools-ui/radio-group`, you can use pnpm or yarn:
14
+
15
+ ```sh
16
+ pnpm i @devtools-ui/radio-group
17
+ ```
18
+
19
+ or
20
+
21
+ ```sh
22
+ yarn add @devtools-ui/radio-group
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ You can leverage this asset through the `@devtools-ui/plugin`:
28
+
29
+ ```ts
30
+ import { RadioGroup } from "@devtools-ui/plugin";
31
+
32
+ // and use it to define your Player-UI content:
33
+ myFlow = {
34
+ id: 'my_flow',
35
+ views: [
36
+ <>
37
+ <RadioGroup binding={b`my_binding`}>
38
+ <RadioGroup.Label>RadioGroup Label</RadioGroup.Label>
39
+ <RadioGroup.Values>
40
+ <RadioGroup.Values.Value value="opt1">
41
+ <RadioGroup.Values.Value.Label>
42
+ Option 1
43
+ </RadioGroup.Values.Value.Label>
44
+ </RadioGroup.Values.Value>
45
+ <RadioGroup.Values.Value value="opt2">
46
+ <RadioGroup.Values.Value.Label>
47
+ Option 2
48
+ </RadioGroup.Values.Value.Label>
49
+ </RadioGroup.Values.Value>
50
+ </RadioGroup.Values>
51
+ </RadioGroup>
52
+ </>
53
+ ]
54
+ }
55
+ ```
56
+
57
+ For more information on how to author Player-UI content using DSL, please check our [Player-UI docs](https://player-ui.github.io/next/dsl#tsxjsx-content-authoring-player-dsl).
58
+
59
+ Or, your can leverage this asset in your own plugin:
60
+
61
+ ```ts
62
+ // TransformPlugin.ts
63
+ import type { Player, PlayerPlugin } from "@player-ui/player";
64
+ import { AssetTransformPlugin } from "@player-ui/asset-transform-plugin";
65
+ import { radioGroupTransform } from "@devtools-ui/radio-group";
66
+
67
+ export class TransformsPlugin implements PlayerPlugin {
68
+ name = "my-plugin-transforms";
69
+
70
+ apply(player: Player) {
71
+ player.registerPlugin(
72
+ new AssetTransformPlugin([
73
+ [{ type: "radio-group" }, radioGroupTransform],
74
+ ])
75
+ );
76
+ }
77
+ }
78
+ ```
79
+
80
+ ```ts
81
+ // AssetRegistryPlugin.ts
82
+ import React from "react";
83
+ import type { Player } from "@player-ui/player";
84
+ import type {
85
+ ExtendedPlayerPlugin,
86
+ ReactPlayer,
87
+ ReactPlayerPlugin,
88
+ } from "@player-ui/react";
89
+ import { AssetProviderPlugin } from "@player-ui/asset-provider-plugin-react";
90
+ import { TransformsPlugin } from "./TransformPlugin";
91
+ import { RadioGroupAsset, RadioGroupComponent } from "@devtools-ui/radio-group";
92
+
93
+ export class AssetsRegistryPlugin implements ReactPlayerPlugin, ExtendedPlayerPlugin<[RadioGroupAsset]> {
94
+ name = "my-plugin";
95
+
96
+ applyReact(reactPlayer: ReactPlayer) {
97
+ reactPlayer.registerPlugin(
98
+ new AssetProviderPlugin([
99
+ ["radio-group", RadioGroupComponent],
100
+ ])
101
+ );
102
+ }
103
+
104
+ apply(player: Player) {
105
+ player.registerPlugin(new TransformsPlugin());
106
+ }
107
+ }
108
+ ```
109
+
package/package.json CHANGED
@@ -1,10 +1,16 @@
1
1
  {
2
+ "sideEffects": false,
3
+ "files": [
4
+ "dist",
5
+ "src",
6
+ "types"
7
+ ],
2
8
  "name": "@devtools-ui/radio-group",
3
- "version": "0.4.1--canary.62.3837",
9
+ "version": "0.4.1-next.0",
4
10
  "main": "dist/cjs/index.cjs",
5
11
  "dependencies": {
6
- "@devtools-ui/text": "0.4.1--canary.62.3837",
7
- "@devtools-ui/collection": "0.4.1--canary.62.3837",
12
+ "@devtools-ui/text": "0.4.1-next.0",
13
+ "@devtools-ui/collection": "0.4.1-next.0",
8
14
  "@chakra-ui/react": "^2.8.2",
9
15
  "@emotion/react": "^11.11.4",
10
16
  "@emotion/styled": "^11.11.0",
@@ -16,7 +22,6 @@
16
22
  },
17
23
  "module": "dist/index.legacy-esm.js",
18
24
  "types": "types/index.d.ts",
19
- "sideEffects": false,
20
25
  "exports": {
21
26
  "./package.json": "./package.json",
22
27
  "./dist/index.css": "./dist/index.css",
@@ -26,11 +31,6 @@
26
31
  "default": "./dist/cjs/index.cjs"
27
32
  }
28
33
  },
29
- "files": [
30
- "dist",
31
- "src",
32
- "types"
33
- ],
34
34
  "peerDependencies": {
35
35
  "@player-lang/react-dsl": "1.0.1",
36
36
  "@player-ui/asset-transform-plugin": "0.15.5",