@edifice.io/react 2.4.1 → 2.4.2-develop-pedago.20251106112812

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.
@@ -2,13 +2,14 @@ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { forwardRef, useState } from "react";
3
3
  import clsx from "clsx";
4
4
  import { useFormControl } from "../Form/FormContext.js";
5
+ import Textcounter from "../TextCounter/TextCounter.js";
5
6
  const Input = /* @__PURE__ */ forwardRef(({
6
7
  noValidationIcon,
7
8
  placeholder,
8
9
  size = "md",
9
10
  type = "text",
10
11
  className,
11
- showCounter,
12
+ showCounter = !1,
12
13
  autoComplete = "off",
13
14
  ...restProps
14
15
  }, ref) => {
@@ -18,7 +19,7 @@ const Input = /* @__PURE__ */ forwardRef(({
18
19
  isRequired,
19
20
  isReadOnly,
20
21
  status
21
- } = useFormControl(), [currentLength, setCurrentLength] = useState(((_a = restProps.value) == null ? void 0 : _a.toString().length) || 0), classes = clsx({
22
+ } = useFormControl(), [currentLength, setCurrentLength] = useState(((_a = restProps.defaultValue) == null ? void 0 : _a.toString().length) || 0), classes = clsx({
22
23
  "form-control": !isReadOnly,
23
24
  "form-control-lg": size === "lg",
24
25
  "form-control-sm": size === "sm",
@@ -33,14 +34,7 @@ const Input = /* @__PURE__ */ forwardRef(({
33
34
  var _a2;
34
35
  setCurrentLength(e.target.value.length), (_a2 = restProps.onChange) == null || _a2.call(restProps, e);
35
36
  }, autoComplete }),
36
- showCounter && !status && /* @__PURE__ */ jsxs("span", { className: clsx("caption text-end float-end mt-n32 py-2 px-12 ", {
37
- "text-danger": currentLength === restProps.maxLength,
38
- "text-gray-700": currentLength !== restProps.maxLength
39
- }), children: [
40
- currentLength,
41
- " / ",
42
- restProps.maxLength
43
- ] })
37
+ showCounter && !status && /* @__PURE__ */ jsx(Textcounter, { currentLength, maxLength: restProps.maxLength ?? 0 })
44
38
  ] });
45
39
  });
46
40
  export {
@@ -0,0 +1,32 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import clsx from "clsx";
4
+ import Radio from "../Radio/Radio.js";
5
+ import Flex from "../Flex/Flex.js";
6
+ const RadioCard = /* @__PURE__ */ forwardRef(({
7
+ selectedValue,
8
+ value,
9
+ onChange,
10
+ description,
11
+ label,
12
+ model = "",
13
+ groupName = "group",
14
+ ...restProps
15
+ }, ref) => {
16
+ const isSelected = selectedValue === value, handleKeyDown = (event) => {
17
+ if (event.key === "Enter") {
18
+ const inputElement = event.currentTarget.querySelector('input[type="radio"]');
19
+ inputElement && inputElement.click();
20
+ }
21
+ };
22
+ return /* @__PURE__ */ jsxs("label", { ref, role: "button", tabIndex: 0, className: clsx("border py-24 border-2 rounded-3", isSelected && "border-secondary", !isSelected && "border-light", restProps.className), onKeyDown: handleKeyDown, ...restProps, children: [
23
+ /* @__PURE__ */ jsxs(Flex, { justify: "between", className: "px-24", children: [
24
+ /* @__PURE__ */ jsx("h4", { className: "mb-8", id: `radio-card-label-${value}`, children: label }),
25
+ /* @__PURE__ */ jsx(Radio, { model, name: groupName, value, checked: isSelected, onChange, "aria-labelledby": `radio-card-label-${value}` })
26
+ ] }),
27
+ description && /* @__PURE__ */ jsx("p", { id: `radio-card-description-${value}`, className: "px-24 text-gray-700 pe-32", children: description })
28
+ ] });
29
+ });
30
+ export {
31
+ RadioCard as default
32
+ };
@@ -16,7 +16,11 @@ export interface OptionsType {
16
16
  }
17
17
  export interface SelectProps extends Omit<DropdownProps, 'children'>, Omit<DropdownTriggerProps, 'badgeContent'> {
18
18
  /**
19
- * Default select label
19
+ * Controlled value
20
+ */
21
+ selectedValue?: OptionsType | string;
22
+ /**
23
+ * Default select label if no selected value (uncontrolled)
20
24
  */
21
25
  placeholderOption: string;
22
26
  /**
@@ -33,7 +37,7 @@ export interface SelectProps extends Omit<DropdownProps, 'children'>, Omit<Dropd
33
37
  * Select component is based on Dropdown Component. It extends `Dropdown` and `Dropdown.Trigger` props `block`, `overflow`, `icon`, `variant`, `size`, `disabled`
34
38
  */
35
39
  declare const Select: {
36
- ({ icon, options, overflow, block, variant, size, disabled, placeholderOption, onValueChange, }: SelectProps): import("react/jsx-runtime").JSX.Element;
40
+ ({ selectedValue, icon, options, overflow, block, variant, size, disabled, placeholderOption, onValueChange, }: SelectProps): import("react/jsx-runtime").JSX.Element;
37
41
  displayName: string;
38
42
  };
39
43
  export default Select;
@@ -4,6 +4,7 @@ import { useTranslation } from "react-i18next";
4
4
  import SelectTrigger from "./SelectTrigger.js";
5
5
  import Dropdown from "../Dropdown/Dropdown.js";
6
6
  const Select = ({
7
+ selectedValue,
7
8
  icon,
8
9
  options,
9
10
  overflow,
@@ -18,6 +19,8 @@ const Select = ({
18
19
  t
19
20
  } = useTranslation();
20
21
  useEffect(() => {
22
+ selectedValue !== void 0 && setLocalValue(selectedValue);
23
+ }, [selectedValue]), useEffect(() => {
21
24
  if (localValue) {
22
25
  const value = typeof localValue == "object" ? localValue.value : localValue;
23
26
  onValueChange == null || onValueChange(value);
@@ -25,6 +25,10 @@ export interface TextAreaProps extends Omit<React.ComponentPropsWithRef<'textare
25
25
  * Optional class for styling purpose
26
26
  */
27
27
  className?: string;
28
+ /**
29
+ * Show count of characters
30
+ */
31
+ showCounter?: boolean;
28
32
  }
29
33
  /**
30
34
  * TextArea Form Component
@@ -1,21 +1,24 @@
1
- import { jsx, Fragment } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { forwardRef, useState } from "react";
3
3
  import clsx from "clsx";
4
4
  import { useFormControl } from "../Form/FormContext.js";
5
+ import Textcounter from "../TextCounter/TextCounter.js";
5
6
  const TextArea = /* @__PURE__ */ forwardRef(({
6
7
  noValidationIcon,
7
8
  placeholder,
8
9
  size = "md",
9
10
  height = "md",
10
11
  className,
12
+ showCounter = !1,
11
13
  ...restProps
12
14
  }, ref) => {
15
+ var _a;
13
16
  const {
14
17
  id,
15
18
  isRequired,
16
19
  isReadOnly,
17
20
  status
18
- } = useFormControl(), classes = clsx({
21
+ } = useFormControl(), [currentLength, setCurrentLength] = useState(((_a = restProps.defaultValue) == null ? void 0 : _a.toString().length) || 0), classes = clsx({
19
22
  "form-control": !isReadOnly,
20
23
  "form-control-lg": size === "lg",
21
24
  "form-control-sm": size === "sm",
@@ -27,7 +30,13 @@ const TextArea = /* @__PURE__ */ forwardRef(({
27
30
  "form-control-plaintext": isReadOnly,
28
31
  "no-validation-icon": noValidationIcon
29
32
  }, className);
30
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("textarea", { ref, id, className: classes, placeholder, required: isRequired, readOnly: isReadOnly, ...restProps }) });
33
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
34
+ /* @__PURE__ */ jsx("textarea", { ref, id, className: classes, placeholder, required: isRequired, readOnly: isReadOnly, ...restProps, onChange: (e) => {
35
+ var _a2;
36
+ setCurrentLength(e.target.value.length), (_a2 = restProps.onChange) == null || _a2.call(restProps, e);
37
+ } }),
38
+ showCounter && !status && /* @__PURE__ */ jsx(Textcounter, { currentLength, maxLength: restProps.maxLength ?? 0 })
39
+ ] });
31
40
  });
32
41
  export {
33
42
  TextArea as default
@@ -0,0 +1,15 @@
1
+ export interface TextcounterProps {
2
+ /**
3
+ * The current number of characters in the text input
4
+ */
5
+ currentLength: number;
6
+ /**
7
+ * The maximum number of characters allowed in the text input
8
+ */
9
+ maxLength: number;
10
+ }
11
+ declare const Textcounter: {
12
+ ({ currentLength, maxLength }: TextcounterProps): import("react/jsx-runtime").JSX.Element;
13
+ displayName: string;
14
+ };
15
+ export default Textcounter;
@@ -0,0 +1,16 @@
1
+ import { jsxs } from "react/jsx-runtime";
2
+ import clsx from "clsx";
3
+ const Textcounter = ({
4
+ currentLength,
5
+ maxLength
6
+ }) => /* @__PURE__ */ jsxs("span", { className: clsx("caption text-end float-end mt-n32 py-2 px-12 ", {
7
+ "text-danger": currentLength === maxLength,
8
+ "text-gray-700": currentLength !== maxLength
9
+ }), children: [
10
+ currentLength,
11
+ " / ",
12
+ maxLength
13
+ ] });
14
+ export {
15
+ Textcounter as default
16
+ };
@@ -0,0 +1,2 @@
1
+ export { default as TextArea } from './TextCounter';
2
+ export * from './TextCounter';
@@ -32,6 +32,7 @@ export * from './Modal';
32
32
  export * from './Popover';
33
33
  export * from './PreventPropagation';
34
34
  export * from './Radio';
35
+ export * from './RadioCard';
35
36
  export * from './SearchBar';
36
37
  export * from './Select';
37
38
  export * from './Skeleton';
@@ -1,3 +1,5 @@
1
1
  import { CustomToastOptions } from '../../hooks/useToast/useToast';
2
- declare const useHttpErrorToast: (options?: CustomToastOptions) => string | undefined;
2
+ export declare const useHttpErrorToast: ({ active, ...options }: {
3
+ active?: boolean;
4
+ } & CustomToastOptions) => string | undefined;
3
5
  export default useHttpErrorToast;
@@ -2,29 +2,35 @@ import React, { useRef, useEffect } from "react";
2
2
  import { odeServices, LAYER_NAME } from "@edifice.io/client";
3
3
  import { useTranslation } from "react-i18next";
4
4
  import useToast from "../useToast/useToast.js";
5
- const useHttpErrorToast = (options) => {
5
+ const useHttpErrorToast = ({
6
+ active = !0,
7
+ ...options
8
+ }) => {
6
9
  const message = useRef(), toast = useToast(), {
7
10
  t
8
11
  } = useTranslation();
9
12
  return useEffect(() => {
10
- const subscription = odeServices.notify().events().subscribe(LAYER_NAME.TRANSPORT, (event) => {
11
- var _a;
12
- if (!(event != null && event.data)) return;
13
- const {
14
- response
15
- } = event.data, i18nKey = (
16
- // The payload may include the i18n key of the error message to show,
17
- ((_a = event.data.payload) == null ? void 0 : _a.error) || // otherwise, try showing the translation of some known HTTP error code.
18
- ([400, 401, 403, 404, 408, 413, 500, 504].includes(response == null ? void 0 : response.status) ? `e${event.data.response.status}` : void 0) || // otherwise try showing the statusText (may be technical, in english),
19
- (response == null ? void 0 : response.statusText)
20
- );
21
- typeof i18nKey == "string" && (message.current = t(i18nKey), toast.error(/* @__PURE__ */ React.createElement("div", {
22
- children: [message.current]
23
- }), options));
24
- });
25
- return () => subscription.revoke();
26
- }, [t, toast]), message.current;
13
+ if (active) {
14
+ const subscription = odeServices.notify().events().subscribe(LAYER_NAME.TRANSPORT, (event) => {
15
+ var _a;
16
+ if (!(event != null && event.data)) return;
17
+ const {
18
+ response
19
+ } = event.data, i18nKey = (
20
+ // The payload may include the i18n key of the error message to show,
21
+ ((_a = event.data.payload) == null ? void 0 : _a.error) || // otherwise, try showing the translation of some known HTTP error code.
22
+ ([400, 401, 403, 404, 408, 413, 500, 504].includes(response == null ? void 0 : response.status) ? `e${event.data.response.status}` : void 0) || // otherwise try showing the statusText (may be technical, in english),
23
+ (response == null ? void 0 : response.statusText)
24
+ );
25
+ typeof i18nKey == "string" && (message.current = t(i18nKey), toast.error(/* @__PURE__ */ React.createElement("div", {
26
+ children: [message.current]
27
+ }), options));
28
+ });
29
+ return () => subscription.revoke();
30
+ }
31
+ }, [t, toast, active]), message.current;
27
32
  };
28
33
  export {
29
- useHttpErrorToast as default
34
+ useHttpErrorToast as default,
35
+ useHttpErrorToast
30
36
  };
package/dist/index.js CHANGED
@@ -31,36 +31,37 @@ import { default as default31 } from "./components/Logo/Logo.js";
31
31
  import { default as default32 } from "./components/Modal/Modal.js";
32
32
  import { default as default33 } from "./components/PreventPropagation/PreventPropagation.js";
33
33
  import { default as default34 } from "./components/Radio/Radio.js";
34
- import { default as default35 } from "./components/SearchBar/SearchBar.js";
35
- import { default as default36 } from "./components/Select/Select.js";
36
- import { default as default37 } from "./components/Skeleton/ButtonSkeleton.js";
37
- import { default as default38 } from "./components/Skeleton/TextSkeleton.js";
38
- import { default as default39 } from "./components/StackedGroup/StackedGroup.js";
39
- import { default as default40 } from "./components/Stepper/Stepper.js";
40
- import { default as default41 } from "./components/Switch/Switch.js";
41
- import { default as default42 } from "./components/Table/components/Table.js";
42
- import { default as default43 } from "./components/TextArea/TextArea.js";
43
- import { default as default44 } from "./components/Tooltip/Tooltip.js";
34
+ import { default as default35 } from "./components/RadioCard/RadioCard.js";
35
+ import { default as default36 } from "./components/SearchBar/SearchBar.js";
36
+ import { default as default37 } from "./components/Select/Select.js";
37
+ import { default as default38 } from "./components/Skeleton/ButtonSkeleton.js";
38
+ import { default as default39 } from "./components/Skeleton/TextSkeleton.js";
39
+ import { default as default40 } from "./components/StackedGroup/StackedGroup.js";
40
+ import { default as default41 } from "./components/Stepper/Stepper.js";
41
+ import { default as default42 } from "./components/Switch/Switch.js";
42
+ import { default as default43 } from "./components/Table/components/Table.js";
43
+ import { default as default44 } from "./components/TextArea/TextArea.js";
44
+ import { default as default45 } from "./components/Tooltip/Tooltip.js";
44
45
  import { DndTree } from "./components/Tree/components/DndTree.js";
45
- import { default as default45 } from "./components/Tree/components/SortableTree.js";
46
- import { default as default46 } from "./components/Tree/components/Tree.js";
47
- import { default as default47 } from "./components/TreeView/TreeView.js";
48
- import { default as default48 } from "./components/VisuallyHidden/VisuallyHidden.js";
49
- import { default as default49 } from "./hooks/useBookmark/useBookmark.js";
50
- import { default as default50 } from "./hooks/useBreakpoint/useBreakpoint.js";
51
- import { default as default51 } from "./hooks/useBrowserInfo/useBrowserInfo.js";
52
- import { default as default52 } from "./hooks/useCantoo/useCantoo.js";
53
- import { default as default53 } from "./hooks/useClickOutside/useClickOutside.js";
54
- import { default as default54 } from "./hooks/useConversation/useConversation.js";
55
- import { default as default55 } from "./hooks/useDate/useDate.js";
56
- import { default as default56 } from "./hooks/useDebounce/useDebounce.js";
57
- import { default as default57 } from "./hooks/useDirectory/useDirectory.js";
58
- import { default as default58 } from "./hooks/useDropdown/useDropdown.js";
59
- import { default as default59 } from "./hooks/useDropzone/useDropzone.js";
60
- import { default as default60 } from "./hooks/useEdificeIcons/useEdificeIcons.js";
61
- import { default as default61 } from "./hooks/useHasWorkflow/useHasWorkflow.js";
62
- import { default as default62 } from "./hooks/useHover/useHover.js";
63
- import { default as default63 } from "./hooks/useHttpErrorToast/useHttpErrorToast.js";
46
+ import { default as default46 } from "./components/Tree/components/SortableTree.js";
47
+ import { default as default47 } from "./components/Tree/components/Tree.js";
48
+ import { default as default48 } from "./components/TreeView/TreeView.js";
49
+ import { default as default49 } from "./components/VisuallyHidden/VisuallyHidden.js";
50
+ import { default as default50 } from "./hooks/useBookmark/useBookmark.js";
51
+ import { default as default51 } from "./hooks/useBreakpoint/useBreakpoint.js";
52
+ import { default as default52 } from "./hooks/useBrowserInfo/useBrowserInfo.js";
53
+ import { default as default53 } from "./hooks/useCantoo/useCantoo.js";
54
+ import { default as default54 } from "./hooks/useClickOutside/useClickOutside.js";
55
+ import { default as default55 } from "./hooks/useConversation/useConversation.js";
56
+ import { default as default56 } from "./hooks/useDate/useDate.js";
57
+ import { default as default57 } from "./hooks/useDebounce/useDebounce.js";
58
+ import { default as default58 } from "./hooks/useDirectory/useDirectory.js";
59
+ import { default as default59 } from "./hooks/useDropdown/useDropdown.js";
60
+ import { default as default60 } from "./hooks/useDropzone/useDropzone.js";
61
+ import { default as default61 } from "./hooks/useEdificeIcons/useEdificeIcons.js";
62
+ import { default as default62 } from "./hooks/useHasWorkflow/useHasWorkflow.js";
63
+ import { default as default63 } from "./hooks/useHover/useHover.js";
64
+ import { useHttpErrorToast } from "./hooks/useHttpErrorToast/useHttpErrorToast.js";
64
65
  import { default as default64 } from "./hooks/useImage/useImage.js";
65
66
  import { default as default65 } from "./hooks/useIsAdml/useIsAdml.js";
66
67
  import { default as default66 } from "./hooks/useIsAdmc/useIsAdmc.js";
@@ -143,7 +144,7 @@ export {
143
144
  default89 as BlogPublic,
144
145
  default10 as Breadcrumb,
145
146
  default11 as Button,
146
- default37 as ButtonSkeleton,
147
+ default38 as ButtonSkeleton,
147
148
  default14 as Card,
148
149
  default15 as Checkbox,
149
150
  default16 as ColorPicker,
@@ -193,29 +194,30 @@ export {
193
194
  default33 as PreventPropagation,
194
195
  default88 as PublishModal,
195
196
  default34 as Radio,
197
+ default35 as RadioCard,
196
198
  ResourceModal,
197
- default35 as SearchBar,
199
+ default36 as SearchBar,
198
200
  default13 as SearchButton,
199
- default36 as Select,
201
+ default37 as Select,
200
202
  default92 as ShareBlog,
201
203
  default91 as ShareModal,
202
- default45 as SortableTree,
203
- default39 as StackedGroup,
204
- default40 as Stepper,
205
- default41 as Switch,
206
- default42 as Table,
204
+ default46 as SortableTree,
205
+ default40 as StackedGroup,
206
+ default41 as Stepper,
207
+ default42 as Switch,
208
+ default43 as Table,
207
209
  Tabs,
208
- default43 as TextArea,
209
- default38 as TextSkeleton,
210
+ default44 as TextArea,
211
+ default39 as TextSkeleton,
210
212
  Toolbar,
211
- default44 as Tooltip,
212
- default46 as Tree,
213
+ default45 as Tooltip,
214
+ default47 as Tree,
213
215
  TreeNode,
214
216
  TreeNodeFolderWrapper,
215
- default47 as TreeView,
217
+ default48 as TreeView,
216
218
  default100 as VideoEmbed,
217
219
  default101 as VideoRecorder,
218
- default48 as VisuallyHidden,
220
+ default49 as VisuallyHidden,
219
221
  WORKSPACE_SHARED_FOLDER_ID,
220
222
  WORKSPACE_USER_FOLDER_ID,
221
223
  default102 as Workspace,
@@ -247,25 +249,25 @@ export {
247
249
  setRef,
248
250
  updateNode,
249
251
  updateParentIds,
250
- default49 as useBookmark,
251
- default50 as useBreakpoint,
252
- default51 as useBrowserInfo,
253
- default52 as useCantoo,
252
+ default50 as useBookmark,
253
+ default51 as useBreakpoint,
254
+ default52 as useBrowserInfo,
255
+ default53 as useCantoo,
254
256
  useCheckable,
255
- default53 as useClickOutside,
256
- default54 as useConversation,
257
- default55 as useDate,
258
- default56 as useDebounce,
259
- default57 as useDirectory,
260
- default58 as useDropdown,
261
- default59 as useDropzone,
257
+ default54 as useClickOutside,
258
+ default55 as useConversation,
259
+ default56 as useDate,
260
+ default57 as useDebounce,
261
+ default58 as useDirectory,
262
+ default59 as useDropdown,
263
+ default60 as useDropzone,
262
264
  useDropzoneContext,
263
265
  useEdificeClient,
264
- default60 as useEdificeIcons,
266
+ default61 as useEdificeIcons,
265
267
  useEdificeTheme,
266
- default61 as useHasWorkflow,
267
- default62 as useHover,
268
- default63 as useHttpErrorToast,
268
+ default62 as useHasWorkflow,
269
+ default63 as useHover,
270
+ useHttpErrorToast,
269
271
  default64 as useImage,
270
272
  default66 as useIsAdmc,
271
273
  default65 as useIsAdml,
@@ -69,7 +69,9 @@ const DeleteModal = /* @__PURE__ */ lazy(() => import("./DeleteModal.js")), Comm
69
69
  ] })
70
70
  ] })
71
71
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
72
- /* @__PURE__ */ jsx("div", { className: "mt-8 mb-4", children: content }),
72
+ /* @__PURE__ */ jsx("div", { className: "mt-8 mb-4", style: {
73
+ whiteSpace: "pre-line"
74
+ }, children: content }),
73
75
  type === "edit" && /* @__PURE__ */ jsxs("div", { className: "ms-n8", children: [
74
76
  !replyTo && /* @__PURE__ */ jsx(Button, { variant: "ghost", color: "tertiary", size: "sm", onClick: () => handleReplyToComment(comment.id), children: t("comment.reply") }),
75
77
  userId === authorId && /* @__PURE__ */ jsx(Button, { variant: "ghost", color: "tertiary", size: "sm", onClick: () => {
@@ -4,7 +4,6 @@ import { odeServices } from "@edifice.io/client";
4
4
  import { createPortal } from "react-dom";
5
5
  import { useForm } from "react-hook-form";
6
6
  import { useTranslation } from "react-i18next";
7
- import { TextareaCounter } from "../../../components/TextArea/TextareaCounter.js";
8
7
  import ImagePicker from "../../multimedia/ImagePicker/ImagePicker.js";
9
8
  import { useThumb } from "./hooks/useThumb.js";
10
9
  import { useEdificeClient } from "../../../providers/EdificeClientProvider/EdificeClientProvider.hook.js";
@@ -67,7 +66,7 @@ const DEFAULT_INPUT_MAX_LENGTH = 60, DEFAULT_TEXTAREA_MAX_LENGTH = 400, Resource
67
66
  } = useThumb({
68
67
  isUpdating,
69
68
  selectedResource: isUpdating ? resource : void 0
70
- }), watchedDescription = watch("description"), onSubmit = async function(formData) {
69
+ }), onSubmit = async function(formData) {
71
70
  var _a2, _b2;
72
71
  try {
73
72
  const data = {
@@ -132,15 +131,14 @@ const DEFAULT_INPUT_MAX_LENGTH = 60, DEFAULT_TEXTAREA_MAX_LENGTH = 400, Resource
132
131
  value: /[^ ]/,
133
132
  message: "invalid title"
134
133
  }
135
- }), placeholder: ((_e = customT.placeholder) == null ? void 0 : _e.title) ?? t("explorer.resource.editModal.title.placeholder"), size: "md", "aria-required": !0, maxLength: inputMaxLength })
134
+ }), placeholder: ((_e = customT.placeholder) == null ? void 0 : _e.title) ?? t("explorer.resource.editModal.title.placeholder"), size: "md", "aria-required": !0, maxLength: inputMaxLength, showCounter: !0 })
136
135
  ] }),
