@nysds/components 1.20.0 → 1.21.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.
@@ -2,6 +2,54 @@
2
2
  * Utility Tools
3
3
  *
4
4
  * MCP tools for NYSDS utility classes.
5
+ *
6
+ * The class lists this tool returns are RENDERED from the scale constants
7
+ * below. Those constants mirror the Sass sources that actually generate the
8
+ * stylesheet:
9
+ *
10
+ * - packages/styles/src/utilities/_config.scss ($spacing, $opacity-values,
11
+ * $zindex-values, $display-values,
12
+ * $breakpoints, $flex-columns)
13
+ * - packages/styles/src/utilities/_layout-grid.scss ($responsive-gap-suffixes)
14
+ * - packages/styles/src/core/typography.scss ($body-sizes, $ui-sizes,
15
+ * $ui-underline-styles, $display-sizes)
16
+ *
17
+ * Do not hand-write a class name into the markdown. Add it to a scale and let
18
+ * the renderer emit it, so a name can never appear here without a scale entry
19
+ * behind it.
20
+ *
21
+ * `npm run verify:utility-docs` compiles the stylesheet and asserts that every
22
+ * class this tool names exists in it. Run it after touching any scale.
5
23
  */
6
24
  import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
25
+ declare const UTILITY_DOCS: {
26
+ grid: string;
27
+ flex: string;
28
+ spacing: string;
29
+ display: string;
30
+ opacity: string;
31
+ zindex: string;
32
+ typography: string;
33
+ responsive: string;
34
+ componentSpacing: string;
35
+ };
36
+ /**
37
+ * Classes the reference deliberately names in order to say they do NOT exist.
38
+ *
39
+ * These are the names people reach for out of habit from other frameworks.
40
+ * Saying so explicitly is more useful than silence, but it means the docs
41
+ * mention class names the stylesheet does not define, which would otherwise
42
+ * trip the verifier.
43
+ *
44
+ * `verify-utility-docs.mjs` asserts each of these is genuinely absent, so if
45
+ * NYSDS ever adds one, the stale warning fails the check instead of quietly
46
+ * misinforming people.
47
+ */
48
+ declare const KNOWN_ABSENT: readonly string[];
49
+ /**
50
+ * Exported so `src/scripts/verify-utility-docs.mjs` can assert that every class
51
+ * named in this reference exists in the compiled stylesheet — and that every
52
+ * class named in KNOWN_ABSENT still does not.
53
+ */
54
+ export { UTILITY_DOCS, KNOWN_ABSENT };
7
55
  export declare function registerUtilityTools(server: McpServer): void;
@@ -15,9 +15,14 @@ import "@nysds/nys-icon";
15
15
  * <nys-badge label="Basic badge"></nys-badge>
16
16
  * ```
17
17
  *
18
- * @example Error Intent
18
+ * @example Info Intent
19
19
  * ```html
20
- * <nys-badge label="Error" intent="error" prefixIcon></nys-badge>
20
+ * <nys-badge label="Info" intent="info" prefixIcon></nys-badge>
21
+ * ```
22
+ *
23
+ * @example Success Intent
24
+ * ```html
25
+ * <nys-badge label="Success" intent="success" prefixIcon></nys-badge>
21
26
  * ```
22
27
  *
23
28
  * @example Warning Intent
@@ -25,29 +30,39 @@ import "@nysds/nys-icon";
25
30
  * <nys-badge label="Warning" intent="warning" prefixIcon></nys-badge>
26
31
  * ```
27
32
  *
28
- * @example Success Intent
33
+ * @example Danger Intent
29
34
  * ```html
30
- * <nys-badge label="Success" intent="success" prefixIcon></nys-badge>
35
+ * <nys-badge label="Danger" intent="danger" prefixIcon></nys-badge>
31
36
  * ```
32
37
  *
33
- * @example Strong Neutral
38
+ * @example Emergency Intent
34
39
  * ```html
35
- * <nys-badge variant="strong" label="Neutral" prefixIcon></nys-badge>
40
+ * <nys-badge label="Emergency" intent="emergency" prefixIcon></nys-badge>
36
41
  * ```
37
42
  *
38
- * @example Strong Error
43
+ * @example Strong Base
39
44
  * ```html
40
- * <nys-badge variant="strong" label="Error" intent="error" prefixIcon></nys-badge>
45
+ * <nys-badge strong label="Base" prefixIcon></nys-badge>
41
46
  * ```
42
47
  *
