grommet 2.25.3 → 2.27.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 (160) hide show
  1. package/all/stories/AllComponents.js +19 -126
  2. package/components/Accordion/stories/CustomHeader.js +3 -1
  3. package/components/Avatar/Avatar.js +22 -9
  4. package/components/Box/stories/BackgroundThemed.js +54 -0
  5. package/components/Box/stories/CustomThemed/ThemedBackground.tsx +176 -0
  6. package/components/Calendar/Calendar.js +2 -1
  7. package/components/CheckBox/StyledCheckBox.js +9 -5
  8. package/components/CheckBoxGroup/CheckBoxGroup.js +3 -2
  9. package/components/CheckBoxGroup/index.d.ts +2 -1
  10. package/components/CheckBoxGroup/propTypes.js +1 -0
  11. package/components/DataChart/Detail.js +3 -1
  12. package/components/DataTable/index.d.ts +6 -6
  13. package/components/DateInput/DateInput.js +1 -1
  14. package/components/Diagram/Diagram.js +2 -1
  15. package/components/Drop/stories/Inline.js +1 -1
  16. package/components/Drop/stories/Overflow.js +1 -1
  17. package/components/Drop/stories/Plain.js +1 -1
  18. package/components/Drop/stories/Simple.js +1 -1
  19. package/components/Drop/stories/Styled.js +1 -1
  20. package/components/FormField/FormField.js +1 -1
  21. package/components/Heading/Heading.js +31 -2
  22. package/components/Heading/StyledHeading.js +1 -1
  23. package/components/Heading/index.d.ts +1 -0
  24. package/components/Heading/propTypes.js +1 -0
  25. package/components/Heading/stories/All.js +4 -1
  26. package/components/List/List.js +125 -41
  27. package/components/List/index.d.ts +1 -0
  28. package/components/List/propTypes.js +1 -0
  29. package/components/List/stories/Order.js +1 -0
  30. package/components/List/stories/Pinned.js +37 -0
  31. package/components/List/stories/Selection.js +1 -0
  32. package/components/List/stories/onClickItem.js +1 -0
  33. package/components/Notification/Notification.js +2 -2
  34. package/components/Notification/index.d.ts +1 -1
  35. package/components/Notification/propTypes.js +1 -1
  36. package/components/Notification/stories/CustomThemed/ThemedNotification.tsx +2 -2
  37. package/components/RadioButton/README.md +1 -279
  38. package/components/RadioButton/RadioButton.js +1 -0
  39. package/components/Select/DefaultSelectTextInput.js +43 -0
  40. package/components/Select/EmptySearchOption.js +34 -0
  41. package/components/Select/Select.js +38 -99
  42. package/components/Select/SelectContainer.js +20 -60
  43. package/components/Select/StyledSelect.js +58 -2
  44. package/components/Select/index.d.ts +11 -9
  45. package/components/Select/propTypes.js +44 -40
  46. package/components/Select/utils.js +129 -3
  47. package/components/SelectMultiple/README.md +2 -0
  48. package/components/SelectMultiple/SelectMultiple.js +476 -0
  49. package/components/SelectMultiple/SelectMultipleContainer.js +483 -0
  50. package/components/SelectMultiple/SelectMultipleValue.js +163 -0
  51. package/components/SelectMultiple/SelectionSummary.js +104 -0
  52. package/components/SelectMultiple/index.d.ts +21 -0
  53. package/components/SelectMultiple/index.js +8 -0
  54. package/components/SelectMultiple/propTypes.js +28 -0
  55. package/components/SelectMultiple/stories/Default.js +76 -0
  56. package/components/SelectMultiple/stories/Disabled.js +84 -0
  57. package/components/SelectMultiple/stories/FormField.js +66 -0
  58. package/components/SelectMultiple/stories/Limited.js +68 -0
  59. package/components/SelectMultiple/stories/LongList.js +76 -0
  60. package/components/SelectMultiple/stories/ObjectOptions.js +104 -0
  61. package/components/SelectMultiple/stories/ShowSelectedInline.js +76 -0
  62. package/components/SelectMultiple/stories/typescript/Children.tsx +106 -0
  63. package/components/Sidebar/stories/Labels.js +4 -1
  64. package/components/TextArea/stories/NonResizable.js +1 -0
  65. package/components/TextArea/stories/Simple.js +1 -0
  66. package/components/index.d.ts +1 -0
  67. package/components/index.js +8 -0
  68. package/es6/all/stories/AllComponents.js +21 -121
  69. package/es6/components/Accordion/stories/CustomHeader.js +3 -1
  70. package/es6/components/Avatar/Avatar.js +21 -9
  71. package/es6/components/Box/stories/BackgroundThemed.js +39 -0
  72. package/es6/components/Box/stories/CustomThemed/ThemedBackground.tsx +176 -0
  73. package/es6/components/Calendar/Calendar.js +2 -1
  74. package/es6/components/CheckBox/StyledCheckBox.js +9 -5
  75. package/es6/components/CheckBoxGroup/CheckBoxGroup.js +3 -2
  76. package/es6/components/CheckBoxGroup/index.d.ts +2 -1
  77. package/es6/components/CheckBoxGroup/propTypes.js +1 -0
  78. package/es6/components/DataChart/Detail.js +3 -1
  79. package/es6/components/DataTable/index.d.ts +6 -6
  80. package/es6/components/DateInput/DateInput.js +1 -1
  81. package/es6/components/Diagram/Diagram.js +2 -1
  82. package/es6/components/Drop/stories/Inline.js +1 -1
  83. package/es6/components/Drop/stories/Overflow.js +1 -1
  84. package/es6/components/Drop/stories/Plain.js +1 -1
  85. package/es6/components/Drop/stories/Simple.js +1 -1
  86. package/es6/components/Drop/stories/Styled.js +1 -1
  87. package/es6/components/FormField/FormField.js +1 -1
  88. package/es6/components/Heading/Heading.js +30 -3
  89. package/es6/components/Heading/StyledHeading.js +1 -1
  90. package/es6/components/Heading/index.d.ts +1 -0
  91. package/es6/components/Heading/propTypes.js +1 -0
  92. package/es6/components/Heading/stories/All.js +4 -1
  93. package/es6/components/List/List.js +126 -42
  94. package/es6/components/List/index.d.ts +1 -0
  95. package/es6/components/List/propTypes.js +1 -0
  96. package/es6/components/List/stories/Order.js +1 -0
  97. package/es6/components/List/stories/Pinned.js +22 -0
  98. package/es6/components/List/stories/Selection.js +1 -0
  99. package/es6/components/List/stories/onClickItem.js +1 -0
  100. package/es6/components/Notification/Notification.js +2 -2
  101. package/es6/components/Notification/index.d.ts +1 -1
  102. package/es6/components/Notification/propTypes.js +1 -1
  103. package/es6/components/Notification/stories/CustomThemed/ThemedNotification.tsx +2 -2
  104. package/es6/components/RadioButton/README.md +1 -279
  105. package/es6/components/RadioButton/RadioButton.js +1 -0
  106. package/es6/components/Select/DefaultSelectTextInput.js +31 -0
  107. package/es6/components/Select/EmptySearchOption.js +21 -0
  108. package/es6/components/Select/Select.js +34 -93
  109. package/es6/components/Select/SelectContainer.js +20 -59
  110. package/es6/components/Select/StyledSelect.js +45 -1
  111. package/es6/components/Select/index.d.ts +11 -9
  112. package/es6/components/Select/propTypes.js +41 -39
  113. package/es6/components/Select/utils.js +95 -1
  114. package/es6/components/SelectMultiple/README.md +2 -0
  115. package/es6/components/SelectMultiple/SelectMultiple.js +447 -0
  116. package/es6/components/SelectMultiple/SelectMultipleContainer.js +455 -0
  117. package/es6/components/SelectMultiple/SelectMultipleValue.js +149 -0
  118. package/es6/components/SelectMultiple/SelectionSummary.js +91 -0
  119. package/es6/components/SelectMultiple/index.d.ts +21 -0
  120. package/es6/components/SelectMultiple/index.js +1 -0
  121. package/es6/components/SelectMultiple/propTypes.js +18 -0
  122. package/es6/components/SelectMultiple/stories/Default.js +60 -0
  123. package/es6/components/SelectMultiple/stories/Disabled.js +68 -0
  124. package/es6/components/SelectMultiple/stories/FormField.js +50 -0
  125. package/es6/components/SelectMultiple/stories/Limited.js +53 -0
  126. package/es6/components/SelectMultiple/stories/LongList.js +63 -0
  127. package/es6/components/SelectMultiple/stories/ObjectOptions.js +88 -0
  128. package/es6/components/SelectMultiple/stories/ShowSelectedInline.js +61 -0
  129. package/es6/components/SelectMultiple/stories/typescript/Children.tsx +106 -0
  130. package/es6/components/Sidebar/stories/Labels.js +4 -1
  131. package/es6/components/TextArea/stories/NonResizable.js +1 -0
  132. package/es6/components/TextArea/stories/Simple.js +1 -0
  133. package/es6/components/index.d.ts +1 -0
  134. package/es6/components/index.js +1 -0
  135. package/es6/index.d.ts +1 -0
  136. package/es6/themes/base.d.ts +16 -5
  137. package/es6/themes/base.js +60 -39
  138. package/es6/themes/grommet.js +15 -0
  139. package/es6/themes/hacktoberfest2022.js +129 -0
  140. package/es6/themes/index.js +2 -1
  141. package/es6/utils/background.js +65 -12
  142. package/es6/utils/general-prop-types.js +2 -0
  143. package/es6/utils/index.d.ts +2 -0
  144. package/es6/utils/styles.js +3 -1
  145. package/grommet.min.js +1 -1
  146. package/grommet.min.js.map +1 -1
  147. package/index.d.ts +1 -0
  148. package/package.json +44 -41
  149. package/themes/base.d.ts +16 -5
  150. package/themes/base.js +61 -39
  151. package/themes/grommet.js +15 -0
  152. package/themes/hacktoberfest2022.js +137 -0
  153. package/themes/index.js +6 -2
  154. package/tools/grommet-babel-preset-es2015.js +1 -12
  155. package/tools/pack.js +1 -94
  156. package/tools/release-stable.js +1 -27
  157. package/utils/background.js +64 -12
  158. package/utils/general-prop-types.js +2 -0
  159. package/utils/index.d.ts +2 -0
  160. package/utils/styles.js +3 -1
