@trackunit/react-components 0.0.42 → 0.0.45

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.
@@ -1,47 +1,47 @@
1
1
  import * as React from "react";
2
2
  import { CommonProps } from "../../common/CommonProps";
3
- export declare type BadgeIntent = "primary" | "secondary" | "success" | "danger" | "warning";
3
+ import { Colors } from "../../constants/colors";
4
4
  export declare type BadgeSize = "default" | "large";
5
5
  declare type BadgeVariant = "badge" | "pill" | "tag";
6
6
  export interface TagProps extends BaseBadgeProps {
7
7
  /**
8
8
  * The name of the variant.
9
9
  *
10
- * @type string}
11
10
  * @memberof TagProps
12
11
  */
13
12
  variant: "tag";
14
13
  /**
15
14
  * A handler for a click event triggered on x icon
16
15
  * if not passed then x icon won't be visible
17
- * @type {() => void}
16
+ *
17
+ * @type () => void
18
18
  * @memberof TagProps
19
19
  */
20
20
  onClose?: () => void;
21
21
  }
22
22
  export interface BaseBadgeProps extends CommonProps {
23
23
  /**
24
- * The intent of the badge.
24
+ * The color of the badge.
25
25
  *
26
- * @type {BadgeIntent}
26
+ * @type "primary" | "accent" | "neutral" | "info" | "success" | "warning" | "danger" | "good" | "low" | "critical" | "working" | "idle" | "stopped" | "unknown"
27
27
  * @memberof BadgeProps
28
28
  */
29
- intent?: BadgeIntent;
29
+ color?: Colors;
30
30
  /**
31
- * Specifies whether the intent style should be subtle or not.
31
+ * Specifies whether the badge is subtle or not.
32
+ * Subtle badges have a light background color wither a darker text color.
32
33
  *
33
- * @type {boolean}
34
+ * @type boolean
34
35
  * @memberof BadgeProps
35
36
  */
36
37
  subtle?: boolean;
37
38
  /**
38
- * Whether badge should be displayed as a pill, tag or badge
39
- * pill numeric values above 99 will be displayed as 99+.
40
- * tag will display x icon, you have to provide onClose handler
41
- *
42
- * Badge will use subtle intent by default.
39
+ * Whether badge should be displayed as a pill, tag or badge.
40
+ * For the pill variant, numeric values above 99 will be displayed as 99+.
41
+ * Tag will display x icon if you provide onClose handler.
42
+ * Badge is subtle by default.
43
43
  *
44
- * @type {BadgeVariant}
44
+ * @type "badge" | "pill" | "tag"
45
45
  * @memberof BadgeProps
46
46
  */
47
47
  variant?: BadgeVariant;
@@ -64,11 +64,11 @@ export interface BaseBadgeProps extends CommonProps {
64
64
  /**
65
65
  * Size of the badge.
66
66
  *
67
- * @type {BadgeSize}
67
+ * @type "default" | "large"
68
68
  * @memberof BadgeProps
69
69
  */
70
70
  size?: BadgeSize;
71
71
  }
72
72
  export declare type BadgeProps = BaseBadgeProps | TagProps;
73
- export declare const Badge: ({ intent, subtle, className, variant, dataTestId, children, size, ...rest }: BadgeProps) => JSX.Element;
73
+ export declare const Badge: ({ color, subtle, className, variant, dataTestId, children, size, ...rest }: BadgeProps) => JSX.Element;
74
74
  export {};
package/index.js CHANGED
@@ -697,7 +697,7 @@ const IconContainer = tw.div`
697
697
 
698
698
  const Badge = _a => {
699
699
  var {
700
- intent = "secondary",
700
+ color = "neutral",
701
701
  subtle = false,
702
702
  className,
703
703
  variant = "badge",
@@ -705,14 +705,14 @@ const Badge = _a => {
705
705
  children,
706
706
  size = "default"
707
707
  } = _a,
708
- rest = __rest(_a, ["intent", "subtle", "className", "variant", "dataTestId", "children", "size"]);
708
+ rest = __rest(_a, ["color", "subtle", "className", "variant", "dataTestId", "children", "size"]);
709
709
 
710
710
  const isPill = variant === "pill";
711
711
  const tagProps = rest;
712
712
  return jsxs(StyledText$2, Object.assign({
713
713
  "$variant": variant,
714
714
  className: className,
715
- "$intent": intent,
715
+ "$color": color,
716
716
  "$size": size,
717
717
  "$subtle": subtle ? subtle : isPill,
718
718
  "data-testid": dataTestId,
@@ -746,17 +746,26 @@ const getSizeModifierClass = () => ({
746
746
  };
747
747
 
748
748
  const getBadgeModifierClass = () => ({
749
- $intent,
749
+ $color,
750
750
  $subtle
751
751
  }) => {
752
- const intentClass = {
752
+ const colorClasses = {
753
753
  primary: $subtle ? tws`badge--primary-subtle` : tws`badge--primary`,
754
- secondary: $subtle ? tws`badge--secondary-subtle` : tws`badge--secondary`,
754
+ accent: $subtle ? tws`badge--accent-subtle` : tws`badge--accent`,
755
755
  success: $subtle ? tws`badge--success-subtle` : tws`badge--success`,
756
756
  danger: $subtle ? tws`badge--danger-subtle` : tws`badge--danger`,
757
- warning: $subtle ? tws`badge--warning-subtle` : tws`badge--warning`
757
+ warning: $subtle ? tws`badge--warning-subtle` : tws`badge--warning`,
758
+ info: $subtle ? tws`badge--info-subtle` : tws`badge--info`,
759
+ neutral: $subtle ? tws`badge--neutral-subtle` : tws`badge--neutral`,
760
+ good: $subtle ? tws`badge--good-subtle` : tws`badge--good`,
761
+ low: $subtle ? tws`badge--low-subtle` : tws`badge--low`,
762
+ critical: $subtle ? tws`badge--critical-subtle` : tws`badge--critical`,
763
+ working: $subtle ? tws`badge--working-subtle` : tws`badge--working`,
764
+ idle: $subtle ? tws`badge--idle-subtle` : tws`badge--idle`,
765
+ stopped: $subtle ? tws`badge--stopped-subtle` : tws`badge--stopped`,
766
+ unknown: $subtle ? tws`badge--unknown-subtle` : tws`badge--unknown`
758
767
  };
759
- return intentClass[$intent];
768
+ return colorClasses[$color];
760
769
  };
761
770
 
762
771
  const StyledText$2 = tw.text`
@@ -3038,7 +3047,7 @@ const PageHeading = ({
3038
3047
  }, {
3039
3048
  children: title
3040
3049
  })), badge && jsx(Badge, Object.assign({
3041
- intent: "primary"
3050
+ color: "primary"
3042
3051
  }, {
3043
3052
  children: badge
3044
3053
  }))]
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.0.42",
3
+ "version": "0.0.45",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "MIT",
6
6
  "dependencies": {
7
7
  "@trackunit/css-core": "0.0.38",
8
8
  "@trackunit/tailwind-styled-components": "0.0.36",
9
9
  "react": "17.0.1",
10
- "@trackunit/ui-design-tokens": "0.0.34",
10
+ "@trackunit/ui-design-tokens": "0.0.35",
11
11
  "echarts-for-react": "^3.0.2",
12
12
  "uuid": "^8.3.2",
13
13
  "@react-spring/web": "^9.4.4",
14
14
  "react-use": "^17.3.2",
15
15
  "react-day-picker": "^8.0.3",
16
16
  "date-fns": "^2.28.0",
17
- "@trackunit/ui-icons": "0.0.34",
17
+ "@trackunit/ui-icons": "0.0.35",
18
18
  "react-useportal": "^1.0.16",
19
19
  "react-helmet": "^6.1.0",
20
20
  "@popperjs/core": "^2.11.4",
@@ -1,32 +0,0 @@
1
- import * as React from "react";
2
- import { CommonProps } from "../../common/CommonProps";
3
- export interface DrawerProps extends CommonProps {
4
- /**
5
- * Child nodes
6
- *
7
- * @type React.ReactNode
8
- * @memberof DrawerProps
9
- */
10
- children: React.ReactNode;
11
- /**
12
- * Whether the drawer is open or not.
13
- *
14
- * @type {boolean}
15
- * @memberof DrawerProps
16
- */
17
- isOpen?: boolean;
18
- /**
19
- * OnClose event.
20
- *
21
- * @memberof DrawerProps
22
- */
23
- onClose?: () => void;
24
- /**
25
- * Whether the drawer is displayed in-line or not.
26
- *
27
- * @type {boolean}
28
- * @memberof DrawerProps
29
- */
30
- inline?: boolean;
31
- }
32
- export declare const Drawer: ({ children, isOpen, onClose, inline, className, dataTestId }: DrawerProps) => JSX.Element;
@@ -1 +0,0 @@
1
- export * from "./Drawer";