@redocly/theme 0.47.1 → 0.48.1

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 (117) hide show
  1. package/lib/components/Feedback/Mood.d.ts +2 -2
  2. package/lib/components/Feedback/Mood.js +20 -15
  3. package/lib/components/Feedback/Rating.d.ts +2 -2
  4. package/lib/components/Feedback/Rating.js +6 -6
  5. package/lib/components/Feedback/Scale.d.ts +2 -2
  6. package/lib/components/Feedback/Scale.js +6 -6
  7. package/lib/components/Feedback/Sentiment.d.ts +2 -2
  8. package/lib/components/Feedback/Sentiment.js +6 -6
  9. package/lib/components/Search/SearchDialog.js +17 -11
  10. package/lib/components/Search/SearchFilter.d.ts +3 -2
  11. package/lib/components/Search/SearchFilter.js +2 -2
  12. package/lib/components/Search/SearchFilterField.d.ts +3 -2
  13. package/lib/components/Search/SearchFilterField.js +2 -2
  14. package/lib/components/Search/SearchGroups.d.ts +5 -4
  15. package/lib/components/Search/SearchGroups.js +3 -3
  16. package/lib/components/Search/variables.js +4 -0
  17. package/lib/components/Segmented/Segmented.d.ts +4 -4
  18. package/lib/components/Segmented/Segmented.js +4 -7
  19. package/lib/components/Tag/Tag.d.ts +1 -0
  20. package/lib/components/Tag/Tag.js +3 -2
  21. package/lib/core/hooks/__mocks__/search/use-search-filter.d.ts +1 -1
  22. package/lib/core/hooks/__mocks__/search/use-search-filter.js +1 -1
  23. package/lib/core/hooks/code-walkthrough/use-code-walkthrough-controls.d.ts +1 -1
  24. package/lib/core/hooks/code-walkthrough/use-code-walkthrough-controls.js +10 -5
  25. package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.d.ts +1 -2
  26. package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.js +20 -15
  27. package/lib/core/hooks/code-walkthrough/use-code-walkthrough.d.ts +2 -7
  28. package/lib/core/hooks/code-walkthrough/use-code-walkthrough.js +10 -3
  29. package/lib/core/hooks/code-walkthrough/use-renderable-files.d.ts +9 -0
  30. package/lib/core/hooks/code-walkthrough/use-renderable-files.js +28 -0
  31. package/lib/core/hooks/index.d.ts +1 -0
  32. package/lib/core/hooks/index.js +1 -0
  33. package/lib/core/hooks/search/use-search-filter.d.ts +2 -2
  34. package/lib/core/hooks/search/use-search-filter.js +5 -5
  35. package/lib/core/types/hooks.d.ts +1 -0
  36. package/lib/core/types/l10n.d.ts +1 -1
  37. package/lib/core/types/search.d.ts +1 -2
  38. package/lib/core/utils/download-code-walkthrough.js +9 -1
  39. package/lib/core/utils/find-closest-common-directory.d.ts +6 -0
  40. package/lib/core/utils/find-closest-common-directory.js +51 -0
  41. package/lib/core/utils/get-file-icon.js +6 -0
  42. package/lib/core/utils/index.d.ts +1 -0
  43. package/lib/core/utils/index.js +1 -0
  44. package/lib/core/utils/replace-inputs-with-value.d.ts +1 -1
  45. package/lib/core/utils/replace-inputs-with-value.js +9 -10
  46. package/lib/icons/DocumentJavaIcon/DocumentJavaIcon.d.ts +9 -0
  47. package/lib/icons/DocumentJavaIcon/DocumentJavaIcon.js +22 -0
  48. package/lib/icons/DocumentJavaIcon/index.d.ts +1 -0
  49. package/lib/icons/DocumentJavaIcon/index.js +6 -0
  50. package/lib/icons/DocumentPythonIcon/DocumentPythonIcon.d.ts +9 -0
  51. package/lib/icons/DocumentPythonIcon/DocumentPythonIcon.js +23 -0
  52. package/lib/icons/DocumentPythonIcon/index.d.ts +1 -0
  53. package/lib/icons/DocumentPythonIcon/index.js +6 -0
  54. package/lib/icons/DocumentShellIcon/DocumentShellIcon.d.ts +9 -0
  55. package/lib/icons/DocumentShellIcon/DocumentShellIcon.js +22 -0
  56. package/lib/icons/DocumentShellIcon/index.d.ts +1 -0
  57. package/lib/icons/DocumentShellIcon/index.js +6 -0
  58. package/lib/icons/__tests__/IconTestUtils.d.ts +7 -0
  59. package/lib/icons/__tests__/IconTestUtils.js +33 -0
  60. package/lib/layouts/CodeWalkthroughLayout.js +4 -1
  61. package/lib/markdoc/components/CodeWalkthrough/CodeContainer.js +1 -1
  62. package/lib/markdoc/components/CodeWalkthrough/CodeFilters.js +15 -2
  63. package/lib/markdoc/components/CodeWalkthrough/CodePanel.js +1 -1
  64. package/lib/markdoc/components/CodeWalkthrough/CodePanelHeader.js +29 -23
  65. package/lib/markdoc/components/CodeWalkthrough/CodePanelPreview.js +1 -1
  66. package/lib/markdoc/components/CodeWalkthrough/CodePanelToolbar.js +1 -1
  67. package/lib/markdoc/components/CodeWalkthrough/CodeStep.js +6 -3
  68. package/lib/markdoc/components/CodeWalkthrough/CodeToggle.js +1 -1
  69. package/lib/markdoc/components/CodeWalkthrough/CodeWalkthrough.js +1 -1
  70. package/lib/markdoc/components/CodeWalkthrough/Input.js +4 -2
  71. package/lib/markdoc/tags/code-walkthrough.js +5 -0
  72. package/package.json +3 -3
  73. package/src/components/Feedback/Mood.tsx +25 -17
  74. package/src/components/Feedback/Rating.tsx +9 -10
  75. package/src/components/Feedback/Scale.tsx +9 -10
  76. package/src/components/Feedback/Sentiment.tsx +9 -10
  77. package/src/components/Search/SearchDialog.tsx +63 -42
  78. package/src/components/Search/SearchFilter.tsx +6 -3
  79. package/src/components/Search/SearchFilterField.tsx +4 -2
  80. package/src/components/Search/SearchGroups.tsx +13 -8
  81. package/src/components/Search/variables.ts +4 -0
  82. package/src/components/Segmented/Segmented.tsx +10 -10
  83. package/src/components/Tag/Tag.tsx +1 -1
  84. package/src/core/hooks/__mocks__/search/use-search-filter.ts +1 -1
  85. package/src/core/hooks/code-walkthrough/use-code-walkthrough-controls.ts +9 -3
  86. package/src/core/hooks/code-walkthrough/use-code-walkthrough-steps.ts +30 -18
  87. package/src/core/hooks/code-walkthrough/use-code-walkthrough.ts +13 -13
  88. package/src/core/hooks/code-walkthrough/use-renderable-files.ts +51 -0
  89. package/src/core/hooks/index.ts +1 -0
  90. package/src/core/hooks/search/use-search-filter.ts +9 -5
  91. package/src/core/types/hooks.ts +1 -0
  92. package/src/core/types/l10n.ts +5 -3
  93. package/src/core/types/search.ts +1 -2
  94. package/src/core/utils/download-code-walkthrough.ts +14 -2
  95. package/src/core/utils/find-closest-common-directory.ts +51 -0
  96. package/src/core/utils/get-file-icon.ts +7 -0
  97. package/src/core/utils/index.ts +1 -0
  98. package/src/core/utils/replace-inputs-with-value.ts +12 -9
  99. package/src/icons/DocumentJavaIcon/DocumentJavaIcon.tsx +33 -0
  100. package/src/icons/DocumentJavaIcon/index.ts +1 -0
  101. package/src/icons/DocumentPythonIcon/DocumentPythonIcon.tsx +37 -0
  102. package/src/icons/DocumentPythonIcon/index.ts +1 -0
  103. package/src/icons/DocumentShellIcon/DocumentShellIcon.tsx +33 -0
  104. package/src/icons/DocumentShellIcon/index.ts +1 -0
  105. package/src/icons/__tests__/IconTestUtils.tsx +31 -0
  106. package/src/layouts/CodeWalkthroughLayout.tsx +5 -1
  107. package/src/markdoc/components/CodeWalkthrough/CodeContainer.tsx +1 -0
  108. package/src/markdoc/components/CodeWalkthrough/CodeFilters.tsx +19 -3
  109. package/src/markdoc/components/CodeWalkthrough/CodePanel.tsx +1 -1
  110. package/src/markdoc/components/CodeWalkthrough/CodePanelHeader.tsx +64 -47
  111. package/src/markdoc/components/CodeWalkthrough/CodePanelPreview.tsx +1 -1
  112. package/src/markdoc/components/CodeWalkthrough/CodePanelToolbar.tsx +1 -1
  113. package/src/markdoc/components/CodeWalkthrough/CodeStep.tsx +6 -2
  114. package/src/markdoc/components/CodeWalkthrough/CodeToggle.tsx +1 -1
  115. package/src/markdoc/components/CodeWalkthrough/CodeWalkthrough.tsx +4 -1
  116. package/src/markdoc/components/CodeWalkthrough/Input.tsx +4 -2
  117. package/src/markdoc/tags/code-walkthrough.ts +5 -0
