grommet 2.41.0 → 2.43.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/all/stories/Colors.js +6 -6
- package/components/Accordion/stories/CustomThemed/Rich.tsx +1 -1
- package/components/AccordionPanel/AccordionPanel.js +1 -7
- package/components/Box/Box.js +1 -1
- package/components/Box/StyledBox.js +1 -6
- package/components/Box/index.d.ts +1 -0
- package/components/Box/propTypes.js +1 -0
- package/components/Box/stories/Background.js +4 -10
- package/components/Button/Button.js +1 -0
- package/components/Button/StyledButton.js +3 -2
- package/components/Calendar/Calendar.js +96 -59
- package/components/Calendar/StyledCalendar.js +89 -7
- package/components/Calendar/utils.js +16 -2
- package/components/Card/stories/Simple.js +2 -2
- package/components/Carousel/Carousel.js +1 -1
- package/components/Chart/Chart.js +3 -3
- package/components/CheckBox/CheckBox.js +3 -2
- package/components/CheckBoxGroup/CheckBoxGroup.js +1 -1
- package/components/Clock/Digital.js +1 -1
- package/components/Data/stories/Cards.js +3 -2
- package/components/Data/stories/Infinite.js +2 -2
- package/components/Data/stories/OnSelect.js +2 -2
- package/components/Data/stories/Properties.js +3 -2
- package/components/Data/stories/SpaceX.js +2 -2
- package/components/Data/stories/StarWars.js +1 -1
- package/components/DataFilter/DataFilter.js +1 -1
- package/components/DataSort/DataSort.js +46 -14
- package/components/DataSort/stories/Simple.js +10 -1
- package/components/DataTable/Body.js +14 -8
- package/components/DataTable/GroupedBody.js +3 -3
- package/components/DataTable/buildState.js +5 -1
- package/components/DataTable/stories/SpaceX.js +2 -2
- package/components/DataTable/stories/SpaceXUngrouped.js +1 -1
- package/components/FileInput/index.d.ts +2 -3
- package/components/FormField/FormField.js +9 -2
- package/components/FormField/stories/ThresholdValidation.js +5 -1
- package/components/Grommet/index.d.ts +19 -1
- package/components/Grommet/propTypes.js +18 -0
- package/components/Grommet/stories/Theme.js +1 -1
- package/components/Grommet/stories/Vars.js +2 -2
- package/components/Layer/Layer.js +1 -1
- package/components/Layer/index.d.ts +2 -0
- package/components/List/List.js +43 -13
- package/components/List/stories/RenderedList.js +1 -1
- package/components/Meter/Circle.js +2 -2
- package/components/Meter/Meter.js +36 -17
- package/components/Meter/index.d.ts +18 -0
- package/components/Meter/propTypes.js +18 -0
- package/components/Notification/Notification.js +18 -6
- package/components/Notification/index.d.ts +1 -0
- package/components/Notification/propTypes.js +1 -0
- package/components/Pagination/Pagination.js +4 -2
- package/components/Pagination/stories/CustomThemed/Custom.tsx +8 -2
- package/components/Pagination/stories/NumberEdgePages.js +2 -0
- package/components/Pagination/stories/NumberMiddlePages.js +2 -0
- package/components/Pagination/stories/Simple.js +4 -2
- package/components/Pagination/stories/Size.js +3 -0
- package/components/Pagination/stories/Steps.js +3 -0
- package/components/RadioButton/RadioButton.js +14 -3
- package/components/RadioButton/stories/Children.js +16 -3
- package/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/components/RadioButtonGroup/stories/Children.js +13 -1
- package/components/Select/Select.js +7 -3
- package/components/Select/SelectContainer.js +41 -34
- package/components/Select/index.d.ts +1 -1
- package/components/Select/utils.js +13 -2
- package/components/SelectMultiple/SelectMultiple.js +10 -0
- package/components/SelectMultiple/SelectMultipleContainer.js +28 -2
- package/components/SelectMultiple/SelectMultipleValue.js +14 -1
- package/components/SkipLinks/index.d.ts +1 -0
- package/components/SkipLinks/propTypes.js +1 -0
- package/components/Tab/Tab.js +1 -1
- package/components/Tabs/stories/Scrollable.js +2 -1
- package/components/Tag/Tag.js +11 -7
- package/components/TextInput/TextInput.js +7 -2
- package/components/ToggleGroup/StyledToggleGroup.js +12 -5
- package/components/ToggleGroup/ToggleGroup.js +21 -10
- package/components/WorldMap/WorldMap.js +1 -1
- package/es6/all/stories/Colors.js +6 -6
- package/es6/components/Accordion/stories/CustomThemed/Rich.tsx +1 -1
- package/es6/components/AccordionPanel/AccordionPanel.js +2 -9
- package/es6/components/Box/Box.js +1 -1
- package/es6/components/Box/StyledBox.js +1 -6
- package/es6/components/Box/index.d.ts +1 -0
- package/es6/components/Box/propTypes.js +1 -0
- package/es6/components/Box/stories/Background.js +4 -10
- package/es6/components/Button/Button.js +1 -0
- package/es6/components/Button/StyledButton.js +4 -3
- package/es6/components/Calendar/Calendar.js +95 -59
- package/es6/components/Calendar/StyledCalendar.js +90 -8
- package/es6/components/Calendar/utils.js +15 -1
- package/es6/components/Card/stories/Simple.js +3 -3
- package/es6/components/Carousel/Carousel.js +1 -1
- package/es6/components/Chart/Chart.js +3 -3
- package/es6/components/CheckBox/CheckBox.js +3 -2
- package/es6/components/CheckBoxGroup/CheckBoxGroup.js +1 -1
- package/es6/components/Clock/Digital.js +1 -1
- package/es6/components/Data/stories/Cards.js +4 -3
- package/es6/components/Data/stories/Infinite.js +2 -2
- package/es6/components/Data/stories/OnSelect.js +2 -2
- package/es6/components/Data/stories/Properties.js +4 -3
- package/es6/components/Data/stories/SpaceX.js +2 -2
- package/es6/components/Data/stories/StarWars.js +1 -1
- package/es6/components/DataFilter/DataFilter.js +1 -1
- package/es6/components/DataSort/DataSort.js +46 -14
- package/es6/components/DataSort/stories/Simple.js +10 -1
- package/es6/components/DataTable/Body.js +14 -8
- package/es6/components/DataTable/GroupedBody.js +3 -3
- package/es6/components/DataTable/buildState.js +5 -1
- package/es6/components/DataTable/stories/SpaceX.js +2 -2
- package/es6/components/DataTable/stories/SpaceXUngrouped.js +1 -1
- package/es6/components/FileInput/index.d.ts +2 -3
- package/es6/components/FormField/FormField.js +10 -3
- package/es6/components/FormField/stories/ThresholdValidation.js +5 -1
- package/es6/components/Grommet/index.d.ts +19 -1
- package/es6/components/Grommet/propTypes.js +18 -0
- package/es6/components/Grommet/stories/Theme.js +1 -1
- package/es6/components/Grommet/stories/Vars.js +2 -2
- package/es6/components/Layer/Layer.js +1 -1
- package/es6/components/Layer/index.d.ts +2 -0
- package/es6/components/List/List.js +43 -13
- package/es6/components/List/stories/RenderedList.js +1 -1
- package/es6/components/Meter/Circle.js +2 -2
- package/es6/components/Meter/Meter.js +37 -18
- package/es6/components/Meter/index.d.ts +18 -0
- package/es6/components/Meter/propTypes.js +18 -0
- package/es6/components/Notification/Notification.js +18 -6
- package/es6/components/Notification/index.d.ts +1 -0
- package/es6/components/Notification/propTypes.js +1 -0
- package/es6/components/Pagination/Pagination.js +4 -2
- package/es6/components/Pagination/stories/CustomThemed/Custom.tsx +8 -2
- package/es6/components/Pagination/stories/NumberEdgePages.js +2 -0
- package/es6/components/Pagination/stories/NumberMiddlePages.js +2 -0
- package/es6/components/Pagination/stories/Simple.js +4 -2
- package/es6/components/Pagination/stories/Size.js +3 -0
- package/es6/components/Pagination/stories/Steps.js +3 -0
- package/es6/components/RadioButton/RadioButton.js +15 -4
- package/es6/components/RadioButton/stories/Children.js +16 -3
- package/es6/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/es6/components/RadioButtonGroup/stories/Children.js +12 -1
- package/es6/components/Select/Select.js +8 -4
- package/es6/components/Select/SelectContainer.js +41 -34
- package/es6/components/Select/index.d.ts +1 -1
- package/es6/components/Select/utils.js +15 -3
- package/es6/components/SelectMultiple/SelectMultiple.js +10 -0
- package/es6/components/SelectMultiple/SelectMultipleContainer.js +28 -2
- package/es6/components/SelectMultiple/SelectMultipleValue.js +14 -1
- package/es6/components/SkipLinks/index.d.ts +1 -0
- package/es6/components/SkipLinks/propTypes.js +1 -0
- package/es6/components/Tab/Tab.js +1 -1
- package/es6/components/Tabs/stories/Scrollable.js +2 -1
- package/es6/components/Tag/Tag.js +11 -7
- package/es6/components/TextInput/TextInput.js +7 -2
- package/es6/components/ToggleGroup/StyledToggleGroup.js +12 -5
- package/es6/components/ToggleGroup/ToggleGroup.js +22 -11
- package/es6/components/WorldMap/WorldMap.js +1 -1
- package/es6/languages/default.json +18 -0
- package/es6/themes/base.d.ts +204 -6
- package/es6/themes/base.js +165 -1
- package/es6/utils/background.js +1 -1
- package/es6/utils/index.js +2 -1
- package/es6/utils/styles.js +8 -0
- package/es6/utils/useId.js +17 -0
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/languages/default.json +18 -0
- package/package.json +36 -36
- package/themes/base.d.ts +204 -6
- package/themes/base.js +165 -1
- package/utils/background.js +1 -1
- package/utils/index.js +6 -0
- package/utils/styles.js +9 -1
- package/utils/useId.js +22 -0
- package/components/CheckBox/stories/InsideButton.js +0 -38
- package/es6/components/CheckBox/stories/InsideButton.js +0 -32
package/all/stories/Colors.js
CHANGED
|
@@ -23,13 +23,13 @@ var customTheme = {
|
|
|
23
23
|
blue: '#00C8FF',
|
|
24
24
|
green: '#17EBA0',
|
|
25
25
|
teal: '#82FFF2',
|
|
26
|
-
purple: '#
|
|
27
|
-
red: '#
|
|
26
|
+
purple: '#694b75',
|
|
27
|
+
red: '#914049',
|
|
28
28
|
orange: '#FFBC44',
|
|
29
|
-
yellow: '#
|
|
29
|
+
yellow: '#faf6d4',
|
|
30
30
|
// you can also point to existing grommet colors
|
|
31
31
|
brightGreen: 'accent-1',
|
|
32
|
-
|
|
32
|
+
dark: 'dark-1',
|
|
33
33
|
// Changing default text color,
|
|
34
34
|
// all colors could be either a string or a dark and light object
|
|
35
35
|
text: {
|
|
@@ -47,8 +47,8 @@ var Colors = exports.Colors = function Colors() {
|
|
|
47
47
|
gap: "medium",
|
|
48
48
|
pad: "small"
|
|
49
49
|
}, /*#__PURE__*/_react["default"].createElement(_grommet.Text, null, "Custom color purple"), /*#__PURE__*/_react["default"].createElement(_grommet.Text, {
|
|
50
|
-
color: "
|
|
51
|
-
}, "Inline custom color
|
|
50
|
+
color: "dark"
|
|
51
|
+
}, "Inline custom dark color"), /*#__PURE__*/_react["default"].createElement(_grommet.Paragraph, {
|
|
52
52
|
color: "red"
|
|
53
53
|
}, "Wrapping your application with the Grommet component that is pointing to your customTheme object as shown on the example, will allow you full access to your custom colors across your application. You can override any Grommet color that is mentioned in the docs in a similar fashion."), /*#__PURE__*/_react["default"].createElement(_grommet.Anchor, {
|
|
54
54
|
href: "https://github.com/grommet/grommet/wiki/Color-Properties"
|
|
@@ -16,12 +16,6 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
16
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
17
17
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
18
18
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
19
|
-
// Ideally we should use `useId` from react but this is only available
|
|
20
|
-
// in React 18 and we want to keep compatibility with React 17 and 16.
|
|
21
|
-
function getUID() {
|
|
22
|
-
var timestamp = Date.now() + Math.random();
|
|
23
|
-
return "grommet-accordion-button-" + timestamp;
|
|
24
|
-
}
|
|
25
19
|
var AccordionPanel = exports.AccordionPanel = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
26
20
|
var children = _ref.children,
|
|
27
21
|
header = _ref.header,
|
|
@@ -33,7 +27,7 @@ var AccordionPanel = exports.AccordionPanel = /*#__PURE__*/(0, _react.forwardRef
|
|
|
33
27
|
_onFocus = _ref.onFocus,
|
|
34
28
|
_onBlur = _ref.onBlur,
|
|
35
29
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
36
|
-
var panelButtonId =
|
|
30
|
+
var panelButtonId = (0, _utils.useId)();
|
|
37
31
|
var _useThemeValue = (0, _useThemeValue2.useThemeValue)(),
|
|
38
32
|
theme = _useThemeValue.theme;
|
|
39
33
|
var _useContext = (0, _react.useContext)(_AccordionContext.AccordionContext),
|
package/components/Box/Box.js
CHANGED
|
@@ -116,7 +116,7 @@ var Box = exports.Box = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
|
116
116
|
if (firstIndex === undefined) {
|
|
117
117
|
firstIndex = index;
|
|
118
118
|
} else {
|
|
119
|
-
contents.push(
|
|
119
|
+
contents.push(/*#__PURE__*/_react["default"].createElement(_StyledBox.StyledBoxGap
|
|
120
120
|
// eslint-disable-next-line react/no-array-index-key
|
|
121
121
|
, _extends({
|
|
122
122
|
key: "gap-" + index,
|
|
@@ -38,11 +38,6 @@ var directionStyle = function directionStyle(direction, theme) {
|
|
|
38
38
|
}
|
|
39
39
|
return styles;
|
|
40
40
|
};
|
|
41
|
-
var elevationStyle = function elevationStyle(elevation) {
|
|
42
|
-
return (0, _styledComponents.css)(["box-shadow:", ";"], function (props) {
|
|
43
|
-
return props.theme.global.elevation[props.theme.dark ? 'dark' : 'light'][elevation];
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
41
|
var FLEX_MAP = (_FLEX_MAP = {}, _FLEX_MAP[true] = '1 1', _FLEX_MAP[false] = '0 0', _FLEX_MAP.grow = '1 0', _FLEX_MAP.shrink = '0 1', _FLEX_MAP);
|
|
47
42
|
var flexGrowShrinkProp = function flexGrowShrinkProp(flex) {
|
|
48
43
|
if (typeof flex === 'boolean' || typeof flex === 'string') {
|
|
@@ -205,7 +200,7 @@ var StyledBox = exports.StyledBox = _styledComponents["default"].div.withConfig(
|
|
|
205
200
|
}, function (props) {
|
|
206
201
|
return props.overflowProp && (0, _utils.overflowStyle)(props.overflowProp);
|
|
207
202
|
}, function (props) {
|
|
208
|
-
return props.elevationProp && elevationStyle(props.elevationProp);
|
|
203
|
+
return props.elevationProp && (0, _utils.elevationStyle)(props.elevationProp);
|
|
209
204
|
}, function (props) {
|
|
210
205
|
return props.gap && gapStyle(props.directionProp, props.gap, props.responsive, props.wrapProp, props.theme);
|
|
211
206
|
}, function (props) {
|
|
@@ -33,6 +33,7 @@ export interface BoxProps {
|
|
|
33
33
|
background?: BackgroundType;
|
|
34
34
|
basis?: BasisType;
|
|
35
35
|
border?: BorderType;
|
|
36
|
+
cssGap?: boolean;
|
|
36
37
|
direction?: DirectionType;
|
|
37
38
|
elevation?: ElevationType;
|
|
38
39
|
flex?: 'grow' | 'shrink' | boolean | { grow?: number; shrink?: number };
|
|
@@ -31,6 +31,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
31
31
|
background: _generalPropTypes.backgroundDoc,
|
|
32
32
|
basis: _propTypes["default"].oneOfType([_propTypes["default"].oneOf(['xxsmall', 'xsmall', 'small', 'medium', 'large', 'xlarge', 'xxlarge', 'full', '1/2', '1/3', '2/3', '1/4', '2/4', '3/4', 'auto']), _propTypes["default"].string]),
|
|
33
33
|
border: _propTypes["default"].oneOfType([_propTypes["default"].bool, _propTypes["default"].oneOf(['top', 'left', 'bottom', 'right', 'start', 'end', 'horizontal', 'vertical', 'all', 'between']), BORDER_SHAPE, _propTypes["default"].arrayOf(BORDER_SHAPE)]),
|
|
34
|
+
cssGap: _propTypes["default"].bool,
|
|
34
35
|
direction: _propTypes["default"].oneOf(['row', 'column', 'row-responsive', 'row-reverse', 'column-reverse']),
|
|
35
36
|
elevation: _generalPropTypes.elevationPropType,
|
|
36
37
|
flex: _propTypes["default"].oneOfType([_propTypes["default"].oneOf(['grow', 'shrink']), _propTypes["default"].bool, _propTypes["default"].shape({
|
|
@@ -61,9 +61,7 @@ var BackgroundBox = exports.BackgroundBox = function BackgroundBox() {
|
|
|
61
61
|
dark: true
|
|
62
62
|
},
|
|
63
63
|
pad: "medium"
|
|
64
|
-
}, /*#__PURE__*/_react["default"].createElement(_grommet.Text, {
|
|
65
|
-
color: "brand"
|
|
66
|
-
}, "force dark background")), /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
64
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Text, null, "force dark background")), /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
67
65
|
background: "dark-1",
|
|
68
66
|
pad: "medium"
|
|
69
67
|
}, /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
@@ -77,15 +75,13 @@ var BackgroundBox = exports.BackgroundBox = function BackgroundBox() {
|
|
|
77
75
|
}, "force light background"))), /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
78
76
|
background: {
|
|
79
77
|
color: {
|
|
80
|
-
dark: '
|
|
78
|
+
dark: 'dark-2',
|
|
81
79
|
light: 'lightgrey'
|
|
82
80
|
},
|
|
83
81
|
dark: true
|
|
84
82
|
},
|
|
85
83
|
pad: "medium"
|
|
86
|
-
}, /*#__PURE__*/_react["default"].createElement(_grommet.Text, {
|
|
87
|
-
color: "brand"
|
|
88
|
-
}, "force dark background with color as object")), /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
84
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Text, null, "force dark background with color as object")), /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
89
85
|
background: "dark-1",
|
|
90
86
|
pad: "medium"
|
|
91
87
|
}, /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
@@ -97,9 +93,7 @@ var BackgroundBox = exports.BackgroundBox = function BackgroundBox() {
|
|
|
97
93
|
dark: false
|
|
98
94
|
},
|
|
99
95
|
pad: "medium"
|
|
100
|
-
}, /*#__PURE__*/_react["default"].createElement(_grommet.Text,
|
|
101
|
-
color: "brand"
|
|
102
|
-
}, "force light background with color as object"))))
|
|
96
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Text, null, "force light background with color as object"))))
|
|
103
97
|
// </Grommet>
|
|
104
98
|
);
|
|
105
99
|
};
|
|
@@ -346,6 +346,7 @@ var Button = exports.Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref
|
|
|
346
346
|
}, first, second);
|
|
347
347
|
} else if (typeof children === 'function') {
|
|
348
348
|
contents = children({
|
|
349
|
+
active: active,
|
|
349
350
|
disabled: disabled,
|
|
350
351
|
hover: hover,
|
|
351
352
|
focus: focus
|
|
@@ -29,10 +29,11 @@ var padStyle = function padStyle(props) {
|
|
|
29
29
|
return (0, _styledComponents.css)(["", " ", ""], props.theme.button.padding.vertical, props.theme.button.padding.horizontal);
|
|
30
30
|
};
|
|
31
31
|
var basicStyle = function basicStyle(props) {
|
|
32
|
-
return (0, _styledComponents.css)(["border:", " solid ", ";border-radius:", ";color:", ";padding:", ";", ""], props.theme.button.border.width, (0, _utils.normalizeColor)(props.colorValue || props.theme.button.border.color || 'control', props.theme), radiusStyle(props), (0, _utils.normalizeColor)(props.theme.button.color || 'text', props.theme), padStyle(props), fontStyle(props));
|
|
32
|
+
return (0, _styledComponents.css)(["border:", " solid ", ";border-radius:", ";", " color:", ";padding:", ";", ""], props.theme.button.border.width, (0, _utils.normalizeColor)(props.colorValue || props.theme.button.border.color || 'control', props.theme), radiusStyle(props), props.theme.button.elevation && (0, _styles.elevationStyle)(props.theme.button.elevation), (0, _utils.normalizeColor)(props.theme.button.color || 'text', props.theme), padStyle(props), fontStyle(props));
|
|
33
33
|
};
|
|
34
34
|
var primaryStyle = function primaryStyle(props) {
|
|
35
|
-
|
|
35
|
+
var _props$theme$button$p, _props$theme$button$p2;
|
|
36
|
+
return (0, _styledComponents.css)(["", " border-radius:", ";", " ", ""], (0, _utils.backgroundStyle)((0, _utils.normalizeColor)(props.colorValue || props.theme.button.primary && props.theme.button.primary.color || 'control', props.theme), props.theme, props.theme.button.color), radiusStyle(props), ((_props$theme$button$p = props.theme.button.primary) == null ? void 0 : _props$theme$button$p.elevation) && (0, _styles.elevationStyle)((_props$theme$button$p2 = props.theme.button.primary) == null ? void 0 : _props$theme$button$p2.elevation), props.theme.button.primary && props.theme.button.primary.extend);
|
|
36
37
|
};
|
|
37
38
|
function getHoverColor(props) {
|
|
38
39
|
if (props.colorValue) {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.getOutputFormat = exports.Calendar = void 0;
|
|
5
5
|
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
6
7
|
var _AnnounceContext = require("../../contexts/AnnounceContext");
|
|
7
8
|
var _MessageContext = require("../../contexts/MessageContext");
|
|
8
9
|
var _Box = require("../Box");
|
|
@@ -16,7 +17,9 @@ var _StyledCalendar = require("./StyledCalendar");
|
|
|
16
17
|
var _utils = require("./utils");
|
|
17
18
|
var _dates = require("../../utils/dates");
|
|
18
19
|
var _useThemeValue3 = require("../../utils/useThemeValue");
|
|
20
|
+
var _utils2 = require("../../utils");
|
|
19
21
|
var _excluded = ["activeDate", "animate", "bounds", "children", "date", "dates", "daysOfWeek", "disabled", "initialFocus", "fill", "firstDayOfWeek", "header", "locale", "messages", "onReference", "onSelect", "range", "reference", "showAdjacentDays", "size", "timestamp"];
|
|
22
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
20
23
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
21
24
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
22
25
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
@@ -154,12 +157,16 @@ var _getOutputFormat = exports.getOutputFormat = function getOutputFormat(dates)
|
|
|
154
157
|
return 'date timezone';
|
|
155
158
|
};
|
|
156
159
|
var millisecondsPerYear = 31557600000;
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
160
|
+
|
|
161
|
+
// when caller opts in to day hover styling, apply all state styles
|
|
162
|
+
// on CalendarDay instead of active state on CalendarDayButton
|
|
163
|
+
var CalendarDayButton = (0, _styledComponents["default"])(_Button.Button).withConfig({
|
|
164
|
+
displayName: "Calendar__CalendarDayButton",
|
|
165
|
+
componentId: "sc-1chaf9i-0"
|
|
166
|
+
})(["", ""], function (props) {
|
|
167
|
+
var _props$theme$calendar;
|
|
168
|
+
return ((_props$theme$calendar = props.theme.calendar) == null || (_props$theme$calendar = _props$theme$calendar.day) == null || (_props$theme$calendar = _props$theme$calendar.hover) == null ? void 0 : _props$theme$calendar.background) && 'background: inherit;';
|
|
169
|
+
});
|
|
163
170
|
var CalendarDay = function CalendarDay(_ref) {
|
|
164
171
|
var children = _ref.children,
|
|
165
172
|
fill = _ref.fill,
|
|
@@ -167,30 +174,46 @@ var CalendarDay = function CalendarDay(_ref) {
|
|
|
167
174
|
isInRange = _ref.isInRange,
|
|
168
175
|
isSelected = _ref.isSelected,
|
|
169
176
|
otherMonth = _ref.otherMonth,
|
|
177
|
+
rangePosition = _ref.rangePosition,
|
|
170
178
|
_ref$buttonProps = _ref.buttonProps,
|
|
171
179
|
buttonProps = _ref$buttonProps === void 0 ? {} : _ref$buttonProps;
|
|
172
180
|
var _useThemeValue = (0, _useThemeValue3.useThemeValue)(),
|
|
173
181
|
passThemeFlag = _useThemeValue.passThemeFlag;
|
|
182
|
+
var usingKeyboard = (0, _utils2.useKeyboard)();
|
|
174
183
|
return /*#__PURE__*/_react["default"].createElement(_StyledCalendar.StyledDayContainer, {
|
|
175
184
|
role: "gridcell",
|
|
176
|
-
sizeProp: size,
|
|
177
|
-
fillContainer: fill
|
|
178
|
-
}, /*#__PURE__*/_react["default"].createElement(CalendarDayButton, _extends({
|
|
179
|
-
fill: fill
|
|
180
|
-
}, buttonProps), /*#__PURE__*/_react["default"].createElement(_StyledCalendar.StyledDay, _extends({
|
|
181
|
-
disabledProp: buttonProps.disabled,
|
|
182
185
|
inRange: isInRange,
|
|
183
|
-
otherMonth: otherMonth,
|
|
184
186
|
isSelected: isSelected,
|
|
187
|
+
rangePosition: rangePosition,
|
|
185
188
|
sizeProp: size,
|
|
186
189
|
fillContainer: fill
|
|
187
|
-
},
|
|
190
|
+
}, /*#__PURE__*/_react["default"].createElement(CalendarDayButton, _extends({
|
|
191
|
+
fill: fill,
|
|
192
|
+
tabIndex: -1,
|
|
193
|
+
plain: true
|
|
194
|
+
}, buttonProps), function (_ref2) {
|
|
195
|
+
var active = _ref2.active,
|
|
196
|
+
hover = _ref2.hover;
|
|
197
|
+
return /*#__PURE__*/_react["default"].createElement(_StyledCalendar.StyledDay
|
|
198
|
+
// only apply active styling when using keyboard
|
|
199
|
+
// otherwise apply hover styling
|
|
200
|
+
, _extends({
|
|
201
|
+
active: usingKeyboard ? active : undefined,
|
|
202
|
+
disabledProp: buttonProps.disabled,
|
|
203
|
+
hover: hover,
|
|
204
|
+
inRange: isInRange,
|
|
205
|
+
isSelected: isSelected,
|
|
206
|
+
otherMonth: otherMonth,
|
|
207
|
+
sizeProp: size,
|
|
208
|
+
fillContainer: fill
|
|
209
|
+
}, passThemeFlag), children);
|
|
210
|
+
}));
|
|
188
211
|
};
|
|
189
|
-
var CalendarCustomDay = function CalendarCustomDay(
|
|
190
|
-
var children =
|
|
191
|
-
fill =
|
|
192
|
-
size =
|
|
193
|
-
buttonProps =
|
|
212
|
+
var CalendarCustomDay = function CalendarCustomDay(_ref3) {
|
|
213
|
+
var children = _ref3.children,
|
|
214
|
+
fill = _ref3.fill,
|
|
215
|
+
size = _ref3.size,
|
|
216
|
+
buttonProps = _ref3.buttonProps;
|
|
194
217
|
if (!buttonProps) {
|
|
195
218
|
return /*#__PURE__*/_react["default"].createElement(_StyledCalendar.StyledDayContainer, {
|
|
196
219
|
role: "gridcell",
|
|
@@ -206,34 +229,34 @@ var CalendarCustomDay = function CalendarCustomDay(_ref2) {
|
|
|
206
229
|
fill: fill
|
|
207
230
|
}, buttonProps), children));
|
|
208
231
|
};
|
|
209
|
-
var Calendar = exports.Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
210
|
-
var activeDateProp =
|
|
211
|
-
|
|
212
|
-
animate =
|
|
213
|
-
boundsProp =
|
|
214
|
-
children =
|
|
215
|
-
dateProp =
|
|
216
|
-
datesProp =
|
|
217
|
-
daysOfWeek =
|
|
218
|
-
disabled =
|
|
219
|
-
initialFocus =
|
|
220
|
-
fill =
|
|
221
|
-
|
|
222
|
-
firstDayOfWeek =
|
|
223
|
-
header =
|
|
224
|
-
|
|
225
|
-
locale =
|
|
226
|
-
messages =
|
|
227
|
-
onReference =
|
|
228
|
-
onSelect =
|
|
229
|
-
range =
|
|
230
|
-
referenceProp =
|
|
231
|
-
|
|
232
|
-
showAdjacentDays =
|
|
233
|
-
|
|
234
|
-
size =
|
|
235
|
-
timestampProp =
|
|
236
|
-
rest = _objectWithoutPropertiesLoose(
|
|
232
|
+
var Calendar = exports.Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (_ref4, ref) {
|
|
233
|
+
var activeDateProp = _ref4.activeDate,
|
|
234
|
+
_ref4$animate = _ref4.animate,
|
|
235
|
+
animate = _ref4$animate === void 0 ? true : _ref4$animate,
|
|
236
|
+
boundsProp = _ref4.bounds,
|
|
237
|
+
children = _ref4.children,
|
|
238
|
+
dateProp = _ref4.date,
|
|
239
|
+
datesProp = _ref4.dates,
|
|
240
|
+
daysOfWeek = _ref4.daysOfWeek,
|
|
241
|
+
disabled = _ref4.disabled,
|
|
242
|
+
initialFocus = _ref4.initialFocus,
|
|
243
|
+
fill = _ref4.fill,
|
|
244
|
+
_ref4$firstDayOfWeek = _ref4.firstDayOfWeek,
|
|
245
|
+
firstDayOfWeek = _ref4$firstDayOfWeek === void 0 ? 0 : _ref4$firstDayOfWeek,
|
|
246
|
+
header = _ref4.header,
|
|
247
|
+
_ref4$locale = _ref4.locale,
|
|
248
|
+
locale = _ref4$locale === void 0 ? 'en-US' : _ref4$locale,
|
|
249
|
+
messages = _ref4.messages,
|
|
250
|
+
onReference = _ref4.onReference,
|
|
251
|
+
onSelect = _ref4.onSelect,
|
|
252
|
+
range = _ref4.range,
|
|
253
|
+
referenceProp = _ref4.reference,
|
|
254
|
+
_ref4$showAdjacentDay = _ref4.showAdjacentDays,
|
|
255
|
+
showAdjacentDays = _ref4$showAdjacentDay === void 0 ? true : _ref4$showAdjacentDay,
|
|
256
|
+
_ref4$size = _ref4.size,
|
|
257
|
+
size = _ref4$size === void 0 ? 'medium' : _ref4$size,
|
|
258
|
+
timestampProp = _ref4.timestamp,
|
|
259
|
+
rest = _objectWithoutPropertiesLoose(_ref4, _excluded);
|
|
237
260
|
var _useThemeValue2 = (0, _useThemeValue3.useThemeValue)(),
|
|
238
261
|
theme = _useThemeValue2.theme,
|
|
239
262
|
passThemeFlag = _useThemeValue2.passThemeFlag;
|
|
@@ -576,7 +599,7 @@ var Calendar = exports.Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
|
576
599
|
var day = new Date(displayBounds[0]);
|
|
577
600
|
var days = [];
|
|
578
601
|
while (days.length < 7) {
|
|
579
|
-
days.push(
|
|
602
|
+
days.push(/*#__PURE__*/_react["default"].createElement(_StyledCalendar.StyledDayContainer, {
|
|
580
603
|
role: "gridcell",
|
|
581
604
|
key: days.length,
|
|
582
605
|
sizeProp: size,
|
|
@@ -602,7 +625,7 @@ var Calendar = exports.Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
|
602
625
|
var _loop = function _loop() {
|
|
603
626
|
if (day.getDay() === firstDayOfWeek) {
|
|
604
627
|
if (days) {
|
|
605
|
-
weeks.push(
|
|
628
|
+
weeks.push(/*#__PURE__*/_react["default"].createElement(_StyledCalendar.StyledWeek, {
|
|
606
629
|
role: "row",
|
|
607
630
|
key: day.getTime(),
|
|
608
631
|
fillContainer: fill
|
|
@@ -612,7 +635,7 @@ var Calendar = exports.Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
|
612
635
|
}
|
|
613
636
|
var otherMonth = day.getMonth() !== reference.getMonth();
|
|
614
637
|
if (!showAdjacentDays && otherMonth) {
|
|
615
|
-
days.push(
|
|
638
|
+
days.push(/*#__PURE__*/_react["default"].createElement(_StyledCalendar.StyledDayContainer, {
|
|
616
639
|
key: day.getTime(),
|
|
617
640
|
sizeProp: size,
|
|
618
641
|
fillContainer: fill
|
|
@@ -634,7 +657,7 @@ var Calendar = exports.Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
|
634
657
|
we know that all days in the array are from the next month. */
|
|
635
658
|
days.length < day.getDate()) {
|
|
636
659
|
blankWeek = true;
|
|
637
|
-
days.push(
|
|
660
|
+
days.push(/*#__PURE__*/_react["default"].createElement(_StyledCalendar.StyledDayContainer, {
|
|
638
661
|
key: day.getTime(),
|
|
639
662
|
sizeProp: size,
|
|
640
663
|
fillContainer: fill
|
|
@@ -647,18 +670,22 @@ var Calendar = exports.Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
|
647
670
|
// this.dayRefs[dateObject] = React.createRef();
|
|
648
671
|
var selected = false;
|
|
649
672
|
var inRange = false;
|
|
650
|
-
var
|
|
673
|
+
var rangePosition;
|
|
674
|
+
var _withinDates = (0, _utils.withinDates)(day, range ? normalizeRange(value, activeDate) : value),
|
|
675
|
+
selectedState = _withinDates[0];
|
|
651
676
|
if (selectedState === 2) {
|
|
652
677
|
selected = true;
|
|
678
|
+
var _withinDates2 = (0, _utils.withinDates)(day, range ? normalizeRange(value, activeDate) : value);
|
|
679
|
+
rangePosition = _withinDates2[1];
|
|
653
680
|
} else if (selectedState === 1) {
|
|
654
681
|
inRange = true;
|
|
655
682
|
}
|
|
656
|
-
var dayDisabled = (0, _utils.withinDates)(day, _normalizeInput(disabled)) || bounds && !(0, _utils.betweenDates)(day, _normalizeInput(bounds));
|
|
683
|
+
var dayDisabled = (0, _utils.withinDates)(day, _normalizeInput(disabled))[0] || bounds && !(0, _utils.betweenDates)(day, _normalizeInput(bounds));
|
|
657
684
|
if (!firstDayInMonth && !dayDisabled && day.getMonth() === reference.getMonth()) {
|
|
658
685
|
firstDayInMonth = dateObject;
|
|
659
686
|
}
|
|
660
687
|
if (!children) {
|
|
661
|
-
days.push(
|
|
688
|
+
days.push(/*#__PURE__*/_react["default"].createElement(CalendarDay, {
|
|
662
689
|
key: day.getTime(),
|
|
663
690
|
buttonProps: {
|
|
664
691
|
a11yTitle: day.toDateString(),
|
|
@@ -677,11 +704,12 @@ var Calendar = exports.Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
|
677
704
|
isInRange: inRange,
|
|
678
705
|
isSelected: selected,
|
|
679
706
|
otherMonth: day.getMonth() !== reference.getMonth(),
|
|
707
|
+
rangePosition: rangePosition,
|
|
680
708
|
size: size,
|
|
681
709
|
fill: fill
|
|
682
710
|
}, day.getDate()));
|
|
683
711
|
} else {
|
|
684
|
-
days.push(
|
|
712
|
+
days.push(/*#__PURE__*/_react["default"].createElement(CalendarCustomDay, {
|
|
685
713
|
key: day.getTime(),
|
|
686
714
|
buttonProps: onSelect ? {
|
|
687
715
|
a11yTitle: day.toDateString(),
|
|
@@ -712,7 +740,7 @@ var Calendar = exports.Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
|
712
740
|
while (day.getTime() < displayBounds[1].getTime()) {
|
|
713
741
|
_loop();
|
|
714
742
|
}
|
|
715
|
-
weeks.push(
|
|
743
|
+
weeks.push(/*#__PURE__*/_react["default"].createElement(_StyledCalendar.StyledWeek
|
|
716
744
|
// if a week contains only blank days, for screen reader accessibility
|
|
717
745
|
// we don't want to set role="row"
|
|
718
746
|
, {
|
|
@@ -757,10 +785,19 @@ var Calendar = exports.Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
|
757
785
|
},
|
|
758
786
|
previousInBound: (0, _utils.betweenDates)(previousMonth, bounds),
|
|
759
787
|
nextInBound: (0, _utils.betweenDates)(nextMonth, bounds)
|
|
760
|
-
}) : renderCalendarHeader(previousMonth, nextMonth),
|
|
788
|
+
}) : renderCalendarHeader(previousMonth, nextMonth), /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
789
|
+
fill: true,
|
|
790
|
+
role: "grid"
|
|
791
|
+
}, daysOfWeek && renderDaysOfWeek(), /*#__PURE__*/_react["default"].createElement(_Keyboard.Keyboard, {
|
|
761
792
|
onEnter: function onEnter() {
|
|
762
793
|
return active !== undefined ? _onClick(active) : undefined;
|
|
763
794
|
},
|
|
795
|
+
onSpace: function onSpace(event) {
|
|
796
|
+
event.preventDefault();
|
|
797
|
+
if (active !== undefined) {
|
|
798
|
+
_onClick(active);
|
|
799
|
+
}
|
|
800
|
+
},
|
|
764
801
|
onUp: function onUp(event) {
|
|
765
802
|
event.preventDefault();
|
|
766
803
|
event.stopPropagation(); // so the page doesn't scroll
|
|
@@ -791,7 +828,7 @@ var Calendar = exports.Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
|
791
828
|
}
|
|
792
829
|
}, /*#__PURE__*/_react["default"].createElement(_StyledCalendar.StyledWeeksContainer, _extends({
|
|
793
830
|
tabIndex: 0,
|
|
794
|
-
role: "
|
|
831
|
+
role: "rowgroup",
|
|
795
832
|
"aria-label": reference.toLocaleDateString(locale, {
|
|
796
833
|
month: 'long',
|
|
797
834
|
year: 'numeric'
|
|
@@ -815,7 +852,7 @@ var Calendar = exports.Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
|
815
852
|
slide: slide,
|
|
816
853
|
sizeProp: size,
|
|
817
854
|
fillContainer: fill
|
|
818
|
-
}, passThemeFlag), weeks)))));
|
|
855
|
+
}, passThemeFlag), weeks))))));
|
|
819
856
|
});
|
|
820
857
|
Calendar.displayName = 'Calendar';
|
|
821
858
|
Calendar.propTypes = _propTypes.CalendarPropTypes;
|
|
@@ -4,6 +4,7 @@ exports.__esModule = true;
|
|
|
4
4
|
exports.StyledWeeksContainer = exports.StyledWeeks = exports.StyledWeek = exports.StyledDayContainer = exports.StyledDay = exports.StyledCalendar = void 0;
|
|
5
5
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
6
6
|
var _utils = require("../../utils");
|
|
7
|
+
var _background = require("../../utils/background");
|
|
7
8
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
8
9
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
9
10
|
var sizeStyle = function sizeStyle(props) {
|
|
@@ -51,6 +52,21 @@ var slideStyle = function slideStyle(props) {
|
|
|
51
52
|
var weeksSizeStyle = function weeksSizeStyle() {
|
|
52
53
|
return (0, _styledComponents.css)(["display:flex;flex-direction:column;height:100%;"]);
|
|
53
54
|
};
|
|
55
|
+
|
|
56
|
+
// fallback to medium if no size-specific styles
|
|
57
|
+
var rangeRoundStyle = function rangeRoundStyle(props) {
|
|
58
|
+
var _props$theme$calendar5, _props$theme$calendar6;
|
|
59
|
+
var themeObj;
|
|
60
|
+
if (props.isSelected) {
|
|
61
|
+
var _props$theme$calendar, _props$theme$calendar2, _props$theme$calendar3, _props$theme$calendar4;
|
|
62
|
+
var rangeStart = ((_props$theme$calendar = props.theme.calendar) == null || (_props$theme$calendar = _props$theme$calendar[props.sizeProp]) == null || (_props$theme$calendar = _props$theme$calendar.range) == null || (_props$theme$calendar = _props$theme$calendar.start) == null ? void 0 : _props$theme$calendar.round) || ((_props$theme$calendar2 = props.theme.calendar) == null || (_props$theme$calendar2 = _props$theme$calendar2.medium) == null || (_props$theme$calendar2 = _props$theme$calendar2.range) == null || (_props$theme$calendar2 = _props$theme$calendar2.start) == null ? void 0 : _props$theme$calendar2.round);
|
|
63
|
+
var rangeEnd = ((_props$theme$calendar3 = props.theme.calendar) == null || (_props$theme$calendar3 = _props$theme$calendar3[props.sizeProp]) == null || (_props$theme$calendar3 = _props$theme$calendar3.range) == null || (_props$theme$calendar3 = _props$theme$calendar3.end) == null ? void 0 : _props$theme$calendar3.round) || ((_props$theme$calendar4 = props.theme.calendar) == null || (_props$theme$calendar4 = _props$theme$calendar4.medium) == null || (_props$theme$calendar4 = _props$theme$calendar4.range) == null || (_props$theme$calendar4 = _props$theme$calendar4.end) == null ? void 0 : _props$theme$calendar4.round);
|
|
64
|
+
if (props.rangePosition === 'start' && rangeStart) {
|
|
65
|
+
themeObj = rangeStart;
|
|
66
|
+
} else if (props.rangePosition === 'end' && rangeEnd) themeObj = rangeEnd;
|
|
67
|
+
} else themeObj = ((_props$theme$calendar5 = props.theme.calendar) == null || (_props$theme$calendar5 = _props$theme$calendar5[props.sizeProp]) == null || (_props$theme$calendar5 = _props$theme$calendar5.range) == null ? void 0 : _props$theme$calendar5.round) || ((_props$theme$calendar6 = props.theme.calendar) == null || (_props$theme$calendar6 = _props$theme$calendar6.medium) == null || (_props$theme$calendar6 = _props$theme$calendar6.range) == null ? void 0 : _props$theme$calendar6.round);
|
|
68
|
+
return themeObj && [(0, _utils.roundStyle)(themeObj, props.responsive, props.theme), 'overflow: hidden;'];
|
|
69
|
+
};
|
|
54
70
|
var StyledWeeks = exports.StyledWeeks = _styledComponents["default"].div.withConfig(_utils.styledComponentsConfig).withConfig({
|
|
55
71
|
displayName: "StyledCalendar__StyledWeeks",
|
|
56
72
|
componentId: "sc-1y4xhmp-2"
|
|
@@ -71,27 +87,93 @@ var StyledWeek = exports.StyledWeek = _styledComponents["default"].div.withConfi
|
|
|
71
87
|
var StyledDayContainer = exports.StyledDayContainer = _styledComponents["default"].div.withConfig(_utils.styledComponentsConfig).withConfig({
|
|
72
88
|
displayName: "StyledCalendar__StyledDayContainer",
|
|
73
89
|
componentId: "sc-1y4xhmp-4"
|
|
74
|
-
})(["flex:0 1 auto;", ""], function (props) {
|
|
90
|
+
})(["flex:0 1 auto;", " ", " ", ""], function (props) {
|
|
75
91
|
return props.fillContainer && 'width: 14.3%;';
|
|
92
|
+
}, function (props) {
|
|
93
|
+
var _props$theme$calendar7;
|
|
94
|
+
return (props.inRange || props.isSelected && props.rangePosition) && ((_props$theme$calendar7 = props.theme.calendar) == null || (_props$theme$calendar7 = _props$theme$calendar7.range) == null ? void 0 : _props$theme$calendar7.background) && (0, _utils.backgroundStyle)(props.theme.calendar.range.background, props.theme);
|
|
95
|
+
}, function (props) {
|
|
96
|
+
return rangeRoundStyle(props);
|
|
76
97
|
});
|
|
77
98
|
var daySizeStyle = function daySizeStyle(props) {
|
|
78
99
|
var data = props.theme.calendar[props.sizeProp];
|
|
79
100
|
return (0, _styledComponents.css)(["width:", ";height:", ";"], props.fillContainer ? '100%' : data.daySize, props.fillContainer ? '100%' : data.daySize);
|
|
80
101
|
};
|
|
102
|
+
var dayStyle = function dayStyle(props) {
|
|
103
|
+
var backgroundObj;
|
|
104
|
+
var colorObj;
|
|
105
|
+
if (props.isSelected) {
|
|
106
|
+
var _props$theme$calendar8, _props$theme$calendar9;
|
|
107
|
+
backgroundObj = ((_props$theme$calendar8 = props.theme.calendar.day) == null || (_props$theme$calendar8 = _props$theme$calendar8.selected) == null ? void 0 : _props$theme$calendar8.background) || 'control';
|
|
108
|
+
colorObj = (_props$theme$calendar9 = props.theme.calendar.day) == null || (_props$theme$calendar9 = _props$theme$calendar9.selected) == null ? void 0 : _props$theme$calendar9.color;
|
|
109
|
+
} else if (props.inRange) {
|
|
110
|
+
var _props$theme$calendar10, _props$theme$calendar11, _props$theme$calendar12, _props$theme$calendar13;
|
|
111
|
+
// for backwards compatability, only apply this if caller hasn't specified
|
|
112
|
+
// range specific rounding
|
|
113
|
+
// if they have, background will be applied to StyledDayContainer
|
|
114
|
+
backgroundObj = !((_props$theme$calendar10 = props.theme.calendar) != null && (_props$theme$calendar10 = _props$theme$calendar10[props.sizeProp]) != null && (_props$theme$calendar10 = _props$theme$calendar10.range) != null && _props$theme$calendar10.round) && !((_props$theme$calendar11 = props.theme.calendar) != null && (_props$theme$calendar11 = _props$theme$calendar11.medium.range) != null && _props$theme$calendar11.round) && (((_props$theme$calendar12 = props.theme.calendar.day) == null || (_props$theme$calendar12 = _props$theme$calendar12.inRange) == null ? void 0 : _props$theme$calendar12.background) || {
|
|
115
|
+
color: 'control',
|
|
116
|
+
opacity: 'weak'
|
|
117
|
+
});
|
|
118
|
+
colorObj = (_props$theme$calendar13 = props.theme.calendar.day) == null || (_props$theme$calendar13 = _props$theme$calendar13.inRange) == null ? void 0 : _props$theme$calendar13.color;
|
|
119
|
+
} else {
|
|
120
|
+
var _props$theme$calendar14, _props$theme$calendar15;
|
|
121
|
+
backgroundObj = (_props$theme$calendar14 = props.theme.calendar.day) == null ? void 0 : _props$theme$calendar14.background;
|
|
122
|
+
colorObj = (_props$theme$calendar15 = props.theme.calendar.day) == null ? void 0 : _props$theme$calendar15.color;
|
|
123
|
+
}
|
|
124
|
+
if (colorObj && !backgroundObj) return "color: " + (0, _utils.normalizeColor)(colorObj, props.theme) + ";";
|
|
125
|
+
return (0, _utils.backgroundStyle)(backgroundObj, props.theme, colorObj);
|
|
126
|
+
};
|
|
127
|
+
var dayHoverStyle = function dayHoverStyle(props) {
|
|
128
|
+
var backgroundObj;
|
|
129
|
+
var colorObj;
|
|
130
|
+
if (props.isSelected) {
|
|
131
|
+
var _props$theme$calendar16, _props$theme$calendar17;
|
|
132
|
+
backgroundObj = (_props$theme$calendar16 = props.theme.calendar.day) == null || (_props$theme$calendar16 = _props$theme$calendar16.selected) == null || (_props$theme$calendar16 = _props$theme$calendar16.hover) == null ? void 0 : _props$theme$calendar16.background;
|
|
133
|
+
colorObj = (_props$theme$calendar17 = props.theme.calendar.day) == null || (_props$theme$calendar17 = _props$theme$calendar17.selected) == null || (_props$theme$calendar17 = _props$theme$calendar17.hover) == null ? void 0 : _props$theme$calendar17.color;
|
|
134
|
+
} else if (props.inRange) {
|
|
135
|
+
var _props$theme$calendar18, _props$theme$calendar19;
|
|
136
|
+
backgroundObj = (_props$theme$calendar18 = props.theme.calendar.day) == null || (_props$theme$calendar18 = _props$theme$calendar18.inRange) == null || (_props$theme$calendar18 = _props$theme$calendar18.hover) == null ? void 0 : _props$theme$calendar18.background;
|
|
137
|
+
colorObj = (_props$theme$calendar19 = props.theme.calendar.day) == null || (_props$theme$calendar19 = _props$theme$calendar19.inRange) == null || (_props$theme$calendar19 = _props$theme$calendar19.hover) == null ? void 0 : _props$theme$calendar19.color;
|
|
138
|
+
} else {
|
|
139
|
+
var _props$theme$calendar20, _props$theme$calendar21;
|
|
140
|
+
backgroundObj = (_props$theme$calendar20 = props.theme.calendar.day) == null || (_props$theme$calendar20 = _props$theme$calendar20.hover) == null ? void 0 : _props$theme$calendar20.background;
|
|
141
|
+
colorObj = (_props$theme$calendar21 = props.theme.calendar.day) == null || (_props$theme$calendar21 = _props$theme$calendar21.hover) == null ? void 0 : _props$theme$calendar21.color;
|
|
142
|
+
}
|
|
143
|
+
if (colorObj && !backgroundObj) return "color: " + (0, _utils.normalizeColor)(colorObj, props.theme) + ";";
|
|
144
|
+
return (0, _utils.backgroundStyle)(backgroundObj, props.theme, colorObj);
|
|
145
|
+
};
|
|
146
|
+
var dayFontStyle = function dayFontStyle(props) {
|
|
147
|
+
var fontWeight;
|
|
148
|
+
if (props.isSelected) {
|
|
149
|
+
var _props$theme$calendar22;
|
|
150
|
+
fontWeight = (_props$theme$calendar22 = props.theme.calendar.day) == null || (_props$theme$calendar22 = _props$theme$calendar22.selected) == null || (_props$theme$calendar22 = _props$theme$calendar22.font) == null ? void 0 : _props$theme$calendar22.weight;
|
|
151
|
+
} else if (props.inRange) {
|
|
152
|
+
var _props$theme$calendar23;
|
|
153
|
+
fontWeight = (_props$theme$calendar23 = props.theme.calendar.day) == null || (_props$theme$calendar23 = _props$theme$calendar23.inRange) == null || (_props$theme$calendar23 = _props$theme$calendar23.font) == null ? void 0 : _props$theme$calendar23.weight;
|
|
154
|
+
}
|
|
155
|
+
return fontWeight && "font-weight: " + fontWeight + ";";
|
|
156
|
+
};
|
|
81
157
|
var StyledDay = exports.StyledDay = _styledComponents["default"].div.withConfig(_utils.styledComponentsConfig).withConfig({
|
|
82
158
|
displayName: "StyledCalendar__StyledDay",
|
|
83
159
|
componentId: "sc-1y4xhmp-5"
|
|
84
|
-
})(["display:flex;justify-content:center;align-items:center;", " ", " ", " ", " ", " ", ""], function (props) {
|
|
160
|
+
})(["display:flex;justify-content:center;align-items:center;", " ", " ", " ", " ", " ", " ", " ", " ", ""], function (props) {
|
|
85
161
|
return daySizeStyle(props);
|
|
86
162
|
}, function (props) {
|
|
87
|
-
return
|
|
88
|
-
color: 'control',
|
|
89
|
-
opacity: 'weak'
|
|
90
|
-
}, props.theme);
|
|
163
|
+
return dayStyle(props);
|
|
91
164
|
}, function (props) {
|
|
92
165
|
return props.otherMonth && 'opacity: 0.5;';
|
|
93
166
|
}, function (props) {
|
|
94
|
-
return props
|
|
167
|
+
return dayFontStyle(props);
|
|
168
|
+
}, function (props) {
|
|
169
|
+
var _props$theme$calendar24, _props$theme$calendar25;
|
|
170
|
+
// fallback to medium if no size-specific styles
|
|
171
|
+
var round = ((_props$theme$calendar24 = props.theme.calendar) == null || (_props$theme$calendar24 = _props$theme$calendar24[props.sizeProp]) == null || (_props$theme$calendar24 = _props$theme$calendar24.day) == null ? void 0 : _props$theme$calendar24.round) || ((_props$theme$calendar25 = props.theme.calendar) == null || (_props$theme$calendar25 = _props$theme$calendar25.medium) == null || (_props$theme$calendar25 = _props$theme$calendar25.day) == null ? void 0 : _props$theme$calendar25.round);
|
|
172
|
+
return round && (0, _utils.roundStyle)(round, props.responsive, props.theme);
|
|
173
|
+
}, function (props) {
|
|
174
|
+
return props.active && _background.activeStyle;
|
|
175
|
+
}, function (props) {
|
|
176
|
+
return props.hover && dayHoverStyle(props);
|
|
95
177
|
}, function (props) {
|
|
96
178
|
return (
|
|
97
179
|
// when theme uses kind Buttons, since we use children for Button,
|