@dxos/react-ui 0.3.9-main.915c0ba → 0.3.9-main.9c71aa7
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/index.mjs +273 -389
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/components/Input/Input.d.ts +2 -2
- 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/Main/Main.d.ts +2 -2
- package/dist/types/src/components/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/components/Input/Input.stories.tsx +19 -2
- package/src/components/index.ts +0 -1
- package/dist/types/src/components/Card/Card.d.ts +0 -52
- package/dist/types/src/components/Card/Card.d.ts.map +0 -1
- package/dist/types/src/components/Card/Card.stories.d.ts +0 -56
- package/dist/types/src/components/Card/Card.stories.d.ts.map +0 -1
- package/dist/types/src/components/Card/index.d.ts +0 -2
- package/dist/types/src/components/Card/index.d.ts.map +0 -1
- package/src/components/Card/Card.stories.tsx +0 -220
- package/src/components/Card/Card.tsx +0 -147
- package/src/components/Card/index.ts +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui",
|
|
3
|
-
"version": "0.3.9-main.
|
|
3
|
+
"version": "0.3.9-main.9c71aa7",
|
|
4
4
|
"description": "Opinionated, styled, low-level React components for DXOS.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"jdenticon": "^3.2.0",
|
|
40
40
|
"keyborg": "^2.0.0",
|
|
41
41
|
"react-i18next": "^11.18.6",
|
|
42
|
-
"@dxos/react-hooks": "0.3.9-main.
|
|
43
|
-
"@dxos/react-input": "0.3.9-main.
|
|
44
|
-
"@dxos/react-list": "0.3.9-main.
|
|
45
|
-
"@dxos/react-ui-types": "0.3.9-main.
|
|
42
|
+
"@dxos/react-hooks": "0.3.9-main.9c71aa7",
|
|
43
|
+
"@dxos/react-input": "0.3.9-main.9c71aa7",
|
|
44
|
+
"@dxos/react-list": "0.3.9-main.9c71aa7",
|
|
45
|
+
"@dxos/react-ui-types": "0.3.9-main.9c71aa7"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@dnd-kit/core": "^6.0.5",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"react-dom": "^18.2.0",
|
|
58
58
|
"vite": "^4.3.9",
|
|
59
59
|
"vite-plugin-turbosnap": "^1.0.2",
|
|
60
|
-
"@dxos/react-ui-theme": "0.3.9-main.
|
|
60
|
+
"@dxos/react-ui-theme": "0.3.9-main.9c71aa7"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@phosphor-icons/react": "^2.0.5",
|
|
@@ -6,6 +6,7 @@ import '@dxosTheme';
|
|
|
6
6
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
|
|
9
|
+
import { baseSurface, chromeSurface, groupSurface, mx, surfaceElevation } from '@dxos/react-ui-theme';
|
|
9
10
|
import { type MessageValence } from '@dxos/react-ui-types';
|
|
10
11
|
|
|
11
12
|
import { Input } from './Input';
|
|
@@ -22,7 +23,7 @@ type StoryInputProps = Partial<{
|
|
|
22
23
|
validationValence: MessageValence;
|
|
23
24
|
}>;
|
|
24
25
|
|
|
25
|
-
const
|
|
26
|
+
const StoryInputContent = ({
|
|
26
27
|
type = 'default',
|
|
27
28
|
label,
|
|
28
29
|
description,
|
|
@@ -32,7 +33,6 @@ const StoryInput = ({
|
|
|
32
33
|
validationMessage,
|
|
33
34
|
...props
|
|
34
35
|
}: StoryInputProps) => {
|
|
35
|
-
// TODO(thure): Implement
|
|
36
36
|
return (
|
|
37
37
|
<Input.Root {...{ validationValence }}>
|
|
38
38
|
<Input.Label srOnly={labelVisuallyHidden}>{label}</Input.Label>
|
|
@@ -53,6 +53,23 @@ const StoryInput = ({
|
|
|
53
53
|
);
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
+
const StoryInput = (props: StoryInputProps) => {
|
|
57
|
+
// TODO(thure): Implement
|
|
58
|
+
return (
|
|
59
|
+
<div className='space-b-4'>
|
|
60
|
+
<div className={mx(baseSurface, 'p-4')}>
|
|
61
|
+
<StoryInputContent {...props} />
|
|
62
|
+
</div>
|
|
63
|
+
<div className={mx(groupSurface, 'p-4 rounded-lg', surfaceElevation({ elevation: 'group' }))}>
|
|
64
|
+
<StoryInputContent {...props} />
|
|
65
|
+
</div>
|
|
66
|
+
<div className={mx(chromeSurface, 'p-4 rounded-lg', surfaceElevation({ elevation: 'chrome' }))}>
|
|
67
|
+
<StoryInputContent {...props} />
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
56
73
|
export default {
|
|
57
74
|
component: StoryInput,
|
|
58
75
|
// TODO(thure): Refactor
|
package/src/components/index.ts
CHANGED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { type Icon } from '@phosphor-icons/react';
|
|
2
|
-
import { type Primitive } from '@radix-ui/react-primitive';
|
|
3
|
-
import React, { type ComponentPropsWithoutRef, type ComponentPropsWithRef, type FC } from 'react';
|
|
4
|
-
import { type ThemedClassName } from '../../util';
|
|
5
|
-
type CardRootProps = ThemedClassName<ComponentPropsWithRef<typeof Primitive.div>> & {
|
|
6
|
-
grow?: boolean;
|
|
7
|
-
square?: boolean;
|
|
8
|
-
noPadding?: boolean;
|
|
9
|
-
};
|
|
10
|
-
type CardHeaderProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> & {
|
|
11
|
-
floating?: boolean;
|
|
12
|
-
};
|
|
13
|
-
export declare const CardHeader: FC<CardHeaderProps>;
|
|
14
|
-
type CardTitleProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> & {
|
|
15
|
-
center?: boolean;
|
|
16
|
-
title?: string;
|
|
17
|
-
};
|
|
18
|
-
export declare const CardTitle: FC<CardTitleProps>;
|
|
19
|
-
type CardDragHandleProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> & {
|
|
20
|
-
position?: 'left' | 'right';
|
|
21
|
-
};
|
|
22
|
-
type CardEndcapProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> & {
|
|
23
|
-
Icon: Icon;
|
|
24
|
-
position?: 'left' | 'right';
|
|
25
|
-
};
|
|
26
|
-
type CardBodyProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> & {
|
|
27
|
-
gutter?: boolean;
|
|
28
|
-
};
|
|
29
|
-
export declare const CardBody: FC<CardBodyProps>;
|
|
30
|
-
type CardMediaProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> & {
|
|
31
|
-
src?: string;
|
|
32
|
-
contain?: boolean;
|
|
33
|
-
};
|
|
34
|
-
export declare const CardMedia: FC<CardMediaProps>;
|
|
35
|
-
export declare const Card: {
|
|
36
|
-
Root: React.ForwardRefExoticComponent<Pick<CardRootProps, "children" | "slot" | "style" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "asChild" | "classNames" | "square" | "grow" | "noPadding"> & React.RefAttributes<HTMLDivElement>>;
|
|
37
|
-
Header: React.FC<CardHeaderProps>;
|
|
38
|
-
DragHandle: React.FC<CardDragHandleProps>;
|
|
39
|
-
Endcap: React.FC<CardEndcapProps>;
|
|
40
|
-
Menu: React.ForwardRefExoticComponent<Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "className"> & {
|
|
41
|
-
classNames?: import("@dxos/react-ui-types").ClassNameValue;
|
|
42
|
-
} & {
|
|
43
|
-
position?: "right" | "left" | undefined;
|
|
44
|
-
} & {
|
|
45
|
-
children?: React.ReactNode;
|
|
46
|
-
} & React.RefAttributes<HTMLDivElement>>;
|
|
47
|
-
Title: React.FC<CardTitleProps>;
|
|
48
|
-
Body: React.FC<CardBodyProps>;
|
|
49
|
-
Media: React.FC<CardMediaProps>;
|
|
50
|
-
};
|
|
51
|
-
export type { CardRootProps };
|
|
52
|
-
//# sourceMappingURL=Card.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../../../src/components/Card/Card.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAsC,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,EACZ,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,EAAE,EAGR,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAGlD,KAAK,aAAa,GAAG,eAAe,CAAC,qBAAqB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG;IAClF,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAcF,KAAK,eAAe,GAAG,eAAe,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEjG,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAO1C,CAAC;AAEF,KAAK,cAAc,GAAG,eAAe,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,GAAG;IACvE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CAOxC,CAAC;AAGF,KAAK,mBAAmB,GAAG,eAAe,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAAC;AAY9G,KAAK,eAAe,GAAG,eAAe,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,GAAG;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAAC;AAqCtH,KAAK,aAAa,GAAG,eAAe,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAE7F,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAQtC,CAAC;AAEF,KAAK,cAAc,GAAG,eAAe,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAG7G,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CAOxC,CAAC;AAEF,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;CAShB,CAAC;AAEF,YAAY,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import '@dxosTheme';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
declare const _default: {
|
|
4
|
-
component: {
|
|
5
|
-
Root: React.ForwardRefExoticComponent<Pick<import("./Card").CardRootProps, "children" | "slot" | "style" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "asChild" | "classNames" | "square" | "grow" | "noPadding"> & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
-
Header: React.FC<Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "className"> & {
|
|
7
|
-
classNames?: import("@dxos/react-ui-types").ClassNameValue;
|
|
8
|
-
} & {
|
|
9
|
-
floating?: boolean | undefined;
|
|
10
|
-
}>;
|
|
11
|
-
DragHandle: React.FC<Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "className"> & {
|
|
12
|
-
classNames?: import("@dxos/react-ui-types").ClassNameValue;
|
|
13
|
-
} & {
|
|
14
|
-
position?: "right" | "left" | undefined;
|
|
15
|
-
}>;
|
|
16
|
-
Endcap: React.FC<Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "className"> & {
|
|
17
|
-
classNames?: import("@dxos/react-ui-types").ClassNameValue;
|
|
18
|
-
} & {
|
|
19
|
-
Icon: import("@phosphor-icons/react").Icon;
|
|
20
|
-
position?: "right" | "left" | undefined;
|
|
21
|
-
}>;
|
|
22
|
-
Menu: React.ForwardRefExoticComponent<Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "className"> & {
|
|
23
|
-
classNames?: import("@dxos/react-ui-types").ClassNameValue;
|
|
24
|
-
} & {
|
|
25
|
-
position?: "right" | "left" | undefined;
|
|
26
|
-
} & {
|
|
27
|
-
children?: React.ReactNode;
|
|
28
|
-
} & React.RefAttributes<HTMLDivElement>>;
|
|
29
|
-
Title: React.FC<Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "className"> & {
|
|
30
|
-
classNames?: import("@dxos/react-ui-types").ClassNameValue;
|
|
31
|
-
} & {
|
|
32
|
-
center?: boolean | undefined;
|
|
33
|
-
title?: string | undefined;
|
|
34
|
-
}>;
|
|
35
|
-
Body: React.FC<Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "className"> & {
|
|
36
|
-
classNames?: import("@dxos/react-ui-types").ClassNameValue;
|
|
37
|
-
} & {
|
|
38
|
-
gutter?: boolean | undefined;
|
|
39
|
-
}>;
|
|
40
|
-
Media: React.FC<Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "className"> & {
|
|
41
|
-
classNames?: import("@dxos/react-ui-types").ClassNameValue;
|
|
42
|
-
} & {
|
|
43
|
-
src?: string | undefined;
|
|
44
|
-
contain?: boolean | undefined;
|
|
45
|
-
}>;
|
|
46
|
-
};
|
|
47
|
-
decorators: ((Story: any) => JSX.Element)[];
|
|
48
|
-
parameters: {
|
|
49
|
-
layout: string;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
export default _default;
|
|
53
|
-
export declare const Draggable: () => JSX.Element;
|
|
54
|
-
export declare const ReadOnly: () => JSX.Element;
|
|
55
|
-
export declare const Editable: () => JSX.Element;
|
|
56
|
-
//# sourceMappingURL=Card.stories.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Card.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Card/Card.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAMpB,OAAO,KAAoD,MAAM,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA+L7D,GAAG;;;;;AAHf,wBAiBE;AAEF,eAAO,MAAM,SAAS,mBAA2B,CAAC;AAClD,eAAO,MAAM,QAAQ,mBAA8B,CAAC;AACpD,eAAO,MAAM,QAAQ,mBAA8B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Card/index.ts"],"names":[],"mappings":"AAIA,cAAc,QAAQ,CAAC"}
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxosTheme';
|
|
6
|
-
|
|
7
|
-
import { DndContext, type DragEndEvent } from '@dnd-kit/core';
|
|
8
|
-
import { arrayMove, SortableContext, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
|
9
|
-
import { CSS } from '@dnd-kit/utilities';
|
|
10
|
-
import { faker } from '@faker-js/faker';
|
|
11
|
-
import React, { type FC, type PropsWithChildren, useState } from 'react';
|
|
12
|
-
|
|
13
|
-
import { chromeSurface, mx } from '@dxos/react-ui-theme';
|
|
14
|
-
|
|
15
|
-
import { Card } from './Card';
|
|
16
|
-
import { DensityProvider } from '../DensityProvider';
|
|
17
|
-
import { DropdownMenu } from '../DropdownMenu';
|
|
18
|
-
import { Input } from '../Input';
|
|
19
|
-
import { ScrollArea } from '../ScrollArea';
|
|
20
|
-
|
|
21
|
-
faker.seed(1);
|
|
22
|
-
|
|
23
|
-
// https://unsplash.com
|
|
24
|
-
// TODO(burdon): Use https://picsum.photos
|
|
25
|
-
const testImages = [
|
|
26
|
-
'https://images.unsplash.com/photo-1616394158624-a2ba9cfe2994',
|
|
27
|
-
'https://images.unsplash.com/photo-1507941097613-9f2157b69235',
|
|
28
|
-
'https://images.unsplash.com/photo-1431274172761-fca41d930114',
|
|
29
|
-
'https://images.unsplash.com/photo-1513635269975-59663e0ac1ad',
|
|
30
|
-
'https://images.unsplash.com/photo-1564221710304-0b37c8b9d729',
|
|
31
|
-
'https://images.unsplash.com/photo-1605425183435-25b7e99104a4',
|
|
32
|
-
];
|
|
33
|
-
|
|
34
|
-
type CardData = {
|
|
35
|
-
id: string;
|
|
36
|
-
title: string;
|
|
37
|
-
body: string;
|
|
38
|
-
image?: string;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const DraggableCard: FC<{ data: CardData; onDelete: (id: string) => void }> = ({
|
|
42
|
-
data: { id, title, body, image },
|
|
43
|
-
onDelete,
|
|
44
|
-
}) => {
|
|
45
|
-
const { attributes, listeners, setNodeRef, transform } = useSortable({ id });
|
|
46
|
-
const t = transform ? Object.assign(transform, { scaleY: 1 }) : null;
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<Card.Root ref={setNodeRef} style={{ transform: CSS.Transform.toString(t) }}>
|
|
50
|
-
<Card.Header>
|
|
51
|
-
<Card.DragHandle {...listeners} {...attributes} />
|
|
52
|
-
<Card.Title title={title} />
|
|
53
|
-
<DropdownMenu.Root>
|
|
54
|
-
<DropdownMenu.Trigger asChild>
|
|
55
|
-
<Card.Menu />
|
|
56
|
-
</DropdownMenu.Trigger>
|
|
57
|
-
<DropdownMenu.Content>
|
|
58
|
-
<DropdownMenu.Viewport>
|
|
59
|
-
<DropdownMenu.Item onClick={() => onDelete(id)}>Delete</DropdownMenu.Item>
|
|
60
|
-
</DropdownMenu.Viewport>
|
|
61
|
-
</DropdownMenu.Content>
|
|
62
|
-
</DropdownMenu.Root>
|
|
63
|
-
</Card.Header>
|
|
64
|
-
<Card.Body classNames={'text-sm'} gutter>
|
|
65
|
-
<p>{body}</p>
|
|
66
|
-
</Card.Body>
|
|
67
|
-
{image && <Card.Media src={image} classNames={'h-[160px]'} />}
|
|
68
|
-
</Card.Root>
|
|
69
|
-
);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const DraggableStory: FC<PropsWithChildren> = ({ children }) => {
|
|
73
|
-
const [cards, setCards] = useState<CardData[]>(
|
|
74
|
-
Array.from({ length: 7 }).map(() => ({
|
|
75
|
-
id: faker.string.uuid(),
|
|
76
|
-
title: faker.lorem.sentence(3),
|
|
77
|
-
body: faker.lorem.sentences(),
|
|
78
|
-
image: faker.datatype.boolean() ? faker.helpers.arrayElement(testImages) : undefined,
|
|
79
|
-
})),
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
const handleDelete = (id: string) => {
|
|
83
|
-
setCards((cards) => cards.filter((card) => card.id !== id));
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
const handleDragEnd = (event: DragEndEvent) => {
|
|
87
|
-
const { active, over } = event;
|
|
88
|
-
if (active.id !== over?.id) {
|
|
89
|
-
setCards((cards) => {
|
|
90
|
-
const oldIndex = cards.findIndex((card) => card.id === active.id);
|
|
91
|
-
const newIndex = cards.findIndex((card) => card.id === over?.id);
|
|
92
|
-
return arrayMove(cards, oldIndex, newIndex);
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
return (
|
|
98
|
-
<DndContext onDragEnd={handleDragEnd}>
|
|
99
|
-
<SortableContext items={cards.map(({ id }) => id)} strategy={verticalListSortingStrategy}>
|
|
100
|
-
<div className='flex flex-col overflow-y-scroll'>
|
|
101
|
-
<div className='flex flex-col gap-4'>
|
|
102
|
-
{cards.map((card) => (
|
|
103
|
-
<DraggableCard key={card.id} data={card} onDelete={handleDelete} />
|
|
104
|
-
))}
|
|
105
|
-
</div>
|
|
106
|
-
</div>
|
|
107
|
-
</SortableContext>
|
|
108
|
-
</DndContext>
|
|
109
|
-
);
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
const ReadonlyCardStory = () => {
|
|
113
|
-
return (
|
|
114
|
-
<div className='flex flex-col overflow-y-scroll'>
|
|
115
|
-
<div className='flex flex-col gap-4'>
|
|
116
|
-
<Card.Root square noPadding>
|
|
117
|
-
<Card.Header floating>
|
|
118
|
-
<Card.DragHandle position='left' />
|
|
119
|
-
<Card.Menu position='right' />
|
|
120
|
-
</Card.Header>
|
|
121
|
-
<Card.Media src={testImages[1]} />
|
|
122
|
-
</Card.Root>
|
|
123
|
-
|
|
124
|
-
<Card.Root>
|
|
125
|
-
<Card.Header>
|
|
126
|
-
<Card.Title title={faker.lorem.sentence(3)} />
|
|
127
|
-
</Card.Header>
|
|
128
|
-
</Card.Root>
|
|
129
|
-
|
|
130
|
-
<Card.Root>
|
|
131
|
-
<Card.Body classNames={'text-sm font-thin h-[100px]'}>
|
|
132
|
-
<ScrollArea.Root>
|
|
133
|
-
<ScrollArea.Viewport>{faker.lorem.sentences(16)}</ScrollArea.Viewport>
|
|
134
|
-
<ScrollArea.Scrollbar orientation='vertical'>
|
|
135
|
-
<ScrollArea.Thumb />
|
|
136
|
-
</ScrollArea.Scrollbar>
|
|
137
|
-
</ScrollArea.Root>
|
|
138
|
-
</Card.Body>
|
|
139
|
-
</Card.Root>
|
|
140
|
-
|
|
141
|
-
<Card.Root>
|
|
142
|
-
<Card.Header>
|
|
143
|
-
<Card.Title center title={faker.lorem.sentence(3)} />
|
|
144
|
-
</Card.Header>
|
|
145
|
-
<Card.Body classNames={'text-sm font-thin'}>{faker.lorem.sentences(3)}</Card.Body>
|
|
146
|
-
</Card.Root>
|
|
147
|
-
|
|
148
|
-
<Card.Root>
|
|
149
|
-
<Card.Header>
|
|
150
|
-
<Card.DragHandle />
|
|
151
|
-
<Card.Title title={faker.lorem.sentence(8)} />
|
|
152
|
-
{/* TODO(burdon): Menu util. */}
|
|
153
|
-
<Card.Menu />
|
|
154
|
-
</Card.Header>
|
|
155
|
-
<Card.Body gutter classNames={'gap-2 text-sm font-thin'}>
|
|
156
|
-
<p>Content with gutter</p>
|
|
157
|
-
<p className='line-clamp-3'>{faker.lorem.sentences(3)}</p>
|
|
158
|
-
</Card.Body>
|
|
159
|
-
</Card.Root>
|
|
160
|
-
|
|
161
|
-
<Card.Root>
|
|
162
|
-
<Card.Header>
|
|
163
|
-
<Card.DragHandle />
|
|
164
|
-
<Card.Title title={faker.lorem.sentence(3)} />
|
|
165
|
-
<Card.Menu />
|
|
166
|
-
</Card.Header>
|
|
167
|
-
<Card.Body gutter classNames={'text-sm gap-2 font-thin'}>
|
|
168
|
-
<p className='line-clamp-3'>{faker.lorem.sentences(1)}</p>
|
|
169
|
-
</Card.Body>
|
|
170
|
-
<Card.Media classNames={'h-[200px] grayscale'} src={testImages[0]} />
|
|
171
|
-
<Card.Body gutter classNames={'text-sm gap-2 font-thin'}>
|
|
172
|
-
<p className='line-clamp-3'>{faker.lorem.sentences(3)}</p>
|
|
173
|
-
</Card.Body>
|
|
174
|
-
</Card.Root>
|
|
175
|
-
</div>
|
|
176
|
-
</div>
|
|
177
|
-
);
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
const EditableCardStory = () => {
|
|
181
|
-
return (
|
|
182
|
-
<div className='flex flex-col h-full justify-center'>
|
|
183
|
-
<Card.Root>
|
|
184
|
-
<Card.Header>
|
|
185
|
-
<Card.DragHandle />
|
|
186
|
-
<Input.Root>
|
|
187
|
-
<Input.TextInput classNames={'-mx-2 px-2'} variant='subdued' placeholder={'Title'} />
|
|
188
|
-
</Input.Root>
|
|
189
|
-
<Card.Menu />
|
|
190
|
-
</Card.Header>
|
|
191
|
-
<Card.Body gutter classNames={'gap-2 text-sm font-thin'}>
|
|
192
|
-
{faker.lorem.sentences()}
|
|
193
|
-
</Card.Body>
|
|
194
|
-
</Card.Root>
|
|
195
|
-
</div>
|
|
196
|
-
);
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
export default {
|
|
200
|
-
component: Card,
|
|
201
|
-
decorators: [
|
|
202
|
-
(Story: any) => (
|
|
203
|
-
<div className={mx('flex h-screen w-full justify-center overflow-hidden', chromeSurface)}>
|
|
204
|
-
<div className='flex flex-col w-[360px] overflow-hidden'>
|
|
205
|
-
{/* TODO(burdon): Story for different densities. */}
|
|
206
|
-
<DensityProvider density='fine'>
|
|
207
|
-
<Story />
|
|
208
|
-
</DensityProvider>
|
|
209
|
-
</div>
|
|
210
|
-
</div>
|
|
211
|
-
),
|
|
212
|
-
],
|
|
213
|
-
parameters: {
|
|
214
|
-
layout: 'fullscreen',
|
|
215
|
-
},
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
export const Draggable = () => <DraggableStory />;
|
|
219
|
-
export const ReadOnly = () => <ReadonlyCardStory />;
|
|
220
|
-
export const Editable = () => <EditableCardStory />;
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { DotsSixVertical, DotsThreeVertical, type Icon } from '@phosphor-icons/react';
|
|
6
|
-
import { type Primitive } from '@radix-ui/react-primitive';
|
|
7
|
-
import React, {
|
|
8
|
-
type ComponentPropsWithoutRef,
|
|
9
|
-
type ComponentPropsWithRef,
|
|
10
|
-
type FC,
|
|
11
|
-
forwardRef,
|
|
12
|
-
type PropsWithChildren,
|
|
13
|
-
} from 'react';
|
|
14
|
-
|
|
15
|
-
import { useDensityContext, useThemeContext } from '../../hooks';
|
|
16
|
-
import { type ThemedClassName } from '../../util';
|
|
17
|
-
import { DropdownMenu } from '../DropdownMenu';
|
|
18
|
-
|
|
19
|
-
type CardRootProps = ThemedClassName<ComponentPropsWithRef<typeof Primitive.div>> & {
|
|
20
|
-
grow?: boolean;
|
|
21
|
-
square?: boolean;
|
|
22
|
-
noPadding?: boolean;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
// TODO(burdon): Forward refs for all components?
|
|
26
|
-
const CardRoot = forwardRef<HTMLDivElement, CardRootProps>(
|
|
27
|
-
({ grow, square, noPadding, classNames, children, ...props }, forwardedRef) => {
|
|
28
|
-
const { tx } = useThemeContext();
|
|
29
|
-
return (
|
|
30
|
-
<div {...props} ref={forwardedRef} className={tx('card.root', 'card', { grow, square, noPadding }, classNames)}>
|
|
31
|
-
{children}
|
|
32
|
-
</div>
|
|
33
|
-
);
|
|
34
|
-
},
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
type CardHeaderProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> & { floating?: boolean };
|
|
38
|
-
|
|
39
|
-
export const CardHeader: FC<CardHeaderProps> = ({ floating, classNames, children, ...props }) => {
|
|
40
|
-
const { tx } = useThemeContext();
|
|
41
|
-
return (
|
|
42
|
-
<div {...props} className={tx('card.header', 'card', { floating }, classNames)}>
|
|
43
|
-
{children}
|
|
44
|
-
</div>
|
|
45
|
-
);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
type CardTitleProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> & {
|
|
49
|
-
center?: boolean;
|
|
50
|
-
title?: string;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export const CardTitle: FC<CardTitleProps> = ({ center, title, classNames, ...props }) => {
|
|
54
|
-
const { tx } = useThemeContext();
|
|
55
|
-
return (
|
|
56
|
-
<div {...props} className={tx('card.title', 'card', { center }, classNames)}>
|
|
57
|
-
{title}
|
|
58
|
-
</div>
|
|
59
|
-
);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
// TODO(burdon): Reuse ListItemEndcap?
|
|
63
|
-
type CardDragHandleProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> & { position?: 'left' | 'right' };
|
|
64
|
-
|
|
65
|
-
const CardDragHandle: FC<CardDragHandleProps> = ({ position, classNames, ...props }) => {
|
|
66
|
-
const { tx } = useThemeContext();
|
|
67
|
-
const density = useDensityContext();
|
|
68
|
-
return (
|
|
69
|
-
<div {...props} className={tx('card.dragHandle', 'card', { density, position }, classNames)}>
|
|
70
|
-
<DotsSixVertical className={tx('card.dragHandleIcon', 'card')} />
|
|
71
|
-
</div>
|
|
72
|
-
);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
type CardEndcapProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> & { Icon: Icon; position?: 'left' | 'right' };
|
|
76
|
-
|
|
77
|
-
const CardEndcap: FC<CardEndcapProps> = ({ Icon, position, classNames, ...props }) => {
|
|
78
|
-
const { tx } = useThemeContext();
|
|
79
|
-
const density = useDensityContext();
|
|
80
|
-
return (
|
|
81
|
-
<div {...props} className={tx('card.menu', 'card', { density, position }, classNames)}>
|
|
82
|
-
<Icon className={tx('card.menuIcon', 'card')} />
|
|
83
|
-
</div>
|
|
84
|
-
);
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
type CardMenuProps = PropsWithChildren<
|
|
88
|
-
ThemedClassName<ComponentPropsWithoutRef<'div'>> & { position?: 'left' | 'right' }
|
|
89
|
-
>;
|
|
90
|
-
|
|
91
|
-
// TODO(burdon): Reconcile with Endcap (remove dropdown from here). See ListItem.Endcap (style icon/size?)
|
|
92
|
-
const CardMenu = forwardRef<HTMLDivElement, CardMenuProps>(
|
|
93
|
-
({ children, position, classNames, ...props }, forwardRef) => {
|
|
94
|
-
const { tx } = useThemeContext();
|
|
95
|
-
const density = useDensityContext();
|
|
96
|
-
return (
|
|
97
|
-
<div {...props} className={tx('card.menu', 'card', { density, position }, classNames)} ref={forwardRef}>
|
|
98
|
-
<DropdownMenu.Root>
|
|
99
|
-
<DropdownMenu.Trigger asChild>
|
|
100
|
-
<DotsThreeVertical className={tx('card.menuIcon', 'card', {})} />
|
|
101
|
-
</DropdownMenu.Trigger>
|
|
102
|
-
{/* TODO(burdon): Position to the left of the menu button. */}
|
|
103
|
-
<DropdownMenu.Content>
|
|
104
|
-
<DropdownMenu.Viewport>{children}</DropdownMenu.Viewport>
|
|
105
|
-
</DropdownMenu.Content>
|
|
106
|
-
</DropdownMenu.Root>
|
|
107
|
-
</div>
|
|
108
|
-
);
|
|
109
|
-
},
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
type CardBodyProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> & { gutter?: boolean };
|
|
113
|
-
|
|
114
|
-
export const CardBody: FC<CardBodyProps> = ({ gutter, classNames, children, ...props }) => {
|
|
115
|
-
const { tx } = useThemeContext();
|
|
116
|
-
const density = useDensityContext();
|
|
117
|
-
return (
|
|
118
|
-
<div {...props} className={tx('card.body', 'card', { density, gutter }, classNames)}>
|
|
119
|
-
{children}
|
|
120
|
-
</div>
|
|
121
|
-
);
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
type CardMediaProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> & { src?: string; contain?: boolean };
|
|
125
|
-
|
|
126
|
-
// TODO(burdon): Option to set to 50% of height of card.
|
|
127
|
-
export const CardMedia: FC<CardMediaProps> = ({ src, contain, classNames, ...props }) => {
|
|
128
|
-
const { tx } = useThemeContext();
|
|
129
|
-
return (
|
|
130
|
-
<div className='flex grow overflow-hidden'>
|
|
131
|
-
<img {...props} className={tx('card.media', 'card', { contain }, classNames)} src={src} />
|
|
132
|
-
</div>
|
|
133
|
-
);
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
export const Card = {
|
|
137
|
-
Root: CardRoot,
|
|
138
|
-
Header: CardHeader,
|
|
139
|
-
DragHandle: CardDragHandle,
|
|
140
|
-
Endcap: CardEndcap,
|
|
141
|
-
Menu: CardMenu,
|
|
142
|
-
Title: CardTitle,
|
|
143
|
-
Body: CardBody,
|
|
144
|
-
Media: CardMedia,
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
export type { CardRootProps };
|