Skip to content

Commit

Permalink
chore: bundling tsup
Browse files Browse the repository at this point in the history
  • Loading branch information
mszekiel authored and jonas-jonas committed Oct 16, 2024
1 parent 911af99 commit a57af75
Show file tree
Hide file tree
Showing 41 changed files with 81 additions and 69 deletions.
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/elements-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"react-dom": "18.3.1"
},
"devDependencies": {
"@svgr/plugin-jsx": "^8.1.0",
"esbuild-plugin-svgr": "2.1.0",
"eslint-plugin-react": "7.35.0",
"tsup": "8.2.3"
Expand Down
4 changes: 2 additions & 2 deletions packages/elements-react/src/components/card/card-two-step.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { OryForm } from "../form/form"
import { OryCardValidationMessages } from "../form/messages"
import { Node } from "../form/nodes/node"
import { OryFormSocialButtons } from "../form/social"
import { useComponents, useNodeSorter } from "../../context/component"
import { useOryFlow } from "../../context/flow-context"
import { useComponents, useNodeSorter } from "../../context"
import { useOryFlow } from "../../context"
import {
isUiNodeInputAttributes,
UiNode,
Expand Down
2 changes: 1 addition & 1 deletion packages/elements-react/src/components/card/header.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useComponents } from "../../context/component"
import { useComponents } from "../../context"

export type OryCardHeaderProps = Record<string, never>

Expand Down
2 changes: 1 addition & 1 deletion packages/elements-react/src/components/card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { OryForm } from "../form/form"
import { OryFormGroups } from "../form/groups"
import { OryCardValidationMessages } from "../form/messages"
import { OryFormSocialButtons } from "../form/social"
import { useComponents } from "../../context/component"
import { useComponents } from "../../context"
import { ComponentType, PropsWithChildren } from "react"
import { OryCardHeader, OryCardHeaderProps } from "./header"

Expand Down
3 changes: 1 addition & 2 deletions packages/elements-react/src/components/form/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import {
import { ComponentType, PropsWithChildren } from "react"
import { FormProvider, SubmitHandler, useForm } from "react-hook-form"
import { useIntl } from "react-intl"
import { useComponents } from "../../context/component"
import { useOryFlow } from "../../context/flow-context"
import { useOryFlow, useComponents } from "../../context"
import {
FormValues,
HeadlessAuthMethodListItemProps,
Expand Down
4 changes: 2 additions & 2 deletions packages/elements-react/src/components/form/groups.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useComponents, useNodeSorter } from "../../context/component"
import { useOryFlow } from "../../context/flow-context"
import { useComponents, useNodeSorter } from "../../context"
import { useOryFlow } from "../../context"
import { UiNodeGroupEnum } from "@ory/client-fetch"
import { PropsWithChildren } from "react"
import { Node } from "./nodes/node"
Expand Down
3 changes: 1 addition & 2 deletions packages/elements-react/src/components/form/messages.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useComponents } from "../../context/component"
import { useOryFlow } from "../../context/flow-context"
import { useOryFlow, useComponents } from "../../context"
import { UiText } from "@ory/client-fetch"
import { DetailedHTMLProps, HTMLAttributes } from "react"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { NodeProps } from "./node"
import { useComponents } from "../../../context/component"
import { useComponents } from "../../../context"
import { triggerToWindowCall } from "../../../util/ui"
import {
UiNodeInputAttributes,
Expand Down
2 changes: 1 addition & 1 deletion packages/elements-react/src/components/form/nodes/node.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
isUiNodeTextAttributes,
} from "@ory/client-fetch"
import { MouseEventHandler, ReactNode } from "react"
import { useComponents } from "../../../context/component"
import { useComponents } from "../../../context"

export type NodeProps = {
node: UiNode
Expand Down
4 changes: 2 additions & 2 deletions packages/elements-react/src/components/form/social.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useComponents } from "../../context/component"
import { useOryFlow } from "../../context/flow-context"
import { useComponents } from "../../context"
import { useOryFlow } from "../../context"
import { UiNode, UiNodeInputAttributes } from "@ory/client-fetch"
import { PropsWithChildren } from "react"
import { Node } from "./nodes/node"
Expand Down
4 changes: 2 additions & 2 deletions packages/elements-react/src/components/generic/divider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useComponents } from "../../context/component"
import { useOryFlow } from "../../context/flow-context"
import { useComponents } from "../../context"
import { useOryFlow } from "../../context"

export type HorizontalDividerProps = Record<string, never>

Expand Down
1 change: 1 addition & 0 deletions packages/elements-react/src/context/intl-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ export const IntlProvider = <
let translation = locales.en

if (props.locale && props.locale in locales) {
// @ts-expect-error asdasd
translation = locales[props.locale as Locale]
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HeadlessAuthMethodListItemProps } from "../../../../types"
import { HeadlessAuthMethodListItemProps } from "@ory/elements-react"

import { FunctionComponent, SVGAttributes } from "react"
import code from "../../assets/icons/code.svg"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OryCardContentProps } from "../../../../components"
import { OryCardContentProps } from "@ory/elements-react"

