@multiplatform.one/theme 10.25.2 → 10.27.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/theme/createThemes.cjs +41 -2
- package/dist/cjs/theme/createThemes.native.cjs +64 -2
- package/dist/cjs/theme/createThemes.native.js +64 -2
- package/dist/cjs/theme/createThemes.native.js.map +1 -1
- package/dist/cjs/theme/overlaySurfaces.cjs +2 -4
- package/dist/cjs/theme/overlaySurfaces.native.cjs +2 -4
- package/dist/cjs/theme/overlaySurfaces.native.js +2 -4
- package/dist/cjs/theme/overlaySurfaces.native.js.map +1 -1
- package/dist/esm/theme/createThemes.mjs +41 -2
- package/dist/esm/theme/createThemes.mjs.map +1 -1
- package/dist/esm/theme/createThemes.native.js +64 -2
- package/dist/esm/theme/createThemes.native.js.map +1 -1
- package/dist/esm/theme/overlaySurfaces.mjs +3 -5
- package/dist/esm/theme/overlaySurfaces.mjs.map +1 -1
- package/dist/esm/theme/overlaySurfaces.native.js +3 -5
- package/dist/esm/theme/overlaySurfaces.native.js.map +1 -1
- package/package.json +5 -5
- package/src/theme/consumerAccentFill.spec.ts +64 -0
- package/src/theme/createThemes.ts +41 -4
- package/src/theme/overlaySurfaces.focus.spec.tsx +4 -5
- package/src/theme/overlaySurfaces.tsx +11 -15
- package/types/theme/createThemes.d.ts.map +1 -1
- package/types/theme/overlaySurfaces.d.ts +1 -1
- package/types/theme/overlaySurfaces.d.ts.map +1 -1
|
@@ -7,7 +7,7 @@ import { ALERT_READABLE_WIDTH } from "./layoutTokens.mjs";
|
|
|
7
7
|
import { panelPaddingPx } from "./resolveKnobs.mjs";
|
|
8
8
|
import { createContext, forwardRef, useContext, useEffect } from "react";
|
|
9
9
|
import { createChangeEventDetails } from "@tamagui/web";
|
|
10
|
-
import { AlertDialog, Dialog,
|
|
10
|
+
import { AlertDialog, Dialog, YStack, isWeb, useDialogContext, useWindowDimensions } from "tamagui";
|
|
11
11
|
import { jsx } from "react/jsx-runtime";
|
|
12
12
|
|
|
13
13
|
const dialogScrim = "$scrim-dialog";
|
|
@@ -286,20 +286,18 @@ const AlertDialogOverlay = forwardRef(function AlertDialogOverlay2({ children, .
|
|
|
286
286
|
children
|
|
287
287
|
});
|
|
288
288
|
});
|
|
289
|
-
const PopoverContent = forwardRef(function PopoverContent2({ children, onOpenAutoFocus, ...props }, ref) {
|
|
289
|
+
const PopoverContent = forwardRef(function PopoverContent2({ children, onOpenAutoFocus: _onOpenAutoFocus, ...props }, ref) {
|
|
290
290
|
const { knobProps } = useResolvedKnobs({
|
|
291
291
|
component: "PopoverContent",
|
|
292
292
|
painted: false
|
|
293
293
|
});
|
|
294
|
-
|
|
295
|
-
return /* @__PURE__ */ jsx(Popover.Content, {
|
|
294
|
+
return /* @__PURE__ */ jsx(YStack, {
|
|
296
295
|
ref,
|
|
297
296
|
...knobProps.elevatedSurface,
|
|
298
297
|
...knobProps.containerRadius,
|
|
299
298
|
...transitionProps(knobProps.motion.overlay),
|
|
300
299
|
...overlayEnterExit,
|
|
301
300
|
...overlayFrameFocus,
|
|
302
|
-
onOpenAutoFocus: withHouseOpenFocus(onOpenAutoFocus, contentId),
|
|
303
301
|
...props,
|
|
304
302
|
children: /* @__PURE__ */ jsx(Surface, {
|
|
305
303
|
painted: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlaySurfaces.js","names":[],"sources":["esm/theme/overlaySurfaces.js"],"sourcesContent":["import { focusOnOpen, wasKeyboardFocus } from \"../keyboardFocusRing\";\nimport { scrimFor } from \"./motion\";\nimport { transitionProps } from \"./transitionProps\";\nimport { Surface } from \"./Surface\";\nimport { useResolvedKnobs } from \"./useResolvedKnobs\";\nimport { ALERT_READABLE_WIDTH } from \"./layoutTokens\";\nimport { panelPaddingPx } from \"./resolveKnobs\";\nimport { createContext, forwardRef, useContext, useEffect } from \"react\";\nimport { createChangeEventDetails } from \"@tamagui/web\";\nimport {\n AlertDialog,\n Dialog,\n isWeb,\n Popover,\n useDialogContext,\n usePopoverContext,\n useWindowDimensions,\n YStack\n} from \"tamagui\";\nimport { jsx } from \"react/jsx-runtime\";\nconst dialogScrim = \"$scrim-dialog\";\nconst sheetScrim = \"$scrim-sheet\";\nconst overlayScrim = dialogScrim;\nconst sheetGrabber = {\n width: 36,\n height: 5,\n borderRadius: 100,\n backgroundColor: \"$color-12\",\n opacity: 0.3,\n alignSelf: \"center\",\n marginHorizontal: 0,\n marginTop: 5,\n marginBottom: -10,\n zIndex: 10\n};\nconst sheetGrabberClearance = 16;\nconst sheetGrabberZone = {\n alignSelf: \"stretch\",\n alignItems: \"center\",\n height: 21\n};\nconst sheetHandleWidthRatio = 0.3;\nconst sheetHandle = {\n width: \"30%\",\n height: 10,\n borderRadius: 100,\n backgroundColor: \"$color-5\",\n opacity: 1,\n alignSelf: \"center\",\n marginHorizontal: 0,\n marginTop: 0,\n marginBottom: 8,\n zIndex: 10\n};\nconst sheetHandleZone = {\n alignSelf: \"stretch\",\n alignItems: \"center\",\n paddingTop: 8\n};\nconst sheetHandleToneOpen = { backgroundColor: \"$color-5\", opacity: 1 };\nfunction sheetHandleTone(_scheme) {\n return sheetHandleToneOpen;\n}\nconst overlayFrameFocus = {\n outlineWidth: { default: 0, focus: 0, \"focus-visible\": 0 },\n outlineStyle: { default: \"none\", focus: \"none\", \"focus-visible\": \"none\" }\n};\nfunction isTabbableWithin(node, container) {\n if (node.tabIndex < 0 || node.hidden || node.tagName === \"A\") return false;\n if (node.disabled) return false;\n if (typeof HTMLInputElement !== \"undefined\" && node instanceof HTMLInputElement && node.type === \"hidden\") {\n return false;\n }\n if (getComputedStyle(node).visibility === \"hidden\") return false;\n for (let el = node; el && el !== container; el = el.parentElement) {\n if (getComputedStyle(el).display === \"none\") return false;\n }\n return true;\n}\nfunction focusFirstTabbableOnOpen(details, container) {\n if (typeof HTMLElement === \"undefined\" || !(container instanceof HTMLElement)) return;\n const first = Array.from(container.querySelectorAll(\"*\")).find(\n (node) => isTabbableWithin(node, container)\n );\n if (!first) return;\n details.cancel();\n const focused = focusOnOpen(first, container);\n if (typeof HTMLInputElement !== \"undefined\" && focused instanceof HTMLInputElement) {\n focused.select();\n }\n}\nfunction withHouseOpenFocus(onOpenAutoFocus, contentId) {\n return (details) => {\n onOpenAutoFocus?.(details);\n if (!details.isCanceled) focusFirstTabbableOnOpen(details, contentById(contentId));\n };\n}\nfunction contentById(contentId) {\n if (!contentId || typeof document === \"undefined\") return null;\n return document.getElementById(contentId);\n}\nfunction useDialogShowFocus(onOpenAutoFocus) {\n const { open, contentId } = useDialogContext();\n useEffect(() => {\n if (!open || !contentId || !isWeb || typeof document === \"undefined\") return;\n const content = document.getElementById(contentId);\n const focused = document.activeElement;\n if (!content || typeof HTMLElement === \"undefined\" || !(focused instanceof HTMLElement)) return;\n if (!content.contains(focused) || focused.tabIndex >= 0 && wasKeyboardFocus()) return;\n onOpenAutoFocus(createChangeEventDetails(\"trigger-focus\"));\n }, [open, contentId]);\n}\nfunction DialogShowFocus({ onOpenAutoFocus }) {\n const { contentId } = useDialogContext();\n useDialogShowFocus(withHouseOpenFocus(onOpenAutoFocus, contentId));\n return null;\n}\nconst DialogRegionContext = createContext({\n inDialogRegion: false\n});\nfunction useDialogRegionContext() {\n return useContext(DialogRegionContext);\n}\nfunction useIsInDialogRegion() {\n return useDialogRegionContext().inDialogRegion;\n}\nconst IN_DIALOG_REGION = { inDialogRegion: true };\nconst SheetBodyContext = createContext(false);\nconst SheetBodyProvider = SheetBodyContext.Provider;\nfunction useIsInSheetBody() {\n return useContext(SheetBodyContext);\n}\nconst DialogSheetFaceContext = createContext(false);\nconst DialogSheetFaceProvider = DialogSheetFaceContext.Provider;\nfunction useDialogSheetFace() {\n return useContext(DialogSheetFaceContext);\n}\nconst DialogSheetBody = forwardRef(\n function DialogSheetBody2({ children }, ref) {\n const { knobProps } = useResolvedKnobs({ component: \"DialogContent\" });\n return /* @__PURE__ */ jsx(YStack, { ref, ...knobProps.gap, ...{ \"data-mp-dialog-face\": \"sheet\" }, children: /* @__PURE__ */ jsx(DialogSheetFaceContext.Provider, { value: false, children: /* @__PURE__ */ jsx(DialogRegionContext.Provider, { value: IN_DIALOG_REGION, children }) }) });\n }\n);\nconst overlayEnterExit = {\n opacity: { enter: 0, exit: 0 },\n y: { enter: -4, exit: -4 },\n scale: { enter: 0.97, exit: 0.97 }\n};\nconst DialogContent = forwardRef(function DialogContent2({ children, size = \"4\", ...props }, ref) {\n if (useDialogSheetFace()) return /* @__PURE__ */ jsx(DialogSheetBody, { ref, children });\n return /* @__PURE__ */ jsx(Surface, { size, painted: false, elevated: true, children: /* @__PURE__ */ jsx(DialogContentInner, { ref, ...props, children }) });\n});\nfunction useWindowFit(props, fallbackMaxWidth) {\n const { width: windowWidth } = useWindowDimensions();\n const room = windowWidth > 0 ? Math.max(0, windowWidth - 2 * panelPaddingPx()) : void 0;\n const fit = (value) => room != null && typeof value === \"number\" ? Math.min(value, room) : value;\n if (room == null) return fallbackMaxWidth == null ? void 0 : { maxWidth: fallbackMaxWidth };\n return {\n maxWidth: fit(props.maxWidth ?? fallbackMaxWidth ?? room),\n ...props.minWidth != null ? { minWidth: fit(props.minWidth) } : void 0,\n ...props.width != null ? { width: fit(props.width) } : void 0\n };\n}\nconst DialogContentInner = forwardRef(function DialogContentInner2({ children, onOpenAutoFocus, ...props }, ref) {\n const { knobProps } = useResolvedKnobs({ component: \"DialogContent\" });\n const { contentId } = useDialogContext();\n const openFocus = withHouseOpenFocus(onOpenAutoFocus, contentId);\n useDialogShowFocus(openFocus);\n const windowFit = useWindowFit(props);\n return /* @__PURE__ */ jsx(\n Dialog.Content,\n {\n ref,\n position: \"relative\",\n pointerEvents: \"auto\",\n ...knobProps.elevatedSurface,\n ...knobProps.containerRadius,\n ...knobProps.panelPadding,\n ...knobProps.gap,\n elevate: false,\n ...transitionProps(knobProps.motion.overlay),\n ...overlayEnterExit,\n ...overlayFrameFocus,\n onOpenAutoFocus: openFocus,\n ...props,\n ...windowFit,\n children: /* @__PURE__ */ jsx(DialogRegionContext.Provider, { value: IN_DIALOG_REGION, children: /* @__PURE__ */ jsx(SheetBodyContext.Provider, { value: false, children }) })\n }\n );\n});\nconst scrimFade = { opacity: { enter: 0, exit: 0 } };\nconst DialogOverlay = forwardRef(function DialogOverlay2({ children, ...props }, ref) {\n const { knobProps } = useResolvedKnobs();\n const sheetFace = useDialogSheetFace();\n if (sheetFace) return null;\n return /* @__PURE__ */ jsx(\n Dialog.Overlay,\n {\n ref,\n backgroundColor: dialogScrim,\n ...transitionProps(scrimFor(knobProps.motion.overlay)),\n ...scrimFade,\n ...props,\n children\n }\n );\n});\nconst AlertDialogContent = forwardRef(\n function AlertDialogContent2({ children, size = \"4\", ...props }, ref) {\n return /* @__PURE__ */ jsx(Surface, { size, painted: false, elevated: true, children: /* @__PURE__ */ jsx(AlertDialogContentInner, { ref, ...props, children }) });\n }\n);\nconst AlertDialogContentInner = forwardRef(function AlertDialogContentInner2({ children, ...props }, ref) {\n const { knobProps } = useResolvedKnobs({ component: \"AlertDialogContent\" });\n const { contentId } = useDialogContext();\n useDialogShowFocus(withHouseOpenFocus(props.onOpenAutoFocus, contentId));\n const windowFit = useWindowFit(props, ALERT_READABLE_WIDTH);\n return /* @__PURE__ */ jsx(\n AlertDialog.Content,\n {\n ref,\n ...knobProps.elevatedSurface,\n ...knobProps.containerRadius,\n ...knobProps.panelPadding,\n ...knobProps.gap,\n elevate: false,\n ...transitionProps(knobProps.motion.overlay),\n ...overlayEnterExit,\n ...overlayFrameFocus,\n ...props,\n ...windowFit,\n children: /* @__PURE__ */ jsx(DialogRegionContext.Provider, { value: IN_DIALOG_REGION, children: /* @__PURE__ */ jsx(SheetBodyContext.Provider, { value: false, children }) })\n }\n );\n});\nconst AlertDialogOverlay = forwardRef(function AlertDialogOverlay2({ children, ...props }, ref) {\n const { knobProps } = useResolvedKnobs();\n return /* @__PURE__ */ jsx(\n AlertDialog.Overlay,\n {\n ref,\n backgroundColor: dialogScrim,\n ...transitionProps(scrimFor(knobProps.motion.overlay)),\n ...scrimFade,\n ...props,\n children\n }\n );\n});\nconst PopoverContent = forwardRef(\n function PopoverContent2({ children, onOpenAutoFocus, ...props }, ref) {\n const { knobProps } = useResolvedKnobs({ component: \"PopoverContent\", painted: false });\n const { contentId } = usePopoverContext();\n return /* @__PURE__ */ jsx(\n Popover.Content,\n {\n ref,\n ...knobProps.elevatedSurface,\n ...knobProps.containerRadius,\n ...transitionProps(knobProps.motion.overlay),\n ...overlayEnterExit,\n ...overlayFrameFocus,\n onOpenAutoFocus: withHouseOpenFocus(onOpenAutoFocus, contentId),\n ...props,\n children: /* @__PURE__ */ jsx(Surface, { painted: false, elevated: true, children: /* @__PURE__ */ jsx(SheetBodyContext.Provider, { value: false, children }) })\n }\n );\n }\n);\nexport {\n AlertDialogContent,\n AlertDialogOverlay,\n DialogContent,\n DialogOverlay,\n DialogRegionContext,\n DialogSheetFaceProvider,\n DialogShowFocus,\n PopoverContent,\n SheetBodyProvider,\n dialogScrim,\n overlayScrim,\n sheetGrabber,\n sheetGrabberClearance,\n sheetGrabberZone,\n sheetHandle,\n sheetHandleTone,\n sheetHandleWidthRatio,\n sheetHandleZone,\n sheetScrim,\n useDialogRegionContext,\n useDialogSheetFace,\n useIsInDialogRegion,\n useIsInSheetBody\n};\n//# sourceMappingURL=overlaySurfaces.js.map\n"],"mappings":";;;;;;;;;;;;;AAoBA,MAAM,cAAc;AACpB,MAAM,aAAa;AACnB,MAAM,eAAe;AACrB,MAAM,eAAe;CACnB,OAAO;CACP,QAAQ;CACR,cAAc;CACd,iBAAiB;CACjB,SAAS;CACT,WAAW;CACX,kBAAkB;CAClB,WAAW;CACX,cAAc,CAAC;CACf,QAAQ;AACV;AACA,MAAM,wBAAwB;AAC9B,MAAM,mBAAmB;CACvB,WAAW;CACX,YAAY;CACZ,QAAQ;AACV;AACA,MAAM,wBAAwB;AAC9B,MAAM,cAAc;CAClB,OAAO;CACP,QAAQ;CACR,cAAc;CACd,iBAA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EACH,iBAAiB,mBAAmB,iBAAiB,SAAS;EAC9D,GAAG;EACH,UAA0B,oBAAI,SAAS;GAAE,SAAS;GAAO,UAAU;GAAM,UAA0B,oBAAI,iBAAiB,UAAU;IAAE,OAAO;IAAO;GAAS,CAAC;EAAE,CAAC;CACjK,CACF;AACF,CACF"}
|
|
1
|
+
{"version":3,"file":"overlaySurfaces.js","names":[],"sources":["esm/theme/overlaySurfaces.js"],"sourcesContent":["import { focusOnOpen, wasKeyboardFocus } from \"../keyboardFocusRing\";\nimport { scrimFor } from \"./motion\";\nimport { transitionProps } from \"./transitionProps\";\nimport { Surface } from \"./Surface\";\nimport { useResolvedKnobs } from \"./useResolvedKnobs\";\nimport { ALERT_READABLE_WIDTH } from \"./layoutTokens\";\nimport { panelPaddingPx } from \"./resolveKnobs\";\nimport { createContext, forwardRef, useContext, useEffect } from \"react\";\nimport { createChangeEventDetails } from \"@tamagui/web\";\nimport {\n AlertDialog,\n Dialog,\n isWeb,\n useDialogContext,\n useWindowDimensions,\n YStack\n} from \"tamagui\";\nimport { jsx } from \"react/jsx-runtime\";\nconst dialogScrim = \"$scrim-dialog\";\nconst sheetScrim = \"$scrim-sheet\";\nconst overlayScrim = dialogScrim;\nconst sheetGrabber = {\n width: 36,\n height: 5,\n borderRadius: 100,\n backgroundColor: \"$color-12\",\n opacity: 0.3,\n alignSelf: \"center\",\n marginHorizontal: 0,\n marginTop: 5,\n marginBottom: -10,\n zIndex: 10\n};\nconst sheetGrabberClearance = 16;\nconst sheetGrabberZone = {\n alignSelf: \"stretch\",\n alignItems: \"center\",\n height: 21\n};\nconst sheetHandleWidthRatio = 0.3;\nconst sheetHandle = {\n width: \"30%\",\n height: 10,\n borderRadius: 100,\n backgroundColor: \"$color-5\",\n opacity: 1,\n alignSelf: \"center\",\n marginHorizontal: 0,\n marginTop: 0,\n marginBottom: 8,\n zIndex: 10\n};\nconst sheetHandleZone = {\n alignSelf: \"stretch\",\n alignItems: \"center\",\n paddingTop: 8\n};\nconst sheetHandleToneOpen = { backgroundColor: \"$color-5\", opacity: 1 };\nfunction sheetHandleTone(_scheme) {\n return sheetHandleToneOpen;\n}\nconst overlayFrameFocus = {\n outlineWidth: { default: 0, focus: 0, \"focus-visible\": 0 },\n outlineStyle: { default: \"none\", focus: \"none\", \"focus-visible\": \"none\" }\n};\nfunction isTabbableWithin(node, container) {\n if (node.tabIndex < 0 || node.hidden || node.tagName === \"A\") return false;\n if (node.disabled) return false;\n if (typeof HTMLInputElement !== \"undefined\" && node instanceof HTMLInputElement && node.type === \"hidden\") {\n return false;\n }\n if (getComputedStyle(node).visibility === \"hidden\") return false;\n for (let el = node; el && el !== container; el = el.parentElement) {\n if (getComputedStyle(el).display === \"none\") return false;\n }\n return true;\n}\nfunction focusFirstTabbableOnOpen(details, container) {\n if (typeof HTMLElement === \"undefined\" || !(container instanceof HTMLElement)) return;\n const first = Array.from(container.querySelectorAll(\"*\")).find(\n (node) => isTabbableWithin(node, container)\n );\n if (!first) return;\n details.cancel();\n const focused = focusOnOpen(first, container);\n if (typeof HTMLInputElement !== \"undefined\" && focused instanceof HTMLInputElement) {\n focused.select();\n }\n}\nfunction withHouseOpenFocus(onOpenAutoFocus, contentId) {\n return (details) => {\n onOpenAutoFocus?.(details);\n if (!details.isCanceled) focusFirstTabbableOnOpen(details, contentById(contentId));\n };\n}\nfunction contentById(contentId) {\n if (!contentId || typeof document === \"undefined\") return null;\n return document.getElementById(contentId);\n}\nfunction useDialogShowFocus(onOpenAutoFocus) {\n const { open, contentId } = useDialogContext();\n useEffect(() => {\n if (!open || !contentId || !isWeb || typeof document === \"undefined\") return;\n const content = document.getElementById(contentId);\n const focused = document.activeElement;\n if (!content || typeof HTMLElement === \"undefined\" || !(focused instanceof HTMLElement)) return;\n if (!content.contains(focused) || focused.tabIndex >= 0 && wasKeyboardFocus()) return;\n onOpenAutoFocus(createChangeEventDetails(\"trigger-focus\"));\n }, [open, contentId]);\n}\nfunction DialogShowFocus({ onOpenAutoFocus }) {\n const { contentId } = useDialogContext();\n useDialogShowFocus(withHouseOpenFocus(onOpenAutoFocus, contentId));\n return null;\n}\nconst DialogRegionContext = createContext({\n inDialogRegion: false\n});\nfunction useDialogRegionContext() {\n return useContext(DialogRegionContext);\n}\nfunction useIsInDialogRegion() {\n return useDialogRegionContext().inDialogRegion;\n}\nconst IN_DIALOG_REGION = { inDialogRegion: true };\nconst SheetBodyContext = createContext(false);\nconst SheetBodyProvider = SheetBodyContext.Provider;\nfunction useIsInSheetBody() {\n return useContext(SheetBodyContext);\n}\nconst DialogSheetFaceContext = createContext(false);\nconst DialogSheetFaceProvider = DialogSheetFaceContext.Provider;\nfunction useDialogSheetFace() {\n return useContext(DialogSheetFaceContext);\n}\nconst DialogSheetBody = forwardRef(\n function DialogSheetBody2({ children }, ref) {\n const { knobProps } = useResolvedKnobs({ component: \"DialogContent\" });\n return /* @__PURE__ */ jsx(YStack, { ref, ...knobProps.gap, ...{ \"data-mp-dialog-face\": \"sheet\" }, children: /* @__PURE__ */ jsx(DialogSheetFaceContext.Provider, { value: false, children: /* @__PURE__ */ jsx(DialogRegionContext.Provider, { value: IN_DIALOG_REGION, children }) }) });\n }\n);\nconst overlayEnterExit = {\n opacity: { enter: 0, exit: 0 },\n y: { enter: -4, exit: -4 },\n scale: { enter: 0.97, exit: 0.97 }\n};\nconst DialogContent = forwardRef(function DialogContent2({ children, size = \"4\", ...props }, ref) {\n if (useDialogSheetFace()) return /* @__PURE__ */ jsx(DialogSheetBody, { ref, children });\n return /* @__PURE__ */ jsx(Surface, { size, painted: false, elevated: true, children: /* @__PURE__ */ jsx(DialogContentInner, { ref, ...props, children }) });\n});\nfunction useWindowFit(props, fallbackMaxWidth) {\n const { width: windowWidth } = useWindowDimensions();\n const room = windowWidth > 0 ? Math.max(0, windowWidth - 2 * panelPaddingPx()) : void 0;\n const fit = (value) => room != null && typeof value === \"number\" ? Math.min(value, room) : value;\n if (room == null) return fallbackMaxWidth == null ? void 0 : { maxWidth: fallbackMaxWidth };\n return {\n maxWidth: fit(props.maxWidth ?? fallbackMaxWidth ?? room),\n ...props.minWidth != null ? { minWidth: fit(props.minWidth) } : void 0,\n ...props.width != null ? { width: fit(props.width) } : void 0\n };\n}\nconst DialogContentInner = forwardRef(function DialogContentInner2({ children, onOpenAutoFocus, ...props }, ref) {\n const { knobProps } = useResolvedKnobs({ component: \"DialogContent\" });\n const { contentId } = useDialogContext();\n const openFocus = withHouseOpenFocus(onOpenAutoFocus, contentId);\n useDialogShowFocus(openFocus);\n const windowFit = useWindowFit(props);\n return /* @__PURE__ */ jsx(\n Dialog.Content,\n {\n ref,\n position: \"relative\",\n pointerEvents: \"auto\",\n ...knobProps.elevatedSurface,\n ...knobProps.containerRadius,\n ...knobProps.panelPadding,\n ...knobProps.gap,\n elevate: false,\n ...transitionProps(knobProps.motion.overlay),\n ...overlayEnterExit,\n ...overlayFrameFocus,\n onOpenAutoFocus: openFocus,\n ...props,\n ...windowFit,\n children: /* @__PURE__ */ jsx(DialogRegionContext.Provider, { value: IN_DIALOG_REGION, children: /* @__PURE__ */ jsx(SheetBodyContext.Provider, { value: false, children }) })\n }\n );\n});\nconst scrimFade = { opacity: { enter: 0, exit: 0 } };\nconst DialogOverlay = forwardRef(function DialogOverlay2({ children, ...props }, ref) {\n const { knobProps } = useResolvedKnobs();\n const sheetFace = useDialogSheetFace();\n if (sheetFace) return null;\n return /* @__PURE__ */ jsx(\n Dialog.Overlay,\n {\n ref,\n backgroundColor: dialogScrim,\n ...transitionProps(scrimFor(knobProps.motion.overlay)),\n ...scrimFade,\n ...props,\n children\n }\n );\n});\nconst AlertDialogContent = forwardRef(\n function AlertDialogContent2({ children, size = \"4\", ...props }, ref) {\n return /* @__PURE__ */ jsx(Surface, { size, painted: false, elevated: true, children: /* @__PURE__ */ jsx(AlertDialogContentInner, { ref, ...props, children }) });\n }\n);\nconst AlertDialogContentInner = forwardRef(function AlertDialogContentInner2({ children, ...props }, ref) {\n const { knobProps } = useResolvedKnobs({ component: \"AlertDialogContent\" });\n const { contentId } = useDialogContext();\n useDialogShowFocus(withHouseOpenFocus(props.onOpenAutoFocus, contentId));\n const windowFit = useWindowFit(props, ALERT_READABLE_WIDTH);\n return /* @__PURE__ */ jsx(\n AlertDialog.Content,\n {\n ref,\n ...knobProps.elevatedSurface,\n ...knobProps.containerRadius,\n ...knobProps.panelPadding,\n ...knobProps.gap,\n elevate: false,\n ...transitionProps(knobProps.motion.overlay),\n ...overlayEnterExit,\n ...overlayFrameFocus,\n ...props,\n ...windowFit,\n children: /* @__PURE__ */ jsx(DialogRegionContext.Provider, { value: IN_DIALOG_REGION, children: /* @__PURE__ */ jsx(SheetBodyContext.Provider, { value: false, children }) })\n }\n );\n});\nconst AlertDialogOverlay = forwardRef(function AlertDialogOverlay2({ children, ...props }, ref) {\n const { knobProps } = useResolvedKnobs();\n return /* @__PURE__ */ jsx(\n AlertDialog.Overlay,\n {\n ref,\n backgroundColor: dialogScrim,\n ...transitionProps(scrimFor(knobProps.motion.overlay)),\n ...scrimFade,\n ...props,\n children\n }\n );\n});\nconst PopoverContent = forwardRef(\n function PopoverContent2({ children, onOpenAutoFocus: _onOpenAutoFocus, ...props }, ref) {\n const { knobProps } = useResolvedKnobs({ component: \"PopoverContent\", painted: false });\n return /* @__PURE__ */ jsx(\n YStack,\n {\n ref,\n ...knobProps.elevatedSurface,\n ...knobProps.containerRadius,\n ...transitionProps(knobProps.motion.overlay),\n ...overlayEnterExit,\n ...overlayFrameFocus,\n ...props,\n children: /* @__PURE__ */ jsx(Surface, { painted: false, elevated: true, children: /* @__PURE__ */ jsx(SheetBodyContext.Provider, { value: false, children }) })\n }\n );\n }\n);\nexport {\n AlertDialogContent,\n AlertDialogOverlay,\n DialogContent,\n DialogOverlay,\n DialogRegionContext,\n DialogSheetFaceProvider,\n DialogShowFocus,\n PopoverContent,\n SheetBodyProvider,\n dialogScrim,\n overlayScrim,\n sheetGrabber,\n sheetGrabberClearance,\n sheetGrabberZone,\n sheetHandle,\n sheetHandleTone,\n sheetHandleWidthRatio,\n sheetHandleZone,\n sheetScrim,\n useDialogRegionContext,\n useDialogSheetFace,\n useIsInDialogRegion,\n useIsInSheetBody\n};\n//# sourceMappingURL=overlaySurfaces.js.map\n"],"mappings":";;;;;;;;;;;;;AAkBA,MAAM,cAAc;AACpB,MAAM,aAAa;AACnB,MAAM,eAAe;AACrB,MAAM,eAAe;CACnB,OAAO;CACP,QAAQ;CACR,cAAc;CACd,iBAAiB;CACjB,SAAS;CACT,WAAW;CACX,kBAAkB;CAClB,WAAW;CACX,cAAc,CAAC;CACf,QAAQ;AACV;AACA,MAAM,wBAAwB;AAC9B,MAAM,mBAAmB;CACvB,WAAW;CACX,YAAY;CACZ,QAAQ;AACV;AACA,MAAM,wBAAwB;AAC9B,MAAM,cAAc;CAClB,OAAO;CACP,QAAQ;CACR,cAAc;CACd,iBAAiB;CACjB,SAAS;CACT,WAAW;CACX,kBAAkB;CAClB,WAAW;CACX,cAAc;CACd,QAAQ;AACV;AACA,MAAM,kBAAkB;CACtB,WAAW;CACX,YAAY;CACZ,YAAY;AACd;AACA,MAAM,sBAAsB;CAAE,iBAAiB;CAAY,SAAS;AAAE;AACtE,SAAS,gBAAgB,SAAS;CAChC,OAAO;AACT;AACA,MAAM,oBAAoB;CACxB,cAAc;EAAE,SAAS;EAAG,OAAO;EAAG,iBAAiB;CAAE;CACzD,cAAc;EAAE,SAAS;EAAQ,OAAO;EAAQ,iBAAiB;CAAO;AAC1E;AACA,SAAS,iBAAiB,MAAM,WAAW;CACzC,IAAI,KAAK,WAAW,KAAK,KAAK,UAAU,KAAK,YAAY,KAAK,OAAO;CACrE,IAAI,KAAK,UAAU,OAAO;CAC1B,IAAI,OAAO,qBAAqB,eAAe,gBAAgB,oBAAoB,KAAK,SAAS,UAAU;EACzG,OAAO;CACT;CACA,IAAI,iBAAiB,IAAI,CAAC,CAAC,eAAe,UAAU,OAAO;CAC3D,KAAK,IAAI,KAAK,MAAM,MAAM,OAAO,WAAW,KAAK,GAAG,eA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AAE,UAAU,GAAG,SAAS,KAAK;CAC9F,MAAM,EAAE,cAAc,iBAAiB;CACvC,OAAuB,oBACrB,YAAY,SACZ;EACE;EACA,iBAAiB;EACjB,GAAG,gBAAgB,SAAS,UAAU,OAAO,OAAO,CAAC;EACrD,GAAG;EACH,GAAG;EACH;CACF,CACF;AACF,CAAC;AACD,MAAM,iBAAiB,WACrB,SAAS,gBAAgB,EAAE,UAAU,iBAAiB,kBAAkB,GAAG,SAAS,KAAK;CACvF,MAAM,EAAE,cAAc,iBAAiB;EAAE,WAAW;EAAkB,SAAS;CAAM,CAAC;CACtF,OAAuB,oBACrB,QACA;EACE;EACA,GAAG,UAAU;EACb,GAAG,UAAU;EACb,GAAG,gBAAgB,UAAU,OAAO,OAAO;EAC3C,GAAG;EACH,GAAG;EACH,GAAG;EACH,UAA0B,oBAAI,SAAS;GAAE,SAAS;GAAO,UAAU;GAAM,UAA0B,oBAAI,iBAAiB,UAAU;IAAE,OAAO;IAAO;GAAS,CAAC;EAAE,CAAC;CACjK,CACF;AACF,CACF"}
|
|
@@ -8,7 +8,7 @@ import { ALERT_READABLE_WIDTH } from "./layoutTokens.native.js";
|
|
|
8
8
|
import { panelPaddingPx } from "./resolveKnobs.native.js";
|
|
9
9
|
import { createContext, forwardRef, useContext, useEffect } from "react";
|
|
10
10
|
import { createChangeEventDetails } from "@tamagui/web";
|
|
11
|
-
import { AlertDialog, Dialog,
|
|
11
|
+
import { AlertDialog, Dialog, YStack, isWeb, useDialogContext, useWindowDimensions } from "tamagui";
|
|
12
12
|
|
|
13
13
|
var dialogScrim = "$scrim-dialog";
|
|
14
14
|
var sheetScrim = "$scrim-sheet";
|
|
@@ -300,20 +300,18 @@ var AlertDialogOverlay = /* @__PURE__ */ forwardRef(function AlertDialogOverlay2
|
|
|
300
300
|
});
|
|
301
301
|
});
|
|
302
302
|
var PopoverContent = /* @__PURE__ */ forwardRef(function PopoverContent2(param, ref) {
|
|
303
|
-
var { children, onOpenAutoFocus, ...props } = param;
|
|
303
|
+
var { children, onOpenAutoFocus: _onOpenAutoFocus, ...props } = param;
|
|
304
304
|
var { knobProps } = useResolvedKnobs({
|
|
305
305
|
component: "PopoverContent",
|
|
306
306
|
painted: false
|
|
307
307
|
});
|
|
308
|
-
|
|
309
|
-
return /* @__PURE__ */ jsx(Popover.Content, {
|
|
308
|
+
return /* @__PURE__ */ jsx(YStack, {
|
|
310
309
|
ref,
|
|
311
310
|
...knobProps.elevatedSurface,
|
|
312
311
|
...knobProps.containerRadius,
|
|
313
312
|
...transitionProps(knobProps.motion.overlay),
|
|
314
313
|
...overlayEnterExit,
|
|
315
314
|
...overlayFrameFocus,
|
|
316
|
-
onOpenAutoFocus: withHouseOpenFocus(onOpenAutoFocus, contentId),
|
|
317
315
|
...props,
|
|
318
316
|
children: /* @__PURE__ */ jsx(Surface, {
|
|
319
317
|
painted: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlaySurfaces.native.js","names":[],"sources":["esm/theme/overlaySurfaces.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { focusOnOpen, wasKeyboardFocus } from \"../keyboardFocusRing\";\nimport { scrimFor } from \"./motion\";\nimport { transitionProps } from \"./transitionProps\";\nimport { Surface } from \"./Surface\";\nimport { useResolvedKnobs } from \"./useResolvedKnobs\";\nimport { ALERT_READABLE_WIDTH } from \"./layoutTokens\";\nimport { panelPaddingPx } from \"./resolveKnobs\";\nimport { createContext, forwardRef, useContext, useEffect } from \"react\";\nimport { createChangeEventDetails } from \"@tamagui/web\";\nimport { AlertDialog, Dialog, isWeb, Popover, useDialogContext, usePopoverContext, useWindowDimensions, YStack } from \"tamagui\";\nvar dialogScrim = \"$scrim-dialog\";\nvar sheetScrim = \"$scrim-sheet\";\nvar overlayScrim = dialogScrim;\nvar sheetGrabber = {\n width: 36,\n height: 5,\n borderRadius: 100,\n backgroundColor: \"$color-12\",\n opacity: 0.3,\n alignSelf: \"center\",\n marginHorizontal: 0,\n marginTop: 5,\n marginBottom: -10,\n zIndex: 10\n};\nvar sheetGrabberClearance = 16;\nvar sheetGrabberZone = {\n alignSelf: \"stretch\",\n alignItems: \"center\",\n height: 21\n};\nvar sheetHandleWidthRatio = 0.3;\nvar sheetHandle = {\n width: \"30%\",\n height: 10,\n borderRadius: 100,\n backgroundColor: \"$color-5\",\n opacity: 1,\n alignSelf: \"center\",\n marginHorizontal: 0,\n marginTop: 0,\n marginBottom: 8,\n zIndex: 10\n};\nvar sheetHandleZone = {\n alignSelf: \"stretch\",\n alignItems: \"center\",\n paddingTop: 8\n};\nvar sheetHandleToneOpen = {\n backgroundColor: \"$color-5\",\n opacity: 1\n};\nfunction sheetHandleTone(_scheme) {\n return sheetHandleToneOpen;\n}\nvar overlayFrameFocus = {\n outlineWidth: {\n default: 0,\n focus: 0,\n \"focus-visible\": 0\n },\n outlineStyle: {\n default: \"none\",\n focus: \"none\",\n \"focus-visible\": \"none\"\n }\n};\nfunction isTabbableWithin(node, container) {\n if (node.tabIndex < 0 || node.hidden || node.tagName === \"A\") return false;\n if (node.disabled) return false;\n if (typeof HTMLInputElement !== \"undefined\" && node instanceof HTMLInputElement && node.type === \"hidden\") {\n return false;\n }\n if (getComputedStyle(node).visibility === \"hidden\") return false;\n for (var el = node; el && el !== container; el = el.parentElement) {\n if (getComputedStyle(el).display === \"none\") return false;\n }\n return true;\n}\nfunction focusFirstTabbableOnOpen(details, container) {\n if (typeof HTMLElement === \"undefined\" || !(container instanceof HTMLElement)) return;\n var first = Array.from(container.querySelectorAll(\"*\")).find(function(node) {\n return isTabbableWithin(node, container);\n });\n if (!first) return;\n details.cancel();\n var focused = focusOnOpen(first, container);\n if (typeof HTMLInputElement !== \"undefined\" && focused instanceof HTMLInputElement) {\n focused.select();\n }\n}\nfunction withHouseOpenFocus(onOpenAutoFocus, contentId) {\n return function(details) {\n onOpenAutoFocus === null || onOpenAutoFocus === void 0 ? void 0 : onOpenAutoFocus(details);\n if (!details.isCanceled) focusFirstTabbableOnOpen(details, contentById(contentId));\n };\n}\nfunction contentById(contentId) {\n if (!contentId || typeof document === \"undefined\") return null;\n return document.getElementById(contentId);\n}\nfunction useDialogShowFocus(onOpenAutoFocus) {\n var { open, contentId } = useDialogContext();\n useEffect(function() {\n if (!open || !contentId || !isWeb || typeof document === \"undefined\") return;\n var content = document.getElementById(contentId);\n var focused = document.activeElement;\n if (!content || typeof HTMLElement === \"undefined\" || !(focused instanceof HTMLElement)) return;\n if (!content.contains(focused) || focused.tabIndex >= 0 && wasKeyboardFocus()) return;\n onOpenAutoFocus(createChangeEventDetails(\"trigger-focus\"));\n }, [\n open,\n contentId\n ]);\n}\nfunction DialogShowFocus(param) {\n var { onOpenAutoFocus } = param;\n var { contentId } = useDialogContext();\n useDialogShowFocus(withHouseOpenFocus(onOpenAutoFocus, contentId));\n return null;\n}\nvar DialogRegionContext = /* @__PURE__ */ createContext({\n inDialogRegion: false\n});\nfunction useDialogRegionContext() {\n return useContext(DialogRegionContext);\n}\nfunction useIsInDialogRegion() {\n return useDialogRegionContext().inDialogRegion;\n}\nvar IN_DIALOG_REGION = {\n inDialogRegion: true\n};\nvar SheetBodyContext = /* @__PURE__ */ createContext(false);\nvar SheetBodyProvider = SheetBodyContext.Provider;\nfunction useIsInSheetBody() {\n return useContext(SheetBodyContext);\n}\nvar DialogSheetFaceContext = /* @__PURE__ */ createContext(false);\nvar DialogSheetFaceProvider = DialogSheetFaceContext.Provider;\nfunction useDialogSheetFace() {\n return useContext(DialogSheetFaceContext);\n}\nvar DialogSheetBody = /* @__PURE__ */ forwardRef(function DialogSheetBody2(param, ref) {\n var { children } = param;\n var { knobProps } = useResolvedKnobs({\n component: \"DialogContent\"\n });\n return /* @__PURE__ */ _jsx(YStack, {\n ref,\n ...knobProps.gap,\n ...{\n \"data-mp-dialog-face\": \"sheet\"\n },\n children: /* @__PURE__ */ _jsx(DialogSheetFaceContext.Provider, {\n value: false,\n children: /* @__PURE__ */ _jsx(DialogRegionContext.Provider, {\n value: IN_DIALOG_REGION,\n children\n })\n })\n });\n});\nvar overlayEnterExit = {\n opacity: {\n enter: 0,\n exit: 0\n },\n y: {\n enter: -4,\n exit: -4\n },\n scale: {\n enter: 0.97,\n exit: 0.97\n }\n};\nvar DialogContent = /* @__PURE__ */ forwardRef(function DialogContent2(param, ref) {\n var { children, size = \"4\", ...props } = param;\n if (useDialogSheetFace()) return /* @__PURE__ */ _jsx(DialogSheetBody, {\n ref,\n children\n });\n return /* @__PURE__ */ _jsx(Surface, {\n size,\n painted: false,\n elevated: true,\n children: /* @__PURE__ */ _jsx(DialogContentInner, {\n ref,\n ...props,\n children\n })\n });\n});\nfunction useWindowFit(props, fallbackMaxWidth) {\n var _ref, _props_maxWidth;\n var { width: windowWidth } = useWindowDimensions();\n var room = windowWidth > 0 ? Math.max(0, windowWidth - 2 * panelPaddingPx()) : void 0;\n var fit = function fit2(value) {\n return room != null && typeof value === \"number\" ? Math.min(value, room) : value;\n };\n if (room == null) return fallbackMaxWidth == null ? void 0 : {\n maxWidth: fallbackMaxWidth\n };\n return {\n maxWidth: fit((_ref = (_props_maxWidth = props.maxWidth) !== null && _props_maxWidth !== void 0 ? _props_maxWidth : fallbackMaxWidth) !== null && _ref !== void 0 ? _ref : room),\n ...props.minWidth != null ? {\n minWidth: fit(props.minWidth)\n } : void 0,\n ...props.width != null ? {\n width: fit(props.width)\n } : void 0\n };\n}\nvar DialogContentInner = /* @__PURE__ */ forwardRef(function DialogContentInner2(param, ref) {\n var { children, onOpenAutoFocus, ...props } = param;\n var { knobProps } = useResolvedKnobs({\n component: \"DialogContent\"\n });\n var { contentId } = useDialogContext();\n var openFocus = withHouseOpenFocus(onOpenAutoFocus, contentId);\n useDialogShowFocus(openFocus);\n var windowFit = useWindowFit(props);\n return /* @__PURE__ */ _jsx(Dialog.Content, {\n ref,\n position: \"relative\",\n pointerEvents: \"auto\",\n ...knobProps.elevatedSurface,\n ...knobProps.containerRadius,\n ...knobProps.panelPadding,\n ...knobProps.gap,\n elevate: false,\n ...transitionProps(knobProps.motion.overlay),\n ...overlayEnterExit,\n ...overlayFrameFocus,\n onOpenAutoFocus: openFocus,\n ...props,\n ...windowFit,\n children: /* @__PURE__ */ _jsx(DialogRegionContext.Provider, {\n value: IN_DIALOG_REGION,\n children: /* @__PURE__ */ _jsx(SheetBodyContext.Provider, {\n value: false,\n children\n })\n })\n });\n});\nvar scrimFade = {\n opacity: {\n enter: 0,\n exit: 0\n }\n};\nvar DialogOverlay = /* @__PURE__ */ forwardRef(function DialogOverlay2(param, ref) {\n var { children, ...props } = param;\n var { knobProps } = useResolvedKnobs();\n var sheetFace = useDialogSheetFace();\n if (sheetFace) return null;\n return /* @__PURE__ */ _jsx(Dialog.Overlay, {\n ref,\n backgroundColor: dialogScrim,\n ...transitionProps(scrimFor(knobProps.motion.overlay)),\n ...scrimFade,\n ...props,\n children\n });\n});\nvar AlertDialogContent = /* @__PURE__ */ forwardRef(function AlertDialogContent2(param, ref) {\n var { children, size = \"4\", ...props } = param;\n return /* @__PURE__ */ _jsx(Surface, {\n size,\n painted: false,\n elevated: true,\n children: /* @__PURE__ */ _jsx(AlertDialogContentInner, {\n ref,\n ...props,\n children\n })\n });\n});\nvar AlertDialogContentInner = /* @__PURE__ */ forwardRef(function AlertDialogContentInner2(param, ref) {\n var { children, ...props } = param;\n var { knobProps } = useResolvedKnobs({\n component: \"AlertDialogContent\"\n });\n var { contentId } = useDialogContext();\n useDialogShowFocus(withHouseOpenFocus(props.onOpenAutoFocus, contentId));\n var windowFit = useWindowFit(props, ALERT_READABLE_WIDTH);\n return /* @__PURE__ */ _jsx(AlertDialog.Content, {\n ref,\n ...knobProps.elevatedSurface,\n ...knobProps.containerRadius,\n ...knobProps.panelPadding,\n ...knobProps.gap,\n elevate: false,\n ...transitionProps(knobProps.motion.overlay),\n ...overlayEnterExit,\n ...overlayFrameFocus,\n ...props,\n ...windowFit,\n children: /* @__PURE__ */ _jsx(DialogRegionContext.Provider, {\n value: IN_DIALOG_REGION,\n children: /* @__PURE__ */ _jsx(SheetBodyContext.Provider, {\n value: false,\n children\n })\n })\n });\n});\nvar AlertDialogOverlay = /* @__PURE__ */ forwardRef(function AlertDialogOverlay2(param, ref) {\n var { children, ...props } = param;\n var { knobProps } = useResolvedKnobs();\n return /* @__PURE__ */ _jsx(AlertDialog.Overlay, {\n ref,\n backgroundColor: dialogScrim,\n ...transitionProps(scrimFor(knobProps.motion.overlay)),\n ...scrimFade,\n ...props,\n children\n });\n});\nvar PopoverContent = /* @__PURE__ */ forwardRef(function PopoverContent2(param, ref) {\n var { children, onOpenAutoFocus, ...props } = param;\n var { knobProps } = useResolvedKnobs({\n component: \"PopoverContent\",\n painted: false\n });\n var { contentId } = usePopoverContext();\n return /* @__PURE__ */ _jsx(Popover.Content, {\n ref,\n ...knobProps.elevatedSurface,\n ...knobProps.containerRadius,\n ...transitionProps(knobProps.motion.overlay),\n ...overlayEnterExit,\n ...overlayFrameFocus,\n onOpenAutoFocus: withHouseOpenFocus(onOpenAutoFocus, contentId),\n ...props,\n children: /* @__PURE__ */ _jsx(Surface, {\n painted: false,\n elevated: true,\n children: /* @__PURE__ */ _jsx(SheetBodyContext.Provider, {\n value: false,\n children\n })\n })\n });\n});\nexport {\n AlertDialogContent,\n AlertDialogOverlay,\n DialogContent,\n DialogOverlay,\n DialogRegionContext,\n DialogSheetFaceProvider,\n DialogShowFocus,\n PopoverContent,\n SheetBodyProvider,\n dialogScrim,\n overlayScrim,\n sheetGrabber,\n sheetGrabberClearance,\n sheetGrabberZone,\n sheetHandle,\n sheetHandleTone,\n sheetHandleWidthRatio,\n sheetHandleZone,\n sheetScrim,\n useDialogRegionContext,\n useDialogSheetFace,\n useIsInDialogRegion,\n useIsInSheetBody\n};\n//# sourceMappingURL=overlaySurfaces.js.map\n"],"mappings":";;;;;;;;;;;;;AAWA,IAAI,cAAc;AAClB,IAAI,aAAa;AACjB,IAAI,eAAe;AACnB,IAAI,eAAe;CACjB,OAAO;CACP,QAAQ;CACR,cAAc;C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KAAK;CAC3F,IAAI,EAAE,UAAU,GAAG,UAAU;CAC7B,IAAI,EAAE,cAAc,iBAAiB;CACrC,OAAuB,oBAAK,YAAY,SAAS;EAC/C;EACA,iBAAiB;EACjB,GAAG,gBAAgB,SAAS,UAAU,OAAO,OAAO,CAAC;EACrD,GAAG;EACH,GAAG;EACH;CACF,CAAC;AACH,CAAC;AACD,IAAI,iBAAiC,2BAAW,SAAS,gBAAgB,OAAO,KAAK;CACnF,IAAI,EAAE,UAAU,iBAAiB,GAAG,UAAU;CAC9C,IAAI,EAAE,cAAc,iBAAiB;EACnC,WAAW;EACX,SAAS;CACX,CAAC;CACD,IAAI,EAAE,cAAc,kBAAkB;CACtC,OAAuB,oBAAK,QAAQ,SAAS;EAC3C;EACA,GAAG,UAAU;EACb,GAAG,UAAU;EACb,GAAG,gBAAgB,UAAU,OAAO,OAAO;EAC3C,GAAG;EACH,GAAG;EACH,iBAAiB,mBAAmB,iBAAiB,SAAS;EAC9D,GAAG;EACH,UAA0B,oBAAK,SAAS;GACtC,SAAS;GACT,UAAU;GACV,UAA0B,oBAAK,iBAAiB,UAAU;IACxD,OAAO;IACP;GACF,CAAC;EACH,CAAC;CACH,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"overlaySurfaces.native.js","names":[],"sources":["esm/theme/overlaySurfaces.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { focusOnOpen, wasKeyboardFocus } from \"../keyboardFocusRing\";\nimport { scrimFor } from \"./motion\";\nimport { transitionProps } from \"./transitionProps\";\nimport { Surface } from \"./Surface\";\nimport { useResolvedKnobs } from \"./useResolvedKnobs\";\nimport { ALERT_READABLE_WIDTH } from \"./layoutTokens\";\nimport { panelPaddingPx } from \"./resolveKnobs\";\nimport { createContext, forwardRef, useContext, useEffect } from \"react\";\nimport { createChangeEventDetails } from \"@tamagui/web\";\nimport { AlertDialog, Dialog, isWeb, useDialogContext, useWindowDimensions, YStack } from \"tamagui\";\nvar dialogScrim = \"$scrim-dialog\";\nvar sheetScrim = \"$scrim-sheet\";\nvar overlayScrim = dialogScrim;\nvar sheetGrabber = {\n width: 36,\n height: 5,\n borderRadius: 100,\n backgroundColor: \"$color-12\",\n opacity: 0.3,\n alignSelf: \"center\",\n marginHorizontal: 0,\n marginTop: 5,\n marginBottom: -10,\n zIndex: 10\n};\nvar sheetGrabberClearance = 16;\nvar sheetGrabberZone = {\n alignSelf: \"stretch\",\n alignItems: \"center\",\n height: 21\n};\nvar sheetHandleWidthRatio = 0.3;\nvar sheetHandle = {\n width: \"30%\",\n height: 10,\n borderRadius: 100,\n backgroundColor: \"$color-5\",\n opacity: 1,\n alignSelf: \"center\",\n marginHorizontal: 0,\n marginTop: 0,\n marginBottom: 8,\n zIndex: 10\n};\nvar sheetHandleZone = {\n alignSelf: \"stretch\",\n alignItems: \"center\",\n paddingTop: 8\n};\nvar sheetHandleToneOpen = {\n backgroundColor: \"$color-5\",\n opacity: 1\n};\nfunction sheetHandleTone(_scheme) {\n return sheetHandleToneOpen;\n}\nvar overlayFrameFocus = {\n outlineWidth: {\n default: 0,\n focus: 0,\n \"focus-visible\": 0\n },\n outlineStyle: {\n default: \"none\",\n focus: \"none\",\n \"focus-visible\": \"none\"\n }\n};\nfunction isTabbableWithin(node, container) {\n if (node.tabIndex < 0 || node.hidden || node.tagName === \"A\") return false;\n if (node.disabled) return false;\n if (typeof HTMLInputElement !== \"undefined\" && node instanceof HTMLInputElement && node.type === \"hidden\") {\n return false;\n }\n if (getComputedStyle(node).visibility === \"hidden\") return false;\n for (var el = node; el && el !== container; el = el.parentElement) {\n if (getComputedStyle(el).display === \"none\") return false;\n }\n return true;\n}\nfunction focusFirstTabbableOnOpen(details, container) {\n if (typeof HTMLElement === \"undefined\" || !(container instanceof HTMLElement)) return;\n var first = Array.from(container.querySelectorAll(\"*\")).find(function(node) {\n return isTabbableWithin(node, container);\n });\n if (!first) return;\n details.cancel();\n var focused = focusOnOpen(first, container);\n if (typeof HTMLInputElement !== \"undefined\" && focused instanceof HTMLInputElement) {\n focused.select();\n }\n}\nfunction withHouseOpenFocus(onOpenAutoFocus, contentId) {\n return function(details) {\n onOpenAutoFocus === null || onOpenAutoFocus === void 0 ? void 0 : onOpenAutoFocus(details);\n if (!details.isCanceled) focusFirstTabbableOnOpen(details, contentById(contentId));\n };\n}\nfunction contentById(contentId) {\n if (!contentId || typeof document === \"undefined\") return null;\n return document.getElementById(contentId);\n}\nfunction useDialogShowFocus(onOpenAutoFocus) {\n var { open, contentId } = useDialogContext();\n useEffect(function() {\n if (!open || !contentId || !isWeb || typeof document === \"undefined\") return;\n var content = document.getElementById(contentId);\n var focused = document.activeElement;\n if (!content || typeof HTMLElement === \"undefined\" || !(focused instanceof HTMLElement)) return;\n if (!content.contains(focused) || focused.tabIndex >= 0 && wasKeyboardFocus()) return;\n onOpenAutoFocus(createChangeEventDetails(\"trigger-focus\"));\n }, [\n open,\n contentId\n ]);\n}\nfunction DialogShowFocus(param) {\n var { onOpenAutoFocus } = param;\n var { contentId } = useDialogContext();\n useDialogShowFocus(withHouseOpenFocus(onOpenAutoFocus, contentId));\n return null;\n}\nvar DialogRegionContext = /* @__PURE__ */ createContext({\n inDialogRegion: false\n});\nfunction useDialogRegionContext() {\n return useContext(DialogRegionContext);\n}\nfunction useIsInDialogRegion() {\n return useDialogRegionContext().inDialogRegion;\n}\nvar IN_DIALOG_REGION = {\n inDialogRegion: true\n};\nvar SheetBodyContext = /* @__PURE__ */ createContext(false);\nvar SheetBodyProvider = SheetBodyContext.Provider;\nfunction useIsInSheetBody() {\n return useContext(SheetBodyContext);\n}\nvar DialogSheetFaceContext = /* @__PURE__ */ createContext(false);\nvar DialogSheetFaceProvider = DialogSheetFaceContext.Provider;\nfunction useDialogSheetFace() {\n return useContext(DialogSheetFaceContext);\n}\nvar DialogSheetBody = /* @__PURE__ */ forwardRef(function DialogSheetBody2(param, ref) {\n var { children } = param;\n var { knobProps } = useResolvedKnobs({\n component: \"DialogContent\"\n });\n return /* @__PURE__ */ _jsx(YStack, {\n ref,\n ...knobProps.gap,\n ...{\n \"data-mp-dialog-face\": \"sheet\"\n },\n children: /* @__PURE__ */ _jsx(DialogSheetFaceContext.Provider, {\n value: false,\n children: /* @__PURE__ */ _jsx(DialogRegionContext.Provider, {\n value: IN_DIALOG_REGION,\n children\n })\n })\n });\n});\nvar overlayEnterExit = {\n opacity: {\n enter: 0,\n exit: 0\n },\n y: {\n enter: -4,\n exit: -4\n },\n scale: {\n enter: 0.97,\n exit: 0.97\n }\n};\nvar DialogContent = /* @__PURE__ */ forwardRef(function DialogContent2(param, ref) {\n var { children, size = \"4\", ...props } = param;\n if (useDialogSheetFace()) return /* @__PURE__ */ _jsx(DialogSheetBody, {\n ref,\n children\n });\n return /* @__PURE__ */ _jsx(Surface, {\n size,\n painted: false,\n elevated: true,\n children: /* @__PURE__ */ _jsx(DialogContentInner, {\n ref,\n ...props,\n children\n })\n });\n});\nfunction useWindowFit(props, fallbackMaxWidth) {\n var _ref, _props_maxWidth;\n var { width: windowWidth } = useWindowDimensions();\n var room = windowWidth > 0 ? Math.max(0, windowWidth - 2 * panelPaddingPx()) : void 0;\n var fit = function fit2(value) {\n return room != null && typeof value === \"number\" ? Math.min(value, room) : value;\n };\n if (room == null) return fallbackMaxWidth == null ? void 0 : {\n maxWidth: fallbackMaxWidth\n };\n return {\n maxWidth: fit((_ref = (_props_maxWidth = props.maxWidth) !== null && _props_maxWidth !== void 0 ? _props_maxWidth : fallbackMaxWidth) !== null && _ref !== void 0 ? _ref : room),\n ...props.minWidth != null ? {\n minWidth: fit(props.minWidth)\n } : void 0,\n ...props.width != null ? {\n width: fit(props.width)\n } : void 0\n };\n}\nvar DialogContentInner = /* @__PURE__ */ forwardRef(function DialogContentInner2(param, ref) {\n var { children, onOpenAutoFocus, ...props } = param;\n var { knobProps } = useResolvedKnobs({\n component: \"DialogContent\"\n });\n var { contentId } = useDialogContext();\n var openFocus = withHouseOpenFocus(onOpenAutoFocus, contentId);\n useDialogShowFocus(openFocus);\n var windowFit = useWindowFit(props);\n return /* @__PURE__ */ _jsx(Dialog.Content, {\n ref,\n position: \"relative\",\n pointerEvents: \"auto\",\n ...knobProps.elevatedSurface,\n ...knobProps.containerRadius,\n ...knobProps.panelPadding,\n ...knobProps.gap,\n elevate: false,\n ...transitionProps(knobProps.motion.overlay),\n ...overlayEnterExit,\n ...overlayFrameFocus,\n onOpenAutoFocus: openFocus,\n ...props,\n ...windowFit,\n children: /* @__PURE__ */ _jsx(DialogRegionContext.Provider, {\n value: IN_DIALOG_REGION,\n children: /* @__PURE__ */ _jsx(SheetBodyContext.Provider, {\n value: false,\n children\n })\n })\n });\n});\nvar scrimFade = {\n opacity: {\n enter: 0,\n exit: 0\n }\n};\nvar DialogOverlay = /* @__PURE__ */ forwardRef(function DialogOverlay2(param, ref) {\n var { children, ...props } = param;\n var { knobProps } = useResolvedKnobs();\n var sheetFace = useDialogSheetFace();\n if (sheetFace) return null;\n return /* @__PURE__ */ _jsx(Dialog.Overlay, {\n ref,\n backgroundColor: dialogScrim,\n ...transitionProps(scrimFor(knobProps.motion.overlay)),\n ...scrimFade,\n ...props,\n children\n });\n});\nvar AlertDialogContent = /* @__PURE__ */ forwardRef(function AlertDialogContent2(param, ref) {\n var { children, size = \"4\", ...props } = param;\n return /* @__PURE__ */ _jsx(Surface, {\n size,\n painted: false,\n elevated: true,\n children: /* @__PURE__ */ _jsx(AlertDialogContentInner, {\n ref,\n ...props,\n children\n })\n });\n});\nvar AlertDialogContentInner = /* @__PURE__ */ forwardRef(function AlertDialogContentInner2(param, ref) {\n var { children, ...props } = param;\n var { knobProps } = useResolvedKnobs({\n component: \"AlertDialogContent\"\n });\n var { contentId } = useDialogContext();\n useDialogShowFocus(withHouseOpenFocus(props.onOpenAutoFocus, contentId));\n var windowFit = useWindowFit(props, ALERT_READABLE_WIDTH);\n return /* @__PURE__ */ _jsx(AlertDialog.Content, {\n ref,\n ...knobProps.elevatedSurface,\n ...knobProps.containerRadius,\n ...knobProps.panelPadding,\n ...knobProps.gap,\n elevate: false,\n ...transitionProps(knobProps.motion.overlay),\n ...overlayEnterExit,\n ...overlayFrameFocus,\n ...props,\n ...windowFit,\n children: /* @__PURE__ */ _jsx(DialogRegionContext.Provider, {\n value: IN_DIALOG_REGION,\n children: /* @__PURE__ */ _jsx(SheetBodyContext.Provider, {\n value: false,\n children\n })\n })\n });\n});\nvar AlertDialogOverlay = /* @__PURE__ */ forwardRef(function AlertDialogOverlay2(param, ref) {\n var { children, ...props } = param;\n var { knobProps } = useResolvedKnobs();\n return /* @__PURE__ */ _jsx(AlertDialog.Overlay, {\n ref,\n backgroundColor: dialogScrim,\n ...transitionProps(scrimFor(knobProps.motion.overlay)),\n ...scrimFade,\n ...props,\n children\n });\n});\nvar PopoverContent = /* @__PURE__ */ forwardRef(function PopoverContent2(param, ref) {\n var { children, onOpenAutoFocus: _onOpenAutoFocus, ...props } = param;\n var { knobProps } = useResolvedKnobs({\n component: \"PopoverContent\",\n painted: false\n });\n return /* @__PURE__ */ _jsx(YStack, {\n ref,\n ...knobProps.elevatedSurface,\n ...knobProps.containerRadius,\n ...transitionProps(knobProps.motion.overlay),\n ...overlayEnterExit,\n ...overlayFrameFocus,\n ...props,\n children: /* @__PURE__ */ _jsx(Surface, {\n painted: false,\n elevated: true,\n children: /* @__PURE__ */ _jsx(SheetBodyContext.Provider, {\n value: false,\n children\n })\n })\n });\n});\nexport {\n AlertDialogContent,\n AlertDialogOverlay,\n DialogContent,\n DialogOverlay,\n DialogRegionContext,\n DialogSheetFaceProvider,\n DialogShowFocus,\n PopoverContent,\n SheetBodyProvider,\n dialogScrim,\n overlayScrim,\n sheetGrabber,\n sheetGrabberClearance,\n sheetGrabberZone,\n sheetHandle,\n sheetHandleTone,\n sheetHandleWidthRatio,\n sheetHandleZone,\n sheetScrim,\n useDialogRegionContext,\n useDialogSheetFace,\n useIsInDialogRegion,\n useIsInSheetBody\n};\n//# sourceMappingURL=overlaySurfaces.js.map\n"],"mappings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AK,iBAAiB,UAAU;IACxD,OAAO;IACP;GACF,CAAC;EACH,CAAC;CACH,CAAC;AACH,CAAC;AACD,IAAI,qBAAqC,2BAAW,SAAS,oBAAoB,OAAO,KAAK;CAC3F,IAAI,EAAE,UAAU,GAAG,UAAU;CAC7B,IAAI,EAAE,cAAc,iBAAiB;CACrC,OAAuB,oBAAK,YAAY,SAAS;EAC/C;EACA,iBAAiB;EACjB,GAAG,gBAAgB,SAAS,UAAU,OAAO,OAAO,CAAC;EACrD,GAAG;EACH,GAAG;EACH;CACF,CAAC;AACH,CAAC;AACD,IAAI,iBAAiC,2BAAW,SAAS,gBAAgB,OAAO,KAAK;CACnF,IAAI,EAAE,UAAU,iBAAiB,kBAAkB,GAAG,UAAU;CAChE,IAAI,EAAE,cAAc,iBAAiB;EACnC,WAAW;EACX,SAAS;CACX,CAAC;CACD,OAAuB,oBAAK,QAAQ;EAClC;EACA,GAAG,UAAU;EACb,GAAG,UAAU;EACb,GAAG,gBAAgB,UAAU,OAAO,OAAO;EAC3C,GAAG;EACH,GAAG;EACH,GAAG;EACH,UAA0B,oBAAK,SAAS;GACtC,SAAS;GACT,UAAU;GACV,UAA0B,oBAAK,iBAAiB,UAAU;IACxD,OAAO;IACP;GACF,CAAC;EACH,CAAC;CACH,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/theme",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.27.0",
|
|
4
4
|
"description": "Tamagui theme system for multiplatform.one",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"multiplatform",
|
|
@@ -163,8 +163,8 @@
|
|
|
163
163
|
"access": "public"
|
|
164
164
|
},
|
|
165
165
|
"dependencies": {
|
|
166
|
-
"@multiplatform.one/platform": "^10.
|
|
167
|
-
"@multiplatform.one/store": "^10.
|
|
166
|
+
"@multiplatform.one/platform": "^10.27.0",
|
|
167
|
+
"@multiplatform.one/store": "^10.27.0",
|
|
168
168
|
"@tamagui/animations-react-native": "3.2.3",
|
|
169
169
|
"@tamagui/colors": "3.2.3",
|
|
170
170
|
"@tamagui/config": "3.2.3",
|
|
@@ -178,8 +178,8 @@
|
|
|
178
178
|
},
|
|
179
179
|
"devDependencies": {
|
|
180
180
|
"@expo/prebuild-config": "58.0.19",
|
|
181
|
-
"@multiplatform.one/config": "10.
|
|
182
|
-
"@multiplatform.one/test-utils": "10.
|
|
181
|
+
"@multiplatform.one/config": "10.27.0",
|
|
182
|
+
"@multiplatform.one/test-utils": "10.27.0",
|
|
183
183
|
"@tamagui/animations-css": "3.2.3",
|
|
184
184
|
"@tamagui/animations-reanimated": "3.2.3",
|
|
185
185
|
"@tamagui/build": "3.2.3",
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as Colors from "@tamagui/colors";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { contrastRatio, normalizeToHex, relativeLuminance } from "./colorRules";
|
|
4
|
+
import { createDefaultThemeConfig } from "./createDefaultThemeConfig";
|
|
5
|
+
import { resolveAllThemes } from "./dedupeInherited";
|
|
6
|
+
import { apcaContrast } from "./fillContrast";
|
|
7
|
+
|
|
8
|
+
function color(value: unknown): string {
|
|
9
|
+
return String(
|
|
10
|
+
typeof value === "object" && value !== null ? (value as { val: unknown }).val : value,
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
describe("LC-172 consumer accent state fills", () => {
|
|
15
|
+
const palettes = [
|
|
16
|
+
...(["blue", "purple", "pink"] as const).map((hue) => ({
|
|
17
|
+
name: hue,
|
|
18
|
+
lightPalette: Object.values(Colors[hue]),
|
|
19
|
+
darkPalette: Object.values(Colors[`${hue}Dark`]),
|
|
20
|
+
})),
|
|
21
|
+
{
|
|
22
|
+
name: "SHC console",
|
|
23
|
+
lightPalette: [57, 54, 51, 48, 46, 44, 42, 40, 38, 36, 95, 98].map(
|
|
24
|
+
(lightness) => `hsla(250, 50%, ${lightness}%, 1)`,
|
|
25
|
+
),
|
|
26
|
+
darkPalette: [35, 38, 41, 43, 46, 49, 52, 54, 57, 60, 86, 95].map(
|
|
27
|
+
(lightness, index) => `hsla(250, ${index === 10 ? 80 : 50}%, ${lightness}%, 1)`,
|
|
28
|
+
),
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
for (const { name, lightPalette, darkPalette } of palettes) {
|
|
32
|
+
const resolved = resolveAllThemes(
|
|
33
|
+
createDefaultThemeConfig({
|
|
34
|
+
accent: {
|
|
35
|
+
lightPalette,
|
|
36
|
+
darkPalette,
|
|
37
|
+
},
|
|
38
|
+
}).tamagui.themes as unknown as Record<string, Record<string, unknown>>,
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
for (const scheme of ["light", "dark"] as const) {
|
|
42
|
+
for (const component of ["", "_Button"] as const) {
|
|
43
|
+
for (const state of ["hover", "press", "focus"] as const) {
|
|
44
|
+
it(`${name} ${scheme}_accent${component} ${state} holds its label`, () => {
|
|
45
|
+
const theme = resolved[`${scheme}_accent${component}`];
|
|
46
|
+
const fill = color(theme[`background-${state}`]);
|
|
47
|
+
const label = color(theme[`color-${state}`] ?? theme.color);
|
|
48
|
+
expect(
|
|
49
|
+
contrastRatio(
|
|
50
|
+
relativeLuminance(normalizeToHex(label)!),
|
|
51
|
+
relativeLuminance(normalizeToHex(fill)!),
|
|
52
|
+
),
|
|
53
|
+
`${label} on ${fill}`,
|
|
54
|
+
).toBeGreaterThanOrEqual(4.5);
|
|
55
|
+
expect(
|
|
56
|
+
Math.abs(apcaContrast(label, fill)),
|
|
57
|
+
`${label} on ${fill}`,
|
|
58
|
+
).toBeGreaterThanOrEqual(60);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
@@ -1135,6 +1135,41 @@ function holdStateFill(ramp: string[], fill: string, label: string, paper: numbe
|
|
|
1135
1135
|
);
|
|
1136
1136
|
}
|
|
1137
1137
|
|
|
1138
|
+
function holdConsumerAccentStates(themes: Record<string, Record<string, string>>) {
|
|
1139
|
+
const out = { ...themes };
|
|
1140
|
+
for (const scheme of ["light", "dark"] as const) {
|
|
1141
|
+
const base = themes[scheme];
|
|
1142
|
+
if (!base) continue;
|
|
1143
|
+
const ramp = Array.from({ length: 12 }, (_, index) => base[`accent-${index + 1}`]);
|
|
1144
|
+
const paper = luminanceOf(base["color-1"]);
|
|
1145
|
+
if (!isFullRamp(ramp) || isAchromaticRamp(ramp) || paper === null) continue;
|
|
1146
|
+
const scopeName = `${scheme}_accent`;
|
|
1147
|
+
const scope = themes[scopeName];
|
|
1148
|
+
if (!scope) continue;
|
|
1149
|
+
for (const [name, theme] of Object.entries(themes)) {
|
|
1150
|
+
if (name !== scopeName && !name.startsWith(`${scopeName}_`)) continue;
|
|
1151
|
+
const held = { ...theme };
|
|
1152
|
+
for (const state of ["hover", "press", "focus"] as const) {
|
|
1153
|
+
const fillKey = `background-${state}`;
|
|
1154
|
+
const inkKey = `color-${state}`;
|
|
1155
|
+
const fill = theme[fillKey] ?? scope[fillKey] ?? theme.background ?? scope.background;
|
|
1156
|
+
const label = theme[inkKey] ?? scope[inkKey] ?? theme.color ?? scope.color;
|
|
1157
|
+
if (labelHolds(label, fill)) continue;
|
|
1158
|
+
const pair =
|
|
1159
|
+
holdFillLabel(fill, ramp, [label], paper) ??
|
|
1160
|
+
holdFillLabel(fill, ramp, [scope.color, base["color-1"], base["color-12"]], paper);
|
|
1161
|
+
if (!pair) continue;
|
|
1162
|
+
held[fillKey] = pair.fill;
|
|
1163
|
+
held[inkKey] = pair.label;
|
|
1164
|
+
if ((theme[`border-color-${state}`] ?? scope[`border-color-${state}`]) === fill)
|
|
1165
|
+
held[`border-color-${state}`] = pair.fill;
|
|
1166
|
+
}
|
|
1167
|
+
out[name] = held;
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
return out;
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1138
1173
|
/**
|
|
1139
1174
|
* LC-172 FILL-CONTRAST. The step of a hue's ramp its accent solid fills with,
|
|
1140
1175
|
* and the label on it: the step nearest in luminance to `preferred` where a
|
|
@@ -1890,10 +1925,12 @@ export function createThemesBuilder(
|
|
|
1890
1925
|
return Object.fromEntries(Object.entries(raw).map(([name, theme]) => [name, { ...theme }]));
|
|
1891
1926
|
};
|
|
1892
1927
|
|
|
1893
|
-
const initialTheme =
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1928
|
+
const initialTheme = holdConsumerAccentStates(
|
|
1929
|
+
buildRawThemes({
|
|
1930
|
+
dark: accentTheme.darkPalette,
|
|
1931
|
+
light: accentTheme.lightPalette,
|
|
1932
|
+
}),
|
|
1933
|
+
);
|
|
1897
1934
|
const scrimAlphas = {
|
|
1898
1935
|
light: baseTheme.lightScrims ?? (defaultBaseTheme.lightScrims as ScrimAlphas),
|
|
1899
1936
|
dark: baseTheme.darkScrims ?? (defaultBaseTheme.darkScrims as ScrimAlphas),
|
|
@@ -22,9 +22,8 @@ vi.mock("tamagui", async () => {
|
|
|
22
22
|
isWeb: true,
|
|
23
23
|
Dialog: { Content: part("Dialog.Content"), Overlay: part("Dialog.Overlay") },
|
|
24
24
|
AlertDialog: { Content: part("AlertDialog.Content"), Overlay: part("AlertDialog.Overlay") },
|
|
25
|
-
|
|
25
|
+
YStack: part("YStack"),
|
|
26
26
|
useDialogContext: () => seen.dialog,
|
|
27
|
-
usePopoverContext: () => seen.popover,
|
|
28
27
|
useWindowDimensions: () => ({ width: seen.width, height: 800 }),
|
|
29
28
|
};
|
|
30
29
|
});
|
|
@@ -52,7 +51,6 @@ const {
|
|
|
52
51
|
DialogContent,
|
|
53
52
|
DialogOverlay,
|
|
54
53
|
DialogShowFocus,
|
|
55
|
-
PopoverContent,
|
|
56
54
|
dialogScrim,
|
|
57
55
|
useIsInDialogRegion,
|
|
58
56
|
} = await import("./overlaySurfaces");
|
|
@@ -69,8 +67,9 @@ function el<K extends keyof HTMLElementTagNameMap>(tag: K, attrs: Record<string,
|
|
|
69
67
|
type OpenFocusDetails = TamaguiChangeEventDetails<"trigger-focus", Event>;
|
|
70
68
|
|
|
71
69
|
function openFocus(onOpenAutoFocus?: (details: OpenFocusDetails) => void) {
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
seen.dialog.contentId = seen.popover.contentId;
|
|
71
|
+
render(<DialogContent onOpenAutoFocus={onOpenAutoFocus}>body</DialogContent>);
|
|
72
|
+
return seen.props["Dialog.Content"].onOpenAutoFocus as (details: OpenFocusDetails) => void;
|
|
74
73
|
}
|
|
75
74
|
|
|
76
75
|
function fire(handler: (details: OpenFocusDetails) => void) {
|
|
@@ -12,9 +12,7 @@ import {
|
|
|
12
12
|
AlertDialog,
|
|
13
13
|
Dialog,
|
|
14
14
|
isWeb,
|
|
15
|
-
Popover,
|
|
16
15
|
useDialogContext,
|
|
17
|
-
usePopoverContext,
|
|
18
16
|
useWindowDimensions,
|
|
19
17
|
YStack,
|
|
20
18
|
type DialogContentProps as TamaguiDialogContentProps,
|
|
@@ -468,39 +466,37 @@ export const AlertDialogOverlay = forwardRef<
|
|
|
468
466
|
});
|
|
469
467
|
|
|
470
468
|
// ── PopoverContent ───────────────────────────────────────────────────────
|
|
471
|
-
//
|
|
472
|
-
//
|
|
473
|
-
//
|
|
474
|
-
//
|
|
475
|
-
//
|
|
476
|
-
//
|
|
477
|
-
// outer border.
|
|
469
|
+
// FloatingPanel owns anchored placement and viewport collisions.
|
|
470
|
+
// This passive frame applies the elevatedSurface recipe, with its
|
|
471
|
+
// border and elevation, followed by the containerRadius cap.
|
|
472
|
+
// It needs no overlay context when rendered on its own.
|
|
473
|
+
// Popover also accepts it as a content marker; FloatingPanel then
|
|
474
|
+
// paints the overlay's single surface around the marker's children.
|
|
475
|
+
// Children must not draw their own outer border.
|
|
478
476
|
|
|
479
477
|
type PopoverContentProps = ViewProps & {
|
|
480
478
|
children?: ReactNode;
|
|
481
|
-
/**
|
|
479
|
+
/** Within Popover, runs first; `cancel()` skips the panel's initial focus. */
|
|
482
480
|
onOpenAutoFocus?: OpenAutoFocus;
|
|
483
481
|
};
|
|
484
482
|
|
|
485
483
|
export const PopoverContent = forwardRef<TamaguiElement, PopoverContentProps>(
|
|
486
|
-
function PopoverContent({ children, onOpenAutoFocus, ...props }, ref) {
|
|
484
|
+
function PopoverContent({ children, onOpenAutoFocus: _onOpenAutoFocus, ...props }, ref) {
|
|
487
485
|
const { knobProps } = useResolvedKnobs({ component: "PopoverContent", painted: false });
|
|
488
|
-
const { contentId } = usePopoverContext();
|
|
489
486
|
return (
|
|
490
|
-
<
|
|
487
|
+
<YStack
|
|
491
488
|
ref={ref}
|
|
492
489
|
{...knobProps.elevatedSurface}
|
|
493
490
|
{...knobProps.containerRadius}
|
|
494
491
|
{...transitionProps(knobProps.motion.overlay)}
|
|
495
492
|
{...overlayEnterExit}
|
|
496
493
|
{...overlayFrameFocus}
|
|
497
|
-
onOpenAutoFocus={withHouseOpenFocus(onOpenAutoFocus, contentId)}
|
|
498
494
|
{...props}
|
|
499
495
|
>
|
|
500
496
|
<Surface painted={false} elevated>
|
|
501
497
|
<SheetBodyContext.Provider value={false}>{children}</SheetBodyContext.Provider>
|
|
502
498
|
</Surface>
|
|
503
|
-
</
|
|
499
|
+
</YStack>
|
|
504
500
|
);
|
|
505
501
|
},
|
|
506
502
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createThemes.d.ts","sourceRoot":"","sources":["../../src/theme/createThemes.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAY7C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc;IACzB,wFAAwF;;IAExF,oEAAoE;;CAE5D,CAAC;AAqJX,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,0BAA0B;IACzC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,KAAK,CAAC;IAChE,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5D,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;CACzF;AAy0CD;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,2aAsBpB,CAAC;AAEX,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAqJ1D,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,0BAA0B,EACrC,WAAW,EAAE,sBAAsB,EACnC,OAAO,CAAC,EAAE,0BAA0B,EACpC,SAAS,GAAE,SAAkB;;aA0LlB,CAAC,SAAS,MAAM,QAAQ,CAAC,SAAS,sBAAsB,GAiB1D,MAAM,CAAC,QAAQ,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;EAGpE"}
|
|
@@ -151,7 +151,7 @@ export declare const AlertDialogOverlay: import("react").ForwardRefExoticCompone
|
|
|
151
151
|
} & import("react").RefAttributes<TamaguiElement>>;
|
|
152
152
|
export declare const PopoverContent: import("react").ForwardRefExoticComponent<import("tamagui").StackNonStyleProps & import("@tamagui/web").WithThemeValues<Omit<import("@tamagui/web").StackStyleBase, never>> & import("@tamagui/web").WithFlatVariantValues<{}> & import("@tamagui/web").WithShorthands<import("@tamagui/web").WithThemeValues<import("@tamagui/web").StackStyleBase>> & {
|
|
153
153
|
children?: ReactNode;
|
|
154
|
-
/**
|
|
154
|
+
/** Within Popover, runs first; `cancel()` skips the panel's initial focus. */
|
|
155
155
|
onOpenAutoFocus?: OpenAutoFocus;
|
|
156
156
|
} & import("react").RefAttributes<TamaguiElement>>;
|
|
157
157
|
//# sourceMappingURL=overlaySurfaces.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlaySurfaces.d.ts","sourceRoot":"","sources":["../../src/theme/overlaySurfaces.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAA4B,KAAK,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACxF,OAAO,
|
|
1
|
+
{"version":3,"file":"overlaySurfaces.d.ts","sourceRoot":"","sources":["../../src/theme/overlaySurfaces.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAA4B,KAAK,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACxF,OAAO,EAOL,KAAK,kBAAkB,IAAI,yBAAyB,EAEpD,KAAK,UAAU,EACf,KAAK,cAAc,EAEpB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,WAAW,EAAG,eAAwB,CAAC;AAEpD,eAAO,MAAM,UAAU,EAAG,cAAuB,CAAC;AAElD,oGAAoG;AACpG,eAAO,MAAM,YAAY,iBAAc,CAAC;AAExC;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;CAWf,CAAC;AAEX,kEAAkE;AAClE,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC,oEAAoE;AACpE,eAAO,MAAM,gBAAgB;;;;CAInB,CAAC;AAEX,4FAA4F;AAC5F,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;C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