@pingux/astro 2.163.1-alpha.2 → 2.163.1-alpha.4

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 (50) hide show
  1. package/lib/cjs/components/LinkSelectField/LinkSelectField.js +7 -3
  2. package/lib/cjs/components/LinkSelectField/LinkSelectField.stories.js +20 -1
  3. package/lib/cjs/components/MenuItem/MenuItem.js +22 -13
  4. package/lib/cjs/components/MenuItem/MenuItem.styles.d.ts +1 -1
  5. package/lib/cjs/components/MenuItem/MenuItem.styles.js +1 -1
  6. package/lib/cjs/components/MenuItem/MenuItem.test.js +217 -194
  7. package/lib/cjs/components/MenuSection/MenuSection.js +2 -1
  8. package/lib/cjs/components/PopoverMenu/PopoverMenu.stories.js +57 -33
  9. package/lib/cjs/hooks/useGetTheme/useGetTheme.d.ts +4 -0
  10. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/colors.d.ts +3 -0
  11. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/colors.js +3 -0
  12. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/customProperties/icons.d.ts +1 -0
  13. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/customProperties/index.d.ts +2 -0
  14. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/menu.d.ts +15 -2
  15. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/menu.js +20 -7
  16. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.d.ts +15 -2
  17. package/lib/cjs/styles/themeOverrides/onyxSideNav.d.ts +1 -0
  18. package/lib/cjs/styles/themes/astro/customProperties/icons.d.ts +1 -0
  19. package/lib/cjs/styles/themes/astro/customProperties/icons.js +1 -1
  20. package/lib/cjs/styles/themes/astro/customProperties/index.d.ts +2 -0
  21. package/lib/cjs/styles/themes/astro/customProperties/index.js +3 -1
  22. package/lib/cjs/styles/themes/next-gen/customProperties/icons.d.ts +1 -0
  23. package/lib/cjs/styles/themes/next-gen/customProperties/icons.js +1 -1
  24. package/lib/cjs/styles/themes/next-gen/customProperties/index.d.ts +2 -0
  25. package/lib/cjs/styles/themes/next-gen/customProperties/index.js +3 -1
  26. package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +34 -2
  27. package/lib/cjs/styles/themes/next-gen/variants/menu.d.ts +32 -2
  28. package/lib/cjs/styles/themes/next-gen/variants/menu.js +39 -9
  29. package/lib/cjs/styles/themes/next-gen/variants/popoverMenu.d.ts +1 -0
  30. package/lib/cjs/styles/themes/next-gen/variants/popoverMenu.js +1 -0
  31. package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +33 -2
  32. package/lib/cjs/styles/themes/next-gen/variants/variants.js +1 -0
  33. package/lib/components/LinkSelectField/LinkSelectField.js +7 -3
  34. package/lib/components/LinkSelectField/LinkSelectField.stories.js +19 -0
  35. package/lib/components/MenuItem/MenuItem.js +25 -16
  36. package/lib/components/MenuItem/MenuItem.styles.js +1 -1
  37. package/lib/components/MenuItem/MenuItem.test.js +224 -201
  38. package/lib/components/MenuSection/MenuSection.js +2 -1
  39. package/lib/components/PopoverMenu/PopoverMenu.stories.js +57 -33
  40. package/lib/styles/themeOverrides/nextGenDarkMode/colors.js +3 -0
  41. package/lib/styles/themeOverrides/nextGenDarkMode/variants/menu.js +20 -7
  42. package/lib/styles/themes/astro/customProperties/icons.js +1 -1
  43. package/lib/styles/themes/astro/customProperties/index.js +3 -1
  44. package/lib/styles/themes/next-gen/customProperties/icons.js +1 -1
  45. package/lib/styles/themes/next-gen/customProperties/index.js +3 -1
  46. package/lib/styles/themes/next-gen/variants/menu.js +38 -8
  47. package/lib/styles/themes/next-gen/variants/popoverMenu.js +1 -0
  48. package/lib/styles/themes/next-gen/variants/variants.js +2 -1
  49. package/lib/tsconfig.lib.tsbuildinfo +1 -1
  50. package/package.json +1 -1
