@dxos/react-ui 0.3.5-next.5910692 → 0.3.5-next.d8a95f3
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 +47 -64
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/components/Avatars/Avatar.d.ts +6 -5
- package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts +2 -0
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/AvatarGroup.d.ts +4 -4
- package/dist/types/src/components/Avatars/AvatarGroup.d.ts.map +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts +5 -5
- package/dist/types/src/components/Buttons/Button.d.ts +2 -2
- package/dist/types/src/components/Buttons/Button.stories.d.ts +1 -1
- package/dist/types/src/components/Buttons/Toggle.d.ts +1 -1
- package/dist/types/src/components/Buttons/ToggleGroup.d.ts +3 -3
- package/dist/types/src/components/Card/Card.d.ts +1 -1
- package/dist/types/src/components/Card/Card.stories.d.ts +1 -1
- package/dist/types/src/components/DropdownMenu/DropdownMenu.d.ts +1 -1
- package/dist/types/src/components/Input/Input.d.ts +7 -7
- package/dist/types/src/components/Link/Link.d.ts +1 -1
- package/dist/types/src/components/List/List.d.ts +1 -1
- package/dist/types/src/components/Main/Main.d.ts +4 -4
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/Message/Message.d.ts +2 -2
- package/dist/types/src/components/Popover/Popover.d.ts +1 -1
- package/dist/types/src/components/Select/Select.d.ts +1 -1
- package/dist/types/src/components/Tag/Tag.d.ts +1 -1
- package/dist/types/src/components/Toast/Toast.d.ts +2 -2
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +5 -5
- package/dist/types/src/playground/Surfaces.stories.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/components/Avatars/Avatar.stories.tsx +51 -15
- package/src/components/Avatars/Avatar.tsx +74 -68
- package/src/components/Avatars/AvatarGroup.tsx +2 -1
- package/src/components/Main/Main.tsx +1 -0
- package/src/playground/Surfaces.stories.tsx +26 -5
|
@@ -14,8 +14,8 @@ export declare const Toolbar: {
|
|
|
14
14
|
Root: React.ForwardRefExoticComponent<Omit<ToolbarPrimitive.ToolbarProps, "className"> & {
|
|
15
15
|
classNames?: import("@dxos/react-ui-types").ClassNameValue;
|
|
16
16
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
-
Button: React.ForwardRefExoticComponent<Pick<ButtonProps, "density" | "value" | "children" | "elevation" | "type" | "form" | "slot" | "style" | "title" | "variant" | "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" | "
|
|
18
|
-
Link: React.ForwardRefExoticComponent<Pick<LinkProps, "children" | "type" | "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" | "
|
|
17
|
+
Button: React.ForwardRefExoticComponent<Pick<ButtonProps, "density" | "value" | "children" | "elevation" | "type" | "form" | "slot" | "style" | "title" | "variant" | "color" | "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" | "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" | "name" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget"> & React.RefAttributes<HTMLButtonElement>>;
|
|
18
|
+
Link: React.ForwardRefExoticComponent<Pick<LinkProps, "children" | "type" | "slot" | "style" | "title" | "color" | "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" | "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" | "media" | "target" | "href" | "download" | "hrefLang" | "ping" | "rel" | "referrerPolicy"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
19
19
|
ToggleGroup: React.ForwardRefExoticComponent<(Pick<Omit<ToolbarPrimitive.ToolbarToggleGroupSingleProps, "className"> & Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
20
20
|
ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
21
21
|
} & {
|
|
@@ -25,7 +25,7 @@ export declare const Toolbar: {
|
|
|
25
25
|
} & {
|
|
26
26
|
elevation?: import("@dxos/react-ui-types").Elevation | undefined;
|
|
27
27
|
asChild?: boolean | undefined;
|
|
28
|
-
}, "value" | "children" | "elevation" | "type" | "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" | "
|
|
28
|
+
}, "value" | "children" | "elevation" | "type" | "slot" | "style" | "title" | "color" | "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" | "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" | "orientation" | "disabled" | "onValueChange" | "rovingFocus" | "loop"> | Pick<Omit<ToolbarPrimitive.ToolbarToggleGroupMultipleProps, "className"> & Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
29
29
|
ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
30
30
|
} & {
|
|
31
31
|
asChild?: boolean | undefined;
|
|
@@ -34,8 +34,8 @@ export declare const Toolbar: {
|
|
|
34
34
|
} & {
|
|
35
35
|
elevation?: import("@dxos/react-ui-types").Elevation | undefined;
|
|
36
36
|
asChild?: boolean | undefined;
|
|
37
|
-
}, "value" | "children" | "elevation" | "type" | "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" | "
|
|
38
|
-
ToggleGroupItem: React.ForwardRefExoticComponent<Pick<ToggleGroupItemProps, "density" | "value" | "children" | "elevation" | "type" | "form" | "slot" | "style" | "title" | "variant" | "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" | "
|
|
37
|
+
}, "value" | "children" | "elevation" | "type" | "slot" | "style" | "title" | "color" | "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" | "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" | "orientation" | "disabled" | "onValueChange" | "rovingFocus" | "loop">) & React.RefAttributes<HTMLDivElement>>;
|
|
38
|
+
ToggleGroupItem: React.ForwardRefExoticComponent<Pick<ToggleGroupItemProps, "density" | "value" | "children" | "elevation" | "type" | "form" | "slot" | "style" | "title" | "variant" | "color" | "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" | "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" | "name" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget"> & React.RefAttributes<HTMLButtonElement>>;
|
|
39
39
|
Separator: (props: SeparatorProps) => JSX.Element;
|
|
40
40
|
};
|
|
41
41
|
export type { ToolbarRootProps, ToolbarButtonProps, ToolbarLinkProps, ToolbarToggleGroupProps, ToolbarToggleGroupItemProps, ToolbarSeparatorProps, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Surfaces.stories.d.ts","sourceRoot":"","sources":["../../../../src/playground/Surfaces.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;;;;
|
|
1
|
+
{"version":3,"file":"Surfaces.stories.d.ts","sourceRoot":"","sources":["../../../../src/playground/Surfaces.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;;;;AAqDpB,wBAEE;AAEF,eAAO,MAAM,OAAO;;CAEnB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui",
|
|
3
|
-
"version": "0.3.5-next.
|
|
3
|
+
"version": "0.3.5-next.d8a95f3",
|
|
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",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"jdenticon": "^3.2.0",
|
|
41
41
|
"keyborg": "^2.0.0",
|
|
42
42
|
"react-i18next": "^11.18.6",
|
|
43
|
-
"@dxos/react-hooks": "0.3.5-next.
|
|
44
|
-
"@dxos/react-input": "0.3.5-next.
|
|
45
|
-
"@dxos/react-list": "0.3.5-next.
|
|
46
|
-
"@dxos/react-ui-types": "0.3.5-next.
|
|
43
|
+
"@dxos/react-hooks": "0.3.5-next.d8a95f3",
|
|
44
|
+
"@dxos/react-input": "0.3.5-next.d8a95f3",
|
|
45
|
+
"@dxos/react-list": "0.3.5-next.d8a95f3",
|
|
46
|
+
"@dxos/react-ui-types": "0.3.5-next.d8a95f3"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@dnd-kit/core": "^6.0.5",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"react-dom": "^18.2.0",
|
|
59
59
|
"vite": "^4.3.9",
|
|
60
60
|
"vite-plugin-turbosnap": "^1.0.2",
|
|
61
|
-
"@dxos/react-ui-theme": "0.3.5-next.
|
|
61
|
+
"@dxos/react-ui-theme": "0.3.5-next.d8a95f3"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"@phosphor-icons/react": "^2.0.5",
|
|
@@ -6,10 +6,13 @@ import '@dxosTheme';
|
|
|
6
6
|
|
|
7
7
|
import React, { type PropsWithChildren } from 'react';
|
|
8
8
|
|
|
9
|
+
import { getColorForValue } from '@dxos/react-ui-theme';
|
|
9
10
|
import { type Size } from '@dxos/react-ui-types';
|
|
10
11
|
|
|
11
12
|
import { Avatar, useJdenticonHref, type AvatarVariant, type AvatarStatus, type AvatarAnimation } from './Avatar';
|
|
12
13
|
|
|
14
|
+
const randomColor = () => getColorForValue({ value: Math.random().toString(16), type: 'color' });
|
|
15
|
+
|
|
13
16
|
type StorybookAvatarProps = {
|
|
14
17
|
imgSrc?: string;
|
|
15
18
|
fallbackValue?: string;
|
|
@@ -20,6 +23,7 @@ type StorybookAvatarProps = {
|
|
|
20
23
|
variant?: AvatarVariant;
|
|
21
24
|
animation?: AvatarAnimation;
|
|
22
25
|
size?: Size;
|
|
26
|
+
color?: string;
|
|
23
27
|
};
|
|
24
28
|
|
|
25
29
|
const StorybookAvatar = (props: PropsWithChildren<StorybookAvatarProps>) => {
|
|
@@ -33,19 +37,26 @@ const StorybookAvatar = (props: PropsWithChildren<StorybookAvatarProps>) => {
|
|
|
33
37
|
fallbackText = '',
|
|
34
38
|
animation,
|
|
35
39
|
imgSrc,
|
|
40
|
+
color = randomColor(),
|
|
36
41
|
} = props;
|
|
37
42
|
const jdenticon = useJdenticonHref(fallbackValue ?? '', size);
|
|
38
43
|
return (
|
|
39
|
-
<
|
|
40
|
-
<Avatar.
|
|
41
|
-
<Avatar.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
<div className='flex flex-row gap-3 align-middle items-center'>
|
|
45
|
+
<Avatar.Root {...{ size, variant, status, animation, color }}>
|
|
46
|
+
<Avatar.Frame>
|
|
47
|
+
{!imgSrc && (fallbackValue || fallbackText) && (
|
|
48
|
+
<Avatar.Fallback href={fallbackValue ? jdenticon : ''} text={fallbackText} />
|
|
49
|
+
)}
|
|
50
|
+
{imgSrc && <Avatar.Image href={imgSrc} />}
|
|
51
|
+
</Avatar.Frame>
|
|
52
|
+
<div>
|
|
53
|
+
<Avatar.Label classNames='block'>{label}</Avatar.Label>
|
|
54
|
+
<Avatar.Description classNames='block'>
|
|
55
|
+
{description} ({size})
|
|
56
|
+
</Avatar.Description>
|
|
57
|
+
</div>
|
|
58
|
+
</Avatar.Root>
|
|
59
|
+
</div>
|
|
49
60
|
);
|
|
50
61
|
};
|
|
51
62
|
|
|
@@ -53,12 +64,37 @@ export default {
|
|
|
53
64
|
component: StorybookAvatar,
|
|
54
65
|
};
|
|
55
66
|
|
|
67
|
+
const sampleImage =
|
|
68
|
+
'https://png.pngtree.com/thumb_back/fh260/background/20230614/pngtree-the-photo-of-a-woman-with-red-sunglasses-is-surrounded-by-image_2931163.jpg';
|
|
69
|
+
|
|
70
|
+
const row = (size: Size) => (
|
|
71
|
+
<>
|
|
72
|
+
<StorybookAvatar size={size} description='Offline' color={''} />
|
|
73
|
+
<StorybookAvatar size={size} status='active' />
|
|
74
|
+
<StorybookAvatar size={size} status='active' imgSrc={sampleImage} />
|
|
75
|
+
</>
|
|
76
|
+
);
|
|
77
|
+
|
|
56
78
|
export const Default = () => (
|
|
57
|
-
<div className='
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
79
|
+
<div className='grid grid-cols-3 gap-6 p-[4rem] min-h-screen bg-cubes'>
|
|
80
|
+
{row(28)}
|
|
81
|
+
{row(20)}
|
|
82
|
+
{row(16)}
|
|
83
|
+
{row(12)}
|
|
84
|
+
{row(10)}
|
|
85
|
+
{row(8)}
|
|
86
|
+
{row(6)}
|
|
87
|
+
{row(5)}
|
|
88
|
+
{row(4)}
|
|
89
|
+
{row(3)}
|
|
90
|
+
{row(2)}
|
|
91
|
+
{row(1)}
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
export const Image = () => (
|
|
96
|
+
<div>
|
|
97
|
+
<StorybookAvatar variant='circle' imgSrc={sampleImage} />
|
|
62
98
|
</div>
|
|
63
99
|
);
|
|
64
100
|
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import {
|
|
6
6
|
Root as AvatarRootPrimitive,
|
|
7
7
|
type AvatarProps as AvatarRootPrimitiveProps,
|
|
8
|
-
Image as AvatarImagePrimitive,
|
|
9
8
|
type ImageLoadingStatus,
|
|
10
9
|
Fallback as AvatarFallbackPrimitive,
|
|
11
10
|
} from '@radix-ui/react-avatar';
|
|
@@ -36,6 +35,7 @@ type AvatarContextValue = {
|
|
|
36
35
|
status?: AvatarStatus;
|
|
37
36
|
animation?: AvatarAnimation;
|
|
38
37
|
inGroup?: boolean;
|
|
38
|
+
color?: string;
|
|
39
39
|
};
|
|
40
40
|
const AVATAR_NAME = 'Avatar';
|
|
41
41
|
const [AvatarProvider, useAvatarContext] = createContext<AvatarContextValue>(AVATAR_NAME);
|
|
@@ -50,12 +50,13 @@ const AvatarRoot = ({
|
|
|
50
50
|
descriptionId: propsDescriptionId,
|
|
51
51
|
maskId: propsMaskId,
|
|
52
52
|
inGroup,
|
|
53
|
+
color,
|
|
53
54
|
}: AvatarRootProps) => {
|
|
54
55
|
const labelId = useId('avatar__label', propsLabelId);
|
|
55
56
|
const descriptionId = useId('avatar__description', propsDescriptionId);
|
|
56
57
|
const maskId = useId('avatar__mask', propsMaskId);
|
|
57
58
|
return (
|
|
58
|
-
<AvatarProvider {...{ labelId, descriptionId, maskId, size, variant, status, animation, inGroup }}>
|
|
59
|
+
<AvatarProvider {...{ labelId, descriptionId, maskId, size, variant, status, animation, inGroup, color }}>
|
|
59
60
|
{children}
|
|
60
61
|
</AvatarProvider>
|
|
61
62
|
);
|
|
@@ -63,19 +64,19 @@ const AvatarRoot = ({
|
|
|
63
64
|
|
|
64
65
|
type AvatarFrameProps = ThemedClassName<AvatarRootPrimitiveProps>;
|
|
65
66
|
|
|
66
|
-
const
|
|
67
|
-
const rx = 8;
|
|
67
|
+
const rx = '0.25rem';
|
|
68
68
|
|
|
69
69
|
const AvatarFrame = forwardRef<HTMLSpanElement, AvatarFrameProps>(
|
|
70
70
|
({ classNames, children, ...props }, forwardedRef) => {
|
|
71
|
-
const { size, variant, labelId, descriptionId, maskId, inGroup, status, animation } =
|
|
71
|
+
const { size, variant, labelId, descriptionId, maskId, inGroup, status, animation, color } =
|
|
72
72
|
useAvatarContext('AvatarFrame');
|
|
73
73
|
|
|
74
74
|
const { tx } = useThemeContext();
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
const ringWidth = 2;
|
|
78
|
-
const
|
|
75
|
+
const numericSize = size === 'px' ? 1 : Number(size);
|
|
76
|
+
const sizePx = numericSize * 4;
|
|
77
|
+
const ringWidth = numericSize > 4 ? 2 : numericSize > 3 ? 1 : 1;
|
|
78
|
+
const ringGap = numericSize > 12 ? 3 : numericSize > 4 ? 2 : numericSize > 3 ? 1 : 0;
|
|
79
|
+
const r = sizePx / 2 - ringGap - ringWidth;
|
|
79
80
|
return (
|
|
80
81
|
<AvatarRootPrimitive
|
|
81
82
|
role='img'
|
|
@@ -88,9 +89,9 @@ const AvatarFrame = forwardRef<HTMLSpanElement, AvatarFrameProps>(
|
|
|
88
89
|
})}
|
|
89
90
|
>
|
|
90
91
|
<svg
|
|
91
|
-
viewBox={`0 0 ${
|
|
92
|
-
width={
|
|
93
|
-
height={
|
|
92
|
+
viewBox={`0 0 ${sizePx} ${sizePx}`}
|
|
93
|
+
width={sizePx}
|
|
94
|
+
height={sizePx}
|
|
94
95
|
className={tx('avatar.frame', 'avatar__frame', { variant })}
|
|
95
96
|
>
|
|
96
97
|
<defs>
|
|
@@ -98,76 +99,65 @@ const AvatarFrame = forwardRef<HTMLSpanElement, AvatarFrameProps>(
|
|
|
98
99
|
{variant === 'circle' ? (
|
|
99
100
|
<circle fill='white' cx='50%' cy='50%' r={r} />
|
|
100
101
|
) : (
|
|
101
|
-
<rect
|
|
102
|
+
<rect
|
|
103
|
+
fill='white'
|
|
104
|
+
width={2 * r}
|
|
105
|
+
height={2 * r}
|
|
106
|
+
x={ringGap + ringWidth}
|
|
107
|
+
y={ringGap + ringWidth}
|
|
108
|
+
rx={rx}
|
|
109
|
+
/>
|
|
102
110
|
)}
|
|
103
111
|
</mask>
|
|
104
112
|
</defs>
|
|
105
113
|
{variant === 'circle' ? (
|
|
106
|
-
<
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
114
|
+
<circle
|
|
115
|
+
className={`avatarFrameFill${color ? '' : ' fill-[var(--surface-bg)]'}`}
|
|
116
|
+
cx='50%'
|
|
117
|
+
cy='50%'
|
|
118
|
+
r={r}
|
|
119
|
+
{...(color ? { fill: color } : {})}
|
|
120
|
+
/>
|
|
110
121
|
) : (
|
|
111
|
-
<
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
y={ringGap + ringWidth}
|
|
120
|
-
rx={2}
|
|
121
|
-
/>
|
|
122
|
-
<rect
|
|
123
|
-
fill='none'
|
|
124
|
-
stroke='#333'
|
|
125
|
-
opacity={0.15}
|
|
126
|
-
width={2 * r}
|
|
127
|
-
height={2 * r}
|
|
128
|
-
x={ringGap + ringWidth}
|
|
129
|
-
y={ringGap + ringWidth}
|
|
130
|
-
rx={2}
|
|
131
|
-
/>
|
|
132
|
-
</g>
|
|
133
|
-
// <circle
|
|
134
|
-
// className='avatarFrameFill fill-[var(--surface-bg)]'
|
|
135
|
-
// cx={imageSizeNumber / 2}
|
|
136
|
-
// cy={imageSizeNumber / 2}
|
|
137
|
-
// r={imageSizeNumber / 2}
|
|
138
|
-
// />
|
|
139
|
-
// ) : (
|
|
140
|
-
// <rect
|
|
141
|
-
// className='avatarFrameFill fill-[var(--surface-bg)]'
|
|
142
|
-
// width={imageSizeNumber}
|
|
143
|
-
// height={imageSizeNumber}
|
|
144
|
-
// rx={rx}
|
|
145
|
-
// />
|
|
122
|
+
<rect
|
|
123
|
+
className='avatarFrameFill fill-[var(--surface-bg)]'
|
|
124
|
+
x={ringGap + ringWidth}
|
|
125
|
+
y={ringGap + ringWidth}
|
|
126
|
+
width={2 * r}
|
|
127
|
+
height={2 * r}
|
|
128
|
+
rx={rx}
|
|
129
|
+
/>
|
|
146
130
|
)}
|
|
147
131
|
{children}
|
|
148
|
-
{variant === 'circle' ? (
|
|
132
|
+
{/* {variant === 'circle' ? (
|
|
149
133
|
<circle
|
|
150
|
-
className='avatarFrameStroke fill-transparent stroke-[var(--surface-
|
|
134
|
+
className='avatarFrameStroke fill-transparent stroke-[var(--surface-text)]'
|
|
151
135
|
strokeWidth={strokeWidth}
|
|
152
136
|
fill='none'
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
137
|
+
opacity={0.1}
|
|
138
|
+
cx={'50%'}
|
|
139
|
+
cy={'50%'}
|
|
140
|
+
r={r - 0.5 * strokeWidth}
|
|
156
141
|
/>
|
|
157
142
|
) : (
|
|
158
143
|
<rect
|
|
159
|
-
className='avatarFrameStroke fill-transparent stroke-[var(--surface-
|
|
144
|
+
className='avatarFrameStroke fill-transparent stroke-[var(--surface-text)]'
|
|
160
145
|
strokeWidth={strokeWidth}
|
|
161
|
-
|
|
162
|
-
y={strokeWidth / 4}
|
|
146
|
+
opacity={0.1}
|
|
163
147
|
fill='none'
|
|
148
|
+
x={ringGap + ringWidth}
|
|
149
|
+
y={ringGap + ringWidth}
|
|
150
|
+
width={2 * r}
|
|
151
|
+
height={2 * r}
|
|
164
152
|
rx={rx}
|
|
165
|
-
width={imageSizeNumber - strokeWidth / 4}
|
|
166
|
-
height={imageSizeNumber - strokeWidth / 4}
|
|
167
153
|
/>
|
|
168
|
-
)}
|
|
154
|
+
)} */}
|
|
169
155
|
</svg>
|
|
170
|
-
<span
|
|
156
|
+
<span
|
|
157
|
+
role='none'
|
|
158
|
+
className={tx('avatar.ring', 'avatar__ring', { size, variant, status, animation })}
|
|
159
|
+
style={{ borderWidth: ringWidth + 'px' }}
|
|
160
|
+
/>
|
|
171
161
|
</AvatarRootPrimitive>
|
|
172
162
|
);
|
|
173
163
|
},
|
|
@@ -219,7 +209,16 @@ type AvatarMaskedImageProps = ComponentPropsWithRef<'image'>;
|
|
|
219
209
|
|
|
220
210
|
const AvatarMaskedImage = forwardRef<SVGImageElement, AvatarMaskedImageProps>((props, forwardedRef) => {
|
|
221
211
|
const { maskId } = useAvatarContext('AvatarFallback');
|
|
222
|
-
return
|
|
212
|
+
return (
|
|
213
|
+
<image
|
|
214
|
+
width='100%'
|
|
215
|
+
height='100%'
|
|
216
|
+
{...props}
|
|
217
|
+
mask={`url(#${maskId})`}
|
|
218
|
+
ref={forwardedRef}
|
|
219
|
+
preserveAspectRatio='xMidYMid slice'
|
|
220
|
+
/>
|
|
221
|
+
);
|
|
223
222
|
});
|
|
224
223
|
|
|
225
224
|
type AvatarMaskedTextProps = PropsWithChildren<{ large?: boolean }>;
|
|
@@ -250,10 +249,15 @@ type AvatarImageProps = ComponentPropsWithRef<'image'> & {
|
|
|
250
249
|
|
|
251
250
|
const AvatarImage = forwardRef<SVGImageElement, AvatarImageProps>(
|
|
252
251
|
({ onLoadingStatusChange, ...props }, forwardedRef) => {
|
|
252
|
+
const { size } = useAvatarContext('AvatarImage');
|
|
253
|
+
const pxSize = size === 'px' ? 1 : size * 4;
|
|
254
|
+
if (pxSize <= 20) {
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
253
257
|
return (
|
|
254
|
-
<
|
|
258
|
+
<AvatarFallbackPrimitive asChild>
|
|
255
259
|
<AvatarMaskedImage {...props} ref={forwardedRef} />
|
|
256
|
-
</
|
|
260
|
+
</AvatarFallbackPrimitive>
|
|
257
261
|
);
|
|
258
262
|
},
|
|
259
263
|
);
|
|
@@ -265,10 +269,12 @@ type AvatarFallbackProps = ComponentPropsWithRef<'image'> & {
|
|
|
265
269
|
|
|
266
270
|
const AvatarFallback = forwardRef<SVGImageElement, AvatarFallbackProps>(({ delayMs, text, ...props }, forwardedRef) => {
|
|
267
271
|
const isTextOnly = Boolean(text && /[0-9a-zA-Z]+/.test(text));
|
|
272
|
+
const { size } = useAvatarContext('AvatarFallback');
|
|
273
|
+
const numericSize = size === 'px' ? 1 : Number(size);
|
|
268
274
|
return (
|
|
269
275
|
<AvatarFallbackPrimitive delayMs={delayMs} asChild>
|
|
270
276
|
<>
|
|
271
|
-
<AvatarMaskedImage {...props} ref={forwardedRef} />
|
|
277
|
+
{numericSize >= 6 && <AvatarMaskedImage {...props} ref={forwardedRef} />}
|
|
272
278
|
{text && <AvatarMaskedText large={!isTextOnly}>{text.toLocaleUpperCase()}</AvatarMaskedText>}
|
|
273
279
|
</>
|
|
274
280
|
</AvatarFallbackPrimitive>
|
|
@@ -46,7 +46,7 @@ const AvatarGroupRoot = forwardRef<HTMLDivElement, AvatarGroupRootProps>(
|
|
|
46
46
|
|
|
47
47
|
type AvatarGroupItemRootProps = Omit<AvatarRootProps, 'labelId' | 'descriptionId' | 'inGroup'>;
|
|
48
48
|
|
|
49
|
-
const AvatarGroupItemRoot = ({ maskId, size, variant, status, children }: AvatarGroupItemRootProps) => {
|
|
49
|
+
const AvatarGroupItemRoot = ({ maskId, size, variant, status, children, ...rest }: AvatarGroupItemRootProps) => {
|
|
50
50
|
const {
|
|
51
51
|
labelId,
|
|
52
52
|
descriptionId,
|
|
@@ -63,6 +63,7 @@ const AvatarGroupItemRoot = ({ maskId, size, variant, status, children }: Avatar
|
|
|
63
63
|
size: size ?? contextSize,
|
|
64
64
|
variant: variant ?? contextVariant,
|
|
65
65
|
inGroup: true,
|
|
66
|
+
...rest,
|
|
66
67
|
}}
|
|
67
68
|
>
|
|
68
69
|
{children}
|
|
@@ -152,6 +152,7 @@ const MainSidebar = forwardRef<HTMLDivElement, MainSidebarProps>(
|
|
|
152
152
|
{ isLg, [side === 'inline-end' ? 'inlineEndSidebarOpen' : 'inlineStartSidebarOpen']: open, side },
|
|
153
153
|
classNames,
|
|
154
154
|
)}
|
|
155
|
+
{...(!open && { inert: 'true' })}
|
|
155
156
|
ref={ref}
|
|
156
157
|
>
|
|
157
158
|
<ElevationProvider elevation='group'>{children}</ElevationProvider>
|