137
136
  /* @__PURE__ */ jsxs(FormControl, { id: "description", isOptional: !0, children: [
138
137
  /* @__PURE__ */ jsx(Label, { children: customT.description ?? t("description") }),
139
138
  /* @__PURE__ */ jsx(TextArea, { defaultValue: (resource == null ? void 0 : resource.description) || "", ...register("description", {
140
139
  required: !1,
141
140
  maxLength: textareaMaxLength
142
- }), placeholder: ((_f = customT.placeholder) == null ? void 0 : _f.description) ?? t("explorer.resource.editModal.description.placeholder"), size: "md", maxLength: textareaMaxLength }),
143
- watchedDescription && /* @__PURE__ */ jsx(TextareaCounter, { content: watchedDescription, maxLength: textareaMaxLength })
141
+ }), placeholder: ((_f = customT.placeholder) == null ? void 0 : _f.description) ?? t("explorer.resource.editModal.description.placeholder"), size: "md", maxLength: textareaMaxLength, showCounter: !0 })
144
142
  ] })
145
143
  ] })
146
144
  ] }),
@@ -11,8 +11,8 @@ import SvgIconRecordVideo from "../../icons/components/IconRecordVideo.js";
11
11
  import SvgIconSmartphone from "../../icons/components/IconSmartphone.js";
