@edifice.io/react 2.2.11-develop-pedago.20250703141131 → 2.2.11-develop-pedago.20250703144408

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.
@@ -1,6 +1,13 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { Placement } from '@floating-ui/react';
3
3
  import { default as DropdownCheckboxItem } from './DropdownCheckboxItem';
4
+ export interface DropdownApi {
5
+ visible: boolean;
6
+ isFocused: string | null;
7
+ menuRef: React.MutableRefObject<HTMLUListElement | null>;
8
+ triggerRef: React.MutableRefObject<HTMLButtonElement | null>;
9
+ setVisible: (visible: boolean) => void;
10
+ }
4
11
  export interface DropdownProps {
5
12
  /** Children Props */
6
13
  children: ReactNode | ((...props: any) => ReactNode);
@@ -68,10 +75,7 @@ export type DropdownMenuOptions = {
68
75
  */
69
76
  type: 'divider';
70
77
  };
71
- declare const Dropdown: {
72
- ({ children, block, overflow, noWrap, placement, extraTriggerKeyDownHandler, onToggle, isTriggerHovered, focusOnVisible, openOnSpace, focusOnMouseEnter, }: DropdownProps): import("react/jsx-runtime").JSX.Element;
73
- displayName: string;
74
- } & {
78
+ declare const Dropdown: import('react').ForwardRefExoticComponent<DropdownProps & import('react').RefAttributes<DropdownApi>> & {
75
79
  Trigger: import('react').ForwardRefExoticComponent<Omit<import('./DropdownTrigger').DropdownTriggerProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
76
80
  Menu: import('react').ForwardRefExoticComponent<Omit<import('./DropdownMenu').DropdownMenuProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
77
81
  Item: {
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { useMemo, useEffect } from "react";
2
+ import { forwardRef, useImperativeHandle, useMemo, useEffect } from "react";
3
3
  import clsx from "clsx";
4
4
  import useDropdown from "../../hooks/useDropdown/useDropdown.js";
5
5
  import DropdownCheckboxItem from "./DropdownCheckboxItem.js";
@@ -11,7 +11,7 @@ import DropdownRadioItem from "./DropdownRadioItem.js";
11
11
  import DropdownSeparator from "./DropdownSeparator.js";
12
12
  import DropdownTrigger from "./DropdownTrigger.js";
13
13
  import useClickOutside from "../../hooks/useClickOutside/useClickOutside.js";
14
- const Root = ({
14
+ const Root = /* @__PURE__ */ forwardRef(({
15
15
  children,
16
16
  block,
17
17
  overflow = !0,
@@ -23,7 +23,7 @@ const Root = ({
23
23
  focusOnVisible = !0,
24
24
  openOnSpace = !0,
25
25
  focusOnMouseEnter = !0
26
- }) => {
26
+ }, refDropdown) => {
27
27
  const {
28
28
  visible,
29
29
  isFocused,
@@ -31,8 +31,18 @@ const Root = ({
31
31
  menuProps,
32
32
  itemProps,
33
33
  itemRefs,
34
- setVisible
35
- } = useDropdown(placement, extraTriggerKeyDownHandler, isTriggerHovered, focusOnVisible, openOnSpace, focusOnMouseEnter), ref = useClickOutside(() => {
34
+ setVisible,
35
+ menuRef,
36
+ triggerRef
37
+ } = useDropdown(placement, extraTriggerKeyDownHandler, isTriggerHovered, focusOnVisible, openOnSpace, focusOnMouseEnter);
38
+ useImperativeHandle(refDropdown, () => ({
39
+ visible,
40
+ setVisible,
41
+ isFocused,
42
+ menuRef,
43
+ triggerRef
44
+ }));
45
+ const ref = useClickOutside(() => {
36
46
  setVisible(!1);
37
47
  }), value = useMemo(() => ({
38
48
  visible,
@@ -51,7 +61,7 @@ const Root = ({
51
61
  return useEffect(() => {
52
62
  onToggle == null || onToggle(visible);
53
63
  }, [visible]), /* @__PURE__ */ jsx(DropdownContext.Provider, { value, children: /* @__PURE__ */ jsx("div", { ref, className: dropdown, children: typeof children == "function" ? children(triggerProps, itemRefs, setVisible) : children }) });
54
- }, Dropdown = /* @__PURE__ */ Object.assign(Root, {
64
+ }), Dropdown = /* @__PURE__ */ Object.assign(Root, {
55
65
  Trigger: DropdownTrigger,
56
66
  Menu: DropdownMenu,
57
67
  Item: DropdownItem,
@@ -9,9 +9,10 @@ const TabsList = (props) => {
9
9
  tabUnderlineWidth
10
10
  } = useTabsContext(), {
11
11
  className,
12
+ fullWidth,
12
13
  ...restProps
13
14
  } = props, ulClasses = clsx("nav nav-tabs flex-nowrap", {
14
- "w-100": props.fullWidth
15
+ "w-100": fullWidth
15
16
  }), tabslist = clsx("position-relative flex-shrink-0 overflow-x-auto", className);
16
17
  return /* @__PURE__ */ jsxs("div", { className: tabslist, ...restProps, children: [
17
18
  /* @__PURE__ */ jsx("ul", { className: ulClasses, role: "tablist", children: items.map((item, order) => /* @__PURE__ */ jsx(Tabs.Item, { order, ...item }, item.id)) }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/react",
3
- "version": "2.2.11-develop-pedago.20250703141131",
3
+ "version": "2.2.11-develop-pedago.20250703144408",
4
4
  "description": "Edifice React Library",
5
5
  "keywords": [
6
6
  "react",
@@ -130,9 +130,9 @@
130
130
  "react-slugify": "^3.0.3",
131
131
  "swiper": "^10.1.0",
132
132
  "ua-parser-js": "^1.0.36",
133
- "@edifice.io/bootstrap": "2.2.11-develop-pedago.20250703141131",
134
- "@edifice.io/tiptap-extensions": "2.2.11-develop-pedago.20250703141131",
135
- "@edifice.io/utilities": "2.2.11-develop-pedago.20250703141131"
133
+ "@edifice.io/bootstrap": "2.2.11-develop-pedago.20250703144408",
134
+ "@edifice.io/tiptap-extensions": "2.2.11-develop-pedago.20250703144408",
135
+ "@edifice.io/utilities": "2.2.11-develop-pedago.20250703144408"
136
136
  },
137
137
  "devDependencies": {
138
138
  "@babel/plugin-transform-react-pure-annotations": "^7.23.3",
@@ -163,8 +163,8 @@
163
163
  "vite": "^5.4.11",
164
164
  "vite-plugin-dts": "^4.1.0",
165
165
  "vite-tsconfig-paths": "^5.0.1",
166
- "@edifice.io/client": "2.2.11-develop-pedago.20250703141131",
167
- "@edifice.io/config": "2.2.11-develop-pedago.20250703141131"
166
+ "@edifice.io/client": "2.2.11-develop-pedago.20250703144408",
167
+ "@edifice.io/config": "2.2.11-develop-pedago.20250703144408"
168
168
  },
169
169
  "peerDependencies": {
170
170
  "@react-spring/web": "^9.7.5",