@flodesk/grain 11.64.0 → 11.66.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.
Files changed (168) hide show
  1. package/es/components/arrange/index.js +24 -32
  2. package/es/components/autocomplete.js +24 -42
  3. package/es/components/autocomplete2.js +59 -85
  4. package/es/components/badge.js +10 -17
  5. package/es/components/box.js +64 -72
  6. package/es/components/button.js +16 -25
  7. package/es/components/card.js +53 -61
  8. package/es/components/checkbox.js +16 -26
  9. package/es/components/dropdown.js +1 -9
  10. package/es/components/flex/index.js +22 -30
  11. package/es/components/ghost-input.js +12 -24
  12. package/es/components/icon-button.js +14 -22
  13. package/es/components/icon-toggle.js +13 -23
  14. package/es/components/icon.js +9 -16
  15. package/es/components/link.js +8 -15
  16. package/es/components/modal.js +57 -72
  17. package/es/components/nav/index.js +29 -41
  18. package/es/components/pagination.js +15 -34
  19. package/es/components/popover.js +18 -25
  20. package/es/components/progress.js +9 -19
  21. package/es/components/radio.js +16 -26
  22. package/es/components/select.js +30 -59
  23. package/es/components/slider.js +13 -24
  24. package/es/components/spinner.js +8 -17
  25. package/es/components/stack.js +7 -14
  26. package/es/components/switch.js +11 -19
  27. package/es/components/tab.js +14 -23
  28. package/es/components/text/index.js +28 -38
  29. package/es/components/text-button.js +14 -23
  30. package/es/components/text-input.js +30 -43
  31. package/es/components/text-toggle.js +14 -23
  32. package/es/components/textarea.js +18 -30
  33. package/es/components/toast.js +1 -9
  34. package/es/components/tooltip.js +22 -37
  35. package/es/foundational/field.js +27 -38
  36. package/es/foundational/menu.js +33 -47
  37. package/es/hooks/useKeyPress.js +0 -5
  38. package/es/hooks/useMedia.js +0 -2
  39. package/es/hooks/useOnClickOutside.js +0 -1
  40. package/es/hooks/useWindowSize.js +0 -1
  41. package/es/icons/icon-align-center.js +1 -4
  42. package/es/icons/icon-align-left.js +1 -4
  43. package/es/icons/icon-align-right.js +1 -4
  44. package/es/icons/icon-apple.js +1 -4
  45. package/es/icons/icon-archive.js +1 -4
  46. package/es/icons/icon-arrow-down.js +1 -4
  47. package/es/icons/icon-arrow-left.js +1 -4
  48. package/es/icons/icon-arrow-right.js +1 -4
  49. package/es/icons/icon-arrow-up.js +1 -4
  50. package/es/icons/icon-at.js +1 -4
  51. package/es/icons/icon-bag.js +1 -4
  52. package/es/icons/icon-ball.js +1 -4
  53. package/es/icons/icon-bold.js +1 -4
  54. package/es/icons/icon-bolt-filled.js +1 -4
  55. package/es/icons/icon-bolt.js +1 -4
  56. package/es/icons/icon-branching.js +1 -4
  57. package/es/icons/icon-browser.js +1 -4
  58. package/es/icons/icon-bullet-list.js +1 -4
  59. package/es/icons/icon-car.js +1 -4
  60. package/es/icons/icon-chart.js +1 -4
  61. package/es/icons/icon-check.js +1 -4
  62. package/es/icons/icon-chevron-down.js +1 -4
  63. package/es/icons/icon-chevron-horizontal.js +1 -4
  64. package/es/icons/icon-chevron-left.js +1 -4
  65. package/es/icons/icon-chevron-right.js +1 -4
  66. package/es/icons/icon-chevron-up.js +1 -4
  67. package/es/icons/icon-chevron-vertical.js +1 -4
  68. package/es/icons/icon-clip.js +1 -4
  69. package/es/icons/icon-clock.js +1 -4
  70. package/es/icons/icon-column-and-rows.js +1 -4
  71. package/es/icons/icon-column-one.js +1 -4
  72. package/es/icons/icon-column-two.js +1 -4
  73. package/es/icons/icon-columns-and-row.js +1 -4
  74. package/es/icons/icon-columns.js +1 -4
  75. package/es/icons/icon-content-align-bottom.js +1 -4
  76. package/es/icons/icon-content-align-center.js +1 -4
  77. package/es/icons/icon-content-align-top.js +1 -4
  78. package/es/icons/icon-crop.js +1 -4
  79. package/es/icons/icon-cross.js +1 -4
  80. package/es/icons/icon-diamond.js +13 -0
  81. package/es/icons/icon-dog.js +1 -4
  82. package/es/icons/icon-download.js +1 -4
  83. package/es/icons/icon-drag.js +1 -4
  84. package/es/icons/icon-duplicate.js +1 -4
  85. package/es/icons/icon-ellipsis.js +1 -4
  86. package/es/icons/icon-exit.js +1 -4
  87. package/es/icons/icon-file.js +1 -4
  88. package/es/icons/icon-flag.js +1 -4
  89. package/es/icons/icon-folder-add.js +1 -4
  90. package/es/icons/icon-folder-move.js +1 -4
  91. package/es/icons/icon-folder-remove.js +1 -4
  92. package/es/icons/icon-folder.js +1 -4
  93. package/es/icons/icon-footer.js +1 -4
  94. package/es/icons/icon-gallery.js +1 -4
  95. package/es/icons/icon-gear.js +1 -4
  96. package/es/icons/icon-globe.js +1 -4
  97. package/es/icons/icon-grid.js +1 -4
  98. package/es/icons/icon-heart.js +1 -4
  99. package/es/icons/icon-hide.js +1 -4
  100. package/es/icons/icon-image.js +1 -4
  101. package/es/icons/icon-info.js +1 -4
  102. package/es/icons/icon-italic.js +1 -4
  103. package/es/icons/icon-layout-text-bottom.js +1 -4
  104. package/es/icons/icon-layout-text-left.js +1 -4
  105. package/es/icons/icon-layout-text-right.js +1 -4
  106. package/es/icons/icon-layout-text-top.js +1 -4
  107. package/es/icons/icon-letter-list.js +1 -4
  108. package/es/icons/icon-line-dashed.js +1 -4
  109. package/es/icons/icon-line.js +1 -4
  110. package/es/icons/icon-link.js +1 -4
  111. package/es/icons/icon-list.js +1 -4
  112. package/es/icons/icon-location.js +1 -4
  113. package/es/icons/icon-logo-instagram.js +1 -4
  114. package/es/icons/icon-mail.js +1 -4
  115. package/es/icons/icon-minus.js +1 -4
  116. package/es/icons/icon-monitor.js +1 -4
  117. package/es/icons/icon-network.js +1 -4
  118. package/es/icons/icon-number-list.js +1 -4
  119. package/es/icons/icon-pencil-ai.js +1 -4
  120. package/es/icons/icon-pencil.js +1 -4
  121. package/es/icons/icon-phone.js +1 -4
  122. package/es/icons/icon-play.js +1 -4
  123. package/es/icons/icon-plus.js +1 -4
  124. package/es/icons/icon-push-button.js +1 -4
  125. package/es/icons/icon-qr.js +1 -4
  126. package/es/icons/icon-question.js +1 -4
  127. package/es/icons/icon-redo.js +1 -4
  128. package/es/icons/icon-reset.js +1 -4
  129. package/es/icons/icon-row-and-columns.js +1 -4
  130. package/es/icons/icon-rows-and-column.js +1 -4
  131. package/es/icons/icon-rows.js +1 -4
  132. package/es/icons/icon-search.js +1 -4
  133. package/es/icons/icon-send.js +1 -4
  134. package/es/icons/icon-share.js +1 -4
  135. package/es/icons/icon-show.js +1 -4
  136. package/es/icons/icon-smile.js +1 -4
  137. package/es/icons/icon-spacer.js +1 -4
  138. package/es/icons/icon-square.js +1 -4
  139. package/es/icons/icon-star.js +13 -0
  140. package/es/icons/icon-stopwatch.js +1 -4
  141. package/es/icons/icon-strike.js +1 -4
  142. package/es/icons/icon-switch.js +1 -4
  143. package/es/icons/icon-symbols.js +1 -4
  144. package/es/icons/icon-tablet.js +1 -4
  145. package/es/icons/icon-text-align-center.js +1 -4
  146. package/es/icons/icon-text-align-left.js +1 -4
  147. package/es/icons/icon-text-align-right.js +1 -4
  148. package/es/icons/icon-text-justify.js +1 -4
  149. package/es/icons/icon-text.js +1 -4
  150. package/es/icons/icon-three-branches.js +1 -4
  151. package/es/icons/icon-trash.js +1 -4
  152. package/es/icons/icon-two-branches.js +1 -4
  153. package/es/icons/icon-type.js +1 -4
  154. package/es/icons/icon-underline.js +1 -4
  155. package/es/icons/icon-undo.js +1 -4
  156. package/es/icons/icon-upload.js +1 -4
  157. package/es/icons/index.js +3 -1
  158. package/es/styles/card.js +31 -19
  159. package/es/styles/utilities.js +0 -4
  160. package/es/styles/variables.js +1 -1
  161. package/es/types/components/modal.d.ts +2 -1
  162. package/es/types/components/text.d.ts +1 -1
  163. package/es/utilities/attributes.js +2 -7
  164. package/es/utilities/responsive.js +0 -14
  165. package/es/utilities/style-config.js +0 -3
  166. package/es/utilities/styles.js +0 -7
  167. package/es/variables/vars.js +6 -6
  168. package/package.json +1 -1
