corpushub-design-system 0.0.17 → 0.0.19

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,5 +1,5 @@
1
- import "./styles.scss";
2
- import { IconSizes } from "../Icon/Icon";
1
+ import { IconSizes } from '../Icon/Icon';
2
+ import './styles.scss';
3
3
  export declare const ButtonModes: readonly ["filled", "tonal", "outlined", "ghost"];
4
4
  export type ButtonDSModes = (typeof ButtonModes)[number];
5
5
  export declare const ButtonSizes: readonly ["large", "medium", "small", "x-small"];
@@ -8,7 +8,7 @@ export declare const ButtonColors: readonly ["accent", "danger", "white"];
8
8
  export type ButtonDSColors = (typeof ButtonColors)[number];
9
9
  export declare const ButtonIconPositions: readonly ["left", "right"];
10
10
  export type ButtonDSPositions = (typeof ButtonIconPositions)[number];
11
- export type Props = JSX.IntrinsicElements["button"] & {
11
+ export type Props = JSX.IntrinsicElements['button'] & {
12
12
  text: string;
13
13
  color?: ButtonDSColors;
14
14
  size?: ButtonDSSizes;
@@ -21,5 +21,6 @@ export type Props = JSX.IntrinsicElements["button"] & {
21
21
  iconSize?: IconSizes;
22
22
  iconFilled?: boolean;
23
23
  spin?: boolean;
24
+ dataTour?: string;
24
25
  };
25
- export default function Button({ text, className, disabled, active, color, size, mode, icon, iconImage, iconPosition, iconSize, iconFilled, spin, onClick, ...buttonProps }: Props): import("react").JSX.Element;
26
+ export default function Button({ text, className, disabled, active, color, size, mode, icon, iconImage, iconPosition, iconSize, iconFilled, spin, onClick, dataTour, ...buttonProps }: Props): import("react").JSX.Element;
@@ -1,27 +1,27 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import cx from "classnames";
3
- import "./styles.scss";
4
- import Icon from "../Icon";
5
- import { iconSizeToPx } from "../Icon/IconSizes";
6
- export const ButtonModes = ["filled", "tonal", "outlined", "ghost"];
7
- export const ButtonSizes = ["large", "medium", "small", "x-small"];
8
- export const ButtonColors = ["accent", "danger", "white"];
9
- export const ButtonIconPositions = ["left", "right"];
10
- export default function Button({ text, className = "", disabled = false, active = false, color = "accent", size = "large", mode = "filled", icon, iconImage, iconPosition = "right", iconSize, iconFilled = false, spin = false, onClick = () => { }, ...buttonProps }) {
2
+ import cx from 'classnames';
3
+ import Icon from '../Icon';
4
+ import { iconSizeToPx } from '../Icon/IconSizes';
5
+ import './styles.scss';
6
+ export const ButtonModes = ['filled', 'tonal', 'outlined', 'ghost'];
7
+ export const ButtonSizes = ['large', 'medium', 'small', 'x-small'];
8
+ export const ButtonColors = ['accent', 'danger', 'white'];
9
+ export const ButtonIconPositions = ['left', 'right'];
10
+ export default function Button({ text, className = '', disabled = false, active = false, color = 'accent', size = 'large', mode = 'filled', icon, iconImage, iconPosition = 'right', iconSize, iconFilled = false, spin = false, onClick = () => { }, dataTour, ...buttonProps }) {
11
11
  const hasIconSlot = Boolean(spin || iconImage || icon);
12
- const getClassNames = cx("ds-button", className, size, mode, color, {
12
+ const getClassNames = cx('ds-button', className, size, mode, color, {
13
13
  active: !disabled && active,
14
- "icon-left": hasIconSlot && iconPosition === "left",
15
- "icon-right": hasIconSlot && iconPosition === "right",
14
+ 'icon-left': hasIconSlot && iconPosition === 'left',
15
+ 'icon-right': hasIconSlot && iconPosition === 'right',
16
16
  });
17
17
  const getIconSize = () => {
18
18
  if (iconSize)
19
19
  return iconSize;
20
- if (size === "large")
21
- return "small";
22
- if (size === "medium" || size === "small")
23
- return "x-small";
24
- return "x-small";
20
+ if (size === 'large')
21
+ return 'small';
22
+ if (size === 'medium' || size === 'small')
23
+ return 'x-small';
24
+ return 'x-small';
25
25
  };
26
26
  const resolvedIconSize = getIconSize();
27
27
  const iconBoxPx = iconSizeToPx(resolvedIconSize);
@@ -33,10 +33,10 @@ export default function Button({ text, className = "", disabled = false, active
33
33
  return (_jsx("img", { src: iconImage, alt: "", className: "ds-button-icon-image", width: iconBoxPx, height: iconBoxPx }));
34
34
  }
35
35
  if (icon) {
36
- return (_jsx(Icon, { name: icon, size: resolvedIconSize, filled: iconFilled }));
36
+ return _jsx(Icon, { name: icon, size: resolvedIconSize, filled: iconFilled });
37
37
  }
38
38
  return null;
39
39
  };
40
40
  const iconVisual = renderIconVisual();
41
- return (_jsxs("button", { type: "button", disabled: disabled, className: getClassNames, onClick: onClick, ...buttonProps, children: [hasIconSlot && iconPosition === "left" && iconVisual, _jsx("span", { className: "ds-button-text", children: text }), hasIconSlot && iconPosition === "right" && iconVisual] }));
41
+ return (_jsxs("button", { type: "button", disabled: disabled, className: getClassNames, onClick: onClick, "data-tour": dataTour, ...buttonProps, children: [hasIconSlot && iconPosition === 'left' && iconVisual, _jsx("span", { className: "ds-button-text", children: text }), hasIconSlot && iconPosition === 'right' && iconVisual] }));
42
42
  }
@@ -14,5 +14,6 @@ export type Props = JSX.IntrinsicElements['button'] & {
14
14
  hideDivider?: boolean;
15
15
  right?: boolean;
16
16
  icon?: string;
17
+ dataTour?: string;
17
18
  };
18
- export default function DropdownButton({ text, list, className, disabled, active, color, size, onSelect, hideDivider, right, icon, }: Props): import("react").JSX.Element;
19
+ export default function DropdownButton({ text, list, className, disabled, active, color, size, onSelect, hideDivider, right, icon, dataTour, }: Props): import("react").JSX.Element;
@@ -15,7 +15,7 @@ export const DropdownButtonColors = [
15
15
  'secondary',
16
16
  'tertiary',
17
17
  ];
18
- export default function DropdownButton({ text, list, className = '', disabled = false, active = false, color = 'primary', size = 'large', onSelect, hideDivider, right, icon, }) {
18
+ export default function DropdownButton({ text, list, className = '', disabled = false, active = false, color = 'primary', size = 'large', onSelect, hideDivider, right, icon, dataTour, }) {
19
19
  const [show, setShow] = useState(false);
20
20
  const containerRef = useRef(null);
21
21
  useEffect(() => {
@@ -35,7 +35,7 @@ export default function DropdownButton({ text, list, className = '', disabled =
35
35
  const getClassNames = cx('ds-dropdown-button', className, size, color, {
36
36
  active: !disabled && active,
37
37
  });
38
- return (_jsxs("div", { className: "ds-dropdown-container", ref: containerRef, children: [_jsxs("button", { type: "button", disabled: disabled, className: getClassNames, onClick: () => setShow(!show), children: [_jsxs("div", { className: "left-side", children: [icon && _jsx(Icon, { name: icon, className: "icon-custom" }), _jsx("span", { className: "text", children: text })] }), !hideDivider && _jsx("div", { className: "divider", children: "\u00A0" }), _jsx(Icon, { name: "arrow_drop_down", className: "icon-arrow" })] }), show && (_jsx(DropdownList, { right: right, list: list, onSelect: (s) => {
38
+ return (_jsxs("div", { className: "ds-dropdown-container", ref: containerRef, children: [_jsxs("button", { type: "button", disabled: disabled, className: getClassNames, onClick: () => setShow(!show), "data-tour": dataTour, children: [_jsxs("div", { className: "left-side", children: [icon && _jsx(Icon, { name: icon, className: "icon-custom" }), _jsx("span", { className: "text", children: text })] }), !hideDivider && _jsx("div", { className: "divider", children: "\u00A0" }), _jsx(Icon, { name: "arrow_drop_down", className: "icon-arrow" })] }), show && (_jsx(DropdownList, { right: right, list: list, onSelect: (s) => {
39
39
  onSelect && onSelect(s);
40
40
  setTimeout(function () {
41
41
  setShow(false);
@@ -10,6 +10,7 @@ export type Props = JSX.IntrinsicElements['span'] & {
10
10
  weight?: IconWeights;
11
11
  filled?: boolean;
12
12
  disabled?: boolean;
13
+ dataTour?: string;
13
14
  };
14
- export default function Icon({ name, className, size, weight, filled, disabled, title, onClick, onMouseDown, onMouseUp, }: Props): import("react").JSX.Element;
15
+ export default function Icon({ name, className, size, weight, filled, disabled, title, onClick, onMouseDown, onMouseUp, dataTour, }: Props): import("react").JSX.Element;
15
16
  export {};
@@ -9,12 +9,12 @@ export const IconSizes = [
9
9
  'small',
10
10
  'x-small',
11
11
  ];
12
- export default function Icon({ name, className = '', size, weight = 'regular', filled = false, disabled = false, title, onClick, onMouseDown, onMouseUp, }) {
12
+ export default function Icon({ name, className = '', size, weight = 'regular', filled = false, disabled = false, title, onClick, onMouseDown, onMouseUp, dataTour, }) {
13
13
  const getClassNames = cx('ds-icon material-symbols-outlined', className, size, weight, {
14
14
  disabled: disabled,
15
15
  });
16
16
  const style = {
17
17
  fontVariationSettings: `'FILL' ${filled ? 1 : 0}, 'wght' 400, 'GRAD' 0, 'opsz' 24`,
18
18
  };
19
- return (_jsx("span", { className: getClassNames, style: style, onClick: (e) => onClick && !disabled && onClick(e), onMouseDown: (e) => onMouseDown && onMouseDown(e), onMouseUp: (e) => onMouseUp && onMouseUp(e), title: title, translate: "no", children: name }));
19
+ return (_jsx("span", { className: getClassNames, style: style, onClick: (e) => onClick && !disabled && onClick(e), onMouseDown: (e) => onMouseDown && onMouseDown(e), onMouseUp: (e) => onMouseUp && onMouseUp(e), title: title, translate: "no", "data-tour": dataTour, children: name }));
20
20
  }
@@ -19,6 +19,7 @@ export type Props = JSX.IntrinsicElements['button'] & {
19
19
  tooltipPlacement?: TooltipPlacements;
20
20
  iconSize?: IconSizes;
21
21
  iconClassName?: string;
22
+ dataTour?: string;
22
23
  };
23
- export default function IconButton({ name, iconImage, className, disabled, active, color, size, mode, filledIcon, title, spin, iconSize, iconClassName, tooltipPlacement, onClick, type, ...buttonProps }: Props): import("react").JSX.Element;
24
+ export default function IconButton({ name, iconImage, className, disabled, active, color, size, mode, filledIcon, title, spin, iconSize, iconClassName, tooltipPlacement, onClick, type, dataTour, ...buttonProps }: Props): import("react").JSX.Element;
24
25
  export {};
@@ -6,7 +6,7 @@ import { iconSizeToPx } from '../Icon/IconSizes';
6
6
  import './styles.scss';
7
7
  export const IconButtonSizes = ['large', 'medium', 'small', 'x-small'];
8
8
  export const IconButtonColors = ['accent', 'danger', 'white'];
9
- export default function IconButton({ name, iconImage, className, disabled = false, active = false, color = 'accent', size = 'large', mode = 'filled', filledIcon, title, spin = false, iconSize, iconClassName, tooltipPlacement = 'top', onClick = () => { }, type = 'button', ...buttonProps }) {
9
+ export default function IconButton({ name, iconImage, className, disabled = false, active = false, color = 'accent', size = 'large', mode = 'filled', filledIcon, title, spin = false, iconSize, iconClassName, tooltipPlacement = 'top', onClick = () => { }, type = 'button', dataTour, ...buttonProps }) {
10
10
  const getClassNames = cx('ds-icon-button', className, size, mode, color, {
11
11
  active: !disabled && active,
12
12
  });
@@ -33,7 +33,7 @@ export default function IconButton({ name, iconImage, className, disabled = fals
33
33
  }
34
34
  return null;
35
35
  };
36
- const renderButton = () => (_jsx("button", { type: type, disabled: disabled, className: getClassNames, onClick: onClick, ...buttonProps, children: renderContent() }));
36
+ const renderButton = () => (_jsx("button", { type: type, disabled: disabled, className: getClassNames, onClick: onClick, "data-tour": dataTour, ...buttonProps, children: renderContent() }));
37
37
  const button = renderButton();
38
38
  // Disabled buttons do not fire pointer events; MUI Tooltip needs a wrapper.
39
39
  if (!title) {
@@ -14,5 +14,6 @@ export type Props = {
14
14
  disabled?: boolean;
15
15
  title?: string | React.ReactNode;
16
16
  onClick?: (event: React.MouseEvent<HTMLElement>) => void;
17
+ dataTour?: string;
17
18
  };
18
- export default function Tag({ text, title, className, disabled, color, size, type, onClick, }: Props): import("react").JSX.Element;
19
+ export default function Tag({ text, title, className, disabled, color, size, type, onClick, dataTour, }: Props): import("react").JSX.Element;
@@ -19,7 +19,7 @@ export const TagColorsValues = [
19
19
  'pink',
20
20
  'slate',
21
21
  ];
22
- export default function Tag({ text = '', title = '', className = '', disabled = false, color = 'gray', size = 'large', type = 'low', onClick, }) {
22
+ export default function Tag({ text = '', title = '', className = '', disabled = false, color = 'gray', size = 'large', type = 'low', onClick, dataTour, }) {
23
23
  const getClassNames = cx('ds-tag', className, type, size, color, {
24
24
  disabled: disabled,
25
25
  });
@@ -28,9 +28,9 @@ export default function Tag({ text = '', title = '', className = '', disabled =
28
28
  dangerouslySetInnerHTML: { __html: title },
29
29
  }), placement: "top", arrow: true, children: (_jsx("div", { className: getClassNames, style: {
30
30
  cursor: title ? 'pointer' : '',
31
- }, onClick: (e) => onClick && onClick(e), children: text })) }));
31
+ }, onClick: (e) => onClick && onClick(e), "data-tour": dataTour, children: text })) }));
32
32
  }
33
33
  return (_jsx("div", { className: getClassNames, style: {
34
34
  cursor: title ? 'pointer' : '',
35
- }, onClick: (e) => onClick && onClick(e), children: text }));
35
+ }, onClick: (e) => onClick && onClick(e), "data-tour": dataTour, children: text }));
36
36
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "corpushub-design-system",
3
3
  "private": false,
4
- "version": "0.0.17",
4
+ "version": "0.0.19",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {