@dxos/ui-theme 0.8.4-staging.ac66bdf99f → 0.9.0
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/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/browser/index.mjs +89 -867
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +89 -867
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/plugin/node-cjs/main.css +252 -119
- package/dist/plugin/node-cjs/main.css.map +3 -3
- package/dist/plugin/node-cjs/meta.json +1 -1
- package/dist/plugin/node-cjs/plugins/ThemePlugin.cjs +82 -10
- package/dist/plugin/node-cjs/plugins/ThemePlugin.cjs.map +3 -3
- package/dist/plugin/node-esm/main.css +252 -119
- package/dist/plugin/node-esm/main.css.map +3 -3
- package/dist/plugin/node-esm/meta.json +1 -1
- package/dist/plugin/node-esm/plugins/ThemePlugin.mjs +84 -12
- package/dist/plugin/node-esm/plugins/ThemePlugin.mjs.map +3 -3
- package/dist/types/src/Theme.stories.d.ts.map +1 -1
- package/dist/types/src/defs.d.ts +1 -1
- package/dist/types/src/defs.d.ts.map +1 -1
- package/dist/types/src/fragments/density.d.ts +2 -2
- package/dist/types/src/fragments/density.d.ts.map +1 -1
- package/dist/types/src/fragments/hover.d.ts +0 -1
- package/dist/types/src/fragments/hover.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/plugins/ThemePlugin.d.ts +3 -2
- package/dist/types/src/plugins/ThemePlugin.d.ts.map +1 -1
- package/dist/types/src/util/hash-styles.d.ts +12 -2
- package/dist/types/src/util/hash-styles.d.ts.map +1 -1
- package/dist/types/src/util/mx.d.ts +0 -36
- package/dist/types/src/util/mx.d.ts.map +1 -1
- package/dist/types/src/util/size.d.ts.map +1 -1
- package/dist/types/src/util/valence.d.ts +8 -2
- package/dist/types/src/util/valence.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -21
- package/src/Theme.stories.tsx +94 -27
- package/src/css/DESIGN_SYSTEM.md +187 -0
- package/src/css/base/base.css +2 -2
- package/src/css/components/button.css +63 -13
- package/src/css/components/card.css +14 -0
- package/src/css/components/checkbox.css +3 -3
- package/src/css/components/focus.css +12 -12
- package/src/css/components/link.css +4 -1
- package/src/css/components/panel.css +45 -45
- package/src/css/components/state.css +99 -0
- package/src/css/components/state.md +101 -0
- package/src/css/components/surface.css +33 -11
- package/src/css/components/tag.css +25 -24
- package/src/css/integrations/codemirror.css +4 -3
- package/src/css/integrations/tldraw.css +1 -1
- package/src/css/layout/main.css +6 -0
- package/src/css/layout/size.css +16 -3
- package/src/css/theme/animation.css +31 -0
- package/src/css/theme/palette.css +34 -0
- package/src/css/theme/semantic.css +101 -60
- package/src/css/theme/spacing.css +29 -12
- package/src/css/theme/styles.css +172 -119
- package/src/css/utilities.css +42 -0
- package/src/defs.ts +3 -1
- package/src/fragments/AUDIT.md +0 -2
- package/src/fragments/density.ts +34 -7
- package/src/fragments/hover.ts +0 -2
- package/src/index.ts +1 -1
- package/src/main.css +68 -9
- package/src/plugins/ThemePlugin.ts +102 -14
- package/src/plugins/main.css +10 -7
- package/src/util/hash-styles.ts +54 -42
- package/src/util/mx.ts +1 -126
- package/src/util/valence.ts +15 -5
- package/dist/types/src/theme/components/avatar.d.ts +0 -21
- package/dist/types/src/theme/components/avatar.d.ts.map +0 -1
- package/dist/types/src/theme/components/breadcrumb.d.ts +0 -9
- package/dist/types/src/theme/components/breadcrumb.d.ts.map +0 -1
- package/dist/types/src/theme/components/button.d.ts +0 -15
- package/dist/types/src/theme/components/button.d.ts.map +0 -1
- package/dist/types/src/theme/components/card.d.ts +0 -12
- package/dist/types/src/theme/components/card.d.ts.map +0 -1
- package/dist/types/src/theme/components/dialog.d.ts +0 -17
- package/dist/types/src/theme/components/dialog.d.ts.map +0 -1
- package/dist/types/src/theme/components/focus.d.ts +0 -6
- package/dist/types/src/theme/components/focus.d.ts.map +0 -1
- package/dist/types/src/theme/components/icon-button.d.ts +0 -8
- package/dist/types/src/theme/components/icon-button.d.ts.map +0 -1
- package/dist/types/src/theme/components/icon.d.ts +0 -10
- package/dist/types/src/theme/components/icon.d.ts.map +0 -1
- package/dist/types/src/theme/components/index.d.ts +0 -27
- package/dist/types/src/theme/components/index.d.ts.map +0 -1
- package/dist/types/src/theme/components/input.d.ts +0 -115
- package/dist/types/src/theme/components/input.d.ts.map +0 -1
- package/dist/types/src/theme/components/link.d.ts +0 -7
- package/dist/types/src/theme/components/link.d.ts.map +0 -1
- package/dist/types/src/theme/components/list.d.ts +0 -14
- package/dist/types/src/theme/components/list.d.ts.map +0 -1
- package/dist/types/src/theme/components/main.d.ts +0 -28
- package/dist/types/src/theme/components/main.d.ts.map +0 -1
- package/dist/types/src/theme/components/menu.d.ts +0 -13
- package/dist/types/src/theme/components/menu.d.ts.map +0 -1
- package/dist/types/src/theme/components/message.d.ts +0 -12
- package/dist/types/src/theme/components/message.d.ts.map +0 -1
- package/dist/types/src/theme/components/popover.d.ts +0 -11
- package/dist/types/src/theme/components/popover.d.ts.map +0 -1
- package/dist/types/src/theme/components/scroll-area.d.ts +0 -32
- package/dist/types/src/theme/components/scroll-area.d.ts.map +0 -1
- package/dist/types/src/theme/components/select.d.ts +0 -13
- package/dist/types/src/theme/components/select.d.ts.map +0 -1
- package/dist/types/src/theme/components/separator.d.ts +0 -8
- package/dist/types/src/theme/components/separator.d.ts.map +0 -1
- package/dist/types/src/theme/components/skeleton.d.ts +0 -7
- package/dist/types/src/theme/components/skeleton.d.ts.map +0 -1
- package/dist/types/src/theme/components/splitter.d.ts +0 -4
- package/dist/types/src/theme/components/splitter.d.ts.map +0 -1
- package/dist/types/src/theme/components/status.d.ts +0 -9
- package/dist/types/src/theme/components/status.d.ts.map +0 -1
- package/dist/types/src/theme/components/tag.d.ts +0 -7
- package/dist/types/src/theme/components/tag.d.ts.map +0 -1
- package/dist/types/src/theme/components/toast.d.ts +0 -12
- package/dist/types/src/theme/components/toast.d.ts.map +0 -1
- package/dist/types/src/theme/components/toolbar.d.ts +0 -11
- package/dist/types/src/theme/components/toolbar.d.ts.map +0 -1
- package/dist/types/src/theme/components/tooltip.d.ts +0 -8
- package/dist/types/src/theme/components/tooltip.d.ts.map +0 -1
- package/dist/types/src/theme/components/treegrid.d.ts +0 -10
- package/dist/types/src/theme/components/treegrid.d.ts.map +0 -1
- package/dist/types/src/theme/index.d.ts +0 -4
- package/dist/types/src/theme/index.d.ts.map +0 -1
- package/dist/types/src/theme/primitives/column.d.ts +0 -29
- package/dist/types/src/theme/primitives/column.d.ts.map +0 -1
- package/dist/types/src/theme/primitives/index.d.ts +0 -3
- package/dist/types/src/theme/primitives/index.d.ts.map +0 -1
- package/dist/types/src/theme/primitives/panel.d.ts +0 -13
- package/dist/types/src/theme/primitives/panel.d.ts.map +0 -1
- package/dist/types/src/theme/theme.d.ts +0 -5
- package/dist/types/src/theme/theme.d.ts.map +0 -1
- package/src/css/components/selected.css +0 -30
- package/src/theme/components/avatar.ts +0 -95
- package/src/theme/components/breadcrumb.ts +0 -29
- package/src/theme/components/button.ts +0 -48
- package/src/theme/components/card.ts +0 -102
- package/src/theme/components/dialog.ts +0 -61
- package/src/theme/components/focus.ts +0 -33
- package/src/theme/components/icon-button.ts +0 -18
- package/src/theme/components/icon.ts +0 -28
- package/src/theme/components/index.ts +0 -30
- package/src/theme/components/input.ts +0 -171
- package/src/theme/components/link.ts +0 -25
- package/src/theme/components/list.ts +0 -46
- package/src/theme/components/main.ts +0 -34
- package/src/theme/components/menu.ts +0 -50
- package/src/theme/components/message.ts +0 -40
- package/src/theme/components/popover.ts +0 -41
- package/src/theme/components/scroll-area.ts +0 -115
- package/src/theme/components/select.ts +0 -52
- package/src/theme/components/separator.ts +0 -24
- package/src/theme/components/skeleton.ts +0 -23
- package/src/theme/components/splitter.ts +0 -20
- package/src/theme/components/status.ts +0 -32
- package/src/theme/components/tag.ts +0 -23
- package/src/theme/components/toast.ts +0 -53
- package/src/theme/components/toolbar.ts +0 -35
- package/src/theme/components/tooltip.ts +0 -27
- package/src/theme/components/treegrid.ts +0 -37
- package/src/theme/index.ts +0 -7
- package/src/theme/primitives/column.ts +0 -71
- package/src/theme/primitives/index.ts +0 -6
- package/src/theme/primitives/panel.ts +0 -43
- package/src/theme/theme.ts +0 -87
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type ComponentFunction, type Theme } from '@dxos/ui-types';
|
|
6
|
-
|
|
7
|
-
import { mx } from '../../util';
|
|
8
|
-
|
|
9
|
-
export type LinkStyleProps = {
|
|
10
|
-
variant?: 'accent' | 'neutral';
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const linkRoot: ComponentFunction<LinkStyleProps> = ({ variant }, ...etc) =>
|
|
14
|
-
mx(
|
|
15
|
-
'underline decoration-1 underline-offset-2 transition-color rounded-xs',
|
|
16
|
-
variant === 'neutral'
|
|
17
|
-
? 'text-inherit hover:opacity-90 visited:text-inherit visited:hover:opacity-90'
|
|
18
|
-
: 'text-accent-text hover:text-accent-text-hover visited:text-accent-text visited:hover:text-accent-text-hover',
|
|
19
|
-
'dx-focus-ring',
|
|
20
|
-
...etc,
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
export const linkTheme: Theme<LinkStyleProps> = {
|
|
24
|
-
root: linkRoot,
|
|
25
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type ComponentFunction, type Density, type Theme } from '@dxos/ui-types';
|
|
6
|
-
|
|
7
|
-
import { densityBlockSize, ghostHover } from '../../fragments';
|
|
8
|
-
import { getSize, mx } from '../../util';
|
|
9
|
-
|
|
10
|
-
export type ListStyleProps = Partial<{
|
|
11
|
-
density: Density;
|
|
12
|
-
collapsible: boolean;
|
|
13
|
-
}>;
|
|
14
|
-
|
|
15
|
-
export const listRoot: ComponentFunction<ListStyleProps> = (_, ...etc) => mx(...etc);
|
|
16
|
-
|
|
17
|
-
export const listItem: ComponentFunction<ListStyleProps> = ({ collapsible }, ...etc) =>
|
|
18
|
-
mx(!collapsible && 'flex', ...etc);
|
|
19
|
-
|
|
20
|
-
export const listItemEndcap: ComponentFunction<ListStyleProps> = ({ density }, ...etc) =>
|
|
21
|
-
mx(density === 'fine' ? getSize(8) : getSize(10), 'shrink-0 flex items-center justify-center', ...etc);
|
|
22
|
-
|
|
23
|
-
export const listItemHeading: ComponentFunction<ListStyleProps> = ({ density }, ...etc) =>
|
|
24
|
-
mx(densityBlockSize(density), 'flex items-center overflow-hidden [&>span]:truncate', ...etc);
|
|
25
|
-
|
|
26
|
-
export const listItemDragHandleIcon: ComponentFunction<ListStyleProps> = (_props, ...etc) =>
|
|
27
|
-
mx(getSize(5), 'mt-2.5', ...etc);
|
|
28
|
-
|
|
29
|
-
export const listItemOpenTrigger: ComponentFunction<ListStyleProps> = ({ density }, ...etc) =>
|
|
30
|
-
mx('w-5 rounded-sm flex justify-center items-center', densityBlockSize(density), ghostHover, 'dx-focus-ring', ...etc);
|
|
31
|
-
|
|
32
|
-
export const listItemOpenTriggerIcon: ComponentFunction<ListStyleProps> = (_props, ...etc) => {
|
|
33
|
-
return mx(getSize(5), ...etc);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const listTheme: Theme<ListStyleProps> = {
|
|
37
|
-
root: listRoot,
|
|
38
|
-
item: {
|
|
39
|
-
root: listItem,
|
|
40
|
-
endcap: listItemEndcap,
|
|
41
|
-
heading: listItemHeading,
|
|
42
|
-
dragHandleIcon: listItemDragHandleIcon,
|
|
43
|
-
openTrigger: listItemOpenTrigger,
|
|
44
|
-
openTriggerIcon: listItemOpenTriggerIcon,
|
|
45
|
-
},
|
|
46
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type ComponentFunction } from '@dxos/ui-types';
|
|
6
|
-
|
|
7
|
-
import { mx } from '../../util';
|
|
8
|
-
|
|
9
|
-
// Padding to apply to in-flow elements which need to clear the fixed topbar/bottombar.
|
|
10
|
-
export const topbarBlockPaddingStart = 'py-(--dx-topbar-size) dx-sticky-top-from-topbar-bottom';
|
|
11
|
-
export const bottombarBlockPaddingEnd = 'pb-(--dx-statusbar-size) dx-sticky-bottom-from-statusbar-bottom';
|
|
12
|
-
|
|
13
|
-
export const mainPadding = 'dx-main-content-padding';
|
|
14
|
-
export const mainPaddingTransitions = 'dx-main-content-padding-transitions';
|
|
15
|
-
export const mainIntrinsicSize = 'dx-main-intrinsic-size';
|
|
16
|
-
|
|
17
|
-
export type MainStyleProps = Partial<{
|
|
18
|
-
bounce: boolean;
|
|
19
|
-
handlesFocus: boolean;
|
|
20
|
-
}>;
|
|
21
|
-
|
|
22
|
-
export const mainContent: ComponentFunction<MainStyleProps> = ({ bounce }, ...etc) =>
|
|
23
|
-
mx(mainPadding, mainPaddingTransitions, bounce && 'dx-main-bounce-layout', 'dx-focus-ring-main', ...etc);
|
|
24
|
-
|
|
25
|
-
export const mainSidebar: ComponentFunction<MainStyleProps> = (_, ...etc) =>
|
|
26
|
-
mx('dx-main-sidebar', 'dx-focus-ring-inset-over-all', ...etc);
|
|
27
|
-
|
|
28
|
-
export const mainOverlay: ComponentFunction<MainStyleProps> = (_, ...etc) => mx('dx-main-overlay', ...etc);
|
|
29
|
-
|
|
30
|
-
export const mainTheme = {
|
|
31
|
-
content: mainContent,
|
|
32
|
-
sidebar: mainSidebar,
|
|
33
|
-
overlay: mainOverlay,
|
|
34
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type ComponentFunction, type Elevation, type Theme } from '@dxos/ui-types';
|
|
6
|
-
|
|
7
|
-
import { dataDisabled } from '../../fragments';
|
|
8
|
-
import { mx, surfaceShadow, surfaceZIndex } from '../../util';
|
|
9
|
-
|
|
10
|
-
export type MenuStyleProps = Partial<{
|
|
11
|
-
constrainBlockSize: boolean;
|
|
12
|
-
elevation: Elevation;
|
|
13
|
-
}>;
|
|
14
|
-
|
|
15
|
-
export const menuContent: ComponentFunction<MenuStyleProps> = ({ elevation }, ...etc) =>
|
|
16
|
-
mx(
|
|
17
|
-
'dx-modal-surface w-48 rounded-sm md:w-56 border border-separator',
|
|
18
|
-
surfaceZIndex({ elevation, level: 'menu' }),
|
|
19
|
-
surfaceShadow({ elevation: 'positioned' }),
|
|
20
|
-
...etc,
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
export const menuViewport: ComponentFunction<MenuStyleProps> = (_props, ...etc) =>
|
|
24
|
-
mx('rounded-sm p-1 max-h-[var(--radix-dropdown-menu-content-available-height)] overflow-y-auto', ...etc);
|
|
25
|
-
|
|
26
|
-
export const menuItem: ComponentFunction<MenuStyleProps> = (_props, ...etc) =>
|
|
27
|
-
mx(
|
|
28
|
-
'flex cursor-pointer select-none items-center gap-2 rounded-xs px-2 py-2 text-sm',
|
|
29
|
-
'hover:bg-hover-surface data-[highlighted]:bg-hover-surface',
|
|
30
|
-
'dx-focus-subdued',
|
|
31
|
-
dataDisabled,
|
|
32
|
-
...etc,
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
export const menuSeparator: ComponentFunction<MenuStyleProps> = (_props, ...etc) =>
|
|
36
|
-
mx('my-1 mx-2 h-px bg-separator', ...etc);
|
|
37
|
-
|
|
38
|
-
export const menuGroupLabel: ComponentFunction<MenuStyleProps> = (_props, ...etc) =>
|
|
39
|
-
mx('text-description', 'select-none px-2 py-2', ...etc);
|
|
40
|
-
|
|
41
|
-
export const menuArrow: ComponentFunction<MenuStyleProps> = (_props, ...etc) => mx('fill-separator', ...etc);
|
|
42
|
-
|
|
43
|
-
export const menuTheme: Theme<MenuStyleProps> = {
|
|
44
|
-
content: menuContent,
|
|
45
|
-
viewport: menuViewport,
|
|
46
|
-
item: menuItem,
|
|
47
|
-
separator: menuSeparator,
|
|
48
|
-
groupLabel: menuGroupLabel,
|
|
49
|
-
arrow: menuArrow,
|
|
50
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type ComponentFunction, type Elevation, type MessageValence, type Theme } from '@dxos/ui-types';
|
|
6
|
-
|
|
7
|
-
import { mx, messageValence } from '../../util';
|
|
8
|
-
|
|
9
|
-
export type MessageStyleProps = {
|
|
10
|
-
valence?: MessageValence;
|
|
11
|
-
elevation?: Elevation;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const messageRoot: ComponentFunction<MessageStyleProps> = ({ valence }, etc) => {
|
|
15
|
-
return mx('grid grid-cols-[min-content_1fr] gap-x-2 p-trim-sm rounded-sm', messageValence(valence), etc);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const messageHeader: ComponentFunction<MessageStyleProps> = (_, etc) => {
|
|
19
|
-
return mx('col-span-2 grid grid-cols-subgrid items-center', etc);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const messageTitle: ComponentFunction<MessageStyleProps> = (_, etc) => {
|
|
23
|
-
return mx('col-start-2 gap-trim-sm [&>svg]:inline-block', etc);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const messageIcon: ComponentFunction<MessageStyleProps> = (_, etc) => {
|
|
27
|
-
return mx('col-start-1', etc);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const messageContent: ComponentFunction<MessageStyleProps> = (_, etc) => {
|
|
31
|
-
return mx('grid grid-cols-subgrid col-start-2 first:font-medium', etc);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const messageTheme: Theme<MessageStyleProps> = {
|
|
35
|
-
root: messageRoot,
|
|
36
|
-
header: messageHeader,
|
|
37
|
-
icon: messageIcon,
|
|
38
|
-
title: messageTitle,
|
|
39
|
-
content: messageContent,
|
|
40
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type ComponentFunction, type Elevation, type Theme } from '@dxos/ui-types';
|
|
6
|
-
|
|
7
|
-
import { mx, surfaceShadow, surfaceZIndex } from '../../util';
|
|
8
|
-
|
|
9
|
-
export type PopoverStyleProps = Partial<{
|
|
10
|
-
constrainBlock: boolean;
|
|
11
|
-
constrainInline: boolean;
|
|
12
|
-
elevation: Elevation;
|
|
13
|
-
}>;
|
|
14
|
-
|
|
15
|
-
export const popoverContent: ComponentFunction<PopoverStyleProps> = ({ elevation }, ...etc) =>
|
|
16
|
-
mx(
|
|
17
|
-
'dx-modal-surface border border-separator rounded-sm',
|
|
18
|
-
surfaceShadow({ elevation: 'positioned' }),
|
|
19
|
-
surfaceZIndex({ elevation, level: 'menu' }),
|
|
20
|
-
'dx-focus-ring',
|
|
21
|
-
...etc,
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
export const popoverViewport: ComponentFunction<PopoverStyleProps> = ({ constrainBlock, constrainInline }, ...etc) =>
|
|
25
|
-
mx(
|
|
26
|
-
'grid grid-rows-[1fr] min-h-0 min-w-popover-min-width',
|
|
27
|
-
(constrainBlock || constrainInline) && 'overflow-hidden',
|
|
28
|
-
constrainBlock && 'max-h-(--radix-popover-content-available-height)',
|
|
29
|
-
constrainBlock &&
|
|
30
|
-
'max-h-[min(var(--radix-popover-content-available-height),calc(100dvh-var(--spacing-screen-border)*2))]',
|
|
31
|
-
constrainInline && 'max-w-(--radix-popover-content-available-width)',
|
|
32
|
-
...etc,
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
export const popoverArrow: ComponentFunction<PopoverStyleProps> = (_props, ...etc) => mx('fill-separator', ...etc);
|
|
36
|
-
|
|
37
|
-
export const popoverTheme: Theme<PopoverStyleProps> = {
|
|
38
|
-
content: popoverContent,
|
|
39
|
-
viewport: popoverViewport,
|
|
40
|
-
arrow: popoverArrow,
|
|
41
|
-
};
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2026 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type AllowedAxis, type ComponentFunction, type Theme } from '@dxos/ui-types';
|
|
6
|
-
|
|
7
|
-
import { mx } from '../../util';
|
|
8
|
-
import { withColumn } from '../primitives/column';
|
|
9
|
-
|
|
10
|
-
export const scrollbar = {
|
|
11
|
-
thin: {
|
|
12
|
-
size: 4,
|
|
13
|
-
padding: 4,
|
|
14
|
-
},
|
|
15
|
-
coarse: {
|
|
16
|
-
size: 8,
|
|
17
|
-
padding: 8,
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export type ScrollAreaStyleProps = {
|
|
22
|
-
orientation?: AllowedAxis;
|
|
23
|
-
autoHide?: boolean;
|
|
24
|
-
/** Balance left/right, top/bottom offset with scrollbar. */
|
|
25
|
-
centered?: boolean;
|
|
26
|
-
/** Add default padding. */
|
|
27
|
-
/** TODO(burdon): Integrate with Column.Root padding. */
|
|
28
|
-
padding?: boolean;
|
|
29
|
-
/** Use thin scrollbars. */
|
|
30
|
-
/** TODO(burdon): Density fine/course. */
|
|
31
|
-
thin?: boolean;
|
|
32
|
-
/** Enable snap scrolling. */
|
|
33
|
-
snap?: boolean;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const scrollAreaRoot: ComponentFunction<ScrollAreaStyleProps> = ({ orientation }, ...etc) =>
|
|
37
|
-
mx(
|
|
38
|
-
// Expand
|
|
39
|
-
'dx-container',
|
|
40
|
-
|
|
41
|
-
orientation === 'vertical' && 'group/scroll-v flex flex-col',
|
|
42
|
-
orientation === 'horizontal' && 'group/scroll-h flex',
|
|
43
|
-
orientation === 'all' && 'group/scroll-all',
|
|
44
|
-
|
|
45
|
-
// Apply col-span-full only when inside a Column.Root grid (detected via dx-column-root marker).
|
|
46
|
-
'[.dx-column-root_&]:col-span-full',
|
|
47
|
-
|
|
48
|
-
...etc,
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* NOTE: The browser reserves space for scrollbars.
|
|
53
|
-
*/
|
|
54
|
-
export const scrollAreaViewport: ComponentFunction<ScrollAreaStyleProps> = (
|
|
55
|
-
{ orientation, centered, padding, snap, autoHide },
|
|
56
|
-
...etc
|
|
57
|
-
) => {
|
|
58
|
-
return mx(
|
|
59
|
-
'flex-1 min-h-0 w-full',
|
|
60
|
-
|
|
61
|
-
// Reset --dx-col so nested components don't try to grid-position themselves.
|
|
62
|
-
// ScrollArea has already consumed --gutter for padding.
|
|
63
|
-
withColumn.consumed(),
|
|
64
|
-
|
|
65
|
-
orientation === 'vertical' && 'overflow-y-scroll',
|
|
66
|
-
orientation === 'horizontal' && 'flex overflow-x-scroll overscroll-x-contain',
|
|
67
|
-
orientation === 'all' && 'overflow-scroll',
|
|
68
|
-
|
|
69
|
-
'[&::-webkit-scrollbar-corner]:bg-transparent',
|
|
70
|
-
'[&::-webkit-scrollbar-track]:bg-transparent',
|
|
71
|
-
'[&::-webkit-scrollbar-thumb]:rounded-none',
|
|
72
|
-
|
|
73
|
-
'[&::-webkit-scrollbar]:w-[var(--scroll-width)] [&::-webkit-scrollbar]:h-[var(--scroll-width)]',
|
|
74
|
-
|
|
75
|
-
// If contained within Column.Root grid the gutter is set by that component (--gutter CSS variable).
|
|
76
|
-
// If centered, left padding compensates for scrollbar width so content is visually centered.
|
|
77
|
-
(orientation === 'vertical' || orientation === 'all') &&
|
|
78
|
-
(padding
|
|
79
|
-
? [
|
|
80
|
-
centered ? 'pl-[var(--gutter,calc(var(--scroll-width)+var(--scroll-padding)))]' : 'pl-[var(--gutter,0)]',
|
|
81
|
-
'pr-[calc(var(--gutter,calc(var(--scroll-width)+var(--scroll-padding)))-var(--scroll-width))]',
|
|
82
|
-
]
|
|
83
|
-
: centered && 'pl-[var(--scroll-width)]'),
|
|
84
|
-
|
|
85
|
-
(orientation === 'horizontal' || orientation === 'all') &&
|
|
86
|
-
(padding
|
|
87
|
-
? [centered && 'pt-[calc(var(--scroll-width)+var(--scroll-padding))]', 'pb-[var(--scroll-padding)]']
|
|
88
|
-
: centered && 'pt-[var(--scroll-width)]'),
|
|
89
|
-
|
|
90
|
-
snap && [
|
|
91
|
-
orientation === 'vertical' && 'snap-y snap-mandatory',
|
|
92
|
-
orientation === 'horizontal' && 'snap-x snap-mandatory',
|
|
93
|
-
orientation === 'all' && 'snap-both snap-mandatory',
|
|
94
|
-
],
|
|
95
|
-
|
|
96
|
-
autoHide
|
|
97
|
-
? [
|
|
98
|
-
orientation === 'vertical' && 'group-hover/scroll-v:[&::-webkit-scrollbar-thumb]:bg-scrollbar-thumb',
|
|
99
|
-
orientation === 'horizontal' && 'group-hover/scroll-h:[&::-webkit-scrollbar-thumb]:bg-scrollbar-thumb',
|
|
100
|
-
orientation === 'all' && 'group-hover/scroll-all:[&::-webkit-scrollbar-thumb]:bg-scrollbar-thumb',
|
|
101
|
-
]
|
|
102
|
-
: [
|
|
103
|
-
orientation === 'vertical' && '[&::-webkit-scrollbar-thumb]:bg-scrollbar-thumb',
|
|
104
|
-
orientation === 'horizontal' && '[&::-webkit-scrollbar-thumb]:bg-scrollbar-thumb',
|
|
105
|
-
orientation === 'all' && '[&::-webkit-scrollbar-thumb]:bg-scrollbar-thumb',
|
|
106
|
-
],
|
|
107
|
-
|
|
108
|
-
...etc,
|
|
109
|
-
);
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
export const scrollAreaTheme: Theme<ScrollAreaStyleProps> = {
|
|
113
|
-
root: scrollAreaRoot,
|
|
114
|
-
viewport: scrollAreaViewport,
|
|
115
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type ComponentFunction, type Elevation, type Theme } from '@dxos/ui-types';
|
|
6
|
-
|
|
7
|
-
import { mx, surfaceShadow, surfaceZIndex } from '../../util';
|
|
8
|
-
|
|
9
|
-
export type SelectStyleProps = Partial<{
|
|
10
|
-
elevation: Elevation;
|
|
11
|
-
}>;
|
|
12
|
-
|
|
13
|
-
export const selectContent: ComponentFunction<SelectStyleProps> = ({ elevation }, ...etc) => {
|
|
14
|
-
return mx(
|
|
15
|
-
'dx-modal-surface rounded-sm border border-separator',
|
|
16
|
-
'min-w-(--radix-select-trigger-width) max-h-(--radix-select-content-available-height)',
|
|
17
|
-
surfaceShadow({ elevation: 'positioned' }),
|
|
18
|
-
surfaceZIndex({ elevation, level: 'menu' }),
|
|
19
|
-
...etc,
|
|
20
|
-
);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export const selectViewport: ComponentFunction<SelectStyleProps> = (_props, ...etc) => mx(...etc);
|
|
24
|
-
|
|
25
|
-
export const selectItem: ComponentFunction<SelectStyleProps> = (_props, ...etc) =>
|
|
26
|
-
mx(
|
|
27
|
-
'flex items-center min-h-[2rem] px-3 py-1 gap-2',
|
|
28
|
-
'text-base-surface-text leading-none select-none outline-hidden',
|
|
29
|
-
'[&>svg]:invisible [&[data-state=checked]>svg]:visible',
|
|
30
|
-
'dx-highlighted',
|
|
31
|
-
...etc,
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
export const selectItemIndicator: ComponentFunction<SelectStyleProps> = (_props, ...etc) => mx('items-center', ...etc);
|
|
35
|
-
|
|
36
|
-
export const selectArrow: ComponentFunction<SelectStyleProps> = (_props, ...etc) => mx('fill-separator', ...etc);
|
|
37
|
-
|
|
38
|
-
export const selectSeparator: ComponentFunction<SelectStyleProps> = (_props, ...etc) =>
|
|
39
|
-
mx('self-stretch border-b my-1 border-separator', ...etc);
|
|
40
|
-
|
|
41
|
-
export const selectScrollButton: ComponentFunction<SelectStyleProps> = (_props, ...etc) =>
|
|
42
|
-
mx('dx-modal-surface flex items-center justify-center cursor-default h-6 w-full', ...etc);
|
|
43
|
-
|
|
44
|
-
export const selectTheme: Theme<SelectStyleProps> = {
|
|
45
|
-
content: selectContent,
|
|
46
|
-
viewport: selectViewport,
|
|
47
|
-
item: selectItem,
|
|
48
|
-
itemIndicator: selectItemIndicator,
|
|
49
|
-
arrow: selectArrow,
|
|
50
|
-
separator: selectSeparator,
|
|
51
|
-
scrollButton: selectScrollButton,
|
|
52
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type ComponentFunction, type Theme } from '@dxos/ui-types';
|
|
6
|
-
|
|
7
|
-
import { mx } from '../../util';
|
|
8
|
-
|
|
9
|
-
export type SeparatorStyleProps = {
|
|
10
|
-
orientation?: 'horizontal' | 'vertical';
|
|
11
|
-
subdued?: boolean;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const separatorRoot: ComponentFunction<SeparatorStyleProps> = ({ orientation, subdued }, ...etc) =>
|
|
15
|
-
mx(
|
|
16
|
-
'self-stretch',
|
|
17
|
-
orientation === 'vertical' ? 'border-e mx-1' : 'border-b my-1',
|
|
18
|
-
subdued ? 'border-subdued-separator' : 'border-separator',
|
|
19
|
-
...etc,
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
export const separatorTheme: Theme<SeparatorStyleProps> = {
|
|
23
|
-
root: separatorRoot,
|
|
24
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2026 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import type { ComponentFunction, Theme } from '@dxos/ui-types';
|
|
6
|
-
|
|
7
|
-
import { mx } from '../../util';
|
|
8
|
-
|
|
9
|
-
export type SkeletonStyleProps = {
|
|
10
|
-
variant?: 'default' | 'circle' | 'text';
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const skeletonRoot: ComponentFunction<SkeletonStyleProps> = ({ variant = 'default' }, ...etc) =>
|
|
14
|
-
mx(
|
|
15
|
-
'animate-pulse bg-neutral-300 dark:bg-neutral-700 rounded-md',
|
|
16
|
-
variant === 'circle' && 'rounded-full',
|
|
17
|
-
variant === 'text' && 'rounded-sm',
|
|
18
|
-
...etc,
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
export const skeletonTheme: Theme<SkeletonStyleProps> = {
|
|
22
|
-
root: skeletonRoot,
|
|
23
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2026 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type ComponentFunction, type Theme } from '@dxos/ui-types';
|
|
6
|
-
|
|
7
|
-
import { mx } from '../../util';
|
|
8
|
-
|
|
9
|
-
export type SplitterStyleProps = {};
|
|
10
|
-
|
|
11
|
-
const splitterRoot: ComponentFunction<SplitterStyleProps> = (_props, ...etc) =>
|
|
12
|
-
mx('relative h-full overflow-hidden', ...etc);
|
|
13
|
-
|
|
14
|
-
const splitterPanel: ComponentFunction<SplitterStyleProps> = (_props, ...etc) =>
|
|
15
|
-
mx('absolute inset-x-0 flex flex-col overflow-hidden', ...etc);
|
|
16
|
-
|
|
17
|
-
export const splitterTheme: Theme<SplitterStyleProps> = {
|
|
18
|
-
root: splitterRoot,
|
|
19
|
-
panel: splitterPanel,
|
|
20
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import type { ComponentFunction, Theme } from '@dxos/ui-types';
|
|
6
|
-
|
|
7
|
-
import { mx } from '../../util';
|
|
8
|
-
|
|
9
|
-
export type StatusStyleProps = {
|
|
10
|
-
variant?: 'default' | 'main-bottom';
|
|
11
|
-
indeterminate?: boolean;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const statusRoot: ComponentFunction<StatusStyleProps> = ({ variant = 'default' }, ...etc) =>
|
|
15
|
-
mx(
|
|
16
|
-
'h-1 relative rounded-full overflow-hidden',
|
|
17
|
-
variant === 'main-bottom' ? 'w-full block' : 'inline-20 inline-block bg-base-surface',
|
|
18
|
-
...etc,
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
export const statusBar: ComponentFunction<StatusStyleProps> = ({ variant = 'default', indeterminate }, ...etc) =>
|
|
22
|
-
mx(
|
|
23
|
-
'absolute inset-y-0 block rounded-full',
|
|
24
|
-
variant === 'main-bottom' ? 'bg-composer-300' : 'bg-un-accent',
|
|
25
|
-
indeterminate ? 'animate-progress-indeterminate' : 'start-0',
|
|
26
|
-
...etc,
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
export const statusTheme: Theme<StatusStyleProps> = {
|
|
30
|
-
root: statusRoot,
|
|
31
|
-
bar: statusBar,
|
|
32
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
type ChromaticPalette,
|
|
7
|
-
type ComponentFunction,
|
|
8
|
-
type MessageValence,
|
|
9
|
-
type NeutralPalette,
|
|
10
|
-
type Theme,
|
|
11
|
-
} from '@dxos/ui-types';
|
|
12
|
-
|
|
13
|
-
import { mx } from '../../util';
|
|
14
|
-
|
|
15
|
-
export type TagStyleProps = {
|
|
16
|
-
palette?: ChromaticPalette | NeutralPalette | MessageValence;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const tagRoot: ComponentFunction<TagStyleProps> = (_, ...etc) => mx('dx-tag', ...etc);
|
|
20
|
-
|
|
21
|
-
export const tagTheme: Theme<TagStyleProps> = {
|
|
22
|
-
root: tagRoot,
|
|
23
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type ComponentFunction, type Theme } from '@dxos/ui-types';
|
|
6
|
-
|
|
7
|
-
import { mx, surfaceShadow } from '../../util';
|
|
8
|
-
|
|
9
|
-
export type ToastStyleProps = Partial<{
|
|
10
|
-
srOnly: boolean;
|
|
11
|
-
}>;
|
|
12
|
-
|
|
13
|
-
export const toastViewport: ComponentFunction<ToastStyleProps> = (_props, ...etc) =>
|
|
14
|
-
mx(
|
|
15
|
-
// TODO(burdon): block-end should take into account status bar.
|
|
16
|
-
'z-40 fixed bottom-[calc(env(safe-area-inset-bottom)+1rem)] inset-start-[calc(env(safe-area-inset-left)+1rem)] inset-end-[calc(env(safe-area-inset-right)+1rem)] w-auto md:end-[calc(env(safe-area-inset-right)+1rem)] md:left-auto md:w-full md:max-w-sm',
|
|
17
|
-
'rounded-md flex flex-col gap-2',
|
|
18
|
-
...etc,
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
export const toastRoot: ComponentFunction<ToastStyleProps> = (_props, ...etc) =>
|
|
22
|
-
mx(
|
|
23
|
-
'dx-modal-surface rounded-md flex p-2 gap-2',
|
|
24
|
-
surfaceShadow({ elevation: 'toast' }),
|
|
25
|
-
'radix-state-open:animate-toast-slide-in-bottom md:radix-state-open:animate-toast-slide-in-right',
|
|
26
|
-
'radix-state-closed:animate-toast-hide',
|
|
27
|
-
'radix-swipe-end:animate-toast-swipe-out',
|
|
28
|
-
'translate-x-radix-toast-swipe-move-x',
|
|
29
|
-
'radix-swipe-cancel:translate-x-0 radix-swipe-cancel:duration-200 radix-swipe-cancel:ease-[ease]',
|
|
30
|
-
'dx-focus-ring',
|
|
31
|
-
...etc,
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
export const toastBody: ComponentFunction<ToastStyleProps> = (_props, ...etc) =>
|
|
35
|
-
mx('grow flex flex-col gap-1 justify-center pl-2', ...etc);
|
|
36
|
-
|
|
37
|
-
export const toastActions: ComponentFunction<ToastStyleProps> = (_props, ...etc) =>
|
|
38
|
-
mx('shrink-0 flex flex-col gap-1 justify-center', ...etc);
|
|
39
|
-
|
|
40
|
-
export const toastTitle: ComponentFunction<ToastStyleProps> = ({ srOnly }, ...etc) =>
|
|
41
|
-
mx('shrink-0 font-medium', srOnly && 'sr-only', ...etc);
|
|
42
|
-
|
|
43
|
-
export const toastDescription: ComponentFunction<ToastStyleProps> = ({ srOnly }, ...etc) =>
|
|
44
|
-
mx('text-description', 'shrink-0', srOnly && 'sr-only', ...etc);
|
|
45
|
-
|
|
46
|
-
export const toastTheme: Theme<ToastStyleProps> = {
|
|
47
|
-
viewport: toastViewport,
|
|
48
|
-
root: toastRoot,
|
|
49
|
-
body: toastBody,
|
|
50
|
-
title: toastTitle,
|
|
51
|
-
description: toastDescription,
|
|
52
|
-
actions: toastActions,
|
|
53
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type ComponentFunction, type Density, type Theme } from '@dxos/ui-types';
|
|
6
|
-
|
|
7
|
-
import { mx } from '../../util';
|
|
8
|
-
|
|
9
|
-
export type ToolbarStyleProps = Partial<{
|
|
10
|
-
density: Density;
|
|
11
|
-
disabled: boolean;
|
|
12
|
-
layoutManaged: boolean;
|
|
13
|
-
}>;
|
|
14
|
-
|
|
15
|
-
export const toolbarLayout =
|
|
16
|
-
'w-full shrink-0 flex flex-nowrap p-1 gap-1 items-center overflow-x-auto scrollbar-none dx-contain-layout';
|
|
17
|
-
|
|
18
|
-
export const toolbarRoot: ComponentFunction<ToolbarStyleProps> = ({ density, disabled, layoutManaged }, ...etc) => {
|
|
19
|
-
return mx(
|
|
20
|
-
'bg-toolbar-surface dx-toolbar',
|
|
21
|
-
density === 'coarse' && 'h-(--dx-rail-size) px-3!',
|
|
22
|
-
disabled && '*:opacity-20',
|
|
23
|
-
!layoutManaged && toolbarLayout,
|
|
24
|
-
...etc,
|
|
25
|
-
);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const toolbarText: ComponentFunction<ToolbarStyleProps> = (_, ...etc) => {
|
|
29
|
-
return mx('px-2 grow truncate items-center', ...etc);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export const toolbarTheme: Theme<ToolbarStyleProps> = {
|
|
33
|
-
root: toolbarRoot,
|
|
34
|
-
text: toolbarText,
|
|
35
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type ComponentFunction, type Elevation, type Theme } from '@dxos/ui-types';
|
|
6
|
-
|
|
7
|
-
import { mx, surfaceShadow, surfaceZIndex } from '../../util';
|
|
8
|
-
|
|
9
|
-
export type TooltipStyleProps = Partial<{
|
|
10
|
-
elevation: Elevation;
|
|
11
|
-
}>;
|
|
12
|
-
|
|
13
|
-
export const tooltipContent: ComponentFunction<TooltipStyleProps> = ({ elevation }, ...etc) =>
|
|
14
|
-
mx(
|
|
15
|
-
'inline-flex items-center p-1 max-w-64 text-sm bg-inverse-surface text-inverse-surface-text rounded-sm',
|
|
16
|
-
surfaceShadow({ elevation: 'positioned' }),
|
|
17
|
-
surfaceZIndex({ elevation, level: 'tooltip' }),
|
|
18
|
-
...etc,
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
export const tooltipArrow: ComponentFunction<TooltipStyleProps> = (_props, ...etc) =>
|
|
22
|
-
mx('fill-inverse-surface', ...etc);
|
|
23
|
-
|
|
24
|
-
export const tooltipTheme: Theme<TooltipStyleProps> = {
|
|
25
|
-
content: tooltipContent,
|
|
26
|
-
arrow: tooltipArrow,
|
|
27
|
-
};
|