@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/cjs/index.js
CHANGED
|
@@ -419,6 +419,7 @@ const Chip = ({ label, icon, variant = 'filled', color = 'default', size = 'md',
|
|
|
419
419
|
Chip.displayName = 'Chip';
|
|
420
420
|
|
|
421
421
|
const BUTTON_SIZE = 36;
|
|
422
|
+
const MENU_ITEM_SIZE = 32;
|
|
422
423
|
const DRAWER_ITEM_HEIGHT = 32;
|
|
423
424
|
const DEFAULT_TRANSITION_DURATION_MS = 150;
|
|
424
425
|
|
|
@@ -1265,7 +1266,7 @@ const Accordion = ({ title, children, expanded, defaultExpanded = false, onChang
|
|
|
1265
1266
|
Accordion.displayName = 'Accordion';
|
|
1266
1267
|
|
|
1267
1268
|
const MENU_STYLES = theme.createStyles((theme) => ({
|
|
1268
|
-
root: (isFadingIn, anchorOrigin, position) => ({
|
|
1269
|
+
root: (isFadingIn, anchorOrigin, position, width) => ({
|
|
1269
1270
|
position: 'absolute',
|
|
1270
1271
|
zIndex: theme.zIndex.dropdown,
|
|
1271
1272
|
marginTop: theme.spacing.xs,
|
|
@@ -1274,6 +1275,9 @@ const MENU_STYLES = theme.createStyles((theme) => ({
|
|
|
1274
1275
|
border: `1px solid ${theme.colors.border}`,
|
|
1275
1276
|
boxShadow: theme.shadows.md,
|
|
1276
1277
|
minWidth: 150,
|
|
1278
|
+
maxHeight: MENU_ITEM_SIZE * 8,
|
|
1279
|
+
overflowY: 'auto',
|
|
1280
|
+
width,
|
|
1277
1281
|
opacity: isFadingIn ? 1 : 0,
|
|
1278
1282
|
transform: isFadingIn ? 'scale(1)' : 'scale(0.95)',
|
|
1279
1283
|
transformOrigin: anchorOrigin === 'right' ? 'top right' : 'top left',
|
|
@@ -1370,7 +1374,7 @@ const useTransitionRender = (isOpen, duration = DEFAULT_TRANSITION_DURATION_MS)
|
|
|
1370
1374
|
};
|
|
1371
1375
|
};
|
|
1372
1376
|
|
|
1373
|
-
const Menu = ({ anchor, onClose, children, anchorOrigin = 'right' }) => {
|
|
1377
|
+
const Menu = ({ anchor, onClose, children, anchorOrigin = 'right', width }) => {
|
|
1374
1378
|
// refs
|
|
1375
1379
|
const menuRef = React.useRef(null);
|
|
1376
1380
|
const anchorRef = React.useRef(null);
|
|
@@ -1395,10 +1399,48 @@ const Menu = ({ anchor, onClose, children, anchorOrigin = 'right' }) => {
|
|
|
1395
1399
|
if (!isVisible) {
|
|
1396
1400
|
return null;
|
|
1397
1401
|
}
|
|
1398
|
-
return (jsxRuntime.jsx("div", { ref: menuRef, className: MENU_STYLES.root(isFadingIn, anchorOrigin, position), children: children }));
|
|
1402
|
+
return (jsxRuntime.jsx("div", { ref: menuRef, className: MENU_STYLES.root(isFadingIn, anchorOrigin, position, width), children: children }));
|
|
1399
1403
|
};
|
|
1400
1404
|
Menu.displayName = 'Menu';
|
|
1401
1405
|
|
|
1406
|
+
const MENU_GROUP_STYLES = theme.createStyles((theme) => ({
|
|
1407
|
+
root: {
|
|
1408
|
+
display: 'flex',
|
|
1409
|
+
flexDirection: 'column',
|
|
1410
|
+
padding: theme.spacing.xs,
|
|
1411
|
+
},
|
|
1412
|
+
}));
|
|
1413
|
+
|
|
1414
|
+
const MenuGroup = ({ children }) => {
|
|
1415
|
+
return (jsxRuntime.jsx("div", { className: MENU_GROUP_STYLES.root, children: children }));
|
|
1416
|
+
};
|
|
1417
|
+
MenuGroup.displayName = 'MenuGroup';
|
|
1418
|
+
|
|
1419
|
+
const MENU_ITEM_STYLES = theme.createStyles((theme) => ({
|
|
1420
|
+
root: {
|
|
1421
|
+
display: 'flex',
|
|
1422
|
+
alignItems: 'center',
|
|
1423
|
+
gap: theme.spacing.sm,
|
|
1424
|
+
padding: theme.spacing.sm,
|
|
1425
|
+
borderRadius: theme.radius.sm,
|
|
1426
|
+
backgroundColor: theme.colors.surface,
|
|
1427
|
+
outline: 'none',
|
|
1428
|
+
border: 'none',
|
|
1429
|
+
cursor: 'pointer',
|
|
1430
|
+
height: MENU_ITEM_SIZE,
|
|
1431
|
+
flexShrink: 0,
|
|
1432
|
+
transition: 'background-color 150ms ease-in-out',
|
|
1433
|
+
':hover': {
|
|
1434
|
+
backgroundColor: theme.colors.surfaceHover,
|
|
1435
|
+
},
|
|
1436
|
+
},
|
|
1437
|
+
}));
|
|
1438
|
+
|
|
1439
|
+
const MenuItem = ({ label, icon, onClick, textColor, iconColor }) => {
|
|
1440
|
+
return (jsxRuntime.jsxs("button", { className: MENU_ITEM_STYLES.root, onClick: onClick, children: [icon && (jsxRuntime.jsx(Icon, { color: iconColor ?? 'text', children: icon })), jsxRuntime.jsx(Text, { variant: 'label', color: textColor ?? 'text', children: label })] }));
|
|
1441
|
+
};
|
|
1442
|
+
MenuItem.displayName = 'MenuItem';
|
|
1443
|
+
|
|
1402
1444
|
/**
|
|
1403
1445
|
* DrawerItem styles using createStyles from @aurora-ds/theme
|
|
1404
1446
|
*/
|
|
@@ -1728,6 +1770,8 @@ exports.Icon = Icon;
|
|
|
1728
1770
|
exports.IconButton = IconButton;
|
|
1729
1771
|
exports.Input = Input_default;
|
|
1730
1772
|
exports.Menu = Menu;
|
|
1773
|
+
exports.MenuGroup = MenuGroup;
|
|
1774
|
+
exports.MenuItem = MenuItem;
|
|
1731
1775
|
exports.Page = Page;
|
|
1732
1776
|
exports.PageSection = PageSection;
|
|
1733
1777
|
exports.Separator = Separator;
|