@edifice.io/react 2.2.9 → 2.2.10-develop-integration.20250619152658
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Button/IconButton.js +1 -1
- package/dist/components/Combobox/Combobox.d.ts +26 -7
- package/dist/components/Combobox/Combobox.js +37 -16
- package/dist/components/Combobox/ComboboxTrigger.d.ts +35 -3
- package/dist/components/Combobox/ComboboxTrigger.js +35 -8
- package/dist/components/Dropdown/Dropdown.d.ts +14 -2
- package/dist/components/Dropdown/Dropdown.js +6 -3
- package/dist/components/Dropdown/DropdownItem.d.ts +5 -1
- package/dist/components/Dropdown/DropdownItem.js +4 -1
- package/dist/components/Dropdown/DropdownTrigger.js +5 -1
- package/dist/components/Input/Input.d.ts +4 -0
- package/dist/components/Input/Input.js +21 -5
- package/dist/components/Layout/components/Header.js +1 -1
- package/dist/components/List/List.d.ts +16 -1
- package/dist/components/List/List.js +30 -26
- package/dist/components/Modal/ModalHeader.js +2 -2
- package/dist/components/SearchBar/SearchBar.d.ts +1 -1
- package/dist/components/SearchBar/SearchBar.js +3 -1
- package/dist/components/Toolbar/Toolbar.d.ts +4 -0
- package/dist/components/Toolbar/Toolbar.js +8 -3
- package/dist/components/Tree/components/Tree.js +1 -2
- package/dist/components/Tree/hooks/useTree.d.ts +0 -1
- package/dist/components/Tree/hooks/useTree.js +2 -25
- package/dist/components/Tree/types/index.d.ts +0 -4
- package/dist/editor.js +28 -24
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useCheckable/useCheckable.js +10 -3
- package/dist/hooks/useConversation/useConversation.d.ts +1 -1
- package/dist/hooks/useConversation/useConversation.js +15 -17
- package/dist/hooks/useDate/useDate.d.ts +1 -0
- package/dist/hooks/useDate/useDate.js +33 -27
- package/dist/hooks/useDropdown/useDropdown.d.ts +2 -1
- package/dist/hooks/useDropdown/useDropdown.js +9 -5
- package/dist/hooks/useHttpErrorToast/useHttpErrorToast.js +12 -3
- package/dist/hooks/useWorkspaceFolders/index.d.ts +3 -0
- package/dist/hooks/useWorkspaceFolders/useWorkspaceFolders.js +54 -0
- package/dist/hooks/useWorkspaceFolders/useWorkspaceFoldersTree.d.ts +13 -0
- package/dist/hooks/useWorkspaceFolders/useWorkspaceFoldersTree.js +51 -0
- package/dist/hooks/useZendeskGuide/useZendeskGuide.js +2 -1
- package/dist/icons.js +236 -216
- package/dist/index.d.ts +1 -0
- package/dist/index.js +50 -20
- package/dist/modals.js +16 -14
- package/dist/modules/editor/components/Editor/Editor.d.ts +8 -1
- package/dist/modules/editor/components/Editor/Editor.js +7 -3
- package/dist/modules/editor/components/NodeView/ConversationHistoryNodeView.d.ts +2 -0
- package/dist/modules/editor/components/NodeView/ConversationHistoryNodeView.js +10 -0
- package/dist/modules/editor/components/NodeView/index.d.ts +2 -1
- package/dist/modules/editor/components/Renderer/ConversationHistoryRenderer.d.ts +8 -0
- package/dist/modules/editor/components/Renderer/ConversationHistoryRenderer.js +28 -0
- package/dist/modules/editor/components/Renderer/index.d.ts +2 -1
- package/dist/modules/editor/hooks/useTipTapEditor.d.ts +6 -2
- package/dist/modules/editor/hooks/useTipTapEditor.js +2 -2
- package/dist/modules/icons/components/IconFolderAdd.d.ts +7 -0
- package/dist/modules/icons/components/IconFolderAdd.js +13 -0
- package/dist/modules/icons/components/IconFolderDelete.d.ts +7 -0
- package/dist/modules/icons/components/IconFolderDelete.js +12 -0
- package/dist/modules/icons/components/IconGlobe2.d.ts +7 -0
- package/dist/modules/icons/components/IconGlobe2.js +16 -0
- package/dist/modules/icons/components/IconGroupAvatar.d.ts +7 -0
- package/dist/modules/icons/components/IconGroupAvatar.js +12 -0
- package/dist/modules/icons/components/IconMailRecall.d.ts +7 -0
- package/dist/modules/icons/components/IconMailRecall.js +13 -0
- package/dist/modules/icons/components/IconQuestionMark.d.ts +7 -0
- package/dist/modules/icons/components/IconQuestionMark.js +13 -0
- package/dist/modules/icons/components/IconReadMail.d.ts +7 -0
- package/dist/modules/icons/components/IconReadMail.js +16 -0
- package/dist/modules/icons/components/IconSignature.d.ts +7 -0
- package/dist/modules/icons/components/IconSignature.js +13 -0
- package/dist/modules/icons/components/IconUndoAll.d.ts +7 -0
- package/dist/modules/icons/components/IconUndoAll.js +14 -0
- package/dist/modules/icons/components/IconUnreadMail.d.ts +7 -0
- package/dist/modules/icons/components/IconUnreadMail.js +16 -0
- package/dist/modules/icons/components/index.d.ts +10 -0
- package/dist/modules/modals/ConfirmModal/ConfirmModal.d.ts +47 -0
- package/dist/modules/modals/ConfirmModal/ConfirmModal.js +37 -0
- package/dist/modules/modals/ConfirmModal/index.d.ts +1 -0
- package/dist/modules/modals/OnboardingModal/OnboardingModal.d.ts +9 -5
- package/dist/modules/modals/OnboardingModal/OnboardingModal.js +5 -4
- package/dist/modules/modals/index.d.ts +1 -0
- package/dist/modules/multimedia/WorkspaceFolders/WorkspaceFolders.d.ts +8 -0
- package/dist/modules/multimedia/WorkspaceFolders/WorkspaceFolders.js +55 -0
- package/dist/modules/multimedia/WorkspaceFolders/components/NewFolderForm.d.ts +16 -0
- package/dist/modules/multimedia/WorkspaceFolders/components/NewFolderForm.js +39 -0
- package/dist/modules/multimedia/WorkspaceFolders/index.d.ts +1 -0
- package/dist/modules/multimedia/index.d.ts +1 -0
- package/dist/multimedia.js +3 -1
- package/package.json +6 -6
|
@@ -19,7 +19,7 @@ const Button = /* @__PURE__ */ forwardRef(({
|
|
|
19
19
|
const classes = clsx("btn", {
|
|
20
20
|
[`btn-filled btn-${color}`]: variant === "filled",
|
|
21
21
|
[`btn-${variant}-${color}`]: variant === "outline" || variant === "ghost",
|
|
22
|
-
"btn-icon": !children,
|
|
22
|
+
"btn-icon btn-sm": !children,
|
|
23
23
|
"btn-loading": isLoading,
|
|
24
24
|
"btn-lg": size === "lg",
|
|
25
25
|
"btn-sm": size === "sm"
|
|
@@ -11,7 +11,7 @@ const IconButton = /* @__PURE__ */ forwardRef(({
|
|
|
11
11
|
...restProps,
|
|
12
12
|
className: clsx("btn-icon btn-sm", className)
|
|
13
13
|
};
|
|
14
|
-
return /* @__PURE__ */ jsx(Button, { ref, ...buttonProps,
|
|
14
|
+
return /* @__PURE__ */ jsx(Button, { ref, ...buttonProps, leftIcon: icon });
|
|
15
15
|
});
|
|
16
16
|
export {
|
|
17
17
|
IconButton as default
|
|
@@ -1,13 +1,26 @@
|
|
|
1
|
-
import { ChangeEvent } from 'react';
|
|
1
|
+
import { ChangeEvent, KeyboardEvent, 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
|
+
onFocus?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
9
|
+
onBlur?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
10
|
+
onSearchResultsChange?: (model: (string | number)[]) => void;
|
|
11
|
+
onSearchInputKeyUp?: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
9
12
|
searchMinLength?: number;
|
|
10
13
|
placeholder?: string;
|
|
14
|
+
variant?: 'outline' | 'ghost';
|
|
15
|
+
renderInputGroup?: ReactNode;
|
|
16
|
+
renderList?: (items: OptionListItemType[]) => ReactNode;
|
|
17
|
+
renderListItem?: (item: OptionListItemType) => ReactNode;
|
|
18
|
+
renderSelectedItems?: ReactNode;
|
|
19
|
+
renderNoResult?: ReactNode;
|
|
20
|
+
hasDefault?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface ComboboxRef {
|
|
23
|
+
focus: () => void;
|
|
11
24
|
}
|
|
12
25
|
export interface OptionListItemType {
|
|
13
26
|
/**
|
|
@@ -17,15 +30,21 @@ export interface OptionListItemType {
|
|
|
17
30
|
/**
|
|
18
31
|
* Label
|
|
19
32
|
*/
|
|
20
|
-
label
|
|
33
|
+
label?: string;
|
|
21
34
|
/**
|
|
22
35
|
* Add an icon
|
|
23
36
|
*/
|
|
24
37
|
icon?: any;
|
|
38
|
+
/**
|
|
39
|
+
* Display Separator or not
|
|
40
|
+
*/
|
|
41
|
+
withSeparator?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Disable option
|
|
44
|
+
*/
|
|
45
|
+
disabled?: boolean;
|
|
25
46
|
}
|
|
26
|
-
declare const Combobox: {
|
|
27
|
-
({
|
|
28
|
-
Trigger: ({ placeholder, value, searchMinLength, handleSearchInputChange, }: import('./ComboboxTrigger').ComboboxTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
-
displayName: string;
|
|
47
|
+
declare const Combobox: import('react').ForwardRefExoticComponent<ComboboxProps & import('react').RefAttributes<ComboboxRef>> & {
|
|
48
|
+
Trigger: ({ placeholder, value, searchMinLength, onFocus, onBlur, handleSearchInputChange, handleSearchInputKeyUp, renderInputGroup, variant, renderSelectedItems, hasDefault, inputRef, }: import('./ComboboxTrigger').ComboboxTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
49
|
};
|
|
31
50
|
export default Combobox;
|
|
@@ -1,40 +1,61 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useEffect, Fragment } from "react";
|
|
2
|
+
import { forwardRef, useRef, useState, useEffect, useImperativeHandle, Fragment } from "react";
|
|
3
3
|
import { useTranslation } from "react-i18next";
|
|
4
4
|
import ComboboxTrigger from "./ComboboxTrigger.js";
|
|
5
5
|
import Dropdown from "../Dropdown/Dropdown.js";
|
|
6
6
|
import Loading from "../Loading/Loading.js";
|
|
7
|
-
const
|
|
7
|
+
const ComboboxComponent = /* @__PURE__ */ forwardRef(({
|
|
8
|
+
onFocus,
|
|
9
|
+
onBlur,
|
|
8
10
|
onSearchResultsChange,
|
|
9
11
|
onSearchInputChange,
|
|
12
|
+
onSearchInputKeyUp,
|
|
10
13
|
options,
|
|
11
14
|
value,
|
|
12
15
|
isLoading,
|
|
13
16
|
noResult,
|
|
14
17
|
searchMinLength,
|
|
15
|
-
placeholder
|
|
16
|
-
|
|
18
|
+
placeholder,
|
|
19
|
+
variant = "outline",
|
|
20
|
+
renderInputGroup,
|
|
21
|
+
renderList,
|
|
22
|
+
renderListItem,
|
|
23
|
+
renderSelectedItems,
|
|
24
|
+
renderNoResult
|
|
25
|
+
}, ref) => {
|
|
17
26
|
const {
|
|
18
27
|
t
|
|
19
|
-
} = useTranslation(), [localValue, setLocalValue] = useState([]);
|
|
28
|
+
} = useTranslation(), inputRef = useRef(null), [localValue, setLocalValue] = useState([]);
|
|
20
29
|
useEffect(() => {
|
|
21
|
-
onSearchResultsChange(localValue);
|
|
30
|
+
onSearchResultsChange == null || onSearchResultsChange(localValue);
|
|
22
31
|
}, [localValue]);
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
32
|
+
const focusInput = () => {
|
|
33
|
+
var _a;
|
|
34
|
+
(_a = inputRef.current) == null || _a.focus();
|
|
35
|
+
}, handleOptionClick = (value2) => {
|
|
36
|
+
setLocalValue([value2]), focusInput();
|
|
37
|
+
};
|
|
38
|
+
useImperativeHandle(ref, () => ({
|
|
39
|
+
focus: focusInput
|
|
40
|
+
}));
|
|
41
|
+
const renderContent = () => isLoading ? /* @__PURE__ */ jsxs("div", { className: "d-flex align-items-center p-4", children: [
|
|
26
42
|
/* @__PURE__ */ jsx(Loading, { isLoading }),
|
|
27
43
|
/* @__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, {})
|
|
44
|
+
] }) : noResult ? renderNoResult || /* @__PURE__ */ jsx("div", { className: "p-4", children: t("portal.no.result") }) : renderList ? renderList(options) : options.map((option, index) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
45
|
+
/* @__PURE__ */ jsx(Dropdown.Item, { type: "select", icon: option.icon, onClick: () => handleOptionClick(option.value), disabled: option.disabled, children: renderListItem ? renderListItem(option) : option.label }),
|
|
46
|
+
(option.withSeparator || option.withSeparator === void 0) && index < options.length - 1 && /* @__PURE__ */ jsx(Dropdown.Separator, {})
|
|
31
47
|
] }, index));
|
|
32
|
-
return /* @__PURE__ */ jsxs(Dropdown, { block: !0,
|
|
33
|
-
|
|
48
|
+
return /* @__PURE__ */ jsxs(Dropdown, { block: !0, focusOnVisible: !1, openOnSpace: !1, focusOnMouseEnter: !1, onToggle: (open) => {
|
|
49
|
+
!open && inputRef.current && (inputRef.current.value = "");
|
|
50
|
+
}, children: [
|
|
51
|
+
/* @__PURE__ */ jsx(Combobox.Trigger, { placeholder, searchMinLength, handleSearchInputChange: onSearchInputChange, handleSearchInputKeyUp: (event) => {
|
|
52
|
+
onSearchInputKeyUp == null || onSearchInputKeyUp(event);
|
|
53
|
+
}, value, variant, renderInputGroup, renderSelectedItems, hasDefault: !!options.length, onFocus, onBlur, inputRef }),
|
|
34
54
|
/* @__PURE__ */ jsx(Dropdown.Menu, { children: renderContent() })
|
|
35
55
|
] });
|
|
36
|
-
}
|
|
37
|
-
|
|
56
|
+
}), Combobox = /* @__PURE__ */ Object.assign(ComboboxComponent, {
|
|
57
|
+
Trigger: ComboboxTrigger
|
|
58
|
+
});
|
|
38
59
|
export {
|
|
39
60
|
Combobox as default
|
|
40
61
|
};
|
|
@@ -1,9 +1,41 @@
|
|
|
1
|
-
import { ChangeEvent } from 'react';
|
|
2
|
-
export interface ComboboxTriggerProps extends React.ComponentPropsWithRef<'
|
|
1
|
+
import { ChangeEvent, KeyboardEvent, ReactNode } from 'react';
|
|
2
|
+
export interface ComboboxTriggerProps extends React.ComponentPropsWithRef<'input'> {
|
|
3
3
|
handleSearchInputChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
4
|
+
handleSearchInputKeyUp: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
4
5
|
value: string;
|
|
5
6
|
searchMinLength?: number;
|
|
6
7
|
placeholder?: string;
|
|
8
|
+
renderInputGroup?: React.ReactNode;
|
|
9
|
+
variant?: 'outline' | 'ghost';
|
|
10
|
+
renderSelectedItems?: ReactNode;
|
|
11
|
+
hasDefault: boolean;
|
|
12
|
+
onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
13
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
14
|
+
inputRef?: React.Ref<HTMLInputElement>;
|
|
7
15
|
}
|
|
8
|
-
|
|
16
|
+
/**
|
|
17
|
+
* A trigger component for the Combobox that handles user input and displays selected items.
|
|
18
|
+
*
|
|
19
|
+
* @component
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* <ComboboxTrigger
|
|
23
|
+
* value={searchValue}
|
|
24
|
+
* handleSearchInputChange={(e) => setSearchValue(e.target.value)}
|
|
25
|
+
* placeholder="Search..."
|
|
26
|
+
* />
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @param {object} props - Component props
|
|
30
|
+
* @param {string} [props.placeholder] - Placeholder text for the search input
|
|
31
|
+
* @param {string} [props.value=''] - Current value of the search input
|
|
32
|
+
* @param {number} [props.searchMinLength=3] - Minimum number of characters required before showing dropdown
|
|
33
|
+
* @param {(event: ChangeEvent<HTMLInputElement>) => void} props.handleSearchInputChange - Handler for input change events
|
|
34
|
+
* @param {ReactNode} [props.renderInputGroup] - Optional content to render in the input group (e.g., icons)
|
|
35
|
+
* @param {'outline' | 'ghost'} [props.variant='outline'] - Visual variant of the input
|
|
36
|
+
* @param {ReactNode} [props.renderSelectedItems] - Optional content to render selected items
|
|
37
|
+
*
|
|
38
|
+
* @returns {JSX.Element} A form control containing an input field with optional input group and selected items
|
|
39
|
+
*/
|
|
40
|
+
declare const ComboboxTrigger: ({ placeholder, value, searchMinLength, onFocus, onBlur, handleSearchInputChange, handleSearchInputKeyUp, renderInputGroup, variant, renderSelectedItems, hasDefault, inputRef, }: ComboboxTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
41
|
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,49 @@ const ComboboxTrigger = ({
|
|
|
7
8
|
placeholder,
|
|
8
9
|
value = "",
|
|
9
10
|
searchMinLength = 3,
|
|
10
|
-
|
|
11
|
+
onFocus,
|
|
12
|
+
onBlur,
|
|
13
|
+
handleSearchInputChange,
|
|
14
|
+
handleSearchInputKeyUp,
|
|
15
|
+
renderInputGroup,
|
|
16
|
+
variant = "outline",
|
|
17
|
+
renderSelectedItems,
|
|
18
|
+
hasDefault,
|
|
19
|
+
inputRef
|
|
11
20
|
}) => {
|
|
12
21
|
const {
|
|
13
22
|
triggerProps,
|
|
14
23
|
itemProps,
|
|
15
24
|
setVisible
|
|
16
|
-
} = useDropdownContext(),
|
|
25
|
+
} = useDropdownContext(), containerProps = {
|
|
17
26
|
...triggerProps,
|
|
27
|
+
className: clsx("d-flex combobox-trigger", renderInputGroup ? "input-group flex-nowrap align-items-start" : "flex-wrap align-items-center", triggerProps.className),
|
|
28
|
+
onClick: (event) => {
|
|
29
|
+
event.stopPropagation();
|
|
30
|
+
}
|
|
31
|
+
}, inputProps = {
|
|
18
32
|
role: "combobox",
|
|
19
|
-
|
|
20
|
-
value.length >= searchMinLength
|
|
33
|
+
onChange: (event) => {
|
|
34
|
+
handleSearchInputChange(event), setVisible(event.target.value.length >= searchMinLength);
|
|
21
35
|
},
|
|
22
|
-
|
|
23
|
-
|
|
36
|
+
onClick: (event) => {
|
|
37
|
+
const input = event.target;
|
|
38
|
+
setVisible(input.value.length >= searchMinLength || hasDefault), input.focus();
|
|
39
|
+
},
|
|
40
|
+
onKeyUp: (event) => {
|
|
41
|
+
handleSearchInputKeyUp == null || handleSearchInputKeyUp(event);
|
|
42
|
+
},
|
|
43
|
+
ref: inputRef
|
|
44
|
+
}, classNameVariant = variant === "ghost" ? " border-0" : "", classNameInput = clsx(classNameVariant, renderSelectedItems ? "flex-fill w-auto " : "");
|
|
24
45
|
return useEffect(() => {
|
|
25
46
|
setVisible(value.length >= searchMinLength);
|
|
26
|
-
}, [
|
|
47
|
+
}, [value, searchMinLength]), /* @__PURE__ */ jsxs(FormControl, { id: "search", ...containerProps, children: [
|
|
48
|
+
!!renderInputGroup && /* @__PURE__ */ jsx("label", { className: "input-group-text pe-0" + classNameVariant, htmlFor: triggerProps.id, children: renderInputGroup }),
|
|
49
|
+
/* @__PURE__ */ jsxs("div", { className: "d-flex align-items-center flex-wrap flex-fill", children: [
|
|
50
|
+
renderSelectedItems,
|
|
51
|
+
/* @__PURE__ */ jsx(Input, { ...inputProps, className: classNameInput, onFocus, onBlur, noValidationIcon: !0, placeholder, size: "md", type: "search", onKeyDown: itemProps.onMenuItemKeyDown })
|
|
52
|
+
] })
|
|
53
|
+
] });
|
|
27
54
|
};
|
|
28
55
|
export {
|
|
29
56
|
ComboboxTrigger as default
|
|
@@ -32,6 +32,18 @@ export interface DropdownProps {
|
|
|
32
32
|
* Whether the trigger is hovered or not.
|
|
33
33
|
*/
|
|
34
34
|
isTriggerHovered?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Whether to focus the first element when the dropdown is opened.
|
|
37
|
+
*/
|
|
38
|
+
focusOnVisible?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Whether to open the dropdown on space key press.
|
|
41
|
+
*/
|
|
42
|
+
openOnSpace?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Whether to focus the element on mouse enter.
|
|
45
|
+
*/
|
|
46
|
+
focusOnMouseEnter?: boolean;
|
|
35
47
|
}
|
|
36
48
|
export type DropdownMenuOptions = {
|
|
37
49
|
/**
|
|
@@ -57,13 +69,13 @@ export type DropdownMenuOptions = {
|
|
|
57
69
|
type: 'divider';
|
|
58
70
|
};
|
|
59
71
|
declare const Dropdown: {
|
|
60
|
-
({ children, block, overflow, noWrap, placement, extraTriggerKeyDownHandler, onToggle, isTriggerHovered, }: DropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
72
|
+
({ children, block, overflow, noWrap, placement, extraTriggerKeyDownHandler, onToggle, isTriggerHovered, focusOnVisible, openOnSpace, focusOnMouseEnter, }: DropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
61
73
|
displayName: string;
|
|
62
74
|
} & {
|
|
63
75
|
Trigger: import('react').ForwardRefExoticComponent<Omit<import('./DropdownTrigger').DropdownTriggerProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
|
|
64
76
|
Menu: import('react').ForwardRefExoticComponent<Omit<import('./DropdownMenu').DropdownMenuProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
65
77
|
Item: {
|
|
66
|
-
({ type, icon, onClick, children, className, minWidth, ...restProps }: import('./DropdownItem').DropdownItemProps): import("react/jsx-runtime").JSX.Element;
|
|
78
|
+
({ type, icon, onClick, children, className, minWidth, disabled, ...restProps }: import('./DropdownItem').DropdownItemProps): import("react/jsx-runtime").JSX.Element;
|
|
67
79
|
displayName: string;
|
|
68
80
|
};
|
|
69
81
|
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,7 +10,6 @@ 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,
|
|
@@ -19,7 +19,10 @@ const Root = ({
|
|
|
19
19
|
placement = "bottom-start",
|
|
20
20
|
extraTriggerKeyDownHandler,
|
|
21
21
|
onToggle,
|
|
22
|
-
isTriggerHovered = !1
|
|
22
|
+
isTriggerHovered = !1,
|
|
23
|
+
focusOnVisible = !0,
|
|
24
|
+
openOnSpace = !0,
|
|
25
|
+
focusOnMouseEnter = !0
|
|
23
26
|
}) => {
|
|
24
27
|
const {
|
|
25
28
|
visible,
|
|
@@ -29,7 +32,7 @@ const Root = ({
|
|
|
29
32
|
itemProps,
|
|
30
33
|
itemRefs,
|
|
31
34
|
setVisible
|
|
32
|
-
} = useDropdown(placement, extraTriggerKeyDownHandler, isTriggerHovered), ref = useClickOutside(() => {
|
|
35
|
+
} = useDropdown(placement, extraTriggerKeyDownHandler, isTriggerHovered, focusOnVisible, openOnSpace, focusOnMouseEnter), ref = useClickOutside(() => {
|
|
33
36
|
setVisible(!1);
|
|
34
37
|
}), value = useMemo(() => ({
|
|
35
38
|
visible,
|
|
@@ -25,9 +25,13 @@ export interface DropdownItemProps {
|
|
|
25
25
|
* Set minimum width in pixels
|
|
26
26
|
*/
|
|
27
27
|
minWidth?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Disabled status
|
|
30
|
+
*/
|
|
31
|
+
disabled?: boolean;
|
|
28
32
|
}
|
|
29
33
|
declare const DropdownItem: {
|
|
30
|
-
({ type, icon, onClick, children, className, minWidth, ...restProps }: DropdownItemProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
({ type, icon, onClick, children, className, minWidth, disabled, ...restProps }: DropdownItemProps): import("react/jsx-runtime").JSX.Element;
|
|
31
35
|
displayName: string;
|
|
32
36
|
};
|
|
33
37
|
export default DropdownItem;
|
|
@@ -9,6 +9,7 @@ const DropdownItem = ({
|
|
|
9
9
|
children,
|
|
10
10
|
className,
|
|
11
11
|
minWidth,
|
|
12
|
+
disabled,
|
|
12
13
|
...restProps
|
|
13
14
|
}) => {
|
|
14
15
|
const {
|
|
@@ -20,9 +21,11 @@ const DropdownItem = ({
|
|
|
20
21
|
onMenuItemMouseEnter,
|
|
21
22
|
onMenuItemClick
|
|
22
23
|
} = itemProps, handleOnClick = (event) => {
|
|
23
|
-
onClick == null || onClick(event), type === "action" && (onMenuItemClick(), event.stopPropagation());
|
|
24
|
+
disabled || (onClick == null || onClick(event), type === "action" && (onMenuItemClick(), event.stopPropagation()));
|
|
24
25
|
}, id = useId(), dropdownItem = clsx("dropdown-item", {
|
|
25
26
|
focus: isFocused === id
|
|
27
|
+
}, {
|
|
28
|
+
"text-gray-600": disabled
|
|
26
29
|
}, className), style = {
|
|
27
30
|
...minWidth && {
|
|
28
31
|
minWidth: `${minWidth}px`
|
|
@@ -3,6 +3,7 @@ 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,
|
|
@@ -46,7 +47,10 @@ const DropdownTrigger = /* @__PURE__ */ forwardRef(({
|
|
|
46
47
|
return /* @__PURE__ */ jsxs("button", { ref: forwardRef2, type: "button", disabled, ...mergedProps, children: [
|
|
47
48
|
icon,
|
|
48
49
|
label,
|
|
49
|
-
badgeContent ? /* @__PURE__ */ jsx(
|
|
50
|
+
badgeContent ? /* @__PURE__ */ jsx(Badge, { variant: {
|
|
51
|
+
level: "info",
|
|
52
|
+
type: "notification"
|
|
53
|
+
}, children: badgeContent }) : !hideCarret && /* @__PURE__ */ jsx(SvgIconRafterUp, { width: 16, height: 16, className: "dropdown-toggle-caret" })
|
|
50
54
|
] });
|
|
51
55
|
});
|
|
52
56
|
export {
|
|
@@ -25,6 +25,10 @@ export interface InputProps extends Omit<React.ComponentPropsWithRef<'input'>, O
|
|
|
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
|
* Input Form Component
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx } 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
5
|
const Input = /* @__PURE__ */ forwardRef(({
|
|
@@ -8,23 +8,39 @@ const Input = /* @__PURE__ */ forwardRef(({
|
|
|
8
8
|
size = "md",
|
|
9
9
|
type = "text",
|
|
10
10
|
className,
|
|
11
|
+
showCounter,
|
|
11
12
|
...restProps
|
|
12
13
|
}, ref) => {
|
|
14
|
+
var _a;
|
|
13
15
|
const {
|
|
14
16
|
id,
|
|
15
17
|
isRequired,
|
|
16
18
|
isReadOnly,
|
|
17
19
|
status
|
|
18
|
-
} = useFormControl(), classes = clsx({
|
|
20
|
+
} = useFormControl(), [currentLength, setCurrentLength] = useState(((_a = restProps.value) == null ? void 0 : _a.toString().length) || 0), classes = clsx({
|
|
19
21
|
"form-control": !isReadOnly,
|
|
20
22
|
"form-control-lg": size === "lg",
|
|
21
23
|
"form-control-sm": size === "sm",
|
|
22
24
|
"is-invalid": status === "invalid",
|
|
23
25
|
"is-valid": status === "valid",
|
|
24
26
|
"form-control-plaintext": isReadOnly,
|
|
25
|
-
"no-validation-icon": noValidationIcon
|
|
27
|
+
"no-validation-icon": noValidationIcon,
|
|
28
|
+
"pe-64": showCounter && !status
|
|
26
29
|
}, className);
|
|
27
|
-
return /* @__PURE__ */
|
|
30
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
31
|
+
/* @__PURE__ */ jsx("input", { ref, id, className: classes, type, placeholder, required: isRequired, readOnly: isReadOnly, ...restProps, onChange: (e) => {
|
|
32
|
+
var _a2;
|
|
33
|
+
setCurrentLength(e.target.value.length), (_a2 = restProps.onChange) == null || _a2.call(restProps, e);
|
|
34
|
+
} }),
|
|
35
|
+
showCounter && !status && /* @__PURE__ */ jsxs("span", { className: clsx("caption text-end float-end mt-n32 py-2 px-12 ", {
|
|
36
|
+
"text-danger": currentLength === restProps.maxLength,
|
|
37
|
+
"text-gray-700": currentLength !== restProps.maxLength
|
|
38
|
+
}), children: [
|
|
39
|
+
currentLength,
|
|
40
|
+
" / ",
|
|
41
|
+
restProps.maxLength
|
|
42
|
+
] })
|
|
43
|
+
] });
|
|
28
44
|
});
|
|
29
45
|
export {
|
|
30
46
|
Input as default
|
|
@@ -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,18 @@ 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;
|
|
28
|
+
/**
|
|
29
|
+
* Toolbar options
|
|
30
|
+
*/
|
|
31
|
+
toolbarOptions?: {
|
|
32
|
+
shouldHideLabelsOnMobile?: boolean;
|
|
33
|
+
sticky?: boolean;
|
|
34
|
+
};
|
|
20
35
|
};
|
|
21
36
|
export declare const List: <T extends {
|
|
22
37
|
_id: string;
|
|
23
|
-
}>({ items, data, renderNode, onSelectedItems, }: ListProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
}>({ items, isCheckable, data, renderNode, onSelectedItems, className, toolbarOptions, }: ListProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useMediaQuery } from "@uidotdev/usehooks";
|
|
3
2
|
import clsx from "clsx";
|
|
4
3
|
import { useEffect, Fragment as Fragment$1 } from "react";
|
|
5
4
|
import { useCheckable } from "../../hooks/useCheckable/useCheckable.js";
|
|
5
|
+
import useBreakpoint from "../../hooks/useBreakpoint/useBreakpoint.js";
|
|
6
6
|
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,
|
|
15
|
+
toolbarOptions
|
|
13
16
|
}) => {
|
|
14
17
|
const {
|
|
15
18
|
selectedItems,
|
|
@@ -17,31 +20,32 @@ const List = ({
|
|
|
17
20
|
isIndeterminate,
|
|
18
21
|
handleOnSelectAllItems,
|
|
19
22
|
handleOnSelectItem
|
|
20
|
-
} = useCheckable(data),
|
|
21
|
-
|
|
23
|
+
} = useCheckable(data), {
|
|
24
|
+
lg
|
|
25
|
+
} = useBreakpoint();
|
|
26
|
+
useEffect(() => {
|
|
22
27
|
selectedItems && (onSelectedItems == null || onSelectedItems(selectedItems));
|
|
23
|
-
}, [onSelectedItems, selectedItems])
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
] })
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return /* @__PURE__ */ jsx(Fragment$1, { children: renderNode(node, checkbox, checked) }, node._id);
|
|
28
|
+
}, [onSelectedItems, selectedItems]);
|
|
29
|
+
const toolbarClassName = clsx("list-header d-flex align-items-center gap-8 px-12 bg-white border-bottom", className, {
|
|
30
|
+
"sticky-top": toolbarOptions == null ? void 0 : toolbarOptions.sticky
|
|
31
|
+
});
|
|
32
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
33
|
+
(items || isCheckable) && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", { className: toolbarClassName, children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
34
|
+
/* @__PURE__ */ jsxs("div", { className: "d-flex align-items-center gap-8 py-12", children: [
|
|
35
|
+
/* @__PURE__ */ jsx(Checkbox, { checked: allItemsSelected, indeterminate: isIndeterminate, onChange: () => handleOnSelectAllItems(allItemsSelected) }),
|
|
36
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
37
|
+
"(",
|
|
38
|
+
selectedItems.length,
|
|
39
|
+
")"
|
|
40
|
+
] })
|
|
41
|
+
] }),
|
|
42
|
+
items && /* @__PURE__ */ jsx(Toolbar, { items, shouldHideLabelsOnMobile: toolbarOptions == null ? void 0 : toolbarOptions.shouldHideLabelsOnMobile, isBlock: !0, align: "left", variant: "no-shadow", className: clsx("gap-4 py-4", {
|
|
43
|
+
"px-0 ms-auto": !lg
|
|
44
|
+
}) })
|
|
45
|
+
] }) }) }),
|
|
46
|
+
/* @__PURE__ */ jsx("div", { children: data == null ? void 0 : data.map((node) => {
|
|
47
|
+
const checked = selectedItems.includes(node._id);
|
|
48
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: renderNode(node, /* @__PURE__ */ jsx(Checkbox, { checked, onChange: () => handleOnSelectItem(node._id), onClick: (event) => event.stopPropagation() }), checked) }, node._id);
|
|
45
49
|
}) })
|
|
46
50
|
] });
|
|
47
51
|
};
|
|
@@ -17,8 +17,8 @@ const ModalHeader = (props) => {
|
|
|
17
17
|
return useEffect(() => {
|
|
18
18
|
var _a;
|
|
19
19
|
focusId || (_a = closeButtonRef.current) == null || _a.focus();
|
|
20
|
-
}, [focusId]), /* @__PURE__ */ jsxs("div", { className: "modal-header", children: [
|
|
21
|
-
/* @__PURE__ */ jsx("h2", { id: ariaLabelId, className: "modal-title", tabIndex: -1, children }),
|
|
20
|
+
}, [focusId]), /* @__PURE__ */ jsxs("div", { className: "modal-header align-self-center", children: [
|
|
21
|
+
/* @__PURE__ */ jsx("h2", { id: ariaLabelId, className: "modal-title text-center", tabIndex: -1, children }),
|
|
22
22
|
/* @__PURE__ */ jsx(IconButton, { ref: closeButtonRef, "aria-label": t("close"), color: "tertiary", icon: /* @__PURE__ */ jsx(SvgIconClose, {}), type: "button", variant: "ghost", title: t("close"), onClick: onModalClose, className: "btn-close" })
|
|
23
23
|
] });
|
|
24
24
|
};
|
|
@@ -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
|
*/
|
|
@@ -24,10 +24,12 @@ const SearchBar = ({
|
|
|
24
24
|
"ps-48": isVariant
|
|
25
25
|
}), handleClick = () => {
|
|
26
26
|
onClick == null || onClick();
|
|
27
|
+
}, handleKeyDown = (e) => {
|
|
28
|
+
e.key === "Enter" && (e.preventDefault(), handleClick());
|
|
27
29
|
};
|
|
28
30
|
return /* @__PURE__ */ jsxs(FormControl, { id: "search-bar", className: searchbar, children: [
|
|
29
31
|
isVariant && /* @__PURE__ */ jsx("div", { className: "position-absolute z-1 top-50 start-0 translate-middle-y border-0 ps-12 bg-transparent", children: /* @__PURE__ */ jsx(SvgIconSearch, {}) }),
|
|
30
|
-
/* @__PURE__ */ jsx(FormControl.Input, { type: "search", placeholder: t(placeholder), size, noValidationIcon: !0, className: input, onChange, disabled, ...restProps }),
|
|
32
|
+
/* @__PURE__ */ jsx(FormControl.Input, { type: "search", placeholder: t(placeholder), size, noValidationIcon: !0, className: input, onChange, disabled, onKeyDown: handleKeyDown, ...restProps }),
|
|
31
33
|
!isVariant && /* @__PURE__ */ jsx(SearchButton, { type: "submit", "aria-label": t("search"), icon: /* @__PURE__ */ jsx(SvgIconSearch, {}), className: "border-start-0", onClick: handleClick })
|
|
32
34
|
] });
|
|
33
35
|
};
|
|
@@ -71,6 +71,10 @@ export interface ToolbarProps extends React.ComponentPropsWithRef<'div'> {
|
|
|
71
71
|
* Accept optional children
|
|
72
72
|
*/
|
|
73
73
|
children?: ReactNode;
|
|
74
|
+
/**
|
|
75
|
+
* Hide labels on mobile
|
|
76
|
+
*/
|
|
77
|
+
shouldHideLabelsOnMobile?: boolean;
|
|
74
78
|
}
|
|
75
79
|
export declare const Toolbar: import('react').ForwardRefExoticComponent<Omit<ToolbarProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
76
80
|
export default Toolbar;
|