@rh-support/components 2.1.9 → 2.1.12

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.
Files changed (27) hide show
  1. package/lib/cjs/DropDownList/dropdownList.css +4 -0
  2. package/lib/cjs/InlineEdit/InlineEdit.js +1 -1
  3. package/lib/cjs/InlineEdit/NewInlineEdit.js +1 -1
  4. package/lib/cjs/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
  5. package/lib/cjs/MarkdownEditor/MarkdownEditor.js +5 -4
  6. package/lib/cjs/MarkdownEditor/markdownEditor.css +9 -0
  7. package/lib/cjs/PhoneInput/PhoneInput.d.ts +0 -2
  8. package/lib/cjs/PhoneInput/PhoneInput.d.ts.map +1 -1
  9. package/lib/cjs/PhoneInput/PhoneInput.js +22 -35
  10. package/lib/cjs/SupportFeedbackForm/SupportFeedbackModal.d.ts.map +1 -1
  11. package/lib/cjs/SupportFeedbackForm/SupportFeedbackModal.js +2 -0
  12. package/lib/cjs/TopContentSearch/TopContentSearch.d.ts.map +1 -1
  13. package/lib/cjs/TopContentSearch/TopContentSearch.js +1 -0
  14. package/lib/esm/DropDownList/dropdownList.css +4 -0
  15. package/lib/esm/InlineEdit/InlineEdit.js +1 -1
  16. package/lib/esm/InlineEdit/NewInlineEdit.js +1 -1
  17. package/lib/esm/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
  18. package/lib/esm/MarkdownEditor/MarkdownEditor.js +5 -4
  19. package/lib/esm/MarkdownEditor/markdownEditor.css +9 -0
  20. package/lib/esm/PhoneInput/PhoneInput.d.ts +0 -2
  21. package/lib/esm/PhoneInput/PhoneInput.d.ts.map +1 -1
  22. package/lib/esm/PhoneInput/PhoneInput.js +22 -35
  23. package/lib/esm/SupportFeedbackForm/SupportFeedbackModal.d.ts.map +1 -1
  24. package/lib/esm/SupportFeedbackForm/SupportFeedbackModal.js +2 -0
  25. package/lib/esm/TopContentSearch/TopContentSearch.d.ts.map +1 -1
  26. package/lib/esm/TopContentSearch/TopContentSearch.js +1 -0
  27. package/package.json +4 -4
@@ -48,3 +48,7 @@
48
48
  .downshift .downshift-menu {
49
49
  visibility: hidden;
50
50
  }
51
+
52
+ .hide-in-pdf {
53
+ display: none !important;
54
+ }
@@ -119,7 +119,7 @@ function InlineEdit(props) {
119
119
  });
120
120
  const renderSaveCancel = () => !props.hideSaveCancel &&
121
121
  props.allowInlineEdit &&
