@ankhorage/surface 4.3.0 → 4.4.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/CHANGELOG.md +6 -0
- package/README.md +4 -4
- package/dist/components/tabs/Tabs.js +2 -2
- package/dist/components/tabs/Tabs.js.map +1 -1
- package/dist/components/tabs/context.js +1 -1
- package/dist/components/tabs/context.js.map +1 -1
- package/dist/context/FontContext.d.ts.map +1 -1
- package/dist/context/FontContext.js +3 -3
- package/dist/context/FontContext.js.map +1 -1
- package/dist/context/TranslationContext.d.ts.map +1 -1
- package/dist/context/TranslationContext.js +3 -4
- package/dist/context/TranslationContext.js.map +1 -1
- package/dist/core/responsive/ResponsiveProvider.d.ts.map +1 -1
- package/dist/core/responsive/ResponsiveProvider.js +3 -3
- package/dist/core/responsive/ResponsiveProvider.js.map +1 -1
- package/dist/examples/DocsExamples.js +1 -1
- package/dist/examples/DocsExamples.js.map +1 -1
- package/dist/features/accordion/adapters/inbound/Accordion.js +2 -2
- package/dist/features/accordion/adapters/inbound/Accordion.js.map +1 -1
- package/dist/features/accordion/adapters/inbound/AccordionContent.js +1 -1
- package/dist/features/accordion/adapters/inbound/AccordionContent.js.map +1 -1
- package/dist/features/accordion/adapters/inbound/AccordionItem.js +3 -3
- package/dist/features/accordion/adapters/inbound/AccordionItem.js.map +1 -1
- package/dist/features/accordion/adapters/inbound/AccordionTrigger.js +1 -1
- package/dist/features/accordion/adapters/inbound/AccordionTrigger.js.map +1 -1
- package/dist/features/bottom-sheet/BottomSheetProvider.js +2 -2
- package/dist/features/bottom-sheet/BottomSheetProvider.js.map +1 -1
- package/dist/features/bottom-sheet/useBottomSheet.js +1 -1
- package/dist/features/bottom-sheet/useBottomSheet.js.map +1 -1
- package/dist/features/popover/adapters/inbound/Popover.d.ts +5 -0
- package/dist/features/popover/adapters/inbound/Popover.d.ts.map +1 -0
- package/dist/features/popover/adapters/inbound/Popover.js +31 -0
- package/dist/features/popover/adapters/inbound/Popover.js.map +1 -0
- package/dist/features/popover/adapters/inbound/PopoverOverlay.d.ts +17 -0
- package/dist/features/popover/adapters/inbound/PopoverOverlay.d.ts.map +1 -0
- package/dist/features/popover/adapters/inbound/PopoverOverlay.js +34 -0
- package/dist/features/popover/adapters/inbound/PopoverOverlay.js.map +1 -0
- package/dist/features/popover/adapters/inbound/usePopoverLayout.d.ts +21 -0
- package/dist/features/popover/adapters/inbound/usePopoverLayout.d.ts.map +1 -0
- package/dist/features/popover/adapters/inbound/usePopoverLayout.js +33 -0
- package/dist/features/popover/adapters/inbound/usePopoverLayout.js.map +1 -0
- package/dist/features/popover/public.d.ts +3 -0
- package/dist/features/popover/public.d.ts.map +1 -0
- package/dist/features/popover/public.js +2 -0
- package/dist/features/popover/public.js.map +1 -0
- package/dist/features/popover/utils/resolvePopoverPosition.d.ts +25 -0
- package/dist/features/popover/utils/resolvePopoverPosition.d.ts.map +1 -0
- package/dist/features/popover/utils/resolvePopoverPosition.js +23 -0
- package/dist/features/popover/utils/resolvePopoverPosition.js.map +1 -0
- package/dist/{components/toast → features/toast/adapters/inbound}/Toast.d.ts +2 -1
- package/dist/features/toast/adapters/inbound/Toast.d.ts.map +1 -0
- package/dist/{components/toast → features/toast/adapters/inbound}/Toast.js +37 -32
- package/dist/features/toast/adapters/inbound/Toast.js.map +1 -0
- package/dist/features/toast/adapters/inbound/ToastProvider.d.ts +5 -0
- package/dist/features/toast/adapters/inbound/ToastProvider.d.ts.map +1 -0
- package/dist/features/toast/adapters/inbound/ToastProvider.js +29 -0
- package/dist/features/toast/adapters/inbound/ToastProvider.js.map +1 -0
- package/dist/features/toast/adapters/inbound/useToast.d.ts +4 -0
- package/dist/features/toast/adapters/inbound/useToast.d.ts.map +1 -0
- package/dist/features/toast/adapters/inbound/useToast.js +11 -0
- package/dist/features/toast/adapters/inbound/useToast.js.map +1 -0
- package/dist/features/toast/composition/ToastContext.d.ts +4 -0
- package/dist/features/toast/composition/ToastContext.d.ts.map +1 -0
- package/dist/features/toast/composition/ToastContext.js +4 -0
- package/dist/features/toast/composition/ToastContext.js.map +1 -0
- package/dist/features/toast/composition/useToastRuntime.d.ts +11 -0
- package/dist/features/toast/composition/useToastRuntime.d.ts.map +1 -0
- package/dist/features/toast/composition/useToastRuntime.js +50 -0
- package/dist/features/toast/composition/useToastRuntime.js.map +1 -0
- package/dist/features/toast/public.d.ts +5 -0
- package/dist/features/toast/public.d.ts.map +1 -0
- package/dist/features/toast/public.js +4 -0
- package/dist/features/toast/public.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/overlay/OverlayProvider.d.ts +1 -0
- package/dist/internal/overlay/OverlayProvider.d.ts.map +1 -1
- package/dist/internal/overlay/OverlayProvider.js +9 -7
- package/dist/internal/overlay/OverlayProvider.js.map +1 -1
- package/dist/internal/overlay/useOverlayStack.js +1 -1
- package/dist/internal/overlay/useOverlayStack.js.map +1 -1
- package/dist/internal/resolvers/resolveOverlayZIndex.d.ts +1 -1
- package/dist/internal/resolvers/resolveOverlayZIndex.d.ts.map +1 -1
- package/dist/internal/resolvers/resolveOverlayZIndex.js +1 -0
- package/dist/internal/resolvers/resolveOverlayZIndex.js.map +1 -1
- package/dist/layout/AppBar.js +1 -1
- package/dist/layout/AppBar.js.map +1 -1
- package/dist/theme/ThemeContext.d.ts.map +1 -1
- package/dist/theme/ThemeContext.js +4 -5
- package/dist/theme/ThemeContext.js.map +1 -1
- package/dist/types/popover.d.ts +21 -0
- package/dist/types/popover.d.ts.map +1 -0
- package/dist/types/popover.js +2 -0
- package/dist/types/popover.js.map +1 -0
- package/dist/{components/toast/types.d.ts → types/toast.d.ts} +11 -3
- package/dist/types/toast.d.ts.map +1 -0
- package/dist/types/toast.js +2 -0
- package/dist/types/toast.js.map +1 -0
- package/package.json +1 -1
- package/src/components/tabs/Tabs.tsx +2 -2
- package/src/components/tabs/context.tsx +1 -1
- package/src/context/FontContext.tsx +3 -3
- package/src/context/TranslationContext.tsx +3 -4
- package/src/core/responsive/ResponsiveProvider.tsx +3 -3
- package/src/examples/DocsExamples.tsx +1 -1
- package/src/features/accordion/adapters/inbound/Accordion.tsx +2 -2
- package/src/features/accordion/adapters/inbound/AccordionContent.tsx +1 -1
- package/src/features/accordion/adapters/inbound/AccordionItem.tsx +3 -3
- package/src/features/accordion/adapters/inbound/AccordionTrigger.tsx +1 -1
- package/src/features/bottom-sheet/BottomSheetProvider.tsx +2 -2
- package/src/features/bottom-sheet/useBottomSheet.ts +1 -1
- package/src/features/popover/adapters/inbound/Popover.tsx +49 -0
- package/src/features/popover/adapters/inbound/PopoverOverlay.tsx +72 -0
- package/src/features/popover/adapters/inbound/usePopoverLayout.ts +51 -0
- package/src/features/popover/public.ts +2 -0
- package/src/features/popover/utils/resolvePopoverPosition.test.ts +31 -0
- package/src/features/popover/utils/resolvePopoverPosition.ts +40 -0
- package/src/{components/toast → features/toast/adapters/inbound}/Toast.tsx +58 -54
- package/src/features/toast/adapters/inbound/ToastProvider.tsx +47 -0
- package/src/features/toast/adapters/inbound/useToast.test.tsx +18 -0
- package/src/features/toast/adapters/inbound/useToast.ts +15 -0
- package/src/features/toast/composition/ToastContext.ts +6 -0
- package/src/features/toast/composition/useToastRuntime.ts +76 -0
- package/src/features/toast/public.ts +10 -0
- package/src/index.test.ts +3 -1
- package/src/index.ts +14 -2
- package/src/internal/overlay/OverlayProvider.tsx +10 -8
- package/src/internal/overlay/useOverlayStack.ts +1 -1
- package/src/internal/resolvers/resolveOverlayZIndex.test.ts +2 -1
- package/src/internal/resolvers/resolveOverlayZIndex.ts +2 -1
- package/src/layout/AppBar.tsx +1 -1
- package/src/theme/ThemeContext.tsx +4 -5
- package/src/types/popover.ts +25 -0
- package/src/{components/toast/types.ts → types/toast.ts} +12 -2
- package/dist/components/toast/Toast.d.ts.map +0 -1
- package/dist/components/toast/Toast.js.map +0 -1
- package/dist/components/toast/ToastProvider.d.ts +0 -13
- package/dist/components/toast/ToastProvider.d.ts.map +0 -1
- package/dist/components/toast/ToastProvider.js +0 -70
- package/dist/components/toast/ToastProvider.js.map +0 -1
- package/dist/components/toast/index.d.ts +0 -4
- package/dist/components/toast/index.d.ts.map +0 -1
- package/dist/components/toast/index.js +0 -3
- package/dist/components/toast/index.js.map +0 -1
- package/dist/components/toast/types.d.ts.map +0 -1
- package/dist/components/toast/types.js +0 -2
- package/dist/components/toast/types.js.map +0 -1
- package/src/components/toast/ToastProvider.tsx +0 -115
- package/src/components/toast/index.ts +0 -3
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,QAAQ,EAAE,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,EAAE,MAAM,2BAA2B,CAAC;AAEpD,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAQpD,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEzE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAE7D,cAAc,UAAU,CAAC;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAOtD,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export type { FieldProps } from './components/field';\nexport { Field } from './components/field';\nexport type { HelperTextProps } from './components/helper-text';\nexport { HelperText } from './components/helper-text';\nexport type { LabelProps } from './components/label';\nexport { Label } from './components/label';\nexport type { ListItemProps } from './components/list-item';\nexport { ListItem } from './components/list-item';\nexport type { MenuAction, MenuActionIntent, MenuItem, MenuProps } from './components/menu';\nexport { Menu } from './components/menu';\nexport type { ModalProps } from './components/modal';\nexport { Modal } from './components/modal';\nexport type { SwitchProps } from './components/switch';\nexport { Switch } from './components/switch';\nexport type { TabListProps, TabPanelProps, TabProps, TabsProps } from './components/tabs';\nexport { Tab, TabList, TabPanel, Tabs } from './components/tabs';\nexport type { TextareaProps } from './components/textarea';\nexport { Textarea } from './components/textarea';\nexport type { TooltipProps } from './components/tooltip';\nexport { Tooltip } from './components/tooltip';\nexport type { FontRuntime } from './context/FontContext';\nexport { FontProvider, useFontContext } from './context/FontContext';\nexport type { I18nInstance, TranslationRuntime, Translator } from './context/TranslationContext';\nexport { TranslationProvider, useTranslationContext } from './context/TranslationContext';\nexport * from './core/responsive';\nexport type {\n AccordionContentProps,\n AccordionItemProps,\n AccordionMode,\n AccordionMultipleProps,\n AccordionProps,\n AccordionSingleProps,\n AccordionTriggerProps,\n} from './features/accordion/public';\nexport {\n Accordion,\n AccordionContent,\n AccordionItem,\n AccordionTrigger,\n} from './features/accordion/public';\nexport type { BadgeProps } from './features/badge/public';\nexport { Badge } from './features/badge/public';\nexport type { ButtonIconSpec, ButtonProps, IconButtonProps } from './features/button/public';\nexport { Button, IconButton } from './features/button/public';\nexport type { CardProps } from './features/card/public';\nexport { Card } from './features/card/public';\nexport type { CheckboxProps } from './features/form/checkbox/public';\nexport { Checkbox } from './features/form/checkbox/public';\nexport type { RadioProps } from './features/form/radio/public';\nexport { Radio } from './features/form/radio/public';\nexport type { TextInputProps } from './features/form/text-input/public';\nexport { TextInput } from './features/form/text-input/public';\nexport type {\n FontIconSource,\n IconProps,\n IconProvider,\n IconSource,\n IconVariant,\n SvgIconSource,\n} from './features/icon/public';\nexport { Icon, SUPPORTED_ICON_PROVIDERS } from './features/icon/public';\nexport type { ImageFit, ImageProps, SurfaceImageSource } from './features/image/public';\nexport { Image } from './features/image/public';\nexport type {\n KeyboardAvoidingViewBehavior,\n KeyboardAvoidingViewProps,\n} from './features/keyboard-avoiding-view/public';\nexport { KeyboardAvoidingView } from './features/keyboard-avoiding-view/public';\nexport type {\n BoxProps,\n ContainerProps,\n DividerProps,\n GridProps,\n StackProps,\n} from './features/layout/public';\nexport { Box, Container, Divider, Grid, Stack } from './features/layout/public';\nexport type {\n PopoverAnchorRenderProps,\n PopoverPlacement,\n PopoverProps,\n} from './features/popover/public';\nexport { Popover } from './features/popover/public';\nexport type { SurfaceProps, SurfaceVariant } from './features/surface/public';\nexport { Surface } from './features/surface/public';\nexport type {\n ToastController,\n ToastOptions,\n ToastProps,\n ToastProviderProps,\n ToastStatus,\n} from './features/toast/public';\nexport { Toast, ToastProvider, useToast } from './features/toast/public';\nexport type { HeadingLevel, HeadingProps, TextProps } from './features/typography/public';\nexport { Heading, Text } from './features/typography/public';\nexport type { InteractionPolicy, InteractionPolicyProps } from './interactionPolicy';\nexport * from './layout';\nexport type { ButtonBaseProps } from './primitives/button-base';\nexport { ButtonBase } from './primitives/button-base';\nexport type {\n SurfaceColor,\n SurfaceEmphasis,\n SurfacePaletteColor,\n SurfaceStatusColor,\n} from './surfaceColor';\nexport {\n SURFACE_COLORS,\n SURFACE_EMPHASES,\n SURFACE_PALETTE_COLORS,\n SURFACE_STATUS_COLORS,\n} from './surfaceColor';\nexport * from './theme';\nexport { isDeepEqual } from './utils/deepEqual';\nexport { deepMerge } from './utils/deepMerge';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayProvider.d.ts","sourceRoot":"","sources":["../../../src/internal/overlay/OverlayProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"OverlayProvider.d.ts","sourceRoot":"","sources":["../../../src/internal/overlay/OverlayProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAwB1B,gFAAgF;AAChF,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,qBAwD1E"}
|
|
@@ -12,9 +12,7 @@ const styles = StyleSheet.create({
|
|
|
12
12
|
top: 0,
|
|
13
13
|
},
|
|
14
14
|
});
|
|
15
|
-
|
|
16
|
-
return { zIndex };
|
|
17
|
-
}
|
|
15
|
+
/*** Installs the shared overlay stack used by portal-based Surface features. */
|
|
18
16
|
export function OverlayProvider({ children }) {
|
|
19
17
|
const orderRef = React.useRef(0);
|
|
20
18
|
const [overlays, setOverlays] = React.useState([]);
|
|
@@ -40,15 +38,19 @@ export function OverlayProvider({ children }) {
|
|
|
40
38
|
removeOverlay,
|
|
41
39
|
setOverlay,
|
|
42
40
|
}), [overlays, removeOverlay, setOverlay]);
|
|
43
|
-
return (<OverlayStackActionsContext
|
|
44
|
-
<OverlayStackContext
|
|
41
|
+
return (<OverlayStackActionsContext value={actions}>
|
|
42
|
+
<OverlayStackContext value={value}>
|
|
45
43
|
{children}
|
|
46
44
|
<View {...boxNonePointerEvents.props} style={[boxNonePointerEvents.style, styles.fill]}>
|
|
47
45
|
{overlays.map((overlay) => (<View {...boxNonePointerEvents.props} key={overlay.id} style={[boxNonePointerEvents.style, styles.fill, overlayZIndex(overlay.zIndex)]}>
|
|
48
46
|
{overlay.node}
|
|
49
47
|
</View>))}
|
|
50
48
|
</View>
|
|
51
|
-
</OverlayStackContext
|
|
52
|
-
</OverlayStackActionsContext
|
|
49
|
+
</OverlayStackContext>
|
|
50
|
+
</OverlayStackActionsContext>);
|
|
51
|
+
}
|
|
52
|
+
/*** Resolves a per-entry z-index style for the overlay host. */
|
|
53
|
+
function overlayZIndex(zIndex) {
|
|
54
|
+
return { zIndex };
|
|
53
55
|
}
|
|
54
56
|
//# sourceMappingURL=OverlayProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayProvider.js","sourceRoot":"","sources":["../../../src/internal/overlay/OverlayProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAkB,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EACL,kBAAkB,EAGlB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,oBAAoB,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC;AAC9D,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,MAAM,EAAE,CAAC;QACT,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,CAAC;QACR,GAAG,EAAE,CAAC;KACP;CACF,CAAC,CAAC;AAEH,
|
|
1
|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AAC,CAAC,CACrF;UAAA,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CACzB,CAAC,IAAI,CACH,IAAI,oBAAoB,CAAC,KAAK,CAAC,CAC/B,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAChB,KAAK,CAAC,CAAC,CAAC,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAEhF;cAAA,CAAC,OAAO,CAAC,IAAI,CACf;YAAA,EAAE,IAAI,CAAC,CACR,CAAC,CACJ;QAAA,EAAE,IAAI,CACR;MAAA,EAAE,mBAAmB,CACvB;IAAA,EAAE,0BAA0B,CAAC,CAC9B,CAAC;AACJ,CAAC;AAED,gEAAgE;AAChE,SAAS,aAAa,CAAC,MAAc;IACnC,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC","sourcesContent":["import React from 'react';\nimport { StyleSheet, View, type ViewStyle } from 'react-native';\n\nimport { resolvePointerEvents } from '../resolvePointerEvents';\nimport {\n createOverlayEntry,\n type OverlayDescriptor,\n type OverlayEntry,\n OverlayStackActionsContext,\n OverlayStackContext,\n sortOverlayEntries,\n} from './useOverlayStack';\n\nconst boxNonePointerEvents = resolvePointerEvents('box-none');\nconst styles = StyleSheet.create({\n fill: {\n bottom: 0,\n left: 0,\n position: 'absolute',\n right: 0,\n top: 0,\n },\n});\n\n/*** Installs the shared overlay stack used by portal-based Surface features. */\nexport function OverlayProvider({ children }: { children: React.ReactNode }) {\n const orderRef = React.useRef(0);\n const [overlays, setOverlays] = React.useState<OverlayEntry[]>([]);\n\n const setOverlay = React.useCallback((id: string, descriptor: OverlayDescriptor) => {\n setOverlays((current) => {\n const existing = current.find((entry) => entry.id === id);\n const nextEntry = createOverlayEntry(id, existing?.order ?? orderRef.current++, descriptor);\n\n if (!existing) {\n return sortOverlayEntries([...current, nextEntry]);\n }\n\n return sortOverlayEntries(current.map((entry) => (entry.id === id ? nextEntry : entry)));\n });\n }, []);\n\n const removeOverlay = React.useCallback((id: string) => {\n setOverlays((current) => current.filter((entry) => entry.id !== id));\n }, []);\n\n const actions = React.useMemo(\n () => ({\n removeOverlay,\n setOverlay,\n }),\n [removeOverlay, setOverlay],\n );\n\n const value = React.useMemo(\n () => ({\n overlays,\n removeOverlay,\n setOverlay,\n }),\n [overlays, removeOverlay, setOverlay],\n );\n\n return (\n <OverlayStackActionsContext value={actions}>\n <OverlayStackContext value={value}>\n {children}\n <View {...boxNonePointerEvents.props} style={[boxNonePointerEvents.style, styles.fill]}>\n {overlays.map((overlay) => (\n <View\n {...boxNonePointerEvents.props}\n key={overlay.id}\n style={[boxNonePointerEvents.style, styles.fill, overlayZIndex(overlay.zIndex)]}\n >\n {overlay.node}\n </View>\n ))}\n </View>\n </OverlayStackContext>\n </OverlayStackActionsContext>\n );\n}\n\n/*** Resolves a per-entry z-index style for the overlay host. */\nfunction overlayZIndex(zIndex: number): ViewStyle {\n return { zIndex };\n}\n"]}
|
|
@@ -17,7 +17,7 @@ export function sortOverlayEntries(entries) {
|
|
|
17
17
|
export const OverlayStackContext = React.createContext(null);
|
|
18
18
|
export const OverlayStackActionsContext = React.createContext(null);
|
|
19
19
|
export function useOverlayStackActions() {
|
|
20
|
-
return React.
|
|
20
|
+
return React.use(OverlayStackActionsContext);
|
|
21
21
|
}
|
|
22
22
|
export function createOverlayEntry(id, order, descriptor) {
|
|
23
23
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOverlayStack.js","sourceRoot":"","sources":["../../../src/internal/overlay/useOverlayStack.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAqB,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAwB5F,MAAM,UAAU,kBAAkB,CAAC,OAAuB;IACxD,MAAM,cAAc,GAA0C,EAAE,CAAC;IACjE,MAAM,iBAAiB,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AClD,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\n\nimport { type OverlayLayer, resolveOverlayZIndex } from '../resolvers/resolveOverlayZIndex';\n\nexport interface OverlayEntry {\n id: string;\n layer: OverlayLayer;\n node: React.ReactNode;\n order: number;\n zIndex: number;\n}\n\nexport interface OverlayDescriptor {\n layer: OverlayLayer;\n node: React.ReactNode;\n}\n\nexport interface OverlayStackActions {\n setOverlay: (id: string, overlay: OverlayDescriptor) => void;\n removeOverlay: (id: string) => void;\n}\n\nexport interface OverlayStackRuntime extends OverlayStackActions {\n overlays: OverlayEntry[];\n}\n\nexport function sortOverlayEntries(entries: OverlayEntry[]): OverlayEntry[] {\n const perLayerCounts: Partial<Record<OverlayLayer, number>> = {};\n const normalizedEntries = [...entries]\n .sort((left, right) => left.order - right.order)\n .map((entry) => {\n const stackIndex = perLayerCounts[entry.layer] ?? 0;\n perLayerCounts[entry.layer] = stackIndex + 1;\n\n return {\n ...entry,\n zIndex: resolveOverlayZIndex(entry.layer, stackIndex),\n };\n });\n\n return normalizedEntries.sort((left, right) =>\n left.zIndex === right.zIndex ? left.order - right.order : left.zIndex - right.zIndex,\n );\n}\n\nexport const OverlayStackContext = React.createContext<OverlayStackRuntime | null>(null);\n\nexport const OverlayStackActionsContext = React.createContext<OverlayStackActions | null>(null);\n\nexport function useOverlayStackActions(): OverlayStackActions | null {\n return React.use(OverlayStackActionsContext);\n}\n\nexport function createOverlayEntry(\n id: string,\n order: number,\n descriptor: OverlayDescriptor,\n): OverlayEntry {\n return {\n id,\n layer: descriptor.layer,\n node: descriptor.node,\n order,\n zIndex: resolveOverlayZIndex(descriptor.layer, 0),\n };\n}\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type OverlayLayer = 'modal' | 'drawer' | 'menu' | 'tooltip' | 'toast';
|
|
1
|
+
export type OverlayLayer = 'modal' | 'drawer' | 'menu' | 'popover' | 'tooltip' | 'toast';
|
|
2
2
|
export declare function resolveOverlayZIndex(layer: OverlayLayer, stackIndex?: number): number;
|
|
3
3
|
//# sourceMappingURL=resolveOverlayZIndex.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveOverlayZIndex.d.ts","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveOverlayZIndex.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"resolveOverlayZIndex.d.ts","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveOverlayZIndex.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAWzF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,YAAY,EAAE,UAAU,SAAI,GAAG,MAAM,CAEhF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveOverlayZIndex.js","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveOverlayZIndex.ts"],"names":[],"mappings":"AAEA,MAAM,YAAY,GAAiC;IACjD,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,IAAI;IACV,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,IAAI;CACZ,CAAC;AAEF,MAAM,UAAU,oBAAoB,CAAC,KAAmB,EAAE,UAAU,GAAG,CAAC;IACtE,OAAO,YAAY,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC;AAC1C,CAAC","sourcesContent":["export type OverlayLayer = 'modal' | 'drawer' | 'menu' | 'tooltip' | 'toast';\n\nconst BASE_Z_INDEX: Record<OverlayLayer, number> = {\n modal: 1000,\n drawer: 1100,\n menu: 1200,\n tooltip: 1300,\n toast: 1400,\n};\n\nexport function resolveOverlayZIndex(layer: OverlayLayer, stackIndex = 0): number {\n return BASE_Z_INDEX[layer] + stackIndex;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"resolveOverlayZIndex.js","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveOverlayZIndex.ts"],"names":[],"mappings":"AAEA,MAAM,YAAY,GAAiC;IACjD,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,IAAI;IACV,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,IAAI;CACZ,CAAC;AAEF,MAAM,UAAU,oBAAoB,CAAC,KAAmB,EAAE,UAAU,GAAG,CAAC;IACtE,OAAO,YAAY,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC;AAC1C,CAAC","sourcesContent":["export type OverlayLayer = 'modal' | 'drawer' | 'menu' | 'popover' | 'tooltip' | 'toast';\n\nconst BASE_Z_INDEX: Record<OverlayLayer, number> = {\n modal: 1000,\n drawer: 1100,\n menu: 1200,\n popover: 1250,\n tooltip: 1300,\n toast: 1400,\n};\n\nexport function resolveOverlayZIndex(layer: OverlayLayer, stackIndex = 0): number {\n return BASE_Z_INDEX[layer] + stackIndex;\n}\n"]}
|
package/dist/layout/AppBar.js
CHANGED
|
@@ -5,7 +5,7 @@ import { Box, Divider } from '../features/layout/public';
|
|
|
5
5
|
import { useTheme } from '../theme/ThemeContext';
|
|
6
6
|
export function AppBar({ leading, trailing, children, safeAreaTop = true, divider = false, contentStyle, bg, style, ...props }) {
|
|
7
7
|
const { theme } = useTheme();
|
|
8
|
-
const insets = React.
|
|
8
|
+
const insets = React.use(SafeAreaInsetsContext);
|
|
9
9
|
const topInset = safeAreaTop ? (insets?.top ?? 0) : 0;
|
|
10
10
|
const safeAreaStyle = topInset === 0 ? undefined : { paddingTop: topInset };
|
|
11
11
|
return (<Box {...props} bg={bg ?? theme.semantics.surface.default} style={style}>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppBar.js","sourceRoot":"","sources":["../../src/layout/AppBar.tsx"],"names":[],"mapp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,IAAI,CACV;QAAA,EAAE,IAAI,CACN;QAAA,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAG,CAAC,CAAC,CAAC,IAAI,CACrF;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport { type StyleProp, View, type ViewStyle } from 'react-native';\nimport { SafeAreaInsetsContext } from 'react-native-safe-area-context';\n\nimport { Box, type BoxProps, Divider } from '../features/layout/public';\nimport { useTheme } from '../theme/ThemeContext';\n\nexport interface AppBarProps extends Omit<BoxProps, 'children'> {\n leading?: React.ReactNode;\n trailing?: React.ReactNode;\n children?: React.ReactNode;\n safeAreaTop?: boolean;\n divider?: boolean;\n contentStyle?: StyleProp<ViewStyle>;\n}\n\nexport function AppBar({\n leading,\n trailing,\n children,\n safeAreaTop = true,\n divider = false,\n contentStyle,\n bg,\n style,\n ...props\n}: AppBarProps) {\n const { theme } = useTheme();\n const insets = React.use(SafeAreaInsetsContext);\n const topInset = safeAreaTop ? (insets?.top ?? 0) : 0;\n const safeAreaStyle: ViewStyle | undefined =\n topInset === 0 ? undefined : { paddingTop: topInset };\n\n return (\n <Box {...props} bg={bg ?? theme.semantics.surface.default} style={style}>\n <View style={safeAreaStyle}>\n <View\n style={[\n {\n minHeight: 56,\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: theme.spacing.m,\n },\n contentStyle,\n ]}\n >\n {leading ? (\n <View style={{ marginRight: theme.spacing.s, flexShrink: 0 }}>{leading}</View>\n ) : null}\n <View style={{ flex: 1, minWidth: 0 }}>{children}</View>\n {trailing ? (\n <View style={{ marginLeft: theme.spacing.s, flexShrink: 0 }}>{trailing}</View>\n ) : null}\n </View>\n {divider ? <Divider color={theme.semantics.neutral.divider} thickness={1} /> : null}\n </View>\n </Box>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeContext.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeContext.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ThemeContext.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAQ3D,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAIzD,eAAO,MAAM,YAAY;WAChB,YAAY;UACb,OAAO,GAAG,MAAM;oBACN,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,IAAI;aAC7C,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,KAAK,IAAI;mBAC1B,OAAO;EAWtB,CAAC;AAEH,eAAO,MAAM,aAAa,GAAI,2CAI3B;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IACrC,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAChC,sBAyCA,CAAC;AAEF,eAAO,MAAM,QAAQ;WApEZ,YAAY;UACb,OAAO,GAAG,MAAM;oBACN,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,IAAI;aAC7C,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,KAAK,IAAI;mBAC1B,OAAO;CAkEvB,CAAC;AAEF,eAAO,MAAM,cAAc,iBAtEA,OAAO,CAAC,WAAW,CAAC,KAAK,IAyEnD,CAAC;AAEF,eAAO,MAAM,YAAY;;oBA1EP,OAAO,GAAG,MAAM,KAAK,IAAI;CA6E1C,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { createContext,
|
|
1
|
+
import React, { createContext, use, useMemo } from 'react';
|
|
2
2
|
import { useFontContext } from '../context/FontContext';
|
|
3
3
|
import { ResponsiveProvider } from '../core/responsive/ResponsiveProvider';
|
|
4
4
|
import { OverlayProvider } from '../internal/overlay/OverlayProvider';
|
|
@@ -21,7 +21,6 @@ export const ThemeProvider = ({ children, initialConfig, initialMode = 'light',
|
|
|
21
21
|
const [config, setConfig] = React.useState(() => initialConfig ? deepMerge(defaultTheme.config, initialConfig) : defaultTheme.config);
|
|
22
22
|
const [mode, setMode] = React.useState(initialMode);
|
|
23
23
|
const { activeFontId } = useFontContext();
|
|
24
|
-
// Keep state in sync with prop for real-time Studio updates
|
|
25
24
|
React.useEffect(() => {
|
|
26
25
|
if (initialConfig) {
|
|
27
26
|
setConfig((prev) => {
|
|
@@ -41,13 +40,13 @@ export const ThemeProvider = ({ children, initialConfig, initialMode = 'light',
|
|
|
41
40
|
_hasProvider: true,
|
|
42
41
|
}), [theme, mode]);
|
|
43
42
|
return (<ResponsiveProvider>
|
|
44
|
-
<ThemeContext
|
|
43
|
+
<ThemeContext value={value}>
|
|
45
44
|
<OverlayProvider>{children}</OverlayProvider>
|
|
46
|
-
</ThemeContext
|
|
45
|
+
</ThemeContext>
|
|
47
46
|
</ResponsiveProvider>);
|
|
48
47
|
};
|
|
49
48
|
export const useTheme = () => {
|
|
50
|
-
return
|
|
49
|
+
return use(ThemeContext);
|
|
51
50
|
};
|
|
52
51
|
export const useThemeConfig = () => {
|
|
53
52
|
const { setThemeConfig } = useTheme();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeContext.js","sourceRoot":"","sources":["../../src/theme/ThemeContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"ThemeContext.js","sourceRoot":"","sources":["../../src/theme/ThemeContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,EAA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AAO,EAAE,GAAG,QAAQ,EAAE,CAAC;IACrC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAC3B,CAAC,CAAC","sourcesContent":["import React, { createContext, use, useMemo } from 'react';\n\nimport { useFontContext } from '../context/FontContext';\nimport { ResponsiveProvider } from '../core/responsive/ResponsiveProvider';\nimport { OverlayProvider } from '../internal/overlay/OverlayProvider';\nimport { isDeepEqual } from '../utils/deepEqual';\nimport { deepMerge } from '../utils/deepMerge';\nimport { createTheme } from './createTheme';\nimport type { SurfaceTheme, ThemeConfig } from './types';\n\nconst defaultTheme = createTheme();\n\nexport const ThemeContext = createContext<{\n theme: SurfaceTheme;\n mode: 'light' | 'dark';\n setThemeConfig: (config: Partial<ThemeConfig>) => void;\n setMode: (mode: 'light' | 'dark') => void;\n _hasProvider?: boolean;\n}>({\n theme: defaultTheme,\n mode: 'light',\n setThemeConfig: () => {\n /* fallback */\n },\n setMode: () => {\n /* fallback */\n },\n _hasProvider: false,\n});\n\nexport const ThemeProvider = ({\n children,\n initialConfig,\n initialMode = 'light',\n}: {\n children: React.ReactNode;\n initialConfig?: Partial<ThemeConfig>;\n initialMode?: 'light' | 'dark';\n}) => {\n const [config, setConfig] = React.useState<ThemeConfig>(() =>\n initialConfig ? deepMerge(defaultTheme.config, initialConfig) : defaultTheme.config,\n );\n const [mode, setMode] = React.useState<'light' | 'dark'>(initialMode);\n const { activeFontId } = useFontContext();\n\n React.useEffect(() => {\n if (initialConfig) {\n setConfig((prev) => {\n const merged = deepMerge(prev, initialConfig);\n if (isDeepEqual(prev, merged)) return prev;\n return merged;\n });\n }\n }, [initialConfig]);\n\n const theme = useMemo(\n () => createTheme(config, mode, activeFontId),\n [config, mode, activeFontId],\n );\n\n const value = useMemo(\n () => ({\n theme,\n mode,\n setThemeConfig: (newConfig: Partial<ThemeConfig>) =>\n setConfig((prev) => deepMerge(prev, newConfig)),\n setMode,\n _hasProvider: true,\n }),\n [theme, mode],\n );\n\n return (\n <ResponsiveProvider>\n <ThemeContext value={value}>\n <OverlayProvider>{children}</OverlayProvider>\n </ThemeContext>\n </ResponsiveProvider>\n );\n};\n\nexport const useTheme = () => {\n return use(ThemeContext);\n};\n\nexport const useThemeConfig = () => {\n const { setThemeConfig } = useTheme();\n return setThemeConfig;\n};\n\nexport const useThemeMode = () => {\n const { mode, setMode } = useTheme();\n return { mode, setMode };\n};\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { InteractionPolicy } from '../interactionPolicy';
|
|
3
|
+
export type PopoverPlacement = 'bottom-start' | 'bottom' | 'bottom-end' | 'top-start' | 'top' | 'top-end';
|
|
4
|
+
export interface PopoverAnchorRenderProps {
|
|
5
|
+
close: () => void;
|
|
6
|
+
open: boolean;
|
|
7
|
+
toggle: () => void;
|
|
8
|
+
}
|
|
9
|
+
export interface PopoverProps {
|
|
10
|
+
anchor: (controls: PopoverAnchorRenderProps) => React.ReactNode;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
closeOnOutsidePress?: boolean;
|
|
13
|
+
defaultOpen?: boolean;
|
|
14
|
+
interactionPolicy?: InteractionPolicy;
|
|
15
|
+
offset?: number;
|
|
16
|
+
onOpenChange?: ((open: boolean) => void) | undefined;
|
|
17
|
+
open?: boolean;
|
|
18
|
+
placement?: PopoverPlacement;
|
|
19
|
+
testID?: string;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=popover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../src/types/popover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,MAAM,MAAM,gBAAgB,GAC1B,cAAc,GAAG,QAAQ,GAAG,YAAY,GAAG,WAAW,GAAG,KAAK,GAAG,SAAS,CAAC;AAE7E,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,CAAC,QAAQ,EAAE,wBAAwB,KAAK,KAAK,CAAC,SAAS,CAAC;IAChE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACrD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover.js","sourceRoot":"","sources":["../../src/types/popover.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nimport type { InteractionPolicy } from '../interactionPolicy';\n\nexport type PopoverPlacement =\n 'bottom-start' | 'bottom' | 'bottom-end' | 'top-start' | 'top' | 'top-end';\n\nexport interface PopoverAnchorRenderProps {\n close: () => void;\n open: boolean;\n toggle: () => void;\n}\n\nexport interface PopoverProps {\n anchor: (controls: PopoverAnchorRenderProps) => React.ReactNode;\n children?: React.ReactNode;\n closeOnOutsidePress?: boolean;\n defaultOpen?: boolean;\n interactionPolicy?: InteractionPolicy;\n offset?: number;\n onOpenChange?: ((open: boolean) => void) | undefined;\n open?: boolean;\n placement?: PopoverPlacement;\n testID?: string;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type { InteractionPolicy } from '
|
|
3
|
-
import type { SurfaceStatusColor } from '
|
|
2
|
+
import type { InteractionPolicy } from '../interactionPolicy';
|
|
3
|
+
import type { SurfaceStatusColor } from '../surfaceColor';
|
|
4
4
|
export type ToastStatus = 'default' | SurfaceStatusColor;
|
|
5
5
|
export interface ToastProps {
|
|
6
6
|
title?: React.ReactNode;
|
|
@@ -14,4 +14,12 @@ export interface ToastOptions extends Omit<ToastProps, 'onDismiss'> {
|
|
|
14
14
|
duration?: number;
|
|
15
15
|
id?: string;
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
export interface ToastProviderProps {
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
defaultDuration?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface ToastController {
|
|
22
|
+
dismissToast: (id: string) => void;
|
|
23
|
+
showToast: (options: ToastOptions) => string;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=toast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../src/types/toast.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,kBAAkB,CAAC;AAEzD,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,SAAS,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IACrC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC;IACjE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,SAAS,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,MAAM,CAAC;CAC9C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.js","sourceRoot":"","sources":["../../src/types/toast.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nimport type { InteractionPolicy } from '../interactionPolicy';\nimport type { SurfaceStatusColor } from '../surfaceColor';\n\nexport type ToastStatus = 'default' | SurfaceStatusColor;\n\nexport interface ToastProps {\n title?: React.ReactNode;\n description?: React.ReactNode;\n status?: ToastStatus;\n onDismiss?: (() => void) | undefined;\n interactionPolicy?: InteractionPolicy;\n testID?: string;\n}\n\nexport interface ToastOptions extends Omit<ToastProps, 'onDismiss'> {\n duration?: number;\n id?: string;\n}\n\nexport interface ToastProviderProps {\n children: React.ReactNode;\n defaultDuration?: number;\n}\n\nexport interface ToastController {\n dismissToast: (id: string) => void;\n showToast: (options: ToastOptions) => string;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -60,8 +60,8 @@ export function Tabs({ children, value, defaultValue, onValueChange, testID }: T
|
|
|
60
60
|
);
|
|
61
61
|
|
|
62
62
|
return (
|
|
63
|
-
<TabsContext
|
|
63
|
+
<TabsContext value={contextValue}>
|
|
64
64
|
<Box testID={testID}>{children}</Box>
|
|
65
|
-
</TabsContext
|
|
65
|
+
</TabsContext>
|
|
66
66
|
);
|
|
67
67
|
}
|
|
@@ -21,7 +21,7 @@ export interface TabsContextValue {
|
|
|
21
21
|
export const TabsContext = React.createContext<TabsContextValue | null>(null);
|
|
22
22
|
|
|
23
23
|
export function useTabsContext(): TabsContextValue {
|
|
24
|
-
const value = React.
|
|
24
|
+
const value = React.use(TabsContext);
|
|
25
25
|
|
|
26
26
|
if (!value) {
|
|
27
27
|
throw new Error('Tabs components must be used within <Tabs>.');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { createContext,
|
|
1
|
+
import React, { createContext, use, useMemo, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Runtime font state consumed by theme and text primitives.
|
|
@@ -51,9 +51,9 @@ export function FontProvider(props: {
|
|
|
51
51
|
[fontsLoaded, activeFontId, onActiveFontChange],
|
|
52
52
|
);
|
|
53
53
|
|
|
54
|
-
return <FontContext
|
|
54
|
+
return <FontContext value={value}>{children}</FontContext>;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
export function useFontContext(): FontRuntime {
|
|
58
|
-
return
|
|
58
|
+
return use(FontContext);
|
|
59
59
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { createContext,
|
|
1
|
+
import React, { createContext, use } from 'react';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Minimal translation runtime surface.
|
|
@@ -35,7 +35,6 @@ export function TranslationProvider(props: {
|
|
|
35
35
|
t: (key: string, options?: Record<string, unknown>) => {
|
|
36
36
|
if (i18n?.t) {
|
|
37
37
|
const result = i18n.t(key, options);
|
|
38
|
-
// If translation returns the key, it's missing in the current dictionary
|
|
39
38
|
if (result !== key) return result;
|
|
40
39
|
}
|
|
41
40
|
return t(key, options);
|
|
@@ -43,9 +42,9 @@ export function TranslationProvider(props: {
|
|
|
43
42
|
i18n: i18n ?? null,
|
|
44
43
|
};
|
|
45
44
|
|
|
46
|
-
return <TranslationContext
|
|
45
|
+
return <TranslationContext value={value}>{children}</TranslationContext>;
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
export function useTranslationContext(): TranslationRuntime {
|
|
50
|
-
return
|
|
49
|
+
return use(TranslationContext);
|
|
51
50
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { createContext,
|
|
1
|
+
import React, { createContext, use, useMemo } from 'react';
|
|
2
2
|
import { useWindowDimensions } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { getBreakpointFromWidth } from './getBreakpointFromWidth';
|
|
@@ -17,11 +17,11 @@ export function ResponsiveProvider({ children }: { children: React.ReactNode })
|
|
|
17
17
|
[width],
|
|
18
18
|
);
|
|
19
19
|
|
|
20
|
-
return <ResponsiveContext
|
|
20
|
+
return <ResponsiveContext value={value}>{children}</ResponsiveContext>;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export function useResponsiveRuntime(): ResponsiveRuntime {
|
|
24
|
-
const runtime =
|
|
24
|
+
const runtime = use(ResponsiveContext);
|
|
25
25
|
|
|
26
26
|
if (!runtime) {
|
|
27
27
|
throw new Error('useResponsiveRuntime must be used within a ResponsiveProvider');
|
|
@@ -5,13 +5,13 @@ import { HelperText } from '../components/helper-text';
|
|
|
5
5
|
import { Menu } from '../components/menu';
|
|
6
6
|
import { Modal } from '../components/modal';
|
|
7
7
|
import { Tab, TabList, TabPanel, Tabs } from '../components/tabs';
|
|
8
|
-
import { ToastProvider, useToast } from '../components/toast';
|
|
9
8
|
import { Tooltip } from '../components/tooltip';
|
|
10
9
|
import { Button } from '../features/button/public';
|
|
11
10
|
import { Card } from '../features/card/public';
|
|
12
11
|
import { Checkbox } from '../features/form/checkbox/public';
|
|
13
12
|
import { TextInput } from '../features/form/text-input/public';
|
|
14
13
|
import { Box, Stack } from '../features/layout/public';
|
|
14
|
+
import { ToastProvider, useToast } from '../features/toast/public';
|
|
15
15
|
import { Text } from '../features/typography/public';
|
|
16
16
|
import { ThemeProvider } from '../theme';
|
|
17
17
|
import type { ThemeConfig } from '../theme/types';
|
|
@@ -52,9 +52,9 @@ export function Accordion(props: AccordionProps) {
|
|
|
52
52
|
);
|
|
53
53
|
|
|
54
54
|
return (
|
|
55
|
-
<AccordionContext
|
|
55
|
+
<AccordionContext value={contextValue}>
|
|
56
56
|
<View {...viewProps}>{children}</View>
|
|
57
|
-
</AccordionContext
|
|
57
|
+
</AccordionContext>
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -11,7 +11,7 @@ export function AccordionContent({
|
|
|
11
11
|
style,
|
|
12
12
|
...viewProps
|
|
13
13
|
}: AccordionContentProps) {
|
|
14
|
-
const item = React.
|
|
14
|
+
const item = React.use(AccordionItemContext);
|
|
15
15
|
if (!item) throw new Error('AccordionContent must be rendered inside AccordionItem.');
|
|
16
16
|
if (!item.open && !forceMount) return null;
|
|
17
17
|
|
|
@@ -13,7 +13,7 @@ export function AccordionItem({
|
|
|
13
13
|
value,
|
|
14
14
|
...viewProps
|
|
15
15
|
}: AccordionItemProps) {
|
|
16
|
-
const accordion = React.
|
|
16
|
+
const accordion = React.use(AccordionContext);
|
|
17
17
|
if (!accordion) throw new Error('AccordionItem must be rendered inside Accordion.');
|
|
18
18
|
|
|
19
19
|
const reactId = React.useId();
|
|
@@ -35,8 +35,8 @@ export function AccordionItem({
|
|
|
35
35
|
);
|
|
36
36
|
|
|
37
37
|
return (
|
|
38
|
-
<AccordionItemContext
|
|
38
|
+
<AccordionItemContext value={contextValue}>
|
|
39
39
|
<View {...viewProps}>{children}</View>
|
|
40
|
-
</AccordionItemContext
|
|
40
|
+
</AccordionItemContext>
|
|
41
41
|
);
|
|
42
42
|
}
|
|
@@ -11,7 +11,7 @@ export function AccordionTrigger({
|
|
|
11
11
|
interactionPolicy,
|
|
12
12
|
...pressableProps
|
|
13
13
|
}: AccordionTriggerProps) {
|
|
14
|
-
const item = React.
|
|
14
|
+
const item = React.use(AccordionItemContext);
|
|
15
15
|
if (!item) throw new Error('AccordionTrigger must be rendered inside AccordionItem.');
|
|
16
16
|
|
|
17
17
|
const resolvedDisabled = item.disabled || disabled;
|
|
@@ -48,7 +48,7 @@ export function BottomSheetProvider({ children }: { children: React.ReactNode })
|
|
|
48
48
|
);
|
|
49
49
|
|
|
50
50
|
return (
|
|
51
|
-
<BottomSheetContext
|
|
51
|
+
<BottomSheetContext value={controller}>
|
|
52
52
|
<BottomSheetModalProvider>
|
|
53
53
|
{children}
|
|
54
54
|
<BottomSheetHost
|
|
@@ -58,7 +58,7 @@ export function BottomSheetProvider({ children }: { children: React.ReactNode })
|
|
|
58
58
|
presentedRef={presentedRef}
|
|
59
59
|
/>
|
|
60
60
|
</BottomSheetModalProvider>
|
|
61
|
-
</BottomSheetContext
|
|
61
|
+
</BottomSheetContext>
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -5,7 +5,7 @@ import { BottomSheetContext } from './BottomSheetContext';
|
|
|
5
5
|
|
|
6
6
|
/*** Returns the shared bottom-sheet controller installed by BottomSheetProvider. */
|
|
7
7
|
export function useBottomSheet(): BottomSheetController {
|
|
8
|
-
const controller = React.
|
|
8
|
+
const controller = React.use(BottomSheetContext);
|
|
9
9
|
|
|
10
10
|
if (!controller) {
|
|
11
11
|
throw new Error('useBottomSheet must be used within BottomSheetProvider.');
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { useControllableState } from '../../../../internal/useControllableState';
|
|
5
|
+
import type { PopoverProps } from '../../../../types/popover';
|
|
6
|
+
import { PopoverOverlay } from './PopoverOverlay';
|
|
7
|
+
|
|
8
|
+
/*** Renders anchored overlay content through the shared Surface overlay stack. */
|
|
9
|
+
export function Popover(props: PopoverProps) {
|
|
10
|
+
const anchorRef = React.useRef<View | null>(null);
|
|
11
|
+
const [resolvedOpen, setResolvedOpen] = useControllableState<boolean>({
|
|
12
|
+
defaultValue: props.defaultOpen ?? false,
|
|
13
|
+
onChange: props.onOpenChange,
|
|
14
|
+
value: props.open,
|
|
15
|
+
});
|
|
16
|
+
const passive = props.interactionPolicy === 'passive';
|
|
17
|
+
|
|
18
|
+
const close = React.useCallback(() => {
|
|
19
|
+
if (!passive) setResolvedOpen(false);
|
|
20
|
+
}, [passive, setResolvedOpen]);
|
|
21
|
+
const toggle = React.useCallback(() => {
|
|
22
|
+
if (!passive) setResolvedOpen(!resolvedOpen);
|
|
23
|
+
}, [passive, resolvedOpen, setResolvedOpen]);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<>
|
|
27
|
+
<View
|
|
28
|
+
collapsable={false}
|
|
29
|
+
ref={anchorRef}
|
|
30
|
+
testID={props.testID ? `${props.testID}-anchor` : undefined}
|
|
31
|
+
>
|
|
32
|
+
{props.anchor({ close, open: resolvedOpen, toggle })}
|
|
33
|
+
</View>
|
|
34
|
+
{resolvedOpen ? (
|
|
35
|
+
<PopoverOverlay
|
|
36
|
+
anchorRef={anchorRef}
|
|
37
|
+
closeOnOutsidePress={props.closeOnOutsidePress ?? true}
|
|
38
|
+
offset={props.offset ?? 8}
|
|
39
|
+
onClose={close}
|
|
40
|
+
passive={passive}
|
|
41
|
+
placement={props.placement ?? 'bottom-start'}
|
|
42
|
+
testID={props.testID}
|
|
43
|
+
>
|
|
44
|
+
{props.children}
|
|
45
|
+
</PopoverOverlay>
|
|
46
|
+
) : null}
|
|
47
|
+
</>
|
|
48
|
+
);
|
|
49
|
+
}
|