tldraw 3.16.0-canary.a03de714c746 → 3.16.0-canary.a962044c3d3b
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-cjs/index.d.ts +26 -1
- package/dist-cjs/index.js +4 -1
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/ui/components/ActionsMenu/DefaultActionsMenu.js +2 -1
- package/dist-cjs/lib/ui/components/ActionsMenu/DefaultActionsMenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/DefaultMenuPanel.js +3 -2
- package/dist-cjs/lib/ui/components/DefaultMenuPanel.js.map +2 -2
- package/dist-cjs/lib/ui/components/NavigationPanel/DefaultNavigationPanel.js +1 -1
- package/dist-cjs/lib/ui/components/NavigationPanel/DefaultNavigationPanel.js.map +2 -2
- package/dist-cjs/lib/ui/components/PageMenu/DefaultPageMenu.js +2 -1
- package/dist-cjs/lib/ui/components/PageMenu/DefaultPageMenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/SharePanel/PeopleMenuItem.js +3 -2
- package/dist-cjs/lib/ui/components/SharePanel/PeopleMenuItem.js.map +2 -2
- package/dist-cjs/lib/ui/components/SharePanel/UserPresenceColorPicker.js +2 -2
- package/dist-cjs/lib/ui/components/SharePanel/UserPresenceColorPicker.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js +14 -14
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DoubleDropdownPicker.js +3 -3
- package/dist-cjs/lib/ui/components/StylePanel/DoubleDropdownPicker.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DropdownPicker.js +26 -25
- package/dist-cjs/lib/ui/components/StylePanel/DropdownPicker.js.map +3 -3
- package/dist-cjs/lib/ui/components/Toolbar/DefaultToolbar.js +6 -5
- package/dist-cjs/lib/ui/components/Toolbar/DefaultToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js +7 -8
- package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiButtonPicker.js +4 -15
- package/dist-cjs/lib/ui/components/primitives/TldrawUiButtonPicker.js.map +3 -3
- package/dist-cjs/lib/ui/components/primitives/TldrawUiContextualToolbar.js +1 -1
- package/dist-cjs/lib/ui/components/primitives/TldrawUiContextualToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiPopover.js +3 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiPopover.js.map +3 -3
- package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js +7 -4
- package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/layout.js +51 -0
- package/dist-cjs/lib/ui/components/primitives/layout.js.map +7 -0
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js +0 -1
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js.map +2 -2
- package/dist-cjs/lib/ui/version.js +3 -3
- package/dist-cjs/lib/ui/version.js.map +1 -1
- package/dist-esm/index.d.mts +26 -1
- package/dist-esm/index.mjs +7 -1
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/ui/components/ActionsMenu/DefaultActionsMenu.mjs +2 -1
- package/dist-esm/lib/ui/components/ActionsMenu/DefaultActionsMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/DefaultMenuPanel.mjs +3 -2
- package/dist-esm/lib/ui/components/DefaultMenuPanel.mjs.map +2 -2
- package/dist-esm/lib/ui/components/NavigationPanel/DefaultNavigationPanel.mjs +1 -1
- package/dist-esm/lib/ui/components/NavigationPanel/DefaultNavigationPanel.mjs.map +2 -2
- package/dist-esm/lib/ui/components/PageMenu/DefaultPageMenu.mjs +2 -1
- package/dist-esm/lib/ui/components/PageMenu/DefaultPageMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/SharePanel/PeopleMenuItem.mjs +3 -2
- package/dist-esm/lib/ui/components/SharePanel/PeopleMenuItem.mjs.map +2 -2
- package/dist-esm/lib/ui/components/SharePanel/UserPresenceColorPicker.mjs +2 -2
- package/dist-esm/lib/ui/components/SharePanel/UserPresenceColorPicker.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs +14 -14
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DoubleDropdownPicker.mjs +3 -3
- package/dist-esm/lib/ui/components/StylePanel/DoubleDropdownPicker.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DropdownPicker.mjs +26 -25
- package/dist-esm/lib/ui/components/StylePanel/DropdownPicker.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/DefaultToolbar.mjs +6 -5
- package/dist-esm/lib/ui/components/Toolbar/DefaultToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs +7 -8
- package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs +2 -2
- package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiButtonPicker.mjs +4 -5
- package/dist-esm/lib/ui/components/primitives/TldrawUiButtonPicker.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiContextualToolbar.mjs +1 -1
- package/dist-esm/lib/ui/components/primitives/TldrawUiContextualToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiPopover.mjs +3 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiPopover.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs +7 -4
- package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/layout.mjs +21 -0
- package/dist-esm/lib/ui/components/primitives/layout.mjs.map +7 -0
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs +0 -1
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs.map +2 -2
- package/dist-esm/lib/ui/version.mjs +3 -3
- package/dist-esm/lib/ui/version.mjs.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +5 -0
- package/src/lib/ui/components/ActionsMenu/DefaultActionsMenu.tsx +2 -1
- package/src/lib/ui/components/DefaultMenuPanel.tsx +4 -3
- package/src/lib/ui/components/NavigationPanel/DefaultNavigationPanel.tsx +1 -1
- package/src/lib/ui/components/PageMenu/DefaultPageMenu.tsx +3 -2
- package/src/lib/ui/components/SharePanel/PeopleMenuItem.tsx +4 -3
- package/src/lib/ui/components/SharePanel/UserPresenceColorPicker.tsx +3 -3
- package/src/lib/ui/components/StylePanel/DefaultStylePanelContent.tsx +39 -43
- package/src/lib/ui/components/StylePanel/DoubleDropdownPicker.tsx +3 -3
- package/src/lib/ui/components/StylePanel/DropdownPicker.tsx +7 -6
- package/src/lib/ui/components/Toolbar/DefaultToolbar.tsx +7 -6
- package/src/lib/ui/components/Toolbar/OverflowingToolbar.tsx +8 -9
- package/src/lib/ui/components/Toolbar/ToggleToolLockedButton.tsx +2 -2
- package/src/lib/ui/components/primitives/TldrawUiButtonPicker.tsx +38 -36
- package/src/lib/ui/components/primitives/TldrawUiContextualToolbar.tsx +1 -1
- package/src/lib/ui/components/primitives/TldrawUiPopover.tsx +4 -2
- package/src/lib/ui/components/primitives/TldrawUiToolbar.tsx +15 -9
- package/src/lib/ui/components/primitives/layout.tsx +33 -0
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuItem.tsx +0 -1
- package/src/lib/ui/version.ts +3 -3
- package/src/lib/ui.css +25 -70
- package/tldraw.css +25 -70
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
TldrawUiPopoverTrigger,
|
|
21
21
|
} from '../primitives/TldrawUiPopover'
|
|
22
22
|
import { TldrawUiToolbar, TldrawUiToolbarButton } from '../primitives/TldrawUiToolbar'
|
|
23
|
+
import { TldrawUiRow } from '../primitives/layout'
|
|
23
24
|
import { TldrawUiMenuContextProvider } from '../primitives/menus/TldrawUiMenuContext'
|
|
24
25
|
|
|
25
26
|
export const IsInOverflowContext = createContext(false)
|
|
@@ -67,9 +68,6 @@ export function OverflowingToolbar({ children }: OverflowingToolbarProps) {
|
|
|
67
68
|
#${id}_more > *:nth-of-type(-n + ${overflowIndex}):not([data-radix-popper-content-wrapper]) {
|
|
68
69
|
display: none;
|
|
69
70
|
}
|
|
70
|
-
#${id}_more > *:nth-of-type(-n + ${overflowIndex + 4}):not([data-radix-popper-content-wrapper]) {
|
|
71
|
-
margin-top: 0;
|
|
72
|
-
}
|
|
73
71
|
`
|
|
74
72
|
}, [lastActiveOverflowItem, id, overflowIndex])
|
|
75
73
|
|
|
@@ -158,16 +156,17 @@ export function OverflowingToolbar({ children }: OverflowingToolbarProps) {
|
|
|
158
156
|
<>
|
|
159
157
|
<style nonce={editor.options.nonce}>{css}</style>
|
|
160
158
|
<TldrawUiToolbar
|
|
161
|
-
|
|
162
|
-
|
|
159
|
+
orientation="horizontal"
|
|
160
|
+
className={classNames('tlui-main-toolbar__tools', {
|
|
161
|
+
'tlui-main-toolbar__tools__mobile': breakpoint < PORTRAIT_BREAKPOINT.TABLET_SM,
|
|
163
162
|
})}
|
|
164
163
|
label={msg('tool-panel.title')}
|
|
165
164
|
>
|
|
166
|
-
<
|
|
165
|
+
<TldrawUiRow id={`${id}_main`} ref={mainToolsRef}>
|
|
167
166
|
<TldrawUiMenuContextProvider type="toolbar" sourceId="toolbar">
|
|
168
167
|
{children}
|
|
169
168
|
</TldrawUiMenuContextProvider>
|
|
170
|
-
</
|
|
169
|
+
</TldrawUiRow>
|
|
171
170
|
{/* There is a +1 because if the menu is just one item, it's not necessary. */}
|
|
172
171
|
{totalItems > overflowIndex + 1 && (
|
|
173
172
|
<IsInOverflowContext.Provider value={true}>
|
|
@@ -176,7 +175,7 @@ export function OverflowingToolbar({ children }: OverflowingToolbarProps) {
|
|
|
176
175
|
<TldrawUiToolbarButton
|
|
177
176
|
title={msg('tool-panel.more')}
|
|
178
177
|
type="tool"
|
|
179
|
-
className="tlui-toolbar__overflow"
|
|
178
|
+
className="tlui-main-toolbar__overflow"
|
|
180
179
|
data-testid="tools.more-button"
|
|
181
180
|
>
|
|
182
181
|
<TldrawUiButtonIcon icon="chevron-up" />
|
|
@@ -184,7 +183,7 @@ export function OverflowingToolbar({ children }: OverflowingToolbarProps) {
|
|
|
184
183
|
</TldrawUiPopoverTrigger>
|
|
185
184
|
<TldrawUiPopoverContent side="top" align="center">
|
|
186
185
|
<TldrawUiToolbar
|
|
187
|
-
|
|
186
|
+
orientation="grid"
|
|
188
187
|
data-testid="tools.more-content"
|
|
189
188
|
label={msg('tool-panel.more')}
|
|
190
189
|
id={`${id}_more`}
|
|
@@ -31,8 +31,8 @@ export function ToggleToolLockedButton({ activeToolId }: ToggleToolLockedButtonP
|
|
|
31
31
|
type="normal"
|
|
32
32
|
title={msg('action.toggle-tool-lock')}
|
|
33
33
|
data-testid="tool-lock"
|
|
34
|
-
className={classNames('tlui-toolbar__lock-button', {
|
|
35
|
-
'tlui-toolbar__lock-button__mobile': breakpoint < PORTRAIT_BREAKPOINT.TABLET_SM,
|
|
34
|
+
className={classNames('tlui-main-toolbar__lock-button', {
|
|
35
|
+
'tlui-main-toolbar__lock-button__mobile': breakpoint < PORTRAIT_BREAKPOINT.TABLET_SM,
|
|
36
36
|
})}
|
|
37
37
|
onClick={() => editor.updateInstanceState({ isToolLocked: !isToolLocked })}
|
|
38
38
|
>
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
TLDefaultColorTheme,
|
|
7
7
|
useEditor,
|
|
8
8
|
} from '@tldraw/editor'
|
|
9
|
-
import classNames from 'classnames'
|
|
10
9
|
import { ReactElement, memo, useMemo, useRef } from 'react'
|
|
11
10
|
import { StyleValuesForUi } from '../../../styles'
|
|
12
11
|
import { PORTRAIT_BREAKPOINT } from '../../constants'
|
|
@@ -15,6 +14,7 @@ import { TLUiTranslationKey } from '../../hooks/useTranslation/TLUiTranslationKe
|
|
|
15
14
|
import { useTranslation } from '../../hooks/useTranslation/useTranslation'
|
|
16
15
|
import { TldrawUiButtonIcon } from './Button/TldrawUiButtonIcon'
|
|
17
16
|
import { TldrawUiToolbarToggleGroup, TldrawUiToolbarToggleItem } from './TldrawUiToolbar'
|
|
17
|
+
import { TldrawUiGrid, TldrawUiRow } from './layout'
|
|
18
18
|
|
|
19
19
|
/** @public */
|
|
20
20
|
export interface TLUiButtonPickerProps<T extends string> {
|
|
@@ -116,41 +116,43 @@ export const TldrawUiButtonPicker = memo(function TldrawUiButtonPicker<T extends
|
|
|
116
116
|
}
|
|
117
117
|
}, [editor, breakpoint, value, onHistoryMark, onValueChange, style])
|
|
118
118
|
|
|
119
|
+
const Wrapper = items.length > 4 ? TldrawUiGrid : TldrawUiRow
|
|
120
|
+
|
|
119
121
|
return (
|
|
120
|
-
<
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
)
|
|
153
|
-
|
|
154
|
-
</
|
|
122
|
+
<Wrapper asChild>
|
|
123
|
+
<TldrawUiToolbarToggleGroup
|
|
124
|
+
data-testid={`style.${uiType}`}
|
|
125
|
+
type="single"
|
|
126
|
+
value={value.type === 'shared' ? value.value : undefined}
|
|
127
|
+
>
|
|
128
|
+
{items.map((item) => {
|
|
129
|
+
const label = title + ' — ' + msg(`${uiType}-style.${item.value}` as TLUiTranslationKey)
|
|
130
|
+
return (
|
|
131
|
+
<TldrawUiToolbarToggleItem
|
|
132
|
+
type="icon"
|
|
133
|
+
key={item.value}
|
|
134
|
+
data-id={item.value}
|
|
135
|
+
data-testid={`style.${uiType}.${item.value}`}
|
|
136
|
+
aria-label={label}
|
|
137
|
+
value={item.value}
|
|
138
|
+
data-state={value.type === 'shared' && value.value === item.value ? 'on' : 'off'}
|
|
139
|
+
data-isactive={value.type === 'shared' && value.value === item.value}
|
|
140
|
+
title={label}
|
|
141
|
+
style={
|
|
142
|
+
style === (DefaultColorStyle as StyleProp<unknown>)
|
|
143
|
+
? { color: theme[item.value as TLDefaultColorStyle].solid }
|
|
144
|
+
: undefined
|
|
145
|
+
}
|
|
146
|
+
onPointerEnter={handleButtonPointerEnter}
|
|
147
|
+
onPointerDown={handleButtonPointerDown}
|
|
148
|
+
onPointerUp={handleButtonPointerUp}
|
|
149
|
+
onClick={handleButtonClick}
|
|
150
|
+
>
|
|
151
|
+
<TldrawUiButtonIcon icon={item.icon} />
|
|
152
|
+
</TldrawUiToolbarToggleItem>
|
|
153
|
+
)
|
|
154
|
+
})}
|
|
155
|
+
</TldrawUiToolbarToggleGroup>
|
|
156
|
+
</Wrapper>
|
|
155
157
|
)
|
|
156
158
|
}) as <T extends string>(props: TLUiButtonPickerProps<T>) => ReactElement
|
|
@@ -172,7 +172,7 @@ export const TldrawUiContextualToolbar = ({
|
|
|
172
172
|
className={classNames('tlui-contextual-toolbar', className)}
|
|
173
173
|
onPointerDown={stopEventPropagation}
|
|
174
174
|
>
|
|
175
|
-
<TldrawUiToolbar className="tlui-menu
|
|
175
|
+
<TldrawUiToolbar orientation="horizontal" className="tlui-menu" label={label}>
|
|
176
176
|
{children}
|
|
177
177
|
</TldrawUiToolbar>
|
|
178
178
|
</div>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useContainer } from '@tldraw/editor'
|
|
2
|
+
import classNames from 'classnames'
|
|
2
3
|
import { Popover as _Popover } from 'radix-ui'
|
|
3
4
|
import React from 'react'
|
|
4
5
|
import { useMenuIsOpen } from '../../hooks/useMenuIsOpen'
|
|
@@ -9,15 +10,16 @@ export interface TLUiPopoverProps {
|
|
|
9
10
|
open?: boolean
|
|
10
11
|
children: React.ReactNode
|
|
11
12
|
onOpenChange?(isOpen: boolean): void
|
|
13
|
+
className?: string
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
/** @public @react */
|
|
15
|
-
export function TldrawUiPopover({ id, children, onOpenChange, open }: TLUiPopoverProps) {
|
|
17
|
+
export function TldrawUiPopover({ id, children, onOpenChange, open, className }: TLUiPopoverProps) {
|
|
16
18
|
const [isOpen, handleOpenChange] = useMenuIsOpen(id, onOpenChange)
|
|
17
19
|
|
|
18
20
|
return (
|
|
19
21
|
<_Popover.Root onOpenChange={handleOpenChange} open={open || isOpen /* allow debugging */}>
|
|
20
|
-
<div className=
|
|
22
|
+
<div className={classNames('tlui-popover', className)}>{children}</div>
|
|
21
23
|
</_Popover.Root>
|
|
22
24
|
)
|
|
23
25
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import classnames from 'classnames'
|
|
2
2
|
import { Toolbar as _Toolbar } from 'radix-ui'
|
|
3
3
|
import React from 'react'
|
|
4
|
+
import { TldrawUiGrid, TldrawUiRow } from './layout'
|
|
4
5
|
import { TldrawUiTooltip } from './TldrawUiTooltip'
|
|
5
6
|
|
|
6
7
|
/** @public */
|
|
@@ -9,20 +10,25 @@ export interface TLUiToolbarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
9
10
|
className?: string
|
|
10
11
|
dir?: 'ltr' | 'rtl'
|
|
11
12
|
label: string
|
|
13
|
+
orientation?: 'horizontal' | 'grid'
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
/** @public @react */
|
|
15
17
|
export const TldrawUiToolbar = React.forwardRef<HTMLDivElement, TLUiToolbarProps>(
|
|
16
|
-
({ children, className, label, ...props }: TLUiToolbarProps, ref) => {
|
|
18
|
+
({ children, className, label, orientation = 'horizontal', ...props }: TLUiToolbarProps, ref) => {
|
|
19
|
+
const Layout = orientation === 'grid' ? TldrawUiGrid : TldrawUiRow
|
|
17
20
|
return (
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
<Layout asChild>
|
|
22
|
+
<_Toolbar.Root
|
|
23
|
+
ref={ref}
|
|
24
|
+
{...props}
|
|
25
|
+
className={classnames('tlui-toolbar', className)}
|
|
26
|
+
aria-label={label}
|
|
27
|
+
orientation={orientation === 'grid' ? 'horizontal' : orientation}
|
|
28
|
+
>
|
|
29
|
+
{children}
|
|
30
|
+
</_Toolbar.Root>
|
|
31
|
+
</Layout>
|
|
26
32
|
)
|
|
27
33
|
}
|
|
28
34
|
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import classNames from 'classnames'
|
|
2
|
+
import { Slot } from 'radix-ui'
|
|
3
|
+
import { HTMLAttributes, ReactNode, forwardRef } from 'react'
|
|
4
|
+
|
|
5
|
+
/** @public */
|
|
6
|
+
export interface TLUiLayoutProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
children: ReactNode
|
|
8
|
+
asChild?: boolean
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A row, usually of UI controls like buttons, select dropdown, checkboxes, etc.
|
|
13
|
+
*
|
|
14
|
+
* @public @react
|
|
15
|
+
*/
|
|
16
|
+
export const TldrawUiRow = forwardRef<HTMLDivElement, TLUiLayoutProps>(
|
|
17
|
+
({ asChild, className, ...props }, ref) => {
|
|
18
|
+
const Component = asChild ? Slot.Root : 'div'
|
|
19
|
+
return <Component ref={ref} className={classNames('tlui-row', className)} {...props} />
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A tight grid 4 elements wide, usually of UI controls like buttons, select dropdown, checkboxes,
|
|
25
|
+
* etc.
|
|
26
|
+
*
|
|
27
|
+
* @public @react */
|
|
28
|
+
export const TldrawUiGrid = forwardRef<HTMLDivElement, TLUiLayoutProps>(
|
|
29
|
+
({ asChild, className, ...props }, ref) => {
|
|
30
|
+
const Component = asChild ? Slot.Root : 'div'
|
|
31
|
+
return <Component ref={ref} className={classNames('tlui-grid', className)} {...props} />
|
|
32
|
+
}
|
|
33
|
+
)
|
|
@@ -232,7 +232,6 @@ export function TldrawUiMenuItem<
|
|
|
232
232
|
aria-label={labelStr}
|
|
233
233
|
aria-pressed={isSelected ? 'true' : 'false'}
|
|
234
234
|
isActive={isSelected}
|
|
235
|
-
className="tlui-button-grid__button"
|
|
236
235
|
data-testid={`tools.more.${id}`}
|
|
237
236
|
data-value={id}
|
|
238
237
|
disabled={disabled}
|
package/src/lib/ui/version.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// This file is automatically generated by internal/scripts/refresh-assets.ts.
|
|
2
2
|
// Do not edit manually. Or do, I'm a comment, not a cop.
|
|
3
3
|
|
|
4
|
-
export const version = '3.16.0-canary.
|
|
4
|
+
export const version = '3.16.0-canary.a962044c3d3b'
|
|
5
5
|
export const publishDates = {
|
|
6
6
|
major: '2024-09-13T14:36:29.063Z',
|
|
7
|
-
minor: '2025-08-
|
|
8
|
-
patch: '2025-08-
|
|
7
|
+
minor: '2025-08-08T12:11:20.287Z',
|
|
8
|
+
patch: '2025-08-08T12:11:20.287Z',
|
|
9
9
|
}
|
package/src/lib/ui.css
CHANGED
|
@@ -161,12 +161,6 @@
|
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
/* Panel button */
|
|
165
|
-
|
|
166
|
-
.tlui-button__panel {
|
|
167
|
-
position: relative;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
164
|
/* Menu button */
|
|
171
165
|
|
|
172
166
|
.tlui-button__menu {
|
|
@@ -207,7 +201,7 @@
|
|
|
207
201
|
|
|
208
202
|
/* Tool lock button */
|
|
209
203
|
|
|
210
|
-
.tlui-toolbar__lock-button {
|
|
204
|
+
.tlui-main-toolbar__lock-button {
|
|
211
205
|
position: absolute;
|
|
212
206
|
top: 4px;
|
|
213
207
|
right: 0px;
|
|
@@ -218,7 +212,7 @@
|
|
|
218
212
|
border-radius: var(--radius-2);
|
|
219
213
|
}
|
|
220
214
|
|
|
221
|
-
.tlui-toolbar__lock-button::after {
|
|
215
|
+
.tlui-main-toolbar__lock-button::after {
|
|
222
216
|
top: 4px;
|
|
223
217
|
left: 8px;
|
|
224
218
|
inset: 4px;
|
|
@@ -230,16 +224,6 @@
|
|
|
230
224
|
position: relative;
|
|
231
225
|
height: 48px;
|
|
232
226
|
width: 48px;
|
|
233
|
-
margin-left: -2px;
|
|
234
|
-
margin-right: -2px;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
.tlui-button__tool:nth-of-type(1) {
|
|
238
|
-
margin-left: 0px;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
.tlui-button__tool:nth-last-of-type(1) {
|
|
242
|
-
margin-right: 0px;
|
|
243
227
|
}
|
|
244
228
|
|
|
245
229
|
.tlui-button__tool::after {
|
|
@@ -270,47 +254,30 @@
|
|
|
270
254
|
width: 16px;
|
|
271
255
|
}
|
|
272
256
|
|
|
273
|
-
/*
|
|
257
|
+
/* Row layout */
|
|
274
258
|
|
|
275
|
-
.tlui-
|
|
259
|
+
.tlui-row {
|
|
276
260
|
display: flex;
|
|
277
261
|
flex-direction: row;
|
|
262
|
+
padding: 0 2px;
|
|
278
263
|
}
|
|
279
|
-
.tlui-
|
|
264
|
+
.tlui-row > * {
|
|
280
265
|
margin-left: -2px;
|
|
281
266
|
margin-right: -2px;
|
|
282
267
|
}
|
|
283
|
-
.tlui-buttons__horizontal > *:nth-child(1) {
|
|
284
|
-
margin-left: 0px;
|
|
285
|
-
}
|
|
286
|
-
.tlui-buttons__horizontal > *:nth-last-child(1) {
|
|
287
|
-
margin-right: 0px;
|
|
288
|
-
}
|
|
289
268
|
|
|
290
|
-
/*
|
|
269
|
+
/* Grid layout */
|
|
291
270
|
|
|
292
|
-
.tlui-
|
|
271
|
+
.tlui-grid {
|
|
293
272
|
display: grid;
|
|
294
|
-
grid-template-columns: repeat(4,
|
|
273
|
+
grid-template-columns: repeat(4, 1fr);
|
|
295
274
|
grid-auto-flow: row;
|
|
296
275
|
overflow: hidden;
|
|
276
|
+
padding: 2px;
|
|
297
277
|
}
|
|
298
|
-
.tlui-
|
|
278
|
+
.tlui-grid > * {
|
|
299
279
|
margin: -2px;
|
|
300
280
|
}
|
|
301
|
-
.tlui-buttons__grid > .tlui-button:nth-of-type(4n),
|
|
302
|
-
.tlui-buttons__vertical-align > .tlui-button:nth-of-type(3n) {
|
|
303
|
-
margin-right: 0px;
|
|
304
|
-
}
|
|
305
|
-
.tlui-buttons__grid > .tlui-button:nth-of-type(4n - 3) {
|
|
306
|
-
margin-left: 0px;
|
|
307
|
-
}
|
|
308
|
-
.tlui-buttons__grid > .tlui-button:nth-of-type(-n + 4) {
|
|
309
|
-
margin-top: 0px;
|
|
310
|
-
}
|
|
311
|
-
.tlui-buttons__grid > .tlui-button:nth-last-of-type(-n + 4) {
|
|
312
|
-
margin-bottom: 0px;
|
|
313
|
-
}
|
|
314
281
|
|
|
315
282
|
/* Zoom button */
|
|
316
283
|
|
|
@@ -1033,12 +1000,8 @@
|
|
|
1033
1000
|
border-bottom: 1px solid var(--color-divider);
|
|
1034
1001
|
}
|
|
1035
1002
|
|
|
1036
|
-
.tlui-style-
|
|
1037
|
-
|
|
1038
|
-
}
|
|
1039
|
-
/* Only really used for the alignment picker */
|
|
1040
|
-
.tlui-style-panel__row__extra-button {
|
|
1041
|
-
margin-left: -2px;
|
|
1003
|
+
.tlui-style-panel__dropdown-picker:only-child {
|
|
1004
|
+
width: 100%;
|
|
1042
1005
|
}
|
|
1043
1006
|
|
|
1044
1007
|
.tlui-style-panel__double-select-picker {
|
|
@@ -1154,7 +1117,7 @@
|
|
|
1154
1117
|
/* --------------------- Toolbar -------------------- */
|
|
1155
1118
|
|
|
1156
1119
|
/* Wide container */
|
|
1157
|
-
.tlui-toolbar {
|
|
1120
|
+
.tlui-main-toolbar {
|
|
1158
1121
|
grid-column: 1 / span 3;
|
|
1159
1122
|
grid-row: 1;
|
|
1160
1123
|
display: flex;
|
|
@@ -1165,7 +1128,7 @@
|
|
|
1165
1128
|
}
|
|
1166
1129
|
|
|
1167
1130
|
/* Centered Content */
|
|
1168
|
-
.tlui-toolbar__inner {
|
|
1131
|
+
.tlui-main-toolbar__inner {
|
|
1169
1132
|
position: relative;
|
|
1170
1133
|
width: fit-content;
|
|
1171
1134
|
display: flex;
|
|
@@ -1173,12 +1136,12 @@
|
|
|
1173
1136
|
align-items: flex-end;
|
|
1174
1137
|
}
|
|
1175
1138
|
|
|
1176
|
-
.tlui-toolbar__left {
|
|
1139
|
+
.tlui-main-toolbar__left {
|
|
1177
1140
|
width: fit-content;
|
|
1178
1141
|
}
|
|
1179
1142
|
|
|
1180
1143
|
/* Row of controls + lock button */
|
|
1181
|
-
.tlui-toolbar__extras {
|
|
1144
|
+
.tlui-main-toolbar__extras {
|
|
1182
1145
|
position: relative;
|
|
1183
1146
|
z-index: var(--layer-above);
|
|
1184
1147
|
width: 100%;
|
|
@@ -1187,11 +1150,11 @@
|
|
|
1187
1150
|
height: 48px;
|
|
1188
1151
|
}
|
|
1189
1152
|
|
|
1190
|
-
.tlui-toolbar__extras:empty {
|
|
1153
|
+
.tlui-main-toolbar__extras:empty {
|
|
1191
1154
|
display: none;
|
|
1192
1155
|
}
|
|
1193
1156
|
|
|
1194
|
-
.tlui-toolbar__extras__controls {
|
|
1157
|
+
.tlui-main-toolbar__extras__controls {
|
|
1195
1158
|
display: flex;
|
|
1196
1159
|
position: relative;
|
|
1197
1160
|
flex-direction: row;
|
|
@@ -1206,7 +1169,7 @@
|
|
|
1206
1169
|
width: fit-content;
|
|
1207
1170
|
}
|
|
1208
1171
|
|
|
1209
|
-
.tlui-toolbar__tools {
|
|
1172
|
+
.tlui-main-toolbar__tools {
|
|
1210
1173
|
display: flex;
|
|
1211
1174
|
flex-direction: row;
|
|
1212
1175
|
align-items: center;
|
|
@@ -1217,37 +1180,29 @@
|
|
|
1217
1180
|
background: var(--color-panel);
|
|
1218
1181
|
box-shadow: var(--shadow-2);
|
|
1219
1182
|
}
|
|
1220
|
-
.tlui-toolbar__tools__list {
|
|
1221
|
-
display: flex;
|
|
1222
|
-
flex-direction: row;
|
|
1223
|
-
align-items: center;
|
|
1224
|
-
}
|
|
1225
1183
|
|
|
1226
|
-
.tlui-toolbar__overflow {
|
|
1184
|
+
.tlui-main-toolbar__overflow {
|
|
1227
1185
|
width: 40px;
|
|
1186
|
+
margin-left: 2px;
|
|
1228
1187
|
}
|
|
1229
1188
|
|
|
1230
|
-
.tlui-layout__mobile .tlui-toolbar__overflow {
|
|
1189
|
+
.tlui-layout__mobile .tlui-main-toolbar__overflow {
|
|
1231
1190
|
width: 32px;
|
|
1232
1191
|
padding: 0px;
|
|
1233
1192
|
}
|
|
1234
1193
|
|
|
1235
|
-
.tlui-toolbar *[data-state='open']::after {
|
|
1194
|
+
.tlui-main-toolbar *[data-state='open']::after {
|
|
1236
1195
|
background: linear-gradient(0deg, rgba(144, 144, 144, 0) 0%, var(--color-muted-2) 100%);
|
|
1237
1196
|
opacity: 1;
|
|
1238
1197
|
}
|
|
1239
1198
|
|
|
1240
1199
|
@media (hover: hover) {
|
|
1241
|
-
.tlui-toolbar *[data-state='open']:not(:hover)::after {
|
|
1200
|
+
.tlui-main-toolbar *[data-state='open']:not(:hover)::after {
|
|
1242
1201
|
background: linear-gradient(0deg, rgba(144, 144, 144, 0) 0%, var(--color-muted-2) 100%);
|
|
1243
1202
|
opacity: 1;
|
|
1244
1203
|
}
|
|
1245
1204
|
}
|
|
1246
1205
|
|
|
1247
|
-
.tlui-layout__mobile .tlui-toolbar {
|
|
1248
|
-
transition: transform 0.15s ease-out 0.05s;
|
|
1249
|
-
}
|
|
1250
|
-
|
|
1251
1206
|
/* ------------------- Tooltip -------------------- */
|
|
1252
1207
|
|
|
1253
1208
|
.tlui-tooltip {
|