@ilo-org/react 0.9.1 → 0.10.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.
- package/CHANGELOG.md +25 -0
- package/lib/cjs/components/Button/Button.js +2 -2
- package/lib/cjs/components/Button/index.js +12 -3
- package/lib/cjs/components/Card/Card.js +1 -1
- package/lib/cjs/components/Checkbox/Checkbox.js +1 -1
- package/lib/cjs/components/Checkbox/index.js +1 -1
- package/lib/cjs/components/DatePicker/DatePicker.js +1 -1
- package/lib/cjs/components/DatePicker/index.js +1 -1
- package/lib/cjs/components/Dropdown/Dropdown.js +2 -2
- package/lib/cjs/components/Dropdown/index.js +1 -1
- package/lib/cjs/components/Fieldset/Fieldset.js +1 -1
- package/lib/cjs/components/Fieldset/index.js +1 -1
- package/lib/cjs/components/FileUpload/FileUpload.js +1 -1
- package/lib/cjs/components/FileUpload/index.js +1 -1
- package/lib/cjs/components/FormControl/FormControl.js +1 -1
- package/lib/cjs/components/FormControl/index.js +1 -1
- package/lib/cjs/components/Hero/Hero.js +1 -1
- package/lib/cjs/components/Hero/index.js +1 -1
- package/lib/cjs/components/Input/Input.js +1 -1
- package/lib/cjs/components/Input/index.js +1 -1
- package/lib/cjs/components/Navigation/Navigation.js +1 -1
- package/lib/cjs/components/Navigation/index.js +1 -1
- package/lib/cjs/components/NumberPicker/NumberPicker.js +1 -1
- package/lib/cjs/components/NumberPicker/index.js +1 -1
- package/lib/cjs/components/Profile/Profile.js +4 -2
- package/lib/cjs/components/Radio/Radio.js +1 -1
- package/lib/cjs/components/Radio/index.js +1 -1
- package/lib/cjs/components/SearchField/SearchField.js +1 -1
- package/lib/cjs/components/SearchField/index.js +1 -1
- package/lib/cjs/components/TextInput/TextInput.js +1 -1
- package/lib/cjs/components/TextInput/index.js +1 -1
- package/lib/cjs/components/Textarea/Textarea.js +1 -1
- package/lib/cjs/components/Textarea/index.js +1 -1
- package/lib/cjs/components/Toggle/Toggle.js +1 -1
- package/lib/cjs/components/Toggle/index.js +1 -1
- package/lib/cjs/components/Tooltip/Tooltip.js +42 -72
- package/lib/cjs/components/Tooltip/index.js +1 -1
- package/lib/cjs/components/index.js +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/esm/components/Button/Button.js +2 -2
- package/lib/esm/components/Button/index.js +12 -3
- package/lib/esm/components/Card/Card.js +1 -1
- package/lib/esm/components/Checkbox/Checkbox.js +1 -1
- package/lib/esm/components/Checkbox/index.js +1 -1
- package/lib/esm/components/DatePicker/DatePicker.js +1 -1
- package/lib/esm/components/DatePicker/index.js +1 -1
- package/lib/esm/components/Dropdown/Dropdown.js +2 -2
- package/lib/esm/components/Dropdown/index.js +1 -1
- package/lib/esm/components/Fieldset/Fieldset.js +1 -1
- package/lib/esm/components/Fieldset/index.js +1 -1
- package/lib/esm/components/FileUpload/FileUpload.js +1 -1
- package/lib/esm/components/FileUpload/index.js +1 -1
- package/lib/esm/components/FormControl/FormControl.js +1 -1
- package/lib/esm/components/FormControl/index.js +1 -1
- package/lib/esm/components/Hero/Hero.js +1 -1
- package/lib/esm/components/Hero/index.js +1 -1
- package/lib/esm/components/Input/Input.js +1 -1
- package/lib/esm/components/Input/index.js +1 -1
- package/lib/esm/components/Navigation/Navigation.js +1 -1
- package/lib/esm/components/Navigation/index.js +1 -1
- package/lib/esm/components/NumberPicker/NumberPicker.js +1 -1
- package/lib/esm/components/NumberPicker/index.js +1 -1
- package/lib/esm/components/Profile/Profile.js +4 -2
- package/lib/esm/components/Radio/Radio.js +1 -1
- package/lib/esm/components/Radio/index.js +1 -1
- package/lib/esm/components/SearchField/SearchField.js +1 -1
- package/lib/esm/components/SearchField/index.js +1 -1
- package/lib/esm/components/TextInput/TextInput.js +1 -1
- package/lib/esm/components/TextInput/index.js +1 -1
- package/lib/esm/components/Textarea/Textarea.js +1 -1
- package/lib/esm/components/Textarea/index.js +1 -1
- package/lib/esm/components/Toggle/Toggle.js +1 -1
- package/lib/esm/components/Toggle/index.js +1 -1
- package/lib/esm/components/Tooltip/Tooltip.js +42 -72
- package/lib/esm/components/Tooltip/index.js +1 -1
- package/lib/esm/components/index.js +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/types/react/src/components/Button/Button.props.d.ts +4 -0
- package/lib/types/react/src/components/Profile/Profile.props.d.ts +9 -0
- package/lib/types/react/src/components/Tooltip/Tooltip.props.d.ts +3 -11
- package/lib/types/react/src/types/index.d.ts +1 -0
- package/package.json +16 -16
- package/src/components/Button/Button.args.ts +12 -3
- package/src/components/Button/Button.props.ts +5 -0
- package/src/components/Button/Button.tsx +2 -0
- package/src/components/Card/Card.tsx +1 -1
- package/src/components/Dropdown/Dropdown.tsx +3 -1
- package/src/components/Profile/Profile.props.ts +12 -0
- package/src/components/Profile/Profile.tsx +19 -11
- package/src/components/Tooltip/Tooltip.args.ts +1 -1
- package/src/components/Tooltip/Tooltip.props.ts +3 -13
- package/src/components/Tooltip/Tooltip.tsx +68 -91
- package/src/types/index.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @ilo-org/react
|
|
2
2
|
|
|
3
|
+
## 0.10.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 67ac66a79: Refactor option label to be a child component instead of an attribute to improve screen reader experience
|
|
8
|
+
- e34e17292: Add optional name paramater that will pass a string to the button element's underlying name attribute
|
|
9
|
+
- d74d0161f: Refactor card heading from h5 to h3 to ensure headings are in sequential order to improve accessibility
|
|
10
|
+
- Updated dependencies [16dea2974]
|
|
11
|
+
- Updated dependencies [0d0341a3c]
|
|
12
|
+
- @ilo-org/styles@0.13.2
|
|
13
|
+
|
|
14
|
+
## 0.10.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- 4630eea87: Upgrade react storybook to 7.6.6
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- d20d3c750: Sync tooltip with twig
|
|
23
|
+
- 857b7b57b: Sync profile with twig
|
|
24
|
+
- Updated dependencies [08a2141cc]
|
|
25
|
+
- Updated dependencies [dea2d0a07]
|
|
26
|
+
- @ilo-org/styles@0.13.1
|
|
27
|
+
|
|
3
28
|
## 0.9.1
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
|
@@ -10,7 +10,7 @@ require('react');
|
|
|
10
10
|
require('../../GlobalCtx-97e4b433.js');
|
|
11
11
|
require('@ilo-org/icons-react');
|
|
12
12
|
|
|
13
|
-
const Button = ({ callback, className, disabled = false, icon, icononly, iconPosition, kind = "button", label, opensmodal, size = "large", target = "", type = "primary", url, style, }) => {
|
|
13
|
+
const Button = ({ callback, className, disabled = false, icon, icononly, iconPosition, kind = "button", label, opensmodal, size = "large", target = "", type = "primary", url, style, name, }) => {
|
|
14
14
|
const { prefix } = hooks_useGlobalSettings();
|
|
15
15
|
const baseClass = `${prefix}--button`;
|
|
16
16
|
const hasURL = !!url;
|
|
@@ -30,7 +30,7 @@ const Button = ({ callback, className, disabled = false, icon, icononly, iconPos
|
|
|
30
30
|
callback(e);
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: hasURL ? (jsxRuntime.jsx(components_Link_Link, Object.assign({ className: ButtonClasses, target: target, url: url, label: label, style: style }, { children: icon && jsxRuntime.jsx(components_Icon_Icon, { name: icon, hidden: true }) }))) : (jsxRuntime.jsxs("button", Object.assign({ className: ButtonClasses, onClick: (e) => handleClick(e), disabled: disabled, type: kind, "aria-haspopup": opensmodal ? `dialog` : false, style: style }, { children: [label && jsxRuntime.jsx("span", Object.assign({ className: "button__label" }, { children: label })), icon && jsxRuntime.jsx(components_Icon_Icon, { name: icon, hidden: true })] }))) }));
|
|
33
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: hasURL ? (jsxRuntime.jsx(components_Link_Link, Object.assign({ className: ButtonClasses, target: target, url: url, label: label, style: style }, { children: icon && jsxRuntime.jsx(components_Icon_Icon, { name: icon, hidden: true }) }))) : (jsxRuntime.jsxs("button", Object.assign({ className: ButtonClasses, onClick: (e) => handleClick(e), disabled: disabled, type: kind, "aria-haspopup": opensmodal ? `dialog` : false, style: style, name: name }, { children: [label && jsxRuntime.jsx("span", Object.assign({ className: "button__label" }, { children: label })), icon && jsxRuntime.jsx(components_Icon_Icon, { name: icon, hidden: true })] }))) }));
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
module.exports = Button;
|
|
@@ -15,10 +15,19 @@ const primary = {
|
|
|
15
15
|
type: "primary",
|
|
16
16
|
label: "Primary",
|
|
17
17
|
size: "medium",
|
|
18
|
+
name: "primary",
|
|
18
19
|
};
|
|
19
|
-
const secondary = {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
const secondary = {
|
|
21
|
+
type: "secondary",
|
|
22
|
+
label: "Secondary",
|
|
23
|
+
name: "secondary",
|
|
24
|
+
};
|
|
25
|
+
const tertiary = {
|
|
26
|
+
type: "tertiary",
|
|
27
|
+
label: "Tertiary",
|
|
28
|
+
name: "tertiary",
|
|
29
|
+
};
|
|
30
|
+
const alert = { type: "alert", label: "Alert", name: "alert" };
|
|
22
31
|
const icon = { type: "primary", label: "Icon", icon: "close" };
|
|
23
32
|
const disabled = {
|
|
24
33
|
type: "primary",
|
|
@@ -28,7 +28,7 @@ const Card = ({ isvideo, eyebrow, title, color, theme, variant, size, cornercut,
|
|
|
28
28
|
return (jsxRuntime.jsxs("div", Object.assign({ className: cardClasses }, { children: [link &&
|
|
29
29
|
variant != "data" &&
|
|
30
30
|
variant != "factlist" &&
|
|
31
|
-
variant != "stat" && (jsxRuntime.jsx("a", Object.assign({ className: `${baseClass}--link`, href: link, title: title }, { children: jsxRuntime.jsx("span", Object.assign({ className: `${baseClass}--link--text` }, { children: title })) }))), jsxRuntime.jsxs("div", Object.assign({ className: `${baseClass}--wrap` }, { children: [image && (jsxRuntime.jsx("div", Object.assign({ className: `${baseClass}--image--wrapper` }, { children: jsxRuntime.jsx("picture", { children: jsxRuntime.jsx("img", { className: `${baseClass}--image`, src: image, alt: title }) }) }))), jsxRuntime.jsxs("div", Object.assign({ className: `${baseClass}--content` }, { children: [eyebrow && jsxRuntime.jsx("p", Object.assign({ className: `${baseClass}--eyebrow` }, { children: eyebrow })), title && jsxRuntime.jsx("
|
|
31
|
+
variant != "stat" && (jsxRuntime.jsx("a", Object.assign({ className: `${baseClass}--link`, href: link, title: title }, { children: jsxRuntime.jsx("span", Object.assign({ className: `${baseClass}--link--text` }, { children: title })) }))), jsxRuntime.jsxs("div", Object.assign({ className: `${baseClass}--wrap` }, { children: [image && (jsxRuntime.jsx("div", Object.assign({ className: `${baseClass}--image--wrapper` }, { children: jsxRuntime.jsx("picture", { children: jsxRuntime.jsx("img", { className: `${baseClass}--image`, src: image, alt: title }) }) }))), jsxRuntime.jsxs("div", Object.assign({ className: `${baseClass}--content` }, { children: [eyebrow && jsxRuntime.jsx("p", Object.assign({ className: `${baseClass}--eyebrow` }, { children: eyebrow })), title && jsxRuntime.jsx("h3", Object.assign({ className: `${baseClass}--title` }, { children: title })), (variant == "multilink" || (variant == "data" && image)) && (jsxRuntime.jsx("div", Object.assign({ className: `${baseClass}--image--wrapper` }, { children: jsxRuntime.jsx("picture", { children: jsxRuntime.jsx("img", { className: `${baseClass}--image`, src: image, alt: title }) }) }))), intro && jsxRuntime.jsx("p", Object.assign({ className: `${baseClass}--intro` }, { children: intro })), date &&
|
|
32
32
|
variant != "stat" &&
|
|
33
33
|
variant != "data" &&
|
|
34
34
|
variant != "graphicpromo" &&
|
|
@@ -10,7 +10,7 @@ var components_FormControl_FormControl = require('../FormControl/FormControl.js'
|
|
|
10
10
|
var hooks_usePrevious = require('../../hooks/usePrevious.js');
|
|
11
11
|
require('../../GlobalCtx-97e4b433.js');
|
|
12
12
|
require('../Tooltip/Tooltip.js');
|
|
13
|
-
require('
|
|
13
|
+
require('@popperjs/core');
|
|
14
14
|
require('nanoid');
|
|
15
15
|
|
|
16
16
|
const Checkbox = require$$0.forwardRef((props, ref) => {
|
|
@@ -9,7 +9,7 @@ require('../../hooks/useGlobalSettings.js');
|
|
|
9
9
|
require('../../GlobalCtx-97e4b433.js');
|
|
10
10
|
require('../Fieldset/Fieldset.js');
|
|
11
11
|
require('../Tooltip/Tooltip.js');
|
|
12
|
-
require('
|
|
12
|
+
require('@popperjs/core');
|
|
13
13
|
require('../FormControl/FormControl.js');
|
|
14
14
|
require('nanoid');
|
|
15
15
|
require('../../hooks/usePrevious.js');
|
|
@@ -9,7 +9,7 @@ var components_FormControl_FormControl = require('../FormControl/FormControl.js'
|
|
|
9
9
|
require('../../GlobalCtx-97e4b433.js');
|
|
10
10
|
require('nanoid');
|
|
11
11
|
require('../Tooltip/Tooltip.js');
|
|
12
|
-
require('
|
|
12
|
+
require('@popperjs/core');
|
|
13
13
|
|
|
14
14
|
const DatePicker = require$$0.forwardRef((props, ref) => {
|
|
15
15
|
const { onChange, onBlur, disabled = false, error, id, name, placeholder, required, max, min, step, } = props;
|
|
@@ -9,7 +9,7 @@ var components_FormControl_FormControl = require('../FormControl/FormControl.js'
|
|
|
9
9
|
require('../../GlobalCtx-97e4b433.js');
|
|
10
10
|
require('nanoid');
|
|
11
11
|
require('../Tooltip/Tooltip.js');
|
|
12
|
-
require('
|
|
12
|
+
require('@popperjs/core');
|
|
13
13
|
|
|
14
14
|
const Dropdown = require$$0.forwardRef((props, ref) => {
|
|
15
15
|
const { autocomplete, onChange, onBlur, disabled = false, error, id, name, options, required, value, form, multiple, selectSize, } = props;
|
|
@@ -28,7 +28,7 @@ const Dropdown = require$$0.forwardRef((props, ref) => {
|
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
return (jsxRuntime.jsx("div", Object.assign({ className: `${baseClass}--wrapper` }, { children: jsxRuntime.jsx("select", Object.assign({ ref: ref, id: id ? id : name, autoComplete: autocomplete, name: name, required: required, onChange: handleChange, onBlur: onBlur, disabled: disabled, className: dropdownClasses, value: currentvalue, form: form, multiple: multiple, size: selectSize, "aria-describedby": ariaDescribedBy }, { children: options &&
|
|
31
|
-
options.map((option, i) => (jsxRuntime.jsx("option", { disabled: option.disabled, label: option.label, value: option.value }, `${baseClass}--option--${i}`))) })) })));
|
|
31
|
+
options.map((option, i) => (jsxRuntime.jsx("option", Object.assign({ disabled: option.disabled, label: option.label, value: option.value }, { children: option.label }), `${baseClass}--option--${i}`))) })) })));
|
|
32
32
|
});
|
|
33
33
|
const LabelledDropdown = require$$0.forwardRef((props, ref) => {
|
|
34
34
|
const { style, inputStyle, className } = props, rest = tslib.__rest(props, ["style", "inputStyle", "className"]);
|
|
@@ -9,7 +9,7 @@ var classNames = require('classnames');
|
|
|
9
9
|
var hooks_useGlobalSettings = require('../../hooks/useGlobalSettings.js');
|
|
10
10
|
var components_Tooltip_Tooltip = require('../Tooltip/Tooltip.js');
|
|
11
11
|
require('../../GlobalCtx-97e4b433.js');
|
|
12
|
-
require('
|
|
12
|
+
require('@popperjs/core');
|
|
13
13
|
|
|
14
14
|
// Create a new context for the error state
|
|
15
15
|
const FieldsetErrorContext = require$$0.createContext({
|
|
@@ -9,7 +9,7 @@ var components_FormControl_FormControl = require('../FormControl/FormControl.js'
|
|
|
9
9
|
require('../../GlobalCtx-97e4b433.js');
|
|
10
10
|
require('nanoid');
|
|
11
11
|
require('../Tooltip/Tooltip.js');
|
|
12
|
-
require('
|
|
12
|
+
require('@popperjs/core');
|
|
13
13
|
|
|
14
14
|
function formatBytes(bytes, decimals = 2) {
|
|
15
15
|
if (!+bytes)
|
|
@@ -10,7 +10,7 @@ var hooks_useGlobalSettings = require('../../hooks/useGlobalSettings.js');
|
|
|
10
10
|
var components_Tooltip_Tooltip = require('../Tooltip/Tooltip.js');
|
|
11
11
|
require('tslib');
|
|
12
12
|
require('../../GlobalCtx-97e4b433.js');
|
|
13
|
-
require('
|
|
13
|
+
require('@popperjs/core');
|
|
14
14
|
|
|
15
15
|
// Calculates unique IDs for the internal accessibility elements
|
|
16
16
|
// TODO: When we upgrade to React 8, this should use useId instead
|
|
@@ -12,7 +12,7 @@ require('../../GlobalCtx-97e4b433.js');
|
|
|
12
12
|
require('../SocialMedia/SocialMedia.js');
|
|
13
13
|
require('../SocialMedia/index.js');
|
|
14
14
|
require('../ContextMenu/ContextMenu.js');
|
|
15
|
-
require('
|
|
15
|
+
require('@popperjs/core');
|
|
16
16
|
|
|
17
17
|
const HeroImage = ({ url, alt }) => {
|
|
18
18
|
const { prefix } = hooks_useGlobalSettings();
|
|
@@ -11,7 +11,7 @@ require('../../GlobalCtx-97e4b433.js');
|
|
|
11
11
|
require('../Breadcrumb/Breadcrumb.js');
|
|
12
12
|
require('../ContextMenu/ContextMenu.js');
|
|
13
13
|
require('../Tooltip/Tooltip.js');
|
|
14
|
-
require('
|
|
14
|
+
require('@popperjs/core');
|
|
15
15
|
require('../SocialMedia/SocialMedia.js');
|
|
16
16
|
require('../SocialMedia/index.js');
|
|
17
17
|
|
|
@@ -9,7 +9,7 @@ require('tslib');
|
|
|
9
9
|
require('react');
|
|
10
10
|
require('../../GlobalCtx-97e4b433.js');
|
|
11
11
|
require('../Tooltip/Tooltip.js');
|
|
12
|
-
require('
|
|
12
|
+
require('@popperjs/core');
|
|
13
13
|
|
|
14
14
|
const Input = ({ callback, disabled = false, error, helper, id, label, name, placeholder, required, tooltip, type = "text", }) => {
|
|
15
15
|
const { prefix } = hooks_useGlobalSettings();
|
|
@@ -11,7 +11,7 @@ require('../../GlobalCtx-97e4b433.js');
|
|
|
11
11
|
require('../Input/Input.js');
|
|
12
12
|
require('../Fieldset/Fieldset.js');
|
|
13
13
|
require('../Tooltip/Tooltip.js');
|
|
14
|
-
require('
|
|
14
|
+
require('@popperjs/core');
|
|
15
15
|
require('../FormElement/FormElement.js');
|
|
16
16
|
|
|
17
17
|
const Navigation = ({ logo, mobilelogo, siteurl, tagline, primarynav, subnav, menulabel, menucloselabel, searchlabel, searchfield, languagelabel, languagecontextmenu, }) => {
|
|
@@ -9,7 +9,7 @@ var components_FormControl_FormControl = require('../FormControl/FormControl.js'
|
|
|
9
9
|
require('../../GlobalCtx-97e4b433.js');
|
|
10
10
|
require('nanoid');
|
|
11
11
|
require('../Tooltip/Tooltip.js');
|
|
12
|
-
require('
|
|
12
|
+
require('@popperjs/core');
|
|
13
13
|
|
|
14
14
|
const NumberPicker = require$$0.forwardRef(({ onChange, onBlur, disabled = false, error, id, name, placeholder, required, max, min, step, }, ref) => {
|
|
15
15
|
const { prefix } = hooks_useGlobalSettings();
|
|
@@ -7,13 +7,15 @@ require('tslib');
|
|
|
7
7
|
require('react');
|
|
8
8
|
require('../../GlobalCtx-97e4b433.js');
|
|
9
9
|
|
|
10
|
-
const Profile = ({ avatar, className, description, link, name, role, }) => {
|
|
10
|
+
const Profile = ({ avatar, className, description, link, name, role, theme = "light", size = "large", }) => {
|
|
11
11
|
const { prefix } = hooks_useGlobalSettings();
|
|
12
12
|
const baseClass = `${prefix}--profile`;
|
|
13
13
|
const profileClasses = classNames(className, {
|
|
14
14
|
[baseClass]: true,
|
|
15
|
+
[`${baseClass}__theme__${theme}`]: theme,
|
|
16
|
+
[`${baseClass}__size__${size}`]: size,
|
|
15
17
|
});
|
|
16
|
-
return (jsxRuntime.jsxs("figure", Object.assign({ className: profileClasses }, { children: [jsxRuntime.jsx("img", { className: `${baseClass}--avatar`, src: avatar, alt: `Avatar for ${name}` }), jsxRuntime.
|
|
18
|
+
return (jsxRuntime.jsxs("figure", Object.assign({ className: profileClasses }, { children: [jsxRuntime.jsx("img", { className: `${baseClass}--avatar`, src: avatar, alt: `Avatar for ${name}` }), jsxRuntime.jsx("figcaption", { children: jsxRuntime.jsxs("div", Object.assign({ className: `${baseClass}--figcaption--content` }, { children: [jsxRuntime.jsx("div", Object.assign({ className: `${baseClass}--name` }, { children: name })), role && jsxRuntime.jsx("div", Object.assign({ className: `${baseClass}--role` }, { children: role }))] })) }), description && (jsxRuntime.jsx("p", Object.assign({ className: `${baseClass}--description` }, { children: description }))), link && (jsxRuntime.jsx("div", Object.assign({ className: `${baseClass}--link` }, { children: jsxRuntime.jsx("a", Object.assign({ href: link.url, target: "__blank", rel: "noopener noreferrer" }, { children: jsxRuntime.jsx("span", Object.assign({ className: `${baseClass}--link--label` }, { children: link.label })) })) })))] })));
|
|
17
19
|
};
|
|
18
20
|
|
|
19
21
|
module.exports = Profile;
|
|
@@ -10,7 +10,7 @@ var components_FormControl_FormControl = require('../FormControl/FormControl.js'
|
|
|
10
10
|
var hooks_usePrevious = require('../../hooks/usePrevious.js');
|
|
11
11
|
require('../../GlobalCtx-97e4b433.js');
|
|
12
12
|
require('../Tooltip/Tooltip.js');
|
|
13
|
-
require('
|
|
13
|
+
require('@popperjs/core');
|
|
14
14
|
require('nanoid');
|
|
15
15
|
|
|
16
16
|
const Radio = require$$0.forwardRef(({ onChange, onBlur, disabled = false, error, id, name, required, checked, defaultChecked = false, value, }, ref) => {
|
|
@@ -9,7 +9,7 @@ require('../../hooks/useGlobalSettings.js');
|
|
|
9
9
|
require('../../GlobalCtx-97e4b433.js');
|
|
10
10
|
require('../Fieldset/Fieldset.js');
|
|
11
11
|
require('../Tooltip/Tooltip.js');
|
|
12
|
-
require('
|
|
12
|
+
require('@popperjs/core');
|
|
13
13
|
require('../FormControl/FormControl.js');
|
|
14
14
|
require('nanoid');
|
|
15
15
|
require('../../hooks/usePrevious.js');
|
|
@@ -9,7 +9,7 @@ require('react');
|
|
|
9
9
|
require('../../GlobalCtx-97e4b433.js');
|
|
10
10
|
require('../Fieldset/Fieldset.js');
|
|
11
11
|
require('../Tooltip/Tooltip.js');
|
|
12
|
-
require('
|
|
12
|
+
require('@popperjs/core');
|
|
13
13
|
require('../FormElement/FormElement.js');
|
|
14
14
|
|
|
15
15
|
const SearchField = ({ action, callback, className, input, }) => {
|
|
@@ -9,7 +9,7 @@ var components_FormControl_FormControl = require('../FormControl/FormControl.js'
|
|
|
9
9
|
require('../../GlobalCtx-97e4b433.js');
|
|
10
10
|
require('nanoid');
|
|
11
11
|
require('../Tooltip/Tooltip.js');
|
|
12
|
-
require('
|
|
12
|
+
require('@popperjs/core');
|
|
13
13
|
|
|
14
14
|
const TextInput = require$$0.forwardRef(({ onChange, onBlur, error, id, name, placeholder, required, pattern, disabled = false, type = "text", }, ref) => {
|
|
15
15
|
const { prefix } = hooks_useGlobalSettings();
|
|
@@ -9,7 +9,7 @@ var components_FormControl_FormControl = require('../FormControl/FormControl.js'
|
|
|
9
9
|
require('../../GlobalCtx-97e4b433.js');
|
|
10
10
|
require('nanoid');
|
|
11
11
|
require('../Tooltip/Tooltip.js');
|
|
12
|
-
require('
|
|
12
|
+
require('@popperjs/core');
|
|
13
13
|
|
|
14
14
|
const Textarea = require$$0.forwardRef((_a, ref) => {
|
|
15
15
|
var { error, className, name, id } = _a, props = tslib.__rest(_a, ["error", "className", "name", "id"]);
|
|
@@ -10,7 +10,7 @@ require('../../GlobalCtx-97e4b433.js');
|
|
|
10
10
|
require('../FormControl/FormControl.js');
|
|
11
11
|
require('nanoid');
|
|
12
12
|
require('../Tooltip/Tooltip.js');
|
|
13
|
-
require('
|
|
13
|
+
require('@popperjs/core');
|
|
14
14
|
|
|
15
15
|
const placeholder = "It was a cold day in April and the clocks were striking thirteen....";
|
|
16
16
|
const basic = {
|
|
@@ -9,7 +9,7 @@ var components_FormControl_FormControl = require('../FormControl/FormControl.js'
|
|
|
9
9
|
require('../../GlobalCtx-97e4b433.js');
|
|
10
10
|
require('nanoid');
|
|
11
11
|
require('../Tooltip/Tooltip.js');
|
|
12
|
-
require('
|
|
12
|
+
require('@popperjs/core');
|
|
13
13
|
|
|
14
14
|
const Toggle = require$$0.forwardRef(({ size = "medium", error = false, disabled = false, defaultChecked = false, required = false, id, name, onChange, onBlur, onClick, checked, className, }, ref) => {
|
|
15
15
|
const { prefix } = hooks_useGlobalSettings();
|
|
@@ -4,100 +4,70 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var require$$0 = require('react');
|
|
5
5
|
var classNames = require('classnames');
|
|
6
6
|
var hooks_useGlobalSettings = require('../../hooks/useGlobalSettings.js');
|
|
7
|
-
var
|
|
7
|
+
var core = require('@popperjs/core');
|
|
8
8
|
require('tslib');
|
|
9
9
|
require('../../GlobalCtx-97e4b433.js');
|
|
10
10
|
|
|
11
|
-
const Tooltip = ({ className, children, icon, label, theme, id, }) => {
|
|
11
|
+
const Tooltip = ({ className, children, icon, label, iconTheme, theme, id, }) => {
|
|
12
12
|
const { prefix } = hooks_useGlobalSettings();
|
|
13
13
|
const baseClass = `${prefix}--tooltip`;
|
|
14
14
|
const [isVisible, setIsVisible] = require$$0.useState(false);
|
|
15
|
-
const [position, setPosition] = require$$0.useState({
|
|
16
|
-
x: 0,
|
|
17
|
-
y: 0,
|
|
18
|
-
});
|
|
19
|
-
const [arrowPlacement, setArrowPlacement] = require$$0.useState("center");
|
|
20
|
-
const [arrowAlignment, setArrowAlignment] = require$$0.useState("left");
|
|
21
15
|
const tooltipRef = require$$0.useRef(null);
|
|
16
|
+
const popperInstanceRef = require$$0.useRef(null);
|
|
17
|
+
const isLongTooltip = () => {
|
|
18
|
+
var _a, _b;
|
|
19
|
+
const tooltipText = (((_a = tooltipRef.current) === null || _a === void 0 ? void 0 : _a.textContent) ||
|
|
20
|
+
((_b = tooltipRef.current) === null || _b === void 0 ? void 0 : _b.innerText) ||
|
|
21
|
+
"").trim();
|
|
22
|
+
return tooltipText.length > 50;
|
|
23
|
+
};
|
|
22
24
|
const tooltipClasses = classNames(className, {
|
|
23
25
|
[baseClass]: true,
|
|
24
26
|
[`${baseClass}--${theme}`]: theme,
|
|
25
|
-
[`${baseClass}--alignment-${arrowAlignment}`]: arrowAlignment,
|
|
26
27
|
[`${baseClass}--visible`]: isVisible,
|
|
28
|
+
[`${baseClass}--long`]: isLongTooltip(),
|
|
27
29
|
});
|
|
28
|
-
const tooltipArrowClasses = classNames(
|
|
29
|
-
|
|
30
|
-
[`${baseClass}--
|
|
30
|
+
const tooltipArrowClasses = classNames(`${baseClass}--arrow`, `${baseClass}--arrow--placement-negative`);
|
|
31
|
+
const iconClasses = classNames(className, `${baseClass}--wrapper`, {
|
|
32
|
+
[`${baseClass}--wrapper__icon ${baseClass}--wrapper__icon__theme__${theme}`]: icon,
|
|
33
|
+
[`${baseClass}--wrapper__icon__theme__${theme}`]: iconTheme,
|
|
31
34
|
});
|
|
32
35
|
const handleOnMouseOver = (e) => {
|
|
33
|
-
// get hovered element reference
|
|
34
36
|
const target = e.currentTarget;
|
|
35
|
-
if (target) {
|
|
36
|
-
const
|
|
37
|
+
if (target && tooltipRef.current) {
|
|
38
|
+
const popperInstance = core.createPopper(target, tooltipRef.current, {
|
|
39
|
+
placement: "top",
|
|
40
|
+
modifiers: [
|
|
41
|
+
{
|
|
42
|
+
name: "offset",
|
|
43
|
+
options: {
|
|
44
|
+
offset: [0, 12], // Adjust offset as needed
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "flip",
|
|
49
|
+
enabled: true,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: "preventOverflow",
|
|
53
|
+
enabled: true,
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
});
|
|
57
|
+
popperInstanceRef.current = popperInstance;
|
|
37
58
|
setIsVisible(true);
|
|
38
|
-
postMouseOver(rect);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
const postMouseOver = (hoverRect) => {
|
|
42
|
-
// position the tooltip after showing it
|
|
43
|
-
let placement = "center";
|
|
44
|
-
let alignment = "left";
|
|
45
|
-
const ttNode = ReactDOM.findDOMNode(tooltipRef.current);
|
|
46
|
-
if (ttNode != null) {
|
|
47
|
-
let x = 0, y = 0;
|
|
48
|
-
const docWidth = document.documentElement.clientWidth, docHeight = document.documentElement.clientHeight;
|
|
49
|
-
const rx = hoverRect.x + hoverRect.width, // most right x
|
|
50
|
-
lx = hoverRect.x, // most left x
|
|
51
|
-
ty = hoverRect.y, // most top y
|
|
52
|
-
by = hoverRect.y + hoverRect.height; // most bottom y
|
|
53
|
-
// tool tip rectange
|
|
54
|
-
const ttRect = ttNode.getBoundingClientRect();
|
|
55
|
-
const bRight = rx + ttRect.width <= window.scrollX + docWidth &&
|
|
56
|
-
ty + ttRect.height <= window.scrollY + docHeight;
|
|
57
|
-
const bLeft = lx - ttRect.width >= 0 &&
|
|
58
|
-
ty + ttRect.height <= window.scrollY + docHeight;
|
|
59
|
-
const bAbove = ty - ttRect.height >= 0;
|
|
60
|
-
const bBellow = by + ttRect.height <= window.scrollY + docHeight;
|
|
61
|
-
// the tooltip doesn't fit to the left
|
|
62
|
-
if (bRight) {
|
|
63
|
-
x = hoverRect.width + 16;
|
|
64
|
-
y = icon ? -8 : 0;
|
|
65
|
-
placement = "negative";
|
|
66
|
-
alignment = "right";
|
|
67
|
-
}
|
|
68
|
-
else if (bBellow) {
|
|
69
|
-
x = icon ? -8 : 0;
|
|
70
|
-
y = hoverRect.height + 16;
|
|
71
|
-
placement = "center";
|
|
72
|
-
alignment = "bottom";
|
|
73
|
-
}
|
|
74
|
-
else if (bLeft) {
|
|
75
|
-
x = -ttRect.width - 16;
|
|
76
|
-
y = icon ? -8 : 0;
|
|
77
|
-
placement = "negative";
|
|
78
|
-
alignment = "left";
|
|
79
|
-
}
|
|
80
|
-
else if (bAbove) {
|
|
81
|
-
x = icon ? -8 : 0;
|
|
82
|
-
y = -ttRect.height - 16;
|
|
83
|
-
placement = "center";
|
|
84
|
-
alignment = "top";
|
|
85
|
-
}
|
|
86
|
-
setPosition({ x: x, y: y });
|
|
87
|
-
setArrowPlacement(placement);
|
|
88
|
-
setArrowAlignment(alignment);
|
|
89
59
|
}
|
|
90
60
|
};
|
|
91
61
|
const handleOnMouseOut = () => {
|
|
62
|
+
if (popperInstanceRef.current) {
|
|
63
|
+
popperInstanceRef.current.destroy();
|
|
64
|
+
}
|
|
92
65
|
setIsVisible(false);
|
|
93
66
|
};
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
// top: ((position.y + window.scrollY) + 'px')
|
|
97
|
-
left: position.x + "px",
|
|
98
|
-
top: position.y + "px",
|
|
67
|
+
const handleOnFocus = (e) => {
|
|
68
|
+
handleOnMouseOver(e);
|
|
99
69
|
};
|
|
100
|
-
return (jsxRuntime.jsxs("div", Object.assign({ className:
|
|
70
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: iconClasses, onMouseOver: handleOnMouseOver, onFocus: handleOnFocus, onMouseOut: handleOnMouseOut, onBlur: handleOnMouseOut, id: id }, { children: [!icon && jsxRuntime.jsx(jsxRuntime.Fragment, { children: children }), jsxRuntime.jsxs("span", Object.assign({ className: tooltipClasses, ref: tooltipRef, "data-id": id, id: "tooltip", role: "tooltip", "aria-hidden": !isVisible }, { children: [jsxRuntime.jsx("span", { "data-popper-arrow": true, className: tooltipArrowClasses, "data-placement": "negative", role: "presentation" }), label] }))] })));
|
|
101
71
|
};
|
|
102
72
|
|
|
103
73
|
module.exports = Tooltip;
|
|
@@ -69,6 +69,7 @@ require('../utils/triggerBrowserReflow.js');
|
|
|
69
69
|
require('./FormControl/FormControl.js');
|
|
70
70
|
require('nanoid');
|
|
71
71
|
require('../hooks/usePrevious.js');
|
|
72
|
+
require('@popperjs/core');
|
|
72
73
|
require('./Hero/HeroCard.js');
|
|
73
74
|
require('./SocialMedia/SocialMedia.js');
|
|
74
75
|
require('./Input/Input.js');
|
package/lib/cjs/index.js
CHANGED
|
@@ -68,6 +68,7 @@ require('./utils/transitionEndListener.js');
|
|
|
68
68
|
require('./utils/triggerBrowserReflow.js');
|
|
69
69
|
require('./components/FormControl/FormControl.js');
|
|
70
70
|
require('nanoid');
|
|
71
|
+
require('@popperjs/core');
|
|
71
72
|
require('./hooks/usePrevious.js');
|
|
72
73
|
require('@ilo-org/icons-react');
|
|
73
74
|
require('./components/Hero/HeroCard.js');
|
|
@@ -8,7 +8,7 @@ import 'react';
|
|
|
8
8
|
import '../../GlobalCtx-7fb23cfa.js';
|
|
9
9
|
import '@ilo-org/icons-react';
|
|
10
10
|
|
|
11
|
-
const Button = ({ callback, className, disabled = false, icon, icononly, iconPosition, kind = "button", label, opensmodal, size = "large", target = "", type = "primary", url, style, }) => {
|
|
11
|
+
const Button = ({ callback, className, disabled = false, icon, icononly, iconPosition, kind = "button", label, opensmodal, size = "large", target = "", type = "primary", url, style, name, }) => {
|
|
12
12
|
const { prefix } = useGlobalSettings();
|
|
13
13
|
const baseClass = `${prefix}--button`;
|
|
14
14
|
const hasURL = !!url;
|
|
@@ -28,7 +28,7 @@ const Button = ({ callback, className, disabled = false, icon, icononly, iconPos
|
|
|
28
28
|
callback(e);
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
return (jsx(Fragment, { children: hasURL ? (jsx(Link, Object.assign({ className: ButtonClasses, target: target, url: url, label: label, style: style }, { children: icon && jsx(Icon, { name: icon, hidden: true }) }))) : (jsxs("button", Object.assign({ className: ButtonClasses, onClick: (e) => handleClick(e), disabled: disabled, type: kind, "aria-haspopup": opensmodal ? `dialog` : false, style: style }, { children: [label && jsx("span", Object.assign({ className: "button__label" }, { children: label })), icon && jsx(Icon, { name: icon, hidden: true })] }))) }));
|
|
31
|
+
return (jsx(Fragment, { children: hasURL ? (jsx(Link, Object.assign({ className: ButtonClasses, target: target, url: url, label: label, style: style }, { children: icon && jsx(Icon, { name: icon, hidden: true }) }))) : (jsxs("button", Object.assign({ className: ButtonClasses, onClick: (e) => handleClick(e), disabled: disabled, type: kind, "aria-haspopup": opensmodal ? `dialog` : false, style: style, name: name }, { children: [label && jsx("span", Object.assign({ className: "button__label" }, { children: label })), icon && jsx(Icon, { name: icon, hidden: true })] }))) }));
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
export { Button as default };
|