@nysds/components 1.16.0-alpha-2 → 1.16.0-alpha-3

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/dist/nysds.es.js CHANGED
@@ -2,7 +2,7 @@ import { LitElement as f, unsafeCSS as g, html as d } from "lit";
2
2
  import { property as a, query as Dt, state as _ } from "lit/decorators.js";
3
3
  import { ifDefined as y } from "lit/directives/if-defined.js";
4
4
  /*!
5
- * New York State Design System v1.16.0-alpha-2
5
+ * New York State Design System v1.16.0-alpha-3
6
6
  * Description: A design system for New York State's digital products.
7
7
  * Repository: https://github.com/its-hcd/nysds
8
8
  * License: MIT
package/dist/nysds.js CHANGED
@@ -1,5 +1,5 @@
1
1
  (function(b,me){typeof exports=="object"&&typeof module<"u"?me(exports):typeof define=="function"&&define.amd?define(["exports"],me):(b=typeof globalThis<"u"?globalThis:b||self,me(b.NYSDS={}))})(this,(function(b){"use strict";/*!
2
- * New York State Design System v1.16.0-alpha-2
2
+ * New York State Design System v1.16.0-alpha-3
3
3
  * Description: A design system for New York State's digital products.
4
4
  * Repository: https://github.com/its-hcd/nysds
5
5
  * License: MIT
@@ -0,0 +1 @@
1
+ export * from "./nys-video";
@@ -0,0 +1,52 @@
1
+ import { LitElement } from "lit";
2
+ export declare class NysVideo extends LitElement {
3
+ static styles: import("lit").CSSResult;
4
+ /** Full YouTube URL — required. Component will not render if invalid. */
5
+ id: string;
6
+ /** Title text for the thumbnail of the video */
7
+ titleText: string;
8
+ /** Full YouTube URL — required. Component will not render if invalid. */
9
+ videourl: string;
10
+ /**
11
+ * Largest size for the video player.
12
+ * If not set, size is determined automatically by viewport width.
13
+ */
14
+ size: "full" | "contained" | "compacted" | "";
15
+ loading: "lazy" | "eager";
16
+ /** Time in seconds where playback begins. **/
17
+ starttime: number;
18
+ /**
19
+ * Custom thumbnail image path.
20
+ * Falls back to YouTube's auto-generated thumbnail if not provided.
21
+ */
22
+ thumbnail: string | null;
23
+ /** Triggers autoplay when the iframe loads */
24
+ autoplay: boolean;
25
+ /** Prevents the video from being played */
26
+ disabled: boolean;
27
+ /** Tracks whether the user has clicked to load the player */
28
+ private _playerActive;
29
+ /** Auto-computed size when no explicit size prop is set */
30
+ private _autoSize;
31
+ private _mediaFull;
32
+ private _mediaMobileLarge;
33
+ private _onMediaChange;
34
+ constructor();
35
+ connectedCallback(): void;
36
+ disconnectedCallback(): void;
37
+ /**
38
+ * Functions
39
+ * --------------------------------------------------------------------------
40
+ */
41
+ private _updateAutoSize;
42
+ private _isValidYouTubeUrl;
43
+ private _getVideoId;
44
+ private _getThumbnailUrl;
45
+ private _getEmbedUrl;
46
+ /**
47
+ * Event Handlers
48
+ * --------------------------------------------------------------------------
49
+ */
50
+ private _handleThumbnailClick;
51
+ render(): import("lit-html").TemplateResult<1>;
52
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nysds/components",
3
- "version": "1.16.0-alpha-2",
3
+ "version": "1.16.0-alpha-3",
4
4
  "description": "New York State's design system and code component library.",
5
5
  "type": "module",
6
6
  "workspaces": [
@@ -20,21 +20,23 @@
20
20
  "import": "./dist/nysds.es.js",
21
21
  "require": "./dist/nysds.js"
22
22
  },
23
- "./react": {
24
- "import": "./packages/react/index.js",
25
- "types": "./packages/react/index.d.ts"
26
- }
23
+ "./react": {
24
+ "import": "./packages/react/index.js",
25
+ "types": "./packages/react/index.d.ts"
26
+ }
27
27
  },
28
28
  "customElements": "custom-elements.json",
