@player-ui/reference-assets-plugin-react 0.8.0--canary.307.9621 → 0.8.0-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 (76) hide show
  1. package/dist/cjs/index.cjs +581 -0
  2. package/dist/cjs/index.cjs.map +1 -0
  3. package/dist/index.css +703 -0
  4. package/dist/index.legacy-esm.js +529 -0
  5. package/dist/index.mjs +529 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/package.json +34 -63
  8. package/src/__tests__/integration.test.tsx +158 -0
  9. package/src/assets/action/Action.tsx +10 -14
  10. package/src/assets/action/hooks.tsx +6 -6
  11. package/src/assets/action/index.ts +2 -2
  12. package/src/assets/choice/Choice.tsx +52 -0
  13. package/src/assets/choice/hooks.tsx +34 -0
  14. package/src/assets/choice/index.ts +2 -0
  15. package/src/assets/collection/Collection.tsx +6 -9
  16. package/src/assets/collection/index.tsx +1 -1
  17. package/src/assets/image/Image.tsx +4 -4
  18. package/src/assets/image/index.tsx +1 -1
  19. package/src/assets/index.tsx +7 -6
  20. package/src/assets/info/Info.tsx +26 -29
  21. package/src/assets/info/index.tsx +1 -1
  22. package/src/assets/input/Input.tsx +27 -19
  23. package/src/assets/input/hooks.tsx +35 -35
  24. package/src/assets/input/index.tsx +2 -2
  25. package/src/assets/input/types.ts +2 -2
  26. package/src/assets/text/Text.tsx +13 -7
  27. package/src/assets/text/hooks.tsx +6 -6
  28. package/src/assets/text/index.tsx +2 -2
  29. package/src/components/Button.tsx +56 -0
  30. package/src/components/ChoiceItem.tsx +31 -0
  31. package/src/components/Input.tsx +26 -0
  32. package/src/components/Label.tsx +26 -0
  33. package/src/components/Separator.tsx +30 -0
  34. package/src/global.css +83 -0
  35. package/src/index.tsx +4 -2
  36. package/src/intro.stories.mdx +9 -9
  37. package/src/plugin.tsx +22 -43
  38. package/src/utils.ts +6 -0
  39. package/types/assets/action/Action.d.ts +7 -0
  40. package/types/assets/action/hooks.d.ts +9 -0
  41. package/types/assets/action/index.d.ts +3 -0
  42. package/types/assets/choice/Choice.d.ts +6 -0
  43. package/types/assets/choice/hooks.d.ts +5 -0
  44. package/types/assets/choice/index.d.ts +3 -0
  45. package/types/assets/collection/Collection.d.ts +4 -0
  46. package/types/assets/collection/index.d.ts +2 -0
  47. package/types/assets/image/Image.d.ts +4 -0
  48. package/types/assets/image/index.d.ts +2 -0
  49. package/types/assets/index.d.ts +8 -0
  50. package/types/assets/info/Info.d.ts +5 -0
  51. package/types/assets/info/index.d.ts +2 -0
  52. package/types/assets/input/Input.d.ts +6 -0
  53. package/types/assets/input/hooks.d.ts +40 -0
  54. package/types/assets/input/index.d.ts +3 -0
  55. package/types/assets/input/types.d.ts +3 -0
  56. package/types/assets/text/Text.d.ts +7 -0
  57. package/types/assets/text/hooks.d.ts +9 -0
  58. package/types/assets/text/index.d.ts +3 -0
  59. package/types/components/Button.d.ts +12 -0
  60. package/types/components/ChoiceItem.d.ts +7 -0
  61. package/types/components/Input.d.ts +6 -0
  62. package/types/components/Label.d.ts +6 -0
  63. package/types/components/Separator.d.ts +5 -0
  64. package/types/index.d.ts +4 -0
  65. package/types/plugin.d.ts +19 -0
  66. package/types/utils.d.ts +3 -0
  67. package/dist/index.cjs.js +0 -501
  68. package/dist/index.d.ts +0 -94
  69. package/dist/index.esm.js +0 -479
  70. package/dist/xlr/ActionAsset.json +0 -126
  71. package/dist/xlr/CollectionAsset.json +0 -40
  72. package/dist/xlr/InfoAsset.json +0 -58
  73. package/dist/xlr/InputAsset.json +0 -109
  74. package/dist/xlr/TextAsset.json +0 -125
  75. package/dist/xlr/manifest.js +0 -16
  76. package/dist/xlr/manifest.json +0 -22
