@moldable-ai/ui 0.2.26 → 0.2.31
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/catalog/component-catalog.d.ts +9 -2
- package/dist/catalog/component-catalog.d.ts.map +1 -1
- package/dist/catalog/component-catalog.js +11 -7
- package/dist/catalog/core-control-stories.d.ts.map +1 -1
- package/dist/catalog/core-control-stories.js +1 -1
- package/dist/catalog/core-foundation-stories.d.ts.map +1 -1
- package/dist/catalog/core-foundation-stories.js +15 -3
- package/dist/components/ui/app-frame.d.ts +20 -1
- package/dist/components/ui/app-frame.d.ts.map +1 -1
- package/dist/components/ui/app-frame.js +37 -7
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/badge.js +1 -1
- package/dist/components/ui/button.d.ts +5 -3
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +39 -10
- package/dist/components/ui/card.d.ts +12 -2
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/card.js +3 -2
- package/dist/components/ui/checkbox.d.ts +4 -1
- package/dist/components/ui/checkbox.d.ts.map +1 -1
- package/dist/components/ui/checkbox.js +4 -4
- package/dist/components/ui/context-menu.js +6 -6
- package/dist/components/ui/date-field.d.ts +1 -1
- package/dist/components/ui/dropdown-menu.js +6 -6
- package/dist/components/ui/icon-button.d.ts +1 -1
- package/dist/components/ui/icon-button.d.ts.map +1 -1
- package/dist/components/ui/icon-button.js +1 -0
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +1 -0
- package/dist/components/ui/input-group.d.ts +2 -2
- package/dist/components/ui/input.d.ts +6 -2
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/input.js +2 -2
- package/dist/components/ui/material.d.ts +8 -3
- package/dist/components/ui/material.d.ts.map +1 -1
- package/dist/components/ui/material.js +2 -2
- package/dist/components/ui/search-field.d.ts +3 -1
- package/dist/components/ui/search-field.d.ts.map +1 -1
- package/dist/components/ui/search-field.js +16 -6
- package/dist/components/ui/segmented-control.d.ts +3 -1
- package/dist/components/ui/segmented-control.d.ts.map +1 -1
- package/dist/components/ui/segmented-control.js +23 -17
- package/dist/components/ui/select.js +2 -2
- package/dist/components/ui/sidebar.d.ts +5 -3
- package/dist/components/ui/sidebar.d.ts.map +1 -1
- package/dist/components/ui/sidebar.js +53 -15
- package/dist/components/ui/status.d.ts +1 -1
- package/dist/components/ui/status.js +1 -1
- package/dist/components/ui/switch.d.ts +3 -1
- package/dist/components/ui/switch.d.ts.map +1 -1
- package/dist/components/ui/switch.js +3 -2
- package/dist/components/ui/toolbar-controls.d.ts +49 -0
- package/dist/components/ui/toolbar-controls.d.ts.map +1 -0
- package/dist/components/ui/toolbar-controls.js +47 -0
- package/dist/components/ui/toolbar.d.ts +5 -4
- package/dist/components/ui/toolbar.d.ts.map +1 -1
- package/dist/components/ui/toolbar.js +3 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/lib/frame-lifecycle.d.ts +1 -0
- package/dist/lib/frame-lifecycle.d.ts.map +1 -1
- package/dist/lib/frame-lifecycle.js +7 -0
- package/dist/lib/theme.d.ts +39 -5
- package/dist/lib/theme.d.ts.map +1 -1
- package/dist/lib/theme.js +105 -17
- package/dist/tokens/contracts.d.ts +79 -0
- package/dist/tokens/contracts.d.ts.map +1 -0
- package/dist/tokens/contracts.js +57 -0
- package/dist/tokens/index.d.ts +2 -0
- package/dist/tokens/index.d.ts.map +1 -0
- package/dist/tokens/index.js +1 -0
- package/docs/README.md +2 -0
- package/docs/adaptive-materials.md +14 -9
- package/docs/design-tokens.md +10 -6
- package/docs/foundations.md +3 -3
- package/docs/macos-design-audit.md +144 -0
- package/docs/native-integration.md +4 -4
- package/docs/platform-architecture.md +189 -0
- package/docs/standalone-app-windows.md +37 -0
- package/docs/visual-regression.md +6 -8
- package/package.json +13 -1
- package/src/components/ui/accordion.md +46 -0
- package/src/components/ui/alert.md +12 -4
- package/src/components/ui/app-frame.md +8 -5
- package/src/components/ui/aspect-ratio.md +37 -0
- package/src/components/ui/avatar.md +48 -0
- package/src/components/ui/breadcrumb.md +52 -0
- package/src/components/ui/button-group.md +43 -0
- package/src/components/ui/button.md +20 -4
- package/src/components/ui/calendar.md +42 -0
- package/src/components/ui/card.md +43 -0
- package/src/components/ui/carousel.md +47 -0
- package/src/components/ui/chart.md +52 -0
- package/src/components/ui/checkbox.md +36 -0
- package/src/components/ui/collapsible.md +2 -3
- package/src/components/ui/color-well.md +14 -4
- package/src/components/ui/combobox.md +3 -3
- package/src/components/ui/confirm-dialog.md +5 -4
- package/src/components/ui/context-menu.md +3 -2
- package/src/components/ui/date-field.md +6 -1
- package/src/components/ui/date-picker.md +6 -3
- package/src/components/ui/dialog.md +14 -12
- package/src/components/ui/drawer.md +58 -0
- package/src/components/ui/error-boundary-view.md +1 -1
- package/src/components/ui/field.md +2 -1
- package/src/components/ui/form.md +71 -0
- package/src/components/ui/grid.md +4 -3
- package/src/components/ui/icon-button.md +4 -1
- package/src/components/ui/input-group.md +49 -0
- package/src/components/ui/input-otp.md +56 -0
- package/src/components/ui/input.md +40 -0
- package/src/components/ui/inspector.md +47 -7
- package/src/components/ui/item.md +5 -3
- package/src/components/ui/kbd.md +30 -0
- package/src/components/ui/label.md +29 -0
- package/src/components/ui/list.md +2 -2
- package/src/components/ui/material.md +25 -12
- package/src/components/ui/menu-items.md +60 -0
- package/src/components/ui/menubar.md +58 -0
- package/src/components/ui/message-scroller-primitive.md +70 -0
- package/src/components/ui/message-scroller.md +86 -0
- package/src/components/ui/navigation-button-group.md +4 -3
- package/src/components/ui/navigation-menu.md +52 -0
- package/src/components/ui/number-input.md +8 -0
- package/src/components/ui/pagination.md +51 -0
- package/src/components/ui/panel.md +6 -0
- package/src/components/ui/popover.md +10 -7
- package/src/components/ui/progress.md +31 -0
- package/src/components/ui/radio-group.md +36 -0
- package/src/components/ui/resizable.md +2 -1
- package/src/components/ui/scroll-area.md +3 -1
- package/src/components/ui/search-field.md +6 -1
- package/src/components/ui/segmented-control.md +6 -1
- package/src/components/ui/separator.md +35 -0
- package/src/components/ui/sidebar.md +20 -3
- package/src/components/ui/skeleton.md +36 -0
- package/src/components/ui/slider.md +58 -0
- package/src/components/ui/spinner.md +41 -0
- package/src/components/ui/split-view.md +8 -4
- package/src/components/ui/switch.md +44 -0
- package/src/components/ui/table.md +7 -7
- package/src/components/ui/tabs.md +3 -1
- package/src/components/ui/textarea.md +41 -0
- package/src/components/ui/toggle-group.md +2 -2
- package/src/components/ui/toggle.md +9 -9
- package/src/components/ui/toolbar-controls.md +83 -0
- package/src/components/ui/toolbar.md +12 -6
- package/src/styles/index.css +199 -107
- package/src/tokens/contracts.ts +131 -0
- package/src/tokens/index.css +6 -0
- package/src/tokens/index.ts +23 -0
- package/src/tokens/macos-26/README.md +37 -0
- package/src/tokens/macos-26/aliases.css +53 -0
- package/src/tokens/macos-26/compatibility.css +7 -0
- package/src/tokens/macos-26/index.css +3 -0
- package/src/tokens/macos-26/source/provenance.generated.json +28 -0
- package/src/tokens/macos-26/source/sidebar.generated.css +29 -0
- package/src/tokens/macos-26/source.css +7 -0
- package/src/tokens/macos-26/web-adaptations.json +25 -0
- package/src/tokens/macos-26/web-adaptations.md +15 -0
- package/src/tokens/macos-27/accessibility.css +11 -0
- package/src/tokens/macos-27/aliases.css +304 -0
- package/src/tokens/macos-27/compatibility.css +212 -0
- package/src/tokens/macos-27/index.css +15 -0
- package/src/tokens/macos-27/recipes.css +23 -0
- package/src/tokens/macos-27/source/chrome.generated.css +338 -0
- package/src/tokens/macos-27/source/colors.generated.css +140 -0
- package/src/tokens/macos-27/source/context.generated.css +18 -0
- package/src/tokens/macos-27/source/controls.generated.css +764 -0
- package/src/tokens/macos-27/source/effects.generated.css +68 -0
- package/src/tokens/macos-27/source/kit.generated.css +50 -0
- package/src/tokens/macos-27/source/overlays-status.generated.css +931 -0
- package/src/tokens/macos-27/source/paint-styles.generated.css +81 -0
- package/src/tokens/macos-27/source/provenance.generated.json +62 -0
- package/src/tokens/macos-27/source/sizes.generated.css +385 -0
- package/src/tokens/macos-27/source/source.generated.json +554 -0
- package/src/tokens/macos-27/source/text-styles.generated.css +116 -0
- package/src/tokens/macos-27/source.css +17 -0
- package/src/tokens/macos-27/web-adaptations.css +98 -0
- package/src/tokens/macos-27/web-adaptations.json +163 -0
- package/src/tokens/macos-27/web-adaptations.md +117 -0
- package/src/tokens/moldable/brand.css +48 -0
- package/src/tokens/moldable/index.css +1 -0
- package/src/tokens/platform-contract.test.ts +290 -0
|
@@ -4,6 +4,7 @@ import { Slot } from '@radix-ui/react-slot';
|
|
|
4
4
|
import { PanelLeftIcon } from 'lucide-react';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { MOLDABLE_MATERIAL_REGION_MESSAGE_TYPE } from '../../lib/frame-lifecycle.js';
|
|
7
|
+
import { useOptionalTheme } from '../../lib/theme.js';
|
|
7
8
|
import { cn } from '../../lib/utils.js';
|
|
8
9
|
import { useIsMobile } from '../../hooks/use-mobile.js';
|
|
9
10
|
import { useAppFrameRuntime } from './app-frame.js';
|
|
@@ -16,7 +17,7 @@ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from './too
|
|
|
16
17
|
import { cva } from 'class-variance-authority';
|
|
17
18
|
const SIDEBAR_COOKIE_NAME = 'sidebar_state';
|
|
18
19
|
const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
19
|
-
const SIDEBAR_WIDTH = '16rem';
|
|
20
|
+
const SIDEBAR_WIDTH = 'var(--m-ui-sidebar-width, 16rem)';
|
|
20
21
|
const SIDEBAR_WIDTH_MOBILE = '18rem';
|
|
21
22
|
const SIDEBAR_WIDTH_ICON = '3rem';
|
|
22
23
|
const SIDEBAR_KEYBOARD_SHORTCUT = 'b';
|
|
@@ -41,6 +42,7 @@ function useSidebarMaterialRegion({ enabled, forwardedRef, }) {
|
|
|
41
42
|
}, [forwardedRef]);
|
|
42
43
|
const canDeclare = enabled &&
|
|
43
44
|
appFrame?.mode === 'window' &&
|
|
45
|
+
appFrame.sidebarMaterialEnabled === true &&
|
|
44
46
|
appFrame.sidebarMaterialAvailable === true;
|
|
45
47
|
React.useEffect(() => {
|
|
46
48
|
const element = elementRef.current;
|
|
@@ -158,32 +160,49 @@ function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: set
|
|
|
158
160
|
...style,
|
|
159
161
|
}, className: cn('group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full', className), ...props, children: children }) }) }));
|
|
160
162
|
}
|
|
161
|
-
function Sidebar({ side = 'left', variant = 'sidebar', collapsible = 'offcanvas', className, children, ref, ...props }) {
|
|
163
|
+
function Sidebar({ side = 'left', variant = 'sidebar', sidebarStyle, collapsible = 'offcanvas', className, children, ref, ...props }) {
|
|
164
|
+
const theme = useOptionalTheme();
|
|
165
|
+
const resolvedSidebarStyle = sidebarStyle ?? theme?.sidebarStyle ?? 'edge-to-edge';
|
|
166
|
+
const resolvedVariant = resolvedSidebarStyle === 'floating'
|
|
167
|
+
? 'floating'
|
|
168
|
+
: resolvedSidebarStyle === 'edge-to-edge'
|
|
169
|
+
? 'sidebar'
|
|
170
|
+
: variant;
|
|
162
171
|
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
163
172
|
const materialRegion = useSidebarMaterialRegion({
|
|
164
173
|
enabled: !isMobile &&
|
|
165
174
|
side === 'left' &&
|
|
166
|
-
|
|
175
|
+
resolvedVariant === 'sidebar' &&
|
|
167
176
|
!(state === 'collapsed' && collapsible === 'offcanvas'),
|
|
168
177
|
forwardedRef: ref,
|
|
169
178
|
});
|
|
170
179
|
if (collapsible === 'none') {
|
|
171
|
-
return (_jsx("div", { ref: materialRegion.setElement, "data-slot": "sidebar", "data-material-region-id": materialRegion.regionId, "data-native-material": materialRegion.active ? 'sidebar' : undefined, className: cn(materialRegion.active ? 'bg-transparent' : 'bg-sidebar', 'text-sidebar-foreground w-(--sidebar-width) flex flex-col self-stretch',
|
|
180
|
+
return (_jsx("div", { ref: materialRegion.setElement, "data-slot": "sidebar", "data-ui-sidebar-style": resolvedSidebarStyle, "data-material-region-id": materialRegion.regionId, "data-native-material": materialRegion.active ? 'sidebar' : undefined, className: cn(materialRegion.active ? 'bg-transparent' : 'bg-sidebar', 'text-sidebar-foreground w-(--sidebar-width) flex flex-col self-stretch', resolvedVariant === 'floating' &&
|
|
181
|
+
'border-[length:var(--m-ui-sidebar-border-width,0px)] [border-color:var(--m-ui-sidebar-border-color,var(--sidebar-border))]', className), ...props, children: children }));
|
|
172
182
|
}
|
|
173
183
|
if (isMobile) {
|
|
174
|
-
return (_jsx(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: _jsxs(SheetContent, { "data-sidebar": "sidebar", "data-slot": "sidebar", "data-mobile": "true", className: "bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden", style: {
|
|
184
|
+
return (_jsx(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: _jsxs(SheetContent, { "data-sidebar": "sidebar", "data-slot": "sidebar", "data-ui-sidebar-style": resolvedSidebarStyle, "data-mobile": "true", className: "bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden", style: {
|
|
175
185
|
'--sidebar-width': SIDEBAR_WIDTH_MOBILE,
|
|
176
186
|
}, side: side, children: [_jsxs(SheetHeader, { className: "sr-only", children: [_jsx(SheetTitle, { children: "Sidebar" }), _jsx(SheetDescription, { children: "Displays the mobile sidebar." })] }), _jsx("div", { className: "flex h-full w-full flex-col", children: children })] }) }));
|
|
177
187
|
}
|
|
178
|
-
return (_jsxs("div", { className: "text-sidebar-foreground group peer hidden md:block", "data-state": state, "data-collapsible": state === 'collapsed' ? collapsible : '', "data-variant":
|
|
188
|
+
return (_jsxs("div", { className: "text-sidebar-foreground group peer hidden md:block", "data-state": state, "data-collapsible": state === 'collapsed' ? collapsible : '', "data-variant": resolvedVariant, "data-side": side, "data-slot": "sidebar", "data-ui-sidebar-style": resolvedSidebarStyle, children: [_jsx("div", { "data-slot": "sidebar-gap", className: cn('w-(--sidebar-width) relative bg-transparent transition-[width] duration-200 ease-linear', 'group-data-[collapsible=offcanvas]:w-0', 'group-data-[side=right]:rotate-180', resolvedVariant === 'floating' || resolvedVariant === 'inset'
|
|
179
189
|
? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]'
|
|
180
190
|
: 'group-data-[collapsible=icon]:w-(--sidebar-width-icon)') }), _jsx("div", { ref: materialRegion.setElement, "data-slot": "sidebar-container", "data-material-region-id": materialRegion.regionId, "data-native-material": materialRegion.active ? 'sidebar' : undefined, className: cn('w-(--sidebar-width) fixed inset-y-0 z-10 hidden h-svh transition-[left,right,width] duration-200 ease-linear md:flex', side === 'left'
|
|
181
191
|
? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]'
|
|
182
192
|
: 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]',
|
|
183
193
|
// Adjust the padding for floating and inset variants.
|
|
184
|
-
|
|
185
|
-
? 'p-
|
|
186
|
-
: 'group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l', className), ...props, children: _jsx("div", { "data-sidebar": "sidebar", "data-slot": "sidebar-inner", className: cn(materialRegion.active ? 'bg-transparent' : 'bg-sidebar', '
|
|
194
|
+
resolvedVariant === 'floating' || resolvedVariant === 'inset'
|
|
195
|
+
? 'p-[var(--m-ui-sidebar-window-inset,0.5rem)] group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]'
|
|
196
|
+
: 'group-data-[collapsible=icon]:w-(--sidebar-width-icon) [border-color:var(--m-ui-sidebar-divider-color,var(--sidebar-border))] group-data-[side=left]:border-r-[length:var(--m-ui-sidebar-divider-width,1px)] group-data-[side=right]:border-l-[length:var(--m-ui-sidebar-divider-width,1px)]', className), ...props, children: _jsx("div", { "data-sidebar": "sidebar", "data-slot": "sidebar-inner", className: cn(materialRegion.active ? 'bg-transparent' : 'bg-sidebar', 'flex h-full w-full flex-col'), style: resolvedVariant === 'floating'
|
|
197
|
+
? {
|
|
198
|
+
borderRadius: 'var(--m-ui-sidebar-shell-radius, var(--shape-container))',
|
|
199
|
+
borderStyle: 'solid',
|
|
200
|
+
borderWidth: 'var(--m-ui-sidebar-border-width, 0px)',
|
|
201
|
+
borderColor: 'var(--m-ui-sidebar-border-color, var(--sidebar-border))',
|
|
202
|
+
boxShadow: 'var(--m-ui-sidebar-shadow, var(--material-shadow-sidebar))',
|
|
203
|
+
backdropFilter: 'blur(var(--m-ui-sidebar-glass-effect-radius, 0px))',
|
|
204
|
+
}
|
|
205
|
+
: undefined, children: children }) })] }));
|
|
187
206
|
}
|
|
188
207
|
function SidebarTrigger({ className, onClick, ...props }) {
|
|
189
208
|
const { toggleSidebar } = useSidebar();
|
|
@@ -217,9 +236,14 @@ function SidebarContent({ className, ...props }) {
|
|
|
217
236
|
function SidebarGroup({ className, ...props }) {
|
|
218
237
|
return (_jsx("div", { "data-slot": "sidebar-group", "data-sidebar": "group", className: cn('relative flex w-full min-w-0 flex-col p-2', className), ...props }));
|
|
219
238
|
}
|
|
220
|
-
function SidebarGroupLabel({ className, asChild = false, ...props }) {
|
|
239
|
+
function SidebarGroupLabel({ className, asChild = false, style, ...props }) {
|
|
221
240
|
const Comp = asChild ? Slot : 'div';
|
|
222
|
-
return (_jsx(Comp, { "data-slot": "sidebar-group-label", "data-sidebar": "group-label", className: cn('text-sidebar-foreground/70 ring-sidebar-ring outline-hidden
|
|
241
|
+
return (_jsx(Comp, { "data-slot": "sidebar-group-label", "data-sidebar": "group-label", className: cn('text-sidebar-foreground/70 ring-sidebar-ring outline-hidden text-ui-caption flex shrink-0 items-center font-medium transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-1 [&>svg]:size-4 [&>svg]:shrink-0', 'group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0', className), style: {
|
|
242
|
+
minHeight: 'var(--m-ui-sidebar-section-height-medium, 2rem)',
|
|
243
|
+
paddingInline: 'var(--m-ui-sidebar-row-inset-inline, 0.5rem)',
|
|
244
|
+
borderRadius: 'var(--m-ui-sidebar-item-radius, var(--shape-control))',
|
|
245
|
+
...style,
|
|
246
|
+
}, ...props }));
|
|
223
247
|
}
|
|
224
248
|
function SidebarGroupAction({ className, asChild = false, ...props }) {
|
|
225
249
|
const Comp = asChild ? Slot : 'button';
|
|
@@ -236,7 +260,7 @@ function SidebarMenu({ className, ...props }) {
|
|
|
236
260
|
function SidebarMenuItem({ className, ...props }) {
|
|
237
261
|
return (_jsx("li", { "data-slot": "sidebar-menu-item", "data-sidebar": "menu-item", className: cn('group/menu-item relative', className), ...props }));
|
|
238
262
|
}
|
|
239
|
-
const sidebarMenuButtonVariants = cva('peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-control p-2 text-left text-ui-body outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-1 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0', {
|
|
263
|
+
const sidebarMenuButtonVariants = cva('peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-control p-2 text-left text-ui-body outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-1 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[active=true]:[&>svg]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0', {
|
|
240
264
|
variants: {
|
|
241
265
|
variant: {
|
|
242
266
|
default: 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',
|
|
@@ -253,10 +277,24 @@ const sidebarMenuButtonVariants = cva('peer/menu-button flex w-full items-center
|
|
|
253
277
|
size: 'default',
|
|
254
278
|
},
|
|
255
279
|
});
|
|
256
|
-
function SidebarMenuButton({ asChild = false, isActive = false, variant = 'default', size = 'default', tooltip, className, ...props }) {
|
|
280
|
+
function SidebarMenuButton({ asChild = false, isActive = false, variant = 'default', size = 'default', tooltip, className, style, ...props }) {
|
|
257
281
|
const Comp = asChild ? Slot : 'button';
|
|
258
282
|
const { isMobile, state } = useSidebar();
|
|
259
|
-
const
|
|
283
|
+
const heightToken = size === 'sm'
|
|
284
|
+
? '--m-ui-sidebar-row-height-small'
|
|
285
|
+
: size === 'lg'
|
|
286
|
+
? '--m-ui-sidebar-row-height-large'
|
|
287
|
+
: '--m-ui-sidebar-row-height-medium';
|
|
288
|
+
const button = (_jsx(Comp, { "data-slot": "sidebar-menu-button", "data-sidebar": "menu-button", "data-size": size, "data-active": isActive, className: cn(sidebarMenuButtonVariants({ variant, size }), className), style: {
|
|
289
|
+
height: `var(${heightToken})`,
|
|
290
|
+
minHeight: `var(${heightToken})`,
|
|
291
|
+
paddingBlock: 0,
|
|
292
|
+
paddingInline: 'var(--m-ui-sidebar-row-inset-inline, 0.5rem)',
|
|
293
|
+
borderRadius: isActive
|
|
294
|
+
? 'var(--m-ui-sidebar-selection-radius, var(--shape-control))'
|
|
295
|
+
: 'var(--m-ui-sidebar-item-radius, var(--shape-control))',
|
|
296
|
+
...style,
|
|
297
|
+
}, ...props }));
|
|
260
298
|
if (!tooltip) {
|
|
261
299
|
return button;
|
|
262
300
|
}
|
|
@@ -294,6 +332,6 @@ function SidebarMenuSubItem({ className, ...props }) {
|
|
|
294
332
|
}
|
|
295
333
|
function SidebarMenuSubButton({ asChild = false, size = 'md', isActive = false, className, ...props }) {
|
|
296
334
|
const Comp = asChild ? Slot : 'a';
|
|
297
|
-
return (_jsx(Comp, { "data-slot": "sidebar-menu-sub-button", "data-sidebar": "menu-sub-button", "data-size": size, "data-active": isActive, className: cn('text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground
|
|
335
|
+
return (_jsx(Comp, { "data-slot": "sidebar-menu-sub-button", "data-sidebar": "menu-sub-button", "data-size": size, "data-active": isActive, className: cn('text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground outline-hidden rounded-control data-[active=true]:[&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden px-2 focus-visible:ring-1 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0', 'data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground', size === 'sm' && 'text-ui-caption', size === 'md' && 'text-ui-body', 'group-data-[collapsible=icon]:hidden', className), ...props }));
|
|
298
336
|
}
|
|
299
337
|
export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar, };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type VariantProps } from 'class-variance-authority';
|
|
3
3
|
declare const statusVariants: (props?: ({
|
|
4
|
-
variant?: "
|
|
4
|
+
variant?: "neutral" | "info" | "success" | "warning" | "error" | "running" | "pending" | null | undefined;
|
|
5
5
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
6
|
export interface StatusProps extends React.ComponentProps<'span'>, VariantProps<typeof statusVariants> {
|
|
7
7
|
asChild?: boolean;
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { Slot } from '@radix-ui/react-slot';
|
|
4
4
|
import { cn } from '../../lib/utils.js';
|
|
5
5
|
import { cva } from 'class-variance-authority';
|
|
6
|
-
const statusVariants = cva('
|
|
6
|
+
const statusVariants = cva('inline-flex min-w-0 items-center gap-1.5 [font-size:var(--type-caption-size,10px)] font-medium [line-height:var(--type-caption-line-height,13px)]', {
|
|
7
7
|
variants: {
|
|
8
8
|
variant: {
|
|
9
9
|
info: 'text-info-foreground [&_[data-slot=status-indicator]]:bg-info',
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
|
|
3
|
+
import type { ControlSize } from '../../tokens/contracts.js';
|
|
4
|
+
declare function Switch({ className, controlSize, size, ...props }: React.ComponentProps<typeof SwitchPrimitive.Root> & {
|
|
4
5
|
size?: 'sm' | 'default';
|
|
6
|
+
controlSize?: ControlSize;
|
|
5
7
|
}): import("react/jsx-runtime").JSX.Element;
|
|
6
8
|
export { Switch };
|
|
7
9
|
//# sourceMappingURL=switch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../src/components/ui/switch.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AACzD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../src/components/ui/switch.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AACzD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEzD,iBAAS,MAAM,CAAC,EACd,SAAS,EACT,WAAW,EACX,IAAgB,EAChB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,GAAG;IACrD,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,CAAA;IACvB,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B,2CAuBA;AAED,OAAO,EAAE,MAAM,EAAE,CAAA"}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
4
4
|
import { cn } from '../../lib/utils.js';
|
|
5
|
-
function Switch({ className, size = 'default', ...props }) {
|
|
6
|
-
|
|
5
|
+
function Switch({ className, controlSize, size = 'default', ...props }) {
|
|
6
|
+
const resolvedControlSize = controlSize ?? (size === 'sm' ? 'small' : 'medium');
|
|
7
|
+
return (_jsx(SwitchPrimitive.Root, { "data-slot": "switch", "data-size": size, "data-control-size": resolvedControlSize, className: cn('focus-visible:border-ring focus-visible:ring-ring group/switch rounded-pill bg-[var(--m-ui-color-text-primary)]/10 active:bg-[var(--m-ui-color-text-primary)]/20 peer relative inline-flex h-[var(--m-ui-switch-track-height)] w-[var(--m-ui-switch-track-width)] shrink-0 cursor-pointer items-center border border-transparent p-0.5 outline-none transition-[background-color,box-shadow] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-[0.06] data-[state=checked]:bg-[var(--m-ui-color-accent)]', className), ...props, children: _jsx(SwitchPrimitive.Thumb, { "data-slot": "switch-thumb", className: cn('border-separator-strong shadow-xs rounded-pill pointer-events-none relative z-10 block h-[var(--m-ui-switch-knob-height)] w-[var(--m-ui-switch-knob-width)] border bg-white ring-0 transition-[width,transform] data-[state=checked]:translate-x-[calc(var(--m-ui-switch-track-width)-var(--m-ui-switch-knob-width)-4px)] data-[state=unchecked]:translate-x-0') }) }));
|
|
7
8
|
}
|
|
8
9
|
export { Switch };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { MenuItems } from '../../lib/host-native-menu.js';
|
|
3
|
+
import { Button } from './button.js';
|
|
4
|
+
import { type IconButtonProps, type IconButtonSize } from './icon-button.js';
|
|
5
|
+
import { Separator } from './separator.js';
|
|
6
|
+
type ToolbarControlAppearance = 'chrome' | 'quiet';
|
|
7
|
+
type ToolbarControlSize = 'medium' | 'xl';
|
|
8
|
+
export interface ToolbarButtonProps extends React.ComponentProps<typeof Button> {
|
|
9
|
+
/**
|
|
10
|
+
* `chrome` uses the raised translucent toolbar surface. `quiet` is useful
|
|
11
|
+
* inside a ToolbarControlGroup, which owns the shared surface.
|
|
12
|
+
*/
|
|
13
|
+
appearance?: ToolbarControlAppearance;
|
|
14
|
+
}
|
|
15
|
+
declare function ToolbarButton({ appearance, className, size, variant, ...props }: ToolbarButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export interface ToolbarIconButtonProps extends Omit<IconButtonProps, 'size'> {
|
|
17
|
+
appearance?: ToolbarControlAppearance;
|
|
18
|
+
size?: IconButtonSize;
|
|
19
|
+
}
|
|
20
|
+
declare function ToolbarIconButton({ appearance, className, size, variant, ...props }: ToolbarIconButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export interface ToolbarControlGroupProps extends React.ComponentProps<'div'> {
|
|
22
|
+
appearance?: ToolbarControlAppearance;
|
|
23
|
+
size?: ToolbarControlSize;
|
|
24
|
+
}
|
|
25
|
+
declare function ToolbarControlGroup({ appearance, className, size, ...props }: ToolbarControlGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
declare function ToolbarControlSeparator({ className, ...props }: React.ComponentProps<typeof Separator>): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export interface ToolbarBackButtonProps extends Omit<ToolbarIconButtonProps, 'children' | 'label'> {
|
|
28
|
+
label?: string;
|
|
29
|
+
}
|
|
30
|
+
declare function ToolbarBackButton({ label, tooltip, ...props }: ToolbarBackButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export interface ToolbarSidebarToggleProps extends Omit<ToolbarIconButtonProps, 'aria-pressed' | 'children' | 'label' | 'onClick'> {
|
|
32
|
+
expanded: boolean;
|
|
33
|
+
onExpandedChange: (expanded: boolean) => void;
|
|
34
|
+
showLabel?: string;
|
|
35
|
+
hideLabel?: string;
|
|
36
|
+
}
|
|
37
|
+
declare function ToolbarSidebarToggle({ expanded, hideLabel, onExpandedChange, showLabel, tooltip, ...props }: ToolbarSidebarToggleProps): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export interface ToolbarOverflowMenuProps extends Omit<ToolbarIconButtonProps, 'children' | 'label' | 'onClick'> {
|
|
39
|
+
items: MenuItems[];
|
|
40
|
+
label?: string;
|
|
41
|
+
onSelectItem?: (id: string) => void;
|
|
42
|
+
}
|
|
43
|
+
declare function ToolbarOverflowMenu({ items, label, onSelectItem, tooltip, ...props }: ToolbarOverflowMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
export interface ToolbarTitleFieldProps extends Omit<React.ComponentProps<'input'>, 'size'> {
|
|
45
|
+
label?: string;
|
|
46
|
+
}
|
|
47
|
+
declare function ToolbarTitleField({ 'aria-label': ariaLabel, className, label, type, ...props }: ToolbarTitleFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
export { ToolbarBackButton, ToolbarButton, ToolbarControlGroup, ToolbarControlSeparator, ToolbarIconButton, ToolbarOverflowMenu, ToolbarSidebarToggle, ToolbarTitleField, };
|
|
49
|
+
//# sourceMappingURL=toolbar-controls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbar-controls.d.ts","sourceRoot":"","sources":["../../../src/components/ui/toolbar-controls.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAE3D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,KAAK,wBAAwB,GAAG,QAAQ,GAAG,OAAO,CAAA;AAClD,KAAK,kBAAkB,GAAG,QAAQ,GAAG,IAAI,CAAA;AAUzC,MAAM,WAAW,kBACf,SAAQ,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC;IAC3C;;;OAGG;IACH,UAAU,CAAC,EAAE,wBAAwB,CAAA;CACtC;AAED,iBAAS,aAAa,CAAC,EACrB,UAAqB,EACrB,SAAS,EACT,IAAI,EACJ,OAAO,EACP,GAAG,KAAK,EACT,EAAE,kBAAkB,2CAwBpB;AAED,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC;IAC3E,UAAU,CAAC,EAAE,wBAAwB,CAAA;IACrC,IAAI,CAAC,EAAE,cAAc,CAAA;CACtB;AAED,iBAAS,iBAAiB,CAAC,EACzB,UAAqB,EACrB,SAAS,EACT,IAAI,E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A;IACd,YAAY,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;CACpC;AAED,iBAAS,mBAAmB,CAAC,EAC3B,KAAK,EACL,KAAsB,EACtB,YAAY,EACZ,OAAc,EACd,GAAG,KAAK,EACT,EAAE,wBAAwB,2CAU1B;AAED,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IACnD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,iBAAS,iBAAiB,CAAC,EACzB,YAAY,EAAE,SAAS,EACvB,SAAS,EACT,KAAwB,EACxB,IAAa,EACb,GAAG,KAAK,EACT,EAAE,sBAAsB,2CAaxB;AAED,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,mBAAmB,EACnB,uBAAuB,EACvB,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,GAClB,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { ChevronLeftIcon, EllipsisIcon, PanelLeftIcon } from 'lucide-react';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { cn } from '../../lib/utils.js';
|
|
6
|
+
import { Button } from './button.js';
|
|
7
|
+
import { DropdownMenu, DropdownMenuTrigger } from './dropdown-menu.js';
|
|
8
|
+
import { IconButton, } from './icon-button.js';
|
|
9
|
+
import { Separator } from './separator.js';
|
|
10
|
+
const ToolbarControlGroupContext = React.createContext(null);
|
|
11
|
+
function ToolbarButton({ appearance = 'chrome', className, size, variant, ...props }) {
|
|
12
|
+
const group = React.useContext(ToolbarControlGroupContext);
|
|
13
|
+
const groupedSize = group?.size === 'xl' ? 'lg' : 'sm';
|
|
14
|
+
const emphasis = variant === 'prominent' ? 'primary' : 'standard';
|
|
15
|
+
const resolvedVariant = variant === 'prominent'
|
|
16
|
+
? 'toolbar'
|
|
17
|
+
: (variant ?? (group || appearance === 'quiet' ? 'ghost' : 'toolbar'));
|
|
18
|
+
return (_jsx(Button, { "data-slot": "toolbar-button", "data-emphasis": emphasis, size: size ?? (group ? groupedSize : 'xl'), variant: resolvedVariant, className: cn('rounded-pill gap-[var(--m-ui-toolbar-action-gap,var(--density-control-gap))] px-[var(--m-ui-toolbar-action-padding-inline,var(--density-control-padding-inline))] [&_svg:not([class*="size-"])]:size-[var(--m-ui-toolbar-action-icon-size,13px)]', emphasis === 'primary' && 'font-semibold', group && 'shadow-none', className), ...props }));
|
|
19
|
+
}
|
|
20
|
+
function ToolbarIconButton({ appearance = 'chrome', className, size, variant, ...props }) {
|
|
21
|
+
const group = React.useContext(ToolbarControlGroupContext);
|
|
22
|
+
const groupedSize = group?.size === 'xl' ? 'lg' : 'sm';
|
|
23
|
+
return (_jsx(IconButton, { "data-slot": "toolbar-icon-button", size: size ?? (group ? groupedSize : 'xl'), variant: variant ?? (group || appearance === 'quiet' ? 'ghost' : 'toolbar'), shape: "circle", className: cn(group && 'shadow-none', className), ...props }));
|
|
24
|
+
}
|
|
25
|
+
function ToolbarControlGroup({ appearance = 'chrome', className, size = 'xl', ...props }) {
|
|
26
|
+
return (_jsx(ToolbarControlGroupContext.Provider, { value: { grouped: true, size }, children: _jsx("div", { role: "group", "data-slot": "toolbar-control-group", "data-appearance": appearance, "data-size": size, className: cn('rounded-pill flex shrink-0 items-center', size === 'medium' ? 'h-control-md' : 'h-control-xl', appearance === 'chrome'
|
|
27
|
+
? cn('border border-[var(--toolbar-control-border)] bg-[var(--toolbar-control-background)] shadow-[var(--toolbar-control-shadow)]', size === 'medium' ? 'gap-1 p-0.5' : 'gap-1 p-1')
|
|
28
|
+
: 'gap-1.5', className), ...props }) }));
|
|
29
|
+
}
|
|
30
|
+
function ToolbarControlSeparator({ className, ...props }) {
|
|
31
|
+
const group = React.useContext(ToolbarControlGroupContext);
|
|
32
|
+
return (_jsx(Separator, { "data-slot": "toolbar-control-separator", orientation: "vertical", className: cn('mx-0.5 self-center bg-[var(--toolbar-control-border)]', group?.size === 'xl' ? 'h-5' : 'h-4', className), ...props }));
|
|
33
|
+
}
|
|
34
|
+
function ToolbarBackButton({ label = 'Back', tooltip = true, ...props }) {
|
|
35
|
+
return (_jsx(ToolbarIconButton, { label: label, tooltip: tooltip, ...props, children: _jsx(ChevronLeftIcon, {}) }));
|
|
36
|
+
}
|
|
37
|
+
function ToolbarSidebarToggle({ expanded, hideLabel = 'Hide sidebar', onExpandedChange, showLabel = 'Show sidebar', tooltip = true, ...props }) {
|
|
38
|
+
const label = expanded ? hideLabel : showLabel;
|
|
39
|
+
return (_jsx(ToolbarIconButton, { "aria-pressed": expanded, "data-state": expanded ? 'on' : 'off', label: label, tooltip: tooltip, onClick: () => onExpandedChange(!expanded), ...props, children: _jsx(PanelLeftIcon, {}) }));
|
|
40
|
+
}
|
|
41
|
+
function ToolbarOverflowMenu({ items, label = 'More actions', onSelectItem, tooltip = true, ...props }) {
|
|
42
|
+
return (_jsx(DropdownMenu, { items: items, onSelectItem: onSelectItem, children: _jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(ToolbarIconButton, { label: label, tooltip: tooltip, ...props, children: _jsx(EllipsisIcon, {}) }) }) }));
|
|
43
|
+
}
|
|
44
|
+
function ToolbarTitleField({ 'aria-label': ariaLabel, className, label = 'Document title', type = 'text', ...props }) {
|
|
45
|
+
return (_jsx("input", { "data-slot": "toolbar-title-field", "aria-label": ariaLabel ?? label, type: type, className: cn('text-foreground hover:bg-control-hover focus:bg-control-hover focus-visible:ring-ring h-control-md rounded-control min-w-0 max-w-[min(24rem,32vw)] bg-transparent px-2 text-[13px] font-bold outline-none transition-colors focus-visible:ring-1', className), ...props }));
|
|
46
|
+
}
|
|
47
|
+
export { ToolbarBackButton, ToolbarButton, ToolbarControlGroup, ToolbarControlSeparator, ToolbarIconButton, ToolbarOverflowMenu, ToolbarSidebarToggle, ToolbarTitleField, };
|
|
@@ -4,18 +4,19 @@ import { Separator } from './separator.js';
|
|
|
4
4
|
import { Text } from './text.js';
|
|
5
5
|
import { type VariantProps } from 'class-variance-authority';
|
|
6
6
|
export type ToolbarInset = 'auto' | 'none' | 'windowControls' | 'windowControlsAndButton';
|
|
7
|
+
type ToolbarMaterialVariant = Extract<MaterialVariant, 'regular' | 'clear'>;
|
|
7
8
|
declare const toolbarVariants: (props?: ({
|
|
8
|
-
variant?: "
|
|
9
|
-
material?: "regular" | "
|
|
9
|
+
variant?: "default" | "panel" | "plain" | null | undefined;
|
|
10
|
+
material?: "regular" | "none" | "clear" | null | undefined;
|
|
10
11
|
density?: "compact" | "default" | "comfortable" | null | undefined;
|
|
11
|
-
position?: "
|
|
12
|
+
position?: "top" | "bottom" | "static" | null | undefined;
|
|
12
13
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
13
14
|
export interface ToolbarProps extends React.ComponentProps<'header'>, VariantProps<typeof toolbarVariants> {
|
|
14
15
|
/**
|
|
15
16
|
* Defaults to regular material for the default toolbar and no material for
|
|
16
17
|
* plain or panel variants.
|
|
17
18
|
*/
|
|
18
|
-
material?:
|
|
19
|
+
material?: ToolbarMaterialVariant | 'none';
|
|
19
20
|
/**
|
|
20
21
|
* Clearance for native window controls. `auto` applies the host-advertised
|
|
21
22
|
* inset only when this is a top toolbar in an app-owned window.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolbar.d.ts","sourceRoot":"","sources":["../../../src/components/ui/toolbar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"toolbar.d.ts","sourceRoot":"","sources":["../../../src/components/ui/toolbar.tsx"],"names":[],"mappings":"AAEA,OAAO,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BAAS,kBAAkB,CAAC,EAC1B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,2CAYnC;AAED,iBAAS,cAAc,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAQ3E;AAED,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,2CASxC;AAED,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,eAAe,GAChB,CAAA"}
|
|
@@ -3,8 +3,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { cn } from '../../lib/utils.js';
|
|
4
4
|
import { Separator } from './separator.js';
|
|
5
5
|
import { Text } from './text.js';
|
|
6
|
-
import { cva } from 'class-variance-authority';
|
|
7
6
|
import { handleWindowTitlebarDoubleClick, handleWindowTitlebarMouseDown, } from './window-titlebar.js';
|
|
7
|
+
import { cva } from 'class-variance-authority';
|
|
8
8
|
const toolbarVariants = cva('z-20 flex min-h-toolbar w-full shrink-0 items-center gap-control-gap px-control-inline', {
|
|
9
9
|
variants: {
|
|
10
10
|
variant: {
|
|
@@ -18,7 +18,7 @@ const toolbarVariants = cva('z-20 flex min-h-toolbar w-full shrink-0 items-cente
|
|
|
18
18
|
none: '',
|
|
19
19
|
},
|
|
20
20
|
density: {
|
|
21
|
-
compact: 'py-
|
|
21
|
+
compact: 'py-2',
|
|
22
22
|
default: 'py-1.5',
|
|
23
23
|
comfortable: 'py-2',
|
|
24
24
|
},
|
|
@@ -68,7 +68,7 @@ function ToolbarContent({ className, ...props }) {
|
|
|
68
68
|
return (_jsx("div", { "data-slot": "toolbar-content", className: cn('flex min-w-0 flex-1 flex-col', className), ...props }));
|
|
69
69
|
}
|
|
70
70
|
function ToolbarTitle({ className, ...props }) {
|
|
71
|
-
return (_jsx(Text, { as: "h2", variant: "strong", truncate: true, "data-slot": "toolbar-title", className: cn('text-[
|
|
71
|
+
return (_jsx(Text, { as: "h2", variant: "strong", truncate: true, "data-slot": "toolbar-title", className: cn('text-[13px] font-bold leading-[15px]', className), ...props }));
|
|
72
72
|
}
|
|
73
73
|
function ToolbarDescription({ className, ...props }) {
|
|
74
74
|
return (_jsx(Text, { as: "p", variant: "small", color: "secondary", truncate: true, "data-slot": "toolbar-description", className: className, ...props }));
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { cn } from './lib/utils.js';
|
|
2
|
-
export { ThemeProvider, useTheme, themeScript, type Theme } from './lib/theme.js';
|
|
2
|
+
export { ThemeProvider, useTheme, themeScript, type Theme, type ThemeProviderProps, } from './lib/theme.js';
|
|
3
|
+
export * from './tokens/index.js';
|
|
3
4
|
export { WorkspaceProvider, useWorkspace, WORKSPACE_HEADER, } from './lib/workspace.js';
|
|
4
5
|
export { useMoldableCommands, useMoldableCommand, useMoldableAppCommands, useMoldableWindowShortcuts, useMoldableNavigationPop, useMoldableNavigationState, isInMoldable, sendToMoldable, pushMoldableNavigation, popMoldableNavigation, resetMoldableNavigation, downloadFile, publishMoldableArtifact, setMoldableWindowFullscreen, type AppCommand, type CommandAction, type CommandsResponse, type CommandMessage, type MoldableNavigationEntry, type MoldableNavigationPopMessage, type MoldableNavigationStateMessage, type MoldableWindowShortcut, type MoldableWindowShortcutDefaults, type DownloadFileOptions, type MoldableArtifactFile, type MoldableArtifactPublishOptions, type MoldableArtifactPublishResult, type MoldableWindowFullscreenMode, type MoldableWindowFullscreenOptions, type MoldableWindowFullscreenResult, type MoldableWindowFullscreenMessage, type MoldableWindowFullscreenResultMessage, } from './lib/commands.js';
|
|
5
6
|
export * from './lib/native-capabilities/index.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAGhC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAGhC,OAAO,EACL,aAAa,EACb,QAAQ,EACR,WAAW,EACX,KAAK,KAAK,EACV,KAAK,kBAAkB,GACxB,MAAM,aAAa,CAAA;AAGpB,cAAc,UAAU,CAAA;AAGxB,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,GACjB,MAAM,iBAAiB,CAAA;AAGxB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC1B,wBAAwB,EACxB,0BAA0B,EAC1B,YAAY,EACZ,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,YAAY,EACZ,uBAAuB,EACvB,2BAA2B,EAC3B,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,EACjC,KAAK,8BAA8B,EACnC,KAAK,sBAAsB,EAC3B,KAAK,8BAA8B,EACnC,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,8BAA8B,EACnC,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EACjC,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EACnC,KAAK,+BAA+B,EACpC,KAAK,qCAAqC,GAC3C,MAAM,gBAAgB,CAAA;AAGvB,cAAc,2BAA2B,CAAA;AAGzC,cAAc,iBAAiB,CAAA;AAG/B,cAAc,kCAAkC,CAAA;AAGhD,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,YA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kBAAkB,GACxB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,6BAA6B,EAClC,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,GAC9B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,6BAA6B,EAClC,KAAK,kCAAkC,GACxC,MAAM,wBAAwB,CAAA;AAG/B,cAAc,mBAAmB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// Export utilities
|
|
2
2
|
export { cn } from './lib/utils.js';
|
|
3
3
|
// Export theme
|
|
4
|
-
export { ThemeProvider, useTheme, themeScript } from './lib/theme.js';
|
|
4
|
+
export { ThemeProvider, useTheme, themeScript, } from './lib/theme.js';
|
|
5
|
+
// Export design-system contracts
|
|
6
|
+
export * from './tokens/index.js';
|
|
5
7
|
// Export workspace
|
|
6
8
|
export { WorkspaceProvider, useWorkspace, WORKSPACE_HEADER, } from './lib/workspace.js';
|
|
7
9
|
// Export commands
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-lifecycle.d.ts","sourceRoot":"","sources":["../../src/lib/frame-lifecycle.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,qBAAqB,CAAA;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,MAAM,MAAM,+BAA+B,GAAG;IAC5C,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,KAAK,CAAC,MAAM,GAAG,KAAK,GAAG,eAAe,CAAC,C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AC,EAAE,OAAO,CAAA;QAC/B,YAAY,CAAC,EAAE,OAAO,CAAA;KACvB,CAAA;IACD,IAAI,CAAC,EAAE;QACL,YAAY,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAA;QAC7D,WAAW,CAAC,EAAE,OAAO,CAAA;KACtB,CAAA;IACD,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AASD,eAAO,MAAM,mCAAmC;;;;;;;EAStC,CAAA;AAoBV,eAAO,MAAM,qCAAqC,oCACf,CAAA;AACnC,eAAO,MAAM,qCAAqC,6BAA6B,CAAA;AAC/E,eAAO,MAAM,iCAAiC,iCAAiC,CAAA;AAC/E,eAAO,MAAM,sCAAsC,6CACP,CAAA;AAE5C,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,OAAO,iCAAiC,CAAA;IAC9C,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,SAAS,CAAA;IACf,IAAI,EAAE,SAAS,CAAA;IACf,MAAM,EAAE,OAAO,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAgCD,wBAAgB,uBAAuB,IACnC,iCAAiC,GACjC,SAAS,CAEZ;AA2BD,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CA6DtE;AAED,wBAAgB,4BAA4B,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO,CAa1E;AAsBD,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,0BAA0B,GAClC,IAAI,CAqDN;AA8DD,wBAAgB,uCAAuC,IAAI,MAAM,IAAI,CAuBpE;AAqCD,wBAAgB,6BAA6B,IAAI,IAAI,CAepD"}
|
|
@@ -156,6 +156,13 @@ export function applyMoldableHostContext(message) {
|
|
|
156
156
|
delete root.dataset.moldableNativeMaterialSidebar;
|
|
157
157
|
clearSidebarMaterialRegion();
|
|
158
158
|
}
|
|
159
|
+
if (message.displayMode === 'window' &&
|
|
160
|
+
message.nativeMaterial?.background === true) {
|
|
161
|
+
root.dataset.moldableNativeMaterialBackground = 'available';
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
delete root.dataset.moldableNativeMaterialBackground;
|
|
165
|
+
}
|
|
159
166
|
const insets = message.safeInsets;
|
|
160
167
|
if (insets) {
|
|
161
168
|
applyBoundedLength('--window-safe-area-top', insets.top);
|
package/dist/lib/theme.d.ts
CHANGED
|
@@ -1,15 +1,49 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import type { ControlSize, MaterialContext, ResolvedUIAppearance, UIAppearance, UIPlatform, UIPlatformPack, UIPlatformVersion, UIPreferences, UISidebarStyle, UITheme } from '../tokens/contracts.js';
|
|
3
|
+
/** @deprecated Use UIAppearance. */
|
|
4
|
+
export type Theme = UIAppearance;
|
|
5
|
+
/** @deprecated Use ResolvedUIAppearance. */
|
|
6
|
+
type ResolvedTheme = ResolvedUIAppearance;
|
|
4
7
|
interface ThemeContextValue {
|
|
8
|
+
uiTheme: UITheme;
|
|
9
|
+
setUITheme: (theme: UITheme) => void;
|
|
10
|
+
platform: UIPlatform;
|
|
11
|
+
platformVersion: UIPlatformVersion;
|
|
12
|
+
platformPack: UIPlatformPack;
|
|
13
|
+
setPlatformPack: (platform: UIPlatform, version: UIPlatformVersion) => void;
|
|
14
|
+
sidebarStyle: UISidebarStyle;
|
|
15
|
+
setSidebarStyle: (style: UISidebarStyle) => void;
|
|
16
|
+
appearance: UIAppearance;
|
|
17
|
+
resolvedAppearance: ResolvedUIAppearance;
|
|
18
|
+
setAppearance: (appearance: UIAppearance) => void;
|
|
19
|
+
controlSize: ControlSize;
|
|
20
|
+
setControlSize: (controlSize: ControlSize) => void;
|
|
21
|
+
materialContext: MaterialContext;
|
|
22
|
+
setMaterialContext: (materialContext: MaterialContext) => void;
|
|
23
|
+
preferences: UIPreferences;
|
|
24
|
+
/** @deprecated Use appearance. */
|
|
5
25
|
theme: Theme;
|
|
26
|
+
/** @deprecated Use resolvedAppearance. */
|
|
6
27
|
resolvedTheme: ResolvedTheme;
|
|
28
|
+
/** @deprecated Use setAppearance. */
|
|
7
29
|
setTheme: (theme: Theme) => void;
|
|
8
30
|
}
|
|
9
|
-
export
|
|
31
|
+
export interface ThemeProviderProps {
|
|
10
32
|
children: ReactNode;
|
|
11
|
-
|
|
33
|
+
platform?: UIPlatform;
|
|
34
|
+
platformVersion?: UIPlatformVersion;
|
|
35
|
+
uiTheme?: UITheme;
|
|
36
|
+
sidebarStyle?: UISidebarStyle;
|
|
37
|
+
appearance?: UIAppearance;
|
|
38
|
+
controlSize?: ControlSize;
|
|
39
|
+
materialContext?: MaterialContext;
|
|
40
|
+
preferences?: UIPreferences;
|
|
41
|
+
storageKey?: string | false;
|
|
42
|
+
}
|
|
43
|
+
export declare function ThemeProvider({ children, platform, platformVersion, uiTheme: uiThemeProp, sidebarStyle: sidebarStyleProp, appearance: appearanceProp, controlSize: controlSizeProp, materialContext: materialContextProp, preferences, storageKey, }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
12
44
|
export declare function useTheme(): ThemeContextValue;
|
|
45
|
+
/** Internal-friendly optional access for components that also work standalone. */
|
|
46
|
+
export declare function useOptionalTheme(): ThemeContextValue | null;
|
|
13
47
|
/**
|
|
14
48
|
* Inline script to prevent theme flash on page load.
|
|
15
49
|
* Add this to your <head> in layout.tsx:
|
|
@@ -20,6 +54,6 @@ export declare function useTheme(): ThemeContextValue;
|
|
|
20
54
|
* </head>
|
|
21
55
|
* ```
|
|
22
56
|
*/
|
|
23
|
-
export declare const themeScript = "\n(function() {\n var params = new URLSearchParams(window.location.search);\n var theme = params.get('theme');\n if (!theme) {\n theme = localStorage.getItem('moldable-theme');\n }\n if (theme === 'system' || !theme) {\n theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n }\n document.documentElement.classList.add(theme);\n})();\n";
|
|
57
|
+
export declare const themeScript = "\n(function() {\n var params = new URLSearchParams(window.location.search);\n var theme = params.get('theme');\n if (!theme) {\n theme = localStorage.getItem('moldable-theme');\n }\n if (theme === 'system' || !theme) {\n theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n }\n document.documentElement.classList.add(theme);\n document.documentElement.dataset.uiTheme = 'moldable';\n document.documentElement.dataset.uiPlatform = 'macos';\n document.documentElement.dataset.uiPlatformVersion = '27';\n document.documentElement.dataset.uiPlatformPack = 'macos-27';\n document.documentElement.dataset.uiSidebarStyle = 'edge-to-edge';\n document.documentElement.dataset.uiAppearance = theme;\n document.documentElement.dataset.controlSize = 'medium';\n document.documentElement.dataset.materialContext = 'content';\n})();\n";
|
|
24
58
|
export {};
|
|
25
59
|
//# sourceMappingURL=theme.d.ts.map
|
package/dist/lib/theme.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/lib/theme.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/lib/theme.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAA;AAEd,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,YAAY,EACZ,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,OAAO,EACR,MAAM,qBAAqB,CAAA;AAG5B,oCAAoC;AACpC,MAAM,MAAM,KAAK,GAAG,YAAY,CAAA;AAChC,4CAA4C;AAC5C,KAAK,aAAa,GAAG,oBAAoB,CAAA;AAEzC,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IACpC,QAAQ,EAAE,UAAU,CAAA;IACpB,eAAe,EAAE,iBAAiB,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