43
- * @example Strong Warning
48
+ * @example Strong Info
44
49
  * ```html
45
- * <nys-badge variant="strong" label="Warning" intent="warning" prefixIcon></nys-badge>
50
+ * <nys-badge strong label="Info" intent="info" prefixIcon></nys-badge>
46
51
  * ```
47
52
  *
48
53
  * @example Strong Success
49
54
  * ```html
50
- * <nys-badge variant="strong" label="Success" intent="success" prefixIcon></nys-badge>
55
+ * <nys-badge strong label="Success" intent="success" prefixIcon></nys-badge>
56
+ * ```
57
+ *
58
+ * @example Strong Warning
59
+ * ```html
60
+ * <nys-badge strong label="Warning" intent="warning" prefixIcon></nys-badge>
61
+ * ```
62
+ *
63
+ * @example Strong Danger
64
+ * ```html
65
+ * <nys-badge strong label="Danger" intent="danger" prefixIcon></nys-badge>
51
66
  * ```
52
67
  *
53
68
  * @example Custom Prefix Icon
@@ -82,17 +97,18 @@ export declare class NysBadge extends NysElement {
82
97
  */
83
98
  size: "sm" | "md";
84
99
  /**
85
- * Semantic intent affecting color: `neutral`, `error`, `success`, or `warning`.
86
- * @default "neutral"
100
+ * Semantic intent affecting color: `base`, `info`, `success`, `warning` `danger`, `emergency`. `error` has been deprecated and support will be removed in a future release. Use `danger` instead
101
+ * @default "info"
87
102
  */
88
- intent: "neutral" | "error" | "success" | "warning";
103
+ intent: "base" | "info" | "success" | "warning" | "danger" | "error" | "emergency";
89
104
  /** Secondary label displayed before the main label. */
90
105
  prefixLabel: string;
91
106
  /** Primary label text displayed in the badge. */
92
107
  label: string;
93
108
  /** Screen reader text appended after the label for additional context. */
94
109
  srText: string;
95
- variant: "strong" | "";
110
+ /** Strong visual intent with bolder text and background. */
111
+ strong: boolean;
96
112
  private _prefixIcon;
97
113
  get prefixIcon(): string | boolean;
98
114
  set prefixIcon(value: string | boolean);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nysds/components",
3
- "version": "1.20.0",
3
+ "version": "1.21.0",
4
4
  "description": "New York State's design system and code component library.",
5
5
  "type": "module",
6
6
  "workspaces": [
@@ -43,7 +43,7 @@
43
43
  "lint:fix": "bash src/scripts/lint-fix.sh",
44
44
  "lit-analyze": "find ./packages/nys-*/ -name '*.ts' ! -name '*.figma.*' | xargs lit-analyzer {}",
45
45
  "playwright:install": "npx playwright install --with-deps",
46
- "release": "cross-env NODE_ENV=production npm run build:all && cross-env NODE_ENV=production npm publish --workspaces --access public && cross-env NODE_ENV=production npm publish --access public",
46
+ "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",
47
47
  "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",
48
48
  "release:alpha": "npm run build && npm run build:umd && npm publish --tag next",
49
49
  "release:zip": "npm run build:all && node src/scripts/create-release-zip.js",
@@ -67,7 +67,8 @@
67
67
  "clean:all": "npm run clean:dist && npm run clean:node && npm run clean:cache && find packages -name '*.tsbuildinfo' -delete 2>/dev/null || true && npm run clean:turbo",
68
68
  "code-connect": "dotenv -- npx figma connect publish",
69
69
  "cem": "npx cem analyze --config src/scripts/custom-elements-manifest.config.mjs && cp ./custom-elements.json dist/ && node src/scripts/patch-react-utils.js",
70
- "verify:a11y-names": "node src/scripts/verify-a11y-names.mjs"
70
+ "verify:a11y-names": "node src/scripts/verify-a11y-names.mjs",
71
+ "verify:utility-docs": "npm run build:mcp && node src/scripts/verify-utility-docs.mjs"
71
72
  },
72
73
  "repository": {
73
74
  "type": "git",
@@ -94,10 +95,10 @@
94
95
  "@typescript-eslint/eslint-plugin": "^8.46.2",
95
96
  "@typescript-eslint/parser": "^8.46.2",
96
97
  "@wc-toolkit/wctools": "^0.0.9",
97
- "@web/dev-server-esbuild": "^1.0.4",
98
- "@web/test-runner": "^0.20.2",
99
- "@web/test-runner-commands": "^0.9.0",
100
- "@web/test-runner-playwright": "^0.11.1",
98
+ "@web/dev-server-esbuild": "^2.0.0",
99
+ "@web/test-runner": "^1.0.0",
100
+ "@web/test-runner-commands": "^1.0.1",
101
+ "@web/test-runner-playwright": "^1.0.0",
101
102
  "cem-plugin-examples": "github:its-hcd/cem-plugin-examples",
102
103
  "cross-env": "^10.1.0",
103
104
  "custom-element-jsx-integration": "^1.6.0",
@@ -18,6 +18,9 @@ export interface NysBadgeProps extends Pick<
18
18
  | "onFocus"
19
19
  | "onBlur"
20
20
  > {
21
+ /** Strong visual intent with bolder text and background. */
22
+ strong?: boolean;
23
+
21
24
  /** undefined */
22
25
  prefixIcon?: string | boolean;
23
26
 
@@ -33,7 +36,7 @@ export interface NysBadgeProps extends Pick<
33
36
  /** Badge size: `sm` (smaller text) or `md` (default). */
34
37
  size?: NysBadgeElement["size"];
35
38
 
36
- /** Semantic intent affecting color: `neutral`, `error`, `success`, or `warning`. */
39
+ /** Semantic intent affecting color: `base`, `info`, `success`, `warning` `danger`, `emergency`. `error` has been deprecated and support will be removed in a future release. Use `danger` instead */
37
40
  intent?: NysBadgeElement["intent"];
38
41
 
39
42
  /** Secondary label displayed before the main label. */
@@ -45,9 +48,6 @@ export interface NysBadgeProps extends Pick<
45
48
  /** Screen reader text appended after the label for additional context. */
46
49
  srText?: NysBadgeElement["srText"];
47
50
 
48
- /** undefined */
49
- variant?: NysBadgeElement["variant"];
50
-
51
51
  /** 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()`. */
52
52
  className?: string;
53
53
 
@@ -3,6 +3,7 @@ import "../../dist/nysds.es.js";
3
3
 
4
4
  export const NysBadge = forwardRef((props, forwardedRef) => {
5
5
  const {
6
+ strong,
6
7
  prefixIcon,
7
8
  suffixIcon,
8
9
  id,
@@ -12,7 +13,6 @@ export const NysBadge = forwardRef((props, forwardedRef) => {
12
13
  prefixLabel,
13
14
  label,
14
15
  srText,
15
- variant,
16
16
  ...filteredProps
17
17
  } = props;
18
18
 
@@ -27,12 +27,12 @@ export const NysBadge = forwardRef((props, forwardedRef) => {
27
27
  prefixLabel: props.prefixLabel,
28
28
  label: props.label,
29
29
  srText: props.srText,
30
- variant: props.variant,
31
30
  class: props.className,
32
31
  exportparts: props.exportparts,
33
32
  for: props.htmlFor,
34
33
  part: props.part,
35
34
  tabindex: props.tabIndex,
35
+ strong: props.strong ? true : undefined,
36
36
  prefixicon: props.prefixIcon ? true : undefined,
37
37
  suffixicon: props.suffixIcon ? true : undefined,
38
38
  style: { ...props.style },
@@ -186,16 +186,16 @@ export type NysBadgeProps = {
186
186
  name?: string;
187
187
  /** Badge size: `sm` (smaller text) or `md` (default). */
188
188
  size?: "sm" | "md";
189
- /** Semantic intent affecting color: `neutral`, `error`, `success`, or `warning`. */
190
- intent?: "neutral" | "error" | "success" | "warning";
189
+ /** Semantic intent affecting color: `base`, `info`, `success`, `warning` `danger`, `emergency`. `error` has been deprecated and support will be removed in a future release. Use `danger` instead */
190
+ intent?: "base" | "info" | "success" | "warning" | "danger" | "error" | "emergency";
191
191
  /** Secondary label displayed before the main label. */
192
192
  prefixLabel?: string;
193
193
  /** Primary label text displayed in the badge. */
194
194
  label?: string;
195
195
  /** Screen reader text appended after the label for additional context. */
196
196
  srText?: string;
197
- /** */
198
- variant?: "strong" | "";
197
+ /** Strong visual intent with bolder text and background. */
198
+ strong?: boolean;
199
199
  /** */
200
200
  prefixicon?: string | boolean;
201
201
  /** */