adnbn-ui 0.2.4 → 0.2.6

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 (63) hide show
  1. package/package.json +10 -9
  2. package/src/components/Avatar/Avatar.tsx +6 -15
  3. package/src/components/Avatar/index.ts +2 -2
  4. package/src/components/Avatar/types.ts +11 -0
  5. package/src/components/BaseButton/BaseButton.tsx +4 -4
  6. package/src/components/BaseButton/index.ts +1 -2
  7. package/src/components/Button/Button.tsx +6 -28
  8. package/src/components/Button/index.ts +2 -2
  9. package/src/components/Button/types.ts +24 -0
  10. package/src/components/Checkbox/Checkbox.tsx +6 -19
  11. package/src/components/Checkbox/index.ts +2 -2
  12. package/src/components/Checkbox/types.ts +15 -0
  13. package/src/components/Dialog/Dialog.tsx +4 -3
  14. package/src/components/Dialog/index.ts +1 -2
  15. package/src/components/Drawer/Drawer.tsx +6 -10
  16. package/src/components/Drawer/index.ts +2 -2
  17. package/src/components/Drawer/types.ts +6 -0
  18. package/src/components/Footer/Footer.tsx +4 -3
  19. package/src/components/Footer/footer.module.scss +2 -1
  20. package/src/components/Footer/index.ts +1 -2
  21. package/src/components/Header/Header.tsx +4 -3
  22. package/src/components/Header/header.module.scss +1 -1
  23. package/src/components/Header/index.ts +1 -2
  24. package/src/components/Highlight/Highlight.tsx +2 -6
  25. package/src/components/Highlight/index.ts +2 -2
  26. package/src/components/Highlight/types.ts +5 -0
  27. package/src/components/Icon/Icon.tsx +4 -4
  28. package/src/components/Icon/index.ts +1 -2
  29. package/src/components/IconButton/IconButton.tsx +6 -21
  30. package/src/components/IconButton/index.ts +2 -2
  31. package/src/components/IconButton/types.ts +17 -0
  32. package/src/components/Layout/Provider.tsx +14 -3
  33. package/src/components/List/index.ts +1 -2
  34. package/src/components/ListItem/index.ts +1 -2
  35. package/src/components/Modal/Modal.tsx +6 -10
  36. package/src/components/Modal/index.ts +2 -2
  37. package/src/components/Modal/types.ts +6 -0
  38. package/src/components/Odometer/index.ts +1 -2
  39. package/src/components/ScrollArea/ScrollArea.tsx +17 -5
  40. package/src/components/ScrollArea/index.ts +1 -2
  41. package/src/components/ScrollArea/scroll-area.module.scss +4 -0
  42. package/src/components/SvgSprite/index.ts +1 -2
  43. package/src/components/Switch/Switch.tsx +4 -4
  44. package/src/components/Switch/index.ts +1 -2
  45. package/src/components/Tag/Tag.tsx +6 -27
  46. package/src/components/Tag/index.ts +2 -2
  47. package/src/components/Tag/types.ts +23 -0
  48. package/src/components/TextArea/TextArea.tsx +2 -19
  49. package/src/components/TextArea/index.ts +2 -2
  50. package/src/components/TextArea/types.ts +18 -0
  51. package/src/components/TextField/TextField.tsx +2 -25
  52. package/src/components/TextField/index.ts +2 -2
  53. package/src/components/TextField/types.ts +24 -0
  54. package/src/components/Toast/Toast.tsx +6 -24
  55. package/src/components/Toast/index.ts +2 -2
  56. package/src/components/Toast/types.ts +20 -0
  57. package/src/components/Tooltip/Tooltip.tsx +4 -3
  58. package/src/components/Tooltip/index.ts +1 -2
  59. package/src/components/View/index.ts +1 -2
  60. package/src/components/ViewDrawer/index.ts +1 -2
  61. package/src/components/ViewModal/index.ts +1 -2
  62. package/src/plugin/finder/Finder.ts +1 -1
  63. package/src/plugin/index.ts +3 -0
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "adnbn-ui",
3
- "version": "0.2.4",
3
+ "type": "module",
4
+ "version": "0.2.6",
4
5
  "description": "A comprehensive React UI component library designed exclusively for the AddonBone browser extension framework with customizable theming and consistent design patterns",
