@nysds/components 1.16.0-alpha3 → 1.16.0-alpha5
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/custom-elements.json +721 -43
- package/dist/.vscode/vscode.html-custom-data.json +56 -0
- package/dist/custom-elements.json +721 -43
- package/dist/nysds.es.js +1805 -1582
- package/dist/nysds.es.js.map +1 -1
- package/dist/nysds.js +204 -132
- package/dist/nysds.js.map +1 -1
- package/dist/packages/mcp-server/src/lib/cem-parser.d.ts +6 -0
- package/dist/packages/mcp-server/src/lib/format.d.ts +21 -0
- package/dist/packages/mcp-server/src/tools/component-tools.d.ts +3 -5
- package/dist/packages/mcp-server/src/tools/guide-tools.d.ts +8 -0
- package/dist/packages/mcp-server/src/tools/token-tools.d.ts +2 -5
- package/dist/packages/mcp-server/src/tools/utility-tools.d.ts +7 -0
- package/dist/packages/mcp-server/src/tools/validation-tools.d.ts +1 -2
- package/dist/packages/nys-button/src/nys-button.d.ts +8 -5
- package/dist/packages/nys-checkbox/src/nys-checkboxgroup.d.ts +1 -0
- package/dist/packages/nys-radiobutton/src/nys-radiobutton.d.ts +1 -0
- package/dist/packages/nys-radiobutton/src/nys-radiogroup.d.ts +2 -0
- package/dist/packages/nys-stepper/src/nys-step.d.ts +35 -0
- package/dist/packages/nys-stepper/src/nys-stepper.d.ts +38 -0
- package/dist/packages/nys-video/src/index.d.ts +1 -0
- package/dist/packages/nys-video/src/nys-video.d.ts +71 -0
- package/dist/packages/nys-video/src/nys-video.figma.d.ts +1 -0
- package/dist/src/index.d.ts +1 -0
- package/package.json +7 -5
- package/packages/react/NysVideo.d.ts +77 -0
- package/packages/react/NysVideo.js +40 -0
- package/packages/react/index.d.ts +1 -0
- package/packages/react/index.js +1 -0
- package/dist/packages/react/nysds-jsx.d.ts +0 -1411
- package/packages/react/nysds-jsx.d.ts +0 -1428
|
@@ -43,6 +43,11 @@ export interface CEMCssPart {
|
|
|
43
43
|
name: string;
|
|
44
44
|
description?: string;
|
|
45
45
|
}
|
|
46
|
+
export interface CEMExample {
|
|
47
|
+
title: string;
|
|
48
|
+
code: string;
|
|
49
|
+
lang?: string;
|
|
50
|
+
}
|
|
46
51
|
export interface CEMDeclaration {
|
|
47
52
|
kind: "class";
|
|
48
53
|
name: string;
|
|
@@ -59,6 +64,7 @@ export interface CEMDeclaration {
|
|
|
59
64
|
name: string;
|
|
60
65
|
package?: string;
|
|
61
66
|
};
|
|
67
|
+
examples?: CEMExample[];
|
|
62
68
|
}
|
|
63
69
|
export interface CEMModule {
|
|
64
70
|
kind: "javascript-module";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format Utilities
|
|
3
|
+
*
|
|
4
|
+
* Helpers for formatting MCP tool responses.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* JSON replacer that strips null and undefined values from objects.
|
|
8
|
+
* Use with JSON.stringify(obj, stripNulls, 2) for cleaner output.
|
|
9
|
+
*/
|
|
10
|
+
export declare function stripNulls(_key: string, value: unknown): unknown;
|
|
11
|
+
/**
|
|
12
|
+
* Format an object as JSON, stripping null/undefined values and empty arrays.
|
|
13
|
+
*/
|
|
14
|
+
export declare function formatResponse(data: unknown): string;
|
|
15
|
+
/**
|
|
16
|
+
* Create a text content response for MCP tools.
|
|
17
|
+
*/
|
|
18
|
+
export declare function textContent(data: unknown): {
|
|
19
|
+
type: "text";
|
|
20
|
+
text: string;
|
|
21
|
+
};
|
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* MCP tools for working with NYSDS components.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
9
|
-
* - find_components: Search by name/description (fuzzy)
|
|
10
|
-
* - get_usage_guide: Installation and usage patterns
|
|
6
|
+
* Tools:
|
|
7
|
+
* - find_components: Search or list all components
|
|
8
|
+
* - get_component: Full documentation for a specific component
|
|
11
9
|
*/
|
|
12
10
|
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
13
11
|
export declare function registerComponentTools(server: McpServer): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Guide Tools
|
|
3
|
+
*
|
|
4
|
+
* Consolidated MCP tool for NYSDS guides and documentation.
|
|
5
|
+
* Loads guide content from data/guides/ markdown files.
|
|
6
|
+
*/
|
|
7
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
8
|
+
export declare function registerGuideTools(server: McpServer): void;
|
|
@@ -4,12 +4,9 @@
|
|
|
4
4
|
* MCP tools for working with NYSDS design tokens.
|
|
5
5
|
*
|
|
6
6
|
* Tools:
|
|
7
|
-
* -
|
|
7
|
+
* - get_tokens: Get tokens, categories, or themes
|
|
8
8
|
* - find_tokens: Search tokens by CSS variable, value, or description
|
|
9
|
-
* -
|
|
10
|
-
* - get_token_value: Get detailed info for a specific token
|
|
11
|
-
* - validate_token_usage: Validate token usage in context
|
|
12
|
-
* - list_token_categories: List categories with token counts
|
|
9
|
+
* - get_token_info: Get detailed token info with optional context validation
|
|
13
10
|
* - get_token_graph: Get token dependency graph
|
|
14
11
|
*/
|
|
15
12
|
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* MCP tools for validating NYSDS component usage.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* Tools:
|
|
7
7
|
* - validate_component_api: Validate prop/attribute usage
|
|
8
|
-
* - setup_framework: Framework-specific guides
|
|
9
8
|
*/
|
|
10
9
|
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
11
10
|
export declare function registerValidationTools(server: McpServer): void;
|
|
@@ -159,7 +159,6 @@ export declare class NysButton extends LitElement {
|
|
|
159
159
|
* @default "_self"
|
|
160
160
|
*/
|
|
161
161
|
target: "_self" | "_blank" | "_parent" | "_top" | "framename";
|
|
162
|
-
getButtonElement(): Promise<HTMLElement | null>;
|
|
163
162
|
private _internals;
|
|
164
163
|
/**
|
|
165
164
|
* Lifecycle methods
|
|
@@ -183,10 +182,14 @@ export declare class NysButton extends LitElement {
|
|
|
183
182
|
private _handleClick;
|
|
184
183
|
private _handleKeydown;
|
|
185
184
|
/**
|
|
186
|
-
* Vanilla JS & Native HTML keydown
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
185
|
+
* A Solution to the Vanilla JS & Native HTML keydown:
|
|
186
|
+
*
|
|
187
|
+
* Handles inline onClick attributes set as strings in vanilla HTML
|
|
188
|
+
* (e.g. <nys-button onClick="doSomething()">).
|
|
189
|
+
*
|
|
190
|
+
* When onClick is set this way, it is a DOM attribute (not a property)
|
|
191
|
+
* so this.onClick remains null. Native clicks execute the attribute
|
|
192
|
+
* automatically, but keydown events do not, so we invoke it manually here.
|
|
190
193
|
*/
|
|
191
194
|
private _handleAnyAttributeFunction;
|
|
192
195
|
focus(options?: FocusOptions): void;
|
|
@@ -97,6 +97,7 @@ export declare class NysCheckboxgroup extends LitElement {
|
|
|
97
97
|
private _handleCheckboxChange;
|
|
98
98
|
private _handleChildError;
|
|
99
99
|
private _handleChildErrorClear;
|
|
100
|
+
private _handleOtherInput;
|
|
100
101
|
private _checkOtherInputs;
|
|
101
102
|
render(): import("lit-html").TemplateResult<1>;
|
|
102
103
|
}
|
|
@@ -81,6 +81,7 @@ export declare class NysRadiobutton extends LitElement {
|
|
|
81
81
|
formResetUpdate(): void;
|
|
82
82
|
private _handleResize;
|
|
83
83
|
private _clearOtherState;
|
|
84
|
+
private _dispatchClearErrorEvent;
|
|
84
85
|
/**
|
|
85
86
|
* Event Handlers
|
|
86
87
|
* --------------------------------------------------------------------------
|
|
@@ -104,5 +104,7 @@ export declare class NysRadiogroup extends LitElement {
|
|
|
104
104
|
private _handleRadioButtonChange;
|
|
105
105
|
private _handleInvalid;
|
|
106
106
|
private _handleChildError;
|
|
107
|
+
private _handleChildErrorClear;
|
|
108
|
+
private _handleOtherInput;
|
|
107
109
|
render(): import("lit-html").TemplateResult<1>;
|
|
108
110
|
}
|
|
@@ -5,6 +5,41 @@ import { LitElement } from "lit";
|
|
|
5
5
|
* Mark as `current` to indicate active progress point. Previous steps become clickable for navigation.
|
|
6
6
|
* Set `href` for page-based navigation or listen to `nys-step-click` for SPA routing.
|
|
7
7
|
*
|
|
8
|
+
* ## Step States
|
|
9
|
+
*
|
|
10
|
+
* Understanding the three step states is critical for proper stepper usage:
|
|
11
|
+
*
|
|
12
|
+
* - **`selected`** - Which step is currently being displayed/viewed. This controls which step's
|
|
13
|
+
* content is shown. Defaults to `current` if not set. Cannot be set on a step after `current`.
|
|
14
|
+
* Users can click previous steps to change `selected` without changing `current`.
|
|
15
|
+
*
|
|
16
|
+
* - **`current`** - The furthest step the user has reached. This is the progress boundary.
|
|
17
|
+
* Update this as the user completes steps and advances. Steps after `current` are not navigable.
|
|
18
|
+
* Only one step should have `current` at a time.
|
|
19
|
+
*
|
|
20
|
+
* - **`previous`** - Auto-applied by the stepper to all steps before `current`. Do not set manually.
|
|
21
|
+
* Steps with `previous` are clickable and allow the user to navigate back.
|
|
22
|
+
*
|
|
23
|
+
* ## Common Patterns
|
|
24
|
+
*
|
|
25
|
+
* **Initial state:** Set `current` on the first step. `selected` will default to it.
|
|
26
|
+
* ```html
|
|
27
|
+
* <nys-step label="Step 1" current></nys-step>
|
|
28
|
+
* <nys-step label="Step 2"></nys-step>
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* **User completed step 1, now on step 2:**
|
|
32
|
+
* ```html
|
|
33
|
+
* <nys-step label="Step 1"></nys-step>
|
|
34
|
+
* <nys-step label="Step 2" current></nys-step>
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* **User went back to review step 1 (but progress is still at step 2):**
|
|
38
|
+
* ```html
|
|
39
|
+
* <nys-step label="Step 1" selected></nys-step>
|
|
40
|
+
* <nys-step label="Step 2" current></nys-step>
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
8
43
|
* @summary Individual step for use within nys-stepper with navigation support.
|
|
9
44
|
* @element nys-step
|
|
10
45
|
*
|
|
@@ -5,6 +5,7 @@ import "./nys-step";
|
|
|
5
5
|
*
|
|
6
6
|
* Add `nys-step` elements as children. Mark one step as `current` to indicate progress; previous steps become
|
|
7
7
|
* navigable. Compact view on mobile expands to show all steps. Use `actions` slot for navigation buttons.
|
|
8
|
+
* Do not place the stepper inside a form element.
|
|
8
9
|
*
|
|
9
10
|
* @summary Multi-step progress indicator with navigation and mobile-friendly compact view.
|
|
10
11
|
* @element nys-stepper
|
|
@@ -20,6 +21,43 @@ import "./nys-step";
|
|
|
20
21
|
* <nys-step label="Review"></nys-step>
|
|
21
22
|
* </nys-stepper>
|
|
22
23
|
* ```
|
|
24
|
+
*
|
|
25
|
+
* @example Grid layout with sidebar placement
|
|
26
|
+
* Use NYSDS grid utilities to position the stepper as a sidebar alongside form content.
|
|
27
|
+
* **Layout requirements:**
|
|
28
|
+
* - Wrap in `nys-grid-container` > `nys-grid-row`
|
|
29
|
+
* - Use mobile-first classes: `nys-grid-col-12` (stacks on mobile) plus `nys-desktop:nys-grid-col-*`
|
|
30
|
+
* - Columns must total 12 (e.g., 3+9 or 4+8)
|
|
31
|
+
* - Recommended: stepper 3-4 cols, content 8-9 cols
|
|
32
|
+
* ```html
|
|
33
|
+
* <div class="nys-grid-container">
|
|
34
|
+
* <div class="nys-grid-row">
|
|
35
|
+
* <nys-stepper label="Application" class="nys-grid-col-12 nys-desktop:nys-grid-col-3">
|
|
36
|
+
* <nys-step label="Personal Info"></nys-step>
|
|
37
|
+
* <nys-step label="Contact" current></nys-step>
|
|
38
|
+
* <nys-step label="Review"></nys-step>
|
|
39
|
+
* </nys-stepper>
|
|
40
|
+
* <main class="nys-grid-col-12 nys-desktop:nys-grid-col-9" id="main-content">
|
|
41
|
+
* <!-- Form content for current step -->
|
|
42
|
+
* <nys-textinput label="Email" required></nys-textinput>
|
|
43
|
+
* <nys-textinput label="Phone"></nys-textinput>
|
|
44
|
+
* </main>
|
|
45
|
+
* </div>
|
|
46
|
+
* </div>
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @example Navigation buttons in actions slot
|
|
50
|
+
* Add Previous/Next buttons using the actions slot. Wrap buttons in a `<div>`.
|
|
51
|
+
* ```html
|
|
52
|
+
* <nys-stepper label="Application">
|
|
53
|
+
* <nys-step label="Step 1"></nys-step>
|
|
54
|
+
* <nys-step label="Step 2" current></nys-step>
|
|
55
|
+
* <nys-step label="Step 3"></nys-step>
|
|
56
|
+
* <div slot="actions">
|
|
57
|
+
* <nys-button label="Save and Exit" variant="outline" size="sm" fullWidth></nys-button>
|
|
58
|
+
* </div>
|
|
59
|
+
* </nys-stepper>
|
|
60
|
+
* ```
|
|
23
61
|
*/
|
|
24
62
|
export declare class NysStepper extends LitElement {
|
|
25
63
|
static styles: import("lit").CSSResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./nys-video";
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
YT: any;
|
|
5
|
+
onYouTubeIframeAPIReady: () => void;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export declare class NysVideo extends LitElement {
|
|
9
|
+
static styles: import("lit").CSSResult;
|
|
10
|
+
/** Full YouTube URL — required. Component will not render if invalid. */
|
|
11
|
+
id: string;
|
|
12
|
+
/** Title text for the thumbnail of the video */
|
|
13
|
+
titleText: string;
|
|
14
|
+
/** Full YouTube URL — required. Component will not render if invalid. */
|
|
15
|
+
videourl: string;
|
|
16
|
+
/**
|
|
17
|
+
* Largest size for the video player.
|
|
18
|
+
* If not set, size is determined automatically by viewport width.
|
|
19
|
+
*/
|
|
20
|
+
size: "full" | "md" | "sm" | "";
|
|
21
|
+
loading: "lazy" | "eager";
|
|
22
|
+
/** Time in seconds where playback begins. **/
|
|
23
|
+
starttime: number;
|
|
24
|
+
/**
|
|
25
|
+
* Custom thumbnail image path.
|
|
26
|
+
* Falls back to YouTube's auto-generated thumbnail if not provided.
|
|
27
|
+
*/
|
|
28
|
+
thumbnail: string | null;
|
|
29
|
+
/** Triggers autoplay when the iframe loads */
|
|
30
|
+
autoplay: boolean;
|
|
31
|
+
/** Prevents the video from being played */
|
|
32
|
+
disabled: boolean;
|
|
33
|
+
/** Tracks whether the user has clicked to load the player */
|
|
34
|
+
private _playerActive;
|
|
35
|
+
/** Screen reader announcement text */
|
|
36
|
+
private _announcement;
|
|
37
|
+
/** Tracks whether an ad is currently playing to suppress false "Video is playing" announcements */
|
|
38
|
+
private _adPlaying;
|
|
39
|
+
constructor();
|
|
40
|
+
connectedCallback(): void;
|
|
41
|
+
disconnectedCallback(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Functions
|
|
44
|
+
* --------------------------------------------------------------------------
|
|
45
|
+
*/
|
|
46
|
+
private _isValidYouTubeUrl;
|
|
47
|
+
private _getVideoId;
|
|
48
|
+
private _getThumbnailUrl;
|
|
49
|
+
private _getEmbedUrl;
|
|
50
|
+
/**
|
|
51
|
+
* Because I need to know if Youtube ADs are playing, I need to call YT's API.
|
|
52
|
+
* Hence, the YT API setup below. The VO has 2 types of announcements:
|
|
53
|
+
* - "Advertisement is playing"
|
|
54
|
+
* - "Video is playing"
|
|
55
|
+
*
|
|
56
|
+
* YT IFrame Player API: https://developers.google.com/youtube/iframe_api_reference
|
|
57
|
+
*/
|
|
58
|
+
private _announceVideoVO;
|
|
59
|
+
/**
|
|
60
|
+
* Event Handlers
|
|
61
|
+
* --------------------------------------------------------------------------
|
|
62
|
+
*/
|
|
63
|
+
private _handleThumbnailClick;
|
|
64
|
+
/**
|
|
65
|
+
* Render Helpers
|
|
66
|
+
* --------------------------------------------------------------------------
|
|
67
|
+
*/
|
|
68
|
+
private _renderAnnouncer;
|
|
69
|
+
private _renderPlayIcon;
|
|
70
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
71
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/src/index.d.ts
CHANGED
|
@@ -28,3 +28,4 @@ export * from "../packages/nys-unavheader/src/index";
|
|
|
28
28
|
export * from "../packages/nys-globalheader/src/index";
|
|
29
29
|
export * from "../packages/nys-globalfooter/src/index";
|
|
30
30
|
export * from "../packages/nys-unavfooter/src/index";
|
|
31
|
+
export * from "../packages/nys-video/src/index";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nysds/components",
|
|
3
|
-
"version": "1.16.0-
|
|
3
|
+
"version": "1.16.0-alpha5",
|
|
4
4
|
"description": "New York State's design system and code component library.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"workspaces": [
|
|
@@ -32,16 +32,17 @@
|
|
|
32
32
|
"build": "tsc --emitDeclarationOnly && vite build",
|
|
33
33
|
"build:umd": "cross-env BUILD_FORMAT=umd vite build",
|
|
34
34
|
"tsc:packages": "tsc -b tsconfig.build.json",
|
|
35
|
-
"build:packages": "npm run tsc:packages && turbo run build --filter='./packages/*'",
|
|
35
|
+
"build:packages": "npm run tsc:packages && turbo run build --filter='./packages/*' --log-order=grouped",
|
|
36
36
|
"build:root": "cross-env NODE_ENV=production npm run build && cross-env NODE_ENV=production npm run build:umd",
|
|
37
|
-
"build:all": "npm run clean:dist && npm run lint && npm run lit-analyze || true && cross-env NODE_ENV=production npm run build:packages && npm run build:root && npm run cem && npm run mcp
|
|
37
|
+
"build:all": "npm run clean:dist && npm run lint && npm run lit-analyze || true && cross-env NODE_ENV=production npm run build:packages && npm run build:root && npm run cem && npm run build:mcp",
|
|
38
|
+
"build:mcp": "npm run build -w @nysds/mcp-server",
|
|
38
39
|
"build:link": "npm run build:all && npm link && cd packages/styles && npm link",
|
|
39
40
|
"lint": "eslint --cache --cache-location node_modules/.cache/eslint && stylelint **/*.scss || true",
|
|
40
41
|
"lint:fix": "eslint --fix && stylelint **/*.scss --fix",
|
|
41
42
|
"lit-analyze": "find ./packages/nys-*/ -name '*.ts' ! -name '*.figma.*' | xargs lit-analyzer {}",
|
|
42
43
|
"release": "cross-env NODE_ENV=production npm run build:all && cross-env NODE_ENV=production npm run test && npm run cem && cross-env NODE_ENV=production npm publish --workspaces --access public && cross-env NODE_ENV=production npm publish --access public",
|
|
43
44
|
"release:dry-run": "cross-env NODE_ENV=production npm run build:all && cross-env NODE_ENV=production npm run test && npm run cem && node src/scripts/publish-dry-run.js",
|
|
44
|
-
"release:alpha": "npm run build && npm run
|
|
45
|
+
"release:alpha": "cross-env NODE_ENV=production npm run build:all && cross-env NODE_ENV=production npm run test && npm run cem && cross-env NODE_ENV=production npm publish --workspaces --access public --tag next && cross-env NODE_ENV=production npm publish --access public --tag next",
|
|
45
46
|
"release:zip": "npm run build:all && node src/scripts/create-release-zip.js",
|
|
46
47
|
"test": "npx playwright install && wtr --node-resolve",
|
|
47
48
|
"test:build": "npm run build:all && npm run test",
|
|
@@ -85,8 +86,8 @@
|
|
|
85
86
|
"@web/test-runner": "^0.20.2",
|
|
86
87
|
"@web/test-runner-commands": "^0.9.0",
|
|
87
88
|
"@web/test-runner-playwright": "^0.11.1",
|
|
89
|
+
"cem-plugin-examples": "github:its-hcd/cem-plugin-examples",
|
|
88
90
|
"cross-env": "^10.1.0",
|
|
89
|
-
"custom-element-jsx-integration": "^1.6.0",
|
|
90
91
|
"custom-element-react-wrappers": "^1.7.3",
|
|
91
92
|
"custom-element-vs-code-integration": "^1.5.0",
|
|
92
93
|
"dotenv-cli": "^10.0.0",
|
|
@@ -98,6 +99,7 @@
|
|
|
98
99
|
"lit": "^3.3.1",
|
|
99
100
|
"lit-analyzer": "^2.0.3",
|
|
100
101
|
"plop": "^4.0.4",
|
|
102
|
+
"prettier": "^3.8.1",
|
|
101
103
|
"rollup-plugin-esbuild-minify": "^1.3.0",
|
|
102
104
|
"rollup-plugin-minify-template-literals": "^1.1.7",
|
|
103
105
|
"rollup-plugin-visualizer": "^6.0.5",
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NysVideo as NysVideoElement } from "../../dist/nysds.es.js";
|
|
3
|
+
|
|
4
|
+
export type { NysVideoElement };
|
|
5
|
+
|
|
6
|
+
export interface NysVideoProps extends Pick<
|
|
7
|
+
React.AllHTMLAttributes<HTMLElement>,
|
|
8
|
+
| "children"
|
|
9
|
+
| "dir"
|
|
10
|
+
| "hidden"
|
|
11
|
+
| "id"
|
|
12
|
+
| "lang"
|
|
13
|
+
| "slot"
|
|
14
|
+
| "style"
|
|
15
|
+
| "title"
|
|
16
|
+
| "translate"
|
|
17
|
+
| "onClick"
|
|
18
|
+
| "onFocus"
|
|
19
|
+
| "onBlur"
|
|
20
|
+
> {
|
|
21
|
+
/** Triggers autoplay when the iframe loads */
|
|
22
|
+
autoplay?: boolean;
|
|
23
|
+
|
|
24
|
+
/** Prevents the video from being played */
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
|
|
27
|
+
/** Full YouTube URL — required. Component will not render if invalid. */
|
|
28
|
+
id?: NysVideoElement["id"];
|
|
29
|
+
|
|
30
|
+
/** Title text for the thumbnail of the video */
|
|
31
|
+
titleText?: NysVideoElement["titleText"];
|
|
32
|
+
|
|
33
|
+
/** Full YouTube URL — required. Component will not render if invalid. */
|
|
34
|
+
videourl?: NysVideoElement["videourl"];
|
|
35
|
+
|
|
36
|
+
/** Largest size for the video player.
|
|
37
|
+
If not set, size is determined automatically by viewport width. */
|
|
38
|
+
size?: NysVideoElement["size"];
|
|
39
|
+
|
|
40
|
+
/** undefined */
|
|
41
|
+
loading?: NysVideoElement["loading"];
|
|
42
|
+
|
|
43
|
+
/** Time in seconds where playback begins. * */
|
|
44
|
+
starttime?: NysVideoElement["starttime"];
|
|
45
|
+
|
|
46
|
+
/** Custom thumbnail image path.
|
|
47
|
+
Falls back to YouTube's auto-generated thumbnail if not provided. */
|
|
48
|
+
thumbnail?: NysVideoElement["thumbnail"];
|
|
49
|
+
|
|
50
|
+
/** A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the class selectors or functions like the method `Document.getElementsByClassName()`. */
|
|
51
|
+
className?: string;
|
|
52
|
+
|
|
53
|
+
/** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
|
|
54
|
+
exportparts?: string;
|
|
55
|
+
|
|
56
|
+
/** Used for labels to link them with their inputs (using input id). */
|
|
57
|
+
htmlFor?: string;
|
|
58
|
+
|
|
59
|
+
/** Used to help React identify which items have changed, are added, or are removed within a list. */
|
|
60
|
+
key?: number | string;
|
|
61
|
+
|
|
62
|
+
/** Contains a space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the ::part pseudo-element. */
|
|
63
|
+
part?: string;
|
|
64
|
+
|
|
65
|
+
/** A mutable ref object whose `.current` property is initialized to the passed argument (`initialValue`). The returned object will persist for the full lifetime of the component. */
|
|
66
|
+
ref?: any;
|
|
67
|
+
|
|
68
|
+
/** Allows developers to make HTML elements focusable, allow or prevent them from being sequentially focusable (usually with the `Tab` key, hence the name) and determine their relative ordering for sequential focus navigation. */
|
|
69
|
+
tabIndex?: number;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
*
|
|
74
|
+
* ---
|
|
75
|
+
*
|
|
76
|
+
*/
|
|
77
|
+
export const NysVideo: React.ForwardRefExoticComponent<NysVideoProps>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import "../../dist/nysds.es.js";
|
|
3
|
+
|
|
4
|
+
export const NysVideo = forwardRef((props, forwardedRef) => {
|
|
5
|
+
const {
|
|
6
|
+
autoplay,
|
|
7
|
+
disabled,
|
|
8
|
+
id,
|
|
9
|
+
titleText,
|
|
10
|
+
videourl,
|
|
11
|
+
size,
|
|
12
|
+
loading,
|
|
13
|
+
starttime,
|
|
14
|
+
thumbnail,
|
|
15
|
+
...filteredProps
|
|
16
|
+
} = props;
|
|
17
|
+
|
|
18
|
+
return React.createElement(
|
|
19
|
+
"nys-video",
|
|
20
|
+
{
|
|
21
|
+
...filteredProps,
|
|
22
|
+
id: props.id,
|
|
23
|
+
titleText: props.titleText,
|
|
24
|
+
videourl: props.videourl,
|
|
25
|
+
size: props.size,
|
|
26
|
+
loading: props.loading,
|
|
27
|
+
starttime: props.starttime,
|
|
28
|
+
thumbnail: props.thumbnail,
|
|
29
|
+
class: props.className,
|
|
30
|
+
exportparts: props.exportparts,
|
|
31
|
+
for: props.htmlFor,
|
|
32
|
+
part: props.part,
|
|
33
|
+
tabindex: props.tabIndex,
|
|
34
|
+
autoplay: props.autoplay ? true : undefined,
|
|
35
|
+
disabled: props.disabled ? true : undefined,
|
|
36
|
+
style: { ...props.style },
|
|
37
|
+
},
|
|
38
|
+
props.children,
|
|
39
|
+
);
|
|
40
|
+
});
|
package/packages/react/index.js
CHANGED