@nysds/components 1.20.0-alpha-3 → 1.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +9101 -5385
- package/dist/.vscode/vscode.css-custom-data.json +5 -0
- package/dist/.vscode/vscode.html-custom-data.json +332 -30
- package/dist/custom-elements.json +9101 -5385
- package/dist/nys-icon.library-Bu3noJqZ-1mvg_e5Y.js +706 -0
- package/dist/nys-icon.library-Bu3noJqZ-1mvg_e5Y.js.map +1 -0
- package/dist/nys-icon.library-eNVZmfkf.js +696 -0
- package/dist/nys-icon.library-eNVZmfkf.js.map +1 -0
- package/dist/nysds.es.js +10460 -5393
- package/dist/nysds.es.js.map +1 -1
- package/dist/nysds.js +2436 -472
- package/dist/nysds.js.map +1 -1
- package/dist/packages/internals/src/aria-associate.d.ts +41 -0
- package/dist/packages/internals/src/form-control-mixin.d.ts +34 -0
- package/dist/packages/internals/src/id.d.ts +8 -0
- package/dist/packages/internals/src/identified-mixin.d.ts +23 -0
- package/dist/packages/internals/src/index.d.ts +7 -0
- package/dist/packages/internals/src/reflects-aria-mixin.d.ts +33 -0
- package/dist/packages/internals/src/test-helpers.d.ts +29 -0
- package/dist/packages/internals/src/types.d.ts +9 -0
- package/dist/packages/nys-accordion/src/nys-accordion.d.ts +72 -10
- package/dist/packages/nys-accordion/src/nys-accordionitem.d.ts +63 -8
- package/dist/packages/nys-alert/src/nys-alert.d.ts +95 -20
- package/dist/packages/nys-avatar/src/nys-avatar.d.ts +100 -7
- package/dist/packages/nys-backtotop/src/nys-backtotop.d.ts +75 -5
- package/dist/packages/nys-badge/src/nys-badge.d.ts +63 -6
- package/dist/packages/nys-breadcrumbs/src/nys-breadcrumbs.d.ts +79 -10
- package/dist/packages/nys-button/src/nys-button.d.ts +132 -26
- package/dist/packages/nys-card/src/index.d.ts +1 -0
- package/dist/packages/nys-card/src/nys-card.d.ts +325 -0
- package/dist/packages/nys-card/src/nys-card.figma.d.ts +1 -0
- package/dist/packages/nys-checkbox/src/nys-checkbox.d.ts +36 -12
- package/dist/packages/nys-checkbox/src/nys-checkboxgroup.d.ts +81 -6
- package/dist/packages/nys-combobox/src/nys-combobox.d.ts +174 -5
- package/dist/packages/nys-datepicker/src/nys-datepicker.d.ts +83 -13
- package/dist/packages/nys-divider/src/nys-divider.d.ts +33 -9
- package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenu.d.ts +24 -15
- package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenuitem.d.ts +3 -12
- package/dist/packages/nys-errormessage/src/nys-errormessage.d.ts +22 -0
- package/dist/packages/nys-fileinput/src/nys-fileinput.d.ts +101 -12
- package/dist/packages/nys-fileinput/src/nys-fileitem.d.ts +23 -2
- package/dist/packages/nys-globalfooter/src/nys-globalfooter.d.ts +99 -9
- package/dist/packages/nys-globalheader/src/nys-globalheader.d.ts +189 -6
- package/dist/packages/nys-icon/src/icon-cache.d.ts +11 -4
- package/dist/packages/nys-icon/src/icon-library-registry.d.ts +33 -16
- package/dist/packages/nys-icon/src/index.d.ts +2 -2
- package/dist/packages/nys-icon/src/nys-icon.d.ts +98 -8
- package/dist/packages/nys-iconlist/src/index.d.ts +2 -0
- package/dist/packages/nys-iconlist/src/nys-iconlist.d.ts +92 -0
- package/dist/packages/nys-iconlist/src/nys-iconlist.figma.d.ts +1 -0
- package/dist/packages/nys-iconlist/src/nys-iconlistitem.d.ts +32 -0
- package/dist/packages/nys-label/src/nys-label.d.ts +37 -2
- package/dist/packages/nys-modal/src/nys-modal.d.ts +145 -13
- package/dist/packages/nys-pagination/src/nys-pagination.d.ts +67 -3
- package/dist/packages/nys-processlist/src/index.d.ts +2 -0
- package/dist/packages/nys-processlist/src/nys-processlist.d.ts +184 -0
- package/dist/packages/nys-processlist/src/nys-processlist.figma.d.ts +1 -0
- package/dist/packages/nys-processlist/src/nys-processlistitem.d.ts +41 -0
- package/dist/packages/nys-radiobutton/src/nys-radiobutton.d.ts +201 -7
- package/dist/packages/nys-radiobutton/src/nys-radiogroup.d.ts +88 -6
- package/dist/packages/nys-select/src/nys-option.d.ts +0 -8
- package/dist/packages/nys-select/src/nys-select.d.ts +150 -15
- package/dist/packages/nys-skipnav/src/nys-skipnav.d.ts +4 -4
- package/dist/packages/nys-stepper/src/nys-step.d.ts +26 -20
- package/dist/packages/nys-stepper/src/nys-stepper.d.ts +128 -75
- package/dist/packages/nys-tab/src/nys-tab.d.ts +19 -10
- package/dist/packages/nys-tab/src/nys-tabgroup.d.ts +181 -39
- package/dist/packages/nys-tab/src/nys-tabpanel.d.ts +15 -24
- package/dist/packages/nys-table/src/nys-table.d.ts +90 -3
- package/dist/packages/nys-textarea/src/nys-textarea.d.ts +60 -10
- package/dist/packages/nys-textinput/src/nys-textinput.d.ts +77 -14
- package/dist/packages/nys-toggle/src/nys-toggle.d.ts +47 -10
- package/dist/packages/nys-tooltip/src/nys-tooltip.d.ts +48 -8
- package/dist/packages/nys-unavfooter/src/nys-unavfooter.d.ts +45 -4
- package/dist/packages/nys-unavheader/src/nys-unavheader.d.ts +216 -11
- package/dist/packages/nys-verticalnav/src/index.d.ts +2 -0
- package/dist/packages/nys-verticalnav/src/nys-verticalnav.d.ts +572 -0
- package/dist/packages/nys-verticalnav/src/nys-verticalnav.figma.d.ts +1 -0
- package/dist/packages/nys-verticalnav/src/nys-verticalnavgroup.d.ts +24 -0
- package/dist/packages/nys-video/src/nys-video.d.ts +67 -7
- package/dist/src/index.d.ts +6 -2
- package/package.json +11 -6
- package/packages/react/NysAccordion.d.ts +10 -0
- package/packages/react/NysAccordion.js +2 -1
- package/packages/react/NysAccordionItem.d.ts +10 -0
- package/packages/react/NysAccordionItem.js +3 -1
- package/packages/react/NysAlert.d.ts +8 -10
- package/packages/react/NysAlert.js +0 -2
- package/packages/react/NysAvatar.d.ts +11 -1
- package/packages/react/NysBacktotop.d.ts +3 -0
- package/packages/react/NysBacktotop.js +2 -1
- package/packages/react/NysBreadcrumbs.d.ts +2 -2
- package/packages/react/NysButton.d.ts +38 -8
- package/packages/react/NysButton.js +6 -4
- package/packages/react/NysCard.d.ts +110 -0
- package/packages/react/NysCard.js +61 -0
- package/packages/react/NysCheckbox.d.ts +9 -0
- package/packages/react/NysCheckbox.js +4 -0
- package/packages/react/NysDropdownMenu.d.ts +4 -2
- package/packages/react/NysFileinput.d.ts +2 -2
- package/packages/react/NysGlobalFooter.d.ts +17 -0
- package/packages/react/NysGlobalFooter.js +10 -2
- package/packages/react/NysGlobalHeader.d.ts +17 -0
- package/packages/react/NysGlobalHeader.js +11 -2
- package/packages/react/NysIconlist.d.ts +54 -0
- package/packages/react/NysIconlist.js +22 -0
- package/packages/react/NysIconlistitem.d.ts +59 -0
- package/packages/react/NysIconlistitem.js +22 -0
- package/packages/react/NysLabel.d.ts +4 -1
- package/packages/react/NysModal.d.ts +8 -1
- package/packages/react/NysModal.js +11 -2
- package/packages/react/NysProcesslist.d.ts +65 -0
- package/packages/react/NysProcesslist.js +25 -0
- package/packages/react/NysProcesslistitem.d.ts +61 -0
- package/packages/react/NysProcesslistitem.js +35 -0
- package/packages/react/NysRadiobutton.d.ts +27 -3
- package/packages/react/NysRadiobutton.js +9 -1
- package/packages/react/NysSelect.d.ts +3 -0
- package/packages/react/NysSelect.js +2 -0
- package/packages/react/NysStepper.d.ts +1 -1
- package/packages/react/NysTabgroup.d.ts +5 -4
- package/packages/react/NysTable.d.ts +1 -1
- package/packages/react/NysTabpanel.d.ts +11 -4
- package/packages/react/NysTextarea.d.ts +4 -1
- package/packages/react/NysTextarea.js +2 -0
- package/packages/react/NysUnavFooter.d.ts +13 -0
- package/packages/react/NysUnavFooter.js +4 -1
- package/packages/react/NysUnavHeader.d.ts +24 -1
- package/packages/react/NysUnavHeader.js +17 -1
- package/packages/react/NysVerticalnav.d.ts +67 -0
- package/packages/react/NysVerticalnav.js +26 -0
- package/packages/react/NysVerticalnavGroup.d.ts +76 -0
- package/packages/react/NysVerticalnavGroup.js +43 -0
- package/packages/react/index.d.ts +7 -0
- package/packages/react/index.js +7 -0
- package/packages/react/nysds-jsx.d.ts +404 -46
|
@@ -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
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NysFormControlElement } from "@nysds/internals";
|
|
2
|
+
import "@nysds/nys-label";
|
|
3
|
+
import "@nysds/nys-errormessage";
|
|
4
|
+
import "@nysds/nys-textinput";
|
|
2
5
|
/**
|
|
3
6
|
* A container for grouping `nys-radiobutton` elements as a single form control with enforced single selection.
|
|
4
7
|
* Handles keyboard navigation (arrow keys), validation, required constraints, and form integration.
|
|
@@ -12,7 +15,7 @@ import { LitElement } from "lit";
|
|
|
12
15
|
* @slot - Default slot for `nys-radiobutton` elements.
|
|
13
16
|
* @slot description - Custom HTML description content.
|
|
14
17
|
*
|
|
15
|
-
* @example Basic
|
|
18
|
+
* @example Basic
|
|
16
19
|
* ```html
|
|
17
20
|
* <nys-radiogroup label="Select borough" required>
|
|
18
21
|
* <nys-radiobutton name="borough" value="bronx" label="The Bronx"></nys-radiobutton>
|
|
@@ -20,8 +23,85 @@ import { LitElement } from "lit";
|
|
|
20
23
|
* <nys-radiobutton name="borough" value="manhattan" label="Manhattan"></nys-radiobutton>
|
|
21
24
|
* </nys-radiogroup>
|
|
22
25
|
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example Tile
|
|
28
|
+
* ```html
|
|
29
|
+
* <nys-radiogroup label="Select borough" tile>
|
|
30
|
+
* <nys-radiobutton name="borough" value="bronx" label="The Bronx"></nys-radiobutton>
|
|
31
|
+
* <nys-radiobutton name="borough" value="brooklyn" label="Brooklyn"></nys-radiobutton>
|
|
32
|
+
* </nys-radiogroup>
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example Required
|
|
36
|
+
* ```html
|
|
37
|
+
* <nys-radiogroup label="Select borough" required>
|
|
38
|
+
* <nys-radiobutton name="borough" value="bronx" label="The Bronx"></nys-radiobutton>
|
|
39
|
+
* <nys-radiobutton name="borough" value="brooklyn" label="Brooklyn"></nys-radiobutton>
|
|
40
|
+
* </nys-radiogroup>
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @example Optional
|
|
44
|
+
* ```html
|
|
45
|
+
* <nys-radiogroup label="Select borough" optional>
|
|
46
|
+
* <nys-radiobutton name="borough" value="bronx" label="The Bronx"></nys-radiobutton>
|
|
47
|
+
* <nys-radiobutton name="borough" value="brooklyn" label="Brooklyn"></nys-radiobutton>
|
|
48
|
+
* </nys-radiogroup>
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @example Disabled
|
|
52
|
+
* ```html
|
|
53
|
+
* <nys-radiogroup label="Select borough">
|
|
54
|
+
* <nys-radiobutton name="borough" value="bronx" label="The Bronx" disabled></nys-radiobutton>
|
|
55
|
+
* <nys-radiobutton name="borough" value="brooklyn" label="Brooklyn" disabled></nys-radiobutton>
|
|
56
|
+
* </nys-radiogroup>
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @example Size Small
|
|
60
|
+
* ```html
|
|
61
|
+
* <nys-radiogroup label="Select borough" size="sm">
|
|
62
|
+
* <nys-radiobutton name="borough" value="bronx" label="The Bronx"></nys-radiobutton>
|
|
63
|
+
* <nys-radiobutton name="borough" value="brooklyn" label="Brooklyn"></nys-radiobutton>
|
|
64
|
+
* </nys-radiogroup>
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* @example Other Option
|
|
68
|
+
* ```html
|
|
69
|
+
* <nys-radiogroup label="Select borough">
|
|
70
|
+
* <nys-radiobutton name="borough" value="bronx" label="The Bronx"></nys-radiobutton>
|
|
71
|
+
* <nys-radiobutton name="borough" value="" label="Other" other></nys-radiobutton>
|
|
72
|
+
* </nys-radiogroup>
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @example Error Message
|
|
76
|
+
* ```html
|
|
77
|
+
* <nys-radiogroup label="Select borough" showError errorMessage="Please select a borough">
|
|
78
|
+
* <nys-radiobutton name="borough" value="bronx" label="The Bronx"></nys-radiobutton>
|
|
79
|
+
* <nys-radiobutton name="borough" value="brooklyn" label="Brooklyn"></nys-radiobutton>
|
|
80
|
+
* </nys-radiogroup>
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* @example Description
|
|
84
|
+
* ```html
|
|
85
|
+
* <nys-radiogroup label="Select borough" description="Your primary residence in NYC.">
|
|
86
|
+
* <nys-radiobutton name="borough" value="bronx" label="The Bronx"></nys-radiobutton>
|
|
87
|
+
* <nys-radiobutton name="borough" value="brooklyn" label="Brooklyn"></nys-radiobutton>
|
|
88
|
+
* </nys-radiogroup>
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* @example Description Slot
|
|
92
|
+
* ```html
|
|
93
|
+
* <nys-radiogroup label="What is your primary work location?">
|
|
94
|
+
* <label slot="description">This is the location you use for your <a href="https://www.ny.gov/" target="__blank">in office days.</a></label>
|
|
95
|
+
* <nys-radiobutton name="office" label="Albany" value="albany">
|
|
96
|
+
* <label slot="description">A part of <a href="https://www.ny.gov/" target="__blank">Upstate New York</a></label>
|
|
97
|
+
* </nys-radiobutton>
|
|
98
|
+
* <nys-radiobutton name="office" label="Manhattan" value="manhattan">
|
|
99
|
+
* <label slot="description">A part of <a href="https://www.ny.gov/" target="__blank">New York City</a></label>
|
|
100
|
+
* </nys-radiobutton>
|
|
101
|
+
* </nys-radiogroup>
|
|
102
|
+
* ```
|
|
23
103
|
*/
|
|
24
|
-
export declare class NysRadiogroup extends
|
|
104
|
+
export declare class NysRadiogroup extends NysFormControlElement {
|
|
25
105
|
static styles: import("lit").CSSResult;
|
|
26
106
|
static shadowRootOptions: {
|
|
27
107
|
delegatesFocus: boolean;
|
|
@@ -66,13 +146,14 @@ export declare class NysRadiogroup extends LitElement {
|
|
|
66
146
|
private isMobile;
|
|
67
147
|
private _hasUserInteracted;
|
|
68
148
|
private _childObserver?;
|
|
69
|
-
private _internals;
|
|
70
149
|
/**
|
|
71
150
|
* Lifecycle methods
|
|
72
151
|
* --------------------------------------------------------------------------
|
|
152
|
+
* Form association, ElementInternals, and id generation are provided by
|
|
153
|
+
* NysFormControlElement (@nysds/internals). super.connectedCallback()
|
|
154
|
+
* assigns an id (prefix = localName) when one is not provided.
|
|
73
155
|
*/
|
|
74
|
-
|
|
75
|
-
constructor();
|
|
156
|
+
protected get defaultRole(): string | null;
|
|
76
157
|
connectedCallback(): void;
|
|
77
158
|
disconnectedCallback(): void;
|
|
78
159
|
firstUpdated(): Promise<void>;
|
|
@@ -100,6 +181,7 @@ export declare class NysRadiogroup extends LitElement {
|
|
|
100
181
|
private _updateRadioButtonsSize;
|
|
101
182
|
private _selectRadio;
|
|
102
183
|
private _getSlotDescriptionForAria;
|
|
184
|
+
private _forwardRadioDescriptions;
|
|
103
185
|
/**
|
|
104
186
|
* Event Handlers
|
|
105
187
|
* --------------------------------------------------------------------------
|
|
@@ -9,14 +9,6 @@ import { LitElement } from "lit";
|
|
|
9
9
|
* @element nys-option
|
|
10
10
|
*
|
|
11
11
|
* @slot - Option label text. Auto-populates the `label` prop if provided.
|
|
12
|
-
*
|
|
13
|
-
* @example Basic options
|
|
14
|
-
* ```html
|
|
15
|
-
* <nys-select>
|
|
16
|
-
* <nys-option value="ny">New York</nys-option>
|
|
17
|
-
* <nys-option value="ca" disabled>California</nys-option>
|
|
18
|
-
* </nys-select>
|
|
19
|
-
* ```
|
|
20
12
|
*/
|
|
21
13
|
export declare class NysOption extends LitElement {
|
|
22
14
|
/** Prevents selection of this option. */
|