@aurora-ds/components 0.14.0 → 0.15.1
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/cjs/components/actions/button/Button.props.d.ts +1 -1
- package/dist/cjs/components/actions/icon-button/IconButton.props.d.ts +1 -1
- package/dist/cjs/components/data-display/avatar/Avatar.props.d.ts +1 -1
- package/dist/cjs/components/overlay/menu/Menu.props.d.ts +1 -0
- package/dist/cjs/components/overlay/menu/Menu.styles.d.ts +1 -1
- package/dist/cjs/components/overlay/menu/MenuGroup/MenuGroup.d.ts +4 -0
- package/dist/cjs/components/overlay/menu/MenuGroup/MenuGroup.props.d.ts +4 -0
- package/dist/cjs/components/overlay/menu/MenuGroup/MenuGroup.styles.d.ts +3 -0
- package/dist/cjs/components/overlay/menu/MenuGroup/index.d.ts +2 -0
- package/dist/cjs/components/overlay/menu/MenuItem/MenuItem.d.ts +4 -0
- package/dist/cjs/components/overlay/menu/MenuItem/MenuItem.props.d.ts +9 -0
- package/dist/cjs/components/overlay/menu/MenuItem/MenuItem.styles.d.ts +3 -0
- package/dist/cjs/components/overlay/menu/MenuItem/index.d.ts +2 -0
- package/dist/cjs/components/overlay/menu/index.d.ts +4 -0
- package/dist/cjs/constants/globalConstants.d.ts +1 -0
- package/dist/cjs/index.js +47 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/actions/button/Button.props.d.ts +1 -1
- package/dist/esm/components/actions/icon-button/IconButton.props.d.ts +1 -1
- package/dist/esm/components/data-display/avatar/Avatar.props.d.ts +1 -1
- package/dist/esm/components/overlay/menu/Menu.props.d.ts +1 -0
- package/dist/esm/components/overlay/menu/Menu.styles.d.ts +1 -1
- package/dist/esm/components/overlay/menu/MenuGroup/MenuGroup.d.ts +4 -0
- package/dist/esm/components/overlay/menu/MenuGroup/MenuGroup.props.d.ts +4 -0
- package/dist/esm/components/overlay/menu/MenuGroup/MenuGroup.styles.d.ts +3 -0
- package/dist/esm/components/overlay/menu/MenuGroup/index.d.ts +2 -0
- package/dist/esm/components/overlay/menu/MenuItem/MenuItem.d.ts +4 -0
- package/dist/esm/components/overlay/menu/MenuItem/MenuItem.props.d.ts +9 -0
- package/dist/esm/components/overlay/menu/MenuItem/MenuItem.styles.d.ts +3 -0
- package/dist/esm/components/overlay/menu/MenuItem/index.d.ts +2 -0
- package/dist/esm/components/overlay/menu/index.d.ts +4 -0
- package/dist/esm/constants/globalConstants.d.ts +1 -0
- package/dist/esm/index.js +46 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +22 -5
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ export type ButtonProps = {
|
|
|
9
9
|
/** Optional icon to display after label */
|
|
10
10
|
endIcon?: ReactNode;
|
|
11
11
|
/** Click handler */
|
|
12
|
-
onClick?: (e
|
|
12
|
+
onClick?: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
13
13
|
/** Visual variant of the button */
|
|
14
14
|
variant?: ButtonVariants;
|
|
15
15
|
/** Button type attribute */
|
|
@@ -5,7 +5,7 @@ export type IconButtonProps = {
|
|
|
5
5
|
/** IconButton icon */
|
|
6
6
|
icon?: ReactNode;
|
|
7
7
|
/** Click handler */
|
|
8
|
-
onClick?: (e
|
|
8
|
+
onClick?: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
9
9
|
/** Visual variant of the button */
|
|
10
10
|
variant?: IconButtonVariants;
|
|
11
11
|
/** Button type attribute */
|
|
@@ -6,7 +6,7 @@ export type AvatarProps = {
|
|
|
6
6
|
/** Fallback text to display when no image */
|
|
7
7
|
label?: string;
|
|
8
8
|
/** Click handler */
|
|
9
|
-
onClick?: (e
|
|
9
|
+
onClick?: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
10
10
|
/** Size of the avatar */
|
|
11
11
|
size?: AvatarSize;
|
|
12
12
|
/** Text color for the label */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { AnchorOrigin, AnchorPosition } from '@hooks/useAnchorPosition.types';
|
|
2
2
|
export declare const MENU_STYLES: {
|
|
3
|
-
root: (isFadingIn: boolean, anchorOrigin: AnchorOrigin, position: AnchorPosition) => string;
|
|
3
|
+
root: (isFadingIn: boolean, anchorOrigin: AnchorOrigin, position: AnchorPosition, width?: string | undefined) => string;
|
|
4
4
|
};
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
export { default as Menu } from './Menu';
|
|
2
2
|
export type { MenuProps } from './Menu.props';
|
|
3
|
+
export { MenuGroup } from './MenuGroup';
|
|
4
|
+
export type { MenuGroupProps } from './MenuGroup/MenuGroup.props';
|
|
5
|
+
export { MenuItem } from './MenuItem';
|
|
6
|
+
export type { MenuItemProps } from './MenuItem/MenuItem.props';
|
package/dist/esm/index.js
CHANGED
|
@@ -417,6 +417,7 @@ const Chip = ({ label, icon, variant = 'filled', color = 'default', size = 'md',
|
|
|
417
417
|
Chip.displayName = 'Chip';
|
|
418
418
|
|
|
419
419
|
const BUTTON_SIZE = 36;
|
|
420
|
+
const MENU_ITEM_SIZE = 32;
|
|
420
421
|
const DRAWER_ITEM_HEIGHT = 32;
|
|
421
422
|
const DEFAULT_TRANSITION_DURATION_MS = 150;
|
|
422
423
|
|
|
@@ -1263,7 +1264,7 @@ const Accordion = ({ title, children, expanded, defaultExpanded = false, onChang
|
|
|
1263
1264
|
Accordion.displayName = 'Accordion';
|
|
1264
1265
|
|
|
1265
1266
|
const MENU_STYLES = createStyles((theme) => ({
|
|
1266
|
-
root: (isFadingIn, anchorOrigin, position) => ({
|
|
1267
|
+
root: (isFadingIn, anchorOrigin, position, width) => ({
|
|
1267
1268
|
position: 'absolute',
|
|
1268
1269
|
zIndex: theme.zIndex.dropdown,
|
|
1269
1270
|
marginTop: theme.spacing.xs,
|
|
@@ -1272,6 +1273,9 @@ const MENU_STYLES = createStyles((theme) => ({
|
|
|
1272
1273
|
border: `1px solid ${theme.colors.border}`,
|
|
1273
1274
|
boxShadow: theme.shadows.md,
|
|
1274
1275
|
minWidth: 150,
|
|
1276
|
+
maxHeight: MENU_ITEM_SIZE * 8,
|
|
1277
|
+
overflowY: 'auto',
|
|
1278
|
+
width,
|
|
1275
1279
|
opacity: isFadingIn ? 1 : 0,
|
|
1276
1280
|
transform: isFadingIn ? 'scale(1)' : 'scale(0.95)',
|
|
1277
1281
|
transformOrigin: anchorOrigin === 'right' ? 'top right' : 'top left',
|
|
@@ -1368,7 +1372,7 @@ const useTransitionRender = (isOpen, duration = DEFAULT_TRANSITION_DURATION_MS)
|
|
|
1368
1372
|
};
|
|
1369
1373
|
};
|
|
1370
1374
|
|
|
1371
|
-
const Menu = ({ anchor, onClose, children, anchorOrigin = 'right' }) => {
|
|
1375
|
+
const Menu = ({ anchor, onClose, children, anchorOrigin = 'right', width }) => {
|
|
1372
1376
|
// refs
|
|
1373
1377
|
const menuRef = useRef(null);
|
|
1374
1378
|
const anchorRef = useRef(null);
|
|
@@ -1393,10 +1397,48 @@ const Menu = ({ anchor, onClose, children, anchorOrigin = 'right' }) => {
|
|
|
1393
1397
|
if (!isVisible) {
|
|
1394
1398
|
return null;
|
|
1395
1399
|
}
|
|
1396
|
-
return (jsx("div", { ref: menuRef, className: MENU_STYLES.root(isFadingIn, anchorOrigin, position), children: children }));
|
|
1400
|
+
return (jsx("div", { ref: menuRef, className: MENU_STYLES.root(isFadingIn, anchorOrigin, position, width), children: children }));
|
|
1397
1401
|
};
|
|
1398
1402
|
Menu.displayName = 'Menu';
|
|
1399
1403
|
|
|
1404
|
+
const MENU_GROUP_STYLES = createStyles((theme) => ({
|
|
1405
|
+
root: {
|
|
1406
|
+
display: 'flex',
|
|
1407
|
+
flexDirection: 'column',
|
|
1408
|
+
padding: theme.spacing.xs,
|
|
1409
|
+
},
|
|
1410
|
+
}));
|
|
1411
|
+
|
|
1412
|
+
const MenuGroup = ({ children }) => {
|
|
1413
|
+
return (jsx("div", { className: MENU_GROUP_STYLES.root, children: children }));
|
|
1414
|
+
};
|
|
1415
|
+
MenuGroup.displayName = 'MenuGroup';
|
|
1416
|
+
|
|
1417
|
+
const MENU_ITEM_STYLES = createStyles((theme) => ({
|
|
1418
|
+
root: {
|
|
1419
|
+
display: 'flex',
|
|
1420
|
+
alignItems: 'center',
|
|
1421
|
+
gap: theme.spacing.sm,
|
|
1422
|
+
padding: theme.spacing.sm,
|
|
1423
|
+
borderRadius: theme.radius.sm,
|
|
1424
|
+
backgroundColor: theme.colors.surface,
|
|
1425
|
+
outline: 'none',
|
|
1426
|
+
border: 'none',
|
|
1427
|
+
cursor: 'pointer',
|
|
1428
|
+
height: MENU_ITEM_SIZE,
|
|
1429
|
+
flexShrink: 0,
|
|
1430
|
+
transition: 'background-color 150ms ease-in-out',
|
|
1431
|
+
':hover': {
|
|
1432
|
+
backgroundColor: theme.colors.surfaceHover,
|
|
1433
|
+
},
|
|
1434
|
+
},
|
|
1435
|
+
}));
|
|
1436
|
+
|
|
1437
|
+
const MenuItem = ({ label, icon, onClick, textColor, iconColor }) => {
|
|
1438
|
+
return (jsxs("button", { className: MENU_ITEM_STYLES.root, onClick: onClick, children: [icon && (jsx(Icon, { color: iconColor ?? 'text', children: icon })), jsx(Text, { variant: 'label', color: textColor ?? 'text', children: label })] }));
|
|
1439
|
+
};
|
|
1440
|
+
MenuItem.displayName = 'MenuItem';
|
|
1441
|
+
|
|
1400
1442
|
/**
|
|
1401
1443
|
* DrawerItem styles using createStyles from @aurora-ds/theme
|
|
1402
1444
|
*/
|
|
@@ -1708,5 +1750,5 @@ const TabItem = ({ label, isActive = false, onClick, }) => {
|
|
|
1708
1750
|
};
|
|
1709
1751
|
TabItem.displayName = 'TabItem';
|
|
1710
1752
|
|
|
1711
|
-
export { Accordion, Avatar, AvatarGroup, Breadcrumb, BreadcrumbEllipsis, BreadcrumbLink, BreadcrumbPage, BreadcrumbSeparator, Button, Card, Chip, DrawerItem, Form_default as Form, Grid, Icon, IconButton, Input_default as Input, Menu, Page, PageSection, Separator, Stack, TabItem, Tabs, Text, TextArea_default as TextArea, useAnchorPosition, useClickOutside, useTransitionRender };
|
|
1753
|
+
export { Accordion, Avatar, AvatarGroup, Breadcrumb, BreadcrumbEllipsis, BreadcrumbLink, BreadcrumbPage, BreadcrumbSeparator, Button, Card, Chip, DrawerItem, Form_default as Form, Grid, Icon, IconButton, Input_default as Input, Menu, MenuGroup, MenuItem, Page, PageSection, Separator, Stack, TabItem, Tabs, Text, TextArea_default as TextArea, useAnchorPosition, useClickOutside, useTransitionRender };
|
|
1712
1754
|
//# sourceMappingURL=index.js.map
|