@atlaskit/datetime-picker 15.4.1 → 15.4.2
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 +9 -0
- package/dist/cjs/components/date-picker-class.js +1 -1
- package/dist/cjs/components/date-picker-fc.js +1 -1
- package/dist/cjs/components/date-picker.js +4 -1
- package/dist/cjs/components/date-time-picker.js +5 -2
- package/dist/cjs/components/time-picker.js +1 -1
- package/dist/cjs/internal/ff-component.js +58 -0
- package/dist/es2019/components/date-picker-class.js +1 -1
- package/dist/es2019/components/date-picker-fc.js +1 -1
- package/dist/es2019/components/date-picker.js +2 -1
- package/dist/es2019/components/date-time-picker.js +3 -2
- package/dist/es2019/components/time-picker.js +1 -1
- package/dist/es2019/internal/ff-component.js +47 -0
- package/dist/esm/components/date-picker-class.js +1 -1
- package/dist/esm/components/date-picker-fc.js +1 -1
- package/dist/esm/components/date-picker.js +4 -1
- package/dist/esm/components/date-time-picker.js +5 -2
- package/dist/esm/components/time-picker.js +1 -1
- package/dist/esm/internal/ff-component.js +49 -0
- package/dist/types/components/date-picker-class.d.ts +2 -2
- package/dist/types/components/date-picker-fc.d.ts +1 -1
- package/dist/types/components/date-picker.d.ts +13 -13
- package/dist/types/components/date-time-picker.d.ts +1 -1
- package/dist/types/components/time-picker.d.ts +1 -1
- package/dist/types/internal/ff-component.d.ts +34 -0
- package/dist/types-ts4.5/components/date-picker-class.d.ts +2 -2
- package/dist/types-ts4.5/components/date-picker-fc.d.ts +1 -1
- package/dist/types-ts4.5/components/date-picker.d.ts +13 -13
- package/dist/types-ts4.5/components/date-time-picker.d.ts +1 -1
- package/dist/types-ts4.5/components/time-picker.d.ts +1 -1
- package/dist/types-ts4.5/internal/ff-component.d.ts +34 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/datetime-picker
|
|
2
2
|
|
|
3
|
+
## 15.4.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#153409](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/153409)
|
|
8
|
+
[`af63929f9d51a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/af63929f9d51a) -
|
|
9
|
+
Fix date-picker conditional component export
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 15.4.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -43,7 +43,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
43
43
|
// version very soon from converting this to functional. And also React 18 is on
|
|
44
44
|
// the horizon
|
|
45
45
|
var packageName = "@atlaskit/datetime-picker";
|
|
46
|
-
var packageVersion = "15.4.
|
|
46
|
+
var packageVersion = "15.4.2";
|
|
47
47
|
var datePickerDefaultProps = {
|
|
48
48
|
defaultIsOpen: false,
|
|
49
49
|
defaultValue: '',
|
|
@@ -40,7 +40,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
40
40
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
41
41
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
42
42
|
var packageName = "@atlaskit/datetime-picker";
|
|
43
|
-
var packageVersion = "15.4.
|
|
43
|
+
var packageVersion = "15.4.2";
|
|
44
44
|
var analyticsAttributes = {
|
|
45
45
|
componentName: 'datePicker',
|
|
46
46
|
packageName: packageName,
|
|
@@ -6,8 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
9
|
+
var _ffComponent = require("../internal/ff-component");
|
|
9
10
|
var _datePickerClass = _interopRequireDefault(require("./date-picker-class"));
|
|
10
11
|
var _datePickerFc = _interopRequireDefault(require("./date-picker-fc"));
|
|
11
|
-
var DatePicker = (0,
|
|
12
|
+
var DatePicker = (0, _ffComponent.componentWithCondition)(function () {
|
|
13
|
+
return (0, _platformFeatureFlags.fg)('dst-date-picker-use-functional-component');
|
|
14
|
+
}, _datePickerFc.default, _datePickerClass.default);
|
|
12
15
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
13
16
|
var _default = exports.default = DatePicker;
|
|
@@ -22,6 +22,7 @@ var _select = require("@atlaskit/select");
|
|
|
22
22
|
var _colors = require("@atlaskit/theme/colors");
|
|
23
23
|
var _internal = require("../internal");
|
|
24
24
|
var _dateTimePickerContainer = require("../internal/date-time-picker-container");
|
|
25
|
+
var _ffComponent = require("../internal/ff-component");
|
|
25
26
|
var _parseTokens = require("../internal/parse-tokens");
|
|
26
27
|
var _datePickerClass = _interopRequireDefault(require("./date-picker-class"));
|
|
27
28
|
var _datePickerFc = _interopRequireDefault(require("./date-picker-fc"));
|
|
@@ -33,9 +34,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
33
34
|
* @jsxRuntime classic
|
|
34
35
|
* @jsx jsx
|
|
35
36
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
36
|
-
var DatePicker = (0,
|
|
37
|
+
var DatePicker = (0, _ffComponent.componentWithCondition)(function () {
|
|
38
|
+
return (0, _platformFeatureFlags.fg)('dst-date-picker-use-functional-component');
|
|
39
|
+
}, _datePickerFc.default, _datePickerClass.default);
|
|
37
40
|
var packageName = "@atlaskit/datetime-picker";
|
|
38
|
-
var packageVersion = "15.4.
|
|
41
|
+
var packageVersion = "15.4.2";
|
|
39
42
|
// Make DatePicker 50% the width of DateTimePicker
|
|
40
43
|
// If rendering an icon container, shrink the TimePicker
|
|
41
44
|
var datePickerContainerStyles = (0, _react2.css)({
|
|
@@ -27,7 +27,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
27
27
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
28
28
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
29
29
|
var packageName = "@atlaskit/datetime-picker";
|
|
30
|
-
var packageVersion = "15.4.
|
|
30
|
+
var packageVersion = "15.4.2";
|
|
31
31
|
var menuStyles = {
|
|
32
32
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
33
33
|
position: 'static',
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.componentWithCondition = componentWithCondition;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
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); }
|
|
12
|
+
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; }
|
|
13
|
+
/**
|
|
14
|
+
* Gets all available ref types from two prop sets and returns
|
|
15
|
+
* them in a ref prop
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```
|
|
19
|
+
* type P1 = { ref: Ref(HTMLDivElement), ... };
|
|
20
|
+
* type P2 = { ref: Ref(HTMLSpanElement), ... };
|
|
21
|
+
*
|
|
22
|
+
* GetRefAttributes(P1, P2) // {ref: Ref(HTMLDivElement | HTMLSpanElement)}
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Returns one of components depending on a boolean condition.
|
|
28
|
+
* The result component will be a union of the two props and
|
|
29
|
+
* an or on both ref types.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```
|
|
33
|
+
* const Component = componentWithCondition(
|
|
34
|
+
* isBooleanConditionMet,
|
|
35
|
+
* ComponentWithConditionMet,
|
|
36
|
+
* ComponentWithConditionNotMet,
|
|
37
|
+
* );
|
|
38
|
+
*
|
|
39
|
+
* @param condition Function returning boolean value
|
|
40
|
+
* @param componentTrue Component that will be returned if conditionGetter is "true"
|
|
41
|
+
* @param componentFalse Component that will be returned if conditionGetter is "false"
|
|
42
|
+
* @returns Component Depending on a Condition result
|
|
43
|
+
*/
|
|
44
|
+
function componentWithCondition(condition, ComponentTrue, ComponentFalse) {
|
|
45
|
+
var ComponentWithCondition = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
46
|
+
return condition() ? /*#__PURE__*/_react.default.createElement(ComponentTrue, (0, _extends2.default)({}, props, {
|
|
47
|
+
ref: ref
|
|
48
|
+
})) : /*#__PURE__*/_react.default.createElement(ComponentFalse, (0, _extends2.default)({}, props, {
|
|
49
|
+
ref: ref
|
|
50
|
+
}));
|
|
51
|
+
});
|
|
52
|
+
if (ComponentTrue.name !== '') {
|
|
53
|
+
ComponentWithCondition.displayName = "ComponentWithCondition[".concat(condition.name, "]");
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
57
|
+
return ComponentWithCondition;
|
|
58
|
+
}
|
|
@@ -26,7 +26,7 @@ import { Menu } from '../internal/menu';
|
|
|
26
26
|
import { getSafeCalendarValue, getShortISOString } from '../internal/parse-date';
|
|
27
27
|
import { makeSingleValue } from '../internal/single-value';
|
|
28
28
|
const packageName = "@atlaskit/datetime-picker";
|
|
29
|
-
const packageVersion = "15.4.
|
|
29
|
+
const packageVersion = "15.4.2";
|
|
30
30
|
const datePickerDefaultProps = {
|
|
31
31
|
defaultIsOpen: false,
|
|
32
32
|
defaultValue: '',
|
|
@@ -25,7 +25,7 @@ import { Menu } from '../internal/menu';
|
|
|
25
25
|
import { getSafeCalendarValue, getShortISOString } from '../internal/parse-date';
|
|
26
26
|
import { makeSingleValue } from '../internal/single-value';
|
|
27
27
|
const packageName = "@atlaskit/datetime-picker";
|
|
28
|
-
const packageVersion = "15.4.
|
|
28
|
+
const packageVersion = "15.4.2";
|
|
29
29
|
const analyticsAttributes = {
|
|
30
30
|
componentName: 'datePicker',
|
|
31
31
|
packageName,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
+
import { componentWithCondition } from '../internal/ff-component';
|
|
2
3
|
import DatePickerOld from './date-picker-class';
|
|
3
4
|
import DatePickerNew from './date-picker-fc';
|
|
4
|
-
const DatePicker = fg('dst-date-picker-use-functional-component')
|
|
5
|
+
const DatePicker = componentWithCondition(() => fg('dst-date-picker-use-functional-component'), DatePickerNew, DatePickerOld);
|
|
5
6
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
6
7
|
export default DatePicker;
|
|
@@ -15,13 +15,14 @@ import { mergeStyles } from '@atlaskit/select';
|
|
|
15
15
|
import { N500, N70 } from '@atlaskit/theme/colors';
|
|
16
16
|
import { formatDateTimeZoneIntoIso } from '../internal';
|
|
17
17
|
import { DateTimePickerContainer } from '../internal/date-time-picker-container';
|
|
18
|
+
import { componentWithCondition } from '../internal/ff-component';
|
|
18
19
|
import { convertTokens } from '../internal/parse-tokens';
|
|
19
20
|
import DatePickerOld from './date-picker-class';
|
|
20
21
|
import DatePickerNew from './date-picker-fc';
|
|
21
22
|
import TimePicker from './time-picker';
|
|
22
|
-
const DatePicker = fg('dst-date-picker-use-functional-component')
|
|
23
|
+
const DatePicker = componentWithCondition(() => fg('dst-date-picker-use-functional-component'), DatePickerNew, DatePickerOld);
|
|
23
24
|
const packageName = "@atlaskit/datetime-picker";
|
|
24
|
-
const packageVersion = "15.4.
|
|
25
|
+
const packageVersion = "15.4.2";
|
|
25
26
|
// Make DatePicker 50% the width of DateTimePicker
|
|
26
27
|
// If rendering an icon container, shrink the TimePicker
|
|
27
28
|
const datePickerContainerStyles = css({
|
|
@@ -11,7 +11,7 @@ import parseTime from '../internal/parse-time';
|
|
|
11
11
|
import { convertTokens } from '../internal/parse-tokens';
|
|
12
12
|
import { makeSingleValue } from '../internal/single-value';
|
|
13
13
|
const packageName = "@atlaskit/datetime-picker";
|
|
14
|
-
const packageVersion = "15.4.
|
|
14
|
+
const packageVersion = "15.4.2";
|
|
15
15
|
const menuStyles = {
|
|
16
16
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
17
17
|
position: 'static',
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Gets all available ref types from two prop sets and returns
|
|
6
|
+
* them in a ref prop
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```
|
|
10
|
+
* type P1 = { ref: Ref(HTMLDivElement), ... };
|
|
11
|
+
* type P2 = { ref: Ref(HTMLSpanElement), ... };
|
|
12
|
+
*
|
|
13
|
+
* GetRefAttributes(P1, P2) // {ref: Ref(HTMLDivElement | HTMLSpanElement)}
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Returns one of components depending on a boolean condition.
|
|
19
|
+
* The result component will be a union of the two props and
|
|
20
|
+
* an or on both ref types.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```
|
|
24
|
+
* const Component = componentWithCondition(
|
|
25
|
+
* isBooleanConditionMet,
|
|
26
|
+
* ComponentWithConditionMet,
|
|
27
|
+
* ComponentWithConditionNotMet,
|
|
28
|
+
* );
|
|
29
|
+
*
|
|
30
|
+
* @param condition Function returning boolean value
|
|
31
|
+
* @param componentTrue Component that will be returned if conditionGetter is "true"
|
|
32
|
+
* @param componentFalse Component that will be returned if conditionGetter is "false"
|
|
33
|
+
* @returns Component Depending on a Condition result
|
|
34
|
+
*/
|
|
35
|
+
export function componentWithCondition(condition, ComponentTrue, ComponentFalse) {
|
|
36
|
+
const ComponentWithCondition = /*#__PURE__*/forwardRef((props, ref) => condition() ? /*#__PURE__*/React.createElement(ComponentTrue, _extends({}, props, {
|
|
37
|
+
ref: ref
|
|
38
|
+
})) : /*#__PURE__*/React.createElement(ComponentFalse, _extends({}, props, {
|
|
39
|
+
ref: ref
|
|
40
|
+
})));
|
|
41
|
+
if (ComponentTrue.name !== '') {
|
|
42
|
+
ComponentWithCondition.displayName = `ComponentWithCondition[${condition.name}]`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
46
|
+
return ComponentWithCondition;
|
|
47
|
+
}
|
|
@@ -36,7 +36,7 @@ import { Menu } from '../internal/menu';
|
|
|
36
36
|
import { getSafeCalendarValue, getShortISOString } from '../internal/parse-date';
|
|
37
37
|
import { makeSingleValue } from '../internal/single-value';
|
|
38
38
|
var packageName = "@atlaskit/datetime-picker";
|
|
39
|
-
var packageVersion = "15.4.
|
|
39
|
+
var packageVersion = "15.4.2";
|
|
40
40
|
var datePickerDefaultProps = {
|
|
41
41
|
defaultIsOpen: false,
|
|
42
42
|
defaultValue: '',
|
|
@@ -31,7 +31,7 @@ import { Menu } from '../internal/menu';
|
|
|
31
31
|
import { getSafeCalendarValue, getShortISOString } from '../internal/parse-date';
|
|
32
32
|
import { makeSingleValue } from '../internal/single-value';
|
|
33
33
|
var packageName = "@atlaskit/datetime-picker";
|
|
34
|
-
var packageVersion = "15.4.
|
|
34
|
+
var packageVersion = "15.4.2";
|
|
35
35
|
var analyticsAttributes = {
|
|
36
36
|
componentName: 'datePicker',
|
|
37
37
|
packageName: packageName,
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
+
import { componentWithCondition } from '../internal/ff-component';
|
|
2
3
|
import DatePickerOld from './date-picker-class';
|
|
3
4
|
import DatePickerNew from './date-picker-fc';
|
|
4
|
-
var DatePicker =
|
|
5
|
+
var DatePicker = componentWithCondition(function () {
|
|
6
|
+
return fg('dst-date-picker-use-functional-component');
|
|
7
|
+
}, DatePickerNew, DatePickerOld);
|
|
5
8
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
6
9
|
export default DatePicker;
|
|
@@ -25,13 +25,16 @@ import { mergeStyles } from '@atlaskit/select';
|
|
|
25
25
|
import { N500, N70 } from '@atlaskit/theme/colors';
|
|
26
26
|
import { formatDateTimeZoneIntoIso } from '../internal';
|
|
27
27
|
import { DateTimePickerContainer } from '../internal/date-time-picker-container';
|
|
28
|
+
import { componentWithCondition } from '../internal/ff-component';
|
|
28
29
|
import { convertTokens } from '../internal/parse-tokens';
|
|
29
30
|
import DatePickerOld from './date-picker-class';
|
|
30
31
|
import DatePickerNew from './date-picker-fc';
|
|
31
32
|
import TimePicker from './time-picker';
|
|
32
|
-
var DatePicker =
|
|
33
|
+
var DatePicker = componentWithCondition(function () {
|
|
34
|
+
return fg('dst-date-picker-use-functional-component');
|
|
35
|
+
}, DatePickerNew, DatePickerOld);
|
|
33
36
|
var packageName = "@atlaskit/datetime-picker";
|
|
34
|
-
var packageVersion = "15.4.
|
|
37
|
+
var packageVersion = "15.4.2";
|
|
35
38
|
// Make DatePicker 50% the width of DateTimePicker
|
|
36
39
|
// If rendering an icon container, shrink the TimePicker
|
|
37
40
|
var datePickerContainerStyles = css({
|
|
@@ -17,7 +17,7 @@ import parseTime from '../internal/parse-time';
|
|
|
17
17
|
import { convertTokens } from '../internal/parse-tokens';
|
|
18
18
|
import { makeSingleValue } from '../internal/single-value';
|
|
19
19
|
var packageName = "@atlaskit/datetime-picker";
|
|
20
|
-
var packageVersion = "15.4.
|
|
20
|
+
var packageVersion = "15.4.2";
|
|
21
21
|
var menuStyles = {
|
|
22
22
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
23
23
|
position: 'static',
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Gets all available ref types from two prop sets and returns
|
|
6
|
+
* them in a ref prop
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```
|
|
10
|
+
* type P1 = { ref: Ref(HTMLDivElement), ... };
|
|
11
|
+
* type P2 = { ref: Ref(HTMLSpanElement), ... };
|
|
12
|
+
*
|
|
13
|
+
* GetRefAttributes(P1, P2) // {ref: Ref(HTMLDivElement | HTMLSpanElement)}
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Returns one of components depending on a boolean condition.
|
|
19
|
+
* The result component will be a union of the two props and
|
|
20
|
+
* an or on both ref types.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```
|
|
24
|
+
* const Component = componentWithCondition(
|
|
25
|
+
* isBooleanConditionMet,
|
|
26
|
+
* ComponentWithConditionMet,
|
|
27
|
+
* ComponentWithConditionNotMet,
|
|
28
|
+
* );
|
|
29
|
+
*
|
|
30
|
+
* @param condition Function returning boolean value
|
|
31
|
+
* @param componentTrue Component that will be returned if conditionGetter is "true"
|
|
32
|
+
* @param componentFalse Component that will be returned if conditionGetter is "false"
|
|
33
|
+
* @returns Component Depending on a Condition result
|
|
34
|
+
*/
|
|
35
|
+
export function componentWithCondition(condition, ComponentTrue, ComponentFalse) {
|
|
36
|
+
var ComponentWithCondition = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
37
|
+
return condition() ? /*#__PURE__*/React.createElement(ComponentTrue, _extends({}, props, {
|
|
38
|
+
ref: ref
|
|
39
|
+
})) : /*#__PURE__*/React.createElement(ComponentFalse, _extends({}, props, {
|
|
40
|
+
ref: ref
|
|
41
|
+
}));
|
|
42
|
+
});
|
|
43
|
+
if (ComponentTrue.name !== '') {
|
|
44
|
+
ComponentWithCondition.displayName = "ComponentWithCondition[".concat(condition.name, "]");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
48
|
+
return ComponentWithCondition;
|
|
49
|
+
}
|
|
@@ -97,7 +97,7 @@ declare const DatePicker: import("react").ForwardRefExoticComponent<Pick<Pick<Om
|
|
|
97
97
|
onBlur: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
98
98
|
onChange: (_value: string) => void;
|
|
99
99
|
onFocus: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
100
|
-
} & DatePickerBaseProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "
|
|
100
|
+
} & DatePickerBaseProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "label" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "id" | "aria-describedby" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "weekStartDay" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & Partial<Pick<Omit<{
|
|
101
101
|
defaultIsOpen: boolean;
|
|
102
102
|
defaultValue: string;
|
|
103
103
|
disabled: string[];
|
|
@@ -115,5 +115,5 @@ declare const DatePicker: import("react").ForwardRefExoticComponent<Pick<Pick<Om
|
|
|
115
115
|
onBlur: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
116
116
|
onChange: (_value: string) => void;
|
|
117
117
|
onFocus: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
118
|
-
}, never>> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "
|
|
118
|
+
}, never>> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "label" | "key" | "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "analyticsContext" | "weekStartDay" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & import("react").RefAttributes<any>>;
|
|
119
119
|
export default DatePicker;
|
|
@@ -26,5 +26,5 @@ declare const DatePicker: import("react").ForwardRefExoticComponent<Pick<DatePic
|
|
|
26
26
|
} & {
|
|
27
27
|
inputValue?: string | undefined;
|
|
28
28
|
}) | undefined;
|
|
29
|
-
}, "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "
|
|
29
|
+
}, "label" | "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "weekStartDay" | "createAnalyticsEvent" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & import("react").RefAttributes<unknown>>;
|
|
30
30
|
export default DatePicker;
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare const DatePicker: import("react").
|
|
2
|
+
declare const DatePicker: import("react").FC<Pick<Pick<import("..").DatePickerProps & {
|
|
3
|
+
icon?: import("react").ComponentType<import("@atlaskit/react-select").DropdownIndicatorProps<import("@atlaskit/select").OptionType, boolean, import("@atlaskit/react-select").GroupBase<import("@atlaskit/select").OptionType>>> | undefined;
|
|
4
|
+
selectProps?: (Omit<import("@atlaskit/select").SelectProps<import("@atlaskit/select").OptionType, false>, "placeholder" | "aria-describedby" | "aria-label" | "inputId"> & {
|
|
5
|
+
'aria-describedby'?: undefined;
|
|
6
|
+
'aria-label'?: undefined;
|
|
7
|
+
inputId?: undefined;
|
|
8
|
+
placeholder?: undefined;
|
|
9
|
+
} & {
|
|
10
|
+
inputValue?: string | undefined;
|
|
11
|
+
}) | undefined;
|
|
12
|
+
}, "label" | "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "weekStartDay" | "createAnalyticsEvent" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & import("react").RefAttributes<unknown>, "label" | "key" | "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "weekStartDay" | "createAnalyticsEvent" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & Pick<Pick<Pick<Omit<{
|
|
3
13
|
defaultIsOpen: boolean;
|
|
4
14
|
defaultValue: string;
|
|
5
15
|
disabled: string[];
|
|
@@ -8,7 +18,7 @@ declare const DatePicker: import("react").ForwardRefExoticComponent<Pick<Pick<Om
|
|
|
8
18
|
onBlur: (_event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
9
19
|
onChange: (_value: string) => void;
|
|
10
20
|
onFocus: (_event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
11
|
-
} & import("..").DatePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "
|
|
21
|
+
} & import("..").DatePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "label" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "id" | "aria-describedby" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "weekStartDay" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & Partial<Pick<Omit<{
|
|
12
22
|
defaultIsOpen: boolean;
|
|
13
23
|
defaultValue: string;
|
|
14
24
|
disabled: string[];
|
|
@@ -26,15 +36,5 @@ declare const DatePicker: import("react").ForwardRefExoticComponent<Pick<Pick<Om
|
|
|
26
36
|
onBlur: (_event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
27
37
|
onChange: (_value: string) => void;
|
|
28
38
|
onFocus: (_event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
29
|
-
}, never>> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "
|
|
30
|
-
icon?: import("react").ComponentType<import("@atlaskit/react-select").DropdownIndicatorProps<import("@atlaskit/select").OptionType, boolean, import("@atlaskit/react-select").GroupBase<import("@atlaskit/select").OptionType>>> | undefined;
|
|
31
|
-
selectProps?: (Omit<import("@atlaskit/select").SelectProps<import("@atlaskit/select").OptionType, false>, "placeholder" | "aria-describedby" | "aria-label" | "inputId"> & {
|
|
32
|
-
'aria-describedby'?: undefined;
|
|
33
|
-
'aria-label'?: undefined;
|
|
34
|
-
inputId?: undefined;
|
|
35
|
-
placeholder?: undefined;
|
|
36
|
-
} & {
|
|
37
|
-
inputValue?: string | undefined;
|
|
38
|
-
}) | undefined;
|
|
39
|
-
}, "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "label" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "weekStartDay" | "createAnalyticsEvent" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & import("react").RefAttributes<unknown>>;
|
|
39
|
+
}, never>> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "label" | "key" | "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "analyticsContext" | "weekStartDay" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & import("react").RefAttributes<any>, "label" | "key" | "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "analyticsContext" | "weekStartDay" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & import("react").RefAttributes<any>>;
|
|
40
40
|
export default DatePicker;
|
|
@@ -52,5 +52,5 @@ export { DateTimePickerComponent as DateTimePickerWithoutAnalytics };
|
|
|
52
52
|
* - [Code](https://atlassian.design/components/datetime-picker/code)
|
|
53
53
|
* - [Usage](https://atlassian.design/components/datetime-picker/usage)
|
|
54
54
|
*/
|
|
55
|
-
declare const DateTimePicker: React.ForwardRefExoticComponent<Pick<Pick<Pick<Omit<DateTimePickerBaseProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, never> & Partial<Pick<Omit<DateTimePickerBaseProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "testId" | "appearance" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "locale" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "clearControlLabel" | "datePickerProps" | "timePickerProps" | "parseValue">> & Partial<Pick<DateTimePickerBaseProps, "ref" | "createAnalyticsEvent">>, "testId" | "appearance" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "locale" | "createAnalyticsEvent" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "clearControlLabel" | "datePickerProps" | "timePickerProps" | "parseValue"> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "
|
|
55
|
+
declare const DateTimePicker: React.ForwardRefExoticComponent<Pick<Pick<Pick<Omit<DateTimePickerBaseProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, never> & Partial<Pick<Omit<DateTimePickerBaseProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "testId" | "appearance" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "locale" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "clearControlLabel" | "datePickerProps" | "timePickerProps" | "parseValue">> & Partial<Pick<DateTimePickerBaseProps, "ref" | "createAnalyticsEvent">>, "testId" | "appearance" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "locale" | "createAnalyticsEvent" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "clearControlLabel" | "datePickerProps" | "timePickerProps" | "parseValue"> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "key" | "testId" | "appearance" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "locale" | "analyticsContext" | "createAnalyticsEvent" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "clearControlLabel" | "datePickerProps" | "timePickerProps" | "parseValue"> & React.RefAttributes<any>>;
|
|
56
56
|
export default DateTimePicker;
|
|
@@ -9,5 +9,5 @@ import { type TimePickerBaseProps } from '../types';
|
|
|
9
9
|
* - [Code](https://atlassian.design/components/datetime-picker/time-picker/code)
|
|
10
10
|
* - [Usage](https://atlassian.design/components/datetime-picker/time-picker/usage)
|
|
11
11
|
*/
|
|
12
|
-
declare const TimePicker: React.ForwardRefExoticComponent<Pick<TimePickerBaseProps, "times" | "
|
|
12
|
+
declare const TimePicker: React.ForwardRefExoticComponent<Pick<TimePickerBaseProps, "times" | "label" | "parseInputValue" | "formatDisplayLabel" | "placeholder" | "testId" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "locale" | "createAnalyticsEvent" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "hideIcon" | "timeIsEditable" | "timeFormat"> & React.RefAttributes<unknown>>;
|
|
13
13
|
export default TimePicker;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { type ComponentType, type RefAttributes } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Gets all available ref types from two prop sets and returns
|
|
4
|
+
* them in a ref prop
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```
|
|
8
|
+
* type P1 = { ref: Ref(HTMLDivElement), ... };
|
|
9
|
+
* type P2 = { ref: Ref(HTMLSpanElement), ... };
|
|
10
|
+
*
|
|
11
|
+
* GetRefAttributes(P1, P2) // {ref: Ref(HTMLDivElement | HTMLSpanElement)}
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
type GetRefAttributes<A, B> = A extends RefAttributes<infer RefA> ? B extends RefAttributes<infer RefB> ? RefAttributes<RefA | RefB> : RefAttributes<RefA> : B extends RefAttributes<infer OnlyRefB> ? RefAttributes<OnlyRefB> : unknown;
|
|
15
|
+
/**
|
|
16
|
+
* Returns one of components depending on a boolean condition.
|
|
17
|
+
* The result component will be a union of the two props and
|
|
18
|
+
* an or on both ref types.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```
|
|
22
|
+
* const Component = componentWithCondition(
|
|
23
|
+
* isBooleanConditionMet,
|
|
24
|
+
* ComponentWithConditionMet,
|
|
25
|
+
* ComponentWithConditionNotMet,
|
|
26
|
+
* );
|
|
27
|
+
*
|
|
28
|
+
* @param condition Function returning boolean value
|
|
29
|
+
* @param componentTrue Component that will be returned if conditionGetter is "true"
|
|
30
|
+
* @param componentFalse Component that will be returned if conditionGetter is "false"
|
|
31
|
+
* @returns Component Depending on a Condition result
|
|
32
|
+
*/
|
|
33
|
+
export declare function componentWithCondition<A extends {}, B extends {}>(condition: () => boolean, ComponentTrue: ComponentType<A>, ComponentFalse: ComponentType<B>): React.FC<React.PropsWithoutRef<A> & React.PropsWithoutRef<B> & GetRefAttributes<React.PropsWithRef<A>, React.PropsWithRef<B>>>;
|
|
34
|
+
export {};
|
|
@@ -97,7 +97,7 @@ declare const DatePicker: import("react").ForwardRefExoticComponent<Pick<Pick<Om
|
|
|
97
97
|
onBlur: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
98
98
|
onChange: (_value: string) => void;
|
|
99
99
|
onFocus: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
100
|
-
} & DatePickerBaseProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "
|
|
100
|
+
} & DatePickerBaseProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "label" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "id" | "aria-describedby" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "weekStartDay" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & Partial<Pick<Omit<{
|
|
101
101
|
defaultIsOpen: boolean;
|
|
102
102
|
defaultValue: string;
|
|
103
103
|
disabled: string[];
|
|
@@ -115,5 +115,5 @@ declare const DatePicker: import("react").ForwardRefExoticComponent<Pick<Pick<Om
|
|
|
115
115
|
onBlur: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
116
116
|
onChange: (_value: string) => void;
|
|
117
117
|
onFocus: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
118
|
-
}, never>> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "
|
|
118
|
+
}, never>> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "label" | "key" | "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "analyticsContext" | "weekStartDay" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & import("react").RefAttributes<any>>;
|
|
119
119
|
export default DatePicker;
|
|
@@ -26,5 +26,5 @@ declare const DatePicker: import("react").ForwardRefExoticComponent<Pick<DatePic
|
|
|
26
26
|
} & {
|
|
27
27
|
inputValue?: string | undefined;
|
|
28
28
|
}) | undefined;
|
|
29
|
-
}, "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "
|
|
29
|
+
}, "label" | "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "weekStartDay" | "createAnalyticsEvent" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & import("react").RefAttributes<unknown>>;
|
|
30
30
|
export default DatePicker;
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare const DatePicker: import("react").
|
|
2
|
+
declare const DatePicker: import("react").FC<Pick<Pick<import("..").DatePickerProps & {
|
|
3
|
+
icon?: import("react").ComponentType<import("@atlaskit/react-select").DropdownIndicatorProps<import("@atlaskit/select").OptionType, boolean, import("@atlaskit/react-select").GroupBase<import("@atlaskit/select").OptionType>>> | undefined;
|
|
4
|
+
selectProps?: (Omit<import("@atlaskit/select").SelectProps<import("@atlaskit/select").OptionType, false>, "placeholder" | "aria-describedby" | "aria-label" | "inputId"> & {
|
|
5
|
+
'aria-describedby'?: undefined;
|
|
6
|
+
'aria-label'?: undefined;
|
|
7
|
+
inputId?: undefined;
|
|
8
|
+
placeholder?: undefined;
|
|
9
|
+
} & {
|
|
10
|
+
inputValue?: string | undefined;
|
|
11
|
+
}) | undefined;
|
|
12
|
+
}, "label" | "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "weekStartDay" | "createAnalyticsEvent" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & import("react").RefAttributes<unknown>, "label" | "key" | "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "weekStartDay" | "createAnalyticsEvent" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & Pick<Pick<Pick<Omit<{
|
|
3
13
|
defaultIsOpen: boolean;
|
|
4
14
|
defaultValue: string;
|
|
5
15
|
disabled: string[];
|
|
@@ -8,7 +18,7 @@ declare const DatePicker: import("react").ForwardRefExoticComponent<Pick<Pick<Om
|
|
|
8
18
|
onBlur: (_event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
9
19
|
onChange: (_value: string) => void;
|
|
10
20
|
onFocus: (_event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
11
|
-
} & import("..").DatePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "
|
|
21
|
+
} & import("..").DatePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "label" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "id" | "aria-describedby" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "weekStartDay" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & Partial<Pick<Omit<{
|
|
12
22
|
defaultIsOpen: boolean;
|
|
13
23
|
defaultValue: string;
|
|
14
24
|
disabled: string[];
|
|
@@ -26,15 +36,5 @@ declare const DatePicker: import("react").ForwardRefExoticComponent<Pick<Pick<Om
|
|
|
26
36
|
onBlur: (_event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
27
37
|
onChange: (_value: string) => void;
|
|
28
38
|
onFocus: (_event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
29
|
-
}, never>> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "
|
|
30
|
-
icon?: import("react").ComponentType<import("@atlaskit/react-select").DropdownIndicatorProps<import("@atlaskit/select").OptionType, boolean, import("@atlaskit/react-select").GroupBase<import("@atlaskit/select").OptionType>>> | undefined;
|
|
31
|
-
selectProps?: (Omit<import("@atlaskit/select").SelectProps<import("@atlaskit/select").OptionType, false>, "placeholder" | "aria-describedby" | "aria-label" | "inputId"> & {
|
|
32
|
-
'aria-describedby'?: undefined;
|
|
33
|
-
'aria-label'?: undefined;
|
|
34
|
-
inputId?: undefined;
|
|
35
|
-
placeholder?: undefined;
|
|
36
|
-
} & {
|
|
37
|
-
inputValue?: string | undefined;
|
|
38
|
-
}) | undefined;
|
|
39
|
-
}, "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "label" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "weekStartDay" | "createAnalyticsEvent" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & import("react").RefAttributes<unknown>>;
|
|
39
|
+
}, never>> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "label" | "key" | "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "analyticsContext" | "weekStartDay" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & import("react").RefAttributes<any>, "label" | "key" | "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "analyticsContext" | "weekStartDay" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & import("react").RefAttributes<any>>;
|
|
40
40
|
export default DatePicker;
|
|
@@ -52,5 +52,5 @@ export { DateTimePickerComponent as DateTimePickerWithoutAnalytics };
|
|
|
52
52
|
* - [Code](https://atlassian.design/components/datetime-picker/code)
|
|
53
53
|
* - [Usage](https://atlassian.design/components/datetime-picker/usage)
|
|
54
54
|
*/
|
|
55
|
-
declare const DateTimePicker: React.ForwardRefExoticComponent<Pick<Pick<Pick<Omit<DateTimePickerBaseProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, never> & Partial<Pick<Omit<DateTimePickerBaseProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "testId" | "appearance" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "locale" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "clearControlLabel" | "datePickerProps" | "timePickerProps" | "parseValue">> & Partial<Pick<DateTimePickerBaseProps, "ref" | "createAnalyticsEvent">>, "testId" | "appearance" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "locale" | "createAnalyticsEvent" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "clearControlLabel" | "datePickerProps" | "timePickerProps" | "parseValue"> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "
|
|
55
|
+
declare const DateTimePicker: React.ForwardRefExoticComponent<Pick<Pick<Pick<Omit<DateTimePickerBaseProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, never> & Partial<Pick<Omit<DateTimePickerBaseProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "testId" | "appearance" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "locale" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "clearControlLabel" | "datePickerProps" | "timePickerProps" | "parseValue">> & Partial<Pick<DateTimePickerBaseProps, "ref" | "createAnalyticsEvent">>, "testId" | "appearance" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "locale" | "createAnalyticsEvent" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "clearControlLabel" | "datePickerProps" | "timePickerProps" | "parseValue"> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "key" | "testId" | "appearance" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "locale" | "analyticsContext" | "createAnalyticsEvent" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "clearControlLabel" | "datePickerProps" | "timePickerProps" | "parseValue"> & React.RefAttributes<any>>;
|
|
56
56
|
export default DateTimePicker;
|
|
@@ -9,5 +9,5 @@ import { type TimePickerBaseProps } from '../types';
|
|
|
9
9
|
* - [Code](https://atlassian.design/components/datetime-picker/time-picker/code)
|
|
10
10
|
* - [Usage](https://atlassian.design/components/datetime-picker/time-picker/usage)
|
|
11
11
|
*/
|
|
12
|
-
declare const TimePicker: React.ForwardRefExoticComponent<Pick<TimePickerBaseProps, "times" | "
|
|
12
|
+
declare const TimePicker: React.ForwardRefExoticComponent<Pick<TimePickerBaseProps, "times" | "label" | "parseInputValue" | "formatDisplayLabel" | "placeholder" | "testId" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "locale" | "createAnalyticsEvent" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "hideIcon" | "timeIsEditable" | "timeFormat"> & React.RefAttributes<unknown>>;
|
|
13
13
|
export default TimePicker;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { type ComponentType, type RefAttributes } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Gets all available ref types from two prop sets and returns
|
|
4
|
+
* them in a ref prop
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```
|
|
8
|
+
* type P1 = { ref: Ref(HTMLDivElement), ... };
|
|
9
|
+
* type P2 = { ref: Ref(HTMLSpanElement), ... };
|
|
10
|
+
*
|
|
11
|
+
* GetRefAttributes(P1, P2) // {ref: Ref(HTMLDivElement | HTMLSpanElement)}
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
type GetRefAttributes<A, B> = A extends RefAttributes<infer RefA> ? B extends RefAttributes<infer RefB> ? RefAttributes<RefA | RefB> : RefAttributes<RefA> : B extends RefAttributes<infer OnlyRefB> ? RefAttributes<OnlyRefB> : unknown;
|
|
15
|
+
/**
|
|
16
|
+
* Returns one of components depending on a boolean condition.
|
|
17
|
+
* The result component will be a union of the two props and
|
|
18
|
+
* an or on both ref types.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```
|
|
22
|
+
* const Component = componentWithCondition(
|
|
23
|
+
* isBooleanConditionMet,
|
|
24
|
+
* ComponentWithConditionMet,
|
|
25
|
+
* ComponentWithConditionNotMet,
|
|
26
|
+
* );
|
|
27
|
+
*
|
|
28
|
+
* @param condition Function returning boolean value
|
|
29
|
+
* @param componentTrue Component that will be returned if conditionGetter is "true"
|
|
30
|
+
* @param componentFalse Component that will be returned if conditionGetter is "false"
|
|
31
|
+
* @returns Component Depending on a Condition result
|
|
32
|
+
*/
|
|
33
|
+
export declare function componentWithCondition<A extends {}, B extends {}>(condition: () => boolean, ComponentTrue: ComponentType<A>, ComponentFalse: ComponentType<B>): React.FC<React.PropsWithoutRef<A> & React.PropsWithoutRef<B> & GetRefAttributes<React.PropsWithRef<A>, React.PropsWithRef<B>>>;
|
|
34
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/datetime-picker",
|
|
3
|
-
"version": "15.4.
|
|
3
|
+
"version": "15.4.2",
|
|
4
4
|
"description": "A date time picker allows the user to select an associated date and time.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@atlaskit/popper": "^6.3.0",
|
|
46
46
|
"@atlaskit/primitives": "^12.2.0",
|
|
47
47
|
"@atlaskit/select": "^18.1.0",
|
|
48
|
-
"@atlaskit/theme": "^
|
|
48
|
+
"@atlaskit/theme": "^14.0.0",
|
|
49
49
|
"@atlaskit/tokens": "^2.0.0",
|
|
50
50
|
"@babel/runtime": "^7.0.0",
|
|
51
51
|
"@emotion/react": "^11.7.1",
|