Skip to content

Commit

Permalink
Merge branch 'develop' into feat/translate-el
Browse files Browse the repository at this point in the history
  • Loading branch information
jimrarras authored Dec 9, 2024
2 parents c496904 + 9534751 commit d8eefe5
Show file tree
Hide file tree
Showing 5,740 changed files with 462,929 additions and 414,323 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
6 changes: 6 additions & 0 deletions .changeset/dry-cheetahs-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@medusajs/dashboard": patch
"@medusajs/types": patch
---

feat(dashboard,types): Add UI to manage conditional SO prices
5 changes: 5 additions & 0 deletions .changeset/empty-snails-admire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/medusa": patch
---

fix(medusa): add query type argument to RequestWithContext
4 changes: 2 additions & 2 deletions .github/workflows/docs-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ jobs:
NEXT_PUBLIC_BASE_URL: "http://localhost:3000"
NEXT_PUBLIC_BASE_PATH: /api
NEXT_PUBLIC_DOCS_URL: "https://medusa-docs.vercel.app"
NEXT_PUBLIC_UI_URL: "https://docs-ui.vercel.app"
NODE_ENV: production
NEXT_PUBLIC_RESOURCES_URL: "http://medusa-types-nine.vercel.app"
# TODO change once we have actual URLs
NEXT_PUBLIC_RESOURCES_URL: "http://example.com"
NEXT_PUBLIC_USER_GUIDE_URL: "http://example.com"

vale-book:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BuildingTax } from "@medusajs/icons"
import { Tooltip, clx } from "@medusajs/ui"
import { TaxExclusive, TaxInclusive } from "@medusajs/icons"
import { Tooltip } from "@medusajs/ui"
import { useTranslation } from "react-i18next"

type IncludesTaxTooltipProps = {
Expand All @@ -20,9 +20,11 @@ export const IncludesTaxTooltip = ({
: t("general.excludesTaxTooltip")
}
>
<BuildingTax
className={clx("shrink-0", { "text-ui-fg-muted": !includesTax })}
/>
{includesTax ? (
<TaxInclusive className="text-ui-fg-muted shrink-0" />
) : (
<TaxExclusive className="text-ui-fg-muted shrink-0" />
)}
</Tooltip>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,52 +19,56 @@ export const DataGridCellContainer = ({
children,
errors,
rowErrors,
outerComponent,
}: DataGridCellContainerProps & DataGridErrorRenderProps<any>) => {
const error = get(errors, field)
const hasError = !!error

return (
<div
className={clx(
"bg-ui-bg-base group/cell relative flex size-full items-center gap-x-2 px-4 py-2.5 outline-none",
{
"bg-ui-tag-red-bg text-ui-tag-red-text":
hasError && !isAnchor && !isSelected && !isDragSelected,
"ring-ui-bg-interactive ring-2 ring-inset": isAnchor,
"bg-ui-bg-highlight [&:has([data-field]:focus)]:bg-ui-bg-base":
isSelected || isAnchor,
"bg-ui-bg-subtle": isDragSelected && !isAnchor,
}
)}
tabIndex={-1}
{...innerProps}
>
<ErrorMessage
name={field}
errors={errors}
render={({ message }) => {
return (
<div className="flex items-center justify-center">
<Tooltip content={message} delayDuration={0}>
<ExclamationCircle className="text-ui-tag-red-icon z-[3]" />
</Tooltip>
</div>
)
}}
/>
<div className="relative z-[1] flex size-full items-center justify-center">
<RenderChildren isAnchor={isAnchor} placeholder={placeholder}>
{children}
</RenderChildren>
</div>
<DataGridRowErrorIndicator rowErrors={rowErrors} />
{showOverlay && (
<div
{...overlayProps}
data-cell-overlay="true"
className="absolute inset-0 z-[2] size-full"
<div className="group/container relative size-full">
<div
className={clx(
"bg-ui-bg-base group/cell relative flex size-full items-center gap-x-2 px-4 py-2.5 outline-none",
{
"bg-ui-tag-red-bg text-ui-tag-red-text":
hasError && !isAnchor && !isSelected && !isDragSelected,
"ring-ui-bg-interactive ring-2 ring-inset": isAnchor,
"bg-ui-bg-highlight [&:has([data-field]:focus)]:bg-ui-bg-base":
isSelected || isAnchor,
"bg-ui-bg-subtle": isDragSelected && !isAnchor,
}
)}
tabIndex={-1}
{...innerProps}
>
<ErrorMessage
name={field}
errors={errors}
render={({ message }) => {
return (
<div className="flex items-center justify-center">
<Tooltip content={message} delayDuration={0}>
<ExclamationCircle className="text-ui-tag-red-icon z-[3]" />
</Tooltip>
</div>
)
}}
/>
)}
<div className="relative z-[1] flex size-full items-center justify-center">
<RenderChildren isAnchor={isAnchor} placeholder={placeholder}>
{children}
</RenderChildren>
</div>
<DataGridRowErrorIndicator rowErrors={rowErrors} />
{showOverlay && (
<div
{...overlayProps}
data-cell-overlay="true"
className="absolute inset-0"
/>
)}
</div>
{outerComponent}
</div>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export interface DataGridRootProps<
state: UseFormReturn<TFieldValues>
getSubRows?: (row: TData) => TData[] | undefined
onEditingChange?: (isEditing: boolean) => void
disableInteractions?: boolean
}

const ROW_HEIGHT = 40
Expand Down Expand Up @@ -102,6 +103,7 @@ export const DataGridRoot = <
state,
getSubRows,
onEditingChange,
disableInteractions,
}: DataGridRootProps<TData, TFieldValues>) => {
const containerRef = useRef<HTMLDivElement>(null)

Expand All @@ -114,7 +116,9 @@ export const DataGridRoot = <
formState: { errors },
} = state

const [trapActive, setTrapActive] = useState(true)
const [internalTrapActive, setTrapActive] = useState(true)

const trapActive = !disableInteractions && internalTrapActive

const [anchor, setAnchor] = useState<DataGridCoordinates | null>(null)
const [rangeEnd, setRangeEnd] = useState<DataGridCoordinates | null>(null)
Expand Down Expand Up @@ -533,7 +537,7 @@ export const DataGridRoot = <
queryTool?.getContainer(anchor)?.focus()
})
}
}, [anchor, trapActive, queryTool])
}, [anchor, trapActive, setSingleRange, scrollToCoordinates, queryTool])