5
6
  "keywords": [
6
7
  "react",
@@ -16,7 +17,6 @@
16
17
  ],
17
18
  "author": "Addon Bone",
18
19
  "license": "MIT",
19
- "type": "module",
20
20
  "repository": {
21
21
  "type": "git",
22
22
  "url": "https://github.com/addonbone/addonbone-ui.git"
@@ -55,13 +55,12 @@
55
55
  "format": "prettier --write ."
56
56
  },
57
57
  "dependencies": {
58
- "adnbn": "^0.2.1",
59
58
  "autosize": "^6.0.1",
60
59
  "classnames": "^2.5.1",
61
60
  "odometer": "^0.4.8",
62
61
  "radix-ui": "^1.1.3",
63
- "sass": "^1.85.1",
64
62
  "react-highlight-words": "^0.21.0",
63
+ "sass": "^1.85.1",
65
64
  "ts-deepmerge": "^7.0.3"
66
65
  },
67
66
  "devDependencies": {
@@ -79,24 +78,26 @@
79
78
  "@vitejs/plugin-react": "^4.3.4",
80
79
  "@vitest/browser": "^3.0.8",
81
80
  "@vitest/coverage-v8": "^3.0.8",
81
+ "adnbn": "^0.2.7",
82
+ "depcheck": "^1.4.7",
82
83
  "eslint": "^9.21.0",
83
84
  "eslint-plugin-react-hooks": "^5.1.0",
84
85
  "eslint-plugin-react-refresh": "^0.4.19",
85
86
  "globals": "^15.15.0",
86
- "playwright": "^1.51.0",
87
- "rspack-plugin-virtual-module": "^1.0.0",
88
- "storybook": "^8.6.4",
87
+ "prettier": "^3.5.3",
89
88
  "react": "^19.1.0",
90
89
  "react-dom": "^19.1.0",
90
+ "rspack-plugin-virtual-module": "^1.0.0",
91
+ "storybook": "^8.6.4",
91
92
  "typescript": "~5.7.2",
92
93
  "typescript-eslint": "^8.24.1",
93
94
  "vite": "^6.2.1",
94
- "vitest": "^3.0.8",
95
- "prettier": "^3.5.3"
95
+ "vitest": "^3.0.8"
96
96
  },
97
97
  "peerDependencies": {
98
98
  "@types/react": "*",
99
99
  "@types/react-dom": "*",
100
+ "adnbn": ">=0.2.7",
100
101
  "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
101
102
  "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
102
103
  },
@@ -1,22 +1,12 @@
1
- import React, {FC, memo, ReactNode} from "react";
1
+ import React, {memo, ReactNode, forwardRef, ForwardRefRenderFunction} from "react";
2
2
  import classnames from "classnames";
3
3
  import {AvatarFallbackProps, AvatarImageProps, Fallback, Image, Root} from "@radix-ui/react-avatar";
4
4
 
5
5
  import {useComponentProps} from "../../providers";
6
6
 
7
- import styles from "./avatar.module.scss";
8
-
9
- export enum AvatarSize {
10
- Small = "small",
11
- Medium = "medium",
12
- Large = "large",
13
- }
7
+ import {AvatarRadius, AvatarSize} from "./types";
14
8
 
15
- export enum AvatarRadius {
16
- Small = "small",
17
- Medium = "medium",
18
- Large = "large",
19
- }
9
+ import styles from "./avatar.module.scss";
20
10
 
