@dxos/react-ui 0.7.5-main.9d26e3a → 0.7.5-main.9d2a38b
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 +213 -140
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +589 -520
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +213 -140
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Buttons/IconButton.d.ts +4 -2
- package/dist/types/src/components/Buttons/IconButton.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/Dialog.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.d.ts +0 -2
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/Menus/ContextMenu.d.ts.map +1 -1
- package/dist/types/src/components/Menus/DropdownMenu.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.d.ts.map +1 -1
- package/dist/types/src/components/Separator/Separator.d.ts +3 -1
- package/dist/types/src/components/Separator/Separator.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +3 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +15 -5
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +7 -2
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useSafeArea.d.ts +9 -0
- package/dist/types/src/hooks/useSafeArea.d.ts.map +1 -0
- package/dist/types/src/hooks/useSafeCollisionPadding.d.ts +10 -0
- package/dist/types/src/hooks/useSafeCollisionPadding.d.ts.map +1 -0
- package/dist/types/src/hooks/useVisualViewport.d.ts +1 -1
- package/dist/types/src/hooks/useVisualViewport.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -12
- package/src/components/Buttons/IconButton.tsx +22 -5
- package/src/components/Dialogs/Dialog.tsx +1 -9
- package/src/components/Main/Main.tsx +0 -36
- package/src/components/Menus/ContextMenu.tsx +4 -2
- package/src/components/Menus/DropdownMenu.tsx +4 -2
- package/src/components/Popover/Popover.tsx +4 -0
- package/src/components/Select/Select.tsx +4 -1
- package/src/components/Separator/Separator.tsx +14 -11
- package/src/components/ThemeProvider/ThemeProvider.tsx +12 -3
- package/src/components/Toolbar/Toolbar.tsx +40 -10
- package/src/components/Tooltip/Tooltip.tsx +17 -13
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useSafeArea.ts +25 -0
- package/src/hooks/useSafeCollisionPadding.ts +39 -0
- package/src/hooks/useVisualViewport.ts +11 -12
|
@@ -1,21 +1,27 @@
|
|
|
1
|
+
import type { ToggleGroupItemProps as ToggleGroupItemPrimitiveProps } from '@radix-ui/react-toggle-group';
|
|
1
2
|
import * as ToolbarPrimitive from '@radix-ui/react-toolbar';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { type ThemedClassName } from '../../util';
|
|
4
|
-
import { type ButtonGroupProps, type ButtonProps, type ToggleGroupItemProps, type ToggleProps } from '../Buttons';
|
|
5
|
+
import { type ButtonGroupProps, type ButtonProps, type ToggleGroupItemProps, type ToggleProps, type IconButtonProps } from '../Buttons';
|
|
5
6
|
import { type LinkProps } from '../Link';
|
|
6
7
|
import { type SeparatorProps } from '../Separator';
|
|
7
8
|
type ToolbarRootProps = ThemedClassName<ToolbarPrimitive.ToolbarProps>;
|
|
8
9
|
type ToolbarButtonProps = ButtonProps;
|
|
10
|
+
type ToolbarIconButtonProps = IconButtonProps;
|
|
9
11
|
type ToolbarToggleProps = ToggleProps;
|
|
10
12
|
type ToolbarLinkProps = LinkProps;
|
|
11
13
|
type ToolbarToggleGroupProps = (Omit<ToolbarPrimitive.ToolbarToggleGroupSingleProps, 'className'> | Omit<ToolbarPrimitive.ToolbarToggleGroupMultipleProps, 'className'>) & ButtonGroupProps;
|
|
12
14
|
type ToolbarToggleGroupItemProps = ToggleGroupItemProps;
|
|
13
|
-
type
|
|
15
|
+
type ToolbarToggleGroupIconItemProps = Omit<ToggleGroupItemPrimitiveProps, 'className'> & IconButtonProps;
|
|
16
|
+
type ToolbarSeparatorProps = SeparatorProps & {
|
|
17
|
+
variant?: 'gap' | 'line';
|
|
18
|
+
};
|
|
14
19
|
export declare const Toolbar: {
|
|
15
20
|
Root: React.ForwardRefExoticComponent<Omit<ToolbarPrimitive.ToolbarProps, "className"> & {
|
|
16
21
|
classNames?: import("packages/ui/react-ui-types/dist/types/src").ClassNameValue;
|
|
17
22
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
18
23
|
Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
24
|
+
IconButton: React.ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
19
25
|
Link: React.ForwardRefExoticComponent<Omit<LinkProps, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
20
26
|
Toggle: React.ForwardRefExoticComponent<Omit<ToggleProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
21
27
|
ToggleGroup: React.ForwardRefExoticComponent<(Omit<Omit<ToolbarPrimitive.ToolbarToggleGroupSingleProps, "className"> & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
@@ -38,8 +44,12 @@ export declare const Toolbar: {
|
|
|
38
44
|
asChild?: boolean;
|
|
39
45
|
}, "ref">) & React.RefAttributes<HTMLDivElement>>;
|
|
40
46
|
ToggleGroupItem: React.ForwardRefExoticComponent<Omit<ToggleGroupItemProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
41
|
-
|
|
42
|
-
|
|
47
|
+
ToggleGroupIconItem: React.ForwardRefExoticComponent<Omit<ToolbarToggleGroupIconItemProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
48
|
+
Separator: React.ForwardRefExoticComponent<Omit<import("@radix-ui/react-separator").SeparatorProps, "className"> & {
|
|
49
|
+
classNames?: import("packages/ui/react-ui-types/dist/types/src").ClassNameValue;
|
|
50
|
+
} & {
|
|
51
|
+
variant?: "gap" | "line";
|
|
52
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
43
53
|
};
|
|
44
|
-
export type { ToolbarRootProps, ToolbarButtonProps, ToolbarLinkProps, ToolbarToggleProps, ToolbarToggleGroupProps, ToolbarToggleGroupItemProps, ToolbarSeparatorProps, };
|
|
54
|
+
export type { ToolbarRootProps, ToolbarButtonProps, ToolbarIconButtonProps, ToolbarLinkProps, ToolbarToggleProps, ToolbarToggleGroupProps, ToolbarToggleGroupItemProps, ToolbarToggleGroupIconItemProps, ToolbarSeparatorProps, };
|
|
45
55
|
//# sourceMappingURL=Toolbar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../../../../src/components/Toolbar/Toolbar.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAqB,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAEhB,KAAK,oBAAoB,EACzB,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../../../../src/components/Toolbar/Toolbar.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,IAAI,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAC1G,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAqB,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAEhB,KAAK,oBAAoB,EACzB,KAAK,WAAW,EAEhB,KAAK,eAAe,EACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9D,KAAK,gBAAgB,GAAG,eAAe,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;AAWvE,KAAK,kBAAkB,GAAG,WAAW,CAAC;AAUtC,KAAK,sBAAsB,GAAG,eAAe,CAAC;AAU9C,KAAK,kBAAkB,GAAG,WAAW,CAAC;AAUtC,KAAK,gBAAgB,GAAG,SAAS,CAAC;AAUlC,KAAK,uBAAuB,GAAG,CAC3B,IAAI,CAAC,gBAAgB,CAAC,6BAA6B,EAAE,WAAW,CAAC,GACjE,IAAI,CAAC,gBAAgB,CAAC,+BAA+B,EAAE,WAAW,CAAC,CACtE,GACC,gBAAgB,CAAC;AAYnB,KAAK,2BAA2B,GAAG,oBAAoB,CAAC;AAYxD,KAAK,+BAA+B,GAAG,IAAI,CAAC,6BAA6B,EAAE,WAAW,CAAC,GAAG,eAAe,CAAC;AAY1G,KAAK,qBAAqB,GAAG,cAAc,GAAG;IAAE,OAAO,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;CAAE,CAAC;AAc3E,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAdsC,KAAK,GAAG,MAAM;;CAwBvE,CAAC;AAEF,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,2BAA2B,EAC3B,+BAA+B,EAC/B,qBAAqB,GACtB,CAAC"}
|
|
@@ -8,6 +8,7 @@ declare const _default: {
|
|
|
8
8
|
classNames?: import("packages/ui/react-ui-types/dist/types/src").ClassNameValue;
|
|
9
9
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
10
10
|
Button: React.ForwardRefExoticComponent<Omit<import("../Buttons").ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
11
|
+
IconButton: React.ForwardRefExoticComponent<Omit<import("../Buttons").IconButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
11
12
|
Link: React.ForwardRefExoticComponent<Omit<import("..").LinkProps, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
12
13
|
Toggle: React.ForwardRefExoticComponent<Omit<import("../Buttons").ToggleProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
13
14
|
ToggleGroup: React.ForwardRefExoticComponent<(Omit<Omit<import("@radix-ui/react-toolbar").ToolbarToggleGroupSingleProps, "className"> & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
@@ -30,8 +31,12 @@ declare const _default: {
|
|
|
30
31
|
asChild?: boolean;
|
|
31
32
|
}, "ref">) & React.RefAttributes<HTMLDivElement>>;
|
|
32
33
|
ToggleGroupItem: React.ForwardRefExoticComponent<Omit<import("../Buttons").ToggleGroupItemProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
ToggleGroupIconItem: React.ForwardRefExoticComponent<Omit<import("./Toolbar").ToolbarToggleGroupIconItemProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
35
|
+
Separator: React.ForwardRefExoticComponent<Omit<import("@radix-ui/react-separator").SeparatorProps, "className"> & {
|
|
36
|
+
classNames?: import("packages/ui/react-ui-types/dist/types/src").ClassNameValue;
|
|
37
|
+
} & {
|
|
38
|
+
variant?: "gap" | "line";
|
|
39
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
35
40
|
};
|
|
36
41
|
render: (props: StorybookToolbarProps) => React.JSX.Element;
|
|
37
42
|
decorators: import("@storybook/react/*").Decorator[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolbar.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Toolbar/Toolbar.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAGrB,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,KAAK,qBAAqB,GAAG,EAAE,CAAC
|
|
1
|
+
{"version":3,"file":"Toolbar.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Toolbar/Toolbar.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAGrB,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,KAAK,qBAAqB,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAEC,qBAAqB;;;;;;;;AAuDtD,wBAME;AAEF,eAAO,MAAM,OAAO;;CAEnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,oBAAoB,IAAI,6BAA6B,EAE1D,KAAK,YAAY,IAAI,yBAAyB,EAC9C,KAAK,mBAAmB,IAAI,4BAA4B,EAExD,KAAK,mBAAmB,IAAI,4BAA4B,EAExD,KAAK,kBAAkB,IAAI,2BAA2B,EAEtD,KAAK,iBAAiB,IAAI,0BAA0B,EAErD,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAA6C,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,oBAAoB,IAAI,6BAA6B,EAE1D,KAAK,YAAY,IAAI,yBAAyB,EAC9C,KAAK,mBAAmB,IAAI,4BAA4B,EAExD,KAAK,mBAAmB,IAAI,4BAA4B,EAExD,KAAK,kBAAkB,IAAI,2BAA2B,EAEtD,KAAK,iBAAiB,IAAI,0BAA0B,EAErD,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAA6C,MAAM,OAAO,CAAC;AAIlE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,KAAK,oBAAoB,GAAG,6BAA6B,CAAC;AAI1D,KAAK,gBAAgB,GAAG,yBAAyB,CAAC;AAIlD,KAAK,kBAAkB,GAAG,2BAA2B,CAAC;AAItD,KAAK,mBAAmB,GAAG,4BAA4B,CAAC;AAIxD,KAAK,iBAAiB,GAAG,eAAe,CAAC,0BAA0B,CAAC,CAAC;AAarE,KAAK,mBAAmB,GAAG,eAAe,CAAC,4BAA4B,CAAC,CAAC;AAmBzE,eAAO,MAAM,OAAO;;;;;;;;;;;CAOnB,CAAC;AAEF,YAAY,EACV,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,GACpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAIA,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAIA,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type SafeAreaPadding = Record<'top' | 'right' | 'bottom' | 'left', number>;
|
|
2
|
+
export declare const initialSafeArea: {
|
|
3
|
+
top: number;
|
|
4
|
+
right: number;
|
|
5
|
+
bottom: number;
|
|
6
|
+
left: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const useSafeArea: () => SafeAreaPadding;
|
|
9
|
+
//# sourceMappingURL=useSafeArea.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSafeArea.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useSafeArea.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC;AAElF,eAAO,MAAM,eAAe;;;;;CAAmD,CAAC;AAEhF,eAAO,MAAM,WAAW,QAAO,eAY9B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type TooltipContentProps } from '@radix-ui/react-tooltip';
|
|
2
|
+
type PaddingProp = TooltipContentProps['collisionPadding'];
|
|
3
|
+
export declare const useSafeCollisionPadding: (collisionPadding?: PaddingProp) => {
|
|
4
|
+
top: number;
|
|
5
|
+
right: number;
|
|
6
|
+
bottom: number;
|
|
7
|
+
left: number;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=useSafeCollisionPadding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSafeCollisionPadding.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useSafeCollisionPadding.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAMnE,KAAK,WAAW,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,CAAC;AAiB3D,eAAO,MAAM,uBAAuB,sBAAuB,WAAW;;;;;CAWrE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useVisualViewport.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useVisualViewport.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"useVisualViewport.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useVisualViewport.ts"],"names":[],"mappings":"AAIA,OAAO,EAAe,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAI9D,eAAO,MAAM,iBAAiB,UAAW,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC;;;CAcvE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"5.7.
|
|
1
|
+
{"version":"5.7.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui",
|
|
3
|
-
"version": "0.7.5-main.
|
|
3
|
+
"version": "0.7.5-main.9d2a38b",
|
|
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",
|
|
@@ -60,13 +60,13 @@
|
|
|
60
60
|
"keyborg": "^2.5.0",
|
|
61
61
|
"react-i18next": "^11.18.6",
|
|
62
62
|
"react-remove-scroll": "^2.6.0",
|
|
63
|
-
"@dxos/debug": "0.7.5-main.
|
|
64
|
-
"@dxos/log": "0.7.5-main.
|
|
65
|
-
"@dxos/react-
|
|
66
|
-
"@dxos/react-
|
|
67
|
-
"@dxos/react-
|
|
68
|
-
"@dxos/react-
|
|
69
|
-
"@dxos/util": "0.7.5-main.
|
|
63
|
+
"@dxos/debug": "0.7.5-main.9d2a38b",
|
|
64
|
+
"@dxos/log": "0.7.5-main.9d2a38b",
|
|
65
|
+
"@dxos/react-input": "0.7.5-main.9d2a38b",
|
|
66
|
+
"@dxos/react-hooks": "0.7.5-main.9d2a38b",
|
|
67
|
+
"@dxos/react-ui-types": "0.7.5-main.9d2a38b",
|
|
68
|
+
"@dxos/react-list": "0.7.5-main.9d2a38b",
|
|
69
|
+
"@dxos/util": "0.7.5-main.9d2a38b"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@dnd-kit/core": "^6.0.5",
|
|
@@ -78,15 +78,15 @@
|
|
|
78
78
|
"react": "~18.2.0",
|
|
79
79
|
"react-dom": "~18.2.0",
|
|
80
80
|
"vite": "5.4.7",
|
|
81
|
-
"@dxos/random": "0.7.5-main.
|
|
82
|
-
"@dxos/react-ui-theme": "0.7.5-main.
|
|
83
|
-
"@dxos/util": "0.7.5-main.
|
|
81
|
+
"@dxos/random": "0.7.5-main.9d2a38b",
|
|
82
|
+
"@dxos/react-ui-theme": "0.7.5-main.9d2a38b",
|
|
83
|
+
"@dxos/util": "0.7.5-main.9d2a38b"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
86
|
"@phosphor-icons/react": "^2.1.5",
|
|
87
87
|
"react": "~18.2.0",
|
|
88
88
|
"react-dom": "~18.2.0",
|
|
89
|
-
"@dxos/react-ui-theme": "0.7.5-main.
|
|
89
|
+
"@dxos/react-ui-theme": "0.7.5-main.9d2a38b"
|
|
90
90
|
},
|
|
91
91
|
"publishConfig": {
|
|
92
92
|
"access": "public"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { forwardRef } from 'react';
|
|
5
|
+
import React, { forwardRef, type ReactNode, type MutableRefObject, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { Button, type ButtonProps } from './Button';
|
|
8
8
|
import { useThemeContext } from '../../hooks';
|
|
@@ -12,16 +12,19 @@ import { Tooltip } from '../Tooltip';
|
|
|
12
12
|
|
|
13
13
|
type IconButtonProps = Omit<ButtonProps, 'children'> &
|
|
14
14
|
Pick<IconProps, 'icon' | 'size'> & {
|
|
15
|
-
label:
|
|
15
|
+
label: NonNullable<ReactNode>;
|
|
16
16
|
iconOnly?: boolean;
|
|
17
|
+
caretDown?: boolean;
|
|
17
18
|
// TODO(burdon): Create slots abstraction?
|
|
18
19
|
iconClassNames?: ThemedClassName<any>['classNames'];
|
|
19
20
|
tooltipPortal?: boolean;
|
|
20
21
|
tooltipZIndex?: string;
|
|
22
|
+
suppressNextTooltip?: MutableRefObject<boolean>;
|
|
21
23
|
};
|
|
22
24
|
|
|
23
25
|
const IconOnlyButton = forwardRef<HTMLButtonElement, IconButtonProps>(
|
|
24
|
-
({ tooltipPortal = true, tooltipZIndex: zIndex, ...props }, forwardedRef) => {
|
|
26
|
+
({ tooltipPortal = true, tooltipZIndex: zIndex, suppressNextTooltip, ...props }, forwardedRef) => {
|
|
27
|
+
const [triggerTooltipOpen, setTriggerTooltipOpen] = useState(false);
|
|
25
28
|
const content = (
|
|
26
29
|
<Tooltip.Content {...(zIndex && { style: { zIndex } })}>
|
|
27
30
|
{props.label}
|
|
@@ -29,7 +32,17 @@ const IconOnlyButton = forwardRef<HTMLButtonElement, IconButtonProps>(
|
|
|
29
32
|
</Tooltip.Content>
|
|
30
33
|
);
|
|
31
34
|
return (
|
|
32
|
-
<Tooltip.Root
|
|
35
|
+
<Tooltip.Root
|
|
36
|
+
open={triggerTooltipOpen}
|
|
37
|
+
onOpenChange={(nextOpen) => {
|
|
38
|
+
if (suppressNextTooltip?.current) {
|
|
39
|
+
setTriggerTooltipOpen(false);
|
|
40
|
+
suppressNextTooltip.current = false;
|
|
41
|
+
} else {
|
|
42
|
+
setTriggerTooltipOpen(nextOpen);
|
|
43
|
+
}
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
33
46
|
<Tooltip.Trigger asChild>
|
|
34
47
|
<LabelledIconButton {...props} ref={forwardedRef} />
|
|
35
48
|
</Tooltip.Trigger>
|
|
@@ -40,12 +53,16 @@ const IconOnlyButton = forwardRef<HTMLButtonElement, IconButtonProps>(
|
|
|
40
53
|
);
|
|
41
54
|
|
|
42
55
|
const LabelledIconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
|
|
43
|
-
(
|
|
56
|
+
(
|
|
57
|
+
{ icon, size, iconOnly, label, classNames, iconClassNames, caretDown, suppressNextTooltip, ...props },
|
|
58
|
+
forwardedRef,
|
|
59
|
+
) => {
|
|
44
60
|
const { tx } = useThemeContext();
|
|
45
61
|
return (
|
|
46
62
|
<Button {...props} classNames={tx('iconButton.root', 'iconButton', {}, classNames)} ref={forwardedRef}>
|
|
47
63
|
<Icon icon={icon} size={size} classNames={iconClassNames} />
|
|
48
64
|
<span className={iconOnly ? 'sr-only' : undefined}>{label}</span>
|
|
65
|
+
{caretDown && <Icon size={3} icon='ph--caret-down--bold' />}
|
|
49
66
|
</Button>
|
|
50
67
|
);
|
|
51
68
|
},
|
|
@@ -94,15 +94,7 @@ const DialogOverlay: ForwardRefExoticComponent<DialogOverlayProps> = forwardRef<
|
|
|
94
94
|
return (
|
|
95
95
|
<DialogOverlayPrimitive
|
|
96
96
|
{...props}
|
|
97
|
-
className={tx(
|
|
98
|
-
'dialog.overlay',
|
|
99
|
-
'dialog__overlay',
|
|
100
|
-
{},
|
|
101
|
-
classNames,
|
|
102
|
-
'data-[block-align=start]:justify-center',
|
|
103
|
-
'data-[block-align=start]:items-start',
|
|
104
|
-
'data-[block-align=center]:place-content-center',
|
|
105
|
-
)}
|
|
97
|
+
className={tx('dialog.overlay', 'dialog__overlay', {}, classNames)}
|
|
106
98
|
ref={forwardedRef}
|
|
107
99
|
data-block-align={blockAlign}
|
|
108
100
|
>
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { useFocusableGroup } from '@fluentui/react-tabster';
|
|
6
|
-
import { useComposedRefs } from '@radix-ui/react-compose-refs';
|
|
7
6
|
import { createContext } from '@radix-ui/react-context';
|
|
8
7
|
import { Root as DialogRoot, DialogContent } from '@radix-ui/react-dialog';
|
|
9
8
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
@@ -333,47 +332,12 @@ const MainOverlay = forwardRef<HTMLDivElement, MainOverlayProps>(({ classNames,
|
|
|
333
332
|
);
|
|
334
333
|
});
|
|
335
334
|
|
|
336
|
-
type MainNotchProps = ThemedClassName<ComponentPropsWithRef<typeof Primitive.div>>;
|
|
337
|
-
|
|
338
|
-
const MainNotch = forwardRef<HTMLDivElement, MainNotchProps>(({ classNames, ...props }, forwardedRef) => {
|
|
339
|
-
const { tx } = useThemeContext();
|
|
340
|
-
// Notch is concerned with the nav sidebar, whichever side it might be on.
|
|
341
|
-
const { navigationSidebarOpen } = useMainContext(MAIN_NAME);
|
|
342
|
-
const notchElement = useRef<HTMLDivElement | null>(null);
|
|
343
|
-
const ref = useComposedRefs(forwardedRef, notchElement);
|
|
344
|
-
|
|
345
|
-
const handleKeyDown = useCallback(
|
|
346
|
-
(event: KeyboardEvent<HTMLDivElement>) => {
|
|
347
|
-
switch (event.key) {
|
|
348
|
-
case 'Escape':
|
|
349
|
-
props?.onKeyDown?.(event);
|
|
350
|
-
notchElement.current?.focus();
|
|
351
|
-
}
|
|
352
|
-
},
|
|
353
|
-
[props?.onKeyDown],
|
|
354
|
-
);
|
|
355
|
-
|
|
356
|
-
const mover = useLandmarkMover(handleKeyDown, '3');
|
|
357
|
-
|
|
358
|
-
return (
|
|
359
|
-
<div
|
|
360
|
-
role='toolbar'
|
|
361
|
-
{...mover}
|
|
362
|
-
{...props}
|
|
363
|
-
data-nav-sidebar-state={navigationSidebarOpen ? 'open' : 'closed'}
|
|
364
|
-
className={tx('main.notch', 'main__notch', {}, classNames)}
|
|
365
|
-
ref={ref}
|
|
366
|
-
/>
|
|
367
|
-
);
|
|
368
|
-
});
|
|
369
|
-
|
|
370
335
|
export const Main = {
|
|
371
336
|
Root: MainRoot,
|
|
372
337
|
Content: MainContent,
|
|
373
338
|
Overlay: MainOverlay,
|
|
374
339
|
NavigationSidebar: MainNavigationSidebar,
|
|
375
340
|
ComplementarySidebar: MainComplementarySidebar,
|
|
376
|
-
Notch: MainNotch,
|
|
377
341
|
};
|
|
378
342
|
|
|
379
343
|
export { useMainContext, useSidebars };
|
|
@@ -7,6 +7,7 @@ import { Slot } from '@radix-ui/react-slot';
|
|
|
7
7
|
import React, { type ComponentPropsWithRef, forwardRef } from 'react';
|
|
8
8
|
|
|
9
9
|
import { useElevationContext, useThemeContext } from '../../hooks';
|
|
10
|
+
import { useSafeCollisionPadding } from '../../hooks/useSafeCollisionPadding';
|
|
10
11
|
import { type ThemedClassName } from '../../util';
|
|
11
12
|
|
|
12
13
|
type ContextMenuRootProps = ContextMenuPrimitive.ContextMenuProps;
|
|
@@ -26,13 +27,14 @@ type ContextMenuContentProps = ThemedClassName<ContextMenuPrimitive.ContextMenuC
|
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
const ContextMenuContent = forwardRef<HTMLDivElement, ContextMenuContentProps>(
|
|
29
|
-
({ classNames, children, ...props }, forwardedRef) => {
|
|
30
|
+
({ classNames, children, collisionPadding = 8, ...props }, forwardedRef) => {
|
|
30
31
|
const { tx } = useThemeContext();
|
|
31
32
|
const elevation = useElevationContext();
|
|
33
|
+
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
32
34
|
return (
|
|
33
35
|
<ContextMenuPrimitive.Content
|
|
34
|
-
collisionPadding={8}
|
|
35
36
|
{...props}
|
|
37
|
+
collisionPadding={safeCollisionPadding}
|
|
36
38
|
className={tx('menu.content', 'menu', { elevation }, classNames)}
|
|
37
39
|
ref={forwardedRef}
|
|
38
40
|
>
|
|
@@ -29,6 +29,7 @@ import React, {
|
|
|
29
29
|
} from 'react';
|
|
30
30
|
|
|
31
31
|
import { useElevationContext, useThemeContext } from '../../hooks';
|
|
32
|
+
import { useSafeCollisionPadding } from '../../hooks/useSafeCollisionPadding';
|
|
32
33
|
import { type ThemedClassName } from '../../util';
|
|
33
34
|
|
|
34
35
|
type Direction = 'ltr' | 'rtl';
|
|
@@ -232,19 +233,20 @@ interface DropdownMenuContentProps extends Omit<MenuContentProps, 'onEntryFocus'
|
|
|
232
233
|
|
|
233
234
|
const DropdownMenuContent = forwardRef<DropdownMenuContentElement, DropdownMenuContentProps>(
|
|
234
235
|
(props: ScopedProps<DropdownMenuContentProps>, forwardedRef) => {
|
|
235
|
-
const { __scopeDropdownMenu, classNames, ...contentProps } = props;
|
|
236
|
+
const { __scopeDropdownMenu, classNames, collisionPadding = 8, ...contentProps } = props;
|
|
236
237
|
const { tx } = useThemeContext();
|
|
237
238
|
const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu);
|
|
238
239
|
const elevation = useElevationContext();
|
|
239
240
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
240
241
|
const hasInteractedOutsideRef = useRef(false);
|
|
241
|
-
|
|
242
|
+
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
242
243
|
return (
|
|
243
244
|
<MenuPrimitive.Content
|
|
244
245
|
id={context.contentId}
|
|
245
246
|
aria-labelledby={context.triggerId}
|
|
246
247
|
{...menuScope}
|
|
247
248
|
{...contentProps}
|
|
249
|
+
collisionPadding={safeCollisionPadding}
|
|
248
250
|
ref={forwardedRef}
|
|
249
251
|
onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
250
252
|
if (!hasInteractedOutsideRef.current) {
|
|
@@ -37,6 +37,7 @@ import React, {
|
|
|
37
37
|
import { RemoveScroll } from 'react-remove-scroll';
|
|
38
38
|
|
|
39
39
|
import { useElevationContext, useThemeContext } from '../../hooks';
|
|
40
|
+
import { useSafeCollisionPadding } from '../../hooks/useSafeCollisionPadding';
|
|
40
41
|
import { type ThemedClassName } from '../../util';
|
|
41
42
|
|
|
42
43
|
/* -------------------------------------------------------------------------------------------------
|
|
@@ -428,6 +429,7 @@ const PopoverContentImpl = forwardRef<PopoverContentImplElement, PopoverContentI
|
|
|
428
429
|
onPointerDownOutside,
|
|
429
430
|
onFocusOutside,
|
|
430
431
|
onInteractOutside,
|
|
432
|
+
collisionPadding = 8,
|
|
431
433
|
classNames,
|
|
432
434
|
...contentProps
|
|
433
435
|
} = props;
|
|
@@ -435,6 +437,7 @@ const PopoverContentImpl = forwardRef<PopoverContentImplElement, PopoverContentI
|
|
|
435
437
|
const popperScope = usePopperScope(__scopePopover);
|
|
436
438
|
const { tx } = useThemeContext();
|
|
437
439
|
const elevation = useElevationContext();
|
|
440
|
+
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
438
441
|
|
|
439
442
|
// Make sure the whole tree has focus guards as our `Popover` may be
|
|
440
443
|
// the last element in the DOM (because of the `Portal`)
|
|
@@ -463,6 +466,7 @@ const PopoverContentImpl = forwardRef<PopoverContentImplElement, PopoverContentI
|
|
|
463
466
|
id={context.contentId}
|
|
464
467
|
{...popperScope}
|
|
465
468
|
{...contentProps}
|
|
469
|
+
collisionPadding={safeCollisionPadding}
|
|
466
470
|
className={tx('popover.content', 'popover', { elevation }, classNames)}
|
|
467
471
|
ref={forwardedRef}
|
|
468
472
|
style={{
|
|
@@ -7,6 +7,7 @@ import * as SelectPrimitive from '@radix-ui/react-select';
|
|
|
7
7
|
import React, { forwardRef } from 'react';
|
|
8
8
|
|
|
9
9
|
import { useElevationContext, useThemeContext } from '../../hooks';
|
|
10
|
+
import { useSafeCollisionPadding } from '../../hooks/useSafeCollisionPadding';
|
|
10
11
|
import { type ThemedClassName } from '../../util';
|
|
11
12
|
import { Button, type ButtonProps } from '../Buttons';
|
|
12
13
|
import { Icon } from '../Icon';
|
|
@@ -53,12 +54,14 @@ const SelectTriggerButton = forwardRef<HTMLButtonElement, SelectTriggerButtonPro
|
|
|
53
54
|
type SelectContentProps = ThemedClassName<SelectPrimitive.SelectContentProps>;
|
|
54
55
|
|
|
55
56
|
const SelectContent = forwardRef<HTMLDivElement, SelectContentProps>(
|
|
56
|
-
({ classNames, children, ...props }, forwardedRef) => {
|
|
57
|
+
({ classNames, children, collisionPadding = 8, ...props }, forwardedRef) => {
|
|
57
58
|
const { tx } = useThemeContext();
|
|
58
59
|
const elevation = useElevationContext();
|
|
60
|
+
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
59
61
|
return (
|
|
60
62
|
<SelectPrimitive.Content
|
|
61
63
|
{...props}
|
|
64
|
+
collisionPadding={safeCollisionPadding}
|
|
62
65
|
className={tx('select.content', 'select__content', { elevation }, classNames)}
|
|
63
66
|
position='popper'
|
|
64
67
|
ref={forwardedRef}
|
|
@@ -5,23 +5,26 @@ import {
|
|
|
5
5
|
Separator as SeparatorPrimitive,
|
|
6
6
|
type SeparatorProps as SeparatorPrimitiveProps,
|
|
7
7
|
} from '@radix-ui/react-separator';
|
|
8
|
-
import React from 'react';
|
|
8
|
+
import React, { forwardRef } from 'react';
|
|
9
9
|
|
|
10
10
|
import { useThemeContext } from '../../hooks';
|
|
11
11
|
import { type ThemedClassName } from '../../util';
|
|
12
12
|
|
|
13
13
|
type SeparatorProps = ThemedClassName<SeparatorPrimitiveProps>;
|
|
14
14
|
|
|
15
|
-
const Separator =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
const Separator = forwardRef<HTMLDivElement, SeparatorProps>(
|
|
16
|
+
({ classNames, orientation = 'horizontal', ...props }, forwardedRef) => {
|
|
17
|
+
const { tx } = useThemeContext();
|
|
18
|
+
return (
|
|
19
|
+
<SeparatorPrimitive
|
|
20
|
+
orientation={orientation}
|
|
21
|
+
{...props}
|
|
22
|
+
className={tx('separator.root', 'separator', { orientation }, classNames)}
|
|
23
|
+
ref={forwardedRef}
|
|
24
|
+
/>
|
|
25
|
+
);
|
|
26
|
+
},
|
|
27
|
+
);
|
|
25
28
|
|
|
26
29
|
export type { SeparatorProps };
|
|
27
30
|
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { createKeyborg } from 'keyborg';
|
|
6
|
-
import React, { createContext, type PropsWithChildren, useEffect } from 'react';
|
|
6
|
+
import React, { createContext, type PropsWithChildren, useEffect, useMemo } from 'react';
|
|
7
7
|
|
|
8
8
|
import { type Density, type Elevation, type ThemeFunction } from '@dxos/react-ui-types';
|
|
9
9
|
|
|
10
10
|
import { TranslationsProvider, type TranslationsProviderProps } from './TranslationsProvider';
|
|
11
|
+
import { type SafeAreaPadding, useSafeArea } from '../../hooks';
|
|
11
12
|
import { hasIosKeyboard } from '../../util';
|
|
12
13
|
import { DensityProvider } from '../DensityProvider';
|
|
13
14
|
import { ElevationProvider } from '../ElevationProvider';
|
|
@@ -18,6 +19,7 @@ export type ThemeContextValue = {
|
|
|
18
19
|
tx: ThemeFunction<any>;
|
|
19
20
|
themeMode: ThemeMode;
|
|
20
21
|
hasIosKeyboard: boolean;
|
|
22
|
+
safeAreaPadding?: SafeAreaPadding;
|
|
21
23
|
noCache?: boolean;
|
|
22
24
|
};
|
|
23
25
|
|
|
@@ -27,7 +29,7 @@ export type ThemeContextValue = {
|
|
|
27
29
|
export const ThemeContext = createContext<ThemeContextValue | undefined>(undefined);
|
|
28
30
|
|
|
29
31
|
export type ThemeProviderProps = Omit<TranslationsProviderProps, 'children'> &
|
|
30
|
-
Partial<ThemeContextValue
|
|
32
|
+
Partial<Omit<ThemeContextValue, 'safeAreaPadding'>> &
|
|
31
33
|
PropsWithChildren<{
|
|
32
34
|
rootDensity?: Density;
|
|
33
35
|
rootElevation?: Elevation;
|
|
@@ -51,8 +53,15 @@ export const ThemeProvider = ({
|
|
|
51
53
|
}
|
|
52
54
|
}, []);
|
|
53
55
|
|
|
56
|
+
const safeAreaPadding = useSafeArea();
|
|
57
|
+
|
|
58
|
+
const contextValue = useMemo(
|
|
59
|
+
() => ({ tx, themeMode, hasIosKeyboard: hasIosKeyboard(), safeAreaPadding, ...rest }),
|
|
60
|
+
[tx, themeMode, safeAreaPadding, rest],
|
|
61
|
+
);
|
|
62
|
+
|
|
54
63
|
return (
|
|
55
|
-
<ThemeContext.Provider value={
|
|
64
|
+
<ThemeContext.Provider value={contextValue}>
|
|
56
65
|
<TranslationsProvider
|
|
57
66
|
{...{
|
|
58
67
|
fallback,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import type { ToggleGroupItemProps as ToggleGroupItemPrimitiveProps } from '@radix-ui/react-toggle-group';
|
|
5
6
|
import * as ToolbarPrimitive from '@radix-ui/react-toolbar';
|
|
6
7
|
import React, { forwardRef } from 'react';
|
|
7
8
|
|
|
@@ -15,6 +16,8 @@ import {
|
|
|
15
16
|
Toggle,
|
|
16
17
|
type ToggleGroupItemProps,
|
|
17
18
|
type ToggleProps,
|
|
19
|
+
IconButton,
|
|
20
|
+
type IconButtonProps,
|
|
18
21
|
} from '../Buttons';
|
|
19
22
|
import { Link, type LinkProps } from '../Link';
|
|
20
23
|
import { Separator, type SeparatorProps } from '../Separator';
|
|
@@ -40,6 +43,16 @@ const ToolbarButton = forwardRef<HTMLButtonElement, ToolbarButtonProps>((props,
|
|
|
40
43
|
);
|
|
41
44
|
});
|
|
42
45
|
|
|
46
|
+
type ToolbarIconButtonProps = IconButtonProps;
|
|
47
|
+
|
|
48
|
+
const ToolbarIconButton = forwardRef<HTMLButtonElement, ToolbarIconButtonProps>((props, forwardedRef) => {
|
|
49
|
+
return (
|
|
50
|
+
<ToolbarPrimitive.Button asChild>
|
|
51
|
+
<IconButton {...props} ref={forwardedRef} />
|
|
52
|
+
</ToolbarPrimitive.Button>
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
|
|
43
56
|
type ToolbarToggleProps = ToggleProps;
|
|
44
57
|
|
|
45
58
|
const ToolbarToggle = forwardRef<HTMLButtonElement, ToolbarToggleProps>((props, forwardedRef) => {
|
|
@@ -88,35 +101,52 @@ const ToolbarToggleGroupItem = forwardRef<HTMLButtonElement, ToolbarToggleGroupI
|
|
|
88
101
|
},
|
|
89
102
|
);
|
|
90
103
|
|
|
91
|
-
type
|
|
104
|
+
type ToolbarToggleGroupIconItemProps = Omit<ToggleGroupItemPrimitiveProps, 'className'> & IconButtonProps;
|
|
92
105
|
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
106
|
+
const ToolbarToggleGroupIconItem = forwardRef<HTMLButtonElement, ToolbarToggleGroupIconItemProps>(
|
|
107
|
+
({ variant, density, elevation, classNames, icon, label, iconOnly, ...props }, forwardedRef) => {
|
|
108
|
+
return (
|
|
109
|
+
<ToolbarPrimitive.ToolbarToggleItem {...props} asChild>
|
|
110
|
+
<IconButton {...{ variant, density, elevation, classNames, icon, label, iconOnly }} ref={forwardedRef} />
|
|
111
|
+
</ToolbarPrimitive.ToolbarToggleItem>
|
|
112
|
+
);
|
|
113
|
+
},
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
type ToolbarSeparatorProps = SeparatorProps & { variant?: 'gap' | 'line' };
|
|
100
117
|
|
|
101
|
-
const
|
|
118
|
+
const ToolbarSeparator = forwardRef<HTMLDivElement, ToolbarSeparatorProps>(
|
|
119
|
+
({ variant = 'line', ...props }, forwardedRef) => {
|
|
120
|
+
return variant === 'line' ? (
|
|
121
|
+
<ToolbarPrimitive.Separator asChild>
|
|
122
|
+
<Separator {...props} ref={forwardedRef} />
|
|
123
|
+
</ToolbarPrimitive.Separator>
|
|
124
|
+
) : (
|
|
125
|
+
<ToolbarPrimitive.Separator className='grow' ref={forwardedRef} />
|
|
126
|
+
);
|
|
127
|
+
},
|
|
128
|
+
);
|
|
102
129
|
|
|
103
130
|
export const Toolbar = {
|
|
104
131
|
Root: ToolbarRoot,
|
|
105
132
|
Button: ToolbarButton,
|
|
133
|
+
IconButton: ToolbarIconButton,
|
|
106
134
|
Link: ToolbarLink,
|
|
107
135
|
Toggle: ToolbarToggle,
|
|
108
136
|
ToggleGroup: ToolbarToggleGroup,
|
|
109
137
|
ToggleGroupItem: ToolbarToggleGroupItem,
|
|
138
|
+
ToggleGroupIconItem: ToolbarToggleGroupIconItem,
|
|
110
139
|
Separator: ToolbarSeparator,
|
|
111
|
-
Expander: ToolbarExpander,
|
|
112
140
|
};
|
|
113
141
|
|
|
114
142
|
export type {
|
|
115
143
|
ToolbarRootProps,
|
|
116
144
|
ToolbarButtonProps,
|
|
145
|
+
ToolbarIconButtonProps,
|
|
117
146
|
ToolbarLinkProps,
|
|
118
147
|
ToolbarToggleProps,
|
|
119
148
|
ToolbarToggleGroupProps,
|
|
120
149
|
ToolbarToggleGroupItemProps,
|
|
150
|
+
ToolbarToggleGroupIconItemProps,
|
|
121
151
|
ToolbarSeparatorProps,
|
|
122
152
|
};
|