export function DefaultCardContent({ children }: OryCardContentProps) {
return children
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HeadlessButtonProps } from "../../../../types"
import { HeadlessButtonProps } from "@ory/elements-react"
import { DefaultInput } from "../form/input"

export function DefaultCurrentIdentifierButton({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FlowType } from "@ory/client-fetch"
import { useIntl } from "react-intl"
import { useOryFlow } from "../../../../context"
import { useOryFlow } from "@ory/elements-react"

export function DefaultCardFooter() {
const { flowType } = useOryFlow()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { FlowType, isUiNodeInputAttributes } from "@ory/client-fetch"
import { useComponents, useOryFlow } from "../../../../context"
import { FlowContainer } from "../../../../util/flowContainer"
import { FlowContainer, useComponents, useOryFlow } from "@ory/elements-react"

function joinWithCommaOr(list: string[]): string {
if (list.length === 0) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OryCardProps } from "../../../../components"
import { OryCardProps } from "@ory/elements-react"
import { Badge } from "./badge"
import { DefaultCardContent } from "./content"
import { DefaultCardFooter } from "./footer"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useOryFlow } from "../../../../context"
import { useOryFlow } from "@ory/elements-react"

export function DefaultCardLogo() {
const flow = useOryFlow()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
} from "./form/social"
import { DefaultText } from "./form/text"
import { DefaultCurrentIdentifierButton } from "./card/current-identifier-button"
import { OryFlowComponents } from "../../../types"
import { OryFlowComponents } from "@ory/elements-react"

export const OryDefaultComponents: OryFlowComponents = {
Card: DefaultCard,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { useFormContext } from "react-hook-form"
import { useIntl } from "react-intl"
import { Spinner } from "./spinner"
import { cn } from "../../utils/cn"
import { HeadlessButtonProps } from "../../../../types"
import { formatMessage } from "../../../../util"
import { formatMessage, HeadlessButtonProps } from "@ory/elements-react"
import { getNodeLabel } from "@ory/client-fetch"

export const DefaultButton = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { useState } from "react"
import { useForm } from "react-hook-form"
import { useIntl } from "react-intl"
import { cn } from "../../utils/cn"
import { HeadlessInputProps } from "../../../../types"
import { formatMessage, messageTestId } from "../../../../util"
import { HeadlessInputProps } from "@ory/elements-react"
import { formatMessage, messageTestId } from "@ory/elements-react"
import { getNodeLabel } from "@ory/client-fetch"

function CheckboxSVG() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HeadlessGroupContainerProps } from "../../../../components"
import { HeadlessGroupContainerProps } from "@ory/elements-react"

export function DefaultGroupContainer({
children,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HeadlessImageProps } from "../../../../types"
import { HeadlessImageProps } from "@ory/elements-react"

export function DefaultImage({ attributes }: HeadlessImageProps) {
// const intl = useIntl()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PropsWithChildren } from "react"
import { cn } from "../../utils/cn"
import { HeadlessFormProps } from "../../../../types"
import { HeadlessMessageProps } from "../../../../components"
import { HeadlessFormProps } from "@ory/elements-react"
import { HeadlessMessageProps } from "@ory/elements-react"

export function DefaultFormContainer({
children,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useFormContext } from "react-hook-form"
import { HeadlessInputProps } from "../../../../types"
import { HeadlessInputProps } from "@ory/elements-react"
import { getNodeLabel } from "@ory/client-fetch"

export const DefaultInput = ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { FlowType, getNodeLabel } from "@ory/client-fetch"
import { useIntl } from "react-intl"
import { useOryFlow } from "../../../../context"
import { HeadlessLabelProps } from "../../../../types"
import { formatMessage, messageTestId } from "../../../../util"
import { useOryFlow } from "@ory/elements-react"
import { HeadlessLabelProps } from "@ory/elements-react"
import { formatMessage, messageTestId } from "@ory/elements-react"
import { cn } from "../../utils/cn"

export function DefaultLabel({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { forwardRef } from "react"
import { useIntl } from "react-intl"
import { cn } from "../../utils/cn"
import { HeadlessLinkButtonProps } from "../../../../types"
import { formatMessage } from "../../../../util"
import { HeadlessLinkButtonProps } from "@ory/elements-react"
import { formatMessage } from "@ory/elements-react"
import { getNodeLabel } from "@ory/client-fetch"

export const DefaultLinkButton = forwardRef<
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client"
import { useFormContext } from "react-hook-form"
import { InputOTP, InputOTPGroup, InputOTPSlot } from "./shadcn/otp-input"
import { HeadlessInputProps } from "../../../../types"
import { HeadlessInputProps } from "@ory/elements-react"

export const DefaultPinCodeInput = ({ attributes }: HeadlessInputProps) => {
const { setValue, watch } = useFormContext()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
HeadlessSocialButtonContainerProps,
HeadlessSocialButtonProps,
} from "../../../../components"
import { useOryFlow } from "../../../../context"
} from "@ory/elements-react"
import { useOryFlow } from "@ory/elements-react"
import logos from "../../provider-logos"
import { cn } from "../../utils/cn"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { UiText } from "@ory/client-fetch"
import { useIntl } from "react-intl"
import { HeadlessTextProps } from "../../../../types"
import { formatMessage } from "../../../../util"
import { HeadlessTextProps } from "@ory/elements-react"
import { formatMessage } from "@ory/elements-react"

export function DefaultText({ node, attributes }: HeadlessTextProps) {
const intl = useIntl()
Expand Down
3 changes: 1 addition & 2 deletions packages/elements-react/src/theme/default/flows/error.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"use client"
import { FlowError } from "@ory/client-fetch"
import { PropsWithChildren } from "react"
import { OryFlowComponents } from "../../../types"
import { OryClientConfiguration } from "../../../util/clientConfiguration"
import { OryClientConfiguration, OryFlowComponents } from "@ory/elements-react"

export type ErrorFlowContextProps = {
error: FlowError
Expand Down
10 changes: 6 additions & 4 deletions packages/elements-react/src/theme/default/flows/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
import { FlowType, LoginFlow } from "@ory/client-fetch"
import { PropsWithChildren } from "react"
import { OryDefaultComponents } from "../components"
import { OryFlowComponents } from "../../../types"
import { OryProvider } from "../../../context"
import { OryCard } from "../../../components"
import { OryClientConfiguration } from "../../../util/clientConfiguration"
import {
OryFlowComponents,
OryCard,
OryClientConfiguration,
OryProvider,
} from "@ory/elements-react"

export type LoginFlowContextProps = {
flow: LoginFlow
Expand Down
10 changes: 6 additions & 4 deletions packages/elements-react/src/theme/default/flows/recovery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
import { FlowType, RecoveryFlow } from "@ory/client-fetch"
import { PropsWithChildren } from "react"
import { OryDefaultComponents } from "../components"
import { OryFlowComponents } from "../../../types"
import { OryProvider } from "../../../context"
import { OryCard } from "../../../components"
import { OryClientConfiguration } from "../../../util/clientConfiguration"
import {
OryCard,
OryFlowComponents,
OryProvider,
OryClientConfiguration,
} from "@ory/elements-react"

export type RecoveryFlowContextProps = {
flow: RecoveryFlow
Expand Down
10 changes: 6 additions & 4 deletions packages/elements-react/src/theme/default/flows/registration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
import { FlowType, RegistrationFlow } from "@ory/client-fetch"
import { PropsWithChildren } from "react"
import { OryDefaultComponents } from "../components"
import { OryFlowComponents } from "../../../types"
import { OryProvider } from "../../../context"
import { OryCard } from "../../../components"
import { OryClientConfiguration } from "../../../util/clientConfiguration"
import {
OryClientConfiguration,
OryFlowComponents,
OryCard,
OryProvider,
} from "@ory/elements-react"

type RegistrationFlowContextProps = {
flow: RegistrationFlow
Expand Down
10 changes: 6 additions & 4 deletions packages/elements-react/src/theme/default/flows/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
import { FlowType, SettingsFlow } from "@ory/client-fetch"
import { PropsWithChildren } from "react"
import { OryDefaultComponents } from "../components"
import { OryFlowComponents } from "../../../types"
import { OryProvider } from "../../../context"
import { OryCard } from "../../../components"
import { OryClientConfiguration } from "../../../util/clientConfiguration"
import {
OryFlowComponents,
OryClientConfiguration,
OryProvider,
OryCard,
} from "@ory/elements-react"

export type SettingsFlowContextProps = {
flow: SettingsFlow
Expand Down
10 changes: 6 additions & 4 deletions packages/elements-react/src/theme/default/flows/verification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
import { FlowType, VerificationFlow } from "@ory/client-fetch"
import { PropsWithChildren } from "react"
import { OryDefaultComponents } from "../components"
import { OryFlowComponents } from "../../../types"
import { OryProvider } from "../../../context"
import { OryCard } from "../../../components"
import { OryClientConfiguration } from "../../../util/clientConfiguration"
import {
OryCard,
OryProvider,
OryClientConfiguration,
OryFlowComponents,
} from "@ory/elements-react"

export type VerificationFlowContextProps = {
flow: VerificationFlow
Expand Down
1 change: 0 additions & 1 deletion packages/elements-react/src/util/onSubmitLogin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export async function onSubmitLogin(
setFlowContainer({
flow: body,
flowType: FlowType.Login,
config,
})
},
onRedirect,
Expand Down
5 changes: 4 additions & 1 deletion packages/elements-react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
"declarationDir": "dist/types",
"jsx": "react-jsx",
"lib": ["ES6", "DOM", "WebWorker"],
"rootDir": "src"
"rootDir": "src",
"paths": {
"@ory/elements-react": ["./src/index.ts"]
}
},
"exclude": ["node_modules"],
"include": [
Expand Down
Loading

0 comments on commit a57af75

Please sign in to comment.