@ilo-org/react 0.9.1 → 0.10.0

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 (81) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/lib/cjs/components/Checkbox/Checkbox.js +1 -1
  3. package/lib/cjs/components/Checkbox/index.js +1 -1
  4. package/lib/cjs/components/DatePicker/DatePicker.js +1 -1
  5. package/lib/cjs/components/DatePicker/index.js +1 -1
  6. package/lib/cjs/components/Dropdown/Dropdown.js +1 -1
  7. package/lib/cjs/components/Dropdown/index.js +1 -1
  8. package/lib/cjs/components/Fieldset/Fieldset.js +1 -1
  9. package/lib/cjs/components/Fieldset/index.js +1 -1
  10. package/lib/cjs/components/FileUpload/FileUpload.js +1 -1
  11. package/lib/cjs/components/FileUpload/index.js +1 -1
  12. package/lib/cjs/components/FormControl/FormControl.js +1 -1
  13. package/lib/cjs/components/FormControl/index.js +1 -1
  14. package/lib/cjs/components/Hero/Hero.js +1 -1
  15. package/lib/cjs/components/Hero/index.js +1 -1
  16. package/lib/cjs/components/Input/Input.js +1 -1
  17. package/lib/cjs/components/Input/index.js +1 -1
  18. package/lib/cjs/components/Navigation/Navigation.js +1 -1
  19. package/lib/cjs/components/Navigation/index.js +1 -1
  20. package/lib/cjs/components/NumberPicker/NumberPicker.js +1 -1
  21. package/lib/cjs/components/NumberPicker/index.js +1 -1
  22. package/lib/cjs/components/Profile/Profile.js +4 -2
  23. package/lib/cjs/components/Radio/Radio.js +1 -1
  24. package/lib/cjs/components/Radio/index.js +1 -1
  25. package/lib/cjs/components/SearchField/SearchField.js +1 -1
  26. package/lib/cjs/components/SearchField/index.js +1 -1
  27. package/lib/cjs/components/TextInput/TextInput.js +1 -1
  28. package/lib/cjs/components/TextInput/index.js +1 -1
  29. package/lib/cjs/components/Textarea/Textarea.js +1 -1
  30. package/lib/cjs/components/Textarea/index.js +1 -1
  31. package/lib/cjs/components/Toggle/Toggle.js +1 -1
  32. package/lib/cjs/components/Toggle/index.js +1 -1
  33. package/lib/cjs/components/Tooltip/Tooltip.js +42 -72
  34. package/lib/cjs/components/Tooltip/index.js +1 -1
  35. package/lib/cjs/components/index.js +1 -0
  36. package/lib/cjs/index.js +1 -0
  37. package/lib/esm/components/Checkbox/Checkbox.js +1 -1
  38. package/lib/esm/components/Checkbox/index.js +1 -1
  39. package/lib/esm/components/DatePicker/DatePicker.js +1 -1
  40. package/lib/esm/components/DatePicker/index.js +1 -1
  41. package/lib/esm/components/Dropdown/Dropdown.js +1 -1
  42. package/lib/esm/components/Dropdown/index.js +1 -1
  43. package/lib/esm/components/Fieldset/Fieldset.js +1 -1
  44. package/lib/esm/components/Fieldset/index.js +1 -1
  45. package/lib/esm/components/FileUpload/FileUpload.js +1 -1
  46. package/lib/esm/components/FileUpload/index.js +1 -1
  47. package/lib/esm/components/FormControl/FormControl.js +1 -1
  48. package/lib/esm/components/FormControl/index.js +1 -1
  49. package/lib/esm/components/Hero/Hero.js +1 -1
  50. package/lib/esm/components/Hero/index.js +1 -1
  51. package/lib/esm/components/Input/Input.js +1 -1
  52. package/lib/esm/components/Input/index.js +1 -1
  53. package/lib/esm/components/Navigation/Navigation.js +1 -1
  54. package/lib/esm/components/Navigation/index.js +1 -1
  55. package/lib/esm/components/NumberPicker/NumberPicker.js +1 -1
  56. package/lib/esm/components/NumberPicker/index.js +1 -1
  57. package/lib/esm/components/Profile/Profile.js +4 -2
  58. package/lib/esm/components/Radio/Radio.js +1 -1
  59. package/lib/esm/components/Radio/index.js +1 -1
  60. package/lib/esm/components/SearchField/SearchField.js +1 -1
  61. package/lib/esm/components/SearchField/index.js +1 -1
  62. package/lib/esm/components/TextInput/TextInput.js +1 -1
  63. package/lib/esm/components/TextInput/index.js +1 -1
  64. package/lib/esm/components/Textarea/Textarea.js +1 -1
  65. package/lib/esm/components/Textarea/index.js +1 -1
  66. package/lib/esm/components/Toggle/Toggle.js +1 -1
  67. package/lib/esm/components/Toggle/index.js +1 -1
  68. package/lib/esm/components/Tooltip/Tooltip.js +42 -72
  69. package/lib/esm/components/Tooltip/index.js +1 -1
  70. package/lib/esm/components/index.js +1 -0
  71. package/lib/esm/index.js +1 -0
  72. package/lib/types/react/src/components/Profile/Profile.props.d.ts +9 -0
  73. package/lib/types/react/src/components/Tooltip/Tooltip.props.d.ts +3 -11
  74. package/lib/types/react/src/types/index.d.ts +1 -0
  75. package/package.json +16 -16
  76. package/src/components/Profile/Profile.props.ts +12 -0
  77. package/src/components/Profile/Profile.tsx +19 -11
  78. package/src/components/Tooltip/Tooltip.args.ts +1 -1
  79. package/src/components/Tooltip/Tooltip.props.ts +3 -13
  80. package/src/components/Tooltip/Tooltip.tsx +68 -91
  81. package/src/types/index.ts +1 -0
