colibri-ui 0.8.98 → 0.8.99

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.
Files changed (113) hide show
  1. package/Accordion/index.js +4 -2
  2. package/Accordion/index.props.d.ts +2 -1
  3. package/Avatar/index.js +2 -5
  4. package/Avatar/index.props.d.ts +2 -1
  5. package/Badge/Control/index.props.d.ts +2 -1
  6. package/Badge/index.js +1 -2
  7. package/Button/index.js +0 -1
  8. package/Checkbox/index.js +4 -2
  9. package/Checkbox/index.props.d.ts +2 -1
  10. package/Chip/index.js +2 -4
  11. package/Chip/index.props.d.ts +2 -2
  12. package/ColorPicker/ColorPicker.d.ts +1 -1
  13. package/ColorPicker/ColorPicker.js +4 -2
  14. package/ColorPicker/index.props.d.ts +2 -1
  15. package/Counter/index.js +4 -2
  16. package/Counter/index.props.d.ts +2 -1
  17. package/Datepicker/index.d.ts +1 -1
  18. package/Datepicker/index.js +5 -3
  19. package/Datepicker/index.props.d.ts +2 -1
  20. package/DotsLoader/index.js +5 -2
  21. package/DotsLoader/index.props.d.ts +2 -1
  22. package/Dropdown/index.js +2 -2
  23. package/Dropdown/index.props.d.ts +2 -1
  24. package/Grid/index.js +3 -1
  25. package/Grid/index.props.d.ts +2 -1
  26. package/InputRadio/index.js +3 -3
  27. package/InputRadio/index.props.d.ts +2 -2
  28. package/Menu/components/MenuItem/index.js +0 -1
  29. package/Menu/components/MenuItem/index.props.d.ts +2 -1
  30. package/Menu/index.d.ts +1 -1
  31. package/Menu/index.js +4 -2
  32. package/Menu/index.props.d.ts +2 -1
  33. package/Modal/index.js +3 -1
  34. package/Modal/index.props.d.ts +2 -1
  35. package/MultiSelect/index.js +3 -1
  36. package/RadioGroup/Radio.js +2 -2
  37. package/RadioGroup/index.js +1 -1
  38. package/RadioGroup/index.props.d.ts +1 -1
  39. package/Select/index.d.ts +1 -1
  40. package/Select/index.js +4 -3
  41. package/Separator/index.js +6 -4
  42. package/Separator/index.props.d.ts +2 -1
  43. package/Skeleton/index.js +6 -2
  44. package/Skeleton/index.props.d.ts +3 -2
  45. package/Status/index.d.ts +1 -1
  46. package/Status/index.js +3 -1
  47. package/Status/index.props.d.ts +2 -1
  48. package/TextArea/index.js +0 -1
  49. package/TimeSelect/index.js +3 -1
  50. package/Tooltip/index.js +3 -1
  51. package/Tooltip/index.props.d.ts +2 -1
  52. package/base/FormField/index.d.ts +1 -1
  53. package/base/FormField/index.js +4 -2
  54. package/base/FormField/index.props.d.ts +2 -1
  55. package/esm/Accordion/index.js +4 -2
  56. package/esm/Accordion/index.props.d.ts +2 -1
  57. package/esm/Avatar/index.js +2 -5
  58. package/esm/Avatar/index.props.d.ts +2 -1
  59. package/esm/Badge/Control/index.props.d.ts +2 -1
  60. package/esm/Badge/index.js +1 -2
  61. package/esm/Button/index.js +0 -1
  62. package/esm/Checkbox/index.js +4 -2
  63. package/esm/Checkbox/index.props.d.ts +2 -1
  64. package/esm/Chip/index.js +2 -4
  65. package/esm/Chip/index.props.d.ts +2 -2
  66. package/esm/ColorPicker/ColorPicker.d.ts +1 -1
  67. package/esm/ColorPicker/ColorPicker.js +4 -2
  68. package/esm/ColorPicker/index.props.d.ts +2 -1
  69. package/esm/Counter/index.js +4 -2
  70. package/esm/Counter/index.props.d.ts +2 -1
  71. package/esm/Datepicker/index.d.ts +1 -1
  72. package/esm/Datepicker/index.js +5 -3
  73. package/esm/Datepicker/index.props.d.ts +2 -1
  74. package/esm/DotsLoader/index.js +5 -2
  75. package/esm/DotsLoader/index.props.d.ts +2 -1
  76. package/esm/Dropdown/index.js +2 -2
  77. package/esm/Dropdown/index.props.d.ts +2 -1
  78. package/esm/Grid/index.js +3 -1
  79. package/esm/Grid/index.props.d.ts +2 -1
  80. package/esm/InputRadio/index.js +3 -3
  81. package/esm/InputRadio/index.props.d.ts +2 -2
  82. package/esm/Menu/components/MenuItem/index.js +0 -1
  83. package/esm/Menu/components/MenuItem/index.props.d.ts +2 -1
  84. package/esm/Menu/index.d.ts +1 -1
  85. package/esm/Menu/index.js +4 -2
  86. package/esm/Menu/index.props.d.ts +2 -1
  87. package/esm/Modal/index.js +3 -1
  88. package/esm/Modal/index.props.d.ts +2 -1
  89. package/esm/MultiSelect/index.js +3 -1
  90. package/esm/RadioGroup/Radio.js +2 -2
  91. package/esm/RadioGroup/index.js +1 -1
  92. package/esm/RadioGroup/index.props.d.ts +1 -1
  93. package/esm/Select/index.d.ts +1 -1
  94. package/esm/Select/index.js +4 -3
  95. package/esm/Separator/index.js +6 -4
  96. package/esm/Separator/index.props.d.ts +2 -1
  97. package/esm/Skeleton/index.js +6 -2
  98. package/esm/Skeleton/index.props.d.ts +3 -2
  99. package/esm/Status/index.d.ts +1 -1
  100. package/esm/Status/index.js +3 -1
  101. package/esm/Status/index.props.d.ts +2 -1
  102. package/esm/TextArea/index.js +0 -1
  103. package/esm/TimeSelect/index.js +3 -1
  104. package/esm/Tooltip/index.js +3 -1
  105. package/esm/Tooltip/index.props.d.ts +2 -1
  106. package/esm/base/FormField/index.d.ts +1 -1
  107. package/esm/base/FormField/index.js +4 -2
  108. package/esm/base/FormField/index.props.d.ts +2 -1
  109. package/esm/helpers/testId.d.ts +18 -0
  110. package/esm/index.d.ts +1 -0
  111. package/helpers/testId.d.ts +18 -0
  112. package/index.d.ts +1 -0
  113. package/package.json +1 -1
