@sap-ux/ui-prompting 0.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/LICENSE +201 -0
- package/README.md +20 -0
- package/dist/components/Inputs/Input/Input.d.ts +10 -0
- package/dist/components/Inputs/Input/Input.d.ts.map +1 -0
- package/dist/components/Inputs/Input/Input.js +21 -0
- package/dist/components/Inputs/Input/Input.js.map +1 -0
- package/dist/components/Inputs/Input/index.d.ts +2 -0
- package/dist/components/Inputs/Input/index.d.ts.map +1 -0
- package/dist/components/Inputs/Input/index.js +18 -0
- package/dist/components/Inputs/Input/index.js.map +1 -0
- package/dist/components/Inputs/MultiSelect/MultiSelect.d.ts +12 -0
- package/dist/components/Inputs/MultiSelect/MultiSelect.d.ts.map +1 -0
- package/dist/components/Inputs/MultiSelect/MultiSelect.js +30 -0
- package/dist/components/Inputs/MultiSelect/MultiSelect.js.map +1 -0
- package/dist/components/Inputs/MultiSelect/index.d.ts +2 -0
- package/dist/components/Inputs/MultiSelect/index.d.ts.map +1 -0
- package/dist/components/Inputs/MultiSelect/index.js +18 -0
- package/dist/components/Inputs/MultiSelect/index.js.map +1 -0
- package/dist/components/Inputs/Select/Select.d.ts +12 -0
- package/dist/components/Inputs/Select/Select.d.ts.map +1 -0
- package/dist/components/Inputs/Select/Select.js +46 -0
- package/dist/components/Inputs/Select/Select.js.map +1 -0
- package/dist/components/Inputs/Select/index.d.ts +2 -0
- package/dist/components/Inputs/Select/index.d.ts.map +1 -0
- package/dist/components/Inputs/Select/index.js +18 -0
- package/dist/components/Inputs/Select/index.js.map +1 -0
- package/dist/components/Inputs/index.d.ts +4 -0
- package/dist/components/Inputs/index.d.ts.map +1 -0
- package/dist/components/Inputs/index.js +20 -0
- package/dist/components/Inputs/index.js.map +1 -0
- package/dist/components/Question/Question.d.ts +15 -0
- package/dist/components/Question/Question.d.ts.map +1 -0
- package/dist/components/Question/Question.js +49 -0
- package/dist/components/Question/Question.js.map +1 -0
- package/dist/components/Question/Question.scss +47 -0
- package/dist/components/Question/index.d.ts +2 -0
- package/dist/components/Question/index.d.ts.map +1 -0
- package/dist/components/Question/index.js +18 -0
- package/dist/components/Question/index.js.map +1 -0
- package/dist/components/QuestionGroup/QuestionGroup.d.ts +11 -0
- package/dist/components/QuestionGroup/QuestionGroup.d.ts.map +1 -0
- package/dist/components/QuestionGroup/QuestionGroup.js +22 -0
- package/dist/components/QuestionGroup/QuestionGroup.js.map +1 -0
- package/dist/components/QuestionGroup/QuestionGroup.scss +31 -0
- package/dist/components/QuestionGroup/index.d.ts +2 -0
- package/dist/components/QuestionGroup/index.d.ts.map +1 -0
- package/dist/components/QuestionGroup/index.js +18 -0
- package/dist/components/QuestionGroup/index.js.map +1 -0
- package/dist/components/Questions/Questions.d.ts +19 -0
- package/dist/components/Questions/Questions.d.ts.map +1 -0
- package/dist/components/Questions/Questions.js +107 -0
- package/dist/components/Questions/Questions.js.map +1 -0
- package/dist/components/Questions/Questions.scss +23 -0
- package/dist/components/Questions/index.d.ts +2 -0
- package/dist/components/Questions/index.d.ts.map +1 -0
- package/dist/components/Questions/index.js +18 -0
- package/dist/components/Questions/index.js.map +1 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +20 -0
- package/dist/components/index.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +115 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/dist/utilities/hooks.d.ts +61 -0
- package/dist/utilities/hooks.d.ts.map +1 -0
- package/dist/utilities/hooks.js +210 -0
- package/dist/utilities/hooks.js.map +1 -0
- package/dist/utilities/index.d.ts +4 -0
- package/dist/utilities/index.d.ts.map +1 -0
- package/dist/utilities/index.js +20 -0
- package/dist/utilities/index.js.map +1 -0
- package/dist/utilities/renderUtils.d.ts +6 -0
- package/dist/utilities/renderUtils.d.ts.map +1 -0
- package/dist/utilities/renderUtils.js +23 -0
- package/dist/utilities/renderUtils.js.map +1 -0
- package/dist/utilities/utils.d.ts +63 -0
- package/dist/utilities/utils.d.ts.map +1 -0
- package/dist/utilities/utils.js +169 -0
- package/dist/utilities/utils.js.map +1 -0
- package/package.json +79 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
.prompt-entries-wrapper {
|
|
2
|
+
&-multi,
|
|
3
|
+
&-single {
|
|
4
|
+
.prompt-entry {
|
|
5
|
+
display: block;
|
|
6
|
+
margin-right: 14px;
|
|
7
|
+
margin-bottom: 10px;
|
|
8
|
+
position: relative;
|
|
9
|
+
|
|
10
|
+
label {
|
|
11
|
+
margin-top: 0 !important;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
&-multi {
|
|
16
|
+
input {
|
|
17
|
+
width: 260px;
|
|
18
|
+
}
|
|
19
|
+
label {
|
|
20
|
+
width: 244px;
|
|
21
|
+
white-space: nowrap;
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
}
|
|
24
|
+
select {
|
|
25
|
+
width: 260px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ms-ComboBox {
|
|
29
|
+
width: 262px;
|
|
30
|
+
|
|
31
|
+
input {
|
|
32
|
+
width: 234px;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.ms-TextField {
|
|
37
|
+
width: 262px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
[role='alert'] {
|
|
41
|
+
display: block;
|
|
42
|
+
width: auto;
|
|
43
|
+
white-space: nowrap;
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Question/index.tsx"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Question"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Question/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './QuestionGroup.scss';
|
|
3
|
+
export interface QuestionGroupProps {
|
|
4
|
+
id?: string;
|
|
5
|
+
title: string;
|
|
6
|
+
description?: string[];
|
|
7
|
+
showDescription?: boolean;
|
|
8
|
+
children?: JSX.Element[];
|
|
9
|
+
}
|
|
10
|
+
export declare const QuestionGroup: (props: QuestionGroupProps) => React.JSX.Element;
|
|
11
|
+
//# sourceMappingURL=QuestionGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuestionGroup.d.ts","sourceRoot":"","sources":["../../../src/components/QuestionGroup/QuestionGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,sBAAsB,CAAC;AAG9B,MAAM,WAAW,kBAAkB;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;CAC5B;AAED,eAAO,MAAM,aAAa,UAAW,kBAAkB,sBAkBtD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.QuestionGroup = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
require("./QuestionGroup.scss");
|
|
9
|
+
const react_markdown_1 = __importDefault(require("react-markdown"));
|
|
10
|
+
const QuestionGroup = (props) => {
|
|
11
|
+
const { title, description, showDescription, children, id } = props;
|
|
12
|
+
return (react_1.default.createElement("div", { id: id, className: "prompts-group" },
|
|
13
|
+
react_1.default.createElement("ul", { className: "prompts-group-title-list" },
|
|
14
|
+
react_1.default.createElement("div", { className: "prompts-group-title-container" },
|
|
15
|
+
react_1.default.createElement("li", { className: "prompts-group-title" }, title))),
|
|
16
|
+
showDescription &&
|
|
17
|
+
description?.map((descriptionParagraph) => (react_1.default.createElement("div", { className: "prompts-group-description", key: descriptionParagraph },
|
|
18
|
+
react_1.default.createElement(react_markdown_1.default, { key: descriptionParagraph }, descriptionParagraph)))),
|
|
19
|
+
react_1.default.createElement("div", { className: "prompt-entries-group" }, children)));
|
|
20
|
+
};
|
|
21
|
+
exports.QuestionGroup = QuestionGroup;
|
|
22
|
+
//# sourceMappingURL=QuestionGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuestionGroup.js","sourceRoot":"","sources":["../../../src/components/QuestionGroup/QuestionGroup.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,gCAA8B;AAC9B,oEAA2C;AAUpC,MAAM,aAAa,GAAG,CAAC,KAAyB,EAAE,EAAE;IACvD,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,KAAK,CAAC;IACpE,OAAO,CACH,uCAAK,EAAE,EAAE,EAAE,EAAE,SAAS,EAAC,eAAe;QAClC,sCAAI,SAAS,EAAC,0BAA0B;YACpC,uCAAK,SAAS,EAAC,+BAA+B;gBAC1C,sCAAI,SAAS,EAAC,qBAAqB,IAAE,KAAK,CAAM,CAC9C,CACL;QACJ,eAAe;YACZ,WAAW,EAAE,GAAG,CAAC,CAAC,oBAAoB,EAAE,EAAE,CAAC,CACvC,uCAAK,SAAS,EAAC,2BAA2B,EAAC,GAAG,EAAE,oBAAoB;gBAChE,8BAAC,wBAAa,IAAC,GAAG,EAAE,oBAAoB,IAAG,oBAAoB,CAAiB,CAC9E,CACT,CAAC;QACN,uCAAK,SAAS,EAAC,sBAAsB,IAAE,QAAQ,CAAO,CACpD,CACT,CAAC;AACN,CAAC,CAAC;AAlBW,QAAA,aAAa,iBAkBxB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.prompt-entries-group {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-flow: row wrap;
|
|
4
|
+
margin: 15px 0 15px 12px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.prompts-group-title-list {
|
|
8
|
+
padding-inline-start: 14px;
|
|
9
|
+
margin-block-start: 2px;
|
|
10
|
+
margin-block-end: 2px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.prompts-group-title-container {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: row;
|
|
16
|
+
vertical-align: middle;
|
|
17
|
+
margin-bottom: 12px;
|
|
18
|
+
margin-top: 8px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.prompts-group-title {
|
|
22
|
+
font-weight: bold;
|
|
23
|
+
text-indent: -1.5px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.prompts-group-description {
|
|
27
|
+
max-width: 800px;
|
|
28
|
+
margin-left: 25px;
|
|
29
|
+
white-space: pre-line;
|
|
30
|
+
margin-left: 12px;
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/QuestionGroup/index.tsx"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./QuestionGroup"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/QuestionGroup/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Answers } from 'inquirer';
|
|
3
|
+
import type { PromptQuestion, ValidationResults, PromptsGroup, AnswerValue, DynamicChoices } from '../../types';
|
|
4
|
+
import { PromptsLayoutType } from '../../types';
|
|
5
|
+
import './Questions.scss';
|
|
6
|
+
export interface QuestionsProps {
|
|
7
|
+
id?: string;
|
|
8
|
+
questions: PromptQuestion[];
|
|
9
|
+
answers?: Answers;
|
|
10
|
+
choices?: DynamicChoices;
|
|
11
|
+
validation?: ValidationResults;
|
|
12
|
+
onChoiceRequest?: (names: string[], answers: Answers) => void;
|
|
13
|
+
onChange?: (answers: Answers, name?: string, answer?: AnswerValue, dependantPromptNames?: string[]) => void;
|
|
14
|
+
layoutType?: PromptsLayoutType;
|
|
15
|
+
groups?: Array<PromptsGroup>;
|
|
16
|
+
showDescriptions?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare const Questions: (props: QuestionsProps) => React.JSX.Element;
|
|
19
|
+
//# sourceMappingURL=Questions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Questions.d.ts","sourceRoot":"","sources":["../../../src/components/Questions/Questions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAaxC,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAChH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,kBAAkB,CAAC;AAE1B,MAAM,WAAW,cAAc;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC9D,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,EAAE,oBAAoB,CAAC,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC5G,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,MAAM,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAC7B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAgBD,eAAO,MAAM,SAAS,UAAW,cAAc,sBA2G9C,CAAC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Questions = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const Question_1 = require("../Question/Question");
|
|
29
|
+
const utilities_1 = require("../../utilities");
|
|
30
|
+
const QuestionGroup_1 = require("../QuestionGroup");
|
|
31
|
+
require("./Questions.scss");
|
|
32
|
+
/**
|
|
33
|
+
* Method returns classes for question's component root DOM element.
|
|
34
|
+
*
|
|
35
|
+
* @param type - Layout type
|
|
36
|
+
* @returns Class names for component's root DOM element.
|
|
37
|
+
*/
|
|
38
|
+
const getComponentClasses = (type) => {
|
|
39
|
+
const classes = ['prompt-entries-wrapper'];
|
|
40
|
+
classes.push(type === "MultiColumn" /* PromptsLayoutType.MultiColumn */ ? 'prompt-entries-wrapper-multi' : 'prompt-entries-wrapper-single');
|
|
41
|
+
return classes.join(' ');
|
|
42
|
+
};
|
|
43
|
+
const Questions = (props) => {
|
|
44
|
+
const { id, groups = [], questions, onChoiceRequest, onChange, answers = {}, choices = {}, layoutType, showDescriptions, validation = {} } = props;
|
|
45
|
+
const componentId = (0, utilities_1.useId)(id);
|
|
46
|
+
const [localAnswers, setLocalAnswers] = (0, utilities_1.useAnswers)(questions, answers, (answers) => {
|
|
47
|
+
onChange?.(answers);
|
|
48
|
+
});
|
|
49
|
+
const [pendingRequests, setRequestedChoices] = (0, utilities_1.useRequestedChoices)({}, choices);
|
|
50
|
+
const requestChoices = (0, react_1.useCallback)((names, answers) => {
|
|
51
|
+
// Call external callback
|
|
52
|
+
if (names.length) {
|
|
53
|
+
onChoiceRequest?.(names, answers);
|
|
54
|
+
}
|
|
55
|
+
// Mark pending requests locally
|
|
56
|
+
setRequestedChoices(names);
|
|
57
|
+
}, [onChoiceRequest]);
|
|
58
|
+
// Request dynamic choices
|
|
59
|
+
(0, utilities_1.useDynamicQuestionsEffect)(() => {
|
|
60
|
+
const dynamicChoices = (0, utilities_1.getDynamicQuestions)(questions);
|
|
61
|
+
requestChoices(dynamicChoices, localAnswers);
|
|
62
|
+
}, questions);
|
|
63
|
+
// Change callback
|
|
64
|
+
const onAnswerChange = (0, react_1.useCallback)((name, answer) => {
|
|
65
|
+
const oldAnswer = (0, utilities_1.getAnswer)(localAnswers, name) || '';
|
|
66
|
+
if (oldAnswer !== answer) {
|
|
67
|
+
const updatedAnswers = (0, utilities_1.updateAnswers)(localAnswers, questions, name, answer);
|
|
68
|
+
setLocalAnswers(updatedAnswers);
|
|
69
|
+
// Callback with onchange
|
|
70
|
+
onChange?.(updatedAnswers, name, answer);
|
|
71
|
+
// Request dynamic choices for dependant questions
|
|
72
|
+
const deps = (0, utilities_1.getDependantQuestions)(questions, name);
|
|
73
|
+
if (deps.length) {
|
|
74
|
+
requestChoices(deps, updatedAnswers);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}, [localAnswers, onChange]);
|
|
78
|
+
const groupsWithQuestions = groups.map((group) => ({
|
|
79
|
+
...group,
|
|
80
|
+
questions: []
|
|
81
|
+
}));
|
|
82
|
+
if (layoutType === "MultiColumn" /* PromptsLayoutType.MultiColumn */ && groups?.length) {
|
|
83
|
+
questions.forEach((question) => {
|
|
84
|
+
const { guiOptions = {} } = question;
|
|
85
|
+
if (guiOptions.groupId) {
|
|
86
|
+
const foundGroup = groupsWithQuestions.find((g) => g.id === guiOptions.groupId);
|
|
87
|
+
if (foundGroup) {
|
|
88
|
+
foundGroup.questions.push(question);
|
|
89
|
+
groupsWithQuestions[groupsWithQuestions.indexOf(foundGroup)] = foundGroup;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
const renderQuestions = (questions) => questions.map((question, index) => {
|
|
95
|
+
const name = question.name;
|
|
96
|
+
const externalChoices = choices[name];
|
|
97
|
+
return (react_1.default.createElement(Question_1.Question, { id: `${componentId}--${question.name}`, key: `${name}-${index}`, question: question, validation: validation, answers: localAnswers, onChange: onAnswerChange, choices: externalChoices, pending: pendingRequests[name] }));
|
|
98
|
+
});
|
|
99
|
+
return (react_1.default.createElement("div", { id: componentId, className: getComponentClasses(layoutType) },
|
|
100
|
+
react_1.default.createElement("div", { className: "prompt-entries" }, layoutType === "MultiColumn" /* PromptsLayoutType.MultiColumn */ && groups?.length
|
|
101
|
+
? groupsWithQuestions.map((group) => {
|
|
102
|
+
return (react_1.default.createElement(QuestionGroup_1.QuestionGroup, { id: `${componentId}--${group.id}`, key: group.id, title: group.title, description: group.description, showDescription: showDescriptions }, renderQuestions(group.questions)));
|
|
103
|
+
})
|
|
104
|
+
: renderQuestions(questions))));
|
|
105
|
+
};
|
|
106
|
+
exports.Questions = Questions;
|
|
107
|
+
//# sourceMappingURL=Questions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Questions.js","sourceRoot":"","sources":["../../../src/components/Questions/Questions.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA2C;AAE3C,mDAAgD;AAChD,+CASyB;AACzB,oDAAiD;AAIjD,4BAA0B;AAe1B;;;;;GAKG;AACH,MAAM,mBAAmB,GAAG,CAAC,IAAwB,EAAU,EAAE;IAC7D,MAAM,OAAO,GAAG,CAAC,wBAAwB,CAAC,CAAC;IAC3C,OAAO,CAAC,IAAI,CACR,IAAI,sDAAkC,CAAC,CAAC,CAAC,8BAA8B,CAAC,CAAC,CAAC,+BAA+B,CAC5G,CAAC;IACF,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7B,CAAC,CAAC;AAEK,MAAM,SAAS,GAAG,CAAC,KAAqB,EAAE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AA3GW,QAAA,SAAS,aA2GpB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.prompt-entries-wrapper-multi {
|
|
2
|
+
margin: 0 5px 15px 0;
|
|
3
|
+
max-width: 900px;
|
|
4
|
+
|
|
5
|
+
.prompt-entries {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-flow: row wrap;
|
|
8
|
+
margin: 15px 0 15px 12px;
|
|
9
|
+
margin-block-start: 2px;
|
|
10
|
+
margin-block-end: 2px;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.input__label {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
> label {
|
|
18
|
+
flex: 1 1 auto;
|
|
19
|
+
white-space: nowrap;
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
text-overflow: ellipsis;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Questions/index.tsx"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Questions"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Questions/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.tsx"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Inputs"), exports);
|
|
18
|
+
__exportStar(require("./Question"), exports);
|
|
19
|
+
__exportStar(require("./Questions"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,6CAA2B;AAC3B,8CAA4B"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.getAnswer = exports.setAnswer = void 0;
|
|
18
|
+
__exportStar(require("./components"), exports);
|
|
19
|
+
__exportStar(require("./types"), exports);
|
|
20
|
+
var utils_1 = require("./utilities/utils");
|
|
21
|
+
Object.defineProperty(exports, "setAnswer", { enumerable: true, get: function () { return utils_1.setAnswer; } });
|
|
22
|
+
Object.defineProperty(exports, "getAnswer", { enumerable: true, get: function () { return utils_1.getAnswer; } });
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,0CAAwB;AACxB,2CAAyD;AAAhD,kGAAA,SAAS,OAAA;AAAE,kGAAA,SAAS,OAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { Answers, DistinctChoice } from 'inquirer';
|
|
2
|
+
import type { CheckBoxQuestion, InputQuestion, ListQuestion, GuiOptions as BaseGuiOptions } from '@sap-ux/inquirer-common';
|
|
3
|
+
export { Answers };
|
|
4
|
+
/**
|
|
5
|
+
* Extended GUI interface for question.
|
|
6
|
+
*/
|
|
7
|
+
export interface GuiOptions extends BaseGuiOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Group id for group visualisation.
|
|
10
|
+
*/
|
|
11
|
+
groupId?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Placeholder text.
|
|
14
|
+
*/
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Extended GUI interface for base list question - list and checkbox/multiselect.
|
|
19
|
+
*/
|
|
20
|
+
export interface BaseListGuiOptions extends GuiOptions {
|
|
21
|
+
/**
|
|
22
|
+
* Option population type.
|
|
23
|
+
* 'static' - options are provided within property 'choices'.
|
|
24
|
+
* 'dynamic' - options are provided dynamicly by request.
|
|
25
|
+
* Default value is "static".
|
|
26
|
+
*/
|
|
27
|
+
selectType?: 'static' | 'dynamic';
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Extended GUI interface for list question.
|
|
31
|
+
*/
|
|
32
|
+
export interface ListGuiOptions extends BaseListGuiOptions {
|
|
33
|
+
/**
|
|
34
|
+
* Dependant prompt names which should be updated after value change of current prompt.
|
|
35
|
+
*/
|
|
36
|
+
dependantPromptNames?: string[];
|
|
37
|
+
/**
|
|
38
|
+
* Properties of input field for creation mode.
|
|
39
|
+
*/
|
|
40
|
+
creation?: ListPromptQuestionCreationProps;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Interface to enable creation within list/combobox component.
|
|
44
|
+
*/
|
|
45
|
+
export interface ListPromptQuestionCreationProps {
|
|
46
|
+
/**
|
|
47
|
+
* Placeholder text for creation mode.
|
|
48
|
+
*/
|
|
49
|
+
placeholder?: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Represents a question prompt for list question with dropdown visualization.
|
|
53
|
+
* Combines properties of ListQuestion and BasePromptQuestion.
|
|
54
|
+
*/
|
|
55
|
+
export interface ListPromptQuestion<T extends Answers = Answers> extends ListQuestion<T> {
|
|
56
|
+
/**
|
|
57
|
+
* Additional properties for ui.
|
|
58
|
+
*/
|
|
59
|
+
guiOptions?: ListGuiOptions;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Represents a question prompt for input with simple input visualization.
|
|
63
|
+
* Combines properties of ListQuestion and BasePromptQuestion.
|
|
64
|
+
*/
|
|
65
|
+
export interface InputPromptQuestion<T extends Answers = Answers> extends InputQuestion<T> {
|
|
66
|
+
/**
|
|
67
|
+
* Additional properties for ui.
|
|
68
|
+
*/
|
|
69
|
+
guiOptions?: GuiOptions;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Represents a question prompt for checkbox.
|
|
73
|
+
* Combines properties of CheckboxQuestion and BasePromptQuestion.
|
|
74
|
+
*/
|
|
75
|
+
export interface CheckboxPromptQuestion<T extends Answers = Answers> extends CheckBoxQuestion<T> {
|
|
76
|
+
/**
|
|
77
|
+
* Additional properties for ui.
|
|
78
|
+
*/
|
|
79
|
+
guiOptions?: BaseListGuiOptions;
|
|
80
|
+
}
|
|
81
|
+
export type PromptQuestion<T extends Answers = Answers> = ListPromptQuestion<T> | InputPromptQuestion<T> | CheckboxPromptQuestion<T>;
|
|
82
|
+
export interface ValidationResult {
|
|
83
|
+
isValid: boolean;
|
|
84
|
+
errorMessage?: string;
|
|
85
|
+
}
|
|
86
|
+
export interface ValidationResults {
|
|
87
|
+
[questionName: string]: ValidationResult;
|
|
88
|
+
}
|
|
89
|
+
export type PromptListChoices = ReadonlyArray<DistinctChoice>;
|
|
90
|
+
export interface DynamicChoices {
|
|
91
|
+
[key: string]: PromptListChoices;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Interfaces for groups.
|
|
95
|
+
*/
|
|
96
|
+
export interface PromptsGroup {
|
|
97
|
+
/**
|
|
98
|
+
* Unique id of group, which can be used to map with questions
|
|
99
|
+
*/
|
|
100
|
+
id: string;
|
|
101
|
+
/**
|
|
102
|
+
* Title of group
|
|
103
|
+
*/
|
|
104
|
+
title: string;
|
|
105
|
+
/**
|
|
106
|
+
* Description texts
|
|
107
|
+
*/
|
|
108
|
+
description: string[];
|
|
109
|
+
}
|
|
110
|
+
export type AnswerValue = string | number | boolean | undefined;
|
|
111
|
+
export declare const enum PromptsLayoutType {
|
|
112
|
+
SingleColumn = "SingleColumn",
|
|
113
|
+
MultiColumn = "MultiColumn"
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,KAAK,EACR,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,UAAU,IAAI,cAAc,EAC/B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,cAAc;IAC9C;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,WAAW,CAAC,EAAE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gBAAgB,CAAC;CAC5C;AAED,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC,cAAc,CAAC,CAAC;AAE9D,MAAM,WAAW,cAAc;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAEhE,0BAAkB,iBAAiB;IAC/B,YAAY,iBAAiB;IAC7B,WAAW,gBAAgB;CAC9B"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PromptsLayoutType = void 0;
|
|
4
|
+
var PromptsLayoutType;
|
|
5
|
+
(function (PromptsLayoutType) {
|
|
6
|
+
PromptsLayoutType["SingleColumn"] = "SingleColumn";
|
|
7
|
+
PromptsLayoutType["MultiColumn"] = "MultiColumn";
|
|
8
|
+
})(PromptsLayoutType || (exports.PromptsLayoutType = PromptsLayoutType = {}));
|
|
9
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAsIA,IAAkB,iBAGjB;AAHD,WAAkB,iBAAiB;IAC/B,kDAA6B,CAAA;IAC7B,gDAA2B,CAAA;AAC/B,CAAC,EAHiB,iBAAiB,iCAAjB,iBAAiB,QAGlC"}
|