@bioturing/components 0.39.0 → 0.40.1
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/base.d.ts +35 -1
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +47 -1
- package/dist/base.js.map +1 -1
- package/dist/components/base-menu/component.d.ts +1 -1
- package/dist/components/base-menu/index.d.ts +1 -1
- package/dist/components/base-menu/index.d.ts.map +1 -1
- package/dist/components/base-menu/index.js +3 -3
- package/dist/components/base-menu/item.d.ts +1 -1
- package/dist/components/base-menu/item.d.ts.map +1 -1
- package/dist/components/base-menu/item.js +1 -1
- package/dist/components/base-menu/item.js.map +1 -1
- package/dist/components/button/component.d.ts +1 -1
- package/dist/components/button/component.d.ts.map +1 -1
- package/dist/components/button/component.js +18 -17
- package/dist/components/button/component.js.map +1 -1
- package/dist/components/checkbox/component.d.ts.map +1 -1
- package/dist/components/choice-list/component.d.ts +8 -4
- package/dist/components/choice-list/component.d.ts.map +1 -1
- package/dist/components/choice-list/component.js +89 -94
- package/dist/components/choice-list/component.js.map +1 -1
- package/dist/components/color-select/component.js +6 -6
- package/dist/components/combobox/component.js +1 -1
- package/dist/components/combobox/component.js.map +1 -1
- package/dist/components/command-palette/component.d.ts +6 -0
- package/dist/components/command-palette/component.d.ts.map +1 -1
- package/dist/components/command-palette/component.js +182 -63
- package/dist/components/command-palette/component.js.map +1 -1
- package/dist/components/command-palette/index.d.ts +3 -1
- package/dist/components/command-palette/index.d.ts.map +1 -1
- package/dist/components/command-palette/style.css +1 -1
- package/dist/components/drag-drop/draggable.js +1 -1
- package/dist/components/drag-drop/draggable.js.map +1 -1
- package/dist/components/drag-drop/droppable.js +1 -1
- package/dist/components/drag-drop/droppable.js.map +1 -1
- package/dist/components/drag-drop/types.d.ts +1 -1
- package/dist/components/drag-drop/types.d.ts.map +1 -1
- package/dist/components/drag-drop/value.js +13 -13
- package/dist/components/dropdown-menu/component.d.ts +5 -3
- package/dist/components/dropdown-menu/component.d.ts.map +1 -1
- package/dist/components/dropdown-menu/component.js +185 -159
- package/dist/components/dropdown-menu/component.js.map +1 -1
- package/dist/components/dropdown-menu/divider.js +6 -6
- package/dist/components/dropdown-menu/divider.js.map +1 -1
- package/dist/components/dropdown-menu/item.d.ts.map +1 -1
- package/dist/components/dropdown-menu/item.js +28 -27
- package/dist/components/dropdown-menu/item.js.map +1 -1
- package/dist/components/dropdown-menu/style.css +1 -1
- package/dist/components/dropdown-menu/types.d.ts +2 -2
- package/dist/components/dropdown-menu/types.d.ts.map +1 -1
- package/dist/components/dropdown-menu/useDropdownMenu.d.ts.map +1 -1
- package/dist/components/dropdown-menu/useDropdownMenu.js +72 -68
- package/dist/components/dropdown-menu/useDropdownMenu.js.map +1 -1
- package/dist/components/hooks/antd.d.ts.map +1 -1
- package/dist/components/hooks/index.d.ts +1 -0
- package/dist/components/hooks/index.d.ts.map +1 -1
- package/dist/components/hooks/useBaseUIPlacement.d.ts +64 -0
- package/dist/components/hooks/useBaseUIPlacement.d.ts.map +1 -0
- package/dist/components/hooks/useBaseUIPlacement.js +61 -0
- package/dist/components/hooks/useBaseUIPlacement.js.map +1 -0
- package/dist/components/hooks/useControlledState.d.ts +1 -0
- package/dist/components/hooks/useControlledState.d.ts.map +1 -1
- package/dist/components/hooks/useControlledState.js +16 -16
- package/dist/components/hooks/useControlledState.js.map +1 -1
- package/dist/components/hooks/useTransitionStatus.js +2 -2
- package/dist/components/hooks/useTransitionStatus.js.map +1 -1
- package/dist/components/icon-button/style.css +1 -1
- package/dist/components/nav/index.d.ts.map +1 -1
- package/dist/components/nav/item.d.ts +1 -1
- package/dist/components/nav/item.d.ts.map +1 -1
- package/dist/components/nav/item.js +1 -1
- package/dist/components/nav/item.js.map +1 -1
- package/dist/components/popup-panel/component.d.ts +4 -4
- package/dist/components/popup-panel/component.d.ts.map +1 -1
- package/dist/components/popup-panel/component.js +142 -152
- package/dist/components/popup-panel/component.js.map +1 -1
- package/dist/components/resizable/component.js +1 -1
- package/dist/components/resizable/component.js.map +1 -1
- package/dist/components/scroll-area/component.d.ts +1 -1
- package/dist/components/scroll-area/component.d.ts.map +1 -1
- package/dist/components/scroll-area/component.js +1 -1
- package/dist/components/scroll-area/component.js.map +1 -1
- package/dist/components/select/component.d.ts.map +1 -1
- package/dist/components/select/component.js +153 -138
- package/dist/components/select/component.js.map +1 -1
- package/dist/components/select/item.js +13 -13
- package/dist/components/select-trigger/component.js +19 -19
- package/dist/components/splitter/splitter.d.ts.map +1 -1
- package/dist/components/splitter/splitter.js +53 -51
- package/dist/components/splitter/splitter.js.map +1 -1
- package/dist/components/stack/StackChild.js +2 -2
- package/dist/components/stack/StackChild.js.map +1 -1
- package/dist/components/toast/component.d.ts +1 -1
- package/dist/components/toast/component.d.ts.map +1 -1
- package/dist/components/toast/component.js +1 -1
- package/dist/components/toast/component.js.map +1 -1
- package/dist/components/toast/function.d.ts +2 -2
- package/dist/components/toast/function.d.ts.map +1 -1
- package/dist/components/toast/function.js +1 -1
- package/dist/components/toast/function.js.map +1 -1
- package/dist/components/transition/component.d.ts +1 -1
- package/dist/components/transition/component.d.ts.map +1 -1
- package/dist/components/transition/component.js +2 -2
- package/dist/components/transition/component.js.map +1 -1
- package/dist/components/tree/useTreeCommon.d.ts.map +1 -1
- package/dist/components/utils/WithRenderProp.d.ts +1 -1
- package/dist/components/utils/WithRenderProp.d.ts.map +1 -1
- package/dist/components/utils/WithRenderProp.js +1 -1
- package/dist/components/utils/WithRenderProp.js.map +1 -1
- package/dist/components/utils/index.d.ts +1 -0
- package/dist/components/utils/index.d.ts.map +1 -1
- package/dist/components/utils/renderProp.d.ts +24 -0
- package/dist/components/utils/renderProp.d.ts.map +1 -0
- package/dist/components/utils/renderProp.js +19 -0
- package/dist/components/utils/renderProp.js.map +1 -0
- package/dist/components/vertical-collapsible-panel/component.js +1 -1
- package/dist/components/vertical-collapsible-panel/component.js.map +1 -1
- package/dist/index.js +162 -158
- package/dist/index.js.map +1 -1
- package/dist/metadata.d.ts.map +1 -1
- package/dist/metadata.js +14 -14
- package/dist/metadata.js.map +1 -1
- package/dist/stats.html +1 -1
- package/dist/tailwind.css +125 -1
- package/package.json +4 -4
- package/dist/components/cmdk/command-score.d.ts +0 -2
- package/dist/components/cmdk/command-score.d.ts.map +0 -1
- package/dist/components/cmdk/command-score.js +0 -48
- package/dist/components/cmdk/command-score.js.map +0 -1
- package/dist/components/cmdk/index.d.ts +0 -440
- package/dist/components/cmdk/index.d.ts.map +0 -1
- package/dist/components/cmdk/index.js +0 -595
- package/dist/components/cmdk/index.js.map +0 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { BaseUIAlign, BaseUISide } from '../utils';
|
|
2
|
+
export interface UseBaseUIPlacementOptions {
|
|
3
|
+
/**
|
|
4
|
+
* The positioner element to observe for placement changes
|
|
5
|
+
*/
|
|
6
|
+
positionerRef: HTMLElement | null;
|
|
7
|
+
/**
|
|
8
|
+
* Whether the popup is currently open
|
|
9
|
+
* Observation only occurs when open is true
|
|
10
|
+
*/
|
|
11
|
+
open: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Initial side placement
|
|
14
|
+
*/
|
|
15
|
+
initialSide: BaseUISide;
|
|
16
|
+
/**
|
|
17
|
+
* Initial align placement
|
|
18
|
+
*/
|
|
19
|
+
initialAlign: BaseUIAlign;
|
|
20
|
+
/**
|
|
21
|
+
* Callback fired when placement changes
|
|
22
|
+
*/
|
|
23
|
+
onPlacementChange?: (placement: string) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Enable debug logging
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
debug?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface UseBaseUIPlacementReturn {
|
|
31
|
+
/**
|
|
32
|
+
* Current side placement
|
|
33
|
+
*/
|
|
34
|
+
currentSide: BaseUISide;
|
|
35
|
+
/**
|
|
36
|
+
* Current align placement
|
|
37
|
+
*/
|
|
38
|
+
currentAlign: BaseUIAlign;
|
|
39
|
+
/**
|
|
40
|
+
* Key that increments when placement changes
|
|
41
|
+
* Useful for triggering re-renders or resets
|
|
42
|
+
*/
|
|
43
|
+
placementChangeKey: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Hook to track Base UI positioner placement changes
|
|
47
|
+
*
|
|
48
|
+
* Observes the positioner element's data-side and data-align attributes
|
|
49
|
+
* and triggers callbacks when they change. Useful for components that need
|
|
50
|
+
* to react to automatic placement adjustments by Base UI.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```tsx
|
|
54
|
+
* const { currentSide, currentAlign, placementChangeKey } = useBaseUIPlacement({
|
|
55
|
+
* positionerRef,
|
|
56
|
+
* open,
|
|
57
|
+
* initialSide: 'bottom',
|
|
58
|
+
* initialAlign: 'start',
|
|
59
|
+
* onPlacementChange: (placement) => console.log('New placement:', placement)
|
|
60
|
+
* });
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare function useBaseUIPlacement({ positionerRef, open, initialSide, initialAlign, onPlacementChange, debug, }: UseBaseUIPlacementOptions): UseBaseUIPlacementReturn;
|
|
64
|
+
//# sourceMappingURL=useBaseUIPlacement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBaseUIPlacement.d.ts","sourceRoot":"","sources":["../../../src/components/hooks/useBaseUIPlacement.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAsB,MAAM,UAAU,CAAC;AAEvE,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,aAAa,EAAE,WAAW,GAAG,IAAI,CAAC;IAClC;;;OAGG;IACH,IAAI,EAAE,OAAO,CAAC;IACd;;OAEG;IACH,WAAW,EAAE,UAAU,CAAC;IACxB;;OAEG;IACH,YAAY,EAAE,WAAW,CAAC;IAC1B;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,WAAW,EAAE,UAAU,CAAC;IACxB;;OAEG;IACH,YAAY,EAAE,WAAW,CAAC;IAC1B;;;OAGG;IACH,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,aAAa,EACb,IAAI,EACJ,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,KAAa,GACd,EAAE,yBAAyB,GAAG,wBAAwB,CAsFtD"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState as i, useEffect as y } from "react";
|
|
3
|
+
import { useStableCallback as N } from "@base-ui/utils/useStableCallback";
|
|
4
|
+
import { buildAntdPlacement as S } from "../utils/placement.js";
|
|
5
|
+
function E({
|
|
6
|
+
positionerRef: a,
|
|
7
|
+
open: b,
|
|
8
|
+
initialSide: d,
|
|
9
|
+
initialAlign: f,
|
|
10
|
+
onPlacementChange: m,
|
|
11
|
+
debug: o = !1
|
|
12
|
+
}) {
|
|
13
|
+
const [r, C] = i(d), [n, h] = i(f), [P, A] = i(0), s = N(m);
|
|
14
|
+
return y(() => {
|
|
15
|
+
if (!a || !b)
|
|
16
|
+
return;
|
|
17
|
+
const g = new MutationObserver((w) => {
|
|
18
|
+
let u = !1, l = r, c = n;
|
|
19
|
+
if (w.forEach((t) => {
|
|
20
|
+
if (t.type === "attributes" && t.attributeName === "data-side") {
|
|
21
|
+
const e = a.getAttribute(t.attributeName);
|
|
22
|
+
e && e !== r && (l = e, u = !0);
|
|
23
|
+
}
|
|
24
|
+
if (t.type === "attributes" && t.attributeName === "data-align") {
|
|
25
|
+
const e = a.getAttribute(t.attributeName);
|
|
26
|
+
e && e !== n && (c = e, u = !0);
|
|
27
|
+
}
|
|
28
|
+
}), u) {
|
|
29
|
+
const t = S({
|
|
30
|
+
side: l,
|
|
31
|
+
align: c
|
|
32
|
+
});
|
|
33
|
+
C(l), h(c), A((e) => e + 1), s && s(t);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
return g.observe(a, {
|
|
37
|
+
attributes: !0,
|
|
38
|
+
attributeFilter: ["data-side", "data-align"],
|
|
39
|
+
attributeOldValue: !0
|
|
40
|
+
}), () => {
|
|
41
|
+
g.disconnect();
|
|
42
|
+
};
|
|
43
|
+
}, [
|
|
44
|
+
b,
|
|
45
|
+
a,
|
|
46
|
+
s,
|
|
47
|
+
r,
|
|
48
|
+
n,
|
|
49
|
+
o,
|
|
50
|
+
d,
|
|
51
|
+
f
|
|
52
|
+
]), {
|
|
53
|
+
currentSide: r,
|
|
54
|
+
currentAlign: n,
|
|
55
|
+
placementChangeKey: P
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
E as useBaseUIPlacement
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=useBaseUIPlacement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBaseUIPlacement.js","sources":["../../../src/components/hooks/useBaseUIPlacement.ts"],"sourcesContent":["\"use client\";\nimport { useEffect, useState } from \"react\";\nimport { useStableCallback } from \"@base-ui/utils/useStableCallback\";\nimport { BaseUIAlign, BaseUISide, buildAntdPlacement } from \"../utils\";\n\nexport interface UseBaseUIPlacementOptions {\n /**\n * The positioner element to observe for placement changes\n */\n positionerRef: HTMLElement | null;\n /**\n * Whether the popup is currently open\n * Observation only occurs when open is true\n */\n open: boolean;\n /**\n * Initial side placement\n */\n initialSide: BaseUISide;\n /**\n * Initial align placement\n */\n initialAlign: BaseUIAlign;\n /**\n * Callback fired when placement changes\n */\n onPlacementChange?: (placement: string) => void;\n /**\n * Enable debug logging\n * @default false\n */\n debug?: boolean;\n}\n\nexport interface UseBaseUIPlacementReturn {\n /**\n * Current side placement\n */\n currentSide: BaseUISide;\n /**\n * Current align placement\n */\n currentAlign: BaseUIAlign;\n /**\n * Key that increments when placement changes\n * Useful for triggering re-renders or resets\n */\n placementChangeKey: number;\n}\n\n/**\n * Hook to track Base UI positioner placement changes\n *\n * Observes the positioner element's data-side and data-align attributes\n * and triggers callbacks when they change. Useful for components that need\n * to react to automatic placement adjustments by Base UI.\n *\n * @example\n * ```tsx\n * const { currentSide, currentAlign, placementChangeKey } = useBaseUIPlacement({\n * positionerRef,\n * open,\n * initialSide: 'bottom',\n * initialAlign: 'start',\n * onPlacementChange: (placement) => console.log('New placement:', placement)\n * });\n * ```\n */\nexport function useBaseUIPlacement({\n positionerRef,\n open,\n initialSide,\n initialAlign,\n onPlacementChange,\n debug = false,\n}: UseBaseUIPlacementOptions): UseBaseUIPlacementReturn {\n const [currentSide, setCurrentSide] = useState<BaseUISide>(initialSide);\n const [currentAlign, setCurrentAlign] = useState<BaseUIAlign>(initialAlign);\n const [placementChangeKey, setPlacementChangeKey] = useState(0);\n\n const stableOnPlacementChange = useStableCallback(onPlacementChange);\n\n useEffect(() => {\n if (!positionerRef || !open) {\n return;\n }\n\n // Create MutationObserver to watch for data-side and data-align changes\n const observer = new MutationObserver((mutations) => {\n let hasPlacementChanged = false;\n let newSide = currentSide;\n let newAlign = currentAlign;\n\n mutations.forEach((mutation) => {\n if (\n mutation.type === \"attributes\" &&\n mutation.attributeName === \"data-side\"\n ) {\n const side = positionerRef.getAttribute(mutation.attributeName);\n if (side && side !== currentSide) {\n newSide = side as BaseUISide;\n hasPlacementChanged = true;\n }\n }\n\n if (\n mutation.type === \"attributes\" &&\n mutation.attributeName === \"data-align\"\n ) {\n const align = positionerRef.getAttribute(mutation.attributeName);\n if (align && align !== currentAlign) {\n newAlign = align as BaseUIAlign;\n hasPlacementChanged = true;\n }\n }\n });\n\n // Only trigger callbacks if placement actually changed\n if (hasPlacementChanged) {\n const newPlacement = buildAntdPlacement({\n side: newSide,\n align: newAlign,\n });\n\n // Update state to trigger re-render\n setCurrentSide(newSide);\n setCurrentAlign(newAlign);\n setPlacementChangeKey((prev) => prev + 1);\n\n if (stableOnPlacementChange) {\n stableOnPlacementChange(newPlacement);\n }\n }\n });\n\n // Start observing\n observer.observe(positionerRef, {\n attributes: true,\n attributeFilter: [\"data-side\", \"data-align\"],\n attributeOldValue: true,\n });\n\n return () => {\n observer.disconnect();\n };\n }, [\n open,\n positionerRef,\n stableOnPlacementChange,\n currentSide,\n currentAlign,\n debug,\n initialSide,\n initialAlign,\n ]);\n\n return {\n currentSide,\n currentAlign,\n placementChangeKey,\n };\n}\n"],"names":["useBaseUIPlacement","positionerRef","open","initialSide","initialAlign","onPlacementChange","debug","currentSide","setCurrentSide","useState","currentAlign","setCurrentAlign","placementChangeKey","setPlacementChangeKey","stableOnPlacementChange","useStableCallback","useEffect","observer","mutations","hasPlacementChanged","newSide","newAlign","mutation","side","align","newPlacement","buildAntdPlacement","prev"],"mappings":";;;;AAoEO,SAASA,EAAmB;AAAA,EACjC,eAAAC;AAAA,EACA,MAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,OAAAC,IAAQ;AACV,GAAwD;AACtD,QAAM,CAACC,GAAaC,CAAc,IAAIC,EAAqBN,CAAW,GAChE,CAACO,GAAcC,CAAe,IAAIF,EAAsBL,CAAY,GACpE,CAACQ,GAAoBC,CAAqB,IAAIJ,EAAS,CAAC,GAExDK,IAA0BC,EAAkBV,CAAiB;AAEnE,SAAAW,EAAU,MAAM;AACd,QAAI,CAACf,KAAiB,CAACC;AACrB;AAIF,UAAMe,IAAW,IAAI,iBAAiB,CAACC,MAAc;AACnD,UAAIC,IAAsB,IACtBC,IAAUb,GACVc,IAAWX;AA2Bf,UAzBAQ,EAAU,QAAQ,CAACI,MAAa;AAC9B,YACEA,EAAS,SAAS,gBAClBA,EAAS,kBAAkB,aAC3B;AACA,gBAAMC,IAAOtB,EAAc,aAAaqB,EAAS,aAAa;AAC9D,UAAIC,KAAQA,MAAShB,MACnBa,IAAUG,GACVJ,IAAsB;AAAA,QAE1B;AAEA,YACEG,EAAS,SAAS,gBAClBA,EAAS,kBAAkB,cAC3B;AACA,gBAAME,IAAQvB,EAAc,aAAaqB,EAAS,aAAa;AAC/D,UAAIE,KAASA,MAAUd,MACrBW,IAAWG,GACXL,IAAsB;AAAA,QAE1B;AAAA,MACF,CAAC,GAGGA,GAAqB;AACvB,cAAMM,IAAeC,EAAmB;AAAA,UACtC,MAAMN;AAAA,UACN,OAAOC;AAAA,QAAA,CACR;AAGD,QAAAb,EAAeY,CAAO,GACtBT,EAAgBU,CAAQ,GACxBR,EAAsB,CAACc,MAASA,IAAO,CAAC,GAEpCb,KACFA,EAAwBW,CAAY;AAAA,MAExC;AAAA,IACF,CAAC;AAGD,WAAAR,EAAS,QAAQhB,GAAe;AAAA,MAC9B,YAAY;AAAA,MACZ,iBAAiB,CAAC,aAAa,YAAY;AAAA,MAC3C,mBAAmB;AAAA,IAAA,CACpB,GAEM,MAAM;AACX,MAAAgB,EAAS,WAAA;AAAA,IACX;AAAA,EACF,GAAG;AAAA,IACDf;AAAA,IACAD;AAAA,IACAa;AAAA,IACAP;AAAA,IACAG;AAAA,IACAJ;AAAA,IACAH;AAAA,IACAC;AAAA,EAAA,CACD,GAEM;AAAA,IACL,aAAAG;AAAA,IACA,cAAAG;AAAA,IACA,oBAAAE;AAAA,EAAA;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useControlledState.d.ts","sourceRoot":"","sources":["../../../src/components/hooks/useControlledState.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useControlledState.d.ts","sourceRoot":"","sources":["../../../src/components/hooks/useControlledState.ts"],"names":[],"mappings":"AAQA;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,EAAE,GAAG,EAAE,EAC5D,KAAK,CAAC,EAAE,CAAC,EACT,QAAQ,CAAC,EACL,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,EAAE,KAAK,IAAI,CAAC,GACrC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAC3C,YAAY,CAAC,EAAE,CAAC,GACf;IACD,CAAC,GAAG,SAAS;IACb,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,SAAS,KAAK,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,EAAE,KAAK,IAAI;CACnE,CA+CA"}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useState as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
));
|
|
2
|
+
import { useState as S, useRef as l, useCallback as m } from "react";
|
|
3
|
+
import { useStableCallback as p } from "@base-ui/utils/useStableCallback";
|
|
4
|
+
function O(s, a, i) {
|
|
5
|
+
const [f, C] = S(
|
|
6
|
+
i
|
|
7
|
+
), t = s !== void 0, e = t ? s : f, n = l(e);
|
|
8
|
+
n.current = e;
|
|
9
|
+
const u = l(t);
|
|
10
|
+
u.current = t;
|
|
11
|
+
const r = p(a), b = m(
|
|
12
|
+
(o, ...d) => {
|
|
13
|
+
const c = typeof o == "function" ? o(n.current) : o;
|
|
14
|
+
Object.is(c, n.current) || (u.current || C(c), r && r(c, ...d));
|
|
15
15
|
},
|
|
16
|
-
[
|
|
16
|
+
[r]
|
|
17
17
|
);
|
|
18
|
-
return [
|
|
18
|
+
return [e, b];
|
|
19
19
|
}
|
|
20
20
|
export {
|
|
21
|
-
|
|
21
|
+
O as useControlledState
|
|
22
22
|
};
|
|
23
23
|
//# sourceMappingURL=useControlledState.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useControlledState.js","sources":["../../../src/components/hooks/useControlledState.ts"],"sourcesContent":["\"use client\";\nimport { useCallback, useState } from \"react\";\n\n// Ref:\n// https://github.com/adobe/react-spectrum/blob/main/packages/%40react-stately/utils/src/useControlledState.ts\n// https://github.com/chakra-ui/chakra-ui/tree/main/packages/hooks/use-controllable-state\n\n/**\n * A hook that manages state that can be either controlled or uncontrolled.\n *\n * @param value - The controlled value\n * @param onChange - Callback when the value changes\n * @param defaultValue - Default value for uncontrolled state\n * @returns [currentValue, setValue] - Current value and setter function\n */\nexport function useControlledState<T, K extends unknown[] = []>(\n value?: T,\n onChange?:\n | ((value: T, ...args: K | []) => void)\n | React.Dispatch<React.SetStateAction<T>>,\n defaultValue?: T\n): [\n T | undefined,\n (value: T | ((prev: T | undefined) => T), ...args: K | []) => void\n] {\n const [internalState, setInternalState] = useState<T | undefined>(\n defaultValue\n );\n\n const isControlled = value !== undefined;\n const currentValue = isControlled ? value : internalState;\n\n // This is
|
|
1
|
+
{"version":3,"file":"useControlledState.js","sources":["../../../src/components/hooks/useControlledState.ts"],"sourcesContent":["\"use client\";\nimport { useCallback, useRef, useState } from \"react\";\nimport { useStableCallback } from \"@base-ui/utils/useStableCallback\";\n\n// Ref:\n// https://github.com/adobe/react-spectrum/blob/main/packages/%40react-stately/utils/src/useControlledState.ts\n// https://github.com/chakra-ui/chakra-ui/tree/main/packages/hooks/use-controllable-state\n\n/**\n * A hook that manages state that can be either controlled or uncontrolled.\n * Uses Base UI utilities for optimal performance and stability.\n *\n * @param value - The controlled value\n * @param onChange - Callback when the value changes\n * @param defaultValue - Default value for uncontrolled state\n * @returns [currentValue, setValue] - Current value and setter function\n */\nexport function useControlledState<T, K extends unknown[] = []>(\n value?: T,\n onChange?:\n | ((value: T, ...args: K | []) => void)\n | React.Dispatch<React.SetStateAction<T>>,\n defaultValue?: T\n): [\n T | undefined,\n (value: T | ((prev: T | undefined) => T), ...args: K | []) => void\n] {\n const [internalState, setInternalState] = useState<T | undefined>(\n defaultValue\n );\n\n const isControlled = value !== undefined;\n const currentValue = isControlled ? value : internalState;\n\n // Use regular refs and update them during render\n // This is safe for refs and allows synchronous updates to prevent timing issues\n const currentValueRef = useRef(currentValue);\n currentValueRef.current = currentValue;\n\n const isControlledRef = useRef(isControlled);\n isControlledRef.current = isControlled;\n\n // Stabilize onChange to prevent re-renders\n const stableOnChange = useStableCallback(onChange);\n\n // FULLY STABLE setValue - uses refs to access current state without re-creation\n const setValue = useCallback(\n (nextValue: T | ((prev: T | undefined) => T), ...args: K | []) => {\n // Resolve the value using ref (avoids stale closure)\n const resolvedValue =\n typeof nextValue === \"function\"\n ? (nextValue as (prev: T | undefined) => T)(currentValueRef.current)\n : nextValue;\n\n // Only update if value actually changed (prevent unnecessary updates)\n if (Object.is(resolvedValue, currentValueRef.current)) {\n return; // No change, skip update\n }\n\n // Only update internal state if we're not controlled\n if (!isControlledRef.current) {\n setInternalState(resolvedValue);\n }\n\n // Call onChange with the resolved value\n if (stableOnChange) {\n stableOnChange(resolvedValue, ...args);\n }\n },\n [stableOnChange]\n );\n\n return [currentValue, setValue];\n}\n"],"names":["useControlledState","value","onChange","defaultValue","internalState","setInternalState","useState","isControlled","currentValue","currentValueRef","useRef","isControlledRef","stableOnChange","useStableCallback","setValue","useCallback","nextValue","args","resolvedValue"],"mappings":";;;AAiBO,SAASA,EACdC,GACAC,GAGAC,GAIA;AACA,QAAM,CAACC,GAAeC,CAAgB,IAAIC;AAAA,IACxCH;AAAA,EAAA,GAGII,IAAeN,MAAU,QACzBO,IAAeD,IAAeN,IAAQG,GAItCK,IAAkBC,EAAOF,CAAY;AAC3C,EAAAC,EAAgB,UAAUD;AAE1B,QAAMG,IAAkBD,EAAOH,CAAY;AAC3C,EAAAI,EAAgB,UAAUJ;AAG1B,QAAMK,IAAiBC,EAAkBX,CAAQ,GAG3CY,IAAWC;AAAA,IACf,CAACC,MAAgDC,MAAiB;AAEhE,YAAMC,IACJ,OAAOF,KAAc,aAChBA,EAAyCP,EAAgB,OAAO,IACjEO;AAGN,MAAI,OAAO,GAAGE,GAAeT,EAAgB,OAAO,MAK/CE,EAAgB,WACnBN,EAAiBa,CAAa,GAI5BN,KACFA,EAAeM,GAAe,GAAGD,CAAI;AAAA,IAEzC;AAAA,IACA,CAACL,CAAc;AAAA,EAAA;AAGjB,SAAO,CAACJ,GAAcM,CAAQ;AAChC;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as c from "react";
|
|
3
3
|
import * as m from "react-dom";
|
|
4
|
-
import { useIsoLayoutEffect as e } from "@base-ui
|
|
5
|
-
import { AnimationFrame as u } from "@base-ui
|
|
4
|
+
import { useIsoLayoutEffect as e } from "@base-ui/utils/useIsoLayoutEffect";
|
|
5
|
+
import { AnimationFrame as u } from "@base-ui/utils/useAnimationFrame";
|
|
6
6
|
function g(t, n = !1, f = !1) {
|
|
7
7
|
const [r, s] = c.useState(
|
|
8
8
|
t && n ? "idle" : void 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTransitionStatus.js","sources":["../../../src/components/hooks/useTransitionStatus.ts"],"sourcesContent":["\"use client\";\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { useIsoLayoutEffect } from \"@base-ui
|
|
1
|
+
{"version":3,"file":"useTransitionStatus.js","sources":["../../../src/components/hooks/useTransitionStatus.ts"],"sourcesContent":["\"use client\";\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { useIsoLayoutEffect } from \"@base-ui/utils/useIsoLayoutEffect\";\nimport { AnimationFrame } from \"@base-ui/utils/useAnimationFrame\";\n\nexport type TransitionStatus = \"starting\" | \"ending\" | \"idle\" | undefined;\n\n/**\n * Provides a status string for CSS animations.\n * @param open - a boolean that determines if the element is open.\n * @param enableIdleState - a boolean that enables the `'idle'` state between `'starting'` and `'ending'`\n */\nexport function useTransitionStatus(\n open: boolean,\n enableIdleState: boolean = false,\n deferEndingState: boolean = false\n) {\n const [transitionStatus, setTransitionStatus] =\n React.useState<TransitionStatus>(\n open && enableIdleState ? \"idle\" : undefined\n );\n const [mounted, setMounted] = React.useState(open);\n\n if (open && !mounted) {\n setMounted(true);\n setTransitionStatus(\"starting\");\n }\n\n if (!open && mounted && transitionStatus !== \"ending\" && !deferEndingState) {\n setTransitionStatus(\"ending\");\n }\n\n if (!open && !mounted && transitionStatus === \"ending\") {\n setTransitionStatus(undefined);\n }\n\n useIsoLayoutEffect(() => {\n if (!open && mounted && transitionStatus !== \"ending\" && deferEndingState) {\n const frame = AnimationFrame.request(() => {\n setTransitionStatus(\"ending\");\n });\n\n return () => {\n AnimationFrame.cancel(frame);\n };\n }\n\n return undefined;\n }, [open, mounted, transitionStatus, deferEndingState]);\n\n useIsoLayoutEffect(() => {\n if (!open || enableIdleState) {\n return undefined;\n }\n\n const frame = AnimationFrame.request(() => {\n ReactDOM.flushSync(() => {\n setTransitionStatus(undefined);\n });\n });\n\n return () => {\n AnimationFrame.cancel(frame);\n };\n }, [enableIdleState, open]);\n\n useIsoLayoutEffect(() => {\n if (!open || !enableIdleState) {\n return undefined;\n }\n\n if (open && mounted && transitionStatus !== \"idle\") {\n setTransitionStatus(\"starting\");\n }\n\n const frame = AnimationFrame.request(() => {\n setTransitionStatus(\"idle\");\n });\n\n return () => {\n AnimationFrame.cancel(frame);\n };\n }, [enableIdleState, open, mounted, setTransitionStatus, transitionStatus]);\n\n return React.useMemo(\n () => ({\n mounted,\n setMounted,\n transitionStatus,\n }),\n [mounted, transitionStatus]\n );\n}\n"],"names":["useTransitionStatus","open","enableIdleState","deferEndingState","transitionStatus","setTransitionStatus","React","mounted","setMounted","useIsoLayoutEffect","frame","AnimationFrame","ReactDOM"],"mappings":";;;;;AAaO,SAASA,EACdC,GACAC,IAA2B,IAC3BC,IAA4B,IAC5B;AACA,QAAM,CAACC,GAAkBC,CAAmB,IAC1CC,EAAM;AAAA,IACJL,KAAQC,IAAkB,SAAS;AAAA,EAAA,GAEjC,CAACK,GAASC,CAAU,IAAIF,EAAM,SAASL,CAAI;AAEjD,SAAIA,KAAQ,CAACM,MACXC,EAAW,EAAI,GACfH,EAAoB,UAAU,IAG5B,CAACJ,KAAQM,KAAWH,MAAqB,YAAY,CAACD,KACxDE,EAAoB,QAAQ,GAG1B,CAACJ,KAAQ,CAACM,KAAWH,MAAqB,YAC5CC,EAAoB,MAAS,GAG/BI,EAAmB,MAAM;AACvB,QAAI,CAACR,KAAQM,KAAWH,MAAqB,YAAYD,GAAkB;AACzE,YAAMO,IAAQC,EAAe,QAAQ,MAAM;AACzC,QAAAN,EAAoB,QAAQ;AAAA,MAC9B,CAAC;AAED,aAAO,MAAM;AACX,QAAAM,EAAe,OAAOD,CAAK;AAAA,MAC7B;AAAA,IACF;AAAA,EAGF,GAAG,CAACT,GAAMM,GAASH,GAAkBD,CAAgB,CAAC,GAEtDM,EAAmB,MAAM;AACvB,QAAI,CAACR,KAAQC;AACX;AAGF,UAAMQ,IAAQC,EAAe,QAAQ,MAAM;AACzC,MAAAC,EAAS,UAAU,MAAM;AACvB,QAAAP,EAAoB,MAAS;AAAA,MAC/B,CAAC;AAAA,IACH,CAAC;AAED,WAAO,MAAM;AACX,MAAAM,EAAe,OAAOD,CAAK;AAAA,IAC7B;AAAA,EACF,GAAG,CAACR,GAAiBD,CAAI,CAAC,GAE1BQ,EAAmB,MAAM;AACvB,QAAI,CAACR,KAAQ,CAACC;AACZ;AAGF,IAAID,KAAQM,KAAWH,MAAqB,UAC1CC,EAAoB,UAAU;AAGhC,UAAMK,IAAQC,EAAe,QAAQ,MAAM;AACzC,MAAAN,EAAoB,MAAM;AAAA,IAC5B,CAAC;AAED,WAAO,MAAM;AACX,MAAAM,EAAe,OAAOD,CAAK;AAAA,IAC7B;AAAA,EACF,GAAG,CAACR,GAAiBD,GAAMM,GAASF,GAAqBD,CAAgB,CAAC,GAEnEE,EAAM;AAAA,IACX,OAAO;AAAA,MACL,SAAAC;AAAA,MACA,YAAAC;AAAA,MACA,kBAAAJ;AAAA,IAAA;AAAA,IAEF,CAACG,GAASH,CAAgB;AAAA,EAAA;AAE9B;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.ds-icon-button{display:inline-flex;align-items:center;justify-content:center;border:none;border-radius:999px;cursor:pointer;background-color:transparent;color:var(--ds-color-icon);transition:all .2s}.ds-icon-button:hover{background-color:var(--ds-color-fill-secondary);color:var(--ds-color-icon-hover)}.ds-icon-button:active,.ds-icon-button.ds-icon-button-active,.ds-icon-button.ds-popover-open{background-color:var(--ds-color-primary-bg);color:var(--ds-color-primary)}.ds-icon-button:focus{outline:none}.ds-icon-button:focus-visible{outline:var(--ds-line-width-focus) solid var(--ds-color-primary-border);outline-offset:1px;transition:outline-offset 0s,outline 0s}.ds-icon-button:disabled{cursor:not-allowed;pointer-events:none;color:var(--ds-color-text-disabled)}.ds-icon-button.ds-icon-button-medium{padding:.25rem;font-size:1.25rem;height:1.75rem;width:1.75rem}.ds-icon-button.ds-icon-button-medium.ds-icon-button-negative-margin{margin:-.25rem}.ds-icon-button.ds-icon-button-small{padding:.25rem;font-size:1rem;height:1.5rem;width:1.5rem}.ds-icon-button.ds-icon-button-small.ds-icon-button-negative-margin{margin:-.25rem}.ds-icon-button .ds-spin{font-size:.8em;line-height:1;display:flex;align-items:center;justify-content:center}}
|
|
1
|
+
@layer components{.ds-icon-button{display:inline-flex;align-items:center;justify-content:center;border:none;border-radius:999px;cursor:pointer;background-color:transparent;color:var(--ds-color-icon);transition:all .2s}.ds-icon-button:hover{background-color:var(--ds-color-fill-secondary);color:var(--ds-color-icon-hover)}.ds-icon-button:active,.ds-icon-button[data-pressed],.ds-icon-button.ds-icon-button-active,.ds-icon-button.ds-popover-open{background-color:var(--ds-color-primary-bg);color:var(--ds-color-primary)}.ds-icon-button:focus{outline:none}.ds-icon-button:focus-visible{outline:var(--ds-line-width-focus) solid var(--ds-color-primary-border);outline-offset:1px;transition:outline-offset 0s,outline 0s}.ds-icon-button:disabled{cursor:not-allowed;pointer-events:none;color:var(--ds-color-text-disabled)}.ds-icon-button.ds-icon-button-medium{padding:.25rem;font-size:1.25rem;height:1.75rem;width:1.75rem}.ds-icon-button.ds-icon-button-medium.ds-icon-button-negative-margin{margin:-.25rem}.ds-icon-button.ds-icon-button-small{padding:.25rem;font-size:1rem;height:1.5rem;width:1.5rem}.ds-icon-button.ds-icon-button-small.ds-icon-button-negative-margin{margin:-.25rem}.ds-icon-button .ds-spin{font-size:.8em;line-height:1;display:flex;align-items:center;justify-content:center}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/nav/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAW,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAc,eAAe,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAY,aAAa,EAAE,MAAM,SAAS,CAAC;AAElD,OAAO,aAAa,CAAC;AAErB,eAAO,MAAM,GAAG;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/nav/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAW,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAc,eAAe,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAY,aAAa,EAAE,MAAM,SAAS,CAAC;AAElD,OAAO,aAAa,CAAC;AAErB,eAAO,MAAM,GAAG;;WAOk2D,CAAC;;;;CAHl3D,CAAC;AAEF,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { useRender } from '@base-ui
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
3
|
export interface NavItemProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
4
|
/**
|
|
5
5
|
* The icon to display in the nav item
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../../src/components/nav/item.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8C,MAAM,OAAO,CAAC;AAEnE,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../../src/components/nav/item.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8C,MAAM,OAAO,CAAC;AAEnE,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,MAAM,WAAW,YACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IACrD;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC;QAC5B,MAAM,EAAE,OAAO,CAAC;QAChB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;KACxB,CAAC,CAAC;IACH;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC;;;OAGG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AAUD,QAAA,MAAM,WAAW,GAAI,CAAC,SAAS,WAAW,EACxC,kFAQG,YAAY,EACf,KAAK,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,SAgClB,CAAC;AAEF,QAAA,MAAM,OAAO,EAA8B,CAAC,CAAC,SAAS,WAAW,EAC/D,KAAK,EAAE,YAAY,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;CAAE,KACzC,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAEpC,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as f, Fragment as c, jsx as n } from "react/jsx-runtime";
|
|
3
3
|
import u, { forwardRef as N, useMemo as x, isValidElement as v } from "react";
|
|
4
|
-
import { useRender as h } from "@base-ui
|
|
4
|
+
import { useRender as h } from "@base-ui/react/use-render";
|
|
5
5
|
import { useCls as I } from "../utils/antdUtils.js";
|
|
6
6
|
import { clsx as R } from "../utils/cn.js";
|
|
7
7
|
const g = (e) => v(e), j = ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.js","sources":["../../../src/components/nav/item.tsx"],"sourcesContent":["\"use client\";\nimport React, { forwardRef, isValidElement, useMemo } from \"react\";\nimport { clsx, useCls } from \"../utils\";\nimport { useRender } from \"@base-ui
|
|
1
|
+
{"version":3,"file":"item.js","sources":["../../../src/components/nav/item.tsx"],"sourcesContent":["\"use client\";\nimport React, { forwardRef, isValidElement, useMemo } from \"react\";\nimport { clsx, useCls } from \"../utils\";\nimport { useRender } from \"@base-ui/react/use-render\";\n\nexport interface NavItemProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /**\n * The icon to display in the nav item\n */\n icon?: React.ReactNode;\n /**\n * Whether the nav item is active\n */\n active?: boolean;\n /**\n * The render prop to render the nav item\n */\n render?: useRender.RenderProp<{\n active: boolean;\n icon?: React.ReactNode;\n }>;\n /**\n * The size of the nav item\n * @default \"medium\"\n */\n size?: \"small\" | \"medium\" | \"large\";\n /**\n * Whether to change the icon weight on active state\n * @default true\n */\n changeIconWeightOnActive?: boolean;\n}\n\n// Define a type for elements that can have a weight prop\ntype ElementWithWeight = React.ReactElement<{ weight?: string }>;\n\n// Type guard to check if an element can accept a weight prop\nconst canHaveWeightProp = (el: React.ReactNode): el is ElementWithWeight => {\n return isValidElement(el);\n};\n\nconst NavItemImpl = <T extends HTMLElement>(\n {\n icon,\n active = false,\n render,\n className,\n children,\n changeIconWeightOnActive = true,\n ...rest\n }: NavItemProps,\n ref: React.Ref<T>\n) => {\n const cls = useCls();\n\n // Apply weight prop only if the element can accept it\n const renderedIcon = useMemo(() => {\n if (!changeIconWeightOnActive || !active || !canHaveWeightProp(icon)) {\n return icon;\n }\n return React.cloneElement(icon, { weight: \"fill\" });\n }, [icon, changeIconWeightOnActive, active]);\n\n const finalClassName = clsx(cls(\"nav-item\"), className);\n\n return useRender({\n render,\n ref,\n defaultTagName: \"button\",\n props: {\n \"data-active\": active || undefined,\n \"aria-expanded\": rest[\"aria-expanded\"],\n className: finalClassName,\n children: (\n <>\n <span className={cls(\"nav-item-icon\")}>{renderedIcon}</span>\n <span className={cls(\"nav-item-content\")}>{children}</span>\n </>\n ),\n ...rest,\n },\n state: { active, icon },\n });\n};\n\nconst NavItem = forwardRef(NavItemImpl) as <T extends HTMLElement>(\n props: NavItemProps & { ref?: React.Ref<T> }\n) => ReturnType<typeof NavItemImpl>;\n\nexport { NavItem };\n"],"names":["canHaveWeightProp","el","isValidElement","NavItemImpl","icon","active","render","className","children","changeIconWeightOnActive","rest","ref","cls","useCls","renderedIcon","useMemo","React","finalClassName","clsx","useRender","jsxs","Fragment","jsx","NavItem","forwardRef"],"mappings":";;;;;;AAsCA,MAAMA,IAAoB,CAACC,MAClBC,EAAeD,CAAE,GAGpBE,IAAc,CAClB;AAAA,EACE,MAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,QAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,0BAAAC,IAA2B;AAAA,EAC3B,GAAGC;AACL,GACAC,MACG;AACH,QAAMC,IAAMC,EAAA,GAGNC,IAAeC,EAAQ,MACvB,CAACN,KAA4B,CAACJ,KAAU,CAACL,EAAkBI,CAAI,IAC1DA,IAEFY,EAAM,aAAaZ,GAAM,EAAE,QAAQ,QAAQ,GACjD,CAACA,GAAMK,GAA0BJ,CAAM,CAAC,GAErCY,IAAiBC,EAAKN,EAAI,UAAU,GAAGL,CAAS;AAEtD,SAAOY,EAAU;AAAA,IACf,QAAAb;AAAA,IACA,KAAAK;AAAA,IACA,gBAAgB;AAAA,IAChB,OAAO;AAAA,MACL,eAAeN,KAAU;AAAA,MACzB,iBAAiBK,EAAK,eAAe;AAAA,MACrC,WAAWO;AAAA,MACX,UACE,gBAAAG,EAAAC,GAAA,EACE,UAAA;AAAA,QAAA,gBAAAC,EAAC,QAAA,EAAK,WAAWV,EAAI,eAAe,GAAI,UAAAE,GAAa;AAAA,0BACpD,QAAA,EAAK,WAAWF,EAAI,kBAAkB,GAAI,UAAAJ,EAAA,CAAS;AAAA,MAAA,GACtD;AAAA,MAEF,GAAGE;AAAA,IAAA;AAAA,IAEL,OAAO,EAAE,QAAAL,GAAQ,MAAAD,EAAA;AAAA,EAAK,CACvB;AACH,GAEMmB,IAAUC,EAAWrB,CAAW;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Popover } from '@base-ui
|
|
2
|
-
import { PopoverProps } from 'antd/es/popover';
|
|
1
|
+
import { Popover } from '@base-ui/react/popover';
|
|
3
2
|
import { PopupPanelSize } from './constants';
|
|
3
|
+
export type PopupPanelPlacement = "top" | "left" | "right" | "bottom" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom";
|
|
4
4
|
export interface PopupPanelProps extends Omit<React.ComponentPropsWithRef<"div">, "title" | "content" | "children">, Omit<Popover.Root.Props, "children"> {
|
|
5
5
|
/** The trigger element that opens the popup panel */
|
|
6
6
|
children?: React.ComponentProps<typeof Popover.Trigger>["render"];
|
|
7
7
|
/** Placement of the popup panel relative to its trigger */
|
|
8
|
-
placement?:
|
|
8
|
+
placement?: PopupPanelPlacement;
|
|
9
9
|
/** Whether to open the popup panel on hover */
|
|
10
10
|
openOnHover?: boolean;
|
|
11
11
|
/** Controls the open state of the popup panel */
|
|
@@ -94,7 +94,7 @@ export interface PopupPanelProps extends Omit<React.ComponentPropsWithRef<"div">
|
|
|
94
94
|
/**
|
|
95
95
|
* Callback function when the placement changes
|
|
96
96
|
*/
|
|
97
|
-
onPlacementChange?: (placement:
|
|
97
|
+
onPlacementChange?: (placement: PopupPanelPlacement) => void;
|
|
98
98
|
/**
|
|
99
99
|
* Props to pass to the positioner
|
|
100
100
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/components/popup-panel/component.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/components/popup-panel/component.tsx"],"names":[],"mappings":"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"}
|