@edifice.io/react 2.6.6 → 2.6.7-develop-b2school.20260928143952

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 (104) hide show
  1. package/dist/components/Alert/Alert.js +47 -23
  2. package/dist/components/Form/FormText.js +11 -6
  3. package/dist/components/Input/Input.d.ts +11 -2
  4. package/dist/components/Input/Input.js +43 -21
  5. package/dist/components/Label/Label.js +4 -4
  6. package/dist/components/Layout/Layout.js +30 -15
  7. package/dist/components/LinkPill/LinkPill.d.ts +41 -0
  8. package/dist/components/LinkPill/LinkPill.js +28 -0
  9. package/dist/components/LinkPill/index.d.ts +2 -0
  10. package/dist/components/ModalBeta/ModalBeta.d.ts +47 -0
  11. package/dist/components/ModalBeta/ModalBeta.js +62 -0
  12. package/dist/components/ModalBeta/ModalBetaBody.d.ts +19 -0
  13. package/dist/components/ModalBeta/ModalBetaBody.js +15 -0
  14. package/dist/components/ModalBeta/ModalBetaContext.d.ts +7 -0
  15. package/dist/components/ModalBeta/ModalBetaContext.js +15 -0
  16. package/dist/components/ModalBeta/ModalBetaFooter.d.ts +13 -0
  17. package/dist/components/ModalBeta/ModalBetaFooter.js +7 -0
  18. package/dist/components/ModalBeta/ModalBetaHeader.d.ts +23 -0
  19. package/dist/components/ModalBeta/ModalBetaHeader.js +31 -0
  20. package/dist/components/ModalBeta/index.d.ts +2 -0
  21. package/dist/components/PageLayout/PageLayout.d.ts +4 -0
  22. package/dist/components/PageLayout/PageLayout.js +37 -14
  23. package/dist/components/PageLayout/components/PageLayoutContent.js +5 -1
  24. package/dist/components/PageLayout/components/PageLayoutHelpZone.d.ts +12 -0
  25. package/dist/components/PageLayout/components/PageLayoutHelpZone.js +6 -0
  26. package/dist/components/Table/components/Table.d.ts +2 -2
  27. package/dist/components/Table/components/TableTd.d.ts +1 -1
  28. package/dist/components/Table/components/TableTh.d.ts +1 -1
  29. package/dist/components/index.d.ts +2 -0
  30. package/dist/homepage.js +44 -19
  31. package/dist/hooks/index.d.ts +2 -0
  32. package/dist/hooks/useBackground/index.d.ts +1 -0
  33. package/dist/hooks/useBackground/useBackground.d.ts +7 -0
  34. package/dist/hooks/useBackground/useBackground.js +16 -0
  35. package/dist/hooks/useClickOutside/useClickOutside.d.ts +1 -1
  36. package/dist/hooks/useClickOutside/useClickOutside.js +3 -2
  37. package/dist/hooks/useToast/useToast.d.ts +1 -0
  38. package/dist/hooks/useToast/useToast.js +12 -9
  39. package/dist/hooks/useUserPreferences/index.d.ts +1 -0
  40. package/dist/hooks/useUserPreferences/useUserPreferences.d.ts +9 -0
  41. package/dist/hooks/useUserPreferences/useUserPreferences.js +40 -0
  42. package/dist/hooks/useZendeskGuide/useZendeskGuide.d.ts +16 -2
  43. package/dist/hooks/useZendeskGuide/useZendeskGuide.js +58 -24
  44. package/dist/icons.js +404 -402
  45. package/dist/index.js +168 -160
  46. package/dist/modules/HelpZone/HelpZone.d.ts +13 -0
  47. package/dist/modules/HelpZone/HelpZone.js +52 -0
  48. package/dist/modules/HelpZone/HelpZoneContainer.d.ts +4 -0
  49. package/dist/modules/HelpZone/HelpZoneContainer.js +18 -0
  50. package/dist/modules/HelpZone/index.d.ts +3 -0
  51. package/dist/modules/homepage/components/Communities/Communities.js +35 -0
  52. package/dist/modules/homepage/components/Communities/CommunitiesContainer.d.ts +4 -2
  53. package/dist/modules/homepage/components/Communities/CommunitiesContainer.js +31 -0
  54. package/dist/modules/homepage/components/Communities/CommunitiesSkeleton.js +32 -0
  55. package/dist/modules/homepage/components/Communities/CommunityItem.d.ts +2 -1
  56. package/dist/modules/homepage/components/Communities/CommunityItem.js +28 -0
  57. package/dist/modules/homepage/components/Communities/useCommunities.d.ts +1 -4
  58. package/dist/modules/homepage/components/Communities/useCommunities.js +25 -0
  59. package/dist/modules/homepage/components/Favorites/Favorites.js +2 -2
  60. package/dist/modules/homepage/components/Header/Header.js +11 -4
  61. package/dist/modules/homepage/components/HomeCard/HomeCard.d.ts +1 -1
  62. package/dist/modules/homepage/components/HomeCard/HomeCardHeader.d.ts +15 -1
  63. package/dist/modules/homepage/components/HomeCard/HomeCardHeader.js +2 -1
  64. package/dist/modules/homepage/components/Notifications/components/NotificationFilterModal.js +36 -26
  65. package/dist/modules/homepage/components/Notifications/components/ReportNotificationModal.js +1 -1
  66. package/dist/modules/homepage/components/Notifications/services/queries/notification.js +9 -2
  67. package/dist/modules/homepage/components/UsefulLinks/LinkForm.d.ts +13 -0
  68. package/dist/modules/homepage/components/UsefulLinks/LinkForm.js +67 -0
  69. package/dist/modules/homepage/components/UsefulLinks/UsefulLinks.d.ts +6 -0
  70. package/dist/modules/homepage/components/UsefulLinks/UsefulLinks.js +31 -0
  71. package/dist/modules/homepage/components/UsefulLinks/UsefulLinksContainer.d.ts +1 -0
  72. package/dist/modules/homepage/components/UsefulLinks/UsefulLinksContainer.js +40 -0
  73. package/dist/modules/homepage/components/UsefulLinks/UsefulLinksModal.d.ts +11 -0
  74. package/dist/modules/homepage/components/UsefulLinks/UsefulLinksModal.js +65 -0
  75. package/dist/modules/homepage/components/UsefulLinks/hooks/useUsefulLinksContainer.d.ts +19 -0
  76. package/dist/modules/homepage/components/UsefulLinks/hooks/useUsefulLinksContainer.js +26 -0
  77. package/dist/modules/homepage/components/UsefulLinks/index.d.ts +5 -0
  78. package/dist/modules/homepage/components/UsefulLinks/services/api/index.d.ts +6 -0
  79. package/dist/modules/homepage/components/UsefulLinks/services/api/index.js +5 -0
  80. package/dist/modules/homepage/components/UsefulLinks/services/api/usefulLinksService.d.ts +31 -0
  81. package/dist/modules/homepage/components/UsefulLinks/services/api/usefulLinksService.js +50 -0
  82. package/dist/modules/homepage/components/UsefulLinks/services/queries/usefulLinks.d.ts +20 -0
  83. package/dist/modules/homepage/components/UsefulLinks/services/queries/usefulLinks.js +65 -0
  84. package/dist/modules/homepage/components/UserSpace/UserSpace.d.ts +3 -1
  85. package/dist/modules/homepage/components/UserSpace/UserSpace.js +13 -7
  86. package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.d.ts +4 -2
  87. package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.js +3 -2
  88. package/dist/modules/homepage/components/UserSpace/hooks/useProfileLinks.js +18 -8
  89. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetToggle.d.ts +16 -0
  90. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetToggle.js +15 -0
  91. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.d.ts +21 -0
  92. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.js +47 -0
  93. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/index.d.ts +2 -0
  94. package/dist/modules/homepage/components/index.d.ts +3 -0
  95. package/dist/modules/icons/components/IconAddWidget.d.ts +7 -0
  96. package/dist/modules/icons/components/IconAddWidget.js +12 -0
  97. package/dist/modules/icons/components/index.d.ts +1 -0
  98. package/dist/modules/icons/components/logo/IconLogoEdificeFull.d.ts +7 -0
  99. package/dist/modules/icons/components/logo/IconLogoEdificeFull.js +26 -0
  100. package/dist/modules/icons/components/logo/IconLogoEdificeSmall.d.ts +7 -0
  101. package/dist/modules/icons/components/logo/IconLogoEdificeSmall.js +17 -0
  102. package/dist/modules/icons/components/logo/index.d.ts +2 -0
  103. package/dist/modules/widgets/index.d.ts +1 -1
  104. package/package.json +6 -6
