@commonsku/styles 1.16.1 → 1.16.3
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/dist/index.d.ts +7 -6
- package/dist/index.es.js +23 -19
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +22 -18
- package/dist/index.js.map +1 -1
- package/dist/styles/Button.d.ts +1 -1
- package/dist/styles/Button.d.ts.map +1 -1
- package/dist/styles/Dropdown.d.ts +5 -4
- package/dist/styles/Dropdown.d.ts.map +1 -1
- package/dist/styles/Tabs.d.ts +3 -3
- package/dist/styles/Tabs.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import React$1, { CSSProperties, Component, ReactNode, WeakValidationMap, ComponentType } from 'react';
|
|
2
|
+
import React$1, { CSSProperties, MouseEvent, Component, MouseEventHandler, ReactNode, WeakValidationMap, ComponentType } from 'react';
|
|
3
3
|
import { FlattenInterpolation, ThemedStyledProps, StyledComponent, CSSObject, FlattenSimpleInterpolation, GlobalStyleComponent, DefaultTheme, ThemeProps, Keyframes, AnyStyledComponent, StyledComponentInnerComponent } from 'styled-components';
|
|
4
4
|
import { DropzoneOptions } from 'react-dropzone';
|
|
5
5
|
import { AsyncAdditionalProps } from 'react-select/dist/declarations/src/useAsync';
|
|
@@ -1207,9 +1207,9 @@ declare const Tab: StyledComponent<"li", any, {
|
|
|
1207
1207
|
variant?: "primary" | "secondary" | undefined;
|
|
1208
1208
|
} & SharedStyleTypes, never>;
|
|
1209
1209
|
declare type TTab = {
|
|
1210
|
-
label: string;
|
|
1210
|
+
label: string | React$1.ReactNode;
|
|
1211
1211
|
content: React$1.ReactNode;
|
|
1212
|
-
onClick?:
|
|
1212
|
+
onClick?: (e?: MouseEvent<HTMLLIElement>) => void;
|
|
1213
1213
|
};
|
|
1214
1214
|
declare type TabsProps = {
|
|
1215
1215
|
tabs: TTab[];
|
|
@@ -2454,7 +2454,7 @@ declare type DropdownItemProps = {
|
|
|
2454
2454
|
declare const DropdownItem: StyledComponent<"div", any, DropdownItemProps, never>;
|
|
2455
2455
|
declare const DropDownContent: StyledComponent<"div", any, DropdownContentProps, never>;
|
|
2456
2456
|
declare type TDropdownItem = {
|
|
2457
|
-
onClick?:
|
|
2457
|
+
onClick?: MouseEventHandler<HTMLDivElement>;
|
|
2458
2458
|
props?: {
|
|
2459
2459
|
[key: string]: any;
|
|
2460
2460
|
underlined?: boolean;
|
|
@@ -2469,12 +2469,13 @@ declare type DropdownProps = {
|
|
|
2469
2469
|
size?: TSize$1;
|
|
2470
2470
|
style?: CSSObject;
|
|
2471
2471
|
buttonVariant?: ButtonVariant;
|
|
2472
|
+
buttonProps?: ButtonProps;
|
|
2472
2473
|
width?: string | number;
|
|
2473
2474
|
bordered?: boolean;
|
|
2474
2475
|
hideOnMouseLeave?: boolean;
|
|
2475
2476
|
onToggleMenu?: (value: boolean) => void;
|
|
2476
2477
|
};
|
|
2477
|
-
declare const Dropdown: ({ items, children, underlined, primary, text, icon, openMenu, onToggleMenu, mouseLeaveCallback, size, style, buttonVariant, width, bordered, hideOnMouseLeave, ...props }: React$1.PropsWithChildren<DropdownProps & DropdownContentProps>) => JSX.Element;
|
|
2478
|
+
declare const Dropdown: ({ items, children, underlined, primary, text, icon, openMenu, onToggleMenu, mouseLeaveCallback, size, style, buttonVariant, buttonProps, width, bordered, hideOnMouseLeave, ...props }: React$1.PropsWithChildren<DropdownProps & DropdownContentProps>) => JSX.Element;
|
|
2478
2479
|
|
|
2479
2480
|
declare const Badge: StyledComponent<"span", any, {
|
|
2480
2481
|
color?: string | undefined;
|
|
@@ -3559,4 +3560,4 @@ declare type SimpleWindowedTableProps = {
|
|
|
3559
3560
|
};
|
|
3560
3561
|
declare function SimpleWindowedTable({ columns, data, itemSize, height, minWidth, maxWidth, defaultSort, onClickRow, onScroll, onUpdateData, useTableProps, tableHeaderProps, tableFooterProps, hideFooter, className, NoRowsFound, }: SimpleWindowedTableProps): JSX.Element;
|
|
3561
3562
|
|
|
3562
|
-
export { AddIcon, AddNoteIcon, AddTaskIcon, AlertIcon, AlertNotification, ArrowIcon, Artwork, ArtworkProps, SKUAsyncSelect as AsyncSelect, Avatar, AvatarColor, AvatarShape, AvatarSize, AwaitingProofIcon, Backdrop, Background, Badge, BaseCskuProps, BotIcon, Box, BulletIcon, Button, ButtonPreset, ButtonVariant, ButtonsGroup, Calendar, CalendarDayBody, CalendarDaysBody, CalendarDaysHeader, CalendarIcon, CalendarTask, CalendarTaskProps, CalendarWrapper, CancelButton, ChangeRequestedIcon, ChatIcon, CheckMark, CheckboxIcon, CheckboxLabel, CheckmarkIcon, ChevronIcon, CircleProgressIcon, ClientApprovedIcon, ClipboardIcon, ClockIcon, Col, ColPropTypes, CollapseStyled, CollapseStyledProps, CollapseWrapper, CollapseWrapperProps, Collapsible, CollapsibleArrowIcon, CollapsibleLabel, CollapsiblePanel, CollapsiblePanelProps, CollapsiblePanelTitle, CollapsiblePanelTitleProps, CollapsiblePanels, CollapsiblePanelsProps, CollapsibleProps, Collapsible$1 as CollapsibleV2, Collapsibles, Column, ColumnSelectIcon, CommentIcon, CompletedCheckmarkIcon, ConfirmPopup, CouponIcon, SKUCreatableSelect as CreatableSelect, CreditCardIcon, Csku, CskuProps, CustomDateInput, Datepicker, DatepickerPorps, DaysBodyWrapper, DaysHeaderWrapper, DefaultCalendarFooter, DefaultCalendarHeader, DefaultStar, DollarIcon, DoneButton, Dot, DownloadIcon, DragIcon, DraggableTasksCalendar, DropArea, DropAreaProps, DropDownContent, Dropdown, DropdownItem, DropdownProps, DropzoneTypes, Dropzoned, DropzonedPreviews, EditIcon, EllipsisIcon, EpsIcon, ErrorBoundary, EstimateCircleIcon, EyeIcon, FeedPost, FilledChevronIcon, FolderIcon, GalleryIcon, GearIcon, GlobalStyle, Grid, GridCell, GridIcon, GridItem, GridItemProps, GridProps, GridRow, GridTable, GridTableContainer, H1, H2, H3, H4, H5, H6, HandleIcon, HeaderWrapper, HeadlessTable, HistoryIcon, IconButton, IconButtonProps, IconDoc, InfoIcon, Input, InputIconLabel, InputIconLabelContainer, InputProps, InputStepper, IntegrationsIcon, Label, LabeledAsyncSelect, LabeledCheckbox, LabeledCheckboxProps, LabeledCreatableSelect, LabeledIconInput, LabeledInput, LabeledMultiProgress, LabeledProgress, LabeledRadio, LabeledRadioGroup, LabeledRadioInButton, LabeledRadioInButtonGroup, LabeledRadioProps, LabeledSelect, LabeledTextarea, LightIndicator, Link, LinkWithIcon, ListIcon, Loading, LockIcon, MailIcon, MarketingStatusIcon, MenuIcon, MultiProgress, NavConnectIcon, NavFinanceIcon, NavManagementIcon, NavProdIcon, NavResourcesIcon, NavSalesIcon, NoteIcon, Number, NumberInput, OpportunityCircleIcon, Overlay, Padding, Page, PanelContact, PanelTileContact, PendingApprovalIcon, PercentIcon, PinIcon, Popup, PopupHeader, PopupProps, PresentationCircleIcon, Product, Progress, PromostandardsIcon, ProofReceivedIcon, ProofingCompleteIcon, Publisher, Radio, RadioIcon, RadioLabel, RadioProps, ReceiptLongIcon, ResponsiveTable, Row, RowPropTypes, SHARED_STYLE_MAPS, SalesArrowIcon, SalesOrderCircleIcon, SearchIcon, SKUSelect as Select, SharedStyleTypes, SharedStyles, ShopIcon, ShowPopup, SidePanel, SimpleWindowedTable, SimpleWindowedTableProps, SimpleWindowedTableStyles, SizerCss, SizerTypes, SizerWrapper, Sparkles, Spinner, StarIcon, StarRating, StateDropdown, StatusDropdown, StyledCalendarTaskBody, StyledDayBody, StyledDayText, StyledDropArea, StyledDropdown, StyledPanel, StyledTask, SubtractIcon, SVG as SvgIcon, TBody, TButtonIcon, TD, TDropdownItem, TH, THSorted, THead, TR, TSize$1 as TSize, TSizeOffset, TSizeOffsetRight, TSizeStyle, TTab, Tab, TabBar, Table, TableIcon, Tabs, TabsProps, TargetIcon, Task, TaskBody, TaskIcon, TaskLabel, TaskName, TaskProps, TasksCalendar, TasksCalendarDayBody, TasksCalendarFooter, TasksCalendarHeader, TemplateIcon, Text, TextProp, Textarea, Theme, Thermometer, TilesIcon, Toggle, ToggleLink, TrashIcon, UserIcon, UsersIcon, VirtualTable, VirtualTableStyles, Wrapper, XIcon, colors, createMeasurementStyle, datepickerStyles, fontFamilies, fontStyles, fonts, getColor, getFontStyle, getThemeColor, getThemeFontFamily, getThemeFontSize, getThemeFontStyle, getThemeProperty, parseCskuStyles, sizes, themeOptions, toggleSizes };
|
|
3563
|
+
export { AddIcon, AddNoteIcon, AddTaskIcon, AlertIcon, AlertNotification, ArrowIcon, Artwork, ArtworkProps, SKUAsyncSelect as AsyncSelect, Avatar, AvatarColor, AvatarShape, AvatarSize, AwaitingProofIcon, Backdrop, Background, Badge, BaseCskuProps, BotIcon, Box, BulletIcon, Button, ButtonPreset, ButtonProps, ButtonVariant, ButtonsGroup, Calendar, CalendarDayBody, CalendarDaysBody, CalendarDaysHeader, CalendarIcon, CalendarTask, CalendarTaskProps, CalendarWrapper, CancelButton, ChangeRequestedIcon, ChatIcon, CheckMark, CheckboxIcon, CheckboxLabel, CheckmarkIcon, ChevronIcon, CircleProgressIcon, ClientApprovedIcon, ClipboardIcon, ClockIcon, Col, ColPropTypes, CollapseStyled, CollapseStyledProps, CollapseWrapper, CollapseWrapperProps, Collapsible, CollapsibleArrowIcon, CollapsibleLabel, CollapsiblePanel, CollapsiblePanelProps, CollapsiblePanelTitle, CollapsiblePanelTitleProps, CollapsiblePanels, CollapsiblePanelsProps, CollapsibleProps, Collapsible$1 as CollapsibleV2, Collapsibles, Column, ColumnSelectIcon, CommentIcon, CompletedCheckmarkIcon, ConfirmPopup, CouponIcon, SKUCreatableSelect as CreatableSelect, CreditCardIcon, Csku, CskuProps, CustomDateInput, Datepicker, DatepickerPorps, DaysBodyWrapper, DaysHeaderWrapper, DefaultCalendarFooter, DefaultCalendarHeader, DefaultStar, DollarIcon, DoneButton, Dot, DownloadIcon, DragIcon, DraggableTasksCalendar, DropArea, DropAreaProps, DropDownContent, Dropdown, DropdownItem, DropdownProps, DropzoneTypes, Dropzoned, DropzonedPreviews, EditIcon, EllipsisIcon, EpsIcon, ErrorBoundary, EstimateCircleIcon, EyeIcon, FeedPost, FilledChevronIcon, FolderIcon, GalleryIcon, GearIcon, GlobalStyle, Grid, GridCell, GridIcon, GridItem, GridItemProps, GridProps, GridRow, GridTable, GridTableContainer, H1, H2, H3, H4, H5, H6, HandleIcon, HeaderWrapper, HeadlessTable, HistoryIcon, IconButton, IconButtonProps, IconDoc, InfoIcon, Input, InputIconLabel, InputIconLabelContainer, InputProps, InputStepper, IntegrationsIcon, Label, LabeledAsyncSelect, LabeledCheckbox, LabeledCheckboxProps, LabeledCreatableSelect, LabeledIconInput, LabeledInput, LabeledMultiProgress, LabeledProgress, LabeledRadio, LabeledRadioGroup, LabeledRadioInButton, LabeledRadioInButtonGroup, LabeledRadioProps, LabeledSelect, LabeledTextarea, LightIndicator, Link, LinkWithIcon, ListIcon, Loading, LockIcon, MailIcon, MarketingStatusIcon, MenuIcon, MultiProgress, NavConnectIcon, NavFinanceIcon, NavManagementIcon, NavProdIcon, NavResourcesIcon, NavSalesIcon, NoteIcon, Number, NumberInput, OpportunityCircleIcon, Overlay, Padding, Page, PanelContact, PanelTileContact, PendingApprovalIcon, PercentIcon, PinIcon, Popup, PopupHeader, PopupProps, PresentationCircleIcon, Product, Progress, PromostandardsIcon, ProofReceivedIcon, ProofingCompleteIcon, Publisher, Radio, RadioIcon, RadioLabel, RadioProps, ReceiptLongIcon, ResponsiveTable, Row, RowPropTypes, SHARED_STYLE_MAPS, SalesArrowIcon, SalesOrderCircleIcon, SearchIcon, SKUSelect as Select, SharedStyleTypes, SharedStyles, ShopIcon, ShowPopup, SidePanel, SimpleWindowedTable, SimpleWindowedTableProps, SimpleWindowedTableStyles, SizerCss, SizerTypes, SizerWrapper, Sparkles, Spinner, StarIcon, StarRating, StateDropdown, StatusDropdown, StyledCalendarTaskBody, StyledDayBody, StyledDayText, StyledDropArea, StyledDropdown, StyledPanel, StyledTask, SubtractIcon, SVG as SvgIcon, TBody, TButtonIcon, TD, TDropdownItem, TH, THSorted, THead, TR, TSize$1 as TSize, TSizeOffset, TSizeOffsetRight, TSizeStyle, TTab, Tab, TabBar, Table, TableIcon, Tabs, TabsProps, TargetIcon, Task, TaskBody, TaskIcon, TaskLabel, TaskName, TaskProps, TasksCalendar, TasksCalendarDayBody, TasksCalendarFooter, TasksCalendarHeader, TemplateIcon, Text, TextProp, Textarea, Theme, Thermometer, TilesIcon, Toggle, ToggleLink, TrashIcon, UserIcon, UsersIcon, VirtualTable, VirtualTableStyles, Wrapper, XIcon, colors, createMeasurementStyle, datepickerStyles, fontFamilies, fontStyles, fonts, getColor, getFontStyle, getThemeColor, getThemeFontFamily, getThemeFontSize, getThemeFontStyle, getThemeProperty, parseCskuStyles, sizes, themeOptions, toggleSizes };
|
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _, { map, pick, keys, isUndefined, get, toNumber, partial, uniqueId, debounce } from 'lodash';
|
|
1
|
+
import _, { map, pick, keys, isUndefined, get, toNumber, isString, filter, partial, uniqueId, debounce } from 'lodash';
|
|
2
2
|
import styled, { css, createGlobalStyle, ThemeProvider, keyframes } from 'styled-components';
|
|
3
3
|
import React__default, { Fragment, useState, useEffect, useRef, Component, useCallback, createContext, memo, forwardRef, useLayoutEffect, useMemo } from 'react';
|
|
4
4
|
import { useDropzone } from 'react-dropzone';
|
|
@@ -1319,16 +1319,18 @@ var themeOptions = {
|
|
|
1319
1319
|
},
|
|
1320
1320
|
};
|
|
1321
1321
|
function getColor(color, def) {
|
|
1322
|
+
var _a;
|
|
1322
1323
|
if (!color) {
|
|
1323
1324
|
return '';
|
|
1324
1325
|
}
|
|
1325
|
-
return _.get(colors, color, _.get(colors, def || '', def));
|
|
1326
|
+
return (_a = _.get(colors, color, _.get(colors, def || '', def))) !== null && _a !== void 0 ? _a : '';
|
|
1326
1327
|
}
|
|
1327
1328
|
function getFontStyle(value, def) {
|
|
1329
|
+
var _a;
|
|
1328
1330
|
if (!value) {
|
|
1329
1331
|
return '';
|
|
1330
1332
|
}
|
|
1331
|
-
return _.get(fontStyles, value, _.get(fontStyles, def || '', def));
|
|
1333
|
+
return (_a = _.get(fontStyles, value, _.get(fontStyles, def || '', def))) !== null && _a !== void 0 ? _a : '';
|
|
1332
1334
|
}
|
|
1333
1335
|
function getThemeColor(props, color, fallbackColor) {
|
|
1334
1336
|
return getThemeProperty(props, 'colors', color, fallbackColor);
|
|
@@ -1344,6 +1346,7 @@ function getThemeFontFamily(props, fallbackValue) {
|
|
|
1344
1346
|
return getThemeProperty(props, 'fontFamily', fallbackValue);
|
|
1345
1347
|
}
|
|
1346
1348
|
function getThemeProperty(props, prop, value, fallbackValue) {
|
|
1349
|
+
var _a, _b;
|
|
1347
1350
|
if (_.get(props, "theme.".concat(prop), null)) {
|
|
1348
1351
|
if (_.isObject(props.theme[prop]) && _.get(props.theme, "".concat(prop, ".").concat(value), null)) {
|
|
1349
1352
|
return _.get(props.theme, "".concat(prop, ".").concat(value), null);
|
|
@@ -1353,7 +1356,7 @@ function getThemeProperty(props, prop, value, fallbackValue) {
|
|
|
1353
1356
|
}
|
|
1354
1357
|
}
|
|
1355
1358
|
else if (_.get(themeOptions, "".concat(prop, ".").concat(value), null)) {
|
|
1356
|
-
return _.get(themeOptions, "".concat(prop, ".").concat(value)
|
|
1359
|
+
return (_a = _.get(themeOptions, "".concat(prop, ".").concat(value))) !== null && _a !== void 0 ? _a : '';
|
|
1357
1360
|
}
|
|
1358
1361
|
switch (prop) {
|
|
1359
1362
|
case 'fontStyles':
|
|
@@ -1363,7 +1366,7 @@ function getThemeProperty(props, prop, value, fallbackValue) {
|
|
|
1363
1366
|
case 'colors':
|
|
1364
1367
|
return getColor(value, fallbackValue);
|
|
1365
1368
|
case 'fontFamily':
|
|
1366
|
-
return _.get(themeOptions.fontFamilies, "".concat(value, ".fontFamily"), fallbackValue || themeOptions.fontFamily);
|
|
1369
|
+
return (_b = _.get(themeOptions.fontFamilies, "".concat(value, ".fontFamily"), fallbackValue || themeOptions.fontFamily)) !== null && _b !== void 0 ? _b : '';
|
|
1367
1370
|
default:
|
|
1368
1371
|
return '';
|
|
1369
1372
|
}
|
|
@@ -3733,8 +3736,8 @@ var Tabs = /** @class */ (function (_super) {
|
|
|
3733
3736
|
var sameTabs = prevProps.tabs.length !== this.props.tabs.length
|
|
3734
3737
|
|| (prevProps.tabs.length === this.props.tabs.length
|
|
3735
3738
|
&& prevProps.tabs.every(function (e, i) {
|
|
3736
|
-
return e.label === _this.props.tabs[i].label
|
|
3737
|
-
&& (e.onClick || "null").toString() === (_this.props.tabs[i].onClick || 'null').toString();
|
|
3739
|
+
return !isString(e.label) || (e.label === _this.props.tabs[i].label
|
|
3740
|
+
&& (e.onClick || "null").toString() === (_this.props.tabs[i].onClick || 'null').toString());
|
|
3738
3741
|
}));
|
|
3739
3742
|
if (!sameTabs) {
|
|
3740
3743
|
this.setState({
|
|
@@ -3744,17 +3747,17 @@ var Tabs = /** @class */ (function (_super) {
|
|
|
3744
3747
|
};
|
|
3745
3748
|
Tabs.prototype.render = function () {
|
|
3746
3749
|
var _this = this;
|
|
3747
|
-
var _a = this.props, tabs = _a.tabs, size = _a.size;
|
|
3750
|
+
var _a = this.props, tabs = _a.tabs, size = _a.size, props = __rest(_a, ["tabs", "size"]);
|
|
3748
3751
|
var selectedTab = this.getTab(tabs, this.state.selectedTabIndex);
|
|
3749
|
-
return React__default.createElement("div",
|
|
3750
|
-
React__default.createElement(TabBar, { padded: this.props.padded === true }, tabs.map(function (tab, index) { return React__default.createElement(Tab, { key: index, size: size, selected: index === _this.state.selectedTabIndex, onClick: function () {
|
|
3752
|
+
return React__default.createElement("div", __assign({}, props),
|
|
3753
|
+
React__default.createElement(TabBar, { padded: this.props.padded === true }, tabs.map(function (tab, index) { return React__default.createElement(Tab, { key: index, size: size, className: index === _this.state.selectedTabIndex ? 'selected' : '', selected: index === _this.state.selectedTabIndex, onClick: function (e) {
|
|
3751
3754
|
_this.setState({ selectedTabIndex: index });
|
|
3752
3755
|
var callback = tabs[index].onClick;
|
|
3753
3756
|
if (callback) {
|
|
3754
|
-
callback();
|
|
3757
|
+
callback(e);
|
|
3755
3758
|
}
|
|
3756
3759
|
} }, tab.label); })),
|
|
3757
|
-
|
|
3760
|
+
get(selectedTab, ['content'], ''));
|
|
3758
3761
|
};
|
|
3759
3762
|
return Tabs;
|
|
3760
3763
|
}(Component));
|
|
@@ -4347,10 +4350,10 @@ var getContentStyle = function (width, rootElem, buttonElem) {
|
|
|
4347
4350
|
return {};
|
|
4348
4351
|
};
|
|
4349
4352
|
var Dropdown = function (_a) {
|
|
4350
|
-
var items = _a.items, _b = _a.children, children = _b === void 0 ? undefined : _b, underlined = _a.underlined, primary = _a.primary, text = _a.text, icon = _a.icon, _c = _a.openMenu, openMenu = _c === void 0 ? false : _c, onToggleMenu = _a.onToggleMenu, mouseLeaveCallback = _a.mouseLeaveCallback, size = _a.size, _d = _a.style, style = _d === void 0 ? {} : _d, buttonVariant = _a.buttonVariant, _e = _a.
|
|
4353
|
+
var items = _a.items, _b = _a.children, children = _b === void 0 ? undefined : _b, underlined = _a.underlined, primary = _a.primary, text = _a.text, icon = _a.icon, _c = _a.openMenu, openMenu = _c === void 0 ? false : _c, onToggleMenu = _a.onToggleMenu, mouseLeaveCallback = _a.mouseLeaveCallback, size = _a.size, _d = _a.style, style = _d === void 0 ? {} : _d, buttonVariant = _a.buttonVariant, _e = _a.buttonProps, buttonProps = _e === void 0 ? {} : _e, _f = _a.width, width = _f === void 0 ? 160 : _f, _g = _a.bordered, bordered = _g === void 0 ? false : _g, _h = _a.hideOnMouseLeave, hideOnMouseLeave = _h === void 0 ? true : _h, props = __rest(_a, ["items", "children", "underlined", "primary", "text", "icon", "openMenu", "onToggleMenu", "mouseLeaveCallback", "size", "style", "buttonVariant", "buttonProps", "width", "bordered", "hideOnMouseLeave"]);
|
|
4351
4354
|
var rootRef = useRef(null);
|
|
4352
4355
|
var buttonRef = useRef(null);
|
|
4353
|
-
var
|
|
4356
|
+
var _j = useState(openMenu), showMenu = _j[0], setShowMenu = _j[1];
|
|
4354
4357
|
var iconProps = {
|
|
4355
4358
|
color: getColor(primary ? 'primary100' : 'white'),
|
|
4356
4359
|
style: { verticalAlign: 'middle', transitionDuration: '.3s', transform: 'rotate(' + (showMenu ? 0 : 180) + 'deg)' },
|
|
@@ -4392,16 +4395,17 @@ var Dropdown = function (_a) {
|
|
|
4392
4395
|
icon ?
|
|
4393
4396
|
React__default.createElement("span", { onClick: function () { return handleToggleMenu(!showMenu); } }, icon)
|
|
4394
4397
|
:
|
|
4395
|
-
React__default.createElement(Button, { size: size, cta: Boolean(!primary), variant: buttonVariant, onClick: function () { return handleToggleMenu(!showMenu); }, ref: buttonRef },
|
|
4398
|
+
React__default.createElement(Button, __assign({ size: size, cta: Boolean(!primary), variant: buttonVariant, onClick: function () { return handleToggleMenu(!showMenu); }, ref: buttonRef }, buttonProps),
|
|
4396
4399
|
text ? text : "Actions",
|
|
4397
4400
|
" ",
|
|
4398
4401
|
React__default.createElement(ChevronIcon, __assign({ direction: "up" }, iconProps))),
|
|
4399
4402
|
showMenu && React__default.createElement(DropDownContent, { style: contentStyle, underlined: underlined, primary: primary, width: width, bordered: bordered },
|
|
4400
|
-
items && items.map(function (
|
|
4401
|
-
|
|
4403
|
+
items && filter(items).map(function (_a, i) {
|
|
4404
|
+
var onClick = _a.onClick, content = _a.content, legecyProps = _a.props, itemProps = __rest(_a, ["onClick", "content", "props"]);
|
|
4405
|
+
return React__default.createElement(DropdownItem, __assign({ key: 'dropdown-item-' + i, underlined: underlined }, legecyProps, { primary: primary, onClick: function (e) {
|
|
4402
4406
|
setShowMenu(false);
|
|
4403
|
-
|
|
4404
|
-
} }),
|
|
4407
|
+
onClick && onClick(e);
|
|
4408
|
+
} }, itemProps), content);
|
|
4405
4409
|
}),
|
|
4406
4410
|
children ? children : null))));
|
|
4407
4411
|
};
|