@devtools-ui/input 0.4.1--canary.62.3837 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,102 @@
1
+ # @devtools-ui/input
2
+
3
+ ## Overview
4
+
5
+ `@devtools-ui/input` 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 an `Input` component that can be used to acquire data from the user.
8
+
9
+ ## Installation
10
+
11
+ To install `@devtools-ui/input`, you can use pnpm or yarn:
12
+
13
+ ```sh
14
+ pnpm i @devtools-ui/input
15
+ ```
16
+
17
+ or
18
+
19
+ ```sh
20
+ yarn add @devtools-ui/input
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ You can leverage this asset through the `@devtools-ui/plugin`:
26
+
27
+ ```ts
28
+ import { Input } from "@devtools-ui/plugin";
29
+
30
+ // and use it to define your Player-UI content:
31
+ myFlow = {
32
+ id: "my_flow",
33
+ views: [
34
+ <MyView>
35
+ <Input
36
+ size={"md"}
37
+ placeholder={"User input"}
38
+ maxLength={10}
39
+ binding={b`binding`}
40
+ >
41
+ <Input.Label>Label</Input.Label>
42
+ <Input.Note>Some note</Input.Note>
43
+ </Input>
44
+ </MyView>,
45
+ ],
46
+ };
47
+ ```
48
+
49
+ 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).
50
+
51
+ Or, your can leverage this asset in your own plugin:
52
+
53
+ ```ts
54
+ // TransformPlugin.ts
55
+ import type { Player, PlayerPlugin } from "@player-ui/player";
56
+ import { AssetTransformPlugin } from "@player-ui/asset-transform-plugin";
57
+ import { inputTransform } from "@devtools-ui/input";
58
+
59
+ export class TransformsPlugin implements PlayerPlugin {
60
+ name = "my-plugin-transforms";
61
+
62
+ apply(player: Player) {
63
+ player.registerPlugin(
64
+ new AssetTransformPlugin([[{ type: "input" }, inputTransform]])
65
+ );
66
+ }
67
+ }
68
+ ```
69
+
70
+ ```ts
71
+ // AssetRegistryPlugin.ts
72
+ import React from "react";
73
+ import type { Player } from "@player-ui/player";
74
+ import type {
75
+ ExtendedPlayerPlugin,
76
+ ReactPlayer,
77
+ ReactPlayerPlugin,
78
+ } from "@player-ui/react";
79
+ import { AssetProviderPlugin } from "@player-ui/asset-provider-plugin-react";
80
+ import { TransformsPlugin } from "./TransformPlugin";
81
+ import { InputAsset, InputComponent } from "@devtools-ui/input";
82
+
83
+ export class AssetsRegistryPlugin
84
+ implements ReactPlayerPlugin, ExtendedPlayerPlugin<[InputAsset]>
85
+ {
86
+ name = "my-plugin";
87
+
88
+ applyReact(reactPlayer: ReactPlayer) {
89
+ reactPlayer.registerPlugin(
90
+ new AssetProviderPlugin([["input", InputComponent]])
91
+ );
92
+ }
93
+
94
+ apply(player: Player) {
95
+ player.registerPlugin(new TransformsPlugin());
96
+ }
97
+ }
98
+ ```
99
+
100
+ ## Contributing
101
+
102
+ We welcome contributions to `@devtools-ui/input`!
package/package.json CHANGED
@@ -1,9 +1,15 @@
1
1
  {
2
+ "sideEffects": false,
3
+ "files": [
4
+ "dist",
5
+ "src",
6
+ "types"
7
+ ],
2
8
  "name": "@devtools-ui/input",
3
- "version": "0.4.1--canary.62.3837",
9
+ "version": "0.4.1",
4
10
  "main": "dist/cjs/index.cjs",
5
11
  "dependencies": {
6
- "@devtools-ui/text": "0.4.1--canary.62.3837",
12
+ "@devtools-ui/text": "0.4.1",
7
13
  "@chakra-ui/react": "^2.8.2",
8
14
  "@emotion/react": "^11.11.4",
9
15
  "@emotion/styled": "^11.11.0",
@@ -15,7 +21,6 @@
15
21
  },
16
22
  "module": "dist/index.legacy-esm.js",
17
23
  "types": "types/index.d.ts",
18
- "sideEffects": false,
19
24
  "exports": {
20
25
  "./package.json": "./package.json",
21
26
  "./dist/index.css": "./dist/index.css",
@@ -25,11 +30,6 @@
25
30
  "default": "./dist/cjs/index.cjs"
26
31
  }
27
32
  },
28
- "files": [
29
- "dist",
30
- "src",
31
- "types"
32
- ],
33
33
  "peerDependencies": {
34
34
  "@player-lang/react-dsl": "1.0.1",
35
35
  "@player-ui/types": "0.15.5",
@@ -1,8 +1,8 @@
1
1
  import type { TextAsset } from "@devtools-ui/text";
2
2
  import { Asset, Schema, AssetWrapper } from "@player-ui/types";
3
3
  import { ValidationResponse } from "@player-ui/player";
4
- export type InputSize = "xs" | "sm" | "md" | "lg";
5
- type ValueType = string | undefined;
4
+ export declare type InputSize = "xs" | "sm" | "md" | "lg";
5
+ declare type ValueType = string | undefined;
6
6
  export interface InputAsset extends Asset<"input"> {
7
7
  /** The location in the data-model to store the data */
8
8
  binding: ValueType;