@@ -0,0 +1,176 @@
1
+ import React from 'react';
2
+
3
+ import { Grommet, Box, Grid, Text } from 'grommet';
4
+ import { ThemeType } from 'grommet/themes';
5
+
6
+ const myTheme: ThemeType = {
7
+ global: {
8
+ backgrounds: {
9
+ hex: '#555555',
10
+ themeColor: 'accent-1',
11
+ image: `url(https://images.unsplash.com/photo-1583530015497-6cf9ef9c6f0f?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80)`,
12
+ 'dark-light-image': {
13
+ dark: `url(https://images.unsplash.com/photo-1620744209976-74accdabd814?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=687&q=80)`,
14
+ light: `url(https://images.unsplash.com/photo-1646723504943-4b55a30ed655?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1471&q=80)`,
15
+ },
16
+ gradient: `linear-gradient(
17
+ 80deg,
18
+ hsl(41deg 100% 67%) 0%,
19
+ hsl(333deg 100% 70%) 33%,
20
+ hsl(257deg 99% 73%) 67%,
21
+ hsl(173deg 95% 75%) 100%
22
+ );`,
23
+ object: {
24
+ color: 'white',
25
+ image: `url(https://images.unsplash.com/photo-1464820453369-31d2c0b651af?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=80&q=80)`,
26
+ repeat: 'repeat',
27
+ size: '24px',
28
+ opacity: true,
29
+ },
30
+ stack: {
31
+ color: 'light-1',
32
+ image: `url(https://v2.grommet.io/img/stak-hurrah.svg)`,
33
+ },
34
+ },
35
+ },
36
+ };
37
+
38
+ const backgroundSamples = [
39
+ {
40
+ background: '#F8F8F8',
41
+ label: { value: 'hex value', context: 'prop string' },
42
+ },
43
+ { background: 'hex', label: { value: 'hex value', context: 'theme string' } },
44
+ {
45
+ background: 'accent-4',
46
+ label: { value: 'color name', context: 'prop string' },
47
+ },
48
+ {
49
+ background: 'themeColor',
50
+ label: { value: 'color name', context: 'theme string' },
51
+ },
52
+ {
53
+ background: `url(https://images.unsplash.com/photo-1493552832879-f61d5dce6c9e?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80)`,
54
+ label: { value: 'image', context: 'prop string' },
55
+ },
56
+ {
57
+ background: 'image',
58
+ label: { value: 'image', context: 'theme string' },
59
+ },
60
+ {
61
+ background: {
62
+ color: 'light-1',
63
+ },
64
+ label: { value: 'hover', context: 'over me' },
65
+ onClick: () => {},
66
+ hoverIndicator: 'stack',
67
+ },
68
+ {
69
+ background: `linear-gradient(
70
+ 155deg,
71
+ hsl(147deg 100% 72%) 0%,
72
+ hsl(223deg 100% 72%) 50%,
73
+ hsl(299deg 100% 72%) 100%
74
+ );`,
75
+ label: { value: 'gradient', context: 'prop string' },
76
+ },
77
+ {
78
+ background: 'gradient',
79
+ label: { value: 'gradient', context: 'theme string' },
80
+ },
81
+ {
82
+ background: { dark: 'accent-2', light: 'accent-3' },
83
+ label: { value: 'dark-light object', context: 'prop object' },
84
+ },
85
+ {
86
+ background: 'dark-light-image',
87
+ label: { value: 'dark-light object', context: 'theme object' },
88
+ },
89
+ {
90
+ background: {
91
+ image: 'dark-light-image',
92
+ dark: true,
93
+ color: { dark: 'black', light: 'gold' },
94
+ },
95
+ label: { value: 'dark-light object force dark', context: 'theme object' },
96
+ },
97
+ {
98
+ background: {
99
+ color: 'neutral-2',
100
+ image: `url(https://images.unsplash.com/photo-1653023500770-3a3b64a1b4c4?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1632&q=80)`,
101
+ position: 'top-left',
102
+ },
103
+ label: { value: 'object', context: 'prop object' },
104
+ },
105
+ {
106
+ background: 'object',
107
+ label: { value: 'object', context: 'theme object' },
108
+ },
109
+ {
110
+ background: { image: 'gradient', rotate: 180 },
111
+ label: { value: 'rotate', context: 'prop object' },
112
+ },
113
+ {
114
+ background: {
115
+ image: 'gradient',
116
+ rotate: -90,
117
+ clip: 'text',
118
+ },
119
+ label: {
120
+ value: <Text size="xxlarge">clip text</Text>,
121
+ context: <Text size="medium">prop object</Text>,
122
+ },
123
+ },
124
+ {
125
+ background: {
126
+ image: 'image',
127
+ rotate: -90,
128
+ clip: 'text',
129
+ },
130
+ label: {
131
+ value: <Text size="xxlarge">clip text</Text>,
132
+ context: <Text size="medium">prop object</Text>,
133
+ },
134
+ },
135
+ ];
136
+
137
+ const Swatch = ({ label, ...rest }) => (
138
+ <Box fill pad="medium" justify="center" round="small" {...rest}>
139
+ <Text weight="bold" size="large">
140
+ {label.value}
141
+ </Text>
142
+ <Text size="small">{label.context}</Text>
143
+ </Box>
144
+ );
145
+
146
+ export const ThemedBackgrounds = () => (
147
+ // Uncomment <Grommet> lines when using outside of storybook
148
+ <Grommet
149
+ theme={myTheme}
150
+ full
151
+ background={`linear-gradient(
152
+ 155deg,
153
+ hsl(0deg 0% 51%) 0%,
154
+ hsl(0deg 0% 76%) 50%,
155
+ hsl(0deg 0% 100%) 100%
156
+ )`}
157
+ >
158
+ <Grid columns="small" rows="small" gap="small" pad="large">
159
+ {backgroundSamples.map((sample, index) => (
160
+ <Swatch
161
+ // eslint-disable-next-line react/no-array-index-key
162
+ key={index}
163
+ background={sample.background}
164
+ label={sample.label}
165
+ {...sample}
166
+ />
167
+ ))}
168
+ </Grid>
169
+ </Grommet>
170
+ );
171
+
172
+ ThemedBackgrounds.storyName = 'Themed Background';
173
+
174
+ export default {
175
+ title: 'Layout/Box/Custom Themed/Themed Background',
176
+ };
@@ -545,7 +545,8 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref3, ref) {
545
545
  }, /*#__PURE__*/React.createElement(Heading, {
546
546
  level: size === 'small' ? theme.calendar.heading && theme.calendar.heading.level || 4 : (theme.calendar.heading && theme.calendar.heading.level || 4) - 1,
547
547
  size: size,
548
- margin: "none"
548
+ margin: "none",
549
+ overflowWrap: "normal"
549
550
  }, reference.toLocaleDateString(locale, {
550
551
  month: 'long',
551
552
  year: 'numeric'
@@ -9,14 +9,18 @@ var fillStyle = function fillStyle() {
9
9
  };
10
10
 
11
11
  var disabledStyle = "\n opacity: 0.5;\n cursor: default;\n";
12
- var hoverStyle = css([":hover input:not([disabled]) + div,:hover input:not([disabled]) + span{border-color:", ";}:hover{background-color:", ";}"], function (props) {
12
+ var hoverStyle = css([":hover input:not([disabled]) + div,:hover input:not([disabled]) + span{border-color:", ";", "}:hover{background-color:", ";}"], function (props) {
13
13
  var _props$theme$checkBox, _props$theme$checkBox2;
14
14
 
15
15
  return normalizeColor((_props$theme$checkBox = props.theme.checkBox.hover) == null ? void 0 : (_props$theme$checkBox2 = _props$theme$checkBox.border) == null ? void 0 : _props$theme$checkBox2.color, props.theme);
16
16
  }, function (props) {
17
- var _props$theme$checkBox3, _props$theme$checkBox4;
17
+ var _props$theme$checkBox3;
18
18
 
19
- return normalizeColor(!props.disabled && ((_props$theme$checkBox3 = props.theme.checkBox.hover) == null ? void 0 : (_props$theme$checkBox4 = _props$theme$checkBox3.background) == null ? void 0 : _props$theme$checkBox4.color), props.theme);
19
+ return (_props$theme$checkBox3 = props.theme.checkBox.hover) == null ? void 0 : _props$theme$checkBox3.extend;
20
+ }, function (props) {
21
+ var _props$theme$checkBox4, _props$theme$checkBox5;
22
+
23
+ return normalizeColor(!props.disabled && ((_props$theme$checkBox4 = props.theme.checkBox.hover) == null ? void 0 : (_props$theme$checkBox5 = _props$theme$checkBox4.background) == null ? void 0 : _props$theme$checkBox5.color), props.theme);
20
24
  });
21
25
  var StyledCheckBoxIcon = styled.svg.withConfig({
22
26
  displayName: "StyledCheckBox__StyledCheckBoxIcon",
@@ -48,9 +52,9 @@ var StyledCheckBoxContainer = styled.label.withConfig({
48
52
  }, function (props) {
49
53
  return !props.disabled && 'cursor: pointer;';
50
54
  }, hoverStyle, function (props) {
51
- var _props$theme$checkBox5, _props$theme$checkBox6, _props$theme$checkBox7, _props$theme$checkBox8;
55
+ var _props$theme$checkBox6, _props$theme$checkBox7, _props$theme$checkBox8, _props$theme$checkBox9;
52
56
 
53
- return props.focus && !props.focusIndicator && "\n input:not([disabled]) + div,\n input:not([disabled]) + span {\n border-color: " + normalizeColor((_props$theme$checkBox5 = props.theme.checkBox.hover) == null ? void 0 : (_props$theme$checkBox6 = _props$theme$checkBox5.border) == null ? void 0 : _props$theme$checkBox6.color, props.theme) + ";\n }\n \n background-color: " + normalizeColor(!props.disabled && ((_props$theme$checkBox7 = props.theme.checkBox.hover) == null ? void 0 : (_props$theme$checkBox8 = _props$theme$checkBox7.background) == null ? void 0 : _props$theme$checkBox8.color), props.theme) + ";";
57
+ return props.focus && !props.focusIndicator && "\n input:not([disabled]) + div,\n input:not([disabled]) + span {\n border-color: " + normalizeColor((_props$theme$checkBox6 = props.theme.checkBox.hover) == null ? void 0 : (_props$theme$checkBox7 = _props$theme$checkBox6.border) == null ? void 0 : _props$theme$checkBox7.color, props.theme) + ";\n }\n \n background-color: " + normalizeColor(!props.disabled && ((_props$theme$checkBox8 = props.theme.checkBox.hover) == null ? void 0 : (_props$theme$checkBox9 = _props$theme$checkBox8.background) == null ? void 0 : _props$theme$checkBox9.color), props.theme) + ";";
54
58
  }, function (props) {
55
59
  return props.theme.checkBox.extend;
56
60
  });
@@ -1,4 +1,4 @@
1
- var _excluded = ["children", "value", "disabled", "focusIndicator", "gap", "labelKey", "valueKey", "onChange", "options", "name"],
1
+ var _excluded = ["children", "defaultValue", "value", "disabled", "focusIndicator", "gap", "labelKey", "valueKey", "onChange", "options", "name"],
2
2
  _excluded2 = ["value"];
3
3
 
4
4
  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); }
@@ -13,6 +13,7 @@ import { StyledCheckBoxGroup } from './StyledCheckBoxGroup';
13
13
  import { CheckBoxGroupPropTypes } from './propTypes';
14
14
  var CheckBoxGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
15
15
  var children = _ref.children,
16
+ defaultValue = _ref.defaultValue,
16
17
  valueProp = _ref.value,
17
18
  disabledProp = _ref.disabled,
18
19
  _ref$focusIndicator = _ref.focusIndicator,
@@ -39,7 +40,7 @@ var CheckBoxGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
39
40
  var _formContext$useFormI = formContext.useFormInput({
40
41
  name: name,
41
42
  value: valueProp,
42
- initialValue: []
43
+ initialValue: defaultValue || []
43
44
  }),
44
45
  value = _formContext$useFormI[0],
45
46
  setValue = _formContext$useFormI[1]; // Logic is necessary to maintain a proper data structure for Form logic
@@ -15,6 +15,7 @@ export interface CheckBoxType
15
15
 
16
16
  export interface CheckBoxGroupProps {
17
17
  value?: (number | string)[];
18
+ defaultValue?: (number | string)[];
18
19
  disabled?: boolean;
19
20
  labelKey?: string;
20
21
  name?: string;
@@ -26,7 +27,7 @@ export interface CheckBoxGroupProps {
26
27
  export interface CheckBoxGroupExtendedProps
27
28
  extends CheckBoxGroupProps,
28
29
  BoxProps,
29
- Omit<JSX.IntrinsicElements['div'], 'onClick' | 'onChange'> {}
30
+ Omit<JSX.IntrinsicElements['div'], 'onClick' | keyof CheckBoxGroupProps> {}
30
31
 
31
32
  declare const CheckBoxGroup: React.FC<CheckBoxGroupExtendedProps>;
32
33
 
@@ -4,6 +4,7 @@ var PropType = {};
4
4
  if (process.env.NODE_ENV !== 'production') {
5
5
  PropType = {
6
6
  value: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),
7
+ defaultValue: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
7
8
  disabled: PropTypes.bool,
8
9
  labelKey: PropTypes.string,
9
10
  name: PropTypes.string,
@@ -116,8 +116,10 @@ var Detail = function Detail(_ref) {
116
116
  gap: "xsmall",
117
117
  align: "center"
118
118
  }, series.filter(function (_ref2) {
119
+ var _data$detailIndex;
120
+
119
121
  var property = _ref2.property;
120
- return !activeProperty || activeProperty === property || axis && axis.x && axis.x.property === property;
122
+ return (!activeProperty || activeProperty === property) && (data == null ? void 0 : (_data$detailIndex = data[detailIndex]) == null ? void 0 : _data$detailIndex[property]) !== undefined || axis && axis.x && axis.x.property === property;
121
123
  }).map(function (serie) {
122
124
  var propertyStyle = seriesStyles[serie.property];
123
125
  return /*#__PURE__*/React.createElement(Fragment, {
@@ -91,12 +91,12 @@ export interface DataTableProps<TRowType = any> {
91
91
  groupBy?:
92
92
  | string
93
93
  | {
94
- property: string;
95
- expand: Array<string>;
96
- expandable: Array<string>;
97
- select: { [key: string]: 'all' | 'some' | 'none' };
98
- onExpand: (expandedKeys: string[]) => void;
99
- onSelect: (select: (string | number)[], datum: TRowType) => void;
94
+ property?: string;
95
+ expand?: Array<string>;
96
+ expandable?: Array<string>;
97
+ select?: { [key: string]: 'all' | 'some' | 'none' };
98
+ onExpand?: (expandedKeys: string[]) => void;
99
+ onSelect?: (select: (string | number)[], datum: TRowType) => void;
100
100
  };
101
101
  primaryKey?: string | boolean;
102
102
  select?: (string | number)[];
@@ -259,7 +259,7 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
259
259
  }, /*#__PURE__*/React.createElement(Box, {
260
260
  ref: containerRef,
261
261
  border: !plain,
262
- round: "xxsmall",
262
+ round: theme.dateInput.container.round,
263
263
  direction: "row",
264
264
  fill: true
265
265
  }, reverse && calendarButton, /*#__PURE__*/React.createElement(MaskedInput, _extends({
@@ -209,7 +209,8 @@ var Diagram = /*#__PURE__*/forwardRef(function (_ref, ref) {
209
209
 
210
210
  path = /*#__PURE__*/React.createElement("path", _extends({
211
211
  // eslint-disable-next-line react/no-array-index-key
212
- key: index,
212
+ key: index // eslint-disable-next-line react/no-unknown-property
213
+ ,
213
214
  animation: animation
214
215
  }, cleanedRest, {
215
216
  stroke: normalizeColor(colorName, theme),
@@ -23,7 +23,7 @@ var InlineDrop = function InlineDrop() {
23
23
  align: "center",
24
24
  justify: "center"
25
25
  }, /*#__PURE__*/React.createElement(Box, {
26
- background: "dark-3",
26
+ background: "dark-2",
27
27
  pad: "medium",
28
28
  align: "center",
29
29
  justify: "start",
@@ -37,7 +37,7 @@ var OverflowDrop = function OverflowDrop() {
37
37
  align: "center",
38
38
  justify: "center"
39
39
  }, /*#__PURE__*/React.createElement(Box, {
40
- background: "dark-3",
40
+ background: "dark-2",
41
41
  pad: "medium",
42
42
  align: "center",
43
43
  justify: "start",
@@ -24,7 +24,7 @@ var PlainDrop = function PlainDrop() {
24
24
  align: "center",
25
25
  justify: "center"
26
26
  }, /*#__PURE__*/React.createElement(Box, {
27
- background: "dark-3",
27
+ background: "dark-2",
28
28
  pad: "medium",
29
29
  align: "center",
30
30
  justify: "start",
@@ -23,7 +23,7 @@ var SimpleDrop = function SimpleDrop() {
23
23
  align: "center",
24
24
  justify: "center"
25
25
  }, /*#__PURE__*/React.createElement(Box, {
26
- background: "dark-3",
26
+ background: "dark-2",
27
27
  pad: "medium",
28
28
  align: "center",
29
29
  justify: "start",
@@ -27,7 +27,7 @@ var StyledDrop = function StyledDrop() {
27
27
  align: "center",
28
28
  justify: "center"
29
29
  }, /*#__PURE__*/React.createElement(Box, {
30
- background: "dark-3",
30
+ background: "dark-2",
31
31
  pad: "medium",
32
32
  align: "center",
33
33
  justify: "start",
@@ -21,7 +21,7 @@ import { Text } from '../Text';
21
21
  import { TextInput } from '../TextInput';
22
22
  import { FormContext } from '../Form/FormContext';
23
23
  import { FormFieldPropTypes } from './propTypes';
24
- var grommetInputNames = ['CheckBox', 'CheckBoxGroup', 'TextInput', 'Select', 'MaskedInput', 'TextArea', 'DateInput', 'FileInput', 'RadioButtonGroup', 'RangeInput'];
24
+ var grommetInputNames = ['CheckBox', 'CheckBoxGroup', 'TextInput', 'Select', 'MaskedInput', 'SelectMultiple', 'TextArea', 'DateInput', 'FileInput', 'RadioButtonGroup', 'RangeInput'];
25
25
  var grommetInputPadNames = ['CheckBox', 'CheckBoxGroup', 'RadioButtonGroup', 'RangeInput'];
26
26
 
27
27
  var isGrommetInput = function isGrommetInput(comp) {
@@ -1,20 +1,46 @@
1
- var _excluded = ["color", "fill", "level", "weight"];
1
+ var _excluded = ["color", "fill", "level", "overflowWrap", "weight"];
2
2
 
3
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
4
 
5
5
  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; }
6
6
 
7
- import React, { forwardRef } from 'react';
7
+ import React, { forwardRef, useState } from 'react';
8
+ import { useLayoutEffect } from '../../utils/use-isomorphic-layout-effect';
8
9
  import { StyledHeading } from './StyledHeading';
9
10
  import { HeadingPropTypes } from './propTypes';
11
+ import { useForwardedRef } from '../../utils';
10
12
  var Heading = /*#__PURE__*/forwardRef(function (_ref, ref // munged to avoid styled-components putting it in the DOM
11
13
  ) {
12
14
  var color = _ref.color,
13
15
  fill = _ref.fill,
14
16
  level = _ref.level,
17
+ overflowWrapProp = _ref.overflowWrap,
15
18
  weight = _ref.weight,
16
19
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
17
20
 
21
+ var headingRef = useForwardedRef(ref);
22
+
23
+ var _useState = useState(overflowWrapProp || 'break-word'),
24
+ overflowWrap = _useState[0],
25
+ setOverflowWrap = _useState[1]; // handle overflowWrap of heading
26
+
27
+
28
+ useLayoutEffect(function () {
29
+ var updateOverflowWrap = function updateOverflowWrap() {
30
+ var wrap;
31
+
32
+ if (!overflowWrapProp && headingRef.current) {
33
+ wrap = headingRef.current.scrollWidth > headingRef.current.offsetWidth ? 'anywhere' : 'break-word';
34
+ setOverflowWrap(wrap);
35
+ }
36
+ };
37
+
38
+ window.addEventListener('resize', updateOverflowWrap);
39
+ updateOverflowWrap();
40
+ return function () {
41
+ return window.removeEventListener('resize', updateOverflowWrap);
42
+ };
43
+ }, [headingRef, overflowWrapProp]);
18
44
  return (
19
45
  /*#__PURE__*/
20
46
  // enforce level to be a number
@@ -23,9 +49,10 @@ var Heading = /*#__PURE__*/forwardRef(function (_ref, ref // munged to avoid sty
23
49
  colorProp: color,
24
50
  fillProp: fill,
25
51
  level: +level,
52
+ overflowWrap: overflowWrap,
26
53
  weight: weight
27
54
  }, rest, {
28
- ref: ref
55
+ ref: headingRef
29
56
  }))
30
57
  );
31
58
  });
@@ -10,7 +10,7 @@ var sizeStyle = function sizeStyle(props) {
10
10
 
11
11
  if (levelStyle) {
12
12
  var data = levelStyle[size];
13
- var styles = [css(["font-size:", ";line-height:", ";max-width:", ";font-weight:", ";"], data ? data.size : size, data ? data.height : 'normal', props.fillProp && 'none' || data && data.maxWidth || levelStyle.medium.maxWidth, props.weight || levelStyle.font.weight || headingTheme.weight)];
13
+ var styles = [css(["font-size:", ";line-height:", ";max-width:", ";font-weight:", ";overflow-wrap:", ";"], data ? data.size : size, data ? data.height : 'normal', props.fillProp && 'none' || data && data.maxWidth || levelStyle.medium.maxWidth, props.weight || levelStyle.font.weight || headingTheme.weight, props.overflowWrap)];
14
14
 
15
15
  if (props.responsive && headingTheme.responsiveBreakpoint) {
16
16
  var breakpoint = props.theme.global.breakpoints[headingTheme.responsiveBreakpoint];
@@ -19,6 +19,7 @@ export interface HeadingProps {
19
19
  fill?: boolean;
20
20
  level?: '1' | '2' | '3' | '4' | '5' | '6' | 1 | 2 | 3 | 4 | 5 | 6;
21
21
  margin?: MarginType;
22
+ overflowWrap?: 'normal' | 'break-word' | 'anywhere' | string;
22
23
  responsive?: boolean;
23
24
  size?: 'small' | 'medium' | 'large' | 'xlarge' | string;
24
25
  textAlign?: TextAlignType;
@@ -9,6 +9,7 @@ if (process.env.NODE_ENV !== 'production') {
9
9
  color: colorPropType,
10
10
  fill: PropTypes.bool,
11
11
  level: PropTypes.oneOf([1, 2, 3, 4, 5, 6, '1', '2', '3', '4', '5', '6']),
12
+ overflowWrap: PropTypes.oneOfType([PropTypes.oneOf(['normal', 'break-word', 'anywhere']), PropTypes.string]),
12
13
  responsive: PropTypes.bool,
13
14
  size: PropTypes.oneOfType([PropTypes.oneOf(['small', 'medium', 'large', 'xlarge']), PropTypes.string]),
14
15
  textAlign: PropTypes.oneOf(['start', 'center', 'end', 'justify']),
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Grid, Heading } from 'grommet';
4
4
  var headingFiller = "\nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod\ntempor incididunt ut labore et dolore magna aliqua.\n";
5
+ var longWord = 'Supercalifragilisticexpialidocious';
5
6
 
6
7
  var H = function H(_ref) {
7
8
  var level = _ref.level,
@@ -49,7 +50,9 @@ export var All = function All() {
49
50
  size: "xlarge"
50
51
  })), /*#__PURE__*/React.createElement(Heading, {
51
52
  fill: true
52
- }, headingFiller)) // </Grommet>
53
+ }, headingFiller), /*#__PURE__*/React.createElement(Heading, {
54
+ fill: true
55
+ }, longWord)) // </Grommet>
53
56
 
54
57
  );
55
58
  };