@atlaskit/contextual-survey 3.0.3 → 3.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 +13 -0
- package/afm-cc/tsconfig.json +6 -0
- package/afm-jira/tsconfig.json +6 -0
- package/afm-post-office/tsconfig.json +6 -0
- package/dist/cjs/compiled/ContextualSurvey.js +231 -0
- package/dist/cjs/compiled/FeedbackAcknowledgement.js +15 -0
- package/dist/cjs/compiled/FeedbackScoreButtons.compiled.css +10 -0
- package/dist/cjs/compiled/FeedbackScoreButtons.js +64 -0
- package/dist/cjs/compiled/SignUpPrompt.compiled.css +4 -0
- package/dist/cjs/compiled/SignUpPrompt.js +80 -0
- package/dist/cjs/compiled/SignUpSuccess.js +22 -0
- package/dist/cjs/compiled/SuccessContainer.compiled.css +4 -0
- package/dist/cjs/compiled/SuccessContainer.js +32 -0
- package/dist/cjs/compiled/SurveyContainer.compiled.css +11 -0
- package/dist/cjs/compiled/SurveyContainer.js +39 -0
- package/dist/cjs/compiled/SurveyForm.compiled.css +2 -0
- package/dist/cjs/compiled/SurveyForm.js +141 -0
- package/dist/cjs/compiled/SurveyMarshal.compiled.css +4 -0
- package/dist/cjs/compiled/SurveyMarshal.js +63 -0
- package/dist/cjs/compiled/useEscapeToDismiss.js +71 -0
- package/dist/cjs/fg-components.js +27 -0
- package/dist/cjs/index.js +4 -8
- package/dist/es2019/compiled/ContextualSurvey.js +176 -0
- package/dist/es2019/compiled/FeedbackAcknowledgement.js +6 -0
- package/dist/es2019/compiled/FeedbackScoreButtons.compiled.css +10 -0
- package/dist/es2019/compiled/FeedbackScoreButtons.js +51 -0
- package/dist/es2019/compiled/SignUpPrompt.compiled.css +4 -0
- package/dist/es2019/compiled/SignUpPrompt.js +47 -0
- package/dist/es2019/compiled/SignUpSuccess.js +11 -0
- package/dist/es2019/compiled/SuccessContainer.compiled.css +4 -0
- package/dist/es2019/compiled/SuccessContainer.js +21 -0
- package/dist/es2019/compiled/SurveyContainer.compiled.css +11 -0
- package/dist/es2019/compiled/SurveyContainer.js +26 -0
- package/dist/es2019/compiled/SurveyForm.compiled.css +2 -0
- package/dist/es2019/compiled/SurveyForm.js +119 -0
- package/dist/es2019/compiled/SurveyMarshal.compiled.css +4 -0
- package/dist/es2019/compiled/SurveyMarshal.js +56 -0
- package/dist/es2019/compiled/useEscapeToDismiss.js +65 -0
- package/dist/es2019/fg-components.js +13 -0
- package/dist/es2019/index.js +3 -2
- package/dist/esm/compiled/ContextualSurvey.js +221 -0
- package/dist/esm/compiled/FeedbackAcknowledgement.js +8 -0
- package/dist/esm/compiled/FeedbackScoreButtons.compiled.css +10 -0
- package/dist/esm/compiled/FeedbackScoreButtons.js +54 -0
- package/dist/esm/compiled/SignUpPrompt.compiled.css +4 -0
- package/dist/esm/compiled/SignUpPrompt.js +70 -0
- package/dist/esm/compiled/SignUpSuccess.js +15 -0
- package/dist/esm/compiled/SuccessContainer.compiled.css +4 -0
- package/dist/esm/compiled/SuccessContainer.js +22 -0
- package/dist/esm/compiled/SurveyContainer.compiled.css +11 -0
- package/dist/esm/compiled/SurveyContainer.js +29 -0
- package/dist/esm/compiled/SurveyForm.compiled.css +2 -0
- package/dist/esm/compiled/SurveyForm.js +131 -0
- package/dist/esm/compiled/SurveyMarshal.compiled.css +4 -0
- package/dist/esm/compiled/SurveyMarshal.js +54 -0
- package/dist/esm/compiled/useEscapeToDismiss.js +64 -0
- package/dist/esm/fg-components.js +19 -0
- package/dist/esm/index.js +3 -2
- package/dist/types/compiled/ContextualSurvey.d.ts +40 -0
- package/dist/types/compiled/FeedbackAcknowledgement.d.ts +3 -0
- package/dist/types/compiled/FeedbackScoreButtons.d.ts +11 -0
- package/dist/types/compiled/SignUpPrompt.d.ts +10 -0
- package/dist/types/compiled/SignUpSuccess.d.ts +5 -0
- package/dist/types/compiled/SuccessContainer.d.ts +6 -0
- package/dist/types/compiled/SurveyContainer.d.ts +11 -0
- package/dist/types/compiled/SurveyForm.d.ts +12 -0
- package/dist/types/compiled/SurveyMarshal.d.ts +16 -0
- package/dist/types/compiled/useEscapeToDismiss.d.ts +6 -0
- package/dist/types/components/ContextualSurvey.d.ts +1 -1
- package/dist/types/components/SurveyMarshal.d.ts +1 -2
- package/dist/types/fg-components.d.ts +5 -0
- package/dist/types/index.d.ts +3 -3
- package/dist/types-ts4.5/compiled/ContextualSurvey.d.ts +40 -0
- package/dist/types-ts4.5/compiled/FeedbackAcknowledgement.d.ts +3 -0
- package/dist/types-ts4.5/compiled/FeedbackScoreButtons.d.ts +11 -0
- package/dist/types-ts4.5/compiled/SignUpPrompt.d.ts +10 -0
- package/dist/types-ts4.5/compiled/SignUpSuccess.d.ts +5 -0
- package/dist/types-ts4.5/compiled/SuccessContainer.d.ts +6 -0
- package/dist/types-ts4.5/compiled/SurveyContainer.d.ts +11 -0
- package/dist/types-ts4.5/compiled/SurveyForm.d.ts +12 -0
- package/dist/types-ts4.5/compiled/SurveyMarshal.d.ts +16 -0
- package/dist/types-ts4.5/compiled/useEscapeToDismiss.d.ts +6 -0
- package/dist/types-ts4.5/components/ContextualSurvey.d.ts +1 -1
- package/dist/types-ts4.5/components/SurveyMarshal.d.ts +1 -2
- package/dist/types-ts4.5/fg-components.d.ts +5 -0
- package/dist/types-ts4.5/index.d.ts +3 -3
- package/package.json +12 -4
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/* SignUpPrompt.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
+
import "./SignUpPrompt.compiled.css";
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
7
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
|
+
import { useCallback, useState } from 'react';
|
|
9
|
+
import Button from '@atlaskit/button/new';
|
|
10
|
+
import Heading from '@atlaskit/heading';
|
|
11
|
+
import Link from '@atlaskit/link';
|
|
12
|
+
import { Box, Stack, Text } from '@atlaskit/primitives/compiled';
|
|
13
|
+
import SuccessContainer from './SuccessContainer';
|
|
14
|
+
var buttonContainerStyles = null;
|
|
15
|
+
export default (function (_ref) {
|
|
16
|
+
var onAnswer = _ref.onAnswer;
|
|
17
|
+
var _useState = useState(null),
|
|
18
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
19
|
+
pending = _useState2[0],
|
|
20
|
+
setPending = _useState2[1];
|
|
21
|
+
var answeredWith = useCallback( /*#__PURE__*/function () {
|
|
22
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(answer) {
|
|
23
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
24
|
+
while (1) switch (_context.prev = _context.next) {
|
|
25
|
+
case 0:
|
|
26
|
+
setPending(answer ? 'yes' : 'no');
|
|
27
|
+
_context.next = 3;
|
|
28
|
+
return onAnswer(answer);
|
|
29
|
+
case 3:
|
|
30
|
+
case "end":
|
|
31
|
+
return _context.stop();
|
|
32
|
+
}
|
|
33
|
+
}, _callee);
|
|
34
|
+
}));
|
|
35
|
+
return function (_x) {
|
|
36
|
+
return _ref2.apply(this, arguments);
|
|
37
|
+
};
|
|
38
|
+
}(), [setPending, onAnswer]);
|
|
39
|
+
var isDisabled = Boolean(pending);
|
|
40
|
+
return /*#__PURE__*/React.createElement(SuccessContainer, null, /*#__PURE__*/React.createElement(Heading, {
|
|
41
|
+
size: "xsmall"
|
|
42
|
+
}, "Thanks for your feedback"), /*#__PURE__*/React.createElement(Box, {
|
|
43
|
+
paddingBlockStart: "space.150"
|
|
44
|
+
}, /*#__PURE__*/React.createElement(Stack, {
|
|
45
|
+
space: "space.150"
|
|
46
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
47
|
+
as: "p"
|
|
48
|
+
}, "Are you interested in participating in our research?"), /*#__PURE__*/React.createElement(Text, {
|
|
49
|
+
as: "p"
|
|
50
|
+
}, "Sign up for the", ' ', /*#__PURE__*/React.createElement(Link, {
|
|
51
|
+
href: "https://www.atlassian.com/research-group",
|
|
52
|
+
target: "_blank"
|
|
53
|
+
}, "Atlassian Research Group"), " and we may contact you in the future with research opportunities."))), /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
className: ax(["_19pkxy5q _1e0c1txw _1bahesu3 _pof3u2gc"])
|
|
55
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
56
|
+
appearance: "subtle",
|
|
57
|
+
onClick: function onClick() {
|
|
58
|
+
return answeredWith(false);
|
|
59
|
+
},
|
|
60
|
+
isDisabled: isDisabled,
|
|
61
|
+
isLoading: pending === 'no'
|
|
62
|
+
}, "No, thanks"), /*#__PURE__*/React.createElement(Button, {
|
|
63
|
+
appearance: "primary",
|
|
64
|
+
onClick: function onClick() {
|
|
65
|
+
return answeredWith(true);
|
|
66
|
+
},
|
|
67
|
+
isDisabled: isDisabled,
|
|
68
|
+
isLoading: pending === 'yes'
|
|
69
|
+
}, "Yes, sign me up")));
|
|
70
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import _objectDestructuringEmpty from "@babel/runtime/helpers/objectDestructuringEmpty";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Heading from '@atlaskit/heading';
|
|
4
|
+
import { Stack, Text } from '@atlaskit/primitives/compiled';
|
|
5
|
+
import SuccessContainer from './SuccessContainer';
|
|
6
|
+
export default (function (_ref) {
|
|
7
|
+
_objectDestructuringEmpty(_ref);
|
|
8
|
+
return /*#__PURE__*/React.createElement(SuccessContainer, null, /*#__PURE__*/React.createElement(Stack, {
|
|
9
|
+
space: "space.150"
|
|
10
|
+
}, /*#__PURE__*/React.createElement(Heading, {
|
|
11
|
+
size: "xsmall"
|
|
12
|
+
}, "Thanks for signing up"), /*#__PURE__*/React.createElement(Text, {
|
|
13
|
+
as: "p"
|
|
14
|
+
}, "We may reach out to you in the future to participate in additional research.")));
|
|
15
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* SuccessContainer.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import "./SuccessContainer.compiled.css";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
import CheckCircleIcon from '@atlaskit/icon/core/migration/success--check-circle';
|
|
6
|
+
import { G300 } from '@atlaskit/theme/colors';
|
|
7
|
+
var sectionStyles = null;
|
|
8
|
+
var iconContainerStyles = null;
|
|
9
|
+
export default (function (_ref) {
|
|
10
|
+
var children = _ref.children;
|
|
11
|
+
return /*#__PURE__*/React.createElement("section", {
|
|
12
|
+
className: ax(["_18u01jfw"])
|
|
13
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
14
|
+
className: ax(["_kqswstnw _154iv47k _1ltv1ejb"])
|
|
15
|
+
}, /*#__PURE__*/React.createElement(CheckCircleIcon, {
|
|
16
|
+
spacing: "spacious",
|
|
17
|
+
label: "",
|
|
18
|
+
"aria-hidden": true,
|
|
19
|
+
color: "var(--ds-icon-success, ".concat(G300, ")"),
|
|
20
|
+
LEGACY_margin: "4px 0 0 0"
|
|
21
|
+
})), children);
|
|
22
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
._2rko1sit{border-radius:var(--ds-border-radius,3px)}._154ipxbi{top:var(--ds-space-200,1pc)}
|
|
3
|
+
._16qs1dt4{box-shadow:var(--_qzf6oc)}
|
|
4
|
+
._19bv1ejb{padding-left:var(--ds-space-300,24px)}
|
|
5
|
+
._1bsb1sw3{width:var(--_18gm6wc)}
|
|
6
|
+
._1xi2pxbi{right:var(--ds-space-200,1pc)}
|
|
7
|
+
._bfhk13b4{background-color:var(--_1f6rtr1)}
|
|
8
|
+
._ca0q1ejb{padding-top:var(--ds-space-300,24px)}
|
|
9
|
+
._kqswstnw{position:absolute}
|
|
10
|
+
._n3td1ejb{padding-bottom:var(--ds-space-300,24px)}
|
|
11
|
+
._u5f31ejb{padding-right:var(--ds-space-300,24px)}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* SurveyContainer.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import "./SurveyContainer.compiled.css";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
import { IconButton as Button } from '@atlaskit/button/new';
|
|
6
|
+
import CrossIcon from '@atlaskit/icon/core/migration/close--cross';
|
|
7
|
+
import { N0, N50A, N60A } from '@atlaskit/theme/colors';
|
|
8
|
+
import { surveyInnerWidth } from '../constants';
|
|
9
|
+
var containerStyles = null;
|
|
10
|
+
var buttonWrapperStyles = null;
|
|
11
|
+
export default (function (_ref) {
|
|
12
|
+
var children = _ref.children,
|
|
13
|
+
onDismiss = _ref.onDismiss;
|
|
14
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
15
|
+
className: ax(["_2rko1sit _bfhk13b4 _ca0q1ejb _u5f31ejb _n3td1ejb _19bv1ejb _16qs1dt4 _1bsb1sw3"]),
|
|
16
|
+
style: {
|
|
17
|
+
"--_1f6rtr1": ix("var(--ds-surface-overlay, ".concat(N0, ")")),
|
|
18
|
+
"--_qzf6oc": ix("var(--ds-shadow-overlay, ".concat("0 20px 32px -8px ".concat(N50A, ", 0 0 1px ").concat(N60A), ")")),
|
|
19
|
+
"--_18gm6wc": ix("".concat(surveyInnerWidth, "px"))
|
|
20
|
+
}
|
|
21
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
22
|
+
className: ax(["_kqswstnw _154ipxbi _1xi2pxbi"])
|
|
23
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
24
|
+
icon: CrossIcon,
|
|
25
|
+
label: "Dismiss",
|
|
26
|
+
appearance: "subtle",
|
|
27
|
+
onClick: onDismiss
|
|
28
|
+
})), children);
|
|
29
|
+
});
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/* SurveyForm.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
+
import "./SurveyForm.compiled.css";
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
7
|
+
import { useCallback, useRef, useState } from 'react';
|
|
8
|
+
import { Transition } from 'react-transition-group';
|
|
9
|
+
import Button from '@atlaskit/button/new';
|
|
10
|
+
import { Checkbox } from '@atlaskit/checkbox';
|
|
11
|
+
import Form, { CheckboxField, Field, FormFooter } from '@atlaskit/form';
|
|
12
|
+
import Heading from '@atlaskit/heading';
|
|
13
|
+
import { Stack, Text } from '@atlaskit/primitives/compiled';
|
|
14
|
+
import Textarea from '@atlaskit/textarea';
|
|
15
|
+
import FeedbackScoreButtons from './FeedbackScoreButtons';
|
|
16
|
+
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
|
+
var transitionDuration = 200;
|
|
32
|
+
export default (function (_ref) {
|
|
33
|
+
var question = _ref.question,
|
|
34
|
+
statement = _ref.statement,
|
|
35
|
+
textPlaceholder = _ref.textPlaceholder,
|
|
36
|
+
textLabel = _ref.textLabel,
|
|
37
|
+
onSubmit = _ref.onSubmit;
|
|
38
|
+
var _useState = useState(false),
|
|
39
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
40
|
+
expanded = _useState2[0],
|
|
41
|
+
setExpanded = _useState2[1];
|
|
42
|
+
var _useState3 = useState(false),
|
|
43
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
44
|
+
canContactDefault = _useState4[0],
|
|
45
|
+
setCanContactDefault = _useState4[1];
|
|
46
|
+
var hasAutoFilledCanContactRef = useRef(false);
|
|
47
|
+
var expandedAreaRef = useRef(null);
|
|
48
|
+
var onScoreSelect = useCallback(function () {
|
|
49
|
+
setExpanded(true);
|
|
50
|
+
}, [setExpanded]);
|
|
51
|
+
|
|
52
|
+
// On the first type the user types some feedback we auto select
|
|
53
|
+
// the option for allowing feedback. This automatic selection only
|
|
54
|
+
// happens once. After that it is up to the user to control
|
|
55
|
+
var onFeedbackChange = useCallback(function () {
|
|
56
|
+
if (hasAutoFilledCanContactRef.current) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
hasAutoFilledCanContactRef.current = true;
|
|
60
|
+
setCanContactDefault(true);
|
|
61
|
+
}, []);
|
|
62
|
+
return /*#__PURE__*/React.createElement("section", {
|
|
63
|
+
"aria-labelledby": "contextualSurveyQuestion"
|
|
64
|
+
}, /*#__PURE__*/React.createElement(Stack, {
|
|
65
|
+
space: "space.150"
|
|
66
|
+
}, /*#__PURE__*/React.createElement(Heading, {
|
|
67
|
+
id: "contextualSurveyQuestion",
|
|
68
|
+
size: "xsmall"
|
|
69
|
+
}, question), statement && /*#__PURE__*/React.createElement(Text, {
|
|
70
|
+
as: "p",
|
|
71
|
+
id: "contextualSurveyStatement"
|
|
72
|
+
}, statement)), /*#__PURE__*/React.createElement(Form, {
|
|
73
|
+
onSubmit: onSubmit
|
|
74
|
+
}, function (_ref2) {
|
|
75
|
+
var formProps = _ref2.formProps,
|
|
76
|
+
submitting = _ref2.submitting;
|
|
77
|
+
return /*#__PURE__*/React.createElement("form", formProps, /*#__PURE__*/React.createElement(Field, {
|
|
78
|
+
name: "feedbackScore",
|
|
79
|
+
isDisabled: submitting,
|
|
80
|
+
isRequired: true
|
|
81
|
+
}, function (_ref3) {
|
|
82
|
+
var fieldProps = _ref3.fieldProps;
|
|
83
|
+
return /*#__PURE__*/React.createElement(FeedbackScoreButtons, _extends({}, fieldProps, {
|
|
84
|
+
onChange: function onChange(score) {
|
|
85
|
+
fieldProps.onChange(score);
|
|
86
|
+
onScoreSelect();
|
|
87
|
+
}
|
|
88
|
+
}));
|
|
89
|
+
}), /*#__PURE__*/React.createElement(Transition, {
|
|
90
|
+
in: expanded,
|
|
91
|
+
timeout: transitionDuration,
|
|
92
|
+
mountOnEnter: true
|
|
93
|
+
}, function (state) {
|
|
94
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
95
|
+
style: {
|
|
96
|
+
transition: "max-height ".concat(transitionDuration, "ms ease-in-out"),
|
|
97
|
+
maxHeight: getExpandedHeight(expandedAreaRef, state)
|
|
98
|
+
},
|
|
99
|
+
ref: expandedAreaRef,
|
|
100
|
+
className: ax(["_1reo15vq _18m915vq"])
|
|
101
|
+
}, /*#__PURE__*/React.createElement(Field, {
|
|
102
|
+
name: "writtenFeedback",
|
|
103
|
+
defaultValue: "",
|
|
104
|
+
isDisabled: submitting
|
|
105
|
+
}, function (_ref4) {
|
|
106
|
+
var fieldProps = _ref4.fieldProps;
|
|
107
|
+
return /*#__PURE__*/React.createElement(Textarea, _extends({}, fieldProps, {
|
|
108
|
+
"aria-label": textLabel,
|
|
109
|
+
placeholder: textPlaceholder,
|
|
110
|
+
onChange: function onChange(event) {
|
|
111
|
+
fieldProps.onChange(event);
|
|
112
|
+
onFeedbackChange();
|
|
113
|
+
}
|
|
114
|
+
}));
|
|
115
|
+
}), /*#__PURE__*/React.createElement(CheckboxField, {
|
|
116
|
+
name: "canContact",
|
|
117
|
+
isDisabled: submitting,
|
|
118
|
+
defaultIsChecked: canContactDefault
|
|
119
|
+
}, function (_ref5) {
|
|
120
|
+
var fieldProps = _ref5.fieldProps;
|
|
121
|
+
return /*#__PURE__*/React.createElement(Checkbox, _extends({}, fieldProps, {
|
|
122
|
+
label: "Atlassian can contact me about this feedback"
|
|
123
|
+
}));
|
|
124
|
+
}), /*#__PURE__*/React.createElement(FormFooter, null, /*#__PURE__*/React.createElement(Button, {
|
|
125
|
+
type: "submit",
|
|
126
|
+
appearance: "primary",
|
|
127
|
+
isLoading: submitting
|
|
128
|
+
}, "Submit")));
|
|
129
|
+
}));
|
|
130
|
+
}));
|
|
131
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/* SurveyMarshal.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import "./SurveyMarshal.compiled.css";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
import { Transition } from 'react-transition-group';
|
|
6
|
+
import { layers } from '@atlaskit/theme/constants';
|
|
7
|
+
import { surveyInnerWidth, surveyOffset } from '../constants';
|
|
8
|
+
var animationDuration = 300;
|
|
9
|
+
var offscreen = {
|
|
10
|
+
translateX: "".concat(surveyInnerWidth + surveyOffset, "px"),
|
|
11
|
+
opacity: '0'
|
|
12
|
+
};
|
|
13
|
+
var getAnimationProps = function getAnimationProps(state) {
|
|
14
|
+
switch (state) {
|
|
15
|
+
case 'entered':
|
|
16
|
+
{
|
|
17
|
+
return {
|
|
18
|
+
translateX: '0',
|
|
19
|
+
opacity: '1'
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
case 'entering':
|
|
23
|
+
case 'unmounted':
|
|
24
|
+
case 'exited':
|
|
25
|
+
case 'exiting':
|
|
26
|
+
{
|
|
27
|
+
return offscreen;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
var transitionBaseStyles = null;
|
|
32
|
+
export default function SurveyMarshal(props) {
|
|
33
|
+
var children = props.children,
|
|
34
|
+
shouldShow = props.shouldShow;
|
|
35
|
+
return /*#__PURE__*/React.createElement(Transition, {
|
|
36
|
+
in: shouldShow,
|
|
37
|
+
timeout: animationDuration,
|
|
38
|
+
unmountOnExit: true
|
|
39
|
+
}, function (state) {
|
|
40
|
+
var _getAnimationProps = getAnimationProps(state),
|
|
41
|
+
translateX = _getAnimationProps.translateX,
|
|
42
|
+
opacity = _getAnimationProps.opacity;
|
|
43
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
44
|
+
className: ax(["_kqsw1n9t _1xi28err _94n58err _k8m01rjc"]),
|
|
45
|
+
style: {
|
|
46
|
+
opacity: opacity,
|
|
47
|
+
transition: "all ".concat(animationDuration, "ms ease-in-out"),
|
|
48
|
+
zIndex: layers.flag(),
|
|
49
|
+
transform: "translateX(".concat(translateX, ")"),
|
|
50
|
+
"--_1hx5ohh": ix("".concat(surveyOffset, "px"))
|
|
51
|
+
}
|
|
52
|
+
}, children());
|
|
53
|
+
});
|
|
54
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
export var escape = 27;
|
|
3
|
+
function bind(target, eventName, handler, options) {
|
|
4
|
+
target.addEventListener(eventName, handler, options);
|
|
5
|
+
return function unbind() {
|
|
6
|
+
target.removeEventListener(eventName, handler, options);
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
function shouldDismiss(target) {
|
|
10
|
+
if (!target) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
if (!(target instanceof HTMLElement)) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Closest doesn't exist for ie11
|
|
18
|
+
// Because we cannot be sure if in a text area - just don't allow dismissing
|
|
19
|
+
if (!target.closest) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
var inTextArea = Boolean(target.closest('textarea'));
|
|
23
|
+
|
|
24
|
+
// Allow dismissing if not in a textarea
|
|
25
|
+
return !inTextArea;
|
|
26
|
+
}
|
|
27
|
+
export default function useEscapeToDismiss(_ref) {
|
|
28
|
+
var onDismiss = _ref.onDismiss;
|
|
29
|
+
var onDismissRef = useRef(onDismiss);
|
|
30
|
+
|
|
31
|
+
// Defensively accounting for consumer passing in a new function
|
|
32
|
+
// each time. We just want to call the latest one
|
|
33
|
+
useEffect(function () {
|
|
34
|
+
onDismissRef.current = onDismiss;
|
|
35
|
+
}, [onDismiss]);
|
|
36
|
+
useEffect(function () {
|
|
37
|
+
var unbind;
|
|
38
|
+
function onKeyDown(event) {
|
|
39
|
+
if (event.keyCode !== escape) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Escape pressed
|
|
44
|
+
|
|
45
|
+
// We don't want to close if the user is typing in the text area
|
|
46
|
+
if (!shouldDismiss(event.target)) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (unbind) {
|
|
50
|
+
// only want to call dismiss once
|
|
51
|
+
unbind();
|
|
52
|
+
}
|
|
53
|
+
onDismissRef.current();
|
|
54
|
+
}
|
|
55
|
+
unbind = bind(window, 'keydown',
|
|
56
|
+
// @ts-ignore: the typescript for this is lame
|
|
57
|
+
onKeyDown, {
|
|
58
|
+
passive: true
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// double calls to unbind is fine
|
|
62
|
+
return unbind;
|
|
63
|
+
}, []);
|
|
64
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
import { default as CompiledContextualSurvey } from './compiled/ContextualSurvey';
|
|
4
|
+
import { default as CompiledSurveyMarshal } from './compiled/SurveyMarshal';
|
|
5
|
+
// exported props for FG check
|
|
6
|
+
import { default as EmotionContextualSurvey } from './components/ContextualSurvey';
|
|
7
|
+
import { default as EmotionSurveyMarshal } from './components/SurveyMarshal';
|
|
8
|
+
export var ContextualSurvey = function ContextualSurvey(props) {
|
|
9
|
+
return (
|
|
10
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
11
|
+
fg('platform_contextual_survey_enable_compiled_fg') ? /*#__PURE__*/React.createElement(CompiledContextualSurvey, props) : /*#__PURE__*/React.createElement(EmotionContextualSurvey, props)
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
export var SurveyMarshal = function SurveyMarshal(props) {
|
|
15
|
+
return (
|
|
16
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
17
|
+
fg('platform_contextual_survey_enable_compiled_fg') ? /*#__PURE__*/React.createElement(CompiledSurveyMarshal, props) : /*#__PURE__*/React.createElement(EmotionSurveyMarshal, props)
|
|
18
|
+
);
|
|
19
|
+
};
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { DismissTrigger } from './components/ContextualSurvey';
|
|
2
|
+
export { ContextualSurvey } from './fg-components';
|
|
3
|
+
export { SurveyMarshal } from './fg-components';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type FormValues } from '../types';
|
|
3
|
+
export declare enum DismissTrigger {
|
|
4
|
+
AutoDismiss = "AUTO_DISMISS",
|
|
5
|
+
Manual = "MANUAL",
|
|
6
|
+
Finished = "FINISHED",
|
|
7
|
+
Unmount = "UNMOUNT"
|
|
8
|
+
}
|
|
9
|
+
export type OnDismissArgs = {
|
|
10
|
+
trigger: DismissTrigger;
|
|
11
|
+
};
|
|
12
|
+
interface Props {
|
|
13
|
+
/** Optional statement, to be used in conjunction with the question for the survey
|
|
14
|
+
* Example: "How strongly do you agree or disagree with this statement"
|
|
15
|
+
*/
|
|
16
|
+
statement?: string;
|
|
17
|
+
/** Question used for the survey
|
|
18
|
+
* Example: "It is easy to find what I am looking for in Jira"
|
|
19
|
+
*/
|
|
20
|
+
question: string;
|
|
21
|
+
/** Accessible label text for the survey text area */
|
|
22
|
+
textLabel?: string;
|
|
23
|
+
/** Text placeholder for the survey text area
|
|
24
|
+
* Example: "Tell us why"
|
|
25
|
+
*/
|
|
26
|
+
textPlaceholder?: string;
|
|
27
|
+
/** Callback that is triggered when the survey should be dismissed */
|
|
28
|
+
onDismiss: (args: OnDismissArgs) => void;
|
|
29
|
+
/** Gets whether user has already signed up to the Atlassian Research Group list.
|
|
30
|
+
* If `true` is returned then the user will not be prompted to sign up to the Research Group.
|
|
31
|
+
*/
|
|
32
|
+
getUserHasAnsweredMailingList: () => Promise<boolean>;
|
|
33
|
+
/** Callback that is triggered when the survey is submitted, it will get the survey data as a parameter */
|
|
34
|
+
onSubmit: (formValues: FormValues) => Promise<void>;
|
|
35
|
+
/** Callback that is triggered when the user clicks 'Yes' or 'No' to sign up to the Atlassian Research Group */
|
|
36
|
+
onMailingListAnswer: (answer: boolean) => Promise<void>;
|
|
37
|
+
}
|
|
38
|
+
export declare const AUTO_DISAPPEAR_DURATION: number;
|
|
39
|
+
declare const _default: ({ question, statement, onDismiss, onSubmit, onMailingListAnswer, getUserHasAnsweredMailingList, textLabel, textPlaceholder, }: Props) => React.JSX.Element;
|
|
40
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
/// <reference types="react" />
|
|
6
|
+
interface Props {
|
|
7
|
+
onChange: (value: number) => void;
|
|
8
|
+
value: number | undefined;
|
|
9
|
+
}
|
|
10
|
+
declare const _default: ({ onChange, value }: Props) => JSX.Element;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
/// <reference types="react" />
|
|
6
|
+
interface Props {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
onDismiss: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare const _default: ({ children, onDismiss }: Props) => JSX.Element;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type OnSubmitHandler } from '@atlaskit/form';
|
|
3
|
+
import { type FormValues } from '../types';
|
|
4
|
+
interface Props {
|
|
5
|
+
question: string;
|
|
6
|
+
statement?: string;
|
|
7
|
+
textPlaceholder: string;
|
|
8
|
+
textLabel: string;
|
|
9
|
+
onSubmit: OnSubmitHandler<FormValues>;
|
|
10
|
+
}
|
|
11
|
+
declare const _default: ({ question, statement, textPlaceholder, textLabel, onSubmit }: Props) => JSX.Element;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import { type ReactNode } from 'react';
|
|
6
|
+
type Props = {
|
|
7
|
+
/** Whether the form should be rendered */
|
|
8
|
+
shouldShow: boolean;
|
|
9
|
+
/** A function that returns Node to be rendered (`<ContextualSurvey/>`)
|
|
10
|
+
* Using a function as child so that the child node does
|
|
11
|
+
* not need to be evaluated if it is not mounted
|
|
12
|
+
*/
|
|
13
|
+
children: () => ReactNode;
|
|
14
|
+
};
|
|
15
|
+
export default function SurveyMarshal(props: Props): JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -9,7 +9,7 @@ export declare enum DismissTrigger {
|
|
|
9
9
|
export type OnDismissArgs = {
|
|
10
10
|
trigger: DismissTrigger;
|
|
11
11
|
};
|
|
12
|
-
interface Props {
|
|
12
|
+
export interface Props {
|
|
13
13
|
/** Optional statement, to be used in conjunction with the question for the survey
|
|
14
14
|
* Example: "How strongly do you agree or disagree with this statement"
|
|
15
15
|
*/
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { type ReactNode } from 'react';
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
7
|
-
type Props = {
|
|
7
|
+
export type Props = {
|
|
8
8
|
/** Whether the form should be rendered */
|
|
9
9
|
shouldShow: boolean;
|
|
10
10
|
/** A function that returns Node to be rendered (`<ContextualSurvey/>`)
|
|
@@ -14,4 +14,3 @@ type Props = {
|
|
|
14
14
|
children: () => ReactNode;
|
|
15
15
|
};
|
|
16
16
|
export default function SurveyMarshal(props: Props): jsx.JSX.Element;
|
|
17
|
-
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type Props as ContextualSurveyProps } from './components/ContextualSurvey';
|
|
3
|
+
import { type Props as SurveyMarshalProps } from './components/SurveyMarshal';
|
|
4
|
+
export declare const ContextualSurvey: (props: ContextualSurveyProps) => React.JSX.Element;
|
|
5
|
+
export declare const SurveyMarshal: (props: SurveyMarshalProps) => React.JSX.Element;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export
|
|
3
|
-
export {
|
|
1
|
+
export { DismissTrigger, type OnDismissArgs } from './components/ContextualSurvey';
|
|
2
|
+
export { ContextualSurvey } from './fg-components';
|
|
3
|
+
export { SurveyMarshal } from './fg-components';
|