@moldable-ai/ui 0.2.29 → 0.2.32
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 +5 -5
- package/dist/components/app-error-boundary.d.ts +1 -1
- package/dist/components/chat/chat-image-lightbox.d.ts +8 -0
- package/dist/components/chat/chat-image-lightbox.d.ts.map +1 -1
- package/dist/components/chat/chat-image-lightbox.js +24 -2
- package/dist/components/chat/chat-input.d.ts +3 -2
- package/dist/components/chat/chat-input.d.ts.map +1 -1
- package/dist/components/chat/chat-input.js +3 -3
- package/dist/components/chat/chat-message.d.ts.map +1 -1
- package/dist/components/chat/chat-message.js +3 -1
- package/dist/components/chat/chat-panel.d.ts +3 -1
- package/dist/components/chat/chat-panel.d.ts.map +1 -1
- package/dist/components/chat/chat-panel.js +53 -39
- package/dist/components/chat/conversation-history.d.ts +4 -2
- package/dist/components/chat/conversation-history.d.ts.map +1 -1
- package/dist/components/chat/conversation-history.js +20 -15
- package/dist/components/ui/alert.d.ts +1 -1
- 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 -11
- 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.d.ts.map +1 -1
- package/dist/components/ui/context-menu.js +7 -6
- package/dist/components/ui/date-field.d.ts +1 -1
- package/dist/components/ui/dropdown-menu.d.ts +1 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu.js +9 -8
- 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/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/menu-items.d.ts +2 -1
- package/dist/components/ui/menu-items.d.ts.map +1 -1
- package/dist/components/ui/menu-items.js +3 -2
- package/dist/components/ui/message-scroller-controller.d.ts +15 -17
- package/dist/components/ui/message-scroller-controller.d.ts.map +1 -1
- package/dist/components/ui/message-scroller-controller.js +106 -91
- package/dist/components/ui/message-scroller-primitive.d.ts +2 -0
- package/dist/components/ui/message-scroller-primitive.d.ts.map +1 -1
- package/dist/components/ui/message-scroller-primitive.js +2 -0
- package/dist/components/ui/message-scroller.d.ts.map +1 -1
- package/dist/components/ui/message-scroller.js +2 -2
- package/dist/components/ui/number-input.d.ts +1 -1
- package/dist/components/ui/popover.js +1 -1
- package/dist/components/ui/search-field.d.ts +4 -2
- 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 +10 -4
- package/dist/components/ui/sidebar.d.ts.map +1 -1
- package/dist/components/ui/sidebar.js +74 -17
- 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 +13 -3
- package/dist/components/ui/toolbar-controls.d.ts.map +1 -1
- package/dist/components/ui/toolbar-controls.js +35 -10
- 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 +21 -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/dropdown-menu.md +16 -14
- 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 +62 -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 +89 -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 +29 -6
- 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 +24 -12
- package/src/components/ui/toolbar.md +6 -6
- package/src/styles/index.css +298 -117
- 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 +165 -0
- package/src/tokens/moldable/index.css +1 -0
- package/src/tokens/platform-contract.test.ts +294 -0
|
@@ -4,16 +4,16 @@ import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { cn } from '../../lib/utils.js';
|
|
6
6
|
import { cva } from 'class-variance-authority';
|
|
7
|
-
const segmentedControlVariants = cva('inline-flex w-fit items-center overflow-x-auto rounded-
|
|
7
|
+
const segmentedControlVariants = cva('inline-flex h-[var(--m-ui-control-height)] w-fit items-center overflow-x-auto rounded-[var(--m-ui-control-radius)] bg-[var(--m-ui-color-fill-quinary)] p-0 text-[var(--m-ui-color-text-secondary)]', {
|
|
8
8
|
variants: {
|
|
9
9
|
variant: {
|
|
10
10
|
muted: 'bg-muted/70',
|
|
11
11
|
outline: 'border border-border/80 bg-background shadow-xs',
|
|
12
12
|
},
|
|
13
13
|
density: {
|
|
14
|
-
compact: '
|
|
15
|
-
default: '
|
|
16
|
-
comfortable: '
|
|
14
|
+
compact: '',
|
|
15
|
+
default: '',
|
|
16
|
+
comfortable: '',
|
|
17
17
|
},
|
|
18
18
|
fullWidth: {
|
|
19
19
|
true: 'flex w-full',
|
|
@@ -26,12 +26,12 @@ const segmentedControlVariants = cva('inline-flex w-fit items-center overflow-x-
|
|
|
26
26
|
fullWidth: false,
|
|
27
27
|
},
|
|
28
28
|
});
|
|
29
|
-
const segmentedControlItemVariants = cva('relative inline-flex cursor-pointer select-none items-center justify-center whitespace-nowrap rounded-control font-medium outline-none transition-[background-color,color,box-shadow] hover:bg-control-hover hover:text-foreground active:bg-control-pressed active:text-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 focus-visible:z-10 focus-visible:ring-
|
|
29
|
+
const segmentedControlItemVariants = cva('relative -ml-px inline-flex h-[var(--m-ui-control-height)] cursor-pointer select-none items-center justify-center whitespace-nowrap rounded-[var(--m-ui-control-radius)] px-[var(--m-ui-segment-margin)] font-medium outline-none transition-[background-color,color,box-shadow] first:ml-0 hover:bg-control-hover hover:text-foreground active:bg-control-pressed active:text-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 focus-visible:z-10 focus-visible:ring-[3px] focus-visible:ring-ring data-[state=checked]:bg-[var(--m-ui-color-accent)] data-[state=checked]:text-white data-[state=checked]:shadow-xs [&_svg]:pointer-events-none [&_svg]:shrink-0', {
|
|
30
30
|
variants: {
|
|
31
31
|
density: {
|
|
32
|
-
compact: '
|
|
33
|
-
default: '
|
|
34
|
-
comfortable: '
|
|
32
|
+
compact: 'gap-1 text-[length:var(--m-ui-control-font-size)] leading-[var(--m-ui-control-line-height)] [&_svg:not([class*="size-"])]:size-3',
|
|
33
|
+
default: 'gap-1.5 text-[length:var(--m-ui-control-font-size)] leading-[var(--m-ui-control-line-height)] [&_svg:not([class*="size-"])]:size-3.5',
|
|
34
|
+
comfortable: 'gap-1.5 text-[length:var(--m-ui-control-font-size)] leading-[var(--m-ui-control-line-height)] [&_svg:not([class*="size-"])]:size-4',
|
|
35
35
|
},
|
|
36
36
|
fullWidth: {
|
|
37
37
|
true: 'min-w-0 flex-1',
|
|
@@ -46,17 +46,23 @@ const segmentedControlItemVariants = cva('relative inline-flex cursor-pointer se
|
|
|
46
46
|
const SegmentedControlContext = React.createContext({
|
|
47
47
|
density: 'default',
|
|
48
48
|
fullWidth: false,
|
|
49
|
+
controlSize: undefined,
|
|
49
50
|
});
|
|
50
|
-
function SegmentedControl({ className, variant = 'muted', density = 'default', fullWidth = false, orientation = 'horizontal', ...props }) {
|
|
51
|
-
|
|
51
|
+
function SegmentedControl({ className, controlSize, variant = 'muted', density = 'default', fullWidth = false, orientation = 'horizontal', ...props }) {
|
|
52
|
+
const resolvedControlSize = controlSize ??
|
|
53
|
+
{
|
|
54
|
+
compact: 'small',
|
|
55
|
+
default: 'medium',
|
|
56
|
+
comfortable: 'large',
|
|
57
|
+
}[density ?? 'default'];
|
|
58
|
+
return (_jsx(SegmentedControlContext.Provider, { value: {
|
|
59
|
+
controlSize: resolvedControlSize,
|
|
60
|
+
density: density ?? 'default',
|
|
61
|
+
fullWidth: Boolean(fullWidth),
|
|
62
|
+
}, children: _jsx(RadioGroupPrimitive.Root, { "data-slot": "segmented-control", "data-variant": variant, "data-density": density, "data-control-size": resolvedControlSize, "data-full-width": fullWidth, orientation: orientation, className: cn(segmentedControlVariants({ variant, density, fullWidth }), orientation === 'vertical' && 'flex-col', className), ...props }) }));
|
|
52
63
|
}
|
|
53
64
|
function SegmentedControlItem({ className, iconOnly = false, ...props }) {
|
|
54
|
-
const { density, fullWidth } = React.useContext(SegmentedControlContext);
|
|
55
|
-
return (_jsx(RadioGroupPrimitive.Item, { "data-slot": "segmented-control-item", "data-density": density, "data-icon-only": iconOnly, className: cn(segmentedControlItemVariants({ density, fullWidth }), iconOnly &&
|
|
56
|
-
{
|
|
57
|
-
compact: 'size-6 p-0',
|
|
58
|
-
default: 'size-7 p-0',
|
|
59
|
-
comfortable: 'size-8 p-0',
|
|
60
|
-
}[density], className), ...props }));
|
|
65
|
+
const { controlSize, density, fullWidth } = React.useContext(SegmentedControlContext);
|
|
66
|
+
return (_jsx(RadioGroupPrimitive.Item, { "data-slot": "segmented-control-item", "data-density": density, "data-control-size": controlSize, "data-icon-only": iconOnly, className: cn(segmentedControlItemVariants({ density, fullWidth }), iconOnly && 'size-[var(--m-ui-control-height)] p-0', className), ...props }));
|
|
61
67
|
}
|
|
62
68
|
export { SegmentedControl, SegmentedControlItem, segmentedControlItemVariants, segmentedControlVariants, };
|
|
@@ -17,14 +17,14 @@ function SelectTrigger({ className, size = 'default', children, ...props }) {
|
|
|
17
17
|
}
|
|
18
18
|
function SelectContent({ className, children, position = 'item-aligned', align = 'center', ...props }) {
|
|
19
19
|
return (_jsx(SelectPrimitive.Portal, { children: _jsxs(SelectPrimitive.Content, { "data-slot": "select-content", className: cn('bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-(--radix-select-content-available-height) origin-(--radix-select-content-transform-origin) rounded-overlay shadow-overlay relative z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden border', position === 'popper' &&
|
|
20
|
-
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1', className), position: position, align: align, ...props, children: [_jsx(SelectScrollUpButton, {}), _jsx(SelectPrimitive.Viewport, { role: "group", tabIndex: 0, className: cn('
|
|
20
|
+
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1', className), position: position, align: align, ...props, children: [_jsx(SelectScrollUpButton, {}), _jsx(SelectPrimitive.Viewport, { role: "group", tabIndex: 0, className: cn('px-1 py-[var(--m-ui-menu-padding-block)]', position === 'popper' &&
|
|
21
21
|
'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1'), children: children }), _jsx(SelectScrollDownButton, {})] }) }));
|
|
22
22
|
}
|
|
23
23
|
function SelectLabel({ className, ...props }) {
|
|
24
24
|
return (_jsx(SelectPrimitive.Label, { "data-slot": "select-label", className: cn('text-muted-foreground text-ui-caption px-2 py-1.5', className), ...props }));
|
|
25
25
|
}
|
|
26
26
|
function SelectItem({ className, children, ...props }) {
|
|
27
|
-
return (_jsxs(SelectPrimitive.Item, { "data-slot": "select-item", className: cn("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground outline-hidden *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2
|
|
27
|
+
return (_jsxs(SelectPrimitive.Item, { "data-slot": "select-item", className: cn("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground outline-hidden *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 text-ui-body relative flex w-full cursor-default select-none items-center gap-2 rounded-[var(--m-ui-menu-item-radius)] py-1.5 pl-2 pr-8 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", className), ...props, children: [_jsx("span", { "data-slot": "select-item-indicator", className: "absolute right-2 flex size-3.5 items-center justify-center", children: _jsx(SelectPrimitive.ItemIndicator, { children: _jsx(CheckIcon, { className: "size-4" }) }) }), _jsx(SelectPrimitive.ItemText, { children: children })] }));
|
|
28
28
|
}
|
|
29
29
|
function SelectSeparator({ className, ...props }) {
|
|
30
30
|
return (_jsx(SelectPrimitive.Separator, { "data-slot": "select-separator", className: cn('bg-border pointer-events-none -mx-1 my-1 h-px', className), ...props }));
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import type { UISidebarStyle } from '../../tokens/contracts.js';
|
|
2
3
|
import { Button } from './button.js';
|
|
3
4
|
import { Input } from './input.js';
|
|
5
|
+
import type { MaterialVariant } from './material.js';
|
|
4
6
|
import { Separator } from './separator.js';
|
|
5
7
|
import { TooltipContent } from './tooltip.js';
|
|
6
8
|
import { type VariantProps } from 'class-variance-authority';
|
|
@@ -19,9 +21,11 @@ declare function SidebarProvider({ defaultOpen, open: openProp, onOpenChange: se
|
|
|
19
21
|
open?: boolean;
|
|
20
22
|
onOpenChange?: (open: boolean) => void;
|
|
21
23
|
}): import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
declare function Sidebar({ side, variant, collapsible, className, children, ref, ...props }: React.ComponentProps<'div'> & {
|
|
24
|
+
declare function Sidebar({ side, variant, sidebarStyle, material, collapsible, className, children, ref, ...props }: React.ComponentProps<'div'> & {
|
|
23
25
|
side?: 'left' | 'right';
|
|
24
26
|
variant?: 'sidebar' | 'floating' | 'inset';
|
|
27
|
+
sidebarStyle?: UISidebarStyle;
|
|
28
|
+
material?: MaterialVariant;
|
|
25
29
|
collapsible?: 'offcanvas' | 'icon' | 'none';
|
|
26
30
|
}): import("react/jsx-runtime").JSX.Element;
|
|
27
31
|
declare function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<typeof Button>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -31,9 +35,11 @@ declare function SidebarInput({ className, ...props }: React.ComponentProps<type
|
|
|
31
35
|
declare function SidebarHeader({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
32
36
|
declare function SidebarFooter({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
33
37
|
declare function SidebarSeparator({ className, ...props }: React.ComponentProps<typeof Separator>): import("react/jsx-runtime").JSX.Element;
|
|
34
|
-
declare function SidebarContent({ className, ...props }: React.ComponentProps<'div'>
|
|
38
|
+
declare function SidebarContent({ className, edgeFade, ...props }: React.ComponentProps<'div'> & {
|
|
39
|
+
edgeFade?: boolean;
|
|
40
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
35
41
|
declare function SidebarGroup({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
36
|
-
declare function SidebarGroupLabel({ className, asChild, ...props }: React.ComponentProps<'div'> & {
|
|
42
|
+
declare function SidebarGroupLabel({ className, asChild, style, ...props }: React.ComponentProps<'div'> & {
|
|
37
43
|
asChild?: boolean;
|
|
38
44
|
}): import("react/jsx-runtime").JSX.Element;
|
|
39
45
|
declare function SidebarGroupAction({ className, asChild, ...props }: React.ComponentProps<'button'> & {
|
|
@@ -46,7 +52,7 @@ declare const sidebarMenuButtonVariants: (props?: ({
|
|
|
46
52
|
variant?: "default" | "outline" | null | undefined;
|
|
47
53
|
size?: "default" | "sm" | "lg" | null | undefined;
|
|
48
54
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
49
|
-
declare function SidebarMenuButton({ asChild, isActive, variant, size, tooltip, className, ...props }: React.ComponentProps<'button'> & {
|
|
55
|
+
declare function SidebarMenuButton({ asChild, isActive, variant, size, tooltip, className, style, ...props }: React.ComponentProps<'button'> & {
|
|
50
56
|
asChild?: boolean;
|
|
51
57
|
isActive?: boolean;
|
|
52
58
|
tooltip?: string | React.ComponentProps<typeof TooltipContent>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../../src/components/ui/sidebar.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../../src/components/ui/sidebar.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAE5D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AASvC,OAAO,EAEL,cAAc,EAGf,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,KAAK,YAAY,EAAO,MAAM,0BAA0B,CAAA;AAkHjE,KAAK,mBAAmB,GAAG;IACzB,KAAK,EAAE,UAAU,GAAG,WAAW,CAAA;IAC/B,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IAChC,UAAU,EAAE,OAAO,CAAA;IACnB,aAAa,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACtC,QAAQ,EAAE,OAAO,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a1E;AAED,iBAAS,kBAAkB,CAAC,EAC1B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,2CAS5B;AAED,iBAAS,oBAAoB,CAAC,EAC5B,OAAe,EACf,IAAW,EACX,QAAgB,EAChB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,2CAoBA;AAED,OAAO,EACL,OAAO,EACP,cAAc,EACd,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,UAAU,GACX,CAAA"}
|
|
@@ -4,10 +4,12 @@ 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';
|
|
10
11
|
import { Button } from './button.js';
|
|
12
|
+
import { EdgeFade } from './edge-fade.js';
|
|
11
13
|
import { Input } from './input.js';
|
|
12
14
|
import { Separator } from './separator.js';
|
|
13
15
|
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, } from './sheet.js';
|
|
@@ -16,7 +18,7 @@ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from './too
|
|
|
16
18
|
import { cva } from 'class-variance-authority';
|
|
17
19
|
const SIDEBAR_COOKIE_NAME = 'sidebar_state';
|
|
18
20
|
const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
19
|
-
const SIDEBAR_WIDTH = '16rem';
|
|
21
|
+
const SIDEBAR_WIDTH = 'var(--m-ui-sidebar-width, 16rem)';
|
|
20
22
|
const SIDEBAR_WIDTH_MOBILE = '18rem';
|
|
21
23
|
const SIDEBAR_WIDTH_ICON = '3rem';
|
|
22
24
|
const SIDEBAR_KEYBOARD_SHORTCUT = 'b';
|
|
@@ -41,6 +43,7 @@ function useSidebarMaterialRegion({ enabled, forwardedRef, }) {
|
|
|
41
43
|
}, [forwardedRef]);
|
|
42
44
|
const canDeclare = enabled &&
|
|
43
45
|
appFrame?.mode === 'window' &&
|
|
46
|
+
appFrame.sidebarMaterialEnabled === true &&
|
|
44
47
|
appFrame.sidebarMaterialAvailable === true;
|
|
45
48
|
React.useEffect(() => {
|
|
46
49
|
const element = elementRef.current;
|
|
@@ -158,32 +161,64 @@ function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: set
|
|
|
158
161
|
...style,
|
|
159
162
|
}, className: cn('group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full', className), ...props, children: children }) }) }));
|
|
160
163
|
}
|
|
161
|
-
function Sidebar({ side = 'left', variant = 'sidebar', collapsible = 'offcanvas', className, children, ref, ...props }) {
|
|
164
|
+
function Sidebar({ side = 'left', variant = 'sidebar', sidebarStyle, material, collapsible = 'offcanvas', className, children, ref, ...props }) {
|
|
165
|
+
const theme = useOptionalTheme();
|
|
166
|
+
const resolvedSidebarStyle = sidebarStyle ?? theme?.sidebarStyle ?? 'edge-to-edge';
|
|
167
|
+
const resolvedVariant = resolvedSidebarStyle === 'floating'
|
|
168
|
+
? 'floating'
|
|
169
|
+
: resolvedSidebarStyle === 'edge-to-edge'
|
|
170
|
+
? 'sidebar'
|
|
171
|
+
: variant;
|
|
162
172
|
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
163
173
|
const materialRegion = useSidebarMaterialRegion({
|
|
164
174
|
enabled: !isMobile &&
|
|
165
175
|
side === 'left' &&
|
|
166
|
-
|
|
176
|
+
resolvedVariant === 'sidebar' &&
|
|
167
177
|
!(state === 'collapsed' && collapsible === 'offcanvas'),
|
|
168
178
|
forwardedRef: ref,
|
|
169
179
|
});
|
|
180
|
+
const usesWebMaterial = resolvedVariant === 'floating' &&
|
|
181
|
+
material !== undefined &&
|
|
182
|
+
!materialRegion.active;
|
|
170
183
|
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(
|
|
184
|
+
return (_jsx("div", { ref: materialRegion.setElement, "data-slot": "sidebar", "data-ui-sidebar-style": resolvedSidebarStyle, "data-material": usesWebMaterial ? material : undefined, "data-material-region-id": materialRegion.regionId, "data-native-material": materialRegion.active ? 'sidebar' : undefined, className: cn(usesWebMaterial
|
|
185
|
+
? 'moldable-material'
|
|
186
|
+
: materialRegion.active
|
|
187
|
+
? 'bg-transparent'
|
|
188
|
+
: 'bg-sidebar', 'text-sidebar-foreground w-(--sidebar-width) flex flex-col self-stretch', resolvedVariant === 'floating' &&
|
|
189
|
+
'overflow-hidden 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
190
|
}
|
|
173
191
|
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: {
|
|
192
|
+
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
193
|
'--sidebar-width': SIDEBAR_WIDTH_MOBILE,
|
|
176
194
|
}, 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
195
|
}
|
|
178
|
-
return (_jsxs("div", { className: "text-sidebar-foreground group peer hidden md:block", "data-state": state, "data-collapsible": state === 'collapsed' ? collapsible : '', "data-variant":
|
|
196
|
+
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
197
|
? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]'
|
|
180
198
|
: '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
199
|
? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]'
|
|
182
200
|
: 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]',
|
|
183
201
|
// 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",
|
|
202
|
+
resolvedVariant === 'floating' || resolvedVariant === 'inset'
|
|
203
|
+
? 'p-[var(--m-ui-sidebar-window-inset,0.5rem)] group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]'
|
|
204
|
+
: '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", "data-material": usesWebMaterial ? material : undefined, className: cn(usesWebMaterial
|
|
205
|
+
? 'moldable-material'
|
|
206
|
+
: materialRegion.active
|
|
207
|
+
? 'bg-transparent'
|
|
208
|
+
: 'bg-sidebar', 'flex h-full w-full flex-col', resolvedVariant === 'floating' && 'overflow-hidden'), style: resolvedVariant === 'floating'
|
|
209
|
+
? {
|
|
210
|
+
borderRadius: 'var(--m-ui-sidebar-shell-radius, var(--shape-container))',
|
|
211
|
+
borderStyle: 'solid',
|
|
212
|
+
borderWidth: 'var(--m-ui-sidebar-border-width, 0px)',
|
|
213
|
+
borderColor: 'var(--m-ui-sidebar-border-color, var(--sidebar-border))',
|
|
214
|
+
boxShadow: 'var(--m-ui-sidebar-shadow, var(--material-shadow-sidebar))',
|
|
215
|
+
...(usesWebMaterial
|
|
216
|
+
? {}
|
|
217
|
+
: {
|
|
218
|
+
backdropFilter: 'blur(var(--m-ui-sidebar-glass-effect-radius, 0px))',
|
|
219
|
+
}),
|
|
220
|
+
}
|
|
221
|
+
: undefined, children: children }) })] }));
|
|
187
222
|
}
|
|
188
223
|
function SidebarTrigger({ className, onClick, ...props }) {
|
|
189
224
|
const { toggleSidebar } = useSidebar();
|
|
@@ -211,15 +246,23 @@ function SidebarFooter({ className, ...props }) {
|
|
|
211
246
|
function SidebarSeparator({ className, ...props }) {
|
|
212
247
|
return (_jsx(Separator, { "data-slot": "sidebar-separator", "data-sidebar": "separator", className: cn('bg-sidebar-border mx-2 w-auto', className), ...props }));
|
|
213
248
|
}
|
|
214
|
-
function SidebarContent({ className, ...props }) {
|
|
215
|
-
|
|
249
|
+
function SidebarContent({ className, edgeFade = false, ...props }) {
|
|
250
|
+
const content = (_jsx("div", { "data-slot": "sidebar-content", "data-sidebar": "content", className: cn('flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden', className), ...props }));
|
|
251
|
+
if (!edgeFade)
|
|
252
|
+
return content;
|
|
253
|
+
return (_jsxs("div", { "data-slot": "sidebar-content-frame", className: "relative flex min-h-0 flex-1 flex-col overflow-hidden", children: [content, _jsx(EdgeFade, { edge: "top", className: "from-sidebar" }), _jsx(EdgeFade, { edge: "bottom", className: "from-sidebar" })] }));
|
|
216
254
|
}
|
|
217
255
|
function SidebarGroup({ className, ...props }) {
|
|
218
256
|
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
257
|
}
|
|
220
|
-
function SidebarGroupLabel({ className, asChild = false, ...props }) {
|
|
258
|
+
function SidebarGroupLabel({ className, asChild = false, style, ...props }) {
|
|
221
259
|
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
|
|
260
|
+
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: {
|
|
261
|
+
minHeight: 'var(--m-ui-sidebar-section-height-medium, 2rem)',
|
|
262
|
+
paddingInline: 'var(--m-ui-sidebar-row-inset-inline, 0.5rem)',
|
|
263
|
+
borderRadius: 'var(--m-ui-sidebar-item-radius, var(--shape-control))',
|
|
264
|
+
...style,
|
|
265
|
+
}, ...props }));
|
|
223
266
|
}
|
|
224
267
|
function SidebarGroupAction({ className, asChild = false, ...props }) {
|
|
225
268
|
const Comp = asChild ? Slot : 'button';
|
|
@@ -236,7 +279,7 @@ function SidebarMenu({ className, ...props }) {
|
|
|
236
279
|
function SidebarMenuItem({ className, ...props }) {
|
|
237
280
|
return (_jsx("li", { "data-slot": "sidebar-menu-item", "data-sidebar": "menu-item", className: cn('group/menu-item relative', className), ...props }));
|
|
238
281
|
}
|
|
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', {
|
|
282
|
+
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
283
|
variants: {
|
|
241
284
|
variant: {
|
|
242
285
|
default: 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',
|
|
@@ -253,10 +296,24 @@ const sidebarMenuButtonVariants = cva('peer/menu-button flex w-full items-center
|
|
|
253
296
|
size: 'default',
|
|
254
297
|
},
|
|
255
298
|
});
|
|
256
|
-
function SidebarMenuButton({ asChild = false, isActive = false, variant = 'default', size = 'default', tooltip, className, ...props }) {
|
|
299
|
+
function SidebarMenuButton({ asChild = false, isActive = false, variant = 'default', size = 'default', tooltip, className, style, ...props }) {
|
|
257
300
|
const Comp = asChild ? Slot : 'button';
|
|
258
301
|
const { isMobile, state } = useSidebar();
|
|
259
|
-
const
|
|
302
|
+
const heightToken = size === 'sm'
|
|
303
|
+
? '--m-ui-sidebar-row-height-small'
|
|
304
|
+
: size === 'lg'
|
|
305
|
+
? '--m-ui-sidebar-row-height-large'
|
|
306
|
+
: '--m-ui-sidebar-row-height-medium';
|
|
307
|
+
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: {
|
|
308
|
+
height: `var(${heightToken})`,
|
|
309
|
+
minHeight: `var(${heightToken})`,
|
|
310
|
+
paddingBlock: 0,
|
|
311
|
+
paddingInline: 'var(--m-ui-sidebar-row-inset-inline, 0.5rem)',
|
|
312
|
+
borderRadius: isActive
|
|
313
|
+
? 'var(--m-ui-sidebar-selection-radius, var(--shape-control))'
|
|
314
|
+
: 'var(--m-ui-sidebar-item-radius, var(--shape-control))',
|
|
315
|
+
...style,
|
|
316
|
+
}, ...props }));
|
|
260
317
|
if (!tooltip) {
|
|
261
318
|
return button;
|
|
262
319
|
}
|
|
@@ -294,6 +351,6 @@ function SidebarMenuSubItem({ className, ...props }) {
|
|
|
294
351
|
}
|
|
295
352
|
function SidebarMenuSubButton({ asChild = false, size = 'md', isActive = false, className, ...props }) {
|
|
296
353
|
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
|
|
354
|
+
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
355
|
}
|
|
299
356
|
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 };
|
|
@@ -2,16 +2,24 @@ import * as React from 'react';
|
|
|
2
2
|
import type { MenuItems } from '../../lib/host-native-menu.js';
|
|
3
3
|
import { Button } from './button.js';
|
|
4
4
|
import { type IconButtonProps, type IconButtonSize } from './icon-button.js';
|
|
5
|
+
import { type MaterialVariant } from './material.js';
|
|
5
6
|
import { Separator } from './separator.js';
|
|
6
7
|
type ToolbarControlAppearance = 'chrome' | 'quiet';
|
|
8
|
+
type ToolbarControlSize = 'medium' | 'xl';
|
|
7
9
|
export interface ToolbarButtonProps extends React.ComponentProps<typeof Button> {
|
|
8
10
|
/**
|
|
9
11
|
* `chrome` uses the raised translucent toolbar surface. `quiet` is useful
|
|
10
12
|
* inside a ToolbarControlGroup, which owns the shared surface.
|
|
11
13
|
*/
|
|
12
14
|
appearance?: ToolbarControlAppearance;
|
|
15
|
+
/**
|
|
16
|
+
* Adaptive material thickness for standalone chrome. Defaults to `thick`
|
|
17
|
+
* for prominent actions, `regular` for standard actions, and `none` inside
|
|
18
|
+
* a shared control group or when `appearance="quiet"`.
|
|
19
|
+
*/
|
|
20
|
+
material?: MaterialVariant | 'none';
|
|
13
21
|
}
|
|
14
|
-
declare function ToolbarButton({ appearance, className, size, variant, ...props }: ToolbarButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
declare function ToolbarButton({ appearance, className, material, size, variant, ...props }: ToolbarButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
15
23
|
export interface ToolbarIconButtonProps extends Omit<IconButtonProps, 'size'> {
|
|
16
24
|
appearance?: ToolbarControlAppearance;
|
|
17
25
|
size?: IconButtonSize;
|
|
@@ -19,8 +27,9 @@ export interface ToolbarIconButtonProps extends Omit<IconButtonProps, 'size'> {
|
|
|
19
27
|
declare function ToolbarIconButton({ appearance, className, size, variant, ...props }: ToolbarIconButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
20
28
|
export interface ToolbarControlGroupProps extends React.ComponentProps<'div'> {
|
|
21
29
|
appearance?: ToolbarControlAppearance;
|
|
30
|
+
size?: ToolbarControlSize;
|
|
22
31
|
}
|
|
23
|
-
declare function ToolbarControlGroup({ appearance, className, ...props }: ToolbarControlGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
declare function ToolbarControlGroup({ appearance, className, size, ...props }: ToolbarControlGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
24
33
|
declare function ToolbarControlSeparator({ className, ...props }: React.ComponentProps<typeof Separator>): import("react/jsx-runtime").JSX.Element;
|
|
25
34
|
export interface ToolbarBackButtonProps extends Omit<ToolbarIconButtonProps, 'children' | 'label'> {
|
|
26
35
|
label?: string;
|
|
@@ -36,9 +45,10 @@ declare function ToolbarSidebarToggle({ expanded, hideLabel, onExpandedChange, s
|
|
|
36
45
|
export interface ToolbarOverflowMenuProps extends Omit<ToolbarIconButtonProps, 'children' | 'label' | 'onClick'> {
|
|
37
46
|
items: MenuItems[];
|
|
38
47
|
label?: string;
|
|
48
|
+
nativeMenu?: boolean;
|
|
39
49
|
onSelectItem?: (id: string) => void;
|
|
40
50
|
}
|
|
41
|
-
declare function ToolbarOverflowMenu({ items, label, onSelectItem, tooltip, ...props }: ToolbarOverflowMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
declare function ToolbarOverflowMenu({ items, label, nativeMenu, onSelectItem, tooltip, ...props }: ToolbarOverflowMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
42
52
|
export interface ToolbarTitleFieldProps extends Omit<React.ComponentProps<'input'>, 'size'> {
|
|
43
53
|
label?: string;
|
|
44
54
|
}
|
|
@@ -1 +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;
|
|
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,EAAY,KAAK,eAAe,EAAE,MAAM,YAAY,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,aA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ACvB,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,GAClB,CAAA"}
|
|
@@ -6,23 +6,48 @@ import { cn } from '../../lib/utils.js';
|
|
|
6
6
|
import { Button } from './button.js';
|
|
7
7
|
import { DropdownMenu, DropdownMenuTrigger } from './dropdown-menu.js';
|
|
8
8
|
import { IconButton, } from './icon-button.js';
|
|
9
|
+
import { Material } from './material.js';
|
|
9
10
|
import { Separator } from './separator.js';
|
|
10
11
|
const ToolbarControlGroupContext = React.createContext(null);
|
|
11
|
-
function ToolbarButton({ appearance = 'chrome', className, size, variant, ...props }) {
|
|
12
|
+
function ToolbarButton({ appearance = 'chrome', className, material, size, variant, ...props }) {
|
|
12
13
|
const group = React.useContext(ToolbarControlGroupContext);
|
|
13
|
-
|
|
14
|
+
const groupedSize = group?.size === 'xl' ? 'lg' : 'sm';
|
|
15
|
+
const emphasis = variant === 'prominent' ? 'primary' : 'standard';
|
|
16
|
+
const usesToolbarChrome = variant === undefined || variant === 'prominent' || variant === 'toolbar';
|
|
17
|
+
const resolvedMaterial = group || appearance === 'quiet'
|
|
18
|
+
? 'none'
|
|
19
|
+
: (material ??
|
|
20
|
+
(usesToolbarChrome
|
|
21
|
+
? variant === 'prominent'
|
|
22
|
+
? 'thick'
|
|
23
|
+
: 'regular'
|
|
24
|
+
: 'none'));
|
|
25
|
+
const resolvedVariant = resolvedMaterial !== 'none'
|
|
26
|
+
? 'ghost'
|
|
27
|
+
: usesToolbarChrome &&
|
|
28
|
+
(group || appearance === 'quiet' || material === 'none')
|
|
29
|
+
? 'ghost'
|
|
30
|
+
: variant === 'prominent'
|
|
31
|
+
? 'toolbar'
|
|
32
|
+
: (variant ?? 'toolbar');
|
|
33
|
+
const button = (_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 }));
|
|
34
|
+
if (resolvedMaterial === 'none')
|
|
35
|
+
return button;
|
|
36
|
+
return (_jsx(Material, { asChild: true, variant: resolvedMaterial, shape: "capsule", elevation: "panel", interactive: true, children: button }));
|
|
14
37
|
}
|
|
15
38
|
function ToolbarIconButton({ appearance = 'chrome', className, size, variant, ...props }) {
|
|
16
39
|
const group = React.useContext(ToolbarControlGroupContext);
|
|
17
|
-
|
|
40
|
+
const groupedSize = group?.size === 'xl' ? 'lg' : 'sm';
|
|
41
|
+
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 }));
|
|
18
42
|
}
|
|
19
|
-
function ToolbarControlGroup({ appearance = 'chrome', className, ...props }) {
|
|
20
|
-
return (_jsx(ToolbarControlGroupContext.Provider, { value: { grouped: true }, children: _jsx("div", { role: "group", "data-slot": "toolbar-control-group", "data-appearance": appearance, className: cn('
|
|
21
|
-
? '
|
|
43
|
+
function ToolbarControlGroup({ appearance = 'chrome', className, size = 'xl', ...props }) {
|
|
44
|
+
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'
|
|
45
|
+
? 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')
|
|
22
46
|
: 'gap-1.5', className), ...props }) }));
|
|
23
47
|
}
|
|
24
48
|
function ToolbarControlSeparator({ className, ...props }) {
|
|
25
|
-
|
|
49
|
+
const group = React.useContext(ToolbarControlGroupContext);
|
|
50
|
+
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 }));
|
|
26
51
|
}
|
|
27
52
|
function ToolbarBackButton({ label = 'Back', tooltip = true, ...props }) {
|
|
28
53
|
return (_jsx(ToolbarIconButton, { label: label, tooltip: tooltip, ...props, children: _jsx(ChevronLeftIcon, {}) }));
|
|
@@ -31,10 +56,10 @@ function ToolbarSidebarToggle({ expanded, hideLabel = 'Hide sidebar', onExpanded
|
|
|
31
56
|
const label = expanded ? hideLabel : showLabel;
|
|
32
57
|
return (_jsx(ToolbarIconButton, { "aria-pressed": expanded, "data-state": expanded ? 'on' : 'off', label: label, tooltip: tooltip, onClick: () => onExpandedChange(!expanded), ...props, children: _jsx(PanelLeftIcon, {}) }));
|
|
33
58
|
}
|
|
34
|
-
function ToolbarOverflowMenu({ items, label = 'More actions', onSelectItem, tooltip = true, ...props }) {
|
|
35
|
-
return (_jsx(DropdownMenu, { items: items, onSelectItem: onSelectItem, children: _jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(ToolbarIconButton, { label: label, tooltip: tooltip, ...props, children: _jsx(EllipsisIcon, {}) }) }) }));
|
|
59
|
+
function ToolbarOverflowMenu({ items, label = 'More actions', nativeMenu = false, onSelectItem, tooltip = true, ...props }) {
|
|
60
|
+
return (_jsx(DropdownMenu, { items: items, nativeMenu: nativeMenu, onSelectItem: onSelectItem, children: _jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(ToolbarIconButton, { label: label, tooltip: tooltip, ...props, children: _jsx(EllipsisIcon, {}) }) }) }));
|
|
36
61
|
}
|
|
37
62
|
function ToolbarTitleField({ 'aria-label': ariaLabel, className, label = 'Document title', type = 'text', ...props }) {
|
|
38
|
-
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-
|
|
63
|
+
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 }));
|
|
39
64
|
}
|
|
40
65
|
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,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;AAK7B,OAAO,EAAE,KAAK,YAAY,EAAO,MAAM,0BAA0B,CAAA;AAEjE,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,MAAM,GACN,gBAAgB,GAChB,yBAAyB,CAAA;AAC7B,KAAK,sBAAsB,GAAG,OAAO,CAAC,eAAe,EAAE,SAAS,GAAG,OAAO,CAAC,CAAA;AAE3E,QAAA,MAAM,eAAe;;;;;8EAsCpB,CAAA;AAED,MAAM,WAAW,YACf,SAAQ,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EACpC,YAAY,CAAC,OAAO,eAAe,CAAC;IACtC;;;OAGG;IACH,QAAQ,CAAC,EAAE,sBAAsB,GAAG,MAAM,CAAA;IAC1C;;;OAGG;IACH,KAAK,CAAC,EAAE,YAAY,CAAA;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,iBAAS,OAAO,CAAC,EACf,OAAO,EACP,OAAO,EACP,QAAQ,EACR,Q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