@@ -1,4 +1,4 @@
1
- import type { AnonymousUserEmailSettings, ReasonsSettingsSchema } from '@redocly/config';
1
+ import type { OptionalEmailSettings, ReasonsSettingsSchema } from '@redocly/config';
2
2
  export declare enum MOOD_STATES {
3
3
  SATISFIED = "satisfied",
4
4
  NEUTRAL = "neutral",
@@ -25,7 +25,7 @@ export type MoodProps = {
25
25
  neutral?: ReasonsSettingsSchema;
26
26
  dissatisfied?: ReasonsSettingsSchema;
27
27
  };
28
- anonymousUserEmail?: AnonymousUserEmailSettings;
28
+ optionalEmail?: OptionalEmailSettings;
29
29
  };
30
30
  className?: string;
31
31
  };
@@ -22,15 +22,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
25
  Object.defineProperty(exports, "__esModule", { value: true });
29
26
  exports.MOOD_STATES = void 0;
30
27
  exports.Mood = Mood;
31
28
  const React = __importStar(require("react"));
32
29
  const react_1 = require("react");
33
- const styled_components_1 = __importDefault(require("styled-components"));
30
+ const styled_components_1 = __importStar(require("styled-components"));
34
31
  const Reasons_1 = require("../../components/Feedback/Reasons");
35
32
  const hooks_1 = require("../../core/hooks");
36
33
  const RadioCheckButtonIcon_1 = require("../../icons/RadioCheckButtonIcon/RadioCheckButtonIcon");
@@ -46,7 +43,7 @@ var MOOD_STATES;
46
43
  MOOD_STATES["DISSATISFIED"] = "dissatisfied";
47
44
  })(MOOD_STATES || (exports.MOOD_STATES = MOOD_STATES = {}));
