@geotab/zenith 3.8.0 → 3.9.0-beta.ssr.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 +12 -12
- package/dist/button/button.d.ts +2 -1
- package/dist/button/button.js +3 -3
- package/dist/calendar/calendar.js +200 -3
- package/dist/card/components/cardButton/cardButton.d.ts +2 -1
- package/dist/card/components/cardButton/cardButton.js +5 -3
- package/dist/card/components/title.js +7 -3
- package/dist/chart/barChart/getBarLegendItems.js +3 -5
- package/dist/chart/lineChart/getLineLegendItems.js +7 -7
- package/dist/chart/pieChart/getPieLegendItems.js +8 -12
- package/dist/chart/plugins/legend/interfaces.d.ts +1 -1
- package/dist/dateInputInner/dateInputInnerControlBlock.js +12 -8
- package/dist/dialog/dialog.js +4 -3
- package/dist/fileUpload/fileUpload.js +21 -12
- package/dist/filtersBar/filtersBarSidePanel/components/filtersBarSidePanelRange/filtersBarSidePanelRange.js +3 -0
- package/dist/formFieldError/formFieldError.d.ts +2 -1
- package/dist/formFieldError/formFieldError.js +2 -2
- package/dist/index.css +5 -0
- package/dist/index.d.ts +0 -2
- package/dist/index.js +16 -20
- package/dist/nav/navEditList/navEditListUtils.d.ts +1 -1
- package/dist/nav/navEditList/navEditListUtils.js +2 -1
- package/dist/nav/navItem/navActionItem.js +3 -3
- package/dist/pageHeader/pageHeaderActions.js +4 -3
- package/dist/rangeRaw/rangeRaw.js +7 -1
- package/dist/selectList/selectList.js +11 -7
- package/dist/toggleButtonRaw/toggleButtonRaw.js +3 -1
- package/dist/toggleButtonRaw/types.d.ts +1 -0
- package/dist/tooltip/tooltip.js +11 -11
- package/dist/utils/localization/translations/en-json.d.ts +2 -0
- package/dist/utils/localization/translations/en-json.js +3 -1
- package/esm/button/button.d.ts +2 -1
- package/esm/button/button.js +3 -3
- package/esm/calendar/calendar.js +200 -3
- package/esm/card/components/cardButton/cardButton.d.ts +2 -1
- package/esm/card/components/cardButton/cardButton.js +5 -3
- package/esm/card/components/title.js +8 -4
- package/esm/chart/barChart/getBarLegendItems.js +3 -5
- package/esm/chart/lineChart/getLineLegendItems.js +7 -7
- package/esm/chart/pieChart/getPieLegendItems.js +8 -12
- package/esm/chart/plugins/legend/interfaces.d.ts +1 -1
- package/esm/dateInputInner/dateInputInnerControlBlock.js +13 -9
- package/esm/dialog/dialog.js +4 -3
- package/esm/fileUpload/fileUpload.js +21 -12
- package/esm/filtersBar/filtersBarSidePanel/components/filtersBarSidePanelRange/filtersBarSidePanelRange.js +3 -0
- package/esm/formFieldError/formFieldError.d.ts +2 -1
- package/esm/formFieldError/formFieldError.js +2 -2
- package/esm/index.d.ts +0 -2
- package/esm/index.js +0 -2
- package/esm/nav/navEditList/navEditListUtils.d.ts +1 -1
- package/esm/nav/navEditList/navEditListUtils.js +2 -1
- package/esm/nav/navItem/navActionItem.js +3 -2
- package/esm/pageHeader/pageHeaderActions.js +4 -3
- package/esm/rangeRaw/rangeRaw.js +7 -1
- package/esm/selectList/selectList.js +11 -7
- package/esm/toggleButtonRaw/toggleButtonRaw.js +3 -1
- package/esm/toggleButtonRaw/types.d.ts +1 -0
- package/esm/tooltip/tooltip.js +11 -11
- package/esm/utils/localization/translations/en-json.d.ts +2 -0
- package/esm/utils/localization/translations/en-json.js +3 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -56,20 +56,20 @@ Zenith library provides components defined in Zenith Design System. It includes
|
|
|
56
56
|
|
|
57
57
|
### 3.8.0
|
|
58
58
|
|
|
59
|
-
- Create FileUpload component
|
|
60
|
-
- Improve Accordion component Storybook documentation
|
|
61
|
-
- Improve Divider component Storybook documentation
|
|
62
|
-
- Improve accessibility for DataGrid sorting
|
|
63
|
-
- Create Chip component documentation
|
|
64
|
-
- Update sort controls in mobile Table
|
|
65
|
-
- Improve accessibility for Radio button
|
|
66
|
-
- Improve accessibility for
|
|
67
|
-
- Accessibility updates for Dropdown
|
|
68
|
-
-
|
|
69
|
-
- SummaryTile refactor, documentation updates
|
|
59
|
+
- Create `FileUpload` component
|
|
60
|
+
- Improve `Accordion` component Storybook documentation
|
|
61
|
+
- Improve `Divider` component Storybook documentation
|
|
62
|
+
- Improve accessibility for `DataGrid` sorting
|
|
63
|
+
- Create `Chip` component documentation
|
|
64
|
+
- Update sort controls in mobile `Table`
|
|
65
|
+
- Improve accessibility for `Radio` button
|
|
66
|
+
- Improve accessibility for `SummaryTile`
|
|
67
|
+
- Accessibility updates for `Dropdown`, `MobileSheet`, `ControlledPopup`
|
|
68
|
+
- `SummaryTile` refactor, documentation updates
|
|
70
69
|
- Updated translations
|
|
71
70
|
- Add multiline table header support (word wrap for long strings)
|
|
72
|
-
- SidePanel outside click improvements
|
|
71
|
+
- `SidePanel` outside click improvements
|
|
72
|
+
- Add Horizontal Layout for pie `Chart` component
|
|
73
73
|
|
|
74
74
|
### 3.7.0
|
|
75
75
|
|
package/dist/button/button.d.ts
CHANGED
|
@@ -24,8 +24,9 @@ export interface IButton extends IZenComponentProps, IZenGridItem {
|
|
|
24
24
|
ref?: Ref<HTMLButtonElement | null>;
|
|
25
25
|
role?: string;
|
|
26
26
|
ariaLabel?: string;
|
|
27
|
+
dataAnalyticsId?: string;
|
|
27
28
|
}
|
|
28
29
|
export declare const Button: {
|
|
29
|
-
({ className, type, disabled, id, title, onClick, onMouseOver, onMouseOut, onMouseDown, onMouseUp, onKeyDown, onKeyUp, children, link, target, htmlType, rel, ref, name, onBlur, role, ariaLabel, ...other }: IButton): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
({ className, type, disabled, id, title, onClick, onMouseOver, onMouseOut, onMouseDown, onMouseUp, onKeyDown, onKeyUp, children, link, target, htmlType, rel, ref, name, onBlur, role, ariaLabel, dataAnalyticsId, ...other }: IButton): import("react/jsx-runtime").JSX.Element;
|
|
30
31
|
displayName: string;
|
|
31
32
|
};
|
package/dist/button/button.js
CHANGED
|
@@ -19,14 +19,14 @@ const useDriveClassName_1 = require("../utils/theme/useDriveClassName");
|
|
|
19
19
|
const filterGridProps_1 = require("../gridLayout/utils/filterGridProps");
|
|
20
20
|
const useMobileClassName_1 = require("../utils/theme/useMobileClassName");
|
|
21
21
|
const Button = (_a) => {
|
|
22
|
-
var { className, type, disabled, id, title, onClick, onMouseOver, onMouseOut, onMouseDown, onMouseUp, onKeyDown, onKeyUp, children, link, target, htmlType, rel, ref, name, onBlur, role, ariaLabel } = _a, other = __rest(_a, ["className", "type", "disabled", "id", "title", "onClick", "onMouseOver", "onMouseOut", "onMouseDown", "onMouseUp", "onKeyDown", "onKeyUp", "children", "link", "target", "htmlType", "rel", "ref", "name", "onBlur", "role", "ariaLabel"]);
|
|
22
|
+
var { className, type, disabled, id, title, onClick, onMouseOver, onMouseOut, onMouseDown, onMouseUp, onKeyDown, onKeyUp, children, link, target, htmlType, rel, ref, name, onBlur, role, ariaLabel, dataAnalyticsId } = _a, other = __rest(_a, ["className", "type", "disabled", "id", "title", "onClick", "onMouseOver", "onMouseOut", "onMouseDown", "onMouseUp", "onKeyDown", "onKeyUp", "children", "link", "target", "htmlType", "rel", "ref", "name", "onBlur", "role", "ariaLabel", "dataAnalyticsId"]);
|
|
23
23
|
const modifierClassName = type && type !== buttonType_1.ButtonType.Secondary ? `zen-button--${type}` : "";
|
|
24
24
|
const disabledClassName = disabled ? "zen-button--disabled" : "";
|
|
25
25
|
const driveClasses = (0, useDriveClassName_1.useDriveClassName)("zen-button");
|
|
26
26
|
const ariaLabelValue = ariaLabel || title;
|
|
27
27
|
const mobileClasses = (0, useMobileClassName_1.useMobileClassName)("zen-button");
|
|
28
|
-
const commonArgs = Object.assign(Object.assign({ id,
|
|
29
|
-
title }, (ariaLabelValue ? { "aria-label": ariaLabelValue } : {})), { className: (0, classNames_1.classNames)(["zen-button", mobileClasses || driveClasses || "", modifierClassName, disabledClassName, className !== null && className !== void 0 ? className : ""]) });
|
|
28
|
+
const commonArgs = Object.assign(Object.assign(Object.assign({ id,
|
|
29
|
+
title }, (ariaLabelValue ? { "aria-label": ariaLabelValue } : {})), (dataAnalyticsId ? { "data-analytics-id": dataAnalyticsId } : {})), { className: (0, classNames_1.classNames)(["zen-button", mobileClasses || driveClasses || "", modifierClassName, disabledClassName, className !== null && className !== void 0 ? className : ""]) });
|
|
30
30
|
if (link) {
|
|
31
31
|
return ((0, jsx_runtime_1.jsx)("a", Object.assign({ role: "link", rel: rel, target: target, href: disabled ? undefined : link, "aria-disabled": disabled, onKeyDown: onKeyDown, onKeyUp: onKeyUp, onMouseOver: onMouseOver, onMouseOut: onMouseOut, onClick: onClick }, commonArgs, (0, filterGridProps_1.filterGridProps)(other), { children: children })));
|
|
32
32
|
}
|
|
@@ -197,6 +197,195 @@ injectString("zh-Hans", "ShortSaturday", "\u516D");
|
|
|
197
197
|
injectString("zh-TW", "ShortSaturday", "\u9031\u516D");
|
|
198
198
|
injectString("ro-RO", "ShortSaturday", "ShortSaturday");
|
|
199
199
|
injectString("ar-SA", "ShortSaturday", "\u0633");
|
|
200
|
+
injectString("cs", "Sunday", "Ned\u011Ble");
|
|
201
|
+
injectString("da-DK", "Sunday", "s\xF8ndag");
|
|
202
|
+
injectString("de", "Sunday", "Sonntag");
|
|
203
|
+
injectString("en", "Sunday", "Sunday");
|
|
204
|
+
injectString("es", "Sunday", "Domingo");
|
|
205
|
+
injectString("fi-FI", "Sunday", "Sunnuntai");
|
|
206
|
+
injectString("fr", "Sunday", "Dimanche");
|
|
207
|
+
injectString("fr-FR", "Sunday", "Dimanche");
|
|
208
|
+
injectString("hu-HU", "Sunday", "vas\xE1rnap");
|
|
209
|
+
injectString("id", "Sunday", "Minggu");
|
|
210
|
+
injectString("it", "Sunday", "Domenica");
|
|
211
|
+
injectString("ja", "Sunday", "\u65E5\u66DC\u65E5");
|
|
212
|
+
injectString("ko-KR", "Sunday", "\uC77C\uC694\uC77C");
|
|
213
|
+
injectString("ms", "Sunday", "Ahad");
|
|
214
|
+
injectString("nb-NO", "Sunday", "S\xF8ndag");
|
|
215
|
+
injectString("nl", "Sunday", "zondag");
|
|
216
|
+
injectString("pl", "Sunday", "Niedziela");
|
|
217
|
+
injectString("pt-BR", "Sunday", "Domingo");
|
|
218
|
+
injectString("pt-PT", "Sunday", "Domingo");
|
|
219
|
+
injectString("sk-SK", "Sunday", "Nede\u013Ea");
|
|
220
|
+
injectString("sv", "Sunday", "S\xF6ndag");
|
|
221
|
+
injectString("th", "Sunday", "\u0E27\u0E31\u0E19\u0E2D\u0E32\u0E17\u0E34\u0E15\u0E22\u0E4C");
|
|
222
|
+
injectString("tr", "Sunday", "Pazar");
|
|
223
|
+
injectString("zh-Hans", "Sunday", "\u661F\u671F\u5929");
|
|
224
|
+
injectString("zh-TW", "Sunday", "\u661F\u671F\u65E5");
|
|
225
|
+
injectString("ro-RO", "Sunday", "Duminic\u0103");
|
|
226
|
+
injectString("ar-SA", "Sunday", "\u0627\u0644\u0623\u062D\u062F");
|
|
227
|
+
injectString("cs", "Monday", "Pond\u011Bl\xED");
|
|
228
|
+
injectString("da-DK", "Monday", "mandag");
|
|
229
|
+
injectString("de", "Monday", "Montag");
|
|
230
|
+
injectString("en", "Monday", "Monday");
|
|
231
|
+
injectString("es", "Monday", "Lunes");
|
|
232
|
+
injectString("fi-FI", "Monday", "Maanantai");
|
|
233
|
+
injectString("fr", "Monday", "Lundi");
|
|
234
|
+
injectString("fr-FR", "Monday", "Lundi");
|
|
235
|
+
injectString("hu-HU", "Monday", "h\xE9tf\u0151");
|
|
236
|
+
injectString("id", "Monday", "Senin");
|
|
237
|
+
injectString("it", "Monday", "Luned\xEC");
|
|
238
|
+
injectString("ja", "Monday", "\u6708\u66DC\u65E5");
|
|
239
|
+
injectString("ko-KR", "Monday", "\uC6D4\uC694\uC77C");
|
|
240
|
+
injectString("ms", "Monday", "Isnin");
|
|
241
|
+
injectString("nb-NO", "Monday", "Mandag");
|
|
242
|
+
injectString("nl", "Monday", "maandag");
|
|
243
|
+
injectString("pl", "Monday", "Poniedzia\u0142ek");
|
|
244
|
+
injectString("pt-BR", "Monday", "Segunda-feira");
|
|
245
|
+
injectString("pt-PT", "Monday", "Segunda-feira");
|
|
246
|
+
injectString("sk-SK", "Monday", "pondelok");
|
|
247
|
+
injectString("sv", "Monday", "M\xE5ndag");
|
|
248
|
+
injectString("th", "Monday", "\u0E27\u0E31\u0E19\u0E08\u0E31\u0E19\u0E17\u0E23\u0E4C");
|
|
249
|
+
injectString("tr", "Monday", "Pazartesi");
|
|
250
|
+
injectString("zh-Hans", "Monday", "\u661F\u671F\u4E00");
|
|
251
|
+
injectString("zh-TW", "Monday", "\u661F\u671F\u4E00");
|
|
252
|
+
injectString("ro-RO", "Monday", "Luni");
|
|
253
|
+
injectString("ar-SA", "Monday", "\u0627\u0644\u0627\u062B\u0646\u064A\u0646");
|
|
254
|
+
injectString("cs", "Tuesday", "\xDAter\xFD");
|
|
255
|
+
injectString("da-DK", "Tuesday", "tirsdag");
|
|
256
|
+
injectString("de", "Tuesday", "Dienstag");
|
|
257
|
+
injectString("en", "Tuesday", "Tuesday");
|
|
258
|
+
injectString("es", "Tuesday", "Martes");
|
|
259
|
+
injectString("fi-FI", "Tuesday", "Tiistai");
|
|
260
|
+
injectString("fr", "Tuesday", "Mardi");
|
|
261
|
+
injectString("fr-FR", "Tuesday", "Mardi");
|
|
262
|
+
injectString("hu-HU", "Tuesday", "kedd");
|
|
263
|
+
injectString("id", "Tuesday", "Selasa");
|
|
264
|
+
injectString("it", "Tuesday", "Marted\xEC");
|
|
265
|
+
injectString("ja", "Tuesday", "\u706B\u66DC\u65E5");
|
|
266
|
+
injectString("ko-KR", "Tuesday", "\uD654\uC694\uC77C");
|
|
267
|
+
injectString("ms", "Tuesday", "Selasa");
|
|
268
|
+
injectString("nb-NO", "Tuesday", "Tirsdag");
|
|
269
|
+
injectString("nl", "Tuesday", "dinsdag");
|
|
270
|
+
injectString("pl", "Tuesday", "Wtorek");
|
|
271
|
+
injectString("pt-BR", "Tuesday", "Ter\xE7a-feira");
|
|
272
|
+
injectString("pt-PT", "Tuesday", "Ter\xE7a-feira");
|
|
273
|
+
injectString("sk-SK", "Tuesday", "Utorok");
|
|
274
|
+
injectString("sv", "Tuesday", "Tisdag");
|
|
275
|
+
injectString("th", "Tuesday", "\u0E27\u0E31\u0E19\u0E2D\u0E31\u0E07\u0E04\u0E32\u0E23");
|
|
276
|
+
injectString("tr", "Tuesday", "Sal\u0131");
|
|
277
|
+
injectString("zh-Hans", "Tuesday", "\u661F\u671F\u4E8C");
|
|
278
|
+
injectString("zh-TW", "Tuesday", "\u661F\u671F\u4E8C");
|
|
279
|
+
injectString("ro-RO", "Tuesday", "Mar\u021Bi");
|
|
280
|
+
injectString("ar-SA", "Tuesday", "\u0627\u0644\u062B\u0644\u0627\u062B\u0627\u0621");
|
|
281
|
+
injectString("cs", "Wednesday", "St\u0159eda");
|
|
282
|
+
injectString("da-DK", "Wednesday", "onsdag");
|
|
283
|
+
injectString("de", "Wednesday", "Mittwoch");
|
|
284
|
+
injectString("en", "Wednesday", "Wednesday");
|
|
285
|
+
injectString("es", "Wednesday", "Mi\xE9rcoles");
|
|
286
|
+
injectString("fi-FI", "Wednesday", "Keskiviikko");
|
|
287
|
+
injectString("fr", "Wednesday", "Mercredi");
|
|
288
|
+
injectString("fr-FR", "Wednesday", "Mercredi");
|
|
289
|
+
injectString("hu-HU", "Wednesday", "szerda");
|
|
290
|
+
injectString("id", "Wednesday", "Rabu");
|
|
291
|
+
injectString("it", "Wednesday", "Mercoled\xEC");
|
|
292
|
+
injectString("ja", "Wednesday", "\u6C34\u66DC\u65E5");
|
|
293
|
+
injectString("ko-KR", "Wednesday", "\uC218\uC694\uC77C");
|
|
294
|
+
injectString("ms", "Wednesday", "Rabu");
|
|
295
|
+
injectString("nb-NO", "Wednesday", "Onsdag");
|
|
296
|
+
injectString("nl", "Wednesday", "woensdag");
|
|
297
|
+
injectString("pl", "Wednesday", "\u015Aroda");
|
|
298
|
+
injectString("pt-BR", "Wednesday", "Quarta-feira");
|
|
299
|
+
injectString("pt-PT", "Wednesday", "Quarta-feira");
|
|
300
|
+
injectString("sk-SK", "Wednesday", "Streda");
|
|
301
|
+
injectString("sv", "Wednesday", "Onsdag");
|
|
302
|
+
injectString("th", "Wednesday", "\u0E27\u0E31\u0E19\u0E1E\u0E38\u0E18");
|
|
303
|
+
injectString("tr", "Wednesday", "\xC7ar\u015Famba");
|
|
304
|
+
injectString("zh-Hans", "Wednesday", "\u661F\u671F\u4E09");
|
|
305
|
+
injectString("zh-TW", "Wednesday", "\u661F\u671F\u4E09");
|
|
306
|
+
injectString("ro-RO", "Wednesday", "Miercuri");
|
|
307
|
+
injectString("ar-SA", "Wednesday", "\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621");
|
|
308
|
+
injectString("cs", "Thursday", "\u010Ctvrtek");
|
|
309
|
+
injectString("da-DK", "Thursday", "torsdag");
|
|
310
|
+
injectString("de", "Thursday", "Donnerstag");
|
|
311
|
+
injectString("en", "Thursday", "Thursday");
|
|
312
|
+
injectString("es", "Thursday", "Jueves");
|
|
313
|
+
injectString("fi-FI", "Thursday", "Torstai");
|
|
314
|
+
injectString("fr", "Thursday", "Jeudi");
|
|
315
|
+
injectString("fr-FR", "Thursday", "Jeudi");
|
|
316
|
+
injectString("hu-HU", "Thursday", "cs\xFCt\xF6rt\xF6k");
|
|
317
|
+
injectString("id", "Thursday", "Kamis");
|
|
318
|
+
injectString("it", "Thursday", "Gioved\xEC");
|
|
319
|
+
injectString("ja", "Thursday", "\u6728\u66DC\u65E5");
|
|
320
|
+
injectString("ko-KR", "Thursday", "\uBAA9\uC694\uC77C");
|
|
321
|
+
injectString("ms", "Thursday", "Khamis");
|
|
322
|
+
injectString("nb-NO", "Thursday", "Torsdag");
|
|
323
|
+
injectString("nl", "Thursday", "donderdag");
|
|
324
|
+
injectString("pl", "Thursday", "Czwartek");
|
|
325
|
+
injectString("pt-BR", "Thursday", "Quinta-feira");
|
|
326
|
+
injectString("pt-PT", "Thursday", "Quinta-feira");
|
|
327
|
+
injectString("sk-SK", "Thursday", "\u0161tvrtok");
|
|
328
|
+
injectString("sv", "Thursday", "Torsdag");
|
|
329
|
+
injectString("th", "Thursday", "\u0E27\u0E31\u0E19\u0E1E\u0E24\u0E2B\u0E31\u0E2A\u0E1A\u0E14\u0E35");
|
|
330
|
+
injectString("tr", "Thursday", "Per\u015Fembe");
|
|
331
|
+
injectString("zh-Hans", "Thursday", "\u661F\u671F\u56DB");
|
|
332
|
+
injectString("zh-TW", "Thursday", "\u661F\u671F\u56DB");
|
|
333
|
+
injectString("ro-RO", "Thursday", "Joi");
|
|
334
|
+
injectString("ar-SA", "Thursday", "\u0627\u0644\u062E\u0645\u064A\u0633");
|
|
335
|
+
injectString("cs", "Friday", "P\xE1tek");
|
|
336
|
+
injectString("da-DK", "Friday", "fredag");
|
|
337
|
+
injectString("de", "Friday", "Freitag");
|
|
338
|
+
injectString("en", "Friday", "Friday");
|
|
339
|
+
injectString("es", "Friday", "Viernes");
|
|
340
|
+
injectString("fi-FI", "Friday", "Perjantai");
|
|
341
|
+
injectString("fr", "Friday", "Vendredi");
|
|
342
|
+
injectString("fr-FR", "Friday", "Vendredi");
|
|
343
|
+
injectString("hu-HU", "Friday", "p\xE9ntek");
|
|
344
|
+
injectString("id", "Friday", "Jumat");
|
|
345
|
+
injectString("it", "Friday", "Venerd\xEC");
|
|
346
|
+
injectString("ja", "Friday", "\u91D1\u66DC\u65E5");
|
|
347
|
+
injectString("ko-KR", "Friday", "\uAE08\uC694\uC77C");
|
|
348
|
+
injectString("ms", "Friday", "Jumaat");
|
|
349
|
+
injectString("nb-NO", "Friday", "Fredag");
|
|
350
|
+
injectString("nl", "Friday", "vrijdag");
|
|
351
|
+
injectString("pl", "Friday", "Pi\u0105tek");
|
|
352
|
+
injectString("pt-BR", "Friday", "Sexta-feira");
|
|
353
|
+
injectString("pt-PT", "Friday", "Sexta-feira");
|
|
354
|
+
injectString("sk-SK", "Friday", "Piatok");
|
|
355
|
+
injectString("sv", "Friday", "Fredag");
|
|
356
|
+
injectString("th", "Friday", "\u0E27\u0E31\u0E19\u0E28\u0E38\u0E01\u0E23\u0E4C");
|
|
357
|
+
injectString("tr", "Friday", "Cuma");
|
|
358
|
+
injectString("zh-Hans", "Friday", "\u661F\u671F\u4E94");
|
|
359
|
+
injectString("zh-TW", "Friday", "\u661F\u671F\u4E94");
|
|
360
|
+
injectString("ro-RO", "Friday", "Vineri");
|
|
361
|
+
injectString("ar-SA", "Friday", "\u0627\u0644\u062C\u0645\u0639\u0629");
|
|
362
|
+
injectString("cs", "Saturday", "Sobota");
|
|
363
|
+
injectString("da-DK", "Saturday", "l\xF8rdag");
|
|
364
|
+
injectString("de", "Saturday", "Samstag");
|
|
365
|
+
injectString("en", "Saturday", "Saturday");
|
|
366
|
+
injectString("es", "Saturday", "S\xE1bado");
|
|
367
|
+
injectString("fi-FI", "Saturday", "Lauantai");
|
|
368
|
+
injectString("fr", "Saturday", "Samedi");
|
|
369
|
+
injectString("fr-FR", "Saturday", "Samedi");
|
|
370
|
+
injectString("hu-HU", "Saturday", "szombat");
|
|
371
|
+
injectString("id", "Saturday", "Sabtu");
|
|
372
|
+
injectString("it", "Saturday", "Sabato");
|
|
373
|
+
injectString("ja", "Saturday", "\u571F\u66DC\u65E5");
|
|
374
|
+
injectString("ko-KR", "Saturday", "\uD1A0\uC694\uC77C");
|
|
375
|
+
injectString("ms", "Saturday", "Sabtu");
|
|
376
|
+
injectString("nb-NO", "Saturday", "L\xF8rdag");
|
|
377
|
+
injectString("nl", "Saturday", "zaterdag");
|
|
378
|
+
injectString("pl", "Saturday", "Sobota");
|
|
379
|
+
injectString("pt-BR", "Saturday", "S\xE1bado");
|
|
380
|
+
injectString("pt-PT", "Saturday", "S\xE1bado");
|
|
381
|
+
injectString("sk-SK", "Saturday", "Sobota");
|
|
382
|
+
injectString("sv", "Saturday", "L\xF6rdag");
|
|
383
|
+
injectString("th", "Saturday", "\u0E27\u0E31\u0E19\u0E40\u0E2A\u0E32\u0E23\u0E4C");
|
|
384
|
+
injectString("tr", "Saturday", "Cumartesi");
|
|
385
|
+
injectString("zh-Hans", "Saturday", "\u661F\u671F\u516D");
|
|
386
|
+
injectString("zh-TW", "Saturday", "\u661F\u671F\u516D");
|
|
387
|
+
injectString("ro-RO", "Saturday", "S\xE2mb\u0103t\u0103");
|
|
388
|
+
injectString("ar-SA", "Saturday", "\u0627\u0644\u0633\u0628\u062A");
|
|
200
389
|
injectString("cs", "Jan", "Led");
|
|
201
390
|
injectString("da-DK", "Jan", "Jan");
|
|
202
391
|
injectString("de", "Jan", "Jan");
|
|
@@ -702,6 +891,7 @@ const Calendar = ({
|
|
|
702
891
|
5: translate("ShortFriday"),
|
|
703
892
|
6: translate("ShortSaturday")
|
|
704
893
|
}), [translate]);
|
|
894
|
+
const fullDayLabels = (0, react_1.useMemo)(() => [translate("Sunday"), translate("Monday"), translate("Tuesday"), translate("Wednesday"), translate("Thursday"), translate("Friday"), translate("Saturday")], [translate]);
|
|
705
895
|
const getDayOfWeek = (0, react_1.useCallback)(date => {
|
|
706
896
|
const dayOfWeek = new Date(date).getDay();
|
|
707
897
|
return dayLabels[dayOfWeek];
|
|
@@ -975,9 +1165,16 @@ const Calendar = ({
|
|
|
975
1165
|
children: [(0, jsx_runtime_1.jsx)("thead", {
|
|
976
1166
|
children: (0, jsx_runtime_1.jsx)("tr", {
|
|
977
1167
|
className: "zen-calendar__columns",
|
|
978
|
-
children: dates[0].map(date => (0, jsx_runtime_1.
|
|
1168
|
+
children: dates[0].map(date => (0, jsx_runtime_1.jsxs)("th", {
|
|
1169
|
+
scope: "col",
|
|
979
1170
|
className: "zen-calendar__column",
|
|
980
|
-
children:
|
|
1171
|
+
children: [(0, jsx_runtime_1.jsx)("span", {
|
|
1172
|
+
"aria-hidden": "true",
|
|
1173
|
+
children: getDayOfWeek(date)
|
|
1174
|
+
}), (0, jsx_runtime_1.jsx)("span", {
|
|
1175
|
+
className: "zen-visually-hidden",
|
|
1176
|
+
children: fullDayLabels[new Date(date).getDay()]
|
|
1177
|
+
})]
|
|
981
1178
|
}, `cal-h-${date}`))
|
|
982
1179
|
})
|
|
983
1180
|
}), (0, jsx_runtime_1.jsx)("tbody", {
|
|
@@ -1032,4 +1229,4 @@ const Calendar = ({
|
|
|
1032
1229
|
});
|
|
1033
1230
|
};
|
|
1034
1231
|
exports.Calendar = Calendar;
|
|
1035
|
-
exports.TRANSLATIONS = ["Select year", "Previous month", "Next month", "Change start date, {date}", "Change end date, {date}", "Choose end date", "Choose start date", "Change date, {date}", "Choose date", "{short-day-of-week-sunday}S", "{short-day-of-week-monday}M", "{short-day-of-week-tuesday}T", "{short-day-of-week-wednesday}W", "{short-day-of-week-thursday}T", "{short-day-of-week-friday}F", "{short-day-of-week-saturday}S", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
1232
|
+
exports.TRANSLATIONS = ["Select year", "Previous month", "Next month", "Change start date, {date}", "Change end date, {date}", "Choose end date", "Choose start date", "Change date, {date}", "Choose date", "{short-day-of-week-sunday}S", "{short-day-of-week-monday}M", "{short-day-of-week-tuesday}T", "{short-day-of-week-wednesday}W", "{short-day-of-week-thursday}T", "{short-day-of-week-friday}F", "{short-day-of-week-saturday}S", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
|
|
@@ -10,5 +10,6 @@ export interface ICardButton extends IZenIdComponentProps {
|
|
|
10
10
|
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
11
11
|
link?: string;
|
|
12
12
|
target?: HTMLAttributeAnchorTarget;
|
|
13
|
+
dataAnalyticsId?: string;
|
|
13
14
|
}
|
|
14
|
-
export declare const CardButton: ({ children, disabled, icon, name, onClick, link, className, target: linkTarget }: ICardButton) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const CardButton: ({ children, disabled, icon, name, onClick, link, className, target: linkTarget, dataAnalyticsId }: ICardButton) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -11,12 +11,14 @@ const iconChevronTopSmall_1 = require("../../../icons/iconChevronTopSmall");
|
|
|
11
11
|
const menu_1 = require("../../../menu/menu");
|
|
12
12
|
const useDriveClassName_1 = require("../../../utils/theme/useDriveClassName");
|
|
13
13
|
const useDrive_1 = require("../../../utils/theme/useDrive");
|
|
14
|
-
const
|
|
14
|
+
const toKebabCase_1 = require("../../../utils/toKebabCase");
|
|
15
|
+
const CardButton = ({ children, disabled = false, icon, name, onClick, link, className, target: linkTarget, dataAnalyticsId }) => {
|
|
15
16
|
const [isOpen, setIsOpen] = (0, react_1.useState)(false);
|
|
16
17
|
const triggerRef = (0, react_1.useRef)(null);
|
|
17
18
|
const content = [];
|
|
18
19
|
const cardButtonDriveClasses = (0, useDriveClassName_1.useDriveClassName)("zen-card-button");
|
|
19
20
|
const isDrive = (0, useDrive_1.useDrive)();
|
|
21
|
+
const analyticsId = dataAnalyticsId || (0, toKebabCase_1.toKebabCase)(name);
|
|
20
22
|
react_1.Children.forEach(children, (el) => {
|
|
21
23
|
if (el.type === menu_1.Menu.Item) {
|
|
22
24
|
content.push(el);
|
|
@@ -30,9 +32,9 @@ const CardButton = ({ children, disabled = false, icon, name, onClick, link, cla
|
|
|
30
32
|
}
|
|
31
33
|
onClick === null || onClick === void 0 ? void 0 : onClick(...args);
|
|
32
34
|
};
|
|
33
|
-
const renderLink = () => ((0, jsx_runtime_1.jsxs)(button_1.Button, { disabled: disabled, type: "tertiary", link: link, target: linkTarget, title: name, className: (0, classNames_1.classNames)([className || "", "zen-card-button", "zen-caption", cardButtonDriveClasses || ""]), children: [icon && (0, react_1.createElement)(icon, { size: isDrive ? "huge" : "large", className: "zen-caption__pre-content" }), (0, jsx_runtime_1.jsx)("span", { className: "zen-caption__content", children: name })] }));
|
|
35
|
+
const renderLink = () => ((0, jsx_runtime_1.jsxs)(button_1.Button, { disabled: disabled, type: "tertiary", link: link, target: linkTarget, title: name, dataAnalyticsId: analyticsId, className: (0, classNames_1.classNames)([className || "", "zen-card-button", "zen-caption", cardButtonDriveClasses || ""]), children: [icon && (0, react_1.createElement)(icon, { size: isDrive ? "huge" : "large", className: "zen-caption__pre-content" }), (0, jsx_runtime_1.jsx)("span", { className: "zen-caption__content", children: name })] }));
|
|
34
36
|
const renderButton = () => {
|
|
35
|
-
const trigger = ((0, jsx_runtime_1.jsxs)(button_1.Button, { htmlType: "button", ref: triggerRef, disabled: disabled, type: "tertiary", onClick: onButtonClickHandler, title: name, className: (0, classNames_1.classNames)([className || "", "zen-card-button", "zen-caption", cardButtonDriveClasses || ""]), children: [icon && (0, react_1.createElement)(icon, { size: isDrive ? "huge" : "large", className: "zen-caption__pre-content" }), (0, jsx_runtime_1.jsx)("span", { className: "zen-caption__content", children: name }), !!content.length &&
|
|
37
|
+
const trigger = ((0, jsx_runtime_1.jsxs)(button_1.Button, { htmlType: "button", ref: triggerRef, disabled: disabled, type: "tertiary", onClick: onButtonClickHandler, title: name, dataAnalyticsId: analyticsId, className: (0, classNames_1.classNames)([className || "", "zen-card-button", "zen-caption", cardButtonDriveClasses || ""]), children: [icon && (0, react_1.createElement)(icon, { size: isDrive ? "huge" : "large", className: "zen-caption__pre-content" }), (0, jsx_runtime_1.jsx)("span", { className: "zen-caption__content", children: name }), !!content.length &&
|
|
36
38
|
(isOpen ? ((0, jsx_runtime_1.jsx)(iconChevronTopSmall_1.IconChevronTopSmall, { size: isDrive ? "huge" : "large", className: "zen-caption__post-content" })) : ((0, jsx_runtime_1.jsx)(iconChevronDownSmall_1.IconChevronDownSmall, { size: isDrive ? "huge" : "large", className: "zen-caption__post-content" })))] }));
|
|
37
39
|
return content.length ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [trigger, (0, jsx_runtime_1.jsx)(controlledMenu_1.ControlledMenu, { title: name, isOpen: isOpen, setIsOpen: setIsOpen, triggerRef: triggerRef, children: content })] })) : (trigger);
|
|
38
40
|
};
|
|
@@ -14,9 +14,13 @@ const Title = ({ isMobile, link, target, title, id, icon, iconType, className =
|
|
|
14
14
|
const iconSize = (0, react_1.useMemo)(() => (isDrive ? "huge" : "large"), [isDrive]);
|
|
15
15
|
const iconElement = (0, react_1.useMemo)(() => (icon ? (0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-card-title__icon", iconClassName]), children: (0, react_1.createElement)(icon, { size: iconSize }) }) : null), [icon, iconSize, iconClassName]);
|
|
16
16
|
const chevron = (0, react_1.useMemo)(() => ((0, jsx_runtime_1.jsx)("span", { className: "zen-card-title__link-chevron", children: (0, jsx_runtime_1.jsx)(iconChevronRightSmall_1.IconChevronRightSmall, { size: iconSize, className: "zen-card-title__chevron-icon" }) })), [iconSize]);
|
|
17
|
-
const roleProp = onClick ? "button" : undefined;
|
|
18
|
-
const tabIndexProp = onClick ? 0 : undefined;
|
|
19
17
|
const titleClasses = (0, classNames_1.classNames)(["zen-card-title", driveClassNames || "", onClick ? "zen-card-title__clickable" : ""]);
|
|
20
|
-
|
|
18
|
+
if (onClick) {
|
|
19
|
+
return ((0, jsx_runtime_1.jsxs)("button", { type: "button", className: titleClasses, onClick: onClick, children: [iconElement, (0, jsx_runtime_1.jsxs)("span", { title: title, id: id, className: (0, classNames_1.classNames)(["zen-card-title__text", isMobile && !isDrive ? "zen-card-title__text--mobile" : "", className]), children: [title, chevron] })] }));
|
|
20
|
+
}
|
|
21
|
+
if (link) {
|
|
22
|
+
return ((0, jsx_runtime_1.jsxs)("a", { id: id, className: titleClasses, href: link, target: target, children: [iconElement, (0, jsx_runtime_1.jsxs)("span", { title: title, className: (0, classNames_1.classNames)(["zen-card-title__link-text"]), children: [title, chevron] })] }));
|
|
23
|
+
}
|
|
24
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: titleClasses, children: [iconElement, (0, jsx_runtime_1.jsx)("span", { title: title, id: id, className: (0, classNames_1.classNames)(["zen-card-title__text", isMobile && !isDrive ? "zen-card-title__text--mobile" : "", className]), children: title })] }));
|
|
21
25
|
};
|
|
22
26
|
exports.Title = Title;
|
|
@@ -19,16 +19,14 @@ const getBarLegendItems = (data, options) => {
|
|
|
19
19
|
const legendItems = data.datasets.map((dataset, index) => {
|
|
20
20
|
let value;
|
|
21
21
|
if (options === null || options === void 0 ? void 0 : options.getValue) {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
if (customValue !== undefined) {
|
|
22
|
+
const customValue = options.getValue(index, getDatasetValues(dataset));
|
|
23
|
+
if (customValue !== null && customValue !== undefined) {
|
|
25
24
|
const strValue = typeof customValue === "number" ? customValue.toFixed(2) : customValue;
|
|
26
25
|
value = (0, formatValue_1.formatValue)(strValue, index, options.unit);
|
|
27
26
|
}
|
|
28
27
|
}
|
|
29
28
|
else if (options === null || options === void 0 ? void 0 : options.unit) {
|
|
30
|
-
|
|
31
|
-
value = (0, formatValue_1.formatValue)(sum.toFixed(2), index, options.unit);
|
|
29
|
+
value = (0, formatValue_1.formatValue)(getDatasetSum(dataset).toFixed(2), index, options.unit);
|
|
32
30
|
}
|
|
33
31
|
const originalLabel = dataset.label || "";
|
|
34
32
|
const text = (options === null || options === void 0 ? void 0 : options.getLabel) ? options.getLabel(index, originalLabel) : originalLabel;
|
|
@@ -38,15 +38,15 @@ const getLineLegendItems = (data, options) => {
|
|
|
38
38
|
}
|
|
39
39
|
let value;
|
|
40
40
|
if (options === null || options === void 0 ? void 0 : options.getValue) {
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
const customValue = options.getValue(index, getDatasetValues(dataset));
|
|
42
|
+
if (customValue !== null) {
|
|
43
|
+
const strValue = customValue !== undefined
|
|
44
|
+
? typeof customValue === "number"
|
|
45
|
+
? customValue.toFixed(2)
|
|
46
|
+
: customValue
|
|
47
|
+
: getLatestValue(dataset).toFixed(2);
|
|
45
48
|
value = (0, formatValue_1.formatValue)(strValue, index, options.unit);
|
|
46
49
|
}
|
|
47
|
-
else {
|
|
48
|
-
value = (0, formatValue_1.formatValue)(getLatestValue(dataset).toFixed(2), index, options.unit);
|
|
49
|
-
}
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
52
52
|
value = (0, formatValue_1.formatValue)(getLatestValue(dataset).toFixed(2), index, options === null || options === void 0 ? void 0 : options.unit);
|
|
@@ -11,22 +11,18 @@ const getPieLegendItems = (data, options, isHidden) => {
|
|
|
11
11
|
const colors = dataset.backgroundColor || [];
|
|
12
12
|
const legendItems = dataset.data.map((item, index) => {
|
|
13
13
|
let value;
|
|
14
|
-
if (isHidden(index)) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
value = (0, formatValue_1.formatValue)(strValue, index, options.unit);
|
|
14
|
+
if (!isHidden(index)) {
|
|
15
|
+
if (options === null || options === void 0 ? void 0 : options.getValue) {
|
|
16
|
+
const customValue = options.getValue(index, dataset.data);
|
|
17
|
+
if (customValue !== null) {
|
|
18
|
+
const strValue = customValue !== undefined ? (typeof customValue === "number" ? customValue.toFixed(2) : customValue) : item.toFixed(2);
|
|
19
|
+
value = (0, formatValue_1.formatValue)(strValue, index, options.unit);
|
|
20
|
+
}
|
|
22
21
|
}
|
|
23
22
|
else {
|
|
24
|
-
value = (0, formatValue_1.formatValue)(item.toFixed(2), index, options.unit);
|
|
23
|
+
value = (0, formatValue_1.formatValue)(item.toFixed(2), index, options === null || options === void 0 ? void 0 : options.unit);
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
|
-
else {
|
|
28
|
-
value = (0, formatValue_1.formatValue)(item.toFixed(2), index, options === null || options === void 0 ? void 0 : options.unit);
|
|
29
|
-
}
|
|
30
26
|
const originalLabel = labels[index] && typeof labels[index] === "string" ? labels[index] : "";
|
|
31
27
|
const text = (options === null || options === void 0 ? void 0 : options.getLabel) ? options.getLabel(index, originalLabel) : originalLabel;
|
|
32
28
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TUnit } from "../../interfaces";
|
|
2
2
|
export interface ILegendOptions {
|
|
3
3
|
unit?: TUnit;
|
|
4
|
-
getValue?: (datasetIndex: number, data: number[]) => string | number | undefined;
|
|
4
|
+
getValue?: (datasetIndex: number, data: number[]) => string | number | null | undefined;
|
|
5
5
|
getLabel?: (datasetIndex: number, originalLabel: string) => string;
|
|
6
6
|
}
|
|
@@ -87,23 +87,28 @@ const DateInputInnerControlBlock = props => {
|
|
|
87
87
|
assistiveText,
|
|
88
88
|
ref
|
|
89
89
|
} = props;
|
|
90
|
+
const generatedId = (0, react_1.useId)();
|
|
91
|
+
const fieldId = id || generatedId;
|
|
90
92
|
const {
|
|
91
93
|
translate
|
|
92
94
|
} = (0, useLanguage_1.useLanguage)();
|
|
93
95
|
const driveAssistiveClass = (0, useDriveClassName_1.useDriveClassName)("zen-form-field__text");
|
|
94
96
|
const isHasDateError = requireSelection && !dateText;
|
|
95
97
|
const isHasTimeError = requireSelection && !timePickerValue;
|
|
98
|
+
const dateErrorId = `${fieldId}-date-error`;
|
|
99
|
+
const timeErrorId = `${fieldId}-time-error`;
|
|
96
100
|
const memoizedDateInput = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsx)(textInputRaw_1.TextInputRaw, {
|
|
97
101
|
className: (0, classNames_1.classNames)(["zen-date-input-inner__text-input", isActiveField ? "zen-date-input-inner__text-input--active" : ""]),
|
|
98
|
-
id:
|
|
102
|
+
id: fieldId,
|
|
99
103
|
value: dateText,
|
|
100
104
|
onChange: handleSetDateText,
|
|
101
105
|
onBlur: onBlurDateChangeHandler,
|
|
102
106
|
placeholder: placeholder,
|
|
103
107
|
autocomplete: "off",
|
|
104
108
|
isError: isHasDateError,
|
|
109
|
+
ariaDescribedby: isHasDateError ? dateErrorId : undefined,
|
|
105
110
|
ref: ref
|
|
106
|
-
}), [dateText, handleSetDateText,
|
|
111
|
+
}), [dateText, handleSetDateText, fieldId, isActiveField, isHasDateError, onBlurDateChangeHandler, placeholder, ref, dateErrorId]);
|
|
107
112
|
const memoizedTimeSelect = (0, react_1.useMemo)(() => selectTime ? (0, jsx_runtime_1.jsxs)("div", {
|
|
108
113
|
className: "zen-date-input-inner__inputs-block-item",
|
|
109
114
|
children: [(0, jsx_runtime_1.jsx)(timePicker_1.TimePicker, {
|
|
@@ -111,18 +116,16 @@ const DateInputInnerControlBlock = props => {
|
|
|
111
116
|
value: timePickerValue,
|
|
112
117
|
onChange: timeChangeHandler,
|
|
113
118
|
isMobileView: isMobileView,
|
|
114
|
-
fullWidth: true
|
|
115
|
-
// eslint-disable-next-line
|
|
116
|
-
// @ts-ignore
|
|
117
|
-
dataTimeId: id
|
|
119
|
+
fullWidth: true
|
|
118
120
|
}), isHasTimeError ? (0, jsx_runtime_1.jsx)(formFieldError_1.FormFieldError, {
|
|
121
|
+
id: timeErrorId,
|
|
119
122
|
error: translate("The time must be set")
|
|
120
123
|
}) : null]
|
|
121
|
-
}) : null, [isActiveField, isHasTimeError, isMobileView, selectTime, timeChangeHandler, timePickerValue, translate,
|
|
124
|
+
}) : null, [isActiveField, isHasTimeError, isMobileView, selectTime, timeChangeHandler, timePickerValue, translate, timeErrorId]);
|
|
122
125
|
return (0, jsx_runtime_1.jsxs)("div", {
|
|
123
126
|
className: (0, classNames_1.classNames)(["zen-date-input-inner__control-block", className || ""]),
|
|
124
127
|
children: [title ? (0, jsx_runtime_1.jsx)("label", {
|
|
125
|
-
htmlFor:
|
|
128
|
+
htmlFor: fieldId,
|
|
126
129
|
className: "zen-date-input-inner__label",
|
|
127
130
|
children: title
|
|
128
131
|
}) : null, (0, jsx_runtime_1.jsxs)("div", {
|
|
@@ -130,6 +133,7 @@ const DateInputInnerControlBlock = props => {
|
|
|
130
133
|
children: [(0, jsx_runtime_1.jsxs)("div", {
|
|
131
134
|
className: "zen-date-input-inner__inputs-block-item",
|
|
132
135
|
children: [memoizedDateInput, isHasDateError ? (0, jsx_runtime_1.jsx)(formFieldError_1.FormFieldError, {
|
|
136
|
+
id: dateErrorId,
|
|
133
137
|
error: translate("The date must be set")
|
|
134
138
|
}) : null]
|
|
135
139
|
}), memoizedTimeSelect]
|
package/dist/dialog/dialog.js
CHANGED
|
@@ -10,7 +10,7 @@ const classNames_1 = require("../commonHelpers/classNames/classNames");
|
|
|
10
10
|
const useBodyScroll_1 = require("../utils/useBodyScroll");
|
|
11
11
|
const useClientReady_1 = require("../commonHelpers/hooks/useClientReady");
|
|
12
12
|
const zen_1 = require("../utils/zen");
|
|
13
|
-
const
|
|
13
|
+
const usePortal_1 = require("../commonHelpers/hooks/usePortal");
|
|
14
14
|
/**
|
|
15
15
|
* @deprecated - use Modal instead
|
|
16
16
|
*/
|
|
@@ -45,10 +45,11 @@ const Dialog = ({ isOpen, children, isElementVisible }) => {
|
|
|
45
45
|
const labeledId = (0, react_1.useId)();
|
|
46
46
|
const darkClass = dark ? "zen-dark" : "";
|
|
47
47
|
const createDialog = id => ((0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-dialog", darkClass]), "aria-modal": "true", role: "dialog", "aria-labelledby": labeledId, style: { top: `${zen_1.zen.pageYOffset || 0}px` }, children: [(0, jsx_runtime_1.jsx)(dialogContent_1.DialogContent, Object.assign({}, children.props, { labeledId: id, isElementVisible: isElementVisible })), (0, jsx_runtime_1.jsx)("div", { className: "zen-dialog__shield" })] }));
|
|
48
|
+
const modalRoot = ((_b = zen_1.zen.document) === null || _b === void 0 ? void 0 : _b.fullscreenElement) || ((_c = zen_1.zen.document) === null || _c === void 0 ? void 0 : _c.body);
|
|
49
|
+
const portal = (0, usePortal_1.usePortal)(isOpen && (0, react_1.isValidElement)(children) ? createDialog(labeledId) : null, modalRoot, "ModalPortal");
|
|
48
50
|
if (!isClientReady) {
|
|
49
51
|
return null;
|
|
50
52
|
}
|
|
51
|
-
|
|
52
|
-
return (0, react_dom_1.createPortal)(isOpen && (0, react_1.isValidElement)(children) ? createDialog(labeledId) : null, modalRoot);
|
|
53
|
+
return portal;
|
|
53
54
|
};
|
|
54
55
|
exports.Dialog = Dialog;
|
|
@@ -212,28 +212,37 @@ const FileUpload = ({
|
|
|
212
212
|
const pendingFocusIndexRef = (0, react_1.useRef)(null);
|
|
213
213
|
const driveClasses = (0, useDriveClassName_1.useDriveClassName)("zen-file-upload");
|
|
214
214
|
const classes = (0, react_1.useMemo)(() => (0, classNames_1.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]);
|
|
215
|
-
const
|
|
216
|
-
const isUploadDisabled = disabled || hasReachedLimit;
|
|
215
|
+
const isUploadDisabled = disabled;
|
|
217
216
|
const isInteractionDisabled = isUploadDisabled || isUploading;
|
|
218
217
|
const dropZoneClasses = (0, react_1.useMemo)(() => (0, classNames_1.classNames)(["zen-file-upload__drop-zone", `zen-file-upload__drop-zone--${size}`, isMobile ? "zen-file-upload__drop-zone--mobile" : "", isDragOver ? "zen-file-upload__drop-zone--drag-over" : "", isInteractionDisabled ? "zen-file-upload__drop-zone--disabled" : ""]), [size, isMobile, isDragOver, isInteractionDisabled]);
|
|
219
218
|
const handleFilesAdded = (0, react_1.useCallback)(fileList => {
|
|
220
219
|
if (!onChange) {
|
|
221
220
|
return;
|
|
222
221
|
}
|
|
223
|
-
|
|
224
|
-
|
|
222
|
+
let newFiles = createUploadedFiles(fileList);
|
|
223
|
+
let addedFiles = fileList;
|
|
224
|
+
// when allowMultiple is false, only take first file
|
|
225
|
+
if (!allowMultiple && newFiles.length > 1) {
|
|
226
|
+
newFiles = [newFiles[0]];
|
|
227
|
+
const firstFile = fileList[0];
|
|
228
|
+
const singleFileArray = [firstFile];
|
|
229
|
+
addedFiles = Object.assign(singleFileArray, {
|
|
230
|
+
item: index => singleFileArray[index] || null
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
const merged = allowMultiple ? [...value, ...newFiles] : newFiles;
|
|
225
234
|
onChange(merged, {
|
|
226
235
|
action: "add",
|
|
227
|
-
addedFiles
|
|
236
|
+
addedFiles
|
|
228
237
|
});
|
|
229
|
-
}, [onChange, value]);
|
|
238
|
+
}, [onChange, value, allowMultiple]);
|
|
230
239
|
const handleDragOver = (0, react_1.useCallback)(e => {
|
|
231
240
|
e.preventDefault();
|
|
232
241
|
e.stopPropagation();
|
|
233
|
-
if (!disabled && !isUploading
|
|
242
|
+
if (!disabled && !isUploading) {
|
|
234
243
|
setIsDragOver(true);
|
|
235
244
|
}
|
|
236
|
-
}, [disabled, isUploading
|
|
245
|
+
}, [disabled, isUploading]);
|
|
237
246
|
const handleDragLeave = (0, react_1.useCallback)(e => {
|
|
238
247
|
e.preventDefault();
|
|
239
248
|
e.stopPropagation();
|
|
@@ -243,7 +252,7 @@ const FileUpload = ({
|
|
|
243
252
|
e.preventDefault();
|
|
244
253
|
e.stopPropagation();
|
|
245
254
|
setIsDragOver(false);
|
|
246
|
-
if (!disabled && !isUploading &&
|
|
255
|
+
if (!disabled && !isUploading && onChange && e.dataTransfer.files.length > 0) {
|
|
247
256
|
// DataTransfer.files becomes inaccessible after event, so preserve it
|
|
248
257
|
const filesArray = Array.from(e.dataTransfer.files);
|
|
249
258
|
// Create a simple FileList-like object
|
|
@@ -252,12 +261,12 @@ const FileUpload = ({
|
|
|
252
261
|
});
|
|
253
262
|
handleFilesAdded(fileList);
|
|
254
263
|
}
|
|
255
|
-
}, [disabled, isUploading,
|
|
264
|
+
}, [disabled, isUploading, onChange, handleFilesAdded]);
|
|
256
265
|
const handleBrowseClick = (0, react_1.useCallback)(() => {
|
|
257
|
-
if (!disabled && !isUploading &&
|
|
266
|
+
if (!disabled && !isUploading && fileInputRef.current) {
|
|
258
267
|
fileInputRef.current.click();
|
|
259
268
|
}
|
|
260
|
-
}, [disabled, isUploading
|
|
269
|
+
}, [disabled, isUploading]);
|
|
261
270
|
const handleFileInputChange = (0, react_1.useCallback)(e => {
|
|
262
271
|
if (e.target.files && e.target.files.length > 0 && onChange) {
|
|
263
272
|
handleFilesAdded(e.target.files);
|