@ankhorage/surface 4.4.1 → 5.0.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/dist/features/bottom-sheet/BottomSheetProvider.js +8 -6
- package/dist/features/bottom-sheet/BottomSheetProvider.js.map +1 -1
- package/dist/features/bottom-sheet/public.d.ts +2 -1
- package/dist/features/bottom-sheet/public.d.ts.map +1 -1
- package/dist/features/bottom-sheet/public.js +1 -0
- package/dist/features/bottom-sheet/public.js.map +1 -1
- package/dist/features/popover-menu/adapters/inbound/PopoverMenu.d.ts +5 -0
- package/dist/features/popover-menu/adapters/inbound/PopoverMenu.d.ts.map +1 -0
- package/dist/features/popover-menu/adapters/inbound/PopoverMenu.js +85 -0
- package/dist/features/popover-menu/adapters/inbound/PopoverMenu.js.map +1 -0
- package/dist/features/popover-menu/composition/usePopoverMenuController.d.ts +19 -0
- package/dist/features/popover-menu/composition/usePopoverMenuController.d.ts.map +1 -0
- package/dist/features/popover-menu/composition/usePopoverMenuController.js +35 -0
- package/dist/features/popover-menu/composition/usePopoverMenuController.js.map +1 -0
- package/dist/features/popover-menu/public.d.ts +3 -0
- package/dist/features/popover-menu/public.d.ts.map +1 -0
- package/dist/features/popover-menu/public.js +2 -0
- package/dist/features/popover-menu/public.js.map +1 -0
- package/dist/features/popover-menu/utils/resolveNextMenuIndex.d.ts +5 -0
- package/dist/features/popover-menu/utils/resolveNextMenuIndex.d.ts.map +1 -0
- package/dist/features/popover-menu/utils/resolveNextMenuIndex.js +18 -0
- package/dist/features/popover-menu/utils/resolveNextMenuIndex.js.map +1 -0
- package/dist/features/tooltip/adapters/inbound/Tooltip.d.ts +5 -0
- package/dist/features/tooltip/adapters/inbound/Tooltip.d.ts.map +1 -0
- package/dist/features/tooltip/adapters/inbound/Tooltip.js +25 -0
- package/dist/features/tooltip/adapters/inbound/Tooltip.js.map +1 -0
- package/dist/features/tooltip/composition/useTooltipVisibility.d.ts +9 -0
- package/dist/features/tooltip/composition/useTooltipVisibility.d.ts.map +1 -0
- package/dist/features/tooltip/composition/useTooltipVisibility.js +25 -0
- package/dist/features/tooltip/composition/useTooltipVisibility.js.map +1 -0
- package/dist/features/tooltip/public.d.ts +3 -0
- package/dist/features/tooltip/public.d.ts.map +1 -0
- package/dist/features/tooltip/public.js +2 -0
- package/dist/features/tooltip/public.js.map +1 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/types/bottomSheet.d.ts +3 -0
- package/dist/types/bottomSheet.d.ts.map +1 -1
- package/dist/types/bottomSheet.js.map +1 -1
- package/dist/types/popoverMenu.d.ts +24 -0
- package/dist/types/popoverMenu.d.ts.map +1 -0
- package/dist/types/popoverMenu.js +2 -0
- package/dist/types/popoverMenu.js.map +1 -0
- package/dist/{components/tooltip/types.d.ts → types/tooltip.d.ts} +2 -2
- package/dist/types/tooltip.d.ts.map +1 -0
- package/dist/types/tooltip.js +2 -0
- package/dist/types/tooltip.js.map +1 -0
- package/package.json +1 -1
- package/src/features/bottom-sheet/BottomSheetProvider.tsx +13 -8
- package/src/features/bottom-sheet/public.test.ts +23 -0
- package/src/features/bottom-sheet/public.ts +12 -1
- package/src/features/popover-menu/adapters/inbound/PopoverMenu.tsx +201 -0
- package/src/features/popover-menu/composition/usePopoverMenuController.ts +55 -0
- package/src/features/popover-menu/public.test.ts +13 -0
- package/src/features/popover-menu/public.ts +6 -0
- package/src/{components/menu/navigation.test.ts → features/popover-menu/utils/resolveNextMenuIndex.test.ts} +4 -4
- package/src/features/popover-menu/utils/resolveNextMenuIndex.ts +21 -0
- package/src/features/tooltip/adapters/inbound/Tooltip.tsx +56 -0
- package/src/features/tooltip/composition/useTooltipVisibility.ts +29 -0
- package/src/features/tooltip/public.test.ts +11 -0
- package/src/features/tooltip/public.ts +2 -0
- package/src/index.test.ts +8 -3
- package/src/index.ts +8 -4
- package/src/types/bottomSheet.ts +4 -0
- package/src/types/popoverMenu.ts +27 -0
- package/src/{components/tooltip/types.ts → types/tooltip.ts} +1 -1
- package/dist/components/menu/Menu.d.ts +0 -4
- package/dist/components/menu/Menu.d.ts.map +0 -1
- package/dist/components/menu/Menu.js +0 -152
- package/dist/components/menu/Menu.js.map +0 -1
- package/dist/components/menu/index.d.ts +0 -3
- package/dist/components/menu/index.d.ts.map +0 -1
- package/dist/components/menu/index.js +0 -2
- package/dist/components/menu/index.js.map +0 -1
- package/dist/components/menu/navigation.d.ts +0 -4
- package/dist/components/menu/navigation.d.ts.map +0 -1
- package/dist/components/menu/navigation.js +0 -25
- package/dist/components/menu/navigation.js.map +0 -1
- package/dist/components/menu/types.d.ts +0 -23
- package/dist/components/menu/types.d.ts.map +0 -1
- package/dist/components/menu/types.js +0 -2
- package/dist/components/menu/types.js.map +0 -1
- package/dist/components/tooltip/Tooltip.d.ts +0 -4
- package/dist/components/tooltip/Tooltip.d.ts.map +0 -1
- package/dist/components/tooltip/Tooltip.js +0 -75
- package/dist/components/tooltip/Tooltip.js.map +0 -1
- package/dist/components/tooltip/index.d.ts +0 -3
- package/dist/components/tooltip/index.d.ts.map +0 -1
- package/dist/components/tooltip/index.js +0 -2
- package/dist/components/tooltip/index.js.map +0 -1
- package/dist/components/tooltip/types.d.ts.map +0 -1
- package/dist/components/tooltip/types.js +0 -2
- package/dist/components/tooltip/types.js.map +0 -1
- package/src/components/menu/Menu.tsx +0 -228
- package/src/components/menu/index.ts +0 -2
- package/src/components/menu/navigation.ts +0 -34
- package/src/components/menu/types.ts +0 -26
- package/src/components/tooltip/Tooltip.tsx +0 -117
- package/src/components/tooltip/index.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @ankhorage/surface
|
|
2
2
|
|
|
3
|
+
## 5.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 33ee8c2: Replace the ambiguous `Menu` API with feature-owned `PopoverMenu`, migrate Tooltip onto the shared Popover capability, and expose Gorhom-integrated bottom-sheet scrollables with direct scrollable content hosting.
|
|
8
|
+
|
|
3
9
|
## 4.4.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -39,21 +39,23 @@ export function BottomSheetProvider({ children }) {
|
|
|
39
39
|
/*** Renders and presents the single Gorhom modal owned by the provider. */
|
|
40
40
|
function BottomSheetHost({ activeRequest, handleDismiss, modalRef, presentedRef, }) {
|
|
41
41
|
React.useEffect(() => {
|
|
42
|
-
if (!activeRequest || presentedRef.current)
|
|
42
|
+
if (!activeRequest || presentedRef.current)
|
|
43
43
|
return;
|
|
44
|
-
}
|
|
45
44
|
presentedRef.current = true;
|
|
46
45
|
modalRef.current?.present();
|
|
47
46
|
}, [activeRequest, modalRef, presentedRef]);
|
|
48
47
|
const renderBackdrop = useBottomSheetBackdrop(activeRequest?.dismissOnBackdropPress);
|
|
49
48
|
const snapPoints = React.useMemo(() => (activeRequest?.snapPoints ? [...activeRequest.snapPoints] : undefined), [activeRequest?.snapPoints]);
|
|
50
|
-
if (!activeRequest)
|
|
49
|
+
if (!activeRequest)
|
|
51
50
|
return null;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
<BottomSheetView>{activeRequest.content}</BottomSheetView>
|
|
51
|
+
return (<BottomSheetModal ref={modalRef} backdropComponent={renderBackdrop} enableDynamicSizing={activeRequest.enableDynamicSizing ?? true} enablePanDownToClose={activeRequest.enablePanDownToClose ?? true} index={activeRequest.initialIndex ?? 0} keyboardBehavior={activeRequest.keyboardBehavior ?? 'interactive'} keyboardBlurBehavior={activeRequest.keyboardBlurBehavior ?? 'restore'} maxDynamicContentSize={activeRequest.maxDynamicContentSize} onChange={activeRequest.onIndexChange} onDismiss={handleDismiss} snapPoints={snapPoints}>
|
|
52
|
+
{renderBottomSheetContent(activeRequest)}
|
|
55
53
|
</BottomSheetModal>);
|
|
56
54
|
}
|
|
55
|
+
/*** Renders default content in BottomSheetView and direct content without an extra wrapper. */
|
|
56
|
+
function renderBottomSheetContent(activeRequest) {
|
|
57
|
+
return activeRequest.contentMode === 'direct' ? (activeRequest.content) : (<BottomSheetView>{activeRequest.content}</BottomSheetView>);
|
|
58
|
+
}
|
|
57
59
|
/*** Creates the backdrop renderer for the active bottom-sheet request. */
|
|
58
60
|
function useBottomSheetBackdrop(dismissOnBackdropPress) {
|
|
59
61
|
return React.useCallback((props) => (<BottomSheetBackdrop {...props} appearsOnIndex={0} disappearsOnIndex={-1} pressBehavior={dismissOnBackdropPress === false ? 'none' : 'close'}/>), [dismissOnBackdropPress]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetProvider.js","sourceRoot":"","sources":["../../../src/features/bottom-sheet/BottomSheetProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EAEnB,gBAAgB,EAChB,wBAAwB,EACxB,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,4FAA4F;AAC5F,MAAM,UAAU,mBAAmB,CAAC,EAAE,QAAQ,EAAiC;IAC7E,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAmB,IAAI,CAAC,CAAC;IACtD,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAAmC,IAAI,CAAC,CAAC;IAC9E,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACzC,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAmC,IAAI,CAAC,CAAC;IAEjG,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,OAAkC,EAAE,EAAE;QACvE,gBAAgB,CAAC,OAAO,GAAG,OAAO,CAAC;QACnC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC,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AC;AACJ,CAAC;AAED,+FAA+F;AAC/F,SAAS,wBAAwB,CAAC,aAAwC;IACxE,OAAO,aAAa,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,CAC9C,aAAa,CAAC,OAAO,CACtB,CAAC,CAAC,CAAC,CACF,CAAC,eAAe,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,eAAe,CAAC,CAC3D,CAAC;AACJ,CAAC;AAED,0EAA0E;AAC1E,SAAS,sBAAsB,CAAC,sBAA2C;IACzE,OAAO,KAAK,CAAC,WAAW,CACtB,CAAC,KAA+B,EAAE,EAAE,CAAC,CACnC,CAAC,mBAAmB,CAClB,IAAI,KAAK,CAAC,CACV,cAAc,CAAC,CAAC,CAAC,CAAC,CAClB,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CACtB,aAAa,CAAC,CAAC,sBAAsB,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,EACnE,CACH,EACD,CAAC,sBAAsB,CAAC,CACzB,CAAC;AACJ,CAAC","sourcesContent":["import {\n BottomSheetBackdrop,\n type BottomSheetBackdropProps,\n BottomSheetModal,\n BottomSheetModalProvider,\n BottomSheetView,\n} from '@gorhom/bottom-sheet';\nimport React from 'react';\n\nimport type { BottomSheetController, BottomSheetPresentOptions } from '../../types/bottomSheet';\nimport { BottomSheetContext } from './BottomSheetContext';\n\n/*** Installs the shared bottom-sheet modal host and controller for descendant consumers. */\nexport function BottomSheetProvider({ children }: { children: React.ReactNode }) {\n const modalRef = React.useRef<BottomSheetModal>(null);\n const activeRequestRef = React.useRef<BottomSheetPresentOptions | null>(null);\n const presentedRef = React.useRef(false);\n const [activeRequest, setActiveRequest] = React.useState<BottomSheetPresentOptions | null>(null);\n\n const present = React.useCallback((options: BottomSheetPresentOptions) => {\n activeRequestRef.current = options;\n setActiveRequest(options);\n }, []);\n\n const dismiss = React.useCallback(() => {\n if (presentedRef.current) {\n modalRef.current?.dismiss();\n return;\n }\n\n const request = activeRequestRef.current;\n activeRequestRef.current = null;\n setActiveRequest(null);\n request?.onDismiss?.();\n }, []);\n\n const handleDismiss = React.useCallback(() => {\n const request = activeRequestRef.current;\n presentedRef.current = false;\n activeRequestRef.current = null;\n setActiveRequest(null);\n request?.onDismiss?.();\n }, []);\n\n const controller = React.useMemo<BottomSheetController>(\n () => ({ dismiss, present }),\n [dismiss, present],\n );\n\n return (\n <BottomSheetContext value={controller}>\n <BottomSheetModalProvider>\n {children}\n <BottomSheetHost\n activeRequest={activeRequest}\n handleDismiss={handleDismiss}\n modalRef={modalRef}\n presentedRef={presentedRef}\n />\n </BottomSheetModalProvider>\n </BottomSheetContext>\n );\n}\n\ninterface BottomSheetHostProps {\n readonly activeRequest: BottomSheetPresentOptions | null;\n readonly handleDismiss: () => void;\n readonly modalRef: React.RefObject<BottomSheetModal | null>;\n readonly presentedRef: React.RefObject<boolean>;\n}\n\n/*** Renders and presents the single Gorhom modal owned by the provider. */\nfunction BottomSheetHost({\n activeRequest,\n handleDismiss,\n modalRef,\n presentedRef,\n}: BottomSheetHostProps) {\n React.useEffect(() => {\n if (!activeRequest || presentedRef.current) return;\n presentedRef.current = true;\n modalRef.current?.present();\n }, [activeRequest, modalRef, presentedRef]);\n\n const renderBackdrop = useBottomSheetBackdrop(activeRequest?.dismissOnBackdropPress);\n const snapPoints = React.useMemo(\n () => (activeRequest?.snapPoints ? [...activeRequest.snapPoints] : undefined),\n [activeRequest?.snapPoints],\n );\n\n if (!activeRequest) return null;\n\n return (\n <BottomSheetModal\n ref={modalRef}\n backdropComponent={renderBackdrop}\n enableDynamicSizing={activeRequest.enableDynamicSizing ?? true}\n enablePanDownToClose={activeRequest.enablePanDownToClose ?? true}\n index={activeRequest.initialIndex ?? 0}\n keyboardBehavior={activeRequest.keyboardBehavior ?? 'interactive'}\n keyboardBlurBehavior={activeRequest.keyboardBlurBehavior ?? 'restore'}\n maxDynamicContentSize={activeRequest.maxDynamicContentSize}\n onChange={activeRequest.onIndexChange}\n onDismiss={handleDismiss}\n snapPoints={snapPoints}\n >\n {renderBottomSheetContent(activeRequest)}\n </BottomSheetModal>\n );\n}\n\n/*** Renders default content in BottomSheetView and direct content without an extra wrapper. */\nfunction renderBottomSheetContent(activeRequest: BottomSheetPresentOptions): React.ReactNode {\n return activeRequest.contentMode === 'direct' ? (\n activeRequest.content\n ) : (\n <BottomSheetView>{activeRequest.content}</BottomSheetView>\n );\n}\n\n/*** Creates the backdrop renderer for the active bottom-sheet request. */\nfunction useBottomSheetBackdrop(dismissOnBackdropPress: boolean | undefined) {\n return React.useCallback(\n (props: BottomSheetBackdropProps) => (\n <BottomSheetBackdrop\n {...props}\n appearsOnIndex={0}\n disappearsOnIndex={-1}\n pressBehavior={dismissOnBackdropPress === false ? 'none' : 'close'}\n />\n ),\n [dismissOnBackdropPress],\n );\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export type { BottomSheetController, BottomSheetPresentOptions } from '../../types/bottomSheet';
|
|
1
|
+
export type { BottomSheetContentMode, BottomSheetController, BottomSheetPresentOptions, } from '../../types/bottomSheet';
|
|
2
2
|
export { BottomSheetProvider } from './BottomSheetProvider';
|
|
3
3
|
export { useBottomSheet } from './useBottomSheet';
|
|
4
|
+
export { BottomSheetFlatList, BottomSheetScrollView, BottomSheetSectionList, BottomSheetView, BottomSheetVirtualizedList, } from '@gorhom/bottom-sheet';
|
|
4
5
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/features/bottom-sheet/public.ts"],"names":[],"mappings":"AAAA,YAAY,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/features/bottom-sheet/public.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,sBAAsB,EACtB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,eAAe,EACf,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { BottomSheetProvider } from './BottomSheetProvider';
|
|
2
2
|
export { useBottomSheet } from './useBottomSheet';
|
|
3
|
+
export { BottomSheetFlatList, BottomSheetScrollView, BottomSheetSectionList, BottomSheetView, BottomSheetVirtualizedList, } from '@gorhom/bottom-sheet';
|
|
3
4
|
//# sourceMappingURL=public.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/features/bottom-sheet/public.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/features/bottom-sheet/public.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,eAAe,EACf,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC","sourcesContent":["export type {\n BottomSheetContentMode,\n BottomSheetController,\n BottomSheetPresentOptions,\n} from '../../types/bottomSheet';\nexport { BottomSheetProvider } from './BottomSheetProvider';\nexport { useBottomSheet } from './useBottomSheet';\nexport {\n BottomSheetFlatList,\n BottomSheetScrollView,\n BottomSheetSectionList,\n BottomSheetView,\n BottomSheetVirtualizedList,\n} from '@gorhom/bottom-sheet';\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PopoverMenuProps } from '../../../../types/popoverMenu';
|
|
3
|
+
/*** Presents an anchored action menu using the shared Popover capability. */
|
|
4
|
+
export declare function PopoverMenu({ trigger, actions, dismiss, closeOnSelect, interactionPolicy, testID, }: PopoverMenuProps): React.JSX.Element;
|
|
5
|
+
//# sourceMappingURL=PopoverMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PopoverMenu.d.ts","sourceRoot":"","sources":["../../../../../src/features/popover-menu/adapters/inbound/PopoverMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,KAAK,EAAqB,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAQzF,6EAA6E;AAC7E,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,OAAO,EACP,OAAO,EACP,aAAoB,EACpB,iBAA6B,EAC7B,MAAM,GACP,EAAE,gBAAgB,qBAyBlB"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Pressable } from 'react-native';
|
|
3
|
+
import { FocusScope } from '../../../../internal/focus/FocusScope';
|
|
4
|
+
import { useFocusManager } from '../../../../internal/focus/useFocusManager';
|
|
5
|
+
import { Inline } from '../../../../layout';
|
|
6
|
+
import { useTheme } from '../../../../theme/ThemeContext';
|
|
7
|
+
import { Box, Stack } from '../../../layout/public';
|
|
8
|
+
import { Popover } from '../../../popover/public';
|
|
9
|
+
import { Surface } from '../../../surface/public';
|
|
10
|
+
import { Text } from '../../../typography/public';
|
|
11
|
+
import { usePopoverMenuController } from '../../composition/usePopoverMenuController';
|
|
12
|
+
import { resolveNextMenuIndex } from '../../utils/resolveNextMenuIndex';
|
|
13
|
+
/*** Presents an anchored action menu using the shared Popover capability. */
|
|
14
|
+
export function PopoverMenu({ trigger, actions, dismiss, closeOnSelect = true, interactionPolicy = 'enabled', testID, }) {
|
|
15
|
+
const passive = interactionPolicy === 'passive';
|
|
16
|
+
const controller = usePopoverMenuController({ actions, closeOnSelect, dismiss, passive });
|
|
17
|
+
return (<Popover anchor={trigger} closeOnOutsidePress interactionPolicy={interactionPolicy} onOpenChange={controller.handleOpenChange} open={controller.open} placement="bottom-start" testID={testID}>
|
|
18
|
+
<PopoverMenuContent actions={actions} activeIndex={controller.activeIndex} activateAction={controller.activateAction} close={controller.close} passive={passive} setActiveIndex={controller.setActiveIndex} testID={testID}/>
|
|
19
|
+
</Popover>);
|
|
20
|
+
}
|
|
21
|
+
/*** Renders menu semantics and keyboard navigation inside an open Popover. */
|
|
22
|
+
function PopoverMenuContent({ actions, activeIndex, activateAction, close, passive, setActiveIndex, testID, }) {
|
|
23
|
+
usePopoverMenuKeyboard({ actions, activeIndex, activateAction, close, passive, setActiveIndex });
|
|
24
|
+
return (<FocusScope active onEscape={passive ? undefined : close}>
|
|
25
|
+
<Surface accessibilityRole="menu" p="xs" testID={testID} variant="raised">
|
|
26
|
+
{actions.map((action, index) => (<PopoverMenuItem action={action} active={index === activeIndex} activateAction={activateAction} key={action.id} passive={passive} testID={testID}/>))}
|
|
27
|
+
</Surface>
|
|
28
|
+
</FocusScope>);
|
|
29
|
+
}
|
|
30
|
+
/*** Subscribes an open PopoverMenu to standard menu keyboard controls. */
|
|
31
|
+
function usePopoverMenuKeyboard({ actions, activeIndex, activateAction, close, passive, setActiveIndex, }) {
|
|
32
|
+
const { bindKeydown } = useFocusManager();
|
|
33
|
+
React.useEffect(() => bindKeydown((event) => {
|
|
34
|
+
if (passive)
|
|
35
|
+
return;
|
|
36
|
+
const { key } = event;
|
|
37
|
+
if (key === undefined)
|
|
38
|
+
return;
|
|
39
|
+
if (['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(key)) {
|
|
40
|
+
event.preventDefault();
|
|
41
|
+
setActiveIndex((current) => resolveNextMenuIndex(actions, current, key));
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (key === 'Enter') {
|
|
45
|
+
event.preventDefault();
|
|
46
|
+
const action = actions.at(activeIndex);
|
|
47
|
+
if (action)
|
|
48
|
+
activateAction(action);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (key === 'Escape') {
|
|
52
|
+
event.preventDefault();
|
|
53
|
+
close();
|
|
54
|
+
}
|
|
55
|
+
}), [actions, activeIndex, activateAction, bindKeydown, close, passive, setActiveIndex]);
|
|
56
|
+
}
|
|
57
|
+
/*** Renders one accessible PopoverMenu action row. */
|
|
58
|
+
function PopoverMenuItem({ action, active, activateAction, passive, testID, }) {
|
|
59
|
+
const { theme } = useTheme();
|
|
60
|
+
const selected = action.selected ?? active;
|
|
61
|
+
return (<Pressable accessibilityRole="menuitem" accessibilityState={{ disabled: action.disabled, selected }} disabled={action.disabled} onPress={passive ? undefined : () => activateAction(action)} testID={testID ? `${testID}-item-${action.id}` : undefined}>
|
|
62
|
+
<Box bg={selected ? theme.semantics.action.neutral.softBg : 'transparent'} opacity={action.disabled ? 0.56 : 1} px="m" py="s" radius="s">
|
|
63
|
+
<PopoverMenuItemContent action={action} active={active}/>
|
|
64
|
+
</Box>
|
|
65
|
+
</Pressable>);
|
|
66
|
+
}
|
|
67
|
+
/*** Renders the leading, textual, and trailing content of one menu action. */
|
|
68
|
+
function PopoverMenuItemContent({ action, active, }) {
|
|
69
|
+
const titleColor = action.intent === 'danger' ? 'danger' : active || action.selected ? 'neutral' : undefined;
|
|
70
|
+
return (<Inline align="center" gap="s" justify="space-between" wrap="nowrap">
|
|
71
|
+
{action.leading ? <Box>{action.leading}</Box> : null}
|
|
72
|
+
<Box flex={1}>
|
|
73
|
+
<Stack gap="xxs">
|
|
74
|
+
<Text color={titleColor} variant="bodySmall" weight={action.selected ? 'semiBold' : 'medium'}>
|
|
75
|
+
{action.title}
|
|
76
|
+
</Text>
|
|
77
|
+
{action.description ? (<Text emphasis="muted" variant="caption">
|
|
78
|
+
{action.description}
|
|
79
|
+
</Text>) : null}
|
|
80
|
+
</Stack>
|
|
81
|
+
</Box>
|
|
82
|
+
{action.trailing ? <Box>{action.trailing}</Box> : null}
|
|
83
|
+
</Inline>);
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=PopoverMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PopoverMenu.js","sourceRoot":"","sources":["../../../../../src/features/popover-menu/adapters/inbound/PopoverMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAE1D,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AACtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAExE,6EAA6E;AAC7E,MAAM,UAAU,WAAW,CAAC,EAC1B,OAAO,EACP,OAAO,EACP,OAAO,EACP,aAAa,GAAG,IAAI,EACpB,iBAAiB,GAAG,SAAS,EAC7B,MAAM,GACW;IACjB,MAAM,OAAO,GAAG,iBAAiB,KAAK,SAAS,CAAC;IAChD,MAAM,UAAU,GAAG,wBAAwB,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IAE1F,OAAO,CACL,CAAC,OAAO,CACN,MAAM,CAAC,CAAC,OAAO,CAAC,CAChB,mBAAmB,CACnB,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,CACrC,YAAY,CAAC,CAAC,UAAU,CAAC,gBAAgB,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AC,MAAM,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CACxD;IAAA,EAAE,MAAM,CAAC,CACV,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport { Pressable } from 'react-native';\n\nimport { FocusScope } from '../../../../internal/focus/FocusScope';\nimport { useFocusManager } from '../../../../internal/focus/useFocusManager';\nimport { Inline } from '../../../../layout';\nimport { useTheme } from '../../../../theme/ThemeContext';\nimport type { PopoverMenuAction, PopoverMenuProps } from '../../../../types/popoverMenu';\nimport { Box, Stack } from '../../../layout/public';\nimport { Popover } from '../../../popover/public';\nimport { Surface } from '../../../surface/public';\nimport { Text } from '../../../typography/public';\nimport { usePopoverMenuController } from '../../composition/usePopoverMenuController';\nimport { resolveNextMenuIndex } from '../../utils/resolveNextMenuIndex';\n\n/*** Presents an anchored action menu using the shared Popover capability. */\nexport function PopoverMenu({\n trigger,\n actions,\n dismiss,\n closeOnSelect = true,\n interactionPolicy = 'enabled',\n testID,\n}: PopoverMenuProps) {\n const passive = interactionPolicy === 'passive';\n const controller = usePopoverMenuController({ actions, closeOnSelect, dismiss, passive });\n\n return (\n <Popover\n anchor={trigger}\n closeOnOutsidePress\n interactionPolicy={interactionPolicy}\n onOpenChange={controller.handleOpenChange}\n open={controller.open}\n placement=\"bottom-start\"\n testID={testID}\n >\n <PopoverMenuContent\n actions={actions}\n activeIndex={controller.activeIndex}\n activateAction={controller.activateAction}\n close={controller.close}\n passive={passive}\n setActiveIndex={controller.setActiveIndex}\n testID={testID}\n />\n </Popover>\n );\n}\n\ninterface PopoverMenuContentProps {\n actions: readonly PopoverMenuAction[];\n activeIndex: number;\n activateAction: (action: PopoverMenuAction) => void;\n close: () => void;\n passive: boolean;\n setActiveIndex: React.Dispatch<React.SetStateAction<number>>;\n testID?: string;\n}\n\n/*** Renders menu semantics and keyboard navigation inside an open Popover. */\nfunction PopoverMenuContent({\n actions,\n activeIndex,\n activateAction,\n close,\n passive,\n setActiveIndex,\n testID,\n}: PopoverMenuContentProps) {\n usePopoverMenuKeyboard({ actions, activeIndex, activateAction, close, passive, setActiveIndex });\n\n return (\n <FocusScope active onEscape={passive ? undefined : close}>\n <Surface accessibilityRole=\"menu\" p=\"xs\" testID={testID} variant=\"raised\">\n {actions.map((action, index) => (\n <PopoverMenuItem\n action={action}\n active={index === activeIndex}\n activateAction={activateAction}\n key={action.id}\n passive={passive}\n testID={testID}\n />\n ))}\n </Surface>\n </FocusScope>\n );\n}\n\n/*** Subscribes an open PopoverMenu to standard menu keyboard controls. */\nfunction usePopoverMenuKeyboard({\n actions,\n activeIndex,\n activateAction,\n close,\n passive,\n setActiveIndex,\n}: Omit<PopoverMenuContentProps, 'testID'>) {\n const { bindKeydown } = useFocusManager();\n\n React.useEffect(\n () =>\n bindKeydown((event) => {\n if (passive) return;\n\n const { key } = event;\n if (key === undefined) return;\n\n if (['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(key)) {\n event.preventDefault();\n setActiveIndex((current) => resolveNextMenuIndex(actions, current, key));\n return;\n }\n if (key === 'Enter') {\n event.preventDefault();\n const action = actions.at(activeIndex);\n if (action) activateAction(action);\n return;\n }\n if (key === 'Escape') {\n event.preventDefault();\n close();\n }\n }),\n [actions, activeIndex, activateAction, bindKeydown, close, passive, setActiveIndex],\n );\n}\n\n/*** Renders one accessible PopoverMenu action row. */\nfunction PopoverMenuItem({\n action,\n active,\n activateAction,\n passive,\n testID,\n}: {\n action: PopoverMenuAction;\n active: boolean;\n activateAction: (action: PopoverMenuAction) => void;\n passive: boolean;\n testID?: string;\n}) {\n const { theme } = useTheme();\n const selected = action.selected ?? active;\n\n return (\n <Pressable\n accessibilityRole=\"menuitem\"\n accessibilityState={{ disabled: action.disabled, selected }}\n disabled={action.disabled}\n onPress={passive ? undefined : () => activateAction(action)}\n testID={testID ? `${testID}-item-${action.id}` : undefined}\n >\n <Box\n bg={selected ? theme.semantics.action.neutral.softBg : 'transparent'}\n opacity={action.disabled ? 0.56 : 1}\n px=\"m\"\n py=\"s\"\n radius=\"s\"\n >\n <PopoverMenuItemContent action={action} active={active} />\n </Box>\n </Pressable>\n );\n}\n\n/*** Renders the leading, textual, and trailing content of one menu action. */\nfunction PopoverMenuItemContent({\n action,\n active,\n}: {\n action: PopoverMenuAction;\n active: boolean;\n}) {\n const titleColor =\n action.intent === 'danger' ? 'danger' : active || action.selected ? 'neutral' : undefined;\n\n return (\n <Inline align=\"center\" gap=\"s\" justify=\"space-between\" wrap=\"nowrap\">\n {action.leading ? <Box>{action.leading}</Box> : null}\n <Box flex={1}>\n <Stack gap=\"xxs\">\n <Text\n color={titleColor}\n variant=\"bodySmall\"\n weight={action.selected ? 'semiBold' : 'medium'}\n >\n {action.title}\n </Text>\n {action.description ? (\n <Text emphasis=\"muted\" variant=\"caption\">\n {action.description}\n </Text>\n ) : null}\n </Stack>\n </Box>\n {action.trailing ? <Box>{action.trailing}</Box> : null}\n </Inline>\n );\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PopoverMenuAction } from '../../../types/popoverMenu';
|
|
3
|
+
interface PopoverMenuControllerOptions {
|
|
4
|
+
actions: readonly PopoverMenuAction[];
|
|
5
|
+
closeOnSelect: boolean;
|
|
6
|
+
dismiss?: () => void;
|
|
7
|
+
passive: boolean;
|
|
8
|
+
}
|
|
9
|
+
/*** Owns PopoverMenu visibility, active action state, and selection behavior. */
|
|
10
|
+
export declare function usePopoverMenuController({ actions, closeOnSelect, dismiss, passive, }: PopoverMenuControllerOptions): {
|
|
11
|
+
readonly activeIndex: number;
|
|
12
|
+
readonly activateAction: (action: PopoverMenuAction) => void;
|
|
13
|
+
readonly close: () => void;
|
|
14
|
+
readonly handleOpenChange: (nextOpen: boolean) => void;
|
|
15
|
+
readonly open: boolean;
|
|
16
|
+
readonly setActiveIndex: React.Dispatch<React.SetStateAction<number>>;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=usePopoverMenuController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePopoverMenuController.d.ts","sourceRoot":"","sources":["../../../../src/features/popover-menu/composition/usePopoverMenuController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,UAAU,4BAA4B;IACpC,OAAO,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACtC,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,iFAAiF;AACjF,wBAAgB,wBAAwB,CAAC,EACvC,OAAO,EACP,aAAa,EACb,OAAO,EACP,OAAO,GACR,EAAE,4BAA4B;;sCAelB,iBAAiB;;0CAVf,OAAO;;;EA0BrB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/*** Owns PopoverMenu visibility, active action state, and selection behavior. */
|
|
3
|
+
export function usePopoverMenuController({ actions, closeOnSelect, dismiss, passive, }) {
|
|
4
|
+
const [open, setOpen] = React.useState(false);
|
|
5
|
+
const [activeIndex, setActiveIndex] = React.useState(0);
|
|
6
|
+
const handleOpenChange = React.useCallback((nextOpen) => {
|
|
7
|
+
if (nextOpen)
|
|
8
|
+
setActiveIndex(resolveInitialIndex(actions));
|
|
9
|
+
if (open && !nextOpen)
|
|
10
|
+
dismiss?.();
|
|
11
|
+
setOpen(nextOpen);
|
|
12
|
+
}, [actions, dismiss, open]);
|
|
13
|
+
const close = React.useCallback(() => handleOpenChange(false), [handleOpenChange]);
|
|
14
|
+
const activateAction = React.useCallback((action) => {
|
|
15
|
+
if (action.disabled || passive)
|
|
16
|
+
return;
|
|
17
|
+
action.activate?.();
|
|
18
|
+
if (closeOnSelect)
|
|
19
|
+
close();
|
|
20
|
+
}, [close, closeOnSelect, passive]);
|
|
21
|
+
return {
|
|
22
|
+
activeIndex,
|
|
23
|
+
activateAction,
|
|
24
|
+
close,
|
|
25
|
+
handleOpenChange,
|
|
26
|
+
open,
|
|
27
|
+
setActiveIndex,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/*** Returns the first enabled action index for a newly opened menu. */
|
|
31
|
+
function resolveInitialIndex(actions) {
|
|
32
|
+
const index = actions.findIndex((action) => !action.disabled);
|
|
33
|
+
return index === -1 ? 0 : index;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=usePopoverMenuController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePopoverMenuController.js","sourceRoot":"","sources":["../../../../src/features/popover-menu/composition/usePopoverMenuController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,iFAAiF;AACjF,MAAM,UAAU,wBAAwB,CAAC,EACvC,OAAO,EACP,aAAa,EACb,OAAO,EACP,OAAO,GACsB;IAC7B,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAExD,MAAM,gBAAgB,GAAG,KAAK,CAAC,WAAW,CACxC,CAAC,QAAiB,EAAE,EAAE;QACpB,IAAI,QAAQ;YAAE,cAAc,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC;QAC3D,IAAI,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO,EAAE,EAAE,CAAC;QACnC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACpB,CAAC,EACD,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CACzB,CAAC;IAEF,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACnF,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CACtC,CAAC,MAAyB,EAAE,EAAE;QAC5B,IAAI,MAAM,CAAC,QAAQ,IAAI,OAAO;YAAE,OAAO;QACvC,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;QACpB,IAAI,aAAa;YAAE,KAAK,EAAE,CAAC;IAC7B,CAAC,EACD,CAAC,KAAK,EAAE,aAAa,EAAE,OAAO,CAAC,CAChC,CAAC;IAEF,OAAO;QACL,WAAW;QACX,cAAc;QACd,KAAK;QACL,gBAAgB;QAChB,IAAI;QACJ,cAAc;KACN,CAAC;AACb,CAAC;AAED,uEAAuE;AACvE,SAAS,mBAAmB,CAAC,OAAqC;IAChE,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC9D,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAClC,CAAC","sourcesContent":["import React from 'react';\n\nimport type { PopoverMenuAction } from '../../../types/popoverMenu';\n\ninterface PopoverMenuControllerOptions {\n actions: readonly PopoverMenuAction[];\n closeOnSelect: boolean;\n dismiss?: () => void;\n passive: boolean;\n}\n\n/*** Owns PopoverMenu visibility, active action state, and selection behavior. */\nexport function usePopoverMenuController({\n actions,\n closeOnSelect,\n dismiss,\n passive,\n}: PopoverMenuControllerOptions) {\n const [open, setOpen] = React.useState(false);\n const [activeIndex, setActiveIndex] = React.useState(0);\n\n const handleOpenChange = React.useCallback(\n (nextOpen: boolean) => {\n if (nextOpen) setActiveIndex(resolveInitialIndex(actions));\n if (open && !nextOpen) dismiss?.();\n setOpen(nextOpen);\n },\n [actions, dismiss, open],\n );\n\n const close = React.useCallback(() => handleOpenChange(false), [handleOpenChange]);\n const activateAction = React.useCallback(\n (action: PopoverMenuAction) => {\n if (action.disabled || passive) return;\n action.activate?.();\n if (closeOnSelect) close();\n },\n [close, closeOnSelect, passive],\n );\n\n return {\n activeIndex,\n activateAction,\n close,\n handleOpenChange,\n open,\n setActiveIndex,\n } as const;\n}\n\n/*** Returns the first enabled action index for a newly opened menu. */\nfunction resolveInitialIndex(actions: readonly PopoverMenuAction[]): number {\n const index = actions.findIndex((action) => !action.disabled);\n return index === -1 ? 0 : index;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/features/popover-menu/public.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,iBAAiB,EACjB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/features/popover-menu/public.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC","sourcesContent":["export type {\n PopoverMenuAction,\n PopoverMenuActionIntent,\n PopoverMenuProps,\n} from '../../types/popoverMenu';\nexport { PopoverMenu } from './adapters/inbound/PopoverMenu';\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*** Resolves the next enabled action index for standard menu keyboard navigation. */
|
|
2
|
+
export declare function resolveNextMenuIndex(items: readonly {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
}[], currentIndex: number, key: string): number;
|
|
5
|
+
//# sourceMappingURL=resolveNextMenuIndex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveNextMenuIndex.d.ts","sourceRoot":"","sources":["../../../../src/features/popover-menu/utils/resolveNextMenuIndex.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,EAAE,EACxC,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,MAAM,GACV,MAAM,CAeR"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*** Resolves the next enabled action index for standard menu keyboard navigation. */
|
|
2
|
+
export function resolveNextMenuIndex(items, currentIndex, key) {
|
|
3
|
+
const enabledIndexes = items.flatMap((item, index) => (item.disabled ? [] : [index]));
|
|
4
|
+
if (enabledIndexes.length === 0)
|
|
5
|
+
return -1;
|
|
6
|
+
if (key === 'Home')
|
|
7
|
+
return enabledIndexes.at(0) ?? -1;
|
|
8
|
+
if (key === 'End')
|
|
9
|
+
return enabledIndexes.at(-1) ?? -1;
|
|
10
|
+
const activeEnabledIndex = enabledIndexes.indexOf(currentIndex);
|
|
11
|
+
const nextEnabledIndex = activeEnabledIndex === -1
|
|
12
|
+
? 0
|
|
13
|
+
: key === 'ArrowUp'
|
|
14
|
+
? (activeEnabledIndex - 1 + enabledIndexes.length) % enabledIndexes.length
|
|
15
|
+
: (activeEnabledIndex + 1) % enabledIndexes.length;
|
|
16
|
+
return enabledIndexes.at(nextEnabledIndex) ?? -1;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=resolveNextMenuIndex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveNextMenuIndex.js","sourceRoot":"","sources":["../../../../src/features/popover-menu/utils/resolveNextMenuIndex.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,MAAM,UAAU,oBAAoB,CAClC,KAAwC,EACxC,YAAoB,EACpB,GAAW;IAEX,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACtF,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC,CAAC;IAC3C,IAAI,GAAG,KAAK,MAAM;QAAE,OAAO,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACtD,IAAI,GAAG,KAAK,KAAK;QAAE,OAAO,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAEtD,MAAM,kBAAkB,GAAG,cAAc,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAChE,MAAM,gBAAgB,GACpB,kBAAkB,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;QACH,CAAC,CAAC,GAAG,KAAK,SAAS;YACjB,CAAC,CAAC,CAAC,kBAAkB,GAAG,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,GAAG,cAAc,CAAC,MAAM;YAC1E,CAAC,CAAC,CAAC,kBAAkB,GAAG,CAAC,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC;IAEzD,OAAO,cAAc,CAAC,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;AACnD,CAAC","sourcesContent":["/*** Resolves the next enabled action index for standard menu keyboard navigation. */\nexport function resolveNextMenuIndex(\n items: readonly { disabled?: boolean }[],\n currentIndex: number,\n key: string,\n): number {\n const enabledIndexes = items.flatMap((item, index) => (item.disabled ? [] : [index]));\n if (enabledIndexes.length === 0) return -1;\n if (key === 'Home') return enabledIndexes.at(0) ?? -1;\n if (key === 'End') return enabledIndexes.at(-1) ?? -1;\n\n const activeEnabledIndex = enabledIndexes.indexOf(currentIndex);\n const nextEnabledIndex =\n activeEnabledIndex === -1\n ? 0\n : key === 'ArrowUp'\n ? (activeEnabledIndex - 1 + enabledIndexes.length) % enabledIndexes.length\n : (activeEnabledIndex + 1) % enabledIndexes.length;\n\n return enabledIndexes.at(nextEnabledIndex) ?? -1;\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TooltipProps } from '../../../../types/tooltip';
|
|
3
|
+
/*** Presents delayed hover/focus help through the shared Popover foundation. */
|
|
4
|
+
export declare function Tooltip({ children, content, delay, interactionPolicy, placement, testID, }: TooltipProps): React.JSX.Element;
|
|
5
|
+
//# sourceMappingURL=Tooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../../../src/features/tooltip/adapters/inbound/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAM9D,gFAAgF;AAChF,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,OAAO,EACP,KAAW,EACX,iBAA6B,EAC7B,SAAiB,EACjB,MAAM,GACP,EAAE,YAAY,qBAqCd"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Platform, Pressable, View } from 'react-native';
|
|
3
|
+
import { useTheme } from '../../../../theme/ThemeContext';
|
|
4
|
+
import { Popover } from '../../../popover/public';
|
|
5
|
+
import { Surface } from '../../../surface/public';
|
|
6
|
+
import { Text } from '../../../typography/public';
|
|
7
|
+
import { useTooltipVisibility } from '../../composition/useTooltipVisibility';
|
|
8
|
+
/*** Presents delayed hover/focus help through the shared Popover foundation. */
|
|
9
|
+
export function Tooltip({ children, content, delay = 150, interactionPolicy = 'enabled', placement = 'top', testID, }) {
|
|
10
|
+
const { theme } = useTheme();
|
|
11
|
+
const passive = interactionPolicy === 'passive';
|
|
12
|
+
const { hide, setVisible, show, visible } = useTooltipVisibility(delay, passive);
|
|
13
|
+
return (<Popover closeOnOutsidePress={false} interactionPolicy={interactionPolicy} onOpenChange={setVisible} open={visible} placement={placement} testID={testID} anchor={() => (<Pressable onBlur={passive ? undefined : hide} onFocus={passive ? undefined : show} onHoverIn={Platform.OS === 'web' && !passive ? show : undefined} onHoverOut={Platform.OS === 'web' && !passive ? hide : undefined}>
|
|
14
|
+
{children}
|
|
15
|
+
</Pressable>)}>
|
|
16
|
+
<View pointerEvents="none">
|
|
17
|
+
<Surface p="s" style={{ backgroundColor: theme.semantics.surface.inverse }} variant="raised">
|
|
18
|
+
<Text emphasis="inverse" variant="caption">
|
|
19
|
+
{content}
|
|
20
|
+
</Text>
|
|
21
|
+
</Surface>
|
|
22
|
+
</View>
|
|
23
|
+
</Popover>);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=Tooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../../../src/features/tooltip/adapters/inbound/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAE9E,gFAAgF;AAChF,MAAM,UAAU,OAAO,CAAC,EACtB,QAAQ,EACR,OAAO,EACP,KAAK,GAAG,GAAG,EACX,iBAAiB,GAAG,SAAS,EAC7B,SAAS,GAAG,KAAK,EACjB,MAAM,GACO;IACb,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,OAAO,GAAG,iBAAiB,KAAK,SAAS,CAAC;IAChD,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,oBAAoB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAEjF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cesContent":["import React from 'react';\nimport { Platform, Pressable, View } from 'react-native';\n\nimport { useTheme } from '../../../../theme/ThemeContext';\nimport type { TooltipProps } from '../../../../types/tooltip';\nimport { Popover } from '../../../popover/public';\nimport { Surface } from '../../../surface/public';\nimport { Text } from '../../../typography/public';\nimport { useTooltipVisibility } from '../../composition/useTooltipVisibility';\n\n/*** Presents delayed hover/focus help through the shared Popover foundation. */\nexport function Tooltip({\n children,\n content,\n delay = 150,\n interactionPolicy = 'enabled',\n placement = 'top',\n testID,\n}: TooltipProps) {\n const { theme } = useTheme();\n const passive = interactionPolicy === 'passive';\n const { hide, setVisible, show, visible } = useTooltipVisibility(delay, passive);\n\n return (\n <Popover\n closeOnOutsidePress={false}\n interactionPolicy={interactionPolicy}\n onOpenChange={setVisible}\n open={visible}\n placement={placement}\n testID={testID}\n anchor={() => (\n <Pressable\n onBlur={passive ? undefined : hide}\n onFocus={passive ? undefined : show}\n onHoverIn={Platform.OS === 'web' && !passive ? show : undefined}\n onHoverOut={Platform.OS === 'web' && !passive ? hide : undefined}\n >\n {children}\n </Pressable>\n )}\n >\n <View pointerEvents=\"none\">\n <Surface\n p=\"s\"\n style={{ backgroundColor: theme.semantics.surface.inverse }}\n variant=\"raised\"\n >\n <Text emphasis=\"inverse\" variant=\"caption\">\n {content}\n </Text>\n </Surface>\n </View>\n </Popover>\n );\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/*** Manages delayed tooltip visibility and timer cleanup. */
|
|
3
|
+
export declare function useTooltipVisibility(delay: number, passive: boolean): {
|
|
4
|
+
readonly hide: () => void;
|
|
5
|
+
readonly setVisible: React.Dispatch<React.SetStateAction<boolean>>;
|
|
6
|
+
readonly show: () => void;
|
|
7
|
+
readonly visible: boolean;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=useTooltipVisibility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTooltipVisibility.d.ts","sourceRoot":"","sources":["../../../../src/features/tooltip/composition/useTooltipVisibility.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,6DAA6D;AAC7D,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;;;;;EAyBnE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/*** Manages delayed tooltip visibility and timer cleanup. */
|
|
3
|
+
export function useTooltipVisibility(delay, passive) {
|
|
4
|
+
const timeoutRef = React.useRef(null);
|
|
5
|
+
const [visible, setVisible] = React.useState(false);
|
|
6
|
+
const clearTimer = React.useCallback(() => {
|
|
7
|
+
if (timeoutRef.current) {
|
|
8
|
+
clearTimeout(timeoutRef.current);
|
|
9
|
+
timeoutRef.current = null;
|
|
10
|
+
}
|
|
11
|
+
}, []);
|
|
12
|
+
const show = React.useCallback(() => {
|
|
13
|
+
if (passive)
|
|
14
|
+
return;
|
|
15
|
+
clearTimer();
|
|
16
|
+
timeoutRef.current = setTimeout(() => setVisible(true), delay);
|
|
17
|
+
}, [clearTimer, delay, passive]);
|
|
18
|
+
const hide = React.useCallback(() => {
|
|
19
|
+
clearTimer();
|
|
20
|
+
setVisible(false);
|
|
21
|
+
}, [clearTimer]);
|
|
22
|
+
React.useEffect(() => clearTimer, [clearTimer]);
|
|
23
|
+
return { hide, setVisible, show, visible };
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=useTooltipVisibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTooltipVisibility.js","sourceRoot":"","sources":["../../../../src/features/tooltip/composition/useTooltipVisibility.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,6DAA6D;AAC7D,MAAM,UAAU,oBAAoB,CAAC,KAAa,EAAE,OAAgB;IAClE,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAuC,IAAI,CAAC,CAAC;IAC5E,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEpD,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACxC,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;YACvB,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YACjC,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC;QAC5B,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QAClC,IAAI,OAAO;YAAE,OAAO;QACpB,UAAU,EAAE,CAAC;QACb,UAAU,CAAC,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;IACjE,CAAC,EAAE,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IAEjC,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QAClC,UAAU,EAAE,CAAC;QACb,UAAU,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAEjB,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,UAAU,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAEhD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAW,CAAC;AACtD,CAAC","sourcesContent":["import React from 'react';\n\n/*** Manages delayed tooltip visibility and timer cleanup. */\nexport function useTooltipVisibility(delay: number, passive: boolean) {\n const timeoutRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n const [visible, setVisible] = React.useState(false);\n\n const clearTimer = React.useCallback(() => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n }, []);\n\n const show = React.useCallback(() => {\n if (passive) return;\n clearTimer();\n timeoutRef.current = setTimeout(() => setVisible(true), delay);\n }, [clearTimer, delay, passive]);\n\n const hide = React.useCallback(() => {\n clearTimer();\n setVisible(false);\n }, [clearTimer]);\n\n React.useEffect(() => clearTimer, [clearTimer]);\n\n return { hide, setVisible, show, visible } as const;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/features/tooltip/public.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/features/tooltip/public.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC","sourcesContent":["export type { TooltipProps } from '../../types/tooltip';\nexport { Tooltip } from './adapters/inbound/Tooltip';\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,8 +6,6 @@ export type { LabelProps } from './components/label';
|
|
|
6
6
|
export { Label } from './components/label';
|
|
7
7
|
export type { ListItemProps } from './components/list-item';
|
|
8
8
|
export { ListItem } from './components/list-item';
|
|
9
|
-
export type { MenuAction, MenuActionIntent, MenuItem, MenuProps } from './components/menu';
|
|
10
|
-
export { Menu } from './components/menu';
|
|
11
9
|
export type { ModalProps } from './components/modal';
|
|
12
10
|
export { Modal } from './components/modal';
|
|
13
11
|
export type { SwitchProps } from './components/switch';
|
|
@@ -16,8 +14,6 @@ export type { TabListProps, TabPanelProps, TabProps, TabsProps } from './compone
|
|
|
16
14
|
export { Tab, TabList, TabPanel, Tabs } from './components/tabs';
|
|
17
15
|
export type { TextareaProps } from './components/textarea';
|
|
18
16
|
export { Textarea } from './components/textarea';
|
|
19
|
-
export type { TooltipProps } from './components/tooltip';
|
|
20
|
-
export { Tooltip } from './components/tooltip';
|
|
21
17
|
export type { FontRuntime } from './context/FontContext';
|
|
22
18
|
export { FontProvider, useFontContext } from './context/FontContext';
|
|
23
19
|
export type { I18nInstance, TranslationRuntime, Translator } from './context/TranslationContext';
|
|
@@ -47,10 +43,14 @@ export type { BoxProps, ContainerProps, DividerProps, GridProps, StackProps, } f
|
|
|
47
43
|
export { Box, Container, Divider, Grid, Stack } from './features/layout/public';
|
|
48
44
|
export type { PopoverAnchorRenderProps, PopoverPlacement, PopoverProps, } from './features/popover/public';
|
|
49
45
|
export { Popover } from './features/popover/public';
|
|
46
|
+
export type { PopoverMenuAction, PopoverMenuActionIntent, PopoverMenuProps, } from './features/popover-menu/public';
|
|
47
|
+
export { PopoverMenu } from './features/popover-menu/public';
|
|
50
48
|
export type { SurfaceProps, SurfaceVariant } from './features/surface/public';
|
|
51
49
|
export { Surface } from './features/surface/public';
|
|
52
50
|
export type { ToastController, ToastOptions, ToastProps, ToastProviderProps, ToastStatus, } from './features/toast/public';
|
|
53
51
|
export { Toast, ToastProvider, useToast } from './features/toast/public';
|
|
52
|
+
export type { TooltipProps } from './features/tooltip/public';
|
|
53
|
+
export { Tooltip } from './features/tooltip/public';
|
|
54
54
|
export type { HeadingLevel, HeadingProps, TextProps } from './features/typography/public';
|
|
55
55
|
export { Heading, Text } from './features/typography/public';
|
|
56
56
|
export type { InteractionPolicy, InteractionPolicyProps } from './interactionPolicy';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,YAAY,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,YAAY,EAAE,UAAU,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EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAC7D,YAAY,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACrF,cAAc,UAAU,CAAC;AACzB,YAAY,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,YAAY,EACV,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,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"}
|
package/dist/index.js
CHANGED
|
@@ -2,12 +2,10 @@ export { Field } from './components/field';
|
|
|
2
2
|
export { HelperText } from './components/helper-text';
|
|
3
3
|
export { Label } from './components/label';
|
|
4
4
|
export { ListItem } from './components/list-item';
|
|
5
|
-
export { Menu } from './components/menu';
|
|
6
5
|
export { Modal } from './components/modal';
|
|
7
6
|
export { Switch } from './components/switch';
|
|
8
7
|
export { Tab, TabList, TabPanel, Tabs } from './components/tabs';
|
|
9
8
|
export { Textarea } from './components/textarea';
|
|
10
|
-
export { Tooltip } from './components/tooltip';
|
|
11
9
|
export { FontProvider, useFontContext } from './context/FontContext';
|
|
12
10
|
export { TranslationProvider, useTranslationContext } from './context/TranslationContext';
|
|
13
11
|
export * from './core/responsive';
|
|
@@ -23,8 +21,10 @@ export { Image } from './features/image/public';
|
|
|
23
21
|
export { KeyboardAvoidingView } from './features/keyboard-avoiding-view/public';
|
|
24
22
|
export { Box, Container, Divider, Grid, Stack } from './features/layout/public';
|
|
25
23
|
export { Popover } from './features/popover/public';
|
|
24
|
+
export { PopoverMenu } from './features/popover-menu/public';
|
|
26
25
|
export { Surface } from './features/surface/public';
|
|
27
26
|
export { Toast, ToastProvider, useToast } from './features/toast/public';
|
|
27
|
+
export { Tooltip } from './features/tooltip/public';
|
|
28
28
|
export { Heading, Text } from './features/typography/public';
|
|
29
29
|
export * from './layout';
|
|
30
30
|
export { ButtonBase } from './primitives/button-base';
|
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,
|
|
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,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,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,cAAc,mBAAmB,CAAC;AAUlC,OAAO,EACL,SAAS,EACT,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AAmB,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 { 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 { 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 {\n PopoverMenuAction,\n PopoverMenuActionIntent,\n PopoverMenuProps,\n} from './features/popover-menu/public';\nexport { PopoverMenu } from './features/popover-menu/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 { TooltipProps } from './features/tooltip/public';\nexport { Tooltip } from './features/tooltip/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"]}
|