48
45
  function Mood({ settings, onSubmit, className }) {
49
- const { label, submitText, comment: commentSettings, reasons: reasonsSettings, anonymousUserEmail: anonymousUserEmailSettings, } = settings || {};
46
+ const { label, submitText, comment: commentSettings, reasons: reasonsSettings, optionalEmail: optionalEmailSettings, } = settings || {};
50
47
  const [score, setScore] = React.useState('');
51
48
  const [isSubmitted, setIsSubmitted] = React.useState(false);
52
49
  const [comment, setComment] = React.useState('');
@@ -109,7 +106,7 @@ function Mood({ settings, onSubmit, className }) {
109
106
  const displayReasons = checkIfShouldDisplayReasons(score);
110
107
  const displayComment = !!(score && !(commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.hide));
111
108
  const displaySubmitBnt = !!(score && (displayReasons || displayComment));
112
- const displayFeedbackEmail = !!score && (anonymousUserEmailSettings === null || anonymousUserEmailSettings === void 0 ? void 0 : anonymousUserEmailSettings.enabled) && !userData.isAuthenticated;
109
+ const displayFeedbackEmail = !!score && !(optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.hide) && !userData.isAuthenticated;
113
110
  const onSubmitMoodForm = () => {
114
111
  onSubmit({
115
112
  score: remapScore(score),
@@ -134,14 +131,14 @@ function Mood({ settings, onSubmit, className }) {
134
131
  if (isSubmitted) {
135
132
  return (React.createElement(MoodWrapper, { "data-component-name": "Feedback/Mood" },
136
133
  React.createElement(StyledFormMandatoryFields, null,
137
- React.createElement(Label, { "data-translation-key": "feedback.settings.submitText" }, submitText ||
134
+ React.createElement(Label, { standAlone: true, "data-translation-key": "feedback.settings.submitText" }, submitText ||
138
135
  translate('feedback.settings.submitText', 'Thank you for helping improve our documentation!')),
139
136
  React.createElement(RadioCheckButtonIcon_1.RadioCheckButtonIcon, null))));
140
137
  }
141
138
  return (React.createElement(MoodWrapper, { "data-component-name": "Feedback/Mood", className: className },
142
139
  React.createElement(StyledForm, { onSubmit: onSubmitMoodForm },
143
140
  React.createElement(StyledFormMandatoryFields, null,
144
- React.createElement(Label, { "data-translation-key": "feedback.settings.label" }, label || translate('feedback.settings.label', 'Was this helpful?')),
141
+ React.createElement(Label, { standAlone: true, "data-translation-key": "feedback.settings.label" }, label || translate('feedback.settings.label', 'Was this helpful?')),
145
142
  React.createElement(StyledMandatoryFieldContainer, null,
146
143
  React.createElement(Button_1.Button, { "aria-label": MOOD_STATES.DISSATISFIED, type: "button", size: "medium", variant: score === MOOD_STATES.DISSATISFIED ? 'primary' : 'secondary', tone: score === MOOD_STATES.DISSATISFIED ? 'danger' : 'default', onClick: () => {
147
144
  setScore(MOOD_STATES.DISSATISFIED);
@@ -160,10 +157,10 @@ function Mood({ settings, onSubmit, className }) {
160
157
  }, onChange: setReasons })),
161
158
  displayComment && (React.createElement(Comment_1.Comment, { standAlone: false, onSubmit: ({ comment }) => setComment(comment), settings: { label: renderCommentLabel(score) } })))),
162
159
  displayFeedbackEmail && (React.createElement(StyledFormOptionalFields, null,
163
- React.createElement(Label, { "data-translation-key": "feedback.settings.anonymousUserEmail.label" }, (anonymousUserEmailSettings === null || anonymousUserEmailSettings === void 0 ? void 0 : anonymousUserEmailSettings.label) ||
164
- translate('feedback.settings.anonymousUserEmail.label', 'Your email (optional, for follow-up)')),
165
- React.createElement(EmailInput, { onChange: onEmailChange, placeholder: (anonymousUserEmailSettings === null || anonymousUserEmailSettings === void 0 ? void 0 : anonymousUserEmailSettings.placeholder) ||
166
- translate('feedback.settings.anonymousUserEmail.placeholder', 'username@mail.com'), type: "email", required: !!email }))),
160
+ React.createElement(Label, { "data-translation-key": "feedback.settings.optionalEmail.label" }, (optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.label) ||
161
+ translate('feedback.settings.optionalEmail.label', 'Your email (optional, for follow-up)')),
162
+ React.createElement(EmailInput, { onChange: onEmailChange, placeholder: (optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.placeholder) ||
163
+ translate('feedback.settings.optionalEmail.placeholder', 'yourname@example.com'), type: "email", required: !!email }))),
167
164
  displaySubmitBnt && (React.createElement(ButtonsContainer, null,
168
165
  React.createElement(Button_1.Button, { onClick: onCancelMoodForm, variant: "text", size: "small" }, "Cancel"),
169
166
  React.createElement(Button_1.Button, { type: "submit", variant: "secondary", size: "small" }, "Submit"))))));
@@ -189,9 +186,17 @@ const MoodWrapper = styled_components_1.default.div `
189
186
  const Label = styled_components_1.default.h4 `
190
187
  font-family: var(--feedback-font-family);
191
188
  font-weight: var(--font-weight-regular);
192
- font-size: var(--feedback-header-font-size);
193
- line-height: var(--feedback-header-line-height);
194
- color: var(--feedback-header-text-color);
189
+ font-size: var(--feedback-font-size);
190
+ line-height: var(--feedback-line-height);
191
+ color: var(--feedback-text-color);
192
+
193
+ ${({ standAlone = false }) => standAlone &&
194
+ (0, styled_components_1.css) `
195
+ font-size: var(--feedback-header-font-size);
196
+ line-height: var(--feedback-header-line-height);
197
+ color: var(--feedback-header-text-color);
198
+ `}
199
+
195
200
  margin: 0;
196
201
  `;
197
202
  const ButtonsContainer = styled_components_1.default.div `
@@ -1,4 +1,4 @@
1
- import type { AnonymousUserEmailSettings } from '@redocly/config';
1
+ import type { OptionalEmailSettings } from '@redocly/config';
2
2
  export declare const FEEDBACK_MAX_RATING = 5;
3
3
  export type RatingProps = {
4
4
  onSubmit: (value: {
@@ -21,7 +21,7 @@ export type RatingProps = {
21
21
  component?: string;
22
22
  items: string[];
23
23
  };
24
- anonymousUserEmail?: AnonymousUserEmailSettings;
24
+ optionalEmail?: OptionalEmailSettings;
25
25
  };
26
26
  className?: string;
27
27
  };
@@ -39,7 +39,7 @@ const Stars_1 = require("../../components/Feedback/Stars");
39
39
  const Button_1 = require("../../components/Button/Button");
40
40
  exports.FEEDBACK_MAX_RATING = 5;
41
41
  function Rating({ settings, onSubmit, className }) {
42
- const { label, submitText, comment: commentSettings, reasons: reasonsSettings, anonymousUserEmail: anonymousUserEmailSettings, } = settings || {};
42
+ const { label, submitText, comment: commentSettings, reasons: reasonsSettings, optionalEmail: optionalEmailSettings, } = settings || {};
43
43
  const [isSubmitted, setIsSubmitted] = React.useState(false);
44
44
  const [score, setScore] = React.useState(0);
45
45
  const [reasons, setReasons] = React.useState([]);
@@ -71,7 +71,7 @@ function Rating({ settings, onSubmit, className }) {
71
71
  const displayReasons = !!(score && reasonsSettings && !reasonsSettings.hide);
72
72
  const displayComment = !!(score && !(commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.hide));
73
73
  const displaySubmitBnt = !!(score && (displayReasons || displayComment));
74
- const displayFeedbackEmail = !!score && (anonymousUserEmailSettings === null || anonymousUserEmailSettings === void 0 ? void 0 : anonymousUserEmailSettings.enabled) && !userData.isAuthenticated;
74
+ const displayFeedbackEmail = !!score && !(optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.hide) && !userData.isAuthenticated;
75
75
  (0, react_1.useEffect)(() => {
76
76
  if (score && !displayComment && !displayReasons && !displayFeedbackEmail) {
77
77
  onSubmitRatingForm();
@@ -102,10 +102,10 @@ function Rating({ settings, onSubmit, className }) {
102
102
  translate('feedback.settings.comment.label', 'Please share your feedback with us.'),
103
103
  } })))),
104
104
  displayFeedbackEmail && (React.createElement(StyledFormOptionalFields, null,
105
- React.createElement(Label, { "data-translation-key": "feedback.settings.anonymousUserEmail.label" }, (anonymousUserEmailSettings === null || anonymousUserEmailSettings === void 0 ? void 0 : anonymousUserEmailSettings.label) ||
106
- translate('feedback.settings.anonymousUserEmail.label', 'Your email (optional, for follow-up)')),
107
- React.createElement(EmailInput, { onChange: onEmailChange, placeholder: (anonymousUserEmailSettings === null || anonymousUserEmailSettings === void 0 ? void 0 : anonymousUserEmailSettings.placeholder) ||
108
- translate('feedback.settings.anonymousUserEmail.placeholder', 'username@mail.com'), type: "email", required: !!email }))),
105
+ React.createElement(Label, { "data-translation-key": "feedback.settings.optionalEmail.label" }, (optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.label) ||
106
+ translate('feedback.settings.optionalEmail.label', 'Your email (optional, for follow-up)')),
107
+ React.createElement(EmailInput, { onChange: onEmailChange, placeholder: (optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.placeholder) ||
108
+ translate('feedback.settings.optionalEmail.placeholder', 'yourname@example.com'), type: "email", required: !!email }))),
109
109
  displaySubmitBnt && (React.createElement(ButtonsContainer, null,
110
110
  React.createElement(Button_1.Button, { onClick: onCancelRatingForm, variant: "text", size: "small" }, "Cancel"),
111
111
  React.createElement(Button_1.Button, { onClick: onSubmitRatingForm, variant: "secondary", size: "small" }, "Submit"))))));
@@ -1,4 +1,4 @@
1
- import type { AnonymousUserEmailSettings } from '@redocly/config';
1
+ import type { OptionalEmailSettings } from '@redocly/config';
2
2
  export declare const MAX_SCALE = 10;
3
3
  export type ScaleProps = {
4
4
  onSubmit: (value: {
@@ -23,7 +23,7 @@ export type ScaleProps = {
23
23
  component?: string;
24
24
  items: string[];
25
25
  };
26
- anonymousUserEmail?: AnonymousUserEmailSettings;
26
+ optionalEmail?: OptionalEmailSettings;
27
27
  };
28
28
  className?: string;
29
29
  };
@@ -39,7 +39,7 @@ const Reasons_1 = require("../../components/Feedback/Reasons");
39
39
  const Button_1 = require("../../components/Button/Button");
40
40
  exports.MAX_SCALE = 10;
41
41
  function Scale({ settings, onSubmit, className }) {
42
- const { label, submitText, leftScaleLabel, rightScaleLabel, comment: commentSettings, reasons: reasonsSettings, anonymousUserEmail: anonymousUserEmailSettings, } = settings || {};
42
+ const { label, submitText, leftScaleLabel, rightScaleLabel, comment: commentSettings, reasons: reasonsSettings, optionalEmail: optionalEmailSettings, } = settings || {};
43
43
  const [score, setScore] = React.useState(0);
44
44
  const [isSubmitted, setIsSubmitted] = React.useState(false);
45
45
  const [comment, setComment] = React.useState('');
@@ -59,7 +59,7 @@ function Scale({ settings, onSubmit, className }) {
59
59
  const displayReasons = !!score && reasonsSettings && !reasonsSettings.hide;
60
60
  const displayComment = !!(score && !(commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.hide));
61
61
  const displaySubmitBnt = !!score && (displayReasons || displayComment);
62
- const displayFeedbackEmail = !!score && (anonymousUserEmailSettings === null || anonymousUserEmailSettings === void 0 ? void 0 : anonymousUserEmailSettings.enabled) && !userData.isAuthenticated;
62
+ const displayFeedbackEmail = !!score && !(optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.hide) && !userData.isAuthenticated;
63
63
  const handleCancel = () => {
64
64
  setScore(0);
65
65
  setComment('');
@@ -109,10 +109,10 @@ function Scale({ settings, onSubmit, className }) {
109
109
  translate('feedback.settings.comment.label', 'Please share your feedback with us.'),
110
110
  } }))),
111
111
  displayFeedbackEmail && (React.createElement(StyledFormOptionalFields, null,
112
- React.createElement(Label, { "data-translation-key": "feedback.settings.anonymousUserEmail.label" }, (anonymousUserEmailSettings === null || anonymousUserEmailSettings === void 0 ? void 0 : anonymousUserEmailSettings.label) ||
113
- translate('feedback.settings.anonymousUserEmail.label', 'Your email (optional, for follow-up)')),
114
- React.createElement(EmailInput, { onChange: onEmailChange, placeholder: (anonymousUserEmailSettings === null || anonymousUserEmailSettings === void 0 ? void 0 : anonymousUserEmailSettings.placeholder) ||
115
- translate('feedback.settings.anonymousUserEmail.placeholder', 'username@mail.com'), type: "email", required: !!email }))),
112
+ React.createElement(Label, { "data-translation-key": "feedback.settings.optionalEmail.label" }, (optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.label) ||
113
+ translate('feedback.settings.optionalEmail.label', 'Your email (optional, for follow-up)')),
114
+ React.createElement(EmailInput, { onChange: onEmailChange, placeholder: (optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.placeholder) ||
115
+ translate('feedback.settings.optionalEmail.placeholder', 'yourname@example.com'), type: "email", required: !!email }))),
116
116
  displaySubmitBnt && (React.createElement(ButtonsContainer, null,
117
117
  React.createElement(Button_1.Button, { "data-translation-key": "feedback.settings.comment.cancel", onClick: handleCancel, variant: "text", size: "small" }, translate('feedback.settings.comment.cancel', 'Cancel')),
118
118
  React.createElement(Button_1.Button, { "data-translation-key": "feedback.settings.scale.send", type: "submit", variant: "secondary", size: "small" }, translate('feedback.settings.scale.send', 'Submit')))))));
