@geotab/zenith 3.18.0 → 3.19.0-beta.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/README.md +9 -0
- package/dist/chart/accessibleChart/accessibleChartTable.d.ts +1 -1
- package/dist/chart/accessibleChart/accessibleChartTable.js +29 -6
- package/dist/chart/accessibleChart/interfaces.d.ts +8 -2
- package/dist/chart/barChart.d.ts +3 -1
- package/dist/chart/barChart.js +5 -3
- package/dist/chart/lineChart.d.ts +3 -1
- package/dist/chart/lineChart.js +5 -3
- package/dist/chart/pieChart.d.ts +3 -1
- package/dist/chart/pieChart.js +5 -3
- package/dist/chart/utils/isEmptyDataPoint.d.ts +1 -0
- package/dist/chart/utils/isEmptyDataPoint.js +5 -0
- package/dist/dataGrid/columns/mainColumn/mainColumnWrapper.d.ts +2 -0
- package/dist/dataGrid/columns/mainColumn/mainColumnWrapper.js +2 -2
- package/dist/fileUpload/components/filePreview.d.ts +15 -0
- package/dist/fileUpload/components/filePreview.js +272 -0
- package/dist/fileUpload/components/previewableFile.d.ts +16 -0
- package/dist/fileUpload/components/previewableFile.js +48 -0
- package/dist/fileUpload/components/resolveFileActions.d.ts +10 -0
- package/dist/fileUpload/components/resolveFileActions.js +11 -0
- package/dist/fileUpload/components/uploadedFilesSection.d.ts +9 -1
- package/dist/fileUpload/components/uploadedFilesSection.js +91 -16
- package/dist/fileUpload/components/useFilePreview.d.ts +12 -0
- package/dist/fileUpload/components/useFilePreview.js +85 -0
- package/dist/fileUpload/fileUpload.d.ts +1 -1
- package/dist/fileUpload/fileUpload.js +63 -2
- package/dist/fileUpload/fileUploadType.d.ts +35 -0
- package/dist/filtersBar/components/filtersBarSearch/filtersBarSearch.d.ts +1 -1
- package/dist/formSection/components/formSectionCard.js +1 -1
- package/dist/icons/iconEngine.d.ts +3 -0
- package/dist/icons/iconEngine.js +12 -0
- package/dist/index.css +74 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.js +12 -10
- package/dist/inputAdornments/inputAdornments.d.ts +3 -1
- package/dist/inputAdornments/inputAdornments.js +2 -2
- package/dist/lineChartMini/lineChartMini.d.ts +3 -1
- package/dist/lineChartMini/lineChartMini.js +5 -3
- package/dist/modal/modal.d.ts +2 -0
- package/dist/primaryIcon/primaryIcon.d.ts +3 -1
- package/dist/primaryIcon/primaryIcon.js +3 -3
- package/dist/searchInputRaw/searchInputRaw.js +4 -2
- package/dist/searchInputRaw/types.d.ts +2 -0
- package/dist/textInputRaw/textInputRaw.js +1 -1
- package/dist/textInputRaw/types.d.ts +2 -0
- package/esm/chart/accessibleChart/accessibleChartTable.d.ts +1 -1
- package/esm/chart/accessibleChart/accessibleChartTable.js +29 -6
- package/esm/chart/accessibleChart/interfaces.d.ts +8 -2
- package/esm/chart/barChart.d.ts +3 -1
- package/esm/chart/barChart.js +5 -3
- package/esm/chart/lineChart.d.ts +3 -1
- package/esm/chart/lineChart.js +5 -3
- package/esm/chart/pieChart.d.ts +3 -1
- package/esm/chart/pieChart.js +5 -3
- package/esm/chart/utils/isEmptyDataPoint.d.ts +1 -0
- package/esm/chart/utils/isEmptyDataPoint.js +1 -0
- package/esm/dataGrid/columns/mainColumn/mainColumnWrapper.d.ts +2 -0
- package/esm/dataGrid/columns/mainColumn/mainColumnWrapper.js +2 -2
- package/esm/fileUpload/components/filePreview.d.ts +15 -0
- package/esm/fileUpload/components/filePreview.js +263 -0
- package/esm/fileUpload/components/previewableFile.d.ts +16 -0
- package/esm/fileUpload/components/previewableFile.js +43 -0
- package/esm/fileUpload/components/resolveFileActions.d.ts +10 -0
- package/esm/fileUpload/components/resolveFileActions.js +7 -0
- package/esm/fileUpload/components/uploadedFilesSection.d.ts +9 -1
- package/esm/fileUpload/components/uploadedFilesSection.js +91 -16
- package/esm/fileUpload/components/useFilePreview.d.ts +12 -0
- package/esm/fileUpload/components/useFilePreview.js +81 -0
- package/esm/fileUpload/fileUpload.d.ts +1 -1
- package/esm/fileUpload/fileUpload.js +63 -2
- package/esm/fileUpload/fileUploadType.d.ts +35 -0
- package/esm/filtersBar/components/filtersBarSearch/filtersBarSearch.d.ts +1 -1
- package/esm/formSection/components/formSectionCard.js +1 -1
- package/esm/icons/iconEngine.d.ts +3 -0
- package/esm/icons/iconEngine.js +8 -0
- package/esm/index.d.ts +3 -1
- package/esm/index.js +1 -0
- package/esm/inputAdornments/inputAdornments.d.ts +3 -1
- package/esm/inputAdornments/inputAdornments.js +2 -2
- package/esm/lineChartMini/lineChartMini.d.ts +3 -1
- package/esm/lineChartMini/lineChartMini.js +5 -3
- package/esm/modal/modal.d.ts +2 -0
- package/esm/primaryIcon/primaryIcon.d.ts +3 -1
- package/esm/primaryIcon/primaryIcon.js +3 -3
- package/esm/searchInputRaw/searchInputRaw.js +4 -2
- package/esm/searchInputRaw/types.d.ts +2 -0
- package/esm/textInputRaw/textInputRaw.js +1 -1
- package/esm/textInputRaw/types.d.ts +2 -0
- package/package.json +1 -1
|
@@ -6,6 +6,9 @@ import { useDriveClassName } from "../utils/theme/useDriveClassName";
|
|
|
6
6
|
import { useLanguage } from "../utils/localization/useLanguage";
|
|
7
7
|
import { useMobile } from "../commonHelpers/hooks/useMobile";
|
|
8
8
|
import { Waiting } from "../waiting/waiting";
|
|
9
|
+
import { FilePreview } from "./components/filePreview";
|
|
10
|
+
import { resolveFileActions } from "./components/resolveFileActions";
|
|
11
|
+
import { useFilePreview } from "./components/useFilePreview";
|
|
9
12
|
import { DropZoneContent } from "./components/dropZoneContent";
|
|
10
13
|
import { TemplateDownloadSection } from "./components/templateDownloadSection";
|
|
11
14
|
import { UploadedFilesSection } from "./components/uploadedFilesSection";
|
|
@@ -226,6 +229,14 @@ export const FileUpload = ({
|
|
|
226
229
|
showTemplateSection = true,
|
|
227
230
|
showUploadedSection = true,
|
|
228
231
|
templateDownload,
|
|
232
|
+
dataAnalyticsId,
|
|
233
|
+
showRemoveButton,
|
|
234
|
+
showViewButton,
|
|
235
|
+
showDownloadButton,
|
|
236
|
+
onView,
|
|
237
|
+
onDownload,
|
|
238
|
+
getPreviewBlob,
|
|
239
|
+
previewMode,
|
|
229
240
|
onChange
|
|
230
241
|
}) => {
|
|
231
242
|
const {
|
|
@@ -237,6 +248,7 @@ export const FileUpload = ({
|
|
|
237
248
|
const fileInputRef = useRef(null);
|
|
238
249
|
const browseButtonRef = useRef(null);
|
|
239
250
|
const removeButtonRefs = useRef(new Map());
|
|
251
|
+
const viewButtonRefs = useRef(new Map());
|
|
240
252
|
const pendingFocusIndexRef = useRef(null);
|
|
241
253
|
const driveClasses = useDriveClassName("zen-file-upload");
|
|
242
254
|
const classes = useMemo(() => classNames(["zen-file-upload", `zen-file-upload--${size}`, isMobile ? "zen-file-upload--mobile" : "", driveClasses || "", disabled ? "zen-file-upload--disabled" : "", className !== null && className !== void 0 ? className : ""]), [size, isMobile, driveClasses, disabled, className]);
|
|
@@ -346,10 +358,52 @@ export const FileUpload = ({
|
|
|
346
358
|
}
|
|
347
359
|
}
|
|
348
360
|
}, [templateDownload]);
|
|
361
|
+
const {
|
|
362
|
+
preview,
|
|
363
|
+
handleViewFile,
|
|
364
|
+
handleClosePreview
|
|
365
|
+
} = useFilePreview({
|
|
366
|
+
onView,
|
|
367
|
+
getPreviewBlob,
|
|
368
|
+
previewMode,
|
|
369
|
+
viewButtonRefs
|
|
370
|
+
});
|
|
371
|
+
const fileActions = resolveFileActions({
|
|
372
|
+
id,
|
|
373
|
+
dataAnalyticsId,
|
|
374
|
+
showViewButton,
|
|
375
|
+
showDownloadButton,
|
|
376
|
+
onView,
|
|
377
|
+
getPreviewBlob,
|
|
378
|
+
onDownload
|
|
379
|
+
});
|
|
380
|
+
const handleDownloadFile = useCallback(file => {
|
|
381
|
+
void (onDownload === null || onDownload === void 0 ? void 0 : onDownload(file));
|
|
382
|
+
}, [onDownload]);
|
|
349
383
|
// Generate accessible description
|
|
350
384
|
const dropZoneDescriptionId = `${id}-description`;
|
|
351
385
|
const acceptedFormats = supportedFormatsText || accept || "";
|
|
352
386
|
const uploadMethodDescription = isMobile ? translate("Tap to add files") : `${translate("Drag & drop files or")} ${translate("Browse")}`;
|
|
387
|
+
const previewElement = _jsx(FilePreview, {
|
|
388
|
+
analyticsBase: fileActions.analyticsBase,
|
|
389
|
+
preview: preview,
|
|
390
|
+
onClose: handleClosePreview,
|
|
391
|
+
onDownload: fileActions.canDownload ? handleDownloadFile : undefined,
|
|
392
|
+
disabled: isInteractionDisabled,
|
|
393
|
+
translate: translate
|
|
394
|
+
});
|
|
395
|
+
if ((preview === null || preview === void 0 ? void 0 : preview.mode) === "inline") {
|
|
396
|
+
// Inline preview takes the place of the upload UI so no second modal is stacked
|
|
397
|
+
return _jsxs("div", {
|
|
398
|
+
id: id,
|
|
399
|
+
className: classes,
|
|
400
|
+
children: [previewElement, _jsx(Waiting, {
|
|
401
|
+
isLoading: isUploading,
|
|
402
|
+
delay: 0,
|
|
403
|
+
hideOverlay: false
|
|
404
|
+
})]
|
|
405
|
+
});
|
|
406
|
+
}
|
|
353
407
|
return _jsxs("div", {
|
|
354
408
|
id: id,
|
|
355
409
|
className: classes,
|
|
@@ -402,8 +456,15 @@ export const FileUpload = ({
|
|
|
402
456
|
isUploading: isUploading,
|
|
403
457
|
handleRemoveFile: handleRemoveFile,
|
|
404
458
|
translate: translate,
|
|
405
|
-
removeButtonRefs: removeButtonRefs
|
|
406
|
-
|
|
459
|
+
removeButtonRefs: removeButtonRefs,
|
|
460
|
+
analyticsBase: fileActions.analyticsBase,
|
|
461
|
+
viewButtonRefs: viewButtonRefs,
|
|
462
|
+
showRemoveButton: showRemoveButton,
|
|
463
|
+
showViewButton: fileActions.canView,
|
|
464
|
+
showDownloadButton: fileActions.canDownload,
|
|
465
|
+
handleViewFile: handleViewFile,
|
|
466
|
+
handleDownloadFile: handleDownloadFile
|
|
467
|
+
}), previewElement, _jsx(Waiting, {
|
|
407
468
|
isLoading: isUploading,
|
|
408
469
|
delay: 0,
|
|
409
470
|
hideOverlay: false
|
|
@@ -17,6 +17,9 @@ export interface IFileUploadMeta {
|
|
|
17
17
|
addedFiles?: FileList;
|
|
18
18
|
removedFileId?: string;
|
|
19
19
|
}
|
|
20
|
+
/** Bytes for the built-in preview. A Blob is also accepted, so a browser `File` can be returned as is. */
|
|
21
|
+
export type TPreviewData = Blob | ArrayBuffer | Uint8Array;
|
|
22
|
+
export type TFilePreviewMode = "modal" | "inline";
|
|
20
23
|
export interface IFileUpload extends IZenComponentProps {
|
|
21
24
|
id: string;
|
|
22
25
|
size?: "large" | "condensed";
|
|
@@ -29,5 +32,37 @@ export interface IFileUpload extends IZenComponentProps {
|
|
|
29
32
|
showTemplateSection?: boolean;
|
|
30
33
|
showUploadedSection?: boolean;
|
|
31
34
|
templateDownload?: ITemplateDownload;
|
|
35
|
+
/**
|
|
36
|
+
* Base for the `data-analytics-id` of the file action buttons (default: the component `id`).
|
|
37
|
+
* Buttons get `{base}-view`, `{base}-download`, `{base}-remove`, `{base}-preview-open-in-new-tab`,
|
|
38
|
+
* `{base}-preview-download` and `{base}-preview-back`. File names are never included.
|
|
39
|
+
*/
|
|
40
|
+
dataAnalyticsId?: string;
|
|
41
|
+
/** Show a Remove (X) button on each uploaded file (default: true). */
|
|
42
|
+
showRemoveButton?: boolean;
|
|
43
|
+
/** Show a View button on each uploaded image or PDF file (default: false). Hidden for other file types, for files with errors, and when neither `onView` nor `getPreviewBlob` is provided. */
|
|
44
|
+
showViewButton?: boolean;
|
|
45
|
+
/** Show a Download button on each uploaded file (default: false). Hidden for files with errors and when `onDownload` is not provided. */
|
|
46
|
+
showDownloadButton?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Called when View is clicked. When provided, the built-in preview is not opened,
|
|
49
|
+
* so the consumer can show its own previewer.
|
|
50
|
+
*/
|
|
51
|
+
onView?: (file: IUploadedFile) => void;
|
|
52
|
+
/** Called when Download is clicked. The consumer owns the fetch (blob URL, authenticated request, etc.). */
|
|
53
|
+
onDownload?: (file: IUploadedFile) => void | Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Returns the bytes for the built-in preview (sync or async). The consumer owns fetching, including any authentication.
|
|
56
|
+
* Zenith creates its own object URL from them, labelled with the type derived from the file kind
|
|
57
|
+
* (`application/pdf`, or the matching image type) and not with the type the Blob carries, so HTML can never be
|
|
58
|
+
* rendered as a page. The same URL feeds the preview and Open in new tab, and Zenith revokes it when the preview
|
|
59
|
+
* closes, when the component unmounts and when a newer request replaces it. If nothing is returned, the preview closes.
|
|
60
|
+
*/
|
|
61
|
+
getPreviewBlob?: (file: IUploadedFile) => TPreviewData | undefined | Promise<TPreviewData | undefined>;
|
|
62
|
+
/**
|
|
63
|
+
* How the built-in preview is presented (default: "modal").
|
|
64
|
+
* Use "inline" when the file upload is already inside a Modal, to avoid stacking modals.
|
|
65
|
+
*/
|
|
66
|
+
previewMode?: TFilePreviewMode;
|
|
32
67
|
onChange?: (files: IUploadedFile[], meta?: IFileUploadMeta) => void;
|
|
33
68
|
}
|
|
@@ -3,7 +3,7 @@ import { ISearchInputRaw } from "../../../searchInputRaw/searchInputRaw";
|
|
|
3
3
|
export interface IFiltersBarSearchState {
|
|
4
4
|
value: string;
|
|
5
5
|
}
|
|
6
|
-
interface IFiltersBarSearchProps extends Pick<ISearchInputRaw, "withDefaultCloseIcon" | "disabled" | "placeholder" | "ariaLabel" | "closeButtonTitle" | "onKeyDown" | "maxLength"> {
|
|
6
|
+
interface IFiltersBarSearchProps extends Pick<ISearchInputRaw, "withDefaultCloseIcon" | "disabled" | "placeholder" | "ariaLabel" | "closeButtonTitle" | "onKeyDown" | "maxLength" | "dataAnalyticsId"> {
|
|
7
7
|
}
|
|
8
8
|
export interface IFiltersBarSearch extends IFiltersBarItem<IFiltersBarSearchState, IFiltersBarSearchProps> {
|
|
9
9
|
className?: string;
|
|
@@ -43,5 +43,5 @@ export const FormSectionCard = (_a) => {
|
|
|
43
43
|
const { error } = useError({ isError, isLoading, retry, type: "card" });
|
|
44
44
|
const contentClasses = classNames(["zen-form-section-card-content", loadingContent ? "zen-form-section-card-content--loading" : ""]);
|
|
45
45
|
// TODO: tests for header
|
|
46
|
-
return (_jsxs(_Fragment, { children: [header && _jsx(FormLayoutTitle, { className: className, value: header || "" }), _jsxs(Card, Object.assign({ size: "L", autoHeight: true, title: title, className: className, cardContentClasses: contentClasses }, cardProps, { children: [actions.length > 0 && _jsx(Card.Actions, { children: cardButtons }), loadingContent || error || (_jsxs(FormSectionInner, { mode: mode, labelAlign: labelAlign, children: [content, additional.length > 0 && (_jsx(FormSectionInner.Additional, Object.assign({}, additional[0].props, { children: additional[0].props.children })))] }))] }))] }));
|
|
46
|
+
return (_jsxs(_Fragment, { children: [header && _jsx(FormLayoutTitle, { className: className, value: header || "" }), _jsxs(Card, Object.assign({ size: "L", autoHeight: true, title: title, className: classNames(["zen-form-section-card", className || ""]), cardContentClasses: contentClasses }, cardProps, { children: [actions.length > 0 && _jsx(Card.Actions, { children: cardButtons }), loadingContent || error || (_jsxs(FormSectionInner, { mode: mode, labelAlign: labelAlign, children: [content, additional.length > 0 && (_jsx(FormSectionInner.Additional, Object.assign({}, additional[0].props, { children: additional[0].props.children })))] }))] }))] }));
|
|
47
47
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId, useMemo } from "react";
|
|
3
|
+
import { classNames } from "../commonHelpers/classNames/classNames";
|
|
4
|
+
export const IconEngine = ({ className, size, title, description, focusable = false }) => {
|
|
5
|
+
const uniqueId = useId();
|
|
6
|
+
const classes = useMemo(() => classNames(["zen-icon", size ? `zen-icon--${size}` : "", className !== null && className !== void 0 ? className : ""]), [size, className]);
|
|
7
|
+
return (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", focusable: focusable ? "true" : undefined, tabIndex: focusable ? 0 : undefined, role: focusable || title || description ? undefined : "presentation", className: classes, "aria-labelledby": title && focusable ? uniqueId : undefined, "data-name": "IconEngine", children: [title ? _jsx("title", { id: uniqueId, children: title }) : null, description ? _jsx("desc", { children: description }) : null, _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M15.2588 4.00244C15.811 4.00248 16.2588 4.45018 16.2588 5.00244C16.2588 5.5547 15.811 6.0024 15.2588 6.00244H12.4355V7.59424H13.1533C13.801 7.59424 14.4091 7.90804 14.7842 8.43604L16.0186 10.1743L16.6641 10.1763C16.903 9.34121 17.6704 8.72902 18.582 8.72705L19.9922 8.72412C21.0981 8.72208 21.9959 9.61822 21.9961 10.7241V16.4019C21.9961 17.5048 21.1029 18.3996 20 18.4019L18.5898 18.4048C17.6861 18.4064 16.9212 17.8082 16.6719 16.9858L16.5449 16.9849L16.5225 18.0415C16.4986 19.1285 15.6107 19.9974 14.5234 19.9976H10.2607C9.62116 19.9974 9.01984 19.6915 8.64355 19.1743L7.76562 17.9663H6.35254C5.64354 17.966 5.0685 17.3912 5.06836 16.6821V14.9722H4.00391V17.8062C4.00391 18.3584 3.55619 18.8062 3.00391 18.8062C2.45182 18.8059 2.00391 18.3583 2.00391 17.8062V10.1489C2.00397 9.59684 2.45186 9.14916 3.00391 9.14893C3.55615 9.14893 4.00384 9.5967 4.00391 10.1489V12.9722H5.06836V11.814C5.06836 10.7095 5.96396 9.81416 7.06836 9.81396H7.29297L8.71387 8.24951C9.09285 7.83229 9.63069 7.59434 10.1943 7.59424H10.4355V6.00244H7.60156C7.04935 6.00236 6.60157 5.55467 6.60156 5.00244C6.60156 4.4502 7.04934 4.00252 7.60156 4.00244H15.2588ZM8.17871 11.814H7.06836V15.9663H8.7832L10.2607 17.9976H14.5234L14.5889 14.979L15.5703 14.9829L17.5889 14.9888L18.5859 14.9927V16.4048L18.9982 16.4039C19.5496 16.4028 19.9961 15.9554 19.9961 15.4039V11.7262C19.9961 11.1731 19.5471 10.7251 18.994 10.7262L18.5859 10.7271V12.1831L14.9844 12.1714L13.1533 9.59424H10.1943L8.17871 11.814Z" })] }));
|
|
8
|
+
};
|
package/esm/index.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export { type ICardsRow, CardsRow } from "./cards/cardsRow";
|
|
|
38
38
|
export { AccessibleChart } from "./chart/accessibleChart/accessibleChart";
|
|
39
39
|
export { collectAllPoints, simplifyData, AccessibleChartNarrative } from "./chart/accessibleChart/accessibleChartNarrative";
|
|
40
40
|
export { AccessibleChartTable } from "./chart/accessibleChart/accessibleChartTable";
|
|
41
|
+
export { type AccessibleChartDataset, type AccessibleTableCellRenderer, type IChartAccessibilityOptions } from "./chart/accessibleChart/interfaces";
|
|
41
42
|
export { Chart } from "./chart/chart";
|
|
42
43
|
export { getFormattedLabel } from "./chart/utils/getFormattedLabel";
|
|
43
44
|
export { removeTrendDataFromDatasets } from "./chart/utils/removeTrendDataFromDatasets";
|
|
@@ -78,7 +79,7 @@ export { FeedbackProvider } from "./feedbackProvider/feedbackProvider";
|
|
|
78
79
|
export { TemplateDownloadSection } from "./fileUpload/components/templateDownloadSection";
|
|
79
80
|
export { UploadedFilesSection } from "./fileUpload/components/uploadedFilesSection";
|
|
80
81
|
export { FileUpload } from "./fileUpload/fileUpload";
|
|
81
|
-
export { type IUploadedFile, type ITemplateDownload, type IFileUploadMeta, type IFileUpload } from "./fileUpload/fileUploadType";
|
|
82
|
+
export { type IUploadedFile, type ITemplateDownload, type IFileUploadMeta, type TPreviewData, type TFilePreviewMode, type IFileUpload } from "./fileUpload/fileUploadType";
|
|
82
83
|
export { type TFilterButton, type IFilterButton, FilterButton } from "./filterButton/filterButton";
|
|
83
84
|
export { type IFiltersChip, FiltersChip } from "./filters/components/filtersChip";
|
|
84
85
|
export { type IFiltersDateInputProps, type TFiltersDateInputState, type IFiltersDateInput, FiltersDateInputDisplayName, FiltersDateInput } from "./filters/components/filtersDateInput";
|
|
@@ -387,6 +388,7 @@ export { IconEditSmall } from "./icons/iconEditSmall";
|
|
|
387
388
|
export { IconEmail } from "./icons/iconEmail";
|
|
388
389
|
export { IconEmail2 } from "./icons/iconEmail2";
|
|
389
390
|
export { IconEmailNotification } from "./icons/iconEmailNotification";
|
|
391
|
+
export { IconEngine } from "./icons/iconEngine";
|
|
390
392
|
export { IconEsc } from "./icons/iconEsc";
|
|
391
393
|
export { IconEthereum } from "./icons/iconEthereum";
|
|
392
394
|
export { IconEuro } from "./icons/iconEuro";
|
package/esm/index.js
CHANGED
|
@@ -375,6 +375,7 @@ export { IconEditSmall } from "./icons/iconEditSmall";
|
|
|
375
375
|
export { IconEmail } from "./icons/iconEmail";
|
|
376
376
|
export { IconEmail2 } from "./icons/iconEmail2";
|
|
377
377
|
export { IconEmailNotification } from "./icons/iconEmailNotification";
|
|
378
|
+
export { IconEngine } from "./icons/iconEngine";
|
|
378
379
|
export { IconEsc } from "./icons/iconEsc";
|
|
379
380
|
export { IconEthereum } from "./icons/iconEthereum";
|
|
380
381
|
export { IconEuro } from "./icons/iconEuro";
|
|
@@ -27,8 +27,10 @@ export interface IInputAdornments {
|
|
|
27
27
|
ariaHaspopup?: boolean | "dialog" | "menu" | "grid" | "true" | "false" | "listbox" | "tree";
|
|
28
28
|
ariaExpanded?: boolean | "true" | "false";
|
|
29
29
|
autocomplete?: string;
|
|
30
|
+
/** Rendered as `data-analytics-id` on the input */
|
|
31
|
+
dataAnalyticsId?: string;
|
|
30
32
|
}
|
|
31
33
|
export declare const InputAdornments: {
|
|
32
|
-
({ id, value, className, disabled, isError, maxLength, onChange, onKeyDown, onFocus, startAdornment, endAdornment, placeholder, inputType, autoFocus, name, onBlur, ref, ariaLabel, ariaDescribedby, role, ariaAutocomplete, ariaControls, ariaHaspopup, ariaExpanded, autocomplete }: IInputAdornments): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
({ id, value, className, disabled, isError, maxLength, onChange, onKeyDown, onFocus, startAdornment, endAdornment, placeholder, inputType, autoFocus, name, onBlur, ref, ariaLabel, ariaDescribedby, role, ariaAutocomplete, ariaControls, ariaHaspopup, ariaExpanded, autocomplete, dataAnalyticsId }: IInputAdornments): import("react/jsx-runtime").JSX.Element;
|
|
33
35
|
displayName: string;
|
|
34
36
|
};
|
|
@@ -4,7 +4,7 @@ import { classNames } from "../commonHelpers/classNames/classNames";
|
|
|
4
4
|
import { TextInputRaw } from "../textInputRaw/textInputRaw";
|
|
5
5
|
import { useDriveClassName } from "../utils/theme/useDriveClassName";
|
|
6
6
|
import { useMobileClassName } from "../utils/theme/useMobileClassName";
|
|
7
|
-
export const InputAdornments = ({ id, value, className = "", disabled, isError, maxLength, onChange, onKeyDown, onFocus, startAdornment, endAdornment, placeholder, inputType = "text", autoFocus, name, onBlur, ref, ariaLabel, ariaDescribedby, role, ariaAutocomplete, ariaControls, ariaHaspopup, ariaExpanded, autocomplete }) => {
|
|
7
|
+
export const InputAdornments = ({ id, value, className = "", disabled, isError, maxLength, onChange, onKeyDown, onFocus, startAdornment, endAdornment, placeholder, inputType = "text", autoFocus, name, onBlur, ref, ariaLabel, ariaDescribedby, role, ariaAutocomplete, ariaControls, ariaHaspopup, ariaExpanded, autocomplete, dataAnalyticsId }) => {
|
|
8
8
|
const disabledClassName = disabled ? "zen-input-adornments--disabled" : "";
|
|
9
9
|
const driveComponentClass = useDriveClassName("zen-input-adornments");
|
|
10
10
|
const mobileComponentClass = useMobileClassName("zen-input-adornments");
|
|
@@ -22,6 +22,6 @@ export const InputAdornments = ({ id, value, className = "", disabled, isError,
|
|
|
22
22
|
!value ? "zen-input-adornments__wrapper--empty" : "",
|
|
23
23
|
className
|
|
24
24
|
]), [className, endAdornment, value]);
|
|
25
|
-
return (_jsxs("div", { className: classes, children: [!!startAdornment && _jsx("div", { className: "zen-input-adornments__adornment zen-input-adornments__adornment--start", children: startAdornment }), _jsx("div", { className: wrapperClasses, children: _jsx(TextInputRaw, { name: name, onBlur: onBlur, ref: ref, id: id, value: value, maxLength: maxLength, isError: isError, placeholder: placeholder, onChange: onChange, onKeyDown: onKeyDown, onFocus: onFocus, disabled: disabled, type: inputType, autoFocus: autoFocus, ariaLabel: ariaLabel, ariaDescribedby: ariaDescribedby, role: role, ariaAutocomplete: ariaAutocomplete, ariaControls: ariaControls, ariaHaspopup: ariaHaspopup, ariaExpanded: ariaExpanded === undefined ? undefined : ariaExpanded === "true" || ariaExpanded === true, autocomplete: autocomplete, className: "zen-input-adornments__input zen-input-adornments__input--border-none" }) }), !!endAdornment && _jsx("div", { className: "zen-input-adornments__adornment zen-input-adornments__adornment--end", children: endAdornment })] }));
|
|
25
|
+
return (_jsxs("div", { className: classes, children: [!!startAdornment && _jsx("div", { className: "zen-input-adornments__adornment zen-input-adornments__adornment--start", children: startAdornment }), _jsx("div", { className: wrapperClasses, children: _jsx(TextInputRaw, { name: name, onBlur: onBlur, ref: ref, id: id, value: value, maxLength: maxLength, isError: isError, placeholder: placeholder, onChange: onChange, onKeyDown: onKeyDown, onFocus: onFocus, disabled: disabled, type: inputType, autoFocus: autoFocus, ariaLabel: ariaLabel, ariaDescribedby: ariaDescribedby, role: role, ariaAutocomplete: ariaAutocomplete, ariaControls: ariaControls, ariaHaspopup: ariaHaspopup, ariaExpanded: ariaExpanded === undefined ? undefined : ariaExpanded === "true" || ariaExpanded === true, autocomplete: autocomplete, dataAnalyticsId: dataAnalyticsId, className: "zen-input-adornments__input zen-input-adornments__input--border-none" }) }), !!endAdornment && _jsx("div", { className: "zen-input-adornments__adornment zen-input-adornments__adornment--end", children: endAdornment })] }));
|
|
26
26
|
};
|
|
27
27
|
InputAdornments.displayName = "InputAdornments";
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { IZenComponentProps } from "../commonHelpers/zenComponent";
|
|
2
2
|
import type { ChartData, ChartOptions } from "chart.js/auto";
|
|
3
|
+
import { IChartAccessibilityOptions } from "../chart/accessibleChart/interfaces";
|
|
3
4
|
import "./lineChartMini.less";
|
|
4
5
|
export interface ILineChartMini extends IZenComponentProps {
|
|
5
6
|
data: ChartData<"line">;
|
|
6
7
|
options?: ChartOptions<"line">;
|
|
8
|
+
accessibility?: IChartAccessibilityOptions;
|
|
7
9
|
}
|
|
8
|
-
export declare const LineChartMini: ({ data, options, ...rest }: ILineChartMini) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const LineChartMini: ({ data, options, accessibility, ...rest }: ILineChartMini) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -101,9 +101,10 @@ export const LineChartMini = _a => {
|
|
|
101
101
|
var _b, _c;
|
|
102
102
|
var {
|
|
103
103
|
data,
|
|
104
|
-
options = {}
|
|
104
|
+
options = {},
|
|
105
|
+
accessibility
|
|
105
106
|
} = _a,
|
|
106
|
-
rest = __rest(_a, ["data", "options"]);
|
|
107
|
+
rest = __rest(_a, ["data", "options", "accessibility"]);
|
|
107
108
|
const {
|
|
108
109
|
translate
|
|
109
110
|
} = useLanguage();
|
|
@@ -152,7 +153,8 @@ export const LineChartMini = _a => {
|
|
|
152
153
|
}), _jsx(AccessibleChart, {
|
|
153
154
|
type: "line-mini",
|
|
154
155
|
data: adaptedData,
|
|
155
|
-
narrativeId: narrativeId
|
|
156
|
+
narrativeId: narrativeId,
|
|
157
|
+
accessibility: accessibility
|
|
156
158
|
})]
|
|
157
159
|
});
|
|
158
160
|
};
|
package/esm/modal/modal.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ interface IButtons extends IButtonIconProps {
|
|
|
24
24
|
className?: string;
|
|
25
25
|
title?: string;
|
|
26
26
|
disabled?: boolean;
|
|
27
|
+
/** Rendered as `data-analytics-id` on the button */
|
|
28
|
+
dataAnalyticsId?: string;
|
|
27
29
|
}
|
|
28
30
|
interface IPrimaryButtons extends IButtons {
|
|
29
31
|
type?: "primary" | "destructive";
|
|
@@ -10,5 +10,7 @@ export interface IPrimaryIcon extends IZenComponentProps {
|
|
|
10
10
|
title?: string;
|
|
11
11
|
disabled?: boolean;
|
|
12
12
|
style?: "primary" | "secondary";
|
|
13
|
+
/** Rendered as `data-analytics-id` on the button or link. Not rendered when the icon is a plain div. */
|
|
14
|
+
dataAnalyticsId?: string;
|
|
13
15
|
}
|
|
14
|
-
export declare const PrimaryIcon: ({ icon, className, onClick, link, target, title, disabled, style }: IPrimaryIcon) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare const PrimaryIcon: ({ icon, className, onClick, link, target, title, disabled, style, dataAnalyticsId }: IPrimaryIcon) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
import { classNames } from "../commonHelpers/classNames/classNames";
|
|
4
4
|
import { renderIcon } from "./renderIcon";
|
|
5
|
-
export const PrimaryIcon = ({ icon, className, onClick, link, target, title, disabled, style }) => {
|
|
5
|
+
export const PrimaryIcon = ({ icon, className, onClick, link, target, title, disabled, style, dataAnalyticsId }) => {
|
|
6
6
|
const iconNode = useMemo(() => renderIcon(icon, className), [icon, className]);
|
|
7
7
|
const topClassName = useMemo(() => classNames([
|
|
8
8
|
"zen-primary-icon",
|
|
@@ -12,10 +12,10 @@ export const PrimaryIcon = ({ icon, className, onClick, link, target, title, dis
|
|
|
12
12
|
className || ""
|
|
13
13
|
]), [onClick, link, className, disabled, style]);
|
|
14
14
|
if (onClick) {
|
|
15
|
-
return (_jsx("button", { className: topClassName, onClick: onClick, disabled: disabled, title: title, "aria-label": title, children: iconNode }));
|
|
15
|
+
return (_jsx("button", { className: topClassName, onClick: onClick, disabled: disabled, title: title, "aria-label": title, "data-analytics-id": dataAnalyticsId, children: iconNode }));
|
|
16
16
|
}
|
|
17
17
|
if (link) {
|
|
18
|
-
return (_jsx("a", { className: topClassName, href: disabled ? undefined : link, target: target, title: title, "aria-label": title, children: iconNode }));
|
|
18
|
+
return (_jsx("a", { className: topClassName, href: disabled ? undefined : link, target: target, title: title, "aria-label": title, "data-analytics-id": dataAnalyticsId, children: iconNode }));
|
|
19
19
|
}
|
|
20
20
|
return _jsx("div", { className: topClassName, children: iconNode });
|
|
21
21
|
};
|
|
@@ -100,7 +100,8 @@ export const SearchInputRaw = props => {
|
|
|
100
100
|
ariaControls,
|
|
101
101
|
ariaHaspopup,
|
|
102
102
|
ariaExpanded,
|
|
103
|
-
autocomplete = "off"
|
|
103
|
+
autocomplete = "off",
|
|
104
|
+
dataAnalyticsId
|
|
104
105
|
} = props;
|
|
105
106
|
const {
|
|
106
107
|
name,
|
|
@@ -194,7 +195,8 @@ export const SearchInputRaw = props => {
|
|
|
194
195
|
ariaControls: ariaControls,
|
|
195
196
|
ariaHaspopup: ariaHaspopup,
|
|
196
197
|
ariaExpanded: ariaExpanded === undefined ? undefined : ariaExpanded === "true" || ariaExpanded === true,
|
|
197
|
-
autocomplete: autocomplete
|
|
198
|
+
autocomplete: autocomplete,
|
|
199
|
+
dataAnalyticsId: dataAnalyticsId
|
|
198
200
|
})
|
|
199
201
|
}));
|
|
200
202
|
};
|
|
@@ -29,6 +29,8 @@ export interface ISearchInputRawBase {
|
|
|
29
29
|
ariaExpanded?: boolean | "true" | "false";
|
|
30
30
|
/** HTML autocomplete attribute for the underlying input. Defaults to "off" to suppress browser autofill. */
|
|
31
31
|
autocomplete?: string;
|
|
32
|
+
/** Rendered as `data-analytics-id` on the input */
|
|
33
|
+
dataAnalyticsId?: string;
|
|
32
34
|
}
|
|
33
35
|
export interface ISearchInputRawDefault extends ISearchInputRawBase {
|
|
34
36
|
value: string;
|
|
@@ -21,6 +21,6 @@ export const TextInputRaw = (props) => {
|
|
|
21
21
|
props.isError ? "zen-text-input--error" : ""
|
|
22
22
|
]), value: maxLength ? value.substring(0, maxLength) : value, placeholder: props.placeholder, disabled: disabled, onChange: onChange, onKeyDown: props.onKeyDown, onBlur: onBlur, maxLength: maxLength, autoComplete: props.autocomplete,
|
|
23
23
|
// TODO: add tests
|
|
24
|
-
min: min, max: max, step: props.step, autoFocus: props.autoFocus, required: !!required, onFocus: props.onFocus, minLength: minLength, name: name, pattern: pattern, role: props.role }, getAriaAttributes(props), { "aria-expanded": props.ariaExpanded === undefined ? undefined : props.ariaExpanded === "true" || props.ariaExpanded === true })));
|
|
24
|
+
min: min, max: max, step: props.step, autoFocus: props.autoFocus, required: !!required, onFocus: props.onFocus, minLength: minLength, name: name, pattern: pattern, role: props.role, "data-analytics-id": props.dataAnalyticsId }, getAriaAttributes(props), { "aria-expanded": props.ariaExpanded === undefined ? undefined : props.ariaExpanded === "true" || props.ariaExpanded === true })));
|
|
25
25
|
};
|
|
26
26
|
TextInputRaw.displayName = "TextInputRaw";
|
|
@@ -10,6 +10,8 @@ export interface ITextInputRawBase {
|
|
|
10
10
|
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
|
11
11
|
type?: string;
|
|
12
12
|
autocomplete?: string;
|
|
13
|
+
/** Rendered as `data-analytics-id` on the input */
|
|
14
|
+
dataAnalyticsId?: string;
|
|
13
15
|
ariaLabelledby?: string;
|
|
14
16
|
role?: string;
|
|
15
17
|
ariaAutocomplete?: "list" | "none" | "inline" | "both";
|