@nori-ui/core 1.8.0 → 1.9.1
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/{chunk-PLQPBMG2.js → chunk-BXZGCOKT.js} +2 -2
- package/dist/{chunk-PLQPBMG2.js.map → chunk-BXZGCOKT.js.map} +1 -1
- package/dist/{chunk-RI4Y2C5U.js → chunk-KLK7OMFT.js} +3 -3
- package/dist/{chunk-RI4Y2C5U.js.map → chunk-KLK7OMFT.js.map} +1 -1
- package/dist/chunk-OHWRTHGL.js +495 -0
- package/dist/chunk-OHWRTHGL.js.map +1 -0
- package/dist/{chunk-V5QSMDZL.js → chunk-QB6RH6UU.js} +3 -3
- package/dist/{chunk-V5QSMDZL.js.map → chunk-QB6RH6UU.js.map} +1 -1
- package/dist/chunk-S763GTIZ.js +350 -0
- package/dist/chunk-S763GTIZ.js.map +1 -0
- package/dist/chunk-UJRVWGK7.js +3 -0
- package/dist/chunk-UJRVWGK7.js.map +1 -0
- package/dist/client.cjs +2248 -1424
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +2 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.js +13 -10
- package/dist/client.js.map +1 -1
- package/dist/components/Accordion/index.js +2 -2
- package/dist/components/Command/index.cjs +1371 -0
- package/dist/components/Command/index.cjs.map +1 -0
- package/dist/components/Command/index.d.cts +89 -0
- package/dist/components/Command/index.d.ts +89 -0
- package/dist/components/Command/index.js +11 -0
- package/dist/components/Command/index.js.map +1 -0
- package/dist/components/Dialog/index.js +2 -1
- package/dist/components/Sidebar/index.cjs +675 -0
- package/dist/components/Sidebar/index.cjs.map +1 -0
- package/dist/components/Sidebar/index.d.cts +109 -0
- package/dist/components/Sidebar/index.d.ts +109 -0
- package/dist/components/Sidebar/index.js +7 -0
- package/dist/components/Sidebar/index.js.map +1 -0
- package/dist/components/Switch/index.js +2 -2
- package/dist/index.cjs +2248 -1424
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +13 -10
- package/package.json +1 -1
|
@@ -423,5 +423,5 @@ var Dialog = Object.assign(DialogRoot, {
|
|
|
423
423
|
});
|
|
424
424
|
|
|
425
425
|
export { Dialog };
|
|
426
|
-
//# sourceMappingURL=chunk-
|
|
427
|
-
//# sourceMappingURL=chunk-
|
|
426
|
+
//# sourceMappingURL=chunk-BXZGCOKT.js.map
|
|
427
|
+
//# sourceMappingURL=chunk-BXZGCOKT.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Dialog/Dialog.tsx"],"names":["RNText"],"mappings":";;;;;;;;;;;AAgCA,IAAM,aAAA,GAAgB,cAAyC,IAAI,CAAA;AAEnE,IAAM,gBAAA,2BAAoB,KAAA,KAAsC;AAC5D,EAAA,MAAM,GAAA,GAAM,WAAW,aAAa,CAAA;AACpC,EAAA,IAAI,CAAC,GAAA,EAAK;AACN,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,CAAA,EAAI,KAAK,CAAA,qCAAA,CAAuC,CAAA;AAAA,EACpE;AACA,EAAA,OAAO,GAAA;AACX,CAAA,EANyB,kBAAA,CAAA;AAiCzB,IAAM,UAAA,2BAAc,EAAE,IAAA,EAAM,cAAc,KAAA,EAAO,YAAA,EAAc,UAAS,KAAmB;AACvF,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAkB,WAAW,CAAA;AACvD,EAAA,MAAM,eAAe,IAAA,KAAS,MAAA;AAC9B,EAAA,MAAM,OAAA,GAAU,eAAe,IAAA,GAAO,KAAA;AAEtC,EAAA,MAAM,OAAA,GAAU,WAAA;AAAA,IACZ,CAAC,IAAA,KAAkB;AACf,MAAA,IAAI,CAAC,YAAA,EAAc;AACf,QAAA,QAAA,CAAS,IAAI,CAAA;AAAA,MACjB;AACA,MAAA,YAAA,GAAe,IAAI,CAAA;AAAA,IACvB,CAAA;AAAA,IACA,CAAC,cAA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B,IAAA,EAAM,IAAI,KAAA,EAAO,MAAA,CAAO,QAAA,CAAS,IAAA,CAAK,KAAA,EAAO;AAAA;AAAA,GAC7E;AAER,CAAA,EAxE2B,aAAA,CAAA;AAgFpB,IAAM,YAAA,mBAAe,MAAA,CAAA,CAAC,EAAE,QAAA,EAAU,WAAU,KAAyB;AACxE,EAAA,MAAM,SAAS,cAAA,EAAe;AAC9B,EAAA,uBACI,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACG,SAAA,EAAW,EAAA,CAAG,8CAAA,EAAgD,SAAS,CAAA;AAAA,MACvE,KAAA,EAAO;AAAA,QACH,SAAA,EAAW,EAAA,CAAG,MAAA,CAAO,OAAA,CAAQ,GAAG,CAAC,CAAA;AAAA,QACjC,aAAA,EAAe,KAAA;AAAA,QACf,UAAA,EAAY,QAAA;AAAA,QACZ,cAAA,EAAgB,UAAA;AAAA,QAChB,GAAA,EAAK,EAAA,CAAG,MAAA,CAAO,OAAA,CAAQ,GAAG,CAAC;AAAA,OAC/B;AAAA,MAEC;AAAA;AAAA,GACL;AAER,CAAA,EAhB4B,cAAA,CAAA;AAwBrB,IAAM,MAAA,GAAS,MAAA,CAAO,MAAA,CAAO,UAAA,EAAY;AAAA,EAC5C,OAAA,EAAS,aAAA;AAAA,EACT,OAAA,EAAS,aAAA;AAAA,EACT,KAAA,EAAO,WAAA;AAAA,EACP,WAAA,EAAa,iBAAA;AAAA,EACb,MAAA,EAAQ,YAAA;AAAA,EACR,KAAA,EAAO;AACX,CAAC","file":"chunk-PLQPBMG2.js","sourcesContent":["'use client';\n\nimport {\n createContext,\n isValidElement,\n type ReactElement,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\nimport type { ViewStyle } from 'react-native';\nimport { Modal, Platform, Pressable, Text as RNText, StyleSheet, View } from 'react-native';\nimport { defaultSemanticIcons } from '../../icons/default-semantic-icons';\nimport { Slot } from '../../slot';\nimport { px } from '../../theme/px';\nimport { useColorScheme } from '../../theme/use-color-scheme';\nimport { useThemeColors } from '../../theme/use-theme-colors';\nimport { cn } from '../../utils/cn';\nimport { BlurBackdrop } from './blur-backdrop';\n\ntype DialogContextValue = {\n open: boolean;\n setOpen: (next: boolean) => void;\n titleId: string;\n descriptionId: string;\n triggerRef: { current: HTMLElement | null };\n};\n\nconst DialogContext = createContext<DialogContextValue | null>(null);\n\nconst useDialogContext = (label: string): DialogContextValue => {\n const ctx = useContext(DialogContext);\n if (!ctx) {\n throw new Error(`<${label}> must be rendered inside a <Dialog>.`);\n }\n return ctx;\n};\n\nexport type DialogProps = {\n /** Controlled open state. */\n open?: boolean;\n /** Uncontrolled initial open state. @defaultValue false */\n defaultOpen?: boolean;\n /** Fires with the new open state. */\n onOpenChange?: (open: boolean) => void;\n children?: ReactNode;\n};\n\n/**\n * Modal dialog. Owns open state and provides context for `DialogTrigger`,\n * `DialogContent`, `DialogTitle`, `DialogDescription`, and `DialogClose`.\n *\n * Behavior:\n * - Click the trigger to open. Click outside the content, press Escape,\n * or click an explicit close to dismiss.\n * - Focus is trapped inside the content while open (web). On close, focus\n * returns to whatever opened the dialog.\n * - Background scrolling is locked while open (web).\n *\n * Cross-platform: uses RN `<Modal>` as the visibility/portal primitive. On\n * web, additional focus-trap / scroll-lock / Escape-key effects layer on\n * top via the platform check inside `DialogContent`.\n */\nconst DialogRoot = ({ open, defaultOpen = false, onOpenChange, children }: DialogProps) => {\n const [inner, setInner] = useState<boolean>(defaultOpen);\n const isControlled = open !== undefined;\n const current = isControlled ? open : inner;\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (!isControlled) {\n setInner(next);\n }\n onOpenChange?.(next);\n },\n [isControlled, onOpenChange]\n );\n\n const baseId = useId();\n const triggerRef = useRef<HTMLElement | null>(null);\n\n const ctxValue: DialogContextValue = {\n open: current,\n setOpen,\n titleId: `${baseId}-title`,\n descriptionId: `${baseId}-description`,\n triggerRef,\n };\n\n return <DialogContext.Provider value={ctxValue}>{children}</DialogContext.Provider>;\n};\n\nexport type DialogTriggerProps = {\n /** Render the child as the trigger (Slot pattern). Default true — pass `false` for an inline button. */\n asChild?: boolean;\n children?: ReactNode;\n className?: string;\n testID?: string;\n};\n\n/**\n * Element that opens the dialog when activated. Uses `asChild` by default so\n * any element (Button, Link, custom Pressable) becomes the trigger.\n */\nexport const DialogTrigger = ({ asChild = true, children, className, testID }: DialogTriggerProps) => {\n const ctx = useDialogContext('DialogTrigger');\n const onPress = useCallback(() => ctx.setOpen(true), [ctx]);\n\n if (asChild && isValidElement(children)) {\n const child = children as ReactElement<Record<string, unknown>>;\n // Pass both onClick (web HTML buttons) AND onPress (RN Pressable /\n // our own Button) so the trigger fires regardless of which event\n // model the wrapped child speaks. The child's existing handler\n // runs first, then we open.\n const fire = (existing: ((e: unknown) => void) | undefined) => (event: unknown) => {\n existing?.(event);\n ctx.setOpen(true);\n };\n return (\n <Slot\n ref={(node: HTMLElement | null) => {\n ctx.triggerRef.current = node;\n }}\n onClick={fire(child.props.onClick as ((e: unknown) => void) | undefined)}\n onPress={fire(child.props.onPress as ((e: unknown) => void) | undefined)}\n {...(testID !== undefined ? { 'data-testid': testID } : {})}\n {...(className !== undefined ? { className } : {})}\n >\n {child}\n </Slot>\n );\n }\n\n return (\n <Pressable\n ref={(node) => {\n ctx.triggerRef.current = node as unknown as HTMLElement | null;\n }}\n onPress={onPress}\n {...(testID !== undefined ? { testID } : {})}\n {...(className !== undefined ? { className } : {})}\n >\n {wrapStringChildren(children)}\n </Pressable>\n );\n};\n\n// On native, raw strings rendered as children of a non-Text component\n// throw \"Text strings must be rendered within a <Text> component\". On\n// web, react-native-web silently tolerates it. Wrap any string/number\n// children in an RNText so the same JSX renders cleanly on both\n// platforms. Non-string children are passed through unchanged.\nfunction wrapStringChildren(children: ReactNode): ReactNode {\n if (typeof children === 'string' || typeof children === 'number') {\n return <RNText>{children}</RNText>;\n }\n return children;\n}\n\n// Scrim + blur target values — applied at the entered state on web,\n// always on as a flat scrim on native (RN doesn't have backdrop-filter\n// and the native shim would be an extra peer dep for vanishingly little\n// visual gain on a v0 component).\n// 24% scrim + 4px blur — strong enough to push the page back but the\n// content underneath is still legible. Earlier 32%/8px felt like a frosted\n// glass slab that completely obscured the page; this lets the page show\n// through as \"behind glass, slightly out of focus.\"\nconst SCRIM_COLOR = 'rgba(0, 0, 0, 0.24)';\nconst BLUR_AMOUNT = 4;\n\n// Static overlay layout — alignment, fixed positioning. The animatable\n// bits (scrim color, backdrop-filter blur) live in a useEffect inside\n// the component that pokes them onto the DOM ref directly so rn-web's\n// style filter can't strip the non-RN keys (backdropFilter,\n// transitionProperty). On web the styles start at blur(0px) +\n// transparent and transition to the target values on the next frame.\n//\n// Why not put blur(8px) here as a constant: when blur is applied to a\n// layer that's mid-fade (e.g. RN Modal's animationType=\"fade\" fades\n// opacity from 0 → 1), Safari and Chromium GPU-composite the layer\n// without rendering backdrop-filter — so the blur appears to \"snap in\"\n// at the end of the fade. Animating blur explicitly via our own\n// transition (and disabling the Modal's fade on web) avoids the snap.\nconst OVERLAY_LAYOUT_BASE: ViewStyle = {\n position: Platform.OS === 'web' ? ('fixed' as unknown as 'absolute') : 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n alignItems: 'center',\n justifyContent: 'center',\n // On native the BlurBackdrop sibling renders BEHIND this overlay and\n // already provides dim + frosted-glass via expo-blur's `tint`/`intensity`.\n // Painting SCRIM_COLOR on top would mask the blur entirely (the user\n // sees only a flat tint), so the overlay stays transparent and the\n // BlurView is the dominant visual on native.\n ...(Platform.OS === 'web' ? ({ zIndex: 50 } as ViewStyle) : { backgroundColor: 'transparent' }),\n};\n\n// Layout / animation only — theme-driven dimensions are merged inside\n// DialogContent below.\nconst CONTENT_LAYOUT_BASE: ViewStyle = {\n width: '100%',\n maxWidth: 480, // component-density literal — not from theme\n ...(Platform.OS === 'web'\n ? ({\n boxShadow: '0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)',\n } as ViewStyle)\n : { elevation: 24 }),\n};\n\nconst FOCUSABLE_SELECTOR =\n 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\nexport type DialogContentProps = {\n children?: ReactNode;\n className?: string;\n testID?: string;\n};\n\n/**\n * The visible dialog surface — overlay + centered card. Renders only when\n * the parent `Dialog` is open. On web: traps focus inside, locks body\n * scroll, and dismisses on Escape or overlay click.\n */\nexport const DialogContent = ({ children, className, testID }: DialogContentProps) => {\n const ctx = useDialogContext('DialogContent');\n const colors = useThemeColors();\n const scheme = useColorScheme();\n const contentRef = useRef<HTMLDivElement | null>(null);\n const overlayStyle: ViewStyle = {\n ...OVERLAY_LAYOUT_BASE,\n padding: px(colors.spacing['4']),\n };\n const contentStyle: ViewStyle = {\n ...CONTENT_LAYOUT_BASE,\n borderRadius: px(colors.radius.xl),\n padding: px(colors.spacing['6']),\n gap: px(colors.spacing['3']),\n };\n // Scale-in: render at scale(0.96) + opacity 0 first, flip to 1 in a\n // useEffect so the CSS transition has a frame to animate from. Web\n // only; native uses `Modal animationType=\"fade\"` which is enough.\n const [entered, setEntered] = useState(false);\n useEffect(() => {\n if (Platform.OS !== 'web') {\n setEntered(true);\n return;\n }\n if (!ctx.open) {\n setEntered(false);\n return;\n }\n const id = requestAnimationFrame(() => setEntered(true));\n return () => cancelAnimationFrame(id);\n }, [ctx.open]);\n const enterStyle: ViewStyle =\n Platform.OS === 'web'\n ? ({\n opacity: entered ? 1 : 0,\n transform: [{ scale: entered ? 1 : 0.96 }],\n transitionProperty: 'opacity, transform',\n transitionDuration: '150ms',\n transitionTimingFunction: 'cubic-bezier(0.16, 1, 0.3, 1)',\n } as ViewStyle)\n : {};\n\n // Overlay's scrim + backdrop-filter share the same `entered` flag as\n // the content card, so the blur starts at 0 and the scrim at 0% on\n // the first paint, then both transition to their target values at the\n // next frame — same 150ms curve as the card. The blur duration is\n // bumped slightly (200ms) so it lands a hair AFTER the scrim instead\n // of slamming to full strength immediately, which reads more natural.\n //\n // We reach for a direct DOM ref + .style assignments here rather than\n // pass the styles through `<Pressable style={...}>`. Reason: rn-web's\n // style filter drops keys it doesn't recognize as RN style props —\n // and `backdropFilter`, `transitionProperty`, etc. fall through that\n // filter, taking the whole style fragment with them. Native gets a\n // flat scrim with no blur; RN doesn't have backdrop-filter and the\n // native shim would be an extra peer dep for negligible gain.\n const overlayDomRef = useRef<HTMLElement | null>(null);\n useEffect(() => {\n if (Platform.OS !== 'web') {\n return;\n }\n const node = overlayDomRef.current;\n if (!node) {\n return;\n }\n // First paint: kick off transparent + zero blur so the next\n // assignment animates from 0 to target. We only need this on\n // the very first frame — the inline style on second frame\n // overwrites these.\n node.style.transitionProperty = 'background-color, backdrop-filter, -webkit-backdrop-filter';\n node.style.transitionDuration = '150ms, 200ms, 200ms';\n node.style.transitionTimingFunction = 'ease-out';\n if (entered) {\n node.style.backgroundColor = SCRIM_COLOR;\n node.style.backdropFilter = `blur(${BLUR_AMOUNT}px)`;\n node.style.setProperty('-webkit-backdrop-filter', `blur(${BLUR_AMOUNT}px)`);\n } else {\n node.style.backgroundColor = 'rgba(0, 0, 0, 0)';\n node.style.backdropFilter = 'blur(0px)';\n node.style.setProperty('-webkit-backdrop-filter', 'blur(0px)');\n }\n }, [entered]);\n\n // Web-only side effects: focus trap, scroll lock, Escape close,\n // initial focus on the first focusable inside the dialog. RN Modal\n // handles its own focus model on native, so the platform check keeps\n // these out of the native render path.\n useEffect(() => {\n if (!ctx.open) {\n return;\n }\n if (Platform.OS !== 'web') {\n return;\n }\n if (typeof document === 'undefined') {\n return;\n }\n\n const previouslyFocused = document.activeElement as HTMLElement | null;\n\n // Lock body scroll. Preserve any previously set inline style so\n // we don't accidentally clobber a consumer's lock from elsewhere.\n const prevBodyOverflow = document.body.style.overflow;\n document.body.style.overflow = 'hidden';\n\n // Move focus into the dialog. Prefer the first focusable element;\n // if there isn't one, focus the dialog container itself so it\n // receives the keydown events.\n const focusFirst = () => {\n const node = contentRef.current;\n if (!node) {\n return;\n }\n const focusable = node.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR);\n const first = focusable[0];\n if (first) {\n first.focus();\n } else {\n node.setAttribute('tabindex', '-1');\n node.focus();\n }\n };\n focusFirst();\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n event.preventDefault();\n ctx.setOpen(false);\n return;\n }\n if (event.key !== 'Tab') {\n return;\n }\n const node = contentRef.current;\n if (!node) {\n return;\n }\n const focusable = Array.from(node.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)).filter(\n (el) => el.offsetParent !== null || el === document.activeElement\n );\n if (focusable.length === 0) {\n event.preventDefault();\n return;\n }\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n if (!first || !last) {\n return;\n }\n if (event.shiftKey) {\n if (document.activeElement === first || !node.contains(document.activeElement)) {\n event.preventDefault();\n last.focus();\n }\n } else if (document.activeElement === last) {\n event.preventDefault();\n first.focus();\n }\n };\n document.addEventListener('keydown', onKeyDown);\n\n return () => {\n document.removeEventListener('keydown', onKeyDown);\n document.body.style.overflow = prevBodyOverflow;\n // Restore focus to whatever opened the dialog (the trigger),\n // falling back to the previously focused node if the trigger\n // is gone.\n const restoreTo = ctx.triggerRef.current ?? previouslyFocused;\n restoreTo?.focus?.();\n };\n }, [ctx.open, ctx.setOpen, ctx.triggerRef]);\n\n const onOverlayPress = useCallback(() => ctx.setOpen(false), [ctx]);\n\n return (\n <Modal\n visible={ctx.open}\n transparent\n // Web: 'none' so RN's built-in fade doesn't fight our own\n // overlay/content transitions (its layer-level fade caused\n // backdrop-filter to \"snap in\" at the end). Native: 'fade'\n // is what users expect on iOS/Android and we don't have a\n // CSS transition path there anyway.\n animationType={Platform.OS === 'web' ? 'none' : 'fade'}\n onRequestClose={() => ctx.setOpen(false)}\n >\n {/* Native blur layer. Renders nothing on web (the overlay's\n CSS backdrop-filter handles it) and renders nothing if\n expo-blur isn't installed (graceful degrade — the scrim\n Pressable below still dims the background). */}\n <BlurBackdrop intensity={60} tint={scheme === 'dark' ? 'dark' : 'light'} style={StyleSheet.absoluteFill} />\n <Pressable\n accessibilityRole=\"none\"\n aria-hidden={true}\n ref={(node) => {\n overlayDomRef.current = node as unknown as HTMLElement | null;\n }}\n style={overlayStyle}\n onPress={onOverlayPress}\n >\n <Pressable\n onPress={(event) => event.stopPropagation?.()}\n ref={(node) => {\n contentRef.current = node as unknown as HTMLDivElement | null;\n }}\n role=\"dialog\"\n accessibilityRole=\"none\"\n aria-modal={true}\n aria-labelledby={ctx.titleId}\n aria-describedby={ctx.descriptionId}\n {...(testID !== undefined ? { testID } : {})}\n className={cn('w-full max-w-md rounded-xl bg-semantic-background-elevated p-6 gap-3', className)}\n style={[contentStyle, { backgroundColor: colors.semantic.background.elevated }, enterStyle]}\n >\n <View\n className=\"flex-col gap-1.5\"\n style={{ flexDirection: 'column', gap: px(colors.spacing['2']) - 2 }}\n >\n {children}\n </View>\n </Pressable>\n </Pressable>\n </Modal>\n );\n};\n\nexport type DialogTextProps = {\n children?: ReactNode;\n className?: string;\n};\n\n/** Heading inside DialogContent. Wires `aria-labelledby`. */\nexport const DialogTitle = ({ children, className }: DialogTextProps) => {\n const ctx = useDialogContext('DialogTitle');\n const colors = useThemeColors();\n return (\n <RNText\n nativeID={ctx.titleId}\n id={ctx.titleId}\n role=\"heading\"\n aria-level={2}\n className={cn('text-lg font-semibold text-semantic-text-default', className)}\n style={{\n color: colors.semantic.text.default,\n fontFamily: colors.fontFamily.display,\n fontSize: px(colors.fontSize.lg),\n fontWeight: colors.fontWeight.semibold as '600',\n }}\n >\n {children}\n </RNText>\n );\n};\n\n/** Subtitle / description inside DialogContent. Wires `aria-describedby`. */\nexport const DialogDescription = ({ children, className }: DialogTextProps) => {\n const ctx = useDialogContext('DialogDescription');\n const colors = useThemeColors();\n return (\n <RNText\n nativeID={ctx.descriptionId}\n id={ctx.descriptionId}\n className={cn('text-sm text-semantic-text-muted', className)}\n style={{\n color: colors.semantic.text.muted,\n fontFamily: colors.fontFamily.body,\n fontSize: px(colors.fontSize.sm),\n lineHeight: px(colors.fontSize.sm) * Number(colors.lineHeight.normal),\n }}\n >\n {children}\n </RNText>\n );\n};\n\nexport type DialogCloseProps = {\n /** Render the child as the close button (Slot pattern). Default true. */\n asChild?: boolean;\n children?: ReactNode;\n className?: string;\n testID?: string;\n accessibilityLabel?: string;\n};\n\n/**\n * Element that closes the dialog when activated. With `asChild` (default),\n * wraps the child. Without `asChild`, renders a default ✕ button — useful\n * for the canonical top-right corner close.\n */\nexport const DialogClose = ({\n asChild = true,\n children,\n className,\n testID,\n accessibilityLabel = 'Close',\n}: DialogCloseProps) => {\n const ctx = useDialogContext('DialogClose');\n const colors = useThemeColors();\n const onPress = useCallback(() => ctx.setOpen(false), [ctx]);\n\n if (asChild && isValidElement(children)) {\n const child = children as ReactElement<Record<string, unknown>>;\n // Same dual-event story as DialogTrigger: pass both onClick (web\n // button) and onPress (RN Pressable / our own Button) so the\n // wrapped element fires regardless of its event model.\n const fire = (existing: ((e: unknown) => void) | undefined) => (event: unknown) => {\n existing?.(event);\n ctx.setOpen(false);\n };\n return (\n <Slot\n onClick={fire(child.props.onClick as ((e: unknown) => void) | undefined)}\n onPress={fire(child.props.onPress as ((e: unknown) => void) | undefined)}\n {...(testID !== undefined ? { 'data-testid': testID } : {})}\n {...(className !== undefined ? { className } : {})}\n >\n {child}\n </Slot>\n );\n }\n\n if (children !== undefined) {\n return (\n <Pressable\n onPress={onPress}\n role=\"button\"\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel}\n aria-label={accessibilityLabel}\n {...(testID !== undefined ? { testID } : {})}\n {...(className !== undefined ? { className } : {})}\n >\n {wrapStringChildren(children)}\n </Pressable>\n );\n }\n\n return (\n <Pressable\n onPress={onPress}\n role=\"button\"\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel}\n aria-label={accessibilityLabel}\n {...(testID !== undefined ? { testID } : {})}\n className={cn('absolute right-3 top-3 w-8 h-8 items-center justify-center rounded-md', className)}\n style={{\n position: 'absolute',\n right: px(colors.spacing['3']),\n top: px(colors.spacing['3']),\n // 32×32 close hit target — component-density literal — not from theme\n width: 32,\n height: 32,\n alignItems: 'center',\n justifyContent: 'center',\n borderRadius: px(colors.radius.md),\n }}\n >\n <defaultSemanticIcons.close size={18} color={colors.semantic.text.muted} />\n </Pressable>\n );\n};\n\nexport type DialogFooterProps = {\n children?: ReactNode;\n className?: string;\n};\n\n/** Convenience row for dialog action buttons (right-aligned). */\nexport const DialogFooter = ({ children, className }: DialogFooterProps) => {\n const colors = useThemeColors();\n return (\n <View\n className={cn('mt-4 flex-row items-center justify-end gap-2', className)}\n style={{\n marginTop: px(colors.spacing['4']),\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'flex-end',\n gap: px(colors.spacing['2']),\n }}\n >\n {children}\n </View>\n );\n};\n\n/**\n * Public `Dialog` value — the root function plus its `.Trigger`, `.Content`,\n * `.Title`, `.Description`, `.Footer`, and `.Close` static members. `Object.assign`\n * produces a value whose inferred type carries the static properties, so `.d.ts`\n * consumers can write `<Dialog.Content>` without a separate import.\n */\nexport const Dialog = Object.assign(DialogRoot, {\n Trigger: DialogTrigger,\n Content: DialogContent,\n Title: DialogTitle,\n Description: DialogDescription,\n Footer: DialogFooter,\n Close: DialogClose,\n});\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/Dialog/Dialog.tsx"],"names":["RNText"],"mappings":";;;;;;;;;;;AAgCA,IAAM,aAAA,GAAgB,cAAyC,IAAI,CAAA;AAEnE,IAAM,gBAAA,2BAAoB,KAAA,KAAsC;AAC5D,EAAA,MAAM,GAAA,GAAM,WAAW,aAAa,CAAA;AACpC,EAAA,IAAI,CAAC,GAAA,EAAK;AACN,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,CAAA,EAAI,KAAK,CAAA,qCAAA,CAAuC,CAAA;AAAA,EACpE;AAC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AA;AAwBrB,IAAM,MAAA,GAAS,MAAA,CAAO,MAAA,CAAO,UAAA,EAAY;AAAA,EAC5C,OAAA,EAAS,aAAA;AAAA,EACT,OAAA,EAAS,aAAA;AAAA,EACT,KAAA,EAAO,WAAA;AAAA,EACP,WAAA,EAAa,iBAAA;AAAA,EACb,MAAA,EAAQ,YAAA;AAAA,EACR,KAAA,EAAO;AACX,CAAC","file":"chunk-BXZGCOKT.js","sourcesContent":["'use client';\n\nimport {\n createContext,\n isValidElement,\n type ReactElement,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\nimport type { ViewStyle } from 'react-native';\nimport { Modal, Platform, Pressable, Text as RNText, StyleSheet, View } from 'react-native';\nimport { defaultSemanticIcons } from '../../icons/default-semantic-icons';\nimport { Slot } from '../../slot';\nimport { px } from '../../theme/px';\nimport { useColorScheme } from '../../theme/use-color-scheme';\nimport { useThemeColors } from '../../theme/use-theme-colors';\nimport { cn } from '../../utils/cn';\nimport { BlurBackdrop } from './blur-backdrop';\n\ntype DialogContextValue = {\n open: boolean;\n setOpen: (next: boolean) => void;\n titleId: string;\n descriptionId: string;\n triggerRef: { current: HTMLElement | null };\n};\n\nconst DialogContext = createContext<DialogContextValue | null>(null);\n\nconst useDialogContext = (label: string): DialogContextValue => {\n const ctx = useContext(DialogContext);\n if (!ctx) {\n throw new Error(`<${label}> must be rendered inside a <Dialog>.`);\n }\n return ctx;\n};\n\nexport type DialogProps = {\n /** Controlled open state. */\n open?: boolean;\n /** Uncontrolled initial open state. @defaultValue false */\n defaultOpen?: boolean;\n /** Fires with the new open state. */\n onOpenChange?: (open: boolean) => void;\n children?: ReactNode;\n};\n\n/**\n * Modal dialog. Owns open state and provides context for `DialogTrigger`,\n * `DialogContent`, `DialogTitle`, `DialogDescription`, and `DialogClose`.\n *\n * Behavior:\n * - Click the trigger to open. Click outside the content, press Escape,\n * or click an explicit close to dismiss.\n * - Focus is trapped inside the content while open (web). On close, focus\n * returns to whatever opened the dialog.\n * - Background scrolling is locked while open (web).\n *\n * Cross-platform: uses RN `<Modal>` as the visibility/portal primitive. On\n * web, additional focus-trap / scroll-lock / Escape-key effects layer on\n * top via the platform check inside `DialogContent`.\n */\nconst DialogRoot = ({ open, defaultOpen = false, onOpenChange, children }: DialogProps) => {\n const [inner, setInner] = useState<boolean>(defaultOpen);\n const isControlled = open !== undefined;\n const current = isControlled ? open : inner;\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (!isControlled) {\n setInner(next);\n }\n onOpenChange?.(next);\n },\n [isControlled, onOpenChange]\n );\n\n const baseId = useId();\n const triggerRef = useRef<HTMLElement | null>(null);\n\n const ctxValue: DialogContextValue = {\n open: current,\n setOpen,\n titleId: `${baseId}-title`,\n descriptionId: `${baseId}-description`,\n triggerRef,\n };\n\n return <DialogContext.Provider value={ctxValue}>{children}</DialogContext.Provider>;\n};\n\nexport type DialogTriggerProps = {\n /** Render the child as the trigger (Slot pattern). Default true — pass `false` for an inline button. */\n asChild?: boolean;\n children?: ReactNode;\n className?: string;\n testID?: string;\n};\n\n/**\n * Element that opens the dialog when activated. Uses `asChild` by default so\n * any element (Button, Link, custom Pressable) becomes the trigger.\n */\nexport const DialogTrigger = ({ asChild = true, children, className, testID }: DialogTriggerProps) => {\n const ctx = useDialogContext('DialogTrigger');\n const onPress = useCallback(() => ctx.setOpen(true), [ctx]);\n\n if (asChild && isValidElement(children)) {\n const child = children as ReactElement<Record<string, unknown>>;\n // Pass both onClick (web HTML buttons) AND onPress (RN Pressable /\n // our own Button) so the trigger fires regardless of which event\n // model the wrapped child speaks. The child's existing handler\n // runs first, then we open.\n const fire = (existing: ((e: unknown) => void) | undefined) => (event: unknown) => {\n existing?.(event);\n ctx.setOpen(true);\n };\n return (\n <Slot\n ref={(node: HTMLElement | null) => {\n ctx.triggerRef.current = node;\n }}\n onClick={fire(child.props.onClick as ((e: unknown) => void) | undefined)}\n onPress={fire(child.props.onPress as ((e: unknown) => void) | undefined)}\n {...(testID !== undefined ? { 'data-testid': testID } : {})}\n {...(className !== undefined ? { className } : {})}\n >\n {child}\n </Slot>\n );\n }\n\n return (\n <Pressable\n ref={(node) => {\n ctx.triggerRef.current = node as unknown as HTMLElement | null;\n }}\n onPress={onPress}\n {...(testID !== undefined ? { testID } : {})}\n {...(className !== undefined ? { className } : {})}\n >\n {wrapStringChildren(children)}\n </Pressable>\n );\n};\n\n// On native, raw strings rendered as children of a non-Text component\n// throw \"Text strings must be rendered within a <Text> component\". On\n// web, react-native-web silently tolerates it. Wrap any string/number\n// children in an RNText so the same JSX renders cleanly on both\n// platforms. Non-string children are passed through unchanged.\nfunction wrapStringChildren(children: ReactNode): ReactNode {\n if (typeof children === 'string' || typeof children === 'number') {\n return <RNText>{children}</RNText>;\n }\n return children;\n}\n\n// Scrim + blur target values — applied at the entered state on web,\n// always on as a flat scrim on native (RN doesn't have backdrop-filter\n// and the native shim would be an extra peer dep for vanishingly little\n// visual gain on a v0 component).\n// 24% scrim + 4px blur — strong enough to push the page back but the\n// content underneath is still legible. Earlier 32%/8px felt like a frosted\n// glass slab that completely obscured the page; this lets the page show\n// through as \"behind glass, slightly out of focus.\"\nconst SCRIM_COLOR = 'rgba(0, 0, 0, 0.24)';\nconst BLUR_AMOUNT = 4;\n\n// Static overlay layout — alignment, fixed positioning. The animatable\n// bits (scrim color, backdrop-filter blur) live in a useEffect inside\n// the component that pokes them onto the DOM ref directly so rn-web's\n// style filter can't strip the non-RN keys (backdropFilter,\n// transitionProperty). On web the styles start at blur(0px) +\n// transparent and transition to the target values on the next frame.\n//\n// Why not put blur(8px) here as a constant: when blur is applied to a\n// layer that's mid-fade (e.g. RN Modal's animationType=\"fade\" fades\n// opacity from 0 → 1), Safari and Chromium GPU-composite the layer\n// without rendering backdrop-filter — so the blur appears to \"snap in\"\n// at the end of the fade. Animating blur explicitly via our own\n// transition (and disabling the Modal's fade on web) avoids the snap.\nconst OVERLAY_LAYOUT_BASE: ViewStyle = {\n position: Platform.OS === 'web' ? ('fixed' as unknown as 'absolute') : 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n alignItems: 'center',\n justifyContent: 'center',\n // On native the BlurBackdrop sibling renders BEHIND this overlay and\n // already provides dim + frosted-glass via expo-blur's `tint`/`intensity`.\n // Painting SCRIM_COLOR on top would mask the blur entirely (the user\n // sees only a flat tint), so the overlay stays transparent and the\n // BlurView is the dominant visual on native.\n ...(Platform.OS === 'web' ? ({ zIndex: 50 } as ViewStyle) : { backgroundColor: 'transparent' }),\n};\n\n// Layout / animation only — theme-driven dimensions are merged inside\n// DialogContent below.\nconst CONTENT_LAYOUT_BASE: ViewStyle = {\n width: '100%',\n maxWidth: 480, // component-density literal — not from theme\n ...(Platform.OS === 'web'\n ? ({\n boxShadow: '0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)',\n } as ViewStyle)\n : { elevation: 24 }),\n};\n\nconst FOCUSABLE_SELECTOR =\n 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\nexport type DialogContentProps = {\n children?: ReactNode;\n className?: string;\n testID?: string;\n};\n\n/**\n * The visible dialog surface — overlay + centered card. Renders only when\n * the parent `Dialog` is open. On web: traps focus inside, locks body\n * scroll, and dismisses on Escape or overlay click.\n */\nexport const DialogContent = ({ children, className, testID }: DialogContentProps) => {\n const ctx = useDialogContext('DialogContent');\n const colors = useThemeColors();\n const scheme = useColorScheme();\n const contentRef = useRef<HTMLDivElement | null>(null);\n const overlayStyle: ViewStyle = {\n ...OVERLAY_LAYOUT_BASE,\n padding: px(colors.spacing['4']),\n };\n const contentStyle: ViewStyle = {\n ...CONTENT_LAYOUT_BASE,\n borderRadius: px(colors.radius.xl),\n padding: px(colors.spacing['6']),\n gap: px(colors.spacing['3']),\n };\n // Scale-in: render at scale(0.96) + opacity 0 first, flip to 1 in a\n // useEffect so the CSS transition has a frame to animate from. Web\n // only; native uses `Modal animationType=\"fade\"` which is enough.\n const [entered, setEntered] = useState(false);\n useEffect(() => {\n if (Platform.OS !== 'web') {\n setEntered(true);\n return;\n }\n if (!ctx.open) {\n setEntered(false);\n return;\n }\n const id = requestAnimationFrame(() => setEntered(true));\n return () => cancelAnimationFrame(id);\n }, [ctx.open]);\n const enterStyle: ViewStyle =\n Platform.OS === 'web'\n ? ({\n opacity: entered ? 1 : 0,\n transform: [{ scale: entered ? 1 : 0.96 }],\n transitionProperty: 'opacity, transform',\n transitionDuration: '150ms',\n transitionTimingFunction: 'cubic-bezier(0.16, 1, 0.3, 1)',\n } as ViewStyle)\n : {};\n\n // Overlay's scrim + backdrop-filter share the same `entered` flag as\n // the content card, so the blur starts at 0 and the scrim at 0% on\n // the first paint, then both transition to their target values at the\n // next frame — same 150ms curve as the card. The blur duration is\n // bumped slightly (200ms) so it lands a hair AFTER the scrim instead\n // of slamming to full strength immediately, which reads more natural.\n //\n // We reach for a direct DOM ref + .style assignments here rather than\n // pass the styles through `<Pressable style={...}>`. Reason: rn-web's\n // style filter drops keys it doesn't recognize as RN style props —\n // and `backdropFilter`, `transitionProperty`, etc. fall through that\n // filter, taking the whole style fragment with them. Native gets a\n // flat scrim with no blur; RN doesn't have backdrop-filter and the\n // native shim would be an extra peer dep for negligible gain.\n const overlayDomRef = useRef<HTMLElement | null>(null);\n useEffect(() => {\n if (Platform.OS !== 'web') {\n return;\n }\n const node = overlayDomRef.current;\n if (!node) {\n return;\n }\n // First paint: kick off transparent + zero blur so the next\n // assignment animates from 0 to target. We only need this on\n // the very first frame — the inline style on second frame\n // overwrites these.\n node.style.transitionProperty = 'background-color, backdrop-filter, -webkit-backdrop-filter';\n node.style.transitionDuration = '150ms, 200ms, 200ms';\n node.style.transitionTimingFunction = 'ease-out';\n if (entered) {\n node.style.backgroundColor = SCRIM_COLOR;\n node.style.backdropFilter = `blur(${BLUR_AMOUNT}px)`;\n node.style.setProperty('-webkit-backdrop-filter', `blur(${BLUR_AMOUNT}px)`);\n } else {\n node.style.backgroundColor = 'rgba(0, 0, 0, 0)';\n node.style.backdropFilter = 'blur(0px)';\n node.style.setProperty('-webkit-backdrop-filter', 'blur(0px)');\n }\n }, [entered]);\n\n // Web-only side effects: focus trap, scroll lock, Escape close,\n // initial focus on the first focusable inside the dialog. RN Modal\n // handles its own focus model on native, so the platform check keeps\n // these out of the native render path.\n useEffect(() => {\n if (!ctx.open) {\n return;\n }\n if (Platform.OS !== 'web') {\n return;\n }\n if (typeof document === 'undefined') {\n return;\n }\n\n const previouslyFocused = document.activeElement as HTMLElement | null;\n\n // Lock body scroll. Preserve any previously set inline style so\n // we don't accidentally clobber a consumer's lock from elsewhere.\n const prevBodyOverflow = document.body.style.overflow;\n document.body.style.overflow = 'hidden';\n\n // Move focus into the dialog. Prefer the first focusable element;\n // if there isn't one, focus the dialog container itself so it\n // receives the keydown events.\n const focusFirst = () => {\n const node = contentRef.current;\n if (!node) {\n return;\n }\n const focusable = node.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR);\n const first = focusable[0];\n if (first) {\n first.focus();\n } else {\n node.setAttribute('tabindex', '-1');\n node.focus();\n }\n };\n focusFirst();\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n event.preventDefault();\n ctx.setOpen(false);\n return;\n }\n if (event.key !== 'Tab') {\n return;\n }\n const node = contentRef.current;\n if (!node) {\n return;\n }\n const focusable = Array.from(node.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)).filter(\n (el) => el.offsetParent !== null || el === document.activeElement\n );\n if (focusable.length === 0) {\n event.preventDefault();\n return;\n }\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n if (!first || !last) {\n return;\n }\n if (event.shiftKey) {\n if (document.activeElement === first || !node.contains(document.activeElement)) {\n event.preventDefault();\n last.focus();\n }\n } else if (document.activeElement === last) {\n event.preventDefault();\n first.focus();\n }\n };\n document.addEventListener('keydown', onKeyDown);\n\n return () => {\n document.removeEventListener('keydown', onKeyDown);\n document.body.style.overflow = prevBodyOverflow;\n // Restore focus to whatever opened the dialog (the trigger),\n // falling back to the previously focused node if the trigger\n // is gone.\n const restoreTo = ctx.triggerRef.current ?? previouslyFocused;\n restoreTo?.focus?.();\n };\n }, [ctx.open, ctx.setOpen, ctx.triggerRef]);\n\n const onOverlayPress = useCallback(() => ctx.setOpen(false), [ctx]);\n\n return (\n <Modal\n visible={ctx.open}\n transparent\n // Web: 'none' so RN's built-in fade doesn't fight our own\n // overlay/content transitions (its layer-level fade caused\n // backdrop-filter to \"snap in\" at the end). Native: 'fade'\n // is what users expect on iOS/Android and we don't have a\n // CSS transition path there anyway.\n animationType={Platform.OS === 'web' ? 'none' : 'fade'}\n onRequestClose={() => ctx.setOpen(false)}\n >\n {/* Native blur layer. Renders nothing on web (the overlay's\n CSS backdrop-filter handles it) and renders nothing if\n expo-blur isn't installed (graceful degrade — the scrim\n Pressable below still dims the background). */}\n <BlurBackdrop intensity={60} tint={scheme === 'dark' ? 'dark' : 'light'} style={StyleSheet.absoluteFill} />\n <Pressable\n accessibilityRole=\"none\"\n aria-hidden={true}\n ref={(node) => {\n overlayDomRef.current = node as unknown as HTMLElement | null;\n }}\n style={overlayStyle}\n onPress={onOverlayPress}\n >\n <Pressable\n onPress={(event) => event.stopPropagation?.()}\n ref={(node) => {\n contentRef.current = node as unknown as HTMLDivElement | null;\n }}\n role=\"dialog\"\n accessibilityRole=\"none\"\n aria-modal={true}\n aria-labelledby={ctx.titleId}\n aria-describedby={ctx.descriptionId}\n {...(testID !== undefined ? { testID } : {})}\n className={cn('w-full max-w-md rounded-xl bg-semantic-background-elevated p-6 gap-3', className)}\n style={[contentStyle, { backgroundColor: colors.semantic.background.elevated }, enterStyle]}\n >\n <View\n className=\"flex-col gap-1.5\"\n style={{ flexDirection: 'column', gap: px(colors.spacing['2']) - 2 }}\n >\n {children}\n </View>\n </Pressable>\n </Pressable>\n </Modal>\n );\n};\n\nexport type DialogTextProps = {\n children?: ReactNode;\n className?: string;\n};\n\n/** Heading inside DialogContent. Wires `aria-labelledby`. */\nexport const DialogTitle = ({ children, className }: DialogTextProps) => {\n const ctx = useDialogContext('DialogTitle');\n const colors = useThemeColors();\n return (\n <RNText\n nativeID={ctx.titleId}\n id={ctx.titleId}\n role=\"heading\"\n aria-level={2}\n className={cn('text-lg font-semibold text-semantic-text-default', className)}\n style={{\n color: colors.semantic.text.default,\n fontFamily: colors.fontFamily.display,\n fontSize: px(colors.fontSize.lg),\n fontWeight: colors.fontWeight.semibold as '600',\n }}\n >\n {children}\n </RNText>\n );\n};\n\n/** Subtitle / description inside DialogContent. Wires `aria-describedby`. */\nexport const DialogDescription = ({ children, className }: DialogTextProps) => {\n const ctx = useDialogContext('DialogDescription');\n const colors = useThemeColors();\n return (\n <RNText\n nativeID={ctx.descriptionId}\n id={ctx.descriptionId}\n className={cn('text-sm text-semantic-text-muted', className)}\n style={{\n color: colors.semantic.text.muted,\n fontFamily: colors.fontFamily.body,\n fontSize: px(colors.fontSize.sm),\n lineHeight: px(colors.fontSize.sm) * Number(colors.lineHeight.normal),\n }}\n >\n {children}\n </RNText>\n );\n};\n\nexport type DialogCloseProps = {\n /** Render the child as the close button (Slot pattern). Default true. */\n asChild?: boolean;\n children?: ReactNode;\n className?: string;\n testID?: string;\n accessibilityLabel?: string;\n};\n\n/**\n * Element that closes the dialog when activated. With `asChild` (default),\n * wraps the child. Without `asChild`, renders a default ✕ button — useful\n * for the canonical top-right corner close.\n */\nexport const DialogClose = ({\n asChild = true,\n children,\n className,\n testID,\n accessibilityLabel = 'Close',\n}: DialogCloseProps) => {\n const ctx = useDialogContext('DialogClose');\n const colors = useThemeColors();\n const onPress = useCallback(() => ctx.setOpen(false), [ctx]);\n\n if (asChild && isValidElement(children)) {\n const child = children as ReactElement<Record<string, unknown>>;\n // Same dual-event story as DialogTrigger: pass both onClick (web\n // button) and onPress (RN Pressable / our own Button) so the\n // wrapped element fires regardless of its event model.\n const fire = (existing: ((e: unknown) => void) | undefined) => (event: unknown) => {\n existing?.(event);\n ctx.setOpen(false);\n };\n return (\n <Slot\n onClick={fire(child.props.onClick as ((e: unknown) => void) | undefined)}\n onPress={fire(child.props.onPress as ((e: unknown) => void) | undefined)}\n {...(testID !== undefined ? { 'data-testid': testID } : {})}\n {...(className !== undefined ? { className } : {})}\n >\n {child}\n </Slot>\n );\n }\n\n if (children !== undefined) {\n return (\n <Pressable\n onPress={onPress}\n role=\"button\"\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel}\n aria-label={accessibilityLabel}\n {...(testID !== undefined ? { testID } : {})}\n {...(className !== undefined ? { className } : {})}\n >\n {wrapStringChildren(children)}\n </Pressable>\n );\n }\n\n return (\n <Pressable\n onPress={onPress}\n role=\"button\"\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel}\n aria-label={accessibilityLabel}\n {...(testID !== undefined ? { testID } : {})}\n className={cn('absolute right-3 top-3 w-8 h-8 items-center justify-center rounded-md', className)}\n style={{\n position: 'absolute',\n right: px(colors.spacing['3']),\n top: px(colors.spacing['3']),\n // 32×32 close hit target — component-density literal — not from theme\n width: 32,\n height: 32,\n alignItems: 'center',\n justifyContent: 'center',\n borderRadius: px(colors.radius.md),\n }}\n >\n <defaultSemanticIcons.close size={18} color={colors.semantic.text.muted} />\n </Pressable>\n );\n};\n\nexport type DialogFooterProps = {\n children?: ReactNode;\n className?: string;\n};\n\n/** Convenience row for dialog action buttons (right-aligned). */\nexport const DialogFooter = ({ children, className }: DialogFooterProps) => {\n const colors = useThemeColors();\n return (\n <View\n className={cn('mt-4 flex-row items-center justify-end gap-2', className)}\n style={{\n marginTop: px(colors.spacing['4']),\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'flex-end',\n gap: px(colors.spacing['2']),\n }}\n >\n {children}\n </View>\n );\n};\n\n/**\n * Public `Dialog` value — the root function plus its `.Trigger`, `.Content`,\n * `.Title`, `.Description`, `.Footer`, and `.Close` static members. `Object.assign`\n * produces a value whose inferred type carries the static properties, so `.d.ts`\n * consumers can write `<Dialog.Content>` without a separate import.\n */\nexport const Dialog = Object.assign(DialogRoot, {\n Trigger: DialogTrigger,\n Content: DialogContent,\n Title: DialogTitle,\n Description: DialogDescription,\n Footer: DialogFooter,\n Close: DialogClose,\n});\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useAnimatedNumber } from './chunk-RB3YBWQ4.js';
|
|
2
1
|
import { AnimatedView } from './chunk-RGJ3NBKE.js';
|
|
2
|
+
import { useAnimatedNumber } from './chunk-RB3YBWQ4.js';
|
|
3
3
|
import { Slot } from './chunk-ZIBNLXIV.js';
|
|
4
4
|
import { px } from './chunk-5A2QOOVN.js';
|
|
5
5
|
import { useThemeColors } from './chunk-R5JMDDCB.js';
|
|
@@ -179,5 +179,5 @@ var Switch = /* @__PURE__ */ __name(({
|
|
|
179
179
|
}, "Switch");
|
|
180
180
|
|
|
181
181
|
export { Switch };
|
|
182
|
-
//# sourceMappingURL=chunk-
|
|
183
|
-
//# sourceMappingURL=chunk-
|
|
182
|
+
//# sourceMappingURL=chunk-KLK7OMFT.js.map
|
|
183
|
+
//# sourceMappingURL=chunk-KLK7OMFT.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Switch/Switch.tsx"],"names":["RNText"],"mappings":";;;;;;;;;;;AA0CA,IAAM,eAAA,GAA6B,EAAE,aAAA,EAAe,KAAA,EAAO,YAAY,QAAA,EAAS;AAGhF,IAAM,UAAA,GAAwB;AAAA,EAC1B,KAAA,EAAO,EAAA;AAAA,EACP,MAAA,EAAQ,EAAA;AAAA,EACR,YAAA,EAAc,EAAA;AAAA;AAAA;AAAA;AAAA,EAId,QAAA,EAAU;AACd,CAAA;AACA,IAAM,gBAAA,GAA8B;AAAA,EAChC,KAAA,EAAO,EAAA;AAAA,EACP,MAAA,EAAQ,EAAA;AAAA,EACR,YAAA,EAAc,EAAA;AAAA;AAAA;AAAA;AAAA,EAId,GAAI,EA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import type { ReactNode } from 'react';\nimport { useCallback, useState } from 'react';\nimport type { ViewStyle } from 'react-native';\nimport { Pressable, Text as RNText, View } from 'react-native';\nimport { AnimatedView } from '../../animation/animated-view';\nimport { useAnimatedNumber } from '../../animation/use-animated-number';\nimport { Slot } from '../../slot';\nimport { px } from '../../theme/px';\nimport { useThemeColors } from '../../theme/use-theme-colors';\nimport { cn } from '../../utils/cn';\n\nexport type SwitchProps = {\n checked?: boolean;\n defaultChecked?: boolean;\n disabled?: boolean;\n onChange?: (next: boolean) => void;\n label?: string;\n className?: string;\n testID?: string;\n asChild?: boolean;\n children?: ReactNode;\n /** DOM id / nativeID forwarded to the Pressable — used by Field.Control */\n id?: string;\n /** HTML name attribute (web only) */\n name?: string;\n /** aria-labelledby forwarded to the Pressable */\n 'aria-labelledby'?: string;\n /** React Native accessibilityLabelledBy forwarded to the Pressable */\n accessibilityLabelledBy?: string;\n /** aria-describedby forwarded to the Pressable */\n 'aria-describedby'?: string;\n /** React Native accessibilityDescribedBy forwarded to the Pressable */\n accessibilityDescribedBy?: string;\n /** Marks the control as invalid — set by Field.Control when there is an error */\n 'aria-invalid'?: boolean;\n /** Marks the control as required — set by Field.Control */\n 'aria-required'?: boolean;\n};\n\n// Layout-only base; row gap is theme-driven inside the component.\nconst ROW_LAYOUT_BASE: ViewStyle = { flexDirection: 'row', alignItems: 'center' };\n// Switch track + thumb are tightly coupled — width 40, height 24, thumb\n// 20×20, travel 18px. Component-density literals — not from theme.\nconst TRACK_BASE: ViewStyle = {\n width: 40,\n height: 24,\n borderRadius: 12,\n // Relative so the absolutely-positioned thumb anchors against the\n // track (not the page). The thumb's `left` value transitions between\n // 2 (off) and 18 (on) — see thumb style below.\n position: 'relative',\n};\nconst THUMB_BASE_STYLE: ViewStyle = {\n width: 20,\n height: 20,\n borderRadius: 10,\n // Web: boxShadow (the modern CSS-style replacement for the legacy RN\n // `shadow*` props that react-native-web has deprecated).\n // Native: elevation (Android) — RN ignores boxShadow there.\n ...({ boxShadow: '0 1px 2px rgba(0, 0, 0, 0.15)' } as ViewStyle),\n elevation: 2,\n};\n\n/**\n * Switch — a toggle control with role=\"switch\". Supports controlled + uncontrolled,\n * disabled state, asChild (via Slot), and a visible label that doubles as the\n * accessibility label.\n */\nexport const Switch = ({\n checked,\n defaultChecked = false,\n disabled,\n onChange,\n label,\n className,\n testID,\n asChild,\n children,\n id,\n name,\n 'aria-labelledby': ariaLabelledBy,\n accessibilityLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n accessibilityDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n}: SwitchProps) => {\n const colors = useThemeColors();\n const [inner, setInner] = useState<boolean>(defaultChecked);\n const isControlled = checked !== undefined;\n const value = isControlled ? Boolean(checked) : inner;\n // Pulled up here (above the asChild early-return) so the hook is\n // called on every render path, not conditionally. The slide isn't\n // used in the asChild branch, but the wasted work is tiny.\n const slide = useAnimatedNumber('left', value ? 18 : 2);\n\n const toggle = useCallback(() => {\n if (disabled) {\n return;\n }\n const next = !value;\n if (!isControlled) {\n setInner(next);\n }\n onChange?.(next);\n }, [disabled, value, isControlled, onChange]);\n\n const ariaChecked: 'true' | 'false' = value ? 'true' : 'false';\n\n const commonProps: Record<string, unknown> = {\n role: 'switch',\n 'aria-checked': ariaChecked,\n accessibilityRole: 'switch' as const,\n accessibilityState: { checked: value, disabled: Boolean(disabled) },\n testID,\n };\n if (id !== undefined) {\n commonProps.id = id;\n commonProps.nativeID = id;\n }\n if (name !== undefined) {\n commonProps.name = name;\n }\n if (disabled) {\n commonProps['aria-disabled'] = true;\n }\n if (label !== undefined) {\n commonProps['aria-label'] = label;\n commonProps.accessibilityLabel = label;\n }\n if (ariaLabelledBy !== undefined) {\n commonProps['aria-labelledby'] = ariaLabelledBy;\n commonProps.accessibilityLabelledBy = ariaLabelledBy;\n }\n if (accessibilityLabelledBy !== undefined) {\n commonProps.accessibilityLabelledBy = accessibilityLabelledBy;\n }\n if (ariaDescribedBy !== undefined) {\n commonProps['aria-describedby'] = ariaDescribedBy;\n commonProps.accessibilityDescribedBy = ariaDescribedBy;\n }\n if (accessibilityDescribedBy !== undefined) {\n commonProps.accessibilityDescribedBy = accessibilityDescribedBy;\n }\n if (ariaInvalid) {\n commonProps['aria-invalid'] = true;\n }\n if (ariaRequired) {\n commonProps['aria-required'] = true;\n }\n\n if (asChild) {\n const slotProps: Record<string, unknown> = {\n role: 'switch',\n 'aria-checked': ariaChecked,\n onClick: toggle,\n };\n if (disabled) {\n slotProps['aria-disabled'] = true;\n }\n if (label !== undefined) {\n slotProps['aria-label'] = label;\n }\n if (testID !== undefined) {\n slotProps['data-testid'] = testID;\n }\n if (className !== undefined) {\n slotProps.className = className;\n }\n return <Slot {...slotProps}>{children}</Slot>;\n }\n\n const trackClasses = cn(\n 'w-10 h-6 rounded-full justify-center px-0.5 transition-colors',\n value ? 'bg-semantic-interactive-primary' : 'bg-neutral-300 dark:bg-neutral-700',\n disabled ? 'opacity-60' : undefined\n );\n // Position is set inline below (absolute + animated `left`), so no\n // self-start/self-end classes here — they'd fight the inline position.\n const thumbClasses = cn('w-5 h-5 rounded-full bg-white dark:bg-neutral-100 shadow-sm');\n\n const trackStyle = [\n TRACK_BASE,\n {\n backgroundColor: value ? colors.semantic.interactive.primary : colors.color.neutral['600'],\n // Subtle 180ms color transition between off → on. Web only;\n // native has no equivalent for the track tint in v1.\n ...({ transitionProperty: 'background-color', transitionDuration: '180ms' } as ViewStyle),\n },\n disabled ? { opacity: 0.6 } : null,\n ];\n // Thumb stays a near-white disc — we deliberately don't go to a dark\n // grey on dark mode because the thumb needs to read as the \"moveable\n // puck\" against the track in both schemes.\n //\n // Animation: thumb slides between left:2 (off) and left:18 (on) —\n // track width 40 - padding 2 - thumb 20 = 18 px travel. The\n // useAnimatedNumber hook picks the right engine per platform (web\n // CSS transition / reanimated spring / RN Animated). The hook is\n // called once at the top of the function — see the `slide` above.\n const thumbStyle = [\n THUMB_BASE_STYLE,\n {\n backgroundColor: colors.color.neutral['50'],\n position: 'absolute' as const,\n top: 2,\n } as ViewStyle,\n slide as ViewStyle,\n ];\n\n // Whole-row Pressable so clicking the label toggles the switch. The\n // visible track is a non-interactive View — one role=\"switch\" per\n // logical control, not two competing hit-areas.\n const rowStyle: ViewStyle = { ...ROW_LAYOUT_BASE, gap: px(colors.spacing['2']) };\n\n return (\n <Pressable\n onPress={toggle}\n {...commonProps}\n className={cn('flex-row items-center gap-2', className)}\n style={rowStyle}\n >\n <View className={trackClasses} style={trackStyle}>\n {/*\n * Animated.View — the slide style fragment from\n * `useAnimatedNumber` contains an `Animated.Value` on\n * native; a plain `View` would render the value as 0\n * (no animation). On web, the same fragment is plain\n * CSS and `Animated.View` falls through to a regular\n * div via react-native-web.\n */}\n <AnimatedView className={thumbClasses} style={thumbStyle} />\n </View>\n {label ? (\n <RNText\n className=\"text-md text-semantic-text-default\"\n style={{\n color: colors.semantic.text.default,\n fontFamily: colors.fontFamily.body,\n fontSize: px(colors.fontSize.md),\n }}\n >\n {label}\n </RNText>\n ) : null}\n {children}\n </Pressable>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/Switch/Switch.tsx"],"names":["RNText"],"mappings":";;;;;;;;;;;AA0CA,IAAM,eAAA,GAA6B,EAAE,aAAA,EAAe,KAAA,EAAO,YAAY,QAAA,EAAS;AAGhF,IAAM,UAAA,GAAwB;AAAA,EAC1B,KAAA,EAAO,EAAA;AAAA,EACP,MAAA,EAAQ,EAAA;AAAA,EACR,YAAA,EAAc,EAAA;AAAA;AAAA;AAAA;AAAA,EAId,QAAA,EAAU;AACd,CAAA;AACA,IAAM,gBAAA,GAA8B;AAAA,EAChC,KAAA,EAAO,EAAA;AAAA,EACP,MAAA,EAAQ,EAAA;AAAA,EACR,YAAA,EAAc,EAAA;AAAA;AAAA;AAAA;AAAA,EAId,GAAI,EAAE,SAAA,EAAW,+BAAA,EAAgC;AAAA,EACjD,SAAA,EAAW;AACf,CAAA;AAOO,IAAM,yBAAS,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iB,MAAA,CAAO,KAAA,CAAM,OAAA,CAAQ,IAAI,CAAA;AAAA,MAC1C,QAAA,EAAU,UAAA;AAAA,MACV,GAAA,EAAK;AAAA,KACT;AAAA,IACA;AAAA,GACJ;AAKA,EAAA,MAAM,QAAA,GAAsB,EAAE,GAAG,eAAA,EAAiB,GAAA,EAAK,GAAG,MAAA,CAAO,OAAA,CAAQ,GAAG,CAAC,CAAA,EAAE;AAE/E,EAAA,uBACI,IAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACG,OAAA,EAAS,MAAA;AAAA,MACR,GAAG,WAAA;AAAA,MACJ,SAAA,EAAW,EAAA,CAAG,6BAAA,EAA+B,SAAS,CAAA;AAAA,MACtD,KAAA,EAAO,QAAA;AAAA,MAEP,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,SAAA,EAAW,YAAA,EAAc,KAAA,EAAO,UAAA,EASlC,QAAA,kBAAA,GAAA,CAAC,YAAA,EAAA,EAAa,SAAA,EAAW,YAAA,EAAc,KAAA,EAAO,UAAA,EAAY,CAAA,EAC9D,CAAA;AAAA,QACC,KAAA,mBACG,GAAA;AAAA,UAACA,IAAA;AAAA,UAAA;AAAA,YACG,SAAA,EAAU,oCAAA;AAAA,YACV,KAAA,EAAO;AAAA,cACH,KAAA,EAAO,MAAA,CAAO,QAAA,CAAS,IAAA,CAAK,OAAA;AAAA,cAC5B,UAAA,EAAY,OAAO,UAAA,CAAW,IAAA;AAAA,cAC9B,QAAA,EAAU,EAAA,CAAG,MAAA,CAAO,QAAA,CAAS,EAAE;AAAA,aACnC;AAAA,YAEC,QAAA,EAAA;AAAA;AAAA,SACL,GACA,IAAA;AAAA,QACH;AAAA;AAAA;AAAA,GACL;AAER,CAAA,EApLsB,QAAA","file":"chunk-KLK7OMFT.js","sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport { useCallback, useState } from 'react';\nimport type { ViewStyle } from 'react-native';\nimport { Pressable, Text as RNText, View } from 'react-native';\nimport { AnimatedView } from '../../animation/animated-view';\nimport { useAnimatedNumber } from '../../animation/use-animated-number';\nimport { Slot } from '../../slot';\nimport { px } from '../../theme/px';\nimport { useThemeColors } from '../../theme/use-theme-colors';\nimport { cn } from '../../utils/cn';\n\nexport type SwitchProps = {\n checked?: boolean;\n defaultChecked?: boolean;\n disabled?: boolean;\n onChange?: (next: boolean) => void;\n label?: string;\n className?: string;\n testID?: string;\n asChild?: boolean;\n children?: ReactNode;\n /** DOM id / nativeID forwarded to the Pressable — used by Field.Control */\n id?: string;\n /** HTML name attribute (web only) */\n name?: string;\n /** aria-labelledby forwarded to the Pressable */\n 'aria-labelledby'?: string;\n /** React Native accessibilityLabelledBy forwarded to the Pressable */\n accessibilityLabelledBy?: string;\n /** aria-describedby forwarded to the Pressable */\n 'aria-describedby'?: string;\n /** React Native accessibilityDescribedBy forwarded to the Pressable */\n accessibilityDescribedBy?: string;\n /** Marks the control as invalid — set by Field.Control when there is an error */\n 'aria-invalid'?: boolean;\n /** Marks the control as required — set by Field.Control */\n 'aria-required'?: boolean;\n};\n\n// Layout-only base; row gap is theme-driven inside the component.\nconst ROW_LAYOUT_BASE: ViewStyle = { flexDirection: 'row', alignItems: 'center' };\n// Switch track + thumb are tightly coupled — width 40, height 24, thumb\n// 20×20, travel 18px. Component-density literals — not from theme.\nconst TRACK_BASE: ViewStyle = {\n width: 40,\n height: 24,\n borderRadius: 12,\n // Relative so the absolutely-positioned thumb anchors against the\n // track (not the page). The thumb's `left` value transitions between\n // 2 (off) and 18 (on) — see thumb style below.\n position: 'relative',\n};\nconst THUMB_BASE_STYLE: ViewStyle = {\n width: 20,\n height: 20,\n borderRadius: 10,\n // Web: boxShadow (the modern CSS-style replacement for the legacy RN\n // `shadow*` props that react-native-web has deprecated).\n // Native: elevation (Android) — RN ignores boxShadow there.\n ...({ boxShadow: '0 1px 2px rgba(0, 0, 0, 0.15)' } as ViewStyle),\n elevation: 2,\n};\n\n/**\n * Switch — a toggle control with role=\"switch\". Supports controlled + uncontrolled,\n * disabled state, asChild (via Slot), and a visible label that doubles as the\n * accessibility label.\n */\nexport const Switch = ({\n checked,\n defaultChecked = false,\n disabled,\n onChange,\n label,\n className,\n testID,\n asChild,\n children,\n id,\n name,\n 'aria-labelledby': ariaLabelledBy,\n accessibilityLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n accessibilityDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n}: SwitchProps) => {\n const colors = useThemeColors();\n const [inner, setInner] = useState<boolean>(defaultChecked);\n const isControlled = checked !== undefined;\n const value = isControlled ? Boolean(checked) : inner;\n // Pulled up here (above the asChild early-return) so the hook is\n // called on every render path, not conditionally. The slide isn't\n // used in the asChild branch, but the wasted work is tiny.\n const slide = useAnimatedNumber('left', value ? 18 : 2);\n\n const toggle = useCallback(() => {\n if (disabled) {\n return;\n }\n const next = !value;\n if (!isControlled) {\n setInner(next);\n }\n onChange?.(next);\n }, [disabled, value, isControlled, onChange]);\n\n const ariaChecked: 'true' | 'false' = value ? 'true' : 'false';\n\n const commonProps: Record<string, unknown> = {\n role: 'switch',\n 'aria-checked': ariaChecked,\n accessibilityRole: 'switch' as const,\n accessibilityState: { checked: value, disabled: Boolean(disabled) },\n testID,\n };\n if (id !== undefined) {\n commonProps.id = id;\n commonProps.nativeID = id;\n }\n if (name !== undefined) {\n commonProps.name = name;\n }\n if (disabled) {\n commonProps['aria-disabled'] = true;\n }\n if (label !== undefined) {\n commonProps['aria-label'] = label;\n commonProps.accessibilityLabel = label;\n }\n if (ariaLabelledBy !== undefined) {\n commonProps['aria-labelledby'] = ariaLabelledBy;\n commonProps.accessibilityLabelledBy = ariaLabelledBy;\n }\n if (accessibilityLabelledBy !== undefined) {\n commonProps.accessibilityLabelledBy = accessibilityLabelledBy;\n }\n if (ariaDescribedBy !== undefined) {\n commonProps['aria-describedby'] = ariaDescribedBy;\n commonProps.accessibilityDescribedBy = ariaDescribedBy;\n }\n if (accessibilityDescribedBy !== undefined) {\n commonProps.accessibilityDescribedBy = accessibilityDescribedBy;\n }\n if (ariaInvalid) {\n commonProps['aria-invalid'] = true;\n }\n if (ariaRequired) {\n commonProps['aria-required'] = true;\n }\n\n if (asChild) {\n const slotProps: Record<string, unknown> = {\n role: 'switch',\n 'aria-checked': ariaChecked,\n onClick: toggle,\n };\n if (disabled) {\n slotProps['aria-disabled'] = true;\n }\n if (label !== undefined) {\n slotProps['aria-label'] = label;\n }\n if (testID !== undefined) {\n slotProps['data-testid'] = testID;\n }\n if (className !== undefined) {\n slotProps.className = className;\n }\n return <Slot {...slotProps}>{children}</Slot>;\n }\n\n const trackClasses = cn(\n 'w-10 h-6 rounded-full justify-center px-0.5 transition-colors',\n value ? 'bg-semantic-interactive-primary' : 'bg-neutral-300 dark:bg-neutral-700',\n disabled ? 'opacity-60' : undefined\n );\n // Position is set inline below (absolute + animated `left`), so no\n // self-start/self-end classes here — they'd fight the inline position.\n const thumbClasses = cn('w-5 h-5 rounded-full bg-white dark:bg-neutral-100 shadow-sm');\n\n const trackStyle = [\n TRACK_BASE,\n {\n backgroundColor: value ? colors.semantic.interactive.primary : colors.color.neutral['600'],\n // Subtle 180ms color transition between off → on. Web only;\n // native has no equivalent for the track tint in v1.\n ...({ transitionProperty: 'background-color', transitionDuration: '180ms' } as ViewStyle),\n },\n disabled ? { opacity: 0.6 } : null,\n ];\n // Thumb stays a near-white disc — we deliberately don't go to a dark\n // grey on dark mode because the thumb needs to read as the \"moveable\n // puck\" against the track in both schemes.\n //\n // Animation: thumb slides between left:2 (off) and left:18 (on) —\n // track width 40 - padding 2 - thumb 20 = 18 px travel. The\n // useAnimatedNumber hook picks the right engine per platform (web\n // CSS transition / reanimated spring / RN Animated). The hook is\n // called once at the top of the function — see the `slide` above.\n const thumbStyle = [\n THUMB_BASE_STYLE,\n {\n backgroundColor: colors.color.neutral['50'],\n position: 'absolute' as const,\n top: 2,\n } as ViewStyle,\n slide as ViewStyle,\n ];\n\n // Whole-row Pressable so clicking the label toggles the switch. The\n // visible track is a non-interactive View — one role=\"switch\" per\n // logical control, not two competing hit-areas.\n const rowStyle: ViewStyle = { ...ROW_LAYOUT_BASE, gap: px(colors.spacing['2']) };\n\n return (\n <Pressable\n onPress={toggle}\n {...commonProps}\n className={cn('flex-row items-center gap-2', className)}\n style={rowStyle}\n >\n <View className={trackClasses} style={trackStyle}>\n {/*\n * Animated.View — the slide style fragment from\n * `useAnimatedNumber` contains an `Animated.Value` on\n * native; a plain `View` would render the value as 0\n * (no animation). On web, the same fragment is plain\n * CSS and `Animated.View` falls through to a regular\n * div via react-native-web.\n */}\n <AnimatedView className={thumbClasses} style={thumbStyle} />\n </View>\n {label ? (\n <RNText\n className=\"text-md text-semantic-text-default\"\n style={{\n color: colors.semantic.text.default,\n fontFamily: colors.fontFamily.body,\n fontSize: px(colors.fontSize.md),\n }}\n >\n {label}\n </RNText>\n ) : null}\n {children}\n </Pressable>\n );\n};\n"]}
|