@@ -10,7 +10,7 @@ import '../../GlobalCtx-7fb23cfa.js';
10
10
  import '../SocialMedia/SocialMedia.js';
11
11
  import '../SocialMedia/index.js';
12
12
  import '../ContextMenu/ContextMenu.js';
13
- import 'react-dom';
13
+ import '@popperjs/core';
14
14
 
15
15
  const HeroImage = ({ url, alt }) => {
16
16
  const { prefix } = useGlobalSettings();
@@ -9,6 +9,6 @@ import '../../GlobalCtx-7fb23cfa.js';
9
9
  import '../Breadcrumb/Breadcrumb.js';
10
10
  import '../ContextMenu/ContextMenu.js';
11
11
  import '../Tooltip/Tooltip.js';
12
- import 'react-dom';
12
+ import '@popperjs/core';
13
13
  import '../SocialMedia/SocialMedia.js';
14
14
  import '../SocialMedia/index.js';
@@ -7,7 +7,7 @@ import 'tslib';
7
7
  import 'react';
8
8
  import '../../GlobalCtx-7fb23cfa.js';
9
9
  import '../Tooltip/Tooltip.js';
10
- import 'react-dom';
10
+ import '@popperjs/core';
11
11
 
12
12
  const Input = ({ callback, disabled = false, error, helper, id, label, name, placeholder, required, tooltip, type = "text", }) => {
13
13
  const { prefix } = useGlobalSettings();
@@ -7,5 +7,5 @@ import 'react';
7
7
  import '../../GlobalCtx-7fb23cfa.js';
8
8
  import '../Fieldset/Fieldset.js';
9
9
  import '../Tooltip/Tooltip.js';
10
- import 'react-dom';
10
+ import '@popperjs/core';
11
11
  import '../FormElement/FormElement.js';
@@ -9,7 +9,7 @@ import '../../GlobalCtx-7fb23cfa.js';
9
9
  import '../Input/Input.js';
10
10
  import '../Fieldset/Fieldset.js';
11
11
  import '../Tooltip/Tooltip.js';
12
- import 'react-dom';
12
+ import '@popperjs/core';
13
13
  import '../FormElement/FormElement.js';
14
14
 
15
15
  const Navigation = ({ logo, mobilelogo, siteurl, tagline, primarynav, subnav, menulabel, menucloselabel, searchlabel, searchfield, languagelabel, languagecontextmenu, }) => {
@@ -10,5 +10,5 @@ import '../SearchField/SearchField.js';
10
10
  import '../Input/Input.js';
11
11
  import '../Fieldset/Fieldset.js';
12
12
  import '../Tooltip/Tooltip.js';
13
- import 'react-dom';
13
+ import '@popperjs/core';
14
14
  import '../FormElement/FormElement.js';
@@ -7,7 +7,7 @@ import FormControl, { useFormControl } from '../FormControl/FormControl.js';
7
7
  import '../../GlobalCtx-7fb23cfa.js';
8
8
  import 'nanoid';
9
9
  import '../Tooltip/Tooltip.js';
10
- import 'react-dom';
10
+ import '@popperjs/core';
11
11
 
12
12
  const NumberPicker = require$$0.forwardRef(({ onChange, onBlur, disabled = false, error, id, name, placeholder, required, max, min, step, }, ref) => {
13
13
  const { prefix } = useGlobalSettings();
@@ -8,4 +8,4 @@ import '../../GlobalCtx-7fb23cfa.js';
8
8
  import '../FormControl/FormControl.js';
9
9
  import 'nanoid';
10
10
  import '../Tooltip/Tooltip.js';
11
- import 'react-dom';
11
+ import '@popperjs/core';
@@ -5,13 +5,15 @@ import 'tslib';
5
5
  import 'react';
6
6
  import '../../GlobalCtx-7fb23cfa.js';
7
7
 
8
- const Profile = ({ avatar, className, description, link, name, role, }) => {
8
+ const Profile = ({ avatar, className, description, link, name, role, theme = "light", size = "large", }) => {
9
9
  const { prefix } = useGlobalSettings();
10
10
  const baseClass = `${prefix}--profile`;
11
11
  const profileClasses = classNames(className, {
12
12
  [baseClass]: true,
13
+ [`${baseClass}__theme__${theme}`]: theme,
14
+ [`${baseClass}__size__${size}`]: size,
13
15
  });
14
- return (jsxs("figure", Object.assign({ className: profileClasses }, { children: [jsx("img", { className: `${baseClass}--avatar`, src: avatar, alt: `Avatar for ${name}` }), jsxs("figcaption", Object.assign({ className: `${baseClass}--contents` }, { children: [jsx("span", Object.assign({ className: `${baseClass}--name id` }, { children: name })), role && jsx("span", Object.assign({ className: `${baseClass}--role id` }, { children: role })), description && (jsx("p", Object.assign({ className: `${baseClass}--description info` }, { children: description }))), link && (jsx("a", Object.assign({ className: `${baseClass}--link info`, href: link.url }, { children: jsx("span", { children: link.label }) })))] }))] })));
16
+ return (jsxs("figure", Object.assign({ className: profileClasses }, { children: [jsx("img", { className: `${baseClass}--avatar`, src: avatar, alt: `Avatar for ${name}` }), jsx("figcaption", { children: jsxs("div", Object.assign({ className: `${baseClass}--figcaption--content` }, { children: [jsx("div", Object.assign({ className: `${baseClass}--name` }, { children: name })), role && jsx("div", Object.assign({ className: `${baseClass}--role` }, { children: role }))] })) }), description && (jsx("p", Object.assign({ className: `${baseClass}--description` }, { children: description }))), link && (jsx("div", Object.assign({ className: `${baseClass}--link` }, { children: jsx("a", Object.assign({ href: link.url, target: "__blank", rel: "noopener noreferrer" }, { children: jsx("span", Object.assign({ className: `${baseClass}--link--label` }, { children: link.label })) })) })))] })));
15
17
  };
16
18
 
17
19
  export { Profile as default };
@@ -8,7 +8,7 @@ import FormControl, { useFormControl } from '../FormControl/FormControl.js';
8
8
  import { usePrevious } from '../../hooks/usePrevious.js';
9
9
  import '../../GlobalCtx-7fb23cfa.js';
10
10
  import '../Tooltip/Tooltip.js';
11
- import 'react-dom';
11
+ import '@popperjs/core';
12
12
  import 'nanoid';
13
13
 
14
14
  const Radio = require$$0.forwardRef(({ onChange, onBlur, disabled = false, error, id, name, required, checked, defaultChecked = false, value, }, ref) => {
@@ -7,7 +7,7 @@ import '../../hooks/useGlobalSettings.js';
7
7
  import '../../GlobalCtx-7fb23cfa.js';
8
8
  import '../Fieldset/Fieldset.js';
9
9
  import '../Tooltip/Tooltip.js';
10
- import 'react-dom';
10
+ import '@popperjs/core';
11
11
  import '../FormControl/FormControl.js';
12
12
  import 'nanoid';
13
13
  import '../../hooks/usePrevious.js';
@@ -7,7 +7,7 @@ import 'react';
7
7
  import '../../GlobalCtx-7fb23cfa.js';
8
8
  import '../Fieldset/Fieldset.js';
9
9
  import '../Tooltip/Tooltip.js';
10
- import 'react-dom';
10
+ import '@popperjs/core';
11
11
  import '../FormElement/FormElement.js';
12
12
 
13
13
  const SearchField = ({ action, callback, className, input, }) => {
@@ -8,5 +8,5 @@ import '../../GlobalCtx-7fb23cfa.js';
8
8
  import '../Input/Input.js';
9
9
  import '../Fieldset/Fieldset.js';
10
10
  import '../Tooltip/Tooltip.js';
11
- import 'react-dom';
11
+ import '@popperjs/core';
12
12
  import '../FormElement/FormElement.js';
@@ -7,7 +7,7 @@ import FormControl, { useFormControl } from '../FormControl/FormControl.js';
7
7
  import '../../GlobalCtx-7fb23cfa.js';
8
8
  import 'nanoid';
9
9
  import '../Tooltip/Tooltip.js';
10
- import 'react-dom';
10
+ import '@popperjs/core';
11
11
 
12
12
  const TextInput = require$$0.forwardRef(({ onChange, onBlur, error, id, name, placeholder, required, pattern, disabled = false, type = "text", }, ref) => {
13
13
  const { prefix } = useGlobalSettings();
@@ -8,7 +8,7 @@ import '../../GlobalCtx-7fb23cfa.js';
8
8
  import '../FormControl/FormControl.js';
9
9
  import 'nanoid';
10
10
  import '../Tooltip/Tooltip.js';
11
- import 'react-dom';
11
+ import '@popperjs/core';
12
12
 
13
13
  const basic = {
14
14
  disabled: false,
@@ -7,7 +7,7 @@ import FormControl, { useFormControl } from '../FormControl/FormControl.js';
7
7
  import '../../GlobalCtx-7fb23cfa.js';
8
8
  import 'nanoid';
9
9
  import '../Tooltip/Tooltip.js';
10
- import 'react-dom';
10
+ import '@popperjs/core';
11
11
 
12
12
  const Textarea = require$$0.forwardRef((_a, ref) => {
13
13
  var { error, className, name, id } = _a, props = __rest(_a, ["error", "className", "name", "id"]);
@@ -8,7 +8,7 @@ import '../../GlobalCtx-7fb23cfa.js';
8
8
  import '../FormControl/FormControl.js';
9
9
  import 'nanoid';
10
10
  import '../Tooltip/Tooltip.js';
11
- import 'react-dom';
11
+ import '@popperjs/core';
12
12
 
13
13
  const placeholder = "It was a cold day in April and the clocks were striking thirteen....";
14
14
  const basic = {
@@ -7,7 +7,7 @@ import FormControl, { useFormControl } from '../FormControl/FormControl.js';
7
7
  import '../../GlobalCtx-7fb23cfa.js';
8
8
  import 'nanoid';
9
9
  import '../Tooltip/Tooltip.js';
10
- import 'react-dom';
10
+ import '@popperjs/core';
11
11
 
12
12
  const Toggle = forwardRef(({ size = "medium", error = false, disabled = false, defaultChecked = false, required = false, id, name, onChange, onBlur, onClick, checked, className, }, ref) => {
13
13
  const { prefix } = useGlobalSettings();
@@ -8,7 +8,7 @@ import 'classnames';
8
8
  import '../FormControl/FormControl.js';
9
9
  import 'nanoid';
10
10
  import '../Tooltip/Tooltip.js';
11
- import 'react-dom';
11
+ import '@popperjs/core';
12
12
 
13
13
  const Default = {
14
14
  defaultChecked: false,
@@ -2,100 +2,70 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { useState, useRef } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import useGlobalSettings from '../../hooks/useGlobalSettings.js';
5
- import ReactDOM from 'react-dom';
5
+ import { createPopper } from '@popperjs/core';
6
6
  import 'tslib';
7
7
  import '../../GlobalCtx-7fb23cfa.js';
8
8
 
9
- const Tooltip = ({ className, children, icon, label, theme, id, }) => {
9
+ const Tooltip = ({ className, children, icon, label, iconTheme, theme, id, }) => {
10
10
  const { prefix } = useGlobalSettings();
11
11
  const baseClass = `${prefix}--tooltip`;
12
12
  const [isVisible, setIsVisible] = useState(false);
13
- const [position, setPosition] = useState({
14
- x: 0,
15
- y: 0,
16
- });
17
- const [arrowPlacement, setArrowPlacement] = useState("center");
18
- const [arrowAlignment, setArrowAlignment] = useState("left");
19
13
  const tooltipRef = useRef(null);
14
+ const popperInstanceRef = useRef(null);
15
+ const isLongTooltip = () => {
16
+ var _a, _b;
17
+ const tooltipText = (((_a = tooltipRef.current) === null || _a === void 0 ? void 0 : _a.textContent) ||
18
+ ((_b = tooltipRef.current) === null || _b === void 0 ? void 0 : _b.innerText) ||
19
+ "").trim();
20
+ return tooltipText.length > 50;
21
+ };
20
22
  const tooltipClasses = classNames(className, {
21
23
  [baseClass]: true,
22
24
  [`${baseClass}--${theme}`]: theme,
23
- [`${baseClass}--alignment-${arrowAlignment}`]: arrowAlignment,
24
25
  [`${baseClass}--visible`]: isVisible,
26
+ [`${baseClass}--long`]: isLongTooltip(),
25
27
  });
26
- const tooltipArrowClasses = classNames(className, {
27
- [`${baseClass}--arrow`]: true,
28
- [`${baseClass}--arrow--placement-${arrowPlacement}`]: arrowPlacement,
28
+ const tooltipArrowClasses = classNames(`${baseClass}--arrow`, `${baseClass}--arrow--placement-negative`);
29
+ const iconClasses = classNames(className, `${baseClass}--wrapper`, {
30
+ [`${baseClass}--wrapper__icon ${baseClass}--wrapper__icon__theme__${theme}`]: icon,
31
+ [`${baseClass}--wrapper__icon__theme__${theme}`]: iconTheme,
29
32
  });
30
33
  const handleOnMouseOver = (e) => {
31
- // get hovered element reference
32
34
  const target = e.currentTarget;
33
- if (target) {
34
- const rect = target.getBoundingClientRect();
35
+ if (target && tooltipRef.current) {
36
+ const popperInstance = createPopper(target, tooltipRef.current, {
37
+ placement: "top",
38
+ modifiers: [
39
+ {
40
+ name: "offset",
41
+ options: {
42
+ offset: [0, 12], // Adjust offset as needed
43
+ },
44
+ },
45
+ {
46
+ name: "flip",
47
+ enabled: true,
48
+ },
49
+ {
50
+ name: "preventOverflow",
51
+ enabled: true,
52
+ },
53
+ ],
54
+ });
55
+ popperInstanceRef.current = popperInstance;
35
56
  setIsVisible(true);
36
- postMouseOver(rect);
37
- }
38
- };
39
- const postMouseOver = (hoverRect) => {
40
- // position the tooltip after showing it
41
- let placement = "center";
42
- let alignment = "left";
43
- const ttNode = ReactDOM.findDOMNode(tooltipRef.current);
44
- if (ttNode != null) {
45
- let x = 0, y = 0;
46
- const docWidth = document.documentElement.clientWidth, docHeight = document.documentElement.clientHeight;
47
- const rx = hoverRect.x + hoverRect.width, // most right x
48
- lx = hoverRect.x, // most left x
49
- ty = hoverRect.y, // most top y
50
- by = hoverRect.y + hoverRect.height; // most bottom y
51
- // tool tip rectange
52
- const ttRect = ttNode.getBoundingClientRect();
53
- const bRight = rx + ttRect.width <= window.scrollX + docWidth &&
54
- ty + ttRect.height <= window.scrollY + docHeight;
55
- const bLeft = lx - ttRect.width >= 0 &&
56
- ty + ttRect.height <= window.scrollY + docHeight;
57
- const bAbove = ty - ttRect.height >= 0;
58
- const bBellow = by + ttRect.height <= window.scrollY + docHeight;
59
- // the tooltip doesn't fit to the left
60
- if (bRight) {
61
- x = hoverRect.width + 16;
62
- y = icon ? -8 : 0;
63
- placement = "negative";
64
- alignment = "right";
65
- }
66
- else if (bBellow) {
67
- x = icon ? -8 : 0;
68
- y = hoverRect.height + 16;
69
- placement = "center";
70
- alignment = "bottom";
71
- }
72
- else if (bLeft) {
73
- x = -ttRect.width - 16;
74
- y = icon ? -8 : 0;
75
- placement = "negative";
76
- alignment = "left";
77
- }
78
- else if (bAbove) {
79
- x = icon ? -8 : 0;
80
- y = -ttRect.height - 16;
81
- placement = "center";
82
- alignment = "top";
83
- }
84
- setPosition({ x: x, y: y });
85
- setArrowPlacement(placement);
86
- setArrowAlignment(alignment);
87
57
  }
88
58
  };
89
59
  const handleOnMouseOut = () => {
60
+ if (popperInstanceRef.current) {
61
+ popperInstanceRef.current.destroy();
62
+ }
90
63
  setIsVisible(false);
91
64
  };
92
- const style = {
93
- // left: ((position.x + window.scrollX) + 'px'),
94
- // top: ((position.y + window.scrollY) + 'px')
95
- left: position.x + "px",
96
- top: position.y + "px",
65
+ const handleOnFocus = (e) => {
66
+ handleOnMouseOver(e);
97
67
  };
98
- return (jsxs("div", Object.assign({ className: `${baseClass}--wrapper ${icon && "has-icon"}`, onMouseOver: handleOnMouseOver, onFocus: handleOnMouseOver, onMouseOut: handleOnMouseOut, onBlur: handleOnMouseOut, id: id }, { children: [!icon && jsx(Fragment, { children: children }), jsxs("span", Object.assign({ className: tooltipClasses, style: style, ref: tooltipRef }, { children: [jsx("span", { className: tooltipArrowClasses, role: "presentation" }), label] }))] })));
68
+ return (jsxs("div", Object.assign({ className: iconClasses, onMouseOver: handleOnMouseOver, onFocus: handleOnFocus, onMouseOut: handleOnMouseOut, onBlur: handleOnMouseOut, id: id }, { children: [!icon && jsx(Fragment, { children: children }), jsxs("span", Object.assign({ className: tooltipClasses, ref: tooltipRef, "data-id": id, id: "tooltip", role: "tooltip", "aria-hidden": !isVisible }, { children: [jsx("span", { "data-popper-arrow": true, className: tooltipArrowClasses, "data-placement": "negative", role: "presentation" }), label] }))] })));
99
69
  };
100
70
 
101
71
  export { Tooltip as default };
@@ -5,4 +5,4 @@ import 'classnames';
5
5
  import '../../hooks/useGlobalSettings.js';
6
6
  import 'tslib';
7
7
  import '../../GlobalCtx-7fb23cfa.js';
8
- import 'react-dom';
8
+ import '@popperjs/core';
@@ -67,6 +67,7 @@ import '../utils/triggerBrowserReflow.js';
67
67
  import './FormControl/FormControl.js';
68
68
  import 'nanoid';
69
69
  import '../hooks/usePrevious.js';
70
+ import '@popperjs/core';
70
71
  import './Hero/HeroCard.js';
71
72
  import './SocialMedia/SocialMedia.js';
72
73
  import './Input/Input.js';
package/lib/esm/index.js CHANGED
@@ -66,6 +66,7 @@ import './utils/transitionEndListener.js';
66
66
  import './utils/triggerBrowserReflow.js';
67
67
  import './components/FormControl/FormControl.js';
68
68
  import 'nanoid';
69
+ import '@popperjs/core';
69
70
  import './hooks/usePrevious.js';
70
71
  import '@ilo-org/icons-react';
71
72
  import './components/Hero/HeroCard.js';
@@ -1,3 +1,4 @@
1
+ import { ThemeTypes, SizeTypes } from "../../types";
1
2
  interface LinkProps {
2
3
  /**
3
4
  * Specify the label for the the Profile's link
@@ -9,6 +10,14 @@ interface LinkProps {
9
10
  url?: Required<string>;
10
11
  }
11
12
  export interface ProfileProps {
13
+ /**
14
+ * Specify the theme for your profile component.
15
+ */
16
+ theme?: ThemeTypes;
17
+ /**
18
+ * Specify the size for your profile component.
19
+ */
20
+ size?: SizeTypes;
12
21
  /**
13
22
  * Specify an optional avatar to be added to your Profile component. Image *must* be a perfect square. CMS backend should provide a fallback if the avatar is not populated.
14
23
  */
@@ -1,4 +1,4 @@
1
- import { TooltipThemes } from "../../types";
1
+ import { TooltipThemes, TooltipIconThemes } from "../../types";
2
2
  export interface TooltipProps {
3
3
  /**
4
4
  * Specify an optional className to be added to your Tooltip.
@@ -20,20 +20,12 @@ export interface TooltipProps {
20
20
  * Set whether the tooltip is visible or not
21
21
  */
22
22
  isVisible?: boolean;
23
- /**
24
- * Callback fired onMouseOver
25
- */
26
- onMouseOver?: (e: React.MouseEventHandler<HTMLDivElement>) => any;
27
- /**
28
- * Callback fired onMouseOut
29
- */
30
- onMouseOut?: (e: React.MouseEventHandler<HTMLDivElement>) => any;
31
23
  /**
32
24
  * Describe the theme of the tooltip
33
25
  */
34
26
  theme?: Required<TooltipThemes>;
35
27
  /**
36
- * Set a width for the tooltip
28
+ * Describe the background theme of the tooltip
37
29
  */
38
- width?: string;
30
+ iconTheme?: Required<TooltipIconThemes>;
39
31
  }
@@ -13,6 +13,7 @@ export type LabelTypes = "default" | "actionable" | "light";
13
13
  export type LinkTypes = "light" | "dark" | "footer" | "button";
14
14
  export type LinkListThemes = "light" | "dark";
15
15
  export type TooltipThemes = "light" | "dark";
16
+ export type TooltipIconThemes = "light" | "dark";
16
17
  export type TooltipAlignment = "top" | "right" | "bottom" | "left";
17
18
  export type TooltipPlacement = "negative" | "center" | "positive";
18
19
  export type ListAlignment = "default" | "horizontal";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ilo-org/react",
3
- "version": "0.9.1",
3
+ "version": "0.10.0",
4
4
  "description": "React components for the ILO's Design System",
5
5
  "keywords": [
6
6
  "ui_patterns",
@@ -68,6 +68,7 @@
68
68
  ]
69
69
  },
70
70
  "dependencies": {
71
+ "@popperjs/core": "^2.11.8",
71
72
  "classnames": "^2.3.1",
72
73
  "dom-helpers": "^5.2.1",
73
74
  "nanoid": "^3.3.6",
@@ -76,7 +77,7 @@
76
77
  "@ilo-org/brand-assets": "0.2.0",
77
78
  "@ilo-org/fonts": "0.1.2",
78
79
  "@ilo-org/icons-react": "0.0.21",
79
- "@ilo-org/styles": "0.13.0",
80
+ "@ilo-org/styles": "0.13.1",
80
81
  "@ilo-org/themes": "0.7.0",
81
82
  "@ilo-org/utils": "0.0.11"
82
83
  },
@@ -84,21 +85,20 @@
84
85
  "@rollup/plugin-commonjs": "^23.0.2",
85
86
  "@rollup/plugin-json": "^5.0.1",
86
87
  "@rollup/plugin-node-resolve": "^15.0.1",
87
- "@storybook/addon-a11y": "7.5.0-alpha.1",
88
- "@storybook/addon-actions": "7.5.0-alpha.1",
89
- "@storybook/addon-docs": "7.5.0-alpha.1",
90
- "@storybook/addon-essentials": "7.5.0-alpha.1",
91
- "@storybook/addon-links": "7.5.0-alpha.1",
88
+ "@storybook/addon-a11y": "7.6.6",
89
+ "@storybook/addon-actions": "7.6.6",
90
+ "@storybook/addon-docs": "7.6.6",
91
+ "@storybook/addon-essentials": "7.6.6",
92
+ "@storybook/addon-links": "7.6.6",
92
93
  "@storybook/addon-styling": "^1.3.7",
93
- "@storybook/blocks": "7.5.0-alpha.1",
94
- "@storybook/builder-vite": "7.5.0-alpha.1",
95
- "@storybook/client-api": "7.5.0-alpha.1",
96
- "@storybook/manager-api": "7.5.0-alpha.1",
97
- "@storybook/node-logger": "7.5.0-alpha.1",
94
+ "@storybook/blocks": "7.6.6",
95
+ "@storybook/client-api": "7.6.6",
96
+ "@storybook/manager-api": "7.6.6",
97
+ "@storybook/node-logger": "7.6.6",
98
98
  "@storybook/preset-scss": "^1.0.3",
99
- "@storybook/react": "7.5.0-alpha.1",
100
- "@storybook/react-vite": "7.5.0-alpha.1",
101
- "@storybook/theming": "7.5.0-alpha.1",
99
+ "@storybook/react": "7.6.6",
100
+ "@storybook/react-vite": "7.6.6",
101
+ "@storybook/theming": "7.6.6",
102
102
  "@testing-library/jest-dom": "5.16.5",
103
103
  "@testing-library/react": "^12.1.2",
104
104
  "@testing-library/user-event": "^13.5.0",
@@ -124,7 +124,7 @@
124
124
  "rollup-plugin-peer-deps-external": "^2.2.4",
125
125
  "rollup-plugin-typescript2": "^0.34.1",
126
126
  "screenfull": "^5.2.0",
127
- "storybook": "7.5.0-alpha.1",
127
+ "storybook": "7.6.6",
128
128
  "storybook-addon-performance": "^0.17.1",
129
129
  "storybook-addon-rtl-direction": "^0.0.19",
130
130
  "ts-dedent": "^2.2.0",
@@ -1,3 +1,5 @@
1
+ import { ThemeTypes, SizeTypes } from "../../types";
2
+
1
3
  interface LinkProps {
2
4
  /**
3
5
  * Specify the label for the the Profile's link
@@ -11,6 +13,16 @@ interface LinkProps {
11
13
  }
12
14
 
13
15
  export interface ProfileProps {
16
+ /**
17
+ * Specify the theme for your profile component.
18
+ */
19
+ theme?: ThemeTypes;
20
+
21
+ /**
22
+ * Specify the size for your profile component.
23
+ */
24
+ size?: SizeTypes;
25
+
14
26
  /**
15
27
  * Specify an optional avatar to be added to your Profile component. Image *must* be a perfect square. CMS backend should provide a fallback if the avatar is not populated.
16
28
  */
@@ -10,11 +10,15 @@ const Profile: FC<ProfileProps> = ({
10
10
  link,
11
11
  name,
12
12
  role,
13
+ theme = "light",
14
+ size = "large",
13
15
  }) => {
14
16
  const { prefix } = useGlobalSettings();
15
17
  const baseClass = `${prefix}--profile`;
16
18
  const profileClasses = classNames(className, {
17
19
  [baseClass]: true,
20
+ [`${baseClass}__theme__${theme}`]: theme,
21
+ [`${baseClass}__size__${size}`]: size,
18
22
  });
19
23
 
20
24
  return (
@@ -24,18 +28,22 @@ const Profile: FC<ProfileProps> = ({
24
28
  src={avatar}
25
29
  alt={`Avatar for ${name}`}
26
30
  />
27
- <figcaption className={`${baseClass}--contents`}>
28
- <span className={`${baseClass}--name id`}>{name}</span>
29
- {role && <span className={`${baseClass}--role id`}>{role}</span>}
30
- {description && (
31
- <p className={`${baseClass}--description info`}>{description}</p>
32
- )}
33
- {link && (
34
- <a className={`${baseClass}--link info`} href={link.url}>
35
- <span>{link.label}</span>
36
- </a>
37
- )}
31
+ <figcaption>
32
+ <div className={`${baseClass}--figcaption--content`}>
33
+ <div className={`${baseClass}--name`}>{name}</div>
34
+ {role && <div className={`${baseClass}--role`}>{role}</div>}
35
+ </div>
38
36
  </figcaption>
37
+ {description && (
38
+ <p className={`${baseClass}--description`}>{description}</p>
39
+ )}
40
+ {link && (
41
+ <div className={`${baseClass}--link`}>
42
+ <a href={link.url} target="__blank" rel="noopener noreferrer">
43
+ <span className={`${baseClass}--link--label`}>{link.label}</span>
44
+ </a>
45
+ </div>
46
+ )}
39
47
  </figure>
40
48
  );
41
49
  };
@@ -22,7 +22,7 @@ const dark: TooltipProps = {
22
22
  const darkicon: TooltipProps = {
23
23
  icon: true,
24
24
  label: "This is a tooltip for an icon",
25
- theme: "dark", // "light" | "dark" ;
25
+ iconTheme: "dark", // "light" | "dark" ;
26
26
  isVisible: false,
27
27
  };
28
28
 
@@ -1,4 +1,4 @@
1
- import { TooltipThemes } from "../../types";
1
+ import { TooltipThemes, TooltipIconThemes } from "../../types";
2
2
 
3
3
  export interface TooltipProps {
4
4
  /**
@@ -26,23 +26,13 @@ export interface TooltipProps {
26
26
  */
27
27
  isVisible?: boolean;
28
28
 
29
- /**
30
- * Callback fired onMouseOver
31
- */
32
- onMouseOver?: (e: React.MouseEventHandler<HTMLDivElement>) => any;
33
-
34
- /**
35
- * Callback fired onMouseOut
36
- */
37
- onMouseOut?: (e: React.MouseEventHandler<HTMLDivElement>) => any;
38
-
39
29
  /**
40
30
  * Describe the theme of the tooltip
41
31
  */
42
32
  theme?: Required<TooltipThemes>;
43
33
 
44
34
  /**
45
- * Set a width for the tooltip
35
+ * Describe the background theme of the tooltip
46
36
  */
47
- width?: string;
37
+ iconTheme?: Required<TooltipIconThemes>;
48
38
  }