@@ -1,21 +1,16 @@
1
+ import "core-js/modules/es.symbol.description.js";
1
2
  const _excluded = ["children", "gap", "columnGap", "rowGap", "alignItems", "justifyItems", "justifyContent", "alignContent", "columns", "rows", "autoFlow", "className", "style"];
2
-
3
- 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); }
4
-
3
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
5
4
  import "core-js/modules/es.regexp.exec.js";
6
5
  import "core-js/modules/es.string.replace.js";
7
6
  import "core-js/modules/es.string.trim.js";
8
-
9
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
-
11
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
12
-
13
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
14
-
15
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
16
-
17
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
18
-
7
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
8
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
10
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
11
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
12
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
13
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
19
14
  import { generateAttributes } from '../../utilities';
20
15
  import React, { forwardRef, useContext } from 'react';
21
16
  import { types } from '../../types';
@@ -25,22 +20,21 @@ import { BreakpointsContext } from '../breakpoints-provider';
25
20
  import { jsx as ___EmotionJSX } from "@emotion/react";
26
21
  export const Arrange = /*#__PURE__*/forwardRef(function Arrange(_ref, ref) {
27
22
  let {
28
- children,
29
- gap,
30
- columnGap,
31
- rowGap,
32
- alignItems = 'center',
33
- justifyItems,
34
- justifyContent = 'start',
35
- alignContent,
36
- columns,
37
- rows,
38
- autoFlow = 'column',
39
- className,
40
- style
41
- } = _ref,
42
- props = _objectWithoutProperties(_ref, _excluded);
43
-
23
+ children,
24
+ gap,
25
+ columnGap,
26
+ rowGap,
27
+ alignItems = 'center',
28
+ justifyItems,
29
+ justifyContent = 'start',
30
+ alignContent,
31
+ columns,
32
+ rows,
33
+ autoFlow = 'column',
34
+ className,
35
+ style
36
+ } = _ref,
37
+ props = _objectWithoutProperties(_ref, _excluded);
44
38
  const propClassName = className ? className : '';
45
39
  const propStyle = style ? style : {};
46
40
  const breakpoints = useContext(BreakpointsContext);
@@ -62,9 +56,7 @@ export const Arrange = /*#__PURE__*/forwardRef(function Arrange(_ref, ref) {
62
56
  classNameProps: _objectSpread({}, sharedProps),
63
57
  breakpoints
64
58
  });
65
-
66
59
  const styleAttributes = _objectSpread(_objectSpread({}, attributes.styles), propStyle);
67
-
68
60
  const classAttributes = "".concat(attributes.classNames, " ").concat(propClassName, " ").concat(styles.arrange).trim().replace(/\s+/g, ' ');
69
61
  return ___EmotionJSX(Box, _extends({
70
62
  ref: ref,
@@ -1,12 +1,8 @@
1
1
  const _excluded = ["options", "value", "onChange", "isCreatable", "onCreate", "menuPlacement", "menuWidth", "menuMaxHeight", "menuZIndex", "placeholder", "label", "hint", "menuItemsHaveEllipsis", "hasPortal", "hasError", "errorMessage", "searchField", "backgroundColor", "onClear"];
2
2
  import "core-js/modules/web.dom-collections.iterator.js";
3
-
4
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
5
-
6
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
7
-
8
- 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); }
9
-
3
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
4
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
5
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
10
6
  import PropTypes from 'prop-types';
11
7
  import React, { forwardRef, Fragment, useMemo, useRef, useState } from 'react';
12
8
  import { Icon, Box, Text, Arrange } from '.';
@@ -27,14 +23,12 @@ const Trigger = /*#__PURE__*/forwardRef(function Trigger(_ref, ref) {
27
23
  position: "relative"
28
24
  }));
29
25
  });
