@tripian/react 6.0.1 → 6.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,6 +11,7 @@ interface IDropdown {
11
11
  selectChange: (value: string | number, index: number) => void;
12
12
  onFocus?: () => void;
13
13
  onBlur?: () => void;
14
+ skippable?: boolean;
14
15
  }
15
16
  declare const Dropdown: React.FC<IDropdown>;
16
17
  export default Dropdown;
package/index.js CHANGED
@@ -7418,8 +7418,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
7418
7418
  var react_1 = __importStar(__webpack_require__(0));
7419
7419
  var Dropdown_scss_1 = __importDefault(__webpack_require__(560));
7420
7420
  var Dropdown = function (_a) {
7421
- var id = _a.id, options = _a.options, defaultValue = _a.defaultValue, selectChange = _a.selectChange, onFocus = _a.onFocus, onBlur = _a.onBlur;
7422
- var _b = (0, react_1.useState)(defaultValue), selection = _b[0], setSelection = _b[1];
7421
+ var id = _a.id, options = _a.options, defaultValue = _a.defaultValue, selectChange = _a.selectChange, onFocus = _a.onFocus, onBlur = _a.onBlur, _b = _a.skippable, skippable = _b === void 0 ? false : _b;
7422
+ var _c = (0, react_1.useState)(defaultValue), selection = _c[0], setSelection = _c[1];
7423
7423
  var keyOptions = options.map(function (o) { return ({
7424
7424
  key: o.key || o.value,
7425
7425
  value: o.value,
@@ -7439,7 +7439,7 @@ var Dropdown = function (_a) {
7439
7439
  if (onBlur)
7440
7440
  onBlur();
7441
7441
  } },
7442
- defaultValue === undefined && react_1.default.createElement("option", { value: undefined }, "Please Select"),
7442
+ skippable && react_1.default.createElement("option", { value: undefined }, "Please Select"),
7443
7443
  keyOptions.map(function (option) { return (react_1.default.createElement("option", { key: option.key, value: option.value }, option.label ? option.label : option.value)); }))));
7444
7444
  };
7445
7445
  exports.default = Dropdown;
@@ -63829,7 +63829,7 @@ var InfoBox_1 = __importDefault(__webpack_require__(105));
63829
63829
  var QuestionTemplate_1 = __importDefault(__webpack_require__(651));
63830
63830
  var QuestionTemplate2_1 = __importDefault(__webpack_require__(659));
63831
63831
  var StepComponent = function (_a) {
63832
- var header = _a.header, defaultTip = _a.defaultTip, stepQuestions = _a.stepQuestions, stepId = _a.stepId, tripProfile = _a.tripProfile, callbackTripAnswers = _a.callbackTripAnswers;
63832
+ var /* header, */ defaultTip = _a.defaultTip, stepQuestions = _a.stepQuestions, /* stepId, */ tripProfile = _a.tripProfile, callbackTripAnswers = _a.callbackTripAnswers;
63833
63833
  var _b = (0, react_1.useState)(defaultTip), tip = _b[0], setTip = _b[1];
63834
63834
  var onFocus = function (qId) {
63835
63835
  var focusedQ = stepQuestions.find(function (x) { return x.id === qId; });
@@ -64334,8 +64334,11 @@ var react_1 = __importStar(__webpack_require__(0));
64334
64334
  var QuestionContext2_1 = __importDefault(__webpack_require__(348));
64335
64335
  var SelectQuestion_1 = __importDefault(__webpack_require__(661));
64336
64336
  var Question2 = function (_a) {
64337
+ var _b, _c;
64337
64338
  var changed = _a.changed, flexDirection = _a.flexDirection;
64338
- var _b = (0, react_1.useContext)(QuestionContext2_1.default), questions = _b.questions, defaultAnswers = _b.defaultAnswers;
64339
+ var _d = (0, react_1.useContext)(QuestionContext2_1.default), questions = _d.questions, defaultAnswers = _d.defaultAnswers;
64340
+ var defaultAnswer1 = (_b = questions[0].answers.find(function (option) { return defaultAnswers.includes(option.id); })) === null || _b === void 0 ? void 0 : _b.id;
64341
+ var defaultAnswer2 = (_c = questions[1].answers.find(function (option) { return defaultAnswers.includes(option.id); })) === null || _c === void 0 ? void 0 : _c.id;
64339
64342
  var selectionChanged = function (addedOptionId, removedOptionId) {
64340
64343
  var newAnswers = __spreadArray([], defaultAnswers, true);
64341
64344
  if (removedOptionId) {
@@ -64345,14 +64348,12 @@ var Question2 = function (_a) {
64345
64348
  newAnswers.push(addedOptionId);
64346
64349
  changed(newAnswers);
64347
64350
  };
64348
- // const defaultAnswer1 = questions[0].answers.find((option) => defaultAnswers.includes(option.id))?.id;
64349
- // const defaultAnswer2 = questions[1].answers.find((option) => defaultAnswers.includes(option.id))?.id;
64350
64351
  return (react_1.default.createElement(react_1.default.Fragment, null,
64351
64352
  react_1.default.createElement("h3", { className: "mt10 mb6" }, "What type of restaurants do you prefer?"),
64352
64353
  react_1.default.createElement("h4", { className: "my2" }, "Lunch/Brunch"),
64353
- react_1.default.createElement(SelectQuestion_1.default, { question: questions[0], selectionChanged: selectionChanged, flexDirection: flexDirection }),
64354
+ react_1.default.createElement(SelectQuestion_1.default, { question: questions[0], defaultAnswer: defaultAnswer1, selectionChanged: selectionChanged, flexDirection: flexDirection }),
64354
64355
  react_1.default.createElement("h4", { className: "my2" }, "Dinner"),
64355
- react_1.default.createElement(SelectQuestion_1.default, { question: questions[1], selectionChanged: selectionChanged, flexDirection: flexDirection })));
64356
+ react_1.default.createElement(SelectQuestion_1.default, { question: questions[1], defaultAnswer: defaultAnswer2, selectionChanged: selectionChanged, flexDirection: flexDirection })));
64356
64357
  };
64357
64358
  exports.default = Question2;
64358
64359
 
@@ -64403,7 +64404,7 @@ var SelectQuestion = function (_a) {
64403
64404
  };
64404
64405
  return (react_1.default.createElement(react_1.default.Fragment, null,
64405
64406
  react_1.default.createElement("div", { style: flexDirection === 'column' ? { display: 'flex', flexDirection: 'column' } : undefined },
64406
- react_1.default.createElement(Dropdown_1.default, { defaultValue: defaultAnswer, options: question.answers.map(function (option) { return ({ value: option.id, label: option.name }); }), selectChange: handleChange }))));
64407
+ react_1.default.createElement(Dropdown_1.default, { defaultValue: defaultAnswer, options: question.answers.map(function (option) { return ({ value: option.id, label: option.name }); }), selectChange: handleChange, skippable: question.skippable }))));
64407
64408
  };
64408
64409
  exports.default = SelectQuestion;
64409
64410