grommet 2.29.1 → 2.30.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.
- package/components/Anchor/Anchor.js +9 -3
- package/components/Anchor/StyledAnchor.js +6 -3
- package/components/Button/Button.js +6 -2
- package/components/Button/StyledButtonKind.js +20 -6
- package/components/Calendar/Calendar.js +14 -6
- package/components/Data/DataForm.js +75 -10
- package/components/Data/stories/Cards.js +1 -1
- package/components/Data/stories/Complex.js +84 -0
- package/components/Data/stories/Controlled.js +1 -1
- package/components/Data/stories/DataTable.js +11 -4
- package/components/Data/stories/Infinite.js +1 -1
- package/components/Data/stories/Inline.js +7 -2
- package/components/Data/stories/List.js +1 -1
- package/components/Data/stories/Simple.js +1 -1
- package/components/Data/stories/SpaceX.js +1 -1
- package/components/Data/stories/StarWars.js +18 -24
- package/components/Data/stories/Views.js +1 -1
- package/components/DataFilter/DataFilter.js +32 -42
- package/components/DataFilter/stories/Simple.js +7 -4
- package/components/DataFilters/DataFilters.js +76 -32
- package/components/DataFilters/index.d.ts +1 -0
- package/components/DataFilters/propTypes.js +2 -1
- package/components/DataFilters/stories/Drop.js +7 -4
- package/components/DataFilters/stories/Inline.js +24 -6
- package/components/DataFilters/stories/Layer.js +46 -0
- package/components/DataFilters/stories/Simple.js +7 -4
- package/components/DataSearch/DataSearch.js +57 -9
- package/components/DataSearch/index.d.ts +10 -1
- package/components/DataSearch/propTypes.js +6 -1
- package/components/DataSearch/stories/Drop.js +42 -0
- package/components/DataSearch/stories/Responsive.js +42 -0
- package/components/DataSearch/stories/Simple.js +5 -2
- package/components/DataSort/DataSort.js +61 -12
- package/components/DataSort/index.d.ts +4 -8
- package/components/DataSort/propTypes.js +9 -2
- package/components/DataSort/stories/Drop.js +41 -0
- package/components/DataSort/stories/Simple.js +9 -5
- package/components/DataSummary/stories/Simple.js +7 -4
- package/components/DataTable/GroupedBody.js +1 -0
- package/components/DataTable/StyledDataTable.js +2 -2
- package/components/DataTableColumns/DataTableColumns.js +2 -1
- package/components/DataTableColumns/stories/Simple.js +9 -5
- package/components/DataView/DataView.js +21 -6
- package/components/DataView/stories/Simple.js +8 -5
- package/components/Distribution/Distribution.js +1 -1
- package/components/Drop/DropContainer.js +32 -79
- package/components/Drop/stories/Overflow.js +1 -0
- package/components/DropButton/DropButton.js +1 -1
- package/components/Form/stories/Controlled.js +11 -2
- package/components/Form/stories/ControlledInput.js +13 -2
- package/components/Form/stories/ControlledInputLazy.js +13 -2
- package/components/Form/stories/ControlledLazy.js +13 -2
- package/components/Form/stories/FieldWithChildren.js +13 -2
- package/components/Form/stories/FieldWithComponentProp.js +17 -1
- package/components/Form/stories/Uncontrolled.js +15 -2
- package/components/Form/stories/ValidateOnChange.js +6 -0
- package/components/Form/stories/ValidateOnMount.js +4 -0
- package/components/Form/stories/typescript/TypedForm.tsx +25 -3
- package/components/FormField/FormField.js +1 -0
- package/components/Layer/LayerContainer.js +1 -1
- package/components/Layer/StyledLayer.js +3 -1
- package/components/Pagination/Pagination.js +8 -0
- package/components/Paragraph/Paragraph.js +18 -6
- package/components/Tabs/Tabs.js +2 -1
- package/components/Text/Text.js +9 -1
- package/components/Text/TextContext.js +8 -0
- package/components/TextInput/StyledTextInput.js +3 -1
- package/components/TextInput/TextInput.js +4 -2
- package/components/TextInput/index.d.ts +3 -1
- package/components/TextInput/propTypes.js +3 -1
- package/components/Toolbar/stories/Simple.js +1 -1
- package/components/WorldMap/WorldMap.js +17 -14
- package/es6/components/Anchor/Anchor.js +9 -3
- package/es6/components/Anchor/StyledAnchor.js +6 -3
- package/es6/components/Button/Button.js +6 -2
- package/es6/components/Button/StyledButtonKind.js +20 -6
- package/es6/components/Calendar/Calendar.js +14 -6
- package/es6/components/Data/DataForm.js +75 -10
- package/es6/components/Data/stories/Cards.js +1 -1
- package/es6/components/Data/stories/Complex.js +78 -0
- package/es6/components/Data/stories/Controlled.js +1 -1
- package/es6/components/Data/stories/DataTable.js +12 -5
- package/es6/components/Data/stories/Infinite.js +1 -1
- package/es6/components/Data/stories/Inline.js +7 -2
- package/es6/components/Data/stories/List.js +1 -1
- package/es6/components/Data/stories/Simple.js +1 -1
- package/es6/components/Data/stories/SpaceX.js +1 -1
- package/es6/components/Data/stories/StarWars.js +18 -24
- package/es6/components/Data/stories/Views.js +1 -1
- package/es6/components/DataFilter/DataFilter.js +32 -42
- package/es6/components/DataFilter/stories/Simple.js +8 -5
- package/es6/components/DataFilters/DataFilters.js +76 -32
- package/es6/components/DataFilters/index.d.ts +1 -0
- package/es6/components/DataFilters/propTypes.js +2 -1
- package/es6/components/DataFilters/stories/Drop.js +8 -5
- package/es6/components/DataFilters/stories/Inline.js +25 -7
- package/es6/components/DataFilters/stories/Layer.js +40 -0
- package/es6/components/DataFilters/stories/Simple.js +8 -5
- package/es6/components/DataSearch/DataSearch.js +58 -10
- package/es6/components/DataSearch/index.d.ts +10 -1
- package/es6/components/DataSearch/propTypes.js +5 -1
- package/es6/components/DataSearch/stories/Drop.js +36 -0
- package/es6/components/DataSearch/stories/Responsive.js +36 -0
- package/es6/components/DataSearch/stories/Simple.js +6 -3
- package/es6/components/DataSort/DataSort.js +62 -13
- package/es6/components/DataSort/index.d.ts +4 -8
- package/es6/components/DataSort/propTypes.js +8 -2
- package/es6/components/DataSort/stories/Drop.js +35 -0
- package/es6/components/DataSort/stories/Simple.js +10 -6
- package/es6/components/DataSummary/stories/Simple.js +8 -5
- package/es6/components/DataTable/GroupedBody.js +1 -0
- package/es6/components/DataTable/StyledDataTable.js +2 -2
- package/es6/components/DataTableColumns/DataTableColumns.js +2 -1
- package/es6/components/DataTableColumns/stories/Simple.js +10 -6
- package/es6/components/DataView/DataView.js +21 -6
- package/es6/components/DataView/stories/Simple.js +9 -6
- package/es6/components/Distribution/Distribution.js +1 -1
- package/es6/components/Drop/DropContainer.js +34 -81
- package/es6/components/Drop/stories/Overflow.js +1 -0
- package/es6/components/DropButton/DropButton.js +1 -1
- package/es6/components/Form/stories/Controlled.js +11 -2
- package/es6/components/Form/stories/ControlledInput.js +13 -2
- package/es6/components/Form/stories/ControlledInputLazy.js +13 -2
- package/es6/components/Form/stories/ControlledLazy.js +13 -2
- package/es6/components/Form/stories/FieldWithChildren.js +13 -2
- package/es6/components/Form/stories/FieldWithComponentProp.js +17 -1
- package/es6/components/Form/stories/Uncontrolled.js +15 -2
- package/es6/components/Form/stories/ValidateOnChange.js +6 -0
- package/es6/components/Form/stories/ValidateOnMount.js +4 -0
- package/es6/components/Form/stories/typescript/TypedForm.tsx +25 -3
- package/es6/components/FormField/FormField.js +1 -0
- package/es6/components/Layer/LayerContainer.js +1 -1
- package/es6/components/Layer/StyledLayer.js +3 -1
- package/es6/components/Pagination/Pagination.js +8 -0
- package/es6/components/Paragraph/Paragraph.js +19 -7
- package/es6/components/Tabs/Tabs.js +2 -1
- package/es6/components/Text/Text.js +10 -2
- package/es6/components/Text/TextContext.js +2 -0
- package/es6/components/TextInput/StyledTextInput.js +4 -2
- package/es6/components/TextInput/TextInput.js +4 -2
- package/es6/components/TextInput/index.d.ts +3 -1
- package/es6/components/TextInput/propTypes.js +3 -1
- package/es6/components/Toolbar/stories/Simple.js +1 -1
- package/es6/components/WorldMap/WorldMap.js +17 -14
- package/es6/languages/default.json +7 -2
- package/es6/themes/base.d.ts +31 -0
- package/es6/themes/base.js +31 -1
- package/es6/utils/DOM.js +1 -1
- package/es6/utils/background.js +9 -1
- package/es6/utils/colors.js +2 -2
- package/es6/utils/general-prop-types.js +1 -1
- package/es6/utils/index.d.ts +7 -1
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/languages/default.json +7 -2
- package/package.json +13 -11
- package/themes/base.d.ts +31 -0
- package/themes/base.js +31 -1
- package/utils/DOM.js +1 -1
- package/utils/background.js +8 -0
- package/utils/colors.js +3 -1
- package/utils/general-prop-types.js +1 -1
- package/utils/index.d.ts +7 -1
|
@@ -38,6 +38,8 @@ export var ValidateOnMount = function ValidateOnMount() {
|
|
|
38
38
|
}
|
|
39
39
|
}, /*#__PURE__*/React.createElement(FormField, {
|
|
40
40
|
label: "First Name",
|
|
41
|
+
htmlFor: "firstName",
|
|
42
|
+
id: "firstName",
|
|
41
43
|
name: "firstName",
|
|
42
44
|
required: true,
|
|
43
45
|
validate: [{
|
|
@@ -48,6 +50,8 @@ export var ValidateOnMount = function ValidateOnMount() {
|
|
|
48
50
|
}]
|
|
49
51
|
}), /*#__PURE__*/React.createElement(FormField, {
|
|
50
52
|
label: "Last Name",
|
|
53
|
+
htmlFor: "lastName",
|
|
54
|
+
id: "lastName",
|
|
51
55
|
name: "lastName",
|
|
52
56
|
required: true,
|
|
53
57
|
validate: [{
|
|
@@ -31,7 +31,7 @@ export const TypedForm = () => {
|
|
|
31
31
|
return (
|
|
32
32
|
// Uncomment <Grommet> lines when using outside of storybook
|
|
33
33
|
// <Grommet theme={...}>
|
|
34
|
-
<Box
|
|
34
|
+
<Box align="center" justify="center" pad="large">
|
|
35
35
|
<Box width="medium">
|
|
36
36
|
{/*
|
|
37
37
|
Type annotations can only be used in TypeScript files
|
|
@@ -50,13 +50,24 @@ export const TypedForm = () => {
|
|
|
50
50
|
>
|
|
51
51
|
<FormField
|
|
52
52
|
label="Name"
|
|
53
|
+
htmlFor="name"
|
|
54
|
+
id="name"
|
|
53
55
|
name="name"
|
|
54
56
|
required
|
|
55
57
|
validate={{ regexp: /^[a-z]/i }}
|
|
56
58
|
/>
|
|
57
|
-
<FormField
|
|
59
|
+
<FormField
|
|
60
|
+
label="Email"
|
|
61
|
+
htmlFor="email"
|
|
62
|
+
id="email"
|
|
63
|
+
name="email"
|
|
64
|
+
type="email"
|
|
65
|
+
required
|
|
66
|
+
/>
|
|
58
67
|
<FormField
|
|
59
68
|
label="Employee ID"
|
|
69
|
+
htmlFor="employeeId"
|
|
70
|
+
id="employeeId"
|
|
60
71
|
name="employeeId"
|
|
61
72
|
required
|
|
62
73
|
validate={{ regexp: /^[0-9]{4,6}$/, message: '4-6 digits' }}
|
|
@@ -75,14 +86,25 @@ export const TypedForm = () => {
|
|
|
75
86
|
/>
|
|
76
87
|
<FormField
|
|
77
88
|
label="Size"
|
|
89
|
+
htmlFor="size"
|
|
90
|
+
id="size"
|
|
91
|
+
aria-label="size"
|
|
78
92
|
name="size"
|
|
79
93
|
component={Select}
|
|
80
94
|
onChange={(event) => console.log(event)}
|
|
81
95
|
options={['small', 'medium', 'large', 'xlarge']}
|
|
82
96
|
/>
|
|
83
|
-
<FormField
|
|
97
|
+
<FormField
|
|
98
|
+
label="Comments"
|
|
99
|
+
htmlFor="comments"
|
|
100
|
+
id="comments"
|
|
101
|
+
name="comments"
|
|
102
|
+
component={TextArea}
|
|
103
|
+
/>
|
|
84
104
|
<FormField
|
|
85
105
|
label="Age"
|
|
106
|
+
htmlFor="age"
|
|
107
|
+
id="age"
|
|
86
108
|
name="age"
|
|
87
109
|
component={RangeInput}
|
|
88
110
|
pad
|
|
@@ -332,6 +332,7 @@ var FormField = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
332
332
|
return /*#__PURE__*/React.createElement(FormFieldBox, _extends({
|
|
333
333
|
ref: formFieldRef,
|
|
334
334
|
className: className,
|
|
335
|
+
flex: false,
|
|
335
336
|
background: outerBackground,
|
|
336
337
|
margin: abut ? abutMargin : margin || _extends({}, formFieldTheme.margin)
|
|
337
338
|
}, outerProps, {
|
|
@@ -250,7 +250,7 @@ var LayerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
250
250
|
// restricting scroll could inhibit the user's
|
|
251
251
|
// ability to scroll the page while the layer is open.
|
|
252
252
|
,
|
|
253
|
-
restrictScroll: !layerTarget
|
|
253
|
+
restrictScroll: !layerTarget && hitResponsiveBreakpoint ? true : undefined,
|
|
254
254
|
trapFocus: true
|
|
255
255
|
}, content);
|
|
256
256
|
}
|
|
@@ -28,12 +28,14 @@ Object.setPrototypeOf(StyledLayer.defaultProps, defaultProps);
|
|
|
28
28
|
var StyledOverlay = styled.div.withConfig({
|
|
29
29
|
displayName: "StyledLayer__StyledOverlay",
|
|
30
30
|
componentId: "sc-rmtehz-1"
|
|
31
|
-
})(["position:absolute;", " top:0px;left:0px;right:0px;bottom:0px;", " pointer-events:all;will-change:transform;"], function (props) {
|
|
31
|
+
})(["position:absolute;", " top:0px;left:0px;right:0px;bottom:0px;", " ", " pointer-events:all;will-change:transform;"], function (props) {
|
|
32
32
|
if (props.responsive && props.theme.layer.responsiveBreakpoint) {
|
|
33
33
|
var breakpoint = props.theme.global.breakpoints[props.theme.layer.responsiveBreakpoint];
|
|
34
34
|
return breakpointStyle(breakpoint, 'position: relative;');
|
|
35
35
|
}
|
|
36
36
|
return '';
|
|
37
|
+
}, function (props) {
|
|
38
|
+
return props.theme.layer.overlay.backdropFilter && "backdrop-filter: " + props.theme.layer.overlay.backdropFilter + ";";
|
|
37
39
|
}, function (props) {
|
|
38
40
|
return !props.plain && props.theme.layer.overlay.background && backgroundStyle(props.theme.layer.overlay.background, props.theme);
|
|
39
41
|
});
|
|
@@ -53,6 +53,14 @@ var Pagination = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
53
53
|
useEffect(function () {
|
|
54
54
|
return setActivePage(page);
|
|
55
55
|
}, [page]);
|
|
56
|
+
useEffect(function () {
|
|
57
|
+
// if we are getting the step or page from outside the view,
|
|
58
|
+
// update the Data's view in case it needs to filter.
|
|
59
|
+
if (onView && ((view == null ? void 0 : view.step) !== step || (view == null ? void 0 : view.page) !== page)) onView(_extends({}, view, {
|
|
60
|
+
page: page,
|
|
61
|
+
step: step
|
|
62
|
+
}));
|
|
63
|
+
}, [onView, page, step, view]);
|
|
56
64
|
|
|
57
65
|
/* Define page indices to display */
|
|
58
66
|
var beginPages = getPageIndices(1, Math.min(numberEdgePages, totalPages));
|
|
@@ -1,27 +1,39 @@
|
|
|
1
|
-
var _excluded = ["color", "fill"];
|
|
1
|
+
var _excluded = ["children", "color", "fill", "size"];
|
|
2
2
|
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); }
|
|
3
3
|
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; }
|
|
4
|
-
import React, { forwardRef } from 'react';
|
|
4
|
+
import React, { forwardRef, useMemo } from 'react';
|
|
5
5
|
import { StyledParagraph } from './StyledParagraph';
|
|
6
6
|
import { ParagraphPropTypes } from './propTypes';
|
|
7
7
|
import { useSkeleton } from '../Skeleton';
|
|
8
8
|
import { ParagraphSkeleton } from './ParagraphSkeleton';
|
|
9
|
+
import { TextContext } from '../Text/TextContext';
|
|
9
10
|
var Paragraph = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
10
|
-
var
|
|
11
|
+
var children = _ref.children,
|
|
12
|
+
color = _ref.color,
|
|
11
13
|
fill = _ref.fill,
|
|
14
|
+
size = _ref.size,
|
|
12
15
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
13
16
|
var skeleton = useSkeleton();
|
|
17
|
+
var textContextValue = useMemo(function () {
|
|
18
|
+
return {
|
|
19
|
+
size: size
|
|
20
|
+
};
|
|
21
|
+
}, [size]);
|
|
14
22
|
if (skeleton) {
|
|
15
23
|
return /*#__PURE__*/React.createElement(ParagraphSkeleton, _extends({
|
|
16
24
|
ref: ref,
|
|
17
|
-
fill: fill
|
|
18
|
-
|
|
25
|
+
fill: fill,
|
|
26
|
+
size: size
|
|
27
|
+
}, rest), children);
|
|
19
28
|
}
|
|
20
29
|
return /*#__PURE__*/React.createElement(StyledParagraph, _extends({
|
|
21
30
|
ref: ref,
|
|
22
31
|
colorProp: color,
|
|
23
|
-
fillProp: fill
|
|
24
|
-
|
|
32
|
+
fillProp: fill,
|
|
33
|
+
size: size
|
|
34
|
+
}, rest), /*#__PURE__*/React.createElement(TextContext.Provider, {
|
|
35
|
+
value: textContextValue
|
|
36
|
+
}, children));
|
|
25
37
|
});
|
|
26
38
|
Paragraph.displayName = 'Paragraph';
|
|
27
39
|
Paragraph.prototype = ParagraphPropTypes;
|
|
@@ -17,6 +17,7 @@ import { MessageContext } from '../../contexts/MessageContext';
|
|
|
17
17
|
import { TabsPropTypes } from './propTypes';
|
|
18
18
|
import { useAnalytics } from '../../contexts/AnalyticsContext/AnalyticsContext';
|
|
19
19
|
var Tabs = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
20
|
+
var _theme$tabs$header;
|
|
20
21
|
var alignControls = _ref.alignControls,
|
|
21
22
|
children = _ref.children,
|
|
22
23
|
flex = _ref.flex,
|
|
@@ -268,6 +269,7 @@ var Tabs = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
268
269
|
}, rest, {
|
|
269
270
|
background: theme.tabs.background
|
|
270
271
|
}), /*#__PURE__*/React.createElement(Box, _extends({
|
|
272
|
+
alignSelf: alignControls || ((_theme$tabs$header = theme.tabs.header) == null ? void 0 : _theme$tabs$header.alignSelf),
|
|
271
273
|
role: "tablist",
|
|
272
274
|
flex: false,
|
|
273
275
|
direction: overflow ? 'row' : 'column'
|
|
@@ -292,7 +294,6 @@ var Tabs = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
292
294
|
as: Box,
|
|
293
295
|
direction: "row",
|
|
294
296
|
justify: overflow ? 'start' : justify,
|
|
295
|
-
alignSelf: alignControls,
|
|
296
297
|
flex: !!overflow,
|
|
297
298
|
wrap: false,
|
|
298
299
|
overflow: overflow ? 'hidden' : 'visible',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["children", "color", "tag", "as", "tip", "a11yTitle", "truncate", "size", "skeleton"];
|
|
2
2
|
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); }
|
|
3
3
|
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; }
|
|
4
|
-
import React, { forwardRef, useState } from 'react';
|
|
4
|
+
import React, { forwardRef, useMemo, useState } from 'react';
|
|
5
5
|
import { useLayoutEffect } from '../../utils/use-isomorphic-layout-effect';
|
|
6
6
|
import { StyledText } from './StyledText';
|
|
7
7
|
import { Tip } from '../Tip';
|
|
@@ -9,6 +9,7 @@ import { useForwardedRef } from '../../utils';
|
|
|
9
9
|
import { TextPropTypes } from './propTypes';
|
|
10
10
|
import { useSkeleton } from '../Skeleton';
|
|
11
11
|
import { TextSkeleton } from './TextSkeleton';
|
|
12
|
+
import { TextContext } from './TextContext';
|
|
12
13
|
var Text = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
13
14
|
var children = _ref.children,
|
|
14
15
|
color = _ref.color,
|
|
@@ -25,6 +26,11 @@ var Text = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
25
26
|
var _useState = useState(false),
|
|
26
27
|
textTruncated = _useState[0],
|
|
27
28
|
setTextTruncated = _useState[1];
|
|
29
|
+
var textContextValue = useMemo(function () {
|
|
30
|
+
return {
|
|
31
|
+
size: size
|
|
32
|
+
};
|
|
33
|
+
}, [size]);
|
|
28
34
|
var skeleton = useSkeleton();
|
|
29
35
|
useLayoutEffect(function () {
|
|
30
36
|
var updateTip = function updateTip() {
|
|
@@ -54,7 +60,9 @@ var Text = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
54
60
|
size: size
|
|
55
61
|
}, rest, {
|
|
56
62
|
ref: textRef
|
|
57
|
-
}),
|
|
63
|
+
}), /*#__PURE__*/React.createElement(TextContext.Provider, {
|
|
64
|
+
value: textContextValue
|
|
65
|
+
}, children));
|
|
58
66
|
if (tipProp || textTruncated) {
|
|
59
67
|
// place the text content in a tip if truncate === 'tip'
|
|
60
68
|
// and the text has been truncated
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
|
-
import { disabledStyle, getInputPadBySide, inputStyle, parseMetricToNum, plainInputStyle, textAlignStyle } from '../../utils';
|
|
2
|
+
import { disabledStyle, getInputPadBySide, inputStyle, parseMetricToNum, plainInputStyle, textAlignStyle, widthStyle } from '../../utils';
|
|
3
3
|
import { defaultProps } from '../../default-props';
|
|
4
4
|
var getPlainStyle = function getPlainStyle(plain) {
|
|
5
5
|
if (plain === 'full') {
|
|
@@ -10,7 +10,7 @@ var getPlainStyle = function getPlainStyle(plain) {
|
|
|
10
10
|
var StyledTextInput = styled.input.withConfig({
|
|
11
11
|
displayName: "StyledTextInput",
|
|
12
12
|
componentId: "sc-1x30a0s-0"
|
|
13
|
-
})(["", " ", " ", " ", " ", " ", ";"], inputStyle, function (props) {
|
|
13
|
+
})(["", " ", " ", " ", " ", " ", " ", ";"], inputStyle, function (props) {
|
|
14
14
|
return getPlainStyle(props.plain);
|
|
15
15
|
}, function (props) {
|
|
16
16
|
return props.icon && (props.reverse ? "padding-right: " + props.theme.global.edgeSize.large + ";" : "padding-left: " + props.theme.global.edgeSize.large + ";");
|
|
@@ -18,6 +18,8 @@ var StyledTextInput = styled.input.withConfig({
|
|
|
18
18
|
return props.disabled && disabledStyle(props.theme.textInput.disabled && props.theme.textInput.disabled.opacity);
|
|
19
19
|
}, function (props) {
|
|
20
20
|
return props.textAlign && textAlignStyle;
|
|
21
|
+
}, function (props) {
|
|
22
|
+
return props.widthProp && widthStyle(props.widthProp, props.theme);
|
|
21
23
|
}, function (props) {
|
|
22
24
|
return props.theme.textInput && props.theme.textInput.extend;
|
|
23
25
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["a11yTitle", "defaultSuggestion", "defaultValue", "dropAlign", "dropHeight", "dropTarget", "dropProps", "focusIndicator", "icon", "id", "messages", "name", "onBlur", "onChange", "onFocus", "onKeyDown", "onSelect", "onSuggestionSelect", "onSuggestionsClose", "onSuggestionsOpen", "placeholder", "plain", "readOnly", "reverse", "suggestions", "textAlign", "value"];
|
|
1
|
+
var _excluded = ["a11yTitle", "defaultSuggestion", "defaultValue", "dropAlign", "dropHeight", "dropTarget", "dropProps", "focusIndicator", "icon", "id", "messages", "name", "onBlur", "onChange", "onFocus", "onKeyDown", "onSelect", "onSuggestionSelect", "onSuggestionsClose", "onSuggestionsOpen", "placeholder", "plain", "readOnly", "reverse", "suggestions", "textAlign", "value", "width"];
|
|
2
2
|
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); }
|
|
3
3
|
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; }
|
|
4
4
|
import React, { forwardRef, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
@@ -71,6 +71,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
71
71
|
suggestions = _ref.suggestions,
|
|
72
72
|
textAlign = _ref.textAlign,
|
|
73
73
|
valueProp = _ref.value,
|
|
74
|
+
widthProp = _ref.width,
|
|
74
75
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
75
76
|
var theme = useContext(ThemeContext) || defaultProps.theme;
|
|
76
77
|
var _useContext = useContext(MessageContext),
|
|
@@ -363,7 +364,8 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
363
364
|
reverse: reverse,
|
|
364
365
|
focus: focus,
|
|
365
366
|
focusIndicator: focusIndicator,
|
|
366
|
-
textAlign: textAlign
|
|
367
|
+
textAlign: textAlign,
|
|
368
|
+
widthProp: widthProp
|
|
367
369
|
}, rest, extraProps, comboboxProps, {
|
|
368
370
|
defaultValue: renderLabel(defaultValue),
|
|
369
371
|
value: renderLabel(value),
|
|
@@ -4,13 +4,14 @@ import {
|
|
|
4
4
|
Omit,
|
|
5
5
|
PlaceHolderType,
|
|
6
6
|
TextAlignType,
|
|
7
|
+
WidthType,
|
|
7
8
|
} from '../../utils';
|
|
8
9
|
import { DropType } from '../Drop';
|
|
9
10
|
|
|
10
11
|
export interface TextInputProps
|
|
11
12
|
extends Omit<
|
|
12
13
|
JSX.IntrinsicElements['input'],
|
|
13
|
-
'onSelect' | 'size' | 'placeholder'
|
|
14
|
+
'onSelect' | 'size' | 'placeholder' | 'width'
|
|
14
15
|
> {
|
|
15
16
|
a11yTitle?: A11yTitleType;
|
|
16
17
|
dropAlign?: {
|
|
@@ -50,6 +51,7 @@ export interface TextInputProps
|
|
|
50
51
|
suggestions?: ({ label?: React.ReactNode; value?: any } | string)[];
|
|
51
52
|
textAlign?: TextAlignType;
|
|
52
53
|
value?: string | number;
|
|
54
|
+
width?: WidthType;
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
declare const TextInput: React.FC<TextInputProps>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
+
import { widthPropType } from '../../utils/general-prop-types';
|
|
2
3
|
var PropType = {};
|
|
3
4
|
if (process.env.NODE_ENV !== 'production') {
|
|
4
5
|
PropType = {
|
|
@@ -38,7 +39,8 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
38
39
|
value: PropTypes.any // this is intentional any
|
|
39
40
|
}), PropTypes.string])),
|
|
40
41
|
textAlign: PropTypes.oneOf(['start', 'center', 'end']),
|
|
41
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
42
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
43
|
+
width: widthPropType
|
|
42
44
|
};
|
|
43
45
|
}
|
|
44
46
|
export var TextInputPropTypes = PropType;
|
|
@@ -217,6 +217,11 @@ var WorldMap = /*#__PURE__*/forwardRef(function (_ref5, ref) {
|
|
|
217
217
|
var _React$useState2 = React.useState([]),
|
|
218
218
|
places = _React$useState2[0],
|
|
219
219
|
setPlaces = _React$useState2[1];
|
|
220
|
+
|
|
221
|
+
// targets are used for the Drops associated with places content
|
|
222
|
+
var _React$useState3 = React.useState([]),
|
|
223
|
+
targets = _React$useState3[0],
|
|
224
|
+
setTargets = _React$useState3[1];
|
|
220
225
|
React.useEffect(function () {
|
|
221
226
|
if (placesProp) {
|
|
222
227
|
setPlaces(placesProp.map(function (_ref6) {
|
|
@@ -229,25 +234,23 @@ var WorldMap = /*#__PURE__*/forwardRef(function (_ref5, ref) {
|
|
|
229
234
|
}, place);
|
|
230
235
|
}));
|
|
231
236
|
} else setPlaces([]);
|
|
237
|
+
return function () {
|
|
238
|
+
setTargets([]);
|
|
239
|
+
};
|
|
232
240
|
}, [placesProp, world]);
|
|
233
|
-
var _React$useState3 = React.useState(),
|
|
234
|
-
over = _React$useState3[0],
|
|
235
|
-
setOver = _React$useState3[1];
|
|
236
241
|
var _React$useState4 = React.useState(),
|
|
237
|
-
|
|
238
|
-
|
|
242
|
+
over = _React$useState4[0],
|
|
243
|
+
setOver = _React$useState4[1];
|
|
239
244
|
var _React$useState5 = React.useState(),
|
|
240
|
-
|
|
241
|
-
|
|
245
|
+
activeCoords = _React$useState5[0],
|
|
246
|
+
setActiveCoords = _React$useState5[1];
|
|
242
247
|
var _React$useState6 = React.useState(),
|
|
243
|
-
|
|
244
|
-
|
|
248
|
+
activeContinent = _React$useState6[0],
|
|
249
|
+
setActiveContinent = _React$useState6[1];
|
|
250
|
+
var _React$useState7 = React.useState(),
|
|
251
|
+
activePlace = _React$useState7[0],
|
|
252
|
+
setActivePlace = _React$useState7[1];
|
|
245
253
|
var containerRef = React.useRef();
|
|
246
|
-
|
|
247
|
-
// targets are used for the Drops associated with places content
|
|
248
|
-
var _React$useState7 = React.useState([]),
|
|
249
|
-
targets = _React$useState7[0],
|
|
250
|
-
setTargets = _React$useState7[1];
|
|
251
254
|
var placeRef = React.useCallback(function (node, index) {
|
|
252
255
|
setTargets(function (prevTargets) {
|
|
253
256
|
if (!prevTargets[index]) {
|
|
@@ -25,13 +25,15 @@
|
|
|
25
25
|
"submit": "Apply filters"
|
|
26
26
|
},
|
|
27
27
|
"dataSearch": {
|
|
28
|
-
"label": "Search
|
|
28
|
+
"label": "Search",
|
|
29
|
+
"open": "Open search"
|
|
29
30
|
},
|
|
30
31
|
"dataSort": {
|
|
31
32
|
"ascending": "Ascending",
|
|
32
33
|
"by": "Sort by",
|
|
33
34
|
"descending": "Descending",
|
|
34
|
-
"direction": "Sort direction"
|
|
35
|
+
"direction": "Sort direction",
|
|
36
|
+
"open": "Open sort"
|
|
35
37
|
},
|
|
36
38
|
"dataSummary": {
|
|
37
39
|
"filtered": "{filteredTotal} results of {total} items",
|
|
@@ -43,6 +45,9 @@
|
|
|
43
45
|
"order": "Order columns",
|
|
44
46
|
"select": "Select columns"
|
|
45
47
|
},
|
|
48
|
+
"dataView": {
|
|
49
|
+
"label": "View"
|
|
50
|
+
},
|
|
46
51
|
"fileInput": {
|
|
47
52
|
"browse": "browse",
|
|
48
53
|
"dropPrompt": "Drop file here or",
|
package/es6/themes/base.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
PropsOf,
|
|
26
26
|
AlignContentType,
|
|
27
27
|
SkeletonColorsType,
|
|
28
|
+
AlignSelfType,
|
|
28
29
|
} from '../utils';
|
|
29
30
|
|
|
30
31
|
import { AnchorProps } from '../components/Anchor/index';
|
|
@@ -147,7 +148,9 @@ interface ButtonKindType {
|
|
|
147
148
|
}
|
|
148
149
|
| boolean;
|
|
149
150
|
color?: ColorType;
|
|
151
|
+
direction?: DirectionType;
|
|
150
152
|
font?: {
|
|
153
|
+
size?: string;
|
|
151
154
|
weight?: number | string;
|
|
152
155
|
};
|
|
153
156
|
icon?: React.ReactNode | Icon;
|
|
@@ -223,6 +226,9 @@ interface ButtonType {
|
|
|
223
226
|
vertical?: string;
|
|
224
227
|
horizontal?: string;
|
|
225
228
|
};
|
|
229
|
+
iconOnly?: {
|
|
230
|
+
pad?: string | { horizontal?: string; vertical?: string };
|
|
231
|
+
};
|
|
226
232
|
};
|
|
227
233
|
medium?: {
|
|
228
234
|
border?: {
|
|
@@ -232,6 +238,9 @@ interface ButtonType {
|
|
|
232
238
|
vertical?: string;
|
|
233
239
|
horizontal?: string;
|
|
234
240
|
};
|
|
241
|
+
iconOnly?: {
|
|
242
|
+
pad?: string | { horizontal?: string; vertical?: string };
|
|
243
|
+
};
|
|
235
244
|
};
|
|
236
245
|
large?: {
|
|
237
246
|
border?: {
|
|
@@ -241,6 +250,9 @@ interface ButtonType {
|
|
|
241
250
|
vertical?: string;
|
|
242
251
|
horizontal?: string;
|
|
243
252
|
};
|
|
253
|
+
iconOnly?: {
|
|
254
|
+
pad?: string | { horizontal?: string; vertical?: string };
|
|
255
|
+
};
|
|
244
256
|
};
|
|
245
257
|
};
|
|
246
258
|
skeleton?: SkeletonProps;
|
|
@@ -480,6 +492,20 @@ export interface ThemeType {
|
|
|
480
492
|
textDecoration?: string;
|
|
481
493
|
};
|
|
482
494
|
textDecoration?: string;
|
|
495
|
+
size?: {
|
|
496
|
+
medium?: {
|
|
497
|
+
color?: ColorType;
|
|
498
|
+
fontWeight?: number;
|
|
499
|
+
textDecoration?: string;
|
|
500
|
+
};
|
|
501
|
+
[x: string]:
|
|
502
|
+
| {
|
|
503
|
+
color?: ColorType;
|
|
504
|
+
fontWeight?: number;
|
|
505
|
+
textDecoration?: string;
|
|
506
|
+
}
|
|
507
|
+
| undefined;
|
|
508
|
+
};
|
|
483
509
|
};
|
|
484
510
|
avatar?: {
|
|
485
511
|
size?: {
|
|
@@ -515,18 +541,21 @@ export interface ThemeType {
|
|
|
515
541
|
};
|
|
516
542
|
extend?: ExtendType;
|
|
517
543
|
small?: {
|
|
544
|
+
title?: TextProps;
|
|
518
545
|
fontSize?: string;
|
|
519
546
|
lineHeight?: number;
|
|
520
547
|
daySize?: string;
|
|
521
548
|
slideDuration?: string;
|
|
522
549
|
};
|
|
523
550
|
medium?: {
|
|
551
|
+
title?: TextProps;
|
|
524
552
|
fontSize?: string;
|
|
525
553
|
lineHeight?: number;
|
|
526
554
|
daySize?: string;
|
|
527
555
|
slideDuration?: string;
|
|
528
556
|
};
|
|
529
557
|
large?: {
|
|
558
|
+
title?: TextProps;
|
|
530
559
|
fontSize?: string;
|
|
531
560
|
lineHeight?: number;
|
|
532
561
|
daySize?: string;
|
|
@@ -1021,6 +1050,7 @@ export interface ThemeType {
|
|
|
1021
1050
|
extend?: ExtendType;
|
|
1022
1051
|
overlay?: {
|
|
1023
1052
|
background?: BackgroundType;
|
|
1053
|
+
backdropFilter?: string;
|
|
1024
1054
|
};
|
|
1025
1055
|
responsiveBreakpoint?: string;
|
|
1026
1056
|
zIndex?: string;
|
|
@@ -1483,6 +1513,7 @@ export interface ThemeType {
|
|
|
1483
1513
|
extend?: ExtendType;
|
|
1484
1514
|
gap?: GapType;
|
|
1485
1515
|
header?: {
|
|
1516
|
+
alignSelf?: AlignSelfType;
|
|
1486
1517
|
background?: BackgroundType;
|
|
1487
1518
|
border?: {
|
|
1488
1519
|
side?: string;
|
package/es6/themes/base.js
CHANGED
|
@@ -402,6 +402,13 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
402
402
|
// fontWeight: undefined,
|
|
403
403
|
// extend: undefined,
|
|
404
404
|
}
|
|
405
|
+
// size: {
|
|
406
|
+
// medium: {
|
|
407
|
+
// color: undefined,
|
|
408
|
+
// fontWeight: undefined,
|
|
409
|
+
// textDecoration: undefined,
|
|
410
|
+
// },
|
|
411
|
+
// },
|
|
405
412
|
// extend: undefined,
|
|
406
413
|
},
|
|
407
414
|
|
|
@@ -487,6 +494,9 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
487
494
|
// 4px
|
|
488
495
|
horizontal: baseSpacing - borderWidth * 2 + "px" // 20px,
|
|
489
496
|
}
|
|
497
|
+
// iconOnly: {
|
|
498
|
+
// pad: undefined,
|
|
499
|
+
// },
|
|
490
500
|
},
|
|
491
501
|
|
|
492
502
|
medium: {
|
|
@@ -499,6 +509,9 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
499
509
|
// 4px
|
|
500
510
|
horizontal: baseSpacing - borderWidth + "px" // 22px
|
|
501
511
|
}
|
|
512
|
+
// iconOnly: {
|
|
513
|
+
// pad: undefined,
|
|
514
|
+
// },
|
|
502
515
|
},
|
|
503
516
|
|
|
504
517
|
large: {
|
|
@@ -511,6 +524,9 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
511
524
|
// 8px
|
|
512
525
|
horizontal: baseSpacing + borderWidth * 4 + "px" // 32px,
|
|
513
526
|
}
|
|
527
|
+
// iconOnly: {
|
|
528
|
+
// pad: undefined,
|
|
529
|
+
// },
|
|
514
530
|
}
|
|
515
531
|
},
|
|
516
532
|
|
|
@@ -524,7 +540,9 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
524
540
|
// background: undefined,
|
|
525
541
|
// border: undefined,
|
|
526
542
|
// color: undefined,
|
|
543
|
+
// direction: undefined,
|
|
527
544
|
// font: {
|
|
545
|
+
// size: undefined,
|
|
528
546
|
// weight: undefined,
|
|
529
547
|
// },
|
|
530
548
|
// icon: undefined,
|
|
@@ -537,11 +555,13 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
537
555
|
// },
|
|
538
556
|
// primary: {
|
|
539
557
|
// font: {
|
|
558
|
+
// size: undefined,
|
|
540
559
|
// weight: undefined,
|
|
541
560
|
// },
|
|
542
561
|
// background: undefined,
|
|
543
562
|
// border: undefined,
|
|
544
563
|
// color: undefined,
|
|
564
|
+
// direction: undefined,
|
|
545
565
|
// icon: undefined,
|
|
546
566
|
// padding: {
|
|
547
567
|
// vertical: undefined,
|
|
@@ -552,11 +572,13 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
552
572
|
// },
|
|
553
573
|
// secondary: {
|
|
554
574
|
// font: {
|
|
575
|
+
// size: undefined,
|
|
555
576
|
// weight: undefined,
|
|
556
577
|
// },
|
|
557
578
|
// background: undefined,
|
|
558
579
|
// border: undefined,
|
|
559
580
|
// color: undefined,
|
|
581
|
+
// direction: undefined,
|
|
560
582
|
// icon: undefined,
|
|
561
583
|
// padding: {
|
|
562
584
|
// vertical: undefined,
|
|
@@ -569,6 +591,7 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
569
591
|
// background: undefined,
|
|
570
592
|
// border: undefined,
|
|
571
593
|
// color: undefined,
|
|
594
|
+
// direction: undefined,
|
|
572
595
|
// icon: undefined,
|
|
573
596
|
// padding: {
|
|
574
597
|
// vertical: undefined,
|
|
@@ -625,18 +648,21 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
625
648
|
calendar: {
|
|
626
649
|
// daySize must align with global.size
|
|
627
650
|
small: {
|
|
651
|
+
// title: {},
|
|
628
652
|
fontSize: baseFontSize - fontScale + "px",
|
|
629
653
|
lineHeight: 1.375,
|
|
630
654
|
daySize: baseSpacing * 8 / 7 + "px",
|
|
631
655
|
slideDuration: '0.2s'
|
|
632
656
|
},
|
|
633
657
|
medium: {
|
|
658
|
+
// title: {},
|
|
634
659
|
fontSize: baseFontSize + "px",
|
|
635
660
|
lineHeight: 1.45,
|
|
636
661
|
daySize: baseSpacing * 16 / 7 + "px",
|
|
637
662
|
slideDuration: '0.5s'
|
|
638
663
|
},
|
|
639
664
|
large: {
|
|
665
|
+
// title: {},
|
|
640
666
|
fontSize: baseFontSize + 3 * fontScale + "px",
|
|
641
667
|
lineHeight: 1.11,
|
|
642
668
|
daySize: baseSpacing * 32 / 7 + "px",
|
|
@@ -1161,7 +1187,8 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
1161
1187
|
weight: 600,
|
|
1162
1188
|
skeleton: {
|
|
1163
1189
|
width: {
|
|
1164
|
-
min: '
|
|
1190
|
+
min: '150px',
|
|
1191
|
+
max: '200px'
|
|
1165
1192
|
}
|
|
1166
1193
|
}
|
|
1167
1194
|
},
|
|
@@ -1182,7 +1209,9 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
1182
1209
|
// extend: undefined,
|
|
1183
1210
|
overlay: {
|
|
1184
1211
|
background: 'rgba(0, 0, 0, 0.5)'
|
|
1212
|
+
// backdropFilter: undefined,
|
|
1185
1213
|
},
|
|
1214
|
+
|
|
1186
1215
|
responsiveBreakpoint: 'small',
|
|
1187
1216
|
// when Layer takes over the full screen
|
|
1188
1217
|
zIndex: '20'
|
|
@@ -1926,6 +1955,7 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
1926
1955
|
// extend: undefined,
|
|
1927
1956
|
// gap: undefined,
|
|
1928
1957
|
header: {
|
|
1958
|
+
// alignSelf: undefined,
|
|
1929
1959
|
// background: undefined,
|
|
1930
1960
|
// border: {
|
|
1931
1961
|
// side: undefined,
|