@trackunit/react-components 0.0.123 → 0.0.124

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.
@@ -9,3 +9,4 @@ export interface CommonProps {
9
9
  dataTestId?: string;
10
10
  }
11
11
  export declare type Density = "none" | "compact" | "comfortable" | "spacious" | "auto";
12
+ export declare type Size = "small" | "medium" | "large";
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { CommonProps } from "../../common/CommonProps";
3
3
  import { Colors } from "../../constants/colors";
4
- export declare type BadgeSize = "default" | "large";
4
+ export declare type BadgeSize = "medium" | "large";
5
5
  interface BaseBadgeProps extends CommonProps {
6
6
  /**
7
7
  * The color of the badge.
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { CommonProps } from "../../common";
3
3
  declare type FilteredInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, "prefix" | "suffix">;
4
- declare type FieldSize = "small" | "default";
4
+ declare type FieldSize = "small" | "medium";
5
5
  export interface BaseInputProps extends FilteredInputProps, CommonProps {
6
6
  /**
7
7
  * An React element to render before the text in the input.
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { Matcher } from "react-day-picker";
3
- import { ButtonIntent, ButtonSize } from "../buttons";
3
+ import { Size } from "../../common";
4
+ import { ButtonIntent } from "../buttons";
4
5
  import { PopoverPlacement } from "../Popover";
5
6
  export interface DayPickerPopoverProps {
6
7
  disabledDays?: Matcher | Matcher[] | undefined;
@@ -8,7 +9,7 @@ export interface DayPickerPopoverProps {
8
9
  onDaySelect: (day: Date) => void;
9
10
  selectedDay?: Date;
10
11
  intent?: ButtonIntent;
11
- size?: ButtonSize;
12
+ size?: Size;
12
13
  placement?: PopoverPlacement;
13
14
  buttonContent: JSX.Element;
14
15
  language: string;
@@ -1,6 +1,6 @@
1
1
  import { HeroIconName, TrackunitIconName } from "@trackunit/ui-icons";
2
2
  import * as React from "react";
3
- import { CommonProps } from "../../common/CommonProps";
3
+ import { CommonProps, Size } from "../../common/CommonProps";
4
4
  import { Colors } from "../../constants/colors";
5
5
  export interface IconProps extends CommonProps {
6
6
  /**
@@ -16,14 +16,14 @@ export interface IconProps extends CommonProps {
16
16
  color?: Colors;
17
17
  /**
18
18
  * The size of the icon.
19
- * Small = 16x16px, Normal = 20x20px, Large = 24x24px.
19
+ * Small = 16x16px, medium = 20x20px, Large = 24x24px.
20
20
  * Default value is Large.
21
21
  * If a custom size is needed, set it in the className.
22
22
  */
23
- size?: "small" | "normal" | "large";
23
+ size?: Size;
24
24
  /**
25
25
  * Select if the icon should be rendered as solid or outline.
26
- * Default value depends on the Size prop, small == solid, normal == solid, large == outline.
26
+ * Default value depends on the Size prop, small == solid, medium == solid, large == outline.
27
27
  * Trackunit icons might not support both outline and Solid.
28
28
  */
29
29
  type?: "solid" | "outline";
@@ -8,7 +8,7 @@ export interface SelectOption {
8
8
  value: string;
9
9
  options?: SelectOption[];
10
10
  }
11
- export declare type SelectSize = "small" | "default";
11
+ export declare type SelectSize = "small" | "medium";
12
12
  export interface ISelectProps<Option, IsAsync extends boolean, IsMulti extends boolean, GroupType extends GroupBase<Option>> extends CommonProps, Props<Option, IsMulti, GroupType> {
13
13
  /**
14
14
  * Label to be displayed.
@@ -1,11 +1,10 @@
1
1
  /// <reference types="react" />
2
- import { CommonProps } from "../../common/CommonProps";
3
- export declare type SpinnerSize = "small" | "regular" | "large";
2
+ import { CommonProps, Size } from "../../common/CommonProps";
4
3
  export interface SpinnerProps extends CommonProps {
5
4
  /**
6
5
  * Defines the size of the spinner.
7
6
  */
8
- size?: SpinnerSize;
7
+ size?: Size;
9
8
  /**
10
9
  * When true, the spinner will be centered in the parent element using css grid.
11
10
  */
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { CommonProps } from "../../common/CommonProps";
3
3
  import { Colors } from "../../constants/colors";
4
- export declare type TagSize = "default" | "small";
4
+ export declare type TagSize = "small" | "medium";
5
5
  export interface TagProps extends CommonProps {
6
6
  /**
7
7
  * The color of the tag.
@@ -1,9 +1,8 @@
1
1
  import * as React from "react";
2
- import { CommonProps } from "../../common/CommonProps";
2
+ import { CommonProps, Size } from "../../common/CommonProps";
3
3
  export declare type TextType = "p" | "span" | "div";
4
- export declare type TextSize = "small" | "default" | "large";
5
4
  export declare type TextAlign = "left" | "center" | "right";
6
- export declare type TextWeight = "default" | "thick" | "bold";
5
+ export declare type TextWeight = "normal" | "thick" | "bold";
7
6
  export interface TextProps extends CommonProps {
8
7
  /**
9
8
  * Child nodes.
@@ -14,15 +13,15 @@ export interface TextProps extends CommonProps {
14
13
  */
15
14
  type?: TextType;
16
15
  /**
17
- * Size of element. Values can be "default", "small", or "large".
16
+ * Size of element. Values can be "small", "medium", or "large".
18
17
  */
19
- size?: TextSize;
18
+ size?: Size;
20
19
  /**
21
20
  * Alignment of the text. Values can be "left", "center", or "right".
22
21
  */
23
22
  align?: TextAlign;
24
23
  /**
25
- * Weight of the text. Values can be "default", "thick", or "bold".
24
+ * Weight of the text. Values can be "normal", "thick", or "bold".
26
25
  */
27
26
  weight?: TextWeight;
28
27
  /**
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { CommonProps } from "../../common/CommonProps";
3
3
  import "./Toggle.css";
4
- export declare type ToggleSize = "small" | "default";
4
+ export declare type ToggleSize = "small" | "medium";
5
5
  export interface ToggleProps extends CommonProps {
6
6
  /**
7
7
  * ID of the toggle.
@@ -1,8 +1,9 @@
1
1
  import * as React from "react";
2
- import { ButtonCommonProps, ButtonIntent, ButtonSize, ButtonType, ButtonVariant } from "../shared/ButtonProps";
2
+ import { Size } from "../../../common";
3
+ import { ButtonCommonProps, ButtonIntent, ButtonType, ButtonVariant } from "../shared/ButtonProps";
3
4
  export interface StyledButtonProps {
4
5
  $variant: ButtonVariant;
5
- $size: ButtonSize;
6
+ $size: Size;
6
7
  $square: boolean;
7
8
  $intent: ButtonIntent;
8
9
  $fullWidth: boolean;
@@ -1,6 +1,7 @@
1
1
  import * as React from "react";
2
+ import { Size } from "../../../common";
2
3
  import "../shared/Button.css";
3
- import { ButtonCommonProps, ButtonSize } from "../shared/ButtonProps";
4
+ import { ButtonCommonProps } from "../shared/ButtonProps";
4
5
  export interface IconButtonProps extends ButtonCommonProps {
5
6
  /**
6
7
  * The icon to display.
@@ -19,6 +20,6 @@ export interface IconButtonProps extends ButtonCommonProps {
19
20
  /**
20
21
  * The size of the button. Defaults to "small".
21
22
  */
22
- size?: ButtonSize;
23
+ size?: Size;
23
24
  }
24
25
  export declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
@@ -1,9 +1,8 @@
1
1
  /// <reference types="react" />
2
- import { CommonProps } from "../../../common/CommonProps";
2
+ import { CommonProps, Size } from "../../../common/CommonProps";
3
3
  export declare type ButtonVariant = "filled" | "transparent";
4
4
  export declare type ButtonIntent = "primary" | "secondary" | "danger" | "warning" | "tertiary";
5
5
  export declare type ButtonType = "button" | "submit";
6
- export declare type ButtonSize = "small" | "normal" | "large";
7
6
  export interface ButtonCommonProps extends CommonProps {
8
7
  onClick?: (event: React.MouseEvent<HTMLElement>) => void;
9
8
  /**
@@ -29,7 +28,7 @@ export interface ButtonCommonProps extends CommonProps {
29
28
  /**
30
29
  * The size of the button.
31
30
  */
32
- size?: ButtonSize;
31
+ size?: Size;
33
32
  /**
34
33
  * The link to be used for the button.
35
34
  */
@@ -1,8 +1,9 @@
1
- import { ButtonIntent, ButtonSize, ButtonVariant } from "./ButtonProps";
1
+ import { Size } from "../../../common";
2
+ import { ButtonIntent, ButtonVariant } from "./ButtonProps";
2
3
  interface ButtonProps {
3
4
  $intent: ButtonIntent;
4
5
  $variant: ButtonVariant;
5
- $size: ButtonSize;
6
+ $size: Size;
6
7
  }
7
8
  /**
8
9
  * Helper to get the needed classname from buttonProps.
package/index.css CHANGED
@@ -242,7 +242,7 @@
242
242
  transition-all;
243
243
  }
244
244
 
245
- &--default {
245
+ &--medium {
246
246
  @apply flex
247
247
  items-center
248
248
  p-1
package/index.js CHANGED
@@ -98,7 +98,7 @@ function __rest(s, e) {
98
98
 
99
99
  const Spinner = ({
100
100
  mode = "light",
101
- size = "regular",
101
+ size = "medium",
102
102
  centered = false,
103
103
  className,
104
104
  containerClassName,
@@ -129,7 +129,7 @@ const getSpinnerStyles = () => ({
129
129
  case "large":
130
130
  return tws`tu-spinner--large`;
131
131
 
132
- case "regular":
132
+ case "medium":
133
133
  default:
134
134
  return;
135
135
  }
@@ -214,7 +214,7 @@ const Button = React.forwardRef((_a, ref) => {
214
214
  intent = "primary",
215
215
  variant = "filled",
216
216
  type = "button",
217
- size = "normal",
217
+ size = "medium",
218
218
  square = false,
219
219
  dataTestId,
220
220
  title,
@@ -335,9 +335,9 @@ const activityColors = {
335
335
  const colors = Object.assign(Object.assign(Object.assign(Object.assign({}, generalColors), intentColors), criticalityColors), activityColors);
336
336
 
337
337
  const IconSizeClassMap = {
338
- small: tws`w-4`,
339
- normal: tws`w-5`,
340
- large: tws`w-6` // 24x24px
338
+ small: tws`tu-icon--small`,
339
+ medium: tws`tu-icon--medium`,
340
+ large: tws`tu-icon--large` // 24x24px
341
341
 
342
342
  };
343
343
  /**
@@ -398,72 +398,58 @@ const Icon$1 = ({
398
398
  }));
399
399
  };
400
400
  const LoadingDot = tw.span`
401
- relative
402
- aspect-square
403
-
404
- after:content-['']
405
- after:absolute
406
- after:h-2
407
- after:w-2
408
- after:bg-current
409
- after:rounded-full
410
- after:inset-1/2
411
- after:-translate-x-1/2
412
- after:-translate-y-1/2
413
- after:opacity-50
401
+ tu-loading-dot
414
402
  `;
415
403
  const Root$3 = tw.span`
416
- inline
417
- relative
418
-
404
+ tu-icon
419
405
  ${({
420
406
  $color
421
407
  }) => {
422
408
  switch ($color) {
423
409
  case colors.PRIMARY:
424
- return tws`text-primary-600`;
410
+ return tws`tu-icon--primary`;
425
411
 
426
412
  case colors.ACCENT:
427
- return tws`text-accent-600`;
413
+ return tws`tu-icon--accent`;
428
414
 
429
415
  case colors.NEUTRAL:
430
- return tws`text-neutral-600`;
416
+ return tws`tu-icon--neutral`;
431
417
 
432
418
  case colors.INFO:
433
- return tws`text-info-600`;
419
+ return tws`tu-icon--info`;
434
420
 
435
421
  case colors.SUCCESS:
436
- return tws`text-success-600`;
422
+ return tws`tu-icon--success`;
437
423
 
438
424
  case colors.WARNING:
439
- return tws`text-warning-600`;
425
+ return tws`tu-icon--warning`;
440
426
 
441
427
  case colors.DANGER:
442
- return tws`text-danger-600`;
428
+ return tws`tu-icon--danger`;
443
429
 
444
430
  case colors.GOOD:
445
- return tws`text-good-600`;
431
+ return tws`tu-icon--good`;
446
432
 
447
433
  case colors.LOW:
448
- return tws`text-low-600`;
434
+ return tws`tu-icon--low`;
449
435
 
450
436
  case colors.CRITICAL:
451
- return tws`text-critical-600`;
437
+ return tws`tu-icon--critical`;
452
438
 
453
439
  case colors.WORKING:
454
- return tws`text-working-600`;
440
+ return tws`tu-icon--working`;
455
441
 
456
442
  case colors.IDLE:
457
- return tws`text-idle-600`;
443
+ return tws`tu-icon--idle`;
458
444
 
459
445
  case colors.STOPPED:
460
- return tws`text-stopped-600`;
446
+ return tws`tu-icon--stopped`;
461
447
 
462
448
  case colors.UNKNOWN:
463
- return tws`text-unknown-600`;
449
+ return tws`tu-icon--unknown`;
464
450
 
465
451
  default:
466
- return "text-current";
452
+ return "tu-icon--default";
467
453
  }
468
454
  }}
469
455
  `;
@@ -516,9 +502,9 @@ const CustomIcon = tw(Icon$1)`
516
502
  const Text = ({
517
503
  children,
518
504
  type = "p",
519
- size = "default",
505
+ size = "medium",
520
506
  align = "left",
521
- weight = "default",
507
+ weight = "normal",
522
508
  underline = false,
523
509
  inverted = false,
524
510
  subtle = false,
@@ -664,7 +650,7 @@ const Alert = ({
664
650
  }, {
665
651
  children: title !== null && title !== void 0 ? title : children
666
652
  })), children && jsx(Description$2, Object.assign({
667
- weight: !title ? "bold" : "default",
653
+ weight: !title ? "bold" : "normal",
668
654
  "$hasTitle": !!title
669
655
  }, {
670
656
  children: children
@@ -675,7 +661,7 @@ const Alert = ({
675
661
  }, {
676
662
  children: title !== null && title !== void 0 ? title : children
677
663
  })), children && jsx(Description$2, Object.assign({
678
- weight: !title ? "bold" : "default",
664
+ weight: !title ? "bold" : "normal",
679
665
  "$hasTitle": !!title
680
666
  }, {
681
667
  children: children
@@ -816,7 +802,7 @@ const Badge = _a => {
816
802
  max,
817
803
  hideZero = false,
818
804
  dataTestId,
819
- size = "default"
805
+ size = "medium"
820
806
  } = _a;
821
807
  __rest(_a, ["color", "subtle", "className", "count", "max", "hideZero", "dataTestId", "size"]);
822
808
 
@@ -843,7 +829,7 @@ const getSizeModifierClass$1 = () => ({
843
829
  }) => {
844
830
  const sizeModifierClass = {
845
831
  large: tws`tu-badge--large`,
846
- default: ""
832
+ medium: ""
847
833
  };
848
834
  return sizeModifierClass[$size];
849
835
  };
@@ -899,7 +885,7 @@ const BaseInput = React.forwardRef((_a, ref) => {
899
885
  addonBefore,
900
886
  addonAfter,
901
887
  actions,
902
- fieldSize = "default"
888
+ fieldSize = "medium"
903
889
  } = _a,
904
890
  rest = __rest(_a, ["className", "isInvalid", "dataTestId", "prefix", "suffix", "addonBefore", "addonAfter", "actions", "fieldSize"]);
905
891
 
@@ -1633,7 +1619,7 @@ const Collapse = ({
1633
1619
  size: "small",
1634
1620
  "$expanded": expanded
1635
1621
  }),
1636
- size: "normal",
1622
+ size: "medium",
1637
1623
  variant: "transparent",
1638
1624
  intent: "secondary"
1639
1625
  })]
@@ -2049,7 +2035,7 @@ const DateInput = forwardRef((_a, ref) => {
2049
2035
  suffix: jsx(Icon$1, {
2050
2036
  dataTestId: "calendar",
2051
2037
  name: "CalendarIcon",
2052
- size: "normal",
2038
+ size: "medium",
2053
2039
  type: "solid",
2054
2040
  onClick: !disabled ? onShow : undefined,
2055
2041
  forwardedRef: targetRef
@@ -2143,7 +2129,7 @@ const PopoverListItem = ({
2143
2129
  children: [prefix && jsx("div", {
2144
2130
  children: prefix
2145
2131
  }), jsx(StyledText$2, Object.assign({
2146
- weight: selected ? "bold" : "default",
2132
+ weight: selected ? "bold" : "normal",
2147
2133
  "$selected": selected
2148
2134
  }, {
2149
2135
  children: children
@@ -2320,7 +2306,7 @@ const Tip = _a => {
2320
2306
  }, {
2321
2307
  children: jsx(Icon$1, Object.assign({
2322
2308
  name: "QuestionMarkCircleIcon",
2323
- size: "normal",
2309
+ size: "medium",
2324
2310
  dataTestId: `${dataTestId}-icon`
2325
2311
  }, iconProps))
2326
2312
  }))
@@ -3158,7 +3144,7 @@ const Tag = React.forwardRef((_a, ref) => {
3158
3144
  className,
3159
3145
  dataTestId,
3160
3146
  children,
3161
- size = "default",
3147
+ size = "medium",
3162
3148
  onClose,
3163
3149
  color = "primary"
3164
3150
  } = _a;
@@ -3184,7 +3170,7 @@ const Tag = React.forwardRef((_a, ref) => {
3184
3170
  style: {
3185
3171
  "-webkit-transition": "-webkit-transform 0.150s"
3186
3172
  },
3187
- className: size === "default" ? tws`tu-tag__icon` : tws`tu-tag__icon tu-tag__icon--small`
3173
+ className: size === "medium" ? tws`tu-tag__icon` : tws`tu-tag__icon tu-tag__icon--small`
3188
3174
  })
3189
3175
  }))]
3190
3176
  }));
@@ -3195,7 +3181,7 @@ const getSizeModifierClass = () => ({
3195
3181
  $withXIcon
3196
3182
  }) => {
3197
3183
  const tagSizeModifierClass = {
3198
- default: $withXIcon ? tws`tu-tag--with-icon ` : tws` `,
3184
+ medium: $withXIcon ? tws`tu-tag--with-icon ` : tws` `,
3199
3185
  small: $withXIcon ? tws`tu-tag--small tu-tag--with-icon` : tws`tu-tag--small`
3200
3186
  };
3201
3187
  return tagSizeModifierClass[$size];
@@ -3631,7 +3617,7 @@ const useCustomComponents = components => {
3631
3617
  const CreatableSelect = _a => {
3632
3618
  var {
3633
3619
  dataTestId,
3634
- size = "default",
3620
+ size = "medium",
3635
3621
  id,
3636
3622
  label,
3637
3623
  hideLabel,
@@ -3688,7 +3674,7 @@ const CreatableSelect = _a => {
3688
3674
  const Select = _a => {
3689
3675
  var {
3690
3676
  dataTestId,
3691
- size = "default",
3677
+ size = "medium",
3692
3678
  id,
3693
3679
  label,
3694
3680
  hideLabel,
@@ -4097,7 +4083,7 @@ const Toggle = React.forwardRef(({
4097
4083
  toggled = false,
4098
4084
  onChange,
4099
4085
  disabled,
4100
- size = "default",
4086
+ size = "medium",
4101
4087
  id,
4102
4088
  tabIndex,
4103
4089
  required,
@@ -4180,7 +4166,7 @@ tu-toggle__switch-container
4180
4166
  }) => $disabled && tws`tu-toggle--disabled`};
4181
4167
  ${({
4182
4168
  $size
4183
- }) => $size === "small" ? tws`tu-toggle--small` : tws`tu-toggle--default`};
4169
+ }) => $size === "small" ? tws`tu-toggle--small` : tws`tu-toggle--medium`};
4184
4170
  ${({
4185
4171
  $toggled
4186
4172
  }) => $toggled && tws`tu-toggle--toggled`}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.0.123",
3
+ "version": "0.0.124",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "dependencies": {