@flodesk/grain 10.5.5 → 10.5.7

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.
@@ -1,4 +1,7 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
1
3
  import "core-js/modules/es.array.map.js";
4
+ import "core-js/modules/es.object.assign.js";
2
5
  import PropTypes from 'prop-types';
3
6
  import React, { Fragment, useEffect } from 'react';
4
7
  import { Menu } from '@headlessui/react';
@@ -26,6 +29,7 @@ export var Dropdown = function Dropdown(_ref2) {
26
29
  menuWidth = _ref2$menuWidth === void 0 ? '192px' : _ref2$menuWidth,
27
30
  menuZIndex = _ref2.menuZIndex,
28
31
  trigger = _ref2.trigger,
32
+ trigger2 = _ref2.trigger2,
29
33
  _ref2$hasPortal = _ref2.hasPortal,
30
34
  hasPortal = _ref2$hasPortal === void 0 ? true : _ref2$hasPortal,
31
35
  _ref2$onOpenChange = _ref2.onOpenChange,
@@ -66,10 +70,10 @@ export var Dropdown = function Dropdown(_ref2) {
66
70
  return ___EmotionJSX(Root, {
67
71
  open: open,
68
72
  onOpenChange: onOpenChange
69
- }, ___EmotionJSX(Menu.Button, {
73
+ }, trigger && ___EmotionJSX(Menu.Button, {
70
74
  as: Fragment,
71
75
  ref: reference
72
- }, trigger), ___EmotionJSX(ItemsRoot, null, ___EmotionJSX(MenuCardTransition, null, ___EmotionJSX(Menu.Items, {
76
+ }, trigger), trigger2 && trigger2(reference), ___EmotionJSX(ItemsRoot, null, ___EmotionJSX(MenuCardTransition, null, ___EmotionJSX(Menu.Items, {
73
77
  static: true,
74
78
  className: "grn-context",
75
79
  ref: floating,
@@ -93,20 +97,22 @@ export var Dropdown = function Dropdown(_ref2) {
93
97
  key: index
94
98
  }, function (_ref4) {
95
99
  var active = _ref4.active;
96
- return ___EmotionJSX(MenuItem, {
100
+ return ___EmotionJSX(MenuItem, _extends({
97
101
  icon: option.icon,
98
102
  isActive: active,
99
103
  onClick: handleMenuItemClick(option),
100
104
  variant: option.variant,
101
105
  hasEllipsis: true,
102
106
  checkVariant: "none"
103
- }, option.content);
107
+ }, option), option.content);
104
108
  });
105
109
  })))));
106
110
  });
107
111
  };
112
+ Dropdown.Trigger = Menu.Button;
108
113
  Dropdown.propTypes = {
109
- trigger: PropTypes.node.isRequired,
114
+ trigger: PropTypes.node,
115
+ trigger2: PropTypes.func,
110
116
  options: PropTypes.array.isRequired,
111
117
  menuPlacement: types.menuPlacement,
112
118
  menuWidth: types.dimension,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flodesk/grain",
3
- "version": "10.5.5",
3
+ "version": "10.5.7",
4
4
  "description": "Flodesk design system",
5
5
  "module": "es/index.js",
6
6
  "author": "Flodesk",