@pingux/astro 2.163.1-alpha.2 → 2.163.1-alpha.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.
Files changed (42) hide show
  1. package/lib/cjs/components/MenuItem/MenuItem.js +22 -13
  2. package/lib/cjs/components/MenuItem/MenuItem.styles.d.ts +1 -1
  3. package/lib/cjs/components/MenuItem/MenuItem.styles.js +1 -1
  4. package/lib/cjs/components/MenuItem/MenuItem.test.js +217 -194
  5. package/lib/cjs/components/MenuSection/MenuSection.js +2 -1
  6. package/lib/cjs/components/PopoverMenu/PopoverMenu.stories.js +57 -33
  7. package/lib/cjs/hooks/useGetTheme/useGetTheme.d.ts +2 -0
  8. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/colors.d.ts +3 -0
  9. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/colors.js +3 -0
  10. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/customProperties/icons.d.ts +1 -0
  11. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/customProperties/index.d.ts +1 -0
  12. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/menu.d.ts +15 -2
  13. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/menu.js +20 -7
  14. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.d.ts +15 -2
  15. package/lib/cjs/styles/themeOverrides/onyxSideNav.d.ts +1 -0
  16. package/lib/cjs/styles/themes/astro/customProperties/icons.d.ts +1 -0
  17. package/lib/cjs/styles/themes/astro/customProperties/icons.js +1 -1
  18. package/lib/cjs/styles/themes/astro/customProperties/index.d.ts +1 -0
  19. package/lib/cjs/styles/themes/next-gen/customProperties/icons.d.ts +1 -0
  20. package/lib/cjs/styles/themes/next-gen/customProperties/icons.js +1 -1
  21. package/lib/cjs/styles/themes/next-gen/customProperties/index.d.ts +1 -0
  22. package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +34 -2
  23. package/lib/cjs/styles/themes/next-gen/variants/menu.d.ts +32 -2
  24. package/lib/cjs/styles/themes/next-gen/variants/menu.js +39 -9
  25. package/lib/cjs/styles/themes/next-gen/variants/popoverMenu.d.ts +1 -0
  26. package/lib/cjs/styles/themes/next-gen/variants/popoverMenu.js +1 -0
  27. package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +33 -2
  28. package/lib/cjs/styles/themes/next-gen/variants/variants.js +1 -0
  29. package/lib/components/MenuItem/MenuItem.js +25 -16
  30. package/lib/components/MenuItem/MenuItem.styles.js +1 -1
  31. package/lib/components/MenuItem/MenuItem.test.js +224 -201
  32. package/lib/components/MenuSection/MenuSection.js +2 -1
  33. package/lib/components/PopoverMenu/PopoverMenu.stories.js +57 -33
  34. package/lib/styles/themeOverrides/nextGenDarkMode/colors.js +3 -0
  35. package/lib/styles/themeOverrides/nextGenDarkMode/variants/menu.js +20 -7
  36. package/lib/styles/themes/astro/customProperties/icons.js +1 -1
  37. package/lib/styles/themes/next-gen/customProperties/icons.js +1 -1
  38. package/lib/styles/themes/next-gen/variants/menu.js +38 -8
  39. package/lib/styles/themes/next-gen/variants/popoverMenu.js +1 -0
  40. package/lib/styles/themes/next-gen/variants/variants.js +2 -1
  41. package/lib/tsconfig.lib.tsbuildinfo +1 -1
  42. package/package.json +1 -1
@@ -3,23 +3,53 @@ export declare const menu: {
3
3
  border: string;
4
4
  borderColor: string;
5
5
  };
