@nysds/components 1.20.0-alpha1 → 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 +7119 -3701
- package/dist/.vscode/vscode.css-custom-data.json +5 -0
- package/dist/.vscode/vscode.html-custom-data.json +317 -38
- package/dist/custom-elements.json +7119 -3701
- 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 +9119 -4161
- package/dist/nysds.es.js.map +1 -1
- package/dist/nysds.js +2413 -492
- 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 +37 -12
- package/dist/packages/nys-checkbox/src/nys-checkboxgroup.d.ts +84 -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 +129 -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 +197 -7
- 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 +219 -10
- package/dist/packages/nys-verticalnav/src/nys-verticalnav.d.ts +421 -37
- package/dist/packages/nys-verticalnav/src/nys-verticalnavgroup.d.ts +4 -54
- package/dist/packages/nys-video/src/nys-video.d.ts +67 -7
- package/dist/src/index.d.ts +5 -2
- package/package.json +15 -7
- 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 +25 -3
- package/packages/react/NysFileinput.js +8 -1
- package/packages/react/NysGlobalFooter.d.ts +17 -0
- package/packages/react/NysGlobalFooter.js +10 -2
- package/packages/react/NysGlobalHeader.d.ts +23 -1
- 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 +15 -8
- package/packages/react/NysVerticalnav.js +6 -4
- package/packages/react/NysVerticalnavGroup.d.ts +4 -0
- package/packages/react/NysVerticalnavGroup.js +5 -0
- package/packages/react/index.d.ts +5 -0
- package/packages/react/index.js +5 -0
- package/packages/react/nysds-jsx.d.ts +394 -56
|
@@ -1,29 +1,102 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NysFormControlElement } from "@nysds/internals";
|
|
2
2
|
import "./nys-fileitem";
|
|
3
|
+
import "@nysds/nys-label";
|
|
4
|
+
import "@nysds/nys-errormessage";
|
|
3
5
|
/**
|
|
4
6
|
* A file input for uploading files with support for multiple files, drag-and-drop, and progress tracking.
|
|
5
7
|
* Validates file types via magic bytes (not just extension). Form-associated via ElementInternals.
|
|
6
8
|
*
|
|
7
9
|
* Use for document uploads, image uploads, or any file submission. Enable `dropzone` for drag-and-drop UI.
|
|
8
10
|
*
|
|
11
|
+
* Read or write the current selection via the `files` (`File[]`) and `value` (`File | null`)
|
|
12
|
+
* properties — useful for rehydrating state or binding from a framework form model.
|
|
13
|
+
* Setting them is silent (does not emit `nys-change`).
|
|
14
|
+
*
|
|
9
15
|
* @summary File input with drag-and-drop, validation, and progress tracking.
|
|
10
16
|
* @element nys-fileinput
|
|
11
17
|
*
|
|
12
18
|
* @slot description - Custom HTML description content.
|
|
13
19
|
*
|
|
14
|
-
* @fires nys-change - Fired
|
|
20
|
+
* @fires nys-change - Fired once per user action (file selection, drop, or removal).
|
|
21
|
+
* Detail: `{id, files, changedFiles}`. The `files` is the full current selection
|
|
22
|
+
* Whereas `changedFiles` is the entries this action added or removed.
|
|
23
|
+
* Both `changedFiles` and each entry in `files` are `{ file: File, progress: number, status: "pending" | "processing" | "done" | "error", errorMsg?: string }`.
|
|
24
|
+
*
|
|
25
|
+
* @fires nys-blur - Fired when focus leaves the component. Triggers validation.
|
|
26
|
+
*
|
|
27
|
+
* @example Basic
|
|
28
|
+
* ```html
|
|
29
|
+
* <nys-fileinput
|
|
30
|
+
* label="Upload a file"
|
|
31
|
+
* ></nys-fileinput>
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @example Dropzone
|
|
35
|
+
* ```html
|
|
36
|
+
* <nys-fileinput
|
|
37
|
+
* label="Upload a file"
|
|
38
|
+
* dropzone
|
|
39
|
+
* ></nys-fileinput>
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @example Multiple
|
|
43
|
+
* ```html
|
|
44
|
+
* <nys-fileinput
|
|
45
|
+
* label="Upload a file"
|
|
46
|
+
* multiple
|
|
47
|
+
* ></nys-fileinput>
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @example Accepted Filetypes
|
|
51
|
+
* ```html
|
|
52
|
+
* <nys-fileinput
|
|
53
|
+
* label="Upload a file"
|
|
54
|
+
* description="Accepted file types: .jpg, .png, .pdf"
|
|
55
|
+
* accept="image/png, image/jpeg, .pdf"
|
|
56
|
+
* ></nys-fileinput>
|
|
57
|
+
* ```
|
|
15
58
|
*
|
|
16
|
-
* @example
|
|
59
|
+
* @example Width Large
|
|
17
60
|
* ```html
|
|
18
|
-
* <nys-fileinput
|
|
61
|
+
* <nys-fileinput
|
|
62
|
+
* label="Upload a file"
|
|
63
|
+
* width="lg"
|
|
64
|
+
* ></nys-fileinput>
|
|
19
65
|
* ```
|
|
20
66
|
*
|
|
21
|
-
* @example
|
|
67
|
+
* @example Width Large Dropzone
|
|
22
68
|
* ```html
|
|
23
|
-
* <nys-fileinput
|
|
69
|
+
* <nys-fileinput
|
|
70
|
+
* label="Upload a file"
|
|
71
|
+
* width="lg"
|
|
72
|
+
* dropzone
|
|
73
|
+
* ></nys-fileinput>
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* @example Disabled
|
|
77
|
+
* ```html
|
|
78
|
+
* <nys-fileinput
|
|
79
|
+
* label="Upload a file"
|
|
80
|
+
* disabled
|
|
81
|
+
* ></nys-fileinput>
|
|
82
|
+
* ```
|
|
83
|
+
*
|
|
84
|
+
* @example Description
|
|
85
|
+
* ```html
|
|
86
|
+
* <nys-fileinput
|
|
87
|
+
* label="Upload a file"
|
|
88
|
+
* description="Make sure the file is not blurry and readable"
|
|
89
|
+
* ></nys-fileinput>
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* @example Description Slot
|
|
93
|
+
* ```html
|
|
94
|
+
* <nys-fileinput label="Upload a file">
|
|
95
|
+
* <div slot="description">Make sure the file is <strong>legible</strong></div>
|
|
96
|
+
* </nys-fileinput>
|
|
24
97
|
* ```
|
|
25
98
|
*/
|
|
26
|
-
export declare class NysFileinput extends
|
|
99
|
+
export declare class NysFileinput extends NysFormControlElement {
|
|
27
100
|
static styles: import("lit").CSSResult;
|
|
28
101
|
static shadowRootOptions: {
|
|
29
102
|
delegatesFocus: boolean;
|
|
@@ -69,21 +142,63 @@ export declare class NysFileinput extends LitElement {
|
|
|
69
142
|
/** Adjusts colors for dark backgrounds. */
|
|
70
143
|
inverted: boolean;
|
|
71
144
|
private _selectedFiles;
|
|
145
|
+
/**
|
|
146
|
+
* The currently selected files. Read to get the current selection; set to
|
|
147
|
+
* replace it (e.g. rehydrating state after navigation, or binding from a
|
|
148
|
+
* framework form model). Property-only — a `File[]` cannot round-trip through
|
|
149
|
+
* an HTML attribute. Setting this is silent (does not emit `nys-change`),
|
|
150
|
+
* matching native input behavior and avoiding feedback loops in two-way bindings.
|
|
151
|
+
*/
|
|
152
|
+
get files(): File[];
|
|
153
|
+
set files(incoming: File[]);
|
|
154
|
+
/**
|
|
155
|
+
* Single-file convenience accessor (parity with `nys-textinput`'s `value`).
|
|
156
|
+
* Reads the first selected file (or `null`); setting replaces the selection.
|
|
157
|
+
*/
|
|
158
|
+
get value(): File | null;
|
|
159
|
+
set value(file: File | null);
|
|
160
|
+
/**
|
|
161
|
+
* Programmatically set the selection and await async validation/processing.
|
|
162
|
+
* Same as assigning `files`, but resolves once every file has finished its
|
|
163
|
+
* magic-byte validation and read — use when you need to read `checkValidity()`
|
|
164
|
+
* or the settled selection immediately after.
|
|
165
|
+
*/
|
|
166
|
+
setFiles(incoming: File[]): Promise<void>;
|
|
72
167
|
private _dragActive;
|
|
73
168
|
private get _isDropDisabled();
|
|
74
|
-
private get _buttonAriaLabel();
|
|
75
|
-
private get _buttonAriaDescription();
|
|
76
169
|
private get _innerNysButton();
|
|
77
|
-
private _internals;
|
|
78
170
|
/**
|
|
79
171
|
* Lifecycle methods
|
|
80
172
|
* --------------------------------------------------------------------------
|
|
173
|
+
* Form association, ElementInternals, and id generation are provided by
|
|
174
|
+
* NysFormControlElement (@nysds/internals).
|
|
81
175
|
*/
|
|
82
|
-
static formAssociated: boolean;
|
|
83
|
-
constructor();
|
|
84
176
|
connectedCallback(): void;
|
|
85
177
|
disconnectedCallback(): void;
|
|
86
178
|
firstUpdated(): void;
|
|
179
|
+
updated(): void;
|
|
180
|
+
/**
|
|
181
|
+
* Point the exposed control at the rendered <nys-errormessage> and, in
|
|
182
|
+
* dropzone mode, at the "or drag here" instructional text.
|
|
183
|
+
*
|
|
184
|
+
* The native <input type="file"> is `hidden`, `aria-hidden` and `tabindex="-1"`,
|
|
185
|
+
* so it is not in the accessibility tree and must not carry these
|
|
186
|
+
* associations. The element a user actually reaches is the <button> inside the
|
|
187
|
+
* "Choose file" <nys-button>'s shadow root — that's also the keyboard path for
|
|
188
|
+
* the dropzone (Enter/Space opens the native file picker via real button
|
|
189
|
+
* semantics); the dropzone `<div>` itself is a non-interactive, pointer-only
|
|
190
|
+
* drop target and never receives focus.
|
|
191
|
+
*
|
|
192
|
+
* The button and these targets sit in different shadow roots, so an IDREF
|
|
193
|
+
* written on the button would dangle. ARIA element reflection does cross into a
|
|
194
|
+
* shadow-including ancestor tree, so associateControlRefs sets the control's own
|
|
195
|
+
* ariaDescribedByElements (plus an aria-description string fallback for engines
|
|
196
|
+
* that expose the IDL but do not yet honor it). aria-describedby — not
|
|
197
|
+
* aria-errormessage — is what Blink actually surfaces for a control inside a
|
|
198
|
+
* shadow root; see src/scripts/verify-a11y-names.mjs. aria-errormessage is set
|
|
199
|
+
* through its element-reflection form where the engine supports it.
|
|
200
|
+
*/
|
|
201
|
+
private _syncControlErrorAssociation;
|
|
87
202
|
/**
|
|
88
203
|
* Form Integration
|
|
89
204
|
* --------------------------------------------------------------------------
|
|
@@ -101,6 +216,7 @@ export declare class NysFileinput extends LitElement {
|
|
|
101
216
|
*/
|
|
102
217
|
private _saveSelectedFiles;
|
|
103
218
|
private _processFile;
|
|
219
|
+
private _handleBlur;
|
|
104
220
|
private _dispatchChangeEvent;
|
|
105
221
|
private _openFileDialog;
|
|
106
222
|
private _handlePostFileSelectionFocus;
|
|
@@ -114,5 +230,6 @@ export declare class NysFileinput extends LitElement {
|
|
|
114
230
|
private _onDragOver;
|
|
115
231
|
private _onDragLeave;
|
|
116
232
|
private _onDrop;
|
|
233
|
+
private _addFiles;
|
|
117
234
|
render(): import("lit-html").TemplateResult<1>;
|
|
118
235
|
}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NysElement } from "@nysds/internals";
|
|
2
|
+
import "@nysds/nys-icon";
|
|
3
|
+
import "@nysds/nys-button";
|
|
2
4
|
/**
|
|
3
5
|
* **Internal component.** Displays an individual file within `nys-fileinput` with status and progress.
|
|
4
6
|
*
|
|
5
7
|
* Rendered automatically by `nys-fileinput` for each selected file. Shows filename, upload status
|
|
6
8
|
* (pending/processing/done/error), progress bar during upload, and error messages. Remove button emits event.
|
|
7
9
|
*
|
|
10
|
+
* When `errorMessage` is set the text is rendered into an element with a stable id
|
|
11
|
+
* (`{host id}--error`) and the item references that id via `aria-errormessage` +
|
|
12
|
+
* `aria-describedby`, paired with `aria-invalid` reflecting the real status.
|
|
13
|
+
*
|
|
8
14
|
* @summary Internal file item display with status, progress bar, and remove action.
|
|
9
15
|
* @element nys-fileitem
|
|
10
16
|
*
|
|
11
17
|
* @fires nys-fileRemove - Fired when remove button is clicked. Detail: `{filename}`.
|
|
12
18
|
*/
|
|
13
|
-
export declare class NysFileItem extends
|
|
19
|
+
export declare class NysFileItem extends NysElement {
|
|
14
20
|
static styles: import("lit").CSSResult;
|
|
15
21
|
static shadowRootOptions: {
|
|
16
22
|
delegatesFocus: boolean;
|
|
@@ -31,6 +37,21 @@ export declare class NysFileItem extends LitElement {
|
|
|
31
37
|
progress: number;
|
|
32
38
|
/** Error message displayed when status is `error`. */
|
|
33
39
|
errorMessage: string;
|
|
40
|
+
/**
|
|
41
|
+
* True when this item is actually in an error state. `aria-invalid` reflects
|
|
42
|
+
* this rather than being hardcoded, so a healthy item is never announced as
|
|
43
|
+
* invalid.
|
|
44
|
+
*/
|
|
45
|
+
private get _isInvalid();
|
|
46
|
+
/** True only when the error element is rendered, so the IDREF can resolve. */
|
|
47
|
+
private get _hasErrorText();
|
|
48
|
+
/**
|
|
49
|
+
* Stable id of the element that holds the error text. `aria-errormessage` and
|
|
50
|
+
* `aria-describedby` take an IDREF, so they must point at this — never at the
|
|
51
|
+
* message text itself. Derived from the host id (auto-generated by NysElement)
|
|
52
|
+
* rather than the filename, which is not id-safe and not stable.
|
|
53
|
+
*/
|
|
54
|
+
private get _errorId();
|
|
34
55
|
private _handleRemove;
|
|
35
56
|
private splitFilename;
|
|
36
57
|
render(): import("lit-html").TemplateResult<1>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NysElement } from "@nysds/internals";
|
|
2
|
+
import "@nysds/nys-divider";
|
|
2
3
|
/**
|
|
3
4
|
* Agency-branded footer with agency name and slotted content sections. Auto-layouts based on content structure.
|
|
4
5
|
*
|
|
@@ -10,26 +11,96 @@ import { LitElement } from "lit";
|
|
|
10
11
|
*
|
|
11
12
|
* @slot - Footer content (links, contact info). Use `<h4>` for column headings.
|
|
12
13
|
*
|
|
13
|
-
* @example
|
|
14
|
+
* @example Basic
|
|
15
|
+
* ```html
|
|
16
|
+
* <nys-globalfooter agencyName="Office of Information Technology Services"></nys-globalfooter>
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @example Homepage Link
|
|
14
20
|
* ```html
|
|
15
21
|
* <nys-globalfooter
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
+
* agencyName="Office of Information Technology Services"
|
|
23
|
+
* homepageLink="https://its.ny.gov"
|
|
24
|
+
* ></nys-globalfooter>
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example Menu Links
|
|
28
|
+
* ```html
|
|
29
|
+
* <nys-globalfooter agencyName="Office of Information Technology Services">
|
|
30
|
+
* <ul>
|
|
31
|
+
* <li><a href="https://its.ny.gov">ITS Home</a></li>
|
|
32
|
+
* <li><a href="https://its.ny.gov/about-us">About ITS</a></li>
|
|
33
|
+
* </ul>
|
|
22
34
|
* </nys-globalfooter>
|
|
23
35
|
* ```
|
|
36
|
+
*
|
|
37
|
+
* @example Column Links
|
|
38
|
+
* ```html
|
|
39
|
+
* <nys-globalfooter agencyName="Office of Information Technology Services">
|
|
40
|
+
* <ul>
|
|
41
|
+
* <li>
|
|
42
|
+
* <span>About</span>
|
|
43
|
+
* <ul>
|
|
44
|
+
* <li><a href="https://its.ny.gov/about-us">About ITS</a></li>
|
|
45
|
+
* <li><a href="https://its.ny.gov/contact-us">Contact</a></li>
|
|
46
|
+
* <li><a href="https://its.ny.gov/policies">Policies</a></li>
|
|
47
|
+
* </ul>
|
|
48
|
+
* </li>
|
|
49
|
+
* <li>
|
|
50
|
+
* <span>Resources</span>
|
|
51
|
+
* <ul>
|
|
52
|
+
* <li><a href="https://its.ny.gov/resources">Developer Tools</a></li>
|
|
53
|
+
* <li><a href="https://its.ny.gov/accessibility">Accessibility</a></li>
|
|
54
|
+
* <li><a href="https://its.ny.gov/privacy">Privacy</a></li>
|
|
55
|
+
* </ul>
|
|
56
|
+
* </li>
|
|
57
|
+
* </ul>
|
|
58
|
+
* </nys-globalfooter>
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* @example Subheading
|
|
62
|
+
* ```html
|
|
63
|
+
* <nys-globalfooter
|
|
64
|
+
* agencyName="Office of Information Technology Services"
|
|
65
|
+
* agencySubheading="Innovating Technology for a Better New York"
|
|
66
|
+
* ></nys-globalfooter>
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @example Custom landmark label
|
|
70
|
+
* ```html
|
|
71
|
+
* <!-- Names the contentinfo landmark directly instead of from the visible
|
|
72
|
+
* heading. Keep it distinct from nys-unavfooter's ("New York State"). -->
|
|
73
|
+
* <nys-globalfooter
|
|
74
|
+
* agencyName="Office of Information Technology Services"
|
|
75
|
+
* landmarkLabel="ITS"
|
|
76
|
+
* ></nys-globalfooter>
|
|
77
|
+
* ```
|
|
24
78
|
*/
|
|
25
|
-
export declare class NysGlobalFooter extends
|
|
79
|
+
export declare class NysGlobalFooter extends NysElement {
|
|
26
80
|
static styles: import("lit").CSSResult;
|
|
81
|
+
/** Unique identifier. Auto-generated if not provided. */
|
|
82
|
+
id: string;
|
|
27
83
|
/** Agency name displayed as the footer heading. */
|
|
28
84
|
agencyName: string;
|
|
29
85
|
/** Optional subheading displayed below the agency name. */
|
|
30
86
|
agencySubheading: string;
|
|
31
87
|
/** URL for the agency name link. If empty, name is not clickable. */
|
|
32
88
|
homepageLink: string;
|
|
89
|
+
/**
|
|
90
|
+
* Accessible name for the `contentinfo` landmark this footer renders.
|
|
91
|
+
*
|
|
92
|
+
* Leave it unset and the landmark is named after the visible `agencyName`
|
|
93
|
+
* heading, which cannot drift out of sync and is translated with the rest of
|
|
94
|
+
* the page. Falls back to `"Site"` when there is no agency name to reference.
|
|
95
|
+
*
|
|
96
|
+
* Set this only when the agency name is not right for your audience. A page
|
|
97
|
+
* pairing this with `nys-unavfooter` carries two `contentinfo` landmarks, so
|
|
98
|
+
* the name must stay distinct from that footer's (`"New York State"` by
|
|
99
|
+
* default) or landmark navigation stops distinguishing them.
|
|
100
|
+
*
|
|
101
|
+
* An explicit name replaces the reference to the visible heading.
|
|
102
|
+
*/
|
|
103
|
+
landmarkLabel: string;
|
|
33
104
|
private slotHasContent;
|
|
34
105
|
/**
|
|
35
106
|
* Lifecycle Methods
|
|
@@ -41,5 +112,24 @@ export declare class NysGlobalFooter extends LitElement {
|
|
|
41
112
|
* --------------------------------------------------------------------------
|
|
42
113
|
*/
|
|
43
114
|
private _handleSlotChange;
|
|
115
|
+
/**
|
|
116
|
+
* Id of the heading that names the contentinfo landmark, or undefined when no
|
|
117
|
+
* agency name was given.
|
|
118
|
+
*
|
|
119
|
+
* The documented pairing puts this footer above `nys-unavfooter`, which leaves a
|
|
120
|
+
* page with two `contentinfo` landmarks. Pointing at the visible heading rather
|
|
121
|
+
* than repeating the agency name in an `aria-label` keeps the two in sync and lets
|
|
122
|
+
* the name be translated along with the rest of the page.
|
|
123
|
+
*/
|
|
124
|
+
private get _contentinfoLabelledBy();
|
|
125
|
+
/** The author's landmark name, or undefined when they gave none. */
|
|
126
|
+
private get _landmarkLabelOverride();
|
|
127
|
+
/**
|
|
128
|
+
* Literal name for the contentinfo: the author's override, or the "Site"
|
|
129
|
+
* default when there is no agency heading to reference. Undefined whenever
|
|
130
|
+
* `_contentinfoLabelledBy` has something to point at, so the landmark never
|
|
131
|
+
* carries both.
|
|
132
|
+
*/
|
|
133
|
+
private get _contentinfoLabel();
|
|
44
134
|
render(): import("lit-html").TemplateResult<1>;
|
|
45
135
|
}
|
|
@@ -1,40 +1,165 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NysElement } from "@nysds/internals";
|
|
2
|
+
import "@nysds/nys-icon";
|
|
2
3
|
/**
|
|
3
4
|
* Agency-branded header with app/agency name, navigation, and responsive mobile menu.
|
|
4
5
|
*
|
|
5
6
|
* Place below `nys-unavheader`. Slot navigation links as `<ul><li><a>` elements; active links
|
|
6
|
-
* are auto-highlighted based on current URL
|
|
7
|
+
* are auto-highlighted based on current URL, unless you set `aria-current` on a link
|
|
8
|
+
* yourself — then the header leaves the current-page state entirely to you, which is
|
|
9
|
+
* what apps that don't route on the pathname (hash-routed SPAs, for example) need.
|
|
10
|
+
* Mobile menu toggles automatically on narrow screens.
|
|
7
11
|
*
|
|
8
12
|
* @summary Agency header with navigation, mobile menu, and active link highlighting.
|
|
9
13
|
* @element nys-globalheader
|
|
10
14
|
*
|
|
15
|
+
* @accessibility
|
|
16
|
+
* - The mobile menu toggle is a real `<button>` carrying `aria-expanded` and
|
|
17
|
+
* `aria-controls` pointing at the mobile navigation.
|
|
18
|
+
* - While the mobile menu is open, Tab and Shift+Tab cycle within the toggle and
|
|
19
|
+
* the menu's links; Escape closes the menu and returns focus to the toggle.
|
|
20
|
+
*
|
|
11
21
|
* @slot - Navigation content (typically `<ul>` with `<li><a>` links). Auto-sanitized.
|
|
22
|
+
* @slot user-actions - User-account controls (e.g. profile link, settings, log-out button) shown in the header.
|
|
23
|
+
*
|
|
24
|
+
*
|
|
25
|
+
* @example Basic
|
|
26
|
+
* ```html
|
|
27
|
+
* <nys-globalheader appName="User Registration Form" agencyName="Office of Information Technology Services"></nys-globalheader>
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example Homepage Link
|
|
31
|
+
* ```html
|
|
32
|
+
* <nys-globalheader
|
|
33
|
+
* agencyName="Office of Information Technology Services"
|
|
34
|
+
* homepageLink="https://its.ny.gov"
|
|
35
|
+
* ></nys-globalheader>
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @example Only Agency Name
|
|
39
|
+
* ```html
|
|
40
|
+
* <nys-globalheader agencyName="Office of Information Technology Services"></nys-globalheader>
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @example Only App Name
|
|
44
|
+
* ```html
|
|
45
|
+
* <nys-globalheader appName="User Registration Form"></nys-globalheader>
|
|
46
|
+
* ```
|
|
12
47
|
*
|
|
13
|
-
* @example
|
|
48
|
+
* @example With Links
|
|
49
|
+
* ```html
|
|
50
|
+
* <nys-globalheader agencyName="Office of Information Technology Services">
|
|
51
|
+
* <ul>
|
|
52
|
+
* <li><a href="https://its.ny.gov/services">Services</a></li>
|
|
53
|
+
* <li><a href="https://its.ny.gov/get-help">Help Center</a></li>
|
|
54
|
+
* <li><a href="https://its.ny.gov/cybersecurity">Cybersecurity</a></li>
|
|
55
|
+
* <li><a href="https://its.ny.gov/policies">Policies and Laws</a></li>
|
|
56
|
+
* <li><a href="https://its.ny.gov/procurement">Procurement</a></li>
|
|
57
|
+
* <li><a href="https://its.ny.gov/about-us">About Us</a></li>
|
|
58
|
+
* </ul>
|
|
59
|
+
* </nys-globalheader>
|
|
60
|
+
* ```
|
|
61
|
+
* @example Author-controlled active link
|
|
14
62
|
* ```html
|
|
15
|
-
*
|
|
16
|
-
*
|
|
63
|
+
* <!-- Set aria-current yourself and the header stops guessing from the URL. -->
|
|
64
|
+
* <nys-globalheader agencyName="Office of Information Technology Services">
|
|
65
|
+
* <ul>
|
|
66
|
+
* <li><a href="#/services">Services</a></li>
|
|
67
|
+
* <li><a href="#/help" aria-current="page">Help Center</a></li>
|
|
68
|
+
* </ul>
|
|
17
69
|
* </nys-globalheader>
|
|
18
70
|
* ```
|
|
71
|
+
*
|
|
72
|
+
* @example User Actions
|
|
73
|
+
* ```html
|
|
74
|
+
* <nys-globalheader agencyName="Office of Information Technology Services">
|
|
75
|
+
* <nys-button slot="user-actions" label="Log out">
|
|
76
|
+
* <nys-avatar
|
|
77
|
+
* slot="prefix-icon"
|
|
78
|
+
* ariaLabel="User avatar"
|
|
79
|
+
* initials="NY"
|
|
80
|
+
* ></nys-avatar>
|
|
81
|
+
* </nys-button>
|
|
82
|
+
* </nys-globalheader>
|
|
83
|
+
* <nys-dropdownmenu id="dropdownmenu" for="my-action-slot">
|
|
84
|
+
* <nys-dropdownmenuitem label="Profile" href="/profile"></nys-dropdownmenuitem>
|
|
85
|
+
* <nys-dropdownmenuitem label="Repositories & Github Pages" href="/repos"></nys-dropdownmenuitem>
|
|
86
|
+
* <nys-dropdownmenuitem label="Organizations" href="/organizations" disabled></nys-dropdownmenuitem>
|
|
87
|
+
* <nys-dropdownmenuitem label="Sign out" href="/logout"></nys-dropdownmenuitem>
|
|
88
|
+
* </nys-dropdownmenu>
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* @example With NYS Logo
|
|
92
|
+
* ```html
|
|
93
|
+
* <nys-globalheader nysLogo appName="Admin Dashboard"></nys-globalheader>
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* @example Custom landmark label
|
|
97
|
+
* ```html
|
|
98
|
+
* <!-- Names the banner landmark directly instead of from the visible title.
|
|
99
|
+
* Keep it distinct from nys-unavheader's ("New York State"). -->
|
|
100
|
+
* <nys-globalheader
|
|
101
|
+
* agencyName="Office of Information Technology Services"
|
|
102
|
+
* landmarkLabel="ITS"
|
|
103
|
+
* ></nys-globalheader>
|
|
104
|
+
* ```
|
|
19
105
|
*/
|
|
20
|
-
export declare class NysGlobalHeader extends
|
|
106
|
+
export declare class NysGlobalHeader extends NysElement {
|
|
21
107
|
static styles: import("lit").CSSResult;
|
|
108
|
+
/** Unique identifier. Auto-generated if not provided. */
|
|
109
|
+
id: string;
|
|
22
110
|
/** Application name displayed prominently. */
|
|
23
111
|
appName: string;
|
|
24
112
|
/** Agency name displayed below app name (or as main title if no appName). */
|
|
25
113
|
agencyName: string;
|
|
26
114
|
/** URL for the header title link. If empty, title is not clickable. */
|
|
27
115
|
homepageLink: string;
|
|
28
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* Displays the NYS brand mark in the header. Off by default.
|
|
118
|
+
*
|
|
119
|
+
* Enable only for internal, state-employee (back-office) applications that omit
|
|
120
|
+
* `nys-unavheader`. Any resident-facing app — even one requiring login — should
|
|
121
|
+
* keep `nys-unavheader` for trust and leave this off.
|
|
122
|
+
*/
|
|
29
123
|
nysLogo: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Accessible name for the `banner` landmark this header renders.
|
|
126
|
+
*
|
|
127
|
+
* Leave it unset and the banner is named after the visible `appName` or
|
|
128
|
+
* `agencyName`, which cannot drift out of sync and is translated with the rest
|
|
129
|
+
* of the page. Falls back to `"Site"` when there is no title to reference.
|
|
130
|
+
*
|
|
131
|
+
* Set this only when neither is right for your audience. A page pairing this
|
|
132
|
+
* with `nys-unavheader` carries two `banner` landmarks, so the name must stay
|
|
133
|
+
* distinct from that header's (`"New York State"` by default) or landmark
|
|
134
|
+
* navigation stops distinguishing them.
|
|
135
|
+
*
|
|
136
|
+
* An explicit name replaces the reference to the visible title.
|
|
137
|
+
*/
|
|
138
|
+
landmarkLabel: string;
|
|
30
139
|
/** Internal state to track mobile menu open/closed status. */
|
|
31
140
|
private _isMobileMenuOpen;
|
|
32
141
|
/** Internal state to track if any navigation links are present in the slot. */
|
|
33
142
|
private _hasLinkContent;
|
|
143
|
+
/**
|
|
144
|
+
* True once the author has marked the current page themselves with `aria-current`.
|
|
145
|
+
*
|
|
146
|
+
* Matching `window.location.pathname` is only a default. An app that doesn't route
|
|
147
|
+
* on the pathname — a hash-routed SPA, say — has to be able to say which link is
|
|
148
|
+
* current, and the header must then leave that signal alone rather than clearing
|
|
149
|
+
* it and marking a link of its own choosing.
|
|
150
|
+
*/
|
|
151
|
+
private _authorSetsCurrent;
|
|
152
|
+
/**
|
|
153
|
+
* Watches for the viewport growing past the mobile breakpoint. The menu and its
|
|
154
|
+
* toggle are `display: none` there, so an open menu that survived a resize would
|
|
155
|
+
* leave the focus trap guarding elements nobody can reach.
|
|
156
|
+
*/
|
|
157
|
+
private _desktopMedia;
|
|
34
158
|
/**
|
|
35
159
|
* Lifecycle Methods
|
|
36
160
|
* --------------------------------------------------------------------------
|
|
37
161
|
*/
|
|
162
|
+
connectedCallback(): void;
|
|
38
163
|
firstUpdated(): void;
|
|
39
164
|
disconnectedCallback(): void;
|
|
40
165
|
/**
|
|
@@ -45,10 +170,75 @@ export declare class NysGlobalHeader extends LitElement {
|
|
|
45
170
|
private _handleListSlotChange;
|
|
46
171
|
private _normalizePath;
|
|
47
172
|
private _toggleMobileMenu;
|
|
173
|
+
/** The toggle, which is both the trap's first stop and where focus returns. */
|
|
174
|
+
private get _menuButton();
|
|
175
|
+
private get _mobileNav();
|
|
176
|
+
/**
|
|
177
|
+
* Closes the mobile menu.
|
|
178
|
+
*
|
|
179
|
+
* `restoreFocus` moves focus back to the toggle, which is required whenever the
|
|
180
|
+
* menu is dismissed by keyboard: the closed menu is `display: none`, so focus
|
|
181
|
+
* sitting on one of its links would otherwise be dropped to the top of the
|
|
182
|
+
* document (WCAG 2.4.3 Focus Order). A click outside is a pointer gesture that
|
|
183
|
+
* lands somewhere the user chose, so that path leaves focus alone.
|
|
184
|
+
*/
|
|
185
|
+
private _closeMobileMenu;
|
|
186
|
+
/**
|
|
187
|
+
* Toggle first, then the menu's own links — the tab order a sighted keyboard
|
|
188
|
+
* user sees, so the trap cycles in the order the menu reads.
|
|
189
|
+
*/
|
|
190
|
+
private _focusableMenuElements;
|
|
191
|
+
/**
|
|
192
|
+
* The focused element, but only when it is one of the menu's own stops.
|
|
193
|
+
*
|
|
194
|
+
* `document.activeElement` reports the host for anything focused inside this
|
|
195
|
+
* shadow root, so the shadow root's own `activeElement` is what identifies the
|
|
196
|
+
* real stop.
|
|
197
|
+
*/
|
|
198
|
+
private _activeMenuElement;
|
|
199
|
+
/**
|
|
200
|
+
* Keeps Tab / Shift+Tab inside the open mobile menu (#1101).
|
|
201
|
+
*
|
|
202
|
+
* The open menu covers the page, so tabbing out of it silently moves focus to
|
|
203
|
+
* content the user cannot see (WCAG 2.4.3, 2.1.2). Wrapping at both ends keeps
|
|
204
|
+
* every stop reachable, and Escape (handled alongside this) is the documented
|
|
205
|
+
* way out.
|
|
206
|
+
*/
|
|
207
|
+
private _trapMobileMenuFocus;
|
|
48
208
|
private _listenLinkClicks;
|
|
209
|
+
/**
|
|
210
|
+
* Id of the element that names the banner landmark, or undefined when this
|
|
211
|
+
* header carries no title to point at.
|
|
212
|
+
*
|
|
213
|
+
* The documented pairing puts this header below `nys-unavheader`, which leaves a
|
|
214
|
+
* page with two `banner` landmarks. Naming each one keeps landmark navigation
|
|
215
|
+
* useful instead of announcing "banner, banner" (axe `landmark-unique`). The name
|
|
216
|
+
* references the visible title rather than repeating it in an `aria-label`, so it
|
|
217
|
+
* cannot drift out of sync and is translated along with the rest of the page.
|
|
218
|
+
*/
|
|
219
|
+
private get _bannerLabelledBy();
|
|
220
|
+
/** The author's landmark name, or undefined when they gave none. */
|
|
221
|
+
private get _landmarkLabelOverride();
|
|
222
|
+
/**
|
|
223
|
+
* Literal name for the banner: the author's override, or the "Site" default when
|
|
224
|
+
* there is no visible title to reference. Undefined whenever `_bannerLabelledBy`
|
|
225
|
+
* has something to point at, so the landmark never carries both.
|
|
226
|
+
*/
|
|
227
|
+
private get _bannerLabel();
|
|
228
|
+
/**
|
|
229
|
+
* App/agency title block. Rendered on its own so the linked and unlinked
|
|
230
|
+
* variants cannot drift apart — the ids here are what names the banner.
|
|
231
|
+
*/
|
|
232
|
+
private _renderNameContainer;
|
|
49
233
|
private _renderBrandMark;
|
|
50
234
|
private _getNysLogo;
|
|
51
235
|
private _boundClickOutside;
|
|
236
|
+
/**
|
|
237
|
+
* Growing past the mobile breakpoint takes the menu off the page, so drop the
|
|
238
|
+
* open state with it. No focus restore: the toggle is gone too, and the resize
|
|
239
|
+
* was not a dismissal the user aimed at anything.
|
|
240
|
+
*/
|
|
241
|
+
private _boundBreakpointChange;
|
|
52
242
|
private _boundKeyDown;
|
|
53
243
|
render(): import("lit-html").TemplateResult<1>;
|
|
54
244
|
}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Icon Cache
|
|
3
3
|
*
|
|
4
|
-
* Shared SVG
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Shared SVG sanitize/parse pipeline and caches. URL-based icons (custom
|
|
5
|
+
* libraries) are fetched once per URL; inline SVG sources (the built-in
|
|
6
|
+
* NYSDS set) are parsed once per source string. Each consumer gets a
|
|
7
|
+
* cloned SVGElement via `cloneNode(true)` so DOM nodes are never shared.
|
|
7
8
|
*/
|
|
8
9
|
/** Fetch and parse an SVG from a URL. Returns a cloned SVGElement (safe for multiple consumers). */
|
|
9
10
|
export declare function fetchIcon(url: string): Promise<SVGElement>;
|
|
10
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Parse an inline SVG source string. Results are cached by source content,
|
|
13
|
+
* so repeated renders of the same icon sanitize/parse once. Returns a
|
|
14
|
+
* cloned SVGElement (safe for multiple consumers).
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseIcon(source: string): SVGElement;
|
|
17
|
+
/** Clear one URL entry, or all cached icons (URL and inline) when no URL is given. */
|
|
11
18
|
export declare function clearIconCache(url?: string): void;
|