122
- isEditing && (react_1.default.createElement("span", { className: "edit-actions" },
122
+ isEditing && (react_1.default.createElement("span", { className: `edit-actions ${props.isExportingPDF ? 'hide-in-pdf' : ''}` },
123
123
  props.loadingIndicator && react_1.default.createElement("span", null, props.loadingIndicator),
124
124
  react_1.default.createElement("button", { "data-tracking-id": props.dataTrackingId ? `${props.dataTrackingId}-inline-edit-save` : null, className: "btn btn-app btn-link", type: "button", onClick: onSaveClicked, disabled: diabledCheckForSpaceAllowed || props.saveDisabled },
125
125
  react_1.default.createElement(react_i18next_1.Trans, null, props.saveLabel)),
@@ -125,7 +125,7 @@ function NewInlineEdit(props) {
125
125
  });
126
126
  const renderSaveCancel = () => !props.hideSaveCancel &&
127
127
  props.allowInlineEdit &&
128
- isEditing && (react_1.default.createElement("span", { className: "edit-actions" },
128
+ isEditing && (react_1.default.createElement("span", { className: `edit-actions ${props.isExportingPDF ? 'hide-in-pdf' : ''}` },
129
129
  props.loadingIndicator && react_1.default.createElement("span", null, props.loadingIndicator),
130
130
  react_1.default.createElement("button", { "data-tracking-id": props.dataTrackingId ? `${props.dataTrackingId}-inline-edit-save` : null, className: "btn btn-app btn-link", type: "button", onClick: onSaveClicked, disabled: diabledCheckForSpaceAllowed || props.saveDisabled },
131
131
  react_1.default.createElement(react_i18next_1.Trans, null, props.saveLabel)),
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownEditor.d.ts","sourceRoot":"","sources":["../../../src/MarkdownEditor/MarkdownEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EA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barItem, null,
410
410
  react_1.default.createElement("a", { className: "pf-c-button pf-m-link pf-m-inline markdown-guidance", rel: "noopener noreferrer", target: "_blank", href: "/articles/4729621", "data-tracking-id": "md-guidance" },
411
411
  react_1.default.createElement(react_i18next_1.Trans, null, "Markdown guidance")))))),
412
- react_1.default.createElement("div", { className: "markdown-content" }, !isPreview ? (react_1.default.createElement("textarea", Object.assign({}, textAreaProps, { onKeyDown: keydown, placeholder: isPlainModeEnabled ? t(props.plainTextPlaceholder) : t(props.mdPlaceholder), ref: bindTextAreaRef, className: classnames_1.default('form-control', 'markdown-text-area', props.textAreaClassName, 'textArea'), value: mdValue, onChange: textChanged, rows: props.rows || contentRows }))) : (react_1.default.createElement("div", { className: "markdown-preview", style: { maxHeight: mdValue ? 310 : 100 } },
413
- react_1.default.createElement("div", { dangerouslySetInnerHTML: {
414
- __html: dompurify_1.default.sanitize(previewMDText(mdValue)),
415
- } })))),
412
+ react_1.default.createElement("div", { className: "markdown-content" }, !isPreview ? (react_1.default.createElement("textarea", Object.assign({}, textAreaProps, { onKeyDown: keydown, placeholder: isPlainModeEnabled ? t(props.plainTextPlaceholder) : t(props.mdPlaceholder), ref: bindTextAreaRef, className: classnames_1.default('form-control', 'markdown-text-area', props.textAreaClassName, 'textArea'), value: mdValue, onChange: textChanged, rows: props.rows || contentRows, style: { height: '313px' } }))) : (react_1.default.createElement("div", { className: "markdown-preview-placeholder", style: { height: '313px' } },
413
+ react_1.default.createElement("div", { className: "markdown-preview", style: { maxHeight: '313px' } },
414
+ react_1.default.createElement("div", { dangerouslySetInnerHTML: {
415
+ __html: dompurify_1.default.sanitize(previewMDText(mdValue)),
416
+ } }))))),
416
417
  react_1.default.createElement("div", null, props.showMarkdownPlainTextToggle && (react_1.default.createElement("div", { className: `markdown-toggle-toolbar pf-l-flex` },
417
418
  react_1.default.createElement("span", { className: "markdown-toolbar-left-section" },
418
419
  !isPlainModeEnabled && (react_1.default.createElement(react_core_1.Button, { className: "markdown-preview-btn", tabIndex: -1, variant: react_core_1.ButtonVariant.link, onClick: preview, title: "Show preview", "data-tracking-id": `md-preview-${isPreview ? 'hide' : 'show'}`, isDisabled: disablePreviewButton }, isPreview ? (react_1.default.createElement("span", null,
@@ -100,3 +100,12 @@ button[data-link*='/attachments/']::before {
100
100
  .toolbar-container {
101
101
  height: 50px;
102
102
  }
103
+ .markdown-text-area {
104
+ width: 100%;
105
+ height: 313px;
106
+ border: none;
107
+ }
108
+
109
+ .markdown-preview {
110
+ border-bottom: none !important;
111
+ }
@@ -9,8 +9,6 @@ interface IProps {
9
9
  setInvalid?: (boolean: any) => void;
10
10
  isLoading?: boolean;
11
11
  isDisabled?: boolean;
12
- phoneLength?: number;
13
- setPhoneLength?: (number: any) => void;
14
12
  }
15
13
  export declare const getPhoneObj: (phoneNumber: string) => {
16
14
  countryCode: string;
@@ -1 +1 @@
1
- {"version":3,"file":"PhoneInput.d.ts","sourceRoot":"","sources":["../../../src/PhoneInput/PhoneInput.tsx"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC;AAU3B,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,CAAC,MAAM,KAAA,KAAK,IAAI,CAAC;IACrC,WAAW,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IACtE,mBAAmB,CAAC,EAAE,CAAC,MAAM,KAAA,KAAK,IAAI,CAAC;IACvC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,CAAC,OAAO,KAAA,KAAK,IAAI,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,CAAC,MAAM,KAAA,KAAK,IAAI,CAAC;CACrC;AAuED,eAAO,MAAM,WAAW,gBAAiB,MAAM;;;CAqB9C,CAAC;AAEF,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,eA4PvC"}
1
+ {"version":3,"file":"PhoneInput.d.ts","sourceRoot":"","sources":["../../../src/PhoneInput/PhoneInput.tsx"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC;AAU3B,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,CAAC,MAAM,KAAA,KAAK,IAAI,CAAC;IACrC,WAAW,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IACtE,mBAAmB,CAAC,EAAE,CAAC,MAAM,KAAA,KAAK,IAAI,CAAC;IACvC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,CAAC,OAAO,KAAA,KAAK,IAAI,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AA4DD,eAAO,MAAM,WAAW,gBAAiB,MAAM;;;CAqB9C,CAAC;AAEF,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,eAiPvC"}
@@ -33,17 +33,6 @@ const CountryData_1 = require("./CountryData");
33
33
  const PREFIX = '+';
34
34
  const DEFAULT_MASK = '... ... ... ... ..';
35
35
  const ALWAYS_DEFAULT_MASK = false;
36
- const initializedCountryObject = {
37
- name: '',
38
- regions: [''],
39
- iso2: '',
40
- countryCode: '',
41
- dialCode: '',
42
- format: '',
43
- priority: 0,
44
- areaCode: [''],
45
- isHavingDefaultFormat: false,
46
- };
47
36
  // Getting Country phone format
48
37
  function getMask(prefix, dialCode, predefinedMask, defaultMask, alwaysDefaultMask) {
49
38
  if (!predefinedMask || alwaysDefaultMask) {
@@ -53,6 +42,7 @@ function getMask(prefix, dialCode, predefinedMask, defaultMask, alwaysDefaultMas
53
42
  return prefix + ''.padEnd(dialCode.length, '.') + ' ' + predefinedMask;
54
43
  }
55
44
  }
45
+ // To map country data
56
46
  const initializedCountries = CountryData_1.COUNTRY_DATA.map((country) => {
57
47
  const countryItem = {
58
48
  name: country[0],
@@ -63,7 +53,6 @@ const initializedCountries = CountryData_1.COUNTRY_DATA.map((country) => {
63
53
  format: getMask(PREFIX, country[3], country[4], DEFAULT_MASK, ALWAYS_DEFAULT_MASK),
64
54
  priority: country[5] || 0,
65
55
  areaCode: country[6] || [],
66
- isHavingDefaultFormat: country[4] ? true : false,
67
56
  };
68
57
  return countryItem;
69
58
  });
@@ -114,13 +103,22 @@ const getPhoneObj = (phoneNumber) => {
114
103
  };
115
104
  exports.getPhoneObj = getPhoneObj;
116
105
  function PhoneInput(props) {
117
- const { phoneValue, countryCode, onCountryCodeChange, onPhoneValueChange, validations, setInvalid, setPhoneLength, } = props;
106
+ const { phoneValue, countryCode, onCountryCodeChange, onPhoneValueChange, validations, setInvalid } = props;
118
107
  const { t } = react_i18next_1.useTranslation();
119
108
  const [isOpen, setIsOpen] = react_1.useState(false);
120
109
  const [iso2, setIso2] = react_1.useState('');
121
110
  const [formattedNumber, setFormattedNumber] = react_1.useState('');
122
111
  const [format, setFormat] = react_1.useState('');
123
- const [countryObj, setCountryObj] = react_1.useState(initializedCountryObject);
112
+ const [countryObj, setCountryObj] = react_1.useState({
113
+ name: '',
114
+ regions: [''],
115
+ iso2: '',
116
+ countryCode: '',
117
+ dialCode: '',
118
+ format: '',
119
+ priority: 0,
120
+ areaCode: [''], // Area codes of a country
121
+ });
124
122
  const setLocalFormat = (phoneNumber) => {
125
123
  let localPhone = phoneNumber.replace(PREFIX, '').trim();
126
124
  localPhone = localPhone.replace('(', '').trim();
@@ -128,9 +126,6 @@ function PhoneInput(props) {
128
126
  // if the user selects a value from the dropdown and the country code is the same as prev, iso2 values shouldn't override
129
127
  if (!isEmpty_1.default(countryObj) && isEqual_1.default(localPhone, countryObj.dialCode)) {
130
128
  onCountryCodeChange && onCountryCodeChange(PREFIX + countryObj.countryCode);
131
- if (setPhoneLength) {
132
- countryObj.isHavingDefaultFormat ? setPhoneLength(countryObj.format.length) : setPhoneLength(8);
133
- }
134
129
  return countryObj.format;
135
130
  }
136
131
  let localFormat;
@@ -146,50 +141,36 @@ function PhoneInput(props) {
146
141
  localFormat = canadaCountryObj[0].format.toString();
147
142
  onCountryCodeChange && onCountryCodeChange(PREFIX + canadaCountryObj[0].dialCode.toString());
148
143
  setFormat(localFormat);
149
- setPhoneLength && setPhoneLength(localFormat.length);
150
144
  }
151
145
  else if (!isEmpty_1.default(exactCountry)) {
152
146
  const localExactCountry = exactCountry.filter((country) => isEqual_1.default(country.priority, 0));
153
147
  if (isEqual_1.default(localExactCountry[0].dialCode.toString(), countryObj.dialCode)) {
154
148
  setIso2(countryObj.iso2);
155
149
  onCountryCodeChange && onCountryCodeChange(PREFIX + countryObj.countryCode);
156
- if (setPhoneLength) {
157
- countryObj.isHavingDefaultFormat ? setPhoneLength(countryObj.format.length) : setPhoneLength(8);
158
- }
159
150
  return countryObj.format;
160
151
  }
161
152
  setIso2(localExactCountry[0].iso2.toString());
162
153
  localFormat = localExactCountry[0].format.toString();
163
154
  onCountryCodeChange && onCountryCodeChange(PREFIX + localExactCountry[0].dialCode.toString());
164
155
  setFormat(localFormat);
165
- if (setPhoneLength) {
166
- localExactCountry[0].isHavingDefaultFormat ? setPhoneLength(localFormat.length) : setPhoneLength(8);
167
- }
168
156
  }
169
157
  else if (!isEmpty_1.default(possibleCountries)) {
170
158
  const localPossibleCountry = possibleCountries.filter((country) => isEqual_1.default(country.priority, 0));
171
159
  if (isEqual_1.default(localPossibleCountry[0].dialCode.toString(), countryObj.dialCode)) {
172
160
  setIso2(countryObj.iso2);
173
161
  onCountryCodeChange && onCountryCodeChange(PREFIX + countryObj.countryCode);
174
- if (setPhoneLength) {
175
- countryObj.isHavingDefaultFormat ? setPhoneLength(countryObj.format.length) : setPhoneLength(8);
176
- }
177
162
  return countryObj.format;
178
163
  }
179
164
  setIso2(localPossibleCountry[0].iso2.toString());
180
165
  localFormat = localPossibleCountry[0].format.toString();
181
166
  onCountryCodeChange && onCountryCodeChange(PREFIX + localPossibleCountry[0].dialCode.toString());
182
167
  setFormat(localFormat);
183
- if (setPhoneLength) {
184
- localPossibleCountry[0].isHavingDefaultFormat ? setPhoneLength(localFormat.length) : setPhoneLength(8);
185
- }
186
168
  }
187
169
  else {
188
170
  // if the exact and possible are not the
189
171
  setIso2('');
190
172
  localFormat = format;
191
173
  onCountryCodeChange && onCountryCodeChange('');
192
- setPhoneLength && setPhoneLength(0);
193
174
  }
194
175
  return localFormat;
195
176
  };
@@ -198,7 +179,6 @@ function PhoneInput(props) {
198
179
  setFormattedNumber('');
199
180
  onPhoneValueChange('');
200
181
  setInvalid && setInvalid(false);
201
- setPhoneLength && setPhoneLength(0);
202
182
  }
203
183
  const regex = /^[\d ()+-]+$/;
204
184
  if (setInvalid)
@@ -246,7 +226,6 @@ function PhoneInput(props) {
246
226
  react_1.useEffect(() => {
247
227
  if (isEmpty_1.default(phoneValue)) {
248
228
  setInvalid && setInvalid(false);
249
- setPhoneLength && setPhoneLength(0);
250
229
  return;
251
230
  }
252
231
  if (isEmpty_1.default(iso2)) {
@@ -273,11 +252,19 @@ function PhoneInput(props) {
273
252
  return;
274
253
  }
275
254
  if (isEmpty_1.default(phoneValue) && isEmpty_1.default(iso2)) {
276
- setCountryObj(initializedCountryObject);
255
+ setCountryObj({
256
+ name: '',
257
+ regions: [''],
258
+ iso2: '',
259
+ countryCode: '',
260
+ dialCode: '',
261
+ format: '',
262
+ priority: 0,
263
+ areaCode: [''],
264
+ });
277
265
  }
278
266
  if (isEmpty_1.default(phoneValue)) {
279
267
  setIso2('');
280
- setPhoneLength && setPhoneLength(0);
281
268
  setInvalid && setInvalid(false);
282
269
  setFormattedNumber('');
283
270
  onPhoneValueChange('');
@@ -1 +1 @@
1
- {"version":3,"file":"SupportFeedbackModal.d.ts","sourceRoot":"","sources":["../../../src/SupportFeedbackForm/SupportFeedbackModal.tsx"],"names":[],"mappings":"AAuBA,UAAU,MAAM;IACZ,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAMD,iBAAS,oBAAoB,CAAC,KAAK,EAAE,MAAM,eAuN1C;kBAvNQ,oBAAoB;;;AA0N7B,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
1
+ {"version":3,"file":"SupportFeedbackModal.d.ts","sourceRoot":"","sources":["../../../src/SupportFeedbackForm/SupportFeedbackModal.tsx"],"names":[],"mappings":"AAuBA,UAAU,MAAM;IACZ,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAMD,iBAAS,oBAAoB,CAAC,KAAK,EAAE,MAAM,eAyN1C;kBAzNQ,oBAAoB;;;AA4N7B,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
@@ -84,6 +84,7 @@ function SupportFeedbackModal(props) {
84
84
  const handleFeedbackTextChange = (event) => {
85
85
  setValues(Object.assign(Object.assign({}, values), { [event.target.name]: event.target.value }));
86
86
  };
87
+ // To handle submit
87
88
  const handleSubmit = (event) => __awaiter(this, void 0, void 0, function* () {
88
89
  event.preventDefault();
89
90
  if (!isSubmitButtonValid) {
@@ -136,6 +137,7 @@ function SupportFeedbackModal(props) {
136
137
  label: 'Very Satisfied',
137
138
  },
138
139
  ];
140
+ // To handle rendering of modal body
139
141
  function renderModalBody() {
140
142
  return (react_1.default.createElement(react_1.default.Fragment, null,
141
143
  react_1.default.createElement("form", { className: "support-feedback-form", action: "", onSubmit: handleSubmit },
@@ -1 +1 @@
1
- {"version":3,"file":"TopContentSearch.d.ts","sourceRoot":"","sources":["../../../src/TopContentSearch/TopContentSearch.tsx"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,eAAe,EAAE,MAAM,2DAA2D,CAAC;AAQ5F,OAAO,KAA4D,MAAM,OAAO,CAAC;AAGjF,UAAU,MAAM;IACZ,cAAc,EAAE,MAAM,CAAC;IACvB,2BAA2B,EAAE,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACzD,cAAc,EAAE,eAAe,EAAE,CAAC;IAClC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;CAC3E;AAED,eAAO,MAAM,gBAAgB,eAAgB,MAAM,WASlD,CAAC;AAOF,wBAAgB,gBAAgB,CAAC,EAC7B,cAAmB,EACnB,2BAA6C,EAC7C,QAAQ,EACR,cAAc,EACd,mBAA2B,GAC9B,EAAE,MAAM,eA0GR"}
1
+ {"version":3,"file":"TopContentSearch.d.ts","sourceRoot":"","sources":["../../../src/TopContentSearch/TopContentSearch.tsx"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,eAAe,EAAE,MAAM,2DAA2D,CAAC;AAQ5F,OAAO,KAA4D,MAAM,OAAO,CAAC;AAGjF,UAAU,MAAM;IACZ,cAAc,EAAE,MAAM,CAAC;IACvB,2BAA2B,EAAE,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACzD,cAAc,EAAE,eAAe,EAAE,CAAC;IAClC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;CAC3E;AAED,eAAO,MAAM,gBAAgB,eAAgB,MAAM,WASlD,CAAC;AAOF,wBAAgB,gBAAgB,CAAC,EAC7B,cAAmB,EACnB,2BAA6C,EAC7C,QAAQ,EACR,cAAc,EACd,mBAA2B,GAC9B,EAAE,MAAM,eA2GR"}
@@ -100,6 +100,7 @@ function TopContentSearch({ topContentData = [], topContentResultsWrapperRef = {
100
100
  },
101
101
  // eslint-disable-next-line react-hooks/exhaustive-deps
102
102
  [highlightSearchResults, topContentData]);
103
+ // To handle search
103
104
  const handleSearch = react_1.useCallback((query) => __awaiter(this, void 0, void 0, function* () {
104
105
  if (!query) {
105
106
  onSearchInputClear();
@@ -48,3 +48,7 @@
48
48
  .downshift .downshift-menu {
49
49
  visibility: hidden;
50
50
  }
51
+
52
+ .hide-in-pdf {
53
+ display: none !important;
54
+ }
@@ -94,7 +94,7 @@ function InlineEdit(props) {
94
94
  });
95
95
  const renderSaveCancel = () => !props.hideSaveCancel &&
96
96
  props.allowInlineEdit &&
97
- isEditing && (React.createElement("span", { className: "edit-actions" },
97
+ isEditing && (React.createElement("span", { className: `edit-actions ${props.isExportingPDF ? 'hide-in-pdf' : ''}` },
98
98
  props.loadingIndicator && React.createElement("span", null, props.loadingIndicator),
99
99
  React.createElement("button", { "data-tracking-id": props.dataTrackingId ? `${props.dataTrackingId}-inline-edit-save` : null, className: "btn btn-app btn-link", type: "button", onClick: onSaveClicked, disabled: diabledCheckForSpaceAllowed || props.saveDisabled },
100
100
  React.createElement(Trans, null, props.saveLabel)),
@@ -100,7 +100,7 @@ function NewInlineEdit(props) {
100
100
  });
101
101
  const renderSaveCancel = () => !props.hideSaveCancel &&
102
102
  props.allowInlineEdit &&
103
- isEditing && (React.createElement("span", { className: "edit-actions" },
103
+ isEditing && (React.createElement("span", { className: `edit-actions ${props.isExportingPDF ? 'hide-in-pdf' : ''}` },
104
104
  props.loadingIndicator && React.createElement("span", null, props.loadingIndicator),
105
105
  React.createElement("button", { "data-tracking-id": props.dataTrackingId ? `${props.dataTrackingId}-inline-edit-save` : null, className: "btn btn-app btn-link", type: "button", onClick: onSaveClicked, disabled: diabledCheckForSpaceAllowed || props.saveDisabled },
106
106
  React.createElement(Trans, null, props.saveLabel)),
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownEditor.d.ts","sourceRoot":"","sources":["../../../src/MarkdownEditor/MarkdownEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA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olbarItem, null,
385
385
  React.createElement("a", { className: "pf-c-button pf-m-link pf-m-inline markdown-guidance", rel: "noopener noreferrer", target: "_blank", href: "/articles/4729621", "data-tracking-id": "md-guidance" },
386
386
  React.createElement(Trans, null, "Markdown guidance")))))),
387
- React.createElement("div", { className: "markdown-content" }, !isPreview ? (React.createElement("textarea", Object.assign({}, textAreaProps, { onKeyDown: keydown, placeholder: isPlainModeEnabled ? t(props.plainTextPlaceholder) : t(props.mdPlaceholder), ref: bindTextAreaRef, className: cx('form-control', 'markdown-text-area', props.textAreaClassName, 'textArea'), value: mdValue, onChange: textChanged, rows: props.rows || contentRows }))) : (React.createElement("div", { className: "markdown-preview", style: { maxHeight: mdValue ? 310 : 100 } },
388
- React.createElement("div", { dangerouslySetInnerHTML: {
389
- __html: DOMPurify.sanitize(previewMDText(mdValue)),
390
- } })))),
387
+ React.createElement("div", { className: "markdown-content" }, !isPreview ? (React.createElement("textarea", Object.assign({}, textAreaProps, { onKeyDown: keydown, placeholder: isPlainModeEnabled ? t(props.plainTextPlaceholder) : t(props.mdPlaceholder), ref: bindTextAreaRef, className: cx('form-control', 'markdown-text-area', props.textAreaClassName, 'textArea'), value: mdValue, onChange: textChanged, rows: props.rows || contentRows, style: { height: '313px' } }))) : (React.createElement("div", { className: "markdown-preview-placeholder", style: { height: '313px' } },
388
+ React.createElement("div", { className: "markdown-preview", style: { maxHeight: '313px' } },
389
+ React.createElement("div", { dangerouslySetInnerHTML: {
390
+ __html: DOMPurify.sanitize(previewMDText(mdValue)),
391
+ } }))))),
391
392
  React.createElement("div", null, props.showMarkdownPlainTextToggle && (React.createElement("div", { className: `markdown-toggle-toolbar pf-l-flex` },
392
393
  React.createElement("span", { className: "markdown-toolbar-left-section" },
393
394
  !isPlainModeEnabled && (React.createElement(Button, { className: "markdown-preview-btn", tabIndex: -1, variant: ButtonVariant.link, onClick: preview, title: "Show preview", "data-tracking-id": `md-preview-${isPreview ? 'hide' : 'show'}`, isDisabled: disablePreviewButton }, isPreview ? (React.createElement("span", null,
@@ -100,3 +100,12 @@ button[data-link*='/attachments/']::before {
100
100
  .toolbar-container {
101
101
  height: 50px;
102
102
  }
103
+ .markdown-text-area {
104
+ width: 100%;
105
+ height: 313px;
106
+ border: none;
107
+ }
108
+
109
+ .markdown-preview {
110
+ border-bottom: none !important;
111
+ }
@@ -9,8 +9,6 @@ interface IProps {
9
9
  setInvalid?: (boolean: any) => void;
10
10
  isLoading?: boolean;
11
11
  isDisabled?: boolean;
12
- phoneLength?: number;
13
- setPhoneLength?: (number: any) => void;
14
12
  }
15
13
  export declare const getPhoneObj: (phoneNumber: string) => {
16
14
  countryCode: string;
@@ -1 +1 @@
1
- {"version":3,"file":"PhoneInput.d.ts","sourceRoot":"","sources":["../../../src/PhoneInput/PhoneInput.tsx"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC;AAU3B,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,CAAC,MAAM,KAAA,KAAK,IAAI,CAAC;IACrC,WAAW,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IACtE,mBAAmB,CAAC,EAAE,CAAC,MAAM,KAAA,KAAK,IAAI,CAAC;IACvC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,CAAC,OAAO,KAAA,KAAK,IAAI,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,CAAC,MAAM,KAAA,KAAK,IAAI,CAAC;CACrC;AAuED,eAAO,MAAM,WAAW,gBAAiB,MAAM;;;CAqB9C,CAAC;AAEF,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,eA4PvC"}
1
+ {"version":3,"file":"PhoneInput.d.ts","sourceRoot":"","sources":["../../../src/PhoneInput/PhoneInput.tsx"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC;AAU3B,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,CAAC,MAAM,KAAA,KAAK,IAAI,CAAC;IACrC,WAAW,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IACtE,mBAAmB,CAAC,EAAE,CAAC,MAAM,KAAA,KAAK,IAAI,CAAC;IACvC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,CAAC,OAAO,KAAA,KAAK,IAAI,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AA4DD,eAAO,MAAM,WAAW,gBAAiB,MAAM;;;CAqB9C,CAAC;AAEF,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,eAiPvC"}
@@ -8,17 +8,6 @@ import { canadaAreaCodes, COUNTRY_DATA } from './CountryData';
8
8
  const PREFIX = '+';
9
9
  const DEFAULT_MASK = '... ... ... ... ..';
10
10
  const ALWAYS_DEFAULT_MASK = false;
11
- const initializedCountryObject = {
12
- name: '',
13
- regions: [''],
14
- iso2: '',
15
- countryCode: '',
16
- dialCode: '',
17
- format: '',
18
- priority: 0,
19
- areaCode: [''],
20
- isHavingDefaultFormat: false,
21
- };
22
11
  // Getting Country phone format
23
12
  function getMask(prefix, dialCode, predefinedMask, defaultMask, alwaysDefaultMask) {
24
13
  if (!predefinedMask || alwaysDefaultMask) {
@@ -28,6 +17,7 @@ function getMask(prefix, dialCode, predefinedMask, defaultMask, alwaysDefaultMas
28
17
  return prefix + ''.padEnd(dialCode.length, '.') + ' ' + predefinedMask;
29
18
  }
30
19
  }
20
+ // To map country data
31
21
  const initializedCountries = COUNTRY_DATA.map((country) => {
32
22
  const countryItem = {
33
23
  name: country[0],
@@ -38,7 +28,6 @@ const initializedCountries = COUNTRY_DATA.map((country) => {
38
28
  format: getMask(PREFIX, country[3], country[4], DEFAULT_MASK, ALWAYS_DEFAULT_MASK),
39
29
  priority: country[5] || 0,
40
30
  areaCode: country[6] || [],
41
- isHavingDefaultFormat: country[4] ? true : false,
42
31
  };
43
32
  return countryItem;
44
33
  });
@@ -88,13 +77,22 @@ export const getPhoneObj = (phoneNumber) => {
88
77
  };
89
78
  };
90
79
  export function PhoneInput(props) {
91
- const { phoneValue, countryCode, onCountryCodeChange, onPhoneValueChange, validations, setInvalid, setPhoneLength, } = props;
80
+ const { phoneValue, countryCode, onCountryCodeChange, onPhoneValueChange, validations, setInvalid } = props;
92
81
  const { t } = useTranslation();
93
82
  const [isOpen, setIsOpen] = useState(false);
94
83
  const [iso2, setIso2] = useState('');
95
84
  const [formattedNumber, setFormattedNumber] = useState('');
96
85
  const [format, setFormat] = useState('');
97
- const [countryObj, setCountryObj] = useState(initializedCountryObject);
86
+ const [countryObj, setCountryObj] = useState({
87
+ name: '',
88
+ regions: [''],
89
+ iso2: '',
90
+ countryCode: '',
91
+ dialCode: '',
92
+ format: '',
93
+ priority: 0,
94
+ areaCode: [''], // Area codes of a country
95
+ });
98
96
  const setLocalFormat = (phoneNumber) => {
99
97
  let localPhone = phoneNumber.replace(PREFIX, '').trim();
100
98
  localPhone = localPhone.replace('(', '').trim();
@@ -102,9 +100,6 @@ export function PhoneInput(props) {
102
100
  // if the user selects a value from the dropdown and the country code is the same as prev, iso2 values shouldn't override
103
101
  if (!isEmpty(countryObj) && isEqual(localPhone, countryObj.dialCode)) {
104
102
  onCountryCodeChange && onCountryCodeChange(PREFIX + countryObj.countryCode);
105
- if (setPhoneLength) {
106
- countryObj.isHavingDefaultFormat ? setPhoneLength(countryObj.format.length) : setPhoneLength(8);
107
- }
108
103
  return countryObj.format;
109
104
  }
110
105
  let localFormat;
@@ -120,50 +115,36 @@ export function PhoneInput(props) {
120
115
  localFormat = canadaCountryObj[0].format.toString();
121
116
  onCountryCodeChange && onCountryCodeChange(PREFIX + canadaCountryObj[0].dialCode.toString());
122
117
  setFormat(localFormat);
123
- setPhoneLength && setPhoneLength(localFormat.length);
124
118
  }
125
119
  else if (!isEmpty(exactCountry)) {
126
120
  const localExactCountry = exactCountry.filter((country) => isEqual(country.priority, 0));
127
121
  if (isEqual(localExactCountry[0].dialCode.toString(), countryObj.dialCode)) {
128
122
  setIso2(countryObj.iso2);
129
123
  onCountryCodeChange && onCountryCodeChange(PREFIX + countryObj.countryCode);
130
- if (setPhoneLength) {
131
- countryObj.isHavingDefaultFormat ? setPhoneLength(countryObj.format.length) : setPhoneLength(8);
132
- }
133
124
  return countryObj.format;
134
125
  }
135
126
  setIso2(localExactCountry[0].iso2.toString());
136
127
  localFormat = localExactCountry[0].format.toString();
137
128
  onCountryCodeChange && onCountryCodeChange(PREFIX + localExactCountry[0].dialCode.toString());
138
129
  setFormat(localFormat);
139
- if (setPhoneLength) {
140
- localExactCountry[0].isHavingDefaultFormat ? setPhoneLength(localFormat.length) : setPhoneLength(8);
141
- }
142
130
  }
143
131
  else if (!isEmpty(possibleCountries)) {
144
132
  const localPossibleCountry = possibleCountries.filter((country) => isEqual(country.priority, 0));
145
133
  if (isEqual(localPossibleCountry[0].dialCode.toString(), countryObj.dialCode)) {
146
134
  setIso2(countryObj.iso2);
147
135
  onCountryCodeChange && onCountryCodeChange(PREFIX + countryObj.countryCode);
148
- if (setPhoneLength) {
149
- countryObj.isHavingDefaultFormat ? setPhoneLength(countryObj.format.length) : setPhoneLength(8);
150
- }
151
136
  return countryObj.format;
152
137
  }
153
138
  setIso2(localPossibleCountry[0].iso2.toString());
154
139
  localFormat = localPossibleCountry[0].format.toString();
155
140
  onCountryCodeChange && onCountryCodeChange(PREFIX + localPossibleCountry[0].dialCode.toString());
156
141
  setFormat(localFormat);
157
- if (setPhoneLength) {
158
- localPossibleCountry[0].isHavingDefaultFormat ? setPhoneLength(localFormat.length) : setPhoneLength(8);
159
- }
160
142
  }
161
143
  else {
162
144
  // if the exact and possible are not the
163
145
  setIso2('');
164
146
  localFormat = format;
165
147
  onCountryCodeChange && onCountryCodeChange('');
166
- setPhoneLength && setPhoneLength(0);
167
148
  }
168
149
  return localFormat;
169
150
  };
@@ -172,7 +153,6 @@ export function PhoneInput(props) {
172
153
  setFormattedNumber('');
173
154
  onPhoneValueChange('');
174
155
  setInvalid && setInvalid(false);
175
- setPhoneLength && setPhoneLength(0);
176
156
  }
177
157
  const regex = /^[\d ()+-]+$/;
178
158
  if (setInvalid)
@@ -220,7 +200,6 @@ export function PhoneInput(props) {
220
200
  useEffect(() => {
221
201
  if (isEmpty(phoneValue)) {
222
202
  setInvalid && setInvalid(false);
223
- setPhoneLength && setPhoneLength(0);
224
203
  return;
225
204
  }
226
205
  if (isEmpty(iso2)) {
@@ -247,11 +226,19 @@ export function PhoneInput(props) {
247
226
  return;
248
227
  }
249
228
  if (isEmpty(phoneValue) && isEmpty(iso2)) {
250
- setCountryObj(initializedCountryObject);
229
+ setCountryObj({
230
+ name: '',
231
+ regions: [''],
232
+ iso2: '',
233
+ countryCode: '',
234
+ dialCode: '',
235
+ format: '',
236
+ priority: 0,
237
+ areaCode: [''],
238
+ });
251
239
  }
252
240
  if (isEmpty(phoneValue)) {
253
241
  setIso2('');
254
- setPhoneLength && setPhoneLength(0);
255
242
  setInvalid && setInvalid(false);
256
243
  setFormattedNumber('');
257
244
  onPhoneValueChange('');
@@ -1 +1 @@
1
- {"version":3,"file":"SupportFeedbackModal.d.ts","sourceRoot":"","sources":["../../../src/SupportFeedbackForm/SupportFeedbackModal.tsx"],"names":[],"mappings":"AAuBA,UAAU,MAAM;IACZ,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAMD,iBAAS,oBAAoB,CAAC,KAAK,EAAE,MAAM,eAuN1C;kBAvNQ,oBAAoB;;;AA0N7B,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
1
+ {"version":3,"file":"SupportFeedbackModal.d.ts","sourceRoot":"","sources":["../../../src/SupportFeedbackForm/SupportFeedbackModal.tsx"],"names":[],"mappings":"AAuBA,UAAU,MAAM;IACZ,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAMD,iBAAS,oBAAoB,CAAC,KAAK,EAAE,MAAM,eAyN1C;kBAzNQ,oBAAoB;;;AA4N7B,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
@@ -59,6 +59,7 @@ function SupportFeedbackModal(props) {
59
59
  const handleFeedbackTextChange = (event) => {
60
60
  setValues(Object.assign(Object.assign({}, values), { [event.target.name]: event.target.value }));
61
61
  };
62
+ // To handle submit
62
63
  const handleSubmit = (event) => __awaiter(this, void 0, void 0, function* () {
63
64
  event.preventDefault();
64
65
  if (!isSubmitButtonValid) {
@@ -111,6 +112,7 @@ function SupportFeedbackModal(props) {
111
112
  label: 'Very Satisfied',
112
113
  },
113
114
  ];
115
+ // To handle rendering of modal body
114
116
  function renderModalBody() {
115
117
  return (React.createElement(React.Fragment, null,
116
118
  React.createElement("form", { className: "support-feedback-form", action: "", onSubmit: handleSubmit },
@@ -1 +1 @@
1
- {"version":3,"file":"TopContentSearch.d.ts","sourceRoot":"","sources":["../../../src/TopContentSearch/TopContentSearch.tsx"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,eAAe,EAAE,MAAM,2DAA2D,CAAC;AAQ5F,OAAO,KAA4D,MAAM,OAAO,CAAC;AAGjF,UAAU,MAAM;IACZ,cAAc,EAAE,MAAM,CAAC;IACvB,2BAA2B,EAAE,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACzD,cAAc,EAAE,eAAe,EAAE,CAAC;IAClC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;CAC3E;AAED,eAAO,MAAM,gBAAgB,eAAgB,MAAM,WASlD,CAAC;AAOF,wBAAgB,gBAAgB,CAAC,EAC7B,cAAmB,EACnB,2BAA6C,EAC7C,QAAQ,EACR,cAAc,EACd,mBAA2B,GAC9B,EAAE,MAAM,eA0GR"}
1
+ {"version":3,"file":"TopContentSearch.d.ts","sourceRoot":"","sources":["../../../src/TopContentSearch/TopContentSearch.tsx"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,eAAe,EAAE,MAAM,2DAA2D,CAAC;AAQ5F,OAAO,KAA4D,MAAM,OAAO,CAAC;AAGjF,UAAU,MAAM;IACZ,cAAc,EAAE,MAAM,CAAC;IACvB,2BAA2B,EAAE,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACzD,cAAc,EAAE,eAAe,EAAE,CAAC;IAClC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;CAC3E;AAED,eAAO,MAAM,gBAAgB,eAAgB,MAAM,WASlD,CAAC;AAOF,wBAAgB,gBAAgB,CAAC,EAC7B,cAAmB,EACnB,2BAA6C,EAC7C,QAAQ,EACR,cAAc,EACd,mBAA2B,GAC9B,EAAE,MAAM,eA2GR"}
@@ -74,6 +74,7 @@ export function TopContentSearch({ topContentData = [], topContentResultsWrapper
74
74
  },
75
75
  // eslint-disable-next-line react-hooks/exhaustive-deps
76
76
  [highlightSearchResults, topContentData]);
77
+ // To handle search
77
78
  const handleSearch = useCallback((query) => __awaiter(this, void 0, void 0, function* () {
78
79
  if (!query) {
79
80
  onSearchInputClear();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/components",
3
- "version": "2.1.9",
3
+ "version": "2.1.12",
4
4
  "description": "Contains all reusabel components for support app",
5
5
  "author": "Vikas Rathee <vrathee@redhat.com>",
6
6
  "license": "ISC",
@@ -80,8 +80,8 @@
80
80
  "@patternfly/react-core": "4.264.0",
81
81
  "@patternfly/react-table": "4.111.33",
82
82
  "@rh-support/types": "2.0.2",
83
- "@rh-support/user-permissions": "2.1.4",
84
- "@rh-support/utils": "2.1.2",
83
+ "@rh-support/user-permissions": "2.1.6",
84
+ "@rh-support/utils": "2.1.3",
85
85
  "dompurify": "^2.2.6",
86
86
  "downshift": "^6.0.5",
87
87
  "js-worker-search": "^1.4.1",
@@ -117,5 +117,5 @@
117
117
  "defaults and supports es6-module",
118
118
  "maintained node versions"
119
119
  ],
120
- "gitHead": "8f7f0aee0461c78e8a5cc0e16777371c4ae1305d"
120
+ "gitHead": "54bc1f4ec262c366c2f13ccf03a0df500b97af6a"
121
121
  }