@nysds/components 1.20.0-alpha1 → 1.20.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 +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-Cfdq5Zdc.js +696 -0
- package/dist/nys-icon.library-Cfdq5Zdc.js.map +1 -0
- package/dist/nys-icon.library-DHBltclg-BYYeCcpo.js +706 -0
- package/dist/nys-icon.library-DHBltclg-BYYeCcpo.js.map +1 -0
- package/dist/nysds.es.js +9113 -4162
- 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 +14 -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 +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,21 +1,43 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TemplateResult } from "lit";
|
|
2
|
+
import { NysElement } from "@nysds/internals";
|
|
3
|
+
import "@nysds/nys-button";
|
|
2
4
|
/**
|
|
3
5
|
* Page navigation with Previous/Next buttons and numbered page links. Auto-collapses with ellipses for many pages.
|
|
4
6
|
*
|
|
5
7
|
* Set `totalPages` and `currentPage` to control state. Listen to `nys-change` for page selection.
|
|
6
8
|
* Hidden automatically when `totalPages` is 1. Responsive: shows compact controls on mobile.
|
|
7
9
|
*
|
|
10
|
+
* ## Accessibility
|
|
11
|
+
* - The controls sit in a `navigation` landmark named "Pagination".
|
|
12
|
+
* - The current page's button carries `aria-current="page"` so assistive technology
|
|
13
|
+
* announces which page the user is on.
|
|
14
|
+
* - Keyboard focus follows the user across a page change: it stays on the page they
|
|
15
|
+
* activated, and moves to the current page's button when Previous or Next disables
|
|
16
|
+
* itself on the first or last page rather than falling back to the document.
|
|
17
|
+
* - The ellipsis between non-adjacent page numbers is inert text, not a control, and is
|
|
18
|
+
* hidden from assistive technology.
|
|
19
|
+
*
|
|
8
20
|
* @summary Page navigation with numbered links, prev/next buttons, and responsive layout.
|
|
9
21
|
* @element nys-pagination
|
|
10
22
|
*
|
|
11
23
|
* @fires nys-change - Fired when page changes. Detail: `{page}`.
|
|
12
24
|
*
|
|
13
|
-
* @example Basic
|
|
25
|
+
* @example Basic
|
|
26
|
+
* ```html
|
|
27
|
+
* <nys-pagination currentPage="5" totalPages="10"></nys-pagination>
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example First Page
|
|
14
31
|
* ```html
|
|
15
32
|
* <nys-pagination currentPage="1" totalPages="10"></nys-pagination>
|
|
16
33
|
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example Last Page
|
|
36
|
+
* ```html
|
|
37
|
+
* <nys-pagination currentPage="10" totalPages="10"></nys-pagination>
|
|
38
|
+
* ```
|
|
17
39
|
*/
|
|
18
|
-
export declare class NysPagination extends
|
|
40
|
+
export declare class NysPagination extends NysElement {
|
|
19
41
|
static styles: import("lit").CSSResult;
|
|
20
42
|
/** Unique identifier. Auto-generated if not provided. */
|
|
21
43
|
id: string;
|
|
@@ -27,18 +49,60 @@ export declare class NysPagination extends LitElement {
|
|
|
27
49
|
totalPages: number;
|
|
28
50
|
/** Internal state for layout adjustments near the end. */
|
|
29
51
|
_twoBeforeLast: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Logical identity of the control that held focus when this update was scheduled,
|
|
54
|
+
* captured before the re-render that invalidates it. Null whenever focus was outside
|
|
55
|
+
* the component, which is what keeps a programmatic page change from stealing focus.
|
|
56
|
+
*/
|
|
57
|
+
private _focusKeyBeforeUpdate;
|
|
58
|
+
/** Guards against an older, still-pending focus restore overriding a newer one. */
|
|
59
|
+
private _focusRestoreToken;
|
|
30
60
|
/**
|
|
31
61
|
* Lifecycle Methods
|
|
32
62
|
* --------------------------------------------------------------------------
|
|
33
63
|
*/
|
|
34
64
|
constructor();
|
|
35
65
|
willUpdate(changedProps: Map<string, unknown>): void;
|
|
66
|
+
updated(): void;
|
|
36
67
|
connectedCallback(): void;
|
|
37
68
|
/**
|
|
38
69
|
* Functions
|
|
39
70
|
* --------------------------------------------------------------------------
|
|
40
71
|
*/
|
|
41
72
|
private _clampPage;
|
|
73
|
+
/**
|
|
74
|
+
* Stable identity for a control in the shadow root, one that survives a re-render.
|
|
75
|
+
*
|
|
76
|
+
* DOM position is not that identity: the window of visible page numbers slides as the
|
|
77
|
+
* user pages through, and Lit reuses the element sitting at a given position, so the
|
|
78
|
+
* button under the user's focus silently starts navigating to a different page. Page
|
|
79
|
+
* buttons are therefore identified by the page they navigate to, and the fixed
|
|
80
|
+
* Previous/Next controls by their id.
|
|
81
|
+
*/
|
|
82
|
+
private _focusKeyOf;
|
|
83
|
+
/** Resolve a focus key back to the control that now carries that identity. */
|
|
84
|
+
private _controlForKey;
|
|
85
|
+
/**
|
|
86
|
+
* A control has to be both enabled and rendered to take focus. `getClientRects()`
|
|
87
|
+
* covers the responsive rules that swap the desktop Previous/Next for their
|
|
88
|
+
* icon-only mobile twins, and hide the page neighbors on narrow screens.
|
|
89
|
+
*/
|
|
90
|
+
private _isFocusable;
|
|
91
|
+
/**
|
|
92
|
+
* Where focus goes when the control the user was on is gone or has just been
|
|
93
|
+
* disabled: the current page's button. It is always rendered, it is never disabled,
|
|
94
|
+
* and it announces the page the user just landed on.
|
|
95
|
+
*/
|
|
96
|
+
private _fallbackFocusTarget;
|
|
97
|
+
/**
|
|
98
|
+
* Keep keyboard focus on the control the user was operating.
|
|
99
|
+
*
|
|
100
|
+
* Two things pull focus out from under them otherwise. Reaching the first or last page
|
|
101
|
+
* disables Previous/Next while it still holds focus, which drops focus to `<body>` and
|
|
102
|
+
* ends the keyboard journey. And activating a page slides the window of page numbers,
|
|
103
|
+
* so the button that keeps focus by DOM position is now a different, non-current page.
|
|
104
|
+
*/
|
|
105
|
+
private _restoreFocus;
|
|
42
106
|
private renderPageButtons;
|
|
43
107
|
/**
|
|
44
108
|
* Event Handlers
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { PropertyValues } from "lit";
|
|
2
|
+
import { NysElement } from "@nysds/internals";
|
|
3
|
+
import "./nys-processlistitem";
|
|
4
|
+
/**
|
|
5
|
+
* A process list is a component that displays a sequence of numbered steps, making it easy to communicate a multi-step process across web projects.
|
|
6
|
+
*
|
|
7
|
+
* Add `<nys-processlistitem>` elements as children. Each item takes a `label` and an optional
|
|
8
|
+
* `description`. Steps are numbered by the list — from 1, or from `initialStep` — so items never
|
|
9
|
+
* set their own number.
|
|
10
|
+
*
|
|
11
|
+
* @summary An ordered list of numbered process steps.
|
|
12
|
+
* @element nys-processlist
|
|
13
|
+
*
|
|
14
|
+
* Children: one or more `<nys-processlistitem>` elements, kept in light DOM so the
|
|
15
|
+
* `list`/`listitem` roles stay directly related in the accessibility tree. The
|
|
16
|
+
* host itself is the `role="list"` container and renders in the light DOM, so
|
|
17
|
+
* its styling comes from `nys-processlist.light.scss` adopted once onto
|
|
18
|
+
* `document.adoptedStyleSheets` rather than from a shadow-DOM stylesheet.
|
|
19
|
+
*
|
|
20
|
+
* A list carries no accessible name of its own. Give one with `aria-label`, or with
|
|
21
|
+
* `aria-labelledby` pointing at the visible heading above the list, so screen reader users can
|
|
22
|
+
* tell what the process is and distinguish it from any other list on the page. Use
|
|
23
|
+
* `aria-describedby` for supporting copy such as an intro paragraph. Because the host renders
|
|
24
|
+
* in the light DOM, these native attributes work with zero component code.
|
|
25
|
+
*
|
|
26
|
+
* @example Basic
|
|
27
|
+
* ```html
|
|
28
|
+
* <nys-processlist id="application-steps">
|
|
29
|
+
* <nys-processlistitem label="Gather your documents"></nys-processlistitem>
|
|
30
|
+
* <nys-processlistitem label="Complete the application"></nys-processlistitem>
|
|
31
|
+
* <nys-processlistitem label="Submit and await review"></nys-processlistitem>
|
|
32
|
+
* </nys-processlist>
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example Accessible Name
|
|
36
|
+
* ```html
|
|
37
|
+
* <nys-processlist id="application-steps-labelled" aria-label="Application steps">
|
|
38
|
+
* <nys-processlistitem label="Gather your documents"></nys-processlistitem>
|
|
39
|
+
* <nys-processlistitem label="Complete the application"></nys-processlistitem>
|
|
40
|
+
* </nys-processlist>
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @example Accessible Name and Description
|
|
44
|
+
* When a visible heading and intro paragraph already describe the process, point at them rather
|
|
45
|
+
* than repeating the text, so the accessible name cannot drift from the visible one.
|
|
46
|
+
* ```html
|
|
47
|
+
* <h2 id="process-heading">Super duper app process</h2>
|
|
48
|
+
* <p id="process-intro">
|
|
49
|
+
* In order to complete this process you will need 3.5 number 2 pencils and a glass of lemonade.
|
|
50
|
+
* </p>
|
|
51
|
+
*
|
|
52
|
+
* <nys-processlist
|
|
53
|
+
* id="application-steps-described"
|
|
54
|
+
* aria-labelledby="process-heading"
|
|
55
|
+
* aria-describedby="process-intro"
|
|
56
|
+
* >
|
|
57
|
+
* <nys-processlistitem label="Gather your documents"></nys-processlistitem>
|
|
58
|
+
* <nys-processlistitem label="Complete the application"></nys-processlistitem>
|
|
59
|
+
* <nys-processlistitem label="Submit and await review"></nys-processlistitem>
|
|
60
|
+
* </nys-processlist>
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @example Description
|
|
64
|
+
* ```html
|
|
65
|
+
* <nys-processlist id="application-steps2">
|
|
66
|
+
* <nys-processlistitem
|
|
67
|
+
* label="Gather your documents"
|
|
68
|
+
* description="Recent pay stubs and a current property tax bill."
|
|
69
|
+
* ></nys-processlistitem>
|
|
70
|
+
* <nys-processlistitem
|
|
71
|
+
* label="Complete the application"
|
|
72
|
+
* description="Most applicants finish in about 20 minutes."
|
|
73
|
+
* ></nys-processlistitem>
|
|
74
|
+
* </nys-processlist>
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @example Description Slot
|
|
78
|
+
* ```html
|
|
79
|
+
* <nys-processlist id="application-steps-desc-slot">
|
|
80
|
+
* <nys-processlistitem label="Gather your documents">
|
|
81
|
+
* <div slot="description">Recent pay stubs and a <strong>current</strong> property tax bill.</div>
|
|
82
|
+
* </nys-processlistitem>
|
|
83
|
+
* <nys-processlistitem label="Complete the application">
|
|
84
|
+
* <div slot="description">Most applicants finish in about <a href="https://www.ny.gov">20 minutes</a>.</div>
|
|
85
|
+
* </nys-processlistitem>
|
|
86
|
+
* </nys-processlist>
|
|
87
|
+
* ```
|
|
88
|
+
*
|
|
89
|
+
* @example Size Small
|
|
90
|
+
* ```html
|
|
91
|
+
* <nys-processlist id="application-steps-sm" size="sm">
|
|
92
|
+
* <nys-processlistitem label="Gather your documents"></nys-processlistitem>
|
|
93
|
+
* <nys-processlistitem label="Complete the application"></nys-processlistitem>
|
|
94
|
+
* <nys-processlistitem label="Submit and await review"></nys-processlistitem>
|
|
95
|
+
* </nys-processlist>
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* @example Strong
|
|
99
|
+
* ```html
|
|
100
|
+
* <nys-processlist id="application-steps-strong" strong>
|
|
101
|
+
* <nys-processlistitem label="Gather your documents"></nys-processlistitem>
|
|
102
|
+
* <nys-processlistitem label="Complete the application"></nys-processlistitem>
|
|
103
|
+
* <nys-processlistitem label="Submit and await review"></nys-processlistitem>
|
|
104
|
+
* </nys-processlist>
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
* @example Neutral
|
|
108
|
+
* ```html
|
|
109
|
+
* <nys-processlist id="application-steps-neutral" neutral>
|
|
110
|
+
* <nys-processlistitem label="Gather your documents"></nys-processlistitem>
|
|
111
|
+
* <nys-processlistitem label="Complete the application"></nys-processlistitem>
|
|
112
|
+
* <nys-processlistitem label="Submit and await review"></nys-processlistitem>
|
|
113
|
+
* </nys-processlist>
|
|
114
|
+
* ```
|
|
115
|
+
*
|
|
116
|
+
* @example Strong Neutral
|
|
117
|
+
* ```html
|
|
118
|
+
* <nys-processlist id="application-steps-strong-neutral" strong neutral>
|
|
119
|
+
* <nys-processlistitem label="Gather your documents"></nys-processlistitem>
|
|
120
|
+
* <nys-processlistitem label="Complete the application"></nys-processlistitem>
|
|
121
|
+
* <nys-processlistitem label="Submit and await review"></nys-processlistitem>
|
|
122
|
+
* </nys-processlist>
|
|
123
|
+
* ```
|
|
124
|
+
*
|
|
125
|
+
* @example Initial Step
|
|
126
|
+
* One process is sometimes interrupted by content that cannot live inside the list —
|
|
127
|
+
* an intermission, a callout, a form. Splitting it into two lists would restart the
|
|
128
|
+
* numbering at 1 and read as two separate processes, so the second list picks up where
|
|
129
|
+
* the first left off. Two lists on one page means each needs its own accessible name.
|
|
130
|
+
* ```html
|
|
131
|
+
* <nys-processlist
|
|
132
|
+
* id="application-steps-part1"
|
|
133
|
+
* aria-label="Application steps, part 1"
|
|
134
|
+
* >
|
|
135
|
+
* <nys-processlistitem label="Gather your documents"></nys-processlistitem>
|
|
136
|
+
* <nys-processlistitem label="Complete the application"></nys-processlistitem>
|
|
137
|
+
* <nys-processlistitem label="Submit and await review"></nys-processlistitem>
|
|
138
|
+
* </nys-processlist>
|
|
139
|
+
*
|
|
140
|
+
* <p>OK, intermission time. Get up, stretch, and drink the glass of lemonade.</p>
|
|
141
|
+
*
|
|
142
|
+
* <nys-processlist
|
|
143
|
+
* id="application-steps-part2"
|
|
144
|
+
* initialstep="4"
|
|
145
|
+
* aria-label="Application steps, part 2"
|
|
146
|
+
* >
|
|
147
|
+
* <nys-processlistitem label="Okay let's continue"></nys-processlistitem>
|
|
148
|
+
* <nys-processlistitem label="Wow, this might be tricky"></nys-processlistitem>
|
|
149
|
+
* <nys-processlistitem label="Cool cool, I got this thing"></nys-processlistitem>
|
|
150
|
+
* </nys-processlist>
|
|
151
|
+
* ```
|
|
152
|
+
*
|
|
153
|
+
*/
|
|
154
|
+
export declare class NysProcesslist extends NysElement {
|
|
155
|
+
/**
|
|
156
|
+
* Unique identifier. Auto-generated if not provided.
|
|
157
|
+
*/
|
|
158
|
+
id: string;
|
|
159
|
+
/**
|
|
160
|
+
* Renders each step number in a bolder, higher-emphasis color.
|
|
161
|
+
*/
|
|
162
|
+
strong: boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Renders each step number using neutral (grayscale) coloring instead of the theme color.
|
|
165
|
+
*/
|
|
166
|
+
neutral: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Step marker size: `sm` (smaller) or `md` (default).
|
|
169
|
+
*/
|
|
170
|
+
size: "md" | "sm";
|
|
171
|
+
/**
|
|
172
|
+
* Number given to the first step. Subsequent steps count up from it. Use this when one
|
|
173
|
+
* process is split across several lists so the later lists continue the count instead of
|
|
174
|
+
* restarting at 1.
|
|
175
|
+
*/
|
|
176
|
+
initialStep: number;
|
|
177
|
+
private _childObserver;
|
|
178
|
+
private _warnedChildren;
|
|
179
|
+
createRenderRoot(): this;
|
|
180
|
+
connectedCallback(): void;
|
|
181
|
+
disconnectedCallback(): void;
|
|
182
|
+
updated(changedProperties: PropertyValues): void;
|
|
183
|
+
private _syncSteps;
|
|
184
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { NysElement } from "@nysds/internals";
|
|
2
|
+
/**
|
|
3
|
+
* A single step in a `<nys-processlist>`. Renders as a list item containing a step number and text.
|
|
4
|
+
*
|
|
5
|
+
* Set `label` for the step label and `description` for supporting information. For rich text, use the
|
|
6
|
+
* `description` slot instead of the property. The step number is owned by the parent list, so items
|
|
7
|
+
* are never numbered individually.
|
|
8
|
+
*
|
|
9
|
+
* @summary A numbered step for use inside `<nys-processlist>`.
|
|
10
|
+
* @element nys-processlistitem
|
|
11
|
+
* @slot description - Custom HTML description content below the label. Overrides the `description` property.
|
|
12
|
+
*/
|
|
13
|
+
export declare class NysProcesslistitem extends NysElement {
|
|
14
|
+
static styles: import("lit").CSSResult;
|
|
15
|
+
/**
|
|
16
|
+
* Step heading text.
|
|
17
|
+
*/
|
|
18
|
+
label: string;
|
|
19
|
+
/**
|
|
20
|
+
* Supporting information displayed below the label. Use the `description` slot for rich text.
|
|
21
|
+
*/
|
|
22
|
+
description: string;
|
|
23
|
+
/**
|
|
24
|
+
* Rendered step number. Assigned by the parent `<nys-processlist>` via `setStep()` — numbering is
|
|
25
|
+
* a property of the list's order, not of the item, so it is deliberately not part of this
|
|
26
|
+
* component's public API.
|
|
27
|
+
*/
|
|
28
|
+
private _step;
|
|
29
|
+
/**
|
|
30
|
+
* A description is shown when either the property or the slot has content, so an item with
|
|
31
|
+
* neither renders no empty paragraph.
|
|
32
|
+
*/
|
|
33
|
+
get _hasDescription(): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Sets the rendered step number.
|
|
36
|
+
* @internal Called by `<nys-processlist>`; not intended for direct use.
|
|
37
|
+
*/
|
|
38
|
+
setStep(step: number): void;
|
|
39
|
+
connectedCallback(): void;
|
|
40
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
41
|
+
}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NysFormControlElement } from "@nysds/internals";
|
|
2
|
+
import "@nysds/nys-label";
|
|
2
3
|
/**
|
|
3
4
|
* A radio button for single selection within a `nys-radiogroup`. Only one radio with the same `name` can be selected.
|
|
4
5
|
*
|
|
5
6
|
* Use within `nys-radiogroup` for 2-6 mutually exclusive options. For 7+ options, use `nys-select`.
|
|
6
7
|
* For multiple selections, use `nys-checkbox`.
|
|
7
8
|
*
|
|
8
|
-
* @summary Radio button for single selection from mutually exclusive options.
|
|
9
|
+
* @summary Radio button for single selection from mutually exclusive options.
|
|
10
|
+
* This is a READONLY data component when there is no `nys-radiogroup` wrapping the `nys-radiobutton`.
|
|
11
|
+
* Otherwise this radiobutton mockup the native grouping of radio buttons via "name" attribute.
|
|
12
|
+
* Since we can't do that naturally, we have supporting functions to keep track of keyboard navigation, a11y VO, and single radiobutton checked at all times.
|
|
13
|
+
*
|
|
9
14
|
* @element nys-radiobutton
|
|
10
15
|
*
|
|
11
16
|
* @slot description - Custom HTML description content.
|
|
@@ -15,16 +20,120 @@ import { LitElement } from "lit";
|
|
|
15
20
|
* @fires nys-blur - Fired when radio loses focus.
|
|
16
21
|
* @fires nys-other-input - Fired when "other" text input value changes. Detail: `{id, name, value}`.
|
|
17
22
|
*
|
|
18
|
-
*
|
|
23
|
+
*
|
|
24
|
+
* @example Pre-selected
|
|
25
|
+
* ```html
|
|
26
|
+
* <nys-radiogroup label="Select borough">
|
|
27
|
+
* <nys-radiobutton name="borough" value="bronx" label="The Bronx" checked></nys-radiobutton>
|
|
28
|
+
* <nys-radiobutton name="borough" value="brooklyn" label="Brooklyn"></nys-radiobutton>
|
|
29
|
+
* </nys-radiogroup>
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example No group
|
|
33
|
+
* ```html
|
|
34
|
+
* <nys-radiobutton name="borough" value="queens" label="Queens" checked description="Includes Flushing and Astoria"></nys-radiobutton>
|
|
35
|
+
* <nys-radiobutton name="borough" value="manhattan" label="Manhattan" checked>
|
|
36
|
+
* <span slot="description">Home to <strong>Central Park</strong></span>
|
|
37
|
+
* </nys-radiobutton>
|
|
38
|
+
* <nys-radiobutton name="borough" value="brooklyn" label="Brooklyn"></nys-radiobutton>
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @example Pre-selected
|
|
19
42
|
* ```html
|
|
20
|
-
* <nys-radiogroup label="Select borough"
|
|
21
|
-
* <nys-radiobutton name="borough" value="bronx" label="The Bronx"></nys-radiobutton>
|
|
43
|
+
* <nys-radiogroup label="Select borough">
|
|
44
|
+
* <nys-radiobutton name="borough" value="bronx" label="The Bronx" checked></nys-radiobutton>
|
|
22
45
|
* <nys-radiobutton name="borough" value="brooklyn" label="Brooklyn"></nys-radiobutton>
|
|
23
46
|
* </nys-radiogroup>
|
|
24
47
|
* ```
|
|
48
|
+
*
|
|
49
|
+
* /**
|
|
50
|
+
* @example Standalone, one per table row
|
|
51
|
+
* ```html
|
|
52
|
+
* <nys-table striped bordered>
|
|
53
|
+
* <table>
|
|
54
|
+
* <caption>
|
|
55
|
+
* Select the highest priority application for review
|
|
56
|
+
* </caption>
|
|
57
|
+
* <tr>
|
|
58
|
+
* <th>Application</th>
|
|
59
|
+
* <th>Priority</th>
|
|
60
|
+
* </tr>
|
|
61
|
+
* <tr>
|
|
62
|
+
* <td>SNAP Benefits</td>
|
|
63
|
+
* <td>
|
|
64
|
+
* <nys-radiobutton
|
|
65
|
+
* name="priority-application"
|
|
66
|
+
* value="snap"
|
|
67
|
+
* label="Select SNAP Benefits"
|
|
68
|
+
* ></nys-radiobutton>
|
|
69
|
+
* </td>
|
|
70
|
+
* </tr>
|
|
71
|
+
* <tr>
|
|
72
|
+
* <td>Child Care Assistance</td>
|
|
73
|
+
* <td>
|
|
74
|
+
* <nys-radiobutton
|
|
75
|
+
* name="priority-application"
|
|
76
|
+
* value="child-care"
|
|
77
|
+
* label="Select Child Care Assistance"
|
|
78
|
+
* ></nys-radiobutton>
|
|
79
|
+
* </td>
|
|
80
|
+
* </tr>
|
|
81
|
+
* <tr>
|
|
82
|
+
* <td>HEAP</td>
|
|
83
|
+
* <td>
|
|
84
|
+
* <label for="rg-bk1">Brooklyn</label>
|
|
85
|
+
* <input id="rg-bk1" type="radio" name="group" value="Brooklyn"></input>
|
|
86
|
+
* </td>
|
|
87
|
+
* </tr>
|
|
88
|
+
* <tr>
|
|
89
|
+
* <td>Medicaid</td>
|
|
90
|
+
* <td>
|
|
91
|
+
* <label for="rg-bk2">Manhattan</label>
|
|
92
|
+
* <input id="rg-bk2" type="radio" name="group" value="Manhattan"></input>
|
|
93
|
+
* </td>
|
|
94
|
+
* </tr>
|
|
95
|
+
* </table>
|
|
96
|
+
* </nys-table>
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* @example Labelled by a table row header
|
|
100
|
+
* ```html
|
|
101
|
+
* <nys-table striped bordered>
|
|
102
|
+
* <table>
|
|
103
|
+
* <caption>
|
|
104
|
+
* Select the highest priority application for review
|
|
105
|
+
* </caption>
|
|
106
|
+
* <tr>
|
|
107
|
+
* <th scope="col">Application</th>
|
|
108
|
+
* <th scope="col">Priority</th>
|
|
109
|
+
* </tr>
|
|
110
|
+
* <tr>
|
|
111
|
+
* <th scope="row" id="row-snap">SNAP Benefits</th>
|
|
112
|
+
* <td>
|
|
113
|
+
* <nys-radiobutton
|
|
114
|
+
* name="priority-application"
|
|
115
|
+
* value="snap"
|
|
116
|
+
* labelledby="row-snap"
|
|
117
|
+
* hideLabel
|
|
118
|
+
* ></nys-radiobutton>
|
|
119
|
+
* </td>
|
|
120
|
+
* </tr>
|
|
121
|
+
* <tr>
|
|
122
|
+
* <th scope="row" id="row-heap">HEAP</th>
|
|
123
|
+
* <td>
|
|
124
|
+
* <nys-radiobutton
|
|
125
|
+
* name="priority-application"
|
|
126
|
+
* value="heap"
|
|
127
|
+
* labelledby="row-heap"
|
|
128
|
+
* hideLabel
|
|
129
|
+
* ></nys-radiobutton>
|
|
130
|
+
* </td>
|
|
131
|
+
* </tr>
|
|
132
|
+
* </table>
|
|
133
|
+
* </nys-table>
|
|
134
|
+
* ```
|
|
25
135
|
*/
|
|
26
|
-
export declare class NysRadiobutton extends
|
|
27
|
-
static styles: import("lit").CSSResult;
|
|
136
|
+
export declare class NysRadiobutton extends NysFormControlElement {
|
|
28
137
|
/** Whether this radio is selected. Only one per group can be checked. */
|
|
29
138
|
checked: boolean;
|
|
30
139
|
/** Prevents interaction. */
|
|
@@ -52,10 +161,95 @@ export declare class NysRadiobutton extends LitElement {
|
|
|
52
161
|
tile: boolean;
|
|
53
162
|
other: boolean;
|
|
54
163
|
showOtherError: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Id of an element in the host's light-DOM tree to borrow the accessible name
|
|
166
|
+
* from (e.g. a table row `<th>`). Enables labelling a radio button that has no
|
|
167
|
+
* visible label of its own.
|
|
168
|
+
*
|
|
169
|
+
* Standalone radios only: inside a `nys-radiogroup` the group renders the
|
|
170
|
+
* native inputs and names them from the group's own labels.
|
|
171
|
+
*/
|
|
172
|
+
labelledby: string;
|
|
173
|
+
/**
|
|
174
|
+
* Suppress the internal visible `<nys-label>` (use with `labelledby` for
|
|
175
|
+
* table cells). Without `labelledby` there is no visible element left to name
|
|
176
|
+
* the radio from, so the accessible name falls back to the `label` string —
|
|
177
|
+
* pair `hideLabel` with `labelledby` wherever a visible element exists.
|
|
178
|
+
*/
|
|
179
|
+
hideLabel: boolean;
|
|
180
|
+
private _inputEl;
|
|
55
181
|
/**
|
|
56
182
|
* Lifecycle methods
|
|
57
183
|
* --------------------------------------------------------------------------
|
|
58
184
|
*/
|
|
185
|
+
protected createRenderRoot(): this;
|
|
59
186
|
connectedCallback(): void;
|
|
187
|
+
disconnectedCallback(): void;
|
|
188
|
+
firstUpdated(): void;
|
|
189
|
+
updated(changedProperties: Map<string, unknown>): void;
|
|
190
|
+
/**
|
|
191
|
+
* Public validation API (Form Association)
|
|
192
|
+
* --------------------------------------------------------------------------
|
|
193
|
+
*/
|
|
194
|
+
get validity(): ValidityState | undefined;
|
|
195
|
+
get validationMessage(): string;
|
|
196
|
+
private _isGroupChecked;
|
|
197
|
+
private _updateValidity;
|
|
198
|
+
private _updateGroupValidity;
|
|
199
|
+
private _handleInvalid;
|
|
200
|
+
private _handleFocusOut;
|
|
201
|
+
/**
|
|
202
|
+
* Functions
|
|
203
|
+
* --------------------------------------------------------------------------
|
|
204
|
+
*/
|
|
205
|
+
private _isGrouped;
|
|
206
|
+
private _getGroupMembers;
|
|
207
|
+
private _uncheckOtherRadios;
|
|
208
|
+
focus(options?: FocusOptions): void;
|
|
209
|
+
private _forwardDescriptionSlot;
|
|
210
|
+
/**
|
|
211
|
+
* Event Handlers
|
|
212
|
+
* --------------------------------------------------------------------------
|
|
213
|
+
*/
|
|
214
|
+
private _handleChange;
|
|
215
|
+
private _handleKeydown;
|
|
216
|
+
private _handleWrapperClick;
|
|
217
|
+
/** The text the internal `<nys-label>` shows, and the last-resort name. */
|
|
218
|
+
private get _labelText();
|
|
219
|
+
/**
|
|
220
|
+
* This component renders into the light DOM (see createRenderRoot), so the
|
|
221
|
+
* native <input>, the internal <nys-label>, and any external labelling element
|
|
222
|
+
* all share one tree scope: a plain aria-labelledby IDREF resolves natively and
|
|
223
|
+
* needs none of the cross-shadow machinery (associateControlRefs) that
|
|
224
|
+
* nys-checkbox requires.
|
|
225
|
+
*
|
|
226
|
+
* When the referenced element is a <nys-label>, its text lives in ITS shadow
|
|
227
|
+
* root; the reference still names the input because nys-label mirrors `label`
|
|
228
|
+
* onto its host via ElementInternals.ariaLabel — do not remove that mirror.
|
|
229
|
+
* That mirror is also why the internal label must NOT be aria-hidden: the name
|
|
230
|
+
* is read from the element the user can see, which is the whole point.
|
|
231
|
+
*/
|
|
232
|
+
private get _hasExternalLabel();
|
|
233
|
+
private get _renderInternalLabel();
|
|
234
|
+
/** Id of the internal `<nys-label>`, which is also what names the input. */
|
|
235
|
+
private get _internalLabelId();
|
|
236
|
+
/**
|
|
237
|
+
* The `aria-labelledby` IDREF for the native input, resolved in priority order:
|
|
238
|
+
* an author-supplied `labelledby` first, then the visible internal label.
|
|
239
|
+
*
|
|
240
|
+
* Naming the input from the element the user can actually see is what keeps the
|
|
241
|
+
* accessible name and the visible text identical (WCAG 2.5.3 Label in Name).
|
|
242
|
+
* The old path built a separate `aria-label` string from the same `label` prop,
|
|
243
|
+
* which is a copy that can drift and that voice-control users cannot rely on
|
|
244
|
+
* (#1820). This component renders into the light DOM, so a plain IDREF resolves
|
|
245
|
+
* natively in one tree scope.
|
|
246
|
+
*/
|
|
247
|
+
private get _labelledById();
|
|
248
|
+
/**
|
|
249
|
+
* Last-resort accessible name, used only when `hideLabel` suppressed the visible
|
|
250
|
+
* label and no external `labelledby` was given. There is no element left to point
|
|
251
|
+
* at, and a nameless radio is worse than a duplicated string.
|
|
252
|
+
*/
|
|
253
|
+
private get _fallbackAriaLabel();
|
|
60
254
|
render(): import("lit-html").TemplateResult<1>;
|
|
61
255
|
}
|