@nysds/components 1.12.0 → 1.13.1
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/README.md +3 -1
- package/custom-elements.json +10506 -0
- package/dist/.vscode/vscode.css-custom-data.json +47 -1
- package/dist/.vscode/vscode.html-custom-data.json +1280 -266
- package/dist/custom-elements.json +2183 -332
- package/dist/nys-stepper/newsletter.html +4 -0
- package/dist/nys-stepper/personal.html +6 -0
- package/dist/nys-stepper/survey.html +5 -0
- package/dist/nys-stepper/team.html +6 -0
- package/dist/nysds.es.js +3325 -1564
- package/dist/nysds.es.js.map +1 -1
- package/dist/nysds.js +280 -164
- package/dist/nysds.js.map +1 -1
- package/dist/packages/mcp-server/src/index.d.ts +8 -0
- package/dist/packages/mcp-server/src/lib/cem-parser.d.ts +95 -0
- package/dist/packages/mcp-server/src/lib/search.d.ts +19 -0
- package/dist/packages/mcp-server/src/lib/token-parser.d.ts +139 -0
- package/dist/packages/mcp-server/src/prompts/nysds-mode.d.ts +7 -0
- package/dist/packages/mcp-server/src/resources/components.d.ts +11 -0
- package/dist/packages/mcp-server/src/resources/guides.d.ts +10 -0
- package/dist/packages/mcp-server/src/resources/index.d.ts +7 -0
- package/dist/packages/mcp-server/src/resources/tokens.d.ts +16 -0
- package/dist/packages/mcp-server/src/server.d.ts +10 -0
- package/dist/packages/mcp-server/src/tools/component-tools.d.ts +13 -0
- package/dist/packages/mcp-server/src/tools/index.d.ts +7 -0
- package/dist/packages/mcp-server/src/tools/token-tools.d.ts +16 -0
- package/dist/packages/mcp-server/src/tools/validation-tools.d.ts +11 -0
- package/dist/packages/nys-accordion/src/nys-accordion.d.ts +37 -3
- package/dist/packages/nys-accordion/src/nys-accordionitem.d.ts +32 -0
- package/dist/packages/nys-alert/src/nys-alert.d.ts +62 -1
- package/dist/packages/nys-avatar/src/nys-avatar.d.ts +44 -0
- package/dist/packages/nys-backtotop/src/nys-backtotop.d.ts +29 -0
- package/dist/packages/nys-badge/src/nys-badge.d.ts +46 -0
- package/dist/packages/nys-button/src/nys-button.d.ts +141 -0
- package/dist/packages/nys-checkbox/src/nys-checkbox.d.ts +65 -1
- package/dist/packages/nys-checkbox/src/nys-checkboxgroup.d.ts +50 -0
- package/dist/packages/nys-datepicker/src/index.d.ts +1 -0
- package/dist/packages/nys-datepicker/src/nys-datepicker.d.ts +116 -0
- package/dist/packages/nys-datepicker/src/nys-datepicker.figma.d.ts +1 -0
- package/dist/packages/nys-divider/src/nys-divider.d.ts +22 -0
- package/dist/packages/nys-errormessage/src/nys-errormessage.d.ts +16 -0
- package/dist/packages/nys-fileinput/src/nys-fileinput.d.ts +59 -0
- package/dist/packages/nys-fileinput/src/nys-fileitem.d.ts +18 -0
- package/dist/packages/nys-globalfooter/src/nys-globalfooter.d.ts +29 -0
- package/dist/packages/nys-globalheader/src/nys-global.logo.d.ts +2 -0
- package/dist/packages/nys-globalheader/src/nys-globalheader.d.ts +32 -5
- package/dist/packages/nys-icon/src/nys-icon.d.ts +33 -0
- package/dist/packages/nys-label/src/nys-label.d.ts +17 -0
- package/dist/packages/nys-modal/src/nys-modal.d.ts +47 -0
- package/dist/packages/nys-pagination/src/nys-pagination.d.ts +33 -0
- package/dist/packages/nys-radiobutton/src/nys-radiobutton.d.ts +52 -3
- package/dist/packages/nys-radiobutton/src/nys-radiogroup.d.ts +55 -1
- package/dist/packages/nys-select/src/nys-option.d.ts +24 -0
- package/dist/packages/nys-select/src/nys-select.d.ts +70 -1
- package/dist/packages/nys-skipnav/src/nys-skipnav.d.ts +26 -0
- package/dist/packages/nys-stepper/src/index.d.ts +2 -0
- package/dist/packages/nys-stepper/src/nys-step.d.ts +37 -0
- package/dist/packages/nys-stepper/src/nys-stepper.d.ts +48 -0
- package/dist/packages/nys-stepper/src/nys-stepper.figma.d.ts +1 -0
- package/dist/packages/nys-table/src/index.d.ts +1 -0
- package/dist/packages/nys-table/src/nys-table.d.ts +39 -0
- package/dist/packages/nys-table/src/nys-table.figma.d.ts +1 -0
- package/dist/packages/nys-textarea/src/nys-textarea.d.ts +72 -1
- package/dist/packages/nys-textinput/src/nys-textinput.d.ts +85 -1
- package/dist/packages/nys-toggle/src/nys-toggle.d.ts +52 -0
- package/dist/packages/nys-tooltip/src/nys-tooltip.d.ts +41 -0
- package/dist/packages/nys-unavfooter/src/nys-unavfooter.d.ts +19 -0
- package/dist/packages/nys-unavheader/src/nys-unavheader.d.ts +38 -2
- package/dist/src/index.d.ts +2 -0
- package/package.json +22 -17
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom Elements Manifest Parser
|
|
3
|
+
*
|
|
4
|
+
* Reads and parses the custom-elements.json manifest from @nysds/components.
|
|
5
|
+
*/
|
|
6
|
+
export interface CEMAttribute {
|
|
7
|
+
name: string;
|
|
8
|
+
type?: {
|
|
9
|
+
text: string;
|
|
10
|
+
};
|
|
11
|
+
default?: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
fieldName?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface CEMMember {
|
|
16
|
+
kind: "field" | "method";
|
|
17
|
+
name: string;
|
|
18
|
+
type?: {
|
|
19
|
+
text: string;
|
|
20
|
+
};
|
|
21
|
+
default?: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
privacy?: "public" | "private" | "protected";
|
|
24
|
+
attribute?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface CEMEvent {
|
|
27
|
+
name: string;
|
|
28
|
+
type?: {
|
|
29
|
+
text: string;
|
|
30
|
+
};
|
|
31
|
+
description?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface CEMSlot {
|
|
34
|
+
name: string;
|
|
35
|
+
description?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface CEMCssProperty {
|
|
38
|
+
name: string;
|
|
39
|
+
default?: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface CEMCssPart {
|
|
43
|
+
name: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface CEMDeclaration {
|
|
47
|
+
kind: "class";
|
|
48
|
+
name: string;
|
|
49
|
+
tagName?: string;
|
|
50
|
+
summary?: string;
|
|
51
|
+
description?: string;
|
|
52
|
+
attributes?: CEMAttribute[];
|
|
53
|
+
members?: CEMMember[];
|
|
54
|
+
events?: CEMEvent[];
|
|
55
|
+
slots?: CEMSlot[];
|
|
56
|
+
cssProperties?: CEMCssProperty[];
|
|
57
|
+
cssParts?: CEMCssPart[];
|
|
58
|
+
superclass?: {
|
|
59
|
+
name: string;
|
|
60
|
+
package?: string;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export interface CEMModule {
|
|
64
|
+
kind: "javascript-module";
|
|
65
|
+
path: string;
|
|
66
|
+
declarations?: CEMDeclaration[];
|
|
67
|
+
exports?: Array<{
|
|
68
|
+
kind: string;
|
|
69
|
+
name: string;
|
|
70
|
+
declaration: {
|
|
71
|
+
name: string;
|
|
72
|
+
};
|
|
73
|
+
}>;
|
|
74
|
+
}
|
|
75
|
+
export interface CustomElementsManifest {
|
|
76
|
+
schemaVersion: string;
|
|
77
|
+
readme?: string;
|
|
78
|
+
modules: CEMModule[];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Load and parse the Custom Elements Manifest
|
|
82
|
+
*/
|
|
83
|
+
export declare function getCEM(): CustomElementsManifest;
|
|
84
|
+
/**
|
|
85
|
+
* Get all component declarations from the manifest
|
|
86
|
+
*/
|
|
87
|
+
export declare function getAllComponents(): CEMDeclaration[];
|
|
88
|
+
/**
|
|
89
|
+
* Get a specific component by tag name
|
|
90
|
+
*/
|
|
91
|
+
export declare function getComponent(tagName: string): CEMDeclaration | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* Clear the cached CEM (useful for testing)
|
|
94
|
+
*/
|
|
95
|
+
export declare function clearCache(): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search Utilities
|
|
3
|
+
*
|
|
4
|
+
* Fuzzy search functionality for components and tokens.
|
|
5
|
+
*/
|
|
6
|
+
export interface SearchResult {
|
|
7
|
+
tagName: string;
|
|
8
|
+
name: string;
|
|
9
|
+
summary: string;
|
|
10
|
+
score: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Search components by name or description
|
|
14
|
+
*/
|
|
15
|
+
export declare function searchComponents(query: string): SearchResult[];
|
|
16
|
+
/**
|
|
17
|
+
* Check if a string matches a search query
|
|
18
|
+
*/
|
|
19
|
+
export declare function matchesQuery(text: string, query: string): boolean;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Design Token Parser
|
|
3
|
+
*
|
|
4
|
+
* Reads and parses NYSDS design tokens with a CSS-centric approach.
|
|
5
|
+
* Returns data aligned with tokens.css output (not JSON internals).
|
|
6
|
+
*
|
|
7
|
+
* Key transformations:
|
|
8
|
+
* - Token paths are converted to CSS variable names
|
|
9
|
+
* - Alias references become var() expressions
|
|
10
|
+
* - Layer prefixes (primitive, applied) are stripped
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Legacy interface for backward compatibility
|
|
14
|
+
*/
|
|
15
|
+
export interface DesignToken {
|
|
16
|
+
name: string;
|
|
17
|
+
value: string;
|
|
18
|
+
category: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* CSS-centric token info aligned with tokens.css output
|
|
23
|
+
*/
|
|
24
|
+
export interface CSSTokenInfo {
|
|
25
|
+
/** CSS variable name, e.g., "--nys-color-text" */
|
|
26
|
+
cssVariable: string;
|
|
27
|
+
/** CSS value as it appears in tokens.css, e.g., "var(--nys-color-neutral-900)" or "#1b1b1b" */
|
|
28
|
+
cssValue: string;
|
|
29
|
+
/** If this is an alias, the variable it references, e.g., "--nys-color-neutral-900" */
|
|
30
|
+
referencesVariable?: string;
|
|
31
|
+
/** Fully resolved value for previews, e.g., "#1b1b1b" */
|
|
32
|
+
resolvedValue?: string;
|
|
33
|
+
/** Token description from $description field */
|
|
34
|
+
description?: string;
|
|
35
|
+
/** Token category (color, font, space, etc.) */
|
|
36
|
+
category: string;
|
|
37
|
+
/** Token layer (primitive, applied, color, etc.) */
|
|
38
|
+
layer: string;
|
|
39
|
+
/** Original JSON path for debugging */
|
|
40
|
+
jsonPath: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Token dependency graph node
|
|
44
|
+
*/
|
|
45
|
+
export interface TokenGraphNode {
|
|
46
|
+
cssVariable: string;
|
|
47
|
+
referencesVariable?: string;
|
|
48
|
+
usedBy: string[];
|
|
49
|
+
}
|
|
50
|
+
export interface TokenGroup {
|
|
51
|
+
category: string;
|
|
52
|
+
tokens: DesignToken[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get the path to tokens.json file
|
|
56
|
+
* Uses ESM-compatible path resolution with fallbacks for different contexts
|
|
57
|
+
*/
|
|
58
|
+
export declare function getTokensPath(): string | null;
|
|
59
|
+
/**
|
|
60
|
+
* Get the path to tokens.css file
|
|
61
|
+
*/
|
|
62
|
+
export declare function getTokensCSSPath(): string | null;
|
|
63
|
+
/**
|
|
64
|
+
* Transform a JSON token path to CSS variable name
|
|
65
|
+
*
|
|
66
|
+
* Examples:
|
|
67
|
+
* - "primitive.color.neutral.900" → "--nys-color-neutral-900"
|
|
68
|
+
* - "applied.color.text.default" → "--nys-color-text"
|
|
69
|
+
* - "color.theme.default" → "--nys-color-theme"
|
|
70
|
+
* - "font.size.md" → "--nys-font-size-md"
|
|
71
|
+
*/
|
|
72
|
+
export declare function toCSSVariable(jsonPath: string): string;
|
|
73
|
+
/**
|
|
74
|
+
* Convert an alias reference to CSS var() syntax
|
|
75
|
+
*
|
|
76
|
+
* Examples:
|
|
77
|
+
* - "{primitive.color.neutral.900}" → "var(--nys-color-neutral-900)"
|
|
78
|
+
* - "{font.size.md}" → "var(--nys-font-size-md)"
|
|
79
|
+
*/
|
|
80
|
+
export declare function aliasToVarRef(aliasValue: string): {
|
|
81
|
+
cssValue: string;
|
|
82
|
+
referencesVariable: string;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Build a dependency graph of tokens
|
|
86
|
+
* Shows which tokens reference which, and which tokens are used by which
|
|
87
|
+
*/
|
|
88
|
+
export declare function buildTokenGraph(): Map<string, TokenGraphNode>;
|
|
89
|
+
/**
|
|
90
|
+
* Get all tokens in CSS-centric format
|
|
91
|
+
*/
|
|
92
|
+
export declare function getCSSTokens(): CSSTokenInfo[];
|
|
93
|
+
/**
|
|
94
|
+
* Get CSS tokens filtered by category
|
|
95
|
+
*/
|
|
96
|
+
export declare function getCSSTokensByCategory(category: string): CSSTokenInfo[];
|
|
97
|
+
/**
|
|
98
|
+
* Get CSS tokens filtered by layer
|
|
99
|
+
*/
|
|
100
|
+
export declare function getCSSTokensByLayer(layer: string): CSSTokenInfo[];
|
|
101
|
+
/**
|
|
102
|
+
* Search CSS tokens by variable name, value, or description
|
|
103
|
+
*/
|
|
104
|
+
export declare function searchCSSTokens(query: string): CSSTokenInfo[];
|
|
105
|
+
/**
|
|
106
|
+
* Get a single token by CSS variable name
|
|
107
|
+
*/
|
|
108
|
+
export declare function getCSSTokenByVariable(variableName: string): CSSTokenInfo | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* Get all unique categories
|
|
111
|
+
*/
|
|
112
|
+
export declare function getCSSTokenCategories(): {
|
|
113
|
+
category: string;
|
|
114
|
+
count: number;
|
|
115
|
+
}[];
|
|
116
|
+
/**
|
|
117
|
+
* Get raw tokens.css content
|
|
118
|
+
*/
|
|
119
|
+
export declare function getTokensCSS(): string | null;
|
|
120
|
+
/**
|
|
121
|
+
* Load all design tokens (legacy format)
|
|
122
|
+
*/
|
|
123
|
+
export declare function getAllTokens(): DesignToken[];
|
|
124
|
+
/**
|
|
125
|
+
* Get tokens filtered by category (legacy format)
|
|
126
|
+
*/
|
|
127
|
+
export declare function getTokensByCategory(category: string): DesignToken[];
|
|
128
|
+
/**
|
|
129
|
+
* Search tokens by name or value (legacy format)
|
|
130
|
+
*/
|
|
131
|
+
export declare function searchTokens(query: string): DesignToken[];
|
|
132
|
+
/**
|
|
133
|
+
* Get available token categories (legacy format)
|
|
134
|
+
*/
|
|
135
|
+
export declare function getTokenCategories(): string[];
|
|
136
|
+
/**
|
|
137
|
+
* Clear all cached tokens (useful for testing)
|
|
138
|
+
*/
|
|
139
|
+
export declare function clearTokenCache(): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component Resources
|
|
3
|
+
*
|
|
4
|
+
* MCP resources for NYSDS component documentation.
|
|
5
|
+
*
|
|
6
|
+
* P0 Resources:
|
|
7
|
+
* - nysds://components - Component overview list
|
|
8
|
+
* - nysds://component/{tag} - Individual component docs
|
|
9
|
+
*/
|
|
10
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
11
|
+
export declare function registerComponentResources(server: McpServer): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Guide Resources
|
|
3
|
+
*
|
|
4
|
+
* MCP resources for NYSDS installation and usage guides.
|
|
5
|
+
*
|
|
6
|
+
* P0 Resources:
|
|
7
|
+
* - nysds://installation - Installation guide
|
|
8
|
+
*/
|
|
9
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
10
|
+
export declare function registerGuideResources(server: McpServer): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token Resources
|
|
3
|
+
*
|
|
4
|
+
* MCP resources for NYSDS design tokens.
|
|
5
|
+
*
|
|
6
|
+
* Resources:
|
|
7
|
+
* - nysds://tokens - All tokens in CSS-centric format
|
|
8
|
+
* - nysds://tokens/css - Raw tokens.css file content
|
|
9
|
+
* - nysds://tokens/graph - Token dependency graph with stats
|
|
10
|
+
* - nysds://tokens/color - Color tokens only
|
|
11
|
+
* - nysds://tokens/font - Typography tokens
|
|
12
|
+
* - nysds://tokens/space - Spacing tokens
|
|
13
|
+
* - nysds://tokens/size - Size tokens
|
|
14
|
+
*/
|
|
15
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
16
|
+
export declare function registerTokenResources(server: McpServer): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NYSDS MCP Server Setup
|
|
3
|
+
*
|
|
4
|
+
* Configures the MCP server with tools, resources, and prompts
|
|
5
|
+
* for the New York State Design System.
|
|
6
|
+
*/
|
|
7
|
+
export interface NysdsMcpServer {
|
|
8
|
+
start(): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export declare function createServer(): Promise<NysdsMcpServer>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component Tools
|
|
3
|
+
*
|
|
4
|
+
* MCP tools for working with NYSDS components.
|
|
5
|
+
*
|
|
6
|
+
* P0 Tools:
|
|
7
|
+
* - list_components: List all NYSDS components with summaries
|
|
8
|
+
* - get_component_docs: Full documentation for a specific component
|
|
9
|
+
* - find_components: Search by name/description (fuzzy)
|
|
10
|
+
* - get_usage_guide: Installation and usage patterns
|
|
11
|
+
*/
|
|
12
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
13
|
+
export declare function registerComponentTools(server: McpServer): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token Tools
|
|
3
|
+
*
|
|
4
|
+
* MCP tools for working with NYSDS design tokens.
|
|
5
|
+
*
|
|
6
|
+
* Tools:
|
|
7
|
+
* - get_design_tokens: Get tokens with filtering and options
|
|
8
|
+
* - find_tokens: Search tokens by CSS variable, value, or description
|
|
9
|
+
* - list_themes: List all 8 agency themes
|
|
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
|
|
13
|
+
* - get_token_graph: Get token dependency graph
|
|
14
|
+
*/
|
|
15
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
16
|
+
export declare function registerTokenTools(server: McpServer): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation Tools
|
|
3
|
+
*
|
|
4
|
+
* MCP tools for validating NYSDS component usage.
|
|
5
|
+
*
|
|
6
|
+
* P1 Tools:
|
|
7
|
+
* - validate_component_api: Validate prop/attribute usage
|
|
8
|
+
* - setup_framework: Framework-specific guides
|
|
9
|
+
*/
|
|
10
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
11
|
+
export declare function registerValidationTools(server: McpServer): void;
|
|
@@ -1,19 +1,53 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
import "./nys-accordionitem";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* A container for grouping `nys-accordionitem` components with coordinated expand/collapse behavior.
|
|
5
|
+
*
|
|
6
|
+
* Place `nys-accordionitem` elements as children. Set `singleSelect` to allow only one item open at a time.
|
|
7
|
+
* The `bordered` style propagates to all children automatically.
|
|
8
|
+
*
|
|
9
|
+
* @summary Container for accordion items with optional single-select and bordered styling.
|
|
10
|
+
* @element nys-accordion
|
|
11
|
+
*
|
|
12
|
+
* @slot - Default slot for `nys-accordionitem` elements.
|
|
13
|
+
*
|
|
14
|
+
* @example Basic accordion
|
|
15
|
+
* ```html
|
|
16
|
+
* <nys-accordion>
|
|
17
|
+
* <nys-accordionitem heading="Section 1">Content for section 1</nys-accordionitem>
|
|
18
|
+
* <nys-accordionitem heading="Section 2">Content for section 2</nys-accordionitem>
|
|
19
|
+
* </nys-accordion>
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @example Single-select accordion
|
|
23
|
+
* ```html
|
|
24
|
+
* <nys-accordion singleSelect bordered>
|
|
25
|
+
* <nys-accordionitem heading="FAQ 1" expanded>Answer 1</nys-accordionitem>
|
|
26
|
+
* <nys-accordionitem heading="FAQ 2">Answer 2</nys-accordionitem>
|
|
27
|
+
* </nys-accordion>
|
|
28
|
+
* ```
|
|
6
29
|
*/
|
|
7
30
|
export declare class NysAccordion extends LitElement {
|
|
8
31
|
static styles: import("lit").CSSResult;
|
|
32
|
+
/** Unique identifier. Auto-generated if not provided. */
|
|
9
33
|
id: string;
|
|
34
|
+
/** Only one item can be expanded at a time. Expanding one collapses others. */
|
|
10
35
|
singleSelect: boolean;
|
|
36
|
+
/** Adds borders around each accordion item. Propagates to all children. */
|
|
11
37
|
bordered: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Lifecycle methods
|
|
40
|
+
* --------------------------------------------------------------------------
|
|
41
|
+
*/
|
|
12
42
|
constructor();
|
|
13
43
|
connectedCallback(): void;
|
|
14
44
|
updated(changedProperties: Map<string, any>): void;
|
|
45
|
+
/**
|
|
46
|
+
* Functions
|
|
47
|
+
* --------------------------------------------------------------------------
|
|
48
|
+
*/
|
|
15
49
|
private _generateUniqueId;
|
|
16
|
-
private
|
|
50
|
+
private _getAccordionItems;
|
|
17
51
|
private _onAccordionToggle;
|
|
18
52
|
private _applyBordered;
|
|
19
53
|
render(): import("lit-html").TemplateResult<1>;
|
|
@@ -1,14 +1,46 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* A collapsible content panel used within `nys-accordion`. Supports keyboard navigation and smooth animations.
|
|
4
|
+
*
|
|
5
|
+
* Place inside `nys-accordion`. Set `expanded` to open by default. The heading acts as a toggle button
|
|
6
|
+
* accessible via click, Enter, or Space. Parent accordion controls `bordered` and `singleSelect` behavior.
|
|
7
|
+
*
|
|
8
|
+
* @summary Collapsible panel for use within nys-accordion with keyboard support.
|
|
9
|
+
* @element nys-accordionitem
|
|
10
|
+
*
|
|
11
|
+
* @slot - Default slot for panel content shown when expanded.
|
|
12
|
+
*
|
|
13
|
+
* @fires nys-accordionitem-toggle - Fired when expanded state changes. Detail: `{id, heading, expanded}`.
|
|
14
|
+
*
|
|
15
|
+
* @example Expanded item
|
|
16
|
+
* ```html
|
|
17
|
+
* <nys-accordionitem heading="How do I apply?" expanded>
|
|
18
|
+
* <p>Visit ny.gov and complete the online application.</p>
|
|
19
|
+
* </nys-accordionitem>
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
2
22
|
export declare class NysAccordionItem extends LitElement {
|
|
3
23
|
static styles: import("lit").CSSResult;
|
|
24
|
+
/** Unique identifier. Auto-generated if not provided. */
|
|
4
25
|
id: string;
|
|
26
|
+
/** Heading text displayed in the clickable toggle button. */
|
|
5
27
|
heading: string;
|
|
28
|
+
/** Whether the content panel is visible. Toggle via click or keyboard. */
|
|
6
29
|
expanded: boolean;
|
|
30
|
+
/** Adds border styling. Set by parent `nys-accordion`, not directly. */
|
|
7
31
|
bordered: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Lifecycle methods
|
|
34
|
+
* --------------------------------------------------------------------------
|
|
35
|
+
*/
|
|
8
36
|
constructor();
|
|
9
37
|
connectedCallback(): void;
|
|
10
38
|
firstUpdated(): void;
|
|
11
39
|
updated(changedProperties: Map<string, any>): void;
|
|
40
|
+
/**
|
|
41
|
+
* Functions
|
|
42
|
+
* --------------------------------------------------------------------------
|
|
43
|
+
*/
|
|
12
44
|
private _generateUniqueId;
|
|
13
45
|
private _dispatchEvent;
|
|
14
46
|
private _handleExpand;
|
|
@@ -1,31 +1,92 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* Displays contextual feedback messages with semantic styling. Uses ARIA live regions for screen reader announcements.
|
|
4
|
+
*
|
|
5
|
+
* Use `info` for neutral information, `success` for confirmations, `warning` for caution, `danger` for errors,
|
|
6
|
+
* and `emergency` for critical system-wide alerts. Set `dismissible` to let users close the alert.
|
|
7
|
+
*
|
|
8
|
+
* @summary Alert for contextual feedback with semantic types and live region support.
|
|
9
|
+
* @element nys-alert
|
|
10
|
+
*
|
|
11
|
+
* @slot - Default slot for custom body content. Overrides `text` prop when provided.
|
|
12
|
+
*
|
|
13
|
+
* @fires nys-close - Fired when alert is dismissed. Detail: `{id, type, label}`.
|
|
14
|
+
*
|
|
15
|
+
* @example Info alert
|
|
16
|
+
* ```html
|
|
17
|
+
* <nys-alert type="info" heading="Update available" text="A new version is ready to install."></nys-alert>
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @example Dismissible success alert
|
|
21
|
+
* ```html
|
|
22
|
+
* <nys-alert type="success" heading="Application submitted" dismissible></nys-alert>
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
2
25
|
export declare class NysAlert extends LitElement {
|
|
3
26
|
static styles: import("lit").CSSResult;
|
|
27
|
+
/** Unique identifier. Auto-generated if not provided. */
|
|
4
28
|
id: string;
|
|
29
|
+
/** Bold heading text displayed at the top of the alert. */
|
|
5
30
|
heading: string;
|
|
31
|
+
/** Custom icon name. Defaults to type-appropriate icon if not set. */
|
|
6
32
|
icon: string;
|
|
33
|
+
/** Shows close button allowing users to dismiss the alert. */
|
|
7
34
|
dismissible: boolean;
|
|
35
|
+
/** Auto-dismiss after specified milliseconds. Set to 0 to disable. */
|
|
8
36
|
duration: number;
|
|
37
|
+
/** Body text content. Ignored if slot content is provided. */
|
|
9
38
|
text: string;
|
|
39
|
+
/** URL for the primary action link. */
|
|
10
40
|
primaryAction: string;
|
|
41
|
+
/** URL for the secondary action link. */
|
|
11
42
|
secondaryAction: string;
|
|
43
|
+
/** Label text for primary action link. */
|
|
12
44
|
primaryLabel: string;
|
|
45
|
+
/** Label text for secondary action link. */
|
|
13
46
|
secondaryLabel: string;
|
|
47
|
+
/**
|
|
48
|
+
* Semantic alert type affecting color and ARIA role. `danger`/`emergency` use assertive live region.
|
|
49
|
+
* @default "base"
|
|
50
|
+
*/
|
|
14
51
|
type: "base" | "info" | "success" | "warning" | "danger" | "emergency";
|
|
15
52
|
private _alertClosed;
|
|
16
53
|
private _slotHasContent;
|
|
54
|
+
/**
|
|
55
|
+
* Returns ARIA role and label based on alert type.
|
|
56
|
+
* - 'alert' => assertive live region (implied)
|
|
57
|
+
* - 'status' => polite live region
|
|
58
|
+
* - 'region' => generic, requires aria-label
|
|
59
|
+
*/
|
|
17
60
|
get ariaAttributes(): {
|
|
18
61
|
role: "alert" | "status" | "region";
|
|
19
62
|
ariaLabel: string;
|
|
20
63
|
};
|
|
64
|
+
/**
|
|
65
|
+
* Returns live-region type for screen readers if applicable.
|
|
66
|
+
* - 'polite' for status role
|
|
67
|
+
* - undefined for alert (since it's implicitly assertive) or region
|
|
68
|
+
*/
|
|
69
|
+
get liveRegion(): "polite" | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Lifecycle methods
|
|
72
|
+
* --------------------------------------------------------------------------
|
|
73
|
+
*/
|
|
21
74
|
private _timeoutId;
|
|
22
75
|
connectedCallback(): void;
|
|
23
76
|
disconnectedCallback(): void;
|
|
24
77
|
firstUpdated(): void;
|
|
78
|
+
/**
|
|
79
|
+
* Functions
|
|
80
|
+
* --------------------------------------------------------------------------
|
|
81
|
+
*/
|
|
25
82
|
private _generateUniqueId;
|
|
26
|
-
private
|
|
83
|
+
private _resolveIconName;
|
|
27
84
|
private _checkAltNaming;
|
|
28
85
|
private _closeAlert;
|
|
86
|
+
/**
|
|
87
|
+
* Checks whether the default slot has content.
|
|
88
|
+
* Updates `_slotHasContent` accordingly.
|
|
89
|
+
*/
|
|
29
90
|
private _checkSlotContent;
|
|
30
91
|
render(): import("lit-html").TemplateResult<1>;
|
|
31
92
|
}
|
|
@@ -1,18 +1,62 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* Displays a user representation as image, initials, or icon with automatic fallback chain.
|
|
4
|
+
*
|
|
5
|
+
* Priority: `image` > `initials` > `icon` > default icon. Set `color` to customize background;
|
|
6
|
+
* foreground auto-adjusts for contrast. Use `interactive` for clickable avatars (e.g., profile menus).
|
|
7
|
+
*
|
|
8
|
+
* @summary User avatar with image, initials, or icon fallback and contrast-aware colors.
|
|
9
|
+
* @element nys-avatar
|
|
10
|
+
*
|
|
11
|
+
* @slot - Custom icon content. Overrides default icon when no image or initials.
|
|
12
|
+
*
|
|
13
|
+
* @example Image avatar
|
|
14
|
+
* ```html
|
|
15
|
+
* <nys-avatar image="/path/to/photo.jpg" ariaLabel="Jane Smith"></nys-avatar>
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @example Initials avatar with custom color
|
|
19
|
+
* ```html
|
|
20
|
+
* <nys-avatar initials="JS" color="var(--nys-color-theme)" ariaLabel="Jane Smith"></nys-avatar>
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
2
23
|
export declare class NysAvatar extends LitElement {
|
|
3
24
|
static styles: import("lit").CSSResult;
|
|
25
|
+
/** Unique identifier. Auto-generated if not provided. */
|
|
4
26
|
id: string;
|
|
27
|
+
/** Accessible label for screen readers. Required when no image `alt` is available. */
|
|
5
28
|
ariaLabel: string;
|
|
29
|
+
/** Image URL. Takes priority over initials and icon. */
|
|
6
30
|
image: string;
|
|
31
|
+
/** 1-2 character initials. Used when no image is provided. */
|
|
7
32
|
initials: string;
|
|
33
|
+
/** Custom icon name. Falls back to `account_circle` if not set. */
|
|
8
34
|
icon: string;
|
|
35
|
+
/** Background color. Foreground auto-adjusts for contrast. Accepts CSS values or variables. */
|
|
9
36
|
color: string;
|
|
37
|
+
/** Makes avatar clickable with button role and focus ring. */
|
|
10
38
|
interactive: boolean;
|
|
39
|
+
/** Prevents interaction when `interactive` is true. */
|
|
11
40
|
disabled: boolean;
|
|
41
|
+
/** Enables lazy loading for the image. */
|
|
12
42
|
lazy: boolean;
|
|
13
43
|
private _slotHasContent;
|
|
44
|
+
/**
|
|
45
|
+
* Lifecycle methods
|
|
46
|
+
* --------------------------------------------------------------------------
|
|
47
|
+
*/
|
|
14
48
|
connectedCallback(): void;
|
|
15
49
|
private _handleSlotChange;
|
|
50
|
+
/**
|
|
51
|
+
* Functions
|
|
52
|
+
* --------------------------------------------------------------------------
|
|
53
|
+
*/
|
|
54
|
+
/**
|
|
55
|
+
* Computes the appropriate foreground color (icon or initials)
|
|
56
|
+
* based on the avatar's background color for sufficient contrast.
|
|
57
|
+
*
|
|
58
|
+
* @returns CSS color string for foreground
|
|
59
|
+
*/
|
|
16
60
|
private getContrastForeground;
|
|
17
61
|
render(): import("lit-html").TemplateResult<1>;
|
|
18
62
|
}
|