-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into fix/clickable-rows
- Loading branch information
Showing
232 changed files
with
7,548 additions
and
3,811 deletions.
There are no files selected for viewing
59 changes: 0 additions & 59 deletions
59
packages/admin-next/dashboard/src/components/common/condition-block/condition-block.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...admin-next/dashboard/src/components/data-grid/data-grid-cells/data-grid-currency-cell.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/admin-next/dashboard/src/components/inputs/province-select/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./province-select" |
111 changes: 111 additions & 0 deletions
111
packages/admin-next/dashboard/src/components/inputs/province-select/province-select.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
import { | ||
ComponentPropsWithoutRef, | ||
forwardRef, | ||
useImperativeHandle, | ||
useRef, | ||
} from "react" | ||
|
||
import { TrianglesMini } from "@medusajs/icons" | ||
import { clx } from "@medusajs/ui" | ||
import { useTranslation } from "react-i18next" | ||
import { getCountryProvinceObjectByIso2 } from "../../../lib/data/country-states" | ||
|
||
interface ProvinceSelectProps extends ComponentPropsWithoutRef<"select"> { | ||
/** | ||
* ISO 3166-1 alpha-2 country code | ||
*/ | ||
country_code: string | ||
/** | ||
* Whether to use the ISO 3166-1 alpha-2 code or the name of the province as the value | ||
* | ||
* @default "iso_2" | ||
*/ | ||
valueAs?: "iso_2" | "name" | ||
placeholder?: string | ||
} | ||
|
||
export const ProvinceSelect = forwardRef< | ||
HTMLSelectElement, | ||
ProvinceSelectProps | ||
>( | ||
( | ||
{ | ||
className, | ||
disabled, | ||
placeholder, | ||
country_code, | ||
valueAs = "iso_2", | ||
...props | ||
}, | ||
ref | ||
) => { | ||
const { t } = useTranslation() | ||
const innerRef = useRef<HTMLSelectElement>(null) | ||
|
||
useImperativeHandle(ref, () => innerRef.current as HTMLSelectElement) | ||
|
||
const isPlaceholder = innerRef.current?.value === "" | ||
|
||
const provinceObject = getCountryProvinceObjectByIso2(country_code) | ||
|
||
if (!provinceObject) { | ||
disabled = true | ||
} | ||
|
||
const options = Object.entries(provinceObject?.options ?? {}).map( | ||
([iso2, name]) => { | ||
return ( | ||
<option key={iso2} value={valueAs === "iso_2" ? iso2 : name}> | ||
{name} | ||
</option> | ||
) | ||
} | ||
) | ||
|
||
const placeholderText = provinceObject | ||
? t(`taxRegions.fields.sublevels.placeholders.${provinceObject.type}`) | ||
: "" | ||
|
||
const placeholderOption = provinceObject ? ( | ||
<option value="" disabled className="text-ui-fg-muted"> | ||
{placeholder || placeholderText} | ||
</option> | ||
) : null | ||
|
||
return ( | ||
<div className="relative"> | ||
<TrianglesMini | ||
className={clx( | ||
"text-ui-fg-muted transition-fg pointer-events-none absolute right-2 top-1/2 -translate-y-1/2", | ||
{ | ||
"text-ui-fg-disabled": disabled, | ||
} | ||
)} | ||
/> | ||
<select | ||
disabled={disabled} | ||
className={clx( | ||
"bg-ui-bg-field shadow-buttons-neutral transition-fg txt-compact-small flex w-full select-none appearance-none items-center justify-between rounded-md px-2 py-1.5 outline-none", | ||
"placeholder:text-ui-fg-muted text-ui-fg-base", | ||
"hover:bg-ui-bg-field-hover", | ||
"focus-visible:shadow-borders-interactive-with-active data-[state=open]:!shadow-borders-interactive-with-active", | ||
"aria-[invalid=true]:border-ui-border-error aria-[invalid=true]:shadow-borders-error", | ||
"invalid::border-ui-border-error invalid:shadow-borders-error", | ||
"disabled:!bg-ui-bg-disabled disabled:!text-ui-fg-disabled", | ||
{ | ||
"text-ui-fg-muted": isPlaceholder, | ||
}, | ||
className | ||
)} | ||
{...props} | ||
ref={innerRef} | ||
> | ||
{/* Add an empty option so the first option is preselected */} | ||
{placeholderOption} | ||
{options} | ||
</select> | ||
</div> | ||
) | ||
} | ||
) | ||
ProvinceSelect.displayName = "CountrySelect" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
packages/admin-next/dashboard/src/components/layout/pages/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from "./single-column-page" | ||
export * from "./two-column-page" |
1 change: 1 addition & 0 deletions
1
packages/admin-next/dashboard/src/components/layout/pages/single-column-page/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./single-column-page" |
38 changes: 38 additions & 0 deletions
38
...dmin-next/dashboard/src/components/layout/pages/single-column-page/single-column-page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Outlet } from "react-router-dom" | ||
import { JsonViewSection } from "../../../common/json-view-section" | ||
import { PageProps } from "../types" | ||
|
||
export const SingleColumnPage = <TData,>({ | ||
children, | ||
widgets, | ||
data, | ||
hasOutlet, | ||
showJSON, | ||
}: PageProps<TData>) => { | ||
const { before, after } = widgets | ||
const widgetProps = { data } | ||
|
||
if (showJSON && !data) { | ||
if (process.env.NODE_ENV === "development") { | ||
console.warn( | ||
"`showJSON` is true but no data is provided. To display JSON, provide data prop." | ||
) | ||
} | ||
|
||
showJSON = false | ||
} | ||
|
||
return ( | ||
<div className="flex flex-col gap-y-3"> | ||
{before.widgets.map((w, i) => { | ||
return <w.Component {...widgetProps} key={i} /> | ||
})} | ||
{children} | ||
{after.widgets.map((w, i) => { | ||
return <w.Component {...widgetProps} key={i} /> | ||
})} | ||
{showJSON && <JsonViewSection data={data!} />} | ||
{hasOutlet && <Outlet />} | ||
</div> | ||
) | ||
} |
1 change: 1 addition & 0 deletions
1
packages/admin-next/dashboard/src/components/layout/pages/two-column-page/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./two-column-page" |
Oops, something went wrong.