@nysds/components 1.22.3 → 1.23.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/custom-elements.json +487 -314
- package/dist/.vscode/vscode.html-custom-data.json +16 -3
- package/dist/custom-elements.json +487 -314
- package/dist/{nys-icon.library-B8CxRzL5.js → nys-icon.library-BoTLZp1N.js} +2 -2
- package/dist/{nys-icon.library-B8CxRzL5.js.map → nys-icon.library-BoTLZp1N.js.map} +1 -1
- package/dist/{nys-icon.library--ld1i3y_-C6XI8cpR.js → nys-icon.library-CzPN4H8R-DCkPqUYP.js} +3 -3
- package/dist/{nys-icon.library--ld1i3y_-C6XI8cpR.js.map → nys-icon.library-CzPN4H8R-DCkPqUYP.js.map} +1 -1
- package/dist/nysds.es.js +2145 -1893
- package/dist/nysds.es.js.map +1 -1
- package/dist/nysds.js +275 -253
- package/dist/nysds.js.map +1 -1
- package/dist/packages/nys-accordion/src/nys-accordion.d.ts +7 -9
- package/dist/packages/nys-accordion/src/nys-accordionitem.d.ts +1 -1
- package/dist/packages/nys-alert/src/nys-alert.d.ts +10 -12
- package/dist/packages/nys-avatar/src/nys-avatar.d.ts +6 -8
- package/dist/packages/nys-backtotop/src/nys-backtotop.d.ts +3 -5
- package/dist/packages/nys-badge/src/nys-badge.d.ts +12 -16
- package/dist/packages/nys-breadcrumbs/src/nys-breadcrumbs.d.ts +6 -8
- package/dist/packages/nys-button/src/nys-button.d.ts +4 -6
- package/dist/packages/nys-card/src/nys-card.d.ts +9 -11
- package/dist/packages/nys-checkbox/src/nys-checkbox.d.ts +4 -7
- package/dist/packages/nys-combobox/src/nys-combobox.d.ts +3 -5
- package/dist/packages/nys-datepicker/src/nys-datepicker.d.ts +5 -7
- package/dist/packages/nys-divider/src/nys-divider.d.ts +4 -6
- package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenu.d.ts +6 -8
- package/dist/packages/nys-fileinput/src/nys-fileinput.d.ts +6 -8
- package/dist/packages/nys-globalfooter/src/nys-globalfooter.d.ts +5 -7
- package/dist/packages/nys-globalheader/src/nys-globalheader.d.ts +5 -7
- package/dist/packages/nys-icon/src/nys-icon.d.ts +8 -10
- package/dist/packages/nys-iconlist/src/nys-iconlist.d.ts +5 -7
- package/dist/packages/nys-modal/src/nys-modal.d.ts +5 -7
- package/dist/packages/nys-pagination/src/nys-pagination.d.ts +4 -6
- package/dist/packages/nys-processlist/src/nys-processlist.d.ts +5 -7
- package/dist/packages/nys-radiobutton/src/nys-radiobutton.d.ts +4 -6
- package/dist/packages/nys-select/src/nys-select.d.ts +4 -6
- package/dist/packages/nys-skipnav/src/nys-skipnav.d.ts +3 -5
- package/dist/packages/nys-stepper/src/nys-stepper.d.ts +3 -5
- package/dist/packages/nys-tab/src/nys-tabgroup.d.ts +6 -8
- package/dist/packages/nys-table/src/nys-table.d.ts +5 -7
- package/dist/packages/nys-textarea/src/nys-textarea.d.ts +3 -5
- package/dist/packages/nys-textinput/src/nys-textinput.d.ts +19 -7
- package/dist/packages/nys-toggle/src/nys-toggle.d.ts +6 -8
- package/dist/packages/nys-tooltip/src/nys-tooltip.d.ts +6 -8
- package/dist/packages/nys-unavbundle/src/index.d.ts +34 -0
- package/dist/packages/nys-unavbundle/src/tokens.d.ts +10 -0
- package/dist/packages/nys-unavfooter/src/nys-unavfooter.d.ts +56 -5
- package/dist/packages/nys-unavheader/src/nys-unavheader.d.ts +63 -10
- package/dist/packages/nys-verticalnav/src/nys-verticalnav.d.ts +7 -8
- package/dist/packages/nys-video/src/nys-video.d.ts +4 -6
- package/package.json +13 -2
|
@@ -23,18 +23,16 @@ import "./nys-processlistitem";
|
|
|
23
23
|
* `aria-describedby` for supporting copy such as an intro paragraph. Because the host renders
|
|
24
24
|
* in the light DOM, these native attributes work with zero component code.
|
|
25
25
|
*
|
|
26
|
-
* @
|
|
26
|
+
* @usage
|
|
27
27
|
* - Use a process list to explain a sequence of steps a user will take, such as how to apply for a benefit or renew a license.
|
|
28
28
|
* - Keep step labels short and action-oriented, and put supporting detail in the `description`.
|
|
29
29
|
* - Give the list an accessible name with `aria-labelledby` or `aria-label` so its purpose is clear.
|
|
30
30
|
* - Use `initialstep` to continue the numbering when one process is split across multiple lists.
|
|
31
31
|
* - Keep styling consistent across all process lists on the same page.
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* -
|
|
35
|
-
* -
|
|
36
|
-
* - Number the steps yourself in the `label`. The list owns the numbering.
|
|
37
|
-
* - Place interactive controls such as buttons inside a step.
|
|
32
|
+
* - Don't use a process list to show a user's progress through a multi-step form. Use the [Stepper](/components/stepper/) instead.
|
|
33
|
+
* - Don't use a process list for items with no inherent order. Use the [Icon List](/components/iconlist/) or a standard list instead.
|
|
34
|
+
* - Don't number the steps yourself in the `label`. The list owns the numbering.
|
|
35
|
+
* - Don't place interactive controls such as buttons inside a step.
|
|
38
36
|
*
|
|
39
37
|
* @example Basic
|
|
40
38
|
* ```html
|
|
@@ -32,17 +32,15 @@ export type NysRadiobuttonChangeEvent = CustomEvent<NysRadiobuttonChangeDetail>;
|
|
|
32
32
|
* renders the inputs and owns the form contract: `nys-focus` and `nys-blur`
|
|
33
33
|
* arrive re-targeted from the group, and `nys-other-input` fires on the group.
|
|
34
34
|
*
|
|
35
|
-
* @
|
|
35
|
+
* @usage
|
|
36
36
|
* - Use when a user needs to select only one option from a list of 7 or fewer choices.
|
|
37
37
|
* - Always wrap a group of `<nys-radiobutton>` with a `<nys-radiogroup>`.
|
|
38
38
|
* - Group radio buttons vertically for easier scanning, especially when labels are lengthy.
|
|
39
39
|
* - Set a clear default when one choice is recommended or most common. Don't leave all options unselected if a helpful default can guide users.
|
|
40
40
|
* - Use concise, descriptive labels for each option.
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* -
|
|
44
|
-
* - Use when there are more than 7 options. Use a dropdown for better space utilization.
|
|
45
|
-
* - Use for yes/no questions. Consider `<nys-toggle>` or `<nys-checkbox>` instead.
|
|
41
|
+
* - Don't use when users need to select multiple options. Use checkboxes instead.
|
|
42
|
+
* - Don't use when there are more than 7 options. Use a dropdown for better space utilization.
|
|
43
|
+
* - Don't use for yes/no questions. Consider `<nys-toggle>` or `<nys-checkbox>` instead.
|
|
46
44
|
*
|
|
47
45
|
* @example Pre-selected
|
|
48
46
|
* ```html
|
|
@@ -29,14 +29,12 @@ export type NysSelectChangeEvent = CustomEvent<NysSelectChangeDetail>;
|
|
|
29
29
|
* @fires {Event} nys-focus - Fired when the select gains focus.
|
|
30
30
|
* @fires {Event} nys-blur - Fired when the select loses focus. Triggers validation.
|
|
31
31
|
*
|
|
32
|
-
* @
|
|
32
|
+
* @usage
|
|
33
33
|
* - Use when a user needs to select a single item from a dropdown list.
|
|
34
34
|
* - Use the `<option>` element to define options and the native `<optgroup>` to group them.
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* -
|
|
38
|
-
* - Use the custom `<nys-option>` element. It will be deprecated in the 2.0 release.
|
|
39
|
-
* - Use `<nys-select multiple>`. Use a checkbox group instead.
|
|
35
|
+
* - Don't use when users need to select multiple items. Use a checkbox group instead.
|
|
36
|
+
* - Don't use the custom `<nys-option>` element. It will be deprecated in the 2.0 release.
|
|
37
|
+
* - Don't use `<nys-select multiple>`. Use a checkbox group instead.
|
|
40
38
|
*
|
|
41
39
|
* @example Basic
|
|
42
40
|
* ```html
|
|
@@ -8,13 +8,11 @@ import { NysElement } from "@nysds/internals";
|
|
|
8
8
|
* @summary Skip navigation link for keyboard accessibility. Hidden until focused.
|
|
9
9
|
* @element nys-skipnav
|
|
10
10
|
*
|
|
11
|
-
* @
|
|
11
|
+
* @usage
|
|
12
12
|
* - Use on pages with a large header, navigation, or other repeated content before the main section.
|
|
13
13
|
* - Ensure the `href` on `<nys-skipnav>` matches the `id` of the main content container.
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* - Use if your layout already starts with the main content and there is nothing to skip over.
|
|
17
|
-
* - Mismatch the `href` and target `id`.
|
|
14
|
+
* - Don't use if your layout already starts with the main content and there is nothing to skip over.
|
|
15
|
+
* - Don't mismatch the `href` and target `id`.
|
|
18
16
|
*
|
|
19
17
|
* @example Basic
|
|
20
18
|
* ```html
|
|
@@ -52,13 +52,11 @@ import "./nys-step";
|
|
|
52
52
|
* @slot - Default slot for `nys-step` elements. Only `nys-step` children are accepted; others are removed.
|
|
53
53
|
* @slot actions - Persistent navigation buttons. Must contain exactly one `<div>` wrapping only `<nys-button>` elements.
|
|
54
54
|
*
|
|
55
|
-
* @
|
|
55
|
+
* @usage
|
|
56
56
|
* - Use for linear, ordered forms with more than 2 sections to show progress through a multi-step process.
|
|
57
57
|
* - Ensure users can navigate back to previous steps to review or change information.
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* - Use when a form has only 1 or 2 sections.
|
|
61
|
-
* - Use for forms that are nonlinear and can be completed in any order.
|
|
58
|
+
* - Don't use when a form has only 1 or 2 sections.
|
|
59
|
+
* - Don't use for forms that are nonlinear and can be completed in any order.
|
|
62
60
|
*
|
|
63
61
|
* @example Basic
|
|
64
62
|
* ```html
|
|
@@ -25,17 +25,15 @@ import { NysElement } from "@nysds/internals";
|
|
|
25
25
|
* tablist and panel containers; they stay in the light DOM. Any other
|
|
26
26
|
* children remain in the default slot, rendered below the panels.
|
|
27
27
|
*
|
|
28
|
-
* @
|
|
28
|
+
* @usage
|
|
29
29
|
* - Use to organize related content into distinct sections within the same context (e.g., Overview, Specs, Reviews), especially when a page would otherwise be overwhelmingly long.
|
|
30
30
|
* - Keep tab labels short and clear, limited to 2–9 tabs and one row. Avoid wrapping.
|
|
31
31
|
* - Only one tab should ever be in the active state.
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* -
|
|
35
|
-
* -
|
|
36
|
-
* -
|
|
37
|
-
* - Nest tabs inside other tabs.
|
|
38
|
-
* - Use tabs for page navigation.
|
|
32
|
+
* - Don't use when users need to compare information across sections simultaneously. Tabs require clicking back and forth.
|
|
33
|
+
* - Don't use for linear, step-by-step processes. Use a stepper instead.
|
|
34
|
+
* - Don't use when you only have two small pieces of content. Display them consecutively instead.
|
|
35
|
+
* - Don't nest tabs inside other tabs.
|
|
36
|
+
* - Don't use tabs for page navigation.
|
|
39
37
|
*
|
|
40
38
|
* @example Basic
|
|
41
39
|
* ```html
|
|
@@ -29,14 +29,12 @@ export type NysTableColumnSortEvent = CustomEvent<NysTableColumnSortDetail>;
|
|
|
29
29
|
*
|
|
30
30
|
* @method downloadFile - Triggers download of the CSV file if `download` is set.
|
|
31
31
|
*
|
|
32
|
-
* @
|
|
32
|
+
* @usage
|
|
33
33
|
* - Use to display tabular data such as statistical information or directories of locations and resources with consistent structure.
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* -
|
|
37
|
-
* -
|
|
38
|
-
* - Use when cell content is long-form; table cells should be brief and scannable. If you need multiple bullet points or paragraphs in a cell, consider page headers or an accordion instead.
|
|
39
|
-
* - Add `rowspan` or `colspan` with the `sortable` property.
|
|
34
|
+
* - Don't use in place of a layout grid. Table content should follow a consistent structure using headers and logical columns and rows.
|
|
35
|
+
* - Don't use for non-tabular content. Consider definition lists or hierarchical lists instead.
|
|
36
|
+
* - Don't use when cell content is long-form; table cells should be brief and scannable. If you need multiple bullet points or paragraphs in a cell, consider page headers or an accordion instead.
|
|
37
|
+
* - Don't add `rowspan` or `colspan` with the `sortable` property.
|
|
40
38
|
*
|
|
41
39
|
* @example Basic
|
|
42
40
|
* ```html
|
|
@@ -52,12 +52,10 @@ export type NysTextareaSelectionchangeEvent = CustomEvent<NysTextareaSelectionch
|
|
|
52
52
|
* @fires {NysTextareaSelectEvent} nys-select - Fired when the user selects text. Detail: `{id, value}`.
|
|
53
53
|
* @fires {NysTextareaSelectionchangeEvent} nys-selectionchange - Fired when the text selection changes. Detail: `{id, value}`.
|
|
54
54
|
*
|
|
55
|
-
* @
|
|
55
|
+
* @usage
|
|
56
56
|
* - Use to collect multiple lines of open-ended text input (e.g., comments, descriptions, feedback).
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* - Use for short or single-line input. Use `<nys-textinput>` instead.
|
|
60
|
-
* - Use when input should be selected from predefined options. Use `<nys-select>`, `<nys-radiobutton>`, or `<nys-checkbox>` instead.
|
|
57
|
+
* - Don't use for short or single-line input. Use `<nys-textinput>` instead.
|
|
58
|
+
* - Don't use when input should be selected from predefined options. Use `<nys-select>`, `<nys-radiobutton>`, or `<nys-checkbox>` instead.
|
|
61
59
|
*
|
|
62
60
|
* @example Basic
|
|
63
61
|
* ```html
|
|
@@ -46,17 +46,15 @@ export type NysTextinputChangeEvent = CustomEvent<NysTextinputChangeDetail>;
|
|
|
46
46
|
* @fires {Event} nys-focus - Fired when the input gains focus.
|
|
47
47
|
* @fires {Event} nys-blur - Fired when the input loses focus. Triggers validation.
|
|
48
48
|
*
|
|
49
|
-
* @
|
|
49
|
+
* @usage
|
|
50
50
|
* - Use to collect short, single-line, open-ended text input (e.g., names, email addresses, or short descriptions).
|
|
51
51
|
* - Use clear, concise labels that describe the expected input.
|
|
52
52
|
* - Add helper text with the `description` property for context.
|
|
53
53
|
* - Validate input live to catch errors early (e.g., invalid email formats).
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* -
|
|
57
|
-
* -
|
|
58
|
-
* - Overwhelm users with too many fields. Group related inputs.
|
|
59
|
-
* - Use placeholders as labels.
|
|
54
|
+
* - Don't use for long or multi-line responses. Use `<nys-textarea>` instead.
|
|
55
|
+
* - Don't use when input can be chosen from predefined options. Use `<nys-select>`, `<nys-radiobutton>`, or `<nys-checkbox>` instead.
|
|
56
|
+
* - Don't overwhelm users with too many fields. Group related inputs.
|
|
57
|
+
* - Don't use placeholders as labels.
|
|
60
58
|
*
|
|
61
59
|
* @example Basic
|
|
62
60
|
* ```html
|
|
@@ -138,6 +136,20 @@ export type NysTextinputChangeEvent = CustomEvent<NysTextinputChangeDetail>;
|
|
|
138
136
|
* ></nys-button>
|
|
139
137
|
* </nys-textinput>
|
|
140
138
|
* ```
|
|
139
|
+
*
|
|
140
|
+
* @example Suffix Button (RTL)
|
|
141
|
+
* ```html
|
|
142
|
+
* <div dir="rtl">
|
|
143
|
+
* <nys-textinput id="search-demo" type="search" placeholder="Search">
|
|
144
|
+
* <nys-button
|
|
145
|
+
* slot="endButton"
|
|
146
|
+
* ariaLabel="Search"
|
|
147
|
+
* prefixIcon="search"
|
|
148
|
+
* onclick="alert('searching for: ' + document.getElementById('search-demo').value)"
|
|
149
|
+
* ></nys-button>
|
|
150
|
+
* </nys-textinput>
|
|
151
|
+
* </div>
|
|
152
|
+
* ```
|
|
141
153
|
*/
|
|
142
154
|
export declare class NysTextinput extends NysFormControlElement {
|
|
143
155
|
static styles: import("lit").CSSResult;
|
|
@@ -38,17 +38,15 @@ export type NysToggleChangeEvent = CustomEvent<NysToggleChangeDetail>;
|
|
|
38
38
|
* @fires {Event} nys-focus Fired when toggle gains focus.
|
|
39
39
|
* @fires {Event} nys-blur Fired when toggle loses focus.
|
|
40
40
|
*
|
|
41
|
-
* @
|
|
41
|
+
* @usage
|
|
42
42
|
* - Provide a clear label and optional description to explain what the toggle controls.
|
|
43
43
|
* - Ensure the page clearly reflects the toggle's on/off state through visible changes.
|
|
44
44
|
* - Use when the state change will be implemented immediately.
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* -
|
|
48
|
-
* -
|
|
49
|
-
* -
|
|
50
|
-
* - Overuse for minor settings that don't affect the user experience.
|
|
51
|
-
* - Hide labels unless an accessible alternative is in place.
|
|
45
|
+
* - Don't use for forms where immediate action isn't expected. Use `<nys-checkbox>` instead.
|
|
46
|
+
* - Don't use for selecting one or more options from a list. Use `<nys-checkbox>` or `<nys-radiobutton>` instead.
|
|
47
|
+
* - Don't use for complex or multi-state choices.
|
|
48
|
+
* - Don't overuse for minor settings that don't affect the user experience.
|
|
49
|
+
* - Don't hide labels unless an accessible alternative is in place.
|
|
52
50
|
*
|
|
53
51
|
* @example Basic
|
|
54
52
|
* ```html
|
|
@@ -16,18 +16,16 @@ import { NysElement } from "@nysds/internals";
|
|
|
16
16
|
* @summary Contextual tooltip with auto-positioning, keyboard support, and screen reader integration.
|
|
17
17
|
* @element nys-tooltip
|
|
18
18
|
*
|
|
19
|
-
* @
|
|
19
|
+
* @usage
|
|
20
20
|
* - Use to provide supplemental hints on form fields (e.g., explaining what "FEIN" means) or on icon buttons that need additional context.
|
|
21
21
|
* - Use on NYSDS form components (`<nys-textinput>`, `<nys-select>`, `<nys-checkbox>`, etc.) where the tooltip automatically renders as a hint icon next to the label.
|
|
22
22
|
* - Keep tooltip content brief and helpful.
|
|
23
23
|
* - Position tooltips so they don't block related content.
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* -
|
|
27
|
-
* -
|
|
28
|
-
* -
|
|
29
|
-
* - Rely on tooltips when you have room to provide inline explanation.
|
|
30
|
-
* - Use when mobile users are a primary audience. Tooltips rely on hover, which is unavailable on touch devices.
|
|
24
|
+
* - Don't use for information critical to task completion. Use inline description text instead, as tooltips are easy to miss.
|
|
25
|
+
* - Don't use when content is long or includes links, actions, or structured content.
|
|
26
|
+
* - Don't use interactive elements such as links or buttons inside a tooltip.
|
|
27
|
+
* - Don't rely on tooltips when you have room to provide inline explanation.
|
|
28
|
+
* - Don't use when mobile users are a primary audience. Tooltips rely on hover, which is unavailable on touch devices.
|
|
31
29
|
*
|
|
32
30
|
* @example Basic
|
|
33
31
|
* ```html
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@nysds/nys-unavbundle` — the universal nav as a single drop-in script.
|
|
3
|
+
*
|
|
4
|
+
* ```html
|
|
5
|
+
* <script src="nys-unavbundle.js"></script>
|
|
6
|
+
* <nys-unavheader></nys-unavheader>
|
|
7
|
+
* ...
|
|
8
|
+
* <nys-unavfooter></nys-unavfooter>
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* Everything the two elements need is inlined: Lit, the shared internals, the
|
|
12
|
+
* `nys-button` / `nys-textinput` / `nys-alert` / `nys-icon` components they
|
|
13
|
+
* compose, and the design tokens their styles read. Icons are pruned at build
|
|
14
|
+
* time to the set the nav can actually render — see `scripts/icon-allowlist.js`.
|
|
15
|
+
*/
|
|
16
|
+
import "@nysds/nys-unavheader";
|
|
17
|
+
import "@nysds/nys-unavfooter";
|
|
18
|
+
declare global {
|
|
19
|
+
interface Window {
|
|
20
|
+
/** Set before the script runs to suppress token injection entirely. */
|
|
21
|
+
NYS_UNAV_SKIP_TOKENS?: boolean;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Put the NYSDS token variables on `:root`.
|
|
26
|
+
*
|
|
27
|
+
* The style goes in as the *first* child of `<head>` on purpose: the component
|
|
28
|
+
* styles read these variables, but a host page that defines its own `--nys-*`
|
|
29
|
+
* values — including a page already loading `@nysds/styles` — should win on
|
|
30
|
+
* source order rather than fight us for it.
|
|
31
|
+
*/
|
|
32
|
+
export declare function injectTokens(): void;
|
|
33
|
+
export { NysUnavHeader } from "@nysds/nys-unavheader";
|
|
34
|
+
export { NysUnavFooter } from "@nysds/nys-unavfooter";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The generated token stylesheet, as a string.
|
|
3
|
+
*
|
|
4
|
+
* Read from `@nysds/tokens`' build output rather than `@nysds/styles`: the
|
|
5
|
+
* latter also ships a global `nys-*:not(:defined) { visibility: hidden }` rule,
|
|
6
|
+
* which would hide unrelated NYSDS elements on a host page that never loaded
|
|
7
|
+
* their definitions.
|
|
8
|
+
*/
|
|
9
|
+
import tokens from "../../tokens/dist/tokens.css?inline";
|
|
10
|
+
export default tokens;
|
|
@@ -1,4 +1,23 @@
|
|
|
1
|
+
import { type PropertyValues } from "lit";
|
|
1
2
|
import { NysElement } from "@nysds/internals";
|
|
3
|
+
import "@nysds/nys-button";
|
|
4
|
+
/**
|
|
5
|
+
* Statewide CTA endpoint. Sites don't opt in or out and never author the
|
|
6
|
+
* content, so a CTA reads identically everywhere it appears.
|
|
7
|
+
*
|
|
8
|
+
* Which one is read is chosen by the page's `<body data-environment="...">`:
|
|
9
|
+
* `dev` → development, `stage` → stage, anything else (or absent) → production.
|
|
10
|
+
*
|
|
11
|
+
* PRODUCTION: https://alerts-cta.static-assets.ny.gov/cta.json
|
|
12
|
+
*
|
|
13
|
+
* DEVELOPMENT: https://alerts-cta-dev.static-assets.ny.gov/cta.json
|
|
14
|
+
*
|
|
15
|
+
* STAGE: https://alerts-cta-stage.static-assets.ny.gov/cta.json
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
export declare const NYS_CTA_URL = "https://alerts-cta.static-assets.ny.gov/cta.json";
|
|
19
|
+
export declare const NYS_CTA_URL_DEV = "https://alerts-cta-dev.static-assets.ny.gov/cta.json";
|
|
20
|
+
export declare const NYS_CTA_URL_STAGE = "https://alerts-cta-stage.static-assets.ny.gov/cta.json";
|
|
2
21
|
/**
|
|
3
22
|
* Universal NYS footer with logo and statewide navigation links. Required on all NYS sites.
|
|
4
23
|
*
|
|
@@ -13,22 +32,28 @@ import { NysElement } from "@nysds/internals";
|
|
|
13
32
|
* - Visual design meets WCAG 2.2 AA contrast and focus indicator standards.
|
|
14
33
|
* - Footer is not hidden from screen readers and is announced as navigation.
|
|
15
34
|
*
|
|
35
|
+
* @remarks Statewide CTA is not configurable. On load the footer reads the statewide
|
|
36
|
+
* CTA endpoint and renders whatever is currently published, so a call to action
|
|
37
|
+
* reaches every NYS site with no per-site work. If the endpoint is unreachable or
|
|
38
|
+
* nothing is published, the footer renders normally.
|
|
39
|
+
*
|
|
40
|
+
* The endpoint's environment follows `<body data-environment="dev|stage">`,
|
|
41
|
+
* read once when the footer connects (it is not watched for later changes);
|
|
42
|
+
* any other value, or none, reads production.
|
|
16
43
|
*
|
|
17
44
|
* @summary Universal NYS footer with logo and statewide links. Required site-wide.
|
|
18
45
|
* @element nys-unavfooter
|
|
19
46
|
*
|
|
20
47
|
* @cssprop [--nys-max-width--content] - Overrides the inner content max width across the grid, header, footer, and breadcrumb. Set at a higher level like `:root` to apply to all instances. Takes priority over the size-specific variable.
|
|
21
48
|
*
|
|
22
|
-
* @
|
|
49
|
+
* @usage
|
|
23
50
|
* - Place the `<nys-unavfooter>` as the last element on every public-facing page, immediately after `<nys-globalfooter>`.
|
|
24
51
|
* - Use on every page of every NYS site and application. This component is required per NYS web policy, including on error pages, login screens, and landing pages.
|
|
25
52
|
* - Place as the very last element on the page, immediately after `<nys-globalfooter>`.
|
|
26
53
|
* - Use as-is with no configuration. The component handles its own content and styling.
|
|
27
|
-
*
|
|
28
|
-
* @usagedonts
|
|
29
54
|
* - Don't use on back office applications or internal sites that are not public-facing.
|
|
30
|
-
* -
|
|
31
|
-
* -
|
|
55
|
+
* - Don't place anywhere other than the absolute bottom of the page.
|
|
56
|
+
* - Don't customize, restyle, or override the component's content or appearance. Consistency across all state sites is the purpose of this component.
|
|
32
57
|
*
|
|
33
58
|
* @example Basic
|
|
34
59
|
* ```html
|
|
@@ -59,11 +84,17 @@ export declare class NysUnavFooter extends NysElement {
|
|
|
59
84
|
* @default "New York State"
|
|
60
85
|
*/
|
|
61
86
|
landmarkLabel: string;
|
|
87
|
+
/** The published CTA, or `null` when nothing is published (or the feed failed). */
|
|
88
|
+
private _cta;
|
|
89
|
+
/** In-flight feed request, aborted if the footer leaves the page first. */
|
|
90
|
+
private _ctaRequest;
|
|
62
91
|
/**
|
|
63
92
|
* Lifecycle methods
|
|
64
93
|
* --------------------------------------------------------------------------
|
|
65
94
|
*/
|
|
66
95
|
connectedCallback(): void;
|
|
96
|
+
disconnectedCallback(): void;
|
|
97
|
+
protected updated(changed: PropertyValues): void;
|
|
67
98
|
/**
|
|
68
99
|
* Functions
|
|
69
100
|
* --------------------------------------------------------------------------
|
|
@@ -75,5 +106,25 @@ export declare class NysUnavFooter extends NysElement {
|
|
|
75
106
|
* to the default.
|
|
76
107
|
*/
|
|
77
108
|
private get _landmarkLabel();
|
|
109
|
+
/**
|
|
110
|
+
* Statewide CTA
|
|
111
|
+
* --------------------------------------------------------------------------
|
|
112
|
+
* Content comes from the CTA feed, never from the consuming page, so the same
|
|
113
|
+
* call to action renders identically everywhere it is shown. A missing,
|
|
114
|
+
* malformed, or unreachable feed leaves the footer untouched — a CTA failing
|
|
115
|
+
* to load must never take a site's navigation down with it.
|
|
116
|
+
*/
|
|
117
|
+
private _loadCta;
|
|
118
|
+
/** Fetches the CTA feed. Resolves to null on any failure. */
|
|
119
|
+
private _readCtaFeed;
|
|
120
|
+
/**
|
|
121
|
+
* `nys-button` has no `ariaLabel` prop, and the host itself carries no role
|
|
122
|
+
* (ARIA placed there never reaches the real control) — so a `textAria` that
|
|
123
|
+
* differs from the button's visible `buttonText` has to be written directly
|
|
124
|
+
* onto the real inner `<button>`/`<a>` once nys-button renders, the same way
|
|
125
|
+
* `nys-unavheader` syncs ARIA onto its own buttons.
|
|
126
|
+
*/
|
|
127
|
+
private _syncCtaButtonAria;
|
|
128
|
+
private _renderCta;
|
|
78
129
|
render(): import("lit-html").TemplateResult<1>;
|
|
79
130
|
}
|
|
@@ -7,6 +7,8 @@ import "@nysds/nys-alert";
|
|
|
7
7
|
export interface Language {
|
|
8
8
|
code: string;
|
|
9
9
|
label: string;
|
|
10
|
+
nativeText: string;
|
|
11
|
+
disclaimer?: string;
|
|
10
12
|
url?: string;
|
|
11
13
|
}
|
|
12
14
|
/** Detail payload for the `nys-language-select` event fired by `nys-unavheader`. */
|
|
@@ -25,10 +27,16 @@ export type NysUnavheaderSearchSubmitEvent = CustomEvent<NysUnavheaderSearchSubm
|
|
|
25
27
|
* Statewide alert endpoint, read once per page load. Sites don't opt in or out and
|
|
26
28
|
* never author the content, so an alert reads identically everywhere it appears.
|
|
27
29
|
*
|
|
30
|
+
* Which one is read is chosen by the page's `<body data-environment="...">`:
|
|
31
|
+
* `dev` → development, `stage` → stage, anything else (or absent) → production.
|
|
32
|
+
*
|
|
28
33
|
* Production is https://alerts-cta.static-assets.ny.gov/alerts.json.
|
|
29
|
-
*
|
|
34
|
+
* Development is https://alerts-cta-dev.static-assets.ny.gov/alerts.json
|
|
35
|
+
* Stage is https://alerts-cta-stage.static-assets.ny.gov/alerts.json
|
|
30
36
|
*/
|
|
31
37
|
export declare const NYS_ALERT_URL = "https://alerts-cta.static-assets.ny.gov/alerts.json";
|
|
38
|
+
export declare const NYS_ALERT_URL_DEV = "https://alerts-cta-dev.static-assets.ny.gov/alerts.json";
|
|
39
|
+
export declare const NYS_ALERT_URL_STAGE = "https://alerts-cta-stage.static-assets.ny.gov/alerts.json";
|
|
32
40
|
/**
|
|
33
41
|
* Universal NYS header with trust bar, logo, search, and language translation. Required on all NYS sites.
|
|
34
42
|
*
|
|
@@ -63,22 +71,29 @@ export declare const NYS_ALERT_URL = "https://alerts-cta.static-assets.ny.gov/al
|
|
|
63
71
|
* reaches every NYS site with no per-site work. If the endpoint is unreachable or nothing
|
|
64
72
|
* is published, the header renders normally. It takes no children.
|
|
65
73
|
*
|
|
74
|
+
* The endpoint's environment follows `<body data-environment="dev|stage">`,
|
|
75
|
+
* read once when the header connects (it is not watched for later changes);
|
|
76
|
+
* any other value, or none, reads production.
|
|
77
|
+
*
|
|
66
78
|
* @cssprop [--nys-max-width--content] - Overrides the inner content max width across the grid, header, footer, and breadcrumb. Set at a higher level like `:root` to apply to all instances. Takes priority over the size-specific variable.
|
|
67
79
|
* @fires {NysUnavheaderLanguageSelectEvent} nys-language-select - Fired when a language is selected. Detail: `{language: {code, label, url?}}`. Cancelable; `preventDefault()` overrides the default Smartling redirect.
|
|
68
80
|
* @fires {NysUnavheaderSearchSubmitEvent} nys-search-submit - Fired when a search is submitted. Detail: `{query}`. Cancelable; `preventDefault()` overrides the default search redirect.
|
|
69
81
|
*
|
|
70
|
-
* @
|
|
82
|
+
* @usage
|
|
71
83
|
* - Place at the top of every public-facing page.
|
|
72
84
|
* - Toggle search (`hideSearch`) and translate (`hideTranslate`) on/off depending on your needs.
|
|
73
85
|
* - Design your page so content below the header can shift down, since a statewide alert can appear at any time and adds height to the header.
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* -
|
|
77
|
-
* - Place anywhere other than the top of the page.
|
|
78
|
-
* - Modify the universal header.
|
|
86
|
+
* - Don't use on back office applications or internal sites that are not public-facing, instead use the `<nys-globalheader>` with the `nysLogo` property applied.
|
|
87
|
+
* - Don't place anywhere other than the top of the page.
|
|
88
|
+
* - Don't modify the universal header.
|
|
79
89
|
*
|
|
80
90
|
* @example Basic
|
|
81
91
|
* ```html
|
|
92
|
+
* <nys-unavheader translateKey="MY_TRANSLATE_KEY"></nys-unavheader>
|
|
93
|
+
* ```
|
|
94
|
+
*
|
|
95
|
+
* @example Basic - Smartling
|
|
96
|
+
* ```html
|
|
82
97
|
* <nys-unavheader></nys-unavheader>
|
|
83
98
|
* ```
|
|
84
99
|
*
|
|
@@ -87,7 +102,7 @@ export declare const NYS_ALERT_URL = "https://alerts-cta.static-assets.ny.gov/al
|
|
|
87
102
|
* <nys-unavheader hideSearch></nys-unavheader>
|
|
88
103
|
* ```
|
|
89
104
|
*
|
|
90
|
-
*
|
|
105
|
+
* @example Hide translate
|
|
91
106
|
* ```html
|
|
92
107
|
* <nys-unavheader hideTranslate></nys-unavheader>
|
|
93
108
|
* ```
|
|
@@ -143,6 +158,8 @@ export declare class NysUnavHeader extends NysElement {
|
|
|
143
158
|
hideSearch: boolean;
|
|
144
159
|
/** The URL endpoint of the search, make sure to include the query param. */
|
|
145
160
|
searchUrl: string;
|
|
161
|
+
/** Localize project key. If provided, the component will load and initialize LocalizeJS automatically. */
|
|
162
|
+
translateKey: string;
|
|
146
163
|
/**
|
|
147
164
|
* Accessible name for the `banner` landmark this header renders.
|
|
148
165
|
* Defaults to `"New York State"`.
|
|
@@ -159,7 +176,7 @@ export declare class NysUnavHeader extends NysElement {
|
|
|
159
176
|
* @default "New York State"
|
|
160
177
|
*/
|
|
161
178
|
landmarkLabel: string;
|
|
162
|
-
/** The list of languages this site can be translated to, default to use
|
|
179
|
+
/** The list of languages this site can be translated to, default to use Localize */
|
|
163
180
|
languages: Language[];
|
|
164
181
|
/**
|
|
165
182
|
* Lifecycle Methods
|
|
@@ -217,7 +234,6 @@ export declare class NysUnavHeader extends NysElement {
|
|
|
217
234
|
* the state onto the inner control, the same way `nys-dropdownmenu` does for its
|
|
218
235
|
* trigger (WCAG 4.1.2).
|
|
219
236
|
*/
|
|
220
|
-
private _syncTranslateTriggerAria;
|
|
221
237
|
/** The language options, in the order they are rendered. */
|
|
222
238
|
private _languageOptions;
|
|
223
239
|
/**
|
|
@@ -232,7 +248,43 @@ export declare class NysUnavHeader extends NysElement {
|
|
|
232
248
|
* -1 is the last option, so "previous from the first" and "End" are the same call.
|
|
233
249
|
*/
|
|
234
250
|
private _focusOption;
|
|
251
|
+
/**
|
|
252
|
+
* Smartling fallback (no `translateKey`)
|
|
253
|
+
* --------------------------------------------------------------------------
|
|
254
|
+
* Instead of client-side translation, each language option is rendered as a
|
|
255
|
+
* real link (`nys-button`'s `href`) to the same URL with the language code
|
|
256
|
+
* prepended as a subdomain label — agency.ny.gov -> es.agency.ny.gov. English
|
|
257
|
+
* strips the label entirely rather than adding "en.", since the untranslated
|
|
258
|
+
* site lives at the bare host.
|
|
259
|
+
*/
|
|
260
|
+
/** Removes a leading language-code subdomain label (e.g. "es.") if present. */
|
|
261
|
+
private _stripLanguagePrefix;
|
|
262
|
+
/** Builds the Smartling redirect URL for `languageCode`, preserving path/query/hash. */
|
|
263
|
+
private _smartlingUrl;
|
|
264
|
+
/**
|
|
265
|
+
* The navigation target for a language option's `href`, or `undefined` when
|
|
266
|
+
* the option isn't a link — Localize handles that case via `setLanguage`
|
|
267
|
+
* from a click on a plain button instead.
|
|
268
|
+
*
|
|
269
|
+
* An explicit per-language `url` always wins, even with a `translateKey`
|
|
270
|
+
* configured. Otherwise: no `translateKey` means Localize can't run at all,
|
|
271
|
+
* so every option is a Smartling subdomain link.
|
|
272
|
+
*/
|
|
273
|
+
private _languageHref;
|
|
274
|
+
private _initLocalize;
|
|
235
275
|
private _toggleSearchDropdown;
|
|
276
|
+
/**
|
|
277
|
+
* Shows, replaces, or removes the translation disclaimer banner for the
|
|
278
|
+
* given language code.
|
|
279
|
+
*
|
|
280
|
+
* Called only from `_handleLanguageSelect`, i.e. only as the direct result of
|
|
281
|
+
* a user clicking a language in the dropdown. Deliberately not wired to
|
|
282
|
+
* Localize's own "setLanguage" event, which also fires for reasons that
|
|
283
|
+
* aren't a user picking a language on this page load — restoring a
|
|
284
|
+
* remembered language chief among them — and the disclaimer must not appear
|
|
285
|
+
* unprompted.
|
|
286
|
+
*/
|
|
287
|
+
private _updateTranslateDisclaimer;
|
|
236
288
|
private _handleLanguageSelect;
|
|
237
289
|
/**
|
|
238
290
|
* Keyboard model for the translate menu (APG menu button):
|
|
@@ -295,5 +347,6 @@ export declare class NysUnavHeader extends NysElement {
|
|
|
295
347
|
* #1795 found it — two unnamed banners — so it falls back to the default.
|
|
296
348
|
*/
|
|
297
349
|
private get _landmarkLabel();
|
|
350
|
+
private get _locale();
|
|
298
351
|
render(): import("lit-html").TemplateResult<1>;
|
|
299
352
|
}
|
|
@@ -15,19 +15,17 @@ type HeadingLevel = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
|
15
15
|
* @summary Responsive navigation that becomes an accordion on smaller screens.
|
|
16
16
|
* @element nys-verticalnav
|
|
17
17
|
*
|
|
18
|
-
* @
|
|
18
|
+
* @usage
|
|
19
19
|
* - Use for navigation where every item links to a different page.
|
|
20
20
|
* - Use for section-level navigation within a site.
|
|
21
21
|
* - Support up to two levels of navigation: top-level links and one level of nested links.
|
|
22
22
|
* - Set `aria-current="page"` on the active link so the component can apply active styles and expand the current group.
|
|
23
23
|
* - Avoid excessive use of icons, colors, or badges in navigation items.
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* -
|
|
27
|
-
* -
|
|
28
|
-
* -
|
|
29
|
-
* - Nest more than one level of sub-items.
|
|
30
|
-
* - Overload with excessive use of icons, colors, or badges in navigation items.
|
|
24
|
+
* - Don't use for in-page navigation, such as scrolling to sections on the same page.
|
|
25
|
+
* - Don't use for linear task flows, such as multi-step forms or wizards.
|
|
26
|
+
* - Don't use for filtering, tab switching, or other in-page interactions.
|
|
27
|
+
* - Don't nest more than one level of sub-items.
|
|
28
|
+
* - Don't overload with excessive use of icons, colors, or badges in navigation items.
|
|
31
29
|
*
|
|
32
30
|
* @example Basic
|
|
33
31
|
* ```html
|
|
@@ -442,6 +440,7 @@ type HeadingLevel = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
|
442
440
|
* ```
|
|
443
441
|
*
|
|
444
442
|
* @render Page layout
|
|
443
|
+
* ```html
|
|
445
444
|
* <style>
|
|
446
445
|
* .page-layout__body {
|
|
447
446
|
* background-color: var(--nys-color-white, #ffffff);
|
|
@@ -26,18 +26,16 @@ declare global {
|
|
|
26
26
|
*
|
|
27
27
|
* @fires {Event} nys-video-play - Fired when the user clicks the thumbnail to load the player.
|
|
28
28
|
*
|
|
29
|
-
* @
|
|
29
|
+
* @usage
|
|
30
30
|
* - Use when motion or audio communicates something better than text or images alone.
|
|
31
31
|
* - Keep `titleText` to 50–60 characters.
|
|
32
32
|
* - Use a clear, high-quality thumbnail so users recognize it as a video.
|
|
33
33
|
* - Maintain the default `lazy` loading for better page performance.
|
|
34
34
|
* - Reserve space for the 16:9 ratio box to prevent layout shift.
|
|
35
35
|
* - Let users choose to start the video; avoid `autoplay` unless necessary.
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* -
|
|
39
|
-
* - Rely on video alone to convey critical information. Always provide a text alternative.
|
|
40
|
-
* - Set `autoplay` without understanding that the video will be muted. `nys-video` enforces this automatically to protect users from unexpected noise.
|
|
36
|
+
* - Don't use video if the same message can be delivered clearly with text or a static image.
|
|
37
|
+
* - Don't rely on video alone to convey critical information. Always provide a text alternative.
|
|
38
|
+
* - Don't set `autoplay` without understanding that the video will be muted. `nys-video` enforces this automatically to protect users from unexpected noise.
|
|
41
39
|
*
|
|
42
40
|
* @example Basic
|
|
43
41
|
* ```html
|