@edifice.io/react 2.2.2-develop-pedago.20250409103005 → 2.2.2-develop-b2school.20250410105023

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 (125) hide show
  1. package/dist/components/Avatar/Avatar.d.ts +0 -21
  2. package/dist/components/Avatar/Avatar.js +2 -15
  3. package/dist/components/Card/Card.d.ts +1 -3
  4. package/dist/components/Card/CardBody.d.ts +1 -3
  5. package/dist/components/Card/CardBody.js +2 -4
  6. package/dist/components/Combobox/Combobox.d.ts +55 -5
  7. package/dist/components/Combobox/Combobox.js +13 -7
  8. package/dist/components/Combobox/ComboboxTrigger.d.ts +30 -2
  9. package/dist/components/Combobox/ComboboxTrigger.js +27 -8
  10. package/dist/components/Dropdown/Dropdown.d.ts +10 -6
  11. package/dist/components/Dropdown/Dropdown.js +5 -5
  12. package/dist/components/Dropdown/DropdownItem.d.ts +3 -3
  13. package/dist/components/Dropdown/DropdownItem.js +6 -8
  14. package/dist/components/Dropdown/DropdownTrigger.d.ts +2 -31
  15. package/dist/components/Dropdown/DropdownTrigger.js +8 -24
  16. package/dist/components/List/List.d.ts +9 -1
  17. package/dist/components/List/List.js +9 -9
  18. package/dist/components/SearchBar/SearchBar.d.ts +1 -1
  19. package/dist/components/SearchBar/SearchBar.js +3 -1
  20. package/dist/components/index.d.ts +0 -4
  21. package/dist/editor.js +22 -22
  22. package/dist/hooks/index.d.ts +1 -0
  23. package/dist/hooks/useCheckable/useCheckable.js +10 -3
  24. package/dist/hooks/useConf/useConf.d.ts +1 -1
  25. package/dist/hooks/useConversation/useConversation.d.ts +1 -1
  26. package/dist/hooks/useConversation/useConversation.js +13 -17
  27. package/dist/hooks/useDropdown/useDropdown.d.ts +2 -1
  28. package/dist/hooks/useDropdown/useDropdown.js +5 -3
  29. package/dist/hooks/useSession/useSession.d.ts +1 -1
  30. package/dist/hooks/useWorkspaceFolders/index.d.ts +1 -0
  31. package/dist/hooks/useWorkspaceFolders/useWorkspaceFolders.d.ts +14 -0
  32. package/dist/hooks/useWorkspaceFolders/useWorkspaceFolders.js +44 -0
  33. package/dist/icons.js +230 -212
  34. package/dist/index.d.ts +1 -0
  35. package/dist/index.js +172 -154
  36. package/dist/modals.js +16 -14
  37. package/dist/modules/comments/components/Comment.js +34 -49
  38. package/dist/modules/comments/components/CommentForm.d.ts +1 -2
  39. package/dist/modules/comments/components/CommentForm.js +8 -12
  40. package/dist/modules/comments/components/CommentList.js +3 -3
  41. package/dist/modules/comments/constants.d.ts +0 -4
  42. package/dist/modules/comments/constants.js +1 -2
  43. package/dist/modules/comments/context/Context.d.ts +4 -6
  44. package/dist/modules/comments/hooks/useComments.d.ts +7 -7
  45. package/dist/modules/comments/hooks/useComments.js +19 -24
  46. package/dist/modules/comments/hooks/useCommentsContext.d.ts +4 -6
  47. package/dist/modules/comments/provider/CommentProvider.js +13 -16
  48. package/dist/modules/comments/types.d.ts +1 -14
  49. package/dist/modules/editor/components/Editor/Editor.d.ts +3 -1
  50. package/dist/modules/editor/components/Editor/Editor.js +5 -8
  51. package/dist/modules/editor/components/EditorToolbar/EditorToolbar.js +0 -12
  52. package/dist/modules/editor/components/NodeView/ConversationHistoryNodeView.d.ts +2 -0
  53. package/dist/modules/editor/components/NodeView/ConversationHistoryNodeView.js +10 -0
  54. package/dist/modules/editor/components/NodeView/index.d.ts +2 -2
  55. package/dist/modules/editor/components/Renderer/ConversationHistoryRenderer.d.ts +8 -0
  56. package/dist/modules/editor/components/Renderer/ConversationHistoryRenderer.js +28 -0
  57. package/dist/modules/editor/components/Renderer/index.d.ts +2 -2
  58. package/dist/modules/editor/hooks/useTipTapEditor.d.ts +6 -2
  59. package/dist/modules/editor/hooks/useTipTapEditor.js +2 -4
  60. package/dist/modules/icons/components/IconFolderAdd.d.ts +7 -0
  61. package/dist/modules/icons/components/IconFolderAdd.js +13 -0
  62. package/dist/modules/icons/components/IconFolderDelete.d.ts +7 -0
  63. package/dist/modules/icons/components/IconFolderDelete.js +12 -0
  64. package/dist/modules/icons/components/IconGlobe2.d.ts +7 -0
  65. package/dist/modules/icons/components/IconGlobe2.js +16 -0
  66. package/dist/modules/icons/components/IconGroupAvatar.d.ts +7 -0
  67. package/dist/modules/icons/components/IconGroupAvatar.js +12 -0
  68. package/dist/modules/icons/components/IconMailRecall.d.ts +7 -0
  69. package/dist/modules/icons/components/IconMailRecall.js +13 -0
  70. package/dist/modules/icons/components/IconQuestionMark.d.ts +7 -0
  71. package/dist/modules/icons/components/IconQuestionMark.js +13 -0
  72. package/dist/modules/icons/components/IconReadMail.d.ts +7 -0
  73. package/dist/modules/icons/components/IconReadMail.js +16 -0
  74. package/dist/modules/icons/components/IconSignature.d.ts +7 -0
  75. package/dist/modules/icons/components/IconSignature.js +13 -0
  76. package/dist/modules/icons/components/IconUndoAll.d.ts +7 -0
  77. package/dist/modules/icons/components/IconUndoAll.js +14 -0
  78. package/dist/modules/icons/components/IconUnreadMail.d.ts +7 -0
  79. package/dist/modules/icons/components/IconUnreadMail.js +16 -0
  80. package/dist/modules/icons/components/index.d.ts +10 -1
  81. package/dist/modules/modals/ConfirmModal/ConfirmModal.d.ts +42 -0
  82. package/dist/modules/modals/ConfirmModal/ConfirmModal.js +36 -0
  83. package/dist/modules/modals/ConfirmModal/index.d.ts +1 -0
  84. package/dist/modules/modals/ResourceModal/ResourceModal.d.ts +1 -1
  85. package/dist/modules/modals/ResourceModal/hooks/useUpdateMutation.d.ts +1 -1
  86. package/dist/modules/modals/ShareModal/ShareModal.d.ts +1 -1
  87. package/dist/modules/modals/ShareModal/apps/ShareBlog.d.ts +1 -1
  88. package/dist/modules/modals/ShareModal/hooks/useShareMutation.d.ts +1 -1
  89. package/dist/modules/modals/index.d.ts +1 -0
  90. package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.js +5 -9
  91. package/dist/modules/multimedia/WorkspaceFolders/WorkspaceFolders.d.ts +8 -0
  92. package/dist/modules/multimedia/WorkspaceFolders/WorkspaceFolders.js +28 -0
  93. package/dist/modules/multimedia/WorkspaceFolders/index.d.ts +1 -0
  94. package/dist/modules/multimedia/index.d.ts +1 -0
  95. package/dist/multimedia.js +3 -1
  96. package/dist/providers/EdificeClientProvider/EdificeClientProvider.context.d.ts +1 -1
  97. package/dist/types/index.d.ts +0 -1
  98. package/package.json +6 -6
  99. package/dist/components/AvatarGroup/AvatarGroup.d.ts +0 -24
  100. package/dist/components/AvatarGroup/AvatarGroup.js +0 -24
  101. package/dist/components/AvatarGroup/index.d.ts +0 -2
  102. package/dist/components/PreventPropagation/PreventPropagation.d.ts +0 -10
  103. package/dist/components/PreventPropagation/PreventPropagation.js +0 -9
  104. package/dist/components/PreventPropagation/index.d.ts +0 -2
  105. package/dist/components/StackedGroup/StackedGroup.d.ts +0 -23
  106. package/dist/components/StackedGroup/StackedGroup.js +0 -21
  107. package/dist/components/StackedGroup/index.d.ts +0 -1
  108. package/dist/components/Switch/Switch.d.ts +0 -29
  109. package/dist/components/Switch/Switch.js +0 -27
  110. package/dist/components/Switch/index.d.ts +0 -2
  111. package/dist/modules/comments/components/CommentDeleted.d.ts +0 -1
  112. package/dist/modules/comments/components/CommentDeleted.js +0 -11
  113. package/dist/modules/comments/components/CommentReplies.d.ts +0 -4
  114. package/dist/modules/comments/components/CommentReplies.js +0 -33
  115. package/dist/modules/comments/hooks/useCommentReplies.d.ts +0 -12
  116. package/dist/modules/comments/hooks/useCommentReplies.js +0 -36
  117. package/dist/modules/editor/components/BubbleMenuEditInformationPane/BubbleMenuEditInformationPane.d.ts +0 -6
  118. package/dist/modules/editor/components/BubbleMenuEditInformationPane/BubbleMenuEditInformationPane.js +0 -136
  119. package/dist/modules/editor/components/BubbleMenuEditInformationPane/index.d.ts +0 -1
  120. package/dist/modules/editor/components/NodeView/InformationPaneNodeView.d.ts +0 -2
  121. package/dist/modules/editor/components/NodeView/InformationPaneNodeView.js +0 -10
  122. package/dist/modules/editor/components/Renderer/InformationPaneRenderer.d.ts +0 -3
  123. package/dist/modules/editor/components/Renderer/InformationPaneRenderer.js +0 -33
  124. package/dist/modules/icons/components/IconInfoRectangle.d.ts +0 -7
  125. package/dist/modules/icons/components/IconInfoRectangle.js +0 -13