12
12
  import { InnerTabs } from "./innertabs/index.js";
13
13
  import { MediaLibraryContext } from "./MediaLibraryContext.js";
14
- import useHttpErrorToast from "../../../hooks/useHttpErrorToast/useHttpErrorToast.js";
15
14
  import useHasWorkflow from "../../../hooks/useHasWorkflow/useHasWorkflow.js";
15
+ import { useHttpErrorToast } from "../../../hooks/useHttpErrorToast/useHttpErrorToast.js";
16
16
  import Modal from "../../../components/Modal/Modal.js";
17
17
  import { Tabs } from "../../../components/Tabs/components/Tabs.js";
18
18
  import Button from "../../../components/Button/Button.js";
@@ -78,13 +78,16 @@ const orderedTabs = [
78
78
  showLink,
79
79
  type,
80
80
  ...refModal.current
81
- })), useHttpErrorToast({
81
+ }));
82
+ const {
83
+ t
84
+ } = useTranslation(), workspaceCreateWorkflow = useHasWorkflow("org.entcore.workspace.controllers.WorkspaceController|addDocument"), videoCaptureWorkflow = useHasWorkflow("com.opendigitaleducation.video.controllers.VideoController|capture"), [type, setType] = useState(null);
85
+ useHttpErrorToast({
86
+ active: !!type,
82
87
  isDismissible: !0,
83
88
  duration: 1 / 0
84
89
  });
