@atlaskit/contextual-survey 6.0.11 → 6.1.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/dist/cjs/components/SurveyForm.js +2 -38
- package/dist/cjs/components/SurveyMarshal.compiled.css +0 -1
- package/dist/cjs/components/SurveyMarshal.js +15 -63
- package/dist/cjs/new-survey/SurveyForm.js +18 -55
- package/dist/cjs/new-survey/SurveyFormExpandedFeedback.js +42 -0
- package/dist/es2019/components/SurveyForm.js +2 -36
- package/dist/es2019/components/SurveyMarshal.compiled.css +0 -1
- package/dist/es2019/components/SurveyMarshal.js +15 -64
- package/dist/es2019/new-survey/SurveyForm.js +14 -51
- package/dist/es2019/new-survey/SurveyFormExpandedFeedback.js +34 -0
- package/dist/esm/components/SurveyForm.js +2 -38
- package/dist/esm/components/SurveyMarshal.compiled.css +0 -1
- package/dist/esm/components/SurveyMarshal.js +15 -63
- package/dist/esm/new-survey/SurveyForm.js +19 -56
- package/dist/esm/new-survey/SurveyFormExpandedFeedback.js +35 -0
- package/dist/types/new-survey/SurveyFormExpandedFeedback.d.ts +8 -0
- package/dist/types-ts4.5/new-survey/SurveyFormExpandedFeedback.d.ts +8 -0
- package/package.json +7 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/contextual-survey
|
|
2
2
|
|
|
3
|
+
## 6.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`08f86d1686ebb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/08f86d1686ebb) -
|
|
8
|
+
Making library react19 compatible - Converting JSX.Element to React.JSX.Element & using
|
|
9
|
+
@atlaskit/motion instead of react-transition-group
|
|
10
|
+
|
|
11
|
+
## 6.0.12
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 6.0.11
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -13,30 +13,14 @@ var React = _react;
|
|
|
13
13
|
var _runtime = require("@compiled/react/runtime");
|
|
14
14
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
15
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
16
|
-
var _reactTransitionGroup = require("react-transition-group");
|
|
17
16
|
var _form = _interopRequireWildcard(require("@atlaskit/form"));
|
|
18
17
|
var _heading = _interopRequireDefault(require("@atlaskit/heading"));
|
|
19
18
|
var _motion = require("@atlaskit/motion");
|
|
20
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
21
19
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
22
20
|
var _FeedbackScoreButtons = _interopRequireDefault(require("./FeedbackScoreButtons"));
|
|
23
21
|
var _SurveyFormExpandedFeedback = require("./SurveyFormExpandedFeedback");
|
|
24
22
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
25
23
|
var transitionBaseStyles = null;
|
|
26
|
-
var getExpandedHeight = function getExpandedHeight(ref, state) {
|
|
27
|
-
if (!ref.current) {
|
|
28
|
-
return '0';
|
|
29
|
-
}
|
|
30
|
-
switch (state) {
|
|
31
|
-
case 'entering':
|
|
32
|
-
return "".concat(ref.current.scrollHeight, "px");
|
|
33
|
-
case 'entered':
|
|
34
|
-
// needed for TextField auto height expand
|
|
35
|
-
return "none";
|
|
36
|
-
default:
|
|
37
|
-
return '0';
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
24
|
var TRANSITION_DURATION = 200;
|
|
41
25
|
var _default = exports.default = function _default(_ref) {
|
|
42
26
|
var question = _ref.question,
|
|
@@ -53,7 +37,6 @@ var _default = exports.default = function _default(_ref) {
|
|
|
53
37
|
canContactDefault = _useState4[0],
|
|
54
38
|
setCanContactDefault = _useState4[1];
|
|
55
39
|
var hasAutoFilledCanContactRef = (0, _react.useRef)(false);
|
|
56
|
-
var expandedAreaRef = (0, _react.useRef)(null);
|
|
57
40
|
var onScoreSelect = (0, _react.useCallback)(function () {
|
|
58
41
|
setExpanded(true);
|
|
59
42
|
}, [setExpanded]);
|
|
@@ -104,7 +87,7 @@ var _default = exports.default = function _default(_ref) {
|
|
|
104
87
|
onScoreSelect();
|
|
105
88
|
}
|
|
106
89
|
}));
|
|
107
|
-
}),
|
|
90
|
+
}), /*#__PURE__*/React.createElement("div", (0, _extends2.default)({}, resizingHeightProps, {
|
|
108
91
|
className: (0, _runtime.ax)(["_1reo15vq _18m915vq"])
|
|
109
92
|
}), expanded ? /*#__PURE__*/React.createElement(_SurveyFormExpandedFeedback.SurveyFormExpandedFeedback, {
|
|
110
93
|
canContactDefault: canContactDefault,
|
|
@@ -112,25 +95,6 @@ var _default = exports.default = function _default(_ref) {
|
|
|
112
95
|
submitting: submitting,
|
|
113
96
|
textLabel: textLabel,
|
|
114
97
|
textPlaceholder: textPlaceholder
|
|
115
|
-
}) : null)
|
|
116
|
-
in: expanded,
|
|
117
|
-
timeout: TRANSITION_DURATION,
|
|
118
|
-
mountOnEnter: true
|
|
119
|
-
}, function (state) {
|
|
120
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
121
|
-
style: {
|
|
122
|
-
transition: "max-height ".concat(TRANSITION_DURATION, "ms ease-in-out"),
|
|
123
|
-
maxHeight: getExpandedHeight(expandedAreaRef, state)
|
|
124
|
-
},
|
|
125
|
-
ref: expandedAreaRef,
|
|
126
|
-
className: (0, _runtime.ax)(["_1reo15vq _18m915vq"])
|
|
127
|
-
}, /*#__PURE__*/React.createElement(_SurveyFormExpandedFeedback.SurveyFormExpandedFeedback, {
|
|
128
|
-
canContactDefault: canContactDefault,
|
|
129
|
-
onFeedbackChange: onFeedbackChange,
|
|
130
|
-
submitting: submitting,
|
|
131
|
-
textLabel: textLabel,
|
|
132
|
-
textPlaceholder: textPlaceholder
|
|
133
|
-
}));
|
|
134
|
-
}));
|
|
98
|
+
}) : null));
|
|
135
99
|
}));
|
|
136
100
|
};
|
|
@@ -10,80 +10,32 @@ exports.default = SurveyMarshal;
|
|
|
10
10
|
require("./SurveyMarshal.compiled.css");
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _runtime = require("@compiled/react/runtime");
|
|
13
|
-
var _reactTransitionGroup = require("react-transition-group");
|
|
14
13
|
var _exitingPersistence = _interopRequireDefault(require("@atlaskit/motion/exiting-persistence"));
|
|
15
14
|
var _slideIn = _interopRequireDefault(require("@atlaskit/motion/slide-in"));
|
|
16
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
15
|
var _constants = require("@atlaskit/theme/constants");
|
|
18
16
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
19
17
|
// 8px is the base unit in pixels
|
|
20
18
|
var surveyOffset = "var(--ds-space-600, 48px)";
|
|
21
|
-
var animationDuration = 300;
|
|
22
|
-
var offscreen = {
|
|
23
|
-
// Hard-coded because there is no large enough space token and this component is not responsive.
|
|
24
|
-
translateX: '488px',
|
|
25
|
-
//survey container width + survey offset
|
|
26
|
-
opacity: '0'
|
|
27
|
-
};
|
|
28
|
-
var getAnimationProps = function getAnimationProps(state) {
|
|
29
|
-
switch (state) {
|
|
30
|
-
case 'entered':
|
|
31
|
-
{
|
|
32
|
-
return {
|
|
33
|
-
translateX: '0',
|
|
34
|
-
opacity: '1'
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
case 'entering':
|
|
38
|
-
case 'unmounted':
|
|
39
|
-
case 'exited':
|
|
40
|
-
case 'exiting':
|
|
41
|
-
{
|
|
42
|
-
return offscreen;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
var transitionBaseStyles = null;
|
|
47
19
|
var marshalLayoutStyles = null;
|
|
48
20
|
var marshalMotionLayerStyles = null;
|
|
49
21
|
function SurveyMarshal(props) {
|
|
50
22
|
var children = props.children,
|
|
51
23
|
shouldShow = props.shouldShow;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}, function (motionProps) {
|
|
61
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
62
|
-
ref: motionProps.ref
|
|
63
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- motion keyframes
|
|
64
|
-
,
|
|
65
|
-
className: (0, _runtime.ax)(["_kqsw1n9t _1xi2oahv _94n5oahv", "_1pbyni7l", motionProps.className]),
|
|
66
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- motion animation styles
|
|
67
|
-
style: motionProps.style
|
|
68
|
-
}, children());
|
|
69
|
-
}));
|
|
70
|
-
}
|
|
71
|
-
return /*#__PURE__*/React.createElement(_reactTransitionGroup.Transition, {
|
|
72
|
-
in: shouldShow,
|
|
73
|
-
timeout: animationDuration,
|
|
74
|
-
unmountOnExit: true
|
|
75
|
-
}, function (state) {
|
|
76
|
-
var _getAnimationProps = getAnimationProps(state),
|
|
77
|
-
translateX = _getAnimationProps.translateX,
|
|
78
|
-
opacity = _getAnimationProps.opacity;
|
|
24
|
+
return /*#__PURE__*/React.createElement(_exitingPersistence.default, {
|
|
25
|
+
appear: true
|
|
26
|
+
}, shouldShow && /*#__PURE__*/React.createElement(_slideIn.default, {
|
|
27
|
+
key: "contextual-survey-marshal",
|
|
28
|
+
enterFrom: "right",
|
|
29
|
+
fade: "inout",
|
|
30
|
+
duration: "medium"
|
|
31
|
+
}, function (motionProps) {
|
|
79
32
|
return /*#__PURE__*/React.createElement("div", {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
className: (0, _runtime.ax)(["_kqsw1n9t _1xi2oahv _94n5oahv _k8m01rjc"])
|
|
33
|
+
ref: motionProps.ref
|
|
34
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- motion keyframes
|
|
35
|
+
,
|
|
36
|
+
className: (0, _runtime.ax)(["_kqsw1n9t _1xi2oahv _94n5oahv", "_1pbyni7l", motionProps.className]),
|
|
37
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- motion animation styles
|
|
38
|
+
style: motionProps.style
|
|
87
39
|
}, children());
|
|
88
|
-
});
|
|
40
|
+
}));
|
|
89
41
|
}
|
|
@@ -13,34 +13,19 @@ var React = _react;
|
|
|
13
13
|
var _runtime = require("@compiled/react/runtime");
|
|
14
14
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
15
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
16
|
-
var _reactTransitionGroup = require("react-transition-group");
|
|
17
16
|
var _new = _interopRequireDefault(require("@atlaskit/button/new"));
|
|
18
|
-
var _checkbox = require("@atlaskit/checkbox");
|
|
19
17
|
var _form = _interopRequireWildcard(require("@atlaskit/form"));
|
|
20
18
|
var _heading = _interopRequireDefault(require("@atlaskit/heading"));
|
|
19
|
+
var _motion = require("@atlaskit/motion");
|
|
21
20
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
22
|
-
var _textarea = _interopRequireDefault(require("@atlaskit/textarea"));
|
|
23
21
|
var _FeedbackScoreButtons = _interopRequireDefault(require("./FeedbackScoreButtons"));
|
|
22
|
+
var _SurveyFormExpandedFeedback = require("./SurveyFormExpandedFeedback");
|
|
24
23
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
25
24
|
var transitionBaseStyles = null;
|
|
26
25
|
var styles = {
|
|
27
26
|
buttonContainer: "_19pk1ejb",
|
|
28
27
|
questionContainer: "_otyrv47k"
|
|
29
28
|
};
|
|
30
|
-
var getExpandedHeight = function getExpandedHeight(ref, state) {
|
|
31
|
-
if (!ref.current) {
|
|
32
|
-
return '0';
|
|
33
|
-
}
|
|
34
|
-
switch (state) {
|
|
35
|
-
case 'entering':
|
|
36
|
-
return "".concat(ref.current.scrollHeight, "px");
|
|
37
|
-
case 'entered':
|
|
38
|
-
// needed for TextField auto height expand
|
|
39
|
-
return "none";
|
|
40
|
-
default:
|
|
41
|
-
return '0';
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
29
|
var TRANSITION_DURATION = 200;
|
|
45
30
|
var _default = exports.default = function _default(_ref) {
|
|
46
31
|
var question = _ref.question,
|
|
@@ -57,7 +42,6 @@ var _default = exports.default = function _default(_ref) {
|
|
|
57
42
|
canContactDefault = _useState4[0],
|
|
58
43
|
setCanContactDefault = _useState4[1];
|
|
59
44
|
var hasAutoFilledCanContactRef = (0, _react.useRef)(false);
|
|
60
|
-
var expandedAreaRef = (0, _react.useRef)(null);
|
|
61
45
|
var onScoreSelect = (0, _react.useCallback)(function () {
|
|
62
46
|
setExpanded(true);
|
|
63
47
|
}, [setExpanded]);
|
|
@@ -72,6 +56,14 @@ var _default = exports.default = function _default(_ref) {
|
|
|
72
56
|
hasAutoFilledCanContactRef.current = true;
|
|
73
57
|
setCanContactDefault(true);
|
|
74
58
|
}, []);
|
|
59
|
+
var resizingHeightProps = (0, _motion.useResizingHeight)({
|
|
60
|
+
duration: function duration() {
|
|
61
|
+
return TRANSITION_DURATION;
|
|
62
|
+
},
|
|
63
|
+
timingFunction: function timingFunction() {
|
|
64
|
+
return 'ease-in-out';
|
|
65
|
+
}
|
|
66
|
+
});
|
|
75
67
|
return /*#__PURE__*/React.createElement("section", {
|
|
76
68
|
"aria-labelledby": "contextualSurveyQuestion"
|
|
77
69
|
}, /*#__PURE__*/React.createElement(_compiled.Stack, {
|
|
@@ -104,43 +96,14 @@ var _default = exports.default = function _default(_ref) {
|
|
|
104
96
|
onScoreSelect();
|
|
105
97
|
}
|
|
106
98
|
}));
|
|
107
|
-
}), /*#__PURE__*/React.createElement(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
maxHeight: getExpandedHeight(expandedAreaRef, state)
|
|
116
|
-
},
|
|
117
|
-
ref: expandedAreaRef,
|
|
118
|
-
className: (0, _runtime.ax)(["_1reo15vq _18m915vq"])
|
|
119
|
-
}, /*#__PURE__*/React.createElement(_form.Field, {
|
|
120
|
-
name: "writtenFeedback",
|
|
121
|
-
defaultValue: "",
|
|
122
|
-
isDisabled: submitting,
|
|
123
|
-
label: textLabel
|
|
124
|
-
}, function (_ref4) {
|
|
125
|
-
var fieldProps = _ref4.fieldProps;
|
|
126
|
-
return /*#__PURE__*/React.createElement(_textarea.default, (0, _extends2.default)({}, fieldProps, {
|
|
127
|
-
"aria-label": textLabel,
|
|
128
|
-
onChange: function onChange(event) {
|
|
129
|
-
fieldProps.onChange(event);
|
|
130
|
-
onFeedbackChange();
|
|
131
|
-
}
|
|
132
|
-
}));
|
|
133
|
-
}), /*#__PURE__*/React.createElement(_form.CheckboxField, {
|
|
134
|
-
name: "canContact",
|
|
135
|
-
isDisabled: submitting,
|
|
136
|
-
defaultIsChecked: canContactDefault
|
|
137
|
-
}, function (_ref5) {
|
|
138
|
-
var fieldProps = _ref5.fieldProps;
|
|
139
|
-
return /*#__PURE__*/React.createElement(_checkbox.Checkbox, (0, _extends2.default)({}, fieldProps, {
|
|
140
|
-
label: "Atlassian can contact me about this feedback"
|
|
141
|
-
}));
|
|
142
|
-
}));
|
|
143
|
-
}), /*#__PURE__*/React.createElement(_compiled.Box, {
|
|
99
|
+
}), /*#__PURE__*/React.createElement("div", (0, _extends2.default)({}, resizingHeightProps, {
|
|
100
|
+
className: (0, _runtime.ax)(["_1reo15vq _18m915vq"])
|
|
101
|
+
}), expanded ? /*#__PURE__*/React.createElement(_SurveyFormExpandedFeedback.SurveyFormExpandedFeedback, {
|
|
102
|
+
canContactDefault: canContactDefault,
|
|
103
|
+
onFeedbackChange: onFeedbackChange,
|
|
104
|
+
submitting: submitting,
|
|
105
|
+
textLabel: textLabel
|
|
106
|
+
}) : null), /*#__PURE__*/React.createElement(_compiled.Box, {
|
|
144
107
|
xcss: styles.buttonContainer
|
|
145
108
|
}, /*#__PURE__*/React.createElement(_new.default, {
|
|
146
109
|
isDisabled: !expanded,
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.SurveyFormExpandedFeedback = SurveyFormExpandedFeedback;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _checkbox = _interopRequireDefault(require("@atlaskit/checkbox"));
|
|
11
|
+
var _form = require("@atlaskit/form");
|
|
12
|
+
var _textarea = _interopRequireDefault(require("@atlaskit/textarea"));
|
|
13
|
+
function SurveyFormExpandedFeedback(_ref) {
|
|
14
|
+
var canContactDefault = _ref.canContactDefault,
|
|
15
|
+
onFeedbackChange = _ref.onFeedbackChange,
|
|
16
|
+
submitting = _ref.submitting,
|
|
17
|
+
textLabel = _ref.textLabel;
|
|
18
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_form.Field, {
|
|
19
|
+
name: "writtenFeedback",
|
|
20
|
+
defaultValue: "",
|
|
21
|
+
isDisabled: submitting,
|
|
22
|
+
label: textLabel
|
|
23
|
+
}, function (_ref2) {
|
|
24
|
+
var fieldProps = _ref2.fieldProps;
|
|
25
|
+
return /*#__PURE__*/_react.default.createElement(_textarea.default, (0, _extends2.default)({}, fieldProps, {
|
|
26
|
+
"aria-label": textLabel,
|
|
27
|
+
onChange: function onChange(event) {
|
|
28
|
+
fieldProps.onChange(event);
|
|
29
|
+
onFeedbackChange();
|
|
30
|
+
}
|
|
31
|
+
}));
|
|
32
|
+
}), /*#__PURE__*/_react.default.createElement(_form.CheckboxField, {
|
|
33
|
+
name: "canContact",
|
|
34
|
+
isDisabled: submitting,
|
|
35
|
+
defaultIsChecked: canContactDefault
|
|
36
|
+
}, function (_ref3) {
|
|
37
|
+
var fieldProps = _ref3.fieldProps;
|
|
38
|
+
return /*#__PURE__*/_react.default.createElement(_checkbox.default, (0, _extends2.default)({}, fieldProps, {
|
|
39
|
+
label: "Atlassian can contact me about this feedback"
|
|
40
|
+
}));
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
@@ -4,29 +4,13 @@ import "./SurveyForm.compiled.css";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
6
|
import { useCallback, useRef, useState } from 'react';
|
|
7
|
-
import { Transition } from 'react-transition-group';
|
|
8
7
|
import Form, { Field } from '@atlaskit/form';
|
|
9
8
|
import Heading from '@atlaskit/heading';
|
|
10
9
|
import { useResizingHeight } from '@atlaskit/motion';
|
|
11
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
10
|
import { Stack, Text } from '@atlaskit/primitives/compiled';
|
|
13
11
|
import FeedbackScoreButtons from './FeedbackScoreButtons';
|
|
14
12
|
import { SurveyFormExpandedFeedback } from './SurveyFormExpandedFeedback';
|
|
15
13
|
const transitionBaseStyles = null;
|
|
16
|
-
const getExpandedHeight = (ref, state) => {
|
|
17
|
-
if (!ref.current) {
|
|
18
|
-
return '0';
|
|
19
|
-
}
|
|
20
|
-
switch (state) {
|
|
21
|
-
case 'entering':
|
|
22
|
-
return `${ref.current.scrollHeight}px`;
|
|
23
|
-
case 'entered':
|
|
24
|
-
// needed for TextField auto height expand
|
|
25
|
-
return `none`;
|
|
26
|
-
default:
|
|
27
|
-
return '0';
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
14
|
const TRANSITION_DURATION = 200;
|
|
31
15
|
export default (({
|
|
32
16
|
question,
|
|
@@ -38,7 +22,6 @@ export default (({
|
|
|
38
22
|
const [expanded, setExpanded] = useState(false);
|
|
39
23
|
const [canContactDefault, setCanContactDefault] = useState(false);
|
|
40
24
|
const hasAutoFilledCanContactRef = useRef(false);
|
|
41
|
-
const expandedAreaRef = useRef(null);
|
|
42
25
|
const onScoreSelect = useCallback(() => {
|
|
43
26
|
setExpanded(true);
|
|
44
27
|
}, [setExpanded]);
|
|
@@ -84,7 +67,7 @@ export default (({
|
|
|
84
67
|
fieldProps.onChange(score);
|
|
85
68
|
onScoreSelect();
|
|
86
69
|
}
|
|
87
|
-
}))),
|
|
70
|
+
}))), /*#__PURE__*/React.createElement("div", _extends({}, resizingHeightProps, {
|
|
88
71
|
className: ax(["_1reo15vq _18m915vq"])
|
|
89
72
|
}), expanded ? /*#__PURE__*/React.createElement(SurveyFormExpandedFeedback, {
|
|
90
73
|
canContactDefault: canContactDefault,
|
|
@@ -92,22 +75,5 @@ export default (({
|
|
|
92
75
|
submitting: submitting,
|
|
93
76
|
textLabel: textLabel,
|
|
94
77
|
textPlaceholder: textPlaceholder
|
|
95
|
-
}) : null)
|
|
96
|
-
in: expanded,
|
|
97
|
-
timeout: TRANSITION_DURATION,
|
|
98
|
-
mountOnEnter: true
|
|
99
|
-
}, state => /*#__PURE__*/React.createElement("div", {
|
|
100
|
-
style: {
|
|
101
|
-
transition: `max-height ${TRANSITION_DURATION}ms ease-in-out`,
|
|
102
|
-
maxHeight: getExpandedHeight(expandedAreaRef, state)
|
|
103
|
-
},
|
|
104
|
-
ref: expandedAreaRef,
|
|
105
|
-
className: ax(["_1reo15vq _18m915vq"])
|
|
106
|
-
}, /*#__PURE__*/React.createElement(SurveyFormExpandedFeedback, {
|
|
107
|
-
canContactDefault: canContactDefault,
|
|
108
|
-
onFeedbackChange: onFeedbackChange,
|
|
109
|
-
submitting: submitting,
|
|
110
|
-
textLabel: textLabel,
|
|
111
|
-
textPlaceholder: textPlaceholder
|
|
112
|
-
}))))));
|
|
78
|
+
}) : null))));
|
|
113
79
|
});
|
|
@@ -2,39 +2,11 @@
|
|
|
2
2
|
import "./SurveyMarshal.compiled.css";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
-
import { Transition } from 'react-transition-group';
|
|
6
5
|
import ExitingPersistence from '@atlaskit/motion/exiting-persistence';
|
|
7
6
|
import SlideIn from '@atlaskit/motion/slide-in';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
7
|
import { layers } from '@atlaskit/theme/constants';
|
|
10
8
|
// 8px is the base unit in pixels
|
|
11
9
|
const surveyOffset = "var(--ds-space-600, 48px)";
|
|
12
|
-
const animationDuration = 300;
|
|
13
|
-
const offscreen = {
|
|
14
|
-
// Hard-coded because there is no large enough space token and this component is not responsive.
|
|
15
|
-
translateX: '488px',
|
|
16
|
-
//survey container width + survey offset
|
|
17
|
-
opacity: '0'
|
|
18
|
-
};
|
|
19
|
-
const getAnimationProps = state => {
|
|
20
|
-
switch (state) {
|
|
21
|
-
case 'entered':
|
|
22
|
-
{
|
|
23
|
-
return {
|
|
24
|
-
translateX: '0',
|
|
25
|
-
opacity: '1'
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
case 'entering':
|
|
29
|
-
case 'unmounted':
|
|
30
|
-
case 'exited':
|
|
31
|
-
case 'exiting':
|
|
32
|
-
{
|
|
33
|
-
return offscreen;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
const transitionBaseStyles = null;
|
|
38
10
|
const marshalLayoutStyles = null;
|
|
39
11
|
const marshalMotionLayerStyles = null;
|
|
40
12
|
export default function SurveyMarshal(props) {
|
|
@@ -42,40 +14,19 @@ export default function SurveyMarshal(props) {
|
|
|
42
14
|
children,
|
|
43
15
|
shouldShow
|
|
44
16
|
} = props;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}, children())));
|
|
61
|
-
}
|
|
62
|
-
return /*#__PURE__*/React.createElement(Transition, {
|
|
63
|
-
in: shouldShow,
|
|
64
|
-
timeout: animationDuration,
|
|
65
|
-
unmountOnExit: true
|
|
66
|
-
}, state => {
|
|
67
|
-
const {
|
|
68
|
-
translateX,
|
|
69
|
-
opacity
|
|
70
|
-
} = getAnimationProps(state);
|
|
71
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
72
|
-
style: {
|
|
73
|
-
opacity: opacity,
|
|
74
|
-
transition: `all ${animationDuration}ms ease-in-out`,
|
|
75
|
-
zIndex: layers.flag(),
|
|
76
|
-
transform: `translateX(${translateX})`
|
|
77
|
-
},
|
|
78
|
-
className: ax(["_kqsw1n9t _1xi2oahv _94n5oahv _k8m01rjc"])
|
|
79
|
-
}, children());
|
|
80
|
-
});
|
|
17
|
+
return /*#__PURE__*/React.createElement(ExitingPersistence, {
|
|
18
|
+
appear: true
|
|
19
|
+
}, shouldShow && /*#__PURE__*/React.createElement(SlideIn, {
|
|
20
|
+
key: "contextual-survey-marshal",
|
|
21
|
+
enterFrom: "right",
|
|
22
|
+
fade: "inout",
|
|
23
|
+
duration: "medium"
|
|
24
|
+
}, motionProps => /*#__PURE__*/React.createElement("div", {
|
|
25
|
+
ref: motionProps.ref
|
|
26
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- motion keyframes
|
|
27
|
+
,
|
|
28
|
+
className: ax(["_kqsw1n9t _1xi2oahv _94n5oahv", "_1pbyni7l", motionProps.className]),
|
|
29
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- motion animation styles
|
|
30
|
+
style: motionProps.style
|
|
31
|
+
}, children())));
|
|
81
32
|
}
|
|
@@ -4,33 +4,18 @@ import "./SurveyForm.compiled.css";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
6
|
import { useCallback, useRef, useState } from 'react';
|
|
7
|
-
import { Transition } from 'react-transition-group';
|
|
8
7
|
import Button from '@atlaskit/button/new';
|
|
9
|
-
import {
|
|
10
|
-
import Form, { CheckboxField, Field } from '@atlaskit/form';
|
|
8
|
+
import Form, { Field } from '@atlaskit/form';
|
|
11
9
|
import Heading from '@atlaskit/heading';
|
|
10
|
+
import { useResizingHeight } from '@atlaskit/motion';
|
|
12
11
|
import { Box, Stack, Text } from '@atlaskit/primitives/compiled';
|
|
13
|
-
import Textarea from '@atlaskit/textarea';
|
|
14
12
|
import FeedbackScoreButtons from './FeedbackScoreButtons';
|
|
13
|
+
import { SurveyFormExpandedFeedback } from './SurveyFormExpandedFeedback';
|
|
15
14
|
const transitionBaseStyles = null;
|
|
16
15
|
const styles = {
|
|
17
16
|
buttonContainer: "_19pk1ejb",
|
|
18
17
|
questionContainer: "_otyrv47k"
|
|
19
18
|
};
|
|
20
|
-
const getExpandedHeight = (ref, state) => {
|
|
21
|
-
if (!ref.current) {
|
|
22
|
-
return '0';
|
|
23
|
-
}
|
|
24
|
-
switch (state) {
|
|
25
|
-
case 'entering':
|
|
26
|
-
return `${ref.current.scrollHeight}px`;
|
|
27
|
-
case 'entered':
|
|
28
|
-
// needed for TextField auto height expand
|
|
29
|
-
return `none`;
|
|
30
|
-
default:
|
|
31
|
-
return '0';
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
19
|
const TRANSITION_DURATION = 200;
|
|
35
20
|
export default (({
|
|
36
21
|
question,
|
|
@@ -42,7 +27,6 @@ export default (({
|
|
|
42
27
|
const [expanded, setExpanded] = useState(false);
|
|
43
28
|
const [canContactDefault, setCanContactDefault] = useState(false);
|
|
44
29
|
const hasAutoFilledCanContactRef = useRef(false);
|
|
45
|
-
const expandedAreaRef = useRef(null);
|
|
46
30
|
const onScoreSelect = useCallback(() => {
|
|
47
31
|
setExpanded(true);
|
|
48
32
|
}, [setExpanded]);
|
|
@@ -57,6 +41,10 @@ export default (({
|
|
|
57
41
|
hasAutoFilledCanContactRef.current = true;
|
|
58
42
|
setCanContactDefault(true);
|
|
59
43
|
}, []);
|
|
44
|
+
const resizingHeightProps = useResizingHeight({
|
|
45
|
+
duration: () => TRANSITION_DURATION,
|
|
46
|
+
timingFunction: () => 'ease-in-out'
|
|
47
|
+
});
|
|
60
48
|
return /*#__PURE__*/React.createElement("section", {
|
|
61
49
|
"aria-labelledby": "contextualSurveyQuestion"
|
|
62
50
|
}, /*#__PURE__*/React.createElement(Stack, {
|
|
@@ -88,39 +76,14 @@ export default (({
|
|
|
88
76
|
fieldProps.onChange(score);
|
|
89
77
|
onScoreSelect();
|
|
90
78
|
}
|
|
91
|
-
}))), /*#__PURE__*/React.createElement(
|
|
92
|
-
in: expanded,
|
|
93
|
-
timeout: TRANSITION_DURATION,
|
|
94
|
-
mountOnEnter: true
|
|
95
|
-
}, state => /*#__PURE__*/React.createElement("div", {
|
|
96
|
-
style: {
|
|
97
|
-
transition: `max-height ${TRANSITION_DURATION}ms ease-in-out`,
|
|
98
|
-
maxHeight: getExpandedHeight(expandedAreaRef, state)
|
|
99
|
-
},
|
|
100
|
-
ref: expandedAreaRef,
|
|
79
|
+
}))), /*#__PURE__*/React.createElement("div", _extends({}, resizingHeightProps, {
|
|
101
80
|
className: ax(["_1reo15vq _18m915vq"])
|
|
102
|
-
}, /*#__PURE__*/React.createElement(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}, ({
|
|
108
|
-
fieldProps
|
|
109
|
-
}) => /*#__PURE__*/React.createElement(Textarea, _extends({}, fieldProps, {
|
|
110
|
-
"aria-label": textLabel,
|
|
111
|
-
onChange: event => {
|
|
112
|
-
fieldProps.onChange(event);
|
|
113
|
-
onFeedbackChange();
|
|
114
|
-
}
|
|
115
|
-
}))), /*#__PURE__*/React.createElement(CheckboxField, {
|
|
116
|
-
name: "canContact",
|
|
117
|
-
isDisabled: submitting,
|
|
118
|
-
defaultIsChecked: canContactDefault
|
|
119
|
-
}, ({
|
|
120
|
-
fieldProps
|
|
121
|
-
}) => /*#__PURE__*/React.createElement(Checkbox, _extends({}, fieldProps, {
|
|
122
|
-
label: "Atlassian can contact me about this feedback"
|
|
123
|
-
}))))), /*#__PURE__*/React.createElement(Box, {
|
|
81
|
+
}), expanded ? /*#__PURE__*/React.createElement(SurveyFormExpandedFeedback, {
|
|
82
|
+
canContactDefault: canContactDefault,
|
|
83
|
+
onFeedbackChange: onFeedbackChange,
|
|
84
|
+
submitting: submitting,
|
|
85
|
+
textLabel: textLabel
|
|
86
|
+
}) : null), /*#__PURE__*/React.createElement(Box, {
|
|
124
87
|
xcss: styles.buttonContainer
|
|
125
88
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
126
89
|
isDisabled: !expanded,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Checkbox from '@atlaskit/checkbox';
|
|
4
|
+
import { CheckboxField, Field } from '@atlaskit/form';
|
|
5
|
+
import Textarea from '@atlaskit/textarea';
|
|
6
|
+
export function SurveyFormExpandedFeedback({
|
|
7
|
+
canContactDefault,
|
|
8
|
+
onFeedbackChange,
|
|
9
|
+
submitting,
|
|
10
|
+
textLabel
|
|
11
|
+
}) {
|
|
12
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Field, {
|
|
13
|
+
name: "writtenFeedback",
|
|
14
|
+
defaultValue: "",
|
|
15
|
+
isDisabled: submitting,
|
|
16
|
+
label: textLabel
|
|
17
|
+
}, ({
|
|
18
|
+
fieldProps
|
|
19
|
+
}) => /*#__PURE__*/React.createElement(Textarea, _extends({}, fieldProps, {
|
|
20
|
+
"aria-label": textLabel,
|
|
21
|
+
onChange: event => {
|
|
22
|
+
fieldProps.onChange(event);
|
|
23
|
+
onFeedbackChange();
|
|
24
|
+
}
|
|
25
|
+
}))), /*#__PURE__*/React.createElement(CheckboxField, {
|
|
26
|
+
name: "canContact",
|
|
27
|
+
isDisabled: submitting,
|
|
28
|
+
defaultIsChecked: canContactDefault
|
|
29
|
+
}, ({
|
|
30
|
+
fieldProps
|
|
31
|
+
}) => /*#__PURE__*/React.createElement(Checkbox, _extends({}, fieldProps, {
|
|
32
|
+
label: "Atlassian can contact me about this feedback"
|
|
33
|
+
}))));
|
|
34
|
+
}
|
|
@@ -5,29 +5,13 @@ import "./SurveyForm.compiled.css";
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { ax, ix } from "@compiled/react/runtime";
|
|
7
7
|
import { useCallback, useRef, useState } from 'react';
|
|
8
|
-
import { Transition } from 'react-transition-group';
|
|
9
8
|
import Form, { Field } from '@atlaskit/form';
|
|
10
9
|
import Heading from '@atlaskit/heading';
|
|
11
10
|
import { useResizingHeight } from '@atlaskit/motion';
|
|
12
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
11
|
import { Stack, Text } from '@atlaskit/primitives/compiled';
|
|
14
12
|
import FeedbackScoreButtons from './FeedbackScoreButtons';
|
|
15
13
|
import { SurveyFormExpandedFeedback } from './SurveyFormExpandedFeedback';
|
|
16
14
|
var transitionBaseStyles = null;
|
|
17
|
-
var getExpandedHeight = function getExpandedHeight(ref, state) {
|
|
18
|
-
if (!ref.current) {
|
|
19
|
-
return '0';
|
|
20
|
-
}
|
|
21
|
-
switch (state) {
|
|
22
|
-
case 'entering':
|
|
23
|
-
return "".concat(ref.current.scrollHeight, "px");
|
|
24
|
-
case 'entered':
|
|
25
|
-
// needed for TextField auto height expand
|
|
26
|
-
return "none";
|
|
27
|
-
default:
|
|
28
|
-
return '0';
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
15
|
var TRANSITION_DURATION = 200;
|
|
32
16
|
export default (function (_ref) {
|
|
33
17
|
var question = _ref.question,
|
|
@@ -44,7 +28,6 @@ export default (function (_ref) {
|
|
|
44
28
|
canContactDefault = _useState4[0],
|
|
45
29
|
setCanContactDefault = _useState4[1];
|
|
46
30
|
var hasAutoFilledCanContactRef = useRef(false);
|
|
47
|
-
var expandedAreaRef = useRef(null);
|
|
48
31
|
var onScoreSelect = useCallback(function () {
|
|
49
32
|
setExpanded(true);
|
|
50
33
|
}, [setExpanded]);
|
|
@@ -95,7 +78,7 @@ export default (function (_ref) {
|
|
|
95
78
|
onScoreSelect();
|
|
96
79
|
}
|
|
97
80
|
}));
|
|
98
|
-
}),
|
|
81
|
+
}), /*#__PURE__*/React.createElement("div", _extends({}, resizingHeightProps, {
|
|
99
82
|
className: ax(["_1reo15vq _18m915vq"])
|
|
100
83
|
}), expanded ? /*#__PURE__*/React.createElement(SurveyFormExpandedFeedback, {
|
|
101
84
|
canContactDefault: canContactDefault,
|
|
@@ -103,25 +86,6 @@ export default (function (_ref) {
|
|
|
103
86
|
submitting: submitting,
|
|
104
87
|
textLabel: textLabel,
|
|
105
88
|
textPlaceholder: textPlaceholder
|
|
106
|
-
}) : null)
|
|
107
|
-
in: expanded,
|
|
108
|
-
timeout: TRANSITION_DURATION,
|
|
109
|
-
mountOnEnter: true
|
|
110
|
-
}, function (state) {
|
|
111
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
112
|
-
style: {
|
|
113
|
-
transition: "max-height ".concat(TRANSITION_DURATION, "ms ease-in-out"),
|
|
114
|
-
maxHeight: getExpandedHeight(expandedAreaRef, state)
|
|
115
|
-
},
|
|
116
|
-
ref: expandedAreaRef,
|
|
117
|
-
className: ax(["_1reo15vq _18m915vq"])
|
|
118
|
-
}, /*#__PURE__*/React.createElement(SurveyFormExpandedFeedback, {
|
|
119
|
-
canContactDefault: canContactDefault,
|
|
120
|
-
onFeedbackChange: onFeedbackChange,
|
|
121
|
-
submitting: submitting,
|
|
122
|
-
textLabel: textLabel,
|
|
123
|
-
textPlaceholder: textPlaceholder
|
|
124
|
-
}));
|
|
125
|
-
}));
|
|
89
|
+
}) : null));
|
|
126
90
|
}));
|
|
127
91
|
});
|
|
@@ -2,79 +2,31 @@
|
|
|
2
2
|
import "./SurveyMarshal.compiled.css";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
-
import { Transition } from 'react-transition-group';
|
|
6
5
|
import ExitingPersistence from '@atlaskit/motion/exiting-persistence';
|
|
7
6
|
import SlideIn from '@atlaskit/motion/slide-in';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
7
|
import { layers } from '@atlaskit/theme/constants';
|
|
10
8
|
// 8px is the base unit in pixels
|
|
11
9
|
var surveyOffset = "var(--ds-space-600, 48px)";
|
|
12
|
-
var animationDuration = 300;
|
|
13
|
-
var offscreen = {
|
|
14
|
-
// Hard-coded because there is no large enough space token and this component is not responsive.
|
|
15
|
-
translateX: '488px',
|
|
16
|
-
//survey container width + survey offset
|
|
17
|
-
opacity: '0'
|
|
18
|
-
};
|
|
19
|
-
var getAnimationProps = function getAnimationProps(state) {
|
|
20
|
-
switch (state) {
|
|
21
|
-
case 'entered':
|
|
22
|
-
{
|
|
23
|
-
return {
|
|
24
|
-
translateX: '0',
|
|
25
|
-
opacity: '1'
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
case 'entering':
|
|
29
|
-
case 'unmounted':
|
|
30
|
-
case 'exited':
|
|
31
|
-
case 'exiting':
|
|
32
|
-
{
|
|
33
|
-
return offscreen;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
var transitionBaseStyles = null;
|
|
38
10
|
var marshalLayoutStyles = null;
|
|
39
11
|
var marshalMotionLayerStyles = null;
|
|
40
12
|
export default function SurveyMarshal(props) {
|
|
41
13
|
var children = props.children,
|
|
42
14
|
shouldShow = props.shouldShow;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}, function (motionProps) {
|
|
52
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
53
|
-
ref: motionProps.ref
|
|
54
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- motion keyframes
|
|
55
|
-
,
|
|
56
|
-
className: ax(["_kqsw1n9t _1xi2oahv _94n5oahv", "_1pbyni7l", motionProps.className]),
|
|
57
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- motion animation styles
|
|
58
|
-
style: motionProps.style
|
|
59
|
-
}, children());
|
|
60
|
-
}));
|
|
61
|
-
}
|
|
62
|
-
return /*#__PURE__*/React.createElement(Transition, {
|
|
63
|
-
in: shouldShow,
|
|
64
|
-
timeout: animationDuration,
|
|
65
|
-
unmountOnExit: true
|
|
66
|
-
}, function (state) {
|
|
67
|
-
var _getAnimationProps = getAnimationProps(state),
|
|
68
|
-
translateX = _getAnimationProps.translateX,
|
|
69
|
-
opacity = _getAnimationProps.opacity;
|
|
15
|
+
return /*#__PURE__*/React.createElement(ExitingPersistence, {
|
|
16
|
+
appear: true
|
|
17
|
+
}, shouldShow && /*#__PURE__*/React.createElement(SlideIn, {
|
|
18
|
+
key: "contextual-survey-marshal",
|
|
19
|
+
enterFrom: "right",
|
|
20
|
+
fade: "inout",
|
|
21
|
+
duration: "medium"
|
|
22
|
+
}, function (motionProps) {
|
|
70
23
|
return /*#__PURE__*/React.createElement("div", {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
className: ax(["_kqsw1n9t _1xi2oahv _94n5oahv _k8m01rjc"])
|
|
24
|
+
ref: motionProps.ref
|
|
25
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- motion keyframes
|
|
26
|
+
,
|
|
27
|
+
className: ax(["_kqsw1n9t _1xi2oahv _94n5oahv", "_1pbyni7l", motionProps.className]),
|
|
28
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- motion animation styles
|
|
29
|
+
style: motionProps.style
|
|
78
30
|
}, children());
|
|
79
|
-
});
|
|
31
|
+
}));
|
|
80
32
|
}
|
|
@@ -5,33 +5,18 @@ import "./SurveyForm.compiled.css";
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { ax, ix } from "@compiled/react/runtime";
|
|
7
7
|
import { useCallback, useRef, useState } from 'react';
|
|
8
|
-
import { Transition } from 'react-transition-group';
|
|
9
8
|
import Button from '@atlaskit/button/new';
|
|
10
|
-
import {
|
|
11
|
-
import Form, { CheckboxField, Field } from '@atlaskit/form';
|
|
9
|
+
import Form, { Field } from '@atlaskit/form';
|
|
12
10
|
import Heading from '@atlaskit/heading';
|
|
11
|
+
import { useResizingHeight } from '@atlaskit/motion';
|
|
13
12
|
import { Box, Stack, Text } from '@atlaskit/primitives/compiled';
|
|
14
|
-
import Textarea from '@atlaskit/textarea';
|
|
15
13
|
import FeedbackScoreButtons from './FeedbackScoreButtons';
|
|
14
|
+
import { SurveyFormExpandedFeedback } from './SurveyFormExpandedFeedback';
|
|
16
15
|
var transitionBaseStyles = null;
|
|
17
16
|
var styles = {
|
|
18
17
|
buttonContainer: "_19pk1ejb",
|
|
19
18
|
questionContainer: "_otyrv47k"
|
|
20
19
|
};
|
|
21
|
-
var getExpandedHeight = function getExpandedHeight(ref, state) {
|
|
22
|
-
if (!ref.current) {
|
|
23
|
-
return '0';
|
|
24
|
-
}
|
|
25
|
-
switch (state) {
|
|
26
|
-
case 'entering':
|
|
27
|
-
return "".concat(ref.current.scrollHeight, "px");
|
|
28
|
-
case 'entered':
|
|
29
|
-
// needed for TextField auto height expand
|
|
30
|
-
return "none";
|
|
31
|
-
default:
|
|
32
|
-
return '0';
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
20
|
var TRANSITION_DURATION = 200;
|
|
36
21
|
export default (function (_ref) {
|
|
37
22
|
var question = _ref.question,
|
|
@@ -48,7 +33,6 @@ export default (function (_ref) {
|
|
|
48
33
|
canContactDefault = _useState4[0],
|
|
49
34
|
setCanContactDefault = _useState4[1];
|
|
50
35
|
var hasAutoFilledCanContactRef = useRef(false);
|
|
51
|
-
var expandedAreaRef = useRef(null);
|
|
52
36
|
var onScoreSelect = useCallback(function () {
|
|
53
37
|
setExpanded(true);
|
|
54
38
|
}, [setExpanded]);
|
|
@@ -63,6 +47,14 @@ export default (function (_ref) {
|
|
|
63
47
|
hasAutoFilledCanContactRef.current = true;
|
|
64
48
|
setCanContactDefault(true);
|
|
65
49
|
}, []);
|
|
50
|
+
var resizingHeightProps = useResizingHeight({
|
|
51
|
+
duration: function duration() {
|
|
52
|
+
return TRANSITION_DURATION;
|
|
53
|
+
},
|
|
54
|
+
timingFunction: function timingFunction() {
|
|
55
|
+
return 'ease-in-out';
|
|
56
|
+
}
|
|
57
|
+
});
|
|
66
58
|
return /*#__PURE__*/React.createElement("section", {
|
|
67
59
|
"aria-labelledby": "contextualSurveyQuestion"
|
|
68
60
|
}, /*#__PURE__*/React.createElement(Stack, {
|
|
@@ -95,43 +87,14 @@ export default (function (_ref) {
|
|
|
95
87
|
onScoreSelect();
|
|
96
88
|
}
|
|
97
89
|
}));
|
|
98
|
-
}), /*#__PURE__*/React.createElement(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
maxHeight: getExpandedHeight(expandedAreaRef, state)
|
|
107
|
-
},
|
|
108
|
-
ref: expandedAreaRef,
|
|
109
|
-
className: ax(["_1reo15vq _18m915vq"])
|
|
110
|
-
}, /*#__PURE__*/React.createElement(Field, {
|
|
111
|
-
name: "writtenFeedback",
|
|
112
|
-
defaultValue: "",
|
|
113
|
-
isDisabled: submitting,
|
|
114
|
-
label: textLabel
|
|
115
|
-
}, function (_ref4) {
|
|
116
|
-
var fieldProps = _ref4.fieldProps;
|
|
117
|
-
return /*#__PURE__*/React.createElement(Textarea, _extends({}, fieldProps, {
|
|
118
|
-
"aria-label": textLabel,
|
|
119
|
-
onChange: function onChange(event) {
|
|
120
|
-
fieldProps.onChange(event);
|
|
121
|
-
onFeedbackChange();
|
|
122
|
-
}
|
|
123
|
-
}));
|
|
124
|
-
}), /*#__PURE__*/React.createElement(CheckboxField, {
|
|
125
|
-
name: "canContact",
|
|
126
|
-
isDisabled: submitting,
|
|
127
|
-
defaultIsChecked: canContactDefault
|
|
128
|
-
}, function (_ref5) {
|
|
129
|
-
var fieldProps = _ref5.fieldProps;
|
|
130
|
-
return /*#__PURE__*/React.createElement(Checkbox, _extends({}, fieldProps, {
|
|
131
|
-
label: "Atlassian can contact me about this feedback"
|
|
132
|
-
}));
|
|
133
|
-
}));
|
|
134
|
-
}), /*#__PURE__*/React.createElement(Box, {
|
|
90
|
+
}), /*#__PURE__*/React.createElement("div", _extends({}, resizingHeightProps, {
|
|
91
|
+
className: ax(["_1reo15vq _18m915vq"])
|
|
92
|
+
}), expanded ? /*#__PURE__*/React.createElement(SurveyFormExpandedFeedback, {
|
|
93
|
+
canContactDefault: canContactDefault,
|
|
94
|
+
onFeedbackChange: onFeedbackChange,
|
|
95
|
+
submitting: submitting,
|
|
96
|
+
textLabel: textLabel
|
|
97
|
+
}) : null), /*#__PURE__*/React.createElement(Box, {
|
|
135
98
|
xcss: styles.buttonContainer
|
|
136
99
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
137
100
|
isDisabled: !expanded,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Checkbox from '@atlaskit/checkbox';
|
|
4
|
+
import { CheckboxField, Field } from '@atlaskit/form';
|
|
5
|
+
import Textarea from '@atlaskit/textarea';
|
|
6
|
+
export function SurveyFormExpandedFeedback(_ref) {
|
|
7
|
+
var canContactDefault = _ref.canContactDefault,
|
|
8
|
+
onFeedbackChange = _ref.onFeedbackChange,
|
|
9
|
+
submitting = _ref.submitting,
|
|
10
|
+
textLabel = _ref.textLabel;
|
|
11
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Field, {
|
|
12
|
+
name: "writtenFeedback",
|
|
13
|
+
defaultValue: "",
|
|
14
|
+
isDisabled: submitting,
|
|
15
|
+
label: textLabel
|
|
16
|
+
}, function (_ref2) {
|
|
17
|
+
var fieldProps = _ref2.fieldProps;
|
|
18
|
+
return /*#__PURE__*/React.createElement(Textarea, _extends({}, fieldProps, {
|
|
19
|
+
"aria-label": textLabel,
|
|
20
|
+
onChange: function onChange(event) {
|
|
21
|
+
fieldProps.onChange(event);
|
|
22
|
+
onFeedbackChange();
|
|
23
|
+
}
|
|
24
|
+
}));
|
|
25
|
+
}), /*#__PURE__*/React.createElement(CheckboxField, {
|
|
26
|
+
name: "canContact",
|
|
27
|
+
isDisabled: submitting,
|
|
28
|
+
defaultIsChecked: canContactDefault
|
|
29
|
+
}, function (_ref3) {
|
|
30
|
+
var fieldProps = _ref3.fieldProps;
|
|
31
|
+
return /*#__PURE__*/React.createElement(Checkbox, _extends({}, fieldProps, {
|
|
32
|
+
label: "Atlassian can contact me about this feedback"
|
|
33
|
+
}));
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type SurveyFormExpandedFeedbackProps = {
|
|
3
|
+
canContactDefault: boolean;
|
|
4
|
+
onFeedbackChange: () => void;
|
|
5
|
+
submitting: boolean;
|
|
6
|
+
textLabel: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function SurveyFormExpandedFeedback({ canContactDefault, onFeedbackChange, submitting, textLabel, }: SurveyFormExpandedFeedbackProps): React.JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type SurveyFormExpandedFeedbackProps = {
|
|
3
|
+
canContactDefault: boolean;
|
|
4
|
+
onFeedbackChange: () => void;
|
|
5
|
+
submitting: boolean;
|
|
6
|
+
textLabel: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function SurveyFormExpandedFeedback({ canContactDefault, onFeedbackChange, submitting, textLabel, }: SurveyFormExpandedFeedbackProps): React.JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/contextual-survey",
|
|
3
|
-
"version": "6.0
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"description": "A React component used to ask the user for feedback",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -39,24 +39,22 @@
|
|
|
39
39
|
"@atlaskit/icon": "^34.0.0",
|
|
40
40
|
"@atlaskit/image": "^3.0.0",
|
|
41
41
|
"@atlaskit/link": "^3.4.0",
|
|
42
|
-
"@atlaskit/motion": "^5.
|
|
42
|
+
"@atlaskit/motion": "^5.6.0",
|
|
43
43
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
44
|
-
"@atlaskit/primitives": "^
|
|
44
|
+
"@atlaskit/primitives": "^19.0.0",
|
|
45
45
|
"@atlaskit/textarea": "^8.2.0",
|
|
46
46
|
"@atlaskit/theme": "^23.0.0",
|
|
47
|
-
"@atlaskit/tokens": "^
|
|
47
|
+
"@atlaskit/tokens": "^13.0.0",
|
|
48
48
|
"@atlaskit/tooltip": "^21.1.0",
|
|
49
49
|
"@babel/runtime": "^7.0.0",
|
|
50
50
|
"@compiled/react": "^0.20.0",
|
|
51
|
-
"@emotion/react": "^11.7.1"
|
|
52
|
-
"react-transition-group": "^4.4.1"
|
|
51
|
+
"@emotion/react": "^11.7.1"
|
|
53
52
|
},
|
|
54
53
|
"peerDependencies": {
|
|
55
|
-
"react": "^18.2.0"
|
|
54
|
+
"react": "^18.2.0 || ^19.0.0"
|
|
56
55
|
},
|
|
57
56
|
"devDependencies": {
|
|
58
|
-
"@testing-library/react": "^16.3.0"
|
|
59
|
-
"@types/react-transition-group": "^2.0.6"
|
|
57
|
+
"@testing-library/react": "^16.3.0"
|
|
60
58
|
},
|
|
61
59
|
"keywords": [
|
|
62
60
|
"atlaskit",
|
|
@@ -73,10 +71,5 @@
|
|
|
73
71
|
"spacing"
|
|
74
72
|
]
|
|
75
73
|
}
|
|
76
|
-
},
|
|
77
|
-
"platform-feature-flags": {
|
|
78
|
-
"platform_contextual_survey_use_atlaskit_motion": {
|
|
79
|
-
"type": "boolean"
|
|
80
|
-
}
|
|
81
74
|
}
|
|
82
75
|
}
|