@roku-sdk/components 0.0.0-stage → 2.19.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/BREAKING_CHANGES.md +84 -0
- package/LICENSE +21 -0
- package/README.md +19 -2
- package/core-jsx.d.ts +53 -0
- package/eslint.config.mjs +3 -0
- package/jsx.d.ts +273 -0
- package/package.json +85 -3
- package/src/__tests__/container.test.tsx +150 -0
- package/src/__tests__/effect-gradient-validation.test.tsx +133 -0
- package/src/__tests__/glyphs.test.ts +202 -0
- package/src/__tests__/modal-boundary-export.test.ts +12 -0
- package/src/__tests__/native-modal.test.tsx +224 -0
- package/src/__tests__/tween-release.test.tsx +125 -0
- package/src/__tests__/tween-stops-shape.test.tsx +165 -0
- package/src/__tests__/tween-without-compat.test.tsx +64 -0
- package/src/__tests__/tween.test.tsx +195 -0
- package/src/blended-busy-spinner.props.ts +37 -0
- package/src/blended-busy-spinner.tsx +13 -0
- package/src/bounding-tracker.props.ts +18 -0
- package/src/bounding-tracker.tsx +13 -0
- package/src/button-row.tsx +126 -0
- package/src/channel-store.props.ts +425 -0
- package/src/channel-store.tsx +76 -0
- package/src/container.tsx +130 -0
- package/src/core/jsx-runtime.ts +39 -0
- package/src/focusable-group.props.ts +8 -0
- package/src/focusable-group.tsx +17 -0
- package/src/focusable.props.ts +14 -0
- package/src/focusable.tsx +17 -0
- package/src/glyphs.ts +116 -0
- package/src/helpers/index.tsx +4 -0
- package/src/helpers/resolution-context.tsx +68 -0
- package/src/helpers/scale-for-device-resolution.ts +31 -0
- package/src/index.tsx +70 -0
- package/src/jsx-props.ts +87 -0
- package/src/kdfs.d.ts +14 -0
- package/src/kdfs.ts +15 -0
- package/src/key-handler.props.ts +33 -0
- package/src/key-handler.tsx +24 -0
- package/src/modal-dialog.props.ts +38 -0
- package/src/modal-dialog.tsx +41 -0
- package/src/retain-asset.ts +24 -0
- package/src/sg-intrinsics.json +1153 -0
- package/src/sg-nodes/__tests__/__snapshots__/font.test.tsx.snap +13 -0
- package/src/sg-nodes/__tests__/__snapshots__/prop-forwarding.test.tsx.snap +4409 -0
- package/src/sg-nodes/__tests__/core-props.test.ts +301 -0
- package/src/sg-nodes/__tests__/font.test.tsx +141 -0
- package/src/sg-nodes/__tests__/imperative-methods.test.ts +276 -0
- package/src/sg-nodes/__tests__/prop-forwarding.test.tsx +1049 -0
- package/src/sg-nodes/__tests__/solid-integration.test.tsx +719 -0
- package/src/sg-nodes/animated-image.props.ts +64 -0
- package/src/sg-nodes/animated-image.tsx +23 -0
- package/src/sg-nodes/animation.props.ts +292 -0
- package/src/sg-nodes/animation.tsx +190 -0
- package/src/sg-nodes/array-grid.ts +602 -0
- package/src/sg-nodes/audio.props.ts +302 -0
- package/src/sg-nodes/audio.tsx +57 -0
- package/src/sg-nodes/busy-spinner.props.ts +59 -0
- package/src/sg-nodes/busy-spinner.tsx +84 -0
- package/src/sg-nodes/button-group.props.ts +141 -0
- package/src/sg-nodes/button-group.tsx +30 -0
- package/src/sg-nodes/button.props.ts +119 -0
- package/src/sg-nodes/button.tsx +31 -0
- package/src/sg-nodes/check-list.props.ts +71 -0
- package/src/sg-nodes/check-list.tsx +55 -0
- package/src/sg-nodes/content-node.props.ts +1316 -0
- package/src/sg-nodes/content-node.tsx +153 -0
- package/src/sg-nodes/core-props.ts +197 -0
- package/src/sg-nodes/custom-keyboard.props.ts +108 -0
- package/src/sg-nodes/custom-keyboard.tsx +48 -0
- package/src/sg-nodes/dialog.props.ts +159 -0
- package/src/sg-nodes/dialog.tsx +36 -0
- package/src/sg-nodes/dynamic-key-grid.props.ts +22 -0
- package/src/sg-nodes/dynamic-key-grid.tsx +16 -0
- package/src/sg-nodes/dynamic-keyboard.props.ts +30 -0
- package/src/sg-nodes/dynamic-keyboard.tsx +18 -0
- package/src/sg-nodes/dynamic-mini-keyboard.props.ts +22 -0
- package/src/sg-nodes/dynamic-mini-keyboard.tsx +18 -0
- package/src/sg-nodes/dynamic-pinpad.props.ts +57 -0
- package/src/sg-nodes/dynamic-pinpad.tsx +18 -0
- package/src/sg-nodes/effect.props.ts +119 -0
- package/src/sg-nodes/effect.tsx +167 -0
- package/src/sg-nodes/font.props.ts +45 -0
- package/src/sg-nodes/font.tsx +80 -0
- package/src/sg-nodes/group.props.ts +105 -0
- package/src/sg-nodes/group.tsx +30 -0
- package/src/sg-nodes/label-list.props.ts +86 -0
- package/src/sg-nodes/label-list.tsx +64 -0
- package/src/sg-nodes/label.props.ts +207 -0
- package/src/sg-nodes/label.tsx +56 -0
- package/src/sg-nodes/layout-group.props.ts +69 -0
- package/src/sg-nodes/layout-group.tsx +75 -0
- package/src/sg-nodes/list-panel.props.ts +103 -0
- package/src/sg-nodes/list-panel.tsx +49 -0
- package/src/sg-nodes/markup-grid.props.ts +78 -0
- package/src/sg-nodes/markup-grid.tsx +38 -0
- package/src/sg-nodes/markup-list.props.ts +66 -0
- package/src/sg-nodes/markup-list.tsx +38 -0
- package/src/sg-nodes/mask-group.props.ts +78 -0
- package/src/sg-nodes/mask-group.tsx +59 -0
- package/src/sg-nodes/media-playback-methods.ts +20 -0
- package/src/sg-nodes/node.ts +77 -0
- package/src/sg-nodes/overhang.props.ts +169 -0
- package/src/sg-nodes/overhang.tsx +29 -0
- package/src/sg-nodes/panel-set.props.ts +71 -0
- package/src/sg-nodes/panel-set.tsx +53 -0
- package/src/sg-nodes/panel.props.ts +176 -0
- package/src/sg-nodes/panel.tsx +56 -0
- package/src/sg-nodes/poster-grid.props.ts +277 -0
- package/src/sg-nodes/poster-grid.tsx +45 -0
- package/src/sg-nodes/poster.props.ts +125 -0
- package/src/sg-nodes/poster.tsx +44 -0
- package/src/sg-nodes/radio-button-list.props.ts +59 -0
- package/src/sg-nodes/radio-button-list.tsx +68 -0
- package/src/sg-nodes/rectangle.props.ts +29 -0
- package/src/sg-nodes/rectangle.tsx +27 -0
- package/src/sg-nodes/row-list.props.ts +288 -0
- package/src/sg-nodes/row-list.tsx +47 -0
- package/src/sg-nodes/scene.props.ts +65 -0
- package/src/sg-nodes/scene.tsx +15 -0
- package/src/sg-nodes/scrollable-text.props.ts +133 -0
- package/src/sg-nodes/scrollable-text.tsx +64 -0
- package/src/sg-nodes/scrolling-label.props.ts +106 -0
- package/src/sg-nodes/scrolling-label.tsx +42 -0
- package/src/sg-nodes/simple-label.props.ts +156 -0
- package/src/sg-nodes/simple-label.tsx +59 -0
- package/src/sg-nodes/sound-effect.props.ts +130 -0
- package/src/sg-nodes/sound-effect.tsx +65 -0
- package/src/sg-nodes/standard-dialog.props.ts +520 -0
- package/src/sg-nodes/standard-dialog.tsx +428 -0
- package/src/sg-nodes/standard-keyboard-dialog.props.ts +84 -0
- package/src/sg-nodes/standard-keyboard-dialog.tsx +58 -0
- package/src/sg-nodes/standard-message-dialog.props.ts +56 -0
- package/src/sg-nodes/standard-message-dialog.tsx +47 -0
- package/src/sg-nodes/standard-pinpad-dialog.props.ts +64 -0
- package/src/sg-nodes/standard-pinpad-dialog.tsx +44 -0
- package/src/sg-nodes/standard-progress-dialog.props.ts +30 -0
- package/src/sg-nodes/standard-progress-dialog.tsx +40 -0
- package/src/sg-nodes/target-group.props.ts +278 -0
- package/src/sg-nodes/target-group.tsx +63 -0
- package/src/sg-nodes/target-list.props.ts +128 -0
- package/src/sg-nodes/target-list.tsx +66 -0
- package/src/sg-nodes/target-set.props.ts +63 -0
- package/src/sg-nodes/target-set.tsx +42 -0
- package/src/sg-nodes/time-grid.props.ts +646 -0
- package/src/sg-nodes/time-grid.tsx +87 -0
- package/src/sg-nodes/tween.props.ts +115 -0
- package/src/sg-nodes/types.ts +150 -0
- package/src/sg-nodes/video.props.ts +642 -0
- package/src/sg-nodes/video.tsx +75 -0
- package/src/sg-nodes/voice-text-edit-box.props.ts +91 -0
- package/src/sg-nodes/voice-text-edit-box.tsx +15 -0
- package/src/sg-nodes/zoom-row-list.props.ts +416 -0
- package/src/sg-nodes/zoom-row-list.tsx +42 -0
- package/src/standard-dialog-next/__tests__/standard-dialog-next.test.tsx +186 -0
- package/src/standard-dialog-next/index.ts +5 -0
- package/src/standard-dialog-next/standard-dialog-next.props.ts +80 -0
- package/src/standard-dialog-next/standard-dialog-next.tsx +326 -0
- package/src/test-helpers/tween-test-setup.ts +78 -0
- package/src/tween.tsx +173 -0
- package/src/types.ts +8 -0
- package/src/xml-components/blended-busy-spinner/BlendedBusySpinner.brs +13 -0
- package/src/xml-components/blended-busy-spinner/BlendedBusySpinner.xml +10 -0
- package/src/xml-components/blended-busy-spinner/BlendedBusySpinner.xml.d.ts +42 -0
- package/src/xml-components/bounding-tracker/BoundingTracker.brs +26 -0
- package/src/xml-components/bounding-tracker/BoundingTracker.xml +14 -0
- package/src/xml-components/bounding-tracker/BoundingTracker.xml.d.ts +42 -0
- package/src/xml-components/channel-store/channelStoreExt.brs +159 -0
- package/src/xml-components/channel-store/channelStoreExt.xml +29 -0
- package/src/xml-components/channel-store/channelStoreExt.xml.d.ts +57 -0
- package/src/xml-components/focus/focusable-group.brs +251 -0
- package/src/xml-components/focus/focusable-group.xml +15 -0
- package/src/xml-components/focus/focusable-group.xml.d.ts +42 -0
- package/src/xml-components/focus/focusable.xml +18 -0
- package/src/xml-components/focus/focusable.xml.d.ts +48 -0
- package/src/xml-components/keyboards/CustomAddressKDF.keyboard.json +547 -0
- package/src/xml-components/keyboards/CustomKeyboard.brs +322 -0
- package/src/xml-components/keyboards/CustomKeyboard.xml +45 -0
- package/src/xml-components/keyboards/CustomKeyboard.xml.d.ts +73 -0
- package/src/xml-components/keyboards/KeyGridExt.xml +4 -0
- package/src/xml-components/keyboards/KeyGridExt.xml.d.ts +37 -0
- package/src/xml-components/keyboards/KeyboardExt.xml +4 -0
- package/src/xml-components/keyboards/KeyboardExt.xml.d.ts +37 -0
- package/src/xml-components/keyboards/MOPPinPadCustomKDF.keyboard.json +151 -0
- package/src/xml-components/keyboards/MiniKeyboardExt.xml +4 -0
- package/src/xml-components/keyboards/MiniKeyboardExt.xml.d.ts +37 -0
- package/src/xml-components/keyboards/PhonePadCustomKDF.keyboard.json +42 -0
- package/src/xml-components/keyboards/PinPadExt.brs +102 -0
- package/src/xml-components/keyboards/PinPadExt.xml +17 -0
- package/src/xml-components/keyboards/PinPadExt.xml.d.ts +49 -0
- package/src/xml-components/keyboards/WifiCustomKDF.keyboard.json +1242 -0
- package/src/xml-components/keyhandler/KeyHandler.brs +30 -0
- package/src/xml-components/keyhandler/KeyHandler.xml +16 -0
- package/src/xml-components/keyhandler/KeyHandler.xml.d.ts +45 -0
- package/src/xml-components/managed-list-panel/ManagedListPanel.brs +137 -0
- package/src/xml-components/managed-list-panel/ManagedListPanel.xml +10 -0
- package/src/xml-components/managed-list-panel/ManagedListPanel.xml.d.ts +37 -0
- package/src/xml-components/modal/Modal.brs +105 -0
- package/src/xml-components/modal/Modal.xml +22 -0
- package/src/xml-components/modal/Modal.xml.d.ts +54 -0
- package/src/xml-components/modal/StandardDialogExt.xml +10 -0
- package/src/xml-components/modal/StandardDialogExt.xml.d.ts +37 -0
- package/src/xml-components/modal/StandardKeyboardDialogExt.xml +10 -0
- package/src/xml-components/modal/StandardKeyboardDialogExt.xml.d.ts +37 -0
- package/src/xml-components/modal/StandardMessageDialogExt.xml +10 -0
- package/src/xml-components/modal/StandardMessageDialogExt.xml.d.ts +37 -0
- package/src/xml-components/modal/StandardPinPadDialogExt.xml +10 -0
- package/src/xml-components/modal/StandardPinPadDialogExt.xml.d.ts +37 -0
- package/src/xml-components/modal/StandardProgressDialogExt.xml +10 -0
- package/src/xml-components/modal/StandardProgressDialogExt.xml.d.ts +37 -0
- package/src/xml-components/modal/tests/Modal.test.brs +195 -0
- package/tsconfig.json +10 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
// Copyright (c) 2026 Roku, Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import type { IArrayGridProps } from "./array-grid";
|
|
5
|
+
import type { PosterDisplayMode } from "./poster.props";
|
|
6
|
+
import type { FontValue, HorizAlign, JSX, Uri, Vector2D, VertAlign } from "./types";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Vertical alignment options for PosterGrid captions.
|
|
10
|
+
*
|
|
11
|
+
* Extends the standard vertical alignment with additional positioning options
|
|
12
|
+
* specific to captions relative to the poster.
|
|
13
|
+
*
|
|
14
|
+
* @see {@link https://developer.roku.com/dev/docs/postergrid}
|
|
15
|
+
*/
|
|
16
|
+
export type CaptionVertAlignment = VertAlign | "above" | "below";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Properties for the PosterGrid node.
|
|
20
|
+
*
|
|
21
|
+
* PosterGrid is a simple grid class that can be used to display two-dimensional grids of posters.
|
|
22
|
+
* In addition to the poster, each item in the grid can include up to two lines of captions.
|
|
23
|
+
*
|
|
24
|
+
* The number of columns in the PosterGrid is fixed and the number of rows varies. The items in the
|
|
25
|
+
* grid fill each row from left to right, then top to bottom.
|
|
26
|
+
*
|
|
27
|
+
* The layout of rows and columns in the grid is very flexible. Possible layouts include:
|
|
28
|
+
* - A simple layout with all posters in the grid having the same size
|
|
29
|
+
* - A layout with posters in some rows having varying heights and/or columns having varying widths
|
|
30
|
+
* - A layout with varying width rows and columns and items that occupy one or more rows and columns
|
|
31
|
+
*
|
|
32
|
+
* The grid items can be organized into sections that are demarcated by labelled horizontal
|
|
33
|
+
* divider lines between the sections.
|
|
34
|
+
*
|
|
35
|
+
* @see {@link https://developer.roku.com/dev/docs/postergrid}
|
|
36
|
+
*
|
|
37
|
+
* @example Simple PosterGrid setup
|
|
38
|
+
* ```tsx
|
|
39
|
+
* <PosterGrid
|
|
40
|
+
* basePosterSize={[240, 240]}
|
|
41
|
+
* itemSpacing={[32, 32]}
|
|
42
|
+
* caption1NumLines={1}
|
|
43
|
+
* caption2NumLines={1}
|
|
44
|
+
* numColumns={4}
|
|
45
|
+
* numRows={3}
|
|
46
|
+
* content={gridContent}
|
|
47
|
+
* onItemSelected={(index) => handleSelection(index)}
|
|
48
|
+
* />
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export interface IPosterGridProps extends IArrayGridProps {
|
|
52
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
53
|
+
// Content Data
|
|
54
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Specifies the content for the grid.
|
|
58
|
+
*
|
|
59
|
+
* Should be a ContentNode with child nodes for each item in the grid.
|
|
60
|
+
* If the data contains section markers, section dividers will be drawn between each section.
|
|
61
|
+
* These section dividers may contain an icon and/or a string.
|
|
62
|
+
*
|
|
63
|
+
* @see {@link https://developer.roku.com/dev/docs/postergrid#data-bindings | Data Bindings}
|
|
64
|
+
*/
|
|
65
|
+
content: JSX.Element;
|
|
66
|
+
|
|
67
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
68
|
+
// Poster Configuration
|
|
69
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Specifies the width and height of the posters in the grid.
|
|
73
|
+
*
|
|
74
|
+
* For simple layouts, set this to the dimensions of each poster image.
|
|
75
|
+
* Can be overridden per-row with `rowHeights` or per-column with `columnWidths`.
|
|
76
|
+
*
|
|
77
|
+
* @default [0, 0]
|
|
78
|
+
* @example [240, 240]
|
|
79
|
+
*/
|
|
80
|
+
basePosterSize?: Vector2D;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Enables a performance optimization when most poster items have the same size.
|
|
84
|
+
*
|
|
85
|
+
* When true, uses a texture atlas that stores the posters in the grid, providing
|
|
86
|
+
* rendering performance benefits for grids where most posters match `basePosterSize`.
|
|
87
|
+
*
|
|
88
|
+
* Set to false for grids with:
|
|
89
|
+
* - Complicated layouts with several posters differing from `basePosterSize`
|
|
90
|
+
* - Only a few large posters (5-8, or about quarter screen height/width)
|
|
91
|
+
*
|
|
92
|
+
* @default true
|
|
93
|
+
*/
|
|
94
|
+
useAtlas?: boolean;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Provides automatic scaling of posters when `useAtlas` is set to false.
|
|
98
|
+
*
|
|
99
|
+
* If loading very large images (larger than UI resolution), you must set a scaling
|
|
100
|
+
* option other than `noScale`, otherwise the image may fail to load.
|
|
101
|
+
*
|
|
102
|
+
* - `noScale`: No scaling applied
|
|
103
|
+
* - `scaleToFit`: Scale to fit, preserving aspect ratio (letterboxing/pillarboxing)
|
|
104
|
+
* - `scaleToFill`: Stretch to fill, distorting if aspect ratios differ
|
|
105
|
+
* - `scaleToZoom`: Scale to fill, preserving aspect ratio but cropping
|
|
106
|
+
*
|
|
107
|
+
* @default "noScale"
|
|
108
|
+
*/
|
|
109
|
+
posterDisplayMode?: PosterDisplayMode;
|
|
110
|
+
|
|
111
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
112
|
+
// Loading State Bitmaps
|
|
113
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Specifies the bitmap file to use to suggest where images would appear
|
|
117
|
+
* for empty grids and empty sections of grids.
|
|
118
|
+
*
|
|
119
|
+
* Only set this field to specify a custom bitmap that differs from the default.
|
|
120
|
+
*/
|
|
121
|
+
imageWellBitmapUri?: Uri;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Specifies a bitmap file to display while a grid item's poster is loading.
|
|
125
|
+
*
|
|
126
|
+
* To execute a seamless cross-fade transition between posters, set this
|
|
127
|
+
* to the URI of the currently displayed poster.
|
|
128
|
+
*/
|
|
129
|
+
loadingBitmapUri?: Uri;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Specifies an opacity value used to render the loading bitmap.
|
|
133
|
+
*
|
|
134
|
+
* @default 1.0
|
|
135
|
+
*/
|
|
136
|
+
loadingBitmapOpacity?: number;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Specifies a bitmap file to display when a grid item poster fails to load.
|
|
140
|
+
*/
|
|
141
|
+
failedBitmapUri?: Uri;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Specifies an opacity value used to render the failed bitmap.
|
|
145
|
+
*
|
|
146
|
+
* @default 1.0
|
|
147
|
+
*/
|
|
148
|
+
failedBitmapOpacity?: number;
|
|
149
|
+
|
|
150
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
151
|
+
// Caption Configuration
|
|
152
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Specifies the font for the grid item first caption.
|
|
156
|
+
* Can be a SystemFont enum, registry font string, or Font component.
|
|
157
|
+
*
|
|
158
|
+
* @default system default
|
|
159
|
+
* @example
|
|
160
|
+
* ```tsx
|
|
161
|
+
* // Using SystemFont enum (recommended)
|
|
162
|
+
* caption1Font={SystemFont.Medium}
|
|
163
|
+
*
|
|
164
|
+
* // Using registry font string
|
|
165
|
+
* caption1Font="font:MediumSystemFont"
|
|
166
|
+
*
|
|
167
|
+
* // Using Font component for custom size
|
|
168
|
+
* caption1Font={<Font uri="pkg:/fonts/caption.ttf" size={20} />}
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
caption1Font?: FontValue;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Specifies the color for the grid item first caption.
|
|
175
|
+
*
|
|
176
|
+
* @default "0xddddddff"
|
|
177
|
+
*/
|
|
178
|
+
caption1Color?: string;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Specifies the number of lines to render for the grid item first caption.
|
|
182
|
+
*
|
|
183
|
+
* Set to 0 to hide the first caption.
|
|
184
|
+
*
|
|
185
|
+
* @default 0
|
|
186
|
+
*/
|
|
187
|
+
caption1NumLines?: number;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Specifies the font for the grid item second caption.
|
|
191
|
+
* Can be a SystemFont enum, registry font string, or Font component.
|
|
192
|
+
*
|
|
193
|
+
* @default system default
|
|
194
|
+
* @example
|
|
195
|
+
* ```tsx
|
|
196
|
+
* // Using SystemFont enum (recommended)
|
|
197
|
+
* caption2Font={SystemFont.Small}
|
|
198
|
+
*
|
|
199
|
+
* // Using registry font string
|
|
200
|
+
* caption2Font="font:SmallSystemFont"
|
|
201
|
+
*
|
|
202
|
+
* // Using Font component for custom size
|
|
203
|
+
* caption2Font={<Font uri="pkg:/fonts/caption.ttf" size={18} />}
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
caption2Font?: FontValue;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Specifies the color for the grid item second caption.
|
|
210
|
+
*
|
|
211
|
+
* @default "0xddddddff"
|
|
212
|
+
*/
|
|
213
|
+
caption2Color?: string;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Specifies the number of lines to render for the grid item second caption.
|
|
217
|
+
*
|
|
218
|
+
* Set to 0 to hide the second caption.
|
|
219
|
+
*
|
|
220
|
+
* @default 0
|
|
221
|
+
*/
|
|
222
|
+
caption2NumLines?: number;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Specifies a bitmap file to render as a background for the grid item captions.
|
|
226
|
+
*/
|
|
227
|
+
captionBackgroundBitmapUri?: Uri;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Specifies the horizontal positioning of the grid item captions.
|
|
231
|
+
*
|
|
232
|
+
* - `left`: Left-justify the caption relative to the grid item poster
|
|
233
|
+
* - `center`: Center-justify the caption relative to the grid item poster
|
|
234
|
+
* - `right`: Right-justify the caption relative to the grid item poster
|
|
235
|
+
*
|
|
236
|
+
* Set `enableCaptionScrolling` to false to use `captionHorizAlignment`.
|
|
237
|
+
*
|
|
238
|
+
* @default "center"
|
|
239
|
+
*/
|
|
240
|
+
captionHorizAlignment?: HorizAlign;
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Specifies the vertical positioning of the grid item captions.
|
|
244
|
+
*
|
|
245
|
+
* - `above`: Position caption so bottom lies just above the poster
|
|
246
|
+
* - `top`: Align top of caption with top edge of poster
|
|
247
|
+
* - `center`: Align vertical center of caption with center of poster
|
|
248
|
+
* - `bottom`: Align bottom of caption with bottom edge of poster
|
|
249
|
+
* - `below`: Position caption so top lies just below the poster
|
|
250
|
+
*
|
|
251
|
+
* @default "below"
|
|
252
|
+
*/
|
|
253
|
+
captionVertAlignment?: CaptionVertAlignment;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Specifies the spacing in pixels between lines of the caption.
|
|
257
|
+
*
|
|
258
|
+
* @default 0
|
|
259
|
+
*/
|
|
260
|
+
captionLineSpacing?: number;
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* If a caption background is specified, this field specifies whether or not
|
|
264
|
+
* to display the caption background when the caption text is empty.
|
|
265
|
+
*
|
|
266
|
+
* @default true
|
|
267
|
+
*/
|
|
268
|
+
showBackgroundForEmptyCaptions?: boolean;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Specifies whether or not to scroll single line captions when it is necessary
|
|
272
|
+
* to ellipsize the caption because it is wider than the column containing the grid item.
|
|
273
|
+
*
|
|
274
|
+
* @default true
|
|
275
|
+
*/
|
|
276
|
+
enableCaptionScrolling?: boolean;
|
|
277
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Copyright (c) 2026 Roku, Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import type { IPosterGridProps } from "./poster-grid.props";
|
|
5
|
+
import { Component } from "./types";
|
|
6
|
+
export type { CaptionVertAlignment, IPosterGridProps } from "./poster-grid.props";
|
|
7
|
+
|
|
8
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
9
|
+
// Caption Vertical Alignment Type
|
|
10
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
11
|
+
|
|
12
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
13
|
+
// PosterGrid Properties
|
|
14
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
15
|
+
|
|
16
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
17
|
+
// PosterGrid Component
|
|
18
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* PosterGrid is a simple grid class that can be used to display two-dimensional grids of posters.
|
|
22
|
+
* In addition to the poster, each item in the grid can include up to two lines of captions.
|
|
23
|
+
*
|
|
24
|
+
* The number of columns in the PosterGrid is fixed and the number of rows varies. The items in the
|
|
25
|
+
* grid fill each row from left to right, then top to bottom.
|
|
26
|
+
*
|
|
27
|
+
* @see {@link https://developer.roku.com/dev/docs/postergrid}
|
|
28
|
+
*
|
|
29
|
+
* @example Simple PosterGrid setup
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <posterGrid
|
|
32
|
+
* basePosterSize={[240, 240]}
|
|
33
|
+
* itemSpacing={[32, 32]}
|
|
34
|
+
* caption1NumLines={1}
|
|
35
|
+
* caption2NumLines={1}
|
|
36
|
+
* numColumns={4}
|
|
37
|
+
* numRows={3}
|
|
38
|
+
* content={gridContent}
|
|
39
|
+
* onItemSelected={(index) => handleSelection(index)}
|
|
40
|
+
* />
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export const PosterGrid: Component<IPosterGridProps> = props => {
|
|
44
|
+
return <posterGrid {...props}></posterGrid>;
|
|
45
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// Copyright (c) 2026 Roku, Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import type { IGroupProps } from "./group.props";
|
|
5
|
+
import type { EventHandler, JSX, ResType, Uri } from "./types";
|
|
6
|
+
|
|
7
|
+
export type PosterDisplayMode = "noScale" | "scaleToFit" | "scaleToFill" | "scaleToZoom";
|
|
8
|
+
|
|
9
|
+
export type LoadDisplayMode = PosterDisplayMode | "limitSize";
|
|
10
|
+
|
|
11
|
+
export type PosterLoadStatus = "none" | "loading" | "ready" | "failed";
|
|
12
|
+
|
|
13
|
+
export interface BitmapMargins {
|
|
14
|
+
left: number;
|
|
15
|
+
top: number;
|
|
16
|
+
right: number;
|
|
17
|
+
bottom: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Properties for the Poster node.
|
|
22
|
+
*
|
|
23
|
+
* Poster is a renderable node that displays bitmap images. It is one of the most widely used nodes
|
|
24
|
+
* in SceneGraph applications for displaying images, thumbnails, and graphics with support for scaling,
|
|
25
|
+
* loading states, and fallback images.
|
|
26
|
+
*
|
|
27
|
+
* Images can be imported directly in TypeScript, which provides automatic resolution handling and
|
|
28
|
+
* dimension information. See the Static Image Management documentation for details.
|
|
29
|
+
*
|
|
30
|
+
* @see {@link https://developer.roku.com/dev/docs/poster}
|
|
31
|
+
* @see **Static Image Management** at documentation/guides/images/static-image-management.md for image import details
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* // Import image with resolution substitutes
|
|
35
|
+
* import { uri as logo } from "./images/logo-*.png";
|
|
36
|
+
* <Poster width={200} height={100} uri={logo} />
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* // Use static URI path
|
|
40
|
+
* <Poster width={1920} height={1080} uri="pkg:/images/background.jpg" />
|
|
41
|
+
*/
|
|
42
|
+
export interface IPosterProps extends IGroupProps {
|
|
43
|
+
/**
|
|
44
|
+
* Specifies the width of the poster bitmap in local coordinates.
|
|
45
|
+
* If set to 0.0, the width of the bitmap from the image file is used.
|
|
46
|
+
* If set to a value greater than 0.0, the bitmap is scaled to that width.
|
|
47
|
+
*/
|
|
48
|
+
width?: ResType<number>;
|
|
49
|
+
/**
|
|
50
|
+
* Specifies the height of the poster bitmap in local coordinates.
|
|
51
|
+
* If set to 0.0, the height of the bitmap from the image file is used.
|
|
52
|
+
* If set to a value greater than 0.0, the bitmap is scaled to that height.
|
|
53
|
+
*/
|
|
54
|
+
height?: ResType<number>;
|
|
55
|
+
/**
|
|
56
|
+
* Controls whether the image is loaded synchronously or asynchronously.
|
|
57
|
+
* If true and the uri specifies a local file (pkg:/images), the image loads synchronously and appears immediately.
|
|
58
|
+
* If false, or if the uri specifies a remote URL (http/https), the image loads asynchronously in a background thread.
|
|
59
|
+
* Be careful when setting to true as it might cause brief glitches in rendering.
|
|
60
|
+
*/
|
|
61
|
+
loadSync?: boolean;
|
|
62
|
+
/** Specifies the width of the bitmap to be loaded. Used for scaling during load. */
|
|
63
|
+
loadWidth?: ResType<number>;
|
|
64
|
+
/** Specifies the height of the bitmap to be loaded. Used for scaling during load. */
|
|
65
|
+
loadHeight?: ResType<number>;
|
|
66
|
+
/**
|
|
67
|
+
* Specifies how the bitmap should be scaled to fit the poster dimensions.
|
|
68
|
+
* - "noScale": Bitmap loaded at original resolution. If Poster's width/height differ, it will be scaled to fill (aspect ratio not preserved)
|
|
69
|
+
* - "scaleToFit": Scale to fit within dimensions, preserving aspect ratio with letterboxing/pillarboxing
|
|
70
|
+
* - "scaleToFill": Stretch to fill dimensions, distorting if aspect ratios differ
|
|
71
|
+
* - "scaleToZoom": Scale to fill dimensions, preserving aspect ratio but cropping parts of the image
|
|
72
|
+
* - "limitSize": Scale while loading so max width/height doesn't exceed loadWidth/loadHeight, preserving aspect ratio
|
|
73
|
+
*/
|
|
74
|
+
loadDisplayMode?: LoadDisplayMode;
|
|
75
|
+
/** Color value to blend with the bitmap. */
|
|
76
|
+
blendColor?: string;
|
|
77
|
+
/** URI of the bitmap to display while the main image is loading. */
|
|
78
|
+
loadingBitmapUri?: Uri;
|
|
79
|
+
/** Opacity of the loading bitmap (0.0 to 1.0). */
|
|
80
|
+
loadingBitmapOpacity?: number;
|
|
81
|
+
/** URI of the bitmap to display if the main image fails to load. */
|
|
82
|
+
failedBitmapUri?: Uri;
|
|
83
|
+
/** Opacity of the failed bitmap (0.0 to 1.0). */
|
|
84
|
+
failedBitmapOpacity?: number;
|
|
85
|
+
/** Text to be spoken by the audio guide for accessibility. */
|
|
86
|
+
audioGuideText?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Event handler called when the load status changes.
|
|
89
|
+
* - "none": No load operation in progress
|
|
90
|
+
* - "loading": Image is currently loading
|
|
91
|
+
* - "ready": Image loaded successfully
|
|
92
|
+
* - "failed": Image failed to load
|
|
93
|
+
*/
|
|
94
|
+
onLoadStatus?: EventHandler<PosterLoadStatus>;
|
|
95
|
+
/** Event handler called when the bitmap width is determined. Provides the actual width of the loaded bitmap. */
|
|
96
|
+
onBitmapWidth?: EventHandler<number>;
|
|
97
|
+
/** Event handler called when the bitmap height is determined. Provides the actual height of the loaded bitmap. */
|
|
98
|
+
onBitmapHeight?: EventHandler<number>;
|
|
99
|
+
/** Event handler called when bitmap margins are determined. Provides margin information for 9-patch images. */
|
|
100
|
+
onBitmapMargins?: EventHandler<BitmapMargins>;
|
|
101
|
+
/**
|
|
102
|
+
* Specifies the URI of the bitmap image file to be displayed.
|
|
103
|
+
* Can use static paths (e.g., "pkg:/images/icon.png") or imported URIs from TypeScript.
|
|
104
|
+
* Images included as part of the application package can be referenced using the pkg:/images prefix.
|
|
105
|
+
*
|
|
106
|
+
* **Important**: Set `uri` as the last property in your JSX to avoid timing issues. If the image is
|
|
107
|
+
* already cached or loads quickly from local storage, it may render before other properties
|
|
108
|
+
* (such as `loadDisplayMode` or event handlers) are applied. Placing `uri` last ensures all
|
|
109
|
+
* configuration properties are set before the image loading process begins.
|
|
110
|
+
*/
|
|
111
|
+
uri?: Uri;
|
|
112
|
+
/**
|
|
113
|
+
* An Effect node to apply shader-based rendering (rounded corners, borders, gradients).
|
|
114
|
+
* On platforms that do not support effects, this is silently ignored.
|
|
115
|
+
*/
|
|
116
|
+
effect?: JSX.Element;
|
|
117
|
+
/**
|
|
118
|
+
* If true, requests that the bitmap is loaded in a format that can be used with shaders, which
|
|
119
|
+
* includes any poster that will have an Effect node attached.
|
|
120
|
+
* Note that setting this to false does not guarantee that the resulting poster cannot be used
|
|
121
|
+
* with Effects.
|
|
122
|
+
* @default false
|
|
123
|
+
*/
|
|
124
|
+
shaderCompatible?: boolean;
|
|
125
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Copyright (c) 2026 Roku, Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import type { IPosterProps } from "./poster.props";
|
|
5
|
+
import { Component } from "./types";
|
|
6
|
+
export type { PosterDisplayMode, LoadDisplayMode, PosterLoadStatus, BitmapMargins, IPosterProps } from "./poster.props";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Poster is a renderable node that displays bitmap images. It is one of the most widely used nodes
|
|
10
|
+
* in SceneGraph applications for displaying images, thumbnails, and graphics with support for scaling,
|
|
11
|
+
* loading states, and fallback images.
|
|
12
|
+
*
|
|
13
|
+
* Images can be imported directly in TypeScript, which provides automatic resolution handling and
|
|
14
|
+
* dimension information. See the Static Image Management documentation for details.
|
|
15
|
+
*
|
|
16
|
+
* **Attribute ordering pitfall:** When using `<poster>` as a JSX intrinsic,
|
|
17
|
+
* write event handlers (`onLoadStatus`, etc.) before `uri` and other props that trigger
|
|
18
|
+
* synchronous events on assignment. If `uri` is set first and the image is already cached,
|
|
19
|
+
* the load event fires before your handler is registered and is silently dropped.
|
|
20
|
+
* Writing handlers first is good practice regardless.
|
|
21
|
+
*
|
|
22
|
+
* ```tsx
|
|
23
|
+
* // Wrong: onLoadStatus may be missed if image is cached
|
|
24
|
+
* <poster uri={src} onLoadStatus={handleLoad} />
|
|
25
|
+
*
|
|
26
|
+
* // Correct: handler registered before the prop that fires it
|
|
27
|
+
* <poster onLoadStatus={handleLoad} uri={src} />
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @see {@link https://developer.roku.com/dev/docs/poster}
|
|
31
|
+
* @see **Static Image Management** at documentation/guides/images/static-image-management.md for image import details
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* // Import image with resolution substitutes - note uri is last
|
|
35
|
+
* import { uri as logo } from "./images/logo-*.png";
|
|
36
|
+
* <poster width={200} height={100} uri={logo} />
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* // Use static URI path - note uri is last
|
|
40
|
+
* <poster width={1920} height={1080} uri="pkg:/images/background.jpg" />
|
|
41
|
+
*/
|
|
42
|
+
export const Poster: Component<IPosterProps> = props => {
|
|
43
|
+
return <poster {...props}></poster>;
|
|
44
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Copyright (c) 2026 Roku, Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import type { ILabelListProps } from "./label-list.props";
|
|
5
|
+
import type { JSX, Uri } from "./types";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Properties for the RadioButtonList component.
|
|
9
|
+
*
|
|
10
|
+
* Extends {@link ILabelListProps} with single-selection radio button state
|
|
11
|
+
* management and custom radio icon options.
|
|
12
|
+
*
|
|
13
|
+
* @see {@link https://developer.roku.com/dev/docs/radiobuttonlist}
|
|
14
|
+
*/
|
|
15
|
+
export interface IRadioButtonListProps extends ILabelListProps {
|
|
16
|
+
/**
|
|
17
|
+
* The data model for the list. Should be a ContentNode with child
|
|
18
|
+
* ContentNodes, one for each item in the list.
|
|
19
|
+
*/
|
|
20
|
+
content: JSX.Element;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Specifies the index of the currently selected (checked) radio button item.
|
|
24
|
+
* Only one item can be selected at a time.
|
|
25
|
+
*
|
|
26
|
+
* Set to `-1` to indicate no item is selected.
|
|
27
|
+
*
|
|
28
|
+
* @default -1
|
|
29
|
+
*/
|
|
30
|
+
checkedItem?: number;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Controls whether pressing OK automatically sets `checkedItem` to the
|
|
34
|
+
* focused item index.
|
|
35
|
+
*
|
|
36
|
+
* When `false`, developer must manage selection manually via `checkedItem`.
|
|
37
|
+
*
|
|
38
|
+
* @default true
|
|
39
|
+
*/
|
|
40
|
+
checkOnSelect?: boolean;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* URI for the radio button icon when item is selected and not focused.
|
|
44
|
+
* Typically shows a filled circle indicator.
|
|
45
|
+
* Only set to specify a custom bitmap different from default.
|
|
46
|
+
*
|
|
47
|
+
* @example "pkg:/images/radio-checked.png"
|
|
48
|
+
*/
|
|
49
|
+
checkedIconUri?: Uri;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* URI for the radio button icon when item is selected and has focus.
|
|
53
|
+
* Typically shows a filled circle indicator with focus highlight.
|
|
54
|
+
* Only set to specify a custom bitmap different from default.
|
|
55
|
+
*
|
|
56
|
+
* @example "pkg:/images/radio-checked-focused.png"
|
|
57
|
+
*/
|
|
58
|
+
focusedCheckedIconUri?: Uri;
|
|
59
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Copyright (c) 2026 Roku, Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import type { IRadioButtonListProps } from "./radio-button-list.props";
|
|
5
|
+
import { Component } from "./types";
|
|
6
|
+
export type { IRadioButtonListProps } from "./radio-button-list.props";
|
|
7
|
+
|
|
8
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
9
|
+
// RadioButtonList Properties
|
|
10
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* RadioButtonList displays a list of items with radio buttons for single selection.
|
|
14
|
+
*
|
|
15
|
+
* Each item shows a text string and a radio button icon positioned to the left.
|
|
16
|
+
* Unlike CheckList which allows multiple selections, RadioButtonList enforces
|
|
17
|
+
* single selection - selecting one item automatically deselects the previous.
|
|
18
|
+
*
|
|
19
|
+
* ## Data Binding
|
|
20
|
+
*
|
|
21
|
+
* The `content` field should be set to a ContentNode with one child ContentNode
|
|
22
|
+
* for each item. Each child ContentNode should have a `TITLE` attribute (string)
|
|
23
|
+
* that specifies the label text for that item.
|
|
24
|
+
*
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <contentNode>
|
|
27
|
+
* <contentNode title="Option A" />
|
|
28
|
+
* <contentNode title="Option B" />
|
|
29
|
+
* <contentNode title="Option C" />
|
|
30
|
+
* </contentNode>
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @example Basic usage
|
|
34
|
+
* ```tsx
|
|
35
|
+
* <radioButtonList
|
|
36
|
+
* itemSize={[440, 48]}
|
|
37
|
+
* checkedItem={0}
|
|
38
|
+
* checkOnSelect={true}
|
|
39
|
+
* content={
|
|
40
|
+
* <contentNode>
|
|
41
|
+
* <contentNode title="Low Quality" />
|
|
42
|
+
* <contentNode title="Medium Quality" />
|
|
43
|
+
* <contentNode title="High Quality" />
|
|
44
|
+
* </contentNode>
|
|
45
|
+
* }
|
|
46
|
+
* />
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @example With custom icons
|
|
50
|
+
* ```tsx
|
|
51
|
+
* <radioButtonList
|
|
52
|
+
* itemSize={[440, 48]}
|
|
53
|
+
* checkedIconUri="pkg:/images/radio-on.png"
|
|
54
|
+
* focusedCheckedIconUri="pkg:/images/radio-on-focused.png"
|
|
55
|
+
* content={
|
|
56
|
+
* <contentNode>
|
|
57
|
+
* <contentNode title="English" />
|
|
58
|
+
* <contentNode title="Spanish" />
|
|
59
|
+
* </contentNode>
|
|
60
|
+
* }
|
|
61
|
+
* />
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @see {@link https://developer.roku.com/dev/docs/radiobuttonlist}
|
|
65
|
+
*/
|
|
66
|
+
export const RadioButtonList: Component<IRadioButtonListProps> = props => {
|
|
67
|
+
return <radioButtonList {...props}></radioButtonList>;
|
|
68
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright (c) 2026 Roku, Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import type { IGroupProps } from "./group.props";
|
|
5
|
+
import type { JSX, ResType } from "./types";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Properties for the Rectangle node.
|
|
9
|
+
*
|
|
10
|
+
* Rectangle is a renderable node that draws a solid colored rectangle. It is one of the three
|
|
11
|
+
* basic renderable nodes in SceneGraph and is commonly used for backgrounds, borders, and simple UI elements.
|
|
12
|
+
*
|
|
13
|
+
* @see {@link https://developer.roku.com/dev/docs/rectangle}
|
|
14
|
+
*/
|
|
15
|
+
export interface IRectangleProps extends IGroupProps {
|
|
16
|
+
/** Specifies the width of the rectangle in local coordinates. @default 0.0 */
|
|
17
|
+
width?: ResType<number>;
|
|
18
|
+
/** Specifies the height of rectangle in local coordinates. @default 0.0 */
|
|
19
|
+
height?: ResType<number>;
|
|
20
|
+
/** Specifies the color of the rectangle (string containing hex value e.g. RGBA). @default "0xFFFFFFFF" */
|
|
21
|
+
color?: string;
|
|
22
|
+
/** Specifies if the rectangle should be alpha blended with the nodes that are behind it. @default true */
|
|
23
|
+
blendingEnabled?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* An Effect node to apply shader-based rendering (rounded corners, borders, gradients).
|
|
26
|
+
* On platforms that do not support effects, this is silently ignored.
|
|
27
|
+
*/
|
|
28
|
+
effect?: JSX.Element;
|
|
29
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Copyright (c) 2026 Roku, Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import type { IRectangleProps } from "./rectangle.props";
|
|
5
|
+
import { Component } from "./types";
|
|
6
|
+
export type { IRectangleProps } from "./rectangle.props";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Rectangle component for rendering solid colored rectangles.
|
|
10
|
+
*
|
|
11
|
+
* Rectangle is a renderable node that draws a solid colored rectangle. It is one of the three
|
|
12
|
+
* basic renderable nodes in SceneGraph and is commonly used for backgrounds, borders, and simple UI elements.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <rectangle
|
|
17
|
+
* width={400}
|
|
18
|
+
* height={200}
|
|
19
|
+
* color="#FF0000FF"
|
|
20
|
+
* />
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @see {@link https://developer.roku.com/dev/docs/rectangle}
|
|
24
|
+
*/
|
|
25
|
+
export const Rectangle: Component<IRectangleProps> = props => {
|
|
26
|
+
return <rectangle {...props}></rectangle>;
|
|
27
|
+
};
|