@@ -1,13 +1,14 @@
1
1
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
2
- import { forwardRef, useState, useRef, useCallback, useImperativeHandle, useLayoutEffect, useEffect } from "react";
2
+ import { forwardRef, useState, useRef, useCallback, useEffect, useImperativeHandle, useLayoutEffect } from "react";
3
3
  import clsx from "clsx";
4
4
  import { useTranslation } from "react-i18next";
5
- import SvgIconAlertCircle from "../../modules/icons/components/IconAlertCircle.js";
5
+ import SvgIconAlertTriangle from "../../modules/icons/components/IconAlertTriangle.js";
6
+ import SvgIconClose from "../../modules/icons/components/IconClose.js";
6
7
  import SvgIconError from "../../modules/icons/components/IconError.js";
7
8
  import SvgIconInfoCircle from "../../modules/icons/components/IconInfoCircle.js";
8
9
  import SvgIconSuccessOutline from "../../modules/icons/components/IconSuccessOutline.js";
9
- import Button from "../Button/Button.js";
10
- const Alert = /* @__PURE__ */ forwardRef(({
10
+ import ButtonBeta from "../ButtonBeta/ButtonBeta.js";
11
+ const TOAST_EXIT_ANIMATION_DURATION = 240, getToastAnimationClass = (position, isClosing) => position === "top-left" || position === "bottom-left" ? isClosing ? "alert-slide-out-left" : "alert-slide-in-left" : position === "top-right" || position === "bottom-right" ? isClosing ? "alert-slide-out-right" : "alert-slide-in-right" : isClosing ? "alert-fade-out" : "alert-fade-in", Alert = /* @__PURE__ */ forwardRef(({
11
12
  type = "success",
12
13
  className = "",
13
14
  children,
@@ -21,31 +22,53 @@ const Alert = /* @__PURE__ */ forwardRef(({
21
22
  onClose,
22
23
  onVisibilityChange
23
24
  }, ref) => {
24
- const [isVisible, setVisibleStatus] = useState(!0), refAlert = useRef(null), {
25
+ const [isVisible, setVisibleStatus] = useState(!0), [isClosing, setIsClosing] = useState(!1), refAlert = useRef(null), {
25
26
  t
26
27
  } = useTranslation(), hide = useCallback(() => {
28
+ if (isToast) {
29
+ setIsClosing(!0);
30
+ return;
31
+ }
27
32
  setVisibleStatus(!1), onClose == null || onClose();
28
- }, [onClose]);
33
+ }, [isToast, onClose]);
34
+ useEffect(() => {
35
+ if (!isClosing)
36
+ return;
37
+ const timeoutId = setTimeout(() => {
38
+ setVisibleStatus(!1), onClose == null || onClose();
39
+ }, TOAST_EXIT_ANIMATION_DURATION);
40
+ return () => clearTimeout(timeoutId);
41
+ }, [isClosing, onClose]);
42
+ const handleToastClick = () => {
43
+ isToast && !isConfirm && hide();
44
+ };
29
45
  useImperativeHandle(ref, () => ({
30
46
  show,
31
47
  hide,
32
48
  ...refAlert.current
33
49
  })), useLayoutEffect(() => {
34
50
  onVisibilityChange == null || onVisibilityChange(isVisible);
35
- }, [isVisible, onVisibilityChange]), useEffect(() => {
36
- autoClose && isVisible && setTimeout(() => {
37
- hide();
38
- }, autoCloseDelay);
39
- }, [autoClose, autoCloseDelay, hide, isVisible]);
40
- const show = () => {
41
- setVisibleStatus(!0);
51
+ }, [isVisible, onVisibilityChange]);
52
+ const shouldAutoClose = autoClose && isVisible && !isClosing, showProgress = autoClose && isToast && !isDismissible && !isClosing, remainingRef = useRef(autoCloseDelay), timeoutRef = useRef(), startedAtRef = useRef(0), [isPaused, setIsPaused] = useState(!1), clearAutoCloseTimeout = useCallback(() => {
53
+ timeoutRef.current && (clearTimeout(timeoutRef.current), timeoutRef.current = void 0);
54
+ }, []);
55
+ useEffect(() => {
56
+ if (shouldAutoClose)
57
+ return remainingRef.current = autoCloseDelay, startedAtRef.current = Date.now(), timeoutRef.current = setTimeout(hide, autoCloseDelay), clearAutoCloseTimeout;
58
+ }, [shouldAutoClose, autoCloseDelay, hide, clearAutoCloseTimeout]);
59
+ const handleMouseEnter = () => {
60
+ !shouldAutoClose || isPaused || (clearAutoCloseTimeout(), remainingRef.current = Math.max(remainingRef.current - (Date.now() - startedAtRef.current), 0), setIsPaused(!0));
61
+ }, handleMouseLeave = () => {
62
+ !shouldAutoClose || !isPaused || (startedAtRef.current = Date.now(), timeoutRef.current = setTimeout(hide, remainingRef.current), setIsPaused(!1));
63
+ }, show = () => {
64
+ setIsClosing(!1), setVisibleStatus(!0);
42
65
  }, mapping = {
43
66
  success: {
44
67
  icon: /* @__PURE__ */ jsx(SvgIconSuccessOutline, {}),
45
68
  classModifier: "alert-success"
46
69
  },
47
70
  warning: {
48
- icon: /* @__PURE__ */ jsx(SvgIconAlertCircle, {}),
71
+ icon: /* @__PURE__ */ jsx(SvgIconAlertTriangle, {}),
49
72
  classModifier: "alert-warning"
50
73
  },
51
74
  info: {
@@ -58,21 +81,22 @@ const Alert = /* @__PURE__ */ forwardRef(({
58
81
  }
59
82
  }, toastClasses = {
60
83
  "is-dismissible": isDismissible,
61
- "is-toast ": isToast
84
+ "is-toast": isToast
62
85
  }, confirmClasses = {
63
86
  "is-confirm": isConfirm
64
- }, divContainerClasses = clsx("alert gap-12", mapping[type].classModifier, toastClasses, confirmClasses, position, className);
65
- return /* @__PURE__ */ jsx(Fragment, { children: isVisible ? /* @__PURE__ */ jsxs("div", { ref: refAlert, className: divContainerClasses, role: "alert", children: [
87
+ }, divContainerClasses = clsx("alert gap-12", mapping[type].classModifier, toastClasses, confirmClasses, position, isToast && getToastAnimationClass(position, isClosing), className);
88
+ return /* @__PURE__ */ jsx(Fragment, { children: isVisible ? /* @__PURE__ */ jsxs("div", { ref: refAlert, className: divContainerClasses, role: "alert", onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onClick: handleToastClick, children: [
66
89
  !isConfirm && mapping[type].icon,
67
90
  /* @__PURE__ */ jsx("div", { className: "alert-content small flex-grow-1", children }),
68
- button && /* @__PURE__ */ jsxs("div", { className: "ms-12", children: [
91
+ button && /* @__PURE__ */ jsxs("div", { className: "alert-actions", onClick: (e) => e.stopPropagation(), children: [
69
92
  button,
70
- " ",
71
- isConfirm && /* @__PURE__ */ jsx(Button, { onClick: hide, children: t("close") })
93
+ isConfirm && /* @__PURE__ */ jsx(ButtonBeta, { onClick: hide, children: t("close") })
72
94
  ] }),
73
- (isDismissible || isConfirm) && /* @__PURE__ */ jsx("div", { className: "btn-close-container", children: /* @__PURE__ */ jsx("button", { type: "button", className: "btn-close", "data-bs-dismiss": "alert", "aria-label": t("close"), onClick: hide }) }),
74
- autoClose && /* @__PURE__ */ jsx("div", { className: "alert-progress", style: {
75
- transform: "scaleX(0)"
95
+ (isDismissible || isConfirm) && /* @__PURE__ */ jsx("div", { className: "btn-close-container", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(ButtonBeta, { type: "button", leftIcon: /* @__PURE__ */ jsx(SvgIconClose, {}), variant: "ghost", color: "tertiary", "aria-label": t("close"), title: t("close"), onClick: hide }) }),
96
+ showProgress && /* @__PURE__ */ jsx("div", { className: clsx("alert-progress", {
97
+ "is-paused": isPaused
98
+ }), style: {
99
+ "--alert-progress-duration": `${autoCloseDelay}ms`
76
100
  } })
77
101
  ] }) : null });
78
102
  });
@@ -1,16 +1,21 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import clsx from "clsx";
3
+ import SvgIconError from "../../modules/icons/components/IconError.js";
4
+ import SvgIconSuccessOutline from "../../modules/icons/components/IconSuccessOutline.js";
3
5
  import { useFormControl } from "./FormContext.js";
4
6
  const FormText = ({
5
7
  children
6
8
  }) => {
7
9
  const {
8
10
  status
9
- } = useFormControl(), classes = clsx("form-text", {
10
- "is-invalid": status === "invalid",
11
- valid: status === "valid"
12
- });
13
- return /* @__PURE__ */ jsx("p", { className: classes, children: /* @__PURE__ */ jsx("em", { children }) });
11
+ } = useFormControl(), classes = clsx("input-message", {
12
+ "input-message--invalid": status === "invalid",
13
+ "input-message--valid": status === "valid"
14
+ }), Icon = status === "invalid" ? SvgIconError : status === "valid" ? SvgIconSuccessOutline : null;
15
+ return /* @__PURE__ */ jsxs("p", { className: classes, children: [
16
+ Icon && /* @__PURE__ */ jsx(Icon, { className: "input-message__icon", "aria-hidden": "true" }),
17
+ children
18
+ ] });
14
19
  };
15
20
  export {
16
21
  FormText as default
@@ -2,7 +2,8 @@ import { Size } from '../../types';
2
2
  export type OmitInputProps = 'disabled' | 'required' | 'size' | 'id' | 'readOnly';
3
3
  export interface InputProps extends Omit<React.ComponentPropsWithRef<'input'>, OmitInputProps> {
4
4
  /**
5
- * Control size of input
5
+ * Control size of input. `sm` and `md` share the same visual size
6
+ * ("Medium" in the design system); only `lg` ("Big") differs.
6
7
  */
7
8
  size: Size;
8
9
  /**
@@ -18,7 +19,8 @@ export interface InputProps extends Omit<React.ComponentPropsWithRef<'input'>, O
18
19
  */
19
20
  disabled?: boolean;
20
21
  /**
21
- * Remove validation icon
22
+ * @deprecated Validation icons no longer render inside the field —
23
+ * this prop has no effect and will be removed in a future major version.
22
24
  */
23
25
  noValidationIcon?: boolean;
24
26
  /**
@@ -33,6 +35,13 @@ export interface InputProps extends Omit<React.ComponentPropsWithRef<'input'>, O
33
35
  * Browser autocomplete feature
34
36
  */
35
37
  autoComplete?: string;
38
+ /**
39
+ * Show a built-in clear (×) button while the field is focused. Opt-in:
40
+ * several consumers render their own clear affordance already (e.g.
41
+ * `SearchBar`), and a broad audit of every `Input` usage hasn't been done
42
+ * yet — see INPUT-MIGRATION-PLAN.md §07.
43
+ */
44
+ clearable?: boolean;
36
45
  }
37
46
  /**
38
47
  * Input Form Component
@@ -1,40 +1,62 @@
1
- import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
- import { forwardRef, useState } from "react";
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { forwardRef, useRef, useState, useLayoutEffect } from "react";
3
3
  import clsx from "clsx";
4
+ import { useTranslation } from "react-i18next";
5
+ import SvgIconClose from "../../modules/icons/components/IconClose.js";
4
6
  import { useFormControl } from "../Form/FormContext.js";
5
- import Textcounter from "../TextCounter/TextCounter.js";
6
7
  const Input = /* @__PURE__ */ forwardRef(({
7
- noValidationIcon,
8
8
  placeholder,
9
9
  size = "md",
10
10
  type = "text",
11
11
  className,
12
12
  showCounter = !1,
13
13
  autoComplete = "off",
14
+ clearable = !1,
15
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
16
+ noValidationIcon,
14
17
  ...restProps
15
- }, ref) => {
18
+ }, forwardedRef) => {
16
19
  var _a;
17
20
  const {
18
21
  id,
19
22
  isRequired,
20
23
  isReadOnly,
21
24
  status
22
- } = useFormControl(), [currentLength, setCurrentLength] = useState(((_a = restProps.defaultValue) == null ? void 0 : _a.toString().length) || 0), classes = clsx({
23
- "form-control": !isReadOnly,
24
- "form-control-lg": size === "lg",
25
- "form-control-sm": size === "sm",
26
- "is-invalid": status === "invalid",
27
- "is-valid": status === "valid",
28
- "form-control-plaintext": isReadOnly,
29
- "no-validation-icon": noValidationIcon,
30
- "pe-64": showCounter && !status
31
- }, className);
32
- return /* @__PURE__ */ jsxs(Fragment, { children: [
33
- /* @__PURE__ */ jsx("input", { ref, id, className: classes, type, placeholder, required: isRequired, readOnly: isReadOnly, ...restProps, onChange: (e) => {
34
- var _a2;
35
- setCurrentLength(e.target.value.length), (_a2 = restProps.onChange) == null || _a2.call(restProps, e);
36
- }, autoComplete }),
37
- showCounter && !status && /* @__PURE__ */ jsx(Textcounter, { currentLength, maxLength: restProps.maxLength ?? 0 })
25
+ } = useFormControl(), {
26
+ t
27
+ } = useTranslation(), inputRef = useRef(null), [currentLength, setCurrentLength] = useState(((_a = restProps.defaultValue) == null ? void 0 : _a.toString().length) || 0);
28
+ useLayoutEffect(() => {
29
+ inputRef.current && setCurrentLength(inputRef.current.value.length);
30
+ }, []);
31
+ const setRefs = (node) => {
32
+ inputRef.current = node, typeof forwardedRef == "function" ? forwardedRef(node) : forwardedRef && (forwardedRef.current = node);
33
+ }, wrapperClasses = clsx("input", {
34
+ "input--lg": size === "lg",
35
+ "input--invalid": status === "invalid",
36
+ "input--valid": status === "valid",
37
+ "input--plaintext": isReadOnly
38
+ }, className), handleChange = (e) => {
39
+ var _a2;
40
+ setCurrentLength(e.target.value.length), (_a2 = restProps.onChange) == null || _a2.call(restProps, e);
41
+ }, handleClear = () => {
42
+ var _a2;
43
+ const node = inputRef.current;
44
+ if (!node) return;
45
+ const nativeSetter = (_a2 = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")) == null ? void 0 : _a2.set;
46
+ nativeSetter == null || nativeSetter.call(node, ""), node.dispatchEvent(new Event("input", {
47
+ bubbles: !0
48
+ })), node.focus();
49
+ }, maxLength = restProps.maxLength ?? 0;
50
+ return /* @__PURE__ */ jsxs("div", { className: wrapperClasses, children: [
51
+ /* @__PURE__ */ jsx("input", { ref: setRefs, id, className: "input__field", type, placeholder, required: isRequired, readOnly: isReadOnly, ...restProps, onChange: handleChange, autoComplete }),
52
+ clearable && !isReadOnly && /* @__PURE__ */ jsx("button", { type: "button", className: "input__clear", onClick: handleClear, "aria-label": t("clear"), children: /* @__PURE__ */ jsx(SvgIconClose, {}) }),
53
+ showCounter && /* @__PURE__ */ jsxs("span", { className: clsx("input__counter", {
54
+ "input__counter--max": currentLength === maxLength
55
+ }), children: [
56
+ currentLength,
57
+ " / ",
58
+ maxLength
59
+ ] })
38
60
  ] });
39
61
  });
40
62
  export {
@@ -16,8 +16,8 @@ const Label = /* @__PURE__ */ forwardRef(({
16
16
  isRequired
17
17
  } = useFormControl(), {
18
18
  t
19
- } = useTranslation(), classes = clsx("form-label", {
20
- "has-icon": leftIcon
19
+ } = useTranslation(), classes = clsx("input-label", {
20
+ "input-label--has-icon": leftIcon
21
21
  }, className), optionalState = isOptional && !isRequired, requiredState = isRequired && !isOptional;
22
22
  return useEffect(() => {
23
23
  if (isOptional && isRequired)
@@ -25,11 +25,11 @@ const Label = /* @__PURE__ */ forwardRef(({
25
25
  }, [isOptional, isRequired]), /* @__PURE__ */ jsxs("label", { ref, htmlFor: id, className: classes, children: [
26
26
  leftIcon,
27
27
  children,
28
- optionalState && /* @__PURE__ */ jsxs("em", { className: "optional", children: [
28
+ optionalState && /* @__PURE__ */ jsxs("em", { className: "input-label__optional", children: [
29
29
  "- ",
30
30
  optionalText ?? t("explorer.optional")
31
31
  ] }),
32
- requiredState && /* @__PURE__ */ jsx("em", { className: "required", children: requiredText })
32
+ requiredState && /* @__PURE__ */ jsx("em", { className: "input-label__required", children: requiredText })
33
33
  ] });
34
34
  });
35
35
  export {
@@ -1,53 +1,68 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Suspense, lazy } from "react";
3
3
  import clsx from "clsx";
4
- import { Toaster } from "react-hot-toast";
5
4
  import { useTranslation } from "react-i18next";
6
5
  import { useEdificeTheme } from "../../providers/EdificeThemeProvider/EdificeThemeProvider.hook.js";
6
+ import { useOverlay } from "../PageLayout/hook/useOverlay.js";
7
7
  import Header from "./components/Header.js";
8
8
  import HeaderNotificationsOverlay from "./components/HeaderNotificationsOverlay.js";
9
- import { useOverlay } from "../PageLayout/hook/useOverlay.js";
10
9
  import useUiOverride from "../../hooks/useUiOverride/useUiOverride.js";
10
+ import useBackground from "../../hooks/useBackground/useBackground.js";
11
+ import useToast from "../../hooks/useToast/useToast.js";
11
12
  import useCookiesConsent from "../../hooks/useCookiesConsent/useCookiesConsent.js";
12
13
  import useZendeskGuide from "../../hooks/useZendeskGuide/useZendeskGuide.js";
13
14
  import useCantoo from "../../hooks/useCantoo/useCantoo.js";
14
15
  import Alert from "../Alert/Alert.js";
15
- import Button from "../Button/Button.js";
16
- const HeaderV2 = /* @__PURE__ */ lazy(() => import("../../modules/homepage/components/Header/Header.js")), Layout = ({
16
+ import ButtonBeta from "../ButtonBeta/ButtonBeta.js";
17
+ import HelpZone from "../../modules/HelpZone/HelpZone.js";
18
+ const HeaderV2 = /* @__PURE__ */ lazy(() => import("../../modules/homepage/components/Header/Header.js"));
19
+ function getHeaderColor() {
20
+ return getComputedStyle(document.documentElement).getPropertyValue("--primitive-blue-400").trim();
21
+ }
22
+ const Layout = ({
17
23
  children,
18
24
  headless = !1,
19
25
  whiteBg = !0,
20
26
  className,
21
27
  ...restProps
22
28
  }) => {
29
+ var _a;
23
30
  const {
24
31
  theme
25
- } = useEdificeTheme(), override = useUiOverride("layout.header"), isHeaderV2 = (override == null ? void 0 : override.variant) === "v2", backgroundOverride = useUiOverride("layout.background"), hasBackgroundImage = (backgroundOverride == null ? void 0 : backgroundOverride.variant) === "image", {
32
+ } = useEdificeTheme(), override = useUiOverride("layout.header"), isHeaderV2 = (override == null ? void 0 : override.variant) === "v2", isEdificeInProductHelp = ((_a = useUiOverride("layout.helpzone")) == null ? void 0 : _a.variant) === "edifice-in-product", {
33
+ productOverride,
34
+ background,
35
+ isBackgroundImageOverridden
36
+ } = useBackground(), {
26
37
  toggleOverlay
27
- } = useOverlay(), {
38
+ } = useOverlay(), toast = useToast(), {
28
39
  t
29
40
  } = useTranslation(), {
30
41
  showCookiesConsent,
31
42
  handleConsultCookies,
32
43
  handleCloseCookiesConsent
33
- } = useCookiesConsent();
34
- useZendeskGuide(), useCantoo();
44
+ } = useCookiesConsent(), {
45
+ isReady: isHelpZoneReady,
46
+ isOpen: isHelpZoneOpen,
47
+ open: openHelpZone,
48
+ close: closeHelpZone
49
+ } = useZendeskGuide(isEdificeInProductHelp ? getHeaderColor() : void 0);
50
+ useCantoo();
35
51
  const classes = clsx("d-flex flex-column", {
36
52
  "bg-white": whiteBg,
37
53
  "container-fluid": !headless,
38
54
  "rounded-4 border": (theme == null ? void 0 : theme.is1d) && !headless,
39
55
  "mt-24": (theme == null ? void 0 : theme.is1d) && !headless
40
- }, className), renderHeader = headless ? null : isHeaderV2 ? /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(HeaderV2, { src: theme == null ? void 0 : theme.basePath, dataProduct: override == null ? void 0 : override.theme, onNotificationsClick: toggleOverlay }) }) : /* @__PURE__ */ jsx(Header, { is1d: theme == null ? void 0 : theme.is1d, src: theme == null ? void 0 : theme.basePath }), renderNotificationsOverlay = !headless && isHeaderV2 && /* @__PURE__ */ jsx(HeaderNotificationsOverlay, {}), renderCookies = showCookiesConsent && /* @__PURE__ */ jsx(Alert, { type: "info", className: "m-12 rgpd", isConfirm: !0, position: "bottom-right", button: /* @__PURE__ */ jsx(Button, { color: "tertiary", variant: "ghost", onClick: handleConsultCookies, children: t("rgpd.cookies.banner.button.consult") }), onClose: handleCloseCookiesConsent, children: t("rgpd.cookies.banner.text1") }), renderToaster = /* @__PURE__ */ jsx(Toaster, { containerClassName: "toaster-container", toastOptions: {
41
- position: "top-right"
42
- } });
43
- return /* @__PURE__ */ jsxs("div", { className: clsx("layout", {
44
- "layout-has-background-image": hasBackgroundImage
45
- }), "data-product": hasBackgroundImage ? backgroundOverride == null ? void 0 : backgroundOverride.theme : void 0, children: [
56
+ }, className), renderHeader = headless ? null : isHeaderV2 ? /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(HeaderV2, { src: theme == null ? void 0 : theme.basePath, dataProduct: override == null ? void 0 : override.theme, onNotificationsClick: toggleOverlay }) }) : /* @__PURE__ */ jsx(Header, { is1d: theme == null ? void 0 : theme.is1d, src: theme == null ? void 0 : theme.basePath }), renderNotificationsOverlay = !headless && isHeaderV2 && /* @__PURE__ */ jsx(HeaderNotificationsOverlay, {}), renderCookies = showCookiesConsent && /* @__PURE__ */ jsx(Alert, { type: "info", className: "m-12 rgpd", isConfirm: !0, position: "bottom-right", button: /* @__PURE__ */ jsx(ButtonBeta, { variant: "outline", onClick: handleConsultCookies, children: t("rgpd.cookies.banner.button.consult") }), onClose: handleCloseCookiesConsent, children: t("rgpd.cookies.banner.text1") }), renderToaster = toast.renderToaster();
57
+ return /* @__PURE__ */ jsxs("div", { "data-product": productOverride, "data-background": theme != null && theme.is1d ? void 0 : background, className: clsx("layout", {
58
+ "layout-has-background-image": isBackgroundImageOverridden
59
+ }), children: [
46
60
  renderHeader,
47
61
  renderNotificationsOverlay,
48
62
  /* @__PURE__ */ jsx("main", { className: classes, ...restProps, children }),
49
63
  renderToaster,
50
- renderCookies
64
+ renderCookies,
65
+ isEdificeInProductHelp && /* @__PURE__ */ jsx(HelpZone, { isReady: isHelpZoneReady, isOpen: isHelpZoneOpen, onOpen: openHelpZone, onClose: closeHelpZone })
51
66
  ] });
52
67
  };
53
68
  export {
@@ -0,0 +1,41 @@
1
+ import { ComponentPropsWithoutRef, ReactNode } from 'react';
2
+ export type LinkPillIllustrationType = 'icon' | 'img';
3
+ export type LinkPillIllustrationPosition = 'left' | 'right';
4
+ export interface LinkPillProps extends ComponentPropsWithoutRef<'a'> {
5
+ /**
6
+ * URL opened in a new tab when the pill is clicked.
7
+ */
8
+ href: string;
9
+ /**
10
+ * Text displayed inside the pill (single line, ellipsis on overflow).
11
+ */
12
+ label: string;
13
+ /**
14
+ * Optional second line displayed below the label (single line, ellipsis
15
+ * on overflow). Does not affect the label's font size.
16
+ */
17
+ subtitle?: string;
18
+ /**
19
+ * Illustration node. Defaults to `<IconLink />` for the `icon` type.
20
+ * For the `img` type, the caller must provide an `<img>` element.
21
+ */
22
+ illustration?: ReactNode;
23
+ /**
24
+ * `icon` (default): illustration wrapped in a small rounded box.
25
+ * `img`: illustration rendered as a 36x36 rounded square (e.g. a favicon).
26
+ */
27
+ illustrationType?: LinkPillIllustrationType;
28
+ /**
29
+ * Side the illustration is displayed on.
30
+ */
31
+ illustrationPosition?: LinkPillIllustrationPosition;
32
+ }
33
+ /**
34
+ * LinkPill – design system component used to display a link to an
35
+ * external resource as a small rounded pill.
36
+ */
37
+ declare const LinkPill: {
38
+ ({ href, label, subtitle, illustration, illustrationType, illustrationPosition, className, ...restProps }: LinkPillProps): import("react/jsx-runtime").JSX.Element;
39
+ displayName: string;
40
+ };
41
+ export default LinkPill;
@@ -0,0 +1,28 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import clsx from "clsx";
3
+ import SvgIconLink from "../../modules/icons/components/IconLink.js";
4
+ const LinkPill = ({
5
+ href,
6
+ label,
7
+ subtitle,
8
+ illustration,
9
+ illustrationType = "icon",
10
+ illustrationPosition = "left",
11
+ className,
12
+ ...restProps
13
+ }) => {
14
+ const illustrationNode = illustrationType === "icon" ? /* @__PURE__ */ jsx("span", { className: "link-pill-icon", children: illustration ?? /* @__PURE__ */ jsx(SvgIconLink, {}) }) : /* @__PURE__ */ jsx("span", { className: "link-pill-image", children: illustration }), contentNode = /* @__PURE__ */ jsxs("span", { className: "link-pill-content", children: [
15
+ /* @__PURE__ */ jsx("span", { className: "link-pill-label", title: label, children: label }),
16
+ subtitle && /* @__PURE__ */ jsx("span", { className: "link-pill-subtitle", title: subtitle, children: subtitle })
17
+ ] });
18
+ return /* @__PURE__ */ jsx("a", { href, target: "_blank", rel: "noopener noreferrer", "data-testid": "link-pill", className: clsx("link-pill", `link-pill--illustration-${illustrationPosition}`, className), ...restProps, children: illustrationPosition === "left" ? /* @__PURE__ */ jsxs(Fragment, { children: [
19
+ illustrationNode,
20
+ contentNode
21
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
22
+ contentNode,
23
+ illustrationNode
24
+ ] }) });
25
+ };
26
+ export {
27
+ LinkPill as default
28
+ };
@@ -0,0 +1,2 @@
1
+ export { default as LinkPill } from './LinkPill';
2
+ export * from './LinkPill';
@@ -0,0 +1,47 @@
1
+ export type ModalBetaElement = HTMLDivElement;
2
+ export type ModalBetaSize = 's' | 'm' | 'l' | 'xl';
3
+ export interface ModalBetaProps {
4
+ /**
5
+ * Modal id (useful when multiple modal on the same page)
6
+ */
7
+ id: string;
8
+ /**
9
+ * Modal testid
10
+ */
11
+ ['data-testid']?: string;
12
+ /**
13
+ * Is Modal Open
14
+ */
15
+ isOpen: boolean;
16
+ /**
17
+ * Function to call when closing modal
18
+ */
19
+ onModalClose: () => void;
20
+ /**
21
+ * Size of the modal (width, padding and corner radius)
22
+ */
23
+ size?: ModalBetaSize;
24
+ /**
25
+ * ID of the HTML element to receive focus when modal is active.
26
+ */
27
+ focusId?: string;
28
+ /**
29
+ * Children
30
+ */
31
+ children: React.ReactNode;
32
+ }
33
+ declare const ModalBeta: import('react').ForwardRefExoticComponent<ModalBetaProps & import('react').RefAttributes<HTMLDivElement>> & {
34
+ Header: {
35
+ ({ onModalClose, children, subtitle, }: import('./ModalBetaHeader').ModalBetaHeaderProps): import("react/jsx-runtime").JSX.Element;
36
+ displayName: string;
37
+ };
38
+ Body: {
39
+ ({ children, className }: import('./ModalBetaBody').ModalBetaBodyProps): import("react/jsx-runtime").JSX.Element;
40
+ displayName: string;
41
+ };
42
+ Footer: {
43
+ ({ children }: import('./ModalBetaFooter').ModalBetaFooterProps): import("react/jsx-runtime").JSX.Element;
44
+ displayName: string;
45
+ };
46
+ };
47
+ export default ModalBeta;
@@ -0,0 +1,62 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { forwardRef, useCallback, useEffect } from "react";
3
+ import { useTransition, animated } from "@react-spring/web";
4
+ import clsx from "clsx";
5
+ import ModalBetaBody from "./ModalBetaBody.js";
6
+ import { ModalBetaContext } from "./ModalBetaContext.js";
7
+ import ModalBetaFooter from "./ModalBetaFooter.js";
8
+ import ModalBetaHeader from "./ModalBetaHeader.js";
9
+ import useClickOutside from "../../hooks/useClickOutside/useClickOutside.js";
10
+ import useTrapFocus from "../../hooks/useTrapFocus/useTrapFocus.js";
11
+ import useKeyPress from "../../hooks/useKeyPress/useKeyPress.js";
12
+ const Root = /* @__PURE__ */ forwardRef(({
13
+ id,
14
+ isOpen,
15
+ onModalClose,
16
+ size = "m",
17
+ focusId,
18
+ children,
19
+ ...otherDivProps
20
+ }, ref) => {
21
+ const ariaLabelId = `aria_label_${id}`, ariaDescriptionId = `aria_desc_${id}`, modalRef = useClickOutside(onModalClose, void 0, void 0, isOpen), trapRef = useTrapFocus(isOpen), setDialogRef = useCallback((node) => {
22
+ modalRef.current = node, trapRef.current = node;
23
+ }, [modalRef, trapRef]);
24
+ useKeyPress(onModalClose, ["Escape"]), useEffect(() => {
25
+ if (isOpen && (document.body.style.overflow = "hidden", focusId)) {
26
+ const elem = document.getElementById(focusId);
27
+ elem == null || elem.focus();
28
+ }
29
+ return () => {
30
+ document.body.style.overflow = "";
31
+ };
32
+ }, [focusId, isOpen]);
33
+ const modalClasses = clsx("modal-beta", `modal-beta--${size}`), modalContextValue = {
34
+ ariaLabelId,
35
+ ariaDescriptionId,
36
+ focusId
37
+ }, transition = useTransition(isOpen, {
38
+ from: {
39
+ y: -20,
40
+ opacity: 0
41
+ },
42
+ enter: {
43
+ y: 0,
44
+ opacity: 1
45
+ },
46
+ leave: {
47
+ y: 20,
48
+ opacity: 0
49
+ }
50
+ });
51
+ return /* @__PURE__ */ jsx(ModalBetaContext.Provider, { value: modalContextValue, children: transition((style, isOpen2) => /* @__PURE__ */ jsxs(Fragment, { children: [
52
+ isOpen2 && /* @__PURE__ */ jsx(animated.div, { id, ref, role: "dialog", "aria-modal": "true", "aria-labelledby": ariaLabelId, "aria-describedby": ariaDescriptionId, className: modalClasses, style, tabIndex: -1, ...otherDivProps, children: /* @__PURE__ */ jsx("div", { id: `${id}_ref`, ref: setDialogRef, className: "modal-beta-dialog", children: /* @__PURE__ */ jsx("div", { className: "modal-beta-content", children }) }) }),
53
+ isOpen2 && /* @__PURE__ */ jsx("div", { className: "modal-beta-backdrop" })
54
+ ] })) });
55
+ }), ModalBeta = Object.assign(Root, {
56
+ Header: ModalBetaHeader,
57
+ Body: ModalBetaBody,
58
+ Footer: ModalBetaFooter
59
+ });
60
+ export {
61
+ ModalBeta as default
62
+ };
@@ -0,0 +1,19 @@
1
+ import { ReactNode } from 'react';
2
+ export interface ModalBetaBodyProps {
3
+ /**
4
+ * Children
5
+ */
6
+ children: ReactNode;
7
+ /**
8
+ * Optional class for styling purpose
9
+ */
10
+ className?: string;
11
+ }
12
+ /**
13
+ * ModalBeta Body
14
+ */
15
+ declare const ModalBetaBody: {
16
+ ({ children, className }: ModalBetaBodyProps): import("react/jsx-runtime").JSX.Element;
17
+ displayName: string;
18
+ };
19
+ export default ModalBetaBody;
@@ -0,0 +1,15 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import clsx from "clsx";
3
+ import { useModalBetaContext } from "./ModalBetaContext.js";
4
+ const ModalBetaBody = ({
5
+ children,
6
+ className
7
+ }) => {
8
+ const {
9
+ ariaDescriptionId
10
+ } = useModalBetaContext();
11
+ return /* @__PURE__ */ jsx("div", { id: ariaDescriptionId, className: clsx("modal-beta-body", className), children });
12
+ };
13
+ export {
14
+ ModalBetaBody as default
15
+ };
@@ -0,0 +1,7 @@
1
+ export interface ModalBetaContextProps {
2
+ ariaLabelId: string;
3
+ ariaDescriptionId: string;
4
+ focusId: string | undefined;
5
+ }
6
+ export declare const ModalBetaContext: import('react').Context<ModalBetaContextProps>;
7
+ export declare const useModalBetaContext: () => ModalBetaContextProps;
@@ -0,0 +1,15 @@
1
+ import { createContext, useContext } from "react";
2
+ const ModalBetaContext = /* @__PURE__ */ createContext({
3
+ ariaLabelId: "",
4
+ ariaDescriptionId: "",
5
+ focusId: ""
6
+ }), useModalBetaContext = () => {
7
+ const context = useContext(ModalBetaContext);
8
+ if (!context)
9
+ throw new Error("Cannot be rendered outside the ModalBeta component");
10
+ return context;
11
+ };
12
+ export {
13
+ ModalBetaContext,
14
+ useModalBetaContext
15
+ };
@@ -0,0 +1,13 @@
1
+ import { ReactNode } from 'react';
2
+ export interface ModalBetaFooterProps {
3
+ children: ReactNode;
4
+ }
5
+ /**
6
+ * ModalBeta Footer — right-aligns its children, typically two ButtonBeta
7
+ * (a ghost/tertiary action followed by the primary filled action).
8
+ */
9
+ declare const ModalBetaFooter: {
10
+ ({ children }: ModalBetaFooterProps): import("react/jsx-runtime").JSX.Element;
11
+ displayName: string;
12
+ };
13
+ export default ModalBetaFooter;