@efolusi/meridian 1.19.1 → 1.21.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 +1 -1
- package/ai/Bubble.d.ts +16 -0
- package/ai/Bubble.js +71 -0
- package/ai/ChatMessage.js +2 -5
- package/ai/Confirmation.d.ts +0 -7
- package/ai/Confirmation.js +3 -6
- package/ai/GeneratedImage.d.ts +0 -2
- package/ai/GeneratedImage.js +2 -4
- package/ai/Marker.d.ts +26 -0
- package/ai/Marker.js +67 -0
- package/ai/Message.d.ts +13 -0
- package/ai/Message.js +68 -0
- package/ai/MessageScroller.d.ts +21 -0
- package/ai/MessageScroller.js +283 -0
- package/ai/ModelSelector.d.ts +2 -2
- package/ai/ModelSelector.js +1 -2
- package/ai/Player.js +1 -1
- package/ai/PromptSteps.js +4 -2
- package/ai/Sandbox.d.ts +0 -2
- package/ai/Sandbox.js +2 -4
- package/ai/Suggestions.d.ts +0 -2
- package/ai/Suggestions.js +1 -4
- package/ai/WebPreview.d.ts +0 -2
- package/ai/WebPreview.js +2 -4
- package/code/Console.js +1 -1
- package/code/EnvList.d.ts +0 -2
- package/code/EnvList.js +2 -3
- package/components.css +660 -423
- package/data/BarChart.d.ts +0 -2
- package/data/BarChart.js +1 -4
- package/data/Chart.d.ts +14 -0
- package/data/Chart.js +149 -0
- package/data/EmptyState.d.ts +8 -13
- package/data/EmptyState.js +62 -24
- package/data/LineChart.js +7 -4
- package/data/Skeleton.d.ts +2 -11
- package/data/Skeleton.js +8 -38
- package/data/Sparkline.js +4 -1
- package/data/StatusDot.d.ts +0 -4
- package/data/StatusDot.js +3 -6
- package/data/Table.d.ts +11 -4
- package/data/Table.js +39 -7
- package/dates/Calendar.d.ts +10 -27
- package/dates/Calendar.js +250 -184
- package/dates/TimePicker.js +2 -2
- package/display/Accordion.d.ts +47 -15
- package/display/Accordion.js +257 -27
- package/display/AspectRatio.d.ts +4 -6
- package/display/AspectRatio.js +7 -5
- package/display/Avatar.d.ts +17 -14
- package/display/Avatar.js +68 -43
- package/display/Badge.d.ts +9 -8
- package/display/Badge.js +32 -14
- package/display/Card.d.ts +11 -13
- package/display/Card.js +74 -29
- package/display/Carousel.d.ts +23 -15
- package/display/Carousel.js +217 -66
- package/display/Collapsible.d.ts +19 -9
- package/display/Collapsible.js +140 -28
- package/display/Direction.d.ts +10 -0
- package/display/Direction.js +24 -0
- package/display/Item.d.ts +19 -0
- package/display/Item.js +152 -0
- package/display/Kbd.d.ts +5 -7
- package/display/Kbd.js +22 -10
- package/display/Link.js +2 -4
- package/display/Resizable.d.ts +6 -16
- package/display/Resizable.js +141 -58
- package/display/ScrollArea.d.ts +3 -1
- package/display/ScrollArea.js +30 -5
- package/display/Separator.d.ts +9 -0
- package/display/Separator.js +18 -0
- package/display/Timeline.d.ts +24 -0
- package/display/Timeline.js +51 -0
- package/display/Toolbar.js +5 -4
- package/display/TreeList.d.ts +0 -2
- package/display/TreeList.js +2 -5
- package/feedback/Alert.d.ts +13 -13
- package/feedback/Alert.js +40 -36
- package/feedback/AlertDialog.d.ts +30 -0
- package/feedback/AlertDialog.js +249 -0
- package/feedback/Banner.d.ts +1 -3
- package/feedback/Banner.js +1 -5
- package/feedback/ConfirmDialog.d.ts +1 -1
- package/feedback/ConfirmDialog.js +18 -20
- package/feedback/Dialog.d.ts +13 -16
- package/feedback/Dialog.js +204 -62
- package/feedback/Progress.d.ts +8 -9
- package/feedback/Progress.js +42 -24
- package/feedback/Sonner.d.ts +8 -0
- package/feedback/Sonner.js +238 -0
- package/feedback/Spinner.d.ts +2 -9
- package/feedback/Spinner.js +19 -28
- package/feedback/Tooltip.d.ts +9 -10
- package/feedback/Tooltip.js +147 -96
- package/files/Attachment.d.ts +27 -0
- package/files/Attachment.js +111 -0
- package/files/FileDrop.js +3 -1
- package/finance/PaymentCard.js +3 -3
- package/forms/Button.d.ts +6 -5
- package/forms/Button.js +42 -8
- package/forms/ButtonGroup.d.ts +11 -3
- package/forms/ButtonGroup.js +57 -6
- package/forms/Checkbox.d.ts +14 -3
- package/forms/Checkbox.js +84 -16
- package/forms/Combobox.d.ts +24 -16
- package/forms/Combobox.js +466 -135
- package/forms/Field.d.ts +14 -0
- package/forms/Field.js +99 -0
- package/forms/IconButton.d.ts +1 -1
- package/forms/IconButton.js +4 -3
- package/forms/Input.d.ts +8 -8
- package/forms/Input.js +46 -33
- package/forms/InputGroup.d.ts +8 -15
- package/forms/InputGroup.js +74 -35
- package/forms/InputOTP.d.ts +13 -0
- package/forms/InputOTP.js +125 -0
- package/forms/Label.d.ts +2 -6
- package/forms/Label.js +6 -4
- package/forms/NativeSelect.d.ts +16 -0
- package/forms/NativeSelect.js +35 -0
- package/forms/NumberInput.js +2 -2
- package/forms/Radio.d.ts +12 -1
- package/forms/Radio.js +76 -6
- package/forms/Select.d.ts +12 -9
- package/forms/Select.js +254 -42
- package/forms/Slider.d.ts +10 -17
- package/forms/Slider.js +78 -39
- package/forms/Switch.d.ts +8 -2
- package/forms/Switch.js +46 -15
- package/forms/Textarea.d.ts +1 -1
- package/forms/Textarea.js +26 -18
- package/forms/Toggle.d.ts +18 -15
- package/forms/Toggle.js +96 -42
- package/icons/_svg.js +2 -0
- package/index.d.ts +20 -8
- package/index.js +50 -38
- package/navigation/Breadcrumbs.d.ts +18 -11
- package/navigation/Breadcrumbs.js +99 -26
- package/navigation/Menubar.d.ts +52 -10
- package/navigation/Menubar.js +191 -146
- package/navigation/NavigationMenu.d.ts +15 -0
- package/navigation/NavigationMenu.js +296 -0
- package/navigation/Pagination.d.ts +10 -9
- package/navigation/Pagination.js +94 -51
- package/navigation/SideNav.js +4 -3
- package/navigation/Sidebar.d.ts +29 -0
- package/navigation/Sidebar.js +311 -0
- package/navigation/Tabs.d.ts +9 -5
- package/navigation/Tabs.js +132 -44
- package/overlay/Command.d.ts +32 -0
- package/overlay/Command.js +257 -0
- package/overlay/ContextMenu.d.ts +40 -8
- package/overlay/ContextMenu.js +468 -107
- package/overlay/Drawer.d.ts +29 -14
- package/overlay/Drawer.js +178 -80
- package/overlay/DropdownMenu.d.ts +43 -0
- package/overlay/DropdownMenu.js +502 -0
- package/overlay/HoverCard.d.ts +21 -12
- package/overlay/HoverCard.js +129 -61
- package/overlay/Popover.d.ts +11 -13
- package/overlay/Popover.js +138 -65
- package/overlay/Portal.js +21 -7
- package/overlay/Sheet.d.ts +11 -0
- package/overlay/Sheet.js +62 -0
- package/package.json +4 -1
- package/tokens/base.css +1 -1
- package/dates/DatePicker.d.ts +0 -14
- package/dates/DatePicker.js +0 -111
- package/dates/DateRangePicker.d.ts +0 -23
- package/dates/DateRangePicker.js +0 -150
- package/display/ListItem.d.ts +0 -19
- package/display/ListItem.js +0 -50
- package/feedback/Toast.d.ts +0 -78
- package/feedback/Toast.js +0 -192
- package/forms/DigitEntry.d.ts +0 -15
- package/forms/DigitEntry.js +0 -79
- package/forms/FormField.d.ts +0 -82
- package/forms/FormField.js +0 -209
- package/overlay/CommandPalette.d.ts +0 -21
- package/overlay/CommandPalette.js +0 -148
- package/overlay/Menu.d.ts +0 -24
- package/overlay/Menu.js +0 -139
package/display/Accordion.js
CHANGED
|
@@ -1,37 +1,267 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import { Icon } from "../icons/Icon.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
import { mergeRefs } from "../forms/Button.js";
|
|
5
|
+
const AccordionRootContext = /*#__PURE__*/React.createContext(null);
|
|
6
|
+
const AccordionItemContext = /*#__PURE__*/React.createContext(null);
|
|
7
|
+
function useAccordionRoot(part) {
|
|
8
|
+
const context = React.useContext(AccordionRootContext);
|
|
9
|
+
if (!context) throw new Error(`${part} must be used inside Accordion`);
|
|
10
|
+
return context;
|
|
11
|
+
}
|
|
12
|
+
function useAccordionItem(part) {
|
|
13
|
+
const context = React.useContext(AccordionItemContext);
|
|
14
|
+
if (!context) throw new Error(`${part} must be used inside AccordionItem`);
|
|
15
|
+
return context;
|
|
16
|
+
}
|
|
17
|
+
function composeEventHandlers(childHandler, ownHandler) {
|
|
18
|
+
return event => {
|
|
19
|
+
childHandler?.(event);
|
|
20
|
+
if (!event.defaultPrevented) ownHandler?.(event);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export const Accordion = /*#__PURE__*/React.forwardRef(function Accordion({
|
|
24
|
+
type,
|
|
25
|
+
value,
|
|
26
|
+
defaultValue,
|
|
27
|
+
onValueChange,
|
|
28
|
+
collapsible = false,
|
|
29
|
+
disabled = false,
|
|
30
|
+
orientation = 'vertical',
|
|
31
|
+
dir = 'ltr',
|
|
32
|
+
loop = true,
|
|
33
|
+
asChild = false,
|
|
34
|
+
children,
|
|
10
35
|
className,
|
|
36
|
+
style,
|
|
11
37
|
...rest
|
|
12
|
-
}) {
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
38
|
+
}, forwardedRef) {
|
|
39
|
+
const resolvedType = type || 'single';
|
|
40
|
+
const initialValue = defaultValue !== undefined ? defaultValue : resolvedType === 'multiple' ? [] : '';
|
|
41
|
+
const [uncontrolledValue, setUncontrolledValue] = React.useState(initialValue);
|
|
42
|
+
const controlled = value !== undefined;
|
|
43
|
+
const currentValue = controlled ? value : uncontrolledValue;
|
|
44
|
+
const rootRef = React.useRef(null);
|
|
45
|
+
const setValue = React.useCallback(next => {
|
|
46
|
+
if (disabled) return;
|
|
47
|
+
if (!controlled) setUncontrolledValue(next);
|
|
48
|
+
onValueChange?.(next);
|
|
49
|
+
}, [controlled, disabled, onValueChange]);
|
|
50
|
+
const isOpen = React.useCallback(itemValue => resolvedType === 'multiple' ? Array.isArray(currentValue) && currentValue.includes(itemValue) : currentValue === itemValue, [currentValue, resolvedType]);
|
|
51
|
+
const toggle = React.useCallback(itemValue => {
|
|
52
|
+
if (resolvedType === 'multiple') {
|
|
53
|
+
const values = Array.isArray(currentValue) ? currentValue : [];
|
|
54
|
+
setValue(values.includes(itemValue) ? values.filter(entry => entry !== itemValue) : [...values, itemValue]);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (currentValue === itemValue) {
|
|
58
|
+
if (collapsible) setValue('');
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
setValue(itemValue);
|
|
62
|
+
}, [collapsible, currentValue, resolvedType, setValue]);
|
|
63
|
+
const moveFocus = React.useCallback((event, trigger) => {
|
|
64
|
+
const triggers = [...rootRef.current.querySelectorAll('[data-slot="accordion-trigger"]:not(:disabled)')];
|
|
65
|
+
const index = triggers.indexOf(trigger);
|
|
66
|
+
if (index < 0 || !triggers.length) return;
|
|
67
|
+
let nextIndex;
|
|
68
|
+
if (event.key === 'Home') nextIndex = 0;else if (event.key === 'End') nextIndex = triggers.length - 1;else {
|
|
69
|
+
let delta = 0;
|
|
70
|
+
if (orientation === 'vertical' && event.key === 'ArrowDown') delta = 1;else if (orientation === 'vertical' && event.key === 'ArrowUp') delta = -1;else if (orientation === 'horizontal' && event.key === 'ArrowRight') delta = dir === 'rtl' ? -1 : 1;else if (orientation === 'horizontal' && event.key === 'ArrowLeft') delta = dir === 'rtl' ? 1 : -1;
|
|
71
|
+
if (delta) {
|
|
72
|
+
const candidate = index + delta;
|
|
73
|
+
nextIndex = loop ? (candidate + triggers.length) % triggers.length : candidate;
|
|
74
|
+
if (nextIndex < 0 || nextIndex >= triggers.length) return;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (nextIndex === undefined) return;
|
|
78
|
+
event.preventDefault();
|
|
79
|
+
triggers[nextIndex].focus();
|
|
80
|
+
}, [dir, loop, orientation]);
|
|
81
|
+
const context = React.useMemo(() => ({
|
|
82
|
+
disabled,
|
|
83
|
+
dir,
|
|
84
|
+
isOpen,
|
|
85
|
+
moveFocus,
|
|
86
|
+
orientation,
|
|
87
|
+
toggle
|
|
88
|
+
}), [disabled, dir, isOpen, moveFocus, orientation, toggle]);
|
|
89
|
+
const content = children;
|
|
90
|
+
const rootProps = {
|
|
91
|
+
...rest,
|
|
92
|
+
ref: mergeRefs(forwardedRef, rootRef),
|
|
93
|
+
dir,
|
|
94
|
+
'data-slot': 'accordion',
|
|
95
|
+
'data-orientation': orientation,
|
|
16
96
|
className: `ef-acc${className ? ' ' + className : ''}`,
|
|
17
|
-
style
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
97
|
+
style
|
|
98
|
+
};
|
|
99
|
+
const root = asChild ? (() => {
|
|
100
|
+
const child = React.Children.only(content);
|
|
101
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
102
|
+
...rootProps,
|
|
103
|
+
...child.props,
|
|
104
|
+
ref: mergeRefs(forwardedRef, rootRef, child.ref),
|
|
105
|
+
dir,
|
|
106
|
+
'data-slot': 'accordion',
|
|
107
|
+
'data-orientation': orientation,
|
|
108
|
+
className: `${rootProps.className}${child.props.className ? ' ' + child.props.className : ''}`,
|
|
109
|
+
style: {
|
|
110
|
+
...style,
|
|
111
|
+
...child.props.style
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
})() : /*#__PURE__*/React.createElement("div", rootProps, content);
|
|
115
|
+
return /*#__PURE__*/React.createElement(AccordionRootContext.Provider, {
|
|
116
|
+
value: context
|
|
117
|
+
}, root);
|
|
118
|
+
});
|
|
119
|
+
export const AccordionItem = /*#__PURE__*/React.forwardRef(function AccordionItem({
|
|
120
|
+
value,
|
|
121
|
+
disabled = false,
|
|
122
|
+
asChild = false,
|
|
123
|
+
children,
|
|
124
|
+
className,
|
|
125
|
+
...rest
|
|
126
|
+
}, ref) {
|
|
127
|
+
const root = useAccordionRoot('AccordionItem');
|
|
128
|
+
const open = root.isOpen(value);
|
|
129
|
+
const itemDisabled = root.disabled || disabled;
|
|
130
|
+
const uid = React.useId();
|
|
131
|
+
const triggerId = `${uid}-trigger`;
|
|
132
|
+
const contentId = `${uid}-content`;
|
|
133
|
+
const state = open ? 'open' : 'closed';
|
|
134
|
+
const context = React.useMemo(() => ({
|
|
135
|
+
contentId,
|
|
136
|
+
disabled: itemDisabled,
|
|
137
|
+
open,
|
|
138
|
+
triggerId,
|
|
139
|
+
value
|
|
140
|
+
}), [contentId, itemDisabled, open, triggerId, value]);
|
|
141
|
+
const props = {
|
|
142
|
+
...rest,
|
|
143
|
+
ref,
|
|
144
|
+
'data-slot': 'accordion-item',
|
|
145
|
+
'data-state': state,
|
|
146
|
+
'data-disabled': itemDisabled ? '' : undefined,
|
|
147
|
+
'data-orientation': root.orientation,
|
|
148
|
+
className: `ef-acc__item${className ? ' ' + className : ''}`
|
|
149
|
+
};
|
|
150
|
+
const item = asChild ? (() => {
|
|
151
|
+
const child = React.Children.only(children);
|
|
152
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
153
|
+
...props,
|
|
154
|
+
...child.props,
|
|
155
|
+
ref: mergeRefs(ref, child.ref),
|
|
156
|
+
'data-slot': 'accordion-item',
|
|
157
|
+
'data-state': state,
|
|
158
|
+
'data-disabled': itemDisabled ? '' : undefined,
|
|
159
|
+
'data-orientation': root.orientation,
|
|
160
|
+
className: `${props.className}${child.props.className ? ' ' + child.props.className : ''}`
|
|
161
|
+
});
|
|
162
|
+
})() : /*#__PURE__*/React.createElement("div", props, children);
|
|
163
|
+
return /*#__PURE__*/React.createElement(AccordionItemContext.Provider, {
|
|
164
|
+
value: context
|
|
165
|
+
}, item);
|
|
166
|
+
});
|
|
167
|
+
export const AccordionTrigger = /*#__PURE__*/React.forwardRef(function AccordionTrigger({
|
|
168
|
+
asChild = false,
|
|
169
|
+
children,
|
|
170
|
+
onClick,
|
|
171
|
+
onKeyDown,
|
|
172
|
+
className,
|
|
173
|
+
...rest
|
|
174
|
+
}, ref) {
|
|
175
|
+
const root = useAccordionRoot('AccordionTrigger');
|
|
176
|
+
const item = useAccordionItem('AccordionTrigger');
|
|
177
|
+
const state = item.open ? 'open' : 'closed';
|
|
178
|
+
const triggerRef = React.useRef(null);
|
|
179
|
+
const props = {
|
|
180
|
+
...rest,
|
|
181
|
+
ref: mergeRefs(ref, triggerRef),
|
|
182
|
+
id: item.triggerId,
|
|
183
|
+
type: asChild ? undefined : rest.type || 'button',
|
|
184
|
+
'data-slot': 'accordion-trigger',
|
|
185
|
+
'data-state': state,
|
|
186
|
+
'data-disabled': item.disabled ? '' : undefined,
|
|
187
|
+
'data-orientation': root.orientation,
|
|
188
|
+
'aria-controls': item.contentId,
|
|
189
|
+
'aria-expanded': item.open,
|
|
190
|
+
disabled: item.disabled || undefined,
|
|
191
|
+
className: `ef-acc__trigger${className ? ' ' + className : ''}`,
|
|
192
|
+
onClick: composeEventHandlers(onClick, () => root.toggle(item.value)),
|
|
193
|
+
onKeyDown: composeEventHandlers(onKeyDown, event => root.moveFocus(event, triggerRef.current))
|
|
194
|
+
};
|
|
195
|
+
const trigger = asChild ? (() => {
|
|
196
|
+
const child = React.Children.only(children);
|
|
197
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
198
|
+
...props,
|
|
199
|
+
...child.props,
|
|
200
|
+
ref: mergeRefs(ref, triggerRef, child.ref),
|
|
201
|
+
id: item.triggerId,
|
|
202
|
+
'data-slot': 'accordion-trigger',
|
|
203
|
+
'data-state': state,
|
|
204
|
+
'data-disabled': item.disabled ? '' : undefined,
|
|
205
|
+
'data-orientation': root.orientation,
|
|
206
|
+
'aria-controls': item.contentId,
|
|
207
|
+
'aria-expanded': item.open,
|
|
208
|
+
'aria-disabled': item.disabled || undefined,
|
|
209
|
+
className: `${props.className}${child.props.className ? ' ' + child.props.className : ''}`,
|
|
210
|
+
onClick: composeEventHandlers(child.props.onClick, props.onClick),
|
|
211
|
+
onKeyDown: composeEventHandlers(child.props.onKeyDown, props.onKeyDown)
|
|
212
|
+
});
|
|
213
|
+
})() : /*#__PURE__*/React.createElement("button", props, children, /*#__PURE__*/React.createElement("span", {
|
|
26
214
|
className: "ef-acc__chev"
|
|
27
215
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
28
216
|
name: "chevron-down",
|
|
29
217
|
size: 16
|
|
30
|
-
})))
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
218
|
+
})));
|
|
219
|
+
return /*#__PURE__*/React.createElement("h3", {
|
|
220
|
+
className: "ef-acc__header"
|
|
221
|
+
}, trigger);
|
|
222
|
+
});
|
|
223
|
+
export const AccordionContent = /*#__PURE__*/React.forwardRef(function AccordionContent({
|
|
224
|
+
asChild = false,
|
|
225
|
+
forceMount = false,
|
|
226
|
+
children,
|
|
227
|
+
className,
|
|
228
|
+
...rest
|
|
229
|
+
}, ref) {
|
|
230
|
+
const root = useAccordionRoot('AccordionContent');
|
|
231
|
+
const item = useAccordionItem('AccordionContent');
|
|
232
|
+
const state = item.open ? 'open' : 'closed';
|
|
233
|
+
if (!forceMount && !item.open) return null;
|
|
234
|
+
const props = {
|
|
235
|
+
...rest,
|
|
236
|
+
ref,
|
|
237
|
+
id: item.contentId,
|
|
238
|
+
role: 'region',
|
|
239
|
+
'aria-labelledby': item.triggerId,
|
|
240
|
+
'data-slot': 'accordion-content',
|
|
241
|
+
'data-state': state,
|
|
242
|
+
'data-disabled': item.disabled ? '' : undefined,
|
|
243
|
+
'data-orientation': root.orientation,
|
|
244
|
+
hidden: !item.open,
|
|
245
|
+
className: `ef-acc__content${className ? ' ' + className : ''}`
|
|
246
|
+
};
|
|
247
|
+
if (asChild) {
|
|
248
|
+
const child = React.Children.only(children);
|
|
249
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
250
|
+
...props,
|
|
251
|
+
...child.props,
|
|
252
|
+
ref: mergeRefs(ref, child.ref),
|
|
253
|
+
id: item.contentId,
|
|
254
|
+
role: 'region',
|
|
255
|
+
'aria-labelledby': item.triggerId,
|
|
256
|
+
'data-slot': 'accordion-content',
|
|
257
|
+
'data-state': state,
|
|
258
|
+
'data-disabled': item.disabled ? '' : undefined,
|
|
259
|
+
'data-orientation': root.orientation,
|
|
260
|
+
hidden: !item.open,
|
|
261
|
+
className: `${props.className}${child.props.className ? ' ' + child.props.className : ''}`
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
return /*#__PURE__*/React.createElement("div", props, /*#__PURE__*/React.createElement("div", {
|
|
265
|
+
className: "ef-acc__content-inner"
|
|
266
|
+
}, children));
|
|
267
|
+
});
|
package/display/AspectRatio.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
export interface AspectRatioProps {
|
|
2
|
-
/** width / height
|
|
3
|
-
ratio
|
|
1
|
+
export interface AspectRatioProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
2
|
+
/** Required width / height ratio. */
|
|
3
|
+
ratio: number;
|
|
4
4
|
children?: React.ReactNode;
|
|
5
|
-
style?: React.CSSProperties;
|
|
6
|
-
className?: string;
|
|
7
5
|
}
|
|
8
|
-
export declare
|
|
6
|
+
export declare const AspectRatio: React.ForwardRefExoticComponent<AspectRatioProps & React.RefAttributes<HTMLDivElement>>;
|
package/display/AspectRatio.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
import React from 'react';
|
|
4
|
-
export function AspectRatio({
|
|
5
|
-
ratio
|
|
4
|
+
export const AspectRatio = /*#__PURE__*/React.forwardRef(function AspectRatio({
|
|
5
|
+
ratio,
|
|
6
6
|
children,
|
|
7
7
|
style,
|
|
8
8
|
className,
|
|
9
9
|
...rest
|
|
10
|
-
}) {
|
|
11
|
-
return /*#__PURE__*/React.createElement("div", _extends({
|
|
10
|
+
}, ref) {
|
|
11
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
12
|
+
ref: ref
|
|
13
|
+
}, rest, {
|
|
12
14
|
className: className,
|
|
13
15
|
style: {
|
|
14
16
|
position: 'relative',
|
|
@@ -22,4 +24,4 @@ export function AspectRatio({
|
|
|
22
24
|
inset: 0
|
|
23
25
|
}
|
|
24
26
|
}, children));
|
|
25
|
-
}
|
|
27
|
+
});
|
package/display/Avatar.d.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
export interface AvatarProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
/** Image URL; falls back to initials */
|
|
5
|
-
src?: string;
|
|
6
|
-
/** Px @default 32 */
|
|
7
|
-
size?: number;
|
|
2
|
+
/** Named avatar size. @default "default" */
|
|
3
|
+
size?: 'default' | 'sm' | 'lg';
|
|
8
4
|
}
|
|
9
|
-
export declare
|
|
5
|
+
export declare const Avatar: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLSpanElement>>;
|
|
10
6
|
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export
|
|
7
|
+
export type AvatarImageProps = React.ImgHTMLAttributes<HTMLImageElement>;
|
|
8
|
+
export declare const AvatarImage: React.ForwardRefExoticComponent<AvatarImageProps & React.RefAttributes<HTMLImageElement>>;
|
|
9
|
+
|
|
10
|
+
export type AvatarFallbackProps = React.HTMLAttributes<HTMLSpanElement>;
|
|
11
|
+
export declare const AvatarFallback: React.ForwardRefExoticComponent<AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>>;
|
|
12
|
+
|
|
13
|
+
export type AvatarBadgeProps = React.HTMLAttributes<HTMLSpanElement>;
|
|
14
|
+
export declare const AvatarBadge: React.ForwardRefExoticComponent<AvatarBadgeProps & React.RefAttributes<HTMLSpanElement>>;
|
|
15
|
+
|
|
16
|
+
export type AvatarGroupProps = React.HTMLAttributes<HTMLDivElement>;
|
|
17
|
+
export declare const AvatarGroup: React.ForwardRefExoticComponent<AvatarGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
18
|
+
|
|
19
|
+
export type AvatarGroupCountProps = React.HTMLAttributes<HTMLSpanElement>;
|
|
20
|
+
export declare const AvatarGroupCount: React.ForwardRefExoticComponent<AvatarGroupCountProps & React.RefAttributes<HTMLSpanElement>>;
|
package/display/Avatar.js
CHANGED
|
@@ -1,52 +1,77 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
import React from 'react';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
size =
|
|
9
|
-
|
|
4
|
+
function classes(...values) {
|
|
5
|
+
return values.filter(Boolean).join(' ');
|
|
6
|
+
}
|
|
7
|
+
export const Avatar = /*#__PURE__*/React.forwardRef(function Avatar({
|
|
8
|
+
size = 'default',
|
|
9
|
+
className,
|
|
10
|
+
...rest
|
|
11
|
+
}, ref) {
|
|
12
|
+
const sizeName = ['sm', 'lg'].includes(size) ? size : 'default';
|
|
13
|
+
return /*#__PURE__*/React.createElement("span", _extends({}, rest, {
|
|
14
|
+
ref: ref,
|
|
15
|
+
"data-slot": "avatar",
|
|
16
|
+
"data-size": sizeName,
|
|
17
|
+
className: classes('ef-avatar', sizeName !== 'default' && `ef-avatar--${sizeName}`, className)
|
|
18
|
+
}));
|
|
19
|
+
});
|
|
20
|
+
export const AvatarImage = /*#__PURE__*/React.forwardRef(function AvatarImage({
|
|
10
21
|
className,
|
|
22
|
+
onError,
|
|
11
23
|
...rest
|
|
12
|
-
}) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
for (let i = 0; i < name.length; i++) h = h * 31 + name.charCodeAt(i) >>> 0;
|
|
24
|
-
const [bg, fg] = TONES[h % TONES.length];
|
|
25
|
-
return /*#__PURE__*/React.createElement("span", _extends({
|
|
26
|
-
className: `ef-avatar${className ? ' ' + className : ''}`,
|
|
27
|
-
title: name || undefined,
|
|
28
|
-
style: {
|
|
29
|
-
width: size,
|
|
30
|
-
height: size,
|
|
31
|
-
fontSize: Math.round(size * 0.38),
|
|
32
|
-
background: showImg ? 'var(--sand-100)' : bg,
|
|
33
|
-
color: fg,
|
|
34
|
-
...style
|
|
24
|
+
}, ref) {
|
|
25
|
+
const [failed, setFailed] = React.useState(false);
|
|
26
|
+
React.useEffect(() => setFailed(false), [rest.src]);
|
|
27
|
+
if (failed) return null;
|
|
28
|
+
return /*#__PURE__*/React.createElement("img", _extends({}, rest, {
|
|
29
|
+
ref: ref,
|
|
30
|
+
"data-slot": "avatar-image",
|
|
31
|
+
className: classes('ef-avatar__image', className),
|
|
32
|
+
onError: event => {
|
|
33
|
+
setFailed(true);
|
|
34
|
+
onError?.(event);
|
|
35
35
|
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
}));
|
|
37
|
+
});
|
|
38
|
+
export const AvatarFallback = /*#__PURE__*/React.forwardRef(function AvatarFallback({
|
|
39
|
+
className,
|
|
40
|
+
...rest
|
|
41
|
+
}, ref) {
|
|
42
|
+
return /*#__PURE__*/React.createElement("span", _extends({}, rest, {
|
|
43
|
+
ref: ref,
|
|
44
|
+
"data-slot": "avatar-fallback",
|
|
45
|
+
className: classes('ef-avatar__fallback', className)
|
|
46
|
+
}));
|
|
47
|
+
});
|
|
48
|
+
export const AvatarBadge = /*#__PURE__*/React.forwardRef(function AvatarBadge({
|
|
49
|
+
className,
|
|
50
|
+
...rest
|
|
51
|
+
}, ref) {
|
|
52
|
+
return /*#__PURE__*/React.createElement("span", _extends({}, rest, {
|
|
53
|
+
ref: ref,
|
|
54
|
+
"data-slot": "avatar-badge",
|
|
55
|
+
className: classes('ef-avatar__badge', className)
|
|
56
|
+
}));
|
|
57
|
+
});
|
|
58
|
+
export const AvatarGroup = /*#__PURE__*/React.forwardRef(function AvatarGroup({
|
|
59
|
+
className,
|
|
60
|
+
...rest
|
|
61
|
+
}, ref) {
|
|
62
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
63
|
+
ref: ref,
|
|
64
|
+
"data-slot": "avatar-group",
|
|
65
|
+
className: classes('ef-avatar-group', className)
|
|
66
|
+
}));
|
|
67
|
+
});
|
|
68
|
+
export const AvatarGroupCount = /*#__PURE__*/React.forwardRef(function AvatarGroupCount({
|
|
45
69
|
className,
|
|
46
70
|
...rest
|
|
47
|
-
}) {
|
|
71
|
+
}, ref) {
|
|
48
72
|
return /*#__PURE__*/React.createElement("span", _extends({}, rest, {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
73
|
+
ref: ref,
|
|
74
|
+
"data-slot": "avatar-group-count",
|
|
75
|
+
className: classes('ef-avatar-count', className)
|
|
76
|
+
}));
|
|
77
|
+
});
|
package/display/Badge.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
export type BadgeVariant = 'default' | 'secondary' | 'destructive' | 'outline' | 'ghost' | 'link';
|
|
2
|
+
|
|
1
3
|
export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
2
|
-
/** @default '
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
/** Leading status dot */
|
|
7
|
-
dot?: boolean;
|
|
8
|
-
children?: React.ReactNode;
|
|
4
|
+
/** @default 'default' */
|
|
5
|
+
variant?: BadgeVariant;
|
|
6
|
+
/** Render the single child as the badge root. */
|
|
7
|
+
asChild?: boolean;
|
|
9
8
|
}
|
|
10
|
-
|
|
9
|
+
|
|
10
|
+
export declare function badgeVariants(options?: Pick<BadgeProps, 'variant'> & { className?: string }): string;
|
|
11
|
+
export declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLElement>>;
|
package/display/Badge.js
CHANGED
|
@@ -1,19 +1,37 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
import React from 'react';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { mergeRefs } from "../forms/Button.js";
|
|
5
|
+
export function badgeVariants({
|
|
6
|
+
variant = 'default',
|
|
7
|
+
className = ''
|
|
8
|
+
} = {}) {
|
|
9
|
+
return `ef-badge ef-badge--${variant}${className ? ' ' + className : ''}`;
|
|
10
|
+
}
|
|
11
|
+
export const Badge = /*#__PURE__*/React.forwardRef(function Badge({
|
|
12
|
+
variant = 'default',
|
|
13
|
+
asChild = false,
|
|
8
14
|
children,
|
|
9
|
-
style,
|
|
10
15
|
className,
|
|
11
|
-
...
|
|
12
|
-
}) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
...props
|
|
17
|
+
}, ref) {
|
|
18
|
+
const classes = badgeVariants({
|
|
19
|
+
variant,
|
|
20
|
+
className
|
|
21
|
+
});
|
|
22
|
+
if (asChild) {
|
|
23
|
+
const child = React.Children.only(children);
|
|
24
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
25
|
+
...props,
|
|
26
|
+
...child.props,
|
|
27
|
+
ref: mergeRefs(ref, child.ref),
|
|
28
|
+
'data-slot': 'badge',
|
|
29
|
+
className: `${classes}${child.props.className ? ' ' + child.props.className : ''}`
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return /*#__PURE__*/React.createElement("span", _extends({}, props, {
|
|
33
|
+
ref: ref,
|
|
34
|
+
"data-slot": "badge",
|
|
35
|
+
className: classes
|
|
36
|
+
}), children);
|
|
37
|
+
});
|
package/display/Card.d.ts
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
|
|
1
3
|
export interface CardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
2
|
-
|
|
3
|
-
title?: React.ReactNode;
|
|
4
|
-
subtitle?: React.ReactNode;
|
|
5
|
-
/** Right-aligned header slot (buttons etc.) */
|
|
6
|
-
actions?: React.ReactNode;
|
|
7
|
-
/** Footer slot on a sunken strip */
|
|
8
|
-
footer?: React.ReactNode;
|
|
9
|
-
/** Body padding in px @default 20 */
|
|
10
|
-
padding?: number;
|
|
11
|
-
/** Slightly stronger shadow */
|
|
4
|
+
size?: 'default' | 'sm';
|
|
12
5
|
elevated?: boolean;
|
|
13
|
-
/** Hover lift + pointer */
|
|
14
6
|
interactive?: boolean;
|
|
15
|
-
children?: React.ReactNode;
|
|
16
7
|
}
|
|
17
|
-
|
|
8
|
+
|
|
9
|
+
export declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export declare const CardHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export declare const CardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
export declare const CardDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export declare const CardAction: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
export declare const CardContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
export declare const CardFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|