@@ -1,4 +1,4 @@
1
- import type { ReasonsSettingsSchema, AnonymousUserEmailSettings } from '@redocly/config';
1
+ import type { OptionalEmailSettings, ReasonsSettingsSchema } from '@redocly/config';
2
2
  export type SentimentProps = {
3
3
  onSubmit: (value: {
4
4
  score: number;
@@ -18,7 +18,7 @@ export type SentimentProps = {
18
18
  like?: ReasonsSettingsSchema;
19
19
  dislike?: ReasonsSettingsSchema;
20
20
  };
21
- anonymousUserEmail?: AnonymousUserEmailSettings;
21
+ optionalEmail?: OptionalEmailSettings;
22
22
  };
23
23
  className?: string;
24
24
  };
@@ -38,7 +38,7 @@ const Button_1 = require("../../components/Button/Button");
38
38
  const ThumbDownIcon_1 = require("../../icons/ThumbDownIcon/ThumbDownIcon");
39
39
  const ThumbUpIcon_1 = require("../../icons/ThumbUpIcon/ThumbUpIcon");
40
40
  function Sentiment({ settings, onSubmit, className }) {
41
- const { label, submitText, comment: commentSettings, reasons: reasonsSettings, anonymousUserEmail: anonymousUserEmailSettings, } = settings || {};
41
+ const { label, submitText, comment: commentSettings, reasons: reasonsSettings, optionalEmail: optionalEmailSettings, } = settings || {};
42
42
  const [isSubmitted, setIsSubmitted] = React.useState(false);
43
43
  const [score, setScore] = React.useState(0);
44
44
  const [comment, setComment] = React.useState('');
@@ -74,7 +74,7 @@ function Sentiment({ settings, onSubmit, className }) {
74
74
  const displayReasons = checkIfShouldDisplayReasons(score);
75
75
  const displayComment = !!(score && !(commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.hide));
76
76
  const displaySubmitBnt = !!(score && (displayReasons || displayComment));
77
- const displayFeedbackEmail = !!score && (anonymousUserEmailSettings === null || anonymousUserEmailSettings === void 0 ? void 0 : anonymousUserEmailSettings.enabled) && !userData.isAuthenticated;
77
+ const displayFeedbackEmail = !!score && !(optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.hide) && !userData.isAuthenticated;
78
78
  const commentLabel = score === 1
79
79
  ? (commentSettings && commentSettings.likeLabel) ||
80
80
  translate('feedback.settings.comment.likeLabel', 'What was most helpful?')
@@ -141,10 +141,10 @@ function Sentiment({ settings, onSubmit, className }) {
141
141
  }, onChange: setReasons })),