return (
<DataGridContext.Provider value={values}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const VERTICAL_KEYS = ["ArrowUp", "ArrowDown"]

export const useDataGridKeydownEvent = <
TData,
TFieldValues extends FieldValues,
TFieldValues extends FieldValues
>({
containerRef,
matrix,
Expand Down Expand Up @@ -108,8 +108,8 @@ export const useDataGridKeydownEvent = <
direction === "horizontal"
? setSingleRange
: e.shiftKey
? setRangeEnd
: setSingleRange
? setRangeEnd
: setSingleRange

if (!basis) {
return
Expand Down
1 change: 1 addition & 0 deletions packages/admin/dashboard/src/components/data-grid/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export interface DataGridCellContainerProps extends PropsWithChildren<{}> {
isDragSelected: boolean
placeholder?: ReactNode
showOverlay: boolean
outerComponent?: ReactNode
}

export type DataGridCellSnapshot<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,20 @@ type StackedFocusModalProps = PropsWithChildren<{
* when multiple stacked modals are registered to the same parent modal.
*/
id: string
/**
* An optional callback that is called when the modal is opened or closed.
*/
onOpenChangeCallback?: (open: boolean) => void
}>

/**
* A stacked modal that can be rendered above a parent modal.
*/
export const Root = ({ id, children }: StackedFocusModalProps) => {
export const Root = ({
id,
onOpenChangeCallback,
children,
}: StackedFocusModalProps) => {
const { register, unregister, getIsOpen, setIsOpen } = useStackedModal()

useEffect(() => {
Expand All @@ -28,11 +36,13 @@ export const Root = ({ id, children }: StackedFocusModalProps) => {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])

const handleOpenChange = (open: boolean) => {
setIsOpen(id, open)
onOpenChangeCallback?.(open)
}

return (
<FocusModal
open={getIsOpen(id)}
onOpenChange={(open) => setIsOpen(id, open)}
>
<FocusModal open={getIsOpen(id)} onOpenChange={handleOpenChange}>
{children}
</FocusModal>
)
Expand Down
Loading

0 comments on commit d8eefe5

Please sign in to comment.