21
11
  export interface AvatarProps extends AvatarImageProps, Pick<AvatarFallbackProps, "delayMs"> {
22
12
  imageClassName?: string;
@@ -27,7 +17,7 @@ export interface AvatarProps extends AvatarImageProps, Pick<AvatarFallbackProps,
27
17
  cursorPointer?: boolean;
28
18
  }
29
19
 
30
- const Avatar: FC<AvatarProps> = props => {
20
+ const Avatar: ForwardRefRenderFunction<HTMLSpanElement, AvatarProps> = (props, ref) => {
31
21
  const {
32
22
  size,
33
23
  radius,
@@ -42,6 +32,7 @@ const Avatar: FC<AvatarProps> = props => {
42
32
 
43
33
  return (
44
34
  <Root
35
+ ref={ref}
45
36
  className={classnames(
46
37
  styles["avatar"],
47
38
  {
@@ -62,4 +53,4 @@ const Avatar: FC<AvatarProps> = props => {
62
53
  );
63
54
  };
64
55
 
65
- export default memo(Avatar);
56
+ export default memo(forwardRef(Avatar));
@@ -1,2 +1,2 @@
1
- export {default as Avatar, AvatarSize, AvatarRadius} from "./Avatar";
2
- export type {AvatarProps} from "./Avatar";
1
+ export * from "./types";
2
+ export {default as Avatar, type AvatarProps} from "./Avatar";
@@ -0,0 +1,11 @@
1
+ export enum AvatarSize {
2
+ Small = "small",
3
+ Medium = "medium",
4
+ Large = "large",
5
+ }
6
+
7
+ export enum AvatarRadius {
8
+ Small = "small",
9
+ Medium = "medium",
10
+ Large = "large",
11
+ }
@@ -1,4 +1,4 @@
1
- import React, {ComponentProps, FC, memo, ReactNode} from "react";
1
+ import React, {ComponentProps, memo, ReactNode, forwardRef, ForwardRefRenderFunction} from "react";
2
2
  import classnames from "classnames";
3
3
 
4
4
  import {cloneOrCreateElement} from "../../utils";
@@ -13,11 +13,11 @@ export interface BaseButtonProps extends ComponentProps<"button"> {
13
13
  childrenClassName?: string;
14
14
  }
15
15
 
16
- const BaseButton: FC<BaseButtonProps> = props => {
16
+ const BaseButton: ForwardRefRenderFunction<HTMLButtonElement, BaseButtonProps> = (props, ref) => {
17
17
  const {after, before, children, className, afterClassName, beforeClassName, childrenClassName, ...other} = props;
18
18
 
19
19
  return (
20
- <button className={classnames(styles["base-button"], className)} {...other}>
20
+ <button ref={ref} className={classnames(styles["base-button"], className)} {...other}>
21
21
  {cloneOrCreateElement(before, {
22
22
  className: classnames(styles["base-button__before"], beforeClassName),
23
23
  })}
@@ -33,4 +33,4 @@ const BaseButton: FC<BaseButtonProps> = props => {
33
33
  );
34
34
  };
35
35
 
36
- export default memo(BaseButton);
36
+ export default memo(forwardRef(BaseButton));
@@ -1,2 +1 @@
1
- export {default as BaseButton} from "./BaseButton";
2
- export type {BaseButtonProps} from "./BaseButton";
1
+ export {default as BaseButton, type BaseButtonProps} from "./BaseButton";
@@ -1,35 +1,12 @@
1
- import React, {FC, memo} from "react";
1
+ import React, {memo, forwardRef, ForwardRefRenderFunction} from "react";
2
2
  import classnames from "classnames";
3
3
  import {BaseButton, BaseButtonProps} from "../BaseButton";
4
4
 
5
5
  import {useComponentProps} from "../../providers";
6
6
 
7
- import styles from "./button.module.scss";
8
-
9
- export enum ButtonVariant {
10
- Contained = "contained",
11
- Outlined = "outlined",
12
- Text = "text",
13
- }
14
-
15
- export enum ButtonColor {
16
- Primary = "primary",
17
- Secondary = "secondary",
18
- Accent = "accent",
19
- }
7
+ import {ButtonColor, ButtonRadius, ButtonSize, ButtonVariant} from "./types";
20
8
 
21
- export enum ButtonSize {
22
- Small = "small",
23
- Medium = "medium",
24
- Large = "large",
25
- }
26
-
27
- export enum ButtonRadius {
28
- Small = "small",
29
- Medium = "medium",
30
- Large = "large",
31
- Full = "full",
32
- }
9
+ import styles from "./button.module.scss";
33
10
 
34
11
  export interface ButtonProps extends BaseButtonProps {
35
12
  variant?: ButtonVariant;
@@ -38,7 +15,7 @@ export interface ButtonProps extends BaseButtonProps {
38
15
  radius?: ButtonRadius;
39
16
  }
40
17
 
41
- const Button: FC<ButtonProps> = props => {
18
+ const Button: ForwardRefRenderFunction<HTMLButtonElement, ButtonProps> = (props, ref) => {
42
19
  const {
43
20
  variant = ButtonVariant.Contained,
44
21
  color,
@@ -52,6 +29,7 @@ const Button: FC<ButtonProps> = props => {
52
29
 
53
30
  return (
54
31
  <BaseButton
32
+ ref={ref}
55
33
  {...other}
56
34
  className={classnames(
57
35
  styles["button"],
@@ -70,4 +48,4 @@ const Button: FC<ButtonProps> = props => {
70
48
  );
71
49
  };
72
50
 
73
- export default memo(Button);
51
+ export default memo(forwardRef(Button));
@@ -1,2 +1,2 @@
1
- export {default as Button, ButtonVariant, ButtonRadius, ButtonColor, ButtonSize} from "./Button";
2
- export type {ButtonProps} from "./Button";
1
+ export * from "./types";
2
+ export {default as Button, type ButtonProps} from "./Button";
@@ -0,0 +1,24 @@
1
+ export enum ButtonVariant {
2
+ Contained = "contained",
3
+ Outlined = "outlined",
4
+ Text = "text",
5
+ }
6
+
7
+ export enum ButtonColor {
8
+ Primary = "primary",
9
+ Secondary = "secondary",
10
+ Accent = "accent",
11
+ }
12
+
13
+ export enum ButtonSize {
14
+ Small = "small",
15
+ Medium = "medium",
16
+ Large = "large",
17
+ }
18
+
19
+ export enum ButtonRadius {
20
+ Small = "small",
21
+ Medium = "medium",
22
+ Large = "large",
23
+ Full = "full",
24
+ }
@@ -1,29 +1,15 @@
1
- import React, {FC, memo, ReactElement} from "react";
1
+ import React, {memo, ReactElement, forwardRef, ForwardRefRenderFunction} from "react";
2
2
  import classnames from "classnames";
3
3
  import {CheckboxProps as CheckboxRootProps, Indicator, Root} from "@radix-ui/react-checkbox";
4
4
 
5
5
  import {useComponentProps} from "../../providers";
6
6
 
7
+ import {CheckboxVariant, CheckboxSize, CheckboxRadius} from "./types";
8
+
7
9
  import styles from "./checkbox.module.scss";
8
10
 
9
11
  export type {CheckedState} from "@radix-ui/react-checkbox";
10
12
 
11
- export enum CheckboxVariant {
12
- Classic = "classic",
13
- Soft = "soft",
14
- }
15
-
16
- export enum CheckboxSize {
17
- Small = "small",
18
- Medium = "medium",
19
- Large = "large",
20
- }
21
-
22
- export enum CheckboxRadius {
23
- Small = "small",
24
- Large = "large",
25
- }
26
-
27
13
  export interface CheckboxProps extends CheckboxRootProps {
28
14
  indicatorClassName?: string;
29
15
  size?: CheckboxSize;
@@ -33,7 +19,7 @@ export interface CheckboxProps extends CheckboxRootProps {
33
19
  indeterminateIcon?: ReactElement;
34
20
  }
35
21
 
36
- const Checkbox: FC<CheckboxProps> = props => {
22
+ const Checkbox: ForwardRefRenderFunction<HTMLButtonElement, CheckboxProps> = (props, ref) => {
37
23
  const {
38
24
  checked,
39
25
  size,
@@ -48,6 +34,7 @@ const Checkbox: FC<CheckboxProps> = props => {
48
34
 
49
35
  return (
50
36
  <Root
37
+ ref={ref}
51
38
  {...other}
52
39
  checked={checked}
53
40
  className={classnames(
@@ -68,4 +55,4 @@ const Checkbox: FC<CheckboxProps> = props => {
68
55
  );
69
56
  };
70
57
 
71
- export default memo(Checkbox);
58
+ export default memo(forwardRef(Checkbox));
@@ -1,2 +1,2 @@
1
- export {default as Checkbox, CheckboxVariant, CheckboxSize, CheckboxRadius} from "./Checkbox";
2
- export type {CheckboxProps, CheckedState} from "./Checkbox";
1
+ export * from "./types";
2
+ export {default as Checkbox, type CheckboxProps, type CheckedState} from "./Checkbox";
@@ -0,0 +1,15 @@
1
+ export enum CheckboxVariant {
2
+ Classic = "classic",
3
+ Soft = "soft",
4
+ }
5
+
6
+ export enum CheckboxSize {
7
+ Small = "small",
8
+ Medium = "medium",
9
+ Large = "large",
10
+ }
11
+
12
+ export enum CheckboxRadius {
13
+ Small = "small",
14
+ Large = "large",
15
+ }
@@ -1,4 +1,4 @@
1
- import React, {FC, memo, useEffect, useRef} from "react";
1
+ import React, {memo, useEffect, useRef, forwardRef, ForwardRefRenderFunction} from "react";
2
2
  import classnames from "classnames";
3
3
  import {
4
4
  Content,
@@ -45,7 +45,7 @@ export const dialogPropsKeys = new Set<keyof DialogProps>([
45
45
  "title",
46
46
  ]);
47
47
 
48
- const Dialog: FC<DialogProps> = props => {
48
+ const Dialog: ForwardRefRenderFunction<HTMLDivElement, DialogProps> = (props, ref) => {
49
49
  const {
50
50
  speed = 200,
51
51
  open,
@@ -102,6 +102,7 @@ const Dialog: FC<DialogProps> = props => {
102
102
  style={{animationDuration: `${speed}ms`}}
103
103
  />
104
104
  <Content
105
+ ref={ref}
105
106
  className={classnames(styles["dialog-content"], className)}
106
107
  style={{animationDuration: `${speed}ms`}}
107
108
  {...other}
@@ -122,4 +123,4 @@ const Dialog: FC<DialogProps> = props => {
122
123
  );
123
124
  };
124
125
 
125
- export default memo(Dialog);
126
+ export default memo(forwardRef(Dialog));
@@ -1,2 +1 @@
1
- export {default as Dialog, dialogPropsKeys} from "./Dialog";
2
- export type {DialogProps} from "./Dialog";
1
+ export {default as Dialog, dialogPropsKeys, type DialogProps} from "./Dialog";
@@ -1,4 +1,4 @@
1
- import React, {FC, memo} from "react";
1
+ import React, {memo, forwardRef, ForwardRefRenderFunction} from "react";
2
2
  import classnames from "classnames";
3
3
 
4
4
  import {useComponentProps} from "../../providers";
@@ -6,14 +6,9 @@ import {cloneOrCreateElement} from "../../utils";
6
6
 
7
7
  import {Dialog, DialogProps, dialogPropsKeys} from "../Dialog";
8
8
 
9
- import styles from "./drawer.module.scss";
9
+ import {DrawerSide} from "./types";
10
10
 
11
- export enum DrawerSide {
12
- Left = "left",
13
- Right = "right",
14
- Top = "top",
15
- Bottom = "bottom",
16
- }
11
+ import styles from "./drawer.module.scss";
17
12
 
18
13
  export interface DrawerProps extends DialogProps {
19
14
  side?: DrawerSide;
@@ -21,7 +16,7 @@ export interface DrawerProps extends DialogProps {
21
16
 
22
17
  export const drawerPropsKeys = new Set<keyof DrawerProps>(["side", ...dialogPropsKeys]);
23
18
 
24
- const Drawer: FC<DrawerProps> = props => {
19
+ const Drawer: ForwardRefRenderFunction<HTMLDivElement, DrawerProps> = (props, ref) => {
25
20
  const {
26
21
  side = DrawerSide.Left,
27
22
  fullscreen,
@@ -34,6 +29,7 @@ const Drawer: FC<DrawerProps> = props => {
34
29
 
35
30
  return (
36
31
  <Dialog
32
+ ref={ref}
37
33
  {...other}
38
34
  overlayClassName={classnames(styles["drawer-overlay"], overlayClassName)}
39
35
  className={classnames(
@@ -54,4 +50,4 @@ const Drawer: FC<DrawerProps> = props => {
54
50
  );
55
51
  };
56
52
 
57
- export default memo(Drawer);
53
+ export default memo(forwardRef(Drawer));
@@ -1,2 +1,2 @@
1
- export {default as Drawer, DrawerSide, drawerPropsKeys} from "./Drawer";
2
- export type {DrawerProps} from "./Drawer";
1
+ export * from "./types";
2
+ export {default as Drawer, drawerPropsKeys, type DrawerProps} from "./Drawer";
@@ -0,0 +1,6 @@
1
+ export enum DrawerSide {
2
+ Left = "left",
3
+ Right = "right",
4
+ Top = "top",
5
+ Bottom = "bottom",
6
+ }
@@ -1,4 +1,4 @@
1
- import React, {ComponentProps, FC, memo, ReactNode} from "react";
1
+ import React, {ComponentProps, memo, ReactNode, forwardRef, ForwardRefRenderFunction} from "react";
2
2
  import classnames from "classnames";
3
3
 
4
4
  import {cloneOrCreateElement} from "../../utils";
@@ -16,7 +16,7 @@ export interface FooterProps extends ComponentProps<"footer"> {
16
16
  childrenClassName?: string;
17
17
  }
18
18
 
19
- const Footer: FC<FooterProps> = props => {
19
+ const Footer: ForwardRefRenderFunction<HTMLElement, FooterProps> = (props, ref) => {
20
20
  const {
21
21
  left,
22
22
  right,
@@ -32,6 +32,7 @@ const Footer: FC<FooterProps> = props => {
32
32
 
33
33
  return (
34
34
  <footer
35
+ ref={ref}
35
36
  {...other}
36
37
  className={classnames(
37
38
  styles["footer"],
@@ -55,4 +56,4 @@ const Footer: FC<FooterProps> = props => {
55
56
  );
56
57
  };
57
58
 
58
- export default memo(Footer);
59
+ export default memo(forwardRef(Footer));
@@ -4,10 +4,11 @@ $root: footer;
4
4
  box-sizing: border-box;
5
5
  display: flex;
6
6
  justify-content: space-between;
7
+ align-items: center;
7
8
  width: 100%;
8
9
  padding: var(--footer-padding, var(--side-padding-sm));
9
10
  padding-top: 0;
10
- background-color: var(--footer-background-color, transparent);
11
+ background-color: var(--footer-bg-color, transparent);
11
12
  transition:
12
13
  background-color var(--transition-speed-sm),
13
14
  box-shadow var(--transition-speed-sm);
@@ -1,2 +1 @@
1
- export {default as Footer} from "./Footer";
2
- export type {FooterProps} from "./Footer";
1
+ export {default as Footer, type FooterProps} from "./Footer";
@@ -1,4 +1,4 @@
1
- import React, {ComponentProps, FC, memo, ReactNode} from "react";
1
+ import React, {ComponentProps, memo, ReactNode, forwardRef, ForwardRefRenderFunction} from "react";
2
2
  import classnames from "classnames";
3
3
 
4
4
  import {cloneOrCreateElement} from "../../utils";
@@ -20,7 +20,7 @@ export interface HeaderProps extends Omit<ComponentProps<"header">, "title"> {
20
20
  alignCenter?: boolean;
21
21
  }
22
22
 
23
- const Header: FC<HeaderProps> = props => {
23
+ const Header: ForwardRefRenderFunction<HTMLElement, HeaderProps> = (props, ref) => {
24
24
  const {
25
25
  title,
26
26
  before,
@@ -40,6 +40,7 @@ const Header: FC<HeaderProps> = props => {
40
40
 
41
41
  return (
42
42
  <header
43
+ ref={ref}
43
44
  {...other}
44
45
  className={classnames(
45
46
  styles["header"],
@@ -70,4 +71,4 @@ const Header: FC<HeaderProps> = props => {
70
71
  );
71
72
  };
72
73
 
73
- export default memo(Header);
74
+ export default memo(forwardRef(Header));
@@ -34,7 +34,7 @@ $root: header;
34
34
  font-weight: var(--header-title-font-weight, 700);
35
35
  line-height: var(--header-title-line-height, 120%);
36
36
  will-change: color;
37
- transition: color var(--transition-speed);
37
+ transition: color var(--header-title-transition-speed, var(--transition-speed-md));
38
38
 
39
39
  .#{$root}--center & {
40
40
  justify-content: center;
@@ -1,2 +1 @@
1
- export {default as Header} from "./Header";
2
- export type {HeaderProps} from "./Header";
1
+ export {default as Header, type HeaderProps} from "./Header";
@@ -4,13 +4,9 @@ import Highlighter, {HighlighterProps} from "react-highlight-words";
4
4
 
5
5
  import {useComponentProps} from "../../providers";
6
6
 
7
- import styles from "./highlight.module.scss";
7
+ import {HighlightColor} from "./types";
8
8
 
9
- export enum HighlightColor {
10
- Primary = "primary",
11
- Secondary = "secondary",
12
- Accent = "accent",
13
- }
9
+ import styles from "./highlight.module.scss";
14
10
 
15
11
  export interface HighlightProps extends HighlighterProps {
16
12
  color?: HighlightColor;
@@ -1,2 +1,2 @@
1
- export {default as Highlight, HighlightColor} from "./Highlight";
2
- export type {HighlightProps} from "./Highlight";
1
+ export * from "./types";
2
+ export {default as Highlight, type HighlightProps} from "./Highlight";
@@ -0,0 +1,5 @@
1
+ export enum HighlightColor {
2
+ Primary = "primary",
3
+ Secondary = "secondary",
4
+ Accent = "accent",
5
+ }
@@ -1,4 +1,4 @@
1
- import React, {FC, memo, useEffect, ComponentProps} from "react";
1
+ import React, {memo, useEffect, ComponentProps, forwardRef, ForwardRefRenderFunction} from "react";
2
2
  import classnames from "classnames";
3
3
  import {useComponentProps, useIcons} from "../../providers";
4
4
 
@@ -9,7 +9,7 @@ export interface IconProps extends ComponentProps<"svg"> {
9
9
  size?: number;
10
10
  }
11
11
 
12
- const Icon: FC<IconProps> = props => {
12
+ const Icon: ForwardRefRenderFunction<SVGSVGElement, IconProps> = (props, ref) => {
13
13
  const {
14
14
  name,
15
15
  className,
@@ -37,10 +37,10 @@ const Icon: FC<IconProps> = props => {
37
37
  }
38
38
 
39
39
  return (
40
- <svg className={classnames(styles["icon"], className)} width={width} height={height} {...other}>
40
+ <svg ref={ref} className={classnames(styles["icon"], className)} width={width} height={height} {...other}>
41
41
  <use href={`#${name}`} />
42
42
  </svg>
43
43
  );
44
44
  };
45
45
 
46
- export default memo(Icon);
46
+ export default memo(forwardRef(Icon));
@@ -1,2 +1 @@
1
- export {default as Icon} from "./Icon";
2
- export type {IconProps} from "./Icon";
1
+ export {default as Icon, type IconProps} from "./Icon";
@@ -1,4 +1,4 @@
1
- import React, {FC, memo} from "react";
1
+ import React, {memo, forwardRef, ForwardRefRenderFunction} from "react";
2
2
  import classnames from "classnames";
3
3
 
4
4
  import {Tooltip, TooltipProps} from "../Tooltip";
@@ -6,25 +6,9 @@ import {BaseButton, BaseButtonProps} from "../BaseButton";
6
6
 
7
7
  import {useComponentProps} from "../../providers";
8
8
 
9
- import styles from "./icon-button.module.scss";
10
-
11
- export enum IconButtonVariant {
12
- Contained = "contained",
13
- Outlined = "outlined",
14
- Ghost = "ghost",
15
- }
9
+ import {IconButtonVariant, IconButtonSize, IconButtonRadius} from "./types";
16
10
 
17
- export enum IconButtonSize {
18
- Small = "small",
19
- Medium = "medium",
20
- Large = "large",
21
- }
22
-
23
- export enum IconButtonRadius {
24
- Small = "small",
25
- Medium = "medium",
26
- Large = "large",
27
- }
11
+ import styles from "./icon-button.module.scss";
28
12
 
29
13
  export interface IconButtonProps extends BaseButtonProps {
30
14
  size?: IconButtonSize;
@@ -33,7 +17,7 @@ export interface IconButtonProps extends BaseButtonProps {
33
17
  tooltip?: Omit<TooltipProps, "children">;
34
18
  }
35
19
 
36
- const IconButton: FC<IconButtonProps> = props => {
20
+ const IconButton: ForwardRefRenderFunction<HTMLButtonElement, IconButtonProps> = (props, ref) => {
37
21
  const {size, radius, variant, tooltip, className, children, ...other} = {
38
22
  ...useComponentProps("iconButton"),
39
23
  ...props,
@@ -41,6 +25,7 @@ const IconButton: FC<IconButtonProps> = props => {
41
25
 
42
26
  const iconButton = (
43
27
  <BaseButton
28
+ ref={ref}
44
29
  {...other}
45
30
  className={classnames(
46
31
  styles["icon-button"],
@@ -62,4 +47,4 @@ const IconButton: FC<IconButtonProps> = props => {
62
47
  return iconButton;
63
48
  };
64
49
 
65
- export default memo(IconButton);
50
+ export default memo(forwardRef(IconButton));
@@ -1,2 +1,2 @@
1
- export {default as IconButton, IconButtonVariant, IconButtonRadius, IconButtonSize} from "./IconButton";
2
- export type {IconButtonProps} from "./IconButton";
1
+ export * from "./types";
2
+ export {default as IconButton, type IconButtonProps} from "./IconButton";
@@ -0,0 +1,17 @@
1
+ export enum IconButtonVariant {
2
+ Contained = "contained",
3
+ Outlined = "outlined",
4
+ Ghost = "ghost",
5
+ }
6
+
7
+ export enum IconButtonSize {
8
+ Small = "small",
9
+ Medium = "medium",
10
+ Large = "large",
11
+ }
12
+
13
+ export enum IconButtonRadius {
14
+ Small = "small",
15
+ Medium = "medium",
16
+ Large = "large",
17
+ }