grommet 2.29.0 → 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 +10 -14
- package/components/Button/StyledButtonKind.js +21 -9
- package/components/Calendar/Calendar.js +80 -71
- package/components/Data/Data.js +48 -26
- package/components/Data/DataForm.js +203 -48
- package/components/Data/filter.js +17 -6
- package/components/Data/index.d.ts +12 -7
- package/components/Data/index.js +6 -2
- package/components/Data/propTypes.js +3 -2
- 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 +53 -57
- 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 +114 -140
- package/components/Data/stories/StarWars.js +127 -0
- package/components/Data/stories/Views.js +56 -0
- package/components/DataFilter/DataFilter.js +33 -42
- package/components/DataFilter/stories/Simple.js +7 -4
- package/components/DataFilters/DataFilters.js +117 -40
- 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 +70 -13
- 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 +67 -18
- 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/DataSummary.js +4 -4
- package/components/DataSummary/index.d.ts +1 -1
- package/components/DataSummary/propTypes.js +2 -2
- package/components/DataSummary/stories/Simple.js +7 -4
- package/components/DataTable/Cell.js +1 -1
- package/components/DataTable/DataTable.js +23 -9
- package/components/DataTable/GroupedBody.js +1 -0
- package/components/DataTable/Resizer.js +1 -3
- package/components/DataTable/StyledDataTable.js +2 -2
- package/components/DataTable/index.d.ts +23 -6
- package/components/DataTable/stories/SpaceX.js +72 -76
- package/components/DataTable/stories/SpaceXUngrouped.js +33 -35
- package/components/DataTableColumns/DataTableColumns.js +226 -0
- package/components/DataTableColumns/README.md +2 -0
- package/components/DataTableColumns/index.d.ts +10 -0
- package/components/DataTableColumns/index.js +6 -0
- package/components/DataTableColumns/propTypes.js +18 -0
- package/components/DataTableColumns/stories/Simple.js +51 -0
- package/components/DataView/DataView.js +73 -0
- package/components/DataView/README.md +2 -0
- package/components/DataView/index.d.ts +15 -0
- package/components/DataView/index.js +6 -0
- package/components/DataView/propTypes.js +10 -0
- package/components/DataView/stories/Simple.js +51 -0
- package/components/DateInput/utils.js +1 -3
- package/components/Distribution/Distribution.js +1 -1
- package/components/Drop/DropContainer.js +56 -100
- 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/ValidateOnBlur.js +18 -0
- 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 +15 -4
- package/components/Layer/LayerContainer.js +2 -3
- package/components/Layer/PortalContext.js +1 -1
- package/components/Layer/StyledLayer.js +3 -1
- package/components/Layer/stories/Form.js +54 -28
- package/components/List/List.js +1 -8
- package/components/Pagination/Pagination.js +27 -8
- package/components/Paragraph/Paragraph.js +18 -6
- package/components/Select/utils.js +1 -1
- package/components/Skeleton/stories/GridContainer.js +1 -3
- 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/Video/Video.js +4 -8
- package/components/WorldMap/WorldMap.js +18 -17
- package/components/index.d.ts +2 -0
- package/components/index.js +18 -6
- package/es6/components/Anchor/Anchor.js +9 -3
- package/es6/components/Anchor/StyledAnchor.js +6 -3
- package/es6/components/Button/Button.js +10 -14
- package/es6/components/Button/StyledButtonKind.js +21 -9
- package/es6/components/Calendar/Calendar.js +80 -71
- package/es6/components/Data/Data.js +48 -26
- package/es6/components/Data/DataForm.js +199 -51
- package/es6/components/Data/filter.js +17 -6
- package/es6/components/Data/index.d.ts +12 -7
- package/es6/components/Data/index.js +1 -1
- package/es6/components/Data/propTypes.js +3 -2
- 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 +53 -57
- 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 +114 -140
- package/es6/components/Data/stories/StarWars.js +121 -0
- package/es6/components/Data/stories/Views.js +50 -0
- package/es6/components/DataFilter/DataFilter.js +33 -42
- package/es6/components/DataFilter/stories/Simple.js +8 -5
- package/es6/components/DataFilters/DataFilters.js +118 -41
- 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 +71 -14
- 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 +67 -18
- 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/DataSummary.js +4 -4
- package/es6/components/DataSummary/index.d.ts +1 -1
- package/es6/components/DataSummary/propTypes.js +2 -2
- package/es6/components/DataSummary/stories/Simple.js +8 -5
- package/es6/components/DataTable/Cell.js +2 -2
- package/es6/components/DataTable/DataTable.js +23 -9
- package/es6/components/DataTable/GroupedBody.js +1 -0
- package/es6/components/DataTable/Resizer.js +1 -3
- package/es6/components/DataTable/StyledDataTable.js +2 -2
- package/es6/components/DataTable/index.d.ts +23 -6
- package/es6/components/DataTable/stories/SpaceX.js +72 -76
- package/es6/components/DataTable/stories/SpaceXUngrouped.js +33 -35
- package/es6/components/DataTableColumns/DataTableColumns.js +219 -0
- package/es6/components/DataTableColumns/README.md +2 -0
- package/es6/components/DataTableColumns/index.d.ts +10 -0
- package/es6/components/DataTableColumns/index.js +1 -0
- package/es6/components/DataTableColumns/propTypes.js +12 -0
- package/es6/components/DataTableColumns/stories/Simple.js +46 -0
- package/es6/components/DataView/DataView.js +66 -0
- package/es6/components/DataView/README.md +2 -0
- package/es6/components/DataView/index.d.ts +15 -0
- package/es6/components/DataView/index.js +1 -0
- package/es6/components/DataView/propTypes.js +5 -0
- package/es6/components/DataView/stories/Simple.js +45 -0
- package/es6/components/DateInput/utils.js +1 -3
- package/es6/components/Distribution/Distribution.js +1 -1
- package/es6/components/Drop/DropContainer.js +58 -102
- 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/ValidateOnBlur.js +19 -1
- 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 +15 -4
- package/es6/components/Layer/LayerContainer.js +2 -3
- package/es6/components/Layer/PortalContext.js +1 -1
- package/es6/components/Layer/StyledLayer.js +3 -1
- package/es6/components/Layer/stories/Form.js +56 -29
- package/es6/components/List/List.js +1 -8
- package/es6/components/Pagination/Pagination.js +27 -8
- package/es6/components/Paragraph/Paragraph.js +19 -7
- package/es6/components/Select/utils.js +1 -1
- package/es6/components/Skeleton/stories/GridContainer.js +1 -3
- 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/Video/Video.js +4 -8
- package/es6/components/WorldMap/WorldMap.js +18 -17
- package/es6/components/index.d.ts +2 -0
- package/es6/components/index.js +3 -1
- package/es6/languages/default.json +14 -4
- package/es6/themes/base.d.ts +31 -0
- package/es6/themes/base.js +31 -1
- package/es6/utils/DOM.js +17 -0
- package/es6/utils/PortalContext.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 +14 -4
- package/package.json +42 -40
- package/themes/base.d.ts +31 -0
- package/themes/base.js +31 -1
- package/utils/DOM.js +20 -2
- package/utils/PortalContext.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
package/components/Text/Text.js
CHANGED
|
@@ -10,6 +10,7 @@ var _utils = require("../../utils");
|
|
|
10
10
|
var _propTypes = require("./propTypes");
|
|
11
11
|
var _Skeleton = require("../Skeleton");
|
|
12
12
|
var _TextSkeleton = require("./TextSkeleton");
|
|
13
|
+
var _TextContext = require("./TextContext");
|
|
13
14
|
var _excluded = ["children", "color", "tag", "as", "tip", "a11yTitle", "truncate", "size", "skeleton"];
|
|
14
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -31,6 +32,11 @@ var Text = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
31
32
|
var _useState = (0, _react.useState)(false),
|
|
32
33
|
textTruncated = _useState[0],
|
|
33
34
|
setTextTruncated = _useState[1];
|
|
35
|
+
var textContextValue = (0, _react.useMemo)(function () {
|
|
36
|
+
return {
|
|
37
|
+
size: size
|
|
38
|
+
};
|
|
39
|
+
}, [size]);
|
|
34
40
|
var skeleton = (0, _Skeleton.useSkeleton)();
|
|
35
41
|
(0, _useIsomorphicLayoutEffect.useLayoutEffect)(function () {
|
|
36
42
|
var updateTip = function updateTip() {
|
|
@@ -60,7 +66,9 @@ var Text = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
60
66
|
size: size
|
|
61
67
|
}, rest, {
|
|
62
68
|
ref: textRef
|
|
63
|
-
}),
|
|
69
|
+
}), /*#__PURE__*/_react["default"].createElement(_TextContext.TextContext.Provider, {
|
|
70
|
+
value: textContextValue
|
|
71
|
+
}, children));
|
|
64
72
|
if (tipProp || textTruncated) {
|
|
65
73
|
// place the text content in a tip if truncate === 'tip'
|
|
66
74
|
// and the text has been truncated
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.TextContext = void 0;
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
7
|
+
var TextContext = /*#__PURE__*/_react["default"].createContext({});
|
|
8
|
+
exports.TextContext = TextContext;
|
|
@@ -16,7 +16,7 @@ var getPlainStyle = function getPlainStyle(plain) {
|
|
|
16
16
|
var StyledTextInput = _styledComponents["default"].input.withConfig({
|
|
17
17
|
displayName: "StyledTextInput",
|
|
18
18
|
componentId: "sc-1x30a0s-0"
|
|
19
|
-
})(["", " ", " ", " ", " ", " ", ";"], _utils.inputStyle, function (props) {
|
|
19
|
+
})(["", " ", " ", " ", " ", " ", " ", ";"], _utils.inputStyle, function (props) {
|
|
20
20
|
return getPlainStyle(props.plain);
|
|
21
21
|
}, function (props) {
|
|
22
22
|
return props.icon && (props.reverse ? "padding-right: " + props.theme.global.edgeSize.large + ";" : "padding-left: " + props.theme.global.edgeSize.large + ";");
|
|
@@ -24,6 +24,8 @@ var StyledTextInput = _styledComponents["default"].input.withConfig({
|
|
|
24
24
|
return props.disabled && (0, _utils.disabledStyle)(props.theme.textInput.disabled && props.theme.textInput.disabled.opacity);
|
|
25
25
|
}, function (props) {
|
|
26
26
|
return props.textAlign && _utils.textAlignStyle;
|
|
27
|
+
}, function (props) {
|
|
28
|
+
return props.widthProp && (0, _utils.widthStyle)(props.widthProp, props.theme);
|
|
27
29
|
}, function (props) {
|
|
28
30
|
return props.theme.textInput && props.theme.textInput.extend;
|
|
29
31
|
});
|
|
@@ -16,7 +16,7 @@ var _utils = require("../../utils");
|
|
|
16
16
|
var _StyledTextInput = require("./StyledTextInput");
|
|
17
17
|
var _MessageContext = require("../../contexts/MessageContext");
|
|
18
18
|
var _propTypes = require("./propTypes");
|
|
19
|
-
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"];
|
|
19
|
+
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"];
|
|
20
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
21
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
22
22
|
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); }
|
|
@@ -77,6 +77,7 @@ var TextInput = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
77
77
|
suggestions = _ref.suggestions,
|
|
78
78
|
textAlign = _ref.textAlign,
|
|
79
79
|
valueProp = _ref.value,
|
|
80
|
+
widthProp = _ref.width,
|
|
80
81
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
81
82
|
var theme = (0, _react.useContext)(_styledComponents.ThemeContext) || _defaultProps.defaultProps.theme;
|
|
82
83
|
var _useContext = (0, _react.useContext)(_MessageContext.MessageContext),
|
|
@@ -369,7 +370,8 @@ var TextInput = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
369
370
|
reverse: reverse,
|
|
370
371
|
focus: focus,
|
|
371
372
|
focusIndicator: focusIndicator,
|
|
372
|
-
textAlign: textAlign
|
|
373
|
+
textAlign: textAlign,
|
|
374
|
+
widthProp: widthProp
|
|
373
375
|
}, rest, extraProps, comboboxProps, {
|
|
374
376
|
defaultValue: renderLabel(defaultValue),
|
|
375
377
|
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>;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.TextInputPropTypes = void 0;
|
|
5
5
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
6
|
+
var _generalPropTypes = require("../../utils/general-prop-types");
|
|
6
7
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
7
8
|
var PropType = {};
|
|
8
9
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -43,7 +44,8 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
43
44
|
value: _propTypes["default"].any // this is intentional any
|
|
44
45
|
}), _propTypes["default"].string])),
|
|
45
46
|
textAlign: _propTypes["default"].oneOf(['start', 'center', 'end']),
|
|
46
|
-
value: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number])
|
|
47
|
+
value: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
|
|
48
|
+
width: _generalPropTypes.widthPropType
|
|
47
49
|
};
|
|
48
50
|
}
|
|
49
51
|
var TextInputPropTypes = PropType;
|
|
@@ -178,7 +178,7 @@ var Video = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
178
178
|
var nextCaptions = [];
|
|
179
179
|
var set = false;
|
|
180
180
|
// iterate through all of the tracks provided
|
|
181
|
-
var _loop = function _loop(
|
|
181
|
+
var _loop = function _loop() {
|
|
182
182
|
var track = textTracks[i];
|
|
183
183
|
var active = track.mode === 'showing';
|
|
184
184
|
var getActiveTrack = function getActiveTrack(currentVideoTime) {
|
|
@@ -223,7 +223,7 @@ var Video = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
223
223
|
}
|
|
224
224
|
};
|
|
225
225
|
for (var i = 0; i < textTracks.length; i += 1) {
|
|
226
|
-
_loop(
|
|
226
|
+
_loop();
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
}, [activeTrack, announce, announceAudioDescription, captions, height, videoRef, width]);
|
|
@@ -263,9 +263,7 @@ var Video = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
263
263
|
}, [videoRef]);
|
|
264
264
|
var showCaptions = (0, _react.useCallback)(function (index) {
|
|
265
265
|
var textTracks = videoRef.current.textTracks;
|
|
266
|
-
for (var i = 0; i < textTracks.length; i += 1)
|
|
267
|
-
textTracks[i].mode = i === index ? 'showing' : 'hidden';
|
|
268
|
-
}
|
|
266
|
+
for (var i = 0; i < textTracks.length; i += 1) textTracks[i].mode = i === index ? 'showing' : 'hidden';
|
|
269
267
|
}, [videoRef]);
|
|
270
268
|
var fullscreen = (0, _react.useCallback)(function () {
|
|
271
269
|
var video = videoRef.current;
|
|
@@ -409,9 +407,7 @@ var Video = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
409
407
|
return undefined;
|
|
410
408
|
}
|
|
411
409
|
if (item === 'captions' && typeof buttonProps[item] === 'object') {
|
|
412
|
-
for (var i = 0; i < buttonProps[item].length; i += 1)
|
|
413
|
-
controlsMenuItems.push(buttonProps[item][i]);
|
|
414
|
-
}
|
|
410
|
+
for (var i = 0; i < buttonProps[item].length; i += 1) controlsMenuItems.push(buttonProps[item][i]);
|
|
415
411
|
return undefined;
|
|
416
412
|
}
|
|
417
413
|
if (item === 'descriptions') {
|
|
@@ -117,9 +117,7 @@ var buildContinent = function buildContinent(_ref3) {
|
|
|
117
117
|
var dots = dotsProp.map(function (segment) {
|
|
118
118
|
var count = segment[2];
|
|
119
119
|
var spots = [];
|
|
120
|
-
for (var i = 0; i < count; i += 1)
|
|
121
|
-
spots.push('h0');
|
|
122
|
-
}
|
|
120
|
+
for (var i = 0; i < count; i += 1) spots.push('h0');
|
|
123
121
|
var dotCommands = spots.join(' m10,0 ');
|
|
124
122
|
var x = FACTOR * (origin[0] + segment[0] + 1);
|
|
125
123
|
var y = FACTOR * (origin[1] + segment[1] + 1);
|
|
@@ -224,6 +222,11 @@ var WorldMap = /*#__PURE__*/(0, _react.forwardRef)(function (_ref5, ref) {
|
|
|
224
222
|
var _React$useState2 = _react["default"].useState([]),
|
|
225
223
|
places = _React$useState2[0],
|
|
226
224
|
setPlaces = _React$useState2[1];
|
|
225
|
+
|
|
226
|
+
// targets are used for the Drops associated with places content
|
|
227
|
+
var _React$useState3 = _react["default"].useState([]),
|
|
228
|
+
targets = _React$useState3[0],
|
|
229
|
+
setTargets = _React$useState3[1];
|
|
227
230
|
_react["default"].useEffect(function () {
|
|
228
231
|
if (placesProp) {
|
|
229
232
|
setPlaces(placesProp.map(function (_ref6) {
|
|
@@ -236,25 +239,23 @@ var WorldMap = /*#__PURE__*/(0, _react.forwardRef)(function (_ref5, ref) {
|
|
|
236
239
|
}, place);
|
|
237
240
|
}));
|
|
238
241
|
} else setPlaces([]);
|
|
242
|
+
return function () {
|
|
243
|
+
setTargets([]);
|
|
244
|
+
};
|
|
239
245
|
}, [placesProp, world]);
|
|
240
|
-
var _React$useState3 = _react["default"].useState(),
|
|
241
|
-
over = _React$useState3[0],
|
|
242
|
-
setOver = _React$useState3[1];
|
|
243
246
|
var _React$useState4 = _react["default"].useState(),
|
|
244
|
-
|
|
245
|
-
|
|
247
|
+
over = _React$useState4[0],
|
|
248
|
+
setOver = _React$useState4[1];
|
|
246
249
|
var _React$useState5 = _react["default"].useState(),
|
|
247
|
-
|
|
248
|
-
|
|
250
|
+
activeCoords = _React$useState5[0],
|
|
251
|
+
setActiveCoords = _React$useState5[1];
|
|
249
252
|
var _React$useState6 = _react["default"].useState(),
|
|
250
|
-
|
|
251
|
-
|
|
253
|
+
activeContinent = _React$useState6[0],
|
|
254
|
+
setActiveContinent = _React$useState6[1];
|
|
255
|
+
var _React$useState7 = _react["default"].useState(),
|
|
256
|
+
activePlace = _React$useState7[0],
|
|
257
|
+
setActivePlace = _React$useState7[1];
|
|
252
258
|
var containerRef = _react["default"].useRef();
|
|
253
|
-
|
|
254
|
-
// targets are used for the Drops associated with places content
|
|
255
|
-
var _React$useState7 = _react["default"].useState([]),
|
|
256
|
-
targets = _React$useState7[0],
|
|
257
|
-
setTargets = _React$useState7[1];
|
|
258
259
|
var placeRef = _react["default"].useCallback(function (node, index) {
|
|
259
260
|
setTargets(function (prevTargets) {
|
|
260
261
|
if (!prevTargets[index]) {
|
package/components/index.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ export * from './DataSearch';
|
|
|
24
24
|
export * from './DataSort';
|
|
25
25
|
export * from './DataSummary';
|
|
26
26
|
export * from './DataTable';
|
|
27
|
+
export * from './DataTableColumns';
|
|
28
|
+
export * from './DataView';
|
|
27
29
|
export * from './DateInput';
|
|
28
30
|
export * from './Diagram';
|
|
29
31
|
export * from './Distribution';
|
package/components/index.js
CHANGED
|
@@ -133,12 +133,6 @@ Object.keys(_DataFilters).forEach(function (key) {
|
|
|
133
133
|
if (key in exports && exports[key] === _DataFilters[key]) return;
|
|
134
134
|
exports[key] = _DataFilters[key];
|
|
135
135
|
});
|
|
136
|
-
var _DataTable = require("./DataTable");
|
|
137
|
-
Object.keys(_DataTable).forEach(function (key) {
|
|
138
|
-
if (key === "default" || key === "__esModule") return;
|
|
139
|
-
if (key in exports && exports[key] === _DataTable[key]) return;
|
|
140
|
-
exports[key] = _DataTable[key];
|
|
141
|
-
});
|
|
142
136
|
var _DataSearch = require("./DataSearch");
|
|
143
137
|
Object.keys(_DataSearch).forEach(function (key) {
|
|
144
138
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -157,6 +151,24 @@ Object.keys(_DataSummary).forEach(function (key) {
|
|
|
157
151
|
if (key in exports && exports[key] === _DataSummary[key]) return;
|
|
158
152
|
exports[key] = _DataSummary[key];
|
|
159
153
|
});
|
|
154
|
+
var _DataTable = require("./DataTable");
|
|
155
|
+
Object.keys(_DataTable).forEach(function (key) {
|
|
156
|
+
if (key === "default" || key === "__esModule") return;
|
|
157
|
+
if (key in exports && exports[key] === _DataTable[key]) return;
|
|
158
|
+
exports[key] = _DataTable[key];
|
|
159
|
+
});
|
|
160
|
+
var _DataTableColumns = require("./DataTableColumns");
|
|
161
|
+
Object.keys(_DataTableColumns).forEach(function (key) {
|
|
162
|
+
if (key === "default" || key === "__esModule") return;
|
|
163
|
+
if (key in exports && exports[key] === _DataTableColumns[key]) return;
|
|
164
|
+
exports[key] = _DataTableColumns[key];
|
|
165
|
+
});
|
|
166
|
+
var _DataView = require("./DataView");
|
|
167
|
+
Object.keys(_DataView).forEach(function (key) {
|
|
168
|
+
if (key === "default" || key === "__esModule") return;
|
|
169
|
+
if (key in exports && exports[key] === _DataView[key]) return;
|
|
170
|
+
exports[key] = _DataView[key];
|
|
171
|
+
});
|
|
160
172
|
var _DateInput = require("./DateInput");
|
|
161
173
|
Object.keys(_DateInput).forEach(function (key) {
|
|
162
174
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["a11yTitle", "aria-label", "children", "color", "disabled", "gap", "href", "icon", "label", "onBlur", "onClick", "onFocus", "reverse"];
|
|
1
|
+
var _excluded = ["a11yTitle", "aria-label", "children", "color", "disabled", "gap", "href", "icon", "label", "onBlur", "onClick", "onFocus", "reverse", "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
4
|
import React, { cloneElement, forwardRef, useCallback, useContext, useEffect, useState } from 'react';
|
|
@@ -9,6 +9,7 @@ import { Box } from '../Box';
|
|
|
9
9
|
import { StyledAnchor } from './StyledAnchor';
|
|
10
10
|
import { AnchorPropTypes } from './propTypes';
|
|
11
11
|
import { useAnalytics } from '../../contexts/AnalyticsContext';
|
|
12
|
+
import { TextContext } from '../Text/TextContext';
|
|
12
13
|
var Anchor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
13
14
|
var a11yTitle = _ref.a11yTitle,
|
|
14
15
|
ariaLabel = _ref['aria-label'],
|
|
@@ -23,11 +24,14 @@ var Anchor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
23
24
|
onClickProp = _ref.onClick,
|
|
24
25
|
_onFocus = _ref.onFocus,
|
|
25
26
|
reverse = _ref.reverse,
|
|
27
|
+
sizeProp = _ref.size,
|
|
26
28
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
27
29
|
var theme = useContext(ThemeContext) || defaultProps.theme;
|
|
28
30
|
var _useState = useState(),
|
|
29
31
|
focus = _useState[0],
|
|
30
32
|
setFocus = _useState[1];
|
|
33
|
+
var _useContext = useContext(TextContext),
|
|
34
|
+
size = _useContext.size;
|
|
31
35
|
var sendAnalytics = useAnalytics();
|
|
32
36
|
var onClick = useCallback(function (event) {
|
|
33
37
|
sendAnalytics({
|
|
@@ -46,8 +50,9 @@ var Anchor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
46
50
|
}, [children, icon, label]);
|
|
47
51
|
var coloredIcon = icon;
|
|
48
52
|
if (icon && !icon.props.color) {
|
|
53
|
+
var _theme$anchor, _theme$anchor$size, _theme$anchor$size2;
|
|
49
54
|
coloredIcon = /*#__PURE__*/cloneElement(icon, {
|
|
50
|
-
color: normalizeColor(color || theme.anchor.color, theme)
|
|
55
|
+
color: normalizeColor(color || ((_theme$anchor = theme.anchor) == null ? void 0 : (_theme$anchor$size = _theme$anchor.size) == null ? void 0 : (_theme$anchor$size2 = _theme$anchor$size[sizeProp || size]) == null ? void 0 : _theme$anchor$size2.color) || theme.anchor.color, theme)
|
|
51
56
|
});
|
|
52
57
|
}
|
|
53
58
|
var first = reverse ? label : coloredIcon;
|
|
@@ -70,7 +75,8 @@ var Anchor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
70
75
|
onBlur: function onBlur(event) {
|
|
71
76
|
setFocus(false);
|
|
72
77
|
if (_onBlur) _onBlur(event);
|
|
73
|
-
}
|
|
78
|
+
},
|
|
79
|
+
size: sizeProp || size
|
|
74
80
|
}), first && second ? /*#__PURE__*/React.createElement(Box, {
|
|
75
81
|
as: "span",
|
|
76
82
|
direction: "row",
|
|
@@ -22,11 +22,14 @@ var StyledAnchor = styled.a.withConfig({
|
|
|
22
22
|
})(["box-sizing:border-box;", " color:", ";", " text-decoration:", ";cursor:pointer;", " ", " ", " ", " ", " ", ""], function (props) {
|
|
23
23
|
return sizeStyle(props);
|
|
24
24
|
}, function (props) {
|
|
25
|
-
|
|
25
|
+
var _props$theme$anchor, _props$theme$anchor$s, _props$theme$anchor$s2;
|
|
26
|
+
return normalizeColor(props.colorProp || ((_props$theme$anchor = props.theme.anchor) == null ? void 0 : (_props$theme$anchor$s = _props$theme$anchor.size) == null ? void 0 : (_props$theme$anchor$s2 = _props$theme$anchor$s[props.size]) == null ? void 0 : _props$theme$anchor$s2.color) || props.theme.anchor.color, props.theme);
|
|
26
27
|
}, function (props) {
|
|
27
|
-
|
|
28
|
+
var _props$theme$anchor2, _props$theme$anchor2$, _props$theme$anchor2$2, _props$theme$anchor3, _props$theme$anchor3$, _props$theme$anchor3$2;
|
|
29
|
+
return props.weight ? "font-weight: " + props.weight + ";" : (((_props$theme$anchor2 = props.theme.anchor) == null ? void 0 : (_props$theme$anchor2$ = _props$theme$anchor2.size) == null ? void 0 : (_props$theme$anchor2$2 = _props$theme$anchor2$[props.size]) == null ? void 0 : _props$theme$anchor2$2.fontWeight) || props.theme.anchor.fontWeight) && "font-weight: " + (((_props$theme$anchor3 = props.theme.anchor) == null ? void 0 : (_props$theme$anchor3$ = _props$theme$anchor3.size) == null ? void 0 : (_props$theme$anchor3$2 = _props$theme$anchor3$[props.size]) == null ? void 0 : _props$theme$anchor3$2.fontWeight) || props.theme.anchor.fontWeight) + ";";
|
|
28
30
|
}, function (props) {
|
|
29
|
-
|
|
31
|
+
var _props$theme$anchor4, _props$theme$anchor4$, _props$theme$anchor4$2;
|
|
32
|
+
return props.hasIcon ? 'none' : ((_props$theme$anchor4 = props.theme.anchor) == null ? void 0 : (_props$theme$anchor4$ = _props$theme$anchor4.size) == null ? void 0 : (_props$theme$anchor4$2 = _props$theme$anchor4$[props.size]) == null ? void 0 : _props$theme$anchor4$2.textDecoration) || props.theme.anchor.textDecoration;
|
|
30
33
|
}, genericStyles, function (props) {
|
|
31
34
|
return !props.disabled && props.theme.anchor.hover && css(["&:hover{", " ", " ", "}"], props.theme.anchor.hover.textDecoration && "text-decoration: " + props.theme.anchor.hover.textDecoration + ";", props.theme.anchor.hover.fontWeight && "font-weight: " + props.theme.anchor.hover.fontWeight + ";", props.theme.anchor.hover.extend);
|
|
32
35
|
}, function (props) {
|
|
@@ -54,9 +54,7 @@ var getIconColor = function getIconColor(paths, theme, colorProp, kind) {
|
|
|
54
54
|
// for example: 'active.primary'
|
|
55
55
|
if (paths[index]) {
|
|
56
56
|
var parts = paths[index].split('.');
|
|
57
|
-
while (obj && parts.length)
|
|
58
|
-
obj = obj[parts.shift()];
|
|
59
|
-
}
|
|
57
|
+
while (obj && parts.length) obj = obj[parts.shift()];
|
|
60
58
|
}
|
|
61
59
|
if (obj) {
|
|
62
60
|
var _obj, _obj$icon, _obj$icon$props;
|
|
@@ -73,9 +71,7 @@ var getIconColor = function getIconColor(paths, theme, colorProp, kind) {
|
|
|
73
71
|
else if (paths[index + 1]) {
|
|
74
72
|
var _obj2, _obj2$icon, _obj2$icon$props;
|
|
75
73
|
var _parts = paths[index + 1].split('.');
|
|
76
|
-
while (baseObj && _parts.length)
|
|
77
|
-
obj = baseObj[_parts.shift()];
|
|
78
|
-
}
|
|
74
|
+
while (baseObj && _parts.length) obj = baseObj[_parts.shift()];
|
|
79
75
|
if ((_obj2 = obj) != null && (_obj2$icon = _obj2.icon) != null && (_obj2$icon$props = _obj2$icon.props) != null && _obj2$icon$props.color) color = obj.icon.props.color;
|
|
80
76
|
}
|
|
81
77
|
// use passed in color for text if the theme doesn't have
|
|
@@ -106,9 +102,7 @@ var getKindIcon = function getKindIcon(paths, theme, kind) {
|
|
|
106
102
|
// for example: 'active.primary'
|
|
107
103
|
if (paths[index]) {
|
|
108
104
|
var parts = paths[index].split('.');
|
|
109
|
-
while (obj && parts.length)
|
|
110
|
-
obj = obj[parts.shift()];
|
|
111
|
-
}
|
|
105
|
+
while (obj && parts.length) obj = obj[parts.shift()];
|
|
112
106
|
}
|
|
113
107
|
if ((_obj3 = obj) != null && _obj3.icon) result = obj.icon;
|
|
114
108
|
index -= 1;
|
|
@@ -125,9 +119,7 @@ var getPropertyColor = function getPropertyColor(property, paths, theme, kind, p
|
|
|
125
119
|
// index 0 is default state
|
|
126
120
|
if (paths[0]) {
|
|
127
121
|
var parts = paths[0].split('.');
|
|
128
|
-
while (obj && parts.length)
|
|
129
|
-
obj = obj[parts.shift()];
|
|
130
|
-
}
|
|
122
|
+
while (obj && parts.length) obj = obj[parts.shift()];
|
|
131
123
|
}
|
|
132
124
|
if (obj) {
|
|
133
125
|
result = obj[property] || obj[property] && obj[property].color;
|
|
@@ -168,7 +160,7 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
168
160
|
reverseProp = _ref.reverse,
|
|
169
161
|
secondary = _ref.secondary,
|
|
170
162
|
selected = _ref.selected,
|
|
171
|
-
|
|
163
|
+
sizeProp = _ref.size,
|
|
172
164
|
tip = _ref.tip,
|
|
173
165
|
_ref$type = _ref.type,
|
|
174
166
|
type = _ref$type === void 0 ? 'button' : _ref$type,
|
|
@@ -216,6 +208,9 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
216
208
|
return undefined; // pre-default, no kind
|
|
217
209
|
}, [kindArg, kindObj, primary, secondary, theme]);
|
|
218
210
|
|
|
211
|
+
// for backwards compatibility, no-kind button theme did not
|
|
212
|
+
// default to size "medium" on buttons with no size prop
|
|
213
|
+
var size = sizeProp || kind && 'medium' || undefined;
|
|
219
214
|
// When we have a kind and are not plain, themePaths stores the relative
|
|
220
215
|
// paths within the theme for the current kind and state of the button.
|
|
221
216
|
// These paths are used with getIconColor() above and kindStyle() within
|
|
@@ -305,8 +300,9 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
305
300
|
var second = reverse ? buttonIcon : label;
|
|
306
301
|
var contents;
|
|
307
302
|
if (first && second) {
|
|
303
|
+
var _theme$button, _theme$button$kind2;
|
|
308
304
|
contents = /*#__PURE__*/React.createElement(Box, {
|
|
309
|
-
direction:
|
|
305
|
+
direction: ((_theme$button = theme.button) == null ? void 0 : (_theme$button$kind2 = _theme$button[kind]) == null ? void 0 : _theme$button$kind2.direction) || 'row',
|
|
310
306
|
align: "center",
|
|
311
307
|
justify: justify || (align === 'center' ? 'center' : 'between'),
|
|
312
308
|
gap: gap || theme.button.gap,
|
|
@@ -15,12 +15,20 @@ var fontStyle = function fontStyle(props) {
|
|
|
15
15
|
var data = props.theme.text[size];
|
|
16
16
|
return css(["font-size:", ";line-height:", ";"], data.size, data.height);
|
|
17
17
|
};
|
|
18
|
-
var padFromTheme = function padFromTheme(size, theme, themeObj, kind) {
|
|
19
|
-
var _themeObj$size, _themeObj$size$size, _themeObj$size$size$
|
|
18
|
+
var padFromTheme = function padFromTheme(size, theme, themeObj, kind, iconOnly) {
|
|
19
|
+
var _themeObj$size, _themeObj$size$size, _themeObj$size$size$i, _themeObj$size3, _themeObj$size3$size, _themeObj$size3$size$;
|
|
20
20
|
if (size === void 0) {
|
|
21
21
|
size = 'medium';
|
|
22
22
|
}
|
|
23
|
-
if (size && themeObj != null && (_themeObj$size = themeObj.size) != null && (_themeObj$size$size = _themeObj$size[size]) != null && (_themeObj$size$size$
|
|
23
|
+
if (size && iconOnly && themeObj != null && (_themeObj$size = themeObj.size) != null && (_themeObj$size$size = _themeObj$size[size]) != null && (_themeObj$size$size$i = _themeObj$size$size.iconOnly) != null && _themeObj$size$size$i.pad) {
|
|
24
|
+
var _themeObj$size2, _themeObj$size2$size, _themeObj$size2$size$;
|
|
25
|
+
var pad = themeObj == null ? void 0 : (_themeObj$size2 = themeObj.size) == null ? void 0 : (_themeObj$size2$size = _themeObj$size2[size]) == null ? void 0 : (_themeObj$size2$size$ = _themeObj$size2$size.iconOnly) == null ? void 0 : _themeObj$size2$size$.pad;
|
|
26
|
+
return {
|
|
27
|
+
vertical: typeof pad === 'string' ? pad : pad.vertical,
|
|
28
|
+
horizontal: typeof pad === 'string' ? pad : pad.horizontal
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
if (size && themeObj != null && (_themeObj$size3 = themeObj.size) != null && (_themeObj$size3$size = _themeObj$size3[size]) != null && (_themeObj$size3$size$ = _themeObj$size3$size[kind]) != null && _themeObj$size3$size$.pad) {
|
|
24
32
|
return themeObj.size[size][kind].pad;
|
|
25
33
|
}
|
|
26
34
|
if (size && themeObj.size && themeObj.size[size] && themeObj.size[size].pad) {
|
|
@@ -38,13 +46,16 @@ var padFromTheme = function padFromTheme(size, theme, themeObj, kind) {
|
|
|
38
46
|
return undefined;
|
|
39
47
|
};
|
|
40
48
|
var padStyle = function padStyle(_ref) {
|
|
41
|
-
var
|
|
49
|
+
var hasIcon = _ref.hasIcon,
|
|
50
|
+
hasLabel = _ref.hasLabel,
|
|
51
|
+
size = _ref.sizeProp,
|
|
42
52
|
theme = _ref.theme,
|
|
43
53
|
kind = _ref.kind;
|
|
44
54
|
// caller has specified a themeObj to use for styling
|
|
45
55
|
// relevant for cases like pagination which looks to theme.pagination.button
|
|
46
56
|
var themeObj = typeof kind === 'object' ? kind : theme.button;
|
|
47
|
-
var
|
|
57
|
+
var iconOnly = hasIcon && !hasLabel;
|
|
58
|
+
var pad = padFromTheme(size, theme, themeObj, kind, iconOnly);
|
|
48
59
|
return pad ? css(["padding:", " ", ";"], pad.vertical, pad.horizontal) : '';
|
|
49
60
|
};
|
|
50
61
|
var basicStyle = function basicStyle(props) {
|
|
@@ -55,9 +66,7 @@ var getPath = function getPath(theme, path) {
|
|
|
55
66
|
if (path) {
|
|
56
67
|
obj = theme;
|
|
57
68
|
var parts = path.split('.');
|
|
58
|
-
while (obj && parts.length)
|
|
59
|
-
obj = obj[parts.shift()];
|
|
60
|
-
}
|
|
69
|
+
while (obj && parts.length) obj = obj[parts.shift()];
|
|
61
70
|
}
|
|
62
71
|
return obj;
|
|
63
72
|
};
|
|
@@ -69,6 +78,8 @@ var adjustPadStyle = function adjustPadStyle(pad, width) {
|
|
|
69
78
|
// build up CSS from basic to specific based on the supplied sub-object paths
|
|
70
79
|
var kindStyle = function kindStyle(_ref2) {
|
|
71
80
|
var colorValue = _ref2.colorValue,
|
|
81
|
+
hasIcon = _ref2.hasIcon,
|
|
82
|
+
hasLabel = _ref2.hasLabel,
|
|
72
83
|
kind = _ref2.kind,
|
|
73
84
|
size = _ref2.sizeProp,
|
|
74
85
|
themePaths = _ref2.themePaths,
|
|
@@ -78,7 +89,8 @@ var kindStyle = function kindStyle(_ref2) {
|
|
|
78
89
|
// caller has specified a themeObj to use for styling
|
|
79
90
|
// relevant for cases like pagination which looks to theme.pagination.button
|
|
80
91
|
var themeObj = typeof kind === 'object' ? kind : theme.button;
|
|
81
|
-
var
|
|
92
|
+
var iconOnly = hasIcon && !hasLabel;
|
|
93
|
+
var pad = padFromTheme(size, theme, themeObj, kind, iconOnly);
|
|
82
94
|
themePaths.base.forEach(function (themePath) {
|
|
83
95
|
var obj = getPath(themeObj, themePath);
|
|
84
96
|
if (obj) {
|