142
142
  displayComment && (React.createElement(Comment_1.Comment, { standAlone: false, onSubmit: ({ comment }) => setComment(comment), settings: { label: commentLabel } })))),
143
143
  displayFeedbackEmail && (React.createElement(StyledFormOptionalFields, null,
144
- React.createElement(Label, { "data-translation-key": "feedback.settings.anonymousUserEmail.label" }, (anonymousUserEmailSettings === null || anonymousUserEmailSettings === void 0 ? void 0 : anonymousUserEmailSettings.label) ||
145
- translate('feedback.settings.anonymousUserEmail.label', 'Your email (optional, for follow-up)')),
146
- React.createElement(EmailInput, { onChange: onEmailChange, placeholder: (anonymousUserEmailSettings === null || anonymousUserEmailSettings === void 0 ? void 0 : anonymousUserEmailSettings.placeholder) ||
147
- translate('feedback.settings.anonymousUserEmail.placeholder', 'username@mail.com'), type: "email", required: !!email }))),
144
+ React.createElement(Label, { "data-translation-key": "feedback.settings.optionalEmail.label" }, (optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.label) ||
145
+ translate('feedback.settings.optionalEmail.label', 'Your email (optional, for follow-up)')),
146
+ React.createElement(EmailInput, { onChange: onEmailChange, placeholder: (optionalEmailSettings === null || optionalEmailSettings === void 0 ? void 0 : optionalEmailSettings.placeholder) ||
147
+ translate('feedback.settings.optionalEmail.placeholder', 'yourname@example.com'), type: "email", required: !!email }))),
148
148
  displaySubmitBnt && (React.createElement(ButtonsContainer, null,
149
149
  React.createElement(Button_1.Button, { onClick: onCancelSentimentForm, variant: "text", size: "small" }, "Cancel"),
150
150
  React.createElement(Button_1.Button, { onClick: onSubmitSentimentForm, variant: "secondary", size: "small" }, "Submit"))))));
@@ -52,8 +52,8 @@ function SearchDialog({ onClose, className }) {
52
52
  const [product, setProduct] = (0, react_1.useState)(currentProduct);
53
53
  const [mode, setMode] = (0, react_1.useState)('search');
54
54
  const autoSearchDisabled = mode !== 'search';
55
- const { query, setQuery, filter, setFilter, items, isSearchLoading, facets, setLoadMore, advancedSearch, askAi, } = useSearch(product === null || product === void 0 ? void 0 : product.name, autoSearchDisabled);
56
- const { isFilterOpen, onFilterToggle, onFilterChange, onFilterReset, onFacetReset, onTopFacetsReset, } = (0, hooks_1.useSearchFilter)(filter, setFilter);
55
+ const { query, setQuery, filter, setFilter, items, isSearchLoading, facets, setLoadMore, advancedSearch, askAi, groupField, } = useSearch(product === null || product === void 0 ? void 0 : product.name, autoSearchDisabled);
56
+ const { isFilterOpen, onFilterToggle, onFilterChange, onFilterReset, onFacetReset, onQuickFilterReset, } = (0, hooks_1.useSearchFilter)(filter, setFilter);
57
57
  const aiSearch = useAiSearch({ filter });
58
58
  const modalRef = (0, react_1.useRef)(null);
59
59
  const { translate } = useTranslate();
@@ -80,10 +80,10 @@ function SearchDialog({ onClose, className }) {
80
80
  return react_1.default.createElement(SearchItem_1.SearchItem, { key: `${index}-${item.document.id}`, item: item, product: itemProduct });
81
81
  };
82
82
  const showLoadMore = (groupKey, currentCount = 0) => {
83
- const topFacet = facets.find((facet) => facet.isTop);
83
+ const groupFacet = facets.find((facet) => facet.field === groupField);
84
84
  let needLoadMore = false;
85
- if (topFacet) {
86
- const groupValue = topFacet.values.find((value) => {
85
+ if (groupFacet) {
86
+ const groupValue = groupFacet.values.find((value) => {
87
87
  if (typeof value === 'object') {
88
88
  return value.value === groupKey;
89
89
  }
@@ -120,15 +120,15 @@ function SearchDialog({ onClose, className }) {
120
120
  setQuery('');
121
121
  aiSearch.askQuestion(query);
122
122
  }
123
- } }, translate('search.aiButton', 'Search with AI'))) : null,
123
+ } }, translate('search.ai.button', 'Search with AI'))) : null,
124
124
  showSearchFilterButton && (react_1.default.createElement(SearchFilterToggleButton, { icon: react_1.default.createElement(SettingsIcon_1.SettingsIcon, null), onClick: onFilterToggle }))))),