@@ -2162,6 +2162,7 @@ declare const _default: {
2162
2162
  daVinci: import("@pingux/mdi-react").MdiReactIconComponentType;
2163
2163
  DefaultCircle: import("@pingux/mdi-react").MdiReactIconComponentType;
2164
2164
  Descending: import("@pingux/mdi-react").MdiReactIconComponentType;
2165
+ popoverMenuIcon: import("@pingux/mdi-react").MdiReactIconComponentType;
2165
2166
  ErrorCircle: import("@pingux/mdi-react").MdiReactIconComponentType;
2166
2167
  integrationsIcon: import("@pingux/mdi-react").MdiReactIconComponentType;
2167
2168
  listViewMenu: import("@pingux/mdi-react").MdiReactIconComponentType;
@@ -4631,23 +4632,53 @@ declare const _default: {
4631
4632
  padding: string;
4632
4633
  outline: string;
4633
4634
  color: string;
4635
+ fontSize: string;
4636
+ lineHeight: string;
4634
4637
  cursor: string;
4635
- '&.is-focused, &.is-selected, &.is-pressed': {
4638
+ borderRadius: string;
4639
+ '&.is-hovered': {
4636
4640
  bg: string;
4637
4641
  color: string;
4638
4642
  '> *': {
4639
4643
  color: string;
4640
4644
  };
4641
4645
  };
4642
- '&.is-pressed': {
4646
+ '&.is-focused': {
4647
+ bg: string;
4643
4648
  color: string;
4649
+ outline: string;
4650
+ outlineOffset: string;
4651
+ outlineColor: string;
4652
+ '> *': {
4653
+ color: string;
4654
+ };
4655
+ };
4656
+ '&.is-pressed, &.is-selected': {
4644
4657
  bg: string;
4658
+ color: string;
4659
+ '> *': {
4660
+ color: string;
4661
+ };
4645
4662
  };
4646
4663
  };
4647
4664
  separator: {
4648
4665
  my: string;
4649
4666
  };
4650
4667
  };
4668
+ menuSection: {
4669
+ sectionTitle: {
4670
+ fontWeight: string;
4671
+ fontSize: string;
4672
+ lineHeight: string;
4673
+ textTransform: string;
4674
+ letterSpacing: string;
4675
+ height: string;
4676
+ py: string;
4677
+ px: string;
4678
+ color: string;
4679
+ ml: number;
4680
+ };
4681
+ };
4651
4682
  menuTab: {
4652
4683
  ml: string;
4653
4684
  };
@@ -4964,6 +4995,7 @@ declare const _default: {
4964
4995
  };
4965
4996
  popoverMenu: {
4966
4997
  container: {
4998
+ minWidth: string;
4967
4999
  transition: string;
4968
5000
  '&.animate': {
4969
5001
  opacity: number;
@@ -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,
@@ -31,17 +31,19 @@ var LinkSelectField = /*#__PURE__*/forwardRef(function (props, ref) {
31
31
  isDisabled = props.isDisabled,
32
32
  status = props.status,
33
33
  helperText = props.helperText,
34
- hasInlineLoader = props.hasInlineLoader;
34
+ hasInlineLoader = props.hasInlineLoader,
35
+ popoverWidth = props.popoverWidth;
35
36
  var _getAriaAttributeProp = getAriaAttributeProps(props),
36
37
  ariaProps = _getAriaAttributeProp.ariaProps;
37
38
  var _useGetTheme = useGetTheme(),
39
+ linkSelectFieldWidth = _useGetTheme.linkSelectFieldWidth,
38
40
  themeState = _useGetTheme.themeState;
39
41
  var isOnyx = themeState.isOnyx;
40
42
  var helperTextId = uuid();
41
43
  usePropWarning(props, 'disabled', 'isDisabled');
42
44
  var _useSelectField = useSelectField(_objectSpread(_objectSpread({
43
45
  listboxStyle: {
44
- width: '10em'
46
+ width: popoverWidth || linkSelectFieldWidth
45
47
  }
46
48
  }, props), {}, {
47
49
  // Need this for not applying is-default class
@@ -152,7 +154,9 @@ LinkSelectField.propTypes = _objectSpread(_objectSpread(_objectSpread({
152
154
  */
153
155
  onSelectionChange: PropTypes.func,
154
156
  /** Display an inline loader inside the select trigger while loading. */
155
- hasInlineLoader: PropTypes.bool
157
+ hasInlineLoader: PropTypes.bool,
158
+ /** Width of the popover menu. Accepts any valid CSS unit. */
159
+ popoverWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
156
160
  }, statusPropTypes), inputFieldAttributesBasePropTypes), ariaAttributesBasePropTypes);
157
161
  LinkSelectField.defaultProps = _objectSpread({
158
162
  placeholder: 'Select',
@@ -315,4 +315,23 @@ export var AsyncLoading = function AsyncLoading() {
315
315
  key: item.id
316
316
  }, item.name.given);
317
317
  }));
318
+ };
319
+ export var WithPopoverWidth = function WithPopoverWidth(args) {
320
+ return ___EmotionJSX(OverlayProvider, null, ___EmotionJSX(LinkSelectField, _extends({}, args, {
321
+ width: "100%",
322
+ popoverWidth: "20rem"
323
+ }), ___EmotionJSX(Item, {
324
+ key: "red"
325
+ }, "Red"), ___EmotionJSX(Item, {
326
+ key: "blue"
327
+ }, "Blue"), ___EmotionJSX(Item, {
328
+ key: "yellow"
329
+ }, "Extra long goes here")));
330
+ };
331
+ WithPopoverWidth.parameters = {
332
+ docs: {
333
+ description: {
334
+ story: 'The `popoverWidth` prop can be used to set a custom width for the dropdown/popover.'
335
+ }
336
+ }
318
337
  };
@@ -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
  '> *': {