6
+ export declare const menuSection: {
7
+ sectionTitle: {
8
+ fontWeight: string;
9
+ fontSize: string;
10
+ lineHeight: string;
11
+ textTransform: string;
12
+ letterSpacing: string;
13
+ height: string;
14
+ py: string;
15
+ px: string;
16
+ color: string;
17
+ ml: number;
18
+ };
19
+ };
6
20
  export declare const menuItem: {
7
21
  item: {
8
22
  bg: string;
9
23
  padding: string;
10
24
  outline: string;
11
25
  color: string;
26
+ fontSize: string;
27
+ lineHeight: string;
12
28
  cursor: string;
13
- '&.is-focused, &.is-selected, &.is-pressed': {
29
+ borderRadius: string;
30
+ '&.is-hovered': {
14
31
  bg: string;
15
32
  color: string;
16
33
  '> *': {
17
34
  color: string;
18
35
  };
19
36
  };
20
- '&.is-pressed': {
37
+ '&.is-focused': {
38
+ bg: string;
21
39
  color: string;
40
+ outline: string;
41
+ outlineOffset: string;
42
+ outlineColor: string;
43
+ '> *': {
44
+ color: string;
45
+ };
46
+ };
47
+ '&.is-pressed, &.is-selected': {
22
48
  bg: string;
49
+ color: string;
50
+ '> *': {
51
+ color: string;
52
+ };
23
53
  };
24
54
  };
25
55
  separator: {
@@ -4,29 +4,59 @@ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/obje
4
4
  _Object$defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.menuItem = exports.menu = void 0;
7
+ exports.menuSection = exports.menuItem = exports.menu = void 0;
8
8
  var menu = exports.menu = {
9
9
  p: 'sm',
10
10
  border: '1px solid',
11
11
  borderColor: 'border.base'
12
12
  };
13
+ var menuSection = exports.menuSection = {
14
+ sectionTitle: {
15
+ fontWeight: '1',
16
+ fontSize: 'tiny',
17
+ lineHeight: 'md',
18
+ textTransform: 'uppercase',
19
+ letterSpacing: '1px',
20
+ height: 'unset',
21
+ py: 'sm',
22
+ px: '12px',
23
+ color: 'font.light',
24
+ ml: 0
25
+ }
26
+ };
13
27
  var menuItem = exports.menuItem = {
14
28
  item: {
15
29
  bg: 'transparent',
16
- padding: '10px 10px',
30
+ padding: '12px 12px',
17
31
  outline: 'none',
18
- color: 'text.primary',
32
+ color: 'gray-700',
33
+ fontSize: 'md',
34
+ lineHeight: 'body',
19
35
  cursor: 'pointer',
20
- '&.is-focused, &.is-selected, &.is-pressed': {
36
+ borderRadius: '4px',
37
+ '&.is-hovered': {
38
+ bg: 'gray-100',
39
+ color: '#121518',
40
+ '> *': {
41
+ color: '#121518'
42
+ }
43
+ },
44
+ '&.is-focused': {
21
45
  bg: 'gray-100',
22
- color: 'text.primary',
46
+ color: '#121518',
47
+ outline: '1px solid',
48
+ outlineOffset: '1px',
49
+ outlineColor: 'primary',
23
50
  '> *': {
24
- color: 'text.primary'
51
+ color: '#121518'
25
52
  }
26
53
  },
27
- '&.is-pressed': {
28
- color: 'text.primary',
29
- bg: 'lightblue'
54
+ '&.is-pressed, &.is-selected': {
55
+ bg: 'lightblue',
56
+ color: '#121518',
57
+ '> *': {
58
+ color: '#121518'
59
+ }
30
60
  }
31
61
  },
32
62
  separator: {
@@ -1,5 +1,6 @@
1
1
  declare const _default: {
2
2
  container: {
3
+ minWidth: string;
3
4
  transition: string;
4
5
  '&.animate': {
5
6
  opacity: number;
@@ -6,6 +6,7 @@ _Object$defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports["default"] = void 0;
8
8
  var container = {
9
+ minWidth: '150px',
9
10
  transition: 'opacity 200ms ease',
10
11
  '&.animate': {
11
12
  opacity: 0
@@ -963,23 +963,53 @@ declare const _default: {
963
963
  padding: string;
964
964
  outline: string;
965
965
  color: string;
966
+ fontSize: string;
967
+ lineHeight: string;
966
968
  cursor: string;
967
- '&.is-focused, &.is-selected, &.is-pressed': {
969
+ borderRadius: string;
970
+ '&.is-hovered': {
968
971
  bg: string;
969
972
  color: string;
970
973
  '> *': {
971
974
  color: string;
972
975
  };
973
976
  };
974
- '&.is-pressed': {
977
+ '&.is-focused': {
978
+ bg: string;
975
979
  color: string;
980
+ outline: string;
981
+ outlineOffset: string;
982
+ outlineColor: string;
983
+ '> *': {
984
+ color: string;
985
+ };
986
+ };
987
+ '&.is-pressed, &.is-selected': {
976
988
  bg: string;
989
+ color: string;
990
+ '> *': {
991
+ color: string;
992
+ };
977
993
  };
978
994
  };
979
995
  separator: {
980
996
  my: string;
981
997
  };
982
998
  };
999
+ menuSection: {
1000
+ sectionTitle: {
1001
+ fontWeight: string;
1002
+ fontSize: string;
1003
+ lineHeight: string;
1004
+ textTransform: string;
1005
+ letterSpacing: string;
1006
+ height: string;
1007
+ py: string;
1008
+ px: string;
1009
+ color: string;
1010
+ ml: number;
1011
+ };
1012
+ };
983
1013
  menuTab: {
984
1014
  ml: string;
985
1015
  };
@@ -1296,6 +1326,7 @@ declare const _default: {
1296
1326
  };
1297
1327
  popoverMenu: {
1298
1328
  container: {
1329
+ minWidth: string;
1299
1330
  transition: string;
1300
1331
  '&.animate': {
1301
1332
  opacity: number;
@@ -429,6 +429,7 @@ var _default = exports["default"] = {
429
429
  loader: loader,
430
430
  menu: _menu.menu,
431
431
  menuItem: _menu.menuItem,
432
+ menuSection: _menu.menuSection,
432
433
  menuTab: _tabs.menuTab,
433
434
  message: _messages.message,
434
435
  modal: modal,
@@ -1,13 +1,15 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
- import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
3
2
  import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
4
3
  var _excluded = ["isSeparator", "isPressed", "data-id"];
5
- import React, { forwardRef, useState } from 'react';
4
+ import React, { forwardRef } from 'react';
6
5
  import { mergeProps, useMenuItem } from 'react-aria';
7
- import { useFocus, useHover, usePress } from '@react-aria/interactions';
6
+ import CheckIcon from '@pingux/mdi-react/CheckIcon';
7
+ import { useFocusRing } from '@react-aria/focus';
8
+ import { useHover, usePress } from '@react-aria/interactions';
8
9
  import { v4 as uuid } from 'uuid';
10
+ import { Icon } from '../..';
9
11
  import { useMenuContext } from '../../context/MenuContext';
10
- import { useLocalOrForwardRef, usePropWarning, useStatusClasses } from '../../hooks';
12
+ import { useGetTheme, useLocalOrForwardRef, usePropWarning, useStatusClasses } from '../../hooks';
11
13
  import Box from '../Box';
12
14
 
13
15
  /**
@@ -20,7 +22,6 @@ var MenuItem = /*#__PURE__*/forwardRef(function (props, ref) {
20
22
  var _item$key;
21
23
  var item = props.item,
22
24
  isPropDisabled = props.isDisabled,
23
- isFocusVisible = props.isFocusVisible,
24
25
  isNotFocusedOnHover = props.isNotFocusedOnHover,
25
26
  className = props.className,
26
27
  state = props.state;
@@ -48,10 +49,6 @@ var MenuItem = /*#__PURE__*/forwardRef(function (props, ref) {
48
49
  closeOnSelect: shouldCloseOnSelect
49
50
  }, state, menuItemRef),
50
51
  menuItemProps = _useMenuItem.menuItemProps;
51
- var _useState = useState(false),
52
- _useState2 = _slicedToArray(_useState, 2),
53
- isFocused = _useState2[0],
54
- setFocused = _useState2[1];
55
52
  var _usePress = usePress({
56
53
  ref: menuItemRef,
57
54
  isDisabled: isDisabled,
@@ -59,34 +56,46 @@ var MenuItem = /*#__PURE__*/forwardRef(function (props, ref) {
59
56
  }),
60
57
  pressProps = _usePress.pressProps,
61
58
  isPressed = _usePress.isPressed;
62
- var _useFocus = useFocus({
63
- onFocusChange: setFocused
64
- }),
65
- focusProps = _useFocus.focusProps;
59
+ var _useFocusRing = useFocusRing(),
60
+ focusProps = _useFocusRing.focusProps,
61
+ isFocusVisible = _useFocusRing.isFocusVisible;
66
62
  var _useHover = useHover({
67
63
  isDisabled: isDisabled
68
64
  }),
69
65
  hoverProps = _useHover.hoverProps,
70
66
  isHovered = _useHover.isHovered;
71
67
  var _useStatusClasses = useStatusClasses(className, {
72
- isFocused: isFocused || isHovered && !isFocusVisible,
68
+ isFocused: isFocusVisible && !isNotFocusedOnHover,
73
69
  isDisabled: isDisabled,
74
70
  isSelected: isSelected,
75
- isPressed: isPressed
71
+ isPressed: isPressed,
72
+ isHovered: isHovered
76
73
  }),
77
74
  classNames = _useStatusClasses.classNames;
78
75
  if (isNotFocusedOnHover) {
79
76
  delete menuItemProps.onPointerEnter;
80
77
  delete menuItemProps.onPointerLeave;
81
78
  }
79
+ var _useGetTheme = useGetTheme(),
80
+ isOnyx = _useGetTheme.themeState.isOnyx;
82
81
  return ___EmotionJSX(Box, _extends({
83
82
  as: "li",
83
+ isRow: true,
84
+ alignItems: "center",
85
+ justifyContent: "space-between",
84
86
  className: classNames,
85
87
  ref: menuItemRef,
86
88
  variant: isSeparator ? 'menuItem.separator' : 'menuItem.item',
87
89
  "data-id": dataId,
88
90
  "aria-disabled": isDisabled
89
- }, mergeProps(pressProps, hoverProps, focusProps, menuItemProps, others)), rendered);
91
+ }, mergeProps(pressProps, hoverProps, focusProps, menuItemProps, others)), rendered, isSelected && isOnyx && ___EmotionJSX(Icon, {
92
+ icon: CheckIcon,
93
+ title: {
94
+ name: 'Check Icon'
95
+ },
96
+ color: "success.bright",
97
+ size: "sm"
98
+ }));
90
99
  });
91
100
  MenuItem.displayName = 'MenuItem';
92
101
  MenuItem.defaultProps = {
@@ -4,7 +4,7 @@ var item = {
4
4
  outline: 'none',
5
5
  cursor: 'pointer',
6
6
  fontFamily: 'standard',
7
- '&.is-focused, &.is-selected, &.is-pressed': {
7
+ '&.is-focused, &.is-selected, &.is-pressed, &.is-hovered': {
8
8
  color: 'white',
9
9
  bg: 'active',
10
10
  '> *': {