29
29
  "scripts": {
30
30
  "dev": "vite",
31
31
  "gen": "plop",
32
32
  "build": "tsc --emitDeclarationOnly && vite build",
33
- "build:umd": "tsc --emitDeclarationOnly && vite build --config vite.config.umd.js",
34
- "build:packages": "node src/scripts/build-order.js",
35
- "build:all": "npm run clean:dist && npm run lint && cross-env NODE_ENV=production npm run build:packages && cross-env NODE_ENV=production npm run build && cross-env NODE_ENV=production npm run build:umd && npm run lit-analyze || true && npm run cem && npm run cem:copy && npm run mcp-server:build",
33
+ "build:umd": "cross-env BUILD_FORMAT=umd vite build",
34
+ "tsc:packages": "tsc -b tsconfig.build.json",
35
+ "build:packages": "npm run tsc:packages && turbo run build --filter='./packages/*'",
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-server:build",
36
38
  "build:link": "npm run build:all && npm link",
37
- "lint": "eslint && stylelint **/*.scss || true",
39
+ "lint": "eslint --cache --cache-location node_modules/.cache/eslint && stylelint **/*.scss || true",
38
40
  "lint:fix": "eslint --fix && stylelint **/*.scss --fix",
39
41
  "lit-analyze": "find ./packages/nys-*/ -name '*.ts' ! -name '*.figma.*' | xargs lit-analyzer {}",
40
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",
@@ -46,13 +48,12 @@
46
48
  "storybook:build:all": "cross-env NODE_ENV=production npm run build:all && npm run storybook",
47
49
  "build-storybook": "npm run build:packages && storybook build",
48
50
  "storybook:cibuild": "storybook build",
49
- "mcp-server:build": "node src/scripts/build-mcp-server.js",
51
+ "mcp-server:build": "turbo run build --filter=@nysds/mcp-server",
50
52
  "clean:node": "rm -rf node_modules && rm -rf packages/*/node_modules && rm -rf packages/**/*/node_modules",
51
53
  "clean:dist": "rm -rf storybook-static && rm -rf coverage && rm -rf packages/*/coverage && rm -rf dist && find packages -type d -name dist ! -path '*/mcp-server/dist' -exec rm -rf {} + 2>/dev/null || true",
52
- "clean:all": "npm run clean:dist && npm run clean:node",
54
+ "clean:all": "npm run clean:dist && npm run clean:node && find packages -name '*.tsbuildinfo' -delete 2>/dev/null || true",
53
55
  "code-connect": "dotenv -- npx figma connect publish",
54
- "cem": "npx cem analyze --config ./custom-elements-manifest.config.mjs",
55
- "cem:copy": "cp ./custom-elements.json dist/"
56
+ "cem": "npx cem analyze --config ./custom-elements-manifest.config.mjs && cp ./custom-elements.json dist/ && node src/scripts/patch-react-utils.js"
56
57
  },
57
58
  "repository": {
58
59
  "type": "git",
@@ -64,6 +65,7 @@
64
65
  "url": "https://github.com/ITS-HCD/nysds/issues"
65
66
  },
66
67
  "homepage": "https://designsystem.ny.gov/",
68
+ "packageManager": "npm@11.6.2",
67
69
  "devDependencies": {
68
70
  "@chromatic-com/storybook": "^5.0.1",
69
71
  "@custom-elements-manifest/analyzer": "^0.11.0",
@@ -105,6 +107,7 @@
105
107
  "stylelint-config-standard-scss": "^17.0.0",
106
108
  "tslib": "^2.8.1",
107
109
  "typescript": "^5.9.3",
110
+ "turbo": "^2.8.16",
108
111
  "vite": "^7.3.1"
109
112
  },
