@nysds/components 1.16.0 → 1.17.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 +543 -52
- package/dist/.vscode/vscode.html-custom-data.json +62 -9
- package/dist/custom-elements.json +543 -52
- package/dist/nysds.es.js +2030 -1773
- package/dist/nysds.es.js.map +1 -1
- package/dist/nysds.js +172 -168
- package/dist/nysds.js.map +1 -1
- package/dist/packages/nys-breadcrumbs/src/index.d.ts +1 -0
- package/dist/packages/nys-breadcrumbs/src/nys-breadcrumbs.d.ts +119 -0
- package/dist/packages/nys-breadcrumbs/src/nys-breadcrumbs.figma.d.ts +1 -0
- package/dist/packages/nys-button/src/nys-button.d.ts +2 -2
- package/dist/packages/nys-combobox/src/nys-combobox.d.ts +8 -0
- package/dist/packages/nys-datepicker/src/nys-datepicker.d.ts +6 -0
- package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenu.d.ts +3 -1
- package/dist/packages/nys-errormessage/src/nys-errormessage.d.ts +2 -2
- package/dist/packages/nys-label/src/nys-label.d.ts +9 -6
- package/dist/packages/nys-textarea/src/nys-textarea.d.ts +1 -1
- package/dist/packages/nys-textinput/src/nys-textinput.d.ts +2 -1
- package/dist/packages/nys-video/src/nys-video.d.ts +25 -0
- package/dist/src/index.d.ts +1 -0
- package/package.json +11 -10
- package/packages/react/NysBreadcrumbItem.d.ts +72 -0
- package/packages/react/NysBreadcrumbItem.js +42 -0
- package/packages/react/NysBreadcrumbs.d.ts +89 -0
- package/packages/react/NysBreadcrumbs.js +50 -0
- package/packages/react/NysButton.d.ts +2 -2
- package/packages/react/NysDatepicker.d.ts +6 -0
- package/packages/react/NysDatepicker.js +4 -0
- package/packages/react/NysErrorMessage.d.ts +3 -0
- package/packages/react/NysErrorMessage.js +2 -1
- package/packages/react/NysLabel.d.ts +16 -4
- package/packages/react/NysLabel.js +17 -3
- package/packages/react/NysVideo.d.ts +7 -1
- package/packages/react/NysVideo.js +14 -1
- package/packages/react/index.d.ts +1 -0
- package/packages/react/index.js +1 -0
- package/packages/react/nysds-jsx.d.ts +63 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./nys-breadcrumbs";
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* A breadcrumb navigation trail composed of `nys-breadcrumbitem` elements.
|
|
4
|
+
* Collapses when the trail exceeds 5 items on desktop or 3 items on mobile,
|
|
5
|
+
* showing the first, last, and item before the current page, with an ellipsis to expand.
|
|
6
|
+
* A single item renders as a back-to-parent link instead of a trail.
|
|
7
|
+
*
|
|
8
|
+
* @summary Breadcrumb navigation trail with responsive collapse support.
|
|
9
|
+
* @element nys-breadcrumbs
|
|
10
|
+
*
|
|
11
|
+
* @slot - One or more `nys-breadcrumbitem` elements defining the trail.
|
|
12
|
+
*
|
|
13
|
+
* @fires nys-breadcrumbs-expand - Fired when the user clicks the ellipsis to expand the trail.
|
|
14
|
+
*
|
|
15
|
+
* @example Full trail with current page
|
|
16
|
+
* ```html
|
|
17
|
+
* <nys-breadcrumbs>
|
|
18
|
+
* <ol>
|
|
19
|
+
* <li><a href="/">Home</a></li>
|
|
20
|
+
* <li><a href="/services">Services</a></li>
|
|
21
|
+
* <li>Current Page</li>
|
|
22
|
+
* </ol>
|
|
23
|
+
* </nys-breadcrumbs>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @example Trail without current page
|
|
27
|
+
* ```html
|
|
28
|
+
* <nys-breadcrumbs>
|
|
29
|
+
* <ol>
|
|
30
|
+
* <li><a href="/">Home</a></li>
|
|
31
|
+
* <li><a href="/services">Services</a></li>
|
|
32
|
+
* </ol>
|
|
33
|
+
* </nys-breadcrumbs>
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @example Single item renders as back-to-parent
|
|
37
|
+
* ```html
|
|
38
|
+
* <nys-breadcrumbs>
|
|
39
|
+
* <ol>
|
|
40
|
+
* <li><a href="/services">Services</a></li>
|
|
41
|
+
* </ol>
|
|
42
|
+
* </nys-breadcrumbs>
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare class NysBreadcrumbs extends LitElement {
|
|
46
|
+
static styles: import("lit").CSSResult;
|
|
47
|
+
/**
|
|
48
|
+
* Unique identifier. Auto-generated if not provided.
|
|
49
|
+
*/
|
|
50
|
+
id: string;
|
|
51
|
+
/**
|
|
52
|
+
* Accessible label for the `<nav>` landmark. Defaults to "path to this page" if not set.
|
|
53
|
+
* Override when multiple crumbs exist on the same page.
|
|
54
|
+
*/
|
|
55
|
+
ariaLabel: string;
|
|
56
|
+
/**
|
|
57
|
+
* Controls the visual size of the breadcrumb text and spacing: `sm` for dense layouts, `md` (default) for standard use.
|
|
58
|
+
* @default "md"
|
|
59
|
+
*/
|
|
60
|
+
size: "sm" | "md" | "";
|
|
61
|
+
/**
|
|
62
|
+
* On mobile, renders the trail as a single back-to-parent link pointing to the item before the current page.
|
|
63
|
+
* Has no effect on desktop or when only one item is present (which always renders as a back link).
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
backToParent: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Forces the trail into its collapsed state.
|
|
69
|
+
* It shows only the first item, an ellipsis, and the last two items.
|
|
70
|
+
* The user can still expand the trail by clicking the ellipsis.
|
|
71
|
+
* @default false
|
|
72
|
+
*/
|
|
73
|
+
collapsed: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Renders a filled light theme background bar behind the breadcrumb trail.
|
|
76
|
+
* @default false
|
|
77
|
+
*/
|
|
78
|
+
backgroundBar: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Prevents interaction.
|
|
81
|
+
* @default false
|
|
82
|
+
*/
|
|
83
|
+
disabled: boolean;
|
|
84
|
+
private _collapseThreshold;
|
|
85
|
+
private _manuallyExpanded;
|
|
86
|
+
private _mediaQuery;
|
|
87
|
+
/**
|
|
88
|
+
* Lifecycle methods
|
|
89
|
+
* --------------------------------------------------------------------------
|
|
90
|
+
*/
|
|
91
|
+
constructor();
|
|
92
|
+
connectedCallback(): void;
|
|
93
|
+
disconnectedCallback(): void;
|
|
94
|
+
firstUpdated(): void;
|
|
95
|
+
updated(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
96
|
+
/**
|
|
97
|
+
* Functions
|
|
98
|
+
* --------------------------------------------------------------------------
|
|
99
|
+
*/
|
|
100
|
+
private _updateCollapseThreshold;
|
|
101
|
+
private _getSlottedOl;
|
|
102
|
+
private _getSlottedItems;
|
|
103
|
+
private _getAnchor;
|
|
104
|
+
private _isCurrentPage;
|
|
105
|
+
private _createBackToParentElement;
|
|
106
|
+
private _createCrumbElement;
|
|
107
|
+
/**
|
|
108
|
+
* Main logic for cloning and handling user slots.
|
|
109
|
+
* New <ol>, <li>, and <a> tags are created and rendered out as crumbs for the breadcrumbs trail.
|
|
110
|
+
*/
|
|
111
|
+
private _handleSlotChange;
|
|
112
|
+
private _moveFocusToFirstExpandCrumb;
|
|
113
|
+
/**
|
|
114
|
+
* Event Handlers
|
|
115
|
+
* --------------------------------------------------------------------------
|
|
116
|
+
*/
|
|
117
|
+
private _dispatchExpandEvent;
|
|
118
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
119
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -108,11 +108,11 @@ export declare class NysButton extends LitElement {
|
|
|
108
108
|
*/
|
|
109
109
|
ariaControls: string;
|
|
110
110
|
/**
|
|
111
|
-
* Material Symbol icon before label. Not shown for `
|
|
111
|
+
* Material Symbol icon before label. Not shown for `circle` mode.
|
|
112
112
|
*/
|
|
113
113
|
prefixIcon: string;
|
|
114
114
|
/**
|
|
115
|
-
* Material Symbol icon after label. Use `chevron_down` for dropdowns, `open_in_new` for external links. Not shown for `
|
|
115
|
+
* Material Symbol icon after label. Use `chevron_down` for dropdowns, `open_in_new` for external links. Not shown for `circle` mode.
|
|
116
116
|
*/
|
|
117
117
|
suffixIcon: string;
|
|
118
118
|
/**
|
|
@@ -22,6 +22,14 @@ import { LitElement } from "lit";
|
|
|
22
22
|
*/
|
|
23
23
|
export declare class NysCombobox extends LitElement {
|
|
24
24
|
static styles: import("lit").CSSResult;
|
|
25
|
+
static shadowRootOptions: {
|
|
26
|
+
delegatesFocus: boolean;
|
|
27
|
+
clonable?: boolean;
|
|
28
|
+
customElementRegistry?: CustomElementRegistry;
|
|
29
|
+
mode: ShadowRootMode;
|
|
30
|
+
serializable?: boolean;
|
|
31
|
+
slotAssignment?: SlotAssignmentMode;
|
|
32
|
+
};
|
|
25
33
|
id: string;
|
|
26
34
|
name: string;
|
|
27
35
|
label: string;
|
|
@@ -87,6 +87,10 @@ export declare class NysDatepicker extends LitElement {
|
|
|
87
87
|
description: string;
|
|
88
88
|
/** Initial date when calendar opens (YYYY-MM-DD). */
|
|
89
89
|
startDate: string;
|
|
90
|
+
/** The earliest selectable date (YYYY-MM-DD). */
|
|
91
|
+
minDate: string;
|
|
92
|
+
/** The latest selectable date (YYYY-MM-DD). */
|
|
93
|
+
maxDate: string;
|
|
90
94
|
/** Dark background mode. */
|
|
91
95
|
inverted: boolean;
|
|
92
96
|
/** Selected date. Accepts Date object or ISO string (YYYY-MM-DD). */
|
|
@@ -103,6 +107,7 @@ export declare class NysDatepicker extends LitElement {
|
|
|
103
107
|
connectedCallback(): void;
|
|
104
108
|
disconnectedCallback(): void;
|
|
105
109
|
firstUpdated(): Promise<void>;
|
|
110
|
+
updated(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
106
111
|
private _whenWcDatepickerReady;
|
|
107
112
|
/**
|
|
108
113
|
* Form Integration
|
|
@@ -148,6 +153,7 @@ export declare class NysDatepicker extends LitElement {
|
|
|
148
153
|
private _parseLocalDate;
|
|
149
154
|
private _setTodayDate;
|
|
150
155
|
private _setFocusOnTodayDate;
|
|
156
|
+
private _isOutOfRange;
|
|
151
157
|
private _dispatchInputEvent;
|
|
152
158
|
/**
|
|
153
159
|
* Event Handlers
|
|
@@ -38,6 +38,7 @@ export declare class NysDropdownMenu extends LitElement {
|
|
|
38
38
|
private _trigger;
|
|
39
39
|
private _menuElement;
|
|
40
40
|
private _ariaTarget;
|
|
41
|
+
private _lastFocusedIndex;
|
|
41
42
|
private readonly GAP;
|
|
42
43
|
/**
|
|
43
44
|
* Lifecycle Methods
|
|
@@ -57,7 +58,7 @@ export declare class NysDropdownMenu extends LitElement {
|
|
|
57
58
|
private _closeDropdown;
|
|
58
59
|
private _getMenuItems;
|
|
59
60
|
private _handleDocumentClick;
|
|
60
|
-
private
|
|
61
|
+
private _focusOnItem;
|
|
61
62
|
private applyInverseTransform;
|
|
62
63
|
/**
|
|
63
64
|
* Position Logic
|
|
@@ -101,6 +102,7 @@ export declare class NysDropdownMenu extends LitElement {
|
|
|
101
102
|
* Event Handlers
|
|
102
103
|
* --------------------------------------------------------------------------
|
|
103
104
|
*/
|
|
105
|
+
private _handleMenuClick;
|
|
104
106
|
private _handleTriggerKeydown;
|
|
105
107
|
private _handleMenuKeydown;
|
|
106
108
|
private _handleWindowResize;
|
|
@@ -10,18 +10,18 @@ import { LitElement } from "lit";
|
|
|
10
10
|
*/
|
|
11
11
|
export declare class NysErrorMessage extends LitElement {
|
|
12
12
|
static styles: import("lit").CSSResult;
|
|
13
|
+
/** The "id" of the error message. */
|
|
14
|
+
id: string;
|
|
13
15
|
/** Whether to display the error message. */
|
|
14
16
|
showError: boolean;
|
|
15
17
|
/** Error text to display. Falls back to native validation message if available. */
|
|
16
18
|
errorMessage: string;
|
|
17
19
|
/** Shows a divider line above the error message. */
|
|
18
20
|
showDivider: boolean;
|
|
19
|
-
private _internals;
|
|
20
21
|
/**
|
|
21
22
|
* Lifecycle methods
|
|
22
23
|
* --------------------------------------------------------------------------
|
|
23
24
|
*/
|
|
24
|
-
static formAssociated: boolean;
|
|
25
25
|
constructor();
|
|
26
26
|
render(): import("lit-html").TemplateResult<1>;
|
|
27
27
|
}
|
|
@@ -12,8 +12,8 @@ import { LitElement } from "lit";
|
|
|
12
12
|
*/
|
|
13
13
|
export declare class NysLabel extends LitElement {
|
|
14
14
|
static styles: import("lit").CSSResult;
|
|
15
|
-
/** ID of the
|
|
16
|
-
|
|
15
|
+
/** The ID of the label. */
|
|
16
|
+
id: string;
|
|
17
17
|
/** Label text displayed above the form field. */
|
|
18
18
|
label: string;
|
|
19
19
|
/** Helper text displayed below the label. */
|
|
@@ -23,13 +23,16 @@ export declare class NysLabel extends LitElement {
|
|
|
23
23
|
/** Adjusts colors for dark backgrounds. */
|
|
24
24
|
inverted: boolean;
|
|
25
25
|
/** Tooltip text shown on hover/focus of info icon next to label. */
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
private _tooltip;
|
|
26
|
+
tooltip: string;
|
|
27
|
+
connectedCallback(): void;
|
|
29
28
|
/**
|
|
30
29
|
* Event Handlers
|
|
31
30
|
* --------------------------------------------------------------------------
|
|
32
31
|
*/
|
|
33
|
-
|
|
32
|
+
/**
|
|
33
|
+
* While most components don't need to listen for this event.
|
|
34
|
+
* Special components like "nys-fileinput" and "nys-toggle" need to listen for label to execute their specific functionalities.
|
|
35
|
+
*/
|
|
36
|
+
private _dispatchLabelClick;
|
|
34
37
|
render(): import("lit-html").TemplateResult<1>;
|
|
35
38
|
}
|
|
@@ -83,7 +83,6 @@ export declare class NysTextarea extends LitElement {
|
|
|
83
83
|
showError: boolean;
|
|
84
84
|
/** Error message text. Shown only when `showError` is true. */
|
|
85
85
|
errorMessage: string;
|
|
86
|
-
updated(changedProperties: Map<string | number | symbol, unknown>): Promise<void>;
|
|
87
86
|
private _hasUserInteracted;
|
|
88
87
|
private _internals;
|
|
89
88
|
/**
|
|
@@ -95,6 +94,7 @@ export declare class NysTextarea extends LitElement {
|
|
|
95
94
|
connectedCallback(): void;
|
|
96
95
|
disconnectedCallback(): void;
|
|
97
96
|
firstUpdated(): void;
|
|
97
|
+
updated(changedProperties: Map<string | number | symbol, unknown>): Promise<void>;
|
|
98
98
|
/**
|
|
99
99
|
* Form Integration
|
|
100
100
|
* --------------------------------------------------------------------------
|
|
@@ -101,6 +101,7 @@ export declare class NysTextinput extends LitElement {
|
|
|
101
101
|
showError: boolean;
|
|
102
102
|
/** Error message text. Shown only when `showError` is true. */
|
|
103
103
|
errorMessage: string;
|
|
104
|
+
private _inputEl;
|
|
104
105
|
private showPassword;
|
|
105
106
|
private _originalErrorMessage;
|
|
106
107
|
private _hasUserInteracted;
|
|
@@ -114,7 +115,7 @@ export declare class NysTextinput extends LitElement {
|
|
|
114
115
|
constructor();
|
|
115
116
|
connectedCallback(): void;
|
|
116
117
|
disconnectedCallback(): void;
|
|
117
|
-
firstUpdated(): void
|
|
118
|
+
firstUpdated(): Promise<void>;
|
|
118
119
|
updated(changedProperties: Map<string | number | symbol, unknown>): Promise<void>;
|
|
119
120
|
/**
|
|
120
121
|
* Form Integration
|
|
@@ -5,6 +5,27 @@ declare global {
|
|
|
5
5
|
onYouTubeIframeAPIReady: () => void;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* A YouTube video player with a thumbnail preview and play button.
|
|
10
|
+
* Loads the iframe only after the user clicks play, keeping initial page load light.
|
|
11
|
+
* Supports autoplay (muted), custom thumbnails, start time, lazy loading, and disabled state.
|
|
12
|
+
* Announces playback state and ad state to screen readers via a live region.
|
|
13
|
+
*
|
|
14
|
+
* For use with YouTube URLs only. Component renders nothing if the URL is invalid.
|
|
15
|
+
*
|
|
16
|
+
* @summary YouTube video player with thumbnail preview and accessibility announcements.
|
|
17
|
+
* @element nys-video
|
|
18
|
+
*
|
|
19
|
+
* @fires nys-video-play - Fired when the user clicks the thumbnail to load the player.
|
|
20
|
+
*
|
|
21
|
+
* @example Basic usage
|
|
22
|
+
* ```html
|
|
23
|
+
* <nys-video
|
|
24
|
+
* videourl="https://www.youtube.com/watch?v=dQw4w9WgXcQ"
|
|
25
|
+
* titleText="Video Title"
|
|
26
|
+
* ></nys-video>
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
8
29
|
export declare class NysVideo extends LitElement {
|
|
9
30
|
static styles: import("lit").CSSResult;
|
|
10
31
|
/** Full YouTube URL — required. Component will not render if invalid. */
|
|
@@ -36,6 +57,10 @@ export declare class NysVideo extends LitElement {
|
|
|
36
57
|
private _announcement;
|
|
37
58
|
/** Tracks whether an ad is currently playing to suppress false "Video is playing" announcements */
|
|
38
59
|
private _adPlaying;
|
|
60
|
+
/**
|
|
61
|
+
* Lifecycle methods
|
|
62
|
+
* --------------------------------------------------------------------------
|
|
63
|
+
*/
|
|
39
64
|
constructor();
|
|
40
65
|
connectedCallback(): void;
|
|
41
66
|
disconnectedCallback(): void;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from "../packages/nys-accordion/src/index";
|
|
|
2
2
|
export * from "../packages/nys-alert/src/index";
|
|
3
3
|
export * from "../packages/nys-avatar/src/index";
|
|
4
4
|
export * from "../packages/nys-backtotop/src/index";
|
|
5
|
+
export * from "../packages/nys-breadcrumbs/src/index";
|
|
5
6
|
export * from "../packages/nys-button/src/index";
|
|
6
7
|
export * from "../packages/nys-badge/src/index";
|
|
7
8
|
export * from "../packages/nys-checkbox/src/index";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nysds/components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"description": "New York State's design system and code component library.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"workspaces": [
|
|
@@ -53,7 +53,8 @@
|
|
|
53
53
|
"mcp-server:build": "turbo run build --filter=@nysds/mcp-server",
|
|
54
54
|
"clean:node": "rm -rf node_modules && rm -rf packages/*/node_modules && rm -rf packages/**/*/node_modules",
|
|
55
55
|
"clean:dist": "rm -rf storybook-static && rm -rf coverage && rm -rf packages/*/coverage && rm -rf dist && find packages -type d -name dist ! -path '*/mcp-server/dist' -exec rm -rf {} + 2>/dev/null || true",
|
|
56
|
-
"clean:
|
|
56
|
+
"clean:turbo": "find packages -type d -name '.turbo' -exec rm -rf {} + && rm -rf .turbo",
|
|
57
|
+
"clean:all": "npm run clean:dist && npm run clean:node && find packages -name '*.tsbuildinfo' -delete 2>/dev/null || true && npm run clean:turbo",
|
|
57
58
|
"code-connect": "dotenv -- npx figma connect publish",
|
|
58
59
|
"cem": "npx cem analyze --config ./custom-elements-manifest.config.mjs && cp ./custom-elements.json dist/ && node src/scripts/patch-react-utils.js"
|
|
59
60
|
},
|
|
@@ -69,15 +70,15 @@
|
|
|
69
70
|
"homepage": "https://designsystem.ny.gov/",
|
|
70
71
|
"packageManager": "npm@11.6.2",
|
|
71
72
|
"devDependencies": {
|
|
72
|
-
"@chromatic-com/storybook": "^5.
|
|
73
|
+
"@chromatic-com/storybook": "^5.1.2",
|
|
73
74
|
"@custom-elements-manifest/analyzer": "^0.11.0",
|
|
74
75
|
"@figma/code-connect": "^1.4.0",
|
|
75
76
|
"@floating-ui/dom": "^1.7.4",
|
|
76
77
|
"@open-wc/testing": "^4.0.0",
|
|
77
|
-
"@storybook/addon-a11y": "10.
|
|
78
|
-
"@storybook/addon-docs": "10.
|
|
79
|
-
"@storybook/addon-links": "10.
|
|
80
|
-
"@storybook/web-components-vite": "10.
|
|
78
|
+
"@storybook/addon-a11y": "10.3.5",
|
|
79
|
+
"@storybook/addon-docs": "10.3.5",
|
|
80
|
+
"@storybook/addon-links": "10.3.5",
|
|
81
|
+
"@storybook/web-components-vite": "10.3.5",
|
|
81
82
|
"@types/mocha": "^10.0.10",
|
|
82
83
|
"@typescript-eslint/eslint-plugin": "^8.46.2",
|
|
83
84
|
"@typescript-eslint/parser": "^8.46.2",
|
|
@@ -95,7 +96,7 @@
|
|
|
95
96
|
"eslint": "^10.0.0",
|
|
96
97
|
"eslint-plugin-lit": "^2.2.1",
|
|
97
98
|
"eslint-plugin-prettier": "^5.5.5",
|
|
98
|
-
"eslint-plugin-storybook": "10.
|
|
99
|
+
"eslint-plugin-storybook": "10.3.5",
|
|
99
100
|
"i": "^0.3.7",
|
|
100
101
|
"lit": "^3.3.1",
|
|
101
102
|
"lit-analyzer": "^2.0.3",
|
|
@@ -106,7 +107,7 @@
|
|
|
106
107
|
"rollup-plugin-visualizer": "^6.0.5",
|
|
107
108
|
"sass": "^1.94.0",
|
|
108
109
|
"sinon": "^21.0.0",
|
|
109
|
-
"storybook": "10.
|
|
110
|
+
"storybook": "10.3.5",
|
|
110
111
|
"stylelint": "^17.1.1",
|
|
111
112
|
"stylelint-config-standard": "^40.0.0",
|
|
112
113
|
"stylelint-config-standard-scss": "^17.0.0",
|
|
@@ -124,6 +125,6 @@
|
|
|
124
125
|
"storybook": "$storybook"
|
|
125
126
|
},
|
|
126
127
|
"dependencies": {
|
|
127
|
-
"wc-datepicker": "^0.
|
|
128
|
+
"wc-datepicker": "^0.10.0"
|
|
128
129
|
}
|
|
129
130
|
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
NysBreadcrumbItem as NysBreadcrumbItemElement,
|
|
4
|
+
CustomEvent,
|
|
5
|
+
} from "../../dist/nysds.es.js";
|
|
6
|
+
|
|
7
|
+
export type { NysBreadcrumbItemElement, CustomEvent };
|
|
8
|
+
|
|
9
|
+
export interface NysBreadcrumbItemProps extends Pick<
|
|
10
|
+
React.AllHTMLAttributes<HTMLElement>,
|
|
11
|
+
| "children"
|
|
12
|
+
| "dir"
|
|
13
|
+
| "hidden"
|
|
14
|
+
| "id"
|
|
15
|
+
| "lang"
|
|
16
|
+
| "slot"
|
|
17
|
+
| "style"
|
|
18
|
+
| "title"
|
|
19
|
+
| "translate"
|
|
20
|
+
| "onClick"
|
|
21
|
+
| "onFocus"
|
|
22
|
+
| "onBlur"
|
|
23
|
+
> {
|
|
24
|
+
/** Private property used by nys-breadcrumbs to indicate this breadcrumb item is the last in the trail * */
|
|
25
|
+
isLast?: boolean;
|
|
26
|
+
|
|
27
|
+
/** undefined */
|
|
28
|
+
isBackToParent?: boolean;
|
|
29
|
+
|
|
30
|
+
/** undefined */
|
|
31
|
+
id?: NysBreadcrumbItemElement["id"];
|
|
32
|
+
|
|
33
|
+
/** undefined */
|
|
34
|
+
label?: NysBreadcrumbItemElement["label"];
|
|
35
|
+
|
|
36
|
+
/** undefined */
|
|
37
|
+
link?: NysBreadcrumbItemElement["link"];
|
|
38
|
+
|
|
39
|
+
/** A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the class selectors or functions like the method `Document.getElementsByClassName()`. */
|
|
40
|
+
className?: string;
|
|
41
|
+
|
|
42
|
+
/** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
|
|
43
|
+
exportparts?: string;
|
|
44
|
+
|
|
45
|
+
/** Used for labels to link them with their inputs (using input id). */
|
|
46
|
+
htmlFor?: string;
|
|
47
|
+
|
|
48
|
+
/** Used to help React identify which items have changed, are added, or are removed within a list. */
|
|
49
|
+
key?: number | string;
|
|
50
|
+
|
|
51
|
+
/** Contains a space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the ::part pseudo-element. */
|
|
52
|
+
part?: string;
|
|
53
|
+
|
|
54
|
+
/** A mutable ref object whose `.current` property is initialized to the passed argument (`initialValue`). The returned object will persist for the full lifetime of the component. */
|
|
55
|
+
ref?: any;
|
|
56
|
+
|
|
57
|
+
/** Allows developers to make HTML elements focusable, allow or prevent them from being sequentially focusable (usually with the `Tab` key, hence the name) and determine their relative ordering for sequential focus navigation. */
|
|
58
|
+
tabIndex?: number;
|
|
59
|
+
|
|
60
|
+
/** Fired when the link is clicked. Detail: `{id, link}`. */
|
|
61
|
+
onNysBreadcrumbitemClick?: (event: CustomEvent) => void;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Single breadcrumb trail item with chevron separator and current page support.
|
|
66
|
+
* ---
|
|
67
|
+
*
|
|
68
|
+
*
|
|
69
|
+
* ### **Events:**
|
|
70
|
+
* - **nys-breadcrumbitem-click** - Fired when the link is clicked. Detail: `{id, link}`.
|
|
71
|
+
*/
|
|
72
|
+
export const NysBreadcrumbItem: React.ForwardRefExoticComponent<NysBreadcrumbItemProps>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React, { forwardRef, useRef, useEffect } from "react";
|
|
2
|
+
import "../../dist/nysds.es.js";
|
|
3
|
+
import { useEventListener } from "./react-utils.js";
|
|
4
|
+
|
|
5
|
+
export const NysBreadcrumbItem = forwardRef((props, forwardedRef) => {
|
|
6
|
+
const ref = useRef(null);
|
|
7
|
+
const { isLast, isBackToParent, id, label, link, ...filteredProps } = props;
|
|
8
|
+
|
|
9
|
+
/** Event listeners - run once */
|
|
10
|
+
useEventListener(
|
|
11
|
+
ref,
|
|
12
|
+
"nys-breadcrumbitem-click",
|
|
13
|
+
props.onNysBreadcrumbitemClick,
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
return React.createElement(
|
|
17
|
+
"nys-breadcrumbitem",
|
|
18
|
+
{
|
|
19
|
+
ref: (node) => {
|
|
20
|
+
ref.current = node;
|
|
21
|
+
if (typeof forwardedRef === "function") {
|
|
22
|
+
forwardedRef(node);
|
|
23
|
+
} else if (forwardedRef) {
|
|
24
|
+
forwardedRef.current = node;
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
...filteredProps,
|
|
28
|
+
id: props.id,
|
|
29
|
+
label: props.label,
|
|
30
|
+
link: props.link,
|
|
31
|
+
class: props.className,
|
|
32
|
+
exportparts: props.exportparts,
|
|
33
|
+
for: props.htmlFor,
|
|
34
|
+
part: props.part,
|
|
35
|
+
tabindex: props.tabIndex,
|
|
36
|
+
isLast: props.isLast ? true : undefined,
|
|
37
|
+
isBackToParent: props.isBackToParent ? true : undefined,
|
|
38
|
+
style: { ...props.style },
|
|
39
|
+
},
|
|
40
|
+
props.children,
|
|
41
|
+
);
|
|
42
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
NysBreadcrumbs as NysBreadcrumbsElement,
|
|
4
|
+
CustomEvent,
|
|
5
|
+
} from "../../dist/nysds.es.js";
|
|
6
|
+
|
|
7
|
+
export type { NysBreadcrumbsElement, CustomEvent };
|
|
8
|
+
|
|
9
|
+
export interface NysBreadcrumbsProps extends Pick<
|
|
10
|
+
React.AllHTMLAttributes<HTMLElement>,
|
|
11
|
+
| "children"
|
|
12
|
+
| "dir"
|
|
13
|
+
| "hidden"
|
|
14
|
+
| "id"
|
|
15
|
+
| "lang"
|
|
16
|
+
| "slot"
|
|
17
|
+
| "style"
|
|
18
|
+
| "title"
|
|
19
|
+
| "translate"
|
|
20
|
+
| "onClick"
|
|
21
|
+
| "onFocus"
|
|
22
|
+
| "onBlur"
|
|
23
|
+
> {
|
|
24
|
+
/** On mobile, renders the trail as a single back-to-parent link pointing to the item before the current page.
|
|
25
|
+
Has no effect on desktop or when only one item is present (which always renders as a back link). */
|
|
26
|
+
backToParent?: boolean;
|
|
27
|
+
|
|
28
|
+
/** Forces the trail into its collapsed state.
|
|
29
|
+
It shows only the first item, an ellipsis, and the last two items.
|
|
30
|
+
The user can still expand the trail by clicking the ellipsis. */
|
|
31
|
+
collapsed?: boolean;
|
|
32
|
+
|
|
33
|
+
/** Renders a filled light theme background bar behind the breadcrumb trail. */
|
|
34
|
+
backgroundBar?: boolean;
|
|
35
|
+
|
|
36
|
+
/** Prevents interaction. */
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
|
|
39
|
+
/** Unique identifier. Auto-generated if not provided. */
|
|
40
|
+
id?: NysBreadcrumbsElement["id"];
|
|
41
|
+
|
|
42
|
+
/** Accessible label for the `<nav>` landmark. Defaults to "path to this page" if not set.
|
|
43
|
+
Override when multiple crumbs exist on the same page. */
|
|
44
|
+
ariaLabel?: NysBreadcrumbsElement["ariaLabel"];
|
|
45
|
+
|
|
46
|
+
/** Controls the visual size of the breadcrumb text and spacing: `sm` for dense layouts, `md` (default) for standard use. */
|
|
47
|
+
size?: NysBreadcrumbsElement["size"];
|
|
48
|
+
|
|
49
|
+
/** A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the class selectors or functions like the method `Document.getElementsByClassName()`. */
|
|
50
|
+
className?: string;
|
|
51
|
+
|
|
52
|
+
/** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
|
|
53
|
+
exportparts?: string;
|
|
54
|
+
|
|
55
|
+
/** Used for labels to link them with their inputs (using input id). */
|
|
56
|
+
htmlFor?: string;
|
|
57
|
+
|
|
58
|
+
/** Used to help React identify which items have changed, are added, or are removed within a list. */
|
|
59
|
+
key?: number | string;
|
|
60
|
+
|
|
61
|
+
/** Contains a space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the ::part pseudo-element. */
|
|
62
|
+
part?: string;
|
|
63
|
+
|
|
64
|
+
/** A mutable ref object whose `.current` property is initialized to the passed argument (`initialValue`). The returned object will persist for the full lifetime of the component. */
|
|
65
|
+
ref?: any;
|
|
66
|
+
|
|
67
|
+
/** Allows developers to make HTML elements focusable, allow or prevent them from being sequentially focusable (usually with the `Tab` key, hence the name) and determine their relative ordering for sequential focus navigation. */
|
|
68
|
+
tabIndex?: number;
|
|
69
|
+
|
|
70
|
+
/** undefined */
|
|
71
|
+
onNysExpand?: (event: CustomEvent) => void;
|
|
72
|
+
|
|
73
|
+
/** Fired when the user clicks the ellipsis to expand the trail. */
|
|
74
|
+
onNysBreadcrumbsExpand?: (event: CustomEvent) => void;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Breadcrumb navigation trail with responsive collapse support.
|
|
79
|
+
* ---
|
|
80
|
+
*
|
|
81
|
+
*
|
|
82
|
+
* ### **Events:**
|
|
83
|
+
* - **nys-expand**
|
|
84
|
+
* - **nys-breadcrumbs-expand** - Fired when the user clicks the ellipsis to expand the trail.
|
|
85
|
+
*
|
|
86
|
+
* ### **Slots:**
|
|
87
|
+
* - _default_ - One or more `nys-breadcrumbitem` elements defining the trail.
|
|
88
|
+
*/
|
|
89
|
+
export const NysBreadcrumbs: React.ForwardRefExoticComponent<NysBreadcrumbsProps>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React, { forwardRef, useRef, useEffect } from "react";
|
|
2
|
+
import "../../dist/nysds.es.js";
|
|
3
|
+
import { useEventListener } from "./react-utils.js";
|
|
4
|
+
|
|
5
|
+
export const NysBreadcrumbs = forwardRef((props, forwardedRef) => {
|
|
6
|
+
const ref = useRef(null);
|
|
7
|
+
const {
|
|
8
|
+
backToParent,
|
|
9
|
+
collapsed,
|
|
10
|
+
backgroundBar,
|
|
11
|
+
disabled,
|
|
12
|
+
id,
|
|
13
|
+
ariaLabel,
|
|
14
|
+
size,
|
|
15
|
+
...filteredProps
|
|
16
|
+
} = props;
|
|
17
|
+
|
|
18
|
+
/** Event listeners - run once */
|
|
19
|
+
useEventListener(ref, "nys-expand", props.onNysExpand);
|
|
20
|
+
useEventListener(ref, "nys-breadcrumbs-expand", props.onNysBreadcrumbsExpand);
|
|
21
|
+
|
|
22
|
+
return React.createElement(
|
|
23
|
+
"nys-breadcrumbs",
|
|
24
|
+
{
|
|
25
|
+
ref: (node) => {
|
|
26
|
+
ref.current = node;
|
|
27
|
+
if (typeof forwardedRef === "function") {
|
|
28
|
+
forwardedRef(node);
|
|
29
|
+
} else if (forwardedRef) {
|
|
30
|
+
forwardedRef.current = node;
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
...filteredProps,
|
|
34
|
+
id: props.id,
|
|
35
|
+
ariaLabel: props.ariaLabel,
|
|
36
|
+
size: props.size,
|
|
37
|
+
class: props.className,
|
|
38
|
+
exportparts: props.exportparts,
|
|
39
|
+
for: props.htmlFor,
|
|
40
|
+
part: props.part,
|
|
41
|
+
tabindex: props.tabIndex,
|
|
42
|
+
backToParent: props.backToParent ? true : undefined,
|
|
43
|
+
collapsed: props.collapsed ? true : undefined,
|
|
44
|
+
backgroundBar: props.backgroundBar ? true : undefined,
|
|
45
|
+
disabled: props.disabled ? true : undefined,
|
|
46
|
+
style: { ...props.style },
|
|
47
|
+
},
|
|
48
|
+
props.children,
|
|
49
|
+
);
|
|
50
|
+
});
|