@nysds/components 1.21.0 → 1.21.1-alpha-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 +56 -8
- package/dist/nys-icon.library-Bi_7DKlD-BEL9M8Q4.js +698 -0
- package/dist/nys-icon.library-Bi_7DKlD-BEL9M8Q4.js.map +1 -0
- package/dist/nys-icon.library-D_YvOGLH.js +696 -0
- package/dist/nys-icon.library-D_YvOGLH.js.map +1 -0
- package/dist/nysds.es.js +1154 -1087
- package/dist/nysds.es.js.map +1 -1
- package/dist/nysds.js +101 -97
- package/dist/nysds.js.map +1 -1
- package/dist/packages/nys-backtotop/src/nys-backtotop.d.ts +2 -2
- package/dist/packages/nys-unavheader/src/nys-unavheader.d.ts +16 -3
- package/package.json +2 -2
- package/packages/react/NysUnavHeader.d.ts +6 -3
- package/packages/react/NysUnavHeader.js +2 -0
- package/packages/react/nysds-jsx.d.ts +5 -3
|
@@ -37,7 +37,7 @@ import "@nysds/nys-button";
|
|
|
37
37
|
* font-size: var(--nys-font-size-sm);
|
|
38
38
|
* }
|
|
39
39
|
* </style>
|
|
40
|
-
* <nys-unavheader
|
|
40
|
+
* <nys-unavheader translateKey="NEf4Y5qMb9PGP"></nys-unavheader>
|
|
41
41
|
* <nys-globalheader appName="Back to Top Example"></nys-globalheader>
|
|
42
42
|
* <main style="padding: 0 2rem">
|
|
43
43
|
* <h1>Sample Content on page</h1>
|
|
@@ -79,7 +79,7 @@ import "@nysds/nys-button";
|
|
|
79
79
|
* --_nys-button-border-radius: var(--nys-radius-round);
|
|
80
80
|
* }
|
|
81
81
|
* </style>
|
|
82
|
-
* <nys-unavheader
|
|
82
|
+
* <nys-unavheader translateKey="NEf4Y5qMb9PGP"></nys-unavheader>
|
|
83
83
|
* <nys-globalheader appName="Back to Top Example"></nys-globalheader>
|
|
84
84
|
* <main style="padding: 0 2rem">
|
|
85
85
|
* <h1>Sample Content on page</h1>
|
|
@@ -7,6 +7,7 @@ import "@nysds/nys-alert";
|
|
|
7
7
|
interface Language {
|
|
8
8
|
code: string;
|
|
9
9
|
label: string;
|
|
10
|
+
nativeText: string;
|
|
10
11
|
url?: string;
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
@@ -51,12 +52,12 @@ export declare const NYS_ALERT_URL = "https://alerts-cta.static-assets.ny.gov/al
|
|
|
51
52
|
* reaches every NYS site with no per-site work. If the endpoint is unreachable or nothing
|
|
52
53
|
* is published, the header renders normally. It takes no children.
|
|
53
54
|
*
|
|
54
|
-
* @fires nys-language-select - Fired when a language is selected. Detail: `{language: {code, label, url?}}`. Cancelable; `preventDefault()` overrides the default
|
|
55
|
+
* @fires nys-language-select - Fired when a language is selected. Detail: `{language: {code, label, url?}}`. Cancelable; `preventDefault()` overrides the default Localize integration.
|
|
55
56
|
* @fires nys-search-submit - Fired when a search is submitted. Detail: `{query}`. Cancelable; `preventDefault()` overrides the default search redirect.
|
|
56
57
|
*
|
|
57
58
|
* @example Basic
|
|
58
59
|
* ```html
|
|
59
|
-
* <nys-unavheader></nys-unavheader>
|
|
60
|
+
* <nys-unavheader translateKey="NEf4Y5qMb9PGP"></nys-unavheader>
|
|
60
61
|
* ```
|
|
61
62
|
*
|
|
62
63
|
* @example Hide search
|
|
@@ -120,6 +121,8 @@ export declare class NysUnavHeader extends NysElement {
|
|
|
120
121
|
hideSearch: boolean;
|
|
121
122
|
/** The URL endpoint of the search, make sure to include the query param. */
|
|
122
123
|
searchUrl: string;
|
|
124
|
+
/** Localize project key. If provided, the component will load and initialize LocalizeJS automatically. */
|
|
125
|
+
translateKey: string;
|
|
123
126
|
/**
|
|
124
127
|
* Accessible name for the `banner` landmark this header renders.
|
|
125
128
|
* Defaults to `"New York State"`.
|
|
@@ -136,7 +139,7 @@ export declare class NysUnavHeader extends NysElement {
|
|
|
136
139
|
* @default "New York State"
|
|
137
140
|
*/
|
|
138
141
|
landmarkLabel: string;
|
|
139
|
-
/** The list of languages this site can be translated to, default to use
|
|
142
|
+
/** The list of languages this site can be translated to, default to use Localize */
|
|
140
143
|
languages: Language[];
|
|
141
144
|
/**
|
|
142
145
|
* Lifecycle Methods
|
|
@@ -148,6 +151,7 @@ export declare class NysUnavHeader extends NysElement {
|
|
|
148
151
|
*/
|
|
149
152
|
connectedCallback(): void;
|
|
150
153
|
disconnectedCallback(): void;
|
|
154
|
+
willUpdate(changedProperties: PropertyValues): void;
|
|
151
155
|
protected updated(changed: PropertyValues): void;
|
|
152
156
|
/**
|
|
153
157
|
* Functions
|
|
@@ -209,7 +213,15 @@ export declare class NysUnavHeader extends NysElement {
|
|
|
209
213
|
* -1 is the last option, so "previous from the first" and "End" are the same call.
|
|
210
214
|
*/
|
|
211
215
|
private _focusOption;
|
|
216
|
+
private _initLocalize;
|
|
212
217
|
private _toggleSearchDropdown;
|
|
218
|
+
/**
|
|
219
|
+
* Shows, replaces, or removes the translation disclaimer banner for the given
|
|
220
|
+
* language code. Called from the Localize "setLanguage" listener — which also
|
|
221
|
+
* fires on page load for a remembered language — and directly from
|
|
222
|
+
* `_handleLanguageSelect` when the Localize API isn't available.
|
|
223
|
+
*/
|
|
224
|
+
private _updateTranslateDisclaimer;
|
|
213
225
|
private _handleLanguageSelect;
|
|
214
226
|
/**
|
|
215
227
|
* Keyboard model for the translate menu (APG menu button):
|
|
@@ -272,6 +284,7 @@ export declare class NysUnavHeader extends NysElement {
|
|
|
272
284
|
* #1795 found it — two unnamed banners — so it falls back to the default.
|
|
273
285
|
*/
|
|
274
286
|
private get _landmarkLabel();
|
|
287
|
+
private get _locale();
|
|
275
288
|
render(): import("lit-html").TemplateResult<1>;
|
|
276
289
|
}
|
|
277
290
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nysds/components",
|
|
3
|
-
"version": "1.21.
|
|
3
|
+
"version": "1.21.1-alpha-1",
|
|
4
4
|
"description": "New York State's design system and code component library.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"workspaces": [
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"playwright:install": "npx playwright install --with-deps",
|
|
46
46
|
"release": "cross-env NODE_ENV=production npm run build:all && cross-env NODE_ENV=production npm run test && npm run cem && cross-env NODE_ENV=production npm publish --workspaces --access public && cross-env NODE_ENV=production npm publish --access public",
|
|
47
47
|
"release:dry-run": "cross-env NODE_ENV=production npm run build:all && cross-env NODE_ENV=production npm run test && npm run cem && node src/scripts/publish-dry-run.js",
|
|
48
|
-
"release:alpha": "npm run build && npm run build:umd && npm publish --tag
|
|
48
|
+
"release:alpha": "npm run build && npm run build:umd && npm publish --tag alpha",
|
|
49
49
|
"release:zip": "npm run build:all && node src/scripts/create-release-zip.js",
|
|
50
50
|
"pretest": "playwright install",
|
|
51
51
|
"test": "wtr --node-resolve",
|
|
@@ -39,6 +39,9 @@ export interface NysUnavHeaderProps extends Pick<
|
|
|
39
39
|
/** The URL endpoint of the search, make sure to include the query param. */
|
|
40
40
|
searchUrl?: NysUnavHeaderElement["searchUrl"];
|
|
41
41
|
|
|
42
|
+
/** Localize project key. If provided, the component will load and initialize LocalizeJS automatically. */
|
|
43
|
+
translateKey?: NysUnavHeaderElement["translateKey"];
|
|
44
|
+
|
|
42
45
|
/** Accessible name for the `banner` landmark this header renders.
|
|
43
46
|
Defaults to `"New York State"`.
|
|
44
47
|
|
|
@@ -52,7 +55,7 @@ A blank value falls back to the default rather than leaving the landmark
|
|
|
52
55
|
unnamed. */
|
|
53
56
|
landmarkLabel?: NysUnavHeaderElement["landmarkLabel"];
|
|
54
57
|
|
|
55
|
-
/** The list of languages this site can be translated to, default to use
|
|
58
|
+
/** The list of languages this site can be translated to, default to use Localize */
|
|
56
59
|
languages?: NysUnavHeaderElement["languages"];
|
|
57
60
|
|
|
58
61
|
/** 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()`. */
|
|
@@ -76,7 +79,7 @@ unnamed. */
|
|
|
76
79
|
/** 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. */
|
|
77
80
|
tabIndex?: number;
|
|
78
81
|
|
|
79
|
-
/** Fired when a language is selected. Detail: `{language: {code, label, url?}}`. Cancelable; `preventDefault()` overrides the default
|
|
82
|
+
/** Fired when a language is selected. Detail: `{language: {code, label, url?}}`. Cancelable; `preventDefault()` overrides the default Localize integration. */
|
|
80
83
|
onNysLanguageSelect?: (event: CustomEvent) => void;
|
|
81
84
|
|
|
82
85
|
/** Fired when a search is submitted. Detail: `{query}`. Cancelable; `preventDefault()` overrides the default search redirect. */
|
|
@@ -89,7 +92,7 @@ unnamed. */
|
|
|
89
92
|
*
|
|
90
93
|
*
|
|
91
94
|
* ### **Events:**
|
|
92
|
-
* - **nys-language-select** - Fired when a language is selected. Detail: `{language: {code, label, url?}}`. Cancelable; `preventDefault()` overrides the default
|
|
95
|
+
* - **nys-language-select** - Fired when a language is selected. Detail: `{language: {code, label, url?}}`. Cancelable; `preventDefault()` overrides the default Localize integration.
|
|
93
96
|
* - **nys-search-submit** - Fired when a search is submitted. Detail: `{query}`. Cancelable; `preventDefault()` overrides the default search redirect.
|
|
94
97
|
*/
|
|
95
98
|
export const NysUnavHeader: React.ForwardRefExoticComponent<NysUnavHeaderProps>;
|
|
@@ -12,6 +12,7 @@ export const NysUnavHeader = forwardRef((props, forwardedRef) => {
|
|
|
12
12
|
hideTranslate,
|
|
13
13
|
hideSearch,
|
|
14
14
|
searchUrl,
|
|
15
|
+
translateKey,
|
|
15
16
|
landmarkLabel,
|
|
16
17
|
languages,
|
|
17
18
|
...filteredProps
|
|
@@ -34,6 +35,7 @@ export const NysUnavHeader = forwardRef((props, forwardedRef) => {
|
|
|
34
35
|
},
|
|
35
36
|
...filteredProps,
|
|
36
37
|
searchUrl: props.searchUrl,
|
|
38
|
+
translateKey: props.translateKey,
|
|
37
39
|
landmarkLabel: props.landmarkLabel,
|
|
38
40
|
languages: props.languages,
|
|
39
41
|
class: props.className,
|
|
@@ -1245,6 +1245,8 @@ export type NysUnavHeaderProps = {
|
|
|
1245
1245
|
hideSearch?: boolean;
|
|
1246
1246
|
/** The URL endpoint of the search, make sure to include the query param. */
|
|
1247
1247
|
searchUrl?: string;
|
|
1248
|
+
/** Localize project key. If provided, the component will load and initialize LocalizeJS automatically. */
|
|
1249
|
+
translateKey?: string;
|
|
1248
1250
|
/** Accessible name for the `banner` landmark this header renders.
|
|
1249
1251
|
Defaults to `"New York State"`.
|
|
1250
1252
|
|
|
@@ -1257,10 +1259,10 @@ comes from that header's visible title.
|
|
|
1257
1259
|
A blank value falls back to the default rather than leaving the landmark
|
|
1258
1260
|
unnamed. */
|
|
1259
1261
|
landmarkLabel?: string;
|
|
1260
|
-
/** The list of languages this site can be translated to, default to use
|
|
1262
|
+
/** The list of languages this site can be translated to, default to use Localize */
|
|
1261
1263
|
languages?: Language[];
|
|
1262
1264
|
|
|
1263
|
-
/** Fired when a language is selected. Detail: `{language: {code, label, url?}}`. Cancelable; `preventDefault()` overrides the default
|
|
1265
|
+
/** Fired when a language is selected. Detail: `{language: {code, label, url?}}`. Cancelable; `preventDefault()` overrides the default Localize integration. */
|
|
1264
1266
|
"onnys-language-select"?: (e: CustomEvent<never>) => void;
|
|
1265
1267
|
/** Fired when a search is submitted. Detail: `{query}`. Cancelable; `preventDefault()` overrides the default search redirect. */
|
|
1266
1268
|
"onnys-search-submit"?: (e: CustomEvent<never>) => void;
|
|
@@ -1957,7 +1959,7 @@ export type CustomElements = {
|
|
|
1957
1959
|
*
|
|
1958
1960
|
*
|
|
1959
1961
|
* ### **Events:**
|
|
1960
|
-
* - **nys-language-select** - Fired when a language is selected. Detail: `{language: {code, label, url?}}`. Cancelable; `preventDefault()` overrides the default
|
|
1962
|
+
* - **nys-language-select** - Fired when a language is selected. Detail: `{language: {code, label, url?}}`. Cancelable; `preventDefault()` overrides the default Localize integration.
|
|
1961
1963
|
* - **nys-search-submit** - Fired when a search is submitted. Detail: `{query}`. Cancelable; `preventDefault()` overrides the default search redirect.
|
|
1962
1964
|
*/
|
|
1963
1965
|
"nys-unavheader": Partial<NysUnavHeaderProps & BaseProps & BaseEvents>;
|