@spaced-out/ui-design-system 0.2.9 → 0.3.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/CHANGELOG.md +14 -0
- package/lib/components/Dropdown/Dropdown.js +3 -1
- package/lib/components/Dropdown/Dropdown.js.flow +3 -2
- package/lib/components/InlineDropdown/InlineDropdown.js +3 -1
- package/lib/components/InlineDropdown/InlineDropdown.js.flow +3 -2
- package/lib/components/Timeline/Timeline.js +37 -0
- package/lib/components/Timeline/Timeline.js.flow +47 -0
- package/lib/components/Timeline/Timeline.module.css +102 -0
- package/lib/components/Timeline/TimelineItem/TimelineItem.js +77 -0
- package/lib/components/Timeline/TimelineItem/TimelineItem.js.flow +117 -0
- package/lib/components/Timeline/TimelineItem/index.js +16 -0
- package/lib/components/Timeline/TimelineItem/index.js.flow +3 -0
- package/lib/components/Timeline/index.js +27 -0
- package/lib/components/Timeline/index.js.flow +4 -0
- package/lib/components/Typeahead/Typeahead.js +3 -1
- package/lib/components/Typeahead/Typeahead.js.flow +4 -2
- package/lib/utils/date-range-picker/date-range-picker.js +1 -6
- package/lib/utils/date-range-picker/date-range-picker.js.flow +1 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [0.3.0](https://github.com/spaced-out/ui-design-system/compare/v0.2.10...v0.3.0) (2024-11-08)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* timeline component ([#283](https://github.com/spaced-out/ui-design-system/issues/283)) ([0f2ae3c](https://github.com/spaced-out/ui-design-system/commit/0f2ae3cf88c065e521994fab3426e32cfe4752b5))
|
|
11
|
+
|
|
12
|
+
### [0.2.10](https://github.com/spaced-out/ui-design-system/compare/v0.2.9...v0.2.10) (2024-11-08)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* support menu open for all menu related components ([#285](https://github.com/spaced-out/ui-design-system/issues/285)) ([657324a](https://github.com/spaced-out/ui-design-system/commit/657324ae683dbcd702dd54ab1d42f007fadb3db2))
|
|
18
|
+
|
|
5
19
|
### [0.2.9](https://github.com/spaced-out/ui-design-system/compare/v0.2.8...v0.2.9) (2024-11-08)
|
|
6
20
|
|
|
7
21
|
|
|
@@ -99,7 +99,9 @@ const Dropdown = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
99
99
|
}, /*#__PURE__*/React.createElement(_Menu.Menu, _extends({}, menu, {
|
|
100
100
|
onSelect: (option, e) => {
|
|
101
101
|
onChange && onChange(option, e);
|
|
102
|
-
if (
|
|
102
|
+
if (
|
|
103
|
+
// option.keepMenuOpenOnOptionSelect - to allow the menu persist its open stat upon option selection in normal variant
|
|
104
|
+
!option.keepMenuOpenOnOptionSelect && (!menu.optionsVariant || menu.optionsVariant === 'normal')) {
|
|
103
105
|
clickAway();
|
|
104
106
|
refs.reference.current.querySelector('input').focus();
|
|
105
107
|
}
|
|
@@ -122,8 +122,9 @@ export const Dropdown: React$AbstractComponent<
|
|
|
122
122
|
onSelect={(option, e) => {
|
|
123
123
|
onChange && onChange(option, e);
|
|
124
124
|
if (
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
// option.keepMenuOpenOnOptionSelect - to allow the menu persist its open stat upon option selection in normal variant
|
|
126
|
+
!option.keepMenuOpenOnOptionSelect &&
|
|
127
|
+
(!menu.optionsVariant || menu.optionsVariant === 'normal')
|
|
127
128
|
) {
|
|
128
129
|
clickAway();
|
|
129
130
|
refs.reference.current.querySelector('input').focus();
|
|
@@ -93,7 +93,9 @@ const InlineDropdown = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
93
93
|
}, /*#__PURE__*/React.createElement(_Menu.Menu, _extends({}, menu, {
|
|
94
94
|
onSelect: (option, e) => {
|
|
95
95
|
onOptionSelect && onOptionSelect(option, e);
|
|
96
|
-
if (
|
|
96
|
+
if (
|
|
97
|
+
// option.keepMenuOpenOnOptionSelect - to allow the menu persist its open stat upon option selection in normal variant
|
|
98
|
+
!option.keepMenuOpenOnOptionSelect && (!menu.optionsVariant || menu.optionsVariant === 'normal')) {
|
|
97
99
|
clickAway();
|
|
98
100
|
}
|
|
99
101
|
},
|
|
@@ -134,8 +134,9 @@ export const InlineDropdown: React$AbstractComponent<
|
|
|
134
134
|
onSelect={(option, e) => {
|
|
135
135
|
onOptionSelect && onOptionSelect(option, e);
|
|
136
136
|
if (
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
// option.keepMenuOpenOnOptionSelect - to allow the menu persist its open stat upon option selection in normal variant
|
|
138
|
+
!option.keepMenuOpenOnOptionSelect &&
|
|
139
|
+
(!menu.optionsVariant || menu.optionsVariant === 'normal')
|
|
139
140
|
) {
|
|
140
141
|
clickAway();
|
|
141
142
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Timeline = exports.ORIENTATION = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _classify = require("../../utils/classify");
|
|
9
|
+
var _TimelineModule = _interopRequireDefault(require("./Timeline.module.css"));
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
+
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; }
|
|
13
|
+
|
|
14
|
+
const ORIENTATION = Object.freeze({
|
|
15
|
+
left: 'left',
|
|
16
|
+
right: 'right'
|
|
17
|
+
});
|
|
18
|
+
exports.ORIENTATION = ORIENTATION;
|
|
19
|
+
const Timeline_ = (_ref, ref) => {
|
|
20
|
+
let {
|
|
21
|
+
classNames,
|
|
22
|
+
orientation = ORIENTATION.left,
|
|
23
|
+
children
|
|
24
|
+
} = _ref;
|
|
25
|
+
const childrenArray = React.Children.toArray(children).filter(Boolean);
|
|
26
|
+
const timelineItems = childrenArray.map(timelineItem => /*#__PURE__*/React.cloneElement(timelineItem, {
|
|
27
|
+
...timelineItem.props,
|
|
28
|
+
orientation
|
|
29
|
+
}));
|
|
30
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
31
|
+
ref: ref,
|
|
32
|
+
className: (0, _classify.classify)(_TimelineModule.default.timelineWrapper, classNames?.wrapper),
|
|
33
|
+
"data-testid": "Timeline"
|
|
34
|
+
}, timelineItems);
|
|
35
|
+
};
|
|
36
|
+
const Timeline = /*#__PURE__*/React.forwardRef(Timeline_);
|
|
37
|
+
exports.Timeline = Timeline;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
import {classify} from '../../utils/classify';
|
|
5
|
+
|
|
6
|
+
import css from './Timeline.module.css';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export const ORIENTATION = Object.freeze({
|
|
10
|
+
left: 'left',
|
|
11
|
+
right: 'right',
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
type ClassNames = $ReadOnly<{wrapper?: string}>;
|
|
15
|
+
export type Orientation = $Values<typeof ORIENTATION>;
|
|
16
|
+
|
|
17
|
+
export type TimelineProps = {
|
|
18
|
+
children: React.Node,
|
|
19
|
+
classNames?: ClassNames,
|
|
20
|
+
orientation?: Orientation,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const Timeline_ = (
|
|
24
|
+
{classNames, orientation = ORIENTATION.left, children}: TimelineProps,
|
|
25
|
+
ref,
|
|
26
|
+
): React.Node => {
|
|
27
|
+
const childrenArray = React.Children.toArray(children).filter(Boolean);
|
|
28
|
+
const timelineItems = childrenArray.map((timelineItem) =>
|
|
29
|
+
React.cloneElement(timelineItem, {
|
|
30
|
+
...timelineItem.props,
|
|
31
|
+
orientation,
|
|
32
|
+
}),
|
|
33
|
+
);
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
ref={ref}
|
|
37
|
+
className={classify(css.timelineWrapper, classNames?.wrapper)}
|
|
38
|
+
data-testid="Timeline"
|
|
39
|
+
>
|
|
40
|
+
{timelineItems}
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const Timeline = (React.forwardRef<TimelineProps, HTMLDivElement>(
|
|
46
|
+
Timeline_,
|
|
47
|
+
): React$AbstractComponent<TimelineProps, HTMLDivElement>);
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
@value (
|
|
2
|
+
size26
|
|
3
|
+
) from '../../styles/variables/_size.css';
|
|
4
|
+
@value (
|
|
5
|
+
spaceXXSmall,
|
|
6
|
+
spaceMedium,
|
|
7
|
+
spaceXSmall,
|
|
8
|
+
spaceSmall,
|
|
9
|
+
spaceFluid,
|
|
10
|
+
spaceNone
|
|
11
|
+
) from '../../styles/variables/_space.css';
|
|
12
|
+
@value (
|
|
13
|
+
colorBorderPrimary,
|
|
14
|
+
colorInformationLightest
|
|
15
|
+
) from '../../styles/variables/_color.css';
|
|
16
|
+
@value (
|
|
17
|
+
borderWidthPrimary,
|
|
18
|
+
borderRadiusCircle
|
|
19
|
+
) from '../../styles/variables/_border.css';
|
|
20
|
+
|
|
21
|
+
.timelineWrapper {
|
|
22
|
+
display: flex;
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
justify-content: space-between;
|
|
26
|
+
gap: spaceSmall;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.timelineItemWrapper {
|
|
30
|
+
display: flex;
|
|
31
|
+
gap: spaceSmall;
|
|
32
|
+
box-sizing: border-box;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
justify-content: space-between;
|
|
35
|
+
align-items: var(--align);
|
|
36
|
+
|
|
37
|
+
/* According to the design specification, the last timeline item's content will not have any space at the bottom. */
|
|
38
|
+
&:last-child .timelineItemContent .timelineItemEventDetails {
|
|
39
|
+
margin-bottom: spaceNone;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.timelineItemIconWrapper {
|
|
44
|
+
display: flex;
|
|
45
|
+
gap: spaceXXSmall;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.timelineItemIcon {
|
|
50
|
+
width: size26;
|
|
51
|
+
height: size26;
|
|
52
|
+
border-radius: borderRadiusCircle;
|
|
53
|
+
background-color: colorInformationLightest;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.timelineItemContent {
|
|
57
|
+
display: flex;
|
|
58
|
+
gap: spaceSmall;
|
|
59
|
+
width: spaceFluid;
|
|
60
|
+
flex-direction: var(--direction);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.timelineItemBorder {
|
|
64
|
+
display: flex;
|
|
65
|
+
width: size26;
|
|
66
|
+
flex: 1;
|
|
67
|
+
box-sizing: border-box;
|
|
68
|
+
justify-content: center;
|
|
69
|
+
|
|
70
|
+
& .border {
|
|
71
|
+
height: spaceFluid;
|
|
72
|
+
border-left: borderWidthPrimary dashed colorBorderPrimary;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.timelineItemEventDetails {
|
|
77
|
+
display: flex;
|
|
78
|
+
gap: spaceXSmall;
|
|
79
|
+
width: spaceFluid;
|
|
80
|
+
flex-direction: column;
|
|
81
|
+
margin-bottom: spaceMedium;
|
|
82
|
+
|
|
83
|
+
& .timelineItemTitle {
|
|
84
|
+
justify-content: var(--justify);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.timelineItemTitle {
|
|
89
|
+
composes: bodySmall from '../../styles/typography.module.css';
|
|
90
|
+
composes: secondary from '../../styles/typography.module.css';
|
|
91
|
+
min-height: size26;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.timelineItemCardWrapper {
|
|
95
|
+
width: spaceFluid;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.timelineItemLoader {
|
|
99
|
+
display: flex;
|
|
100
|
+
width: spaceFluid;
|
|
101
|
+
justify-content: center;
|
|
102
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TimelineItem = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _typography = require("../../../types/typography");
|
|
9
|
+
var _classify = require("../../../utils/classify");
|
|
10
|
+
var _Card = require("../../Card");
|
|
11
|
+
var _ConditionalWrapper = require("../../ConditionalWrapper");
|
|
12
|
+
var _Icon = require("../../Icon");
|
|
13
|
+
var _Timeline = require("../Timeline");
|
|
14
|
+
var _TimelineModule = _interopRequireDefault(require("../Timeline.module.css"));
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
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; }
|
|
18
|
+
|
|
19
|
+
const TimelineItem_ = (_ref, ref) => {
|
|
20
|
+
let {
|
|
21
|
+
id,
|
|
22
|
+
title,
|
|
23
|
+
iconName,
|
|
24
|
+
iconType = _Icon.ICON_TYPE.solid,
|
|
25
|
+
children,
|
|
26
|
+
iconColor = _typography.TEXT_COLORS.information,
|
|
27
|
+
classNames,
|
|
28
|
+
orientation = _Timeline.ORIENTATION.left,
|
|
29
|
+
parentComponent,
|
|
30
|
+
enableCardWrapper = true
|
|
31
|
+
} = _ref;
|
|
32
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
id: id,
|
|
34
|
+
key: id,
|
|
35
|
+
"data-testid": "Timeline-item",
|
|
36
|
+
className: (0, _classify.classify)(_TimelineModule.default.timelineItemWrapper, classNames?.wrapper),
|
|
37
|
+
style: {
|
|
38
|
+
'--align': orientation === 'left' ? 'flex-start' : 'flex-end'
|
|
39
|
+
},
|
|
40
|
+
ref: ref
|
|
41
|
+
}, parentComponent, /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
style: {
|
|
43
|
+
'--direction': orientation === 'left' ? 'row' : 'row-reverse'
|
|
44
|
+
},
|
|
45
|
+
className: _TimelineModule.default.timelineItemContent
|
|
46
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
className: _TimelineModule.default.timelineItemIconWrapper
|
|
48
|
+
}, /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
49
|
+
name: iconName,
|
|
50
|
+
type: iconType,
|
|
51
|
+
size: _Icon.ICON_SIZE.small,
|
|
52
|
+
color: iconColor,
|
|
53
|
+
className: (0, _classify.classify)(_TimelineModule.default.timelineItemIcon, classNames?.icon)
|
|
54
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
55
|
+
className: _TimelineModule.default.timelineItemBorder
|
|
56
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
57
|
+
className: _TimelineModule.default.border
|
|
58
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
59
|
+
style: {
|
|
60
|
+
'--justify': orientation === 'left' ? 'flex-start' : 'flex-end'
|
|
61
|
+
},
|
|
62
|
+
className: _TimelineModule.default.timelineItemEventDetails
|
|
63
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
64
|
+
className: (0, _classify.classify)(_TimelineModule.default.timelineItemTitle, classNames?.title)
|
|
65
|
+
}, title), /*#__PURE__*/React.createElement(_ConditionalWrapper.ConditionalWrapper, {
|
|
66
|
+
condition: enableCardWrapper,
|
|
67
|
+
wrapper: children => /*#__PURE__*/React.createElement(_Card.Card, {
|
|
68
|
+
paddingTop: _Card.PADDING_SIZES.small,
|
|
69
|
+
paddingBottom: _Card.PADDING_SIZES.small,
|
|
70
|
+
classNames: {
|
|
71
|
+
wrapper: (0, _classify.classify)(_TimelineModule.default.timelineItemCardWrapper, classNames?.card)
|
|
72
|
+
}
|
|
73
|
+
}, children)
|
|
74
|
+
}, children))));
|
|
75
|
+
};
|
|
76
|
+
const TimelineItem = /*#__PURE__*/React.forwardRef(TimelineItem_);
|
|
77
|
+
exports.TimelineItem = TimelineItem;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
import type {ColorTypes} from '../../../types/typography';
|
|
5
|
+
import {TEXT_COLORS} from '../../../types/typography';
|
|
6
|
+
import {classify} from '../../../utils/classify';
|
|
7
|
+
import {Card, PADDING_SIZES} from '../../Card';
|
|
8
|
+
import {ConditionalWrapper} from '../../ConditionalWrapper';
|
|
9
|
+
import type {IconType} from '../../Icon';
|
|
10
|
+
import {Icon, ICON_SIZE, ICON_TYPE} from '../../Icon';
|
|
11
|
+
import type {Orientation} from '../Timeline';
|
|
12
|
+
import {ORIENTATION} from '../Timeline';
|
|
13
|
+
|
|
14
|
+
import css from '../Timeline.module.css';
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
type ClassNames = $ReadOnly<{
|
|
18
|
+
card?: string,
|
|
19
|
+
icon?: string,
|
|
20
|
+
title?: string,
|
|
21
|
+
wrapper?: string,
|
|
22
|
+
}>;
|
|
23
|
+
|
|
24
|
+
export type TimelineItemProps = {
|
|
25
|
+
id?: string,
|
|
26
|
+
title?: React.Node,
|
|
27
|
+
iconName: string,
|
|
28
|
+
children: React.Node,
|
|
29
|
+
iconType?: IconType,
|
|
30
|
+
iconColor?: ColorTypes,
|
|
31
|
+
classNames?: ClassNames,
|
|
32
|
+
orientation?: Orientation,
|
|
33
|
+
parentComponent?: React.Node,
|
|
34
|
+
enableCardWrapper?: boolean,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const TimelineItem_ = (
|
|
38
|
+
{
|
|
39
|
+
id,
|
|
40
|
+
title,
|
|
41
|
+
iconName,
|
|
42
|
+
iconType = ICON_TYPE.solid,
|
|
43
|
+
children,
|
|
44
|
+
iconColor = TEXT_COLORS.information,
|
|
45
|
+
classNames,
|
|
46
|
+
orientation = ORIENTATION.left,
|
|
47
|
+
parentComponent,
|
|
48
|
+
enableCardWrapper = true,
|
|
49
|
+
}: TimelineItemProps,
|
|
50
|
+
ref,
|
|
51
|
+
): React.Node => (
|
|
52
|
+
<div
|
|
53
|
+
id={id}
|
|
54
|
+
key={id}
|
|
55
|
+
data-testid="Timeline-item"
|
|
56
|
+
className={classify(css.timelineItemWrapper, classNames?.wrapper)}
|
|
57
|
+
style={{
|
|
58
|
+
'--align': orientation === 'left' ? 'flex-start' : 'flex-end',
|
|
59
|
+
}}
|
|
60
|
+
ref={ref}
|
|
61
|
+
>
|
|
62
|
+
{parentComponent}
|
|
63
|
+
<div
|
|
64
|
+
style={{
|
|
65
|
+
'--direction': orientation === 'left' ? 'row' : 'row-reverse',
|
|
66
|
+
}}
|
|
67
|
+
className={css.timelineItemContent}
|
|
68
|
+
>
|
|
69
|
+
<div className={css.timelineItemIconWrapper}>
|
|
70
|
+
<Icon
|
|
71
|
+
name={iconName}
|
|
72
|
+
type={iconType}
|
|
73
|
+
size={ICON_SIZE.small}
|
|
74
|
+
color={iconColor}
|
|
75
|
+
className={classify(css.timelineItemIcon, classNames?.icon)}
|
|
76
|
+
/>
|
|
77
|
+
<div className={css.timelineItemBorder}>
|
|
78
|
+
<div className={css.border} />
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
<div
|
|
82
|
+
style={{
|
|
83
|
+
'--justify': orientation === 'left' ? 'flex-start' : 'flex-end',
|
|
84
|
+
}}
|
|
85
|
+
className={css.timelineItemEventDetails}
|
|
86
|
+
>
|
|
87
|
+
<div className={classify(css.timelineItemTitle, classNames?.title)}>
|
|
88
|
+
{title}
|
|
89
|
+
</div>
|
|
90
|
+
<ConditionalWrapper
|
|
91
|
+
condition={enableCardWrapper}
|
|
92
|
+
wrapper={(children) => (
|
|
93
|
+
<Card
|
|
94
|
+
paddingTop={PADDING_SIZES.small}
|
|
95
|
+
paddingBottom={PADDING_SIZES.small}
|
|
96
|
+
classNames={{
|
|
97
|
+
wrapper: classify(
|
|
98
|
+
css.timelineItemCardWrapper,
|
|
99
|
+
classNames?.card,
|
|
100
|
+
),
|
|
101
|
+
}}
|
|
102
|
+
>
|
|
103
|
+
{children}
|
|
104
|
+
</Card>
|
|
105
|
+
)}
|
|
106
|
+
>
|
|
107
|
+
{children}
|
|
108
|
+
</ConditionalWrapper>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
export const TimelineItem = (React.forwardRef<
|
|
115
|
+
TimelineItemProps,
|
|
116
|
+
HTMLDivElement,
|
|
117
|
+
>(TimelineItem_): React$AbstractComponent<TimelineItemProps, HTMLDivElement>);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _TimelineItem = require("./TimelineItem");
|
|
7
|
+
Object.keys(_TimelineItem).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _TimelineItem[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _TimelineItem[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _Timeline = require("./Timeline");
|
|
7
|
+
Object.keys(_Timeline).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _Timeline[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _Timeline[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _TimelineItem = require("./TimelineItem");
|
|
18
|
+
Object.keys(_TimelineItem).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _TimelineItem[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _TimelineItem[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -109,7 +109,9 @@ const BaseTypeahead = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
109
109
|
options: menuOptions,
|
|
110
110
|
onSelect: (option, e) => {
|
|
111
111
|
onSelect && onSelect(option, e);
|
|
112
|
-
if (
|
|
112
|
+
if (
|
|
113
|
+
// option.keepMenuOpenOnOptionSelect - to allow the menu persist its open stat upon option selection in normal variant
|
|
114
|
+
!option.keepMenuOpenOnOptionSelect && (!menu.optionsVariant || menu.optionsVariant === 'normal')) {
|
|
113
115
|
clickAway();
|
|
114
116
|
}
|
|
115
117
|
},
|
|
@@ -144,8 +144,10 @@ const BaseTypeahead: React$AbstractComponent<
|
|
|
144
144
|
onSelect={(option, e) => {
|
|
145
145
|
onSelect && onSelect(option, e);
|
|
146
146
|
if (
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
// option.keepMenuOpenOnOptionSelect - to allow the menu persist its open stat upon option selection in normal variant
|
|
148
|
+
!option.keepMenuOpenOnOptionSelect &&
|
|
149
|
+
(!menu.optionsVariant ||
|
|
150
|
+
menu.optionsVariant === 'normal')
|
|
149
151
|
) {
|
|
150
152
|
clickAway();
|
|
151
153
|
}
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.wrangleMoment = exports.isStartOfRange = exports.isStartDateEndDateSame = exports.isEndOfRange = exports.inDateRange = exports.getValidDates = exports.getTimezones = exports.getSubtractedDate = exports.getMonthEndDate = exports.getDaysInMonth = exports.getAvailableMonths = exports.getAddedDate = exports.generateAvailableYears = exports.formatIsoDate = exports.checkRangeValidity = exports.addTimezone = exports.WEEKDAYS = exports.NAVIGATION_ACTION = exports.MONTHS = exports.MARKERS = exports.DATE_RANGE_PICKER_ERRORS = void 0;
|
|
7
|
-
var _formatISO = _interopRequireDefault(require("date-fns/formatISO"));
|
|
8
7
|
var _parseISO = _interopRequireDefault(require("date-fns/parseISO"));
|
|
9
8
|
var _invariant = _interopRequireDefault(require("invariant"));
|
|
10
9
|
var _lodash = require("lodash");
|
|
@@ -14,8 +13,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
14
13
|
|
|
15
14
|
// $FlowFixMe - strict types for date-fns
|
|
16
15
|
|
|
17
|
-
// $FlowFixMe - strict types for date-fns
|
|
18
|
-
|
|
19
16
|
// $FlowFixMe[untyped-import]
|
|
20
17
|
|
|
21
18
|
const NAVIGATION_ACTION = Object.freeze({
|
|
@@ -107,9 +104,7 @@ const wrangleMoment = date => {
|
|
|
107
104
|
return date instanceof _momentTimezone.default ? date.toDate() : (0, _parseISO.default)(date);
|
|
108
105
|
};
|
|
109
106
|
exports.wrangleMoment = wrangleMoment;
|
|
110
|
-
const formatIsoDate = date => (0,
|
|
111
|
-
representation: 'date'
|
|
112
|
-
});
|
|
107
|
+
const formatIsoDate = date => (0, _momentTimezone.default)(date).utc().format('YYYY-MM-DD');
|
|
113
108
|
exports.formatIsoDate = formatIsoDate;
|
|
114
109
|
const isStartOfRange = (_ref, date) => {
|
|
115
110
|
let {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
// @flow strict
|
|
2
2
|
|
|
3
|
-
// $FlowFixMe - strict types for date-fns
|
|
4
|
-
import formatISO from 'date-fns/formatISO';
|
|
5
3
|
// $FlowFixMe - strict types for date-fns
|
|
6
4
|
import parseISO from 'date-fns/parseISO';
|
|
7
5
|
import invariant from 'invariant';
|
|
@@ -92,9 +90,7 @@ export const wrangleMoment = (date?: string | Date): Date => {
|
|
|
92
90
|
};
|
|
93
91
|
|
|
94
92
|
export const formatIsoDate = (date?: string | Date): string =>
|
|
95
|
-
|
|
96
|
-
representation: 'date',
|
|
97
|
-
});
|
|
93
|
+
moment(date).utc().format('YYYY-MM-DD');
|
|
98
94
|
|
|
99
95
|
export const isStartOfRange = ({startDate}: DateRange, date: string): boolean =>
|
|
100
96
|
Boolean(startDate) && moment(date).isSame(moment(startDate), 'd');
|