@dxos/react-ui 0.7.5-labs.5f04cf6 → 0.7.5-labs.e27f9b9
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 +69 -70
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +70 -70
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +69 -70
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Avatars/Avatar.d.ts +5 -9
- package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts +1 -2
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/IconButton.d.ts +2 -0
- package/dist/types/src/components/Buttons/IconButton.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.d.ts +35 -22
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.stories.d.ts +1 -1
- package/dist/types/src/components/Menus/DropdownMenu.d.ts +2 -6
- package/dist/types/src/components/Menus/DropdownMenu.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/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +42 -42
- package/src/components/Avatars/Avatar.tsx +3 -6
- package/src/components/Buttons/IconButton.tsx +4 -3
- package/src/components/Input/Input.tsx +1 -1
- package/src/components/Main/Main.stories.tsx +1 -1
- package/src/components/Main/Main.tsx +78 -72
- package/src/components/Tag/Tag.stories.tsx +20 -31
- package/src/components/Tag/Tag.tsx +15 -6
|
@@ -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
|
+
);
|