110
113
  "eslintConfig": {
@@ -1,6 +1,6 @@
1
1
  # `@nysds/components/react` — Auto-generated React Wrappers
2
2
 
3
- This folder is **fully auto-generated** — do not edit files inside it directly.
3
+ ⚠️ This folder is **fully auto-generated** — do not edit files inside it directly!
4
4
  Files are regenerated every time `npm run cem` runs, which is called automatically by `npm run build:all`.
5
5
 
6
6
  ---
@@ -12,11 +12,11 @@ npm run cem
12
12
  └─► cem analyze --config custom-elements-manifest.config.mjs
13
13
  └─► customElementReactWrapperPlugin (custom-element-react-wrappers)
14
14
  └─► packages/react/
15
- ├── index.js barrel, one export per component
16
- ├── index.d.ts TypeScript types
17
- ├── react-utils.js internal hooks used by wrappers, do not use directly
18
- ├── NysButton.js one file per component
19
- └── etc.
15
+ ├── index.js <= barrel, one export per component
16
+ ├── index.d.ts <= TypeScript types
17
+ ├── react-utils.js <= auto generated internal hooks used by wrappers, do not use directly
18
+ ├── NysButton.js <= one file per component
19
+ └── ...etc.
20
20
  ```
21
21
 
22
22
  The plugin is configured in `custom-elements-manifest.config.mjs` at the repo root.
@@ -81,12 +81,12 @@ React 19 improves web component interop but doesn't bridge custom events to `on*
81
81
  ## Repo layout
82
82
 
83
83
  ```
84
- custom-elements-manifest.config.mjs plugin configured here
85
- package.json "./react" subpath export declared here
84
+ custom-elements-manifest.config.mjs <= plugin configured here
85
+ package.json <= "./react" subpath export declared here
86
86
  packages/
87
- react/ auto-generated, do not edit
87
+ react/ <= auto-generated, do not edit
88
88
  index.js
89
89
  index.d.ts
90
90
  react-utils.js
91
- NysButton.js etc.
91
+ NysButton.js ...etc.
92
92
  ```
@@ -1,37 +1,37 @@
1
1
  export * from "./NysAccordion.js";
2
2
  export * from "./NysAccordionItem.js";
3
3
  export * from "./NysAvatar.js";
4
- export * from "./NysBacktotop.js";
5
- export * from "./NysBadge.js";
6
4
  export * from "./NysAlert.js";
5
+ export * from "./NysBadge.js";
6
+ export * from "./NysBacktotop.js";
7
7
  export * from "./NysButton.js";
8
8
  export * from "./NysCheckbox.js";
9
9
  export * from "./NysCheckboxgroup.js";
10
- export * from "./NysCombobox.js";
10
+ export * from "./NysDatepicker.js";
11
11
  export * from "./NysDivider.js";
12
12
  export * from "./NysDropdownMenu.js";
13
13
  export * from "./NysDropdownMenuItem.js";
14
+ export * from "./NysErrorMessage.js";
15
+ export * from "./NysGlobalFooter.js";
14
16
  export * from "./NysFileinput.js";
15
17
  export * from "./NysFileItem.js";
16
- export * from "./NysGlobalFooter.js";
17
- export * from "./NysErrorMessage.js";
18
- export * from "./NysDatepicker.js";
19
18
  export * from "./NysGlobalHeader.js";
20
19
  export * from "./NysIcon.js";
21
- export * from "./NysModal.js";
20
+ export * from "./NysLabel.js";
22
21
  export * from "./NysPagination.js";
23
22
  export * from "./NysOption.js";
24
23
  export * from "./NysSelect.js";
25
24
  export * from "./NysSkipnav.js";
26
- export * from "./NysLabel.js";
27
- export * from "./NysRadiobutton.js";
28
- export * from "./NysRadiogroup.js";
29
25
  export * from "./NysStep.js";
30
26
  export * from "./NysStepper.js";
27
+ export * from "./NysModal.js";
31
28
  export * from "./NysTable.js";
32
- export * from "./NysTooltip.js";
33
- export * from "./NysToggle.js";
34
- export * from "./NysUnavFooter.js";
35
29
  export * from "./NysTextarea.js";
36
- export * from "./NysUnavHeader.js";
30
+ export * from "./NysRadiobutton.js";
31
+ export * from "./NysRadiogroup.js";
32
+ export * from "./NysCombobox.js";
33
+ export * from "./NysToggle.js";
37
34
  export * from "./NysTextinput.js";
35
+ export * from "./NysTooltip.js";
36
+ export * from "./NysUnavHeader.js";
37
+ export * from "./NysUnavFooter.js";
@@ -1,37 +1,37 @@
1
1
  export * from "./NysAccordion.js";
2
2
  export * from "./NysAccordionItem.js";
3
3
  export * from "./NysAvatar.js";
4
- export * from "./NysBacktotop.js";
5
- export * from "./NysBadge.js";
6
4
  export * from "./NysAlert.js";
5
+ export * from "./NysBadge.js";
6
+ export * from "./NysBacktotop.js";
7
7
  export * from "./NysButton.js";
8
8
  export * from "./NysCheckbox.js";
9
9
  export * from "./NysCheckboxgroup.js";
10
- export * from "./NysCombobox.js";
10
+ export * from "./NysDatepicker.js";
11
11
  export * from "./NysDivider.js";
12
12
  export * from "./NysDropdownMenu.js";
13
13
  export * from "./NysDropdownMenuItem.js";
14
+ export * from "./NysErrorMessage.js";
15
+ export * from "./NysGlobalFooter.js";
14
16
  export * from "./NysFileinput.js";
15
17
  export * from "./NysFileItem.js";
16
- export * from "./NysGlobalFooter.js";
17
- export * from "./NysErrorMessage.js";
18
- export * from "./NysDatepicker.js";
19
18
  export * from "./NysGlobalHeader.js";
20
19
  export * from "./NysIcon.js";
21
- export * from "./NysModal.js";
20
+ export * from "./NysLabel.js";
22
21
  export * from "./NysPagination.js";
23
22
  export * from "./NysOption.js";
24
23
  export * from "./NysSelect.js";
25
24
  export * from "./NysSkipnav.js";
26
- export * from "./NysLabel.js";
27
- export * from "./NysRadiobutton.js";
28
- export * from "./NysRadiogroup.js";
29
25
  export * from "./NysStep.js";
30
26
  export * from "./NysStepper.js";
27
+ export * from "./NysModal.js";
31
28
  export * from "./NysTable.js";
32
- export * from "./NysTooltip.js";
33
- export * from "./NysToggle.js";
34
- export * from "./NysUnavFooter.js";
35
29
  export * from "./NysTextarea.js";
36
- export * from "./NysUnavHeader.js";
30
+ export * from "./NysRadiobutton.js";
31
+ export * from "./NysRadiogroup.js";
32
+ export * from "./NysCombobox.js";
33
+ export * from "./NysToggle.js";
37
34
  export * from "./NysTextinput.js";
35
+ export * from "./NysTooltip.js";
36
+ export * from "./NysUnavHeader.js";
37
+ export * from "./NysUnavFooter.js";
@@ -1,4 +1,4 @@
1
- import { useEffect, useLayoutEffect } from "react";
1
+ import { useEffect, useRef } from "react";
2
2
 
3
3
  export function useProperties(targetElement, propName, value) {
4
4
  useEffect(() => {
@@ -7,28 +7,36 @@ export function useProperties(targetElement, propName, value) {
7
7
  targetElement.current &&
8
8
  targetElement.current[propName] !== value
9
9
  ) {
10
- // add try catch to avoid errors when setting read-only properties
11
10
  try {
12
11
  targetElement.current[propName] = value;
13
12
  } catch (e) {
14
13
  console.warn(e);
15
14
  }
16
15
  }
17
- }, [value, targetElement.current]);
16
+ }, [value, targetElement]);
18
17
  }
