@dxos/react-ui 0.7.5-labs.35b4b42 → 0.7.5-labs.8a82073
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/index.mjs +10 -9
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +10 -9
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +10 -9
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Clipboard/CopyButton.d.ts +5 -1
- package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/index.d.ts +6 -1
- package/dist/types/src/components/Clipboard/index.d.ts.map +1 -1
- package/dist/types/src/components/Lists/ListDropIndicator.d.ts +3 -1
- package/dist/types/src/components/Lists/ListDropIndicator.d.ts.map +1 -1
- package/dist/types/src/components/Tag/Tag.d.ts.map +1 -1
- package/dist/types/src/components/Tag/Tag.stories.d.ts +12 -5
- package/dist/types/src/components/Tag/Tag.stories.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/components/Clipboard/CopyButton.tsx +6 -2
- package/src/components/Lists/ListDropIndicator.tsx +15 -7
- package/src/components/Tag/Tag.stories.tsx +20 -31
- package/src/components/Tag/Tag.tsx +15 -6
|
@@ -15,8 +15,10 @@ const edgeToOrientationMap: Record<Edge, Orientation> = {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
const orientationStyles: Record<Orientation, HTMLAttributes<HTMLElement>['className']> = {
|
|
18
|
-
horizontal:
|
|
19
|
-
|
|
18
|
+
horizontal:
|
|
19
|
+
'h-[--line-thickness] left-[calc(var(--line-inset)+var(--terminal-radius))] right-[--line-inset] before:left-[--terminal-inset]',
|
|
20
|
+
vertical:
|
|
21
|
+
'w-[--line-thickness] top-[calc(var(--line-inset)+var(--terminal-radius))] bottom-[--line-inset] before:top-[--terminal-inset]',
|
|
20
22
|
};
|
|
21
23
|
|
|
22
24
|
const edgeStyles: Record<Edge, HTMLAttributes<HTMLElement>['className']> = {
|
|
@@ -33,14 +35,19 @@ const offsetToAlignTerminalWithLine = (strokeSize - terminalSize) / 2;
|
|
|
33
35
|
export type DropIndicatorProps = {
|
|
34
36
|
edge: Edge;
|
|
35
37
|
gap?: number;
|
|
38
|
+
terminalInset?: number;
|
|
39
|
+
lineInset?: number;
|
|
36
40
|
};
|
|
37
41
|
|
|
38
42
|
/**
|
|
39
43
|
* This is a tailwind port of `@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box`
|
|
40
44
|
*/
|
|
41
|
-
export const ListDropIndicator = ({
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
export const ListDropIndicator = ({
|
|
46
|
+
edge,
|
|
47
|
+
gap = 0,
|
|
48
|
+
lineInset = 0,
|
|
49
|
+
terminalInset = lineInset - terminalSize,
|
|
50
|
+
}: DropIndicatorProps) => {
|
|
44
51
|
const orientation = edgeToOrientationMap[edge];
|
|
45
52
|
|
|
46
53
|
return (
|
|
@@ -49,10 +56,11 @@ export const ListDropIndicator = ({ edge, gap = 0 }: DropIndicatorProps) => {
|
|
|
49
56
|
style={
|
|
50
57
|
{
|
|
51
58
|
'--line-thickness': `${strokeSize}px`,
|
|
52
|
-
'--line-offset':
|
|
59
|
+
'--line-offset': `calc(-0.5 * (${gap}px + ${strokeSize}px))`,
|
|
60
|
+
'--line-inset': `${lineInset}px`,
|
|
53
61
|
'--terminal-size': `${terminalSize}px`,
|
|
54
62
|
'--terminal-radius': `${terminalSize / 2}px`,
|
|
55
|
-
'--
|
|
63
|
+
'--terminal-inset': `${terminalInset}px`,
|
|
56
64
|
'--offset-terminal': `${offsetToAlignTerminalWithLine}px`,
|
|
57
65
|
} as CSSProperties
|
|
58
66
|
}
|
|
@@ -1,46 +1,35 @@
|
|
|
1
1
|
//
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
|
+
import React from 'react';
|
|
4
5
|
|
|
6
|
+
import { hueTokenThemes } from '@dxos/react-ui-theme';
|
|
5
7
|
import '@dxos-theme';
|
|
8
|
+
import { type ChromaticPalette, type MessageValence } from '@dxos/react-ui-types';
|
|
6
9
|
|
|
7
10
|
import { Tag } from './Tag';
|
|
8
11
|
import { withTheme } from '../../testing';
|
|
9
12
|
|
|
13
|
+
const palettes = ['neutral', 'success', 'info', 'warning', 'error', ...Object.keys(hueTokenThemes)] as (
|
|
14
|
+
| ChromaticPalette
|
|
15
|
+
| MessageValence
|
|
16
|
+
)[];
|
|
17
|
+
|
|
10
18
|
export default {
|
|
11
19
|
title: 'ui/react-ui-core/Tag',
|
|
12
20
|
component: Tag,
|
|
13
21
|
decorators: [withTheme],
|
|
14
22
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
15
|
-
|
|
16
|
-
palette: {
|
|
17
|
-
control: 'select',
|
|
18
|
-
options: [
|
|
19
|
-
'neutral',
|
|
20
|
-
'success',
|
|
21
|
-
'info',
|
|
22
|
-
'warning',
|
|
23
|
-
'error',
|
|
24
|
-
'red',
|
|
25
|
-
'orange',
|
|
26
|
-
'amber',
|
|
27
|
-
'yellow',
|
|
28
|
-
'lime',
|
|
29
|
-
'green',
|
|
30
|
-
'emerald',
|
|
31
|
-
'teal',
|
|
32
|
-
'cyan',
|
|
33
|
-
'sky',
|
|
34
|
-
'blue',
|
|
35
|
-
'indigo',
|
|
36
|
-
'violet',
|
|
37
|
-
'purple',
|
|
38
|
-
'fuchsia',
|
|
39
|
-
'pink',
|
|
40
|
-
'rose',
|
|
41
|
-
],
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
} as any;
|
|
23
|
+
} as const;
|
|
45
24
|
|
|
46
|
-
export const Default = {
|
|
25
|
+
export const Default = {
|
|
26
|
+
render: () => (
|
|
27
|
+
<div role='grid' className='grid grid-cols-5 gap-2 max-is-screen-md'>
|
|
28
|
+
{palettes.map((palette) => (
|
|
29
|
+
<Tag key={palette} palette={palette}>
|
|
30
|
+
{palette}
|
|
31
|
+
</Tag>
|
|
32
|
+
))}
|
|
33
|
+
</div>
|
|
34
|
+
),
|
|
35
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
@@ -16,8 +16,17 @@ export type TagProps = ThemedClassName<ComponentPropsWithRef<typeof Primitive.sp
|
|
|
16
16
|
asChild?: boolean;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
export const Tag = forwardRef<HTMLSpanElement, TagProps>(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
export const Tag = forwardRef<HTMLSpanElement, TagProps>(
|
|
20
|
+
({ asChild, palette = 'neutral', classNames, ...props }, forwardedRef) => {
|
|
21
|
+
const { tx } = useThemeContext();
|
|
22
|
+
const Root = asChild ? Slot : Primitive.span;
|
|
23
|
+
return (
|
|
24
|
+
<Root
|
|
25
|
+
{...props}
|
|
26
|
+
className={tx('tag.root', 'dx-tag', { palette }, classNames)}
|
|
27
|
+
data-hue={palette}
|
|
28
|
+
ref={forwardedRef}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
},
|
|
32
|
+
);
|