85
- const {
86
- t
87
- } = useTranslation(), workspaceCreateWorkflow = useHasWorkflow("org.entcore.workspace.controllers.WorkspaceController|addDocument"), videoCaptureWorkflow = useHasWorkflow("com.opendigitaleducation.video.controllers.VideoController|capture"), [type, setType] = useState(null), availableTabs = {
90
+ const availableTabs = {
88
91
  workspace: {
89
92
  id: "workspace",
90
93
  icon: /* @__PURE__ */ jsx(SvgIconFolder, {}),
@@ -1,5 +1,7 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { useMediaLibraryContext } from "../MediaLibraryContext.js";
3
+ import { useTranslation } from "react-i18next";
4
+ import Alert from "../../../../components/Alert/Alert.js";
3
5
  import Dropzone from "../../../../components/Dropzone/Dropzone.js";
4
6
  import UploadFiles from "../../UploadFiles/UploadFiles.js";
5
7
  const acceptedTypes = (type) => {
@@ -18,6 +20,8 @@ const acceptedTypes = (type) => {
18
20
  return acceptedTypes2;
19
21
  }, Upload = () => {
20
22
  const {
23
+ t
24
+ } = useTranslation(), {
21
25
  type,
22
26
  visibility,
23
27
  multiple,
@@ -27,7 +31,10 @@ const acceptedTypes = (type) => {
27
31
  } = useMediaLibraryContext(), handleOnFilesChange = (uploadedFiles) => {
28
32
  uploadedFiles.length ? (setCancellable(uploadedFiles), setResultCounter(uploadedFiles.length), setResult(uploadedFiles)) : (setCancellable([]), setResultCounter(void 0), setResult(void 0));
29
33
  };
30
- return /* @__PURE__ */ jsx("div", { className: "py-8 flex-grow-1", children: /* @__PURE__ */ jsx(Dropzone, { multiple, accept: acceptedTypes(type ?? "embedder"), children: /* @__PURE__ */ jsx(UploadFiles, { onFilesChange: handleOnFilesChange, visibility }) }) });
34
+ return /* @__PURE__ */ jsxs("div", { className: "flex-grow-1", children: [
35
+ multiple && /* @__PURE__ */ jsx(Alert, { type: "info", className: "flex-shrink-0 mb-16", children: t("bbm.upload.alert") }),
36
+ /* @__PURE__ */ jsx(Dropzone, { multiple, accept: acceptedTypes(type ?? "embedder"), children: /* @__PURE__ */ jsx(UploadFiles, { onFilesChange: handleOnFilesChange, visibility }) })
37
+ ] });
31
38
  };
32
39
  export {
33
40
  Upload
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/react",
3
- "version": "2.4.1",
3
+ "version": "2.4.2-develop-pedago.20251106112812",
4
4
  "description": "Edifice React Library",
5
5
  "keywords": [
6
6
  "react",
@@ -131,9 +131,9 @@
131
131
  "react-slugify": "^3.0.3",
132
132
  "swiper": "^10.1.0",
133
133
  "ua-parser-js": "^1.0.36",
134
- "@edifice.io/bootstrap": "2.4.1",
135
- "@edifice.io/tiptap-extensions": "2.4.1",
136
- "@edifice.io/utilities": "2.4.1"
134
+ "@edifice.io/tiptap-extensions": "2.4.2-develop-pedago.20251106112812",
135
+ "@edifice.io/utilities": "2.4.2-develop-pedago.20251106112812",
136
+ "@edifice.io/bootstrap": "2.4.2-develop-pedago.20251106112812"
137
137
  },
138
138
  "devDependencies": {
139
139
  "@babel/plugin-transform-react-pure-annotations": "^7.23.3",
@@ -164,8 +164,8 @@
164
164
  "vite": "^5.4.11",
165
165
  "vite-plugin-dts": "^4.1.0",
166
166
  "vite-tsconfig-paths": "^5.0.1",
167
- "@edifice.io/client": "2.4.1",
168
- "@edifice.io/config": "2.4.1"
167
+ "@edifice.io/client": "2.4.2-develop-pedago.20251106112812",
168
+ "@edifice.io/config": "2.4.2-develop-pedago.20251106112812"
169
169
  },
170
170
  "peerDependencies": {
171
171
  "@react-spring/web": "^9.7.5",
@@ -1,8 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- const TextareaCounter = ({
3
- content,
4
- maxLength
5
- }) => /* @__PURE__ */ jsx("p", { className: "small text-gray-700 p-2 text-end", children: content ? `${content.length} / ${maxLength}` : "" });
6
- export {
7
- TextareaCounter
8
- };