@thunderid/react 0.5.0 → 0.6.0
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.
- package/dist/cjs/components/presentation/auth/AcceptInvite/BaseAcceptInvite.cjs +9 -1
- package/dist/cjs/components/presentation/auth/AcceptInvite/BaseAcceptInvite.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs +52 -9
- package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/InviteUser/BaseInviteUser.cjs +11 -1
- package/dist/cjs/components/presentation/auth/InviteUser/BaseInviteUser.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/Recovery/BaseRecovery.cjs +18 -14
- package/dist/cjs/components/presentation/auth/Recovery/BaseRecovery.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.cjs +35 -9
- package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.cjs +16 -13
- package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.cjs.map +1 -1
- package/dist/cjs/components/primitives/AffixedField/AffixedField.cjs +88 -0
- package/dist/cjs/components/primitives/AffixedField/AffixedField.cjs.map +1 -0
- package/dist/cjs/components/primitives/AffixedField/AffixedField.styles.cjs +130 -0
- package/dist/cjs/components/primitives/AffixedField/AffixedField.styles.cjs.map +1 -0
- package/dist/cjs/contexts/ComponentRenderer/ComponentRendererContext.cjs.map +1 -1
- package/dist/cjs/utils/composeAffixedInputs.cjs +74 -0
- package/dist/cjs/utils/composeAffixedInputs.cjs.map +1 -0
- package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.d.ts.map +1 -1
- package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.js +9 -1
- package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.js.map +1 -1
- package/dist/components/presentation/auth/AuthOptionFactory.d.ts +12 -4
- package/dist/components/presentation/auth/AuthOptionFactory.d.ts.map +1 -1
- package/dist/components/presentation/auth/AuthOptionFactory.js +52 -9
- package/dist/components/presentation/auth/AuthOptionFactory.js.map +1 -1
- package/dist/components/presentation/auth/InviteUser/BaseInviteUser.d.ts.map +1 -1
- package/dist/components/presentation/auth/InviteUser/BaseInviteUser.js +11 -1
- package/dist/components/presentation/auth/InviteUser/BaseInviteUser.js.map +1 -1
- package/dist/components/presentation/auth/Recovery/BaseRecovery.d.ts.map +1 -1
- package/dist/components/presentation/auth/Recovery/BaseRecovery.js +19 -15
- package/dist/components/presentation/auth/Recovery/BaseRecovery.js.map +1 -1
- package/dist/components/presentation/auth/SignIn/BaseSignIn.d.ts.map +1 -1
- package/dist/components/presentation/auth/SignIn/BaseSignIn.js +37 -11
- package/dist/components/presentation/auth/SignIn/BaseSignIn.js.map +1 -1
- package/dist/components/presentation/auth/SignUp/BaseSignUp.d.ts.map +1 -1
- package/dist/components/presentation/auth/SignUp/BaseSignUp.js +16 -13
- package/dist/components/presentation/auth/SignUp/BaseSignUp.js.map +1 -1
- package/dist/components/primitives/AffixedField/AffixedField.d.ts +52 -0
- package/dist/components/primitives/AffixedField/AffixedField.d.ts.map +1 -0
- package/dist/components/primitives/AffixedField/AffixedField.js +83 -0
- package/dist/components/primitives/AffixedField/AffixedField.js.map +1 -0
- package/dist/components/primitives/AffixedField/AffixedField.styles.d.ts +25 -0
- package/dist/components/primitives/AffixedField/AffixedField.styles.d.ts.map +1 -0
- package/dist/components/primitives/AffixedField/AffixedField.styles.js +127 -0
- package/dist/components/primitives/AffixedField/AffixedField.styles.js.map +1 -0
- package/dist/components/primitives/AffixedField/index.d.ts +20 -0
- package/dist/components/primitives/AffixedField/index.d.ts.map +1 -0
- package/dist/components/primitives/Dialog/Dialog.js +3 -3
- package/dist/components/primitives/Dialog/Dialog.js.map +1 -1
- package/dist/contexts/ComponentRenderer/ComponentRendererContext.d.ts +1 -0
- package/dist/contexts/ComponentRenderer/ComponentRendererContext.d.ts.map +1 -1
- package/dist/contexts/ComponentRenderer/ComponentRendererContext.js.map +1 -1
- package/dist/utils/composeAffixedInputs.d.ts +52 -0
- package/dist/utils/composeAffixedInputs.d.ts.map +1 -0
- package/dist/utils/composeAffixedInputs.js +70 -0
- package/dist/utils/composeAffixedInputs.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/AffixedField/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAChE,YAAY,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAC"}
|
|
@@ -6,7 +6,7 @@ import { bem, withVendorCSSClassPrefix } from "@thunderid/browser";
|
|
|
6
6
|
import { cloneElement, createContext, forwardRef, isValidElement, useContext, useLayoutEffect, useMemo, useState } from "react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { cx } from "@emotion/css";
|
|
9
|
-
import { FloatingFocusManager, FloatingOverlay, FloatingPortal, useClick, useDismiss, useFloating, useId, useInteractions, useMergeRefs, useRole } from "@floating-ui/react";
|
|
9
|
+
import { FloatingFocusManager, FloatingOverlay, FloatingPortal, useClick, useDismiss, useFloating, useId as useId$1, useInteractions, useMergeRefs, useRole } from "@floating-ui/react";
|
|
10
10
|
|
|
11
11
|
//#region src/components/primitives/Dialog/Dialog.tsx
|
|
12
12
|
function useDialog({ initialOpen = false, open: controlledOpen, onOpenChange: setControlledOpen } = {}) {
|
|
@@ -104,7 +104,7 @@ const DialogHeading = forwardRef(({ children,...props }, ref) => {
|
|
|
104
104
|
const context = useDialogContext();
|
|
105
105
|
const { theme, colorScheme } = useTheme_default();
|
|
106
106
|
const styles = Dialog_styles_default(theme, colorScheme);
|
|
107
|
-
const id = useId();
|
|
107
|
+
const id = useId$1();
|
|
108
108
|
useLayoutEffect(() => {
|
|
109
109
|
context.setLabelId(id);
|
|
110
110
|
return () => {
|
|
@@ -139,7 +139,7 @@ const DialogDescription = forwardRef(({ children,...props }, ref) => {
|
|
|
139
139
|
const context = useDialogContext();
|
|
140
140
|
const { theme, colorScheme } = useTheme_default();
|
|
141
141
|
const styles = Dialog_styles_default(theme, colorScheme);
|
|
142
|
-
const id = useId();
|
|
142
|
+
const id = useId$1();
|
|
143
143
|
useLayoutEffect(() => {
|
|
144
144
|
context.setDescriptionId(id);
|
|
145
145
|
return () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","names":["open: boolean","setOpen: (openVal: boolean) => void","data: UseFloatingReturn","interactions: UseInteractionsReturn","DialogContext: Context<DialogContextType>","context: DialogContextType","dialog: DialogHookReturn","DialogTrigger: ForwardRefExoticComponent<\n HTMLProps<HTMLElement> & DialogTriggerProps & RefAttributes<HTMLElement>\n>","context: DialogHookReturn","childrenRef: Ref<HTMLElement>","ref: ReturnType<typeof useMergeRefs>","DialogContent: ForwardRefExoticComponent<HTMLProps<HTMLDivElement> & RefAttributes<HTMLDivElement>>","useTheme","styles: Record<string, string>","useStyles","DialogHeading: ForwardRefExoticComponent<\n HTMLProps<HTMLHeadingElement> & RefAttributes<HTMLHeadingElement>\n>","id: string | undefined","Button","X","DialogDescription: ForwardRefExoticComponent<\n HTMLProps<HTMLParagraphElement> & RefAttributes<HTMLParagraphElement>\n>","DialogClose: ForwardRefExoticComponent<\n ButtonHTMLAttributes<HTMLButtonElement> & DialogCloseProps & RefAttributes<HTMLButtonElement>\n>","childrenRef: Ref<HTMLButtonElement>"],"sources":["../../../../src/components/primitives/Dialog/Dialog.tsx"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {cx} from '@emotion/css';\nimport {\n useFloating,\n useClick,\n useDismiss,\n useRole,\n useInteractions,\n useMergeRefs,\n FloatingFocusManager,\n FloatingOverlay,\n FloatingPortal,\n useId,\n UseFloatingReturn,\n UseInteractionsReturn,\n} from '@floating-ui/react';\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {\n type ButtonHTMLAttributes,\n type Context,\n type Dispatch,\n type FC,\n type ForwardRefExoticComponent,\n type HTMLProps,\n type JSX,\n type MouseEvent,\n type ReactNode,\n type Ref,\n type RefAttributes,\n type SetStateAction,\n cloneElement,\n createContext,\n forwardRef,\n isValidElement,\n useContext,\n useLayoutEffect,\n useMemo,\n useState,\n} from 'react';\nimport useStyles from './Dialog.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport Button from '../Button/Button';\nimport {X} from '../Icons';\n\ninterface DialogOptions {\n initialOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n open?: boolean;\n}\n\ninterface DialogHookReturn extends UseFloatingReturn, UseInteractionsReturn {\n descriptionId: string | undefined;\n labelId: string | undefined;\n open: boolean;\n setDescriptionId: Dispatch<SetStateAction<string | undefined>>;\n setLabelId: Dispatch<SetStateAction<string | undefined>>;\n setOpen: (open: boolean) => void;\n}\n\nexport function useDialog({\n initialOpen = false,\n open: controlledOpen,\n onOpenChange: setControlledOpen,\n}: DialogOptions = {}): DialogHookReturn {\n const [uncontrolledOpen, setUncontrolledOpen] = useState(initialOpen);\n const [labelId, setLabelId] = useState<string | undefined>();\n const [descriptionId, setDescriptionId] = useState<string | undefined>();\n\n const open: boolean = controlledOpen ?? uncontrolledOpen;\n const setOpen: (openVal: boolean) => void = setControlledOpen ?? setUncontrolledOpen;\n\n const data: UseFloatingReturn = useFloating({\n onOpenChange: setOpen,\n open,\n });\n\n const {context} = data;\n\n const click: ReturnType<typeof useClick> = useClick(context, {\n enabled: controlledOpen == null,\n });\n const dismiss: ReturnType<typeof useDismiss> = useDismiss(context, {outsidePressEvent: 'mousedown'});\n const role: ReturnType<typeof useRole> = useRole(context);\n\n const interactions: UseInteractionsReturn = useInteractions([click, dismiss, role]);\n\n return useMemo(\n () => ({\n open,\n setOpen,\n ...interactions,\n ...data,\n descriptionId,\n labelId,\n setDescriptionId,\n setLabelId,\n }),\n [open, setOpen, interactions, data, labelId, descriptionId],\n );\n}\n\ntype DialogContextType =\n | (DialogHookReturn & {\n setDescriptionId: Dispatch<SetStateAction<string | undefined>>;\n setLabelId: Dispatch<SetStateAction<string | undefined>>;\n })\n | null;\n\nconst DialogContext: Context<DialogContextType> = createContext<DialogContextType>(null);\n\nexport const useDialogContext = (): DialogHookReturn => {\n const context: DialogContextType = useContext(DialogContext);\n if (context == null) {\n throw new Error('Dialog components must be wrapped in <Dialog />');\n }\n return context;\n};\n\n// Dialog Components (Modal)\nexport function Dialog({children, ...options}: {children: ReactNode} & DialogOptions): JSX.Element {\n const dialog: DialogHookReturn = useDialog(options);\n return <DialogContext.Provider value={dialog}>{children}</DialogContext.Provider>;\n}\n\ninterface DialogTriggerProps {\n asChild?: boolean;\n children: ReactNode;\n}\n\nexport const DialogTrigger: ForwardRefExoticComponent<\n HTMLProps<HTMLElement> & DialogTriggerProps & RefAttributes<HTMLElement>\n> = forwardRef<HTMLElement, HTMLProps<HTMLElement> & DialogTriggerProps>(\n ({children, asChild = false, ...props}: HTMLProps<HTMLElement> & DialogTriggerProps, propRef: Ref<HTMLElement>) => {\n const context: DialogHookReturn = useDialogContext();\n const childrenRef: Ref<HTMLElement> = (children as any).ref;\n const ref: ReturnType<typeof useMergeRefs> = useMergeRefs([context.refs.setReference, propRef, childrenRef]);\n\n if (asChild && isValidElement(children)) {\n return cloneElement(\n children,\n context.getReferenceProps({\n ref,\n ...props,\n ...(children.props as any),\n 'data-state': context.open ? 'open' : 'closed',\n }),\n );\n }\n\n return (\n <button ref={ref} data-state={context.open ? 'open' : 'closed'} {...context.getReferenceProps(props)}>\n {children}\n </button>\n );\n },\n);\n\nexport const DialogContent: ForwardRefExoticComponent<HTMLProps<HTMLDivElement> & RefAttributes<HTMLDivElement>> =\n forwardRef<HTMLDivElement, HTMLProps<HTMLDivElement>>(\n (props: HTMLProps<HTMLDivElement>, propRef: Ref<HTMLDivElement>) => {\n const {context: floatingContext, ...context} = useDialogContext();\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme);\n const ref: ReturnType<typeof useMergeRefs> = useMergeRefs([context.refs.setFloating, propRef]);\n\n if (!floatingContext.open) return null;\n\n return (\n <FloatingPortal>\n <FloatingOverlay\n className={cx(withVendorCSSClassPrefix(bem('dialog', 'overlay')), styles['overlay'])}\n lockScroll\n >\n <FloatingFocusManager context={floatingContext} initialFocus={-1}>\n <div\n ref={ref}\n className={cx(withVendorCSSClassPrefix(bem('dialog', 'content')), styles['content'], props.className)}\n aria-labelledby={context.labelId}\n aria-describedby={context.descriptionId}\n {...context.getFloatingProps(props)}\n >\n {props.children}\n </div>\n </FloatingFocusManager>\n </FloatingOverlay>\n </FloatingPortal>\n );\n },\n );\n\nexport const DialogHeading: ForwardRefExoticComponent<\n HTMLProps<HTMLHeadingElement> & RefAttributes<HTMLHeadingElement>\n> = forwardRef<HTMLHeadingElement, HTMLProps<HTMLHeadingElement>>(\n ({children, ...props}: HTMLProps<HTMLHeadingElement>, ref: Ref<HTMLHeadingElement>) => {\n const context: DialogHookReturn = useDialogContext();\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme);\n const id: string | undefined = useId();\n\n useLayoutEffect((): (() => void) => {\n context.setLabelId(id);\n return (): void => {\n context.setLabelId(undefined);\n };\n }, [id, context.setLabelId]);\n\n return (\n <div className={cx(withVendorCSSClassPrefix(bem('dialog', 'header')), styles['header'])}>\n <h2\n {...props}\n ref={ref}\n id={id}\n className={cx(withVendorCSSClassPrefix(bem('dialog', 'title')), styles['headerTitle'])}\n >\n {children}\n </h2>\n <Button\n color=\"tertiary\"\n variant=\"icon\"\n size=\"small\"\n shape=\"round\"\n onClick={(): void => {\n context.setOpen(false);\n }}\n aria-label=\"Close\"\n >\n <X width={16} height={16} />\n </Button>\n </div>\n );\n },\n);\n\nexport const DialogDescription: ForwardRefExoticComponent<\n HTMLProps<HTMLParagraphElement> & RefAttributes<HTMLParagraphElement>\n> = forwardRef<HTMLParagraphElement, HTMLProps<HTMLParagraphElement>>(\n ({children, ...props}: HTMLProps<HTMLParagraphElement>, ref: Ref<HTMLParagraphElement>) => {\n const context: DialogHookReturn = useDialogContext();\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme);\n const id: string | undefined = useId();\n\n useLayoutEffect((): (() => void) => {\n context.setDescriptionId(id);\n return (): void => {\n context.setDescriptionId(undefined);\n };\n }, [id, context.setDescriptionId]);\n\n return (\n <p\n {...props}\n ref={ref}\n id={id}\n className={cx(withVendorCSSClassPrefix(bem('dialog', 'description')), styles['description'], props.className)}\n >\n {children}\n </p>\n );\n },\n);\n\ninterface DialogCloseProps {\n asChild?: boolean;\n children?: ReactNode;\n}\n\nexport const DialogClose: ForwardRefExoticComponent<\n ButtonHTMLAttributes<HTMLButtonElement> & DialogCloseProps & RefAttributes<HTMLButtonElement>\n> = forwardRef<HTMLButtonElement, ButtonHTMLAttributes<HTMLButtonElement> & DialogCloseProps>(\n (\n {children, asChild = false, ...props}: ButtonHTMLAttributes<HTMLButtonElement> & DialogCloseProps,\n propRef: Ref<HTMLButtonElement>,\n ) => {\n const context: DialogHookReturn = useDialogContext();\n const childrenRef: Ref<HTMLButtonElement> = (children as any)?.ref;\n const ref: ReturnType<typeof useMergeRefs> = useMergeRefs([propRef, childrenRef]);\n\n const handleClick = (event: MouseEvent<HTMLButtonElement>): void => {\n context.setOpen(false);\n props.onClick?.(event);\n };\n\n if (asChild && isValidElement(children)) {\n return cloneElement(children, {\n ref,\n ...props,\n ...(children.props as any),\n onClick: handleClick,\n });\n }\n\n return (\n <Button\n {...props}\n ref={ref}\n onClick={handleClick}\n className={cx(withVendorCSSClassPrefix(bem('dialog', 'close')), props.className)}\n variant=\"text\"\n >\n {children}\n </Button>\n );\n },\n);\n\nDialogTrigger.displayName = 'DialogTrigger';\nDialogContent.displayName = 'DialogContent';\nDialogHeading.displayName = 'DialogHeading';\nDialogDescription.displayName = 'DialogDescription';\nDialogClose.displayName = 'DialogClose';\n\n// Attach subcomponents to Dialog\n(Dialog as any).Trigger = DialogTrigger;\n(Dialog as any).Content = DialogContent;\n(Dialog as any).Heading = DialogHeading;\n(Dialog as any).Description = DialogDescription;\n(Dialog as any).Close = DialogClose;\n\nexport interface DialogComponent extends FC<{children: ReactNode} & DialogOptions> {\n Close: typeof DialogClose;\n Content: typeof DialogContent;\n Description: typeof DialogDescription;\n Heading: typeof DialogHeading;\n Trigger: typeof DialogTrigger;\n}\n\nexport default Dialog as DialogComponent;\n"],"mappings":";;;;;;;;;;;AA4EA,SAAgB,UAAU,EACxB,cAAc,OACd,MAAM,gBACN,cAAc,sBACG,EAAE,EAAoB;CACvC,MAAM,CAAC,kBAAkB,uBAAuB,SAAS,YAAY;CACrE,MAAM,CAAC,SAAS,cAAc,UAA8B;CAC5D,MAAM,CAAC,eAAe,oBAAoB,UAA8B;CAExE,MAAMA,OAAgB,kBAAkB;CACxC,MAAMC,UAAsC,qBAAqB;CAEjE,MAAMC,OAA0B,YAAY;EAC1C,cAAc;EACd;EACD,CAAC;CAEF,MAAM,EAAC,YAAW;CAQlB,MAAMC,eAAsC,gBAAgB;EANjB,SAAS,SAAS,EAC3D,SAAS,kBAAkB,MAC5B,CAAC;EAC6C,WAAW,SAAS,EAAC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AiB,GAAG;AAC5B,eAAmB;AACjB,WAAQ,iBAAiB,OAAU;;IAEpC,CAAC,IAAI,QAAQ,iBAAiB,CAAC;AAElC,QACE,oBAAC;EACC,GAAI;EACC;EACD;EACJ,WAAW,GAAG,yBAAyB,IAAI,UAAU,cAAc,CAAC,EAAE,OAAO,gBAAgB,MAAM,UAAU;EAE5G;GACC;EAGT;AAOD,MAAaI,cAET,YAEA,EAAC,UAAU,UAAU,MAAO,GAAG,SAC/B,YACG;CACH,MAAMZ,UAA4B,kBAAkB;CACpD,MAAMa,cAAuC,UAAkB;CAC/D,MAAMX,MAAuC,aAAa,CAAC,SAAS,YAAY,CAAC;CAEjF,MAAM,eAAe,UAA+C;AAClE,UAAQ,QAAQ,MAAM;AACtB,QAAM,UAAU,MAAM;;AAGxB,KAAI,WAAW,eAAe,SAAS,CACrC,QAAO,aAAa,UAAU;EAC5B;EACA,GAAG;EACH,GAAI,SAAS;EACb,SAAS;EACV,CAAC;AAGJ,QACE,oBAACO;EACC,GAAI;EACC;EACL,SAAS;EACT,WAAW,GAAG,yBAAyB,IAAI,UAAU,QAAQ,CAAC,EAAE,MAAM,UAAU;EAChF,SAAQ;EAEP;GACM;EAGd;AAED,cAAc,cAAc;AAC5B,cAAc,cAAc;AAC5B,cAAc,cAAc;AAC5B,kBAAkB,cAAc;AAChC,YAAY,cAAc;AAG1B,AAAC,OAAe,UAAU;AAC1B,AAAC,OAAe,UAAU;AAC1B,AAAC,OAAe,UAAU;AAC1B,AAAC,OAAe,cAAc;AAC9B,AAAC,OAAe,QAAQ;AAUxB,qBAAe"}
|
|
1
|
+
{"version":3,"file":"Dialog.js","names":["open: boolean","setOpen: (openVal: boolean) => void","data: UseFloatingReturn","interactions: UseInteractionsReturn","DialogContext: Context<DialogContextType>","context: DialogContextType","dialog: DialogHookReturn","DialogTrigger: ForwardRefExoticComponent<\n HTMLProps<HTMLElement> & DialogTriggerProps & RefAttributes<HTMLElement>\n>","context: DialogHookReturn","childrenRef: Ref<HTMLElement>","ref: ReturnType<typeof useMergeRefs>","DialogContent: ForwardRefExoticComponent<HTMLProps<HTMLDivElement> & RefAttributes<HTMLDivElement>>","useTheme","styles: Record<string, string>","useStyles","DialogHeading: ForwardRefExoticComponent<\n HTMLProps<HTMLHeadingElement> & RefAttributes<HTMLHeadingElement>\n>","id: string | undefined","useId","Button","X","DialogDescription: ForwardRefExoticComponent<\n HTMLProps<HTMLParagraphElement> & RefAttributes<HTMLParagraphElement>\n>","DialogClose: ForwardRefExoticComponent<\n ButtonHTMLAttributes<HTMLButtonElement> & DialogCloseProps & RefAttributes<HTMLButtonElement>\n>","childrenRef: Ref<HTMLButtonElement>"],"sources":["../../../../src/components/primitives/Dialog/Dialog.tsx"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {cx} from '@emotion/css';\nimport {\n useFloating,\n useClick,\n useDismiss,\n useRole,\n useInteractions,\n useMergeRefs,\n FloatingFocusManager,\n FloatingOverlay,\n FloatingPortal,\n useId,\n UseFloatingReturn,\n UseInteractionsReturn,\n} from '@floating-ui/react';\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {\n type ButtonHTMLAttributes,\n type Context,\n type Dispatch,\n type FC,\n type ForwardRefExoticComponent,\n type HTMLProps,\n type JSX,\n type MouseEvent,\n type ReactNode,\n type Ref,\n type RefAttributes,\n type SetStateAction,\n cloneElement,\n createContext,\n forwardRef,\n isValidElement,\n useContext,\n useLayoutEffect,\n useMemo,\n useState,\n} from 'react';\nimport useStyles from './Dialog.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport Button from '../Button/Button';\nimport {X} from '../Icons';\n\ninterface DialogOptions {\n initialOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n open?: boolean;\n}\n\ninterface DialogHookReturn extends UseFloatingReturn, UseInteractionsReturn {\n descriptionId: string | undefined;\n labelId: string | undefined;\n open: boolean;\n setDescriptionId: Dispatch<SetStateAction<string | undefined>>;\n setLabelId: Dispatch<SetStateAction<string | undefined>>;\n setOpen: (open: boolean) => void;\n}\n\nexport function useDialog({\n initialOpen = false,\n open: controlledOpen,\n onOpenChange: setControlledOpen,\n}: DialogOptions = {}): DialogHookReturn {\n const [uncontrolledOpen, setUncontrolledOpen] = useState(initialOpen);\n const [labelId, setLabelId] = useState<string | undefined>();\n const [descriptionId, setDescriptionId] = useState<string | undefined>();\n\n const open: boolean = controlledOpen ?? uncontrolledOpen;\n const setOpen: (openVal: boolean) => void = setControlledOpen ?? setUncontrolledOpen;\n\n const data: UseFloatingReturn = useFloating({\n onOpenChange: setOpen,\n open,\n });\n\n const {context} = data;\n\n const click: ReturnType<typeof useClick> = useClick(context, {\n enabled: controlledOpen == null,\n });\n const dismiss: ReturnType<typeof useDismiss> = useDismiss(context, {outsidePressEvent: 'mousedown'});\n const role: ReturnType<typeof useRole> = useRole(context);\n\n const interactions: UseInteractionsReturn = useInteractions([click, dismiss, role]);\n\n return useMemo(\n () => ({\n open,\n setOpen,\n ...interactions,\n ...data,\n descriptionId,\n labelId,\n setDescriptionId,\n setLabelId,\n }),\n [open, setOpen, interactions, data, labelId, descriptionId],\n );\n}\n\ntype DialogContextType =\n | (DialogHookReturn & {\n setDescriptionId: Dispatch<SetStateAction<string | undefined>>;\n setLabelId: Dispatch<SetStateAction<string | undefined>>;\n })\n | null;\n\nconst DialogContext: Context<DialogContextType> = createContext<DialogContextType>(null);\n\nexport const useDialogContext = (): DialogHookReturn => {\n const context: DialogContextType = useContext(DialogContext);\n if (context == null) {\n throw new Error('Dialog components must be wrapped in <Dialog />');\n }\n return context;\n};\n\n// Dialog Components (Modal)\nexport function Dialog({children, ...options}: {children: ReactNode} & DialogOptions): JSX.Element {\n const dialog: DialogHookReturn = useDialog(options);\n return <DialogContext.Provider value={dialog}>{children}</DialogContext.Provider>;\n}\n\ninterface DialogTriggerProps {\n asChild?: boolean;\n children: ReactNode;\n}\n\nexport const DialogTrigger: ForwardRefExoticComponent<\n HTMLProps<HTMLElement> & DialogTriggerProps & RefAttributes<HTMLElement>\n> = forwardRef<HTMLElement, HTMLProps<HTMLElement> & DialogTriggerProps>(\n ({children, asChild = false, ...props}: HTMLProps<HTMLElement> & DialogTriggerProps, propRef: Ref<HTMLElement>) => {\n const context: DialogHookReturn = useDialogContext();\n const childrenRef: Ref<HTMLElement> = (children as any).ref;\n const ref: ReturnType<typeof useMergeRefs> = useMergeRefs([context.refs.setReference, propRef, childrenRef]);\n\n if (asChild && isValidElement(children)) {\n return cloneElement(\n children,\n context.getReferenceProps({\n ref,\n ...props,\n ...(children.props as any),\n 'data-state': context.open ? 'open' : 'closed',\n }),\n );\n }\n\n return (\n <button ref={ref} data-state={context.open ? 'open' : 'closed'} {...context.getReferenceProps(props)}>\n {children}\n </button>\n );\n },\n);\n\nexport const DialogContent: ForwardRefExoticComponent<HTMLProps<HTMLDivElement> & RefAttributes<HTMLDivElement>> =\n forwardRef<HTMLDivElement, HTMLProps<HTMLDivElement>>(\n (props: HTMLProps<HTMLDivElement>, propRef: Ref<HTMLDivElement>) => {\n const {context: floatingContext, ...context} = useDialogContext();\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme);\n const ref: ReturnType<typeof useMergeRefs> = useMergeRefs([context.refs.setFloating, propRef]);\n\n if (!floatingContext.open) return null;\n\n return (\n <FloatingPortal>\n <FloatingOverlay\n className={cx(withVendorCSSClassPrefix(bem('dialog', 'overlay')), styles['overlay'])}\n lockScroll\n >\n <FloatingFocusManager context={floatingContext} initialFocus={-1}>\n <div\n ref={ref}\n className={cx(withVendorCSSClassPrefix(bem('dialog', 'content')), styles['content'], props.className)}\n aria-labelledby={context.labelId}\n aria-describedby={context.descriptionId}\n {...context.getFloatingProps(props)}\n >\n {props.children}\n </div>\n </FloatingFocusManager>\n </FloatingOverlay>\n </FloatingPortal>\n );\n },\n );\n\nexport const DialogHeading: ForwardRefExoticComponent<\n HTMLProps<HTMLHeadingElement> & RefAttributes<HTMLHeadingElement>\n> = forwardRef<HTMLHeadingElement, HTMLProps<HTMLHeadingElement>>(\n ({children, ...props}: HTMLProps<HTMLHeadingElement>, ref: Ref<HTMLHeadingElement>) => {\n const context: DialogHookReturn = useDialogContext();\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme);\n const id: string | undefined = useId();\n\n useLayoutEffect((): (() => void) => {\n context.setLabelId(id);\n return (): void => {\n context.setLabelId(undefined);\n };\n }, [id, context.setLabelId]);\n\n return (\n <div className={cx(withVendorCSSClassPrefix(bem('dialog', 'header')), styles['header'])}>\n <h2\n {...props}\n ref={ref}\n id={id}\n className={cx(withVendorCSSClassPrefix(bem('dialog', 'title')), styles['headerTitle'])}\n >\n {children}\n </h2>\n <Button\n color=\"tertiary\"\n variant=\"icon\"\n size=\"small\"\n shape=\"round\"\n onClick={(): void => {\n context.setOpen(false);\n }}\n aria-label=\"Close\"\n >\n <X width={16} height={16} />\n </Button>\n </div>\n );\n },\n);\n\nexport const DialogDescription: ForwardRefExoticComponent<\n HTMLProps<HTMLParagraphElement> & RefAttributes<HTMLParagraphElement>\n> = forwardRef<HTMLParagraphElement, HTMLProps<HTMLParagraphElement>>(\n ({children, ...props}: HTMLProps<HTMLParagraphElement>, ref: Ref<HTMLParagraphElement>) => {\n const context: DialogHookReturn = useDialogContext();\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme);\n const id: string | undefined = useId();\n\n useLayoutEffect((): (() => void) => {\n context.setDescriptionId(id);\n return (): void => {\n context.setDescriptionId(undefined);\n };\n }, [id, context.setDescriptionId]);\n\n return (\n <p\n {...props}\n ref={ref}\n id={id}\n className={cx(withVendorCSSClassPrefix(bem('dialog', 'description')), styles['description'], props.className)}\n >\n {children}\n </p>\n );\n },\n);\n\ninterface DialogCloseProps {\n asChild?: boolean;\n children?: ReactNode;\n}\n\nexport const DialogClose: ForwardRefExoticComponent<\n ButtonHTMLAttributes<HTMLButtonElement> & DialogCloseProps & RefAttributes<HTMLButtonElement>\n> = forwardRef<HTMLButtonElement, ButtonHTMLAttributes<HTMLButtonElement> & DialogCloseProps>(\n (\n {children, asChild = false, ...props}: ButtonHTMLAttributes<HTMLButtonElement> & DialogCloseProps,\n propRef: Ref<HTMLButtonElement>,\n ) => {\n const context: DialogHookReturn = useDialogContext();\n const childrenRef: Ref<HTMLButtonElement> = (children as any)?.ref;\n const ref: ReturnType<typeof useMergeRefs> = useMergeRefs([propRef, childrenRef]);\n\n const handleClick = (event: MouseEvent<HTMLButtonElement>): void => {\n context.setOpen(false);\n props.onClick?.(event);\n };\n\n if (asChild && isValidElement(children)) {\n return cloneElement(children, {\n ref,\n ...props,\n ...(children.props as any),\n onClick: handleClick,\n });\n }\n\n return (\n <Button\n {...props}\n ref={ref}\n onClick={handleClick}\n className={cx(withVendorCSSClassPrefix(bem('dialog', 'close')), props.className)}\n variant=\"text\"\n >\n {children}\n </Button>\n );\n },\n);\n\nDialogTrigger.displayName = 'DialogTrigger';\nDialogContent.displayName = 'DialogContent';\nDialogHeading.displayName = 'DialogHeading';\nDialogDescription.displayName = 'DialogDescription';\nDialogClose.displayName = 'DialogClose';\n\n// Attach subcomponents to Dialog\n(Dialog as any).Trigger = DialogTrigger;\n(Dialog as any).Content = DialogContent;\n(Dialog as any).Heading = DialogHeading;\n(Dialog as any).Description = DialogDescription;\n(Dialog as any).Close = DialogClose;\n\nexport interface DialogComponent extends FC<{children: ReactNode} & DialogOptions> {\n Close: typeof DialogClose;\n Content: typeof DialogContent;\n Description: typeof DialogDescription;\n Heading: typeof DialogHeading;\n Trigger: typeof DialogTrigger;\n}\n\nexport default Dialog as DialogComponent;\n"],"mappings":";;;;;;;;;;;AA4EA,SAAgB,UAAU,EACxB,cAAc,OACd,MAAM,gBACN,cAAc,sBACG,EAAE,EAAoB;CACvC,MAAM,CAAC,kBAAkB,uBAAuB,SAAS,YAAY;CACrE,MAAM,CAAC,SAAS,cAAc,UAA8B;CAC5D,MAAM,CAAC,eAAe,oBAAoB,UAA8B;CAExE,MAAMA,OAAgB,kBAAkB;CACxC,MAAMC,UAAsC,qBAAqB;CAEjE,MAAMC,OAA0B,YAAY;EAC1C,cAAc;EACd;EACD,CAAC;CAEF,MAAM,EAAC,YAAW;CAQlB,MAAMC,eAAsC,gBAAgB;EANjB,SAAS,SAAS,EAC3D,SAAS,kBAAkB,MAC5B,CAAC;EAC6C,WAAW,SAAS,EAAC,mBAAmB,aAAY,CAAC;EAC3D,QAAQ,QAAQ;EAEyB,CAAC;AAEnF,QAAO,eACE;EACL;EACA;EACA,GAAG;EACH,GAAG;EACH;EACA;EACA;EACA;EACD,GACD;EAAC;EAAM;EAAS;EAAc;EAAM;EAAS;EAAc,CAC5D;;AAUH,MAAMC,gBAA4C,cAAiC,KAAK;AAExF,MAAa,yBAA2C;CACtD,MAAMC,UAA6B,WAAW,cAAc;AAC5D,KAAI,WAAW,KACb,OAAM,IAAI,MAAM,kDAAkD;AAEpE,QAAO;;AAIT,SAAgB,OAAO,EAAC,SAAU,GAAG,WAA8D;CACjG,MAAMC,SAA2B,UAAU,QAAQ;AACnD,QAAO,oBAAC,cAAc;EAAS,OAAO;EAAS;GAAkC;;AAQnF,MAAaC,gBAET,YACD,EAAC,UAAU,UAAU,MAAO,GAAG,SAAqD,YAA8B;CACjH,MAAMC,UAA4B,kBAAkB;CACpD,MAAMC,cAAiC,SAAiB;CACxD,MAAMC,MAAuC,aAAa;EAAC,QAAQ,KAAK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EACL,SAAS;EACT,WAAW,GAAG,yBAAyB,IAAI,UAAU,QAAQ,CAAC,EAAE,MAAM,UAAU;EAChF,SAAQ;EAEP;GACM;EAGd;AAED,cAAc,cAAc;AAC5B,cAAc,cAAc;AAC5B,cAAc,cAAc;AAC5B,kBAAkB,cAAc;AAChC,YAAY,cAAc;AAG1B,AAAC,OAAe,UAAU;AAC1B,AAAC,OAAe,UAAU;AAC1B,AAAC,OAAe,UAAU;AAC1B,AAAC,OAAe,cAAc;AAC9B,AAAC,OAAe,QAAQ;AAUxB,qBAAe"}
|
|
@@ -25,6 +25,7 @@ export interface ComponentRenderContext {
|
|
|
25
25
|
isFormValid: boolean;
|
|
26
26
|
isLoading: boolean;
|
|
27
27
|
meta?: FlowMetadataResponse | null;
|
|
28
|
+
resetForm?: () => void;
|
|
28
29
|
onInputBlur?: (name: string) => void;
|
|
29
30
|
onInputChange: (name: string, value: string) => void;
|
|
30
31
|
onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComponentRendererContext.d.ts","sourceRoot":"","sources":["../../../src/contexts/ComponentRenderer/ComponentRendererContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,qBAAqB,EAAE,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAC,OAAO,EAAiB,YAAY,EAAC,MAAM,OAAO,CAAC;AAE3D,MAAM,WAAW,sBAAsB;IACrC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;IAC3C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,WAAW,EAAE,OAAO,CAA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C;IACnC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,qBAAqB,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,cAAc,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5G,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxC;AAED,MAAM,MAAM,iBAAiB,GAAG,CAC9B,SAAS,EAAE,qBAAqB,EAChC,OAAO,EAAE,sBAAsB,KAC5B,YAAY,GAAG,IAAI,CAAC;AAEzB,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAErE,QAAA,MAAM,wBAAwB,EAAE,OAAO,CAAC,oBAAoB,CAA2C,CAAC;AAExG,eAAe,wBAAwB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComponentRendererContext.js","names":["ComponentRendererContext: Context<ComponentRendererMap>"],"sources":["../../../src/contexts/ComponentRenderer/ComponentRendererContext.ts"],"sourcesContent":["/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {EmbeddedFlowComponent, FlowMetadataResponse} from '@thunderid/browser';\nimport {Context, createContext, ReactElement} from 'react';\n\nexport interface ComponentRenderContext {\n additionalData?: Record<string, any>;\n authType: 'signin' | 'signup' | 'recovery';\n formErrors: Record<string, string>;\n formValues: Record<string, string>;\n isFormValid: boolean;\n isLoading: boolean;\n meta?: FlowMetadataResponse | null;\n onInputBlur?: (name: string) => void;\n onInputChange: (name: string, value: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n touchedFields: Record<string, boolean>;\n}\n\nexport type ComponentRenderer = (\n component: EmbeddedFlowComponent,\n context: ComponentRenderContext,\n) => ReactElement | null;\n\nexport type ComponentRendererMap = Record<string, ComponentRenderer>;\n\nconst ComponentRendererContext: Context<ComponentRendererMap> = createContext<ComponentRendererMap>({});\n\nexport default ComponentRendererContext;\n"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ComponentRendererContext.js","names":["ComponentRendererContext: Context<ComponentRendererMap>"],"sources":["../../../src/contexts/ComponentRenderer/ComponentRendererContext.ts"],"sourcesContent":["/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {EmbeddedFlowComponent, FlowMetadataResponse} from '@thunderid/browser';\nimport {Context, createContext, ReactElement} from 'react';\n\nexport interface ComponentRenderContext {\n additionalData?: Record<string, any>;\n authType: 'signin' | 'signup' | 'recovery';\n formErrors: Record<string, string>;\n formValues: Record<string, string>;\n isFormValid: boolean;\n isLoading: boolean;\n meta?: FlowMetadataResponse | null;\n resetForm?: () => void;\n onInputBlur?: (name: string) => void;\n onInputChange: (name: string, value: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n touchedFields: Record<string, boolean>;\n}\n\nexport type ComponentRenderer = (\n component: EmbeddedFlowComponent,\n context: ComponentRenderContext,\n) => ReactElement | null;\n\nexport type ComponentRendererMap = Record<string, ComponentRenderer>;\n\nconst ComponentRendererContext: Context<ComponentRendererMap> = createContext<ComponentRendererMap>({});\n\nexport default ComponentRendererContext;\n"],"mappings":";;;AA2CA,MAAMA,2BAA0D,cAAoC,EAAE,CAAC;AAEvG,uCAAe"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Returns the sentinel key used to store the selected prefix `value` for the affixed
|
|
20
|
+
* field addressed by `identifier`. The vendor namespace controls the runtime string
|
|
21
|
+
* so consumers overriding `vendor` do not conflict with the SDK default.
|
|
22
|
+
*/
|
|
23
|
+
export declare const affixPrefixKey: (identifier: string, vendor?: string) => string;
|
|
24
|
+
/**
|
|
25
|
+
* Returns the sentinel key used to store the postfix `value` for the affixed field
|
|
26
|
+
* addressed by `identifier`. See {@link affixPrefixKey}.
|
|
27
|
+
*/
|
|
28
|
+
export declare const affixPostfixKey: (identifier: string, vendor?: string) => string;
|
|
29
|
+
/**
|
|
30
|
+
* Rewrites `formData` (returns a new object) so that any affixed-input identifier
|
|
31
|
+
* tracked by matching sentinel prefix/postfix keys is replaced with its composed
|
|
32
|
+
* form `${prefix}${typed}${postfix}`. Sentinel keys are stripped from the result.
|
|
33
|
+
*
|
|
34
|
+
* Behaviour:
|
|
35
|
+
* - Prefix present, postfix present → `prefix + typed + postfix`.
|
|
36
|
+
* - Only prefix present → `prefix + typed`.
|
|
37
|
+
* - Only postfix present → `typed + postfix`.
|
|
38
|
+
* - Both empty / typed empty → the identifier is left untouched.
|
|
39
|
+
* - No sentinel keys → returns a shallow copy of `formData` unchanged.
|
|
40
|
+
*
|
|
41
|
+
* The input object is not mutated. This is component-type agnostic: any field carrying
|
|
42
|
+
* matching sentinel keys is composed, regardless of whether it originated from a
|
|
43
|
+
* TEXT_INPUT, EMAIL_INPUT, PASSWORD_INPUT, or PHONE_INPUT.
|
|
44
|
+
*
|
|
45
|
+
* @param formData - The current form values map (values indexed by field identifier).
|
|
46
|
+
* @param vendor - The vendor namespace configured on the SDK client, if any. Sentinel
|
|
47
|
+
* keys are resolved through this namespace so composition ignores unrelated keys
|
|
48
|
+
* written by other vendors when multiple SDK instances share a form.
|
|
49
|
+
*/
|
|
50
|
+
declare const composeAffixedInputs: (formData: Record<string, string>, vendor?: string) => Record<string, string>;
|
|
51
|
+
export default composeAffixedInputs;
|
|
52
|
+
//# sourceMappingURL=composeAffixedInputs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composeAffixedInputs.d.ts","sourceRoot":"","sources":["../../src/utils/composeAffixedInputs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAiBH;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,YAAY,MAAM,EAAE,SAAS,MAAM,KAAG,MAAkD,CAAC;AAExH;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,YAAY,MAAM,EAAE,SAAS,MAAM,KAAG,MAC3B,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,oBAAoB,GAAI,UAAU,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,MAAM,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CA6BtG,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { getVendorPrefix } from "@thunderid/browser";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/composeAffixedInputs.ts
|
|
4
|
+
/**
|
|
5
|
+
* Returns the runtime sentinel prefix used to tag "selected prefix" entries in the
|
|
6
|
+
* form-state map. Resolved through the vendor namespace so white-labeled deployments
|
|
7
|
+
* do not collide with each other or with a real field identifier.
|
|
8
|
+
*/
|
|
9
|
+
const prefixSentinel = (vendor) => `__${getVendorPrefix(vendor)}_prefix__`;
|
|
10
|
+
/**
|
|
11
|
+
* Returns the runtime sentinel prefix used to tag "postfix" entries in the form-state
|
|
12
|
+
* map. See {@link prefixSentinel}.
|
|
13
|
+
*/
|
|
14
|
+
const postfixSentinel = (vendor) => `__${getVendorPrefix(vendor)}_postfix__`;
|
|
15
|
+
/**
|
|
16
|
+
* Returns the sentinel key used to store the selected prefix `value` for the affixed
|
|
17
|
+
* field addressed by `identifier`. The vendor namespace controls the runtime string
|
|
18
|
+
* so consumers overriding `vendor` do not conflict with the SDK default.
|
|
19
|
+
*/
|
|
20
|
+
const affixPrefixKey = (identifier, vendor) => `${prefixSentinel(vendor)}${identifier}`;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the sentinel key used to store the postfix `value` for the affixed field
|
|
23
|
+
* addressed by `identifier`. See {@link affixPrefixKey}.
|
|
24
|
+
*/
|
|
25
|
+
const affixPostfixKey = (identifier, vendor) => `${postfixSentinel(vendor)}${identifier}`;
|
|
26
|
+
/**
|
|
27
|
+
* Rewrites `formData` (returns a new object) so that any affixed-input identifier
|
|
28
|
+
* tracked by matching sentinel prefix/postfix keys is replaced with its composed
|
|
29
|
+
* form `${prefix}${typed}${postfix}`. Sentinel keys are stripped from the result.
|
|
30
|
+
*
|
|
31
|
+
* Behaviour:
|
|
32
|
+
* - Prefix present, postfix present → `prefix + typed + postfix`.
|
|
33
|
+
* - Only prefix present → `prefix + typed`.
|
|
34
|
+
* - Only postfix present → `typed + postfix`.
|
|
35
|
+
* - Both empty / typed empty → the identifier is left untouched.
|
|
36
|
+
* - No sentinel keys → returns a shallow copy of `formData` unchanged.
|
|
37
|
+
*
|
|
38
|
+
* The input object is not mutated. This is component-type agnostic: any field carrying
|
|
39
|
+
* matching sentinel keys is composed, regardless of whether it originated from a
|
|
40
|
+
* TEXT_INPUT, EMAIL_INPUT, PASSWORD_INPUT, or PHONE_INPUT.
|
|
41
|
+
*
|
|
42
|
+
* @param formData - The current form values map (values indexed by field identifier).
|
|
43
|
+
* @param vendor - The vendor namespace configured on the SDK client, if any. Sentinel
|
|
44
|
+
* keys are resolved through this namespace so composition ignores unrelated keys
|
|
45
|
+
* written by other vendors when multiple SDK instances share a form.
|
|
46
|
+
*/
|
|
47
|
+
const composeAffixedInputs = (formData, vendor) => {
|
|
48
|
+
const composed = { ...formData };
|
|
49
|
+
const prefixTag = prefixSentinel(vendor);
|
|
50
|
+
const postfixTag = postfixSentinel(vendor);
|
|
51
|
+
for (const key of Object.keys(formData)) {
|
|
52
|
+
if (!key.startsWith(prefixTag) && !key.startsWith(postfixTag)) continue;
|
|
53
|
+
const identifier = key.startsWith(prefixTag) ? key.slice(prefixTag.length) : key.slice(postfixTag.length);
|
|
54
|
+
const typed = composed[identifier] ?? "";
|
|
55
|
+
if (typed === "") {
|
|
56
|
+
delete composed[affixPrefixKey(identifier, vendor)];
|
|
57
|
+
delete composed[affixPostfixKey(identifier, vendor)];
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
composed[identifier] = `${composed[affixPrefixKey(identifier, vendor)] ?? ""}${typed}${composed[affixPostfixKey(identifier, vendor)] ?? ""}`;
|
|
61
|
+
delete composed[affixPrefixKey(identifier, vendor)];
|
|
62
|
+
delete composed[affixPostfixKey(identifier, vendor)];
|
|
63
|
+
}
|
|
64
|
+
return composed;
|
|
65
|
+
};
|
|
66
|
+
var composeAffixedInputs_default = composeAffixedInputs;
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
export { affixPostfixKey, affixPrefixKey, composeAffixedInputs_default as default };
|
|
70
|
+
//# sourceMappingURL=composeAffixedInputs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composeAffixedInputs.js","names":["composed: Record<string, string>","prefixTag: string","postfixTag: string","identifier: string","typed: string"],"sources":["../../src/utils/composeAffixedInputs.ts"],"sourcesContent":["/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {getVendorPrefix} from '@thunderid/browser';\n\n/**\n * Returns the runtime sentinel prefix used to tag \"selected prefix\" entries in the\n * form-state map. Resolved through the vendor namespace so white-labeled deployments\n * do not collide with each other or with a real field identifier.\n */\nconst prefixSentinel = (vendor?: string): string => `__${getVendorPrefix(vendor)}_prefix__`;\n\n/**\n * Returns the runtime sentinel prefix used to tag \"postfix\" entries in the form-state\n * map. See {@link prefixSentinel}.\n */\nconst postfixSentinel = (vendor?: string): string => `__${getVendorPrefix(vendor)}_postfix__`;\n\n/**\n * Returns the sentinel key used to store the selected prefix `value` for the affixed\n * field addressed by `identifier`. The vendor namespace controls the runtime string\n * so consumers overriding `vendor` do not conflict with the SDK default.\n */\nexport const affixPrefixKey = (identifier: string, vendor?: string): string => `${prefixSentinel(vendor)}${identifier}`;\n\n/**\n * Returns the sentinel key used to store the postfix `value` for the affixed field\n * addressed by `identifier`. See {@link affixPrefixKey}.\n */\nexport const affixPostfixKey = (identifier: string, vendor?: string): string =>\n `${postfixSentinel(vendor)}${identifier}`;\n\n/**\n * Rewrites `formData` (returns a new object) so that any affixed-input identifier\n * tracked by matching sentinel prefix/postfix keys is replaced with its composed\n * form `${prefix}${typed}${postfix}`. Sentinel keys are stripped from the result.\n *\n * Behaviour:\n * - Prefix present, postfix present → `prefix + typed + postfix`.\n * - Only prefix present → `prefix + typed`.\n * - Only postfix present → `typed + postfix`.\n * - Both empty / typed empty → the identifier is left untouched.\n * - No sentinel keys → returns a shallow copy of `formData` unchanged.\n *\n * The input object is not mutated. This is component-type agnostic: any field carrying\n * matching sentinel keys is composed, regardless of whether it originated from a\n * TEXT_INPUT, EMAIL_INPUT, PASSWORD_INPUT, or PHONE_INPUT.\n *\n * @param formData - The current form values map (values indexed by field identifier).\n * @param vendor - The vendor namespace configured on the SDK client, if any. Sentinel\n * keys are resolved through this namespace so composition ignores unrelated keys\n * written by other vendors when multiple SDK instances share a form.\n */\nconst composeAffixedInputs = (formData: Record<string, string>, vendor?: string): Record<string, string> => {\n const composed: Record<string, string> = {...formData};\n const prefixTag: string = prefixSentinel(vendor);\n const postfixTag: string = postfixSentinel(vendor);\n\n for (const key of Object.keys(formData)) {\n if (!key.startsWith(prefixTag) && !key.startsWith(postfixTag)) {\n continue;\n }\n\n const identifier: string = key.startsWith(prefixTag) ? key.slice(prefixTag.length) : key.slice(postfixTag.length);\n\n const typed: string = composed[identifier] ?? '';\n if (typed === '') {\n // Preserve emptiness — required-field checks are the caller's responsibility.\n delete composed[affixPrefixKey(identifier, vendor)];\n delete composed[affixPostfixKey(identifier, vendor)];\n continue;\n }\n\n const prefix: string = composed[affixPrefixKey(identifier, vendor)] ?? '';\n const postfix: string = composed[affixPostfixKey(identifier, vendor)] ?? '';\n\n composed[identifier] = `${prefix}${typed}${postfix}`;\n delete composed[affixPrefixKey(identifier, vendor)];\n delete composed[affixPostfixKey(identifier, vendor)];\n }\n\n return composed;\n};\n\nexport default composeAffixedInputs;\n"],"mappings":";;;;;;;;AAyBA,MAAM,kBAAkB,WAA4B,KAAK,gBAAgB,OAAO,CAAC;;;;;AAMjF,MAAM,mBAAmB,WAA4B,KAAK,gBAAgB,OAAO,CAAC;;;;;;AAOlF,MAAa,kBAAkB,YAAoB,WAA4B,GAAG,eAAe,OAAO,GAAG;;;;;AAM3G,MAAa,mBAAmB,YAAoB,WAClD,GAAG,gBAAgB,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;AAuB/B,MAAM,wBAAwB,UAAkC,WAA4C;CAC1G,MAAMA,WAAmC,EAAC,GAAG,UAAS;CACtD,MAAMC,YAAoB,eAAe,OAAO;CAChD,MAAMC,aAAqB,gBAAgB,OAAO;AAElD,MAAK,MAAM,OAAO,OAAO,KAAK,SAAS,EAAE;AACvC,MAAI,CAAC,IAAI,WAAW,UAAU,IAAI,CAAC,IAAI,WAAW,WAAW,CAC3D;EAGF,MAAMC,aAAqB,IAAI,WAAW,UAAU,GAAG,IAAI,MAAM,UAAU,OAAO,GAAG,IAAI,MAAM,WAAW,OAAO;EAEjH,MAAMC,QAAgB,SAAS,eAAe;AAC9C,MAAI,UAAU,IAAI;AAEhB,UAAO,SAAS,eAAe,YAAY,OAAO;AAClD,UAAO,SAAS,gBAAgB,YAAY,OAAO;AACnD;;AAMF,WAAS,cAAc,GAHA,SAAS,eAAe,YAAY,OAAO,KAAK,KAGpC,QAFX,SAAS,gBAAgB,YAAY,OAAO,KAAK;AAGzE,SAAO,SAAS,eAAe,YAAY,OAAO;AAClD,SAAO,SAAS,gBAAgB,YAAY,OAAO;;AAGrD,QAAO;;AAGT,mCAAe"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thunderid/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "React SDK for ThunderID",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"thunderid",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@floating-ui/react": "0.27.12",
|
|
62
62
|
"dompurify": "3.4.11",
|
|
63
63
|
"tslib": "2.8.1",
|
|
64
|
-
"@thunderid/browser": "^0.
|
|
64
|
+
"@thunderid/browser": "^0.6.0"
|
|
65
65
|
},
|
|
66
66
|
"publishConfig": {
|
|
67
67
|
"access": "public"
|