@@ -1,4 +1,3 @@
1
- import { Color } from 'src/types/color';
2
1
  export type AvatarVariants = 'square' | 'rounded' | 'circle';
3
2
  export type AvatarSizes = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
4
3
  export interface AvatarProps extends React.ComponentPropsWithRef<'img'> {
@@ -27,26 +26,6 @@ export interface AvatarProps extends React.ComponentPropsWithRef<'img'> {
27
26
  * Optional class for styling purpose
28
27
  */
29
28
  className?: string;
30
- /**
31
- * Inner border color
32
- */
33
- innerBorderColor?: Color;
34
- /**
35
- * Inner border width in pixels
36
- */
37
- innerBorderWidth?: number;
38
- /**
39
- * Outer border color
40
- */
41
- outerBorderColor?: Color;
42
- /**
43
- * Outer border width in pixels
44
- */
45
- outerBorderWidth?: number;
46
- /**
47
- * Outer border offset in pixels
48
- */
49
- outerBorderOffset?: number;
50
29
  }
51
30
  declare const Avatar: import('react').ForwardRefExoticComponent<Omit<AvatarProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
52
31
  export default Avatar;
@@ -10,11 +10,6 @@ const Avatar = /* @__PURE__ */ forwardRef(({
10
10
  src,
11
11
  imgPlaceholder,
12
12
  className,
13
- innerBorderColor,
14
- innerBorderWidth,
15
- outerBorderColor,
16
- outerBorderWidth,
17
- outerBorderOffset,
18
13
  ...restProps
19
14
  }, ref) => {
20
15
  const placeholder = imgPlaceholder || noAvatar, classes = clsx("avatar", {
@@ -30,16 +25,8 @@ const Avatar = /* @__PURE__ */ forwardRef(({
30
25
  rounded: variant === "rounded",
31
26
  "rounded-circle": variant === "circle"
32
27
  }
33
- }, className), style = {
34
- ...outerBorderColor && {
35
- outline: `${outerBorderWidth}px solid var(--edifice-${outerBorderColor})`,
36
- outlineOffset: outerBorderOffset
37
- },
38
- ...innerBorderColor && {
39
- border: `${innerBorderWidth}px solid var(--edifice-${innerBorderColor})`
40
- }
41
- };
42
- return /* @__PURE__ */ jsx("div", { ref, className: classes, style, children: /* @__PURE__ */ jsx(Image, { src: src || placeholder, alt, imgPlaceholder: placeholder, ...restProps }) });
28
+ }, className);
29
+ return /* @__PURE__ */ jsx("div", { ref, className: classes, children: /* @__PURE__ */ jsx(Image, { src: src || placeholder, alt, imgPlaceholder: placeholder, ...restProps }) });
43
30
  });
44
31
  export {
45
32
  Avatar as default
@@ -59,10 +59,8 @@ declare const Card: import('react').ForwardRefExoticComponent<CardProps & import
59
59
  displayName: string;
60
60
  };
61
61
  Body: {
62
- ({ children, gap, space, padding, flexDirection, }: {
63
- gap?: "0" | "8" | "16" | null;
62
+ ({ children, space, flexDirection, }: {
64
63
  space?: "0" | "8" | "16" | null;
65
- padding?: "0" | "8" | "16" | null;
66
64
  flexDirection?: "row" | "column" | null;
67
65
  children: ReactNode;
68
66
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,9 +1,7 @@
1
1
  import { ReactNode } from 'react';
2
2
  declare const CardBody: {
3
- ({ children, gap, space, padding, flexDirection, }: {
4
- gap?: "0" | "8" | "16" | null;
3
+ ({ children, space, flexDirection, }: {
5
4
  space?: "0" | "8" | "16" | null;
6
- padding?: "0" | "8" | "16" | null;
7
5
  flexDirection?: "row" | "column" | null;
8
6
  children: ReactNode;
9
7
  }): import("react/jsx-runtime").JSX.Element;
@@ -2,14 +2,12 @@ import { jsx } from "react/jsx-runtime";
2
2
  import clsx from "clsx";
3
3
  const CardBody = ({
4
4
  children,
5
- gap = null,
6
5
  space = null,
7
- padding = null,
8
6
  flexDirection = "row"
9
7
  }) => {
10
8
  const cardbody = clsx("card-body", {
11
- [`p-${padding ?? space}`]: space,
12
- [`gap-${gap ?? space}`]: space,
9
+ [`p-${space}`]: space,
10
+ [`gap-${space}`]: space,
13
11
  "align-items-start": flexDirection === "column",
14
12
  "flex-column": flexDirection === "column"
15
13
  });
@@ -1,13 +1,20 @@
1
- import { ChangeEvent } from 'react';
1
+ import { ChangeEvent, ReactNode } from 'react';
2
2
  export interface ComboboxProps extends React.InputHTMLAttributes<HTMLInputElement> {
3
- onSearchResultsChange: (model: (string | number)[]) => void;
4
3
  onSearchInputChange: (event: ChangeEvent<HTMLInputElement>) => void;
5
4
  options: OptionListItemType[];
6
5
  value: string;
7
6
  isLoading: boolean;
8
7
  noResult: boolean;
8
+ onSearchResultsChange?: (model: (string | number)[]) => void;
9
9
  searchMinLength?: number;
10
10
  placeholder?: string;
11
+ variant?: 'outline' | 'ghost';
12
+ renderInputGroup?: ReactNode;
13
+ renderList?: (items: OptionListItemType[]) => ReactNode;
14
+ renderListItem?: (item: OptionListItemType) => ReactNode;
15
+ renderSelectedItems?: ReactNode;
16
+ renderNoResult?: ReactNode;
17
+ hasDefault?: boolean;
11
18
  }
12
19
  export interface OptionListItemType {
13
20
  /**
@@ -17,15 +24,58 @@ export interface OptionListItemType {
17
24
  /**
18
25
  * Label
19
26
  */
20
- label: string;
27
+ label?: string;
21
28
  /**
22
29
  * Add an icon
23
30
  */
24
31
  icon?: any;
32
+ /**
33
+ * Display Separator or not
34
+ */
35
+ withSeparator?: boolean;
36
+ /**
37
+ * Disable option
38
+ */
39
+ disabled?: boolean;
25
40
  }
41
+ /**
42
+ * A component that combines an input field with a dropdown list of selectable options.
43
+ *
44
+ * @component
45
+ * @example
46
+ * ```tsx
47
+ * <Combobox
48
+ * onSearchResultsChange={(values) => console.log(values)}
49
+ * onSearchInputChange={(e) => console.log(e.target.value)}
50
+ * options={[{ value: '1', label: 'Option 1' }]}
51
+ * value=""
52
+ * isLoading={false}
53
+ * noResult={false}
54
+ * />
55
+ * ```
56
+ *
57
+ * @param props - The component props
58
+ * @param props.onSearchResultsChange - Callback fired when the selected values change
59
+ * @param props.onSearchInputChange - Callback fired when the search input value changes
60
+ * @param props.options - Array of options to display in the dropdown
61
+ * @param props.value - Current value of the search input
62
+ * @param props.isLoading - Whether the component is in a loading state
63
+ * @param props.noResult - Whether to show a "no results" message
64
+ * @param props.searchMinLength - Minimum number of characters required to trigger search
65
+ * @param props.placeholder - Placeholder text for the input field
66
+ * @param props.variant - Visual variant of the input ('outline' or 'ghost')
67
+ * @param props.renderInputGroup - Custom render function for the input group
68
+ * @param props.renderList - Custom render function for the dropdown list
69
+ * @param props.renderListItem - Custom render function for each option item
70
+ * @param props.renderSelectedItems - Custom render function for selected items
71
+ * @param props.renderNoResult - Custom render function for no results message
72
+ * @param props.hasDefault - Whether to show default options
73
+ *
74
+ * @extends {React.InputHTMLAttributes<HTMLInputElement>}
75
+ */
26
76
  declare const Combobox: {
27
- ({ onSearchResultsChange, onSearchInputChange, options, value, isLoading, noResult, searchMinLength, placeholder, }: ComboboxProps): import("react/jsx-runtime").JSX.Element;
28
- Trigger: ({ placeholder, value, searchMinLength, handleSearchInputChange, }: import('./ComboboxTrigger').ComboboxTriggerProps) => import("react/jsx-runtime").JSX.Element;
77
+ ({ onSearchResultsChange, onSearchInputChange, options, value, isLoading, noResult, searchMinLength, placeholder, variant, renderInputGroup, renderList, renderListItem, renderSelectedItems, renderNoResult, }: ComboboxProps): import("react/jsx-runtime").JSX.Element;
78
+ Trigger: ({ placeholder, value, searchMinLength, handleSearchInputChange, renderInputGroup, variant, renderSelectedItems, hasDefault, }: import('./ComboboxTrigger').ComboboxTriggerProps) => import("react/jsx-runtime").JSX.Element;
29
79
  displayName: string;
30
80
  };
31
81
  export default Combobox;
@@ -12,25 +12,31 @@ const Combobox = ({
12
12
  isLoading,
13
13
  noResult,
14
14
  searchMinLength,
15
- placeholder
15
+ placeholder,
16
+ variant = "outline",
17
+ renderInputGroup,
18
+ renderList,
19
+ renderListItem,
20
+ renderSelectedItems,
21
+ renderNoResult
16
22
  }) => {
17
23
  const {
18
24
  t
19
25
  } = useTranslation(), [localValue, setLocalValue] = useState([]);
20
26
  useEffect(() => {
21
- onSearchResultsChange(localValue);
27
+ onSearchResultsChange == null || onSearchResultsChange(localValue);
22
28
  }, [localValue]);
23
29
  const handleOptionClick = (value2) => {
24
30
  setLocalValue([value2]);
25
31
  }, renderContent = () => isLoading ? /* @__PURE__ */ jsxs("div", { className: "d-flex align-items-center p-4", children: [
26
32
  /* @__PURE__ */ jsx(Loading, { isLoading }),
27
33
  /* @__PURE__ */ jsx("span", { className: "ps-4", children: t("explorer.search.pending") })
28
- ] }) : noResult ? /* @__PURE__ */ jsx("div", { className: "p-4", children: t("portal.no.result") }) : options.map((option, index) => /* @__PURE__ */ jsxs(Fragment, { children: [
29
- /* @__PURE__ */ jsx(Dropdown.Item, { type: "select", icon: option.icon, onClick: () => handleOptionClick(option.value), children: option.label }),
30
- index < options.length - 1 && /* @__PURE__ */ jsx(Dropdown.Separator, {})
34
+ ] }) : noResult ? renderNoResult || /* @__PURE__ */ jsx("div", { className: "p-4", children: t("portal.no.result") }) : renderList ? renderList(options) : options.map((option, index) => /* @__PURE__ */ jsxs(Fragment, { children: [
35
+ /* @__PURE__ */ jsx(Dropdown.Item, { type: "select", icon: option.icon, onClick: () => handleOptionClick(option.value), disabled: option.disabled, children: renderListItem ? renderListItem(option) : option.label }),
36
+ (option.withSeparator || option.withSeparator === void 0) && index < options.length - 1 && /* @__PURE__ */ jsx(Dropdown.Separator, {})
31
37
  ] }, index));
32
- return /* @__PURE__ */ jsxs(Dropdown, { block: !0, children: [
33
- /* @__PURE__ */ jsx(Combobox.Trigger, { placeholder, searchMinLength, handleSearchInputChange: onSearchInputChange, value }),
38
+ return /* @__PURE__ */ jsxs(Dropdown, { block: !0, focusOnVisible: !1, openOnSpace: !1, children: [
39
+ /* @__PURE__ */ jsx(Combobox.Trigger, { placeholder, searchMinLength, handleSearchInputChange: onSearchInputChange, value, variant, renderInputGroup, renderSelectedItems, hasDefault: !!options.length }),
34
40
  /* @__PURE__ */ jsx(Dropdown.Menu, { children: renderContent() })
35
41
  ] });
36
42
  };
@@ -1,9 +1,37 @@
1
- import { ChangeEvent } from 'react';
1
+ import { ChangeEvent, ReactNode } from 'react';
2
2
  export interface ComboboxTriggerProps extends React.ComponentPropsWithRef<'button'> {
3
3
  handleSearchInputChange: (event: ChangeEvent<HTMLInputElement>) => void;
4
4
  value: string;
5
5
  searchMinLength?: number;
6
6
  placeholder?: string;
7
+ renderInputGroup?: React.ReactNode;
8
+ variant?: 'outline' | 'ghost';
9
+ renderSelectedItems?: ReactNode;
10
+ hasDefault?: boolean;
7
11
  }
8
- declare const ComboboxTrigger: ({ placeholder, value, searchMinLength, handleSearchInputChange, }: ComboboxTriggerProps) => import("react/jsx-runtime").JSX.Element;
12
+ /**
13
+ * A trigger component for the Combobox that handles user input and displays selected items.
14
+ *
15
+ * @component
16
+ * @example
17
+ * ```tsx
18
+ * <ComboboxTrigger
19
+ * value={searchValue}
20
+ * handleSearchInputChange={(e) => setSearchValue(e.target.value)}
21
+ * placeholder="Search..."
22
+ * />
23
+ * ```
24
+ *
25
+ * @param {object} props - Component props
26
+ * @param {string} [props.placeholder] - Placeholder text for the search input
27
+ * @param {string} [props.value=''] - Current value of the search input
28
+ * @param {number} [props.searchMinLength=3] - Minimum number of characters required before showing dropdown
29
+ * @param {(event: ChangeEvent<HTMLInputElement>) => void} props.handleSearchInputChange - Handler for input change events
30
+ * @param {ReactNode} [props.renderInputGroup] - Optional content to render in the input group (e.g., icons)
31
+ * @param {'outline' | 'ghost'} [props.variant='outline'] - Visual variant of the input
32
+ * @param {ReactNode} [props.renderSelectedItems] - Optional content to render selected items
33
+ *
34
+ * @returns {JSX.Element} A form control containing an input field with optional input group and selected items
35
+ */
36
+ declare const ComboboxTrigger: ({ placeholder, value, searchMinLength, handleSearchInputChange, renderInputGroup, variant, renderSelectedItems, hasDefault, }: ComboboxTriggerProps) => import("react/jsx-runtime").JSX.Element;
9
37
  export default ComboboxTrigger;
@@ -1,5 +1,6 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { useEffect } from "react";
3
+ import clsx from "clsx";
3
4
  import { useDropdownContext } from "../Dropdown/DropdownContext.js";
4
5
  import Input from "../Input/Input.js";
5
6
  import FormControl from "../Form/FormControl.js";
@@ -7,23 +8,41 @@ const ComboboxTrigger = ({
7
8
  placeholder,
8
9
  value = "",
9
10
  searchMinLength = 3,
10
- handleSearchInputChange
11
+ handleSearchInputChange,
12
+ renderInputGroup,
13
+ variant = "outline",
14
+ renderSelectedItems,
15
+ hasDefault
11
16
  }) => {
12
17
  const {
13
18
  triggerProps,
14
19
  itemProps,
15
20
  setVisible
16
- } = useDropdownContext(), inputProps = {
21
+ } = useDropdownContext(), containerProps = {
17
22
  ...triggerProps,
23
+ className: clsx("d-flex combobox-trigger", renderInputGroup ? "input-group flex-nowrap align-items-start" : "flex-wrap align-items-center", triggerProps.className),
24
+ onClick: (event) => {
25
+ event.stopPropagation();
26
+ }
27
+ }, inputProps = {
18
28
  role: "combobox",
19
- onClick: () => {
20
- value.length >= searchMinLength && setVisible(!0);
29
+ onChange: (event) => {
30
+ handleSearchInputChange(event), setVisible(event.target.value.length >= searchMinLength);
21
31
  },
22
- onChange: handleSearchInputChange
23
- };
32
+ onClick: (event) => {
33
+ const input = event.target;
34
+ setVisible(input.value.length >= searchMinLength || !!hasDefault), input.focus();
35
+ }
36
+ }, classNameVariant = variant === "ghost" ? " border-0" : "", classNameInput = clsx(classNameVariant, renderSelectedItems ? "flex-fill w-auto " : "");
24
37
  return useEffect(() => {
25
38
  setVisible(value.length >= searchMinLength);
26
- }, [setVisible, value, searchMinLength]), /* @__PURE__ */ jsx(FormControl, { className: "d-flex align-items-center", id: "search", children: /* @__PURE__ */ jsx(Input, { ...inputProps, className: "max-w-512", noValidationIcon: !0, placeholder, size: "md", type: "search", onKeyDown: itemProps.onMenuItemKeyDown }) });
39
+ }, [value, searchMinLength]), /* @__PURE__ */ jsxs(FormControl, { id: "search", ...containerProps, children: [
40
+ !!renderInputGroup && /* @__PURE__ */ jsx("label", { className: "input-group-text pe-0" + classNameVariant, htmlFor: triggerProps.id, children: renderInputGroup }),
41
+ /* @__PURE__ */ jsxs("div", { className: "d-flex align-items-center flex-wrap flex-fill", children: [
42
+ renderSelectedItems,
43
+ /* @__PURE__ */ jsx(Input, { ...inputProps, className: classNameInput, noValidationIcon: !0, placeholder, size: "md", type: "search", onKeyDown: itemProps.onMenuItemKeyDown })
44
+ ] })
45
+ ] });
27
46
  };
28
47
  export {
29
48
  ComboboxTrigger as default
@@ -14,10 +14,6 @@ export interface DropdownProps {
14
14
  * Default placement with FloatingUI
15
15
  */
16
16
  placement?: Placement;
17
- /**
18
- * If true, the text will not wrap
19
- */
20
- noWrap?: boolean;
21
17
  /**
22
18
  * Extra keydown handler for the Dropdown Trigger.
23
19
  * Useful for a11y keyboard navigation between a Dropdown element and other elements,
@@ -32,6 +28,14 @@ export interface DropdownProps {
32
28
  * Whether the trigger is hovered or not.
33
29
  */
34
30
  isTriggerHovered?: boolean;
31
+ /**
32
+ * Whether to focus the first element when the dropdown is opened.
33
+ */
34
+ focusOnVisible?: boolean;
35
+ /**
36
+ * Whether to open the dropdown on space key press.
37
+ */
38
+ openOnSpace?: boolean;
35
39
  }
36
40
  export type DropdownMenuOptions = {
37
41
  /**
@@ -57,13 +61,13 @@ export type DropdownMenuOptions = {
57
61
  type: 'divider';
58
62
  };
59
63
  declare const Dropdown: {
60
- ({ children, block, overflow, noWrap, placement, extraTriggerKeyDownHandler, onToggle, isTriggerHovered, }: DropdownProps): import("react/jsx-runtime").JSX.Element;
64
+ ({ children, block, overflow, placement, extraTriggerKeyDownHandler, onToggle, isTriggerHovered, focusOnVisible, openOnSpace, }: DropdownProps): import("react/jsx-runtime").JSX.Element;
61
65
  displayName: string;
62
66
  } & {
63
67
  Trigger: import('react').ForwardRefExoticComponent<Omit<import('./DropdownTrigger').DropdownTriggerProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
64
68
  Menu: import('react').ForwardRefExoticComponent<Omit<import('./DropdownMenu').DropdownMenuProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
65
69
  Item: {
66
- ({ type, icon, onClick, children, className, minWidth, ...restProps }: import('./DropdownItem').DropdownItemProps): import("react/jsx-runtime").JSX.Element;
70
+ ({ type, icon, onClick, children, className, disabled, ...restProps }: import('./DropdownItem').DropdownItemProps): import("react/jsx-runtime").JSX.Element;
67
71
  displayName: string;
68
72
  };
69
73
  Separator: {
@@ -1,6 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useMemo, useEffect } from "react";
3
3
  import clsx from "clsx";
4
+ import useDropdown from "../../hooks/useDropdown/useDropdown.js";
4
5
  import DropdownCheckboxItem from "./DropdownCheckboxItem.js";
5
6
  import { DropdownContext } from "./DropdownContext.js";
6
7
  import DropdownItem from "./DropdownItem.js";
@@ -9,17 +10,17 @@ import DropdownMenuGroup from "./DropdownMenuGroup.js";
9
10
  import DropdownRadioItem from "./DropdownRadioItem.js";
10
11
  import DropdownSeparator from "./DropdownSeparator.js";
11
12
  import DropdownTrigger from "./DropdownTrigger.js";
12
- import useDropdown from "../../hooks/useDropdown/useDropdown.js";
13
13
  import useClickOutside from "../../hooks/useClickOutside/useClickOutside.js";
14
14
  const Root = ({
15
15
  children,
16
16
  block,
17
17
  overflow = !0,
18
- noWrap,
19
18
  placement = "bottom-start",
20
19
  extraTriggerKeyDownHandler,
21
20
  onToggle,
22
- isTriggerHovered = !1
21
+ isTriggerHovered = !1,
22
+ focusOnVisible = !0,
23
+ openOnSpace = !0
23
24
  }) => {
24
25
  const {
25
26
  visible,
@@ -29,7 +30,7 @@ const Root = ({
29
30
  itemProps,
30
31
  itemRefs,
31
32
  setVisible
32
- } = useDropdown(placement, extraTriggerKeyDownHandler, isTriggerHovered), ref = useClickOutside(() => {
33
+ } = useDropdown(placement, extraTriggerKeyDownHandler, isTriggerHovered, focusOnVisible, openOnSpace), ref = useClickOutside(() => {
33
34
  setVisible(!1);
34
35
  }), value = useMemo(() => ({
35
36
  visible,
@@ -42,7 +43,6 @@ const Root = ({
42
43
  setVisible
43
44
  }), [visible, isFocused, triggerProps, menuProps, itemProps, itemRefs, block, setVisible]), dropdown = clsx("dropdown", {
44
45
  "w-100": block,
45
- "dropdown-nowrap": noWrap,
46
46
  overflow
47
47
  });
48
48
  return useEffect(() => {
@@ -22,12 +22,12 @@ export interface DropdownItemProps {
22
22
  */
23
23
  className?: string;
24
24
  /**
25
- * Set minimum width in pixels
25
+ * Disabled status
26
26
  */
27
- minWidth?: number;
27
+ disabled?: boolean;
28
28
  }
29
29
  declare const DropdownItem: {
30
- ({ type, icon, onClick, children, className, minWidth, ...restProps }: DropdownItemProps): import("react/jsx-runtime").JSX.Element;
30
+ ({ type, icon, onClick, children, className, disabled, ...restProps }: DropdownItemProps): import("react/jsx-runtime").JSX.Element;
31
31
  displayName: string;
32
32
  };
33
33
  export default DropdownItem;
@@ -8,7 +8,7 @@ const DropdownItem = ({
8
8
  onClick,
9
9
  children,
10
10
  className,
11
- minWidth,
11
+ disabled,
12
12
  ...restProps
13
13
  }) => {
14
14
  const {
@@ -20,15 +20,13 @@ const DropdownItem = ({
20
20
  onMenuItemMouseEnter,
21
21
  onMenuItemClick
22
22
  } = itemProps, handleOnClick = (event) => {
23
- onClick == null || onClick(event), type === "action" && (onMenuItemClick(), event.stopPropagation());
23
+ disabled || (onClick == null || onClick(event), type === "action" && (onMenuItemClick(), event.stopPropagation()));
24
24
  }, id = useId(), dropdownItem = clsx("dropdown-item", {
25
25
  focus: isFocused === id
26
- }, className), style = {
27
- ...minWidth && {
28
- minWidth: `${minWidth}px`
29
- }
30
- };
31
- return /* @__PURE__ */ jsx("div", { id, role: "menuitem", style, ref: (el) => itemRefs.current[id] = el, tabIndex: isFocused === id ? 0 : -1, className: dropdownItem, "aria-current": isFocused === id, onClick: handleOnClick, onMouseEnter: onMenuItemMouseEnter, onKeyDown: (event) => onMenuItemKeyDown(event, onClick), ...restProps, children: /* @__PURE__ */ jsxs("div", { className: "d-flex gap-8 align-items-center", children: [
26
+ }, {
27
+ "text-gray-600": disabled
28
+ }, className);
29
+ return /* @__PURE__ */ jsx("div", { id, role: "menuitem", ref: (el) => itemRefs.current[id] = el, tabIndex: isFocused === id ? 0 : -1, className: dropdownItem, "aria-current": isFocused === id, onClick: handleOnClick, onMouseEnter: onMenuItemMouseEnter, onKeyDown: (event) => onMenuItemKeyDown(event, onClick), ...restProps, children: /* @__PURE__ */ jsxs("div", { className: "d-flex gap-8 align-items-center", children: [
32
30
  icon,
33
31
  children
34
32
  ] }) });
@@ -1,9 +1,8 @@
1
- import { Color } from 'src/types';
2
1
  export interface DropdownTriggerProps extends React.ComponentPropsWithRef<'button'> {
3
2
  /**
4
3
  * Dropdown trigger title
5
4
  */
6
- label?: React.ReactNode;
5
+ label?: string;
7
6
  /**
8
7
  * Add an icon in dropdown trigger
9
8
  */
@@ -15,7 +14,7 @@ export interface DropdownTriggerProps extends React.ComponentPropsWithRef<'butto
15
14
  /**
16
15
  * Set appearance
17
16
  */
18
- variant?: 'default' | 'ghost' | 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info';
17
+ variant?: 'ghost';
19
18
  /**
20
19
  * Button size
21
20
  */
@@ -32,34 +31,6 @@ export interface DropdownTriggerProps extends React.ComponentPropsWithRef<'butto
32
31
  * Hide the carret
33
32
  */
34
33
  hideCarret?: boolean;
35
- /**
36
- * Make the dropdown trigger a pill
37
- */
38
- pill?: boolean;
39
- /**
40
- * Inner border color
41
- */
42
- innerBorderColor?: Color;
43
- /**
44
- * Inner border width in pixels
45
- */
46
- innerBorderWidth?: number;
47
- /**
48
- * Outer border color
49
- */
50
- outerBorderColor?: Color;
51
- /**
52
- * Outer border width in pixels
53
- */
54
- outerBorderWidth?: number;
55
- /**
56
- * Outer border offset in pixels
57
- */
58
- outerBorderOffset?: number;
59
- /**
60
- * Use base shade color
61
- */
62
- baseShade?: boolean;
63
34
  }
64
35
  export type DropdownTriggerType = React.ReactElement<DropdownTriggerProps>;
65
36
  declare const DropdownTrigger: import('react').ForwardRefExoticComponent<Omit<DropdownTriggerProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
@@ -3,21 +3,15 @@ import { forwardRef } from "react";
3
3
  import clsx from "clsx";
4
4
  import SvgIconRafterUp from "../../modules/icons/components/IconRafterUp.js";
5
5
  import { useDropdownContext } from "./DropdownContext.js";
6
+ import Badge from "../Badge/Badge.js";
6
7
  const DropdownTrigger = /* @__PURE__ */ forwardRef(({
7
8
  label,
8
9
  icon,
9
- variant = "default",
10
+ variant,
10
11
  disabled = !1,
11
12
  size,
12
13
  badgeContent,
13
14
  hideCarret = !1,
14
- pill = !1,
15
- innerBorderColor,
16
- innerBorderWidth,
17
- outerBorderColor,
18
- outerBorderWidth,
19
- outerBorderOffset,
20
- baseShade,
21
15
  ...restProps
22
16
  }, forwardRef2) => {
23
17
  const {
@@ -25,28 +19,18 @@ const DropdownTrigger = /* @__PURE__ */ forwardRef(({
25
19
  block
26
20
  } = useDropdownContext(), className = clsx("dropdown-toggle ", size, variant, {
27
21
  "w-100": block
28
- }, triggerProps.className, restProps.className, {
29
- "rounded-pill": pill
30
- }, {
31
- "base-shade": baseShade
32
- }), style = {
33
- ...outerBorderColor && {
34
- outline: `${outerBorderWidth}px solid var(--edifice-${outerBorderColor})`,
35
- outlineOffset: outerBorderOffset
36
- },
37
- ...innerBorderColor && {
38
- border: `${innerBorderWidth}px solid var(--edifice-${innerBorderColor})`
39
- }
40
- }, mergedProps = {
22
+ }, triggerProps.className, restProps.className), mergedProps = {
41
23
  ...triggerProps,
42
24
  ...restProps,
43
- className,
44
- style
25
+ className
45
26
  };
46
27
  return /* @__PURE__ */ jsxs("button", { ref: forwardRef2, type: "button", disabled, ...mergedProps, children: [
47
28
  icon,
48
29
  label,
49
- badgeContent ? /* @__PURE__ */ jsx("span", { className: "badge text-bg-secondary rounded-pill", children: badgeContent }) : !hideCarret && /* @__PURE__ */ jsx(SvgIconRafterUp, { width: 16, height: 16, className: "dropdown-toggle-caret" })
30
+ badgeContent ? /* @__PURE__ */ jsx(Badge, { variant: {
31
+ level: "info",
32
+ type: "notification"
33
+ }, children: badgeContent }) : !hideCarret && /* @__PURE__ */ jsx(SvgIconRafterUp, { width: 16, height: 16, className: "dropdown-toggle-caret" })
50
34
  ] });
51
35
  });
52
36
  export {
@@ -5,6 +5,10 @@ export type ListProps<T> = {
5
5
  * Toolbar data items
6
6
  */
7
7
  items?: ToolbarItem[];
8
+ /**
9
+ * Checkable list
10
+ */
11
+ isCheckable?: boolean;
8
12
  /**
9
13
  * Generic data
10
14
  */
@@ -17,7 +21,11 @@ export type ListProps<T> = {
17
21
  * Callback to get selected ids
18
22
  */
19
23
  onSelectedItems?: (selectedIds: string[]) => void;
24
+ /**
25
+ * Custom class name
26
+ */
27
+ className?: string;
20
28
  };
21
29
  export declare const List: <T extends {
22
30
  _id: string;
23
- }>({ items, data, renderNode, onSelectedItems, }: ListProps<T>) => import("react/jsx-runtime").JSX.Element;
31
+ }>({ items, isCheckable, data, renderNode, onSelectedItems, className, }: ListProps<T>) => import("react/jsx-runtime").JSX.Element;
@@ -7,9 +7,11 @@ import Checkbox from "../Checkbox/Checkbox.js";
7
7
  import { Toolbar } from "../Toolbar/Toolbar.js";
8
8
  const List = ({
9
9
  items,
10
+ isCheckable = !1,
10
11
  data,
11
12
  renderNode,
12
- onSelectedItems
13
+ onSelectedItems,
14
+ className
13
15
  }) => {
14
16
  const {
15
17
  selectedItems,
@@ -21,11 +23,9 @@ const List = ({
21
23
  return useEffect(() => {
22
24
  selectedItems && (onSelectedItems == null || onSelectedItems(selectedItems));
23
25
  }, [onSelectedItems, selectedItems]), /* @__PURE__ */ jsxs(Fragment, { children: [
24
- items && /* @__PURE__ */ jsxs(Fragment, { children: [
25
- /* @__PURE__ */ jsx("div", { className: clsx("d-flex align-items-center gap-8", {
26
- "px-12": items
27
- }), children: /* @__PURE__ */ jsxs(Fragment, { children: [
28
- /* @__PURE__ */ jsxs("div", { className: "d-flex align-items-center gap-8", children: [
26
+ (items || isCheckable) && /* @__PURE__ */ jsxs(Fragment, { children: [
27
+ /* @__PURE__ */ jsx("div", { className: clsx("list-header d-flex align-items-center gap-8 px-12", className), children: /* @__PURE__ */ jsxs(Fragment, { children: [
28
+ /* @__PURE__ */ jsxs("div", { className: "d-flex align-items-center gap-8 py-12", children: [
29
29
  /* @__PURE__ */ jsx(Checkbox, { checked: allItemsSelected, indeterminate: isIndeterminate, onChange: () => handleOnSelectAllItems(allItemsSelected) }),
30
30
  /* @__PURE__ */ jsxs("span", { children: [
31
31
  "(",
@@ -33,15 +33,15 @@ const List = ({
33
33
  ")"
34
34
  ] })
35
35
  ] }),
36
- /* @__PURE__ */ jsx(Toolbar, { items, isBlock: !0, align: "left", variant: "no-shadow", className: clsx("gap-4 py-4", {
36
+ items && /* @__PURE__ */ jsx(Toolbar, { items, isBlock: !0, align: "left", variant: "no-shadow", className: clsx("gap-4 py-4", {
37
37
  "px-0 ms-auto": !isDesktopDevice
38
38
  }) })
39
39
  ] }) }),
40
40
  /* @__PURE__ */ jsx("div", { className: "border-top" })
41
41
  ] }),
42
42
  /* @__PURE__ */ jsx("div", { className: "mt-8", children: data == null ? void 0 : data.map((node) => {
43
- const checkbox = /* @__PURE__ */ jsx(Checkbox, { checked: selectedItems.includes(node._id), onChange: () => handleOnSelectItem(node._id) }), checked = selectedItems.includes(node._id);
44
- return /* @__PURE__ */ jsx(Fragment$1, { children: renderNode(node, checkbox, checked) }, node._id);
43
+ const checked = selectedItems.includes(node._id);
44
+ return /* @__PURE__ */ jsx(Fragment$1, { children: renderNode(node, /* @__PURE__ */ jsx(Checkbox, { checked, onChange: () => handleOnSelectItem(node._id), onClick: (event) => event.stopPropagation() }), checked) }, node._id);
45
45
  }) })
46
46
  ] });
47
47
  };
@@ -1,6 +1,6 @@
1
1
  import { ChangeEvent } from 'react';
2
2
  import { Size } from '../../types';
3
- export interface BaseProps {
3
+ export interface BaseProps extends Omit<React.ComponentPropsWithoutRef<'input'>, 'size'> {
4
4
  /**
5
5
  * String or Template literal with React i18next namespace
6
6
  */