@arun-dev/headless 4.13.0 → 4.15.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/avatar/index.cjs +218 -0
- package/dist/avatar/index.d.cts +52 -0
- package/dist/avatar/index.d.ts +52 -0
- package/dist/avatar/index.js +105 -0
- package/dist/chunk-36N5DD5K.js +78 -0
- package/dist/chunk-E4JBFRMM.js +11 -0
- package/dist/chunk-ETNICT5M.js +8 -0
- package/dist/combobox/index.cjs +3 -1
- package/dist/combobox/index.js +6 -6
- package/dist/menu/index.cjs +311 -19
- package/dist/menu/index.d.cts +144 -10
- package/dist/menu/index.d.ts +144 -10
- package/dist/menu/index.js +310 -22
- package/dist/rovingFocus-BZB3yicE.d.cts +11 -0
- package/dist/rovingFocus-BZB3yicE.d.ts +11 -0
- package/dist/tabs/index.d.cts +1 -10
- package/dist/tabs/index.d.ts +1 -10
- package/dist/toggle/index.cjs +232 -0
- package/dist/toggle/index.d.cts +26 -0
- package/dist/toggle/index.d.ts +26 -0
- package/dist/toggle/index.js +68 -0
- package/dist/toggle-group/index.cjs +292 -0
- package/dist/toggle-group/index.d.cts +31 -0
- package/dist/toggle-group/index.d.ts +31 -0
- package/dist/toggle-group/index.js +68 -0
- package/dist/toolbar/index.cjs +357 -0
- package/dist/toolbar/index.d.cts +89 -0
- package/dist/toolbar/index.d.ts +89 -0
- package/dist/toolbar/index.js +152 -0
- package/package.json +41 -1
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RovingGroupContext,
|
|
3
|
+
useRovingGroup,
|
|
4
|
+
useRovingItem
|
|
5
|
+
} from "../chunk-36N5DD5K.js";
|
|
6
|
+
import "../chunk-2S4XG4VD.js";
|
|
7
|
+
import {
|
|
8
|
+
__export,
|
|
9
|
+
useRender
|
|
10
|
+
} from "../chunk-OQTWWZ4B.js";
|
|
11
|
+
|
|
12
|
+
// src/toolbar/index.parts.ts
|
|
13
|
+
var index_parts_exports = {};
|
|
14
|
+
__export(index_parts_exports, {
|
|
15
|
+
Button: () => ToolbarButton,
|
|
16
|
+
Group: () => ToolbarGroup,
|
|
17
|
+
Input: () => ToolbarInput,
|
|
18
|
+
Link: () => ToolbarLink,
|
|
19
|
+
Root: () => ToolbarRoot,
|
|
20
|
+
Separator: () => ToolbarSeparator
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// src/toolbar/ToolbarRoot.tsx
|
|
24
|
+
import { createContext, useContext } from "react";
|
|
25
|
+
import { jsx } from "react/jsx-runtime";
|
|
26
|
+
var ToolbarContext = createContext(null);
|
|
27
|
+
function useToolbarContext(part) {
|
|
28
|
+
const context = useContext(ToolbarContext);
|
|
29
|
+
if (!context) throw new Error(`<Toolbar.${part}> must be rendered inside <Toolbar.Root>.`);
|
|
30
|
+
return context;
|
|
31
|
+
}
|
|
32
|
+
function ToolbarRoot({
|
|
33
|
+
orientation = "horizontal",
|
|
34
|
+
className,
|
|
35
|
+
children,
|
|
36
|
+
render,
|
|
37
|
+
...rest
|
|
38
|
+
}) {
|
|
39
|
+
const roving = useRovingGroup({ orientation });
|
|
40
|
+
const element = useRender({
|
|
41
|
+
render,
|
|
42
|
+
defaultTagName: "div",
|
|
43
|
+
props: {
|
|
44
|
+
role: "toolbar",
|
|
45
|
+
"aria-orientation": orientation,
|
|
46
|
+
"data-orientation": orientation,
|
|
47
|
+
className,
|
|
48
|
+
children,
|
|
49
|
+
onKeyDown: roving.onKeyDown
|
|
50
|
+
},
|
|
51
|
+
consumerProps: rest
|
|
52
|
+
});
|
|
53
|
+
return /* @__PURE__ */ jsx(ToolbarContext.Provider, { value: { orientation }, children: /* @__PURE__ */ jsx(RovingGroupContext.Provider, { value: roving.context, children: element }) });
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// src/toolbar/ToolbarButton.tsx
|
|
57
|
+
import { useRef } from "react";
|
|
58
|
+
function ToolbarButton({
|
|
59
|
+
disabled = false,
|
|
60
|
+
className,
|
|
61
|
+
render,
|
|
62
|
+
...rest
|
|
63
|
+
}) {
|
|
64
|
+
useToolbarContext("Button");
|
|
65
|
+
const elementRef = useRef(null);
|
|
66
|
+
const roving = useRovingItem(elementRef, disabled);
|
|
67
|
+
return useRender({
|
|
68
|
+
render,
|
|
69
|
+
defaultTagName: "button",
|
|
70
|
+
props: {
|
|
71
|
+
type: "button",
|
|
72
|
+
disabled: disabled || void 0,
|
|
73
|
+
"data-disabled": disabled ? "" : void 0,
|
|
74
|
+
tabIndex: roving.tabIndex,
|
|
75
|
+
className,
|
|
76
|
+
ref: elementRef,
|
|
77
|
+
onFocus: roving.onFocus
|
|
78
|
+
},
|
|
79
|
+
consumerProps: rest
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// src/toolbar/ToolbarLink.tsx
|
|
84
|
+
import { useRef as useRef2 } from "react";
|
|
85
|
+
function ToolbarLink({ className, render, ...rest }) {
|
|
86
|
+
useToolbarContext("Link");
|
|
87
|
+
const elementRef = useRef2(null);
|
|
88
|
+
const roving = useRovingItem(elementRef, false);
|
|
89
|
+
return useRender({
|
|
90
|
+
render,
|
|
91
|
+
defaultTagName: "a",
|
|
92
|
+
props: {
|
|
93
|
+
tabIndex: roving.tabIndex,
|
|
94
|
+
className,
|
|
95
|
+
ref: elementRef,
|
|
96
|
+
onFocus: roving.onFocus
|
|
97
|
+
},
|
|
98
|
+
consumerProps: rest
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// src/toolbar/ToolbarInput.tsx
|
|
103
|
+
import { useRef as useRef3 } from "react";
|
|
104
|
+
function ToolbarInput({ disabled = false, className, render, ...rest }) {
|
|
105
|
+
useToolbarContext("Input");
|
|
106
|
+
const elementRef = useRef3(null);
|
|
107
|
+
const roving = useRovingItem(elementRef, disabled);
|
|
108
|
+
return useRender({
|
|
109
|
+
render,
|
|
110
|
+
defaultTagName: "input",
|
|
111
|
+
props: {
|
|
112
|
+
disabled: disabled || void 0,
|
|
113
|
+
"data-disabled": disabled ? "" : void 0,
|
|
114
|
+
tabIndex: roving.tabIndex,
|
|
115
|
+
className,
|
|
116
|
+
ref: elementRef,
|
|
117
|
+
onFocus: roving.onFocus
|
|
118
|
+
},
|
|
119
|
+
consumerProps: rest
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// src/toolbar/ToolbarGroup.tsx
|
|
124
|
+
function ToolbarGroup({ className, render, ...rest }) {
|
|
125
|
+
useToolbarContext("Group");
|
|
126
|
+
return useRender({
|
|
127
|
+
render,
|
|
128
|
+
defaultTagName: "div",
|
|
129
|
+
props: { role: "group", className },
|
|
130
|
+
consumerProps: rest
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// src/toolbar/ToolbarSeparator.tsx
|
|
135
|
+
function ToolbarSeparator({ className, render, ...rest }) {
|
|
136
|
+
const { orientation } = useToolbarContext("Separator");
|
|
137
|
+
const own = orientation === "horizontal" ? "vertical" : "horizontal";
|
|
138
|
+
return useRender({
|
|
139
|
+
render,
|
|
140
|
+
defaultTagName: "div",
|
|
141
|
+
props: {
|
|
142
|
+
role: "separator",
|
|
143
|
+
"aria-orientation": own,
|
|
144
|
+
"data-orientation": own,
|
|
145
|
+
className
|
|
146
|
+
},
|
|
147
|
+
consumerProps: rest
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
export {
|
|
151
|
+
index_parts_exports as Toolbar
|
|
152
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arun-dev/headless",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.15.0",
|
|
4
4
|
"description": "Unstyled React behaviour primitives — render engine, controlled/uncontrolled state, and data-* state projection. Ships no CSS and no class names.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -124,6 +124,46 @@
|
|
|
124
124
|
"default": "./dist/toast/index.cjs"
|
|
125
125
|
}
|
|
126
126
|
},
|
|
127
|
+
"./avatar": {
|
|
128
|
+
"import": {
|
|
129
|
+
"types": "./dist/avatar/index.d.ts",
|
|
130
|
+
"default": "./dist/avatar/index.js"
|
|
131
|
+
},
|
|
132
|
+
"require": {
|
|
133
|
+
"types": "./dist/avatar/index.d.cts",
|
|
134
|
+
"default": "./dist/avatar/index.cjs"
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"./toggle": {
|
|
138
|
+
"import": {
|
|
139
|
+
"types": "./dist/toggle/index.d.ts",
|
|
140
|
+
"default": "./dist/toggle/index.js"
|
|
141
|
+
},
|
|
142
|
+
"require": {
|
|
143
|
+
"types": "./dist/toggle/index.d.cts",
|
|
144
|
+
"default": "./dist/toggle/index.cjs"
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"./toggle-group": {
|
|
148
|
+
"import": {
|
|
149
|
+
"types": "./dist/toggle-group/index.d.ts",
|
|
150
|
+
"default": "./dist/toggle-group/index.js"
|
|
151
|
+
},
|
|
152
|
+
"require": {
|
|
153
|
+
"types": "./dist/toggle-group/index.d.cts",
|
|
154
|
+
"default": "./dist/toggle-group/index.cjs"
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
"./toolbar": {
|
|
158
|
+
"import": {
|
|
159
|
+
"types": "./dist/toolbar/index.d.ts",
|
|
160
|
+
"default": "./dist/toolbar/index.js"
|
|
161
|
+
},
|
|
162
|
+
"require": {
|
|
163
|
+
"types": "./dist/toolbar/index.d.cts",
|
|
164
|
+
"default": "./dist/toolbar/index.cjs"
|
|
165
|
+
}
|
|
166
|
+
},
|
|
127
167
|
"./switch": {
|
|
128
168
|
"import": {
|
|
129
169
|
"types": "./dist/switch/index.d.ts",
|