@@ -0,0 +1,3 @@
1
+ export * from "./Action";
2
+ export * from "./hooks";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ import type { TransformedChoice } from "@player-ui/reference-assets-plugin";
3
+ /** A Choice */
4
+ export declare const Choice: (props: TransformedChoice) => React.JSX.Element;
5
+ export default Choice;
6
+ //# sourceMappingURL=Choice.d.ts.map
@@ -0,0 +1,5 @@
1
+ import type { TransformedChoice } from "@player-ui/reference-assets-plugin";
2
+ import type { ChoiceItemProps } from "../../components/ChoiceItem";
3
+ /** Hook to get the props for all choice asset items */
4
+ export declare const useChoiceItems: (props: TransformedChoice) => Array<ChoiceItemProps>;
5
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from "./Choice";
2
+ export * from "./hooks";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import type { CollectionAsset } from "@player-ui/reference-assets-plugin";
3
+ export declare const Collection: (props: CollectionAsset) => React.JSX.Element;
4
+ //# sourceMappingURL=Collection.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from "./Collection";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import type { TransformedImage } from "@player-ui/reference-assets-plugin";
3
+ export declare const Image: (props: TransformedImage) => React.JSX.Element;
4
+ //# sourceMappingURL=Image.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from "./Image";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,8 @@
1
+ export * from "./input";
2
+ export * from "./text";
3
+ export * from "./collection";
4
+ export * from "./action";
5
+ export * from "./info";
6
+ export * from "./image";
7
+ export * from "./choice";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import type { InfoAssetTransform } from "@player-ui/reference-assets-plugin";
3
+ /** The info view type is used to show information to the user */
4
+ export declare const Info: (props: InfoAssetTransform) => React.JSX.Element;
5
+ //# sourceMappingURL=Info.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from "./Info";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ import type { TransformedInput } from "@player-ui/reference-assets-plugin";
3
+ /** An Input */
4
+ export declare const Input: (props: TransformedInput) => React.JSX.Element;
5
+ export default Input;
6
+ //# sourceMappingURL=Input.d.ts.map
@@ -0,0 +1,40 @@
1
+ import React from "react";
2
+ import type { TransformedInput } from "@player-ui/reference-assets-plugin";
3
+ export interface InputHookConfig {
4
+ /** Format the input as the user keys down */
5
+ liveFormat?: boolean;
6
+ /** Skip sending beacon events for this input */
7
+ suppressBeacons?: boolean;
8
+ /** Time (ms) to wait before formatting the user input for normal keys */
9
+ quickFormatDelay?: number;
10
+ /** Time (ms) to wait before formatting the input after the user types a special _slow_ format key */
11
+ slowFormatDelay?: number;
12
+ /** Keys to use a slower formatter for. Usually reserved for backspace, arrows, tabs, etc */
13
+ slowFormatKeys?: Array<number | string>;
14
+ /** Symbol to be used for decimal point */
15
+ decimalSymbol?: string;
16
+ /** Affix to append to value - does not save to model and is only for display on input */
17
+ prefix?: string;
18
+ /** Affix to prepend to value - does not save to model and is only for display on input */
19
+ suffix?: string;
20
+ }
21
+ /** Create a valid config mixing in defaults and user overrides */
22
+ export declare const getConfig: (userConfig?: InputHookConfig) => Required<InputHookConfig>;
23
+ /** A hook to manage beacon changes for input assets */
24
+ export declare const useInputBeacon: (props: TransformedInput) => (newValue: string) => void;
25
+ /**
26
+ * A hook to manage an input html element as an asset.
27
+ * The hook returns an object containing props that are expected to reside on any html input.
28
+ * It will handle formatting, setting values, beaconing, aria-labels, etc.
29
+ *
30
+ * @param props - The output of the input transform
31
+ * @param config - Local config to manage user interaction overrides
32
+ */
33
+ export declare const useInputAsset: (props: TransformedInput, config?: InputHookConfig) => {
34
+ onBlur: React.FocusEventHandler<HTMLInputElement>;
35
+ onChange: React.ChangeEventHandler<HTMLInputElement>;
36
+ onKeyDown: React.KeyboardEventHandler<HTMLInputElement>;
37
+ onFocus: React.FocusEventHandler<HTMLInputElement>;
38
+ value: string;
39
+ };
40
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from "./Input";
2
+ export * from "./hooks";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
1
+ import type { TransformedInput } from "@player-ui/reference-assets-plugin";
2
+ export type KeyDownHandler = (currentValue: string, props?: TransformedInput) => any;
3
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import type { TextAsset, LinkModifier } from "@player-ui/reference-assets-plugin";
3
+ /** Find any link modifiers on the text */
4
+ export declare const getLinkModifier: (asset: TextAsset) => LinkModifier | undefined;
5
+ /** A text asset */
6
+ export declare const Text: (props: TextAsset) => React.JSX.Element;
7
+ //# sourceMappingURL=Text.d.ts.map
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import type { TextAsset } from "@player-ui/reference-assets-plugin";
3
+ export interface TextModifierContextType {
4
+ getClassForModifier?<T>(modifier: T): string | undefined;
5
+ }
6
+ export declare const TextModifierContext: React.Context<TextModifierContextType | undefined>;
7
+ /** Get the props for a basic text element */
8
+ export declare const useText: (props: TextAsset) => JSX.IntrinsicElements["span"];
9
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from "./Text";
2
+ export * from "./hooks";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,12 @@
1
+ import * as React from "react";
2
+ import { type VariantProps } from "class-variance-authority";
3
+ declare const buttonVariants: (props?: ({
4
+ variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
5
+ size?: "default" | "sm" | "lg" | "icon" | null | undefined;
6
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
7
+ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
8
+ asChild?: boolean;
9
+ }
10
+ declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
11
+ export { Button, buttonVariants };
12
+ //# sourceMappingURL=Button.d.ts.map
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import type { ChoiceItem as ChoiceItemType } from "@player-ui/reference-assets-plugin";
3
+ export type ChoiceItemProps = React.InputHTMLAttributes<HTMLInputElement> & Pick<ChoiceItemType, "label">;
4
+ /** A choice item */
5
+ export declare const ChoiceItem: (props: ChoiceItemProps) => React.JSX.Element;
6
+ export default ChoiceItem;
7
+ //# sourceMappingURL=ChoiceItem.d.ts.map
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
3
+ }
4
+ declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
5
+ export { Input };
6
+ //# sourceMappingURL=Input.d.ts.map
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ import * as LabelPrimitive from "@radix-ui/react-label";
3
+ import { type VariantProps } from "class-variance-authority";
4
+ declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps<(props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string> & React.RefAttributes<HTMLLabelElement>>;
5
+ export { Label };
6
+ //# sourceMappingURL=Label.d.ts.map
@@ -0,0 +1,5 @@
1
+ import * as React from "react";
2
+ import * as SeparatorPrimitive from "@radix-ui/react-separator";
3
+ declare const Separator: React.ForwardRefExoticComponent<SeparatorPrimitive.SeparatorProps & React.RefAttributes<HTMLDivElement>>;
4
+ export { Separator };
5
+ //# sourceMappingURL=Separator.d.ts.map
@@ -0,0 +1,4 @@
1
+ import "./global.css";
2
+ export * from "./plugin";
3
+ export * from "./assets";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,19 @@
1
+ import type { ReactPlayer, ReactPlayerPlugin, Player, ExtendedPlayerPlugin } from "@player-ui/react";
2
+ import type { InputAsset, TextAsset, CollectionAsset, ActionAsset, InfoAsset, ChoiceAsset } from "@player-ui/reference-assets-plugin";
3
+ /**
4
+ * A plugin to register the base reference assets
5
+ */
6
+ export declare class ReferenceAssetsPlugin implements ReactPlayerPlugin, ExtendedPlayerPlugin<[
7
+ InputAsset,
8
+ TextAsset,
9
+ ActionAsset,
10
+ CollectionAsset,
11
+ ChoiceAsset
12
+ ], [
13
+ InfoAsset
14
+ ]> {
15
+ name: string;
16
+ applyReact(reactPlayer: ReactPlayer): void;
17
+ apply(player: Player): void;
18
+ }
19
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1,3 @@
1
+ import { type ClassValue } from "clsx";
2
+ export declare function cn(...inputs: ClassValue[]): string;
3
+ //# sourceMappingURL=utils.d.ts.map