@dxos/react-ui 0.7.5-main.e9bb01b → 0.7.5-staging.2ff1350
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 +19 -17
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +19 -17
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +19 -17
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- 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 +10 -10
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/AvatarGroup.d.ts +1 -1
- package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts +2 -2
- package/dist/types/src/components/Buttons/Button.stories.d.ts +1 -1
- package/dist/types/src/components/Buttons/IconButton.d.ts +1 -0
- package/dist/types/src/components/Buttons/IconButton.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/IconButton.stories.d.ts +1 -1
- package/dist/types/src/components/Buttons/Toggle.stories.d.ts +1 -1
- package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts +1 -1
- package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts +1 -1
- package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/CopyButton.d.ts +6 -3
- package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/index.d.ts +8 -3
- package/dist/types/src/components/Clipboard/index.d.ts.map +1 -1
- package/dist/types/src/components/DensityProvider/DensityProvider.d.ts +1 -1
- package/dist/types/src/components/DensityProvider/DensityProvider.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/AlertDialog.d.ts +1 -1
- package/dist/types/src/components/Dialogs/AlertDialog.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts +1 -1
- package/dist/types/src/components/Dialogs/Dialog.d.ts +4 -2
- package/dist/types/src/components/Dialogs/Dialog.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/Dialog.stories.d.ts +1 -1
- package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts +1 -1
- package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts.map +1 -1
- package/dist/types/src/components/Icon/Icon.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.d.ts +1 -1
- package/dist/types/src/components/Input/Input.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts +2 -2
- package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/types/src/components/Lists/List.stories.d.ts +4 -4
- package/dist/types/src/components/Lists/ListDropIndicator.d.ts +3 -2
- package/dist/types/src/components/Lists/ListDropIndicator.d.ts.map +1 -1
- package/dist/types/src/components/Lists/Tree.stories.d.ts +1 -1
- package/dist/types/src/components/Lists/TreeDropIndicator.d.ts +1 -2
- package/dist/types/src/components/Lists/TreeDropIndicator.d.ts.map +1 -1
- package/dist/types/src/components/Lists/Treegrid.stories.d.ts +1 -1
- package/dist/types/src/components/Main/Main.d.ts +1 -1
- package/dist/types/src/components/Main/Main.stories.d.ts +2 -3
- package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
- package/dist/types/src/components/Menus/ContextMenu.stories.d.ts +1 -1
- package/dist/types/src/components/Menus/DropdownMenu.d.ts +1 -1
- package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts +3 -3
- package/dist/types/src/components/Message/Message.stories.d.ts +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts +1 -1
- package/dist/types/src/components/Popover/Popover.stories.d.ts +4 -4
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +1 -1
- package/dist/types/src/components/Select/Select.stories.d.ts +1 -2
- package/dist/types/src/components/Select/Select.stories.d.ts.map +1 -1
- package/dist/types/src/components/Status/Status.stories.d.ts +2 -2
- package/dist/types/src/components/Status/Status.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tag/Tag.stories.d.ts +1 -1
- package/dist/types/src/components/Tag/Tag.stories.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +2 -2
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts +1 -1
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.stories.d.ts +3 -3
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +13 -1
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
- package/dist/types/src/playground/Controls.stories.d.ts +1 -2
- package/dist/types/src/playground/Controls.stories.d.ts.map +1 -1
- package/dist/types/src/playground/Typography.stories.d.ts +1 -2
- package/dist/types/src/playground/Typography.stories.d.ts.map +1 -1
- package/dist/types/src/util/ThemedClassName.d.ts +1 -1
- package/dist/types/src/util/ThemedClassName.d.ts.map +1 -1
- package/package.json +13 -12
- package/src/components/Avatars/Avatar.tsx +2 -7
- package/src/components/Buttons/IconButton.tsx +8 -1
- package/src/components/Clipboard/CopyButton.tsx +6 -2
- package/src/components/Dialogs/AlertDialog.tsx +3 -1
- package/src/components/Dialogs/Dialog.stories.tsx +1 -1
- package/src/components/Dialogs/Dialog.tsx +9 -4
- package/src/components/Icon/Icon.tsx +4 -1
- package/src/components/Lists/ListDropIndicator.tsx +15 -7
- package/src/components/Tag/Tag.stories.tsx +2 -5
- package/src/components/Tooltip/Tooltip.stories.tsx +13 -2
- package/src/util/ThemedClassName.ts +1 -1
|
@@ -2,6 +2,7 @@ import '@dxos-theme';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
type StoryTooltipProps = {
|
|
4
4
|
content: string;
|
|
5
|
+
defaultOpen?: boolean;
|
|
5
6
|
};
|
|
6
7
|
declare const _default: {
|
|
7
8
|
title: string;
|
|
@@ -17,7 +18,7 @@ declare const _default: {
|
|
|
17
18
|
classNames?: import("packages/ui/react-ui-types/dist/types/src").ClassNameValue;
|
|
18
19
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
19
20
|
};
|
|
20
|
-
render: ({ content }: StoryTooltipProps) =>
|
|
21
|
+
render: ({ content, defaultOpen }: StoryTooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
22
|
decorators: import("@storybook/react/*").Decorator[];
|
|
22
23
|
parameters: {
|
|
23
24
|
chromatic: {
|
|
@@ -36,4 +37,15 @@ export declare const Default: {
|
|
|
36
37
|
};
|
|
37
38
|
};
|
|
38
39
|
};
|
|
40
|
+
export declare const Testing: {
|
|
41
|
+
args: {
|
|
42
|
+
defaultOption: boolean;
|
|
43
|
+
content: string;
|
|
44
|
+
};
|
|
45
|
+
parameters: {
|
|
46
|
+
chromatic: {
|
|
47
|
+
delay: number;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
39
51
|
//# sourceMappingURL=Tooltip.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Tooltip/Tooltip.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,KAAK,iBAAiB,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"Tooltip.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Tooltip/Tooltip.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,KAAK,iBAAiB,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;;;;;;;;;;;;;;;uCAE8C,iBAAiB;;;;;;;;AAcjE,wBAME;AAEF,eAAO,MAAM,OAAO;;;;;;;;;CAOnB,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;;;;;;CAQnB,CAAC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import '@dxos-theme';
|
|
2
|
-
import React from 'react';
|
|
3
2
|
export declare const Default: {};
|
|
4
3
|
declare const _default: {
|
|
5
4
|
title: string;
|
|
6
|
-
render: () =>
|
|
5
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
7
6
|
decorators: import("@storybook/react/*").Decorator[];
|
|
8
7
|
parameters: {
|
|
9
8
|
chromatic: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Controls.stories.d.ts","sourceRoot":"","sources":["../../../../src/playground/Controls.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"Controls.stories.d.ts","sourceRoot":"","sources":["../../../../src/playground/Controls.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AA+ErB,eAAO,MAAM,OAAO,IAAK,CAAC;;;;;;;;;;;AAE1B,wBAKE"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import '@dxos-theme';
|
|
2
|
-
import React from 'react';
|
|
3
2
|
declare const _default: {
|
|
4
3
|
title: string;
|
|
5
|
-
render: () =>
|
|
4
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
6
5
|
decorators: import("@storybook/react/*").Decorator[];
|
|
7
6
|
parameters: {
|
|
8
7
|
chromatic: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Typography.stories.d.ts","sourceRoot":"","sources":["../../../../src/playground/Typography.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC
|
|
1
|
+
{"version":3,"file":"Typography.stories.d.ts","sourceRoot":"","sources":["../../../../src/playground/Typography.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;;;;;;;;;;;AAyCrB,wBAKE;AAEF,eAAO,MAAM,OAAO;;CAEnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemedClassName.d.ts","sourceRoot":"","sources":["../../../../src/util/ThemedClassName.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,WAAW,CAAC,GAAG;IAAE,UAAU,CAAC,EAAE,cAAc,CAAA;CAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"ThemedClassName.d.ts","sourceRoot":"","sources":["../../../../src/util/ThemedClassName.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,MAAM,MAAM,eAAe,CAAC,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,CAAC,EAAE,WAAW,CAAC,GAAG;IAAE,UAAU,CAAC,EAAE,cAAc,CAAA;CAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui",
|
|
3
|
-
"version": "0.7.5-
|
|
3
|
+
"version": "0.7.5-staging.2ff1350",
|
|
4
4
|
"description": "Low-level React components for DXOS, applying a theme to a core group of primitives",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": "DXOS.org",
|
|
9
9
|
"sideEffects": true,
|
|
10
|
+
"type": "module",
|
|
10
11
|
"exports": {
|
|
11
12
|
".": {
|
|
12
13
|
"types": "./dist/types/src/index.d.ts",
|
|
@@ -60,13 +61,13 @@
|
|
|
60
61
|
"keyborg": "^2.5.0",
|
|
61
62
|
"react-i18next": "^11.18.6",
|
|
62
63
|
"react-remove-scroll": "^2.6.0",
|
|
63
|
-
"@dxos/debug": "0.7.5-
|
|
64
|
-
"@dxos/
|
|
65
|
-
"@dxos/
|
|
66
|
-
"@dxos/react-input": "0.7.5-
|
|
67
|
-
"@dxos/react-ui-types": "0.7.5-
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/
|
|
64
|
+
"@dxos/debug": "0.7.5-staging.2ff1350",
|
|
65
|
+
"@dxos/react-hooks": "0.7.5-staging.2ff1350",
|
|
66
|
+
"@dxos/log": "0.7.5-staging.2ff1350",
|
|
67
|
+
"@dxos/react-input": "0.7.5-staging.2ff1350",
|
|
68
|
+
"@dxos/react-ui-types": "0.7.5-staging.2ff1350",
|
|
69
|
+
"@dxos/react-list": "0.7.5-staging.2ff1350",
|
|
70
|
+
"@dxos/util": "0.7.5-staging.2ff1350"
|
|
70
71
|
},
|
|
71
72
|
"devDependencies": {
|
|
72
73
|
"@dnd-kit/core": "^6.0.5",
|
|
@@ -78,15 +79,15 @@
|
|
|
78
79
|
"react": "~18.2.0",
|
|
79
80
|
"react-dom": "~18.2.0",
|
|
80
81
|
"vite": "5.4.7",
|
|
81
|
-
"@dxos/random": "0.7.5-
|
|
82
|
-
"@dxos/react-ui-theme": "0.7.5-
|
|
83
|
-
"@dxos/util": "0.7.5-
|
|
82
|
+
"@dxos/random": "0.7.5-staging.2ff1350",
|
|
83
|
+
"@dxos/react-ui-theme": "0.7.5-staging.2ff1350",
|
|
84
|
+
"@dxos/util": "0.7.5-staging.2ff1350"
|
|
84
85
|
},
|
|
85
86
|
"peerDependencies": {
|
|
86
87
|
"@phosphor-icons/react": "^2.1.5",
|
|
87
88
|
"react": "~18.2.0",
|
|
88
89
|
"react-dom": "~18.2.0",
|
|
89
|
-
"@dxos/react-ui-theme": "0.7.5-
|
|
90
|
+
"@dxos/react-ui-theme": "0.7.5-staging.2ff1350"
|
|
90
91
|
},
|
|
91
92
|
"publishConfig": {
|
|
92
93
|
"access": "public"
|
|
@@ -112,15 +112,10 @@ const AvatarFrame = forwardRef<HTMLSpanElement, AvatarFrameProps>(
|
|
|
112
112
|
</mask>
|
|
113
113
|
</defs>
|
|
114
114
|
{variant === 'circle' ? (
|
|
115
|
-
<circle
|
|
116
|
-
className={hue ? tx('hue.fill', 'avatar__frame__circle', { hue }) : 'fill-[var(--surface-bg)]'}
|
|
117
|
-
cx='50%'
|
|
118
|
-
cy='50%'
|
|
119
|
-
r={r}
|
|
120
|
-
/>
|
|
115
|
+
<circle cx='50%' cy='50%' r={r} fill={hue ? `var(--dx-${hue}Fill)` : 'var(--surface-bg)'} />
|
|
121
116
|
) : (
|
|
122
117
|
<rect
|
|
123
|
-
|
|
118
|
+
fill={hue ? `var(--dx-${hue}Fill)` : 'var(--surface-bg)'}
|
|
124
119
|
x={ringGap + ringWidth}
|
|
125
120
|
y={ringGap + ringWidth}
|
|
126
121
|
width={2 * r}
|
|
@@ -14,6 +14,7 @@ type IconButtonProps = Omit<ButtonProps, 'children'> &
|
|
|
14
14
|
Pick<IconProps, 'icon' | 'size'> & {
|
|
15
15
|
label: NonNullable<ReactNode>;
|
|
16
16
|
iconOnly?: boolean;
|
|
17
|
+
noTooltip?: boolean;
|
|
17
18
|
caretDown?: boolean;
|
|
18
19
|
// TODO(burdon): Create slots abstraction?
|
|
19
20
|
iconClassNames?: ThemedClassName<any>['classNames'];
|
|
@@ -24,8 +25,14 @@ type IconButtonProps = Omit<ButtonProps, 'children'> &
|
|
|
24
25
|
};
|
|
25
26
|
|
|
26
27
|
const IconOnlyButton = forwardRef<HTMLButtonElement, IconButtonProps>(
|
|
27
|
-
(
|
|
28
|
+
(
|
|
29
|
+
{ noTooltip, tooltipPortal = true, tooltipZIndex: zIndex, tooltipSide, suppressNextTooltip, ...props },
|
|
30
|
+
forwardedRef,
|
|
31
|
+
) => {
|
|
28
32
|
const [triggerTooltipOpen, setTriggerTooltipOpen] = useState(false);
|
|
33
|
+
if (noTooltip) {
|
|
34
|
+
return <LabelledIconButton {...props} ref={forwardedRef} />;
|
|
35
|
+
}
|
|
29
36
|
const content = (
|
|
30
37
|
<Tooltip.Content {...(zIndex && { style: { zIndex } })} side={tooltipSide}>
|
|
31
38
|
{props.label}
|
|
@@ -44,11 +44,15 @@ export const CopyButton = ({ value, classNames, iconProps, ...props }: CopyButto
|
|
|
44
44
|
);
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
type CopyButtonIconOnlyProps = CopyButtonProps & {
|
|
48
|
+
label?: string;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const CopyButtonIconOnly = ({ value, classNames, iconProps, variant, ...props }: CopyButtonIconOnlyProps) => {
|
|
48
52
|
const { t } = useTranslation('os');
|
|
49
53
|
const { textValue, setTextValue } = useClipboard();
|
|
50
54
|
const isCopied = textValue === value;
|
|
51
|
-
const label = isCopied ? t('copy success label') : t('copy label');
|
|
55
|
+
const label = isCopied ? t('copy success label') : props.label ?? t('copy label');
|
|
52
56
|
const [open, setOpen] = useState(false);
|
|
53
57
|
return (
|
|
54
58
|
<Tooltip.Root delayDuration={1500} open={open} onOpenChange={setOpen}>
|
|
@@ -95,7 +95,9 @@ const [OverlayLayoutProvider, useOverlayLayoutContext] = createContext<OverlayLa
|
|
|
95
95
|
},
|
|
96
96
|
);
|
|
97
97
|
|
|
98
|
-
type AlertDialogOverlayProps = ThemedClassName<AlertDialogOverlayPrimitiveProps> & {
|
|
98
|
+
type AlertDialogOverlayProps = ThemedClassName<AlertDialogOverlayPrimitiveProps> & {
|
|
99
|
+
blockAlign?: 'center' | 'start' | 'end';
|
|
100
|
+
};
|
|
99
101
|
|
|
100
102
|
const AlertDialogOverlay: ForwardRefExoticComponent<AlertDialogOverlayProps> = forwardRef<
|
|
101
103
|
HTMLDivElement,
|
|
@@ -85,7 +85,7 @@ const [OverlayLayoutProvider, useOverlayLayoutContext] = createContext<OverlayLa
|
|
|
85
85
|
inOverlayLayout: false,
|
|
86
86
|
});
|
|
87
87
|
|
|
88
|
-
type DialogOverlayProps = ThemedClassName<DialogOverlayPrimitiveProps> & { blockAlign?: 'center' | 'start' };
|
|
88
|
+
type DialogOverlayProps = ThemedClassName<DialogOverlayPrimitiveProps> & { blockAlign?: 'center' | 'start' | 'end' };
|
|
89
89
|
|
|
90
90
|
const DialogOverlay: ForwardRefExoticComponent<DialogOverlayProps> = forwardRef<HTMLDivElement, DialogOverlayProps>(
|
|
91
91
|
({ classNames, children, blockAlign, ...props }, forwardedRef) => {
|
|
@@ -106,17 +106,22 @@ const DialogOverlay: ForwardRefExoticComponent<DialogOverlayProps> = forwardRef<
|
|
|
106
106
|
|
|
107
107
|
DialogOverlay.displayName = DIALOG_OVERLAY_NAME;
|
|
108
108
|
|
|
109
|
-
type DialogContentProps = ThemedClassName<DialogContentPrimitiveProps
|
|
109
|
+
type DialogContentProps = ThemedClassName<DialogContentPrimitiveProps> & { inOverlayLayout?: boolean };
|
|
110
110
|
|
|
111
111
|
const DialogContent: ForwardRefExoticComponent<DialogContentProps> = forwardRef<HTMLDivElement, DialogContentProps>(
|
|
112
|
-
({ classNames, children, ...props }, forwardedRef) => {
|
|
112
|
+
({ classNames, children, inOverlayLayout: propsInOverlayLayout, ...props }, forwardedRef) => {
|
|
113
113
|
const { tx } = useThemeContext();
|
|
114
114
|
const { inOverlayLayout } = useOverlayLayoutContext(DIALOG_CONTENT_NAME);
|
|
115
115
|
|
|
116
116
|
return (
|
|
117
117
|
<DialogContentPrimitive
|
|
118
118
|
{...props}
|
|
119
|
-
className={tx(
|
|
119
|
+
className={tx(
|
|
120
|
+
'dialog.content',
|
|
121
|
+
'dialog',
|
|
122
|
+
{ inOverlayLayout: propsInOverlayLayout || inOverlayLayout },
|
|
123
|
+
classNames,
|
|
124
|
+
)}
|
|
120
125
|
ref={forwardedRef}
|
|
121
126
|
>
|
|
122
127
|
{children}
|
|
@@ -12,7 +12,10 @@ import { type ThemedClassName } from '../../util';
|
|
|
12
12
|
|
|
13
13
|
const ICONS_URL = '/icons.svg';
|
|
14
14
|
|
|
15
|
-
export type IconProps = ThemedClassName<ComponentPropsWithRef<typeof Primitive.svg>> & {
|
|
15
|
+
export type IconProps = ThemedClassName<ComponentPropsWithRef<typeof Primitive.svg>> & {
|
|
16
|
+
icon: string;
|
|
17
|
+
size?: Size;
|
|
18
|
+
};
|
|
16
19
|
|
|
17
20
|
export const Icon = memo(
|
|
18
21
|
forwardRef<SVGSVGElement, IconProps>(({ icon, classNames, size, ...props }, forwardedRef) => {
|
|
@@ -15,8 +15,10 @@ const edgeToOrientationMap: Record<Edge, Orientation> = {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
const orientationStyles: Record<Orientation, HTMLAttributes<HTMLElement>['className']> = {
|
|
18
|
-
horizontal:
|
|
19
|
-
|
|
18
|
+
horizontal:
|
|
19
|
+
'h-[--line-thickness] left-[calc(var(--line-inset)+var(--terminal-radius))] right-[--line-inset] before:left-[--terminal-inset]',
|
|
20
|
+
vertical:
|
|
21
|
+
'w-[--line-thickness] top-[calc(var(--line-inset)+var(--terminal-radius))] bottom-[--line-inset] before:top-[--terminal-inset]',
|
|
20
22
|
};
|
|
21
23
|
|
|
22
24
|
const edgeStyles: Record<Edge, HTMLAttributes<HTMLElement>['className']> = {
|
|
@@ -33,14 +35,19 @@ const offsetToAlignTerminalWithLine = (strokeSize - terminalSize) / 2;
|
|
|
33
35
|
export type DropIndicatorProps = {
|
|
34
36
|
edge: Edge;
|
|
35
37
|
gap?: number;
|
|
38
|
+
terminalInset?: number;
|
|
39
|
+
lineInset?: number;
|
|
36
40
|
};
|
|
37
41
|
|
|
38
42
|
/**
|
|
39
43
|
* This is a tailwind port of `@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box`
|
|
40
44
|
*/
|
|
41
|
-
export const ListDropIndicator = ({
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
export const ListDropIndicator = ({
|
|
46
|
+
edge,
|
|
47
|
+
gap = 0,
|
|
48
|
+
lineInset = 0,
|
|
49
|
+
terminalInset = lineInset - terminalSize,
|
|
50
|
+
}: DropIndicatorProps) => {
|
|
44
51
|
const orientation = edgeToOrientationMap[edge];
|
|
45
52
|
|
|
46
53
|
return (
|
|
@@ -49,10 +56,11 @@ export const ListDropIndicator = ({ edge, gap = 0 }: DropIndicatorProps) => {
|
|
|
49
56
|
style={
|
|
50
57
|
{
|
|
51
58
|
'--line-thickness': `${strokeSize}px`,
|
|
52
|
-
'--line-offset':
|
|
59
|
+
'--line-offset': `calc(-0.5 * (${gap}px + ${strokeSize}px))`,
|
|
60
|
+
'--line-inset': `${lineInset}px`,
|
|
53
61
|
'--terminal-size': `${terminalSize}px`,
|
|
54
62
|
'--terminal-radius': `${terminalSize / 2}px`,
|
|
55
|
-
'--
|
|
63
|
+
'--terminal-inset': `${terminalInset}px`,
|
|
56
64
|
'--offset-terminal': `${offsetToAlignTerminalWithLine}px`,
|
|
57
65
|
} as CSSProperties
|
|
58
66
|
}
|
|
@@ -3,17 +3,14 @@
|
|
|
3
3
|
//
|
|
4
4
|
import React from 'react';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { hues } from '@dxos/react-ui-theme';
|
|
7
7
|
import '@dxos-theme';
|
|
8
8
|
import { type ChromaticPalette, type MessageValence } from '@dxos/react-ui-types';
|
|
9
9
|
|
|
10
10
|
import { Tag } from './Tag';
|
|
11
11
|
import { withTheme } from '../../testing';
|
|
12
12
|
|
|
13
|
-
const palettes = ['neutral', 'success', 'info', 'warning', 'error', ...
|
|
14
|
-
| ChromaticPalette
|
|
15
|
-
| MessageValence
|
|
16
|
-
)[];
|
|
13
|
+
const palettes = ['neutral', 'success', 'info', 'warning', 'error', ...hues] as (ChromaticPalette | MessageValence)[];
|
|
17
14
|
|
|
18
15
|
export default {
|
|
19
16
|
title: 'ui/react-ui-core/Tag',
|
|
@@ -12,11 +12,12 @@ import { Button } from '../Buttons';
|
|
|
12
12
|
|
|
13
13
|
type StoryTooltipProps = {
|
|
14
14
|
content: string;
|
|
15
|
+
defaultOpen?: boolean;
|
|
15
16
|
};
|
|
16
17
|
|
|
17
|
-
const StoryTooltip = ({ content }: StoryTooltipProps) => (
|
|
18
|
+
const StoryTooltip = ({ content, defaultOpen }: StoryTooltipProps) => (
|
|
18
19
|
<Tooltip.Provider>
|
|
19
|
-
<Tooltip.Root defaultOpen>
|
|
20
|
+
<Tooltip.Root defaultOpen={defaultOpen}>
|
|
20
21
|
<Tooltip.Trigger asChild>
|
|
21
22
|
<Button>Trigger tooltip</Button>
|
|
22
23
|
</Tooltip.Trigger>
|
|
@@ -44,3 +45,13 @@ export const Default = {
|
|
|
44
45
|
chromatic: { delay: 500 },
|
|
45
46
|
},
|
|
46
47
|
};
|
|
48
|
+
|
|
49
|
+
export const Testing = {
|
|
50
|
+
args: {
|
|
51
|
+
defaultOption: true,
|
|
52
|
+
content: 'This is the tooltip content',
|
|
53
|
+
},
|
|
54
|
+
parameters: {
|
|
55
|
+
chromatic: { delay: 500 },
|
|
56
|
+
},
|
|
57
|
+
};
|