@geotab/zenith 3.10.0-beta.0 → 3.10.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -1
- package/dist/absolute/absolute.d.ts +7 -1
- package/dist/absolute/absolute.js +8 -4
- package/dist/betaPill/betaPill.d.ts +18 -2
- package/dist/betaPill/betaPill.js +11 -8
- package/dist/card/card.d.ts +2 -1
- package/dist/card/card.js +4 -2
- package/dist/card/components/title.d.ts +3 -1
- package/dist/card/components/title.js +5 -3
- package/dist/checkbox/checkbox.js +2 -2
- package/dist/checkboxListWithAction/checkboxListWithAction.js +2 -1
- package/dist/commonStyles/colors/colorsConstant.d.ts +44 -0
- package/dist/commonStyles/colors/colorsConstant.js +361 -0
- package/dist/commonStyles/typography/components/typographyItem.d.ts +8 -0
- package/dist/commonStyles/typography/components/typographyItem.js +45 -0
- package/dist/controlledPopup/controlledPopup.d.ts +2 -1
- package/dist/controlledPopup/controlledPopup.js +2 -2
- package/dist/dropdown/dropdown.js +1 -1
- package/dist/dropdownRaw/dropdownList.d.ts +4 -2
- package/dist/dropdownRaw/dropdownList.js +15 -36
- package/dist/dropdownRaw/dropdownRaw.js +9 -23
- package/dist/dropdownRaw/stateReducer/stateReducer.d.ts +1 -0
- package/dist/dropdownRaw/stateReducer/stateReducer.js +13 -14
- package/dist/dropdownRaw/stateReducer/stateReducerHelper.d.ts +1 -2
- package/dist/dropdownRaw/stateReducer/stateReducerHelper.js +5 -12
- package/dist/headerTitle/headerTitle.d.ts +9 -1
- package/dist/headerTitle/headerTitle.js +3 -2
- package/dist/index.css +52 -14
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/menu/controlledMenu.d.ts +1 -0
- package/dist/menu/controlledMenu.js +2 -2
- package/dist/testHelpers/fakeFetch.d.ts +1 -0
- package/dist/testHelpers/fakeFetch.js +14 -0
- package/dist/testHelpers/geotab-axe/index.d.ts +2 -0
- package/dist/testHelpers/geotab-axe/index.js +81 -0
- package/dist/testHelpers/jestRetry.d.ts +0 -0
- package/dist/testHelpers/jestRetry.js +2 -0
- package/dist/testHelpers/renderAsync.d.ts +2 -0
- package/dist/testHelpers/renderAsync.js +12 -0
- package/dist/testHelpers/setReadonlyHtmlProperty.d.ts +1 -0
- package/dist/testHelpers/setReadonlyHtmlProperty.js +15 -0
- package/dist/testHelpers/styled-output.d.ts +30 -0
- package/dist/testHelpers/styled-output.js +42 -0
- package/esm/absolute/absolute.d.ts +7 -1
- package/esm/absolute/absolute.js +8 -4
- package/esm/betaPill/betaPill.d.ts +18 -2
- package/esm/betaPill/betaPill.js +11 -8
- package/esm/card/card.d.ts +2 -1
- package/esm/card/card.js +4 -2
- package/esm/card/components/title.d.ts +3 -1
- package/esm/card/components/title.js +5 -3
- package/esm/checkbox/checkbox.js +2 -2
- package/esm/checkboxListWithAction/checkboxListWithAction.js +2 -1
- package/esm/controlledPopup/controlledPopup.d.ts +2 -1
- package/esm/controlledPopup/controlledPopup.js +2 -2
- package/esm/dropdown/dropdown.js +1 -1
- package/esm/dropdownRaw/dropdownList.d.ts +4 -2
- package/esm/dropdownRaw/dropdownList.js +15 -36
- package/esm/dropdownRaw/dropdownRaw.js +10 -24
- package/esm/dropdownRaw/stateReducer/stateReducer.d.ts +1 -0
- package/esm/dropdownRaw/stateReducer/stateReducer.js +14 -15
- package/esm/dropdownRaw/stateReducer/stateReducerHelper.d.ts +1 -2
- package/esm/dropdownRaw/stateReducer/stateReducerHelper.js +3 -10
- package/esm/headerTitle/headerTitle.d.ts +9 -1
- package/esm/headerTitle/headerTitle.js +3 -2
- package/esm/index.d.ts +3 -1
- package/esm/index.js +1 -0
- package/esm/menu/controlledMenu.d.ts +1 -0
- package/esm/menu/controlledMenu.js +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export { type ICardButton, CardButton } from "./card/components/cardButton/cardB
|
|
|
20
20
|
export { type ICardToggle, CardToggle } from "./card/components/cardToggle/cardToggle";
|
|
21
21
|
export { type IContent, Content } from "./card/components/content";
|
|
22
22
|
export { type TCardStatus, Status } from "./card/components/status";
|
|
23
|
-
export { Title } from "./card/components/title";
|
|
23
|
+
export { type THeadingTag, Title } from "./card/components/title";
|
|
24
24
|
export { TitleLink } from "./card/components/titleLink";
|
|
25
25
|
export { getDefaultFullWidthValue } from "./card/helpers/getDefaultFullWidthValue";
|
|
26
26
|
export { getIconFromStatus } from "./card/helpers/getIconFromStatus";
|
|
@@ -774,6 +774,8 @@ export { HeaderButtonsProvider } from "./utils/headerButtons/headerButtonsProvid
|
|
|
774
774
|
export { getNewFocusableItem, getFirstFocusableItem } from "./utils/keyboardHelpers";
|
|
775
775
|
export { LanguageProvider } from "./utils/localization/languageProvider";
|
|
776
776
|
export { dictionaries, injectString } from "./utils/localization/translationsDictionary";
|
|
777
|
+
export { directionContext } from "./utils/localization/directionContext";
|
|
778
|
+
export type { TTextDirection } from "./utils/localization/getTextDirection";
|
|
777
779
|
export { useDirection } from "./utils/localization/useDirection";
|
|
778
780
|
export { useLanguage } from "./utils/localization/useLanguage";
|
|
779
781
|
export { ThemeDark } from "./utils/theme/themeDark";
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@ exports.IconShield3 = exports.IconShield2 = exports.IconShield = exports.IconSha
|
|
|
17
17
|
exports.IconVolumeHalf = exports.IconVolumeFull = exports.IconVolumeDown = exports.IconVoice = exports.IconVisitPage = exports.IconVideoReplay = exports.IconVideo2 = exports.IconVideo = exports.IconUsbHub = exports.IconUsb = exports.IconUpload = exports.IconUnlocked = exports.IconUndock = exports.IconUndo2 = exports.IconUndo = exports.IconUnderline = exports.IconUmbrella = exports.IconTrailer = exports.IconThumbsUp = exports.IconThumbsDown = exports.IconThermometer = exports.IconThermograph = exports.IconTextSize = exports.IconTelevision2 = exports.IconTelevision = exports.IconTarget3 = exports.IconTarget2 = exports.IconTarget = exports.IconTachographTimeCard = exports.IconTachograph = exports.IconTable = exports.IconSupport = exports.IconSun = exports.IconStrikeThrough = exports.IconStore = exports.IconStorage = exports.IconStopwatch = exports.IconStarFilled = exports.IconStarAi = exports.IconStar = exports.IconSquare = exports.IconSpeaker = exports.IconSortVertical = exports.IconSortHorizontal = exports.IconSort2Vertical = exports.IconSort2Horizontal = exports.IconSmiley = exports.IconSign = exports.IconSidebar = exports.IconShield4 = void 0;
|
|
18
18
|
exports.isButton = exports.findPrevFocusable = exports.findNextFocusable = exports.findLastFocusable = exports.findFirstFocusable = exports.Menu = exports.ControlledMenu = exports.isDragNotClick = exports.changeOrder = exports.ListItem = exports.List = exports.ItemData = exports.ItemCompact = exports.LineChartMini = exports.getDefaultDatasetStyle = exports.htmlLegendPlugin = exports.LEGEND_PLUGIN_ID = exports.LineChart = exports.useLayoutSize = exports.LayoutFullScreenProvider = exports.useLayoutFullScreen = exports.LayoutFullScreenElementProvider = exports.useLayoutFullScreenElement = exports.Layout = exports.ImageTapToUpload = exports.ImageNothingFound = exports.ImageNoMatchingAssets = exports.ImageLooking = exports.ImageCloudUpload = exports.ImageAdjustFilter = exports.IconZoom2 = exports.IconZoom = exports.IconZone = exports.IconYen = exports.IconWrite = exports.IconWrench = exports.IconWorld = exports.IconWorkday = exports.IconWifi2 = exports.IconWifi = exports.IconWhisper = exports.IconWebcam = exports.IconWatch2 = exports.IconWatch = exports.IconWarning = exports.IconWallet1 = exports.IconWallet = exports.IconVolumeOn = exports.IconVolumeOff = exports.IconVolumeMinimum = void 0;
|
|
19
19
|
exports.SummaryTileBarDisplayName = exports.SummaryTileBar = exports.getTypeClassName = exports.SummaryTileTrigger = exports.SummaryTile = exports.SummaryTileDisplayName = exports.SummaryTileSize = exports.SummaryTileType = exports.Summary = exports.Summaries = exports.Stepper = exports.SortControl = exports.SortDirections = exports.Skeleton = exports.LazyContent = exports.SidePanel = exports.CUSTOM_POPUP_COMPONENT_CLASSNAME = exports.SidePanelCloseReason = exports.isChildPopup = exports.SelectField = exports.Select = exports.SearchInput = exports.Range = exports.RadioGroup = exports.Radio = exports.ProgressBar = exports.ProgreesBarSize = exports.ProgressBarType = exports.PrimaryIcon = exports.Popup = exports.PillExpandable = exports.Pill = exports.PaginationType = exports.Pagination = exports.PageLayout = exports.PageContentLayout = exports.PageHeaderMenu = exports.PageHeaderMenuDisplayName = exports.PageHeaderButton = exports.PageHeaderButtonDisplayName = exports.PageHeader = exports.PageHeaderDisplayName = exports.Notification = exports.getPredefinedFocusableItem = exports.DialogContentNew = exports.Modal = exports.MobileSheet = exports.MiniTabs = exports.MiniTabsSize = exports.isLink = void 0;
|
|
20
|
-
exports.Waiting = exports.UserFormatProvider = exports.useDrive = exports.ThemeProvider = exports.ThemeDrive = exports.ThemeDark = exports.useLanguage = exports.useDirection = exports.injectString = exports.dictionaries = exports.LanguageProvider = exports.getFirstFocusableItem = exports.getNewFocusableItem = exports.HeaderButtonsProvider = exports.AbortablePromise = exports.Tooltip = exports.removeArrowClasses = exports.calculateArrowPosition = exports.ToggleButtonRaw = exports.ToggleButton = exports.Toast = exports.useToast = exports.TimePicker = exports.TextareaRaw = exports.Textarea = exports.TextInputRaw = exports.TextInput = exports.TextIconButton = exports.ButtonIconPosition = exports.Tabs = exports.TabsDisplayName = exports.ActionLinkColumn = exports.CheckboxColumn = exports.MainColumn = exports.ActionsColumn = exports.getSortableValue = exports.ColumnSortDirection = exports.getEmptySelection = exports.Table = exports.useNestedRows = exports.NestedData = exports.TabBarContent = exports.TabBar = void 0;
|
|
20
|
+
exports.Waiting = exports.UserFormatProvider = exports.useDrive = exports.ThemeProvider = exports.ThemeDrive = exports.ThemeDark = exports.useLanguage = exports.useDirection = exports.directionContext = exports.injectString = exports.dictionaries = exports.LanguageProvider = exports.getFirstFocusableItem = exports.getNewFocusableItem = exports.HeaderButtonsProvider = exports.AbortablePromise = exports.Tooltip = exports.removeArrowClasses = exports.calculateArrowPosition = exports.ToggleButtonRaw = exports.ToggleButton = exports.Toast = exports.useToast = exports.TimePicker = exports.TextareaRaw = exports.Textarea = exports.TextInputRaw = exports.TextInput = exports.TextIconButton = exports.ButtonIconPosition = exports.Tabs = exports.TabsDisplayName = exports.ActionLinkColumn = exports.CheckboxColumn = exports.MainColumn = exports.ActionsColumn = exports.getSortableValue = exports.ColumnSortDirection = exports.getEmptySelection = exports.Table = exports.useNestedRows = exports.NestedData = exports.TabBarContent = exports.TabBar = void 0;
|
|
21
21
|
/* eslint-disable max-len */
|
|
22
22
|
var absolute_1 = require("./absolute/absolute");
|
|
23
23
|
Object.defineProperty(exports, "Absolute", { enumerable: true, get: function () { return absolute_1.Absolute; } });
|
|
@@ -1663,6 +1663,8 @@ Object.defineProperty(exports, "LanguageProvider", { enumerable: true, get: func
|
|
|
1663
1663
|
var translationsDictionary_1 = require("./utils/localization/translationsDictionary");
|
|
1664
1664
|
Object.defineProperty(exports, "dictionaries", { enumerable: true, get: function () { return translationsDictionary_1.dictionaries; } });
|
|
1665
1665
|
Object.defineProperty(exports, "injectString", { enumerable: true, get: function () { return translationsDictionary_1.injectString; } });
|
|
1666
|
+
var directionContext_1 = require("./utils/localization/directionContext");
|
|
1667
|
+
Object.defineProperty(exports, "directionContext", { enumerable: true, get: function () { return directionContext_1.directionContext; } });
|
|
1666
1668
|
var useDirection_1 = require("./utils/localization/useDirection");
|
|
1667
1669
|
Object.defineProperty(exports, "useDirection", { enumerable: true, get: function () { return useDirection_1.useDirection; } });
|
|
1668
1670
|
var useLanguage_1 = require("./utils/localization/useLanguage");
|
|
@@ -23,7 +23,7 @@ const generateId_1 = require("../commonHelpers/generateId");
|
|
|
23
23
|
const pathProvider_1 = require("./contexts/pathProvider");
|
|
24
24
|
const menuSeparator_1 = require("./components/menuSeparator");
|
|
25
25
|
const focusableSelector_1 = require("../utils/focusableSelector");
|
|
26
|
-
const ControlledMenu = ({ children, isOpen, setIsOpen, triggerRef, ariaLabel, ariaLabelledby, id, title, className = "", listClassName = "", paddingX = 0, paddingY = 0, alignment }) => {
|
|
26
|
+
const ControlledMenu = ({ children, isOpen, setIsOpen, triggerRef, ariaLabel, ariaLabelledby, id, title, className = "", listClassName = "", paddingX = 0, paddingY = 0, alignment, closeOnScroll = true }) => {
|
|
27
27
|
const [deviceType, setDeviceType] = (0, react_1.useState)(deviceType_1.DeviceType.Desktop);
|
|
28
28
|
const isMobile = deviceType === deviceType_1.DeviceType.Mobile;
|
|
29
29
|
const memoizedOnChange = (0, react_1.useCallback)(setIsOpen, [setIsOpen]);
|
|
@@ -218,7 +218,7 @@ const ControlledMenu = ({ children, isOpen, setIsOpen, triggerRef, ariaLabel, ar
|
|
|
218
218
|
if (isMobile) {
|
|
219
219
|
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(pathProvider_1.PathProvider, { path: path, onOpenBranch: onOpenBranch, closeBranch: closeBranch, navigatedViaKeyboardRef: navigatedViaKeyboardRef, keyboardActiveRef: keyboardActiveRef, children: (0, jsx_runtime_1.jsxs)(mobileSheet_1.MobileSheet, { label: title, isOpen: isOpen, triggerRef: triggerRef, onHidePanel: hideMenu, onCloseClick: hideMenu, children: [(0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Title, { children: title }), (0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Content, { children: renderMenuList() })] }) }) }));
|
|
220
220
|
}
|
|
221
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(pathProvider_1.PathProvider, { path: path, onOpenBranch: onOpenBranch, closeBranch: closeBranch, navigatedViaKeyboardRef: navigatedViaKeyboardRef, keyboardActiveRef: keyboardActiveRef, children: (0, jsx_runtime_1.jsx)(controlledPopup_1.ControlledPopup, { id: id, useTrapFocusWithTrigger: "on", className: (0, classNames_1.classNames)(["zen-controlled-menu", className]), onOpenChange: memoizedOnChange, isOpen: isOpen, triggerRef: triggerRef, paddingX: paddingX, paddingY: paddingY, alignment: alignment, ariaLabelledby: ariaLabelledby, ariaLabel: ariaLabel || title,
|
|
221
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(pathProvider_1.PathProvider, { path: path, onOpenBranch: onOpenBranch, closeBranch: closeBranch, navigatedViaKeyboardRef: navigatedViaKeyboardRef, keyboardActiveRef: keyboardActiveRef, children: (0, jsx_runtime_1.jsx)(controlledPopup_1.ControlledPopup, { id: id, useTrapFocusWithTrigger: "on", className: (0, classNames_1.classNames)(["zen-controlled-menu", className]), onOpenChange: memoizedOnChange, isOpen: isOpen, triggerRef: triggerRef, paddingX: paddingX, paddingY: paddingY, alignment: alignment, ariaLabelledby: ariaLabelledby, ariaLabel: ariaLabel || title, closeOnScroll: closeOnScroll,
|
|
222
222
|
// focusOnOpen is false - ControlledMenu handles focus based on input method
|
|
223
223
|
// (keyboard vs mouse) in its own useEffect
|
|
224
224
|
focusOnOpen: false, children: renderMenuList() }) }) }));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const fetchData: () => Promise<string>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchData = void 0;
|
|
4
|
+
const zen_1 = require("../utils/zen");
|
|
5
|
+
let loadTimeout = null;
|
|
6
|
+
const fetchData = () => {
|
|
7
|
+
var _a;
|
|
8
|
+
loadTimeout && ((_a = zen_1.zen.clearTimeout) === null || _a === void 0 ? void 0 : _a.call(zen_1.zen, loadTimeout));
|
|
9
|
+
return new Promise((res, rej) => {
|
|
10
|
+
var _a;
|
|
11
|
+
loadTimeout = (_a = zen_1.zen.setTimeout) === null || _a === void 0 ? void 0 : _a.call(zen_1.zen, () => Math.random() > 0.5 ? res("Fetched Data") : rej(new Error("Error while fetching data")), 5000);
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
exports.fetchData = fetchData;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/// <reference path="./index.d.ts" />
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const axe_core_1 = __importDefault(require("axe-core"));
|
|
8
|
+
const styled_output_1 = require("../styled-output");
|
|
9
|
+
const domParser = new DOMParser();
|
|
10
|
+
const lineBreak = "\n\n";
|
|
11
|
+
const horizontalLine = "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500";
|
|
12
|
+
const runAxe = (el) => new Promise(resolve => {
|
|
13
|
+
const parent = el.parentNode;
|
|
14
|
+
const sibling = el.nextSibling;
|
|
15
|
+
document === null || document === void 0 ? void 0 : document.body.appendChild(el);
|
|
16
|
+
axe_core_1.default.configure({
|
|
17
|
+
rules: [{
|
|
18
|
+
id: "target-size",
|
|
19
|
+
enabled: true
|
|
20
|
+
}],
|
|
21
|
+
checks: [
|
|
22
|
+
{
|
|
23
|
+
// color contrast checking doesnt work in a jsdom environment.
|
|
24
|
+
id: "color-contrast",
|
|
25
|
+
enabled: false
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
});
|
|
29
|
+
axe_core_1.default.run(el, {}, (err, results) => {
|
|
30
|
+
if (err) {
|
|
31
|
+
throw err;
|
|
32
|
+
}
|
|
33
|
+
resolve(results);
|
|
34
|
+
parent ? parent.insertBefore(el, sibling) : document === null || document === void 0 ? void 0 : document.body.removeChild(el);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
const toHtml = (str) => {
|
|
38
|
+
if (str.indexOf("<html") > -1) {
|
|
39
|
+
return domParser.parseFromString(str, "text/html").body;
|
|
40
|
+
}
|
|
41
|
+
const html = document === null || document === void 0 ? void 0 : document.createElement("template");
|
|
42
|
+
html.insertAdjacentHTML("afterbegin", str);
|
|
43
|
+
return html;
|
|
44
|
+
};
|
|
45
|
+
const formatViolations = (violations) => {
|
|
46
|
+
if (violations.length === 0) {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
return violations.map(violation => {
|
|
50
|
+
const errorText = violation.nodes.map(node => {
|
|
51
|
+
const selector = node.target.join(", ");
|
|
52
|
+
const expectedText = `Availability violation for selector $('${selector}'):` + lineBreak;
|
|
53
|
+
return (expectedText +
|
|
54
|
+
(0, styled_output_1.stylize)(node.html, styled_output_1.Color.Gray) +
|
|
55
|
+
lineBreak +
|
|
56
|
+
(0, styled_output_1.stylize)(`---Explanation---`, styled_output_1.Color.Black, styled_output_1.BackgroundColor.White, styled_output_1.Style.Bold, styled_output_1.Style.Underline) +
|
|
57
|
+
lineBreak +
|
|
58
|
+
`${violation.help} (${violation.id})` +
|
|
59
|
+
lineBreak +
|
|
60
|
+
(0, styled_output_1.stylize)(node.failureSummary || "", styled_output_1.Color.Yellow) +
|
|
61
|
+
lineBreak + (violation.helpUrl
|
|
62
|
+
? `You can find more about it here: \n${(0, styled_output_1.stylize)(violation.helpUrl, styled_output_1.Color.Blue)}`
|
|
63
|
+
: ""));
|
|
64
|
+
}).join(lineBreak);
|
|
65
|
+
return (errorText);
|
|
66
|
+
}).join(lineBreak + horizontalLine + lineBreak);
|
|
67
|
+
};
|
|
68
|
+
const toBeAccessible = async (element, errorMsg) => {
|
|
69
|
+
if (!element) {
|
|
70
|
+
return { pass: true, message: () => "ok" };
|
|
71
|
+
}
|
|
72
|
+
const html = element instanceof Node ? element : toHtml(element);
|
|
73
|
+
const results = await runAxe(html);
|
|
74
|
+
if (results.violations.length) {
|
|
75
|
+
const formatedViolations = formatViolations(results.violations);
|
|
76
|
+
const message = () => (errorMsg ? errorMsg + lineBreak : "") + formatedViolations;
|
|
77
|
+
return { pass: false, message };
|
|
78
|
+
}
|
|
79
|
+
return { pass: true, message: () => "ok" };
|
|
80
|
+
};
|
|
81
|
+
expect.extend({ toBeAccessible });
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderAsync = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const react_2 = require("@testing-library/react");
|
|
6
|
+
const renderAsync = async (component) => (0, react_1.act)(async () => {
|
|
7
|
+
const result = (0, react_2.render)(component);
|
|
8
|
+
await Promise.resolve();
|
|
9
|
+
await Promise.resolve();
|
|
10
|
+
return result;
|
|
11
|
+
});
|
|
12
|
+
exports.renderAsync = renderAsync;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const setReadonlyHtmlProperty: (propName: keyof HTMLElement, values: Map<string, Required<HTMLElement>[keyof HTMLElement]>) => void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setReadonlyHtmlProperty = void 0;
|
|
4
|
+
const setReadonlyHtmlProperty = (propName, values) => {
|
|
5
|
+
jest.spyOn(HTMLElement.prototype, propName, "get").mockImplementation(function () {
|
|
6
|
+
var _a;
|
|
7
|
+
for (const [selector, value] of values) {
|
|
8
|
+
if (((_a = this.parentElement) === null || _a === void 0 ? void 0 : _a.querySelector(selector)) === this) {
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return this[propName];
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
exports.setReadonlyHtmlProperty = setReadonlyHtmlProperty;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare enum Color {
|
|
2
|
+
No = 39,
|
|
3
|
+
Black = 30,
|
|
4
|
+
Red = 31,
|
|
5
|
+
Green = 32,
|
|
6
|
+
Yellow = 33,
|
|
7
|
+
Blue = 34,
|
|
8
|
+
Purple = 35,
|
|
9
|
+
Cyan = 36,
|
|
10
|
+
White = 37,
|
|
11
|
+
Gray = 90
|
|
12
|
+
}
|
|
13
|
+
export declare enum BackgroundColor {
|
|
14
|
+
No = 49,
|
|
15
|
+
Black = 40,
|
|
16
|
+
Red = 41,
|
|
17
|
+
Green = 42,
|
|
18
|
+
Yellow = 43,
|
|
19
|
+
Blue = 44,
|
|
20
|
+
Purple = 45,
|
|
21
|
+
Cyan = 46,
|
|
22
|
+
White = 47,
|
|
23
|
+
Gray = 100
|
|
24
|
+
}
|
|
25
|
+
export declare enum Style {
|
|
26
|
+
No = 0,
|
|
27
|
+
Bold = 1,
|
|
28
|
+
Underline = 4
|
|
29
|
+
}
|
|
30
|
+
export declare function stylize(text: string, ...styles: (Color | BackgroundColor | Style)[]): string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stylize = exports.Style = exports.BackgroundColor = exports.Color = void 0;
|
|
4
|
+
var Color;
|
|
5
|
+
(function (Color) {
|
|
6
|
+
Color[Color["No"] = 39] = "No";
|
|
7
|
+
Color[Color["Black"] = 30] = "Black";
|
|
8
|
+
Color[Color["Red"] = 31] = "Red";
|
|
9
|
+
Color[Color["Green"] = 32] = "Green";
|
|
10
|
+
Color[Color["Yellow"] = 33] = "Yellow";
|
|
11
|
+
Color[Color["Blue"] = 34] = "Blue";
|
|
12
|
+
Color[Color["Purple"] = 35] = "Purple";
|
|
13
|
+
Color[Color["Cyan"] = 36] = "Cyan";
|
|
14
|
+
Color[Color["White"] = 37] = "White";
|
|
15
|
+
Color[Color["Gray"] = 90] = "Gray";
|
|
16
|
+
})(Color || (exports.Color = Color = {}));
|
|
17
|
+
var BackgroundColor;
|
|
18
|
+
(function (BackgroundColor) {
|
|
19
|
+
BackgroundColor[BackgroundColor["No"] = 49] = "No";
|
|
20
|
+
BackgroundColor[BackgroundColor["Black"] = 40] = "Black";
|
|
21
|
+
BackgroundColor[BackgroundColor["Red"] = 41] = "Red";
|
|
22
|
+
BackgroundColor[BackgroundColor["Green"] = 42] = "Green";
|
|
23
|
+
BackgroundColor[BackgroundColor["Yellow"] = 43] = "Yellow";
|
|
24
|
+
BackgroundColor[BackgroundColor["Blue"] = 44] = "Blue";
|
|
25
|
+
BackgroundColor[BackgroundColor["Purple"] = 45] = "Purple";
|
|
26
|
+
BackgroundColor[BackgroundColor["Cyan"] = 46] = "Cyan";
|
|
27
|
+
BackgroundColor[BackgroundColor["White"] = 47] = "White";
|
|
28
|
+
BackgroundColor[BackgroundColor["Gray"] = 100] = "Gray";
|
|
29
|
+
})(BackgroundColor || (exports.BackgroundColor = BackgroundColor = {}));
|
|
30
|
+
var Style;
|
|
31
|
+
(function (Style) {
|
|
32
|
+
Style[Style["No"] = 0] = "No";
|
|
33
|
+
Style[Style["Bold"] = 1] = "Bold";
|
|
34
|
+
Style[Style["Underline"] = 4] = "Underline";
|
|
35
|
+
})(Style || (exports.Style = Style = {}));
|
|
36
|
+
function stylize(text, ...styles) {
|
|
37
|
+
if (!styles.length) {
|
|
38
|
+
return text;
|
|
39
|
+
}
|
|
40
|
+
return styles.reduce((res, style) => `\x1b[${style}m${res}\x1b[0m`, text);
|
|
41
|
+
}
|
|
42
|
+
exports.stylize = stylize;
|
|
@@ -22,8 +22,14 @@ export interface IAbsolute extends IZenComponentProps {
|
|
|
22
22
|
ariaLabelledby?: string;
|
|
23
23
|
alignmentsFn?: IAlignment;
|
|
24
24
|
recalculateOnScroll?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* When true, closes the popup on scroll instead of repositioning it.
|
|
27
|
+
* Mutually exclusive with `recalculateOnScroll` — setting both causes a
|
|
28
|
+
* wasted position recalculation before the popup closes.
|
|
29
|
+
*/
|
|
30
|
+
closeOnScroll?: boolean;
|
|
25
31
|
recalculateTrigger?: boolean;
|
|
26
32
|
/** Whether to focus the first focusable element when popup opens. Default: true */
|
|
27
33
|
focusOnOpen?: boolean;
|
|
28
34
|
}
|
|
29
|
-
export declare const Absolute: ({ isOpen, id, paddingX, paddingY, className, children, triggerRef, alignment, inline, onOpenChange, useTrapFocusWithTrigger, shouldHoldScroll, stateFullChilds, role, ariaLabel, ariaLabelledby, alignmentsFn, recalculateOnScroll, recalculateTrigger, focusOnOpen }: IAbsolute) => import("react/jsx-runtime").JSX.Element | "" | null;
|
|
35
|
+
export declare const Absolute: ({ isOpen, id, paddingX, paddingY, className, children, triggerRef, alignment, inline, onOpenChange, useTrapFocusWithTrigger, shouldHoldScroll, stateFullChilds, role, ariaLabel, ariaLabelledby, alignmentsFn, recalculateOnScroll, closeOnScroll, recalculateTrigger, focusOnOpen }: IAbsolute) => import("react/jsx-runtime").JSX.Element | "" | null;
|
package/esm/absolute/absolute.js
CHANGED
|
@@ -16,7 +16,7 @@ import { useScroll } from "../commonHelpers/hooks/useScroll";
|
|
|
16
16
|
import { getScrollableParent } from "../utils/getScrollableParent";
|
|
17
17
|
import { useClientReady } from "../commonHelpers/hooks/useClientReady";
|
|
18
18
|
import { zen } from "../utils/zen";
|
|
19
|
-
export const Absolute = ({ isOpen, id, paddingX, paddingY, className, children, triggerRef, alignment, inline, onOpenChange, useTrapFocusWithTrigger = "off", shouldHoldScroll, stateFullChilds, role, ariaLabel, ariaLabelledby, alignmentsFn, recalculateOnScroll, recalculateTrigger = true, focusOnOpen = true }) => {
|
|
19
|
+
export const Absolute = ({ isOpen, id, paddingX, paddingY, className, children, triggerRef, alignment, inline, onOpenChange, useTrapFocusWithTrigger = "off", shouldHoldScroll, stateFullChilds, role, ariaLabel, ariaLabelledby, alignmentsFn, recalculateOnScroll, closeOnScroll, recalculateTrigger = true, focusOnOpen = true }) => {
|
|
20
20
|
const popupRef = useRef(null);
|
|
21
21
|
const prevScroll = useRef(0);
|
|
22
22
|
const { dark } = useContext(themeContext);
|
|
@@ -44,14 +44,18 @@ export const Absolute = ({ isOpen, id, paddingX, paddingY, className, children,
|
|
|
44
44
|
return "";
|
|
45
45
|
};
|
|
46
46
|
const parent = useMemo(() => {
|
|
47
|
-
if (!isOpen || !recalculateOnScroll) {
|
|
47
|
+
if (!isOpen || (!recalculateOnScroll && !closeOnScroll)) {
|
|
48
48
|
return null;
|
|
49
49
|
}
|
|
50
50
|
return getScrollableParent(triggerRef.current);
|
|
51
|
-
}, [triggerRef, isOpen, recalculateOnScroll]);
|
|
51
|
+
}, [triggerRef, isOpen, recalculateOnScroll, closeOnScroll]);
|
|
52
52
|
const calculatePosition = useCallback(() => calculatePos(triggerRef, popupRef, paddingX, paddingY, inline, alignment, alignmentsFn, parent ? parent : undefined), [triggerRef, paddingX, paddingY, inline, alignment, alignmentsFn, popupRef, parent]);
|
|
53
|
+
const handleCloseOnScroll = useCallback(() => {
|
|
54
|
+
onOpenChange(false);
|
|
55
|
+
}, [onOpenChange]);
|
|
53
56
|
useResize(calculatePosition, isOpen);
|
|
54
|
-
useScroll(calculatePosition, isOpen, parent);
|
|
57
|
+
useScroll(calculatePosition, isOpen && !!recalculateOnScroll, parent);
|
|
58
|
+
useScroll(handleCloseOnScroll, isOpen && !!closeOnScroll, parent);
|
|
55
59
|
useLayoutEffect(calculatePosition, [isOpen, children, recalculateTrigger, calculatePosition]);
|
|
56
60
|
function handleEscape() {
|
|
57
61
|
onOpenChange(false);
|
|
@@ -6,10 +6,26 @@ export interface IBetaPillActions {
|
|
|
6
6
|
link?: string;
|
|
7
7
|
linkOptions?: ILinkOptions;
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* @internal - temporary escape hatch
|
|
11
|
+
* @deprecated
|
|
12
|
+
*/
|
|
13
|
+
export interface IBetaPillBaseInternal {
|
|
14
|
+
name?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
}
|
|
17
|
+
interface IBetaPillBase {
|
|
10
18
|
className?: string;
|
|
19
|
+
}
|
|
20
|
+
interface IBetaPillWithActions extends IBetaPillBase {
|
|
11
21
|
feedbackAction?: IBetaPillActions;
|
|
12
22
|
betaOptionAction?: IBetaPillActions;
|
|
13
23
|
}
|
|
14
|
-
|
|
24
|
+
interface IBetaPillWithoutActions extends IBetaPillBase {
|
|
25
|
+
feedbackAction?: never;
|
|
26
|
+
betaOptionAction?: never;
|
|
27
|
+
}
|
|
28
|
+
export type IBetaPill = IBetaPillWithActions | IBetaPillWithoutActions;
|
|
29
|
+
export declare const BetaPill: (props: IBetaPill) => import("react/jsx-runtime").JSX.Element;
|
|
15
30
|
export declare const TRANSLATIONS: string[];
|
|
31
|
+
export {};
|
package/esm/betaPill/betaPill.js
CHANGED
|
@@ -116,11 +116,14 @@ injectString("zh-Hans", "Beta", "\u6D4B\u8BD5\u7248");
|
|
|
116
116
|
injectString("zh-TW", "Beta", "\u6E2C\u8A66\u7248");
|
|
117
117
|
injectString("ro-RO", "Beta", "Beta");
|
|
118
118
|
injectString("ar-SA", "Beta", "\u062A\u062C\u0631\u064A\u0628\u064A");
|
|
119
|
-
export const BetaPill =
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
119
|
+
export const BetaPill = props => {
|
|
120
|
+
const {
|
|
121
|
+
className,
|
|
122
|
+
feedbackAction,
|
|
123
|
+
betaOptionAction,
|
|
124
|
+
name,
|
|
125
|
+
description
|
|
126
|
+
} = props;
|
|
124
127
|
const {
|
|
125
128
|
translate
|
|
126
129
|
} = useLanguage();
|
|
@@ -139,8 +142,8 @@ export const BetaPill = ({
|
|
|
139
142
|
return _jsx(PillExpandable, {
|
|
140
143
|
isBeta: true,
|
|
141
144
|
icon: IconLab,
|
|
142
|
-
description: translate("This feature is still in testing, and is not fully supported yet. Your feedback is valuable to help guide future enhancements."),
|
|
143
|
-
text: translate("Beta"),
|
|
145
|
+
description: description !== null && description !== void 0 ? description : translate("This feature is still in testing, and is not fully supported yet. Your feedback is valuable to help guide future enhancements."),
|
|
146
|
+
text: name !== null && name !== void 0 ? name : translate("Beta"),
|
|
144
147
|
type: "info",
|
|
145
148
|
className: pillClasses,
|
|
146
149
|
mainAction: resolvedMainAction,
|
|
@@ -153,7 +156,7 @@ export const BetaPill = ({
|
|
|
153
156
|
type: "info",
|
|
154
157
|
children: !isMobile && _jsx("span", {
|
|
155
158
|
className: "zen-caption__content",
|
|
156
|
-
children: translate("Beta")
|
|
159
|
+
children: name !== null && name !== void 0 ? name : translate("Beta")
|
|
157
160
|
})
|
|
158
161
|
});
|
|
159
162
|
};
|
package/esm/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 "./components/title";
|
|
4
|
+
import { THeadingTag, TIconType } from "./components/title";
|
|
5
5
|
import { IActions } from "./components/actions";
|
|
6
6
|
import { IContent } from "./components/content";
|
|
7
7
|
import "./card.less";
|
|
@@ -42,6 +42,7 @@ export interface ICard extends IZenComponentProps, IZenGridItem, IZenFormLayoutI
|
|
|
42
42
|
scrollableContent?: boolean;
|
|
43
43
|
autoHeight?: boolean;
|
|
44
44
|
fullHeight?: boolean;
|
|
45
|
+
titleAs?: THeadingTag;
|
|
45
46
|
}
|
|
46
47
|
export declare const Card: FC<ICard> & {
|
|
47
48
|
Actions: FC<IActions>;
|
package/esm/card/card.js
CHANGED
|
@@ -82,7 +82,8 @@ props => {
|
|
|
82
82
|
fullWidth,
|
|
83
83
|
scrollableContent = true,
|
|
84
84
|
autoHeight = false,
|
|
85
|
-
fullHeight = false
|
|
85
|
+
fullHeight = false,
|
|
86
|
+
titleAs
|
|
86
87
|
} = props;
|
|
87
88
|
const {
|
|
88
89
|
translate
|
|
@@ -242,7 +243,8 @@ props => {
|
|
|
242
243
|
isMobile: isMobile,
|
|
243
244
|
title: title,
|
|
244
245
|
icon: titleIcon,
|
|
245
|
-
iconType: titleIconType
|
|
246
|
+
iconType: titleIconType,
|
|
247
|
+
titleAs: titleAs
|
|
246
248
|
}), _jsxs("div", {
|
|
247
249
|
className: "zen-card__header-right",
|
|
248
250
|
children: [!!headerActions.length && headerActions, date ? _jsx("span", {
|
|
@@ -2,6 +2,7 @@ import { FunctionComponent } from "react";
|
|
|
2
2
|
import "./title.less";
|
|
3
3
|
import { IIcon } from "../../icons/icon";
|
|
4
4
|
export type TIconType = "info" | "warning" | "error" | "success" | "default";
|
|
5
|
+
export type THeadingTag = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
5
6
|
interface ITitle {
|
|
6
7
|
isMobile: boolean;
|
|
7
8
|
title: string;
|
|
@@ -12,6 +13,7 @@ interface ITitle {
|
|
|
12
13
|
icon?: FunctionComponent<IIcon>;
|
|
13
14
|
iconType?: TIconType;
|
|
14
15
|
onClick?: () => void;
|
|
16
|
+
titleAs?: THeadingTag;
|
|
15
17
|
}
|
|
16
|
-
export declare const Title: ({ isMobile, link, target, title, id, icon, iconType, className, onClick }: ITitle) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare const Title: ({ isMobile, link, target, title, id, icon, iconType, className, onClick, titleAs }: ITitle) => import("react/jsx-runtime").JSX.Element;
|
|
17
19
|
export {};
|
|
@@ -4,12 +4,13 @@ import { classNames } from "../../commonHelpers/classNames/classNames";
|
|
|
4
4
|
import { useDriveClassName } from "../../utils/theme/useDriveClassName";
|
|
5
5
|
import { useDrive } from "../../utils/theme/useDrive";
|
|
6
6
|
import { IconChevronRightSmall } from "../../icons/iconChevronRightSmall";
|
|
7
|
-
|
|
7
|
+
const VALID_HEADING_TAGS = new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
|
|
8
|
+
export const Title = ({ isMobile, link, target, title, id, icon, iconType, className = "", onClick, titleAs }) => {
|
|
8
9
|
const driveClassNames = useDriveClassName("zen-card-title");
|
|
9
10
|
const isDrive = useDrive();
|
|
10
11
|
const iconClassName = iconType ? `zen-card-title__icon--${iconType}` : "";
|
|
11
12
|
const iconSize = useMemo(() => (isDrive ? "huge" : "large"), [isDrive]);
|
|
12
|
-
const iconElement = useMemo(() => (icon ? _jsx("
|
|
13
|
+
const iconElement = useMemo(() => (icon ? _jsx("span", { className: classNames(["zen-card-title__icon", iconClassName]), children: createElement(icon, { size: iconSize }) }) : null), [icon, iconSize, iconClassName]);
|
|
13
14
|
const chevron = useMemo(() => (_jsx("span", { className: "zen-card-title__link-chevron", children: _jsx(IconChevronRightSmall, { size: iconSize, className: "zen-card-title__chevron-icon" }) })), [iconSize]);
|
|
14
15
|
const titleClasses = classNames(["zen-card-title", driveClassNames || "", onClick ? "zen-card-title__clickable" : ""]);
|
|
15
16
|
if (onClick) {
|
|
@@ -18,5 +19,6 @@ export const Title = ({ isMobile, link, target, title, id, icon, iconType, class
|
|
|
18
19
|
if (link) {
|
|
19
20
|
return (_jsxs("a", { id: id, className: titleClasses, href: link, target: target, children: [iconElement, _jsxs("span", { title: title, className: classNames(["zen-card-title__link-text"]), children: [title, chevron] })] }));
|
|
20
21
|
}
|
|
21
|
-
|
|
22
|
+
const tag = titleAs && VALID_HEADING_TAGS.has(titleAs) ? titleAs : "div";
|
|
23
|
+
return createElement(tag, { className: titleClasses }, iconElement, _jsx("span", { title: title, id: id, className: classNames(["zen-card-title__text", isMobile && !isDrive ? "zen-card-title__text--mobile" : "", className]), children: title }, "text"));
|
|
22
24
|
};
|
package/esm/checkbox/checkbox.js
CHANGED
|
@@ -28,9 +28,9 @@ export const Checkbox = (_a) => {
|
|
|
28
28
|
const isMobile = useMobile();
|
|
29
29
|
const checkboxIconClasses = useMemo(() => classNames(["zen-checkbox__icon", disabled ? "zen-checkbox__icon--disabled" : ""]), [disabled]);
|
|
30
30
|
const checkbox = (_jsx(TriStateCheckbox, Object.assign({ className: "zen-checkbox__input", id: intId, checked: checked, indeterminate: indeterminate, disabled: disabled, "aria-label": title, "aria-describedby": describedBy }, rest)));
|
|
31
|
-
const iconAndLabel = (_jsxs(_Fragment, { children: [_jsx("div", { className: "zen-checkbox__box", children: state === CheckboxState.Indeterminate ? (_jsx(CheckboxIconMinus, { className: checkboxIconClasses, size: driveClasses ? "bigger" : "medium" })) : state === CheckboxState.On ? (_jsx(CheckboxIconCheckmark, { className: checkboxIconClasses, size: driveClasses ? "bigger" : "medium" })) : null }), children ? (_jsx("div", { className: classNames(["zen-checkbox__label-text", fullWidth ? "zen-checkbox__label-text--full-width" : ""]), children: children })) : null] }));
|
|
31
|
+
const iconAndLabel = (_jsxs(_Fragment, { children: [_jsx("div", { className: "zen-checkbox__box", "aria-hidden": true, children: state === CheckboxState.Indeterminate ? (_jsx(CheckboxIconMinus, { className: checkboxIconClasses, size: driveClasses ? "bigger" : "medium" })) : state === CheckboxState.On ? (_jsx(CheckboxIconCheckmark, { className: checkboxIconClasses, size: driveClasses ? "bigger" : "medium" })) : null }), children ? (_jsx("div", { className: classNames(["zen-checkbox__label-text", fullWidth ? "zen-checkbox__label-text--full-width" : ""]), children: children })) : null] }));
|
|
32
32
|
if (wrapped) {
|
|
33
33
|
return (_jsxs("label", { className: classNames(["zen-checkbox", driveClasses || "", className]), title: title, children: [checkbox, _jsx("div", { className: classNames(["zen-checkbox__label", reverse ? "zen-checkbox__label--reverse" : ""]), children: iconAndLabel })] }));
|
|
34
34
|
}
|
|
35
|
-
return (
|
|
35
|
+
return (_jsx("div", { className: classNames(["zen-checkbox", isMobile && !driveClasses ? "zen-checkbox--mobile" : "", driveClasses || "", className]), children: _jsxs("label", { className: classNames(["zen-checkbox__label", reverse ? "zen-checkbox__label--reverse" : ""]), title: title, children: [checkbox, iconAndLabel] }) }));
|
|
36
36
|
};
|
|
@@ -23,8 +23,9 @@ export interface IControlledPopup extends IZenComponentProps {
|
|
|
23
23
|
ariaLabel?: string;
|
|
24
24
|
ariaLabelledby?: string;
|
|
25
25
|
recalculateOnScroll?: boolean;
|
|
26
|
+
closeOnScroll?: boolean;
|
|
26
27
|
preventAttributesAutoSet?: boolean;
|
|
27
28
|
/** Whether to focus the first focusable element when popup opens. Default: true */
|
|
28
29
|
focusOnOpen?: boolean;
|
|
29
30
|
}
|
|
30
|
-
export declare const ControlledPopup: ({ isOpen, id, paddingX, paddingY, triggerRef, className, children, alignment, inline, onOpenChange, useTrapFocusWithTrigger, shouldHoldScroll, ariaLabel, ariaLabelledby, recalculateOnScroll, preventAttributesAutoSet, focusOnOpen, role }: IControlledPopup) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export declare const ControlledPopup: ({ isOpen, id, paddingX, paddingY, triggerRef, className, children, alignment, inline, onOpenChange, useTrapFocusWithTrigger, shouldHoldScroll, ariaLabel, ariaLabelledby, recalculateOnScroll, closeOnScroll, preventAttributesAutoSet, focusOnOpen, role }: IControlledPopup) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,7 +3,7 @@ import { useEffect, useId } from "react";
|
|
|
3
3
|
import { Absolute } from "../absolute/absolute";
|
|
4
4
|
import { classNames } from "../commonHelpers/classNames/classNames";
|
|
5
5
|
import { useClientReady } from "../commonHelpers/hooks/useClientReady";
|
|
6
|
-
export const ControlledPopup = ({ isOpen, id, paddingX, paddingY, triggerRef, className, children, alignment, inline, onOpenChange, useTrapFocusWithTrigger, shouldHoldScroll, ariaLabel, ariaLabelledby, recalculateOnScroll, preventAttributesAutoSet, focusOnOpen, role = "dialog" }) => {
|
|
6
|
+
export const ControlledPopup = ({ isOpen, id, paddingX, paddingY, triggerRef, className, children, alignment, inline, onOpenChange, useTrapFocusWithTrigger, shouldHoldScroll, ariaLabel, ariaLabelledby, recalculateOnScroll, closeOnScroll, preventAttributesAutoSet, focusOnOpen, role = "dialog" }) => {
|
|
7
7
|
const autoId = useId();
|
|
8
8
|
const popupId = id || autoId;
|
|
9
9
|
const isClientReady = useClientReady();
|
|
@@ -21,5 +21,5 @@ export const ControlledPopup = ({ isOpen, id, paddingX, paddingY, triggerRef, cl
|
|
|
21
21
|
triggerRef.current.setAttribute("aria-expanded", isOpen ? "true" : "false");
|
|
22
22
|
triggerRef.current.setAttribute("aria-controls", popupId);
|
|
23
23
|
}, [triggerRef, isOpen, popupId, preventAttributesAutoSet, isClientReady]);
|
|
24
|
-
return (_jsx(Absolute, Object.assign({ triggerRef: triggerRef, alignment: alignment, id: popupId, isOpen: isOpen, className: classNames(["zen-popup", className ? className : ""]), paddingX: paddingX, paddingY: paddingY, inline: inline, onOpenChange: onOpenChange, useTrapFocusWithTrigger: useTrapFocusWithTrigger, shouldHoldScroll: shouldHoldScroll }, (role !== false && typeof role === "string" ? { role } : {}), (role !== false && ariaLabel ? { ariaLabel } : {}), (role !== false && ariaLabelledby ? { ariaLabelledby } : {}), { recalculateOnScroll: recalculateOnScroll, focusOnOpen: focusOnOpen, children: children })));
|
|
24
|
+
return (_jsx(Absolute, Object.assign({ triggerRef: triggerRef, alignment: alignment, id: popupId, isOpen: isOpen, className: classNames(["zen-popup", className ? className : ""]), paddingX: paddingX, paddingY: paddingY, inline: inline, onOpenChange: onOpenChange, useTrapFocusWithTrigger: useTrapFocusWithTrigger, shouldHoldScroll: shouldHoldScroll }, (role !== false && typeof role === "string" ? { role } : {}), (role !== false && ariaLabel ? { ariaLabel } : {}), (role !== false && ariaLabelledby ? { ariaLabelledby } : {}), { recalculateOnScroll: recalculateOnScroll, closeOnScroll: closeOnScroll, focusOnOpen: focusOnOpen, children: children })));
|
|
25
25
|
};
|
package/esm/dropdown/dropdown.js
CHANGED
|
@@ -20,4 +20,4 @@ export const Dropdown = (_a) => {
|
|
|
20
20
|
var props = __rest(_a, []);
|
|
21
21
|
return _jsx(DropDownFormField, Object.assign({}, props));
|
|
22
22
|
};
|
|
23
|
-
export const TRANSLATIONS = ["Filter by group", "Open filter", "Clear search", "Select all", "
|
|
23
|
+
export const TRANSLATIONS = ["Filter by group", "Open filter", "Clear search", "Select all", "Clear", "Back", "No data"];
|
|
@@ -13,7 +13,9 @@ export interface IDropdownList extends IZenComponentProps {
|
|
|
13
13
|
onSelect: (id: string) => void;
|
|
14
14
|
onSingleSelect: (reset: boolean, selected?: string) => void;
|
|
15
15
|
backButtonName?: string;
|
|
16
|
-
isAllSelected
|
|
16
|
+
isAllSelected?: boolean;
|
|
17
|
+
isSelectAllActive?: boolean;
|
|
18
|
+
shouldBlockItems?: boolean;
|
|
17
19
|
listData: ICheckboxListWithActionOption[] | ISelectListItem[];
|
|
18
20
|
isWithFooter: boolean;
|
|
19
21
|
width?: number;
|
|
@@ -39,6 +41,6 @@ interface IDropdownEmptyList extends Pick<IDropdownList, "className" | "width" |
|
|
|
39
41
|
hasError: boolean;
|
|
40
42
|
}
|
|
41
43
|
export declare const EmptyList: ({ className, width, onClearClick, onApplyClick, onCancelClick, hasApplyButton, isApplyDisabled, isClearButtonDisabled, isWithFooter, hasError }: IDropdownEmptyList) => import("react/jsx-runtime").JSX.Element;
|
|
42
|
-
export declare const DropdownList: ({ onBackButtonClick, onSelectAllClick, onClearClick, onApplyClick, onCancelClick, onChange, onSelect, onSingleSelect, listData,
|
|
44
|
+
export declare const DropdownList: ({ onBackButtonClick, onSelectAllClick, onClearClick, onApplyClick, onCancelClick, onChange, onSelect, onSingleSelect, listData, isSelectAllActive, shouldBlockItems, backButtonName, width, minWidth, isSelectAllButtonDisable, hasSelectAllButton, filterName, isMultiselect, hasApplyButton, isApplyDisabled, isClearButtonDisabled, activeValue, forceSelection, isWithFooter, isMobile, handleCheckboxChange, checkboxLabel, isChecked, listElementRef, listId }: IDropdownList) => import("react/jsx-runtime").JSX.Element;
|
|
43
45
|
export declare const TRANSLATIONS: string[];
|
|
44
46
|
export {};
|