@infonomic/uikit 2.9.0 → 2.11.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/dist/components/badge/badge.d.ts +17 -2
- package/dist/components/badge/badge.d.ts.map +1 -1
- package/dist/components/badge/badge.js +9 -4
- package/dist/components/badge/badge_module.css +1 -1
- package/dist/components/card/card.d.ts +2 -2
- package/dist/components/card/card.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/badge/badge.module.css +1 -1
- package/src/components/badge/badge.tsx +36 -3
- package/src/components/card/card.tsx +2 -2
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import { Intent } from '../@types/shared';
|
|
2
|
-
|
|
2
|
+
type AsDiv = {
|
|
3
|
+
asChild?: false;
|
|
4
|
+
} & React.ComponentPropsWithoutRef<'div'>;
|
|
5
|
+
interface AsSlot {
|
|
6
|
+
asChild?: true;
|
|
7
|
+
}
|
|
8
|
+
export type BadgeRefType<C extends React.ElementType> = React.ComponentPropsWithRef<C>['ref'];
|
|
9
|
+
export type BadgeProps<C extends React.ElementType = 'div'> = {
|
|
3
10
|
children: React.ReactNode;
|
|
4
11
|
intent?: Intent;
|
|
5
|
-
|
|
12
|
+
className?: string;
|
|
13
|
+
asChild?: boolean;
|
|
14
|
+
ref?: BadgeRefType<C>;
|
|
15
|
+
} & (AsSlot | AsDiv);
|
|
16
|
+
export declare const Badge: {
|
|
17
|
+
<C extends React.ElementType = "div">({ className, intent, children, asChild, ref, ...rest }: BadgeProps<C>): React.JSX.Element;
|
|
18
|
+
displayName: string;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
6
21
|
//# sourceMappingURL=badge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/components/badge/badge.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/components/badge/badge.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAGzC,KAAK,KAAK,GAAG;IACX,OAAO,CAAC,EAAE,KAAK,CAAA;CAChB,GAAG,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAA;AAEzC,UAAU,MAAM;IACd,OAAO,CAAC,EAAE,IAAI,CAAA;CACf;AAED,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;AAE7F,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,KAAK,IAAI;IAC5D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,GAAG,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;CACtB,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,CAAA;AAEpB,eAAO,MAAM,KAAK;KAAI,CAAC,SAAS,KAAK,CAAC,WAAW,kEAMpC,UAAU,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO;;CAQ7C,CAAA"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
2
3
|
import classnames from "classnames";
|
|
3
4
|
import badge_module from "./badge.module.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
const Badge = ({ className, intent = 'primary', children, asChild, ref, ...rest })=>{
|
|
6
|
+
const Comp = true === asChild ? Slot : 'div';
|
|
7
|
+
return /*#__PURE__*/ jsx(Comp, {
|
|
8
|
+
ref: ref,
|
|
9
|
+
className: classnames('badge', intent, badge_module.badge, badge_module[intent], className),
|
|
10
|
+
...rest,
|
|
7
11
|
children: children
|
|
8
12
|
});
|
|
9
|
-
}
|
|
13
|
+
};
|
|
14
|
+
Badge.displayName = 'Badge';
|
|
10
15
|
export { Badge };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
|
|
2
|
+
type AsDiv = {
|
|
3
3
|
asChild?: false;
|
|
4
4
|
} & React.ComponentPropsWithoutRef<'div'>;
|
|
5
|
-
|
|
5
|
+
interface AsSlot {
|
|
6
6
|
asChild?: true;
|
|
7
7
|
}
|
|
8
8
|
export type CardRefType<C extends React.ElementType> = React.ComponentPropsWithRef<C>['ref'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../src/components/card/card.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../src/components/card/card.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,KAAK,KAAK,GAAG;IACX,OAAO,CAAC,EAAE,KAAK,CAAA;CAChB,GAAG,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAA;AAEzC,UAAU,MAAM;IACd,OAAO,CAAC,EAAE,IAAI,CAAA;CACf;AAED,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;AAE5F,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,KAAK,IAAI;IAC3D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,GAAG,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAA;CACrB,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,CAAA;AAEpB,QAAA,MAAM,IAAI;KAAI,CAAC,SAAS,KAAK,CAAC,WAAW,iEAOtC,SAAS,CAAC,CAAC,CAAC;;;uCAkB+B,UAAU;;;;uCAMX,UAAU;;;;uCASJ,UAAU;;;;uCAKd,UAAU;;;;uCAKX,UAAU;;;CAjCvD,CAAA;AAID,UAAU,UAAW,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC/D,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;CAChC;AAsCD,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,40 @@
|
|
|
1
|
+
import { Slot } from '@radix-ui/react-slot'
|
|
1
2
|
import cx from 'classnames'
|
|
2
3
|
import { Intent } from '../@types/shared'
|
|
3
4
|
import styles from './badge.module.css'
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
6
|
+
type AsDiv = {
|
|
7
|
+
asChild?: false
|
|
8
|
+
} & React.ComponentPropsWithoutRef<'div'>
|
|
9
|
+
|
|
10
|
+
interface AsSlot {
|
|
11
|
+
asChild?: true
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type BadgeRefType<C extends React.ElementType> = React.ComponentPropsWithRef<C>['ref']
|
|
15
|
+
|
|
16
|
+
export type BadgeProps<C extends React.ElementType = 'div'> = {
|
|
17
|
+
children: React.ReactNode
|
|
18
|
+
intent?: Intent
|
|
19
|
+
className?: string
|
|
20
|
+
asChild?: boolean
|
|
21
|
+
ref?: BadgeRefType<C>
|
|
22
|
+
} & (AsSlot | AsDiv)
|
|
23
|
+
|
|
24
|
+
export const Badge = <C extends React.ElementType = 'div'>({
|
|
25
|
+
className,
|
|
26
|
+
intent = 'primary',
|
|
27
|
+
children,
|
|
28
|
+
asChild,
|
|
29
|
+
ref,
|
|
30
|
+
...rest }: BadgeProps<C>): React.JSX.Element =>{
|
|
31
|
+
const Comp: React.ElementType = asChild === true ? Slot : 'div'
|
|
32
|
+
return (
|
|
33
|
+
<Comp
|
|
34
|
+
ref={ref} className={cx('badge', intent, styles.badge, styles[intent], className)} {...rest}>
|
|
35
|
+
{children}
|
|
36
|
+
</Comp>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
Badge.displayName = 'Badge'
|
|
@@ -4,11 +4,11 @@ import type React from 'react'
|
|
|
4
4
|
|
|
5
5
|
import styles from './card.module.css'
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
type AsDiv = {
|
|
8
8
|
asChild?: false
|
|
9
9
|
} & React.ComponentPropsWithoutRef<'div'>
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
interface AsSlot {
|
|
12
12
|
asChild?: true
|
|
13
13
|
}
|
|
14
14
|
|