diff --git a/www/apps/api-reference/providers/search.tsx b/www/apps/api-reference/providers/search.tsx
index 6c07df10e31db..9f0cebeb577f6 100644
--- a/www/apps/api-reference/providers/search.tsx
+++ b/www/apps/api-reference/providers/search.tsx
@@ -4,6 +4,8 @@ import {
usePageLoading,
SearchProvider as UiSearchProvider,
searchFiltersV2,
+ AiAssistantIcon,
+ AiAssistantProvider,
} from "docs-ui"
import { config } from "../config"
import basePathUrl from "../utils/base-path-url"
@@ -33,15 +35,14 @@ const SearchProvider = ({ children }: SearchProviderProps) => {
items: [
"Install Medusa with create-medusa-app",
"What is an API route?",
- "What is a Module?",
"What is a Workflow?",
],
},
{
title: "Developing with Medusa",
items: [
- "How to create a Module",
"How to create an API route",
+ "How to create a module",
"How to create a data model",
"How to create an admin widget",
],
@@ -52,6 +53,28 @@ const SearchProvider = ({ children }: SearchProviderProps) => {
),
filterOptions: searchFiltersV2,
}}
+ commands={[
+ {
+ name: "ai-assistant",
+ icon: ,
+ component: (
+
+ ),
+ title: "AI Assistant",
+ badge: {
+ variant: "blue",
+ badgeType: "shaded",
+ children: "Beta",
+ },
+ },
+ ]}
>
{children}
diff --git a/www/apps/book/providers/search.tsx b/www/apps/book/providers/search.tsx
index 21645c25d8fbc..24ce8468adff2 100644
--- a/www/apps/book/providers/search.tsx
+++ b/www/apps/book/providers/search.tsx
@@ -1,6 +1,11 @@
"use client"
-import { SearchProvider as UiSearchProvider, searchFiltersV2 } from "docs-ui"
+import {
+ AiAssistantIcon,
+ AiAssistantProvider,
+ SearchProvider as UiSearchProvider,
+ searchFiltersV2,
+} from "docs-ui"
import { config } from "../config"
type SearchProviderProps = {
@@ -47,6 +52,28 @@ const SearchProvider = ({ children }: SearchProviderProps) => {
),
filterOptions: searchFiltersV2,
}}
+ commands={[
+ {
+ name: "ai-assistant",
+ icon: ,
+ component: (
+
+ ),
+ title: "AI Assistant",
+ badge: {
+ variant: "blue",
+ badgeType: "shaded",
+ children: "Beta",
+ },
+ },
+ ]}
initialDefaultFilters={["book"]}
>
{children}
diff --git a/www/apps/resources/providers/search.tsx b/www/apps/resources/providers/search.tsx
index 44846d5677ae9..78fb9f2972081 100644
--- a/www/apps/resources/providers/search.tsx
+++ b/www/apps/resources/providers/search.tsx
@@ -1,6 +1,11 @@
"use client"
-import { SearchProvider as UiSearchProvider, searchFiltersV2 } from "docs-ui"
+import {
+ AiAssistantIcon,
+ AiAssistantProvider,
+ SearchProvider as UiSearchProvider,
+ searchFiltersV2,
+} from "docs-ui"
import { config } from "../config"
type SearchProviderProps = {
@@ -28,15 +33,36 @@ const SearchProvider = ({ children }: SearchProviderProps) => {
items: [
"Medusa Configurations",
"Commerce Modules",
- "Medusa JS Reference",
- "Medusa React Reference",
- "Workflows API Reference",
+ "Medusa Workflows Reference",
+ "Storefront Development",
],
},
],
checkInternalPattern: new RegExp(`^${config.baseUrl}/v2/resources/.*`),
filterOptions: searchFiltersV2,
}}
+ commands={[
+ {
+ name: "ai-assistant",
+ icon: ,
+ component: (
+
+ ),
+ title: "AI Assistant",
+ badge: {
+ variant: "blue",
+ badgeType: "shaded",
+ children: "Beta",
+ },
+ },
+ ]}
initialDefaultFilters={["resources"]}
>
{children}
diff --git a/www/apps/ui/src/providers/search.tsx b/www/apps/ui/src/providers/search.tsx
index dfc4ed633256c..f6c574ab688fc 100644
--- a/www/apps/ui/src/providers/search.tsx
+++ b/www/apps/ui/src/providers/search.tsx
@@ -49,6 +49,7 @@ const SearchProvider = ({ children }: SearchProviderProps) => {
process.env.NEXT_PUBLIC_AI_API_ASSISTANT_RECAPTCHA_SITE_KEY ||
"temp"
}
+ version="v1"
/>
),
title: "AI Assistant",
diff --git a/www/packages/docs-ui/src/components/AiAssistant/ThreadItem/Actions/index.tsx b/www/packages/docs-ui/src/components/AiAssistant/ThreadItem/Actions/index.tsx
index 5840f301d413f..23364d5aacd37 100644
--- a/www/packages/docs-ui/src/components/AiAssistant/ThreadItem/Actions/index.tsx
+++ b/www/packages/docs-ui/src/components/AiAssistant/ThreadItem/Actions/index.tsx
@@ -1,13 +1,8 @@
import React, { useState } from "react"
import { ThreadType } from "../.."
import clsx from "clsx"
-import {
- Button,
- type ButtonProps,
- ThumbDownIcon,
- ThumbUpIcon,
-} from "@/components"
-import { Check, SquareTwoStack } from "@medusajs/icons"
+import { Button, type ButtonProps } from "@/components"
+import { Check, SquareTwoStackMini, ThumbDown, ThumbUp } from "@medusajs/icons"
import { useCopy } from "@/hooks"
import { AiAssistantFeedbackType, useAiAssistant } from "@/providers"
@@ -43,21 +38,17 @@ export const AiAssistantThreadItemActions = ({
return (
- {isCopied ? : }
+ {isCopied ? : }
{(feedback === null || feedback === "upvote") && (
handleFeedback("upvote", item.question_id)}
className={clsx(feedback === "upvote" && "!text-medusa-fg-subtle")}
>
-
+
)}
{(feedback === null || feedback === "downvote") && (
@@ -65,7 +56,7 @@ export const AiAssistantThreadItemActions = ({
onClick={async () => handleFeedback("downvote", item.question_id)}
className={clsx(feedback === "downvote" && "!text-medusa-fg-subtle")}
>
-
+
)}
@@ -79,7 +70,7 @@ const ActionButton = ({ children, className, ...props }: ButtonProps) => {
className={clsx(
"text-medusa-fg-muted hover:text-medusa-fg-subtle",
"hover:bg-medusa-bg-subtle-hover",
- "p-docs_0.125 rounded-docs_sm",
+ "!p-[4.5px] rounded-docs_sm",
className
)}
{...props}
diff --git a/www/packages/docs-ui/src/components/AiAssistant/ThreadItem/index.tsx b/www/packages/docs-ui/src/components/AiAssistant/ThreadItem/index.tsx
index e40663bac76f7..44e4bcb5eb601 100644
--- a/www/packages/docs-ui/src/components/AiAssistant/ThreadItem/index.tsx
+++ b/www/packages/docs-ui/src/components/AiAssistant/ThreadItem/index.tsx
@@ -1,8 +1,7 @@
import clsx from "clsx"
import React from "react"
import { ThreadType } from ".."
-import { DotsLoading, MarkdownContent, QuestionMarkIcon } from "@/components"
-import { ExclamationCircle, Sparkles } from "@medusajs/icons"
+import { AiAssistantIcon, DotsLoading, MarkdownContent } from "@/components"
import { AiAssistantThreadItemActions } from "./Actions"
export type AiAssistantThreadItemProps = {
@@ -13,39 +12,37 @@ export const AiAssistantThreadItem = ({ item }: AiAssistantThreadItemProps) => {
return (
-
}
+
- {item.type === "question" &&
}
- {item.type === "answer" &&
}
- {item.type === "error" &&
}
-
-
{item.type === "question" && <>{item.content}>}
{item.type === "answer" && (
- <>
+
{!item.question_id && item.content.length === 0 &&
}
-
{item.content}
- >
+
+ {item.content}
+
+ {item.question_id &&
}
+
)}
{item.type === "error" && (
{item.content}
)}
- {item.type === "answer" && item.question_id && (
-
- )}
)
}
diff --git a/www/packages/docs-ui/src/components/AiAssistant/index.tsx b/www/packages/docs-ui/src/components/AiAssistant/index.tsx
index 0d372b50f41e8..2d966bc792729 100644
--- a/www/packages/docs-ui/src/components/AiAssistant/index.tsx
+++ b/www/packages/docs-ui/src/components/AiAssistant/index.tsx
@@ -11,10 +11,9 @@ import {
SearchHitGroupName,
Tooltip,
Link,
- AiAssistantIcon,
} from "@/components"
import { useAiAssistant, useSearch } from "@/providers"
-import { ArrowUturnLeft, XMarkMini } from "@medusajs/icons"
+import { ArrowUturnLeft } from "@medusajs/icons"
import clsx from "clsx"
import { useSearchNavigation } from "@/hooks"
import { AiAssistantThreadItem } from "./ThreadItem"
@@ -77,26 +76,50 @@ export const AiAssistant = () => {
const [answer, setAnswer] = useState("")
const [identifiers, setIdentifiers] = useState
(null)
const [loading, setLoading] = useState(false)
- const { getAnswer } = useAiAssistant()
+ const { getAnswer, version } = useAiAssistant()
const { setCommand } = useSearch()
const inputRef = useRef(null)
const contentRef = useRef(null)
- const suggestions: SearchSuggestionType[] = [
- {
- title: "FAQ",
- items: [
- "What is Medusa?",
- "How can I create an ecommerce store with Medusa?",
- "How can I build a marketplace with Medusa?",
- "How can I build subscription-based purchases with Medusa?",
- "How can I build digital products with Medusa?",
- "What can I build with Medusa?",
- "What is Medusa Admin?",
- "How do I configure the database in Medusa?",
- ],
- },
- ]
+ const suggestions: SearchSuggestionType[] = useMemo(() => {
+ return version === "v2"
+ ? [
+ {
+ title: "FAQ",
+ items: [
+ "What is Medusa?",
+ "How can I create a module?",
+ "How can I create a data model?",
+ "How do I create a workflow?",
+ "How can I extend a data model in the Product Module?",
+ ],
+ },
+ {
+ title: "Recipes",
+ items: [
+ "How do I build a marketplace with Medusa?",
+ "How do I build digital products with Medusa?",
+ "How do I build subscription-based purchases with Medusa?",
+ "What other recipes are available in the Medusa documentation?",
+ ],
+ },
+ ]
+ : [
+ {
+ title: "FAQ",
+ items: [
+ "What is Medusa?",
+ "How can I create an ecommerce store with Medusa?",
+ "How can I build a marketplace with Medusa?",
+ "How can I build subscription-based purchases with Medusa?",
+ "How can I build digital products with Medusa?",
+ "What can I build with Medusa?",
+ "What is Medusa Admin?",
+ "How do I configure the database in Medusa?",
+ ],
+ },
+ ]
+ }, [version])
const handleSubmit = (selectedQuestion?: string) => {
if (!selectedQuestion?.length && !question.length) {
@@ -292,6 +315,22 @@ export const AiAssistant = () => {
return (
+
+
+ This site is protected by reCAPTCHA and the{" "}
+
+ Google Privacy Policy
+ {" "}
+ and ToS{" "}
+ apply
+ >
+ }
+ >
+ AI Assistant
+
+
{
setCommand(null)}
- className="text-medusa-fg-subtle p-[5px]"
+ className="text-medusa-fg-muted p-[6.5px]"
>
@@ -311,7 +350,7 @@ export const AiAssistant = () => {
onChange={(e) => setQuestion(e.target.value)}
className={clsx(
"bg-transparent border-0 focus:outline-none hover:!bg-transparent",
- "shadow-none flex-1 text-medusa-fg-base",
+ "!shadow-none flex-1 text-medusa-fg-base",
"disabled:!bg-transparent disabled:cursor-not-allowed"
)}
placeholder="Ask me a question about Medusa..."
@@ -319,23 +358,22 @@ export const AiAssistant = () => {
passedRef={inputRef}
disabled={loading}
/>
-
{
setQuestion("")
inputRef.current?.focus()
}}
className={clsx(
- "text-medusa-fg-subtle p-[5px]",
+ "text-medusa-fg-muted hover:text-medusa-fg-subtle",
"absolute top-docs_0.75 right-docs_1",
- "hover:bg-medusa-bg-base-hover rounded-docs_sm",
+ "cursor-pointer",
question.length === 0 && "hidden"
)}
>
-
-
+ Clear
+
-
+
{!thread.length && (
@@ -372,35 +410,12 @@ export const AiAssistant = () => {
-
- This site is protected by reCAPTCHA and the{" "}
-
- Google Privacy Policy
- {" "}
- and ToS{" "}
- apply
- >
- }
- >
-
-
-
Medusa AI Assistant
-
Beta
-
-
-
+
{thread.length === 0 && (
<>
@@ -412,9 +427,23 @@ export const AiAssistant = () => {
>
Navigate FAQ
-
- ↑
- ↓
+
+
+ ↑
+
+
+ ↓
+
>
)}
@@ -426,13 +455,23 @@ export const AiAssistant = () => {
)}
+
Ask Question
- ↵
+
+ ↵
+
diff --git a/www/packages/docs-ui/src/components/Icons/AiAssistant/index.tsx b/www/packages/docs-ui/src/components/Icons/AiAssistant/index.tsx
index fc52b9f172777..0308d7178a42e 100644
--- a/www/packages/docs-ui/src/components/Icons/AiAssistant/index.tsx
+++ b/www/packages/docs-ui/src/components/Icons/AiAssistant/index.tsx
@@ -11,27 +11,38 @@ export const AiAssistantIcon = (props: IconProps) => {
xmlns="http://www.w3.org/2000/svg"
{...props}
>
-
+
-
-
+
+
@@ -39,14 +50,15 @@ export const AiAssistantIcon = (props: IconProps) => {
style={{
mixBlendMode: "plus-lighter",
}}
- filter="url(#filter2_f_7480_20594)"
+ opacity="0.8"
+ filter="url(#filter2_f_10448_46450)"
>
-
+
@@ -54,21 +66,22 @@ export const AiAssistantIcon = (props: IconProps) => {
style={{
mixBlendMode: "plus-lighter",
}}
- filter="url(#filter3_f_7480_20594)"
+ opacity="0.8"
+ filter="url(#filter3_f_10448_46450)"
>
@@ -76,46 +89,53 @@ export const AiAssistantIcon = (props: IconProps) => {
style={{
mixBlendMode: "plus-lighter",
}}
- filter="url(#filter4_f_7480_20594)"
+ opacity="0.8"
+ filter="url(#filter4_f_10448_46450)"
>
-
+
{
{
{
{
/>
{
/>
{
/>
{
/>
{
/>
{
/>
-
-
+
+
-
+
-
+
{
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
{title &&
}
diff --git a/www/packages/docs-ui/src/components/Search/Footer/index.tsx b/www/packages/docs-ui/src/components/Search/Footer/index.tsx
new file mode 100644
index 0000000000000..114b58c854d93
--- /dev/null
+++ b/www/packages/docs-ui/src/components/Search/Footer/index.tsx
@@ -0,0 +1,59 @@
+import clsx from "clsx"
+import React from "react"
+import { Kbd } from "../../.."
+
+export const SearchFooter = () => {
+ return (
+
+
+
+
+ Navigation
+
+
+
+ ↑
+
+
+ ↓
+
+
+
+
+
+
+ Open Result
+
+
+ ↵
+
+
+
+
+ )
+}
diff --git a/www/packages/docs-ui/src/components/Search/Hits/GroupName/index.tsx b/www/packages/docs-ui/src/components/Search/Hits/GroupName/index.tsx
index b17b3c008a8e7..346887a8db910 100644
--- a/www/packages/docs-ui/src/components/Search/Hits/GroupName/index.tsx
+++ b/www/packages/docs-ui/src/components/Search/Hits/GroupName/index.tsx
@@ -9,7 +9,7 @@ export const SearchHitGroupName = ({ name }: SearchHitGroupNameProps) => {
return (
+
{status !== "loading" && showNoResults &&
}
{indices.map((indexName, index) => (
diff --git a/www/packages/docs-ui/src/components/Search/NoResults/index.tsx b/www/packages/docs-ui/src/components/Search/NoResults/index.tsx
index 1a69c12941a89..1f720db7465e5 100644
--- a/www/packages/docs-ui/src/components/Search/NoResults/index.tsx
+++ b/www/packages/docs-ui/src/components/Search/NoResults/index.tsx
@@ -1,4 +1,4 @@
-import { ExclamationCircleSolid } from "@medusajs/icons"
+import { MagnifierAlert } from "@medusajs/icons"
import clsx from "clsx"
import React from "react"
@@ -6,14 +6,24 @@ export const SearchNoResult = () => {
return (
-
-
- No results found. Try changing selected filters.
-
+
+
+
+ No results found.
+
+
+ We couldn't find any matches for your search. Please try changing
+ the filters or using different keywords.
+
+
)
}
diff --git a/www/packages/docs-ui/src/components/Search/Suggestions/Item/index.tsx b/www/packages/docs-ui/src/components/Search/Suggestions/Item/index.tsx
index 9ed739dbe84c2..0b11983c35ac1 100644
--- a/www/packages/docs-ui/src/components/Search/Suggestions/Item/index.tsx
+++ b/www/packages/docs-ui/src/components/Search/Suggestions/Item/index.tsx
@@ -14,7 +14,7 @@ export const SearchSuggestionItem = ({
return (
{
const { commands, setCommand } = useSearch()
return (
-
+
{commands.length > 0 && (
<>
@@ -30,12 +30,9 @@ export const SearchSuggestions = ({ suggestions }: SearchSuggestionsProps) => {
onClick={() => setCommand(command)}
key={index}
tabIndex={index}
- className="justify-between"
>
-
- {command.icon}
- {command.title}
-
+ {command.icon}
+
{command.title}
{command.badge &&
}
))}
diff --git a/www/packages/docs-ui/src/components/Search/index.tsx b/www/packages/docs-ui/src/components/Search/index.tsx
index 5b417607d320c..6a21f005f03fd 100644
--- a/www/packages/docs-ui/src/components/Search/index.tsx
+++ b/www/packages/docs-ui/src/components/Search/index.tsx
@@ -8,9 +8,10 @@ import { SearchSuggestions, type SearchSuggestionType } from "./Suggestions"
import { AlgoliaProps, useSearch } from "@/providers"
import { checkArraySameElms } from "@/utils"
import { SearchHitsWrapper } from "./Hits"
-import { Button, Kbd, SelectBadge } from "@/components"
+import { Button, Kbd, SelectBadge, SpinnerLoading } from "@/components"
import { MagnifyingGlass, XMark } from "@medusajs/icons"
import { useSearchNavigation, type OptionType } from "@/hooks"
+import { SearchFooter } from "./Footer"
export type SearchProps = {
algolia: AlgoliaProps
@@ -68,7 +69,31 @@ export const Search = ({
})
return (
-
+
+ {filterOptions.length && (
+
+ setFilters(Array.isArray(value) ? [...value] : [value])
+ }
+ addSelected={(value) => setFilters((prev) => [...prev, value])}
+ removeSelected={(value) =>
+ setFilters((prev) => prev.filter((v) => v !== value))
+ }
+ showClearButton={false}
+ placeholder="Filters"
+ handleAddAll={(isAllSelected: boolean) => {
+ if (isAllSelected) {
+ setFilters(defaultFilters)
+ } else {
+ setFilters(filterOptions.map((option) => option.value))
+ }
+ }}
+ className="px-docs_1 pt-docs_1 bg-medusa-bg-base"
+ />
+ )}
(
-
- )}
+ submitIconComponent={() => <>>}
resetIconComponent={() => (
-
+
+ Clear
+
)}
placeholder="Find something..."
autoFocus
formRef={searchBoxRef}
+ loadingIconComponent={() => }
/>
-
+
}
>
@@ -135,59 +158,7 @@ export const Search = ({
-
- {filterOptions.length && (
-
- setFilters(Array.isArray(value) ? [...value] : [value])
- }
- addSelected={(value) => setFilters((prev) => [...prev, value])}
- removeSelected={(value) =>
- setFilters((prev) => prev.filter((v) => v !== value))
- }
- showClearButton={false}
- placeholder="Filters"
- handleAddAll={(isAllSelected: boolean) => {
- if (isAllSelected) {
- setFilters(defaultFilters)
- } else {
- setFilters(filterOptions.map((option) => option.value))
- }
- }}
- />
- )}
-
-
-
- Navigation
-
-
- ↑
- ↓
-
-
-
-
- Open Result
-
- ↵
-
-
-
+
)
}
diff --git a/www/packages/docs-ui/src/components/Select/Badge/index.tsx b/www/packages/docs-ui/src/components/Select/Badge/index.tsx
index 3b77145f6362b..7c57aced404a6 100644
--- a/www/packages/docs-ui/src/components/Select/Badge/index.tsx
+++ b/www/packages/docs-ui/src/components/Select/Badge/index.tsx
@@ -4,6 +4,7 @@ import React, { useCallback, useRef, useState } from "react"
import { useSelect } from "@/hooks"
import clsx from "clsx"
import { SelectDropdown, SelectProps } from ".."
+import { TriangleDownMini } from "@medusajs/icons"
export const SelectBadge = ({
value,
@@ -20,16 +21,21 @@ export const SelectBadge = ({
const [open, setOpen] = useState(false)
const ref = useRef
(null)
const dropdownRef = useRef(null)
- const { isValueSelected, isAllSelected, handleChange, handleSelectAll } =
- useSelect({
- value,
- options,
- multiple,
- setSelected,
- removeSelected,
- addSelected,
- handleAddAll,
- })
+ const {
+ isValueSelected,
+ isAllSelected,
+ handleChange,
+ handleSelectAll,
+ setSelectedValues,
+ } = useSelect({
+ value,
+ options,
+ multiple,
+ setSelected,
+ removeSelected,
+ addSelected,
+ handleAddAll,
+ })
const getSelectedText = useCallback(() => {
let str = ""
@@ -38,7 +44,7 @@ export const SelectBadge = ({
)
if (isAllSelected) {
- str = "All Areas"
+ str = "All areas"
} else {
if (
(!Array.isArray(value) && !value) ||
@@ -54,37 +60,28 @@ export const SelectBadge = ({
<>
{str}
+ {!isAllSelected && selectedOptions.length > 1 && (
+ <> + {selectedOptions.length - 1}>
+ )}
- {!isAllSelected && selectedOptions.length > 1 && (
-
- {" "}
- + {selectedOptions.length}
-
- )}
>
)
}, [isAllSelected, options, value])
return (
-
+
{
@@ -93,10 +90,8 @@ export const SelectBadge = ({
}
}}
>
-
- Show results from:{" "}
-
{getSelectedText()}
+
)
diff --git a/www/packages/docs-ui/src/components/Select/Dropdown/index.tsx b/www/packages/docs-ui/src/components/Select/Dropdown/index.tsx
index e906ec4b4980b..407d2dd7c13bf 100644
--- a/www/packages/docs-ui/src/components/Select/Dropdown/index.tsx
+++ b/www/packages/docs-ui/src/components/Select/Dropdown/index.tsx
@@ -19,6 +19,7 @@ export type SelectDropdownProps = {
parentRef?: React.RefObject
className?: string
passedRef?: Ref
+ setSelectedValues?: (values: string[]) => void
}
export const SelectDropdown = ({
@@ -34,6 +35,7 @@ export const SelectDropdown = ({
parentRef,
className,
passedRef,
+ setSelectedValues,
}: SelectDropdownProps) => {
const ref = useRef(null)
const setRefs = useCallback(
@@ -50,7 +52,11 @@ export const SelectDropdown = ({
)
const handleChange = (clickedValue: string, wasSelected: boolean) => {
- handleSelectChange?.(clickedValue, wasSelected)
+ if (isAllSelected && setSelectedValues) {
+ setSelectedValues([clickedValue])
+ } else {
+ handleSelectChange?.(clickedValue, wasSelected)
+ }
if (!multiple) {
setOpen(false)
}
@@ -78,43 +84,75 @@ export const SelectDropdown = ({
}, [handleOutsideClick])
const getSelectOption = (option: OptionType, index: number) => {
- const isSelected = option.isAllOption
- ? isAllSelected
- : isValueSelected(option.value)
+ const originalIsSelected = isValueSelected(option.value)
+ const isSelected = isAllSelected
+ ? option.isAllOption || false
+ : originalIsSelected
return (
svg]:left-docs_0.75 cursor-pointer [&>svg]:absolute [&>svg]:top-docs_0.5",
- !isSelected && "text-compact-small",
- isSelected && "text-compact-small-plus"
+ "px-docs_0.25",
+ index <= 0 && "rounded-t-docs_DEFAULT",
+ index === options.length - 1 && "rounded-b-docs_DEFAULT"
)}
onClick={() => {
if (option.isAllOption) {
handleSelectAll()
} else {
- handleChange(option.value, isSelected)
+ handleChange(option.value, originalIsSelected)
}
}}
>
- {isSelected && (
- <>
- {multiple && }
- {!multiple && }
- >
- )}
- {option.label}
+
+
+ {isSelected && (
+ <>
+ {option.isAllOption && }
+ {!option.isAllOption && (
+ <>
+ {multiple && }
+ {!multiple && }
+ >
+ )}
+ >
+ )}
+ {!isSelected && }
+
+ {option.label}
+
)
}
+ const getDivider = () => (
+
+
+
+
+
+ )
+
return (
- {addAll &&
- getSelectOption(
- {
- value: "all",
- label: "All Areas",
- isAllOption: true,
- },
- -1
- )}
+ {addAll && (
+ <>
+ {getSelectOption(
+ {
+ value: "all",
+ label: "All Areas",
+ isAllOption: true,
+ },
+ -1
+ )}
+ {getDivider()}
+ >
+ )}
{options.map(getSelectOption)}
diff --git a/www/packages/docs-ui/src/hooks/use-select/index.tsx b/www/packages/docs-ui/src/hooks/use-select/index.tsx
index 8ecf7202fd461..36731b9483a0f 100644
--- a/www/packages/docs-ui/src/hooks/use-select/index.tsx
+++ b/www/packages/docs-ui/src/hooks/use-select/index.tsx
@@ -79,6 +79,10 @@ export const useSelect = ({
}
}
+ const setSelectedValues = (values: string[]) => {
+ setSelected?.(values)
+ }
+
return {
isValueSelected,
hasSelectedValue,
@@ -87,5 +91,6 @@ export const useSelect = ({
isAllSelected,
handleChange,
handleSelectAll,
+ setSelectedValues,
}
}
diff --git a/www/packages/docs-ui/src/providers/AiAssistant/index.tsx b/www/packages/docs-ui/src/providers/AiAssistant/index.tsx
index 79ff129fd2739..17736da57423b 100644
--- a/www/packages/docs-ui/src/providers/AiAssistant/index.tsx
+++ b/www/packages/docs-ui/src/providers/AiAssistant/index.tsx
@@ -13,6 +13,7 @@ export type AiAssistantContextType = {
questionId: string,
reaction: AiAssistantFeedbackType
) => Promise
+ version: "v1" | "v2"
}
const AiAssistantContext = createContext(null)
@@ -22,12 +23,14 @@ export type AiAssistantProviderProps = {
apiUrl: string
recaptchaSiteKey: string
websiteId: string
+ version?: "v1" | "v2"
}
export const AiAssistantProvider = ({
apiUrl,
recaptchaSiteKey,
websiteId,
+ version = "v2",
children,
}: AiAssistantProviderProps) => {
const { analytics } = useAnalytics()
@@ -90,6 +93,7 @@ export const AiAssistantProvider = ({
value={{
getAnswer,
sendFeedback,
+ version,
}}
>
{children}
diff --git a/www/packages/docs-ui/src/providers/Search/index.tsx b/www/packages/docs-ui/src/providers/Search/index.tsx
index fe8ea48dea787..de69022c34f9c 100644
--- a/www/packages/docs-ui/src/providers/Search/index.tsx
+++ b/www/packages/docs-ui/src/providers/Search/index.tsx
@@ -131,14 +131,9 @@ export const SearchProvider = ({
setIsOpen(false)}
passedRef={modalRef}
@@ -156,7 +151,7 @@ export const SearchProvider = ({
? "animate-fadeOutLeft animate-fast"
: "animate-fadeOutRight animate-fast",
}}
- timeout={300}
+ timeout={250}
key={command?.name || "search"}
>
<>
diff --git a/www/packages/tailwind/base.tailwind.config.js b/www/packages/tailwind/base.tailwind.config.js
index 2ffdf2720c224..876127b7677e0 100644
--- a/www/packages/tailwind/base.tailwind.config.js
+++ b/www/packages/tailwind/base.tailwind.config.js
@@ -310,8 +310,14 @@ module.exports = {
"inner-content-xxl": "640px",
"inner-content-xxxl": "640px",
// wide layout
+ "wide-content": "1112px",
"xl-wide-content": "1112px",
"lg-wide-content": "800px",
+ // modal
+ "modal-xs": "304px",
+ "modal-sm": "624px",
+ "modal-md": "752px",
+ "modal-lg": "640px",
},
minWidth: {
xl: "1419px",