@@ -1,3 +1,3 @@
1
1
  import type { JSX } from "react";
2
2
  import type { SelectProps } from "./index.props";
3
- export declare const Select: <T extends string>({ options, value, name, zIndex, fontSize, label, hint, hasError, required, placeholder, disabled, size, fullWidth, customInputRoot, className, onChange, "aria-label": ariaLabel, }: SelectProps<T>) => JSX.Element;
3
+ export declare const Select: <T extends string>({ options, value, name, zIndex, fontSize, label, hint, hasError, required, placeholder, disabled, size, fullWidth, customInputRoot, className, onChange, "aria-label": ariaLabel, "data-testid": testId, }: SelectProps<T>) => JSX.Element;
@@ -24,7 +24,8 @@ const Select = ({
24
24
  customInputRoot,
25
25
  className,
26
26
  onChange,
27
- "aria-label": ariaLabel
27
+ "aria-label": ariaLabel,
28
+ "data-testid": testId
28
29
  }) => {
29
30
  const [isOpen, setIsOpen] = useState(false);
30
31
  const id = useId();
@@ -48,6 +49,7 @@ const Select = ({
48
49
  }) => selected)) === null || _a === void 0 ? void 0 : _a.label;
49
50
  }, [preparedOptions]);
50
51
  return /*#__PURE__*/React.createElement(FormField, {
52
+ "data-testid": testId,
51
53
  className: clsx(styles["form-field"], {
52
54
  [styles["full-width"]]: Boolean(fullWidth)
53
55
  }, className),
@@ -96,8 +98,7 @@ const Select = ({
96
98
  disabled: Boolean(disabled)
97
99
  }, /*#__PURE__*/React.createElement("div", {
98
100
  id: valueId,
99
- className: styles["base-input"],
100
- "data-testid": "base-input"
101
+ className: styles["base-input"]
101
102
  }, preparedLabel !== null && preparedLabel !== void 0 ? preparedLabel : (/*#__PURE__*/React.createElement("span", {
102
103
  className: styles.placeholder
103
104
  }, placeholder))), /*#__PURE__*/React.createElement("input", {
@@ -3,9 +3,11 @@ import clsx from 'clsx';
3
3
  import styles from './Separator.module.css';
4
4
 
5
5
  const Separator = ({
6
- className
7
- }) => (/*#__PURE__*/React.createElement("div", {
8
- className: clsx(styles.root, className)
9
- }));
6
+ className,
7
+ "data-testid": testId
8
+ }) => /*#__PURE__*/React.createElement("div", {
9
+ className: clsx(styles.root, className),
10
+ "data-testid": testId
11
+ });
10
12
 
11
13
  export { Separator };
@@ -1,3 +1,4 @@
1
- export type SeparatorProps = {
1
+ import type { TestIdProps } from "../helpers/testId";
2
+ export type SeparatorProps = TestIdProps & {
2
3
  className?: string;
3
4
  };
@@ -7,9 +7,11 @@ const SkeletonRect = ({
7
7
  className,
8
8
  width,
9
9
  height,
10
- radius = "sm"
10
+ radius = "sm",
11
+ "data-testid": testId
11
12
  }) => (/*#__PURE__*/React.createElement("div", {
12
13
  className: clsx(styles.rect, className),
14
+ "data-testid": testId,
13
15
  style: {
14
16
  width: toRemLength(width),
15
17
  height: toRemLength(height),
@@ -19,9 +21,11 @@ const SkeletonRect = ({
19
21
  const SkeletonText = ({
20
22
  className,
21
23
  width,
22
- size
24
+ size,
25
+ "data-testid": testId
23
26
  }) => (/*#__PURE__*/React.createElement("div", {
24
27
  className: clsx(styles.text, className),
28
+ "data-testid": testId,
25
29
  style: {
26
30
  width: toRemLength(width),
27
31
  height: toRemLength(size)
@@ -1,9 +1,10 @@
1
- export type TextProps = {
1
+ import type { TestIdProps } from "../helpers/testId";
2
+ export type TextProps = TestIdProps & {
2
3
  className?: string;
3
4
  width?: number | string;
4
5
  size?: number | string;
5
6
  };
6
- export type RectProps = {
7
+ export type RectProps = TestIdProps & {
7
8
  className?: string;
8
9
  width?: number | string;
9
10
  height?: number | string;
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import type { PropsWithChildren } from "react";
3
3
  import type { StatusProps } from "./index.props";
4
- export declare const Status: ({ className, indicator, showIndicator, tag: Component, children, type, }: PropsWithChildren<StatusProps>) => React.JSX.Element;
4
+ export declare const Status: ({ className, indicator, showIndicator, tag: Component, children, type, "data-testid": testId, }: PropsWithChildren<StatusProps>) => React.JSX.Element;
@@ -8,8 +8,10 @@ const Status = ({
8
8
  showIndicator = true,
9
9
  tag: Component = "span",
10
10
  children,
11
- type
11
+ type,
12
+ "data-testid": testId
12
13
  }) => (/*#__PURE__*/React.createElement(Component, {
14
+ "data-testid": testId,
13
15
  className: clsx(styles.root, {
14
16
  [styles[`root_${type}`]]: Boolean(type)
15
17
  }, className)
@@ -1,4 +1,5 @@
1
1
  import type { ReactNode } from "react";
2
+ import type { TestIdProps } from "../helpers/testId";
2
3
  export type StatusTag = "span" | "div";
3
4
  export declare enum STATUS_TYPE {
4
5
  SUCCESS = "success",
@@ -6,7 +7,7 @@ export declare enum STATUS_TYPE {
6
7
  INFO = "info",
7
8
  WARNING = "warning"
8
9
  }
9
- export type StatusProps = {
10
+ export type StatusProps = TestIdProps & {
10
11
  className?: string;
11
12
  indicator?: ReactNode;
12
13
  showIndicator?: boolean;
@@ -44,7 +44,6 @@ const TextArea = _a => {
44
44
  hasError: hasError
45
45
  }, /*#__PURE__*/React.createElement(TextareaAutosize, Object.assign({
46
46
  ref: inputRef,
47
- "data-testid": "textarea",
48
47
  disabled: disabled,
49
48
  minRows: minRows,
50
49
  maxRows: maxRows,
@@ -23,7 +23,8 @@ const TimeSelect = ({
23
23
  zIndex,
24
24
  hasError,
25
25
  hint,
26
- "aria-label": ariaLabel
26
+ "aria-label": ariaLabel,
27
+ "data-testid": testId
27
28
  }) => {
28
29
  const baseOptions = useMemo(() => generateSuggest(interval).map(item => ({
29
30
  value: item.time,
@@ -39,6 +40,7 @@ const TimeSelect = ({
39
40
  }), [baseOptions, currentDate, selectedDate, allowedTimeRange, interval]);
40
41
  return /*#__PURE__*/React.createElement(Select, {
41
42
  "aria-label": ariaLabel,
43
+ "data-testid": testId,
42
44
  className: className,
43
45
  customInputRoot: customInputRoot,
44
46
  fontSize: fontSize,
@@ -10,7 +10,8 @@ const Tooltip = ({
10
10
  withTail = false,
11
11
  placement = "bottom",
12
12
  strategy = "absolute",
13
- className
13
+ className,
14
+ "data-testid": testId
14
15
  }) => {
15
16
  const [isOpen, setIsOpen] = useState(false);
16
17
  const arrowRef = useRef(null);
@@ -58,6 +59,7 @@ const Tooltip = ({
58
59
  ref: refs.setFloating
59
60
  }, getFloatingProps(), {
60
61
  className: clsx(styles.tooltip, className),
62
+ "data-testid": testId,
61
63
  style: Object.assign(Object.assign({}, floatingStyles), {
62
64
  zIndex
63
65
  })
@@ -1,6 +1,7 @@
1
1
  import type { Placement, Strategy } from "@floating-ui/react";
2
2
  import type { ReactNode } from "react";
3
- export type TooltipProps = {
3
+ import type { PopupTestIdProps } from "../helpers/testId";
4
+ export type TooltipProps = PopupTestIdProps & {
4
5
  content: ReactNode;
5
6
  zIndex?: number;
6
7
  placement?: Placement;
@@ -1,3 +1,3 @@
1
1
  import React from "react";
2
2
  import type { FormFieldProps } from "./index.props";
3
- export declare const FormField: ({ label, hint, children, hasError, hintId, htmlFor, labelId, required, className, ref, }: FormFieldProps) => React.JSX.Element;
3
+ export declare const FormField: ({ label, hint, children, hasError, hintId, htmlFor, labelId, required, className, ref, "data-testid": testId, }: FormFieldProps) => React.JSX.Element;
@@ -13,10 +13,12 @@ const FormField = ({
13
13
  labelId,
14
14
  required,
15
15
  className,
16
- ref
16
+ ref,
17
+ "data-testid": testId
17
18
  }) => (/*#__PURE__*/React.createElement("div", {
18
19
  className: clsx(styles.container, className),
19
- ref: ref
20
+ ref: ref,
21
+ "data-testid": testId
20
22
  }, label && (/*#__PURE__*/React.createElement(Typography, {
21
23
  className: clsx(styles.label, {
22
24
  [styles.label_required]: Boolean(required)
@@ -1,6 +1,7 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { PropsWithChildren } from "react";
3
- export type FormFieldProps = PropsWithChildren<{
3
+ import type { TestIdProps } from "../../helpers/testId";
4
+ export type FormFieldProps = PropsWithChildren<TestIdProps & {
4
5
  className?: string;
5
6
  hasError?: boolean;
6
7
  hint?: ReactNode;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * A test id a consumer gives a component; the component puts it on its own
3
+ * root element. Fields put it on the native control. Components set no test
4
+ * id of their own. A component without a root of its own takes
5
+ * `PopupTestIdProps` instead.
6
+ */
7
+ export type TestIdProps = {
8
+ "data-testid"?: string;
9
+ };
10
+ /**
11
+ * A test id of a popup (`Dropdown`, `Tooltip`): it names the floating panel,
12
+ * which is in the DOM only while open. The trigger is the consumer's own
13
+ * element and keeps its own `data-testid`; the component never writes one on
14
+ * it.
15
+ */
16
+ export type PopupTestIdProps = {
17
+ "data-testid"?: string;
18
+ };
package/esm/index.d.ts CHANGED
@@ -97,3 +97,4 @@ export type { TypographyFontWeight, TypographyProps, TypographyResponsiveSize, T
97
97
  export { useMediaSizes } from "./hooks/useMediaSizes";
98
98
  export { useScrollLock } from "./hooks/useScrollLock";
99
99
  export * from "./Icons";
100
+ export type { PopupTestIdProps, TestIdProps } from "./helpers/testId";
@@ -0,0 +1,18 @@
1
+ /**
2
+ * A test id a consumer gives a component; the component puts it on its own
3
+ * root element. Fields put it on the native control. Components set no test
4
+ * id of their own. A component without a root of its own takes
5
+ * `PopupTestIdProps` instead.
6
+ */
7
+ export type TestIdProps = {
8
+ "data-testid"?: string;
9
+ };
10
+ /**
11
+ * A test id of a popup (`Dropdown`, `Tooltip`): it names the floating panel,
12
+ * which is in the DOM only while open. The trigger is the consumer's own
13
+ * element and keeps its own `data-testid`; the component never writes one on
14
+ * it.
15
+ */
16
+ export type PopupTestIdProps = {
17
+ "data-testid"?: string;
18
+ };
package/index.d.ts CHANGED
@@ -97,3 +97,4 @@ export type { TypographyFontWeight, TypographyProps, TypographyResponsiveSize, T
97
97
  export { useMediaSizes } from "./hooks/useMediaSizes";
98
98
  export { useScrollLock } from "./hooks/useScrollLock";
99
99
  export * from "./Icons";
100
+ export type { PopupTestIdProps, TestIdProps } from "./helpers/testId";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "colibri-ui",
3
- "version": "0.8.98",
3
+ "version": "0.8.99",
4
4
  "description": "React UI components library",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",