@flodesk/grain 6.12.0 → 6.12.2
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/es/components/dropdown.js +12 -27
- package/es/hooks/index.js +5 -5
- package/es/hooks/useMedia.js +1 -0
- package/es/index.js +2 -1
- package/es/types.js +5 -2
- package/package.json +1 -1
|
@@ -1,33 +1,20 @@
|
|
|
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
|
-
|
|
3
|
-
import "core-js/modules/es.object.assign.js";
|
|
4
1
|
import "core-js/modules/es.array.map.js";
|
|
5
2
|
import PropTypes from 'prop-types';
|
|
6
3
|
import React, { Fragment } from 'react';
|
|
7
|
-
import { Box } from '.';
|
|
8
4
|
import { Menu } from '@headlessui/react';
|
|
9
5
|
import { types } from '../types';
|
|
10
6
|
import { MenuCard, MenuItem } from '../foundational';
|
|
11
7
|
import { useMenuPosition } from '../foundational/menu';
|
|
12
8
|
import { FloatingPortal } from '@floating-ui/react-dom-interactions';
|
|
13
9
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
14
|
-
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export var Dropdown = function Dropdown(_ref2) {
|
|
24
|
-
var options = _ref2.options,
|
|
25
|
-
_ref2$menuPlacement = _ref2.menuPlacement,
|
|
26
|
-
menuPlacement = _ref2$menuPlacement === void 0 ? 'bottomStart' : _ref2$menuPlacement,
|
|
27
|
-
_ref2$menuWidth = _ref2.menuWidth,
|
|
28
|
-
menuWidth = _ref2$menuWidth === void 0 ? '192px' : _ref2$menuWidth,
|
|
29
|
-
menuZIndex = _ref2.menuZIndex,
|
|
30
|
-
trigger = _ref2.trigger;
|
|
10
|
+
export var Dropdown = function Dropdown(_ref) {
|
|
11
|
+
var options = _ref.options,
|
|
12
|
+
_ref$menuPlacement = _ref.menuPlacement,
|
|
13
|
+
menuPlacement = _ref$menuPlacement === void 0 ? 'bottomStart' : _ref$menuPlacement,
|
|
14
|
+
_ref$menuWidth = _ref.menuWidth,
|
|
15
|
+
menuWidth = _ref$menuWidth === void 0 ? '192px' : _ref$menuWidth,
|
|
16
|
+
menuZIndex = _ref.menuZIndex,
|
|
17
|
+
trigger = _ref.trigger;
|
|
31
18
|
|
|
32
19
|
var _useMenuPosition = useMenuPosition({
|
|
33
20
|
menuWidth: menuWidth,
|
|
@@ -37,10 +24,8 @@ export var Dropdown = function Dropdown(_ref2) {
|
|
|
37
24
|
floating = _useMenuPosition.floating,
|
|
38
25
|
floatingStyles = _useMenuPosition.floatingStyles;
|
|
39
26
|
|
|
40
|
-
return ___EmotionJSX(Menu, {
|
|
41
|
-
|
|
42
|
-
}, function (_ref3) {
|
|
43
|
-
var open = _ref3.open;
|
|
27
|
+
return ___EmotionJSX(Menu, null, function (_ref2) {
|
|
28
|
+
var open = _ref2.open;
|
|
44
29
|
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Menu.Button, {
|
|
45
30
|
as: Fragment,
|
|
46
31
|
ref: reference
|
|
@@ -56,8 +41,8 @@ export var Dropdown = function Dropdown(_ref2) {
|
|
|
56
41
|
}, options.map(function (option, index) {
|
|
57
42
|
return ___EmotionJSX(Menu.Item, {
|
|
58
43
|
key: index
|
|
59
|
-
}, function (
|
|
60
|
-
var active =
|
|
44
|
+
}, function (_ref3) {
|
|
45
|
+
var active = _ref3.active;
|
|
61
46
|
return ___EmotionJSX(MenuItem, {
|
|
62
47
|
icon: option.icon,
|
|
63
48
|
isActive: active,
|
package/es/hooks/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
1
|
+
export * from './useMedia';
|
|
2
|
+
export * from './useKeyPress';
|
|
3
|
+
export * from './useOnClickOutside';
|
|
4
|
+
export * from './useWindowSize';
|
|
5
|
+
export * from './useWidth';
|
package/es/hooks/useMedia.js
CHANGED
|
@@ -23,6 +23,7 @@ import "core-js/modules/web.dom-collections.iterator.js";
|
|
|
23
23
|
import "core-js/modules/es.array.slice.js";
|
|
24
24
|
import "core-js/modules/es.array.from.js";
|
|
25
25
|
import "core-js/modules/es.regexp.exec.js";
|
|
26
|
+
import { useEffect, useState } from 'react';
|
|
26
27
|
export function useMedia(queries, values, defaultValue) {
|
|
27
28
|
var mediaQueryLists = queries.map(function (q) {
|
|
28
29
|
return window.matchMedia(q);
|
package/es/index.js
CHANGED
package/es/types.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import "core-js/modules/es.array.concat.js";
|
|
1
2
|
import "core-js/modules/es.object.keys.js";
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
import { vars } from './variables';
|
|
4
|
-
export var
|
|
5
|
+
export var yPlacements = ['top', 'topStart', 'topEnd', 'bottom', 'bottomStart', 'bottomEnd'];
|
|
6
|
+
export var xPlacements = ['right', 'rightStart', 'rightEnd', 'left', 'leftStart', 'leftEnd'];
|
|
7
|
+
export var placements = [].concat(yPlacements, xPlacements);
|
|
5
8
|
export var gridContentPositions = ['start', 'end', 'center', 'stretch', 'space-around', 'space-between', 'space-evenly'];
|
|
6
9
|
export var gridItemsAlignments = ['start', 'end', 'center', 'stretch'];
|
|
7
10
|
export var autoFlows = ['column', 'row'];
|
|
@@ -31,7 +34,7 @@ export var types = {
|
|
|
31
34
|
clearButtonVariant: PropTypes.oneOf(['neutral', 'danger']),
|
|
32
35
|
buttonVariant: PropTypes.oneOf(['neutral', 'accent', 'danger']),
|
|
33
36
|
iconPosition: PropTypes.oneOf(['left', 'right']),
|
|
34
|
-
menuPlacement: PropTypes.oneOf(
|
|
37
|
+
menuPlacement: PropTypes.oneOf(yPlacements),
|
|
35
38
|
placement: PropTypes.oneOf(placements),
|
|
36
39
|
textInput: PropTypes.oneOf(['text', 'password', 'email', 'date', 'datetime-local', 'email', 'month', 'number', 'password', 'search', 'tel', 'time', 'url', 'week']),
|
|
37
40
|
buttonType: PropTypes.oneOf(['button', 'submit', 'reset']),
|