@dxos/react-ui 0.8.4-main.406dc2a → 0.8.4-main.59c2e9b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/chunk-CEKVHJ27.mjs +774 -0
- package/dist/lib/browser/chunk-CEKVHJ27.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +3067 -64
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +34 -46
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node-esm/chunk-2NHEX4AD.mjs +776 -0
- package/dist/lib/node-esm/chunk-2NHEX4AD.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +3067 -64
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +34 -46
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- package/dist/types/src/components/{Buttons → Button}/Button.d.ts +1 -1
- package/dist/types/src/components/Button/Button.d.ts.map +1 -0
- package/dist/types/src/components/Button/Button.stories.d.ts.map +1 -0
- package/dist/types/src/components/{Buttons → Button}/IconButton.d.ts +2 -2
- package/dist/types/src/components/Button/IconButton.d.ts.map +1 -0
- package/dist/types/src/components/Button/IconButton.stories.d.ts.map +1 -0
- package/dist/types/src/components/Button/Toggle.d.ts.map +1 -0
- package/dist/types/src/components/Button/Toggle.stories.d.ts +16 -0
- package/dist/types/src/components/Button/Toggle.stories.d.ts.map +1 -0
- package/dist/types/src/components/{Buttons → Button}/ToggleGroup.d.ts +4 -4
- package/dist/types/src/components/Button/ToggleGroup.d.ts.map +1 -0
- package/dist/types/src/components/{Buttons → Button}/ToggleGroup.stories.d.ts +4 -4
- package/dist/types/src/components/Button/ToggleGroup.stories.d.ts.map +1 -0
- package/dist/types/src/components/Button/index.d.ts.map +1 -0
- package/dist/types/src/components/Clipboard/CopyButton.d.ts +1 -1
- package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -1
- package/dist/types/src/components/DensityProvider/DensityProvider.d.ts +1 -1
- package/dist/types/src/components/DensityProvider/DensityProvider.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/AlertDialog.d.ts.map +1 -0
- package/dist/types/src/components/Dialog/AlertDialog.stories.d.ts.map +1 -0
- package/dist/types/src/components/Dialog/Dialog.d.ts +40 -0
- package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -0
- package/dist/types/src/components/{Dialogs → Dialog}/Dialog.stories.d.ts +7 -5
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts.map +1 -0
- package/dist/types/src/components/Dialog/index.d.ts.map +1 -0
- package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts +1 -1
- package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts.map +1 -1
- package/dist/types/src/components/Icon/Icon.d.ts +1 -1
- package/dist/types/src/components/Icon/Icon.d.ts.map +1 -1
- package/dist/types/src/components/Icon/Icon.stories.d.ts +17 -0
- package/dist/types/src/components/Icon/Icon.stories.d.ts.map +1 -0
- package/dist/types/src/components/Input/Input.d.ts +5 -2
- package/dist/types/src/components/Input/Input.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/types/src/components/{Lists → List}/List.d.ts +1 -1
- package/dist/types/src/components/List/List.d.ts.map +1 -0
- package/dist/types/src/components/List/List.stories.d.ts.map +1 -0
- package/dist/types/src/components/List/ListDropIndicator.d.ts.map +1 -0
- package/dist/types/src/components/List/Tree.d.ts.map +1 -0
- package/dist/types/src/components/List/Tree.stories.d.ts.map +1 -0
- package/dist/types/src/components/List/TreeDropIndicator.d.ts.map +1 -0
- package/dist/types/src/components/List/Treegrid.d.ts.map +1 -0
- package/dist/types/src/components/List/Treegrid.stories.d.ts.map +1 -0
- package/dist/types/src/components/List/index.d.ts.map +1 -0
- package/dist/types/src/components/Main/Main.d.ts +8 -8
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/{Menus → Menu}/ContextMenu.d.ts +6 -6
- package/dist/types/src/components/Menu/ContextMenu.d.ts.map +1 -0
- package/dist/types/src/components/Menu/ContextMenu.stories.d.ts.map +1 -0
- package/dist/types/src/components/{Menus → Menu}/DropdownMenu.d.ts +3 -4
- package/dist/types/src/components/Menu/DropdownMenu.d.ts.map +1 -0
- package/dist/types/src/components/Menu/DropdownMenu.stories.d.ts.map +1 -0
- package/dist/types/src/components/Menu/index.d.ts.map +1 -0
- package/dist/types/src/components/Message/Message.d.ts +1 -1
- package/dist/types/src/components/Message/Message.d.ts.map +1 -1
- package/dist/types/src/components/Message/Message.stories.d.ts +1 -1
- package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts +9 -7
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +4 -0
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts +39 -0
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts.map +1 -0
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts +19 -0
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts.map +1 -0
- package/dist/types/src/components/ScrollContainer/index.d.ts +2 -0
- package/dist/types/src/components/ScrollContainer/index.d.ts.map +1 -0
- package/dist/types/src/components/Select/Select.d.ts +10 -10
- package/dist/types/src/components/Select/Select.d.ts.map +1 -1
- package/dist/types/src/components/Separator/Separator.d.ts +1 -1
- package/dist/types/src/components/Tag/Tag.d.ts +1 -1
- package/dist/types/src/components/Tag/Tag.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +1 -2
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts +1 -8
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/index.d.ts +2 -1
- package/dist/types/src/components/ThemeProvider/index.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.d.ts +4 -4
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +11 -9
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +5 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useDensityContext.d.ts +1 -1
- package/dist/types/src/hooks/useDensityContext.d.ts.map +1 -1
- package/dist/types/src/hooks/useElevationContext.d.ts +1 -1
- package/dist/types/src/hooks/useElevationContext.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/playground/Custom.stories.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/index.d.ts +1 -1
- package/dist/types/src/testing/decorators/index.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/withLayout.d.ts +3 -3
- package/dist/types/src/testing/decorators/withLayout.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/withLayoutVariants.d.ts +12 -0
- package/dist/types/src/testing/decorators/withLayoutVariants.d.ts.map +1 -0
- package/dist/types/src/testing/decorators/withTheme.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +1 -2
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +32 -24
- package/src/components/Avatars/Avatar.stories.tsx +2 -2
- package/src/components/Avatars/Avatar.tsx +1 -1
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +1 -1
- package/src/components/{Buttons → Button}/Button.stories.tsx +2 -2
- package/src/components/{Buttons → Button}/Button.tsx +1 -1
- package/src/components/{Buttons → Button}/IconButton.tsx +19 -13
- package/src/components/{Buttons → Button}/Toggle.stories.tsx +5 -4
- package/src/components/Clipboard/CopyButton.tsx +4 -4
- package/src/components/DensityProvider/DensityProvider.tsx +1 -1
- package/src/components/{Dialogs → Dialog}/AlertDialog.stories.tsx +1 -1
- package/src/components/Dialog/Dialog.stories.tsx +97 -0
- package/src/components/{Dialogs → Dialog}/Dialog.tsx +140 -40
- package/src/components/ElevationProvider/ElevationProvider.tsx +1 -1
- package/src/components/Icon/Icon.stories.tsx +113 -0
- package/src/components/Icon/Icon.tsx +2 -2
- package/src/components/Input/Input.stories.tsx +2 -2
- package/src/components/Input/Input.tsx +13 -4
- package/src/components/{Lists → List}/List.stories.tsx +17 -13
- package/src/components/{Lists → List}/List.tsx +1 -1
- package/src/components/{Lists → List}/ListDropIndicator.tsx +1 -1
- package/src/components/Main/Main.stories.tsx +1 -1
- package/src/components/Main/Main.tsx +13 -13
- package/src/components/{Menus → Menu}/DropdownMenu.stories.tsx +1 -1
- package/src/components/{Menus → Menu}/DropdownMenu.tsx +79 -58
- package/src/components/Message/Message.stories.tsx +1 -1
- package/src/components/Message/Message.tsx +30 -5
- package/src/components/Popover/Popover.stories.tsx +1 -1
- package/src/components/Popover/Popover.tsx +52 -33
- package/src/components/ScrollArea/ScrollArea.stories.tsx +54 -4
- package/src/components/ScrollArea/ScrollArea.tsx +50 -4
- package/src/components/ScrollContainer/ScrollContainer.stories.tsx +70 -0
- package/src/components/ScrollContainer/ScrollContainer.tsx +233 -0
- package/src/components/ScrollContainer/index.ts +5 -0
- package/src/components/Select/Select.stories.tsx +2 -2
- package/src/components/Select/Select.tsx +4 -4
- package/src/components/Tag/Tag.stories.tsx +2 -2
- package/src/components/Tag/Tag.tsx +1 -1
- package/src/components/ThemeProvider/ThemeProvider.tsx +1 -3
- package/src/components/ThemeProvider/TranslationsProvider.tsx +1 -16
- package/src/components/ThemeProvider/index.ts +3 -3
- package/src/components/Toast/Toast.stories.tsx +1 -1
- package/src/components/Toolbar/Toolbar.stories.tsx +2 -4
- package/src/components/Toolbar/Toolbar.tsx +24 -9
- package/src/components/Tooltip/Tooltip.stories.tsx +1 -1
- package/src/components/Tooltip/Tooltip.tsx +22 -20
- package/src/components/index.ts +5 -4
- package/src/hooks/useDensityContext.ts +1 -1
- package/src/hooks/useElevationContext.ts +1 -1
- package/src/index.ts +1 -1
- package/src/playground/Controls.stories.tsx +2 -2
- package/src/playground/Custom.stories.tsx +6 -8
- package/src/testing/decorators/index.ts +1 -1
- package/src/testing/decorators/withLayout.tsx +22 -15
- package/src/testing/decorators/{withSurfaceVariantsLayout.tsx → withLayoutVariants.tsx} +5 -5
- package/src/testing/decorators/withTheme.tsx +3 -2
- package/src/util/index.ts +2 -2
- package/dist/lib/browser/chunk-KX5JDELJ.mjs +0 -4521
- package/dist/lib/browser/chunk-KX5JDELJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3HDQYL5S.mjs +0 -4523
- package/dist/lib/node-esm/chunk-3HDQYL5S.mjs.map +0 -7
- package/dist/types/src/components/Buttons/Button.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/Button.stories.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/IconButton.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/IconButton.stories.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/Toggle.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/Toggle.stories.d.ts +0 -13
- package/dist/types/src/components/Buttons/Toggle.stories.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/ToggleGroup.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/index.d.ts.map +0 -1
- package/dist/types/src/components/Dialogs/AlertDialog.d.ts.map +0 -1
- package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts.map +0 -1
- package/dist/types/src/components/Dialogs/Dialog.d.ts +0 -31
- package/dist/types/src/components/Dialogs/Dialog.d.ts.map +0 -1
- package/dist/types/src/components/Dialogs/Dialog.stories.d.ts.map +0 -1
- package/dist/types/src/components/Dialogs/index.d.ts.map +0 -1
- package/dist/types/src/components/Lists/List.d.ts.map +0 -1
- package/dist/types/src/components/Lists/List.stories.d.ts.map +0 -1
- package/dist/types/src/components/Lists/ListDropIndicator.d.ts.map +0 -1
- package/dist/types/src/components/Lists/Tree.d.ts.map +0 -1
- package/dist/types/src/components/Lists/Tree.stories.d.ts.map +0 -1
- package/dist/types/src/components/Lists/TreeDropIndicator.d.ts.map +0 -1
- package/dist/types/src/components/Lists/Treegrid.d.ts.map +0 -1
- package/dist/types/src/components/Lists/Treegrid.stories.d.ts.map +0 -1
- package/dist/types/src/components/Lists/index.d.ts.map +0 -1
- package/dist/types/src/components/Menus/ContextMenu.d.ts.map +0 -1
- package/dist/types/src/components/Menus/ContextMenu.stories.d.ts.map +0 -1
- package/dist/types/src/components/Menus/DropdownMenu.d.ts.map +0 -1
- package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts.map +0 -1
- package/dist/types/src/components/Menus/index.d.ts.map +0 -1
- package/dist/types/src/testing/decorators/withSurfaceVariantsLayout.d.ts +0 -12
- package/dist/types/src/testing/decorators/withSurfaceVariantsLayout.d.ts.map +0 -1
- package/dist/types/src/util/ThemedClassName.d.ts +0 -5
- package/dist/types/src/util/ThemedClassName.d.ts.map +0 -1
- package/dist/types/src/util/domino.d.ts +0 -18
- package/dist/types/src/util/domino.d.ts.map +0 -1
- package/src/components/Dialogs/Dialog.stories.tsx +0 -67
- package/src/util/ThemedClassName.ts +0 -7
- package/src/util/domino.ts +0 -53
- /package/dist/types/src/components/{Buttons → Button}/Button.stories.d.ts +0 -0
- /package/dist/types/src/components/{Buttons → Button}/IconButton.stories.d.ts +0 -0
- /package/dist/types/src/components/{Buttons → Button}/Toggle.d.ts +0 -0
- /package/dist/types/src/components/{Buttons → Button}/index.d.ts +0 -0
- /package/dist/types/src/components/{Dialogs → Dialog}/AlertDialog.d.ts +0 -0
- /package/dist/types/src/components/{Dialogs → Dialog}/AlertDialog.stories.d.ts +0 -0
- /package/dist/types/src/components/{Dialogs → Dialog}/index.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/List.stories.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/ListDropIndicator.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/Tree.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/Tree.stories.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/TreeDropIndicator.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/Treegrid.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/Treegrid.stories.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/index.d.ts +0 -0
- /package/dist/types/src/components/{Menus → Menu}/ContextMenu.stories.d.ts +0 -0
- /package/dist/types/src/components/{Menus → Menu}/DropdownMenu.stories.d.ts +0 -0
- /package/dist/types/src/components/{Menus → Menu}/index.d.ts +0 -0
- /package/src/components/{Buttons → Button}/IconButton.stories.tsx +0 -0
- /package/src/components/{Buttons → Button}/Toggle.tsx +0 -0
- /package/src/components/{Buttons → Button}/ToggleGroup.stories.tsx +0 -0
- /package/src/components/{Buttons → Button}/ToggleGroup.tsx +0 -0
- /package/src/components/{Buttons → Button}/index.ts +0 -0
- /package/src/components/{Dialogs → Dialog}/AlertDialog.tsx +0 -0
- /package/src/components/{Dialogs → Dialog}/index.ts +0 -0
- /package/src/components/{Lists → List}/Tree.stories.tsx +0 -0
- /package/src/components/{Lists → List}/Tree.tsx +0 -0
- /package/src/components/{Lists → List}/TreeDropIndicator.tsx +0 -0
- /package/src/components/{Lists → List}/Treegrid.stories.tsx +0 -0
- /package/src/components/{Lists → List}/Treegrid.tsx +0 -0
- /package/src/components/{Lists → List}/index.ts +0 -0
- /package/src/components/{Menus → Menu}/ContextMenu.stories.tsx +0 -0
- /package/src/components/{Menus → Menu}/ContextMenu.tsx +0 -0
- /package/src/components/{Menus → Menu}/index.ts +0 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { createContext } from '@radix-ui/react-context';
|
|
6
|
+
import React, {
|
|
7
|
+
type HTMLAttributes,
|
|
8
|
+
type PropsWithChildren,
|
|
9
|
+
forwardRef,
|
|
10
|
+
useCallback,
|
|
11
|
+
useEffect,
|
|
12
|
+
useImperativeHandle,
|
|
13
|
+
useMemo,
|
|
14
|
+
useRef,
|
|
15
|
+
useState,
|
|
16
|
+
} from 'react';
|
|
17
|
+
|
|
18
|
+
// TODO(burdon): Move these deps to @dxos/dom-util.
|
|
19
|
+
import { addEventListener, combine } from '@dxos/async';
|
|
20
|
+
import { invariant } from '@dxos/invariant';
|
|
21
|
+
import { useForwardedRef } from '@dxos/react-hooks';
|
|
22
|
+
import { mx } from '@dxos/ui-theme';
|
|
23
|
+
|
|
24
|
+
import { type ThemedClassName } from '../../util';
|
|
25
|
+
import { IconButton } from '../Button';
|
|
26
|
+
|
|
27
|
+
const isBottom = (el: HTMLElement | null) => {
|
|
28
|
+
return !!(el && el.scrollHeight - el.scrollTop === el.clientHeight);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export interface ScrollController {
|
|
32
|
+
viewport: HTMLDivElement | null;
|
|
33
|
+
scrollToTop: (behavior?: ScrollBehavior) => void;
|
|
34
|
+
scrollToBottom: (behavior?: ScrollBehavior) => void;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
type ScrollContainerContextValue = {
|
|
38
|
+
scrollToBottom: (behavior?: ScrollBehavior) => void;
|
|
39
|
+
controller?: ScrollController;
|
|
40
|
+
pinned?: boolean;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const [ScrollContainerProvider, useScrollContainerContext] =
|
|
44
|
+
createContext<ScrollContainerContextValue>('ScrollContainer');
|
|
45
|
+
|
|
46
|
+
//
|
|
47
|
+
// Root
|
|
48
|
+
//
|
|
49
|
+
|
|
50
|
+
type RootProps = ThemedClassName<
|
|
51
|
+
PropsWithChildren<{
|
|
52
|
+
pin?: boolean;
|
|
53
|
+
fade?: boolean;
|
|
54
|
+
behavior?: ScrollBehavior;
|
|
55
|
+
}>
|
|
56
|
+
>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Scroll container that automatically scrolls to the bottom when new content is added.
|
|
60
|
+
*/
|
|
61
|
+
const Root = forwardRef<ScrollController, RootProps>(
|
|
62
|
+
({ children, classNames, pin, fade, behavior: behaviorProp = 'smooth' }, forwardedRef) => {
|
|
63
|
+
const scrollerRef = useRef<HTMLDivElement>(null);
|
|
64
|
+
const autoScrollRef = useRef(false);
|
|
65
|
+
const [overflow, setOverflow] = useState(false);
|
|
66
|
+
const [pinned, setPinned] = useState(pin);
|
|
67
|
+
|
|
68
|
+
const timeoutRef = useRef<NodeJS.Timeout>(undefined);
|
|
69
|
+
const scrollToBottom = useCallback((behavior: ScrollBehavior = behaviorProp) => {
|
|
70
|
+
if (scrollerRef.current) {
|
|
71
|
+
// Temporarily hide scrollbar to prevent flicker.
|
|
72
|
+
autoScrollRef.current = true;
|
|
73
|
+
scrollerRef.current.classList.add('scrollbar-none');
|
|
74
|
+
scrollerRef.current.scrollTo({
|
|
75
|
+
top: scrollerRef.current.scrollHeight,
|
|
76
|
+
behavior,
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
clearTimeout(timeoutRef.current);
|
|
80
|
+
if (behavior !== 'instant') {
|
|
81
|
+
timeoutRef.current = setTimeout(() => {
|
|
82
|
+
scrollerRef.current?.classList.remove('scrollbar-none');
|
|
83
|
+
autoScrollRef.current = false;
|
|
84
|
+
}, 500);
|
|
85
|
+
}
|
|
86
|
+
setPinned(true);
|
|
87
|
+
}
|
|
88
|
+
}, []);
|
|
89
|
+
|
|
90
|
+
const controller = useMemo(
|
|
91
|
+
() => ({
|
|
92
|
+
viewport: scrollerRef.current,
|
|
93
|
+
scrollToTop: () => {
|
|
94
|
+
invariant(scrollerRef.current);
|
|
95
|
+
scrollerRef.current.scrollTo({ top: 0, behavior: 'smooth' });
|
|
96
|
+
setPinned(false);
|
|
97
|
+
},
|
|
98
|
+
scrollToBottom: () => {
|
|
99
|
+
scrollToBottom('smooth');
|
|
100
|
+
},
|
|
101
|
+
}),
|
|
102
|
+
[scrollToBottom, scrollerRef.current],
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
// Scroll controller imperative ref.
|
|
106
|
+
useImperativeHandle(forwardedRef, () => controller, [controller]);
|
|
107
|
+
|
|
108
|
+
// Listen for scroll events.
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
if (!scrollerRef.current) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return combine(
|
|
115
|
+
// Check if user scrolls.
|
|
116
|
+
addEventListener(scrollerRef.current, 'wheel', () => {
|
|
117
|
+
setPinned(isBottom(scrollerRef.current));
|
|
118
|
+
}),
|
|
119
|
+
// Check if scrolls.
|
|
120
|
+
addEventListener(scrollerRef.current, 'scroll', () => {
|
|
121
|
+
setOverflow((scrollerRef.current?.scrollTop ?? 0) > 0);
|
|
122
|
+
}),
|
|
123
|
+
);
|
|
124
|
+
}, []);
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<ScrollContainerProvider pinned={pinned} controller={controller} scrollToBottom={scrollToBottom}>
|
|
128
|
+
<div className='relative grid flex-1 min-bs-0 overflow-hidden'>
|
|
129
|
+
{fade && (
|
|
130
|
+
<div
|
|
131
|
+
role='none'
|
|
132
|
+
data-visible={overflow}
|
|
133
|
+
className={mx(
|
|
134
|
+
// NOTE: Gradients may not be visible with dark reader extensions.
|
|
135
|
+
'z-10 absolute block-start-0 inset-inline-0 bs-24 is-full',
|
|
136
|
+
'opacity-0 duration-200 transition-opacity data-[visible="true"]:opacity-100',
|
|
137
|
+
'bg-gradient-to-b from-[--surface-bg] to-transparent pointer-events-none',
|
|
138
|
+
)}
|
|
139
|
+
/>
|
|
140
|
+
)}
|
|
141
|
+
<div className={mx('flex flex-col min-bs-0 overflow-y-auto scrollbar-thin', classNames)} ref={scrollerRef}>
|
|
142
|
+
{children}
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
</ScrollContainerProvider>
|
|
146
|
+
);
|
|
147
|
+
},
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
Root.displayName = 'ScrollContainer.Root';
|
|
151
|
+
|
|
152
|
+
//
|
|
153
|
+
// Viewport
|
|
154
|
+
//
|
|
155
|
+
|
|
156
|
+
type ViewportProps = ThemedClassName<PropsWithChildren<Omit<HTMLAttributes<HTMLDivElement>, 'className'>>>;
|
|
157
|
+
|
|
158
|
+
const Viewport = forwardRef<HTMLDivElement, ViewportProps>(({ classNames, children, ...props }, forwardedRef) => {
|
|
159
|
+
const contentRef = useForwardedRef(forwardedRef);
|
|
160
|
+
const { pinned, scrollToBottom } = useScrollContainerContext(Viewport.displayName!);
|
|
161
|
+
|
|
162
|
+
useEffect(() => {
|
|
163
|
+
if (!pinned || !contentRef.current) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Scroll instantly otherwise it might move while we're scrolling.
|
|
168
|
+
scrollToBottom();
|
|
169
|
+
|
|
170
|
+
// Setup resize observer to detect content changes.
|
|
171
|
+
const resizeObserver = new ResizeObserver(() => scrollToBottom());
|
|
172
|
+
resizeObserver.observe(contentRef.current);
|
|
173
|
+
return () => resizeObserver.disconnect();
|
|
174
|
+
}, [pinned, scrollToBottom]);
|
|
175
|
+
|
|
176
|
+
return (
|
|
177
|
+
<div className={mx('is-full', classNames)} {...props} ref={contentRef}>
|
|
178
|
+
{children}
|
|
179
|
+
</div>
|
|
180
|
+
);
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
Viewport.displayName = 'ScrollContainer.Viewport';
|
|
184
|
+
|
|
185
|
+
//
|
|
186
|
+
// ScrollDownButton
|
|
187
|
+
//
|
|
188
|
+
|
|
189
|
+
type ScrollDownButtonProps = ThemedClassName;
|
|
190
|
+
|
|
191
|
+
const ScrollDownButton = ({ classNames }: ScrollDownButtonProps) => {
|
|
192
|
+
const { pinned, scrollToBottom } = useScrollContainerContext(ScrollDownButton.displayName!);
|
|
193
|
+
|
|
194
|
+
return (
|
|
195
|
+
<div
|
|
196
|
+
role='none'
|
|
197
|
+
className={mx(
|
|
198
|
+
'absolute bottom-2 right-4 opacity-100 transition-opacity duration-300',
|
|
199
|
+
pinned && 'opacity-0',
|
|
200
|
+
classNames,
|
|
201
|
+
)}
|
|
202
|
+
>
|
|
203
|
+
<IconButton
|
|
204
|
+
variant='primary'
|
|
205
|
+
icon='ph--arrow-down--regular'
|
|
206
|
+
iconOnly
|
|
207
|
+
size={4}
|
|
208
|
+
label='Scroll down'
|
|
209
|
+
onClick={() => scrollToBottom()}
|
|
210
|
+
/>
|
|
211
|
+
</div>
|
|
212
|
+
);
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
ScrollDownButton.displayName = 'ScrollContainer.ScrollDownButton';
|
|
216
|
+
|
|
217
|
+
//
|
|
218
|
+
// ScrollContainer
|
|
219
|
+
//
|
|
220
|
+
|
|
221
|
+
export { useScrollContainerContext };
|
|
222
|
+
|
|
223
|
+
export const ScrollContainer = {
|
|
224
|
+
Root,
|
|
225
|
+
Viewport,
|
|
226
|
+
ScrollDownButton,
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
export type {
|
|
230
|
+
RootProps as ScrollContainerRootProps,
|
|
231
|
+
ViewportProps as ScrollContainerViewportProps,
|
|
232
|
+
ScrollDownButtonProps as ScrollContainerScrollDownButtonProps,
|
|
233
|
+
};
|
|
@@ -8,7 +8,7 @@ import React, { useState } from 'react';
|
|
|
8
8
|
import { faker } from '@dxos/random';
|
|
9
9
|
|
|
10
10
|
import { withTheme } from '../../testing';
|
|
11
|
-
import {
|
|
11
|
+
import { withLayoutVariants } from '../../testing';
|
|
12
12
|
|
|
13
13
|
import { Select } from './Select';
|
|
14
14
|
|
|
@@ -44,7 +44,7 @@ const DefaultStory = ({ items = [] }: StoryProps) => {
|
|
|
44
44
|
const meta = {
|
|
45
45
|
title: 'ui/react-ui-core/Select',
|
|
46
46
|
render: DefaultStory,
|
|
47
|
-
decorators: [withTheme,
|
|
47
|
+
decorators: [withTheme, withLayoutVariants()],
|
|
48
48
|
} satisfies Meta<typeof DefaultStory>;
|
|
49
49
|
|
|
50
50
|
export default meta;
|
|
@@ -8,7 +8,7 @@ import React, { forwardRef } from 'react';
|
|
|
8
8
|
import { useElevationContext, useThemeContext } from '../../hooks';
|
|
9
9
|
import { useSafeCollisionPadding } from '../../hooks/useSafeCollisionPadding';
|
|
10
10
|
import { type ThemedClassName } from '../../util';
|
|
11
|
-
import { Button, type ButtonProps } from '../
|
|
11
|
+
import { Button, type ButtonProps } from '../Button';
|
|
12
12
|
import { Icon } from '../Icon';
|
|
13
13
|
|
|
14
14
|
type SelectRootProps = SelectPrimitive.SelectProps;
|
|
@@ -39,7 +39,7 @@ const SelectTriggerButton = forwardRef<HTMLButtonElement, SelectTriggerButtonPro
|
|
|
39
39
|
<SelectPrimitive.Trigger asChild ref={forwardedRef}>
|
|
40
40
|
<Button {...props}>
|
|
41
41
|
<SelectPrimitive.Value placeholder={placeholder}>{children}</SelectPrimitive.Value>
|
|
42
|
-
<span className='
|
|
42
|
+
<span className='is-1 flex-1' />
|
|
43
43
|
<SelectPrimitive.Icon asChild>
|
|
44
44
|
<Icon size={3} icon='ph--caret-down--bold' />
|
|
45
45
|
</SelectPrimitive.Icon>
|
|
@@ -108,7 +108,7 @@ const SelectScrollDownButton = forwardRef<HTMLDivElement, SelectScrollDownButton
|
|
|
108
108
|
type SelectViewportProps = ThemedClassName<SelectPrimitive.SelectViewportProps>;
|
|
109
109
|
|
|
110
110
|
const SelectViewport = forwardRef<HTMLDivElement, SelectViewportProps>(
|
|
111
|
-
({ classNames,
|
|
111
|
+
({ classNames, children, ...props }, forwardedRef) => {
|
|
112
112
|
const { tx } = useThemeContext();
|
|
113
113
|
return (
|
|
114
114
|
<SelectPrimitive.SelectViewport
|
|
@@ -158,7 +158,7 @@ const SelectOption = forwardRef<HTMLDivElement, SelectItemProps>(({ children, cl
|
|
|
158
158
|
return (
|
|
159
159
|
<SelectPrimitive.Item {...props} className={tx('select.item', 'option', {}, classNames)} ref={forwardedRef}>
|
|
160
160
|
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
161
|
-
<span className='grow
|
|
161
|
+
<span className='grow is-1' />
|
|
162
162
|
{/* <SelectPrimitive.ItemIndicator className={tx('select.itemIndicator', 'option__indicator', {})}> */}
|
|
163
163
|
<Icon icon='ph--check--regular' />
|
|
164
164
|
{/* </SelectPrimitive.ItemIndicator> */}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import { hues } from '@dxos/
|
|
9
|
-
import { type ChromaticPalette, type MessageValence } from '@dxos/
|
|
8
|
+
import { hues } from '@dxos/ui-theme';
|
|
9
|
+
import { type ChromaticPalette, type MessageValence } from '@dxos/ui-types';
|
|
10
10
|
|
|
11
11
|
import { withTheme } from '../../testing';
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@ import { Primitive } from '@radix-ui/react-primitive';
|
|
|
6
6
|
import { Slot } from '@radix-ui/react-slot';
|
|
7
7
|
import React, { type ComponentPropsWithRef, forwardRef } from 'react';
|
|
8
8
|
|
|
9
|
-
import { type ChromaticPalette, type MessageValence, type NeutralPalette } from '@dxos/
|
|
9
|
+
import { type ChromaticPalette, type MessageValence, type NeutralPalette } from '@dxos/ui-types';
|
|
10
10
|
|
|
11
11
|
import { useThemeContext } from '../../hooks';
|
|
12
12
|
import { type ThemedClassName } from '../../util';
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { createKeyborg } from 'keyborg';
|
|
6
6
|
import React, { type PropsWithChildren, createContext, useEffect, useMemo } from 'react';
|
|
7
7
|
|
|
8
|
-
import { type Density, type Elevation, type ThemeFunction } from '@dxos/
|
|
8
|
+
import { type Density, type Elevation, type ThemeFunction, type ThemeMode } from '@dxos/ui-types';
|
|
9
9
|
|
|
10
10
|
import { type SafeAreaPadding, useSafeArea } from '../../hooks';
|
|
11
11
|
import { hasIosKeyboard } from '../../util';
|
|
@@ -14,8 +14,6 @@ import { ElevationProvider } from '../ElevationProvider';
|
|
|
14
14
|
|
|
15
15
|
import { TranslationsProvider, type TranslationsProviderProps } from './TranslationsProvider';
|
|
16
16
|
|
|
17
|
-
export type ThemeMode = 'dark' | 'light';
|
|
18
|
-
|
|
19
17
|
export type ThemeContextValue = {
|
|
20
18
|
tx: ThemeFunction<any>;
|
|
21
19
|
themeMode: ThemeMode;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Locale, enUS as dtLocaleEnUs } from 'date-fns/locale';
|
|
6
|
-
import i18Next, { type Resource
|
|
6
|
+
import i18Next, { type Resource } from 'i18next';
|
|
7
7
|
import React, { type ReactNode, Suspense, createContext, useContext, useEffect, useState } from 'react';
|
|
8
8
|
import { initReactI18next, useTranslation as useI18NextTranslation } from 'react-i18next';
|
|
9
9
|
|
|
@@ -11,21 +11,6 @@ const initialLng = 'en-US';
|
|
|
11
11
|
const initialNs = 'dxos-common';
|
|
12
12
|
const initialDtLocale = dtLocaleEnUs;
|
|
13
13
|
|
|
14
|
-
// TODO(thure): `Parameters<TFunction>` causes typechecking issues because `TFunction` has so many signatures.
|
|
15
|
-
export type Label = string | [string, { ns: string; count?: number; defaultValue?: string }];
|
|
16
|
-
|
|
17
|
-
export const isLabel = (o: any): o is Label =>
|
|
18
|
-
typeof o === 'string' ||
|
|
19
|
-
(Array.isArray(o) &&
|
|
20
|
-
o.length === 2 &&
|
|
21
|
-
typeof o[0] === 'string' &&
|
|
22
|
-
!!o[1] &&
|
|
23
|
-
typeof o[1] === 'object' &&
|
|
24
|
-
'ns' in o[1] &&
|
|
25
|
-
typeof o[1].ns === 'string');
|
|
26
|
-
|
|
27
|
-
export const toLocalizedString = (label: Label, t: TFunction) => (Array.isArray(label) ? t(...label) : label);
|
|
28
|
-
|
|
29
14
|
export const resources = {
|
|
30
15
|
[initialLng]: {
|
|
31
16
|
[initialNs]: {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
export { type Label, isLabel, toLocalizedString, useTranslation } from './TranslationsProvider';
|
|
5
|
+
export { type Label, isLabel, toLocalizedString } from '@dxos/ui-types';
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
export * from './ThemeProvider';
|
|
8
|
+
export { useTranslation } from './TranslationsProvider';
|
|
@@ -6,7 +6,7 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import React, { type ReactNode, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { withTheme } from '../../testing';
|
|
9
|
-
import { Button } from '../
|
|
9
|
+
import { Button } from '../Button';
|
|
10
10
|
|
|
11
11
|
import { Toast } from './Toast';
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
8
|
import { withTheme } from '../../testing';
|
|
9
|
-
import { Toggle } from '../
|
|
9
|
+
import { Toggle } from '../Button';
|
|
10
10
|
import { Icon } from '../Icon';
|
|
11
11
|
import { Select } from '../Select';
|
|
12
12
|
|
|
@@ -63,9 +63,7 @@ const DefaultStory = (props: StorybookToolbarProps) => {
|
|
|
63
63
|
</Toolbar.Button>
|
|
64
64
|
<Toolbar.Separator />
|
|
65
65
|
<Toolbar.Button>Test</Toolbar.Button>
|
|
66
|
-
<Toolbar.
|
|
67
|
-
<Icon icon='ph--arrow-clockwise--regular' />
|
|
68
|
-
</Toolbar.Button>
|
|
66
|
+
<Toolbar.IconButton icon='ph--arrow-clockwise--regular' label='Refresh' iconOnly />
|
|
69
67
|
</Toolbar.Root>
|
|
70
68
|
);
|
|
71
69
|
};
|
|
@@ -18,30 +18,34 @@ import {
|
|
|
18
18
|
Toggle,
|
|
19
19
|
type ToggleGroupItemProps,
|
|
20
20
|
type ToggleProps,
|
|
21
|
-
} from '../
|
|
21
|
+
} from '../Button';
|
|
22
22
|
import { Link, type LinkProps } from '../Link';
|
|
23
23
|
import { Separator, type SeparatorProps } from '../Separator';
|
|
24
24
|
|
|
25
25
|
type ToolbarRootProps = ThemedClassName<
|
|
26
26
|
ToolbarPrimitive.ToolbarProps & {
|
|
27
|
-
layoutManaged?: boolean;
|
|
28
27
|
textBlockWidth?: boolean;
|
|
28
|
+
layoutManaged?: boolean;
|
|
29
|
+
disabled?: boolean;
|
|
29
30
|
}
|
|
30
31
|
>;
|
|
31
32
|
|
|
32
33
|
const ToolbarRoot = forwardRef<HTMLDivElement, ToolbarRootProps>(
|
|
33
|
-
({ classNames, children, layoutManaged, textBlockWidth:
|
|
34
|
+
({ classNames, children, layoutManaged, textBlockWidth: textBlockWidthProp, disabled, ...props }, forwardedRef) => {
|
|
34
35
|
const { tx } = useThemeContext();
|
|
35
|
-
const InnerRoot =
|
|
36
|
-
const innerRootProps =
|
|
37
|
-
? {
|
|
36
|
+
const InnerRoot = textBlockWidthProp ? 'div' : Fragment;
|
|
37
|
+
const innerRootProps = textBlockWidthProp
|
|
38
|
+
? {
|
|
39
|
+
role: 'none',
|
|
40
|
+
className: tx('toolbar.inner', 'toolbar', { layoutManaged }, classNames),
|
|
41
|
+
}
|
|
38
42
|
: {};
|
|
39
43
|
|
|
40
44
|
return (
|
|
41
45
|
<ToolbarPrimitive.Root
|
|
42
46
|
{...props}
|
|
43
47
|
data-arrow-keys={props.orientation === 'vertical' ? 'up down' : 'left right'}
|
|
44
|
-
className={tx('toolbar.root', 'toolbar', { layoutManaged }, classNames)}
|
|
48
|
+
className={tx('toolbar.root', 'toolbar', { layoutManaged, disabled }, classNames)}
|
|
45
49
|
ref={forwardedRef}
|
|
46
50
|
>
|
|
47
51
|
<InnerRoot {...innerRootProps}>{children}</InnerRoot>
|
|
@@ -65,7 +69,7 @@ type ToolbarIconButtonProps = IconButtonProps;
|
|
|
65
69
|
const ToolbarIconButton = forwardRef<HTMLButtonElement, ToolbarIconButtonProps>((props, forwardedRef) => {
|
|
66
70
|
return (
|
|
67
71
|
<ToolbarPrimitive.Button asChild>
|
|
68
|
-
<IconButton {...props} ref={forwardedRef} />
|
|
72
|
+
<IconButton {...props} noTooltip ref={forwardedRef} />
|
|
69
73
|
</ToolbarPrimitive.Button>
|
|
70
74
|
);
|
|
71
75
|
});
|
|
@@ -124,7 +128,18 @@ const ToolbarToggleGroupIconItem = forwardRef<HTMLButtonElement, ToolbarToggleGr
|
|
|
124
128
|
({ variant, density, elevation, classNames, icon, label, iconOnly, ...props }, forwardedRef) => {
|
|
125
129
|
return (
|
|
126
130
|
<ToolbarPrimitive.ToolbarToggleItem {...props} asChild>
|
|
127
|
-
<IconButton
|
|
131
|
+
<IconButton
|
|
132
|
+
{...{
|
|
133
|
+
variant,
|
|
134
|
+
density,
|
|
135
|
+
elevation,
|
|
136
|
+
classNames,
|
|
137
|
+
icon,
|
|
138
|
+
label,
|
|
139
|
+
iconOnly,
|
|
140
|
+
}}
|
|
141
|
+
ref={forwardedRef}
|
|
142
|
+
/>
|
|
128
143
|
</ToolbarPrimitive.ToolbarToggleItem>
|
|
129
144
|
);
|
|
130
145
|
},
|
|
@@ -41,9 +41,9 @@ type TooltipScopedProps<P = {}> = P & { __scopeTooltip?: Scope };
|
|
|
41
41
|
const [createTooltipContext, createTooltipScope] = createContextScope('Tooltip', [createPopperScope]);
|
|
42
42
|
const usePopperScope = createPopperScope();
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
//
|
|
45
|
+
// Tooltip
|
|
46
|
+
//
|
|
47
47
|
|
|
48
48
|
const DEFAULT_DELAY_DURATION = 700;
|
|
49
49
|
const TOOLTIP_OPEN = 'tooltip.open';
|
|
@@ -228,9 +228,9 @@ const TooltipProvider: FC<TooltipProviderProps> = (props: TooltipScopedProps<Too
|
|
|
228
228
|
|
|
229
229
|
TooltipProvider.displayName = TOOLTIP_NAME;
|
|
230
230
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
231
|
+
//
|
|
232
|
+
// TooltipVirtualTrigger
|
|
233
|
+
//
|
|
234
234
|
|
|
235
235
|
const TooltipVirtualTrigger = ({
|
|
236
236
|
virtualRef,
|
|
@@ -240,9 +240,9 @@ const TooltipVirtualTrigger = ({
|
|
|
240
240
|
return <PopperPrimitive.Anchor asChild {...popperScope} virtualRef={virtualRef} />;
|
|
241
241
|
};
|
|
242
242
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
243
|
+
//
|
|
244
|
+
// TooltipTrigger
|
|
245
|
+
//
|
|
246
246
|
|
|
247
247
|
const TRIGGER_NAME = 'TooltipTrigger';
|
|
248
248
|
|
|
@@ -322,9 +322,9 @@ const TooltipTrigger = forwardRef<TooltipTriggerElement, TooltipTriggerProps>(
|
|
|
322
322
|
|
|
323
323
|
TooltipTrigger.displayName = TRIGGER_NAME;
|
|
324
324
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
325
|
+
//
|
|
326
|
+
// TooltipPortal
|
|
327
|
+
//
|
|
328
328
|
|
|
329
329
|
const PORTAL_NAME = 'TooltipPortal';
|
|
330
330
|
|
|
@@ -363,9 +363,9 @@ const TooltipPortal: FC<TooltipPortalProps> = (props: TooltipScopedProps<Tooltip
|
|
|
363
363
|
|
|
364
364
|
TooltipPortal.displayName = PORTAL_NAME;
|
|
365
365
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
366
|
+
//
|
|
367
|
+
// TooltipContent
|
|
368
|
+
//
|
|
369
369
|
|
|
370
370
|
const CONTENT_NAME = 'TooltipContent';
|
|
371
371
|
|
|
@@ -574,9 +574,9 @@ const TooltipContentImpl = forwardRef<TooltipContentImplElement, TooltipContentI
|
|
|
574
574
|
|
|
575
575
|
TooltipContent.displayName = CONTENT_NAME;
|
|
576
576
|
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
577
|
+
//
|
|
578
|
+
// TooltipArrow
|
|
579
|
+
//
|
|
580
580
|
|
|
581
581
|
const ARROW_NAME = 'TooltipArrow';
|
|
582
582
|
|
|
@@ -599,8 +599,6 @@ const TooltipArrow = forwardRef<TooltipArrowElement, TooltipArrowProps>(
|
|
|
599
599
|
|
|
600
600
|
TooltipArrow.displayName = ARROW_NAME;
|
|
601
601
|
|
|
602
|
-
/* ----------------------------------------------------------------------------------------------- */
|
|
603
|
-
|
|
604
602
|
type TooltipSide = NonNullable<TooltipContentProps['side']>;
|
|
605
603
|
|
|
606
604
|
const getExitSideFromRect = (point: Point, rect: DOMRect): TooltipSide => {
|
|
@@ -755,6 +753,10 @@ const getHullPresorted = <P extends Point>(points: Readonly<Array<P>>): Array<P>
|
|
|
755
753
|
}
|
|
756
754
|
};
|
|
757
755
|
|
|
756
|
+
//
|
|
757
|
+
// Tooltip
|
|
758
|
+
//
|
|
759
|
+
|
|
758
760
|
export const Tooltip = {
|
|
759
761
|
Provider: TooltipProvider,
|
|
760
762
|
Trigger: TooltipTrigger,
|
package/src/components/index.ts
CHANGED
|
@@ -5,19 +5,20 @@
|
|
|
5
5
|
export * from './AnchoredOverflow';
|
|
6
6
|
export * from './Avatars';
|
|
7
7
|
export * from './Breadcrumb';
|
|
8
|
-
export * from './
|
|
8
|
+
export * from './Button';
|
|
9
9
|
export * from './Clipboard';
|
|
10
|
-
export * from './
|
|
10
|
+
export * from './Dialog';
|
|
11
11
|
export * from './Icon';
|
|
12
12
|
export * from './Input';
|
|
13
13
|
export * from './Link';
|
|
14
|
-
export * from './
|
|
14
|
+
export * from './List';
|
|
15
15
|
export * from './Main';
|
|
16
|
-
export * from './
|
|
16
|
+
export * from './Menu';
|
|
17
17
|
export * from './Message';
|
|
18
18
|
export * from './Popover';
|
|
19
19
|
export * from './Status';
|
|
20
20
|
export * from './ScrollArea';
|
|
21
|
+
export * from './ScrollContainer';
|
|
21
22
|
export * from './Select';
|
|
22
23
|
export * from './Separator';
|
|
23
24
|
export * from './Tag';
|
package/src/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { type Resource, type TFunction } from 'i18next';
|
|
|
6
6
|
export { Trans } from 'react-i18next';
|
|
7
7
|
|
|
8
8
|
export * from '@dxos/react-hooks';
|
|
9
|
-
export * from '@dxos/
|
|
9
|
+
export * from '@dxos/ui-types';
|
|
10
10
|
|
|
11
11
|
export * from './components';
|
|
12
12
|
export * from './hooks';
|
|
@@ -7,7 +7,7 @@ import React, { useState } from 'react';
|
|
|
7
7
|
|
|
8
8
|
import { Icon, Input, Select, Toggle, Toolbar } from '../components';
|
|
9
9
|
import { withTheme } from '../testing';
|
|
10
|
-
import {
|
|
10
|
+
import { withLayoutVariants } from '../testing';
|
|
11
11
|
|
|
12
12
|
const DefaultStory = () => {
|
|
13
13
|
const [checked, setChecked] = useState<boolean>(false);
|
|
@@ -84,7 +84,7 @@ const DefaultStory = () => {
|
|
|
84
84
|
const meta = {
|
|
85
85
|
title: 'ui/react-ui-core/Playground/Controls',
|
|
86
86
|
render: DefaultStory,
|
|
87
|
-
decorators: [withTheme,
|
|
87
|
+
decorators: [withTheme, withLayoutVariants()],
|
|
88
88
|
} satisfies Meta<typeof Icon>;
|
|
89
89
|
|
|
90
90
|
export default meta;
|