30
-
31
26
  const EmptyState = () => ___EmotionJSX(Box, {
32
27
  paddingY: "s",
33
28
  paddingX: "12px"
34
29
  }, ___EmotionJSX(Text, {
35
30
  color: "content2"
36
31
  }, "No results"));
37
-
38
32
  const ActionsSection = _ref2 => {
39
33
  let {
40
34
  children
@@ -49,73 +43,62 @@ const ActionsSection = _ref2 => {
49
43
  height: "100%"
50
44
  }, children);
51
45
  };
52
-
53
46
  const ClearButton = _ref3 => {
54
47
  let {
55
48
  onClick
56
49
  } = _ref3;
57
-
58
50
  const handleClear = e => {
59
51
  e.stopPropagation();
60
52
  onClick();
61
53
  };
62
-
63
54
  return ___EmotionJSX(FieldClearButton, {
64
55
  onClick: e => handleClear(e)
65
56
  });
66
57
  };
67
-
68
58
  const getFilteredOptions = (query, options, searchField) => {
69
59
  if (query === '') return options;
70
60
  return options.filter(option => option[searchField].toLowerCase().includes(query.toLowerCase()));
71
61
  };
72
-
73
62
  const getShowGroupTitle = (index, option, filteredOptions) => {
74
63
  const firstOptionHasTitle = index === 0 && option.groupTitle;
75
64
  const titleChanged = index > 0 && option.groupTitle !== filteredOptions[index - 1].groupTitle;
76
65
  return firstOptionHasTitle || titleChanged;
77
66
  };
