@aurora-ds/components 0.14.0 → 0.15.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/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 +6 -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/index.js +42 -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 +6 -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/index.js +41 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +20 -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
|
@@ -1265,7 +1265,7 @@ const Accordion = ({ title, children, expanded, defaultExpanded = false, onChang
|
|
|
1265
1265
|
Accordion.displayName = 'Accordion';
|
|
1266
1266
|
|
|
1267
1267
|
const MENU_STYLES = theme.createStyles((theme) => ({
|
|
1268
|
-
root: (isFadingIn, anchorOrigin, position) => ({
|
|
1268
|
+
root: (isFadingIn, anchorOrigin, position, width) => ({
|
|
1269
1269
|
position: 'absolute',
|
|
1270
1270
|
zIndex: theme.zIndex.dropdown,
|
|
1271
1271
|
marginTop: theme.spacing.xs,
|
|
@@ -1274,6 +1274,7 @@ const MENU_STYLES = theme.createStyles((theme) => ({
|
|
|
1274
1274
|
border: `1px solid ${theme.colors.border}`,
|
|
1275
1275
|
boxShadow: theme.shadows.md,
|
|
1276
1276
|
minWidth: 150,
|
|
1277
|
+
width,
|
|
1277
1278
|
opacity: isFadingIn ? 1 : 0,
|
|
1278
1279
|
transform: isFadingIn ? 'scale(1)' : 'scale(0.95)',
|
|
1279
1280
|
transformOrigin: anchorOrigin === 'right' ? 'top right' : 'top left',
|
|
@@ -1370,7 +1371,7 @@ const useTransitionRender = (isOpen, duration = DEFAULT_TRANSITION_DURATION_MS)
|
|
|
1370
1371
|
};
|
|
1371
1372
|
};
|
|
1372
1373
|
|
|
1373
|
-
const Menu = ({ anchor, onClose, children, anchorOrigin = 'right' }) => {
|
|
1374
|
+
const Menu = ({ anchor, onClose, children, anchorOrigin = 'right', width }) => {
|
|
1374
1375
|
// refs
|
|
1375
1376
|
const menuRef = React.useRef(null);
|
|
1376
1377
|
const anchorRef = React.useRef(null);
|
|
@@ -1395,10 +1396,46 @@ const Menu = ({ anchor, onClose, children, anchorOrigin = 'right' }) => {
|
|
|
1395
1396
|
if (!isVisible) {
|
|
1396
1397
|
return null;
|
|
1397
1398
|
}
|
|
1398
|
-
return (jsxRuntime.jsx("div", { ref: menuRef, className: MENU_STYLES.root(isFadingIn, anchorOrigin, position), children: children }));
|
|
1399
|
+
return (jsxRuntime.jsx("div", { ref: menuRef, className: MENU_STYLES.root(isFadingIn, anchorOrigin, position, width), children: children }));
|
|
1399
1400
|
};
|
|
1400
1401
|
Menu.displayName = 'Menu';
|
|
1401
1402
|
|
|
1403
|
+
const MENU_GROUP_STYLES = theme.createStyles((theme) => ({
|
|
1404
|
+
root: {
|
|
1405
|
+
display: 'flex',
|
|
1406
|
+
flexDirection: 'column',
|
|
1407
|
+
padding: theme.spacing.xs,
|
|
1408
|
+
},
|
|
1409
|
+
}));
|
|
1410
|
+
|
|
1411
|
+
const MenuGroup = ({ children }) => {
|
|
1412
|
+
return (jsxRuntime.jsx("div", { className: MENU_GROUP_STYLES.root, children: children }));
|
|
1413
|
+
};
|
|
1414
|
+
MenuGroup.displayName = 'MenuGroup';
|
|
1415
|
+
|
|
1416
|
+
const MENU_ITEM_STYLES = theme.createStyles((theme) => ({
|
|
1417
|
+
root: {
|
|
1418
|
+
display: 'flex',
|
|
1419
|
+
alignItems: 'center',
|
|
1420
|
+
gap: theme.spacing.sm,
|
|
1421
|
+
padding: theme.spacing.sm,
|
|
1422
|
+
borderRadius: theme.radius.sm,
|
|
1423
|
+
backgroundColor: theme.colors.surface,
|
|
1424
|
+
outline: 'none',
|
|
1425
|
+
border: 'none',
|
|
1426
|
+
cursor: 'pointer',
|
|
1427
|
+
transition: 'background-color 150ms ease-in-out',
|
|
1428
|
+
':hover': {
|
|
1429
|
+
backgroundColor: theme.colors.surfaceHover,
|
|
1430
|
+
},
|
|
1431
|
+
},
|
|
1432
|
+
}));
|
|
1433
|
+
|
|
1434
|
+
const MenuItem = ({ label, icon, onClick }) => {
|
|
1435
|
+
return (jsxRuntime.jsxs("button", { className: MENU_ITEM_STYLES.root, onClick: onClick, children: [icon && (jsxRuntime.jsx(Icon, { color: 'text', children: icon })), jsxRuntime.jsx(Text, { children: label })] }));
|
|
1436
|
+
};
|
|
1437
|
+
MenuItem.displayName = 'MenuItem';
|
|
1438
|
+
|
|
1402
1439
|
/**
|
|
1403
1440
|
* DrawerItem styles using createStyles from @aurora-ds/theme
|
|
1404
1441
|
*/
|
|
@@ -1728,6 +1765,8 @@ exports.Icon = Icon;
|
|
|
1728
1765
|
exports.IconButton = IconButton;
|
|
1729
1766
|
exports.Input = Input_default;
|
|
1730
1767
|
exports.Menu = Menu;
|
|
1768
|
+
exports.MenuGroup = MenuGroup;
|
|
1769
|
+
exports.MenuItem = MenuItem;
|
|
1731
1770
|
exports.Page = Page;
|
|
1732
1771
|
exports.PageSection = PageSection;
|
|
1733
1772
|
exports.Separator = Separator;
|