@nysds/components 1.20.0-alpha-3 → 1.20.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.
- package/custom-elements.json +9101 -5385
- package/dist/.vscode/vscode.css-custom-data.json +5 -0
- package/dist/.vscode/vscode.html-custom-data.json +332 -30
- package/dist/custom-elements.json +9101 -5385
- package/dist/nys-icon.library-Bu3noJqZ-1mvg_e5Y.js +706 -0
- package/dist/nys-icon.library-Bu3noJqZ-1mvg_e5Y.js.map +1 -0
- package/dist/nys-icon.library-eNVZmfkf.js +696 -0
- package/dist/nys-icon.library-eNVZmfkf.js.map +1 -0
- package/dist/nysds.es.js +10460 -5393
- package/dist/nysds.es.js.map +1 -1
- package/dist/nysds.js +2436 -472
- package/dist/nysds.js.map +1 -1
- package/dist/packages/internals/src/aria-associate.d.ts +41 -0
- package/dist/packages/internals/src/form-control-mixin.d.ts +34 -0
- package/dist/packages/internals/src/id.d.ts +8 -0
- package/dist/packages/internals/src/identified-mixin.d.ts +23 -0
- package/dist/packages/internals/src/index.d.ts +7 -0
- package/dist/packages/internals/src/reflects-aria-mixin.d.ts +33 -0
- package/dist/packages/internals/src/test-helpers.d.ts +29 -0
- package/dist/packages/internals/src/types.d.ts +9 -0
- package/dist/packages/nys-accordion/src/nys-accordion.d.ts +72 -10
- package/dist/packages/nys-accordion/src/nys-accordionitem.d.ts +63 -8
- package/dist/packages/nys-alert/src/nys-alert.d.ts +95 -20
- package/dist/packages/nys-avatar/src/nys-avatar.d.ts +100 -7
- package/dist/packages/nys-backtotop/src/nys-backtotop.d.ts +75 -5
- package/dist/packages/nys-badge/src/nys-badge.d.ts +63 -6
- package/dist/packages/nys-breadcrumbs/src/nys-breadcrumbs.d.ts +79 -10
- package/dist/packages/nys-button/src/nys-button.d.ts +132 -26
- package/dist/packages/nys-card/src/index.d.ts +1 -0
- package/dist/packages/nys-card/src/nys-card.d.ts +325 -0
- package/dist/packages/nys-card/src/nys-card.figma.d.ts +1 -0
- package/dist/packages/nys-checkbox/src/nys-checkbox.d.ts +36 -12
- package/dist/packages/nys-checkbox/src/nys-checkboxgroup.d.ts +81 -6
- package/dist/packages/nys-combobox/src/nys-combobox.d.ts +174 -5
- package/dist/packages/nys-datepicker/src/nys-datepicker.d.ts +83 -13
- package/dist/packages/nys-divider/src/nys-divider.d.ts +33 -9
- package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenu.d.ts +24 -15
- package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenuitem.d.ts +3 -12
- package/dist/packages/nys-errormessage/src/nys-errormessage.d.ts +22 -0
- package/dist/packages/nys-fileinput/src/nys-fileinput.d.ts +101 -12
- package/dist/packages/nys-fileinput/src/nys-fileitem.d.ts +23 -2
- package/dist/packages/nys-globalfooter/src/nys-globalfooter.d.ts +99 -9
- package/dist/packages/nys-globalheader/src/nys-globalheader.d.ts +189 -6
- package/dist/packages/nys-icon/src/icon-cache.d.ts +11 -4
- package/dist/packages/nys-icon/src/icon-library-registry.d.ts +33 -16
- package/dist/packages/nys-icon/src/index.d.ts +2 -2
- package/dist/packages/nys-icon/src/nys-icon.d.ts +98 -8
- package/dist/packages/nys-iconlist/src/index.d.ts +2 -0
- package/dist/packages/nys-iconlist/src/nys-iconlist.d.ts +92 -0
- package/dist/packages/nys-iconlist/src/nys-iconlist.figma.d.ts +1 -0
- package/dist/packages/nys-iconlist/src/nys-iconlistitem.d.ts +32 -0
- package/dist/packages/nys-label/src/nys-label.d.ts +37 -2
- package/dist/packages/nys-modal/src/nys-modal.d.ts +145 -13
- package/dist/packages/nys-pagination/src/nys-pagination.d.ts +67 -3
- package/dist/packages/nys-processlist/src/index.d.ts +2 -0
- package/dist/packages/nys-processlist/src/nys-processlist.d.ts +184 -0
- package/dist/packages/nys-processlist/src/nys-processlist.figma.d.ts +1 -0
- package/dist/packages/nys-processlist/src/nys-processlistitem.d.ts +41 -0
- package/dist/packages/nys-radiobutton/src/nys-radiobutton.d.ts +201 -7
- package/dist/packages/nys-radiobutton/src/nys-radiogroup.d.ts +88 -6
- package/dist/packages/nys-select/src/nys-option.d.ts +0 -8
- package/dist/packages/nys-select/src/nys-select.d.ts +150 -15
- package/dist/packages/nys-skipnav/src/nys-skipnav.d.ts +4 -4
- package/dist/packages/nys-stepper/src/nys-step.d.ts +26 -20
- package/dist/packages/nys-stepper/src/nys-stepper.d.ts +128 -75
- package/dist/packages/nys-tab/src/nys-tab.d.ts +19 -10
- package/dist/packages/nys-tab/src/nys-tabgroup.d.ts +181 -39
- package/dist/packages/nys-tab/src/nys-tabpanel.d.ts +15 -24
- package/dist/packages/nys-table/src/nys-table.d.ts +90 -3
- package/dist/packages/nys-textarea/src/nys-textarea.d.ts +60 -10
- package/dist/packages/nys-textinput/src/nys-textinput.d.ts +77 -14
- package/dist/packages/nys-toggle/src/nys-toggle.d.ts +47 -10
- package/dist/packages/nys-tooltip/src/nys-tooltip.d.ts +48 -8
- package/dist/packages/nys-unavfooter/src/nys-unavfooter.d.ts +45 -4
- package/dist/packages/nys-unavheader/src/nys-unavheader.d.ts +216 -11
- package/dist/packages/nys-verticalnav/src/index.d.ts +2 -0
- package/dist/packages/nys-verticalnav/src/nys-verticalnav.d.ts +572 -0
- package/dist/packages/nys-verticalnav/src/nys-verticalnav.figma.d.ts +1 -0
- package/dist/packages/nys-verticalnav/src/nys-verticalnavgroup.d.ts +24 -0
- package/dist/packages/nys-video/src/nys-video.d.ts +67 -7
- package/dist/src/index.d.ts +6 -2
- package/package.json +11 -6
- package/packages/react/NysAccordion.d.ts +10 -0
- package/packages/react/NysAccordion.js +2 -1
- package/packages/react/NysAccordionItem.d.ts +10 -0
- package/packages/react/NysAccordionItem.js +3 -1
- package/packages/react/NysAlert.d.ts +8 -10
- package/packages/react/NysAlert.js +0 -2
- package/packages/react/NysAvatar.d.ts +11 -1
- package/packages/react/NysBacktotop.d.ts +3 -0
- package/packages/react/NysBacktotop.js +2 -1
- package/packages/react/NysBreadcrumbs.d.ts +2 -2
- package/packages/react/NysButton.d.ts +38 -8
- package/packages/react/NysButton.js +6 -4
- package/packages/react/NysCard.d.ts +110 -0
- package/packages/react/NysCard.js +61 -0
- package/packages/react/NysCheckbox.d.ts +9 -0
- package/packages/react/NysCheckbox.js +4 -0
- package/packages/react/NysDropdownMenu.d.ts +4 -2
- package/packages/react/NysFileinput.d.ts +2 -2
- package/packages/react/NysGlobalFooter.d.ts +17 -0
- package/packages/react/NysGlobalFooter.js +10 -2
- package/packages/react/NysGlobalHeader.d.ts +17 -0
- package/packages/react/NysGlobalHeader.js +11 -2
- package/packages/react/NysIconlist.d.ts +54 -0
- package/packages/react/NysIconlist.js +22 -0
- package/packages/react/NysIconlistitem.d.ts +59 -0
- package/packages/react/NysIconlistitem.js +22 -0
- package/packages/react/NysLabel.d.ts +4 -1
- package/packages/react/NysModal.d.ts +8 -1
- package/packages/react/NysModal.js +11 -2
- package/packages/react/NysProcesslist.d.ts +65 -0
- package/packages/react/NysProcesslist.js +25 -0
- package/packages/react/NysProcesslistitem.d.ts +61 -0
- package/packages/react/NysProcesslistitem.js +35 -0
- package/packages/react/NysRadiobutton.d.ts +27 -3
- package/packages/react/NysRadiobutton.js +9 -1
- package/packages/react/NysSelect.d.ts +3 -0
- package/packages/react/NysSelect.js +2 -0
- package/packages/react/NysStepper.d.ts +1 -1
- package/packages/react/NysTabgroup.d.ts +5 -4
- package/packages/react/NysTable.d.ts +1 -1
- package/packages/react/NysTabpanel.d.ts +11 -4
- package/packages/react/NysTextarea.d.ts +4 -1
- package/packages/react/NysTextarea.js +2 -0
- package/packages/react/NysUnavFooter.d.ts +13 -0
- package/packages/react/NysUnavFooter.js +4 -1
- package/packages/react/NysUnavHeader.d.ts +24 -1
- package/packages/react/NysUnavHeader.js +17 -1
- package/packages/react/NysVerticalnav.d.ts +67 -0
- package/packages/react/NysVerticalnav.js +26 -0
- package/packages/react/NysVerticalnavGroup.d.ts +76 -0
- package/packages/react/NysVerticalnavGroup.js +43 -0
- package/packages/react/index.d.ts +7 -0
- package/packages/react/index.js +7 -0
- package/packages/react/nysds-jsx.d.ts +404 -46
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NysFormControlElement } from "@nysds/internals";
|
|
2
|
+
import "@nysds/nys-label";
|
|
3
|
+
import "@nysds/nys-errormessage";
|
|
4
|
+
import "@nysds/nys-button";
|
|
5
|
+
import "@nysds/nys-icon";
|
|
2
6
|
/**
|
|
3
7
|
* A text input for collecting short, single-line data. Supports validation, input masking (tel),
|
|
4
8
|
* password visibility toggle, and live error messaging. Form-associated via ElementInternals.
|
|
@@ -17,29 +21,88 @@ import { LitElement } from "lit";
|
|
|
17
21
|
* @fires nys-focus - Fired when input gains focus.
|
|
18
22
|
* @fires nys-blur - Fired when input loses focus. Triggers validation.
|
|
19
23
|
*
|
|
20
|
-
* @example Basic
|
|
24
|
+
* @example Basic
|
|
21
25
|
* ```html
|
|
22
|
-
* <nys-textinput label="Full Name"
|
|
26
|
+
* <nys-textinput label="Full Name"></nys-textinput>
|
|
23
27
|
* ```
|
|
24
28
|
*
|
|
25
|
-
* @example
|
|
29
|
+
* @example Disabled
|
|
26
30
|
* ```html
|
|
27
|
-
* <nys-textinput
|
|
31
|
+
* <nys-textinput label="Email Address" disabled></nys-textinput>
|
|
28
32
|
* ```
|
|
29
33
|
*
|
|
30
|
-
* @example
|
|
34
|
+
* @example Readonly
|
|
31
35
|
* ```html
|
|
32
|
-
* <nys-textinput
|
|
36
|
+
* <nys-textinput label="Email Address" readonly value="You can see me but not edit me"></nys-textinput>
|
|
33
37
|
* ```
|
|
34
38
|
*
|
|
35
|
-
* @example
|
|
39
|
+
* @example Required
|
|
36
40
|
* ```html
|
|
37
|
-
* <nys-textinput
|
|
38
|
-
*
|
|
41
|
+
* <nys-textinput label="Email Address" required></nys-textinput>
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @example Optional
|
|
45
|
+
* ```html
|
|
46
|
+
* <nys-textinput label="Email Address" optional></nys-textinput>
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @example Width Small
|
|
50
|
+
* ```html
|
|
51
|
+
* <nys-textinput label="Zip Code" width="sm"></nys-textinput>
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @example Width Medium
|
|
55
|
+
* ```html
|
|
56
|
+
* <nys-textinput label="City" width="md"></nys-textinput>
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @example Width Large
|
|
60
|
+
* ```html
|
|
61
|
+
* <nys-textinput label="Email Address" width="lg"></nys-textinput>
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @example Description
|
|
65
|
+
* ```html
|
|
66
|
+
* <nys-textinput label="Email Address" description="Only valid ny.gov emails are accepted."></nys-textinput>
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @example Description Slot
|
|
70
|
+
* ```html
|
|
71
|
+
* <nys-textinput label="Email Address">
|
|
72
|
+
* <div slot="description">Only valid <strong>ny.gov</strong> emails are accepted.</div>
|
|
73
|
+
* </nys-textinput>
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* @example Masking
|
|
77
|
+
* ```html
|
|
78
|
+
* <nys-textinput type="tel" label="Phone Number">
|
|
79
|
+
* <div slot="description">Some types, such as <code>tel</code> have automatic masking available.</div>
|
|
80
|
+
* </nys-textinput>
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* @example Password
|
|
84
|
+
* ```html
|
|
85
|
+
* <nys-textinput type="password"></nys-textinput>
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* @example Max Min Values
|
|
89
|
+
* ```html
|
|
90
|
+
* <nys-textinput type="number" label="Age" min="18" max="99" width="sm"></nys-textinput>
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @example Suffix Button
|
|
94
|
+
* ```html
|
|
95
|
+
* <nys-textinput id="search-demo" type="search" placeholder="Search">
|
|
96
|
+
* <nys-button
|
|
97
|
+
* slot="endButton"
|
|
98
|
+
* ariaLabel="Search"
|
|
99
|
+
* prefixIcon="search"
|
|
100
|
+
* onclick="alert('searching for: ' + document.getElementById('search-demo').value)"
|
|
101
|
+
* ></nys-button>
|
|
39
102
|
* </nys-textinput>
|
|
40
103
|
* ```
|
|
41
104
|
*/
|
|
42
|
-
export declare class NysTextinput extends
|
|
105
|
+
export declare class NysTextinput extends NysFormControlElement {
|
|
43
106
|
static styles: import("lit").CSSResult;
|
|
44
107
|
static shadowRootOptions: {
|
|
45
108
|
delegatesFocus: boolean;
|
|
@@ -105,14 +168,13 @@ export declare class NysTextinput extends LitElement {
|
|
|
105
168
|
private showPassword;
|
|
106
169
|
private _originalErrorMessage;
|
|
107
170
|
private _hasUserInteracted;
|
|
108
|
-
private _internals;
|
|
109
171
|
private _maskPatterns;
|
|
110
172
|
/**
|
|
111
173
|
* Lifecycle methods
|
|
112
174
|
* --------------------------------------------------------------------------
|
|
175
|
+
* Form association, ElementInternals, and id generation are provided by
|
|
176
|
+
* NysFormControlElement (@nysds/internals).
|
|
113
177
|
*/
|
|
114
|
-
static formAssociated: boolean;
|
|
115
|
-
constructor();
|
|
116
178
|
connectedCallback(): void;
|
|
117
179
|
disconnectedCallback(): void;
|
|
118
180
|
firstUpdated(): Promise<void>;
|
|
@@ -133,6 +195,7 @@ export declare class NysTextinput extends LitElement {
|
|
|
133
195
|
checkValidity(): boolean;
|
|
134
196
|
private _handleInvalid;
|
|
135
197
|
private _togglePasswordVisibility;
|
|
198
|
+
private _clearSearch;
|
|
136
199
|
private _updateOverlay;
|
|
137
200
|
private _applyMask;
|
|
138
201
|
/**
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NysFormControlElement } from "@nysds/internals";
|
|
2
|
+
import "@nysds/nys-label";
|
|
3
|
+
import "@nysds/nys-icon";
|
|
2
4
|
/**
|
|
3
5
|
* A toggle switch for binary settings with immediate effect. Form-associated via ElementInternals.
|
|
4
6
|
*
|
|
@@ -14,17 +16,53 @@ import { LitElement } from "lit";
|
|
|
14
16
|
* @fires nys-focus - Fired when toggle gains focus.
|
|
15
17
|
* @fires nys-blur - Fired when toggle loses focus.
|
|
16
18
|
*
|
|
17
|
-
* @example Basic
|
|
19
|
+
* @example Basic
|
|
18
20
|
* ```html
|
|
19
|
-
* <nys-toggle label="Enable notifications" name="notifications"></nys-toggle>
|
|
21
|
+
* <nys-toggle label="Enable notifications" name="notifications" value="enabled-notifications"></nys-toggle>
|
|
20
22
|
* ```
|
|
21
23
|
*
|
|
22
|
-
* @example
|
|
24
|
+
* @example Checked
|
|
23
25
|
* ```html
|
|
24
|
-
* <nys-toggle label="Dark
|
|
26
|
+
* <nys-toggle label="Dark Mode" name="theme" value="dark" checked></nys-toggle>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @example Disabled
|
|
30
|
+
* ```html
|
|
31
|
+
* <nys-toggle label="Opt Out of emails" name="toggle-switch" value="emails" disabled></nys-toggle>
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @example Hide Icon
|
|
35
|
+
* ```html
|
|
36
|
+
* <nys-toggle label="No icon on the toggle knob" name="icon" value="no-icon" noIcon></nys-toggle>
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @example Size small
|
|
40
|
+
* ```html
|
|
41
|
+
* <nys-toggle label="Tiny but mighty" name="sm-size" value="sm-size" size="sm"></nys-toggle>
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @example Description
|
|
45
|
+
* ```html
|
|
46
|
+
* <nys-toggle
|
|
47
|
+
* label="Opt Out of emails"
|
|
48
|
+
* description="An email address is recommended to be on file for contact information."
|
|
49
|
+
* name="toggle-switch"
|
|
50
|
+
* value="emails"
|
|
51
|
+
* ></nys-toggle>
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @example Description Slot
|
|
55
|
+
* ```html
|
|
56
|
+
* <nys-toggle
|
|
57
|
+
* label="Opt Out of emails"
|
|
58
|
+
* name="toggle-switch"
|
|
59
|
+
* value="emails"
|
|
60
|
+
* >
|
|
61
|
+
* <p slot="description">We <strong>REALLY</strong> encourage you to keep emails enabled for contact purposes.</p>
|
|
62
|
+
* </nys-toggle>
|
|
25
63
|
* ```
|
|
26
64
|
*/
|
|
27
|
-
export declare class NysToggle extends
|
|
65
|
+
export declare class NysToggle extends NysFormControlElement {
|
|
28
66
|
static styles: import("lit").CSSResult;
|
|
29
67
|
static shadowRootOptions: {
|
|
30
68
|
delegatesFocus: boolean;
|
|
@@ -59,14 +97,13 @@ export declare class NysToggle extends LitElement {
|
|
|
59
97
|
* @default "md"
|
|
60
98
|
*/
|
|
61
99
|
size: "sm" | "md";
|
|
62
|
-
private _internals;
|
|
63
100
|
/**
|
|
64
101
|
* Lifecycle methods
|
|
65
102
|
* --------------------------------------------------------------------------
|
|
103
|
+
* Form association, ElementInternals, and id generation are provided by
|
|
104
|
+
* NysFormControlElement (@nysds/internals). super.connectedCallback() assigns
|
|
105
|
+
* an id (prefix = localName) when one is not provided.
|
|
66
106
|
*/
|
|
67
|
-
static formAssociated: boolean;
|
|
68
|
-
constructor();
|
|
69
|
-
connectedCallback(): void;
|
|
70
107
|
/**
|
|
71
108
|
* Form Integration
|
|
72
109
|
* --------------------------------------------------------------------------
|
|
@@ -1,26 +1,58 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NysElement } from "@nysds/internals";
|
|
2
2
|
/**
|
|
3
3
|
* Shows contextual help text on hover/focus. Auto-positions to stay within viewport and supports keyboard dismiss.
|
|
4
4
|
*
|
|
5
5
|
* Link to a trigger element via `for` attribute matching the trigger's `id`. Tooltip appears on hover or focus
|
|
6
6
|
* and dismisses on blur, mouse leave, or Escape key. Use for supplementary info only—not critical content.
|
|
7
7
|
*
|
|
8
|
+
* @accessibility
|
|
9
|
+
* - Linked to trigger element via `for` attribute (must match trigger's `id`).
|
|
10
|
+
* - `role="tooltip"` with dynamic `aria-hidden` based on visibility.
|
|
11
|
+
* - Keyboard accessible: Tab to trigger, Enter/Space shows tooltip, Escape dismisses.
|
|
12
|
+
* - Screen readers announce tooltip text when visible.
|
|
13
|
+
* - Visual focus indicators on trigger elements meet WCAG 2.2 AA standards.
|
|
14
|
+
* - Auto-positioning respects viewport bounds to prevent content loss.
|
|
15
|
+
*
|
|
8
16
|
* @summary Contextual tooltip with auto-positioning, keyboard support, and screen reader integration.
|
|
9
17
|
* @element nys-tooltip
|
|
10
18
|
*
|
|
11
|
-
* @example
|
|
19
|
+
* @example Basic
|
|
20
|
+
* ```html
|
|
21
|
+
* <div style="display: flex; justify-content: center; gap: 5px; padding: 40px;">
|
|
22
|
+
* <nys-tooltip for="my-button" text="I am a tooltip."></nys-tooltip>
|
|
23
|
+
* <nys-button id="my-button" label="Hover Me"></nys-button>
|
|
24
|
+
* </div>
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example Position
|
|
12
28
|
* ```html
|
|
13
|
-
* <
|
|
14
|
-
*
|
|
29
|
+
* <div style="display: flex; justify-content: center; gap: 5px; padding: 40px;">
|
|
30
|
+
* <p>Hover over the icon</p>
|
|
31
|
+
* <nys-tooltip
|
|
32
|
+
* for="my-icon2"
|
|
33
|
+
* text="I am a tooltip."
|
|
34
|
+
* position="right"
|
|
35
|
+
* >
|
|
36
|
+
* </nys-tooltip>
|
|
37
|
+
* <nys-icon id="my-icon2" name="info" size="3xl"></nys-icon>
|
|
38
|
+
* </div>
|
|
15
39
|
* ```
|
|
16
40
|
*
|
|
17
|
-
* @example
|
|
41
|
+
* @example Inverted
|
|
18
42
|
* ```html
|
|
19
|
-
* <
|
|
20
|
-
*
|
|
43
|
+
* <div style="background-color: #1b1b1b; color: #ffffff; padding: 40px; display: flex; gap: 5px">
|
|
44
|
+
* <p>Hover over the icon</p>
|
|
45
|
+
* <nys-tooltip
|
|
46
|
+
* for="my-tooltip3"
|
|
47
|
+
* text="I am a tooltip."
|
|
48
|
+
* inverted
|
|
49
|
+
* >
|
|
50
|
+
* </nys-tooltip>
|
|
51
|
+
* <nys-icon id="my-tooltip3" name="info" size="3xl"></nys-icon>
|
|
52
|
+
* </div>
|
|
21
53
|
* ```
|
|
22
54
|
*/
|
|
23
|
-
export declare class NysTooltip extends
|
|
55
|
+
export declare class NysTooltip extends NysElement {
|
|
24
56
|
static styles: import("lit").CSSResult;
|
|
25
57
|
/** Unique identifier. Auto-generated if not provided. */
|
|
26
58
|
id: string;
|
|
@@ -69,6 +101,14 @@ export declare class NysTooltip extends LitElement {
|
|
|
69
101
|
* --------------------------------------------------------------------------
|
|
70
102
|
*/
|
|
71
103
|
private _getReferenceElement;
|
|
104
|
+
/**
|
|
105
|
+
* Programmatically associates the trigger with the tooltip via
|
|
106
|
+
* `aria-describedby`, per the WAI-ARIA Tooltip pattern. The tooltip bubble
|
|
107
|
+
* (`.nys-tooltip__content`) carries `role="tooltip"` and `id={this.id}`, so we
|
|
108
|
+
* point the trigger's `aria-describedby` at that id. Preserves any existing
|
|
109
|
+
* `aria-describedby` tokens the consumer already set, and avoids duplicates.
|
|
110
|
+
*/
|
|
111
|
+
private _associateTrigger;
|
|
72
112
|
private _passAria;
|
|
73
113
|
/**
|
|
74
114
|
* In React, the reference element found is often the native HTML element within the nys-component.
|
|
@@ -1,25 +1,66 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NysElement } from "@nysds/internals";
|
|
2
2
|
/**
|
|
3
3
|
* Universal NYS footer with logo and statewide navigation links. Required on all NYS sites.
|
|
4
4
|
*
|
|
5
5
|
* Place as the last element before `</body>`. Displays NY.gov logo and links to Agencies,
|
|
6
6
|
* App Directory, Counties, Events, Programs, and Services. No configuration needed.
|
|
7
7
|
*
|
|
8
|
+
* @accessibility
|
|
9
|
+
* - Uses semantic `<footer>` element for assistive technology recognition.
|
|
10
|
+
* - All links are keyboard-navigable via Tab.
|
|
11
|
+
* - Proper link text for screen reader users.
|
|
12
|
+
* - Links open in same window (no target="_blank") unless external policy requires otherwise.
|
|
13
|
+
* - Visual design meets WCAG 2.2 AA contrast and focus indicator standards.
|
|
14
|
+
* - Footer is not hidden from screen readers and is announced as navigation.
|
|
15
|
+
*
|
|
16
|
+
*
|
|
8
17
|
* @summary Universal NYS footer with logo and statewide links. Required site-wide.
|
|
9
18
|
* @element nys-unavfooter
|
|
10
19
|
*
|
|
11
|
-
* @example
|
|
20
|
+
* @example Basic
|
|
12
21
|
* ```html
|
|
13
|
-
* <nys-globalfooter>...</nys-globalfooter>
|
|
14
22
|
* <nys-unavfooter></nys-unavfooter>
|
|
15
23
|
* ```
|
|
24
|
+
*
|
|
25
|
+
* @example Custom landmark label
|
|
26
|
+
* ```html
|
|
27
|
+
* <!-- Renames the contentinfo landmark. Keep it distinct from the agency footer's. -->
|
|
28
|
+
* <nys-unavfooter landmarkLabel="Statewide"></nys-unavfooter>
|
|
29
|
+
* ```
|
|
16
30
|
*/
|
|
17
|
-
export declare class NysUnavFooter extends
|
|
31
|
+
export declare class NysUnavFooter extends NysElement {
|
|
18
32
|
static styles: import("lit").CSSResult;
|
|
33
|
+
/**
|
|
34
|
+
* Accessible name for the `contentinfo` landmark this footer renders.
|
|
35
|
+
* Defaults to `"New York State"`.
|
|
36
|
+
*
|
|
37
|
+
* A page pairing this footer with `nys-globalfooter` carries two `contentinfo`
|
|
38
|
+
* landmarks; distinct names are what keep landmark navigation useful instead of
|
|
39
|
+
* announcing "content information" twice. Override only when your wording is
|
|
40
|
+
* clearer for your audience — and keep it distinct from the agency footer's
|
|
41
|
+
* name, which comes from that footer's visible heading.
|
|
42
|
+
*
|
|
43
|
+
* A blank value falls back to the default rather than leaving the landmark
|
|
44
|
+
* unnamed.
|
|
45
|
+
*
|
|
46
|
+
* @default "New York State"
|
|
47
|
+
*/
|
|
48
|
+
landmarkLabel: string;
|
|
49
|
+
/**
|
|
50
|
+
* Lifecycle methods
|
|
51
|
+
* --------------------------------------------------------------------------
|
|
52
|
+
*/
|
|
53
|
+
connectedCallback(): void;
|
|
19
54
|
/**
|
|
20
55
|
* Functions
|
|
21
56
|
* --------------------------------------------------------------------------
|
|
22
57
|
*/
|
|
23
58
|
private _getNysLogo;
|
|
59
|
+
/**
|
|
60
|
+
* The contentinfo's accessible name. A blank override would put the page back
|
|
61
|
+
* where #1795 found it — two unnamed contentinfo landmarks — so it falls back
|
|
62
|
+
* to the default.
|
|
63
|
+
*/
|
|
64
|
+
private get _landmarkLabel();
|
|
24
65
|
render(): import("lit-html").TemplateResult<1>;
|
|
25
66
|
}
|
|
@@ -1,4 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type PropertyValues } from "lit";
|
|
2
|
+
import { NysElement } from "@nysds/internals";
|
|
3
|
+
import "@nysds/nys-button";
|
|
4
|
+
import "@nysds/nys-icon";
|
|
5
|
+
import "@nysds/nys-textinput";
|
|
6
|
+
import "@nysds/nys-alert";
|
|
7
|
+
interface Language {
|
|
8
|
+
code: string;
|
|
9
|
+
label: string;
|
|
10
|
+
url?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Statewide alert endpoint, read once per page load. Sites don't opt in or out and
|
|
14
|
+
* never author the content, so an alert reads identically everywhere it appears.
|
|
15
|
+
*
|
|
16
|
+
* Production is https://alerts-cta.static-assets.ny.gov/alerts.json.
|
|
17
|
+
* For dev testing use: https://alerts-cta-dev.static-assets.ny.gov/alerts.json
|
|
18
|
+
*/
|
|
19
|
+
export declare const NYS_ALERT_URL = "https://alerts-cta.static-assets.ny.gov/alerts.json";
|
|
2
20
|
/**
|
|
3
21
|
* Universal NYS header with trust bar, logo, search, and language translation. Required on all NYS sites.
|
|
4
22
|
*
|
|
@@ -6,30 +24,87 @@ import { LitElement } from "lit";
|
|
|
6
24
|
* site search (searches ny.gov), and 14-language translation dropdown. Use `hideSearch` or `hideTranslate`
|
|
7
25
|
* to remove features if not applicable.
|
|
8
26
|
*
|
|
27
|
+
* @accessibility
|
|
28
|
+
* - Semantic `<header>` element ensures assistive technology recognition.
|
|
29
|
+
* - Trust bar button: `role="button"`, `aria-expanded`, descriptive `aria-label`.
|
|
30
|
+
* - All links and buttons are keyboard-navigable via Tab.
|
|
31
|
+
* - Translate control: the WAI-ARIA APG menu button pattern. A real button carries
|
|
32
|
+
* `aria-expanded`, `aria-haspopup="menu"`, and `aria-controls` pointing at a
|
|
33
|
+
* `role="menu"` list of `role="menuitem"` options. The menu is display-hidden when
|
|
34
|
+
* closed, so its options only enter the tab order once it opens.
|
|
35
|
+
* - Translate keyboard model: Down/Up on the trigger open the menu on its first/last
|
|
36
|
+
* option; inside the menu Down/Up step and wrap, Home/End jump to either end,
|
|
37
|
+
* Enter/Space pick an option, and Escape closes the menu and returns focus to the
|
|
38
|
+
* trigger. A roving tabindex keeps the open menu to a single tab stop.
|
|
39
|
+
* - Each language option carries the BCP 47 `lang` of the language it names, so its
|
|
40
|
+
* label is announced in that language rather than the page's.
|
|
41
|
+
* - Search input announces field purpose and keyboard shortcuts (Enter to submit, Escape to dismiss).
|
|
42
|
+
* - Visual focus indicators meet WCAG 2.2 AA standards.
|
|
43
|
+
* - All text has sufficient color contrast (4.5:1 minimum).
|
|
44
|
+
* - Icons have text labels or `aria-label` attributes.
|
|
45
|
+
*
|
|
9
46
|
* @summary Universal NYS header with trust bar, search, and translation. Required site-wide.
|
|
10
47
|
* @element nys-unavheader
|
|
11
48
|
*
|
|
49
|
+
* @remarks Statewide alerts are not configurable. On load the header reads the statewide
|
|
50
|
+
* alert endpoint and renders whatever is currently published, so an emergency message
|
|
51
|
+
* reaches every NYS site with no per-site work. If the endpoint is unreachable or nothing
|
|
52
|
+
* is published, the header renders normally. It takes no children.
|
|
53
|
+
*
|
|
12
54
|
* @fires nys-language-select - Fired when a language is selected. Detail: `{language: {code, label, url?}}`. Cancelable; `preventDefault()` overrides the default Smartling redirect.
|
|
13
55
|
* @fires nys-search-submit - Fired when a search is submitted. Detail: `{query}`. Cancelable; `preventDefault()` overrides the default search redirect.
|
|
14
|
-
|
|
15
56
|
*
|
|
16
|
-
* @example
|
|
57
|
+
* @example Basic
|
|
17
58
|
* ```html
|
|
18
59
|
* <nys-unavheader></nys-unavheader>
|
|
19
|
-
* <nys-globalheader>...</nys-globalheader>
|
|
20
60
|
* ```
|
|
21
61
|
*
|
|
22
|
-
* @example
|
|
62
|
+
* @example Hide search
|
|
23
63
|
* ```html
|
|
24
64
|
* <nys-unavheader hideSearch></nys-unavheader>
|
|
25
65
|
* ```
|
|
66
|
+
*
|
|
67
|
+
* @example Hide translate
|
|
68
|
+
* ```html
|
|
69
|
+
* <nys-unavheader hideTranslate></nys-unavheader>
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @example Custom landmark label
|
|
73
|
+
* ```html
|
|
74
|
+
* <!-- Renames the banner landmark. Keep it distinct from the agency header's. -->
|
|
75
|
+
* <nys-unavheader landmarkLabel="Statewide"></nys-unavheader>
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* @example Custom Search URL
|
|
79
|
+
* ```html
|
|
80
|
+
* <nys-unavheader searchUrl="https://designsystem.ny.gov/search/?q="></nys-unavheader>
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* @example Custom Language List
|
|
84
|
+
* ```html
|
|
85
|
+
* <nys-unavheader id="my-header"></nys-unavheader>
|
|
86
|
+
* <script>
|
|
87
|
+
* const header = document.querySelector('#my-header');
|
|
88
|
+
* header.languages = [
|
|
89
|
+
* { code: 'en', label: 'English' },
|
|
90
|
+
* { code: 'es', label: 'Español' , url: '"https://ny.gov/?lang=es"'},
|
|
91
|
+
* { code: 'fr', label: 'Français', url: '"https://ny.gov/?lang=fr"'},
|
|
92
|
+
* ];
|
|
93
|
+
* </script>
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* @example Custom Language List JS
|
|
97
|
+
* ```html
|
|
98
|
+
* <nys-unavheader id="my-header2"></nys-unavheader>
|
|
99
|
+
* <script>
|
|
100
|
+
* document.querySelector('#my-header2').addEventListener('nys-language-select', (event) => {
|
|
101
|
+
* event.preventDefault();
|
|
102
|
+
* const selectedLanguage = event.detail.language.label;
|
|
103
|
+
* });
|
|
104
|
+
* </script>
|
|
105
|
+
* ```
|
|
26
106
|
*/
|
|
27
|
-
|
|
28
|
-
code: string;
|
|
29
|
-
label: string;
|
|
30
|
-
url?: string;
|
|
31
|
-
}
|
|
32
|
-
export declare class NysUnavHeader extends LitElement {
|
|
107
|
+
export declare class NysUnavHeader extends NysElement {
|
|
33
108
|
static styles: import("lit").CSSResult;
|
|
34
109
|
/** Internal: Whether trust bar panel is expanded. */
|
|
35
110
|
trustbarVisible: boolean;
|
|
@@ -45,28 +120,158 @@ export declare class NysUnavHeader extends LitElement {
|
|
|
45
120
|
hideSearch: boolean;
|
|
46
121
|
/** The URL endpoint of the search, make sure to include the query param. */
|
|
47
122
|
searchUrl: string;
|
|
123
|
+
/**
|
|
124
|
+
* Accessible name for the `banner` landmark this header renders.
|
|
125
|
+
* Defaults to `"New York State"`.
|
|
126
|
+
*
|
|
127
|
+
* A page pairing this header with `nys-globalheader` carries two `banner`
|
|
128
|
+
* landmarks; distinct names are what keep landmark navigation useful instead of
|
|
129
|
+
* announcing "banner, banner". Override only when your wording is clearer for
|
|
130
|
+
* your audience — and keep it distinct from the agency header's name, which
|
|
131
|
+
* comes from that header's visible title.
|
|
132
|
+
*
|
|
133
|
+
* A blank value falls back to the default rather than leaving the landmark
|
|
134
|
+
* unnamed.
|
|
135
|
+
*
|
|
136
|
+
* @default "New York State"
|
|
137
|
+
*/
|
|
138
|
+
landmarkLabel: string;
|
|
48
139
|
/** The list of languages this site can be translated to, default to use Smartling */
|
|
49
140
|
languages: Language[];
|
|
50
141
|
/**
|
|
51
142
|
* Lifecycle Methods
|
|
52
143
|
* --------------------------------------------------------------------------
|
|
144
|
+
* connectedCallback is inherited from NysElement, which assigns an
|
|
145
|
+
* auto-generated host id (prefix "nys-unavheader") when none is provided. The
|
|
146
|
+
* banner landmark intentionally lives on the inner <header> element, so this
|
|
147
|
+
* component keeps defaultRole = null and does not move a role onto the host.
|
|
53
148
|
*/
|
|
54
149
|
connectedCallback(): void;
|
|
55
150
|
disconnectedCallback(): void;
|
|
151
|
+
protected updated(changed: PropertyValues): void;
|
|
56
152
|
/**
|
|
57
153
|
* Functions
|
|
58
154
|
* --------------------------------------------------------------------------
|
|
59
155
|
*/
|
|
60
156
|
private _getNysLogo;
|
|
61
157
|
private _toggleTrustbar;
|
|
158
|
+
/**
|
|
159
|
+
* The translate menu — WAI-ARIA APG "Menu Button"
|
|
160
|
+
* --------------------------------------------------------------------------
|
|
161
|
+
* The options are actions, not links: picking one fires a cancelable
|
|
162
|
+
* `nys-language-select` and, unless the page handles it, redirects. That, plus a
|
|
163
|
+
* trigger already declaring `aria-haspopup`/`aria-expanded`/`aria-controls`, makes
|
|
164
|
+
* this a menu button rather than a disclosure navigation menu — and it is the same
|
|
165
|
+
* shape `nys-dropdownmenu` uses, so #1412's eventual move onto that component
|
|
166
|
+
* won't change a single ARIA attribute.
|
|
167
|
+
*
|
|
168
|
+
* Focus moves by roving tabindex, not `aria-activedescendant`. Each option's
|
|
169
|
+
* `role="menuitem"` sits on the real `<button>` inside a `nys-button`'s shadow
|
|
170
|
+
* root, and `aria-activedescendant` is an IDREF — it cannot reach across a shadow
|
|
171
|
+
* boundary.
|
|
172
|
+
*/
|
|
173
|
+
/** Which translate trigger opened the menu, so Escape can return focus to it. */
|
|
174
|
+
private _translateTrigger;
|
|
175
|
+
/** Index of the option holding the menu's single tab stop. */
|
|
176
|
+
private _activeOption;
|
|
177
|
+
/**
|
|
178
|
+
* Where focus lands when the menu opens, set only by a keyboard activation. A
|
|
179
|
+
* mouse open leaves focus on the trigger: moving it would put a focus ring on an
|
|
180
|
+
* option the pointer user never asked for.
|
|
181
|
+
*/
|
|
182
|
+
private _openWithFocus;
|
|
62
183
|
private _toggleLanguageList;
|
|
184
|
+
/**
|
|
185
|
+
* Closes the menu and puts focus back on the trigger. The open list is the only
|
|
186
|
+
* thing keeping the language buttons focusable, so closing it while focus sits on
|
|
187
|
+
* one would drop focus to the top of the page (WCAG 2.4.3).
|
|
188
|
+
*/
|
|
189
|
+
private _closeLanguageList;
|
|
190
|
+
/**
|
|
191
|
+
* `nys-button` renders the real `<button>` inside its own shadow root, so an
|
|
192
|
+
* `aria-expanded` written on the host never reaches the element that carries the
|
|
193
|
+
* button role — assistive tech was never told the translate menu collapses. Mirror
|
|
194
|
+
* the state onto the inner control, the same way `nys-dropdownmenu` does for its
|
|
195
|
+
* trigger (WCAG 4.1.2).
|
|
196
|
+
*/
|
|
197
|
+
private _syncTranslateTriggerAria;
|
|
198
|
+
/** The language options, in the order they are rendered. */
|
|
199
|
+
private _languageOptions;
|
|
200
|
+
/**
|
|
201
|
+
* Menu semantics for the options, and the same shadow-root problem as the trigger:
|
|
202
|
+
* `role="menuitem"` and the tab stop have to land on the real `<button>`, not on
|
|
203
|
+
* the `nys-button` host. The hosts carry `role="presentation"` in the template so
|
|
204
|
+
* they don't sit between the menu and its items in the accessibility tree.
|
|
205
|
+
*/
|
|
206
|
+
private _syncLanguageMenuAria;
|
|
207
|
+
/**
|
|
208
|
+
* Moves both focus and the tab stop to an option, wrapping at either end. Index
|
|
209
|
+
* -1 is the last option, so "previous from the first" and "End" are the same call.
|
|
210
|
+
*/
|
|
211
|
+
private _focusOption;
|
|
63
212
|
private _toggleSearchDropdown;
|
|
64
213
|
private _handleLanguageSelect;
|
|
214
|
+
/**
|
|
215
|
+
* Keyboard model for the translate menu (APG menu button):
|
|
216
|
+
* - on the trigger: Down/Up open the menu on its first/last option, Enter/Space
|
|
217
|
+
* open it on the first option, Escape closes it
|
|
218
|
+
* - in the menu: Down/Up step and wrap, Home/End jump to either end, Enter/Space
|
|
219
|
+
* pick the option (native `<button>` activation), Escape closes the menu and
|
|
220
|
+
* returns focus to the trigger
|
|
221
|
+
*
|
|
222
|
+
* Type-ahead is deliberately left out. Each label is written in its own script, so
|
|
223
|
+
* matching typed characters would mean transliteration plus an IME to be usable —
|
|
224
|
+
* "e" finds nothing in "Español" for anyone who would need it. The pattern lists
|
|
225
|
+
* type-ahead as optional.
|
|
226
|
+
*/
|
|
227
|
+
private _handleTranslateKeydown;
|
|
228
|
+
private _handleTriggerKeydown;
|
|
229
|
+
private _handleOptionKeydown;
|
|
230
|
+
/**
|
|
231
|
+
* Focus leaving the menu closes it — that is what Tab and Shift+Tab do under the
|
|
232
|
+
* menu button pattern, and it also covers clicking away. Closing without touching
|
|
233
|
+
* focus is the point here: the browser is already moving it somewhere else.
|
|
234
|
+
*/
|
|
235
|
+
private _handleTranslateFocusout;
|
|
65
236
|
private _handleSearchFocus;
|
|
66
237
|
private _handleSearchBlur;
|
|
67
238
|
private _handleSearchKeyup;
|
|
68
239
|
private _handleSearchButton;
|
|
69
240
|
private _handleSearch;
|
|
241
|
+
/**
|
|
242
|
+
* Statewide alerts
|
|
243
|
+
* --------------------------------------------------------------------------
|
|
244
|
+
* Content comes from the alert feed, never from the consuming page, so the same
|
|
245
|
+
* message renders identically everywhere it is shown. A missing, malformed, or
|
|
246
|
+
* unreachable feed leaves the header untouched — an alert failing to load must
|
|
247
|
+
* never take a site's navigation down with it.
|
|
248
|
+
*/
|
|
249
|
+
/** The published alerts, in feed order. Empty when nothing is published. */
|
|
250
|
+
private _alerts;
|
|
251
|
+
/** In-flight feed request, aborted if the header leaves the page first. */
|
|
252
|
+
private _alertRequest;
|
|
253
|
+
private _loadAlerts;
|
|
254
|
+
/** Fetches the alert feed. Resolves to null on any failure. */
|
|
255
|
+
private _readFeed;
|
|
256
|
+
/** Feed severity → `nys-alert` type. */
|
|
257
|
+
private _alertType;
|
|
258
|
+
/**
|
|
259
|
+
* Feed icon name → `nys-icon` name. Unknown names resolve to "", which leaves
|
|
260
|
+
* `nys-alert` to draw the default icon for the alert's type.
|
|
261
|
+
*/
|
|
262
|
+
private _alertIcon;
|
|
263
|
+
/**
|
|
264
|
+
* One full-bleed band per published alert, so alerts of different severities keep
|
|
265
|
+
* their own background instead of sharing one. The body is slotted rather than
|
|
266
|
+
* passed as `text`/`primaryAction` so the link can carry the feed's `linkAriaLabel`.
|
|
267
|
+
*/
|
|
268
|
+
private _renderAlerts;
|
|
269
|
+
private _renderAlert;
|
|
270
|
+
/**
|
|
271
|
+
* The banner's accessible name. A blank override would put the page back where
|
|
272
|
+
* #1795 found it — two unnamed banners — so it falls back to the default.
|
|
273
|
+
*/
|
|
274
|
+
private get _landmarkLabel();
|
|
70
275
|
render(): import("lit-html").TemplateResult<1>;
|
|
71
276
|
}
|
|
72
277
|
export {};
|