@luxfi/ui 7.4.10 → 7.4.12
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/accordion.cjs +107 -166
- package/dist/accordion.d.cts +18 -51
- package/dist/accordion.d.ts +18 -51
- package/dist/accordion.js +109 -166
- package/dist/alert.cjs +68 -46
- package/dist/alert.js +69 -46
- package/dist/avatar.cjs +49 -46
- package/dist/avatar.js +52 -48
- package/dist/badge.cjs +82 -49
- package/dist/badge.js +83 -50
- package/dist/checkbox.cjs +42 -75
- package/dist/checkbox.js +43 -76
- package/dist/chrome.cjs +196 -386
- package/dist/chrome.js +198 -386
- package/dist/close-button.cjs +3 -7
- package/dist/close-button.js +3 -7
- package/dist/collapsible.cjs +35 -26
- package/dist/collapsible.d.cts +2 -1
- package/dist/collapsible.d.ts +2 -1
- package/dist/collapsible.js +34 -24
- package/dist/dialog.cjs +3 -7
- package/dist/dialog.d.cts +1 -1
- package/dist/dialog.d.ts +1 -1
- package/dist/dialog.js +3 -7
- package/dist/drawer.cjs +95 -122
- package/dist/drawer.d.cts +43 -10
- package/dist/drawer.d.ts +43 -10
- package/dist/drawer.js +97 -122
- package/dist/empty-state.cjs +13 -13
- package/dist/empty-state.js +13 -13
- package/dist/expiration-selector.cjs +58 -63
- package/dist/expiration-selector.js +58 -63
- package/dist/field.cjs +60 -109
- package/dist/field.d.cts +0 -1
- package/dist/field.d.ts +0 -1
- package/dist/field.js +61 -109
- package/dist/greeks-display.cjs +48 -39
- package/dist/greeks-display.js +48 -39
- package/dist/heading.cjs +10 -17
- package/dist/heading.d.cts +0 -2
- package/dist/heading.d.ts +0 -2
- package/dist/heading.js +10 -17
- package/dist/icon-button.cjs +82 -82
- package/dist/icon-button.d.cts +16 -12
- package/dist/icon-button.d.ts +16 -12
- package/dist/icon-button.js +82 -82
- package/dist/index.cjs +1812 -2105
- package/dist/index.d.cts +1 -5
- package/dist/index.d.ts +1 -5
- package/dist/index.js +1814 -2100
- package/dist/input-group.cjs +11 -12
- package/dist/input-group.js +11 -12
- package/dist/input.cjs +27 -27
- package/dist/input.d.cts +21 -1
- package/dist/input.d.ts +21 -1
- package/dist/input.js +25 -28
- package/dist/menu.cjs +160 -271
- package/dist/menu.d.cts +41 -57
- package/dist/menu.d.ts +41 -57
- package/dist/menu.js +161 -251
- package/dist/option-chain.cjs +89 -67
- package/dist/option-chain.js +89 -67
- package/dist/option-position.cjs +88 -85
- package/dist/option-position.js +88 -85
- package/dist/pnl-diagram.cjs +20 -20
- package/dist/pnl-diagram.js +20 -20
- package/dist/popover.cjs +4 -8
- package/dist/popover.js +4 -8
- package/dist/progress.cjs +15 -22
- package/dist/progress.d.cts +6 -6
- package/dist/progress.d.ts +6 -6
- package/dist/progress.js +15 -22
- package/dist/radio.cjs +35 -67
- package/dist/radio.d.cts +18 -18
- package/dist/radio.d.ts +18 -18
- package/dist/radio.js +36 -68
- package/dist/select.cjs +40 -39
- package/dist/select.d.cts +35 -4
- package/dist/select.d.ts +35 -4
- package/dist/select.js +40 -38
- package/dist/separator.cjs +8 -33
- package/dist/separator.js +8 -33
- package/dist/slider.cjs +33 -49
- package/dist/slider.js +34 -50
- package/dist/switch.cjs +48 -55
- package/dist/switch.js +49 -56
- package/dist/tabs.cjs +108 -197
- package/dist/tabs.d.cts +16 -60
- package/dist/tabs.d.ts +16 -60
- package/dist/tabs.js +109 -196
- package/dist/tag.cjs +112 -69
- package/dist/tag.js +113 -69
- package/dist/textarea.cjs +56 -27
- package/dist/textarea.js +57 -28
- package/dist/toaster.cjs +97 -79
- package/dist/toaster.d.cts +7 -8
- package/dist/toaster.d.ts +7 -8
- package/dist/toaster.js +78 -80
- package/dist/tooltip.cjs +28 -17
- package/dist/tooltip.js +30 -18
- package/package.json +2 -16
- package/src/accordion.tsx +173 -227
- package/src/alert.tsx +78 -45
- package/src/avatar.tsx +54 -37
- package/src/badge.tsx +65 -44
- package/src/checkbox.tsx +70 -89
- package/src/close-button.tsx +3 -8
- package/src/collapsible.tsx +55 -52
- package/src/drawer.tsx +123 -115
- package/src/empty-state.tsx +21 -17
- package/src/expiration-selector.tsx +84 -66
- package/src/field.tsx +68 -124
- package/src/greeks-display.tsx +59 -51
- package/src/heading.tsx +22 -26
- package/src/icon-button.tsx +134 -141
- package/src/ink.tsx +37 -0
- package/src/input-group.tsx +59 -36
- package/src/input.tsx +41 -32
- package/src/menu.tsx +224 -397
- package/src/option-chain.tsx +154 -104
- package/src/option-position.tsx +136 -114
- package/src/pin-input.tsx +37 -29
- package/src/pnl-diagram.tsx +36 -28
- package/src/popover.tsx +1 -1
- package/src/progress.tsx +17 -21
- package/src/radio.tsx +56 -75
- package/src/select.tsx +80 -59
- package/src/separator.tsx +13 -34
- package/src/slider.tsx +43 -44
- package/src/strategy-builder.tsx +245 -156
- package/src/switch.tsx +63 -64
- package/src/tabs.tsx +166 -296
- package/src/tag.tsx +89 -51
- package/src/textarea.tsx +19 -29
- package/src/toaster.tsx +118 -86
- package/src/tooltip.tsx +21 -13
- package/tokens.css +79 -0
package/dist/accordion.cjs
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var gui = require('@hanzo/gui');
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var clsx = require('clsx');
|
|
7
|
-
var tailwindMerge = require('tailwind-merge');
|
|
8
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
9
7
|
|
|
10
8
|
function _interopNamespace(e) {
|
|
@@ -25,185 +23,128 @@ function _interopNamespace(e) {
|
|
|
25
23
|
return Object.freeze(n);
|
|
26
24
|
}
|
|
27
25
|
|
|
28
|
-
var AccordionPrimitive__namespace = /*#__PURE__*/_interopNamespace(AccordionPrimitive);
|
|
29
26
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
30
27
|
|
|
31
28
|
// src/accordion.tsx
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
children
|
|
79
|
-
}
|
|
80
|
-
);
|
|
29
|
+
var ink = (children, Wrap = gui.Text, props = {}) => {
|
|
30
|
+
let hasText = false;
|
|
31
|
+
React.Children.forEach(children, (child) => {
|
|
32
|
+
if (typeof child === "string" || typeof child === "number") hasText = true;
|
|
33
|
+
});
|
|
34
|
+
if (!hasText) return children;
|
|
35
|
+
return React.Children.map(children, (child) => typeof child === "string" || typeof child === "number" ? React.createElement(Wrap, props, child) : child);
|
|
36
|
+
};
|
|
37
|
+
var IndicatorIcon = () => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M7.5 15L12.5 10L7.5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
38
|
+
var BAR = "var(--color-text-primary)";
|
|
39
|
+
var Indicator = ({ open, variant }) => variant === "faq" ? /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { width: 12, height: 12, flexShrink: 0, alignItems: "center", justifyContent: "center", position: "relative", children: [
|
|
40
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.View, { position: "absolute", width: "100%", height: 2, borderRadius: 2, backgroundColor: BAR }),
|
|
41
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
42
|
+
gui.View,
|
|
43
|
+
{
|
|
44
|
+
position: "absolute",
|
|
45
|
+
width: 2,
|
|
46
|
+
height: "100%",
|
|
47
|
+
borderRadius: 2,
|
|
48
|
+
backgroundColor: BAR,
|
|
49
|
+
rotate: open ? "90deg" : "0deg"
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { flexShrink: 0, alignItems: "center", rotate: open ? "270deg" : "180deg", children: /* @__PURE__ */ jsxRuntime.jsx(IndicatorIcon, {}) });
|
|
53
|
+
var Variant = React__namespace.createContext(void 0);
|
|
54
|
+
var AccordionRoot = ({
|
|
55
|
+
value,
|
|
56
|
+
defaultValue,
|
|
57
|
+
onValueChange,
|
|
58
|
+
variant,
|
|
59
|
+
size,
|
|
60
|
+
children,
|
|
61
|
+
...rest
|
|
62
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(Variant.Provider, { value: variant, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
63
|
+
gui.Accordion,
|
|
64
|
+
{
|
|
65
|
+
unstyled: true,
|
|
66
|
+
type: "multiple",
|
|
67
|
+
width: "100%",
|
|
68
|
+
value,
|
|
69
|
+
defaultValue,
|
|
70
|
+
onValueChange: onValueChange ? (next) => onValueChange({ value: next }) : void 0,
|
|
71
|
+
"data-variant": variant,
|
|
72
|
+
"data-size": size,
|
|
73
|
+
...rest,
|
|
74
|
+
children
|
|
81
75
|
}
|
|
82
|
-
);
|
|
83
|
-
var AccordionItem =
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
className: cn(
|
|
91
|
-
"border-b border-[var(--color-border-divider)]",
|
|
92
|
-
className
|
|
93
|
-
),
|
|
94
|
-
...rest
|
|
95
|
-
}
|
|
96
|
-
);
|
|
76
|
+
) });
|
|
77
|
+
var AccordionItem = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
78
|
+
gui.Accordion.Item,
|
|
79
|
+
{
|
|
80
|
+
unstyled: true,
|
|
81
|
+
borderBottomWidth: 1,
|
|
82
|
+
borderColor: "var(--color-border-divider)",
|
|
83
|
+
...props
|
|
97
84
|
}
|
|
98
85
|
);
|
|
99
|
-
var AccordionItemTrigger =
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
textAlign: _textAlign,
|
|
112
|
-
cursor: _cursor,
|
|
113
|
-
display: _display,
|
|
114
|
-
alignItems: _alignItems,
|
|
115
|
-
columnGap: _columnGap,
|
|
116
|
-
...rest
|
|
117
|
-
} = props;
|
|
118
|
-
const indicatorPlacement = variant === "faq" ? "start" : indicatorPlacementProp ?? "end";
|
|
119
|
-
const indicator = variant === "faq" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
120
|
-
"span",
|
|
121
|
-
{
|
|
122
|
-
className: cn(
|
|
123
|
-
"relative inline-block h-3 w-3 shrink-0",
|
|
124
|
-
// horizontal bar (always visible)
|
|
125
|
-
"before:absolute before:left-0 before:top-1/2 before:block before:h-[2px] before:w-full before:-translate-y-1/2 before:rounded-[2px] before:bg-current",
|
|
126
|
-
// vertical bar (rotates to 0 when open)
|
|
127
|
-
"after:absolute after:left-1/2 after:top-0 after:block after:h-full after:w-[2px]",
|
|
128
|
-
"after:-translate-x-1/2 after:rounded-[2px] after:bg-current",
|
|
129
|
-
"after:transition-transform after:duration-200 after:ease-in-out",
|
|
130
|
-
// When parent trigger has data-state="open", rotate vertical bar
|
|
131
|
-
"group-data-[state=open]/trigger:after:rotate-90"
|
|
132
|
-
)
|
|
133
|
-
}
|
|
134
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
135
|
-
"span",
|
|
136
|
-
{
|
|
137
|
-
className: cn(
|
|
138
|
-
"inline-flex shrink-0 transition-transform duration-200",
|
|
139
|
-
"rotate-180",
|
|
140
|
-
"group-data-[state=open]/trigger:rotate-[270deg]"
|
|
141
|
-
),
|
|
142
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(IndicatorIcon, { className: "h-5 w-5" })
|
|
143
|
-
}
|
|
144
|
-
);
|
|
145
|
-
return /* @__PURE__ */ jsxRuntime.jsx(AccordionPrimitive__namespace.Header, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
146
|
-
AccordionPrimitive__namespace.Trigger,
|
|
86
|
+
var AccordionItemTrigger = ({
|
|
87
|
+
children,
|
|
88
|
+
indicatorPlacement: placementProp,
|
|
89
|
+
variant: variantProp,
|
|
90
|
+
noIndicator,
|
|
91
|
+
headingLevel = 3,
|
|
92
|
+
...rest
|
|
93
|
+
}) => {
|
|
94
|
+
const variant = variantProp ?? React__namespace.useContext(Variant);
|
|
95
|
+
const placement = variant === "faq" ? "start" : placementProp ?? "end";
|
|
96
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.Accordion.Header, { unstyled: true, render: `h${headingLevel}`, "aria-level": headingLevel, display: "flex", width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
97
|
+
gui.Accordion.Trigger,
|
|
147
98
|
{
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
99
|
+
unstyled: true,
|
|
100
|
+
type: "button",
|
|
101
|
+
width: "100%",
|
|
102
|
+
flexDirection: "row",
|
|
103
|
+
alignItems: "center",
|
|
104
|
+
gap: 8,
|
|
105
|
+
paddingVertical: 12,
|
|
106
|
+
paddingHorizontal: 0,
|
|
107
|
+
borderWidth: 0,
|
|
108
|
+
backgroundColor: "transparent",
|
|
109
|
+
cursor: "pointer",
|
|
110
|
+
className: "lux-accordion-trigger",
|
|
155
111
|
...rest,
|
|
156
|
-
children: [
|
|
157
|
-
|
|
158
|
-
children,
|
|
159
|
-
|
|
160
|
-
]
|
|
112
|
+
children: (({ open }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
113
|
+
placement === "start" && !noIndicator && /* @__PURE__ */ jsxRuntime.jsx(Indicator, { open, variant }),
|
|
114
|
+
ink(children, void 0, { color: "inherit", textAlign: "left" }),
|
|
115
|
+
placement === "end" && !noIndicator && /* @__PURE__ */ jsxRuntime.jsx(Indicator, { open, variant })
|
|
116
|
+
] }))
|
|
161
117
|
}
|
|
162
|
-
) })
|
|
163
|
-
}
|
|
164
|
-
var AccordionItemContent =
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
),
|
|
176
|
-
...rest,
|
|
177
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pb-3", children })
|
|
178
|
-
}
|
|
179
|
-
);
|
|
180
|
-
});
|
|
118
|
+
) });
|
|
119
|
+
};
|
|
120
|
+
var AccordionItemContent = ({ children, ...rest }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
121
|
+
gui.Accordion.Content,
|
|
122
|
+
{
|
|
123
|
+
unstyled: true,
|
|
124
|
+
overflow: "hidden",
|
|
125
|
+
paddingBottom: 12,
|
|
126
|
+
backgroundColor: "transparent",
|
|
127
|
+
...rest,
|
|
128
|
+
children: ink(children, void 0, { color: "var(--color-text-primary)" })
|
|
129
|
+
}
|
|
130
|
+
);
|
|
181
131
|
function useAccordion(items) {
|
|
182
132
|
const [value, setValue] = React__namespace.useState([]);
|
|
183
|
-
const onValueChange = React__namespace.useCallback(({ value:
|
|
184
|
-
setValue(
|
|
133
|
+
const onValueChange = React__namespace.useCallback(({ value: next }) => {
|
|
134
|
+
setValue(next);
|
|
185
135
|
}, []);
|
|
186
136
|
const scrollToItemFromUrl = React__namespace.useCallback(() => {
|
|
187
137
|
const hash = window.location.hash.replace("#", "");
|
|
188
|
-
if (!hash)
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
138
|
+
if (!hash) return;
|
|
191
139
|
const itemToScroll = items.find((item) => item.id === hash);
|
|
192
|
-
if (itemToScroll)
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
el.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
196
|
-
}
|
|
197
|
-
setValue([itemToScroll.id]);
|
|
198
|
-
}
|
|
140
|
+
if (!itemToScroll) return;
|
|
141
|
+
document.getElementById(itemToScroll.id)?.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
142
|
+
setValue([itemToScroll.id]);
|
|
199
143
|
}, [items]);
|
|
200
|
-
return React__namespace.useMemo(
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
scrollToItemFromUrl
|
|
205
|
-
};
|
|
206
|
-
}, [value, onValueChange, scrollToItemFromUrl]);
|
|
144
|
+
return React__namespace.useMemo(
|
|
145
|
+
() => ({ value, onValueChange, scrollToItemFromUrl }),
|
|
146
|
+
[value, onValueChange, scrollToItemFromUrl]
|
|
147
|
+
);
|
|
207
148
|
}
|
|
208
149
|
|
|
209
150
|
exports.AccordionItem = AccordionItem;
|
package/dist/accordion.d.cts
CHANGED
|
@@ -1,74 +1,41 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Accordion } from '@hanzo/gui';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
|
-
interface AccordionRootProps extends Omit<React.
|
|
5
|
-
/**
|
|
6
|
-
readonly multiple?: boolean;
|
|
7
|
-
/** Controlled open items (array of `value` strings). */
|
|
4
|
+
interface AccordionRootProps extends Omit<React.ComponentProps<typeof Accordion>, 'type' | 'value' | 'defaultValue' | 'onValueChange' | 'size'> {
|
|
5
|
+
/** Controlled open items. */
|
|
8
6
|
readonly value?: Array<string>;
|
|
9
7
|
/** Uncontrolled initial open items. */
|
|
10
8
|
readonly defaultValue?: Array<string>;
|
|
11
|
-
/**
|
|
12
|
-
* Called when open items change.
|
|
13
|
-
* Wraps the value in `{ value }` to stay compatible with the Chakra callback shape
|
|
14
|
-
* that consumers already rely on.
|
|
15
|
-
*/
|
|
9
|
+
/** Fires with the full set of open items. */
|
|
16
10
|
readonly onValueChange?: (details: {
|
|
17
11
|
value: Array<string>;
|
|
18
12
|
}) => void;
|
|
19
13
|
readonly variant?: 'outline' | 'faq';
|
|
20
14
|
readonly size?: 'sm' | 'md';
|
|
21
|
-
/** Accepted for compatibility; not applied visually. */
|
|
22
|
-
readonly noAnimation?: boolean;
|
|
23
|
-
/** Accepted for compatibility; Radix defers rendering internally. */
|
|
24
|
-
readonly lazyMount?: boolean;
|
|
25
|
-
readonly children?: React.ReactNode;
|
|
26
|
-
readonly position?: string;
|
|
27
|
-
readonly w?: string;
|
|
28
|
-
readonly bgColor?: string | Record<string, string>;
|
|
29
|
-
readonly borderRadius?: string;
|
|
30
15
|
}
|
|
31
|
-
declare const AccordionRoot:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
_last?: Record<string, unknown>;
|
|
36
|
-
display?: string;
|
|
37
|
-
}
|
|
38
|
-
declare const AccordionItem: React.ForwardRefExoticComponent<AccordionItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
39
|
-
interface AccordionItemTriggerProps extends Omit<React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>, 'dir'> {
|
|
16
|
+
declare const AccordionRoot: ({ value, defaultValue, onValueChange, variant, size, children, ...rest }: AccordionRootProps) => React.ReactElement;
|
|
17
|
+
type AccordionItemProps = React.ComponentProps<typeof Accordion.Item>;
|
|
18
|
+
declare const AccordionItem: (props: AccordionItemProps) => React.ReactElement;
|
|
19
|
+
type AccordionItemTriggerProps = React.ComponentProps<typeof Accordion.Trigger> & {
|
|
40
20
|
readonly indicatorPlacement?: 'start' | 'end';
|
|
41
21
|
readonly noIndicator?: boolean;
|
|
42
22
|
readonly variant?: 'outline' | 'faq';
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
columnGap?: number | string;
|
|
52
|
-
}
|
|
53
|
-
declare const AccordionItemTrigger: React.ForwardRefExoticComponent<AccordionItemTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
54
|
-
interface AccordionItemContentProps extends React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content> {
|
|
55
|
-
pb?: number | string;
|
|
56
|
-
pr?: number | string;
|
|
57
|
-
pl?: string;
|
|
58
|
-
w?: string;
|
|
59
|
-
display?: string;
|
|
60
|
-
flexDir?: string;
|
|
61
|
-
rowGap?: number | string;
|
|
62
|
-
}
|
|
63
|
-
declare const AccordionItemContent: React.ForwardRefExoticComponent<AccordionItemContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
23
|
+
readonly headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
24
|
+
/** The DOM button type — see (3) above. Defaults to `button`, not submit. */
|
|
25
|
+
readonly type?: 'button' | 'submit' | 'reset';
|
|
26
|
+
};
|
|
27
|
+
declare const AccordionItemTrigger: ({ children, indicatorPlacement: placementProp, variant: variantProp, noIndicator, headingLevel, ...rest }: AccordionItemTriggerProps) => React.ReactElement;
|
|
28
|
+
type AccordionItemContentProps = React.ComponentProps<typeof Accordion.Content>;
|
|
29
|
+
declare const AccordionItemContent: ({ children, ...rest }: AccordionItemContentProps) => React.ReactElement;
|
|
30
|
+
/** Open state for an accordion whose items are addressable by URL fragment. */
|
|
64
31
|
declare function useAccordion(items: Array<{
|
|
65
32
|
id: string;
|
|
66
33
|
}>): {
|
|
67
34
|
value: string[];
|
|
68
|
-
onValueChange: ({ value }: {
|
|
35
|
+
onValueChange: ({ value: next }: {
|
|
69
36
|
value: Array<string>;
|
|
70
37
|
}) => void;
|
|
71
38
|
scrollToItemFromUrl: () => void;
|
|
72
39
|
};
|
|
73
40
|
|
|
74
|
-
export { AccordionItem, AccordionItemContent, type AccordionItemContentProps, AccordionItemTrigger, AccordionRoot, useAccordion };
|
|
41
|
+
export { AccordionItem, AccordionItemContent, type AccordionItemContentProps, type AccordionItemProps, AccordionItemTrigger, type AccordionItemTriggerProps, AccordionRoot, type AccordionRootProps, useAccordion };
|
package/dist/accordion.d.ts
CHANGED
|
@@ -1,74 +1,41 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Accordion } from '@hanzo/gui';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
|
-
interface AccordionRootProps extends Omit<React.
|
|
5
|
-
/**
|
|
6
|
-
readonly multiple?: boolean;
|
|
7
|
-
/** Controlled open items (array of `value` strings). */
|
|
4
|
+
interface AccordionRootProps extends Omit<React.ComponentProps<typeof Accordion>, 'type' | 'value' | 'defaultValue' | 'onValueChange' | 'size'> {
|
|
5
|
+
/** Controlled open items. */
|
|
8
6
|
readonly value?: Array<string>;
|
|
9
7
|
/** Uncontrolled initial open items. */
|
|
10
8
|
readonly defaultValue?: Array<string>;
|
|
11
|
-
/**
|
|
12
|
-
* Called when open items change.
|
|
13
|
-
* Wraps the value in `{ value }` to stay compatible with the Chakra callback shape
|
|
14
|
-
* that consumers already rely on.
|
|
15
|
-
*/
|
|
9
|
+
/** Fires with the full set of open items. */
|
|
16
10
|
readonly onValueChange?: (details: {
|
|
17
11
|
value: Array<string>;
|
|
18
12
|
}) => void;
|
|
19
13
|
readonly variant?: 'outline' | 'faq';
|
|
20
14
|
readonly size?: 'sm' | 'md';
|
|
21
|
-
/** Accepted for compatibility; not applied visually. */
|
|
22
|
-
readonly noAnimation?: boolean;
|
|
23
|
-
/** Accepted for compatibility; Radix defers rendering internally. */
|
|
24
|
-
readonly lazyMount?: boolean;
|
|
25
|
-
readonly children?: React.ReactNode;
|
|
26
|
-
readonly position?: string;
|
|
27
|
-
readonly w?: string;
|
|
28
|
-
readonly bgColor?: string | Record<string, string>;
|
|
29
|
-
readonly borderRadius?: string;
|
|
30
15
|
}
|
|
31
|
-
declare const AccordionRoot:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
_last?: Record<string, unknown>;
|
|
36
|
-
display?: string;
|
|
37
|
-
}
|
|
38
|
-
declare const AccordionItem: React.ForwardRefExoticComponent<AccordionItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
39
|
-
interface AccordionItemTriggerProps extends Omit<React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>, 'dir'> {
|
|
16
|
+
declare const AccordionRoot: ({ value, defaultValue, onValueChange, variant, size, children, ...rest }: AccordionRootProps) => React.ReactElement;
|
|
17
|
+
type AccordionItemProps = React.ComponentProps<typeof Accordion.Item>;
|
|
18
|
+
declare const AccordionItem: (props: AccordionItemProps) => React.ReactElement;
|
|
19
|
+
type AccordionItemTriggerProps = React.ComponentProps<typeof Accordion.Trigger> & {
|
|
40
20
|
readonly indicatorPlacement?: 'start' | 'end';
|
|
41
21
|
readonly noIndicator?: boolean;
|
|
42
22
|
readonly variant?: 'outline' | 'faq';
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
columnGap?: number | string;
|
|
52
|
-
}
|
|
53
|
-
declare const AccordionItemTrigger: React.ForwardRefExoticComponent<AccordionItemTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
54
|
-
interface AccordionItemContentProps extends React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content> {
|
|
55
|
-
pb?: number | string;
|
|
56
|
-
pr?: number | string;
|
|
57
|
-
pl?: string;
|
|
58
|
-
w?: string;
|
|
59
|
-
display?: string;
|
|
60
|
-
flexDir?: string;
|
|
61
|
-
rowGap?: number | string;
|
|
62
|
-
}
|
|
63
|
-
declare const AccordionItemContent: React.ForwardRefExoticComponent<AccordionItemContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
23
|
+
readonly headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
24
|
+
/** The DOM button type — see (3) above. Defaults to `button`, not submit. */
|
|
25
|
+
readonly type?: 'button' | 'submit' | 'reset';
|
|
26
|
+
};
|
|
27
|
+
declare const AccordionItemTrigger: ({ children, indicatorPlacement: placementProp, variant: variantProp, noIndicator, headingLevel, ...rest }: AccordionItemTriggerProps) => React.ReactElement;
|
|
28
|
+
type AccordionItemContentProps = React.ComponentProps<typeof Accordion.Content>;
|
|
29
|
+
declare const AccordionItemContent: ({ children, ...rest }: AccordionItemContentProps) => React.ReactElement;
|
|
30
|
+
/** Open state for an accordion whose items are addressable by URL fragment. */
|
|
64
31
|
declare function useAccordion(items: Array<{
|
|
65
32
|
id: string;
|
|
66
33
|
}>): {
|
|
67
34
|
value: string[];
|
|
68
|
-
onValueChange: ({ value }: {
|
|
35
|
+
onValueChange: ({ value: next }: {
|
|
69
36
|
value: Array<string>;
|
|
70
37
|
}) => void;
|
|
71
38
|
scrollToItemFromUrl: () => void;
|
|
72
39
|
};
|
|
73
40
|
|
|
74
|
-
export { AccordionItem, AccordionItemContent, type AccordionItemContentProps, AccordionItemTrigger, AccordionRoot, useAccordion };
|
|
41
|
+
export { AccordionItem, AccordionItemContent, type AccordionItemContentProps, type AccordionItemProps, AccordionItemTrigger, type AccordionItemTriggerProps, AccordionRoot, type AccordionRootProps, useAccordion };
|