@node-core/ui-components 1.0.1-345c7d19144bec7138956e6ae7f5b20cfa2e2450 → 1.0.1-71be0843d06de0924837b94fc6f55f1cb3cd4d1d
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.
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
@reference "../../styles/index.css";
|
|
2
|
+
|
|
3
|
+
.dataTag {
|
|
4
|
+
@apply flex
|
|
5
|
+
items-center
|
|
6
|
+
justify-center
|
|
7
|
+
rounded-full
|
|
8
|
+
font-semibold
|
|
9
|
+
text-white;
|
|
10
|
+
|
|
11
|
+
&.lg {
|
|
12
|
+
@apply size-12
|
|
13
|
+
text-2xl;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&.md {
|
|
17
|
+
@apply size-10
|
|
18
|
+
text-xl;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&.sm {
|
|
22
|
+
@apply size-8;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&.event {
|
|
26
|
+
@apply bg-accent1-600;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&.method {
|
|
30
|
+
@apply bg-info-600;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&.property {
|
|
34
|
+
@apply bg-green-600;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&.class {
|
|
38
|
+
@apply bg-warning-600;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&.module {
|
|
42
|
+
@apply bg-red-600;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&.classMethod {
|
|
46
|
+
@apply bg-blue-600;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&.ctor {
|
|
50
|
+
@apply bg-accent2-600;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&.global {
|
|
54
|
+
@apply bg-amber-600;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Meta as MetaObj, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import DataTag, { type DataTagProps } from '#ui/Common/DataTag';
|
|
4
|
+
|
|
5
|
+
type Story = StoryObj<typeof DataTag>;
|
|
6
|
+
type Meta = MetaObj<typeof DataTag>;
|
|
7
|
+
|
|
8
|
+
export const DataTags: Story = {
|
|
9
|
+
render: () => (
|
|
10
|
+
<div className="grid grid-cols-3 gap-6 p-6">
|
|
11
|
+
{[
|
|
12
|
+
'event',
|
|
13
|
+
'method',
|
|
14
|
+
'property',
|
|
15
|
+
'class',
|
|
16
|
+
'module',
|
|
17
|
+
'classMethod',
|
|
18
|
+
'ctor',
|
|
19
|
+
'global',
|
|
20
|
+
]
|
|
21
|
+
.map(kind =>
|
|
22
|
+
['sm', 'md', 'lg'].map(size => (
|
|
23
|
+
<div
|
|
24
|
+
key={`${kind}-${size}`}
|
|
25
|
+
className="flex justify-center"
|
|
26
|
+
title={kind}
|
|
27
|
+
>
|
|
28
|
+
<DataTag
|
|
29
|
+
kind={kind as DataTagProps['kind']}
|
|
30
|
+
size={size as DataTagProps['size']}
|
|
31
|
+
/>
|
|
32
|
+
</div>
|
|
33
|
+
))
|
|
34
|
+
)
|
|
35
|
+
.flat()}
|
|
36
|
+
</div>
|
|
37
|
+
),
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default { component: DataTag } as Meta;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import type { FC } from 'react';
|
|
3
|
+
|
|
4
|
+
import styles from './index.module.css';
|
|
5
|
+
|
|
6
|
+
export type DataTagProps = {
|
|
7
|
+
kind:
|
|
8
|
+
| 'event'
|
|
9
|
+
| 'method'
|
|
10
|
+
| 'property'
|
|
11
|
+
| 'class'
|
|
12
|
+
| 'module'
|
|
13
|
+
| 'classMethod'
|
|
14
|
+
| 'global'
|
|
15
|
+
| 'ctor';
|
|
16
|
+
size?: 'lg' | 'md' | 'sm';
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// These symbols match up with the types used in
|
|
20
|
+
// node core, and the ones defined at
|
|
21
|
+
// https://github.com/nodejs/api-docs-tooling/blob/main/src/types.d.ts#L22 (`HeadingMetadataEntry['type']`)
|
|
22
|
+
const symbolMap = {
|
|
23
|
+
event: 'E',
|
|
24
|
+
method: 'M',
|
|
25
|
+
property: 'P',
|
|
26
|
+
class: 'C',
|
|
27
|
+
module: 'M',
|
|
28
|
+
classMethod: 'S',
|
|
29
|
+
global: 'G',
|
|
30
|
+
ctor: 'C',
|
|
31
|
+
} as const;
|
|
32
|
+
|
|
33
|
+
const DataTag: FC<DataTagProps> = ({ kind, size = 'md' }) => (
|
|
34
|
+
<div className={classNames(styles.dataTag, styles[size], styles[kind])}>
|
|
35
|
+
<span>{symbolMap[kind]}</span>
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
export default DataTag;
|
package/package.json
CHANGED