@indico-data/design-system 2.20.0 → 2.21.1

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,2 +1,3 @@
1
+ import React from 'react';
1
2
  import { ButtonProps } from './types';
2
- export declare const Button: (props: ButtonProps) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indico-data/design-system",
3
- "version": "2.20.0",
3
+ "version": "2.21.1",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "lib/index.js",
@@ -1,10 +1,10 @@
1
+ import React, { forwardRef } from 'react';
1
2
  import classNames from 'classnames';
2
- import React from 'react';
3
3
  import { Icon } from '@/components';
4
4
 
5
5
  import { ButtonProps } from './types';
6
6
 
7
- export const Button = (props: ButtonProps) => {
7
+ export const Button = forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {
8
8
  const {
9
9
  ariaLabel,
10
10
  children,
@@ -37,13 +37,14 @@ export const Button = (props: ButtonProps) => {
37
37
  );
38
38
 
39
39
  const handleOnClick = (event: React.MouseEvent<HTMLButtonElement>) => {
40
- if (!isLoading && props.onClick) {
41
- props.onClick(event);
40
+ if (!isLoading && onClick) {
41
+ onClick(event);
42
42
  }
43
43
  };
44
44
 
45
45
  return (
46
46
  <button
47
+ ref={ref}
47
48
  disabled={isLoading || isDisabled}
48
49
  className={buttonClasses}
49
50
  role="button"
@@ -84,4 +85,4 @@ export const Button = (props: ButtonProps) => {
84
85
  )}
85
86
  </button>
86
87
  );
87
- };
88
+ });
@@ -111,17 +111,16 @@ type Story = StoryObj<PopperProps>;
111
111
  export const Default: Story = {
112
112
  render: (args) => {
113
113
  const [isOpen, setIsOpen] = useState(false);
114
- const buttonRef = useRef<HTMLDivElement | null>(null);
114
+ const buttonRef = useRef<HTMLButtonElement | null>(null);
115
115
 
116
116
  return (
117
- <div>
118
- <div ref={buttonRef}>
119
- <Button
120
- onClick={() => setIsOpen((prev) => !prev)}
121
- iconName="kabob"
122
- ariaLabel="Toggle Popper"
123
- />
124
- </div>
117
+ <>
118
+ <Button
119
+ ref={buttonRef}
120
+ onClick={() => setIsOpen((prev) => !prev)}
121
+ iconName="kabob"
122
+ ariaLabel="Toggle Popper"
123
+ />
125
124
  <Popper
126
125
  {...args}
127
126
  referenceElement={buttonRef.current}
@@ -155,7 +154,7 @@ export const Default: Story = {
155
154
  </Button>
156
155
  </Menu>
157
156
  </Popper>
158
- </div>
157
+ </>
159
158
  );
160
159
  },
161
160
  };
@@ -45,7 +45,7 @@ html {
45
45
  font-size: var(--pf-font-size-caption);
46
46
  }
47
47
  .text-overline {
48
- font-size: var(--pf-font-size-overine);
48
+ font-size: var(--pf-font-size-overline);
49
49
  }
50
50
 
51
51
  // Transform
@@ -4,7 +4,6 @@
4
4
  // Family
5
5
  --pf-font-family-base: 'Mulish', sans-serif;
6
6
 
7
-
8
7
  // Sizes
9
8
  --pf-font-size-base: 1rem;
10
9
  --pf-font-size-h1: calc(1.5 * var(--pf-font-size-base));
@@ -18,7 +17,7 @@
18
17
  --pf-font-size-subtitle: var(--pf-font-size-base);
19
18
  --pf-font-size-subtitle2: calc(0.875 * var(--pf-font-size-base));
20
19
  --pf-font-size-button: var(--pf-font-size-base);
21
- --pf-font-size-overine: calc(0.75 * var(--pf-font-size-base));
20
+ --pf-font-size-overline: calc(0.75 * var(--pf-font-size-base));
22
21
 
23
22
  // Weights
24
23
  --pf-font-weight-thin: 100;
@@ -27,5 +26,4 @@
27
26
  --pf-font-weight-medium: 500;
28
27
  --pf-font-weight-bold: 700;
29
28
  --pf-font-weight-heavy: 900;
30
-
31
- }
29
+ }