@geotab/zenith 3.8.0-beta.1 → 3.9.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 +11 -12
- package/dist/button/button.d.ts +2 -1
- package/dist/button/button.js +3 -3
- package/dist/calendar/calendar.js +201 -4
- package/dist/card/card.d.ts +1 -1
- package/dist/card/card.js +1 -1
- package/dist/card/components/cardButton/cardButton.d.ts +2 -1
- package/dist/card/components/cardButton/cardButton.js +5 -3
- package/dist/card/helpers/getIconTypeFromStatus.d.ts +1 -1
- package/dist/chart/barChart/getBarLegendItems.js +3 -5
- package/dist/chart/lineChart/getLineLegendItems.js +7 -7
- package/dist/chart/pieChart/centerTextPlugin.js +13 -5
- package/dist/chart/pieChart/getPieLegendItems.js +8 -12
- package/dist/chart/pieChart.js +13 -11
- package/dist/chart/plugins/legend/interfaces.d.ts +1 -1
- package/dist/commonHelpers/generateId.d.ts +8 -0
- package/dist/commonHelpers/generateId.js +8 -0
- package/dist/commonHelpers/hooks/ssrProvider.d.ts +14 -0
- package/dist/commonHelpers/hooks/ssrProvider.js +12 -0
- package/dist/commonHelpers/hooks/useClientReady.js +3 -1
- package/dist/commonHelpers/hooks/useDeviceType.js +6 -2
- package/dist/commonHelpers/hooks/useIsomorphicLayoutEffect.d.ts +2 -0
- package/dist/commonHelpers/hooks/useIsomorphicLayoutEffect.js +6 -0
- package/dist/commonHelpers/hooks/useMobile.js +4 -3
- package/dist/commonHelpers/hooks/usePortal.js +2 -5
- package/dist/commonHelpers/isDomEnv.js +1 -2
- package/dist/commonHelpers/useUniqueId.d.ts +6 -0
- package/dist/commonHelpers/useUniqueId.js +8 -2
- package/dist/commonHelpers/utils.d.ts +0 -1
- package/dist/commonHelpers/utils.js +1 -3
- package/dist/commonStyles/common.less +13 -1
- package/dist/commonStyles/fonts/notosarabic/LICENSE.txt +93 -0
- package/dist/commonStyles/fonts/notosarabic/NotoSansArabic-Bold.woff +0 -0
- package/dist/commonStyles/fonts/notosarabic/NotoSansArabic-Bold.woff2 +0 -0
- package/dist/commonStyles/fonts/notosarabic/NotoSansArabic-Medium.woff +0 -0
- package/dist/commonStyles/fonts/notosarabic/NotoSansArabic-Medium.woff2 +0 -0
- package/dist/commonStyles/fonts/notosarabic/NotoSansArabic-Regular.woff +0 -0
- package/dist/commonStyles/fonts/notosarabic/NotoSansArabic-Regular.woff2 +0 -0
- package/dist/commonStyles/fonts/notosarabic/NotoSansArabic-SemiBold.woff +0 -0
- package/dist/commonStyles/fonts/notosarabic/NotoSansArabic-SemiBold.woff2 +0 -0
- package/dist/commonStyles/fonts/notosarabic.less +43 -0
- package/dist/commonStyles/pillStyles/pillContent.less +2 -3
- package/dist/commonStyles/pillStyles/pillStyles.less +1 -2
- package/dist/commonStyles/pillStyles/pillTextContent.less +2 -2
- package/dist/commonStyles/typography/typography.less +440 -305
- package/dist/dataGrid/withSelectableRows/components/bulkActions/bulkActions.d.ts +5 -3
- package/dist/dataGrid/withSelectableRows/components/bulkActions/bulkActions.js +2 -38
- package/dist/dateInputInner/dateInputInnerControlBlock.js +12 -8
- package/dist/dateRangeRaw/dateRangeRaw.js +5 -1
- package/dist/dialog/dialog.js +4 -3
- package/dist/feedbackContainer/feedbackContainer.js +4 -4
- package/dist/fileUpload/fileUpload.js +21 -12
- package/dist/filters/components/filtersSidePanel.d.ts +1 -1
- package/dist/filters/components/filtersSidePanel.js +123 -116
- package/dist/filters/filters.js +1 -2
- package/dist/filtersBar/filtersBar.d.ts +2 -0
- package/dist/filtersBar/filtersBar.js +5 -3
- package/dist/filtersBar/filtersBarActions/filtersBarActions.js +3 -1
- package/dist/filtersBar/filtersBarSidePanel/components/filtersBarSidePanelRange/filtersBarSidePanelRange.js +3 -0
- package/dist/filtersBar/filtersBarSidePanel/filtersBarSidePanel.d.ts +1 -1
- package/dist/filtersBar/filtersBarSidePanel/filtersBarSidePanel.js +86 -80
- package/dist/formFieldError/formFieldError.d.ts +2 -1
- package/dist/formFieldError/formFieldError.js +2 -2
- package/dist/header/components/collapsedItemsControl/utils/handleCustomMenuWrapper.js +1 -1
- package/dist/index.css +3210 -2238
- package/dist/index.d.ts +3 -5
- package/dist/index.js +24 -29
- package/dist/menu/components/menuItem.js +4 -4
- package/dist/menu/controlledMenu.js +4 -4
- package/dist/nav/nav.js +10 -5
- package/dist/nav/navAddMenu/navAddMenu.js +1 -2
- 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/nav/navItem/navItem.js +1 -2
- package/dist/pageHeader/pageHeaderActions.js +4 -3
- package/dist/rangeRaw/rangeRaw.js +7 -1
- package/dist/selectList/selectList.js +11 -7
- package/dist/selectRaw/selectRaw.js +1 -1
- package/dist/shield/shield.js +5 -3
- package/dist/sidePanel/sidePanel.js +9 -8
- package/dist/summaryTile/summaryTile.d.ts +1 -3
- package/dist/summaryTile/summaryTile.js +1 -2
- package/dist/table/children/useTableChildren.d.ts +1 -1
- package/dist/table/children/useTableChildren.js +3 -3
- package/dist/table/flexible/useFlexibleColumns.js +39 -1
- package/dist/table/nested/useNestedRows.d.ts +1 -0
- package/dist/table/nested/useNestedRows.js +3 -3
- package/dist/table/selectable/useSelectableRows.d.ts +9 -0
- package/dist/table/selectable/useSelectableRows.js +18 -11
- package/dist/table/table.js +1 -7
- package/dist/{card/components → title}/title.d.ts +1 -1
- package/dist/title/title.js +27 -0
- package/dist/toggleButtonRaw/toggleButtonRaw.js +3 -1
- package/dist/toggleButtonRaw/types.d.ts +1 -0
- package/dist/tooltip/tooltip.d.ts +2 -1
- package/dist/tooltip/tooltip.js +68 -64
- package/dist/utils/localization/directionContext.d.ts +3 -0
- package/dist/utils/localization/directionContext.js +5 -0
- package/dist/utils/localization/getTextDirection.d.ts +2 -0
- package/dist/utils/localization/getTextDirection.js +6 -0
- package/dist/utils/localization/languageProvider.js +15 -1
- package/dist/utils/localization/translations/en-json.d.ts +2 -0
- package/dist/utils/localization/translations/en-json.js +3 -1
- package/dist/utils/localization/translations/en.json +3 -0
- package/dist/utils/localization/useDirection.d.ts +2 -0
- package/dist/utils/localization/useDirection.js +7 -0
- package/esm/button/button.d.ts +2 -1
- package/esm/button/button.js +3 -3
- package/esm/calendar/calendar.js +201 -4
- package/esm/card/card.d.ts +1 -1
- package/esm/card/card.js +1 -1
- package/esm/card/components/cardButton/cardButton.d.ts +2 -1
- package/esm/card/components/cardButton/cardButton.js +5 -3
- package/esm/card/helpers/getIconTypeFromStatus.d.ts +1 -1
- package/esm/chart/barChart/getBarLegendItems.js +3 -5
- package/esm/chart/lineChart/getLineLegendItems.js +7 -7
- package/esm/chart/pieChart/centerTextPlugin.js +13 -5
- package/esm/chart/pieChart/getPieLegendItems.js +8 -12
- package/esm/chart/pieChart.js +14 -12
- package/esm/chart/plugins/legend/interfaces.d.ts +1 -1
- package/esm/commonHelpers/generateId.d.ts +8 -0
- package/esm/commonHelpers/generateId.js +8 -0
- package/esm/commonHelpers/hooks/ssrProvider.d.ts +14 -0
- package/esm/commonHelpers/hooks/ssrProvider.js +6 -0
- package/esm/commonHelpers/hooks/useClientReady.js +4 -2
- package/esm/commonHelpers/hooks/useDeviceType.js +7 -3
- package/esm/commonHelpers/hooks/useIsomorphicLayoutEffect.d.ts +2 -0
- package/esm/commonHelpers/hooks/useIsomorphicLayoutEffect.js +3 -0
- package/esm/commonHelpers/hooks/useMobile.js +4 -3
- package/esm/commonHelpers/hooks/usePortal.js +2 -5
- package/esm/commonHelpers/isDomEnv.js +1 -2
- package/esm/commonHelpers/useUniqueId.d.ts +6 -0
- package/esm/commonHelpers/useUniqueId.js +7 -1
- package/esm/commonHelpers/utils.d.ts +0 -1
- package/esm/commonHelpers/utils.js +0 -1
- package/esm/dataGrid/withSelectableRows/components/bulkActions/bulkActions.d.ts +5 -3
- package/esm/dataGrid/withSelectableRows/components/bulkActions/bulkActions.js +2 -38
- package/esm/dateInputInner/dateInputInnerControlBlock.js +13 -9
- package/esm/dateRangeRaw/dateRangeRaw.js +5 -1
- package/esm/dialog/dialog.js +4 -3
- package/esm/feedbackContainer/feedbackContainer.js +4 -4
- package/esm/fileUpload/fileUpload.js +21 -12
- package/esm/filters/components/filtersSidePanel.d.ts +1 -1
- package/esm/filters/components/filtersSidePanel.js +123 -116
- package/esm/filters/filters.js +2 -3
- package/esm/filtersBar/filtersBar.d.ts +2 -0
- package/esm/filtersBar/filtersBar.js +5 -3
- package/esm/filtersBar/filtersBarActions/filtersBarActions.js +3 -1
- package/esm/filtersBar/filtersBarSidePanel/components/filtersBarSidePanelRange/filtersBarSidePanelRange.js +3 -0
- package/esm/filtersBar/filtersBarSidePanel/filtersBarSidePanel.d.ts +1 -1
- package/esm/filtersBar/filtersBarSidePanel/filtersBarSidePanel.js +86 -80
- package/esm/formFieldError/formFieldError.d.ts +2 -1
- package/esm/formFieldError/formFieldError.js +2 -2
- package/esm/header/components/collapsedItemsControl/utils/handleCustomMenuWrapper.js +1 -1
- package/esm/index.d.ts +3 -5
- package/esm/index.js +3 -5
- package/esm/menu/components/menuItem.js +1 -1
- package/esm/menu/controlledMenu.js +1 -1
- package/esm/nav/nav.js +10 -5
- package/esm/nav/navAddMenu/navAddMenu.js +2 -3
- 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/nav/navItem/navItem.js +2 -3
- package/esm/pageHeader/pageHeaderActions.js +4 -3
- package/esm/rangeRaw/rangeRaw.js +7 -1
- package/esm/selectList/selectList.js +11 -7
- package/esm/selectRaw/selectRaw.js +1 -1
- package/esm/shield/shield.js +5 -3
- package/esm/sidePanel/sidePanel.js +9 -8
- package/esm/summaryTile/summaryTile.d.ts +1 -3
- package/esm/summaryTile/summaryTile.js +1 -2
- package/esm/table/children/useTableChildren.d.ts +1 -1
- package/esm/table/children/useTableChildren.js +3 -3
- package/esm/table/flexible/useFlexibleColumns.js +39 -1
- package/esm/table/nested/useNestedRows.d.ts +1 -0
- package/esm/table/nested/useNestedRows.js +1 -1
- package/esm/table/selectable/useSelectableRows.d.ts +9 -0
- package/esm/table/selectable/useSelectableRows.js +15 -8
- package/esm/table/table.js +1 -7
- package/esm/{card/components → title}/title.d.ts +1 -1
- package/esm/title/title.js +23 -0
- package/esm/toggleButtonRaw/toggleButtonRaw.js +3 -1
- package/esm/toggleButtonRaw/types.d.ts +1 -0
- package/esm/tooltip/tooltip.d.ts +2 -1
- package/esm/tooltip/tooltip.js +68 -64
- package/esm/utils/localization/directionContext.d.ts +3 -0
- package/esm/utils/localization/directionContext.js +2 -0
- package/esm/utils/localization/getTextDirection.d.ts +2 -0
- package/esm/utils/localization/getTextDirection.js +2 -0
- package/esm/utils/localization/languageProvider.js +15 -1
- package/esm/utils/localization/translations/en-json.d.ts +2 -0
- package/esm/utils/localization/translations/en-json.js +3 -1
- package/esm/utils/localization/translations/en.json +3 -0
- package/esm/utils/localization/useDirection.d.ts +2 -0
- package/esm/utils/localization/useDirection.js +3 -0
- package/package.json +33 -31
- package/dist/card/components/title.js +0 -22
- package/dist/commonHelpers/hooks/deviceProvider.d.ts +0 -7
- package/dist/commonHelpers/hooks/deviceProvider.js +0 -11
- package/esm/card/components/title.js +0 -18
- package/esm/commonHelpers/hooks/deviceProvider.d.ts +0 -7
- package/esm/commonHelpers/hooks/deviceProvider.js +0 -4
package/README.md
CHANGED
|
@@ -56,20 +56,19 @@ Zenith library provides components defined in Zenith Design System. It includes
|
|
|
56
56
|
|
|
57
57
|
### 3.8.0
|
|
58
58
|
|
|
59
|
-
- Create
|
|
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
|
|
73
72
|
|
|
74
73
|
### 3.7.0
|
|
75
74
|
|
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");
|
|
@@ -645,7 +834,7 @@ const buttonType_1 = require("../button/buttonType");
|
|
|
645
834
|
const zen_1 = require("../utils/zen");
|
|
646
835
|
const DEFAULT_START_DAY_OF_WEEK = 0;
|
|
647
836
|
const DEFAULT_YEAR_RANGE = 20;
|
|
648
|
-
exports.monthLabelsArray = ["Jan", "Feb", "Mar", "Apr", "
|
|
837
|
+
exports.monthLabelsArray = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
649
838
|
const Calendar = ({
|
|
650
839
|
id,
|
|
651
840
|
value,
|
|
@@ -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"];
|
package/dist/card/card.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { FC, FunctionComponent, ReactNode } from "react";
|
|
2
2
|
import { IAbsoluteSize, TContainerSize } from "../cardContainer/cardContainer";
|
|
3
3
|
import { TCardStatus } from "./components/status";
|
|
4
|
-
import { TIconType } from "
|
|
4
|
+
import { TIconType } from "../title/title";
|
|
5
5
|
import { IActions } from "./components/actions";
|
|
6
6
|
import { IContent } from "./components/content";
|
|
7
7
|
import "./card.less";
|
package/dist/card/card.js
CHANGED
|
@@ -71,7 +71,7 @@ const cardContainer_1 = require("../cardContainer/cardContainer");
|
|
|
71
71
|
const deviceType_1 = require("../commonHelpers/hooks/deviceType");
|
|
72
72
|
const useDeviceType_1 = require("../commonHelpers/hooks/useDeviceType");
|
|
73
73
|
const status_1 = require("./components/status");
|
|
74
|
-
const title_1 = require("
|
|
74
|
+
const title_1 = require("../title/title");
|
|
75
75
|
const actions_1 = require("./components/actions");
|
|
76
76
|
const content_1 = require("./components/content");
|
|
77
77
|
const useCardSize_1 = require("./hooks/useCardSize");
|
|
@@ -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
|
};
|
|
@@ -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);
|
|
@@ -6,6 +6,7 @@ const getCssVar = (el, name) => { var _a, _b; return (_b = (_a = zen_1.zen.getCo
|
|
|
6
6
|
const centerTextPlugin = (centerText) => ({
|
|
7
7
|
id: "zenithPieCenterText",
|
|
8
8
|
afterDraw(chart) {
|
|
9
|
+
var _a;
|
|
9
10
|
if (!centerText || centerText.value === undefined) {
|
|
10
11
|
return;
|
|
11
12
|
}
|
|
@@ -14,18 +15,25 @@ const centerTextPlugin = (centerText) => ({
|
|
|
14
15
|
const centerX = left + width / 2;
|
|
15
16
|
const centerY = top + height / 2;
|
|
16
17
|
const css = (name) => getCssVar(chart.canvas, name);
|
|
17
|
-
const fontFamily =
|
|
18
|
+
const fontFamily = ((_a = zen_1.zen.getComputedStyle) === null || _a === void 0 ? void 0 : _a.call(zen_1.zen, chart.canvas).fontFamily) || "Roboto";
|
|
18
19
|
const hasLabel = !!centerText.label;
|
|
19
|
-
const
|
|
20
|
+
const meta = chart.getDatasetMeta(0);
|
|
21
|
+
const controllerRadius = meta.controller.innerRadius;
|
|
22
|
+
const innerRadius = typeof controllerRadius === "number" && controllerRadius > 0 ? controllerRadius : Math.min(width, height) * 0.325;
|
|
23
|
+
const maxValueFont = parseFloat(css("--pie-center-value-font-size")) || 28;
|
|
24
|
+
const maxLabelFont = parseFloat(css("--pie-center-label-font-size")) || 14;
|
|
25
|
+
const valueFontSize = Math.max(10, Math.min(maxValueFont, innerRadius * 0.45));
|
|
26
|
+
const labelFontSize = Math.max(8, Math.min(maxLabelFont, innerRadius * 0.22));
|
|
27
|
+
const valueY = hasLabel ? centerY - valueFontSize * 0.5 : centerY;
|
|
20
28
|
ctx.textAlign = "center";
|
|
21
29
|
ctx.textBaseline = "middle";
|
|
22
|
-
ctx.font = `${css("--pie-center-value-font-weight")} ${
|
|
30
|
+
ctx.font = `${css("--pie-center-value-font-weight")} ${valueFontSize}px ${fontFamily}`;
|
|
23
31
|
ctx.fillStyle = css("--text-primary");
|
|
24
32
|
ctx.fillText(String(centerText.value), centerX, valueY);
|
|
25
33
|
if (hasLabel) {
|
|
26
|
-
ctx.font = `${css("--pie-center-label-font-weight")} ${
|
|
34
|
+
ctx.font = `${css("--pie-center-label-font-weight")} ${labelFontSize}px ${fontFamily}`;
|
|
27
35
|
ctx.fillStyle = css("--text-secondary");
|
|
28
|
-
ctx.fillText(String(centerText.label), centerX, centerY +
|
|
36
|
+
ctx.fillText(String(centerText.label), centerX, centerY + labelFontSize * 1.1);
|
|
29
37
|
}
|
|
30
38
|
ctx.restore();
|
|
31
39
|
}
|
|
@@ -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 {
|
package/dist/chart/pieChart.js
CHANGED
|
@@ -18,7 +18,6 @@ const typedCharts_1 = require("../react-chartjs/typedCharts");
|
|
|
18
18
|
const auto_1 = require("chart.js/auto");
|
|
19
19
|
require("../react-chartjs/dateAdapter");
|
|
20
20
|
const utils_1 = require("../commonHelpers/utils");
|
|
21
|
-
const zen_1 = require("../utils/zen");
|
|
22
21
|
const useDrive_1 = require("../utils/theme/useDrive");
|
|
23
22
|
const useMobile_1 = require("../commonHelpers/hooks/useMobile");
|
|
24
23
|
const themeContext_1 = require("../utils/theme/themeContext");
|
|
@@ -44,22 +43,25 @@ const PieChart = (_a) => {
|
|
|
44
43
|
const { dark } = (0, react_1.useContext)(themeContext_1.themeContext);
|
|
45
44
|
const legendId = (0, react_1.useId)();
|
|
46
45
|
const tooltipId = (0, react_1.useId)();
|
|
47
|
-
const containerRef = (0, react_1.useRef)(null);
|
|
48
46
|
(0, react_1.useEffect)(() => {
|
|
49
|
-
var _a;
|
|
50
|
-
const el = containerRef.current;
|
|
51
|
-
const styles = el ? (_a = zen_1.zen.getComputedStyle) === null || _a === void 0 ? void 0 : _a.call(zen_1.zen, el) : undefined;
|
|
52
|
-
const fontFamily = (styles === null || styles === void 0 ? void 0 : styles.getPropertyValue("--main-font").trim()) || "Roboto";
|
|
53
|
-
const color = (styles === null || styles === void 0 ? void 0 : styles.getPropertyValue("--text-primary").trim()) || "";
|
|
54
47
|
auto_1.Chart.defaults.font = {
|
|
55
|
-
family:
|
|
48
|
+
family: "Roboto",
|
|
56
49
|
size: fontSize
|
|
57
50
|
};
|
|
58
|
-
auto_1.Chart.defaults.color =
|
|
51
|
+
auto_1.Chart.defaults.color = dark ? "#FFFFFF" : "#1F2833";
|
|
59
52
|
}, [fontSize, dark]);
|
|
60
53
|
const defOptions = (0, react_1.useMemo)(() => (0, getDefaultOptions_1.getDefaultOptions)(), []);
|
|
61
54
|
const chartOptions = (0, utils_1.deepMerge)(defOptions, options);
|
|
62
|
-
const { isHidden, toggleHidden } = (0, useHidden_1.useHidden)();
|
|
55
|
+
const { isHidden, toggleHidden: rawToggle } = (0, useHidden_1.useHidden)();
|
|
56
|
+
const pieData = data.datasets[0].data;
|
|
57
|
+
const toggleHidden = (0, react_1.useCallback)((index) => {
|
|
58
|
+
if (!isHidden(index)) {
|
|
59
|
+
const visibleCount = pieData.filter((_, i) => !isHidden(i)).length;
|
|
60
|
+
if (visibleCount <= 1)
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
rawToggle(index);
|
|
64
|
+
}, [isHidden, rawToggle, pieData]);
|
|
63
65
|
const chartData = (0, react_1.useMemo)(() => {
|
|
64
66
|
const chData = Object.assign({}, data);
|
|
65
67
|
chData.datasets = chData.datasets.map(ds => (0, getDefaultDatasetStyle_1.getDefaultDatasetStyle)(ds));
|
|
@@ -89,6 +91,6 @@ const PieChart = (_a) => {
|
|
|
89
91
|
const chartPlugins = (0, react_1.useMemo)(() => [...(plugins || []), chartLegend, chartTooltip, chartCenterText], [chartLegend, chartTooltip, chartCenterText, plugins]);
|
|
90
92
|
const intSummary = (0, useSummary_1.useSummary)(summary, chartData);
|
|
91
93
|
const legendRight = isHorizontal;
|
|
92
|
-
return ((0, jsx_runtime_1.jsxs)("div", {
|
|
94
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-chart", legendRight ? "zen-chart--legend-right" : "", className || ""]), children: [insight ? (0, jsx_runtime_1.jsx)(chartInsight_1.ChartInsight, Object.assign({}, insight)) : null, summary ? (0, jsx_runtime_1.jsx)(summary_1.Summary, Object.assign({}, intSummary)) : null, (0, jsx_runtime_1.jsx)("div", { className: "zen-chart__chart", children: (0, jsx_runtime_1.jsx)(typedCharts_1.Pie, Object.assign({ options: chartOptions, data: chartData, plugins: chartPlugins }, rest, { "aria-hidden": true })) }), (0, jsx_runtime_1.jsx)("div", { className: "zen-chart__legend", id: legendId }), (0, jsx_runtime_1.jsx)(accessibleChart_1.AccessibleChart, { type: "pie", data: chartData })] }));
|
|
93
95
|
};
|
|
94
96
|
exports.PieChart = PieChart;
|
|
@@ -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
|
}
|
|
@@ -1 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a random unique ID string.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* **Prefer `React.useId()`** inside React components. `useId` produces IDs that are
|
|
6
|
+
* stable across server and client renders, preventing SSR hydration mismatches.
|
|
7
|
+
* Use `generateId` only outside of a React component context where `useId` is not available.
|
|
8
|
+
*/
|
|
1
9
|
export declare function generateId(): string;
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateId = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Generates a random unique ID string.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* **Prefer `React.useId()`** inside React components. `useId` produces IDs that are
|
|
9
|
+
* stable across server and client renders, preventing SSR hydration mismatches.
|
|
10
|
+
* Use `generateId` only outside of a React component context where `useId` is not available.
|
|
11
|
+
*/
|
|
4
12
|
function generateId() {
|
|
5
13
|
return "id" + Math.random().toString().substring(2) + Math.random().toString().substring(2);
|
|
6
14
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PropsWithChildren } from "react";
|
|
2
|
+
import { DeviceType } from "./deviceType";
|
|
3
|
+
interface ISSRContext {
|
|
4
|
+
isClientReady: boolean;
|
|
5
|
+
deviceType?: DeviceType;
|
|
6
|
+
}
|
|
7
|
+
export declare const SSRContext: import("react").Context<ISSRContext | null>;
|
|
8
|
+
export declare const SSRProvider: ({ deviceType, isClientReady, children }: PropsWithChildren<{
|
|
9
|
+
deviceType?: DeviceType;
|
|
10
|
+
isClientReady?: boolean;
|
|
11
|
+
}>) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const useSSRContext: () => ISSRContext | null;
|
|
13
|
+
export declare const useIsSSRProviderMounted: () => boolean;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useIsSSRProviderMounted = exports.useSSRContext = exports.SSRProvider = exports.SSRContext = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
exports.SSRContext = (0, react_1.createContext)(null);
|
|
7
|
+
const SSRProvider = ({ deviceType, isClientReady = false, children }) => ((0, jsx_runtime_1.jsx)(exports.SSRContext.Provider, { value: { isClientReady, deviceType }, children: children }));
|
|
8
|
+
exports.SSRProvider = SSRProvider;
|
|
9
|
+
const useSSRContext = () => (0, react_1.useContext)(exports.SSRContext);
|
|
10
|
+
exports.useSSRContext = useSSRContext;
|
|
11
|
+
const useIsSSRProviderMounted = () => (0, react_1.useContext)(exports.SSRContext) !== null;
|
|
12
|
+
exports.useIsSSRProviderMounted = useIsSSRProviderMounted;
|