@a11y-core/react 0.1.0-alpha.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/README.md +252 -0
- package/dist/chunk-3WBTHTVK.js +41 -0
- package/dist/chunk-3WBTHTVK.js.map +1 -0
- package/dist/chunk-47MFBHV6.js +85 -0
- package/dist/chunk-47MFBHV6.js.map +1 -0
- package/dist/chunk-7A3IDIUB.cjs +89 -0
- package/dist/chunk-7A3IDIUB.cjs.map +1 -0
- package/dist/chunk-AZFZWGI6.cjs +383 -0
- package/dist/chunk-AZFZWGI6.cjs.map +1 -0
- package/dist/chunk-CTW5D77X.cjs +220 -0
- package/dist/chunk-CTW5D77X.cjs.map +1 -0
- package/dist/chunk-EY73HQNR.js +380 -0
- package/dist/chunk-EY73HQNR.js.map +1 -0
- package/dist/chunk-FJABCNFE.js +215 -0
- package/dist/chunk-FJABCNFE.js.map +1 -0
- package/dist/chunk-FTZ5KCOO.js +326 -0
- package/dist/chunk-FTZ5KCOO.js.map +1 -0
- package/dist/chunk-GS3H4T2O.cjs +106 -0
- package/dist/chunk-GS3H4T2O.cjs.map +1 -0
- package/dist/chunk-N6L4GLFC.cjs +45 -0
- package/dist/chunk-N6L4GLFC.cjs.map +1 -0
- package/dist/chunk-N774QCHE.js +234 -0
- package/dist/chunk-N774QCHE.js.map +1 -0
- package/dist/chunk-OSHIYZCZ.cjs +386 -0
- package/dist/chunk-OSHIYZCZ.cjs.map +1 -0
- package/dist/chunk-SRJSGDIA.js +373 -0
- package/dist/chunk-SRJSGDIA.js.map +1 -0
- package/dist/chunk-THB5U7YC.cjs +338 -0
- package/dist/chunk-THB5U7YC.cjs.map +1 -0
- package/dist/chunk-U6DUSMEA.js +99 -0
- package/dist/chunk-U6DUSMEA.js.map +1 -0
- package/dist/chunk-WDCYEMBO.cjs +245 -0
- package/dist/chunk-WDCYEMBO.cjs.map +1 -0
- package/dist/components/combobox/index.cjs +31 -0
- package/dist/components/combobox/index.cjs.map +1 -0
- package/dist/components/combobox/index.d.cts +55 -0
- package/dist/components/combobox/index.d.ts +55 -0
- package/dist/components/combobox/index.js +6 -0
- package/dist/components/combobox/index.js.map +1 -0
- package/dist/components/dialog/index.cjs +46 -0
- package/dist/components/dialog/index.cjs.map +1 -0
- package/dist/components/dialog/index.d.cts +84 -0
- package/dist/components/dialog/index.d.ts +84 -0
- package/dist/components/dialog/index.js +5 -0
- package/dist/components/dialog/index.js.map +1 -0
- package/dist/components/menu/index.cjs +46 -0
- package/dist/components/menu/index.cjs.map +1 -0
- package/dist/components/menu/index.d.cts +80 -0
- package/dist/components/menu/index.d.ts +80 -0
- package/dist/components/menu/index.js +5 -0
- package/dist/components/menu/index.js.map +1 -0
- package/dist/components/tabs/index.cjs +35 -0
- package/dist/components/tabs/index.cjs.map +1 -0
- package/dist/components/tabs/index.d.cts +65 -0
- package/dist/components/tabs/index.d.ts +65 -0
- package/dist/components/tabs/index.js +6 -0
- package/dist/components/tabs/index.js.map +1 -0
- package/dist/components/toast/index.cjs +24 -0
- package/dist/components/toast/index.cjs.map +1 -0
- package/dist/components/toast/index.d.cts +49 -0
- package/dist/components/toast/index.d.ts +49 -0
- package/dist/components/toast/index.js +3 -0
- package/dist/components/toast/index.js.map +1 -0
- package/dist/index.cjs +698 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +402 -0
- package/dist/index.d.ts +402 -0
- package/dist/index.js +426 -0
- package/dist/index.js.map +1 -0
- package/package.json +89 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk7A3IDIUB_cjs = require('./chunk-7A3IDIUB.cjs');
|
|
4
|
+
var chunkGS3H4T2O_cjs = require('./chunk-GS3H4T2O.cjs');
|
|
5
|
+
var chunkN6L4GLFC_cjs = require('./chunk-N6L4GLFC.cjs');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
|
|
9
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
|
|
11
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
12
|
+
|
|
13
|
+
var TabsContext = React.createContext(null);
|
|
14
|
+
function useTabsContext() {
|
|
15
|
+
const context = React.useContext(TabsContext);
|
|
16
|
+
if (!context) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
"Tabs compound components must be used within a Tabs component"
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
return context;
|
|
22
|
+
}
|
|
23
|
+
var TabsProvider = TabsContext.Provider;
|
|
24
|
+
var Tabs = React.forwardRef(function Tabs2({
|
|
25
|
+
defaultValue = "",
|
|
26
|
+
value: controlledValue,
|
|
27
|
+
onValueChange,
|
|
28
|
+
orientation = "horizontal",
|
|
29
|
+
activationMode = "automatic",
|
|
30
|
+
children,
|
|
31
|
+
...props
|
|
32
|
+
}, ref) {
|
|
33
|
+
const [uncontrolledValue, setUncontrolledValue] = React.useState(defaultValue);
|
|
34
|
+
const selectedValue = controlledValue ?? uncontrolledValue;
|
|
35
|
+
const tabsRef = React.useRef([]);
|
|
36
|
+
const baseId = chunkN6L4GLFC_cjs.useId("tabs");
|
|
37
|
+
const setSelectedValue = React.useCallback(
|
|
38
|
+
(value) => {
|
|
39
|
+
if (controlledValue === void 0) {
|
|
40
|
+
setUncontrolledValue(value);
|
|
41
|
+
}
|
|
42
|
+
onValueChange?.(value);
|
|
43
|
+
},
|
|
44
|
+
[controlledValue, onValueChange]
|
|
45
|
+
);
|
|
46
|
+
const registerTab = React.useCallback((value) => {
|
|
47
|
+
if (!tabsRef.current.includes(value)) {
|
|
48
|
+
tabsRef.current.push(value);
|
|
49
|
+
}
|
|
50
|
+
}, []);
|
|
51
|
+
const unregisterTab = React.useCallback((value) => {
|
|
52
|
+
const index = tabsRef.current.indexOf(value);
|
|
53
|
+
if (index > -1) {
|
|
54
|
+
tabsRef.current.splice(index, 1);
|
|
55
|
+
}
|
|
56
|
+
}, []);
|
|
57
|
+
const getTabValues = React.useCallback(() => [...tabsRef.current], []);
|
|
58
|
+
const contextValue = {
|
|
59
|
+
selectedValue,
|
|
60
|
+
setSelectedValue,
|
|
61
|
+
baseId,
|
|
62
|
+
orientation,
|
|
63
|
+
activationMode,
|
|
64
|
+
registerTab,
|
|
65
|
+
unregisterTab,
|
|
66
|
+
getTabValues
|
|
67
|
+
};
|
|
68
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TabsProvider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
69
|
+
"div",
|
|
70
|
+
{
|
|
71
|
+
ref,
|
|
72
|
+
"data-orientation": orientation,
|
|
73
|
+
"data-a11y-core-tabs": true,
|
|
74
|
+
...props,
|
|
75
|
+
children
|
|
76
|
+
}
|
|
77
|
+
) });
|
|
78
|
+
});
|
|
79
|
+
var TabList = React.forwardRef(
|
|
80
|
+
function TabList2({ children, "aria-label": ariaLabel, onKeyDown, ...props }, ref) {
|
|
81
|
+
const {
|
|
82
|
+
orientation,
|
|
83
|
+
selectedValue,
|
|
84
|
+
setSelectedValue,
|
|
85
|
+
getTabValues,
|
|
86
|
+
activationMode
|
|
87
|
+
} = useTabsContext();
|
|
88
|
+
const navigateToTab = React.useCallback(
|
|
89
|
+
(direction) => {
|
|
90
|
+
const values = getTabValues();
|
|
91
|
+
if (values.length === 0) return;
|
|
92
|
+
const currentIndex = values.indexOf(selectedValue);
|
|
93
|
+
let newIndex;
|
|
94
|
+
switch (direction) {
|
|
95
|
+
case "next":
|
|
96
|
+
newIndex = (currentIndex + 1) % values.length;
|
|
97
|
+
break;
|
|
98
|
+
case "previous":
|
|
99
|
+
newIndex = (currentIndex - 1 + values.length) % values.length;
|
|
100
|
+
break;
|
|
101
|
+
case "first":
|
|
102
|
+
newIndex = 0;
|
|
103
|
+
break;
|
|
104
|
+
case "last":
|
|
105
|
+
newIndex = values.length - 1;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
const newValue = values[newIndex];
|
|
109
|
+
if (newValue) {
|
|
110
|
+
const tabElement = document.querySelector(
|
|
111
|
+
`[data-a11y-core-tab][data-value="${newValue}"]`
|
|
112
|
+
);
|
|
113
|
+
tabElement?.focus();
|
|
114
|
+
if (activationMode === "automatic") {
|
|
115
|
+
setSelectedValue(newValue);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
[getTabValues, selectedValue, setSelectedValue, activationMode]
|
|
120
|
+
);
|
|
121
|
+
const keyboardProps = chunkGS3H4T2O_cjs.useKeyboard(
|
|
122
|
+
{
|
|
123
|
+
ArrowRight: () => {
|
|
124
|
+
if (orientation === "horizontal") navigateToTab("next");
|
|
125
|
+
},
|
|
126
|
+
ArrowLeft: () => {
|
|
127
|
+
if (orientation === "horizontal") navigateToTab("previous");
|
|
128
|
+
},
|
|
129
|
+
ArrowDown: () => {
|
|
130
|
+
if (orientation === "vertical") navigateToTab("next");
|
|
131
|
+
},
|
|
132
|
+
ArrowUp: () => {
|
|
133
|
+
if (orientation === "vertical") navigateToTab("previous");
|
|
134
|
+
},
|
|
135
|
+
Home: () => navigateToTab("first"),
|
|
136
|
+
End: () => navigateToTab("last")
|
|
137
|
+
},
|
|
138
|
+
{ preventDefault: true }
|
|
139
|
+
);
|
|
140
|
+
const handleKeyDown = (event) => {
|
|
141
|
+
onKeyDown?.(event);
|
|
142
|
+
if (!event.defaultPrevented) {
|
|
143
|
+
keyboardProps.onKeyDown(event);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
147
|
+
"div",
|
|
148
|
+
{
|
|
149
|
+
ref,
|
|
150
|
+
role: "tablist",
|
|
151
|
+
"aria-label": ariaLabel,
|
|
152
|
+
"aria-orientation": orientation,
|
|
153
|
+
onKeyDown: handleKeyDown,
|
|
154
|
+
"data-a11y-core-tablist": true,
|
|
155
|
+
...props,
|
|
156
|
+
children
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
var Tab = React.forwardRef(function Tab2({ value, disabled = false, children, onClick, ...props }, ref) {
|
|
162
|
+
const {
|
|
163
|
+
selectedValue,
|
|
164
|
+
setSelectedValue,
|
|
165
|
+
baseId,
|
|
166
|
+
registerTab,
|
|
167
|
+
unregisterTab
|
|
168
|
+
} = useTabsContext();
|
|
169
|
+
const { announce } = chunk7A3IDIUB_cjs.useAnnouncer();
|
|
170
|
+
React__default.default.useEffect(() => {
|
|
171
|
+
registerTab(value);
|
|
172
|
+
return () => unregisterTab(value);
|
|
173
|
+
}, [value, registerTab, unregisterTab]);
|
|
174
|
+
const isSelected = selectedValue === value;
|
|
175
|
+
const tabId = `${baseId}-tab-${value}`;
|
|
176
|
+
const panelId = `${baseId}-panel-${value}`;
|
|
177
|
+
const handleClick = (event) => {
|
|
178
|
+
onClick?.(event);
|
|
179
|
+
if (!event.defaultPrevented && !disabled) {
|
|
180
|
+
setSelectedValue(value);
|
|
181
|
+
announce(`${value} tab selected`);
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
185
|
+
"button",
|
|
186
|
+
{
|
|
187
|
+
ref,
|
|
188
|
+
type: "button",
|
|
189
|
+
role: "tab",
|
|
190
|
+
id: tabId,
|
|
191
|
+
"aria-selected": isSelected,
|
|
192
|
+
"aria-controls": panelId,
|
|
193
|
+
"aria-disabled": disabled,
|
|
194
|
+
tabIndex: isSelected ? 0 : -1,
|
|
195
|
+
onClick: handleClick,
|
|
196
|
+
disabled,
|
|
197
|
+
"data-selected": isSelected,
|
|
198
|
+
"data-disabled": disabled,
|
|
199
|
+
"data-value": value,
|
|
200
|
+
"data-a11y-core-tab": true,
|
|
201
|
+
...props,
|
|
202
|
+
children
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
});
|
|
206
|
+
var TabPanel = React.forwardRef(
|
|
207
|
+
function TabPanel2({ value, forceMount = false, children, ...props }, ref) {
|
|
208
|
+
const { selectedValue, baseId } = useTabsContext();
|
|
209
|
+
const isSelected = selectedValue === value;
|
|
210
|
+
const tabId = `${baseId}-tab-${value}`;
|
|
211
|
+
const panelId = `${baseId}-panel-${value}`;
|
|
212
|
+
if (!isSelected && !forceMount) {
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
216
|
+
"div",
|
|
217
|
+
{
|
|
218
|
+
ref,
|
|
219
|
+
role: "tabpanel",
|
|
220
|
+
id: panelId,
|
|
221
|
+
"aria-labelledby": tabId,
|
|
222
|
+
tabIndex: 0,
|
|
223
|
+
hidden: !isSelected,
|
|
224
|
+
"data-selected": isSelected,
|
|
225
|
+
"data-a11y-core-tabpanel": true,
|
|
226
|
+
...props,
|
|
227
|
+
children
|
|
228
|
+
}
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
);
|
|
232
|
+
var TabsCompound = Object.assign(Tabs, {
|
|
233
|
+
List: TabList,
|
|
234
|
+
Tab,
|
|
235
|
+
Panel: TabPanel
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
exports.Tab = Tab;
|
|
239
|
+
exports.TabList = TabList;
|
|
240
|
+
exports.TabPanel = TabPanel;
|
|
241
|
+
exports.Tabs = Tabs;
|
|
242
|
+
exports.TabsCompound = TabsCompound;
|
|
243
|
+
exports.useTabsContext = useTabsContext;
|
|
244
|
+
//# sourceMappingURL=chunk-WDCYEMBO.cjs.map
|
|
245
|
+
//# sourceMappingURL=chunk-WDCYEMBO.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/tabs/tabs-context.ts","../src/components/tabs/tabs.tsx"],"names":["createContext","useContext","forwardRef","Tabs","useState","useRef","useId","useCallback","jsx","TabList","useKeyboard","Tab","useAnnouncer","React","TabPanel"],"mappings":";;;;;;;;;;;;AAqBA,IAAM,WAAA,GAAcA,oBAAuC,IAAI,CAAA;AAEx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SAAAA,CAAS,EAAE,KAAA,EAAO,UAAA,GAAa,OAAO,QAAA,EAAU,GAAG,KAAA,EAAM,EAAG,GAAA,EAAK;AACxE,IAAA,MAAM,EAAE,aAAA,EAAe,MAAA,EAAO,GAAI,cAAA,EAAe;AAEjD,IAAA,MAAM,aAAa,aAAA,KAAkB,KAAA;AACrC,IAAA,MAAM,KAAA,GAAQ,CAAA,EAAG,MAAM,CAAA,KAAA,EAAQ,KAAK,CAAA,CAAA;AACpC,IAAA,MAAM,OAAA,GAAU,CAAA,EAAG,MAAM,CAAA,OAAA,EAAU,KAAK,CAAA,CAAA;AAExC,IAAA,IAAI,CAAC,UAAA,IAAc,CAAC,UAAA,EAAY;AAC9B,MAAA,OAAO,IAAA;AAAA,IACT;AAEA,IAAA,uBACEN,cAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,GAAA;AAAA,QACA,IAAA,EAAK,UAAA;AAAA,QACL,EAAA,EAAI,OAAA;AAAA,QACJ,iBAAA,EAAiB,KAAA;AAAA,QACjB,QAAA,EAAU,CAAA;AAAA,QACV,QAAQ,CAAC,UAAA;AAAA,QACT,eAAA,EAAe,UAAA;AAAA,QACf,yBAAA,EAAuB,IAAA;AAAA,QACtB,GAAG,KAAA;AAAA,QAEH;AAAA;AAAA,KACH;AAAA,EAEJ;AACF;AAEO,IAAM,YAAA,GAAe,MAAA,CAAO,MAAA,CAAO,IAAA,EAAM;AAAA,EAC9C,IAAA,EAAM,OAAA;AAAA,EACN,GAAA;AAAA,EACA,KAAA,EAAO;AACT,CAAC","file":"chunk-WDCYEMBO.cjs","sourcesContent":["import { createContext, useContext } from 'react';\n\nexport interface TabsContextValue {\n /** Currently selected tab value */\n selectedValue: string;\n /** Change selected tab */\n setSelectedValue: (value: string) => void;\n /** Base ID for ARIA relationships */\n baseId: string;\n /** Orientation of tabs */\n orientation: 'horizontal' | 'vertical';\n /** Whether tabs are activated on focus or on click */\n activationMode: 'automatic' | 'manual';\n /** Register a tab */\n registerTab: (value: string) => void;\n /** Unregister a tab */\n unregisterTab: (value: string) => void;\n /** Get all tab values */\n getTabValues: () => string[];\n}\n\nconst TabsContext = createContext<TabsContextValue | null>(null);\n\nexport function useTabsContext(): TabsContextValue {\n const context = useContext(TabsContext);\n if (!context) {\n throw new Error(\n 'Tabs compound components must be used within a Tabs component'\n );\n }\n return context;\n}\n\nexport const TabsProvider = TabsContext.Provider;\n","import React, { forwardRef, useCallback, useRef, useState } from 'react';\nimport { useId } from '../../hooks/use-id';\nimport { useKeyboard } from '../../hooks/use-keyboard';\nimport { useAnnouncer } from '../../hooks/use-announcer';\nimport {\n TabsProvider,\n useTabsContext,\n type TabsContextValue,\n} from './tabs-context';\n\nexport interface TabsProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Default selected tab value */\n defaultValue?: string;\n /** Controlled selected value */\n value?: string;\n /** Called when selection changes */\n onValueChange?: (value: string) => void;\n /** Orientation of tabs */\n orientation?: 'horizontal' | 'vertical';\n /** Activation mode */\n activationMode?: 'automatic' | 'manual';\n children: React.ReactNode;\n}\n\nexport const Tabs = forwardRef<HTMLDivElement, TabsProps>(function Tabs(\n {\n defaultValue = '',\n value: controlledValue,\n onValueChange,\n orientation = 'horizontal',\n activationMode = 'automatic',\n children,\n ...props\n },\n ref\n) {\n const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);\n const selectedValue = controlledValue ?? uncontrolledValue;\n const tabsRef = useRef<string[]>([]);\n const baseId = useId('tabs');\n\n const setSelectedValue = useCallback(\n (value: string) => {\n if (controlledValue === undefined) {\n setUncontrolledValue(value);\n }\n onValueChange?.(value);\n },\n [controlledValue, onValueChange]\n );\n\n const registerTab = useCallback((value: string) => {\n if (!tabsRef.current.includes(value)) {\n tabsRef.current.push(value);\n }\n }, []);\n\n const unregisterTab = useCallback((value: string) => {\n const index = tabsRef.current.indexOf(value);\n if (index > -1) {\n tabsRef.current.splice(index, 1);\n }\n }, []);\n\n const getTabValues = useCallback(() => [...tabsRef.current], []);\n\n const contextValue: TabsContextValue = {\n selectedValue,\n setSelectedValue,\n baseId,\n orientation,\n activationMode,\n registerTab,\n unregisterTab,\n getTabValues,\n };\n\n return (\n <TabsProvider value={contextValue}>\n <div\n ref={ref}\n data-orientation={orientation}\n data-a11y-core-tabs\n {...props}\n >\n {children}\n </div>\n </TabsProvider>\n );\n});\n\nexport interface TabListProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Accessible label for the tab list */\n 'aria-label'?: string;\n children: React.ReactNode;\n}\n\nexport const TabList = forwardRef<HTMLDivElement, TabListProps>(\n function TabList(\n { children, 'aria-label': ariaLabel, onKeyDown, ...props },\n ref\n ) {\n const {\n orientation,\n selectedValue,\n setSelectedValue,\n getTabValues,\n activationMode,\n } = useTabsContext();\n\n const navigateToTab = useCallback(\n (direction: 'next' | 'previous' | 'first' | 'last') => {\n const values = getTabValues();\n if (values.length === 0) return;\n\n const currentIndex = values.indexOf(selectedValue);\n let newIndex: number;\n\n switch (direction) {\n case 'next':\n newIndex = (currentIndex + 1) % values.length;\n break;\n case 'previous':\n newIndex = (currentIndex - 1 + values.length) % values.length;\n break;\n case 'first':\n newIndex = 0;\n break;\n case 'last':\n newIndex = values.length - 1;\n break;\n }\n\n const newValue = values[newIndex];\n if (newValue) {\n const tabElement = document.querySelector(\n `[data-a11y-core-tab][data-value=\"${newValue}\"]`\n ) as HTMLElement;\n tabElement?.focus();\n\n if (activationMode === 'automatic') {\n setSelectedValue(newValue);\n }\n }\n },\n [getTabValues, selectedValue, setSelectedValue, activationMode]\n );\n\n const keyboardProps = useKeyboard(\n {\n ArrowRight: () => {\n if (orientation === 'horizontal') navigateToTab('next');\n },\n ArrowLeft: () => {\n if (orientation === 'horizontal') navigateToTab('previous');\n },\n ArrowDown: () => {\n if (orientation === 'vertical') navigateToTab('next');\n },\n ArrowUp: () => {\n if (orientation === 'vertical') navigateToTab('previous');\n },\n Home: () => navigateToTab('first'),\n End: () => navigateToTab('last'),\n },\n { preventDefault: true }\n );\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n if (!event.defaultPrevented) {\n keyboardProps.onKeyDown(event);\n }\n };\n\n return (\n <div\n ref={ref}\n role=\"tablist\"\n aria-label={ariaLabel}\n aria-orientation={orientation}\n onKeyDown={handleKeyDown}\n data-a11y-core-tablist\n {...props}\n >\n {children}\n </div>\n );\n }\n);\n\nexport interface TabProps extends Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n 'value'\n> {\n /** Value identifying this tab */\n value: string;\n /** Whether the tab is disabled */\n disabled?: boolean;\n children: React.ReactNode;\n}\n\nexport const Tab = forwardRef<HTMLButtonElement, TabProps>(function Tab(\n { value, disabled = false, children, onClick, ...props },\n ref\n) {\n const {\n selectedValue,\n setSelectedValue,\n baseId,\n registerTab,\n unregisterTab,\n } = useTabsContext();\n const { announce } = useAnnouncer();\n\n React.useEffect(() => {\n registerTab(value);\n return () => unregisterTab(value);\n }, [value, registerTab, unregisterTab]);\n\n const isSelected = selectedValue === value;\n const tabId = `${baseId}-tab-${value}`;\n const panelId = `${baseId}-panel-${value}`;\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (!event.defaultPrevented && !disabled) {\n setSelectedValue(value);\n announce(`${value} tab selected`);\n }\n };\n\n return (\n <button\n ref={ref}\n type=\"button\"\n role=\"tab\"\n id={tabId}\n aria-selected={isSelected}\n aria-controls={panelId}\n aria-disabled={disabled}\n tabIndex={isSelected ? 0 : -1}\n onClick={handleClick}\n disabled={disabled}\n data-selected={isSelected}\n data-disabled={disabled}\n data-value={value}\n data-a11y-core-tab\n {...props}\n >\n {children}\n </button>\n );\n});\n\nexport interface TabPanelProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Value identifying this panel (must match a Tab value) */\n value: string;\n /** Whether to keep panel mounted when not selected */\n forceMount?: boolean;\n children: React.ReactNode;\n}\n\nexport const TabPanel = forwardRef<HTMLDivElement, TabPanelProps>(\n function TabPanel({ value, forceMount = false, children, ...props }, ref) {\n const { selectedValue, baseId } = useTabsContext();\n\n const isSelected = selectedValue === value;\n const tabId = `${baseId}-tab-${value}`;\n const panelId = `${baseId}-panel-${value}`;\n\n if (!isSelected && !forceMount) {\n return null;\n }\n\n return (\n <div\n ref={ref}\n role=\"tabpanel\"\n id={panelId}\n aria-labelledby={tabId}\n tabIndex={0}\n hidden={!isSelected}\n data-selected={isSelected}\n data-a11y-core-tabpanel\n {...props}\n >\n {children}\n </div>\n );\n }\n);\n\nexport const TabsCompound = Object.assign(Tabs, {\n List: TabList,\n Tab: Tab,\n Panel: TabPanel,\n});\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkOSHIYZCZ_cjs = require('../../chunk-OSHIYZCZ.cjs');
|
|
4
|
+
require('../../chunk-7A3IDIUB.cjs');
|
|
5
|
+
require('../../chunk-GS3H4T2O.cjs');
|
|
6
|
+
require('../../chunk-N6L4GLFC.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, "Combobox", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () { return chunkOSHIYZCZ_cjs.Combobox; }
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(exports, "ComboboxCompound", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return chunkOSHIYZCZ_cjs.ComboboxCompound; }
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "ComboboxInput", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () { return chunkOSHIYZCZ_cjs.ComboboxInput; }
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(exports, "ComboboxListbox", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () { return chunkOSHIYZCZ_cjs.ComboboxListbox; }
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(exports, "ComboboxOption", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () { return chunkOSHIYZCZ_cjs.ComboboxOption; }
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=index.cjs.map
|
|
31
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
|
|
4
|
+
interface ComboboxProps {
|
|
5
|
+
/** List of options */
|
|
6
|
+
options: ComboboxOption[];
|
|
7
|
+
/** Currently selected value */
|
|
8
|
+
value?: string | null;
|
|
9
|
+
/** Called when selection changes */
|
|
10
|
+
onValueChange?: (value: string | null) => void;
|
|
11
|
+
/** Called when input changes */
|
|
12
|
+
onInputChange?: (value: string) => void;
|
|
13
|
+
/** Default input value */
|
|
14
|
+
defaultInputValue?: string;
|
|
15
|
+
/** Whether the combobox is disabled */
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/** Placeholder text */
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
/** Custom filter function */
|
|
20
|
+
filterFn?: (option: ComboboxOption, inputValue: string) => boolean;
|
|
21
|
+
/** Accessible label */
|
|
22
|
+
'aria-label'?: string;
|
|
23
|
+
/** ID of labelling element */
|
|
24
|
+
'aria-labelledby'?: string;
|
|
25
|
+
children: React__default.ReactNode;
|
|
26
|
+
}
|
|
27
|
+
declare function Combobox({ options, value: controlledValue, onValueChange, onInputChange, defaultInputValue, disabled, filterFn, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, children, }: ComboboxProps): react_jsx_runtime.JSX.Element;
|
|
28
|
+
interface ComboboxInputProps extends Omit<React__default.InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange'> {
|
|
29
|
+
/** Show clear button */
|
|
30
|
+
clearable?: boolean;
|
|
31
|
+
}
|
|
32
|
+
declare const ComboboxInput: React__default.ForwardRefExoticComponent<ComboboxInputProps & React__default.RefAttributes<HTMLInputElement>>;
|
|
33
|
+
interface ComboboxListboxProps extends React__default.HTMLAttributes<HTMLUListElement> {
|
|
34
|
+
/** Render when no options match */
|
|
35
|
+
emptyMessage?: React__default.ReactNode;
|
|
36
|
+
children?: React__default.ReactNode;
|
|
37
|
+
}
|
|
38
|
+
declare const ComboboxListbox: React__default.ForwardRefExoticComponent<ComboboxListboxProps & React__default.RefAttributes<HTMLUListElement>>;
|
|
39
|
+
interface ComboboxOptionProps extends React__default.LiHTMLAttributes<HTMLLIElement> {
|
|
40
|
+
option: ComboboxOption;
|
|
41
|
+
index: number;
|
|
42
|
+
}
|
|
43
|
+
interface ComboboxOption {
|
|
44
|
+
value: string;
|
|
45
|
+
label: string;
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
}
|
|
48
|
+
declare const ComboboxOption: React__default.ForwardRefExoticComponent<ComboboxOptionProps & React__default.RefAttributes<HTMLLIElement>>;
|
|
49
|
+
declare const ComboboxCompound: typeof Combobox & {
|
|
50
|
+
Input: React__default.ForwardRefExoticComponent<ComboboxInputProps & React__default.RefAttributes<HTMLInputElement>>;
|
|
51
|
+
Listbox: React__default.ForwardRefExoticComponent<ComboboxListboxProps & React__default.RefAttributes<HTMLUListElement>>;
|
|
52
|
+
Option: React__default.ForwardRefExoticComponent<ComboboxOptionProps & React__default.RefAttributes<HTMLLIElement>>;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export { Combobox, ComboboxCompound, ComboboxInput, type ComboboxInputProps, ComboboxListbox, type ComboboxListboxProps, ComboboxOption, type ComboboxOptionProps, ComboboxOption as ComboboxOptionType, type ComboboxProps };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
|
|
4
|
+
interface ComboboxProps {
|
|
5
|
+
/** List of options */
|
|
6
|
+
options: ComboboxOption[];
|
|
7
|
+
/** Currently selected value */
|
|
8
|
+
value?: string | null;
|
|
9
|
+
/** Called when selection changes */
|
|
10
|
+
onValueChange?: (value: string | null) => void;
|
|
11
|
+
/** Called when input changes */
|
|
12
|
+
onInputChange?: (value: string) => void;
|
|
13
|
+
/** Default input value */
|
|
14
|
+
defaultInputValue?: string;
|
|
15
|
+
/** Whether the combobox is disabled */
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/** Placeholder text */
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
/** Custom filter function */
|
|
20
|
+
filterFn?: (option: ComboboxOption, inputValue: string) => boolean;
|
|
21
|
+
/** Accessible label */
|
|
22
|
+
'aria-label'?: string;
|
|
23
|
+
/** ID of labelling element */
|
|
24
|
+
'aria-labelledby'?: string;
|
|
25
|
+
children: React__default.ReactNode;
|
|
26
|
+
}
|
|
27
|
+
declare function Combobox({ options, value: controlledValue, onValueChange, onInputChange, defaultInputValue, disabled, filterFn, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, children, }: ComboboxProps): react_jsx_runtime.JSX.Element;
|
|
28
|
+
interface ComboboxInputProps extends Omit<React__default.InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange'> {
|
|
29
|
+
/** Show clear button */
|
|
30
|
+
clearable?: boolean;
|
|
31
|
+
}
|
|
32
|
+
declare const ComboboxInput: React__default.ForwardRefExoticComponent<ComboboxInputProps & React__default.RefAttributes<HTMLInputElement>>;
|
|
33
|
+
interface ComboboxListboxProps extends React__default.HTMLAttributes<HTMLUListElement> {
|
|
34
|
+
/** Render when no options match */
|
|
35
|
+
emptyMessage?: React__default.ReactNode;
|
|
36
|
+
children?: React__default.ReactNode;
|
|
37
|
+
}
|
|
38
|
+
declare const ComboboxListbox: React__default.ForwardRefExoticComponent<ComboboxListboxProps & React__default.RefAttributes<HTMLUListElement>>;
|
|
39
|
+
interface ComboboxOptionProps extends React__default.LiHTMLAttributes<HTMLLIElement> {
|
|
40
|
+
option: ComboboxOption;
|
|
41
|
+
index: number;
|
|
42
|
+
}
|
|
43
|
+
interface ComboboxOption {
|
|
44
|
+
value: string;
|
|
45
|
+
label: string;
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
}
|
|
48
|
+
declare const ComboboxOption: React__default.ForwardRefExoticComponent<ComboboxOptionProps & React__default.RefAttributes<HTMLLIElement>>;
|
|
49
|
+
declare const ComboboxCompound: typeof Combobox & {
|
|
50
|
+
Input: React__default.ForwardRefExoticComponent<ComboboxInputProps & React__default.RefAttributes<HTMLInputElement>>;
|
|
51
|
+
Listbox: React__default.ForwardRefExoticComponent<ComboboxListboxProps & React__default.RefAttributes<HTMLUListElement>>;
|
|
52
|
+
Option: React__default.ForwardRefExoticComponent<ComboboxOptionProps & React__default.RefAttributes<HTMLLIElement>>;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export { Combobox, ComboboxCompound, ComboboxInput, type ComboboxInputProps, ComboboxListbox, type ComboboxListboxProps, ComboboxOption, type ComboboxOptionProps, ComboboxOption as ComboboxOptionType, type ComboboxProps };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Combobox, ComboboxCompound, ComboboxInput, ComboboxListbox, ComboboxOption } from '../../chunk-EY73HQNR.js';
|
|
2
|
+
import '../../chunk-47MFBHV6.js';
|
|
3
|
+
import '../../chunk-U6DUSMEA.js';
|
|
4
|
+
import '../../chunk-3WBTHTVK.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkTHB5U7YC_cjs = require('../../chunk-THB5U7YC.cjs');
|
|
4
|
+
require('../../chunk-7A3IDIUB.cjs');
|
|
5
|
+
require('../../chunk-N6L4GLFC.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "Dialog", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return chunkTHB5U7YC_cjs.Dialog; }
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "DialogActions", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return chunkTHB5U7YC_cjs.DialogActions; }
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "DialogClose", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return chunkTHB5U7YC_cjs.DialogClose; }
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports, "DialogCompound", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () { return chunkTHB5U7YC_cjs.DialogCompound; }
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "DialogContent", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () { return chunkTHB5U7YC_cjs.DialogContent; }
|
|
28
|
+
});
|
|
29
|
+
Object.defineProperty(exports, "DialogDescription", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () { return chunkTHB5U7YC_cjs.DialogDescription; }
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(exports, "DialogTitle", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () { return chunkTHB5U7YC_cjs.DialogTitle; }
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, "DialogTrigger", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () { return chunkTHB5U7YC_cjs.DialogTrigger; }
|
|
40
|
+
});
|
|
41
|
+
Object.defineProperty(exports, "useDialogContext", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () { return chunkTHB5U7YC_cjs.useDialogContext; }
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=index.cjs.map
|
|
46
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
interface DialogProps {
|
|
4
|
+
/** Whether the dialog is open */
|
|
5
|
+
open: boolean;
|
|
6
|
+
/** Called when the dialog should close */
|
|
7
|
+
onOpenChange: (open: boolean) => void;
|
|
8
|
+
/** The dialog content */
|
|
9
|
+
children: React__default.ReactNode;
|
|
10
|
+
/** Custom class name */
|
|
11
|
+
className?: string;
|
|
12
|
+
/** Element to focus when dialog opens */
|
|
13
|
+
initialFocus?: React__default.RefObject<HTMLElement>;
|
|
14
|
+
/** Whether clicking outside closes the dialog */
|
|
15
|
+
closeOnOutsideClick?: boolean;
|
|
16
|
+
/** Whether pressing Escape closes the dialog */
|
|
17
|
+
closeOnEscape?: boolean;
|
|
18
|
+
/** Portal container (defaults to document.body) */
|
|
19
|
+
container?: HTMLElement;
|
|
20
|
+
/** Accessible label (required if no DialogTitle) */
|
|
21
|
+
'aria-label'?: string;
|
|
22
|
+
/** ID of element that labels the dialog */
|
|
23
|
+
'aria-labelledby'?: string;
|
|
24
|
+
/** Remove default styles to allow full customization via className */
|
|
25
|
+
unstyled?: boolean;
|
|
26
|
+
}
|
|
27
|
+
declare function Dialog({ open, onOpenChange, children, className, initialFocus, closeOnOutsideClick, closeOnEscape, container, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, unstyled, }: DialogProps): React__default.ReactPortal | null;
|
|
28
|
+
interface DialogTriggerProps extends React__default.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
29
|
+
children: React__default.ReactNode;
|
|
30
|
+
}
|
|
31
|
+
declare const DialogTrigger: React__default.ForwardRefExoticComponent<DialogTriggerProps & React__default.RefAttributes<HTMLButtonElement>>;
|
|
32
|
+
interface DialogTitleProps extends React__default.HTMLAttributes<HTMLHeadingElement> {
|
|
33
|
+
as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
34
|
+
children: React__default.ReactNode;
|
|
35
|
+
}
|
|
36
|
+
declare const DialogTitle: React__default.ForwardRefExoticComponent<DialogTitleProps & React__default.RefAttributes<HTMLHeadingElement>>;
|
|
37
|
+
interface DialogDescriptionProps extends React__default.HTMLAttributes<HTMLParagraphElement> {
|
|
38
|
+
children: React__default.ReactNode;
|
|
39
|
+
}
|
|
40
|
+
declare const DialogDescription: React__default.ForwardRefExoticComponent<DialogDescriptionProps & React__default.RefAttributes<HTMLParagraphElement>>;
|
|
41
|
+
interface DialogCloseProps extends React__default.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
42
|
+
children?: React__default.ReactNode;
|
|
43
|
+
}
|
|
44
|
+
declare const DialogClose: React__default.ForwardRefExoticComponent<DialogCloseProps & React__default.RefAttributes<HTMLButtonElement>>;
|
|
45
|
+
interface DialogContentProps extends React__default.HTMLAttributes<HTMLDivElement> {
|
|
46
|
+
children: React__default.ReactNode;
|
|
47
|
+
}
|
|
48
|
+
declare const DialogContent: React__default.ForwardRefExoticComponent<DialogContentProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
49
|
+
interface DialogActionsProps extends React__default.HTMLAttributes<HTMLDivElement> {
|
|
50
|
+
children: React__default.ReactNode;
|
|
51
|
+
}
|
|
52
|
+
declare const DialogActions: React__default.ForwardRefExoticComponent<DialogActionsProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
53
|
+
declare const DialogCompound: typeof Dialog & {
|
|
54
|
+
Trigger: React__default.ForwardRefExoticComponent<DialogTriggerProps & React__default.RefAttributes<HTMLButtonElement>>;
|
|
55
|
+
Title: React__default.ForwardRefExoticComponent<DialogTitleProps & React__default.RefAttributes<HTMLHeadingElement>>;
|
|
56
|
+
Description: React__default.ForwardRefExoticComponent<DialogDescriptionProps & React__default.RefAttributes<HTMLParagraphElement>>;
|
|
57
|
+
Close: React__default.ForwardRefExoticComponent<DialogCloseProps & React__default.RefAttributes<HTMLButtonElement>>;
|
|
58
|
+
Content: React__default.ForwardRefExoticComponent<DialogContentProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
59
|
+
Actions: React__default.ForwardRefExoticComponent<DialogActionsProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
interface DialogContextValue {
|
|
63
|
+
/** Whether the dialog is open */
|
|
64
|
+
isOpen: boolean;
|
|
65
|
+
/** Close the dialog */
|
|
66
|
+
close: () => void;
|
|
67
|
+
/** ID for the dialog element */
|
|
68
|
+
dialogId: string;
|
|
69
|
+
/** ID for the title element */
|
|
70
|
+
titleId: string;
|
|
71
|
+
/** ID for the description element */
|
|
72
|
+
descriptionId: string;
|
|
73
|
+
/** Whether the dialog has a visible title */
|
|
74
|
+
hasTitle: boolean;
|
|
75
|
+
/** Whether the dialog has a visible description */
|
|
76
|
+
hasDescription: boolean;
|
|
77
|
+
/** Set whether title is rendered */
|
|
78
|
+
setHasTitle: (value: boolean) => void;
|
|
79
|
+
/** Set whether description is rendered */
|
|
80
|
+
setHasDescription: (value: boolean) => void;
|
|
81
|
+
}
|
|
82
|
+
declare function useDialogContext(): DialogContextValue;
|
|
83
|
+
|
|
84
|
+
export { Dialog, DialogActions, type DialogActionsProps, DialogClose, type DialogCloseProps, DialogCompound, DialogContent, type DialogContentProps, type DialogContextValue, DialogDescription, type DialogDescriptionProps, type DialogProps, DialogTitle, type DialogTitleProps, DialogTrigger, type DialogTriggerProps, useDialogContext };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
interface DialogProps {
|
|
4
|
+
/** Whether the dialog is open */
|
|
5
|
+
open: boolean;
|
|
6
|
+
/** Called when the dialog should close */
|
|
7
|
+
onOpenChange: (open: boolean) => void;
|
|
8
|
+
/** The dialog content */
|
|
9
|
+
children: React__default.ReactNode;
|
|
10
|
+
/** Custom class name */
|
|
11
|
+
className?: string;
|
|
12
|
+
/** Element to focus when dialog opens */
|
|
13
|
+
initialFocus?: React__default.RefObject<HTMLElement>;
|
|
14
|
+
/** Whether clicking outside closes the dialog */
|
|
15
|
+
closeOnOutsideClick?: boolean;
|
|
16
|
+
/** Whether pressing Escape closes the dialog */
|
|
17
|
+
closeOnEscape?: boolean;
|
|
18
|
+
/** Portal container (defaults to document.body) */
|
|
19
|
+
container?: HTMLElement;
|
|
20
|
+
/** Accessible label (required if no DialogTitle) */
|
|
21
|
+
'aria-label'?: string;
|
|
22
|
+
/** ID of element that labels the dialog */
|
|
23
|
+
'aria-labelledby'?: string;
|
|
24
|
+
/** Remove default styles to allow full customization via className */
|
|
25
|
+
unstyled?: boolean;
|
|
26
|
+
}
|
|
27
|
+
declare function Dialog({ open, onOpenChange, children, className, initialFocus, closeOnOutsideClick, closeOnEscape, container, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, unstyled, }: DialogProps): React__default.ReactPortal | null;
|
|
28
|
+
interface DialogTriggerProps extends React__default.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
29
|
+
children: React__default.ReactNode;
|
|
30
|
+
}
|
|
31
|
+
declare const DialogTrigger: React__default.ForwardRefExoticComponent<DialogTriggerProps & React__default.RefAttributes<HTMLButtonElement>>;
|
|
32
|
+
interface DialogTitleProps extends React__default.HTMLAttributes<HTMLHeadingElement> {
|
|
33
|
+
as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
34
|
+
children: React__default.ReactNode;
|
|
35
|
+
}
|
|
36
|
+
declare const DialogTitle: React__default.ForwardRefExoticComponent<DialogTitleProps & React__default.RefAttributes<HTMLHeadingElement>>;
|
|
37
|
+
interface DialogDescriptionProps extends React__default.HTMLAttributes<HTMLParagraphElement> {
|
|
38
|
+
children: React__default.ReactNode;
|
|
39
|
+
}
|
|
40
|
+
declare const DialogDescription: React__default.ForwardRefExoticComponent<DialogDescriptionProps & React__default.RefAttributes<HTMLParagraphElement>>;
|
|
41
|
+
interface DialogCloseProps extends React__default.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
42
|
+
children?: React__default.ReactNode;
|
|
43
|
+
}
|
|
44
|
+
declare const DialogClose: React__default.ForwardRefExoticComponent<DialogCloseProps & React__default.RefAttributes<HTMLButtonElement>>;
|
|
45
|
+
interface DialogContentProps extends React__default.HTMLAttributes<HTMLDivElement> {
|
|
46
|
+
children: React__default.ReactNode;
|
|
47
|
+
}
|
|
48
|
+
declare const DialogContent: React__default.ForwardRefExoticComponent<DialogContentProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
49
|
+
interface DialogActionsProps extends React__default.HTMLAttributes<HTMLDivElement> {
|
|
50
|
+
children: React__default.ReactNode;
|
|
51
|
+
}
|
|
52
|
+
declare const DialogActions: React__default.ForwardRefExoticComponent<DialogActionsProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
53
|
+
declare const DialogCompound: typeof Dialog & {
|
|
54
|
+
Trigger: React__default.ForwardRefExoticComponent<DialogTriggerProps & React__default.RefAttributes<HTMLButtonElement>>;
|
|
55
|
+
Title: React__default.ForwardRefExoticComponent<DialogTitleProps & React__default.RefAttributes<HTMLHeadingElement>>;
|
|
56
|
+
Description: React__default.ForwardRefExoticComponent<DialogDescriptionProps & React__default.RefAttributes<HTMLParagraphElement>>;
|
|
57
|
+
Close: React__default.ForwardRefExoticComponent<DialogCloseProps & React__default.RefAttributes<HTMLButtonElement>>;
|
|
58
|
+
Content: React__default.ForwardRefExoticComponent<DialogContentProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
59
|
+
Actions: React__default.ForwardRefExoticComponent<DialogActionsProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
interface DialogContextValue {
|
|
63
|
+
/** Whether the dialog is open */
|
|
64
|
+
isOpen: boolean;
|
|
65
|
+
/** Close the dialog */
|
|
66
|
+
close: () => void;
|
|
67
|
+
/** ID for the dialog element */
|
|
68
|
+
dialogId: string;
|
|
69
|
+
/** ID for the title element */
|
|
70
|
+
titleId: string;
|
|
71
|
+
/** ID for the description element */
|
|
72
|
+
descriptionId: string;
|
|
73
|
+
/** Whether the dialog has a visible title */
|
|
74
|
+
hasTitle: boolean;
|
|
75
|
+
/** Whether the dialog has a visible description */
|
|
76
|
+
hasDescription: boolean;
|
|
77
|
+
/** Set whether title is rendered */
|
|
78
|
+
setHasTitle: (value: boolean) => void;
|
|
79
|
+
/** Set whether description is rendered */
|
|
80
|
+
setHasDescription: (value: boolean) => void;
|
|
81
|
+
}
|
|
82
|
+
declare function useDialogContext(): DialogContextValue;
|
|
83
|
+
|
|
84
|
+
export { Dialog, DialogActions, type DialogActionsProps, DialogClose, type DialogCloseProps, DialogCompound, DialogContent, type DialogContentProps, type DialogContextValue, DialogDescription, type DialogDescriptionProps, type DialogProps, DialogTitle, type DialogTitleProps, DialogTrigger, type DialogTriggerProps, useDialogContext };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { Dialog, DialogActions, DialogClose, DialogCompound, DialogContent, DialogDescription, DialogTitle, DialogTrigger, useDialogContext } from '../../chunk-FTZ5KCOO.js';
|
|
2
|
+
import '../../chunk-47MFBHV6.js';
|
|
3
|
+
import '../../chunk-3WBTHTVK.js';
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
5
|
+
//# sourceMappingURL=index.js.map
|