@nysds/components 1.16.0-alpha3 → 1.16.0-alpha4
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 +344 -11
- package/dist/.vscode/vscode.html-custom-data.json +56 -0
- package/dist/custom-elements.json +344 -11
- 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/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-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 +3 -4
- 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
|
@@ -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
|
}
|
|
@@ -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-alpha4",
|
|
4
4
|
"description": "New York State's design system and code component library.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"workspaces": [
|
|
@@ -32,7 +32,7 @@
|
|
|
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
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-server:build",
|
|
38
38
|
"build:link": "npm run build:all && npm link && cd packages/styles && npm link",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"lit-analyze": "find ./packages/nys-*/ -name '*.ts' ! -name '*.figma.*' | xargs lit-analyzer {}",
|
|
42
42
|
"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
43
|
"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
|
|
44
|
+
"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
45
|
"release:zip": "npm run build:all && node src/scripts/create-release-zip.js",
|
|
46
46
|
"test": "npx playwright install && wtr --node-resolve",
|
|
47
47
|
"test:build": "npm run build:all && npm run test",
|
|
@@ -86,7 +86,6 @@
|
|
|
86
86
|
"@web/test-runner-commands": "^0.9.0",
|
|
87
87
|
"@web/test-runner-playwright": "^0.11.1",
|
|
88
88
|
"cross-env": "^10.1.0",
|
|
89
|
-
"custom-element-jsx-integration": "^1.6.0",
|
|
90
89
|
"custom-element-react-wrappers": "^1.7.3",
|
|
91
90
|
"custom-element-vs-code-integration": "^1.5.0",
|
|
92
91
|
"dotenv-cli": "^10.0.0",
|
|
@@ -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