125
125
  react_1.default.createElement(SearchDialogBody, null, mode === 'search' ? (react_1.default.createElement(react_1.default.Fragment, null,
126
126
  react_1.default.createElement(SearchDialogBodyMainView, null,
127
- react_1.default.createElement(SearchGroups_1.SearchGroups, { facets: facets, searchFilter: filter, onFilterChange: onFilterChange, onTopFacetsReset: onTopFacetsReset }),
127
+ react_1.default.createElement(SearchGroups_1.SearchGroups, { facets: facets, searchFilter: filter, onFilterChange: onFilterChange, onQuickFilterReset: onQuickFilterReset, groupField: groupField }),
128
128
  showResults ? (items && Object.keys(items).some((key) => { var _a; return (_a = items[key]) === null || _a === void 0 ? void 0 : _a.length; }) ? (Object.keys(items).map((key) => {
129
129
  var _a, _b, _c;
130
130
  return ((_a = items[key]) === null || _a === void 0 ? void 0 : _a.length) ? (react_1.default.createElement(react_1.Fragment, { key: key },
131
- react_1.default.createElement(SearchGroupTitle, null, key), (_b = items[key]) === null || _b === void 0 ? void 0 :
131
+ react_1.default.createElement(SearchGroupTitle, { "data-testid": "search-group-title" }, key), (_b = items[key]) === null || _b === void 0 ? void 0 :
132
132
  _b.map(mapItem),
133
133
  showLoadMore(key, ((_c = items[key]) === null || _c === void 0 ? void 0 : _c.length) || 0) && (react_1.default.createElement(SearchGroupFooter, { "data-translation-key": "search.showMore", onClick: () => { var _a; return setLoadMore({ groupKey: key, offset: ((_a = items[key]) === null || _a === void 0 ? void 0 : _a.length) || 0 }); } }, translate('search.showMore', 'Show more'))))) : null;
134
134
  })) : isSearchLoading ? (react_1.default.createElement(SearchMessage, null,
@@ -138,8 +138,8 @@ function SearchDialog({ onClose, className }) {
138
138
  react_1.default.createElement(SearchRecent_1.SearchRecent, { onSelect: setQuery }),
139
139
  react_1.default.createElement(SearchSuggestedPages_1.SearchSuggestedPages, null)))),
140
140
  advancedSearch && mode === 'search' && isFilterOpen && (react_1.default.createElement(SearchDialogBodyFilterView, null,
141
- react_1.default.createElement(SearchFilter_1.SearchFilter, { facets: facets, filter: filter, query: query, onFilterChange: onFilterChange, onFilterReset: onFilterReset, onFacetReset: onFacetReset }))))) : (react_1.default.createElement(SearchAiResponse_1.SearchAiResponse, { question: aiSearch.question, isGeneratingResponse: aiSearch.isGeneratingResponse, response: aiSearch.response, resources: aiSearch.resources }))),
142
- mode === 'search' && (react_1.default.createElement(SearchDialogFooter, null,
141
+ react_1.default.createElement(SearchFilter_1.SearchFilter, { facets: facets, filter: filter, query: query, quickFilterFields: [groupField], onFilterChange: onFilterChange, onFilterReset: onFilterReset, onFacetReset: onFacetReset }))))) : (react_1.default.createElement(SearchAiResponse_1.SearchAiResponse, { question: aiSearch.question, isGeneratingResponse: aiSearch.isGeneratingResponse, response: aiSearch.response, resources: aiSearch.resources }))),
142
+ react_1.default.createElement(SearchDialogFooter, null, mode === 'ai-dialog' ? (react_1.default.createElement(AiDisclaimer, null, translate('search.ai.disclaimer', 'AI search might provide incomplete or incorrect results. Verify important information.'))) : (react_1.default.createElement(react_1.default.Fragment, null,
143
143
  react_1.default.createElement(SearchShortcuts, null,
144
144
  react_1.default.createElement(SearchShortcut_1.SearchShortcut, { "data-translation-key": "search.keys.navigate", combination: "Tab", text: translate('search.keys.navigate', 'to navigate') }),
145
145
  react_1.default.createElement(SearchShortcut_1.SearchShortcut, { "data-translation-key": "search.keys.select", combination: "\u23CE", text: translate('search.keys.select', 'to select') }),
@@ -147,7 +147,7 @@ function SearchDialog({ onClose, className }) {
147
147
  isSearchLoading && (react_1.default.createElement(SearchLoading, null,
148
148
  react_1.default.createElement(SpinnerLoader_1.SpinnerLoader, { size: "16px", color: "var(--search-input-icon-color)" }),
149
149
  translate('search.loading', 'Loading...'))),
150
- react_1.default.createElement(SearchCancelButton, { "data-translation-key": "search.cancel", variant: "secondary", size: "small", onClick: onClose }, translate('search.cancel', 'Cancel')))))));
150
+ react_1.default.createElement(SearchCancelButton, { "data-translation-key": "search.cancel", variant: "secondary", size: "small", onClick: onClose }, translate('search.cancel', 'Cancel'))))))));
151
151
  }
152
152
  const SearchOverlay = styled_components_1.default.div `
153
153
  position: fixed;
@@ -296,4 +296,10 @@ const SearchHeaderButtons = styled_components_1.default.div `
296
296
  padding-left: var(--search-header-buttons-padding-left);
297
297
  border-left: var(--search-header-buttons-border-left);
298
298
  `;
299
+ const AiDisclaimer = styled_components_1.default.div `
300
+ font-size: var(--search-ai-disclaimer-font-size);
301
+ line-height: var(--search-ai-disclaimer-line-height);
302
+ color: var(--search-ai-disclaimer-text-color);
303
+ margin: 0 auto;
304
+ `;
299
305
  //# sourceMappingURL=SearchDialog.js.map
@@ -4,8 +4,9 @@ export type SearchFilterProps = {
4
4
  facets: SearchFacet[];
5
5
  filter: SearchFilterItem[];
6
6
  query: string;
7
- onFilterChange: (field: string, value: string | string[], isTop?: boolean) => void;
7
+ quickFilterFields: string[];
8
+ onFilterChange: (field: string, value: string | string[], isQuickFilter?: boolean) => void;
8
9
  onFilterReset: () => void;
9
10
  onFacetReset: (field: string) => void;
10
11
  };
11
- export declare function SearchFilter({ className, facets, filter, query, onFilterChange, onFilterReset, onFacetReset, }: SearchFilterProps): JSX.Element;
12
+ export declare function SearchFilter({ className, facets, filter, query, quickFilterFields, onFilterChange, onFilterReset, onFacetReset, }: SearchFilterProps): JSX.Element;
@@ -33,14 +33,14 @@ const Button_1 = require("../../components/Button/Button");
33
33
  const CleanIcon_1 = require("../../icons/CleanIcon/CleanIcon");
34
34
  const SearchFilterField_1 = require("../../components/Search/SearchFilterField");
35
35
  const hooks_1 = require("../../core/hooks");
36
- function SearchFilter({ className, facets, filter, query, onFilterChange, onFilterReset, onFacetReset, }) {
36
+ function SearchFilter({ className, facets, filter, query, quickFilterFields, onFilterChange, onFilterReset, onFacetReset, }) {
37
37
  const { useTranslate } = (0, hooks_1.useThemeHooks)();
38
38
  const { translate } = useTranslate();
39
39
  return (React.createElement(SearchFilterWrapper, { "data-component-name": "Search/SearchFilter", className: className },
40
40
  React.createElement(SearchFilterHeader, null,
41
41
  React.createElement("span", { "data-translation-key": "search.filter.title" }, translate('search.filter.title', 'Advanced filter')),
42
42
  React.createElement(Button_1.Button, { "data-translation-key": "search.filter.reset", onClick: onFilterReset, variant: "ghost", icon: React.createElement(CleanIcon_1.CleanIcon, null) }, translate('search.filter.reset', 'Reset filters'))),
43
- React.createElement(SearchFilterFields, null, facets.map((facet, index) => (React.createElement(SearchFilterField_1.SearchFilterField, { key: `${facet.field}-${index}`, facet: facet, onFilterChange: onFilterChange, onFacetReset: onFacetReset, filter: filter, query: query }))))));
43
+ React.createElement(SearchFilterFields, null, facets.map((facet, index) => (React.createElement(SearchFilterField_1.SearchFilterField, { key: `${facet.field}-${index}`, facet: facet, filter: filter, query: query, quickFilterFields: quickFilterFields, onFilterChange: onFilterChange, onFacetReset: onFacetReset }))))));
44
44
  }
45
45
  const SearchFilterWrapper = styled_components_1.default.div `
46
46
  width: var(--search-filter-width);
@@ -4,8 +4,9 @@ type SearchFilterFieldProps = {
4
4
  facet: SearchFacet;
5
5
  filter: SearchFilterItem[];
6
6
  query: string;
7
- onFilterChange: (field: string, value: string | string[], isTop?: boolean) => void;
7
+ quickFilterFields: string[];
8
+ onFilterChange: (field: string, value: string | string[], isQuickFilter?: boolean) => void;
8
9
  onFacetReset: (filed: string) => void;
9
10
  };
10
- export declare function SearchFilterField({ className, facet, filter, query, onFilterChange, onFacetReset, }: SearchFilterFieldProps): JSX.Element;
11
+ export declare function SearchFilterField({ className, facet, filter, query, quickFilterFields, onFilterChange, onFacetReset, }: SearchFilterFieldProps): JSX.Element;
11
12
  export {};