78
-
79
67
  const menuItemStyles = "\n .autocompleteMenuItem {\n display: flex;\n gap: 8px;\n align-items: center;\n list-style: none;\n padding: 4px 12px;\n min-height: var(--grn-textbox-height-m);\n border-radius: ".concat(getRadius('s'), ";\n appearance: none;\n\n &.hasPreContent {\n padding-left: 0;\n }\n }\n\n .autocompleteMenuItemText {\n flex-grow: 1;\n\n &.hasEllipsis {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n");
80
68
  export const Autocomplete = _ref4 => {
81
69
  let {
82
- options,
83
- value,
84
- onChange,
85
- isCreatable,
86
- onCreate,
87
- menuPlacement = defaultProps.menuPlacement,
88
- menuWidth,
89
- menuMaxHeight = defaultProps.menuMaxHeight,
90
- menuZIndex,
91
- placeholder,
92
- label,
93
- hint,
94
- menuItemsHaveEllipsis = true,
95
- hasPortal = true,
96
- hasError,
97
- errorMessage,
98
- searchField = 'content',
99
- backgroundColor,
100
- onClear
101
- } = _ref4,
102
- props = _objectWithoutProperties(_ref4, _excluded);
103
-
70
+ options,
71
+ value,
72
+ onChange,
73
+ isCreatable,
74
+ onCreate,
75
+ menuPlacement = defaultProps.menuPlacement,
76
+ menuWidth,
77
+ menuMaxHeight = defaultProps.menuMaxHeight,
78
+ menuZIndex,
79
+ placeholder,
80
+ label,
81
+ hint,
82
+ menuItemsHaveEllipsis = true,
83
+ hasPortal = true,
84
+ hasError,
85
+ errorMessage,
86
+ searchField = 'content',
87
+ backgroundColor,
88
+ onClear
89
+ } = _ref4,
90
+ props = _objectWithoutProperties(_ref4, _excluded);
104
91
  const [query, setQuery] = useState('');
105
-
106
92
  const handleCreatableChange = option => {
107
93
  if (onCreate) {
108
94
  const isCreatableOption = !options.find(item => item.value === option.value);
109
-
110
95
  if (isCreatableOption) {
111
96
  onCreate(option);
112
97
  return;
113
98
  }
114
99
  }
115
-
116
100
  onChange(option);
117
101
  };
118
-
119
102
  const handleChange = option => {
120
103
  if (isCreatable) {
121
104
  handleCreatableChange(option);
@@ -123,7 +106,6 @@ export const Autocomplete = _ref4 => {
123
106
  onChange(option);
124
107
  }
125
108
  };
126
-
127
109
  const filteredOptions = getFilteredOptions(query, options, searchField);
128
110
  const isShowCreateOption = isCreatable && query.length > 0;
129
111
  const noResults = !Boolean(filteredOptions.length) && !isShowCreateOption;