@px-ui/core 1.22.0 → 1.24.0
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/block-checkbox-group.js +72 -0
- package/dist/components/block-radio-group.js +79 -0
- package/dist/components/input-group.js +37 -24
- package/dist/components/input.js +46 -0
- package/dist/components/radio-group.js +85 -0
- package/dist/components/switch.js +39 -0
- package/dist/components/tabs.js +108 -0
- package/dist/components/textarea.js +41 -0
- package/dist/components/tooltip.js +5 -5
- package/dist/hooks/use-async-options.js +17 -13
- package/dist/index.d.ts +21 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +48 -21
- package/dist/node_modules/.pnpm/@base-ui-components_react@1.0.0-beta.4_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/react/esm/checkbox-group/CheckboxGroup.js +82 -0
- package/dist/node_modules/.pnpm/@base-ui-components_react@1.0.0-beta.4_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/react/esm/checkbox-group/useCheckboxGroupParent.js +42 -0
- package/dist/node_modules/.pnpm/@base-ui-components_react@1.0.0-beta.4_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/react/esm/radio/indicator/RadioIndicator.js +37 -0
- package/dist/node_modules/.pnpm/@base-ui-components_react@1.0.0-beta.4_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/react/esm/radio/root/RadioRootContext.js +11 -4
- package/dist/node_modules/.pnpm/@base-ui-components_react@1.0.0-beta.4_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/react/esm/switch/root/SwitchRoot.js +144 -0
- package/dist/node_modules/.pnpm/@base-ui-components_react@1.0.0-beta.4_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/react/esm/switch/root/SwitchRootContext.js +13 -0
- package/dist/node_modules/.pnpm/@base-ui-components_react@1.0.0-beta.4_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/react/esm/switch/root/SwitchRootDataAttributes.js +6 -0
- package/dist/node_modules/.pnpm/@base-ui-components_react@1.0.0-beta.4_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/react/esm/switch/stateAttributesMapping.js +15 -0
- package/dist/node_modules/.pnpm/@base-ui-components_react@1.0.0-beta.4_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/react/esm/switch/thumb/SwitchThumb.js +27 -0
- package/dist/node_modules/.pnpm/@base-ui-components_react@1.0.0-beta.4_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/react/esm/tabs/indicator/TabsIndicator.js +107 -0
- package/dist/node_modules/.pnpm/@base-ui-components_react@1.0.0-beta.4_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/react/esm/tabs/indicator/TabsIndicatorCssVars.js +6 -0
- package/dist/node_modules/.pnpm/@base-ui-components_react@1.0.0-beta.4_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/react/esm/tabs/indicator/prehydrationScript.min.js +4 -0
- package/dist/node_modules/.pnpm/@base-ui-components_react@1.0.0-beta.4_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/react/esm/tabs/list/TabsList.js +130 -0
- package/dist/node_modules/.pnpm/@base-ui-components_react@1.0.0-beta.4_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/react/esm/tabs/list/TabsListContext.js +13 -0
- package/dist/node_modules/.pnpm/@base-ui-components_react@1.0.0-beta.4_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/react/esm/tabs/panel/TabsPanel.js +53 -0
- package/dist/node_modules/.pnpm/@base-ui-components_react@1.0.0-beta.4_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/react/esm/tabs/panel/TabsPanelDataAttributes.js +6 -0
- package/dist/node_modules/.pnpm/@base-ui-components_react@1.0.0-beta.4_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/react/esm/tabs/root/TabsRoot.js +76 -0
- package/dist/node_modules/.pnpm/@base-ui-components_react@1.0.0-beta.4_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/react/esm/tabs/root/TabsRootContext.js +13 -0
- package/dist/node_modules/.pnpm/@base-ui-components_react@1.0.0-beta.4_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/react/esm/tabs/root/TabsRootDataAttributes.js +6 -0
- package/dist/node_modules/.pnpm/@base-ui-components_react@1.0.0-beta.4_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/react/esm/tabs/root/stateAttributesMapping.js +9 -0
- package/dist/node_modules/.pnpm/@base-ui-components_react@1.0.0-beta.4_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/react/esm/tabs/tab/TabsTab.js +108 -0
- package/dist/node_modules/.pnpm/@base-ui-components_react@1.0.0-beta.4_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/react/esm/utils/createBaseUIEventDetails.js +9 -9
- package/dist/node_modules/.pnpm/@base-ui-components_utils@0.1.2_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/utils/esm/generateId.js +7 -0
- package/dist/node_modules/.pnpm/@base-ui-components_utils@0.1.2_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/utils/esm/useForcedRerendering.js +10 -0
- package/package.json +98 -6
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import * as l from "react";
|
|
2
|
+
import { useEventCallback as N } from "../../../../../../../@base-ui-components_utils@0.1.2_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/utils/esm/useEventCallback.js";
|
|
3
|
+
import { useIsoLayoutEffect as j } from "../../../../../../../@base-ui-components_utils@0.1.2_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/utils/esm/useIsoLayoutEffect.js";
|
|
4
|
+
import { CompositeRoot as y } from "../../composite/root/CompositeRoot.js";
|
|
5
|
+
import { tabsStateAttributesMapping as L } from "../root/stateAttributesMapping.js";
|
|
6
|
+
import { useTabsRootContext as P } from "../root/TabsRootContext.js";
|
|
7
|
+
import { TabsListContext as z } from "./TabsListContext.js";
|
|
8
|
+
import { j as x } from "../../../../../../../../../_virtual/jsx-runtime.js";
|
|
9
|
+
const B = [], H = /* @__PURE__ */ l.forwardRef(function(o, r) {
|
|
10
|
+
const {
|
|
11
|
+
activateOnFocus: i = !0,
|
|
12
|
+
className: t,
|
|
13
|
+
loop: n = !0,
|
|
14
|
+
render: s,
|
|
15
|
+
...e
|
|
16
|
+
} = o, {
|
|
17
|
+
getTabElementBySelectedValue: u,
|
|
18
|
+
onValueChange: A,
|
|
19
|
+
orientation: a,
|
|
20
|
+
value: f,
|
|
21
|
+
setTabMap: T,
|
|
22
|
+
tabActivationDirection: h
|
|
23
|
+
} = P(), [d, m] = l.useState(0), p = l.useRef(null), E = S(
|
|
24
|
+
f,
|
|
25
|
+
// the old value
|
|
26
|
+
a,
|
|
27
|
+
p,
|
|
28
|
+
u
|
|
29
|
+
), v = N((g, b) => {
|
|
30
|
+
if (g !== f) {
|
|
31
|
+
const D = E(g);
|
|
32
|
+
b.activationDirection = D, A(g, b);
|
|
33
|
+
}
|
|
34
|
+
}), I = l.useMemo(() => ({
|
|
35
|
+
orientation: a,
|
|
36
|
+
tabActivationDirection: h
|
|
37
|
+
}), [a, h]), M = {
|
|
38
|
+
"aria-orientation": a === "vertical" ? "vertical" : void 0,
|
|
39
|
+
role: "tablist"
|
|
40
|
+
}, R = l.useMemo(() => ({
|
|
41
|
+
activateOnFocus: i,
|
|
42
|
+
highlightedTabIndex: d,
|
|
43
|
+
onTabActivation: v,
|
|
44
|
+
setHighlightedTabIndex: m,
|
|
45
|
+
tabsListRef: p,
|
|
46
|
+
value: f
|
|
47
|
+
}), [i, d, v, m, p, f]);
|
|
48
|
+
return /* @__PURE__ */ x.jsx(z.Provider, {
|
|
49
|
+
value: R,
|
|
50
|
+
children: /* @__PURE__ */ x.jsx(y, {
|
|
51
|
+
render: s,
|
|
52
|
+
className: t,
|
|
53
|
+
state: I,
|
|
54
|
+
refs: [r, p],
|
|
55
|
+
props: [M, e],
|
|
56
|
+
stateAttributesMapping: L,
|
|
57
|
+
highlightedIndex: d,
|
|
58
|
+
enableHomeAndEndKeys: !0,
|
|
59
|
+
loop: n,
|
|
60
|
+
orientation: a,
|
|
61
|
+
onHighlightedIndexChange: m,
|
|
62
|
+
onMapChange: T,
|
|
63
|
+
disabledIndices: B
|
|
64
|
+
})
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
process.env.NODE_ENV !== "production" && (H.displayName = "TabsList");
|
|
68
|
+
function C(c, o) {
|
|
69
|
+
const {
|
|
70
|
+
left: r,
|
|
71
|
+
top: i
|
|
72
|
+
} = c.getBoundingClientRect(), {
|
|
73
|
+
left: t,
|
|
74
|
+
top: n
|
|
75
|
+
} = o.getBoundingClientRect(), s = r - t, e = i - n;
|
|
76
|
+
return {
|
|
77
|
+
left: s,
|
|
78
|
+
top: e
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function S(c, o, r, i) {
|
|
82
|
+
const t = l.useRef(null);
|
|
83
|
+
return j(() => {
|
|
84
|
+
if (c == null || r.current == null) {
|
|
85
|
+
t.current = null;
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const n = i(c);
|
|
89
|
+
if (n == null) {
|
|
90
|
+
t.current = null;
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const {
|
|
94
|
+
left: s,
|
|
95
|
+
top: e
|
|
96
|
+
} = C(n, r.current);
|
|
97
|
+
t.current = o === "horizontal" ? s : e;
|
|
98
|
+
}, [o, i, r, c]), l.useCallback((n) => {
|
|
99
|
+
if (n === c)
|
|
100
|
+
return "none";
|
|
101
|
+
if (n == null)
|
|
102
|
+
return t.current = null, "none";
|
|
103
|
+
if (n != null && r.current != null) {
|
|
104
|
+
const s = i(n);
|
|
105
|
+
if (s != null) {
|
|
106
|
+
const {
|
|
107
|
+
left: e,
|
|
108
|
+
top: u
|
|
109
|
+
} = C(s, r.current);
|
|
110
|
+
if (t.current == null)
|
|
111
|
+
return t.current = o === "horizontal" ? e : u, "none";
|
|
112
|
+
if (o === "horizontal") {
|
|
113
|
+
if (e < t.current)
|
|
114
|
+
return t.current = e, "left";
|
|
115
|
+
if (e > t.current)
|
|
116
|
+
return t.current = e, "right";
|
|
117
|
+
} else {
|
|
118
|
+
if (u < t.current)
|
|
119
|
+
return t.current = u, "up";
|
|
120
|
+
if (u > t.current)
|
|
121
|
+
return t.current = u, "down";
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return "none";
|
|
126
|
+
}, [i, o, t, r, c]);
|
|
127
|
+
}
|
|
128
|
+
export {
|
|
129
|
+
H as TabsList
|
|
130
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as s from "react";
|
|
2
|
+
const e = /* @__PURE__ */ s.createContext(void 0);
|
|
3
|
+
process.env.NODE_ENV !== "production" && (e.displayName = "TabsListContext");
|
|
4
|
+
function n() {
|
|
5
|
+
const t = s.useContext(e);
|
|
6
|
+
if (t === void 0)
|
|
7
|
+
throw new Error("Base UI: TabsListContext is missing. TabsList parts must be placed within <Tabs.List>.");
|
|
8
|
+
return t;
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
e as TabsListContext,
|
|
12
|
+
n as useTabsListContext
|
|
13
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as n from "react";
|
|
2
|
+
import { useBaseUiId as I } from "../../utils/useBaseUiId.js";
|
|
3
|
+
import { useRenderElement as T } from "../../utils/useRenderElement.js";
|
|
4
|
+
import { useCompositeListItem as x } from "../../composite/list/useCompositeListItem.js";
|
|
5
|
+
import { tabsStateAttributesMapping as M } from "../root/stateAttributesMapping.js";
|
|
6
|
+
import { useTabsRootContext as R } from "../root/TabsRootContext.js";
|
|
7
|
+
import { TabsPanelDataAttributes as V } from "./TabsPanelDataAttributes.js";
|
|
8
|
+
const g = /* @__PURE__ */ n.forwardRef(function(r, d) {
|
|
9
|
+
const {
|
|
10
|
+
children: m,
|
|
11
|
+
className: N,
|
|
12
|
+
value: e,
|
|
13
|
+
render: h,
|
|
14
|
+
keepMounted: u = !1,
|
|
15
|
+
...c
|
|
16
|
+
} = r, {
|
|
17
|
+
value: p,
|
|
18
|
+
getTabIdByPanelValueOrIndex: s,
|
|
19
|
+
orientation: i,
|
|
20
|
+
tabActivationDirection: l
|
|
21
|
+
} = R(), o = I(), b = n.useMemo(() => ({
|
|
22
|
+
id: o,
|
|
23
|
+
value: e
|
|
24
|
+
}), [o, e]), {
|
|
25
|
+
ref: f,
|
|
26
|
+
index: a
|
|
27
|
+
} = x({
|
|
28
|
+
metadata: b
|
|
29
|
+
}), t = (e ?? a) !== p, P = n.useMemo(() => s(e, a), [s, a, e]), v = n.useMemo(() => ({
|
|
30
|
+
hidden: t,
|
|
31
|
+
orientation: i,
|
|
32
|
+
tabActivationDirection: l
|
|
33
|
+
}), [t, i, l]);
|
|
34
|
+
return T("div", r, {
|
|
35
|
+
state: v,
|
|
36
|
+
ref: [d, f],
|
|
37
|
+
props: [{
|
|
38
|
+
"aria-labelledby": P,
|
|
39
|
+
hidden: t,
|
|
40
|
+
id: o ?? void 0,
|
|
41
|
+
role: "tabpanel",
|
|
42
|
+
tabIndex: t ? -1 : 0,
|
|
43
|
+
[V.index]: a
|
|
44
|
+
}, c, {
|
|
45
|
+
children: t && !u ? void 0 : m
|
|
46
|
+
}],
|
|
47
|
+
stateAttributesMapping: M
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
process.env.NODE_ENV !== "production" && (g.displayName = "TabsPanel");
|
|
51
|
+
export {
|
|
52
|
+
g as TabsPanel
|
|
53
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import * as r from "react";
|
|
2
|
+
import { useControlled as I } from "../../../../../../../@base-ui-components_utils@0.1.2_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/utils/esm/useControlled.js";
|
|
3
|
+
import { useEventCallback as N } from "../../../../../../../@base-ui-components_utils@0.1.2_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/utils/esm/useEventCallback.js";
|
|
4
|
+
import { useRenderElement as a } from "../../utils/useRenderElement.js";
|
|
5
|
+
import { CompositeList as B } from "../../composite/list/CompositeList.js";
|
|
6
|
+
import { useDirection as D } from "../../direction-provider/DirectionContext.js";
|
|
7
|
+
import { TabsRootContext as O } from "./TabsRootContext.js";
|
|
8
|
+
import { tabsStateAttributesMapping as w } from "./stateAttributesMapping.js";
|
|
9
|
+
import { j as R } from "../../../../../../../../../_virtual/jsx-runtime.js";
|
|
10
|
+
const z = /* @__PURE__ */ r.forwardRef(function(f, x) {
|
|
11
|
+
const {
|
|
12
|
+
className: _,
|
|
13
|
+
defaultValue: g = 0,
|
|
14
|
+
onValueChange: s,
|
|
15
|
+
orientation: t = "horizontal",
|
|
16
|
+
render: q,
|
|
17
|
+
value: E,
|
|
18
|
+
...h
|
|
19
|
+
} = f, c = D(), S = r.useRef([]), [l, b] = I({
|
|
20
|
+
controlled: E,
|
|
21
|
+
default: g,
|
|
22
|
+
name: "Tabs",
|
|
23
|
+
state: "value"
|
|
24
|
+
}), [d, j] = r.useState(() => /* @__PURE__ */ new Map()), [i, m] = r.useState(() => /* @__PURE__ */ new Map()), [u, k] = r.useState("none"), p = N((n, o) => {
|
|
25
|
+
s == null || s(n, o), !o.isCanceled && (b(n), k(o.activationDirection));
|
|
26
|
+
}), v = r.useCallback((n, o) => {
|
|
27
|
+
if (!(n === void 0 && o < 0)) {
|
|
28
|
+
for (const e of d.values())
|
|
29
|
+
if (n !== void 0 && e && n === (e == null ? void 0 : e.value) || n === void 0 && (e != null && e.index) && (e == null ? void 0 : e.index) === o)
|
|
30
|
+
return e.id;
|
|
31
|
+
}
|
|
32
|
+
}, [d]), T = r.useCallback((n, o) => {
|
|
33
|
+
if (!(n === void 0 && o < 0)) {
|
|
34
|
+
for (const e of i.values())
|
|
35
|
+
if (n !== void 0 && o > -1 && n === ((e == null ? void 0 : e.value) ?? (e == null ? void 0 : e.index) ?? void 0) || n === void 0 && o > -1 && o === ((e == null ? void 0 : e.value) ?? (e == null ? void 0 : e.index) ?? void 0))
|
|
36
|
+
return e == null ? void 0 : e.id;
|
|
37
|
+
}
|
|
38
|
+
}, [i]), C = r.useCallback((n) => {
|
|
39
|
+
if (n === void 0)
|
|
40
|
+
return null;
|
|
41
|
+
for (const [o, e] of i.entries())
|
|
42
|
+
if (e != null && n === (e.value ?? e.index))
|
|
43
|
+
return o;
|
|
44
|
+
return null;
|
|
45
|
+
}, [i]), y = r.useMemo(() => ({
|
|
46
|
+
direction: c,
|
|
47
|
+
getTabElementBySelectedValue: C,
|
|
48
|
+
getTabIdByPanelValueOrIndex: T,
|
|
49
|
+
getTabPanelIdByTabValueOrIndex: v,
|
|
50
|
+
onValueChange: p,
|
|
51
|
+
orientation: t,
|
|
52
|
+
setTabMap: m,
|
|
53
|
+
tabActivationDirection: u,
|
|
54
|
+
value: l
|
|
55
|
+
}), [c, C, T, v, p, t, m, u, l]), A = a("div", f, {
|
|
56
|
+
state: {
|
|
57
|
+
orientation: t,
|
|
58
|
+
tabActivationDirection: u
|
|
59
|
+
},
|
|
60
|
+
ref: x,
|
|
61
|
+
props: h,
|
|
62
|
+
stateAttributesMapping: w
|
|
63
|
+
});
|
|
64
|
+
return /* @__PURE__ */ R.jsx(O.Provider, {
|
|
65
|
+
value: y,
|
|
66
|
+
children: /* @__PURE__ */ R.jsx(B, {
|
|
67
|
+
elementsRef: S,
|
|
68
|
+
onMapChange: j,
|
|
69
|
+
children: A
|
|
70
|
+
})
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
process.env.NODE_ENV !== "production" && (z.displayName = "TabsRoot");
|
|
74
|
+
export {
|
|
75
|
+
z as TabsRoot
|
|
76
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as o from "react";
|
|
2
|
+
const e = /* @__PURE__ */ o.createContext(void 0);
|
|
3
|
+
process.env.NODE_ENV !== "production" && (e.displayName = "TabsRootContext");
|
|
4
|
+
function n() {
|
|
5
|
+
const t = o.useContext(e);
|
|
6
|
+
if (t === void 0)
|
|
7
|
+
throw new Error("Base UI: TabsRootContext is missing. Tabs parts must be placed within <Tabs.Root>.");
|
|
8
|
+
return t;
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
e as TabsRootContext,
|
|
12
|
+
n as useTabsRootContext
|
|
13
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import * as a from "react";
|
|
2
|
+
import { ownerDocument as g } from "../../../../../../../@base-ui-components_utils@0.1.2_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/utils/esm/owner.js";
|
|
3
|
+
import { useEventCallback as d } from "../../../../../../../@base-ui-components_utils@0.1.2_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/utils/esm/useEventCallback.js";
|
|
4
|
+
import { useIsoLayoutEffect as F } from "../../../../../../../@base-ui-components_utils@0.1.2_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/utils/esm/useIsoLayoutEffect.js";
|
|
5
|
+
import { useBaseUiId as U } from "../../utils/useBaseUiId.js";
|
|
6
|
+
import { useRenderElement as H } from "../../utils/useRenderElement.js";
|
|
7
|
+
import { ACTIVE_COMPOSITE_ITEM as K } from "../../composite/constants.js";
|
|
8
|
+
import { useCompositeItem as S } from "../../composite/item/useCompositeItem.js";
|
|
9
|
+
import { useTabsRootContext as W } from "../root/TabsRootContext.js";
|
|
10
|
+
import { useTabsListContext as j } from "../list/TabsListContext.js";
|
|
11
|
+
import { createChangeEventDetails as I } from "../../utils/createBaseUIEventDetails.js";
|
|
12
|
+
import { useButton as q } from "../../use-button/useButton.js";
|
|
13
|
+
import { activeElement as z, contains as G } from "../../floating-ui-react/utils/element.js";
|
|
14
|
+
const J = /* @__PURE__ */ a.forwardRef(function(p, P) {
|
|
15
|
+
const {
|
|
16
|
+
className: X,
|
|
17
|
+
disabled: n = !1,
|
|
18
|
+
render: Y,
|
|
19
|
+
value: r,
|
|
20
|
+
id: C,
|
|
21
|
+
nativeButton: h = !0,
|
|
22
|
+
...D
|
|
23
|
+
} = p, {
|
|
24
|
+
value: u,
|
|
25
|
+
getTabPanelIdByTabValueOrIndex: x,
|
|
26
|
+
orientation: b
|
|
27
|
+
} = W(), {
|
|
28
|
+
activateOnFocus: M,
|
|
29
|
+
highlightedTabIndex: v,
|
|
30
|
+
onTabActivation: T,
|
|
31
|
+
setHighlightedTabIndex: c,
|
|
32
|
+
tabsListRef: E
|
|
33
|
+
} = j(), f = U(C), B = a.useMemo(() => ({
|
|
34
|
+
disabled: n,
|
|
35
|
+
id: f,
|
|
36
|
+
value: r
|
|
37
|
+
}), [n, f, r]), {
|
|
38
|
+
compositeProps: N,
|
|
39
|
+
compositeRef: O,
|
|
40
|
+
index: e
|
|
41
|
+
// hook is used instead of the CompositeItem component
|
|
42
|
+
// because the index is needed for Tab internals
|
|
43
|
+
} = S({
|
|
44
|
+
metadata: B
|
|
45
|
+
}), R = r ?? e, o = a.useMemo(() => r === void 0 ? e < 0 ? !1 : e === u : r === u, [e, u, r]), l = a.useRef(!1);
|
|
46
|
+
F(() => {
|
|
47
|
+
if (l.current) {
|
|
48
|
+
l.current = !1;
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (!(o && e > -1 && v !== e))
|
|
52
|
+
return;
|
|
53
|
+
const t = E.current, i = z(g(t));
|
|
54
|
+
t && i && G(t, i) || c(e);
|
|
55
|
+
}, [o, e, v, c, n, E]);
|
|
56
|
+
const {
|
|
57
|
+
getButtonProps: V,
|
|
58
|
+
buttonRef: w
|
|
59
|
+
} = q({
|
|
60
|
+
disabled: n,
|
|
61
|
+
native: h,
|
|
62
|
+
focusableWhenDisabled: !0
|
|
63
|
+
}), y = e > -1 ? x(r, e) : void 0, s = a.useRef(!1), m = a.useRef(!1), L = d((t) => {
|
|
64
|
+
o || n || T(R, I("none", t.nativeEvent, {
|
|
65
|
+
activationDirection: "none"
|
|
66
|
+
}));
|
|
67
|
+
}), _ = d((t) => {
|
|
68
|
+
o || (e > -1 && c(e), !n && (M && !s.current || // keyboard or touch focus
|
|
69
|
+
s.current && m.current) && T(R, I("none", t.nativeEvent, {
|
|
70
|
+
activationDirection: "none"
|
|
71
|
+
})));
|
|
72
|
+
}), k = d((t) => {
|
|
73
|
+
if (o || n)
|
|
74
|
+
return;
|
|
75
|
+
s.current = !0;
|
|
76
|
+
function i() {
|
|
77
|
+
s.current = !1, m.current = !1;
|
|
78
|
+
}
|
|
79
|
+
(!t.button || t.button === 0) && (m.current = !0, g(t.currentTarget).addEventListener("pointerup", i, {
|
|
80
|
+
once: !0
|
|
81
|
+
}));
|
|
82
|
+
}), A = a.useMemo(() => ({
|
|
83
|
+
disabled: n,
|
|
84
|
+
selected: o,
|
|
85
|
+
orientation: b
|
|
86
|
+
}), [n, o, b]);
|
|
87
|
+
return H("button", p, {
|
|
88
|
+
state: A,
|
|
89
|
+
ref: [P, w, O],
|
|
90
|
+
props: [N, {
|
|
91
|
+
role: "tab",
|
|
92
|
+
"aria-controls": y,
|
|
93
|
+
"aria-selected": o,
|
|
94
|
+
id: f,
|
|
95
|
+
onClick: L,
|
|
96
|
+
onFocus: _,
|
|
97
|
+
onPointerDown: k,
|
|
98
|
+
[K]: o ? "" : void 0,
|
|
99
|
+
onKeyDownCapture() {
|
|
100
|
+
l.current = !0;
|
|
101
|
+
}
|
|
102
|
+
}, D, V]
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
process.env.NODE_ENV !== "production" && (J.displayName = "TabsTab");
|
|
106
|
+
export {
|
|
107
|
+
J as TabsTab
|
|
108
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { EMPTY_OBJECT as
|
|
2
|
-
function
|
|
3
|
-
let e = !1,
|
|
4
|
-
const
|
|
1
|
+
import { EMPTY_OBJECT as o } from "../../../../../../@base-ui-components_utils@0.1.2_@types_react@19.2.0_react-dom@19.2.0_react@19.2.0/node_modules/@base-ui-components/utils/esm/empty.js";
|
|
2
|
+
function i(t, n, r) {
|
|
3
|
+
let e = !1, a = !1;
|
|
4
|
+
const l = r ?? o;
|
|
5
5
|
return {
|
|
6
6
|
reason: t,
|
|
7
7
|
event: n ?? new Event("base-ui"),
|
|
@@ -9,19 +9,19 @@ function l(t, n, r) {
|
|
|
9
9
|
e = !0;
|
|
10
10
|
},
|
|
11
11
|
allowPropagation() {
|
|
12
|
-
|
|
12
|
+
a = !0;
|
|
13
13
|
},
|
|
14
14
|
get isCanceled() {
|
|
15
15
|
return e;
|
|
16
16
|
},
|
|
17
17
|
get isPropagationAllowed() {
|
|
18
|
-
return
|
|
18
|
+
return a;
|
|
19
19
|
},
|
|
20
|
-
...
|
|
20
|
+
...l
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
function s(t, n, r) {
|
|
24
|
-
const e = r ??
|
|
24
|
+
const e = r ?? o;
|
|
25
25
|
return {
|
|
26
26
|
reason: t,
|
|
27
27
|
event: n ?? new Event("base-ui"),
|
|
@@ -29,6 +29,6 @@ function s(t, n, r) {
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
export {
|
|
32
|
-
|
|
32
|
+
i as createChangeEventDetails,
|
|
33
33
|
s as createGenericEventDetails
|
|
34
34
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@px-ui/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.24.0",
|
|
4
4
|
"description": "A modern React component library built with Tailwind CSS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -15,9 +15,101 @@
|
|
|
15
15
|
"import": "./dist/index.js"
|
|
16
16
|
},
|
|
17
17
|
"./styles": "./dist/core.css",
|
|
18
|
-
"./
|
|
19
|
-
"types": "./dist/components
|
|
20
|
-
"import": "./dist/components
|
|
18
|
+
"./button": {
|
|
19
|
+
"types": "./dist/components/button.d.ts",
|
|
20
|
+
"import": "./dist/components/button.js"
|
|
21
|
+
},
|
|
22
|
+
"./checkbox": {
|
|
23
|
+
"types": "./dist/components/checkbox.d.ts",
|
|
24
|
+
"import": "./dist/components/checkbox.js"
|
|
25
|
+
},
|
|
26
|
+
"./label": {
|
|
27
|
+
"types": "./dist/components/label.d.ts",
|
|
28
|
+
"import": "./dist/components/label.js"
|
|
29
|
+
},
|
|
30
|
+
"./text-input": {
|
|
31
|
+
"types": "./dist/components/text-input.d.ts",
|
|
32
|
+
"import": "./dist/components/text-input.js"
|
|
33
|
+
},
|
|
34
|
+
"./input": {
|
|
35
|
+
"types": "./dist/components/input.d.ts",
|
|
36
|
+
"import": "./dist/components/input.js"
|
|
37
|
+
},
|
|
38
|
+
"./input-group": {
|
|
39
|
+
"types": "./dist/components/input-group.d.ts",
|
|
40
|
+
"import": "./dist/components/input-group.js"
|
|
41
|
+
},
|
|
42
|
+
"./textarea": {
|
|
43
|
+
"types": "./dist/components/textarea.d.ts",
|
|
44
|
+
"import": "./dist/components/textarea.js"
|
|
45
|
+
},
|
|
46
|
+
"./avatar": {
|
|
47
|
+
"types": "./dist/components/avatar.d.ts",
|
|
48
|
+
"import": "./dist/components/avatar.js"
|
|
49
|
+
},
|
|
50
|
+
"./avatar-group": {
|
|
51
|
+
"types": "./dist/components/avatar-group.d.ts",
|
|
52
|
+
"import": "./dist/components/avatar-group.js"
|
|
53
|
+
},
|
|
54
|
+
"./user-avatar": {
|
|
55
|
+
"types": "./dist/components/user-avatar.d.ts",
|
|
56
|
+
"import": "./dist/components/user-avatar.js"
|
|
57
|
+
},
|
|
58
|
+
"./segmented-control": {
|
|
59
|
+
"types": "./dist/components/segmented-control.d.ts",
|
|
60
|
+
"import": "./dist/components/segmented-control.js"
|
|
61
|
+
},
|
|
62
|
+
"./dialog": {
|
|
63
|
+
"types": "./dist/components/dialog.d.ts",
|
|
64
|
+
"import": "./dist/components/dialog.js"
|
|
65
|
+
},
|
|
66
|
+
"./popover": {
|
|
67
|
+
"types": "./dist/components/popover.d.ts",
|
|
68
|
+
"import": "./dist/components/popover.js"
|
|
69
|
+
},
|
|
70
|
+
"./combobox": {
|
|
71
|
+
"types": "./dist/components/combobox.d.ts",
|
|
72
|
+
"import": "./dist/components/combobox.js"
|
|
73
|
+
},
|
|
74
|
+
"./select": {
|
|
75
|
+
"types": "./dist/components/select.d.ts",
|
|
76
|
+
"import": "./dist/components/select.js"
|
|
77
|
+
},
|
|
78
|
+
"./menu": {
|
|
79
|
+
"types": "./dist/components/menu.d.ts",
|
|
80
|
+
"import": "./dist/components/menu.js"
|
|
81
|
+
},
|
|
82
|
+
"./spinner": {
|
|
83
|
+
"types": "./dist/components/spinner.d.ts",
|
|
84
|
+
"import": "./dist/components/spinner.js"
|
|
85
|
+
},
|
|
86
|
+
"./switch": {
|
|
87
|
+
"types": "./dist/components/switch.d.ts",
|
|
88
|
+
"import": "./dist/components/switch.js"
|
|
89
|
+
},
|
|
90
|
+
"./tabs": {
|
|
91
|
+
"types": "./dist/components/tabs.d.ts",
|
|
92
|
+
"import": "./dist/components/tabs.js"
|
|
93
|
+
},
|
|
94
|
+
"./tooltip": {
|
|
95
|
+
"types": "./dist/components/tooltip.d.ts",
|
|
96
|
+
"import": "./dist/components/tooltip.js"
|
|
97
|
+
},
|
|
98
|
+
"./radio-group": {
|
|
99
|
+
"types": "./dist/components/radio-group.d.ts",
|
|
100
|
+
"import": "./dist/components/radio-group.js"
|
|
101
|
+
},
|
|
102
|
+
"./block-checkbox-group": {
|
|
103
|
+
"types": "./dist/components/block-checkbox-group.d.ts",
|
|
104
|
+
"import": "./dist/components/block-checkbox-group.js"
|
|
105
|
+
},
|
|
106
|
+
"./block-radio-group": {
|
|
107
|
+
"types": "./dist/components/block-radio-group.d.ts",
|
|
108
|
+
"import": "./dist/components/block-radio-group.js"
|
|
109
|
+
},
|
|
110
|
+
"./utils": {
|
|
111
|
+
"types": "./dist/utils/index.d.ts",
|
|
112
|
+
"import": "./dist/utils/index.js"
|
|
21
113
|
}
|
|
22
114
|
},
|
|
23
115
|
"files": [
|
|
@@ -48,7 +140,6 @@
|
|
|
48
140
|
"access": "public"
|
|
49
141
|
},
|
|
50
142
|
"peerDependencies": {
|
|
51
|
-
"classnames": ">2.0.0",
|
|
52
143
|
"react": ">=16.8.0",
|
|
53
144
|
"react-dom": ">=16.8.0"
|
|
54
145
|
},
|
|
@@ -56,7 +147,8 @@
|
|
|
56
147
|
"@base-ui-components/react": "1.0.0-beta.4",
|
|
57
148
|
"class-variance-authority": "^0.7.1",
|
|
58
149
|
"tailwind-merge": "3.2.0",
|
|
59
|
-
"tw-animate-css": "^1.3.4"
|
|
150
|
+
"tw-animate-css": "^1.3.4",
|
|
151
|
+
"classnames": ">2.0.0"
|
|
60
152
|
},
|
|
61
153
|
"devDependencies": {
|
|
62
154
|
"@tanstack/react-query": "^5.90.1",
|