@@ -11,13 +11,13 @@ const ResetIcon_1 = require("../../icons/ResetIcon/ResetIcon");
11
11
  const hooks_1 = require("../../core/hooks");
12
12
  const SearchFilterFieldSelect_1 = require("../../components/Search/FilterFields/SearchFilterFieldSelect");
13
13
  const SearchFilterFieldTags_1 = require("../../components/Search/FilterFields/SearchFilterFieldTags");
14
- function SearchFilterField({ className, facet, filter, query, onFilterChange, onFacetReset, }) {
14
+ function SearchFilterField({ className, facet, filter, query, quickFilterFields, onFilterChange, onFacetReset, }) {
15
15
  var _a;
16
16
  const { useTranslate } = (0, hooks_1.useThemeHooks)();
17
17
  const { translate } = useTranslate();
18
18
  const selectedValues = ((_a = filter.find((item) => item.field === facet.field)) === null || _a === void 0 ? void 0 : _a.values) || [];
19
19
  const onChange = (value) => {
20
- onFilterChange(facet.field, value, facet.isTop);
20
+ onFilterChange(facet.field, value, facet.field in quickFilterFields);
21
21
  };
22
22
  const onReset = () => {
23
23
  onFacetReset(facet.field);
@@ -1,9 +1,10 @@
1
- import type { SearchFacet, SearchFilterItem } from '../../index.js';
1
+ import { type SearchFacet, type SearchFilterItem } from '../../core/types';
2
2
  type SearchGroupsProps = {
3
3
  facets: SearchFacet[];
4
4
  searchFilter: SearchFilterItem[];
5
- onFilterChange: (field: string, value: string[], isTop?: boolean) => void;
6
- onTopFacetsReset: () => void;
5
+ groupField: string;
6
+ onFilterChange: (field: string, value: string[], isQuickFilter?: boolean) => void;
7
+ onQuickFilterReset: () => void;
7
8
  };
8
- export declare function SearchGroups({ facets, searchFilter, onFilterChange, onTopFacetsReset, }: SearchGroupsProps): JSX.Element;
9
+ export declare function SearchGroups({ facets, searchFilter, groupField, onFilterChange, onQuickFilterReset, }: SearchGroupsProps): JSX.Element;
9
10
  export {};
@@ -30,8 +30,8 @@ exports.SearchGroups = SearchGroups;
30
30
  const React = __importStar(require("react"));
31
31
  const styled_components_1 = __importDefault(require("styled-components"));
32
32
  const Tag_1 = require("../../components/Tag/Tag");
33
- function SearchGroups({ facets, searchFilter, onFilterChange, onTopFacetsReset, }) {
34
- const groupFacets = facets.filter((facet) => facet.isTop);
33
+ function SearchGroups({ facets, searchFilter, groupField, onFilterChange, onQuickFilterReset, }) {
34
+ const groupFacets = facets.filter((facet) => facet.field === groupField);
35
35
  const handleGroupTagClick = (value, fieldId, active, currentValues) => {
36
36
  const values = active
37
37
  ? currentValues.filter((item) => item !== value)
@@ -39,7 +39,7 @@ function SearchGroups({ facets, searchFilter, onFilterChange, onTopFacetsReset,
39
39
  onFilterChange(fieldId, values, true);
40
40
  };
41
41
  return (React.createElement(SearchGroupsWrapper, null,
42
- React.createElement(GroupTag, { borderless: true, active: !searchFilter.some((item) => item.isTop), onClick: () => searchFilter.some((item) => item.isTop) && onTopFacetsReset() }, "All"),
42
+ React.createElement(GroupTag, { borderless: true, active: !searchFilter.some((item) => item.isQuickFilter), onClick: () => searchFilter.some((item) => item.isQuickFilter) && onQuickFilterReset() }, "All"),
43
43
  React.createElement(Divider, null),
44
44
  groupFacets.flatMap((facet) => facet.values.map((facetCount, index) => {
45
45
  var _a;
@@ -178,6 +178,10 @@ exports.search = (0, styled_components_1.css) `
178
178
  --search-ai-resource-tag-text-color: var(--text-color-secondary);
179
179
  --search-ai-resource-tag-icon-color: var(--text-color-secondary);
180
180
 
181
+ --search-ai-disclaimer-font-size: var(--font-size-sm);
182
+ --search-ai-disclaimer-line-height: var(--line-height-sm);
183
+ --search-ai-disclaimer-text-color: var(--text-color-secondary);
184
+
181
185
  // @tokens End
182
186
  `;
183
187
  //# sourceMappingURL=variables.js.map
@@ -1,4 +1,4 @@
1
- import type { ReactElement } from 'react';
1
+ import type { ForwardedRef, ReactElement } from 'react';
2
2
  import type { SelectOption } from '../../core/types/select';
3
3
  export type SegmentedProps<T> = {
4
4
  options: SelectOption<T>[];
@@ -7,6 +7,6 @@ export type SegmentedProps<T> = {
7
7
  className?: string;
8
8
  size?: 'regular' | 'small';
9
9
  };
10
- declare function SegmentedComponent<T>({ options, onChange, value, className, size, }: SegmentedProps<T>): ReactElement;
11
- export declare const Segmented: typeof SegmentedComponent;
12
- export {};
10
+ export declare const Segmented: <T>(props: SegmentedProps<T> & {
11
+ ref?: ForwardedRef<HTMLDivElement>;
12
+ }) => ReactElement;
@@ -22,18 +22,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
25
  Object.defineProperty(exports, "__esModule", { value: true });
29
26
  exports.Segmented = void 0;
30
- const react_1 = __importDefault(require("react"));
27
+ const react_1 = __importStar(require("react"));
31
28
  const styled_components_1 = __importStar(require("styled-components"));
32
29
  const typedMemo_1 = require("../../core/hoc/typedMemo");
33
- function SegmentedComponent({ options, onChange, value, className = '', size = 'regular', }) {
34
- return (react_1.default.createElement(SegmentedGroup, { "data-component-name": "Segmented/Segmented", className: `tag-grey ${size} ${className}`, role: "tablist" }, options.map((opt) => (react_1.default.createElement(SegmentedItem, { key: opt.label, role: "tab", title: opt.label, onClick: () => onChange(opt), "$isActive": value == opt.value, "$size": size }, opt.label)))));
30
+ function SegmentedComponent({ options, onChange, value, className = '', size = 'regular' }, ref) {
31
+ return (react_1.default.createElement(SegmentedGroup, { ref: ref, "data-component-name": "Segmented/Segmented", className: `tag-grey ${size} ${className}`, role: "tablist" }, options.map((opt) => (react_1.default.createElement(SegmentedItem, { key: opt.label, role: "tab", title: opt.label, onClick: () => onChange(opt), "$isActive": value == opt.value, "$size": size }, opt.label)))));
35
32
  }
36
- exports.Segmented = (0, typedMemo_1.typedMemo)(SegmentedComponent);
33
+ exports.Segmented = (0, typedMemo_1.typedMemo)((0, react_1.forwardRef)(SegmentedComponent));
37
34
  const SegmentedGroup = styled_components_1.default.div `
38
35
  display: flex;
39
36
  background: var(--segmented-buttons-bg-color-main);
@@ -21,4 +21,5 @@ export type TagProps = {
21
21
  onClose?: (event: React.MouseEvent) => void;
22
22
  };
23
23
  export declare function Tag({ children, color, icon, active, closable, onClick, onClose, size, borderless, withStatusDot, statusDotColor, ...otherProps }: TagProps): JSX.Element;
24
+ export declare const ContentWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
24
25
  export {};
@@ -14,6 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.ContentWrapper = void 0;
17
18
  exports.Tag = Tag;
18
19
  const react_1 = __importDefault(require("react"));
19
20
  const styled_components_1 = __importDefault(require("styled-components"));
@@ -23,14 +24,14 @@ function Tag(_a) {
23
24
  var { children, color, icon, active, closable, onClick, onClose, size, borderless, withStatusDot, statusDotColor = 'var(--tag-status-dot-color-default)' } = _a, otherProps = __rest(_a, ["children", "color", "icon", "active", "closable", "onClick", "onClose", "size", "borderless", "withStatusDot", "statusDotColor"]);
24
25
  return (react_1.default.createElement(TagWrapper, Object.assign({ "data-component-name": "Tag/Tag", borderless: borderless, color: color, size: size, onClick: onClick, hasCloseButton: closable }, otherProps),
25
26
  withStatusDot ? react_1.default.createElement(StatusDot, { color: statusDotColor }) : icon ? icon : null,
26
- react_1.default.createElement(ContentWrapper, null, children),
27
+ react_1.default.createElement(exports.ContentWrapper, null, children),
27
28
  closable && (react_1.default.createElement(CloseButton, { onClick: (event) => {
28
29
  onClose === null || onClose === void 0 ? void 0 : onClose(event);
29
30
  } },
30
31
  react_1.default.createElement(CloseIcon_1.CloseIcon, null))),
31
32
  active && react_1.default.createElement(ActiveIcon, null)));
32
33
  }
33
- const ContentWrapper = styled_components_1.default.div `
34
+ exports.ContentWrapper = styled_components_1.default.div `
34
35
  display: inline-flex;
35
36
  align-items: center;
36
37
  justify-content: center;
@@ -4,5 +4,5 @@ export declare const useSearchFilter: jest.Mock<{
4
4
  onFilterChange: () => void;
5
5
  onFilterToggle: () => void;
6
6
  onFilterReset: () => void;
7
- onTopFacetsReset: () => void;
7
+ onQuickFilterReset: () => void;
8
8
  }, [], any>;
@@ -8,7 +8,7 @@ exports.useSearchFilter = jest.fn(() => {
8
8
  onFilterChange: () => { },
9
9
  onFilterToggle: () => { },
10
10
  onFilterReset: () => { },
11
- onTopFacetsReset: () => { },
11
+ onQuickFilterReset: () => { },
12
12
  };
13
13
  });
14
14
  //# sourceMappingURL=use-search-filter.js.map
@@ -19,4 +19,4 @@ export type WalkthroughControlsState = {
19
19
  getFileText: (file: CodeWalkthroughFile) => string;
20
20
  populateInputsWithValue: (node: string) => string;
21
21
  };
22
- export declare function useCodeWalkthroughControls(filters: Record<string, CodeWalkthroughFilter>, inputs: InputsMarkdocAttr, toggles: TogglesMarkdocAttr): WalkthroughControlsState;
22
+ export declare function useCodeWalkthroughControls(filters: Record<string, CodeWalkthroughFilter>, inputs: InputsMarkdocAttr, toggles: TogglesMarkdocAttr, enableDeepLink: boolean): WalkthroughControlsState;
@@ -9,14 +9,14 @@ const defaultControlsValues = {
9
9
  toggle: false,
10
10
  filter: '',
11
11
  };
12
- function useCodeWalkthroughControls(filters, inputs, toggles) {
12
+ function useCodeWalkthroughControls(filters, inputs, toggles, enableDeepLink) {
13
13
  const location = (0, react_router_dom_1.useLocation)();
14
14
  const navigate = (0, react_router_dom_1.useNavigate)();
15
15
  const searchParams = (0, react_1.useMemo)(() => new URLSearchParams(location.search), [location.search]);
16
16
  const [togglesState, setTogglesState] = (0, react_1.useState)(() => {
17
17
  const initialState = {};
18
18
  for (const [id, toggle] of Object.entries(toggles)) {
19
- initialState[id] = Object.assign(Object.assign({}, toggle), { render: true, type: 'toggle', value: searchParams.get(id) === 'true' });
19
+ initialState[id] = Object.assign(Object.assign({}, toggle), { render: true, type: 'toggle', value: enableDeepLink ? searchParams.get(id) === 'true' : false });
20
20
  }
21
21
  return initialState;
22
22
  });
@@ -44,9 +44,10 @@ function useCodeWalkthroughControls(filters, inputs, toggles) {
44
44
  }
45
45
  };
46
46
  const [inputsState, setInputsState] = (0, react_1.useState)(() => {
47
+ var _a;
47
48
  const initialState = {};
48
49
  for (const [id, input] of Object.entries(inputs)) {
49
- initialState[id] = Object.assign(Object.assign({}, input), { render: true, type: 'input', value: searchParams.get(id) || input.value });
50
+ initialState[id] = Object.assign(Object.assign({}, input), { render: true, type: 'input', value: enableDeepLink ? ((_a = searchParams.get(id)) !== null && _a !== void 0 ? _a : input.value) : input.value });
50
51
  }
51
52
  return initialState;
52
53
  });
@@ -74,10 +75,11 @@ function useCodeWalkthroughControls(filters, inputs, toggles) {
74
75
  }
75
76
  };
76
77
  const [filtersState, setFiltersState] = (0, react_1.useState)(() => {
77
- var _a, _b;
78
+ var _a, _b, _c;
78
79
  const initialState = {};
79
80
  for (const [id, filter] of Object.entries(filters)) {
80
- initialState[id] = Object.assign(Object.assign({}, filter), { render: true, type: 'filter', value: searchParams.get(id) || ((_b = (_a = filter === null || filter === void 0 ? void 0 : filter.items) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.value) || '' });
81
+ const defaultValue = ((_b = (_a = filter === null || filter === void 0 ? void 0 : filter.items) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.value) || '';
82
+ initialState[id] = Object.assign(Object.assign({}, filter), { render: true, type: 'filter', value: enableDeepLink ? ((_c = searchParams.get(id)) !== null && _c !== void 0 ? _c : defaultValue) : defaultValue });
81
83
  }
82
84
  return initialState;
83
85
  });
@@ -157,6 +159,9 @@ function useCodeWalkthroughControls(filters, inputs, toggles) {
157
159
  * Update the URL search params with the current state of the filters and inputs
158
160
  */
159
161
  (0, react_1.useEffect)(() => {
162
+ if (!enableDeepLink) {
163
+ return;
164
+ }
160
165
  const newSearchParams = new URLSearchParams(Array.from(searchParams.entries()));
161
166
  for (const [id, { value }] of Object.entries(state)) {
162
167
  if (value) {