19
18
 
20
19
  export function useEventListener(targetElement, eventName, eventHandler) {
21
- useLayoutEffect(() => {
22
- if (eventHandler !== undefined) {
23
- targetElement?.current?.addEventListener(eventName, eventHandler);
24
- }
20
+ // Store the latest handler in a ref so we never need to re-subscribe
21
+ // just because the consumer passed a new function reference.
22
+ const savedHandler = useRef(eventHandler);
23
+ useEffect(() => {
24
+ savedHandler.current = eventHandler;
25
+ }, [eventHandler]);
25
26
 
26
- return () => {
27
- if (eventHandler?.cancel) {
28
- eventHandler.cancel();
29
- }
27
+ useEffect(() => {
28
+ const element = targetElement.current;
29
+ if (!element || eventHandler === undefined) return;
30
+
31
+ // Stable wrapper — identity never changes, so add/remove are always paired.
32
+ const listener = (event) => savedHandler.current(event);
30
33
 
31
- targetElement?.current?.removeEventListener(eventName, eventHandler);
34
+ element.addEventListener(eventName, listener);
35
+
36
+ return () => {
37
+ element.removeEventListener(eventName, listener);
32
38
  };
33
- }, [eventName, eventHandler, targetElement.current]);
39
+ // Only re-subscribe when the element or event name changes.
40
+ // Handler changes are handled via the savedHandler ref above.
41
+ }, [eventName, targetElement]);
34
42
  }