sinwan-ui-core 1.2.1 → 1.3.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/CHANGELOG.md +18 -0
- package/README.md +2 -2
- package/dist/chunks/{chunk-94xhejch.js → chunk-4a2neay9.js} +51 -2
- package/dist/chunks/{chunk-s03me75x.js → chunk-b3nbmmyq.js} +161 -103
- package/dist/controls.d.ts +25 -9
- package/dist/controls.js +1 -1
- package/dist/index.js +8 -2
- package/dist/overlay.d.ts +31 -16
- package/dist/overlay.js +7 -1
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this package are documented in this file. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this package uses [Semantic Versioning](https://semver.org/).
|
|
4
4
|
|
|
5
|
+
## [1.3.0]
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Tabs follow the WAI-ARIA tabs pattern (`controls`). The tab list has a single tab stop (the active tab, or the first enabled one). Left and Right move between tabs, Up and Down when the root is `orientation="vertical"`, and Home and End jump to the first and last tab. Moving selects the tab (automatic activation) and skips disabled tabs. Left and Right swap inside a `DirectionProvider dir="rtl"`. Each tab and its panel are linked (`id`, `aria-controls`, `aria-labelledby`), the panel is focusable, and the list has `aria-orientation`.
|
|
10
|
+
- `DialogTitle` and `DialogDescription` (`overlay`): a heading and a paragraph that name and describe their dialog. Inside a `DialogRoot`, `DialogContent` gets `aria-labelledby` and `aria-describedby` pointing at them, so screen readers announce the dialog's title when it opens. An `id` you pass is kept and used. `DialogLabelsKey` and the `DialogLabels` type are exported.
|
|
11
|
+
- `DialogContent` takes `role="alertdialog"` for dialogs that interrupt to ask for a decision (the default stays `dialog`), and passes `aria-*` attributes through. An `aria-labelledby` or `aria-describedby` you pass wins over the automatic one.
|
|
12
|
+
- `TabsKey` gains optional `orientation`, `idOf`, `register`, `tabStop` and `move`. A context provided by hand without them still works, without the keyboard behaviour.
|
|
13
|
+
- Exported types: `AriaProps`, `RovingMove`, `HeadingProps`, `ParagraphProps`.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- `SwitchRoot`, `RadioGroupRoot` and `TabsList` forward `aria-*` attributes to their element, as `ToggleGroupRoot` already did. Before, an `aria-label` such as "Payment method" was dropped, so screen readers announced an unnamed switch, radio group or tab list. Attributes the primitive owns (`aria-checked`, `aria-orientation`) still win.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- The radio group shares its roving-focus code with tabs. Its behaviour is unchanged (its keyboard tests pass as before).
|
|
22
|
+
|
|
5
23
|
## [1.2.1]
|
|
6
24
|
|
|
7
25
|
### Fixed
|
package/README.md
CHANGED
|
@@ -23,8 +23,8 @@ Import from the root barrel or from a subpath (subpaths keep bundles small):
|
|
|
23
23
|
| Subpath | Contents |
|
|
24
24
|
| --- | --- |
|
|
25
25
|
| `sinwan-ui-core/core` | `Presence` (keeps content mounted through CSS exit), `UiPortal`, `useControllableState`, `getFocusableElements`, `trapFocus`; re-exports the positioning helpers from `floating` |
|
|
26
|
-
| `sinwan-ui-core/overlay` | Dialog, Collapsible, Popover and Tooltip primitives (`DialogRoot`, `DialogTrigger`, `DialogOverlay`, `DialogContent`, `PopoverRoot`, …), their injection keys and `OpenApi` |
|
|
27
|
-
| `sinwan-ui-core/controls` | Tabs
|
|
26
|
+
| `sinwan-ui-core/overlay` | Dialog, Collapsible, Popover and Tooltip primitives (`DialogRoot`, `DialogTrigger`, `DialogOverlay`, `DialogContent` with `role="alertdialog"`, `DialogTitle` and `DialogDescription`, which name and describe the dialog, `PopoverRoot`, …), their injection keys and `OpenApi` |
|
|
27
|
+
| `sinwan-ui-core/controls` | Tabs and RadioGroup (WAI-ARIA arrow keys and a single tab stop), Accordion, Checkbox, Switch, Toggle and ToggleGroup primitives with injection keys. Roots forward `aria-*` attributes |
|
|
28
28
|
| `sinwan-ui-core/floating` | `useAnchorPosition`, `usePointPosition`, `computePosition`, `estimatePosition` and placement helpers (Floating UI based) |
|
|
29
29
|
| `sinwan-ui-core/dismiss` | `isDismissExemptPointerTarget` for outside-press handling across portaled layers |
|
|
30
30
|
| `sinwan-ui-core/menu-sub` | `createMenuSubApi` (closes with its `parentOpen`), `createMenuSubTriggerHandlers`, `isInsideMenuSubContent`, `MenuSubContentLayer` for nested menus |
|
|
@@ -18,6 +18,7 @@ import { _$createTemplate } from "sinwan/renderer/web";
|
|
|
18
18
|
import { unwrap as _$unwrap } from "sinwan/reactivity";
|
|
19
19
|
import {
|
|
20
20
|
cc,
|
|
21
|
+
getRawProps,
|
|
21
22
|
inject,
|
|
22
23
|
onMounted,
|
|
23
24
|
onUnmounted,
|
|
@@ -129,13 +130,53 @@ function createOpenState(props) {
|
|
|
129
130
|
};
|
|
130
131
|
}
|
|
131
132
|
var DialogKey2 = Symbol("sinwan-ui.dialog");
|
|
133
|
+
var DialogLabelsKey2 = Symbol("sinwan-ui.dialog-labels");
|
|
134
|
+
var dialogCount = 0;
|
|
132
135
|
var DialogRoot2 = cc((props) => {
|
|
133
136
|
const api = createOpenState(props);
|
|
134
137
|
provide(DialogKey2, api);
|
|
138
|
+
dialogCount += 1;
|
|
139
|
+
provide(DialogLabelsKey2, {
|
|
140
|
+
title: signal(null),
|
|
141
|
+
description: signal(null),
|
|
142
|
+
baseId: `sinwan-ui-dialog-${dialogCount}`
|
|
143
|
+
});
|
|
135
144
|
return /* @__PURE__ */ jsx(Fragment, {
|
|
136
145
|
children: () => _$unwrap(props).children
|
|
137
146
|
});
|
|
138
147
|
});
|
|
148
|
+
function useDialogLabel(part, id) {
|
|
149
|
+
const labels = inject(DialogLabelsKey2, null);
|
|
150
|
+
const own = typeof id === "string" && id !== "" ? id : labels ? `${labels.baseId}-${part}` : undefined;
|
|
151
|
+
if (labels && own) {
|
|
152
|
+
labels[part].value = own;
|
|
153
|
+
onUnmounted(() => {
|
|
154
|
+
if (labels[part].value === own)
|
|
155
|
+
labels[part].value = null;
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
return own;
|
|
159
|
+
}
|
|
160
|
+
var DialogTitle2 = cc((props) => {
|
|
161
|
+
const { children, id, ...rest } = getRawProps(props);
|
|
162
|
+
const own = useDialogLabel("title", id);
|
|
163
|
+
return /* @__PURE__ */ jsx("h2", {
|
|
164
|
+
"data-slot": "dialog-title",
|
|
165
|
+
...rest,
|
|
166
|
+
id: own,
|
|
167
|
+
children
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
var DialogDescription2 = cc((props) => {
|
|
171
|
+
const { children, id, ...rest } = getRawProps(props);
|
|
172
|
+
const own = useDialogLabel("description", id);
|
|
173
|
+
return /* @__PURE__ */ jsx("p", {
|
|
174
|
+
"data-slot": "dialog-description",
|
|
175
|
+
...rest,
|
|
176
|
+
id: own,
|
|
177
|
+
children
|
|
178
|
+
});
|
|
179
|
+
});
|
|
139
180
|
var DialogTrigger2 = cc((props) => {
|
|
140
181
|
const api = inject(DialogKey2);
|
|
141
182
|
const onClick = () => {
|
|
@@ -201,6 +242,7 @@ var DialogContent2 = cc((props) => {
|
|
|
201
242
|
const dataAttrs = _$createLiveRest(props, [
|
|
202
243
|
"children",
|
|
203
244
|
"class",
|
|
245
|
+
"role",
|
|
204
246
|
"onEscapeKeyDown",
|
|
205
247
|
"data-side",
|
|
206
248
|
"data-size",
|
|
@@ -208,6 +250,7 @@ var DialogContent2 = cc((props) => {
|
|
|
208
250
|
"data-slot"
|
|
209
251
|
]);
|
|
210
252
|
const api = inject(DialogKey2);
|
|
253
|
+
const labels = inject(DialogLabelsKey2, null);
|
|
211
254
|
let contentEl = null;
|
|
212
255
|
let previousFocus = null;
|
|
213
256
|
onMounted(() => {
|
|
@@ -235,8 +278,14 @@ var DialogContent2 = cc((props) => {
|
|
|
235
278
|
present: () => api.open.value,
|
|
236
279
|
children: /* @__PURE__ */ jsx(UiPortal2, {
|
|
237
280
|
children: /* @__PURE__ */ jsx("div", {
|
|
281
|
+
"aria-labelledby": function labelledBy() {
|
|
282
|
+
return labels?.title.value ?? undefined;
|
|
283
|
+
},
|
|
284
|
+
"aria-describedby": function describedBy() {
|
|
285
|
+
return labels?.description.value ?? undefined;
|
|
286
|
+
},
|
|
238
287
|
..._$getSpreadProps(dataAttrs),
|
|
239
|
-
role: "dialog",
|
|
288
|
+
role: () => _$unwrap(props).role === undefined ? "dialog" : _$unwrap(props).role,
|
|
240
289
|
"aria-modal": "true",
|
|
241
290
|
"data-slot": () => props["data-slot"] === undefined ? "dialog-content" : props["data-slot"],
|
|
242
291
|
"data-state": contentState,
|
|
@@ -508,4 +557,4 @@ var TooltipContent2 = cc((props) => {
|
|
|
508
557
|
});
|
|
509
558
|
});
|
|
510
559
|
|
|
511
|
-
export { DialogKey2, DialogRoot2, DialogTrigger2, DialogClose2, DialogOverlay2, DialogContent2, CollapsibleKey2, CollapsibleRoot2, CollapsibleTrigger2, CollapsibleContent2, PopoverKey2, PopoverRoot2, PopoverTrigger2, PopoverContent2, TooltipKey2, TooltipProvider2, TooltipRoot2, TooltipTrigger2, TooltipContent2 };
|
|
560
|
+
export { DialogKey2, DialogLabelsKey2, DialogRoot2, DialogTitle2, DialogDescription2, DialogTrigger2, DialogClose2, DialogOverlay2, DialogContent2, CollapsibleKey2, CollapsibleRoot2, CollapsibleTrigger2, CollapsibleContent2, PopoverKey2, PopoverRoot2, PopoverTrigger2, PopoverContent2, TooltipKey2, TooltipProvider2, TooltipRoot2, TooltipTrigger2, TooltipContent2 };
|
|
@@ -29,32 +29,29 @@ var _$tmpl_0 = {
|
|
|
29
29
|
]
|
|
30
30
|
};
|
|
31
31
|
var _$tmpl_1 = {
|
|
32
|
-
html: '<
|
|
33
|
-
slots: [
|
|
34
|
-
{ path: [], type: "attr", name: "data-variant" },
|
|
35
|
-
{ path: [], type: "attr", name: "class" },
|
|
36
|
-
{ path: [], type: "child" }
|
|
37
|
-
]
|
|
38
|
-
};
|
|
39
|
-
var _$tmpl_2 = {
|
|
40
|
-
html: '<button type="button" role="tab" data-slot="tabs-trigger" data-state="" aria-selected="" disabled=""></button>',
|
|
32
|
+
html: '<button type="button" role="tab" id="" data-slot="tabs-trigger" data-state="" aria-selected="" aria-controls="" tabIndex="" disabled=""></button>',
|
|
41
33
|
slots: [
|
|
34
|
+
{ path: [], type: "ref", name: "ref" },
|
|
35
|
+
{ path: [], type: "attr", name: "id" },
|
|
42
36
|
{ path: [], type: "attr", name: "data-state" },
|
|
43
37
|
{ path: [], type: "attr", name: "aria-selected" },
|
|
38
|
+
{ path: [], type: "attr", name: "aria-controls" },
|
|
39
|
+
{ path: [], type: "attr", name: "tabIndex" },
|
|
44
40
|
{ path: [], type: "attr", name: "disabled" },
|
|
45
41
|
{ path: [], type: "attr", name: "class" },
|
|
46
42
|
{ path: [], type: "event", name: "onclick" },
|
|
43
|
+
{ path: [], type: "event", name: "onkeydown" },
|
|
47
44
|
{ path: [], type: "child" }
|
|
48
45
|
]
|
|
49
46
|
};
|
|
50
|
-
var _$
|
|
47
|
+
var _$tmpl_2 = {
|
|
51
48
|
html: '<div data-slot="accordion"></div>',
|
|
52
49
|
slots: [
|
|
53
50
|
{ path: [], type: "attr", name: "class" },
|
|
54
51
|
{ path: [], type: "child" }
|
|
55
52
|
]
|
|
56
53
|
};
|
|
57
|
-
var _$
|
|
54
|
+
var _$tmpl_3 = {
|
|
58
55
|
html: '<div data-slot="accordion-item" data-state=""></div>',
|
|
59
56
|
slots: [
|
|
60
57
|
{ path: [], type: "attr", name: "data-state" },
|
|
@@ -62,7 +59,7 @@ var _$tmpl_4 = {
|
|
|
62
59
|
{ path: [], type: "child" }
|
|
63
60
|
]
|
|
64
61
|
};
|
|
65
|
-
var _$
|
|
62
|
+
var _$tmpl_4 = {
|
|
66
63
|
html: '<button type="button" data-slot="accordion-trigger" aria-expanded=""></button>',
|
|
67
64
|
slots: [
|
|
68
65
|
{ path: [], type: "attr", name: "aria-expanded" },
|
|
@@ -71,7 +68,7 @@ var _$tmpl_5 = {
|
|
|
71
68
|
{ path: [], type: "child" }
|
|
72
69
|
]
|
|
73
70
|
};
|
|
74
|
-
var _$
|
|
71
|
+
var _$tmpl_5 = {
|
|
75
72
|
html: '<button type="button" role="checkbox" id="" data-slot="checkbox" data-state="" aria-checked="" aria-label="" disabled="" name="" value=""></button>',
|
|
76
73
|
slots: [
|
|
77
74
|
{ path: [], type: "attr", name: "id" },
|
|
@@ -86,27 +83,7 @@ var _$tmpl_6 = {
|
|
|
86
83
|
{ path: [], type: "child" }
|
|
87
84
|
]
|
|
88
85
|
};
|
|
89
|
-
var _$
|
|
90
|
-
html: '<button type="button" role="switch" id="" data-slot="switch" data-size="" data-state="" aria-checked="" disabled=""></button>',
|
|
91
|
-
slots: [
|
|
92
|
-
{ path: [], type: "attr", name: "id" },
|
|
93
|
-
{ path: [], type: "attr", name: "data-size" },
|
|
94
|
-
{ path: [], type: "attr", name: "data-state" },
|
|
95
|
-
{ path: [], type: "attr", name: "aria-checked" },
|
|
96
|
-
{ path: [], type: "attr", name: "disabled" },
|
|
97
|
-
{ path: [], type: "attr", name: "class" },
|
|
98
|
-
{ path: [], type: "event", name: "onclick" },
|
|
99
|
-
{ path: [], type: "child" }
|
|
100
|
-
]
|
|
101
|
-
};
|
|
102
|
-
var _$tmpl_8 = {
|
|
103
|
-
html: '<div role="radiogroup" data-slot="radio-group"></div>',
|
|
104
|
-
slots: [
|
|
105
|
-
{ path: [], type: "attr", name: "class" },
|
|
106
|
-
{ path: [], type: "child" }
|
|
107
|
-
]
|
|
108
|
-
};
|
|
109
|
-
var _$tmpl_9 = {
|
|
86
|
+
var _$tmpl_6 = {
|
|
110
87
|
html: '<button type="button" role="radio" id="" data-slot="radio-group-item" data-state="" aria-checked="" tabIndex="" disabled=""></button>',
|
|
111
88
|
slots: [
|
|
112
89
|
{ path: [], type: "ref", name: "ref" },
|
|
@@ -121,7 +98,7 @@ var _$tmpl_9 = {
|
|
|
121
98
|
{ path: [], type: "child" }
|
|
122
99
|
]
|
|
123
100
|
};
|
|
124
|
-
var _$
|
|
101
|
+
var _$tmpl_7 = {
|
|
125
102
|
html: '<button type="button" data-slot="toggle" data-state="" aria-pressed="" disabled=""></button>',
|
|
126
103
|
slots: [
|
|
127
104
|
{ path: [], type: "attr", name: "data-state" },
|
|
@@ -132,7 +109,7 @@ var _$tmpl_10 = {
|
|
|
132
109
|
{ path: [], type: "child" }
|
|
133
110
|
]
|
|
134
111
|
};
|
|
135
|
-
var _$
|
|
112
|
+
var _$tmpl_8 = {
|
|
136
113
|
html: '<button type="button" data-slot="toggle-group-item" data-variant="" data-size="" data-spacing="" data-state="" disabled=""></button>',
|
|
137
114
|
slots: [
|
|
138
115
|
{ path: [], type: "attr", name: "data-variant" },
|
|
@@ -150,6 +127,63 @@ function toValueList(v) {
|
|
|
150
127
|
return [];
|
|
151
128
|
return Array.isArray(v) ? v : v ? [v] : [];
|
|
152
129
|
}
|
|
130
|
+
function ariaOf(props) {
|
|
131
|
+
return Object.fromEntries(Object.entries(getRawProps(props)).filter(([key]) => key.startsWith("aria-")));
|
|
132
|
+
}
|
|
133
|
+
var idCount = 0;
|
|
134
|
+
function nextId(prefix) {
|
|
135
|
+
idCount += 1;
|
|
136
|
+
return `sinwan-ui-${prefix}-${idCount}`;
|
|
137
|
+
}
|
|
138
|
+
function idPart(value) {
|
|
139
|
+
return value.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
140
|
+
}
|
|
141
|
+
var DOCUMENT_POSITION_FOLLOWING = 4;
|
|
142
|
+
function inDocumentOrder(a, b) {
|
|
143
|
+
return a.el.compareDocumentPosition(b.el) & DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
|
|
144
|
+
}
|
|
145
|
+
function createRovingFocus(value, select) {
|
|
146
|
+
const entries = signal([]);
|
|
147
|
+
const enabled = () => entries.value.filter((entry) => !entry.disabled());
|
|
148
|
+
return {
|
|
149
|
+
register: (entry) => {
|
|
150
|
+
entries.value = [...entries.value, entry];
|
|
151
|
+
return () => {
|
|
152
|
+
entries.value = entries.value.filter((other) => other !== entry);
|
|
153
|
+
};
|
|
154
|
+
},
|
|
155
|
+
tabStop: computed(() => {
|
|
156
|
+
const list = enabled();
|
|
157
|
+
return (list.find((entry) => entry.value() === value.value) ?? list[0])?.value();
|
|
158
|
+
}),
|
|
159
|
+
move: (from, step) => {
|
|
160
|
+
const list = enabled().sort(inDocumentOrder);
|
|
161
|
+
if (list.length === 0)
|
|
162
|
+
return;
|
|
163
|
+
const index = list.findIndex((entry) => entry.value() === from);
|
|
164
|
+
let next;
|
|
165
|
+
if (step === "first")
|
|
166
|
+
next = list[0];
|
|
167
|
+
else if (step === "last")
|
|
168
|
+
next = list[list.length - 1];
|
|
169
|
+
else if (index === -1)
|
|
170
|
+
next = list[step === 1 ? 0 : list.length - 1];
|
|
171
|
+
else
|
|
172
|
+
next = list[(index + step + list.length) % list.length];
|
|
173
|
+
next.el.focus();
|
|
174
|
+
select(next.value());
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function useRovingItem(register, entry) {
|
|
179
|
+
let unregister;
|
|
180
|
+
onUnmounted(() => unregister?.());
|
|
181
|
+
return (el) => {
|
|
182
|
+
if (el && !unregister)
|
|
183
|
+
unregister = register({ ...entry, el });
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
var LTR = { dir: { value: "ltr" } };
|
|
153
187
|
var TabsKey2 = Symbol("sinwan-ui.tabs");
|
|
154
188
|
var TabsRoot2 = cc((props) => {
|
|
155
189
|
const valueLocal = signal(props.defaultValue ?? "");
|
|
@@ -158,12 +192,17 @@ var TabsRoot2 = cc((props) => {
|
|
|
158
192
|
if (!("value" in props))
|
|
159
193
|
valueLocal.value = next;
|
|
160
194
|
};
|
|
195
|
+
const setValue = (v) => {
|
|
196
|
+
set(v);
|
|
197
|
+
props.onValueChange?.(v);
|
|
198
|
+
};
|
|
199
|
+
const baseId = nextId("tabs");
|
|
161
200
|
provide(TabsKey2, {
|
|
162
201
|
value,
|
|
163
|
-
setValue
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
202
|
+
setValue,
|
|
203
|
+
orientation: () => props.orientation ?? "horizontal",
|
|
204
|
+
idOf: (tab, part) => `${baseId}-${part}-${idPart(tab)}`,
|
|
205
|
+
...createRovingFocus(value, setValue)
|
|
167
206
|
});
|
|
168
207
|
return _$createTemplate(_$tmpl_0, [
|
|
169
208
|
() => _$unwrap(props).orientation ?? "horizontal",
|
|
@@ -173,22 +212,57 @@ var TabsRoot2 = cc((props) => {
|
|
|
173
212
|
() => _$unwrap(props).children
|
|
174
213
|
]);
|
|
175
214
|
});
|
|
176
|
-
var TabsList2 = cc((props) =>
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
215
|
+
var TabsList2 = cc((props) => {
|
|
216
|
+
const api = inject(TabsKey2, null);
|
|
217
|
+
return /* @__PURE__ */ jsx("div", {
|
|
218
|
+
...ariaOf(props),
|
|
219
|
+
role: "tablist",
|
|
220
|
+
"aria-orientation": () => api?.orientation?.() ?? "horizontal",
|
|
221
|
+
"data-slot": "tabs-list",
|
|
222
|
+
"data-variant": () => props["data-variant"],
|
|
223
|
+
class: () => _$unwrap(props).class,
|
|
224
|
+
children: () => _$unwrap(props).children
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
function tabStep(key, orientation, dir) {
|
|
228
|
+
if (key === "Home")
|
|
229
|
+
return "first";
|
|
230
|
+
if (key === "End")
|
|
231
|
+
return "last";
|
|
232
|
+
if (orientation === "vertical")
|
|
233
|
+
return key === "ArrowDown" ? 1 : key === "ArrowUp" ? -1 : 0;
|
|
234
|
+
const forward = dir === "rtl" ? "ArrowLeft" : "ArrowRight";
|
|
235
|
+
const backward = dir === "rtl" ? "ArrowRight" : "ArrowLeft";
|
|
236
|
+
return key === forward ? 1 : key === backward ? -1 : 0;
|
|
237
|
+
}
|
|
181
238
|
var TabsTrigger2 = cc((props) => {
|
|
182
239
|
const api = inject(TabsKey2);
|
|
183
|
-
|
|
240
|
+
const direction = inject(DirectionKey2, LTR);
|
|
241
|
+
const register = api.register;
|
|
242
|
+
const ref = register ? useRovingItem(register, {
|
|
243
|
+
value: () => props.value,
|
|
244
|
+
disabled: () => Boolean(props.disabled)
|
|
245
|
+
}) : undefined;
|
|
246
|
+
return _$createTemplate(_$tmpl_1, [
|
|
247
|
+
ref,
|
|
248
|
+
() => api.idOf?.(_$unwrap(props).value, "trigger"),
|
|
184
249
|
() => api.value.value === _$unwrap(props).value ? "active" : "inactive",
|
|
185
250
|
() => api.value.value === _$unwrap(props).value,
|
|
251
|
+
() => api.value.value === _$unwrap(props).value ? api.idOf?.(_$unwrap(props).value, "content") : undefined,
|
|
252
|
+
() => api.tabStop ? api.tabStop.value === _$unwrap(props).value ? 0 : -1 : undefined,
|
|
186
253
|
() => _$unwrap(props).disabled,
|
|
187
254
|
() => _$unwrap(props).class,
|
|
188
255
|
() => {
|
|
189
256
|
if (!props.disabled)
|
|
190
257
|
api.setValue(props.value);
|
|
191
258
|
},
|
|
259
|
+
(event) => {
|
|
260
|
+
const step = tabStep(event.key, api.orientation?.() ?? "horizontal", direction.dir.value);
|
|
261
|
+
if (step === 0 || !api.move)
|
|
262
|
+
return;
|
|
263
|
+
event.preventDefault();
|
|
264
|
+
api.move(props.value, step);
|
|
265
|
+
},
|
|
192
266
|
() => _$unwrap(props).children
|
|
193
267
|
]);
|
|
194
268
|
});
|
|
@@ -198,6 +272,9 @@ var TabsContent2 = cc((props) => {
|
|
|
198
272
|
when: () => api.value.value === _$unwrap(props).value,
|
|
199
273
|
children: /* @__PURE__ */ jsx("div", {
|
|
200
274
|
role: "tabpanel",
|
|
275
|
+
id: () => api.idOf?.(_$unwrap(props).value, "content"),
|
|
276
|
+
"aria-labelledby": () => api.idOf?.(_$unwrap(props).value, "trigger"),
|
|
277
|
+
tabIndex: 0,
|
|
201
278
|
"data-slot": "tabs-content",
|
|
202
279
|
"data-state": "active",
|
|
203
280
|
class: () => _$unwrap(props).class,
|
|
@@ -231,12 +308,12 @@ var AccordionRoot2 = cc((props) => {
|
|
|
231
308
|
props.onValueChange?.(type() === "single" ? next[0] ?? "" : next);
|
|
232
309
|
}
|
|
233
310
|
});
|
|
234
|
-
return _$createTemplate(_$
|
|
311
|
+
return _$createTemplate(_$tmpl_2, [() => _$unwrap(props).class, () => _$unwrap(props).children]);
|
|
235
312
|
});
|
|
236
313
|
var AccordionItem2 = cc((props) => {
|
|
237
314
|
provide(AccordionItemKey2, { value: props.value });
|
|
238
315
|
const api = inject(AccordionKey2);
|
|
239
|
-
return _$createTemplate(_$
|
|
316
|
+
return _$createTemplate(_$tmpl_3, [
|
|
240
317
|
() => api.value.value.includes(_$unwrap(props).value) ? "open" : "closed",
|
|
241
318
|
() => _$unwrap(props).class,
|
|
242
319
|
() => _$unwrap(props).children
|
|
@@ -245,7 +322,7 @@ var AccordionItem2 = cc((props) => {
|
|
|
245
322
|
var AccordionTrigger2 = cc((props) => {
|
|
246
323
|
const root = inject(AccordionKey2);
|
|
247
324
|
const item = inject(AccordionItemKey2);
|
|
248
|
-
return _$createTemplate(_$
|
|
325
|
+
return _$createTemplate(_$tmpl_4, [
|
|
249
326
|
() => root.value.value.includes(item.value) ? "true" : "false",
|
|
250
327
|
() => _$unwrap(props).class,
|
|
251
328
|
() => root.toggle(item.value),
|
|
@@ -297,7 +374,7 @@ var CheckboxRoot2 = cc((props) => {
|
|
|
297
374
|
if (!("indeterminate" in props))
|
|
298
375
|
mixedLocal.value = next;
|
|
299
376
|
};
|
|
300
|
-
return _$createTemplate(_$
|
|
377
|
+
return _$createTemplate(_$tmpl_5, [
|
|
301
378
|
() => _$unwrap(props).id,
|
|
302
379
|
() => mixed.value ? "indeterminate" : checked.value ? "checked" : "unchecked",
|
|
303
380
|
() => mixed.value ? "mixed" : checked.value,
|
|
@@ -324,28 +401,28 @@ var SwitchRoot2 = cc((props) => {
|
|
|
324
401
|
if (!("checked" in props))
|
|
325
402
|
checkedLocal.value = next;
|
|
326
403
|
};
|
|
327
|
-
return
|
|
328
|
-
(
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
() =>
|
|
332
|
-
|
|
333
|
-
() =>
|
|
334
|
-
() =>
|
|
404
|
+
return /* @__PURE__ */ jsx("button", {
|
|
405
|
+
...ariaOf(props),
|
|
406
|
+
type: "button",
|
|
407
|
+
role: "switch",
|
|
408
|
+
id: () => _$unwrap(props).id,
|
|
409
|
+
"data-slot": "switch",
|
|
410
|
+
"data-size": () => props["data-size"],
|
|
411
|
+
"data-state": () => checked.value ? "checked" : "unchecked",
|
|
412
|
+
"aria-checked": () => checked.value,
|
|
413
|
+
disabled: () => _$unwrap(props).disabled,
|
|
414
|
+
class: () => _$unwrap(props).class,
|
|
415
|
+
onclick: () => {
|
|
335
416
|
if (props.disabled)
|
|
336
417
|
return;
|
|
337
418
|
const next = !checked.value;
|
|
338
419
|
set(next);
|
|
339
420
|
props.onCheckedChange?.(next);
|
|
340
421
|
},
|
|
341
|
-
() => _$unwrap(props).children
|
|
342
|
-
|
|
422
|
+
children: () => _$unwrap(props).children
|
|
423
|
+
});
|
|
343
424
|
});
|
|
344
425
|
var RadioGroupKey2 = Symbol("sinwan-ui.radio-group");
|
|
345
|
-
var DOCUMENT_POSITION_FOLLOWING = 4;
|
|
346
|
-
function inDocumentOrder(a, b) {
|
|
347
|
-
return a.el.compareDocumentPosition(b.el) & DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
|
|
348
|
-
}
|
|
349
426
|
var RadioGroupRoot2 = cc((props) => {
|
|
350
427
|
const valueLocal = signal(props.defaultValue ?? "");
|
|
351
428
|
const value = "value" in props ? computed(() => props.value ?? "") : valueLocal;
|
|
@@ -357,36 +434,23 @@ var RadioGroupRoot2 = cc((props) => {
|
|
|
357
434
|
set(v);
|
|
358
435
|
props.onValueChange?.(v);
|
|
359
436
|
};
|
|
360
|
-
const
|
|
361
|
-
const enabled = () => entries.value.filter((entry) => !entry.disabled());
|
|
362
|
-
const tabStop = computed(() => {
|
|
363
|
-
const list = enabled();
|
|
364
|
-
return (list.find((entry) => entry.value() === value.value) ?? list[0])?.value();
|
|
365
|
-
});
|
|
437
|
+
const roving = createRovingFocus(value, setValue);
|
|
366
438
|
provide(RadioGroupKey2, {
|
|
367
439
|
value,
|
|
368
440
|
name: props.name,
|
|
369
441
|
setValue,
|
|
370
|
-
register:
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
return;
|
|
381
|
-
const index = list.findIndex((entry) => entry.value() === from);
|
|
382
|
-
const next = index === -1 ? list[step === 1 ? 0 : list.length - 1] : list[(index + step + list.length) % list.length];
|
|
383
|
-
next.el.focus();
|
|
384
|
-
setValue(next.value());
|
|
385
|
-
}
|
|
442
|
+
register: roving.register,
|
|
443
|
+
tabStop: roving.tabStop,
|
|
444
|
+
move: roving.move
|
|
445
|
+
});
|
|
446
|
+
return /* @__PURE__ */ jsx("div", {
|
|
447
|
+
...ariaOf(props),
|
|
448
|
+
role: "radiogroup",
|
|
449
|
+
"data-slot": "radio-group",
|
|
450
|
+
class: () => _$unwrap(props).class,
|
|
451
|
+
children: () => _$unwrap(props).children
|
|
386
452
|
});
|
|
387
|
-
return _$createTemplate(_$tmpl_8, [() => _$unwrap(props).class, () => _$unwrap(props).children]);
|
|
388
453
|
});
|
|
389
|
-
var LTR = { dir: { value: "ltr" } };
|
|
390
454
|
function radioStep(key, dir) {
|
|
391
455
|
const forward = dir === "rtl" ? "ArrowLeft" : "ArrowRight";
|
|
392
456
|
const backward = dir === "rtl" ? "ArrowRight" : "ArrowLeft";
|
|
@@ -399,18 +463,12 @@ function radioStep(key, dir) {
|
|
|
399
463
|
var RadioGroupItem2 = cc((props) => {
|
|
400
464
|
const api = inject(RadioGroupKey2);
|
|
401
465
|
const direction = inject(DirectionKey2, LTR);
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
value: () => props.value,
|
|
409
|
-
disabled: () => Boolean(props.disabled),
|
|
410
|
-
el
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
},
|
|
466
|
+
const ref = useRovingItem(api.register, {
|
|
467
|
+
value: () => props.value,
|
|
468
|
+
disabled: () => Boolean(props.disabled)
|
|
469
|
+
});
|
|
470
|
+
return _$createTemplate(_$tmpl_6, [
|
|
471
|
+
ref,
|
|
414
472
|
() => _$unwrap(props).id,
|
|
415
473
|
() => api.value.value === _$unwrap(props).value ? "checked" : "unchecked",
|
|
416
474
|
() => api.value.value === _$unwrap(props).value,
|
|
@@ -438,7 +496,7 @@ var ToggleRoot2 = cc((props) => {
|
|
|
438
496
|
if (!("pressed" in props))
|
|
439
497
|
pressedLocal.value = next;
|
|
440
498
|
};
|
|
441
|
-
return _$createTemplate(_$
|
|
499
|
+
return _$createTemplate(_$tmpl_7, [
|
|
442
500
|
() => pressed.value ? "on" : "off",
|
|
443
501
|
() => pressed.value,
|
|
444
502
|
() => _$unwrap(props).disabled,
|
|
@@ -456,7 +514,7 @@ var ToggleRoot2 = cc((props) => {
|
|
|
456
514
|
var ToggleGroupKey2 = Symbol("sinwan-ui.toggle-group");
|
|
457
515
|
var ToggleGroupRoot2 = cc((props) => {
|
|
458
516
|
const type = () => props.type ?? "single";
|
|
459
|
-
const ariaProps =
|
|
517
|
+
const ariaProps = ariaOf(props);
|
|
460
518
|
const valueLocal = signal(toValueList(props.defaultValue));
|
|
461
519
|
const value = "value" in props ? computed(() => toValueList(props.value)) : valueLocal;
|
|
462
520
|
const set = (next) => {
|
|
@@ -492,7 +550,7 @@ var ToggleGroupRoot2 = cc((props) => {
|
|
|
492
550
|
});
|
|
493
551
|
var ToggleGroupItem2 = cc((props) => {
|
|
494
552
|
const api = inject(ToggleGroupKey2);
|
|
495
|
-
return _$createTemplate(_$
|
|
553
|
+
return _$createTemplate(_$tmpl_8, [
|
|
496
554
|
() => props["data-variant"],
|
|
497
555
|
() => props["data-size"],
|
|
498
556
|
() => props["data-spacing"],
|
package/dist/controls.d.ts
CHANGED
|
@@ -2,9 +2,31 @@ import { type InjectionKey, type SinwanNode } from "sinwan/component";
|
|
|
2
2
|
import { For, Show } from "sinwan/control-flow";
|
|
3
3
|
import { type Computed, type Signal } from "sinwan/reactivity";
|
|
4
4
|
import { Slot } from "./slot";
|
|
5
|
+
/** `aria-*` attributes a primitive passes through to its element. */
|
|
6
|
+
export type AriaProps = {
|
|
7
|
+
[key: `aria-${string}`]: string | boolean | undefined;
|
|
8
|
+
};
|
|
9
|
+
/** An item of a roving-focus group (radio group, tab list). */
|
|
10
|
+
export type RadioGroupEntry = {
|
|
11
|
+
value: () => string;
|
|
12
|
+
disabled: () => boolean;
|
|
13
|
+
el: HTMLElement;
|
|
14
|
+
};
|
|
15
|
+
/** Where an arrow, Home or End key moves in a roving-focus group. */
|
|
16
|
+
export type RovingMove = 1 | -1 | "first" | "last";
|
|
5
17
|
export declare const TabsKey: InjectionKey<{
|
|
6
18
|
value: Signal<string> | Computed<string>;
|
|
7
19
|
setValue: (v: string) => void;
|
|
20
|
+
/** Arrow keys follow it: Left/Right when horizontal, Up/Down when vertical. */
|
|
21
|
+
orientation?: () => "horizontal" | "vertical";
|
|
22
|
+
/** Id of a tab (`part: "trigger"`) or of its panel (`part: "content"`). */
|
|
23
|
+
idOf?: (value: string, part: "trigger" | "content") => string;
|
|
24
|
+
/** Adds a tab to the keyboard order; returns its removal. */
|
|
25
|
+
register?: (entry: RadioGroupEntry) => () => void;
|
|
26
|
+
/** Value of the one tab that is in the tab order. */
|
|
27
|
+
tabStop?: Computed<string | undefined>;
|
|
28
|
+
/** Moves focus and selection (automatic activation). */
|
|
29
|
+
move?: (from: string, step: RovingMove) => void;
|
|
8
30
|
}>;
|
|
9
31
|
export declare const TabsRoot: import("sinwan/component").SinwanComponent<{
|
|
10
32
|
children?: SinwanNode;
|
|
@@ -18,7 +40,7 @@ export declare const TabsList: import("sinwan/component").SinwanComponent<{
|
|
|
18
40
|
children?: SinwanNode;
|
|
19
41
|
class?: string;
|
|
20
42
|
"data-variant"?: string;
|
|
21
|
-
}>;
|
|
43
|
+
} & AriaProps>;
|
|
22
44
|
export declare const TabsTrigger: import("sinwan/component").SinwanComponent<{
|
|
23
45
|
children?: SinwanNode;
|
|
24
46
|
class?: string;
|
|
@@ -82,13 +104,7 @@ export declare const SwitchRoot: import("sinwan/component").SinwanComponent<{
|
|
|
82
104
|
id?: string;
|
|
83
105
|
children?: SinwanNode;
|
|
84
106
|
"data-size"?: string;
|
|
85
|
-
}>;
|
|
86
|
-
/** A radio registered with its group for roving focus. */
|
|
87
|
-
export type RadioGroupEntry = {
|
|
88
|
-
value: () => string;
|
|
89
|
-
disabled: () => boolean;
|
|
90
|
-
el: HTMLElement;
|
|
91
|
-
};
|
|
107
|
+
} & AriaProps>;
|
|
92
108
|
export declare const RadioGroupKey: InjectionKey<{
|
|
93
109
|
value: Signal<string> | Computed<string>;
|
|
94
110
|
setValue: (v: string) => void;
|
|
@@ -107,7 +123,7 @@ export declare const RadioGroupRoot: import("sinwan/component").SinwanComponent<
|
|
|
107
123
|
onValueChange?: (v: string) => void;
|
|
108
124
|
class?: string;
|
|
109
125
|
name?: string;
|
|
110
|
-
}>;
|
|
126
|
+
} & AriaProps>;
|
|
111
127
|
export declare const RadioGroupItem: import("sinwan/component").SinwanComponent<{
|
|
112
128
|
value: string;
|
|
113
129
|
class?: string;
|
package/dist/controls.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
ToggleGroupKey2,
|
|
54
54
|
ToggleGroupRoot2,
|
|
55
55
|
ToggleGroupItem2
|
|
56
|
-
} from "./chunks/chunk-
|
|
56
|
+
} from "./chunks/chunk-b3nbmmyq.js";
|
|
57
57
|
import {
|
|
58
58
|
isDismissExemptPointerTarget2
|
|
59
59
|
} from "./chunks/chunk-9whagkb6.js";
|
|
@@ -65,7 +65,10 @@ import {
|
|
|
65
65
|
} from "./chunks/chunk-8zvv4kad.js";
|
|
66
66
|
import {
|
|
67
67
|
DialogKey2,
|
|
68
|
+
DialogLabelsKey2,
|
|
68
69
|
DialogRoot2,
|
|
70
|
+
DialogTitle2,
|
|
71
|
+
DialogDescription2,
|
|
69
72
|
DialogTrigger2,
|
|
70
73
|
DialogClose2,
|
|
71
74
|
DialogOverlay2,
|
|
@@ -83,7 +86,7 @@ import {
|
|
|
83
86
|
TooltipRoot2,
|
|
84
87
|
TooltipTrigger2,
|
|
85
88
|
TooltipContent2
|
|
86
|
-
} from "./chunks/chunk-
|
|
89
|
+
} from "./chunks/chunk-4a2neay9.js";
|
|
87
90
|
import {
|
|
88
91
|
ThemeKey2,
|
|
89
92
|
ThemeProvider2,
|
|
@@ -104,9 +107,12 @@ export {
|
|
|
104
107
|
CollapsibleTrigger2 as CollapsibleTrigger,
|
|
105
108
|
DialogClose2 as DialogClose,
|
|
106
109
|
DialogContent2 as DialogContent,
|
|
110
|
+
DialogDescription2 as DialogDescription,
|
|
107
111
|
DialogKey2 as DialogKey,
|
|
112
|
+
DialogLabelsKey2 as DialogLabelsKey,
|
|
108
113
|
DialogOverlay2 as DialogOverlay,
|
|
109
114
|
DialogRoot2 as DialogRoot,
|
|
115
|
+
DialogTitle2 as DialogTitle,
|
|
110
116
|
DialogTrigger2 as DialogTrigger,
|
|
111
117
|
DirectionKey2 as DirectionKey,
|
|
112
118
|
DirectionProvider2 as DirectionProvider,
|
package/dist/overlay.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { type InjectionKey, type SinwanNode } from "sinwan/component";
|
|
1
|
+
import { type InjectionKey, type SinwanComponent, type SinwanNode } from "sinwan/component";
|
|
2
2
|
import { signal, type Computed, type Signal } from "sinwan/reactivity";
|
|
3
3
|
import { type Align, type Placement } from "./core";
|
|
4
|
+
import type { HeadingProps, ParagraphProps } from "./types";
|
|
4
5
|
export type OpenApi = {
|
|
5
6
|
open: Signal<boolean> | Computed<boolean>;
|
|
6
7
|
setOpen: (value: boolean) => void;
|
|
@@ -17,24 +18,38 @@ export type DialogRootProps = {
|
|
|
17
18
|
defaultOpen?: boolean;
|
|
18
19
|
onOpenChange?: (open: boolean) => void;
|
|
19
20
|
};
|
|
20
|
-
|
|
21
|
-
export
|
|
21
|
+
/** Which title and description name the open dialog (`aria-labelledby` / `aria-describedby`). */
|
|
22
|
+
export type DialogLabels = {
|
|
23
|
+
title: Signal<string | null>;
|
|
24
|
+
description: Signal<string | null>;
|
|
25
|
+
baseId: string;
|
|
26
|
+
};
|
|
27
|
+
export declare const DialogLabelsKey: InjectionKey<DialogLabels>;
|
|
28
|
+
export declare const DialogRoot: SinwanComponent<DialogRootProps>;
|
|
29
|
+
/** The dialog's heading. Inside a `DialogRoot` it names the dialog (`aria-labelledby`). */
|
|
30
|
+
export declare const DialogTitle: SinwanComponent<HeadingProps>;
|
|
31
|
+
/** The dialog's description. Inside a `DialogRoot` it describes the dialog (`aria-describedby`). */
|
|
32
|
+
export declare const DialogDescription: SinwanComponent<ParagraphProps>;
|
|
33
|
+
export declare const DialogTrigger: SinwanComponent<{
|
|
22
34
|
children?: SinwanNode;
|
|
23
35
|
class?: string;
|
|
24
36
|
asChild?: boolean;
|
|
25
37
|
}>;
|
|
26
|
-
export declare const DialogClose:
|
|
38
|
+
export declare const DialogClose: SinwanComponent<{
|
|
27
39
|
children?: SinwanNode;
|
|
28
40
|
class?: string;
|
|
29
41
|
asChild?: boolean;
|
|
30
42
|
}>;
|
|
31
|
-
export declare const DialogOverlay:
|
|
43
|
+
export declare const DialogOverlay: SinwanComponent<{
|
|
32
44
|
class?: string;
|
|
33
45
|
}>;
|
|
34
|
-
export declare const DialogContent:
|
|
46
|
+
export declare const DialogContent: SinwanComponent<{
|
|
35
47
|
[key: `data-${string}`]: string | undefined;
|
|
48
|
+
[key: `aria-${string}`]: string | boolean | undefined;
|
|
36
49
|
children?: SinwanNode;
|
|
37
50
|
class?: string;
|
|
51
|
+
/** `alertdialog` for a dialog that interrupts to ask for a decision. */
|
|
52
|
+
role?: "dialog" | "alertdialog";
|
|
38
53
|
onEscapeKeyDown?: (e: KeyboardEvent) => void;
|
|
39
54
|
"data-side"?: string;
|
|
40
55
|
"data-size"?: string;
|
|
@@ -45,19 +60,19 @@ export declare const CollapsibleKey: InjectionKey<{
|
|
|
45
60
|
open: Signal<boolean> | Computed<boolean>;
|
|
46
61
|
setOpen: (v: boolean) => void;
|
|
47
62
|
}>;
|
|
48
|
-
export declare const CollapsibleRoot:
|
|
63
|
+
export declare const CollapsibleRoot: SinwanComponent<{
|
|
49
64
|
children?: SinwanNode;
|
|
50
65
|
open?: boolean;
|
|
51
66
|
defaultOpen?: boolean;
|
|
52
67
|
onOpenChange?: (open: boolean) => void;
|
|
53
68
|
class?: string;
|
|
54
69
|
}>;
|
|
55
|
-
export declare const CollapsibleTrigger:
|
|
70
|
+
export declare const CollapsibleTrigger: SinwanComponent<{
|
|
56
71
|
children?: SinwanNode;
|
|
57
72
|
class?: string;
|
|
58
73
|
asChild?: boolean;
|
|
59
74
|
}>;
|
|
60
|
-
export declare const CollapsibleContent:
|
|
75
|
+
export declare const CollapsibleContent: SinwanComponent<{
|
|
61
76
|
children?: SinwanNode;
|
|
62
77
|
class?: string;
|
|
63
78
|
}>;
|
|
@@ -65,7 +80,7 @@ export declare const PopoverKey: InjectionKey<OpenApi & {
|
|
|
65
80
|
placement: Placement;
|
|
66
81
|
align: Align;
|
|
67
82
|
}>;
|
|
68
|
-
export declare const PopoverRoot:
|
|
83
|
+
export declare const PopoverRoot: SinwanComponent<{
|
|
69
84
|
children?: SinwanNode;
|
|
70
85
|
open?: boolean;
|
|
71
86
|
defaultOpen?: boolean;
|
|
@@ -73,12 +88,12 @@ export declare const PopoverRoot: import("sinwan/component").SinwanComponent<{
|
|
|
73
88
|
placement?: Placement;
|
|
74
89
|
align?: Align;
|
|
75
90
|
}>;
|
|
76
|
-
export declare const PopoverTrigger:
|
|
91
|
+
export declare const PopoverTrigger: SinwanComponent<{
|
|
77
92
|
children?: SinwanNode;
|
|
78
93
|
class?: string;
|
|
79
94
|
asChild?: boolean;
|
|
80
95
|
}>;
|
|
81
|
-
export declare const PopoverContent:
|
|
96
|
+
export declare const PopoverContent: SinwanComponent<{
|
|
82
97
|
children?: SinwanNode;
|
|
83
98
|
class?: string;
|
|
84
99
|
side?: Placement;
|
|
@@ -88,22 +103,22 @@ export declare const PopoverContent: import("sinwan/component").SinwanComponent<
|
|
|
88
103
|
onmouseleave?: (event: MouseEvent) => void;
|
|
89
104
|
}>;
|
|
90
105
|
export declare const TooltipKey: InjectionKey<OpenApi>;
|
|
91
|
-
export declare const TooltipProvider:
|
|
106
|
+
export declare const TooltipProvider: SinwanComponent<{
|
|
92
107
|
children?: SinwanNode;
|
|
93
108
|
delayDuration?: number;
|
|
94
109
|
}>;
|
|
95
|
-
export declare const TooltipRoot:
|
|
110
|
+
export declare const TooltipRoot: SinwanComponent<{
|
|
96
111
|
children?: SinwanNode;
|
|
97
112
|
open?: boolean;
|
|
98
113
|
defaultOpen?: boolean;
|
|
99
114
|
onOpenChange?: (open: boolean) => void;
|
|
100
115
|
}>;
|
|
101
|
-
export declare const TooltipTrigger:
|
|
116
|
+
export declare const TooltipTrigger: SinwanComponent<{
|
|
102
117
|
children?: SinwanNode;
|
|
103
118
|
class?: string;
|
|
104
119
|
asChild?: boolean;
|
|
105
120
|
}>;
|
|
106
|
-
export declare const TooltipContent:
|
|
121
|
+
export declare const TooltipContent: SinwanComponent<{
|
|
107
122
|
children?: SinwanNode;
|
|
108
123
|
class?: string;
|
|
109
124
|
side?: Placement;
|
package/dist/overlay.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DialogKey2,
|
|
3
|
+
DialogLabelsKey2,
|
|
3
4
|
DialogRoot2,
|
|
5
|
+
DialogTitle2,
|
|
6
|
+
DialogDescription2,
|
|
4
7
|
DialogTrigger2,
|
|
5
8
|
DialogClose2,
|
|
6
9
|
DialogOverlay2,
|
|
@@ -18,7 +21,7 @@ import {
|
|
|
18
21
|
TooltipRoot2,
|
|
19
22
|
TooltipTrigger2,
|
|
20
23
|
TooltipContent2
|
|
21
|
-
} from "./chunks/chunk-
|
|
24
|
+
} from "./chunks/chunk-4a2neay9.js";
|
|
22
25
|
import"./chunks/chunk-bw9vp0y9.js";
|
|
23
26
|
import"./chunks/chunk-7r6fwdyt.js";
|
|
24
27
|
import"./chunks/chunk-9whagkb6.js";
|
|
@@ -31,9 +34,12 @@ export {
|
|
|
31
34
|
CollapsibleTrigger2 as CollapsibleTrigger,
|
|
32
35
|
DialogClose2 as DialogClose,
|
|
33
36
|
DialogContent2 as DialogContent,
|
|
37
|
+
DialogDescription2 as DialogDescription,
|
|
34
38
|
DialogKey2 as DialogKey,
|
|
39
|
+
DialogLabelsKey2 as DialogLabelsKey,
|
|
35
40
|
DialogOverlay2 as DialogOverlay,
|
|
36
41
|
DialogRoot2 as DialogRoot,
|
|
42
|
+
DialogTitle2 as DialogTitle,
|
|
37
43
|
DialogTrigger2 as DialogTrigger,
|
|
38
44
|
PopoverContent2 as PopoverContent,
|
|
39
45
|
PopoverKey2 as PopoverKey,
|
package/dist/types.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export type TextareaHTMLProps = JSX.IntrinsicElements["textarea"];
|
|
|
6
6
|
export type LabelHTMLProps = JSX.IntrinsicElements["label"];
|
|
7
7
|
export type AnchorHTMLProps = JSX.IntrinsicElements["a"];
|
|
8
8
|
export type SpanProps = JSX.IntrinsicElements["span"];
|
|
9
|
+
export type HeadingProps = JSX.IntrinsicElements["h2"];
|
|
10
|
+
export type ParagraphProps = JSX.IntrinsicElements["p"];
|
|
9
11
|
export type SVGProps = JSX.IntrinsicElements["svg"];
|
|
10
12
|
export declare function isSinwanElement(node: SinwanNode): node is SinwanElement;
|
|
11
13
|
export declare function flattenChildren(children: SinwanNode | undefined): SinwanNode[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sinwan-ui-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Headless behaviour primitives for Sinwan UI components: overlays, floating positioning, dismiss layers, controls, slots, theme and direction.",
|
|
5
5
|
"author": "Mohammed Ben Cheikh",
|
|
6
6
|
"license": "MIT",
|