@dxos/react-ui 0.8.4-main.4a85c3132b → 0.8.4-main.4f23b4e393
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-2FKSMWNY.mjs → chunk-BDBC6H6V.mjs} +79 -5
- package/dist/lib/browser/chunk-BDBC6H6V.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1209 -1031
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +44 -20
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/browser/translations.mjs +18 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-ZNBLTSHI.mjs → chunk-3JSJK2ZY.mjs} +79 -5
- package/dist/lib/node-esm/chunk-3JSJK2ZY.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1209 -1031
- 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 +44 -20
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- package/dist/lib/node-esm/translations.mjs +20 -0
- package/dist/lib/node-esm/translations.mjs.map +7 -0
- package/dist/types/src/components/Avatars/Avatar.d.ts +1 -1
- package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts.map +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts.map +1 -1
- package/dist/types/src/components/Button/Button.d.ts +2 -2
- package/dist/types/src/components/Button/Button.d.ts.map +1 -1
- package/dist/types/src/components/Button/Button.stories.d.ts +1 -1
- package/dist/types/src/components/Button/Button.stories.d.ts.map +1 -1
- package/dist/types/src/components/Button/IconButton.d.ts +1 -0
- package/dist/types/src/components/Button/IconButton.d.ts.map +1 -1
- package/dist/types/src/components/Button/IconButton.stories.d.ts +3 -0
- package/dist/types/src/components/Button/IconButton.stories.d.ts.map +1 -1
- package/dist/types/src/components/Button/Toggle.d.ts +2 -2
- package/dist/types/src/components/Button/Toggle.d.ts.map +1 -1
- package/dist/types/src/components/Button/Toggle.stories.d.ts.map +1 -1
- package/dist/types/src/components/Button/ToggleGroup.d.ts +6 -6
- package/dist/types/src/components/Button/ToggleGroup.d.ts.map +1 -1
- package/dist/types/src/components/Button/ToggleGroup.stories.d.ts +2 -2
- package/dist/types/src/components/Button/ToggleGroup.stories.d.ts.map +1 -1
- package/dist/types/src/components/Card/Card.d.ts +68 -65
- package/dist/types/src/components/Card/Card.d.ts.map +1 -1
- package/dist/types/src/components/Card/Card.stories.d.ts +2 -2
- package/dist/types/src/components/Card/Card.stories.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/index.d.ts +10 -1
- package/dist/types/src/components/Clipboard/index.d.ts.map +1 -1
- package/dist/types/src/components/DensityProvider/DensityProvider.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/AlertDialog.d.ts +42 -31
- package/dist/types/src/components/Dialog/AlertDialog.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/AlertDialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/Dialog.d.ts +47 -30
- package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts +3 -2
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts.map +1 -1
- package/dist/types/src/components/ErrorFallback/ErrorFallback.d.ts.map +1 -1
- package/dist/types/src/components/ErrorFallback/ErrorFallback.stories.d.ts.map +1 -1
- package/dist/types/src/components/ErrorFallback/ErrorStack.d.ts +14 -3
- package/dist/types/src/components/ErrorFallback/ErrorStack.d.ts.map +1 -1
- package/dist/types/src/components/ErrorFallback/ThrowError.d.ts.map +1 -1
- package/dist/types/src/components/Focus/Focus.d.ts +36 -0
- package/dist/types/src/components/Focus/Focus.d.ts.map +1 -0
- package/dist/types/src/components/Focus/Focus.stories.d.ts +9 -0
- package/dist/types/src/components/Focus/Focus.stories.d.ts.map +1 -0
- package/dist/types/src/components/Focus/index.d.ts +2 -0
- package/dist/types/src/components/Focus/index.d.ts.map +1 -0
- package/dist/types/src/components/Icon/Icon.d.ts +4 -0
- package/dist/types/src/components/Icon/Icon.d.ts.map +1 -1
- package/dist/types/src/components/Icon/Icon.stories.d.ts +11 -3
- package/dist/types/src/components/Icon/Icon.stories.d.ts.map +1 -1
- package/dist/types/src/components/Image/Image.d.ts +2 -1
- package/dist/types/src/components/Image/Image.d.ts.map +1 -1
- package/dist/types/src/components/Image/Image.stories.d.ts +3 -2
- package/dist/types/src/components/Image/Image.stories.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.d.ts +14 -17
- package/dist/types/src/components/Input/Input.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts +3 -3
- package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/types/src/components/Link/Link.stories.d.ts.map +1 -1
- package/dist/types/src/components/List/List.d.ts +5 -3
- package/dist/types/src/components/List/List.d.ts.map +1 -1
- package/dist/types/src/components/List/List.stories.d.ts +3 -1
- package/dist/types/src/components/List/List.stories.d.ts.map +1 -1
- package/dist/types/src/components/List/ListDropIndicator.d.ts.map +1 -1
- package/dist/types/src/components/List/Tree.d.ts +2 -2
- package/dist/types/src/components/List/Tree.d.ts.map +1 -1
- package/dist/types/src/components/List/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/components/List/TreeDropIndicator.d.ts.map +1 -1
- package/dist/types/src/components/List/Treegrid.d.ts +5 -9
- package/dist/types/src/components/List/Treegrid.d.ts.map +1 -1
- package/dist/types/src/components/List/Treegrid.stories.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.d.ts +7 -3
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
- package/dist/types/src/components/Main/useSwipeToDismiss.d.ts.map +1 -1
- package/dist/types/src/components/Menu/ContextMenu.d.ts.map +1 -1
- package/dist/types/src/components/Menu/ContextMenu.stories.d.ts.map +1 -1
- package/dist/types/src/components/Menu/DropdownMenu.d.ts +58 -49
- package/dist/types/src/components/Menu/DropdownMenu.d.ts.map +1 -1
- package/dist/types/src/components/Menu/DropdownMenu.stories.d.ts +14 -1
- package/dist/types/src/components/Menu/DropdownMenu.stories.d.ts.map +1 -1
- 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 +2 -2
- package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts +38 -22
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts +12 -11
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +21 -10
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts +42 -13
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts +5 -6
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.stories.d.ts +2 -2
- package/dist/types/src/components/Select/Select.stories.d.ts.map +1 -1
- package/dist/types/src/components/Separator/Separator.d.ts +3 -3
- package/dist/types/src/components/Separator/Separator.d.ts.map +1 -1
- package/dist/types/src/components/Skeleton/Skeleton.stories.d.ts.map +1 -1
- package/dist/types/src/components/Splitter/Splitter.d.ts +19 -21
- package/dist/types/src/components/Splitter/Splitter.d.ts.map +1 -1
- package/dist/types/src/components/Splitter/Splitter.stories.d.ts.map +1 -1
- package/dist/types/src/components/Status/Status.d.ts +3 -4
- package/dist/types/src/components/Status/Status.d.ts.map +1 -1
- package/dist/types/src/components/Status/Status.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tag/Tag.stories.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.stories.d.ts +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.stories.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts +54 -55
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/index.d.ts +1 -1
- package/dist/types/src/components/ThemeProvider/index.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.d.ts +16 -16
- package/dist/types/src/components/Toast/Toast.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +10 -20
- 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 +10 -10
- package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +2 -2
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/exemplars/generics.stories.d.ts +6 -5
- package/dist/types/src/exemplars/generics.stories.d.ts.map +1 -1
- package/dist/types/src/exemplars/slot.stories.d.ts +1 -0
- package/dist/types/src/exemplars/slot.stories.d.ts.map +1 -1
- package/dist/types/src/exemplars/tabster.stories.d.ts.map +1 -1
- package/dist/types/src/exemplars/virtualizer.stories.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/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.map +1 -1
- package/dist/types/src/hooks/useIconHref.d.ts.map +1 -1
- package/dist/types/src/hooks/useSafeArea.d.ts.map +1 -1
- package/dist/types/src/hooks/useSafeCollisionPadding.d.ts.map +1 -1
- package/dist/types/src/hooks/useVisualViewport.d.ts.map +1 -1
- package/dist/types/src/playground/Controls.stories.d.ts.map +1 -1
- package/dist/types/src/playground/Custom.stories.d.ts +1 -1
- package/dist/types/src/playground/Custom.stories.d.ts.map +1 -1
- package/dist/types/src/playground/Typography.stories.d.ts.map +1 -1
- package/dist/types/src/primitives/Column/Column.d.ts +20 -19
- package/dist/types/src/primitives/Column/Column.d.ts.map +1 -1
- package/dist/types/src/primitives/Column/Column.stories.d.ts +19 -0
- package/dist/types/src/primitives/Column/Column.stories.d.ts.map +1 -1
- package/dist/types/src/primitives/Container/Container.d.ts +7 -0
- package/dist/types/src/primitives/Container/Container.d.ts.map +1 -0
- package/dist/types/src/primitives/Container/Container.stories.d.ts +6 -0
- package/dist/types/src/primitives/Container/Container.stories.d.ts.map +1 -0
- package/dist/types/src/primitives/Container/index.d.ts +2 -0
- package/dist/types/src/primitives/Container/index.d.ts.map +1 -0
- package/dist/types/src/primitives/Flex/Flex.d.ts +8 -5
- package/dist/types/src/primitives/Flex/Flex.d.ts.map +1 -1
- package/dist/types/src/primitives/Flex/Flex.stories.d.ts.map +1 -1
- package/dist/types/src/primitives/Grid/Grid.d.ts +6 -5
- package/dist/types/src/primitives/Grid/Grid.d.ts.map +1 -1
- package/dist/types/src/primitives/Grid/Grid.stories.d.ts.map +1 -1
- package/dist/types/src/primitives/Panel/Panel.d.ts +23 -22
- package/dist/types/src/primitives/Panel/Panel.d.ts.map +1 -1
- package/dist/types/src/primitives/Panel/Panel.stories.d.ts.map +1 -1
- package/dist/types/src/primitives/index.d.ts +1 -0
- package/dist/types/src/primitives/index.d.ts.map +1 -1
- package/dist/types/src/testing/Loading.d.ts +9 -0
- package/dist/types/src/testing/Loading.d.ts.map +1 -0
- package/dist/types/src/testing/decorators/withLayout.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/withLayoutVariants.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/withTheme.d.ts +1 -1
- package/dist/types/src/testing/decorators/withTheme.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +1 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -3
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/util/usePx.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +28 -25
- package/src/components/Avatars/Avatar.stories.tsx +2 -3
- package/src/components/Avatars/Avatar.tsx +1 -2
- package/src/components/Avatars/AvatarGroup.stories.tsx +0 -1
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +1 -2
- package/src/components/Button/Button.stories.tsx +0 -1
- package/src/components/Button/Button.tsx +5 -13
- package/src/components/Button/IconButton.stories.tsx +6 -4
- package/src/components/Button/IconButton.tsx +3 -4
- package/src/components/Button/Toggle.stories.tsx +0 -1
- package/src/components/Button/Toggle.tsx +4 -4
- package/src/components/Button/ToggleGroup.stories.tsx +0 -1
- package/src/components/Button/ToggleGroup.tsx +12 -16
- package/src/components/Card/Card.stories.tsx +15 -15
- package/src/components/Card/Card.tsx +294 -132
- package/src/components/Clipboard/CopyButton.tsx +5 -6
- package/src/components/Dialog/AlertDialog.stories.tsx +5 -6
- package/src/components/Dialog/AlertDialog.tsx +67 -126
- package/src/components/Dialog/Dialog.stories.tsx +64 -9
- package/src/components/Dialog/Dialog.tsx +84 -88
- package/src/components/ErrorFallback/ErrorFallback.stories.tsx +3 -8
- package/src/components/ErrorFallback/ErrorStack.tsx +36 -2
- package/src/components/Focus/AUDIT.md +43 -0
- package/src/components/Focus/Focus.stories.tsx +230 -0
- package/src/components/Focus/Focus.tsx +201 -0
- package/src/components/Focus/index.ts +5 -0
- package/src/components/Icon/Icon.stories.tsx +43 -13
- package/src/components/Icon/Icon.tsx +14 -3
- package/src/components/Image/Image.stories.tsx +3 -3
- package/src/components/Image/Image.tsx +31 -8
- package/src/components/Input/Input.stories.tsx +3 -4
- package/src/components/Input/Input.tsx +7 -7
- package/src/components/Link/Link.stories.tsx +0 -1
- package/src/components/List/List.stories.tsx +3 -4
- package/src/components/List/List.tsx +7 -6
- package/src/components/List/ListDropIndicator.tsx +0 -1
- package/src/components/List/Tree.stories.tsx +2 -3
- package/src/components/List/Tree.tsx +0 -1
- package/src/components/List/TreeDropIndicator.tsx +1 -1
- package/src/components/List/Treegrid.stories.tsx +26 -27
- package/src/components/List/Treegrid.tsx +14 -14
- package/src/components/Main/Main.stories.tsx +0 -1
- package/src/components/Main/Main.tsx +1 -2
- package/src/components/Menu/ContextMenu.stories.tsx +0 -1
- package/src/components/Menu/DropdownMenu.stories.tsx +0 -1
- package/src/components/Menu/DropdownMenu.tsx +48 -42
- package/src/components/Message/Message.stories.tsx +7 -8
- package/src/components/Message/Message.tsx +23 -10
- package/src/components/Popover/Popover.stories.tsx +4 -5
- package/src/components/Popover/Popover.tsx +42 -42
- package/src/components/ScrollArea/ScrollArea.stories.tsx +89 -30
- package/src/components/ScrollArea/ScrollArea.tsx +41 -25
- package/src/components/ScrollContainer/ScrollContainer.stories.tsx +20 -18
- package/src/components/ScrollContainer/ScrollContainer.tsx +199 -92
- package/src/components/Select/Select.stories.tsx +5 -6
- package/src/components/Separator/Separator.tsx +4 -7
- package/src/components/Skeleton/Skeleton.stories.tsx +0 -1
- package/src/components/Splitter/Splitter.stories.tsx +29 -29
- package/src/components/Splitter/Splitter.tsx +35 -46
- package/src/components/Status/Status.stories.tsx +0 -1
- package/src/components/Status/Status.tsx +8 -5
- package/src/components/Tag/Tag.stories.tsx +0 -1
- package/src/components/ThemeProvider/ThemeProvider.stories.tsx +0 -1
- package/src/components/ThemeProvider/ThemeProvider.tsx +5 -4
- package/src/components/ThemeProvider/index.ts +1 -1
- package/src/components/Toast/Toast.stories.tsx +0 -1
- package/src/components/Toast/Toast.tsx +16 -31
- package/src/components/Toolbar/Toolbar.stories.tsx +0 -1
- package/src/components/Toolbar/Toolbar.tsx +34 -47
- package/src/components/Tooltip/Tooltip.stories.tsx +7 -8
- package/src/components/Tooltip/Tooltip.tsx +15 -16
- package/src/components/index.ts +1 -0
- package/src/exemplars/generics.stories.tsx +7 -15
- package/src/exemplars/slot.stories.tsx +64 -68
- package/src/exemplars/tabster.stories.tsx +1 -1
- package/src/exemplars/virtualizer.stories.tsx +4 -5
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useDensityContext.ts +2 -2
- package/src/playground/Custom.stories.tsx +6 -9
- package/src/primitives/Column/AUDIT.md +148 -0
- package/src/primitives/Column/Column.stories.tsx +128 -19
- package/src/primitives/Column/Column.tsx +89 -80
- package/src/primitives/Container/Container.stories.tsx +29 -0
- package/src/primitives/Container/Container.tsx +19 -0
- package/src/primitives/Container/index.ts +5 -0
- package/src/primitives/Flex/Flex.stories.tsx +0 -1
- package/src/primitives/Flex/Flex.tsx +20 -20
- package/src/primitives/Grid/Grid.stories.tsx +0 -1
- package/src/primitives/Grid/Grid.tsx +23 -36
- package/src/primitives/Panel/Panel.stories.tsx +9 -8
- package/src/primitives/Panel/Panel.tsx +43 -60
- package/src/primitives/index.ts +1 -0
- package/src/testing/Loading.tsx +47 -0
- package/src/testing/decorators/withLayout.tsx +7 -17
- package/src/testing/decorators/withTheme.tsx +10 -7
- package/src/testing/index.ts +2 -0
- package/src/translations.ts +3 -3
- package/src/util/usePx.ts +1 -0
- package/dist/lib/browser/chunk-2FKSMWNY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZNBLTSHI.mjs.map +0 -7
|
@@ -4,10 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
6
6
|
import { Slot } from '@radix-ui/react-slot';
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
import DOMPurify from 'dompurify';
|
|
8
|
+
import React, {
|
|
9
|
+
CSSProperties,
|
|
10
|
+
MouseEventHandler,
|
|
11
|
+
type PropsWithChildren,
|
|
12
|
+
createContext,
|
|
13
|
+
forwardRef,
|
|
14
|
+
useContext,
|
|
15
|
+
useMemo,
|
|
16
|
+
} from 'react';
|
|
17
|
+
|
|
18
|
+
import { composable, composableProps, iconSize, mx, slottable } from '@dxos/ui-theme';
|
|
19
|
+
import { type Density } from '@dxos/ui-types';
|
|
11
20
|
|
|
12
21
|
import { useThemeContext } from '../../hooks';
|
|
13
22
|
import { Column } from '../../primitives';
|
|
@@ -15,12 +24,21 @@ import { type ThemedClassName } from '../../util';
|
|
|
15
24
|
import { Button } from '../Button';
|
|
16
25
|
import { Icon, type IconProps } from '../Icon';
|
|
17
26
|
import { Image } from '../Image';
|
|
18
|
-
import {
|
|
27
|
+
import {
|
|
28
|
+
Toolbar,
|
|
29
|
+
ToolbarCloseIconButtonProps,
|
|
30
|
+
ToolbarDragHandleProps,
|
|
31
|
+
type ToolbarMenuItem,
|
|
32
|
+
type ToolbarMenuProps,
|
|
33
|
+
type ToolbarRootProps,
|
|
34
|
+
} from '../Toolbar';
|
|
19
35
|
|
|
20
36
|
//
|
|
21
37
|
// Context
|
|
22
38
|
//
|
|
23
39
|
|
|
40
|
+
const CARD_NAME = 'Card';
|
|
41
|
+
|
|
24
42
|
type CardContextValue = {
|
|
25
43
|
menuItems?: CardMenuItem<any>[];
|
|
26
44
|
};
|
|
@@ -32,165 +50,276 @@ const CardContext = createContext<CardContextValue>({});
|
|
|
32
50
|
// Root
|
|
33
51
|
//
|
|
34
52
|
|
|
35
|
-
|
|
53
|
+
const CARD_ROOT_NAME = 'Card.Root';
|
|
54
|
+
|
|
55
|
+
type CardRootProps = {
|
|
36
56
|
id?: string;
|
|
37
57
|
border?: boolean;
|
|
38
58
|
fullWidth?: boolean;
|
|
59
|
+
density?: Density;
|
|
60
|
+
style?: CSSProperties;
|
|
61
|
+
tabIndex?: number;
|
|
62
|
+
onClick?: MouseEventHandler<HTMLDivElement>;
|
|
63
|
+
'data-selected'?: boolean;
|
|
64
|
+
'data-testid'?: string;
|
|
39
65
|
};
|
|
40
66
|
|
|
41
|
-
|
|
42
|
-
|
|
67
|
+
/**
|
|
68
|
+
* `Card.Root` does not support `asChild`. The Column grid is the root element
|
|
69
|
+
* (one `<div>` carrying both the `dx-card` and `dx-column-root` classes
|
|
70
|
+
* instead of the previous outer-card + inner-column pair), so caller-provided
|
|
71
|
+
* HTML attributes — `onClick`, `tabIndex`, `style`, `data-*`, `grid-template-rows`
|
|
72
|
+
* overrides via `classNames` — land directly on the grid container.
|
|
73
|
+
* Slot-parents (`Focus.Item asChild`, `Mosaic.Tile asChild`, etc.) continue to
|
|
74
|
+
* work because `composable()` preserves the COMPOSABLE marker that slottable parents
|
|
75
|
+
* check before warning, and Radix `Slot` merges the parent's props onto the inner
|
|
76
|
+
* `<div>` exactly the way `slottable`'s `Slot`/`Primitive.div` branch did.
|
|
77
|
+
*/
|
|
78
|
+
const CardRoot = composable<HTMLDivElement, CardRootProps>(
|
|
79
|
+
({ children, id, role, border = true, fullWidth, density, ...props }, forwardedRef) => {
|
|
80
|
+
const { className, ...rest } = composableProps(props);
|
|
43
81
|
const { tx } = useThemeContext();
|
|
44
|
-
const Comp = asChild ? Slot : Primitive.div;
|
|
45
82
|
|
|
46
83
|
return (
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
{
|
|
84
|
+
<Column.Root
|
|
85
|
+
asChild
|
|
86
|
+
gutter={density === 'coarse' ? 'lg' : 'md'}
|
|
87
|
+
classNames={tx('card.root', { border, fullWidth }, className)}
|
|
50
88
|
role={role ?? 'group'}
|
|
51
|
-
className={tx('card.root', { border, fullWidth }, [className, classNames])}
|
|
52
|
-
ref={forwardedRef}
|
|
53
89
|
>
|
|
54
|
-
<
|
|
55
|
-
|
|
90
|
+
<div {...rest} {...(id && { 'data-object-id': id })} ref={forwardedRef}>
|
|
91
|
+
{children}
|
|
92
|
+
</div>
|
|
93
|
+
</Column.Root>
|
|
56
94
|
);
|
|
57
95
|
},
|
|
58
96
|
);
|
|
59
97
|
|
|
98
|
+
CardRoot.displayName = CARD_ROOT_NAME;
|
|
99
|
+
|
|
60
100
|
//
|
|
61
101
|
// Toolbar
|
|
62
102
|
//
|
|
63
103
|
|
|
64
|
-
|
|
65
|
-
density?: Density;
|
|
66
|
-
};
|
|
104
|
+
const CARD_TOOLBAR_NAME = 'Card.Toolbar';
|
|
67
105
|
|
|
68
|
-
|
|
69
|
-
const CardToolbar = forwardRef<HTMLDivElement, CardToolbarProps>(
|
|
70
|
-
({ children, classNames, density = 'fine', ...props }, forwardedRef) => {
|
|
71
|
-
const { tx } = useThemeContext();
|
|
106
|
+
type CardToolbarProps = ToolbarRootProps;
|
|
72
107
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
108
|
+
const CardToolbar = composable<HTMLDivElement, CardToolbarProps>(({ children, classNames, ...props }, forwardedRef) => {
|
|
109
|
+
const { tx } = useThemeContext();
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<Toolbar.Root {...props} style={iconSize(5)} classNames={[tx('card.toolbar', {}), classNames]} ref={forwardedRef}>
|
|
113
|
+
{children}
|
|
114
|
+
</Toolbar.Root>
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
CardToolbar.displayName = CARD_TOOLBAR_NAME;
|
|
119
|
+
|
|
120
|
+
//
|
|
121
|
+
// DragHandle
|
|
122
|
+
//
|
|
123
|
+
|
|
124
|
+
const CARD_DRAG_HANDLE_NAME = 'Card.DragHandle';
|
|
125
|
+
|
|
126
|
+
type CardDragHandleProps = ToolbarDragHandleProps;
|
|
127
|
+
|
|
128
|
+
const CardDragHandle = forwardRef<HTMLButtonElement, CardDragHandleProps>((props, forwardedRef) => {
|
|
129
|
+
return (
|
|
130
|
+
<CardIconBlock padding>
|
|
131
|
+
<Toolbar.DragHandle {...props} ref={forwardedRef} />
|
|
132
|
+
</CardIconBlock>
|
|
133
|
+
);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
CardDragHandle.displayName = CARD_DRAG_HANDLE_NAME;
|
|
137
|
+
|
|
138
|
+
//
|
|
139
|
+
// CloseIconButton
|
|
140
|
+
//
|
|
141
|
+
|
|
142
|
+
const CARD_CLOSE_ICON_BUTTON_NAME = 'Card.CloseIconButton';
|
|
143
|
+
|
|
144
|
+
type CloseIconButtonProps = ToolbarCloseIconButtonProps;
|
|
145
|
+
|
|
146
|
+
const CloseIconButton = forwardRef<HTMLButtonElement, CloseIconButtonProps>((props, forwardedRef) => {
|
|
147
|
+
return (
|
|
148
|
+
<CardIconBlock padding>
|
|
149
|
+
<Toolbar.CloseIconButton {...props} ref={forwardedRef} />
|
|
150
|
+
</CardIconBlock>
|
|
151
|
+
);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
CloseIconButton.displayName = CARD_CLOSE_ICON_BUTTON_NAME;
|
|
84
155
|
|
|
85
156
|
//
|
|
86
|
-
// Menu
|
|
157
|
+
// Menu
|
|
87
158
|
//
|
|
88
159
|
|
|
160
|
+
const CARD_MENU_NAME = 'Card.Menu';
|
|
161
|
+
|
|
89
162
|
type CardMenuItem<T extends any | void = void> = ToolbarMenuItem<T>;
|
|
163
|
+
|
|
90
164
|
type CardMenuProps<T extends any | void = void> = ToolbarMenuProps<T>;
|
|
91
165
|
|
|
92
|
-
const CardMenu = <T extends any | void = void>({ context, items }: CardMenuProps<T>) => {
|
|
166
|
+
const CardMenu = <T extends any | void = void>({ context, items, ...props }: CardMenuProps<T>) => {
|
|
93
167
|
const { menuItems } = useContext(CardContext) ?? {};
|
|
94
168
|
const combinedItems = [...(items ?? []), ...((menuItems as CardMenuItem<T>[]) ?? [])];
|
|
95
169
|
|
|
96
|
-
return
|
|
170
|
+
return (
|
|
171
|
+
<CardIconBlock padding>
|
|
172
|
+
<Toolbar.Menu {...props} context={context} items={combinedItems} />
|
|
173
|
+
</CardIconBlock>
|
|
174
|
+
);
|
|
97
175
|
};
|
|
98
176
|
|
|
177
|
+
(CardMenu as any).displayName = CARD_MENU_NAME;
|
|
178
|
+
|
|
99
179
|
//
|
|
100
|
-
//
|
|
180
|
+
// Icon
|
|
181
|
+
//
|
|
182
|
+
|
|
183
|
+
const CARD_ICON_NAME = 'Card.Icon';
|
|
184
|
+
|
|
185
|
+
const CardIcon = (props: IconProps) => {
|
|
186
|
+
return (
|
|
187
|
+
<CardIconBlock>
|
|
188
|
+
<Icon {...props} />
|
|
189
|
+
</CardIconBlock>
|
|
190
|
+
);
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
(CardIcon as any).displayName = CARD_ICON_NAME;
|
|
194
|
+
|
|
195
|
+
//
|
|
196
|
+
// IconBlock
|
|
101
197
|
//
|
|
102
198
|
|
|
103
|
-
|
|
199
|
+
const CARD_ICON_BLOCK_NAME = 'Card.IconBlock';
|
|
104
200
|
|
|
105
|
-
const
|
|
106
|
-
({
|
|
201
|
+
const CardIconBlock = forwardRef<HTMLDivElement, ThemedClassName<PropsWithChildren<{ padding?: boolean }>>>(
|
|
202
|
+
({ classNames, children, padding, ...props }, forwardedRef) => {
|
|
107
203
|
const { tx } = useThemeContext();
|
|
108
|
-
const Comp = asChild ? Slot : Primitive.div;
|
|
109
204
|
|
|
110
205
|
return (
|
|
111
|
-
<
|
|
112
|
-
{...props}
|
|
113
|
-
role={role ?? 'heading'}
|
|
114
|
-
className={tx('card.title', {}, [className, classNames])}
|
|
115
|
-
ref={forwardedRef}
|
|
116
|
-
>
|
|
206
|
+
<div {...props} className={tx('card.icon-block', { padding }, classNames)} ref={forwardedRef}>
|
|
117
207
|
{children}
|
|
118
|
-
</
|
|
208
|
+
</div>
|
|
119
209
|
);
|
|
120
210
|
},
|
|
121
211
|
);
|
|
122
212
|
|
|
213
|
+
CardIconBlock.displayName = CARD_ICON_BLOCK_NAME;
|
|
214
|
+
|
|
215
|
+
//
|
|
216
|
+
// Title
|
|
217
|
+
//
|
|
218
|
+
|
|
219
|
+
const CARD_TITLE_NAME = 'Card.Title';
|
|
220
|
+
|
|
221
|
+
const CardTitle = slottable<HTMLDivElement>(({ children, asChild, ...props }, forwardedRef) => {
|
|
222
|
+
const { tx } = useThemeContext();
|
|
223
|
+
const { className, ...rest } = composableProps(props, { role: 'heading' });
|
|
224
|
+
const Comp = asChild ? Slot : Primitive.div;
|
|
225
|
+
|
|
226
|
+
return (
|
|
227
|
+
<Comp {...rest} className={tx('card.title', {}, className)} ref={forwardedRef}>
|
|
228
|
+
{children}
|
|
229
|
+
</Comp>
|
|
230
|
+
);
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
CardTitle.displayName = CARD_TITLE_NAME;
|
|
234
|
+
|
|
123
235
|
//
|
|
124
236
|
// Content
|
|
125
237
|
//
|
|
126
238
|
|
|
127
|
-
|
|
239
|
+
const CARD_CONTENT_NAME = 'Card.Content';
|
|
128
240
|
|
|
129
|
-
const CardContent =
|
|
241
|
+
const CardContent = slottable<HTMLDivElement>(({ children, asChild, ...props }, forwardedRef) => {
|
|
242
|
+
const { className, ...rest } = composableProps(props);
|
|
243
|
+
const Comp = asChild ? Slot : Primitive.div;
|
|
130
244
|
const { tx } = useThemeContext();
|
|
131
245
|
|
|
132
246
|
return (
|
|
133
|
-
<
|
|
247
|
+
<Comp {...rest} className={tx('card.content', {}, className)} ref={forwardedRef}>
|
|
134
248
|
{children}
|
|
135
|
-
</
|
|
249
|
+
</Comp>
|
|
136
250
|
);
|
|
137
251
|
});
|
|
138
252
|
|
|
253
|
+
CardContent.displayName = CARD_CONTENT_NAME;
|
|
254
|
+
|
|
139
255
|
//
|
|
140
256
|
// Row
|
|
141
257
|
//
|
|
142
258
|
|
|
143
|
-
|
|
259
|
+
const CARD_ROW_NAME = 'Card.Row';
|
|
144
260
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
)
|
|
261
|
+
type CardRowProps = { icon?: string; fullWidth?: boolean };
|
|
262
|
+
|
|
263
|
+
// TODO(burdon): fullWidth should mean no columns.
|
|
264
|
+
const CardRow = slottable<HTMLDivElement, CardRowProps>(({ children, asChild, icon, ...props }, forwardedRef) => {
|
|
265
|
+
const { className, ...rest } = composableProps(props);
|
|
266
|
+
const Comp = asChild ? Slot : Primitive.div;
|
|
267
|
+
const { tx } = useThemeContext();
|
|
268
|
+
|
|
269
|
+
return (
|
|
270
|
+
<Comp {...rest} className={tx('card.row', {}, className)} ref={forwardedRef}>
|
|
271
|
+
{(icon && <CardIcon classNames='text-subdued' icon={icon} size={4} />) || <div />}
|
|
272
|
+
{children}
|
|
273
|
+
</Comp>
|
|
274
|
+
);
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
CardRow.displayName = CARD_ROW_NAME;
|
|
156
278
|
|
|
157
279
|
//
|
|
158
280
|
// Section
|
|
159
281
|
//
|
|
160
282
|
|
|
161
|
-
|
|
283
|
+
const CARD_SECTION_NAME = 'Card.Section';
|
|
162
284
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
285
|
+
/**
|
|
286
|
+
* @deprecated Merge with Card.Row fullWidth
|
|
287
|
+
*/
|
|
288
|
+
const CardSection = slottable<HTMLDivElement>(({ children, asChild, role, ...props }, forwardedRef) => {
|
|
289
|
+
const { className, ...rest } = composableProps(props);
|
|
290
|
+
const Comp = asChild ? Slot : Primitive.div;
|
|
166
291
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
292
|
+
return (
|
|
293
|
+
<Comp {...rest} role={role ?? 'none'} className={mx('col-span-full', className)} ref={forwardedRef}>
|
|
294
|
+
{children}
|
|
295
|
+
</Comp>
|
|
296
|
+
);
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
CardSection.displayName = CARD_SECTION_NAME;
|
|
174
300
|
|
|
175
301
|
//
|
|
176
302
|
// Heading
|
|
177
303
|
//
|
|
178
304
|
|
|
179
|
-
|
|
305
|
+
const CARD_HEADING_NAME = 'Card.Heading';
|
|
306
|
+
|
|
307
|
+
type CardHeadingProps = { variant?: 'default' | 'subtitle' };
|
|
180
308
|
|
|
181
309
|
/**
|
|
182
310
|
* @deprecated Use typography.
|
|
183
311
|
*/
|
|
184
|
-
const CardHeading =
|
|
185
|
-
({ children,
|
|
186
|
-
const {
|
|
312
|
+
const CardHeading = slottable<HTMLDivElement, CardHeadingProps>(
|
|
313
|
+
({ children, asChild, role, variant = 'default', ...props }, forwardedRef) => {
|
|
314
|
+
const { className, ...rest } = composableProps(props);
|
|
187
315
|
const Comp = asChild ? Slot : Primitive.div;
|
|
316
|
+
const { tx } = useThemeContext();
|
|
188
317
|
|
|
189
318
|
return (
|
|
190
319
|
<Comp
|
|
191
|
-
{...
|
|
320
|
+
{...rest}
|
|
192
321
|
role={role ?? 'heading'}
|
|
193
|
-
className={tx('card.heading', { variant },
|
|
322
|
+
className={tx('card.heading', { variant }, className)}
|
|
194
323
|
ref={forwardedRef}
|
|
195
324
|
>
|
|
196
325
|
{children}
|
|
@@ -199,48 +328,93 @@ const CardHeading = forwardRef<HTMLDivElement, CardHeadingProps>(
|
|
|
199
328
|
},
|
|
200
329
|
);
|
|
201
330
|
|
|
331
|
+
CardHeading.displayName = CARD_HEADING_NAME;
|
|
332
|
+
|
|
202
333
|
//
|
|
203
334
|
// Text
|
|
204
335
|
//
|
|
205
336
|
|
|
206
|
-
|
|
337
|
+
const CARD_TEXT_NAME = 'Card.Text';
|
|
207
338
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
339
|
+
type CardTextProps = { truncate?: boolean; variant?: 'default' | 'description' };
|
|
340
|
+
|
|
341
|
+
const CardText = slottable<HTMLDivElement, CardTextProps>(
|
|
342
|
+
({ children, asChild, role, truncate, variant = 'default', ...props }, forwardedRef) => {
|
|
343
|
+
const { className, ...rest } = composableProps(props);
|
|
211
344
|
const Comp = asChild ? Slot : Primitive.div;
|
|
345
|
+
const { tx } = useThemeContext();
|
|
212
346
|
|
|
213
347
|
return (
|
|
214
|
-
<Comp
|
|
215
|
-
{...props}
|
|
216
|
-
role={role ?? 'none'}
|
|
217
|
-
className={tx('card.text', { variant }, [classNames, className])}
|
|
218
|
-
ref={forwardedRef}
|
|
219
|
-
>
|
|
348
|
+
<Comp {...rest} role={role ?? 'none'} className={tx('card.text', { variant }, className)} ref={forwardedRef}>
|
|
220
349
|
<span className={tx('card.text-span', { variant, truncate })}>{children}</span>
|
|
221
350
|
</Comp>
|
|
222
351
|
);
|
|
223
352
|
},
|
|
224
353
|
);
|
|
225
354
|
|
|
355
|
+
CardText.displayName = CARD_TEXT_NAME;
|
|
356
|
+
|
|
357
|
+
//
|
|
358
|
+
// Html
|
|
359
|
+
//
|
|
360
|
+
|
|
361
|
+
const CARD_HTML_NAME = 'Card.Html';
|
|
362
|
+
|
|
363
|
+
type CardHtmlProps = { html: string; variant?: 'default' | 'description' };
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Renders sanitized HTML content inside a card text slot.
|
|
367
|
+
* Uses DOMPurify to prevent XSS from untrusted markup (e.g. RSS feed content).
|
|
368
|
+
*/
|
|
369
|
+
const CardHtml = ({ html, variant = 'default', ...props }: CardHtmlProps & ThemedClassName<object>) => {
|
|
370
|
+
const { tx } = useThemeContext();
|
|
371
|
+
const sanitized = useMemo(() => DOMPurify.sanitize(html), [html]);
|
|
372
|
+
|
|
373
|
+
return (
|
|
374
|
+
<div
|
|
375
|
+
{...props}
|
|
376
|
+
className={tx('card.text', { variant })}
|
|
377
|
+
// eslint-disable-next-line react/no-danger
|
|
378
|
+
dangerouslySetInnerHTML={{ __html: sanitized }}
|
|
379
|
+
/>
|
|
380
|
+
);
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
(CardHtml as any).displayName = CARD_HTML_NAME;
|
|
384
|
+
|
|
226
385
|
//
|
|
227
386
|
// Poster
|
|
228
387
|
//
|
|
229
388
|
|
|
389
|
+
const CARD_POSTER_NAME = 'Card.Poster';
|
|
390
|
+
|
|
230
391
|
type CardPosterProps = ThemedClassName<
|
|
231
392
|
{
|
|
232
393
|
alt: string;
|
|
233
394
|
aspect?: 'video' | 'auto';
|
|
395
|
+
/**
|
|
396
|
+
* How the image fills the poster box. `'contain'` (default) preserves
|
|
397
|
+
* aspect ratio and may letterbox; `'cover'` fills the box edge-to-edge,
|
|
398
|
+
* cropping as needed. Forwarded to the underlying `Image`'s
|
|
399
|
+
* `object-fit`.
|
|
400
|
+
*/
|
|
401
|
+
fit?: 'contain' | 'cover';
|
|
234
402
|
} & Partial<{ image: string; icon: string }>
|
|
235
403
|
>;
|
|
236
404
|
|
|
237
405
|
const CardPoster = (props: CardPosterProps) => {
|
|
238
406
|
const { tx } = useThemeContext();
|
|
239
407
|
const aspect = props.aspect === 'auto' ? 'aspect-auto' : 'aspect-video';
|
|
408
|
+
|
|
240
409
|
if (props.image) {
|
|
241
410
|
return (
|
|
242
|
-
<div
|
|
243
|
-
<Image
|
|
411
|
+
<div className='col-span-full'>
|
|
412
|
+
<Image
|
|
413
|
+
classNames={[tx('card.poster', {}), aspect, props.classNames]}
|
|
414
|
+
src={props.image}
|
|
415
|
+
alt={props.alt}
|
|
416
|
+
fit={props.fit}
|
|
417
|
+
/>
|
|
244
418
|
</div>
|
|
245
419
|
);
|
|
246
420
|
}
|
|
@@ -254,27 +428,35 @@ const CardPoster = (props: CardPosterProps) => {
|
|
|
254
428
|
}
|
|
255
429
|
};
|
|
256
430
|
|
|
431
|
+
(CardPoster as any).displayName = CARD_POSTER_NAME;
|
|
432
|
+
|
|
257
433
|
//
|
|
258
434
|
// Action
|
|
259
435
|
//
|
|
260
436
|
|
|
437
|
+
const CARD_ACTION_NAME = 'Card.Action';
|
|
438
|
+
|
|
261
439
|
type CardActionProps = { icon?: string; label: string; actionIcon?: string; onClick?: () => void };
|
|
262
440
|
|
|
263
441
|
const CardAction = ({ icon, actionIcon = 'ph--arrow-right--regular', label, onClick }: CardActionProps) => {
|
|
264
442
|
const { tx } = useThemeContext();
|
|
265
443
|
return (
|
|
266
444
|
<Button variant='ghost' classNames={tx('card.action', {})} onClick={onClick}>
|
|
267
|
-
{icon ? <CardIcon classNames='text-subdued' icon={icon} /> : <div />}
|
|
445
|
+
{icon ? <CardIcon classNames='text-subdued' icon={icon} size={4} /> : <div />}
|
|
268
446
|
<span className={tx('card.action-label', {}, !actionIcon ? 'col-span-2' : undefined)}>{label}</span>
|
|
269
|
-
{actionIcon && <CardIcon icon={actionIcon} />}
|
|
447
|
+
{actionIcon && <CardIcon icon={actionIcon} size={4} />}
|
|
270
448
|
</Button>
|
|
271
449
|
);
|
|
272
450
|
};
|
|
273
451
|
|
|
452
|
+
(CardAction as any).displayName = CARD_ACTION_NAME;
|
|
453
|
+
|
|
274
454
|
//
|
|
275
455
|
// Link
|
|
276
456
|
//
|
|
277
457
|
|
|
458
|
+
const CARD_LINK_NAME = 'Card.Link';
|
|
459
|
+
|
|
278
460
|
type CardLinkProps = { label: string; href: string };
|
|
279
461
|
|
|
280
462
|
const CardLink = ({ label, href }: CardLinkProps) => {
|
|
@@ -288,35 +470,7 @@ const CardLink = ({ label, href }: CardLinkProps) => {
|
|
|
288
470
|
);
|
|
289
471
|
};
|
|
290
472
|
|
|
291
|
-
|
|
292
|
-
// Icon
|
|
293
|
-
//
|
|
294
|
-
|
|
295
|
-
const CardIcon = ({ toolbar, ...props }: IconProps & { toolbar?: boolean }) => {
|
|
296
|
-
return (
|
|
297
|
-
<CardIconBlock>
|
|
298
|
-
<Icon {...props} size={toolbar ? 5 : 4} />
|
|
299
|
-
</CardIconBlock>
|
|
300
|
-
);
|
|
301
|
-
};
|
|
302
|
-
|
|
303
|
-
//
|
|
304
|
-
// IconBlock
|
|
305
|
-
//
|
|
306
|
-
|
|
307
|
-
const CardIconBlock = ({
|
|
308
|
-
classNames,
|
|
309
|
-
children,
|
|
310
|
-
role,
|
|
311
|
-
...props
|
|
312
|
-
}: ThemedClassName<PropsWithChildren<HTMLAttributes<HTMLDivElement>>>) => {
|
|
313
|
-
const { tx } = useThemeContext();
|
|
314
|
-
return (
|
|
315
|
-
<div {...props} role={role ?? 'none'} className={tx('card.icon-block', {}, classNames)}>
|
|
316
|
-
{children}
|
|
317
|
-
</div>
|
|
318
|
-
);
|
|
319
|
-
};
|
|
473
|
+
(CardLink as any).displayName = CARD_LINK_NAME;
|
|
320
474
|
|
|
321
475
|
//
|
|
322
476
|
// Card
|
|
@@ -329,14 +483,14 @@ export const Card = {
|
|
|
329
483
|
Toolbar: CardToolbar,
|
|
330
484
|
ToolbarIconButton: Toolbar.IconButton,
|
|
331
485
|
ToolbarSeparator: Toolbar.Separator,
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
486
|
+
|
|
487
|
+
// Toolbar blocks
|
|
488
|
+
IconBlock: CardIconBlock,
|
|
489
|
+
DragHandle: CardDragHandle,
|
|
490
|
+
CloseIconButton: CloseIconButton,
|
|
337
491
|
Menu: CardMenu,
|
|
338
492
|
Icon: CardIcon,
|
|
339
|
-
|
|
493
|
+
Title: CardTitle,
|
|
340
494
|
|
|
341
495
|
// Content
|
|
342
496
|
Content: CardContent,
|
|
@@ -344,9 +498,17 @@ export const Card = {
|
|
|
344
498
|
Section: CardSection,
|
|
345
499
|
Heading: CardHeading,
|
|
346
500
|
Text: CardText,
|
|
501
|
+
Html: CardHtml,
|
|
347
502
|
Poster: CardPoster,
|
|
348
503
|
Action: CardAction,
|
|
349
504
|
Link: CardLink,
|
|
350
505
|
};
|
|
351
506
|
|
|
352
|
-
export type {
|
|
507
|
+
export type {
|
|
508
|
+
CardContextValue,
|
|
509
|
+
CardRootProps,
|
|
510
|
+
CardToolbarProps,
|
|
511
|
+
CardDragHandleProps,
|
|
512
|
+
CloseIconButtonProps,
|
|
513
|
+
CardMenuProps,
|
|
514
|
+
};
|
|
@@ -10,7 +10,6 @@ import { Button, type ButtonProps, IconButton } from '../Button';
|
|
|
10
10
|
import { Icon, type IconProps } from '../Icon';
|
|
11
11
|
import { useTranslation } from '../ThemeProvider';
|
|
12
12
|
import { type TooltipScopedProps, useTooltipContext } from '../Tooltip';
|
|
13
|
-
|
|
14
13
|
import { useClipboard } from './ClipboardProvider';
|
|
15
14
|
|
|
16
15
|
export type CopyButtonProps = ButtonProps &
|
|
@@ -31,12 +30,12 @@ export const CopyButton = ({ classNames, value, size = 5, ...props }: CopyButton
|
|
|
31
30
|
onClick={() => setTextValue(value)}
|
|
32
31
|
data-testid='copy-invitation'
|
|
33
32
|
>
|
|
34
|
-
<div
|
|
35
|
-
<span className='px-1'>{t('copy
|
|
33
|
+
<div className={mx('flex gap-1 items-center', isCopied && inactiveLabelStyles)}>
|
|
34
|
+
<span className='px-1'>{t('copy.label')}</span>
|
|
36
35
|
<Icon icon='ph--copy--regular' size={size} />
|
|
37
36
|
</div>
|
|
38
|
-
<div
|
|
39
|
-
<span className='px-1'>{t('copy
|
|
37
|
+
<div className={mx('flex gap-1 items-center', !isCopied && inactiveLabelStyles)}>
|
|
38
|
+
<span className='px-1'>{t('copy-success.label')}</span>
|
|
40
39
|
<Icon icon='ph--check--regular' size={size} />
|
|
41
40
|
</div>
|
|
42
41
|
</Button>
|
|
@@ -58,7 +57,7 @@ export const CopyButtonIconOnly = ({
|
|
|
58
57
|
const { t } = useTranslation(osTranslations);
|
|
59
58
|
const { textValue, setTextValue } = useClipboard();
|
|
60
59
|
const isCopied = textValue === value;
|
|
61
|
-
const label = isCopied ? t('copy
|
|
60
|
+
const label = isCopied ? t('copy-success.label') : (props.label ?? t('copy.label'));
|
|
62
61
|
const { onOpen } = useTooltipContext('CopyButton', __scopeTooltip);
|
|
63
62
|
return (
|
|
64
63
|
<IconButton
|