react-restyle-components 0.4.23 → 0.4.24
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/lib/src/core-components/src/components/AlertBanner/AlertBanner.d.ts +4 -0
- package/lib/src/core-components/src/components/AlertBanner/AlertBanner.d.ts.map +1 -0
- package/lib/src/core-components/src/components/AlertBanner/AlertBanner.js +45 -0
- package/lib/src/core-components/src/components/AlertBanner/elements.d.ts +27 -0
- package/lib/src/core-components/src/components/AlertBanner/elements.d.ts.map +1 -0
- package/lib/src/core-components/src/components/AlertBanner/elements.js +233 -0
- package/lib/src/core-components/src/components/AlertBanner/index.d.ts +3 -0
- package/lib/src/core-components/src/components/AlertBanner/index.d.ts.map +1 -0
- package/lib/src/core-components/src/components/AlertBanner/index.js +2 -0
- package/lib/src/core-components/src/components/AlertBanner/types.d.ts +46 -0
- package/lib/src/core-components/src/components/AlertBanner/types.d.ts.map +1 -0
- package/lib/src/core-components/src/components/AlertBanner/types.js +10 -0
- package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.d.ts.map +1 -1
- package/lib/src/core-components/src/components/Badge/Badge.d.ts +33 -33
- package/lib/src/core-components/src/components/Breadcrumb/Breadcrumb.d.ts +28 -0
- package/lib/src/core-components/src/components/Breadcrumb/Breadcrumb.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Breadcrumb/Breadcrumb.js +83 -0
- package/lib/src/core-components/src/components/Breadcrumb/elements.d.ts +44 -0
- package/lib/src/core-components/src/components/Breadcrumb/elements.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Breadcrumb/elements.js +370 -0
- package/lib/src/core-components/src/components/Breadcrumb/index.d.ts +4 -0
- package/lib/src/core-components/src/components/Breadcrumb/index.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Breadcrumb/index.js +3 -0
- package/lib/src/core-components/src/components/Breadcrumb/types.d.ts +14 -0
- package/lib/src/core-components/src/components/Breadcrumb/types.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Breadcrumb/types.js +3 -0
- package/lib/src/core-components/src/components/Button/Button.spec.js +1 -1
- package/lib/src/core-components/src/components/Button/button.component.js +1 -1
- package/lib/src/core-components/src/components/Chip/Chip.d.ts +5 -0
- package/lib/src/core-components/src/components/Chip/Chip.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Chip/Chip.js +64 -0
- package/lib/src/core-components/src/components/Chip/elements.d.ts +27 -0
- package/lib/src/core-components/src/components/Chip/elements.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Chip/elements.js +253 -0
- package/lib/src/core-components/src/components/Chip/index.d.ts +3 -0
- package/lib/src/core-components/src/components/Chip/index.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Chip/index.js +2 -0
- package/lib/src/core-components/src/components/Chip/types.d.ts +54 -0
- package/lib/src/core-components/src/components/Chip/types.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Chip/types.js +4 -0
- package/lib/src/core-components/src/components/Divider/Divider.d.ts +4 -0
- package/lib/src/core-components/src/components/Divider/Divider.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Divider/Divider.js +25 -0
- package/lib/src/core-components/src/components/Divider/elements.d.ts +22 -0
- package/lib/src/core-components/src/components/Divider/elements.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Divider/elements.js +103 -0
- package/lib/src/core-components/src/components/Divider/index.d.ts +3 -0
- package/lib/src/core-components/src/components/Divider/index.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Divider/index.js +2 -0
- package/lib/src/core-components/src/components/Divider/types.d.ts +30 -0
- package/lib/src/core-components/src/components/Divider/types.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Divider/types.js +4 -0
- package/lib/src/core-components/src/components/DynamicGrid/DynamicGrid.d.ts +6 -0
- package/lib/src/core-components/src/components/DynamicGrid/DynamicGrid.d.ts.map +1 -0
- package/lib/src/core-components/src/components/DynamicGrid/DynamicGrid.js +147 -0
- package/lib/src/core-components/src/components/DynamicGrid/GridContainer.d.ts +12 -0
- package/lib/src/core-components/src/components/DynamicGrid/GridContainer.d.ts.map +1 -0
- package/lib/src/core-components/src/components/DynamicGrid/GridContainer.js +89 -0
- package/lib/src/core-components/src/components/DynamicGrid/elements.d.ts +49 -0
- package/lib/src/core-components/src/components/DynamicGrid/elements.d.ts.map +1 -0
- package/lib/src/core-components/src/components/DynamicGrid/elements.js +409 -0
- package/lib/src/core-components/src/components/DynamicGrid/index.d.ts +4 -0
- package/lib/src/core-components/src/components/DynamicGrid/index.d.ts.map +1 -0
- package/lib/src/core-components/src/components/DynamicGrid/index.js +3 -0
- package/lib/src/core-components/src/components/DynamicGrid/types.d.ts +173 -0
- package/lib/src/core-components/src/components/DynamicGrid/types.d.ts.map +1 -0
- package/lib/src/core-components/src/components/DynamicGrid/types.js +28 -0
- package/lib/src/core-components/src/components/DynamicGrid/utils.d.ts +65 -0
- package/lib/src/core-components/src/components/DynamicGrid/utils.d.ts.map +1 -0
- package/lib/src/core-components/src/components/DynamicGrid/utils.js +193 -0
- package/lib/src/core-components/src/components/FormField/FormField.d.ts +1 -1
- package/lib/src/core-components/src/components/Icon/Icon.js +1 -1
- package/lib/src/core-components/src/components/Masonry/Masonry.d.ts +7 -0
- package/lib/src/core-components/src/components/Masonry/Masonry.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Masonry/Masonry.js +73 -0
- package/lib/src/core-components/src/components/Masonry/elements.d.ts +31 -0
- package/lib/src/core-components/src/components/Masonry/elements.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Masonry/elements.js +122 -0
- package/lib/src/core-components/src/components/Masonry/hooks.d.ts +21 -0
- package/lib/src/core-components/src/components/Masonry/hooks.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Masonry/hooks.js +100 -0
- package/lib/src/core-components/src/components/Masonry/index.d.ts +4 -0
- package/lib/src/core-components/src/components/Masonry/index.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Masonry/index.js +3 -0
- package/lib/src/core-components/src/components/Masonry/types.d.ts +117 -0
- package/lib/src/core-components/src/components/Masonry/types.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Masonry/types.js +1 -0
- package/lib/src/core-components/src/components/Picker/color-picker-modal/color-picker-modal.component.js +1 -1
- package/lib/src/core-components/src/components/Skeleton/Skeleton.d.ts +8 -0
- package/lib/src/core-components/src/components/Skeleton/Skeleton.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Skeleton/Skeleton.js +51 -0
- package/lib/src/core-components/src/components/Skeleton/elements.d.ts +33 -0
- package/lib/src/core-components/src/components/Skeleton/elements.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Skeleton/elements.js +238 -0
- package/lib/src/core-components/src/components/Skeleton/index.d.ts +3 -0
- package/lib/src/core-components/src/components/Skeleton/index.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Skeleton/index.js +2 -0
- package/lib/src/core-components/src/components/Skeleton/types.d.ts +80 -0
- package/lib/src/core-components/src/components/Skeleton/types.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Skeleton/types.js +4 -0
- package/lib/src/core-components/src/components/SpeedDial/SpeedDial.d.ts +4 -0
- package/lib/src/core-components/src/components/SpeedDial/SpeedDial.d.ts.map +1 -0
- package/lib/src/core-components/src/components/SpeedDial/SpeedDial.js +128 -0
- package/lib/src/core-components/src/components/SpeedDial/elements.d.ts +57 -0
- package/lib/src/core-components/src/components/SpeedDial/elements.d.ts.map +1 -0
- package/lib/src/core-components/src/components/SpeedDial/elements.js +299 -0
- package/lib/src/core-components/src/components/SpeedDial/index.d.ts +3 -0
- package/lib/src/core-components/src/components/SpeedDial/index.d.ts.map +1 -0
- package/lib/src/core-components/src/components/SpeedDial/index.js +2 -0
- package/lib/src/core-components/src/components/SpeedDial/types.d.ts +149 -0
- package/lib/src/core-components/src/components/SpeedDial/types.d.ts.map +1 -0
- package/lib/src/core-components/src/components/SpeedDial/types.js +3 -0
- package/lib/src/core-components/src/components/Switch/Switch.d.ts +4 -0
- package/lib/src/core-components/src/components/Switch/Switch.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Switch/Switch.js +26 -0
- package/lib/src/core-components/src/components/Switch/elements.d.ts +33 -0
- package/lib/src/core-components/src/components/Switch/elements.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Switch/elements.js +167 -0
- package/lib/src/core-components/src/components/Switch/index.d.ts +3 -0
- package/lib/src/core-components/src/components/Switch/index.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Switch/index.js +2 -0
- package/lib/src/core-components/src/components/Switch/types.d.ts +32 -0
- package/lib/src/core-components/src/components/Switch/types.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Switch/types.js +3 -0
- package/lib/src/core-components/src/components/Table/Table.d.ts +7 -0
- package/lib/src/core-components/src/components/Table/Table.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Table/Table.js +357 -0
- package/lib/src/core-components/src/components/Table/elements.d.ts +89 -0
- package/lib/src/core-components/src/components/Table/elements.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Table/elements.js +604 -0
- package/lib/src/core-components/src/components/Table/filters.d.ts +23 -0
- package/lib/src/core-components/src/components/Table/filters.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Table/filters.js +181 -0
- package/lib/src/core-components/src/components/Table/hooks.d.ts +107 -0
- package/lib/src/core-components/src/components/Table/hooks.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Table/hooks.js +451 -0
- package/lib/src/core-components/src/components/Table/index.d.ts +5 -0
- package/lib/src/core-components/src/components/Table/index.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Table/index.js +4 -0
- package/lib/src/core-components/src/components/Table/types.d.ts +358 -0
- package/lib/src/core-components/src/components/Table/types.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Table/types.js +1 -0
- package/lib/src/core-components/src/components/Toast/Toast.d.ts +5 -0
- package/lib/src/core-components/src/components/Toast/Toast.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Toast/Toast.js +50 -0
- package/lib/src/core-components/src/components/Toast/elements.d.ts +28 -0
- package/lib/src/core-components/src/components/Toast/elements.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Toast/elements.js +272 -0
- package/lib/src/core-components/src/components/Toast/index.d.ts +3 -0
- package/lib/src/core-components/src/components/Toast/index.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Toast/index.js +2 -0
- package/lib/src/core-components/src/components/Toast/types.d.ts +52 -0
- package/lib/src/core-components/src/components/Toast/types.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Toast/types.js +9 -0
- package/lib/src/core-components/src/components/Tooltip/Tooltip.d.ts +7 -0
- package/lib/src/core-components/src/components/Tooltip/Tooltip.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Tooltip/Tooltip.js +200 -0
- package/lib/src/core-components/src/components/Tooltip/elements.d.ts +19 -0
- package/lib/src/core-components/src/components/Tooltip/elements.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Tooltip/elements.js +195 -0
- package/lib/src/core-components/src/components/Tooltip/index.d.ts +3 -0
- package/lib/src/core-components/src/components/Tooltip/index.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Tooltip/index.js +2 -0
- package/lib/src/core-components/src/components/Tooltip/types.d.ts +81 -17
- package/lib/src/core-components/src/components/Tooltip/types.d.ts.map +1 -1
- package/lib/src/core-components/src/components/Tooltip/types.js +17 -1
- package/lib/src/core-components/src/components/Tooltip/utils.d.ts +26 -0
- package/lib/src/core-components/src/components/Tooltip/utils.d.ts.map +1 -0
- package/lib/src/core-components/src/components/Tooltip/utils.js +140 -0
- package/lib/src/core-components/src/components/TreeSelect/TreeSelect.d.ts +5 -0
- package/lib/src/core-components/src/components/TreeSelect/TreeSelect.d.ts.map +1 -0
- package/lib/src/core-components/src/components/TreeSelect/TreeSelect.js +303 -0
- package/lib/src/core-components/src/components/TreeSelect/elements.d.ts +74 -0
- package/lib/src/core-components/src/components/TreeSelect/elements.d.ts.map +1 -0
- package/lib/src/core-components/src/components/TreeSelect/elements.js +494 -0
- package/lib/src/core-components/src/components/TreeSelect/hooks.d.ts +57 -0
- package/lib/src/core-components/src/components/TreeSelect/hooks.d.ts.map +1 -0
- package/lib/src/core-components/src/components/TreeSelect/hooks.js +252 -0
- package/lib/src/core-components/src/components/TreeSelect/index.d.ts +4 -0
- package/lib/src/core-components/src/components/TreeSelect/index.d.ts.map +1 -0
- package/lib/src/core-components/src/components/TreeSelect/index.js +3 -0
- package/lib/src/core-components/src/components/TreeSelect/types.d.ts +205 -0
- package/lib/src/core-components/src/components/TreeSelect/types.d.ts.map +1 -0
- package/lib/src/core-components/src/components/TreeSelect/types.js +1 -0
- package/lib/src/core-components/src/components/index.d.ts +13 -1
- package/lib/src/core-components/src/components/index.d.ts.map +1 -1
- package/lib/src/core-components/src/components/index.js +14 -1
- package/lib/src/core-components/src/core-components/CoreButton/CoreButton.d.ts +2 -2
- package/lib/src/core-components/src/tc.global.css +7 -3
- package/lib/src/core-components/src/tc.module.css +2 -2
- package/package.json +1 -1
- package/lib/src/core-components/src/components/Tooltip/tooltip.component.d.ts +0 -29
- package/lib/src/core-components/src/components/Tooltip/tooltip.component.d.ts.map +0 -1
- package/lib/src/core-components/src/components/Tooltip/tooltip.component.js +0 -10
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useState, useRef, useCallback, useEffect, } from 'react';
|
|
4
|
+
import { Icon } from '../Icon/Icon';
|
|
5
|
+
import { Tooltip } from '../Tooltip/Tooltip';
|
|
6
|
+
import { SpeedDialRoot, SpeedDialBackdrop, SpeedDialFab, SpeedDialActions, SpeedDialActionWrapper, SpeedDialActionButton, SpeedDialActionLabel, IconWrapper, sizeConfig, } from './elements';
|
|
7
|
+
// Default icons
|
|
8
|
+
const PlusIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", children: [_jsx("line", { x1: "12", y1: "5", x2: "12", y2: "19" }), _jsx("line", { x1: "5", y1: "12", x2: "19", y2: "12" })] }));
|
|
9
|
+
const CloseIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", children: [_jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), _jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })] }));
|
|
10
|
+
export const SpeedDial = forwardRef(function SpeedDialComponent(props, ref) {
|
|
11
|
+
const { actions, open: controlledOpen, defaultOpen = false, onOpenChange, onActionClick, uiConfig = {}, mainButtonConfig = {}, classNames = {}, styles = {}, disabled = false, hidden = false, closeOnActionClick = true, closeOnClickOutside = true, closeOnEscape = true, className, style, ariaLabel, } = props;
|
|
12
|
+
// Destructure configs with defaults
|
|
13
|
+
const { direction = 'up', size = 'medium', variant = 'filled', gap = 12, showLabels = false, showTooltips = true, animationDuration = 200, staggerDelay = 30, showBackdrop = false, backdropOpacity = 0.3, zIndex = 1000, } = uiConfig;
|
|
14
|
+
const { openIcon = 'MdAdd', closeIcon = 'MdClose', openIconElement, closeIconElement, backgroundColor, iconColor, rotateOnToggle = true, rotationDegrees = 45, ariaLabelClosed = 'Open speed dial', ariaLabelOpen = 'Close speed dial', } = mainButtonConfig;
|
|
15
|
+
// Refs
|
|
16
|
+
const rootRef = useRef(null);
|
|
17
|
+
// State
|
|
18
|
+
const [internalOpen, setInternalOpen] = useState(defaultOpen);
|
|
19
|
+
// Controlled vs uncontrolled
|
|
20
|
+
const isControlled = controlledOpen !== undefined;
|
|
21
|
+
const isOpen = isControlled ? controlledOpen : internalOpen;
|
|
22
|
+
// Handle open/close
|
|
23
|
+
const setOpen = useCallback((newOpen) => {
|
|
24
|
+
if (disabled)
|
|
25
|
+
return;
|
|
26
|
+
if (isControlled) {
|
|
27
|
+
onOpenChange?.(newOpen);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
setInternalOpen(newOpen);
|
|
31
|
+
onOpenChange?.(newOpen);
|
|
32
|
+
}
|
|
33
|
+
}, [disabled, isControlled, onOpenChange]);
|
|
34
|
+
const toggle = useCallback(() => {
|
|
35
|
+
setOpen(!isOpen);
|
|
36
|
+
}, [isOpen, setOpen]);
|
|
37
|
+
const close = useCallback(() => {
|
|
38
|
+
setOpen(false);
|
|
39
|
+
}, [setOpen]);
|
|
40
|
+
// Handle action click
|
|
41
|
+
const handleActionClick = useCallback((action, e) => {
|
|
42
|
+
if (action.disabled)
|
|
43
|
+
return;
|
|
44
|
+
action.onClick?.(e);
|
|
45
|
+
onActionClick?.(action, e);
|
|
46
|
+
if (closeOnActionClick) {
|
|
47
|
+
close();
|
|
48
|
+
}
|
|
49
|
+
}, [closeOnActionClick, close, onActionClick]);
|
|
50
|
+
// Click outside handler
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (!isOpen || !closeOnClickOutside)
|
|
53
|
+
return;
|
|
54
|
+
const handleClickOutside = (e) => {
|
|
55
|
+
if (rootRef.current && !rootRef.current.contains(e.target)) {
|
|
56
|
+
close();
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
// Delay to prevent immediate close on open click
|
|
60
|
+
const timeout = setTimeout(() => {
|
|
61
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
62
|
+
}, 0);
|
|
63
|
+
return () => {
|
|
64
|
+
clearTimeout(timeout);
|
|
65
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
66
|
+
};
|
|
67
|
+
}, [isOpen, closeOnClickOutside, close]);
|
|
68
|
+
// Escape key handler
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
if (!isOpen || !closeOnEscape)
|
|
71
|
+
return;
|
|
72
|
+
const handleEscape = (e) => {
|
|
73
|
+
if (e.key === 'Escape') {
|
|
74
|
+
close();
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
document.addEventListener('keydown', handleEscape);
|
|
78
|
+
return () => document.removeEventListener('keydown', handleEscape);
|
|
79
|
+
}, [isOpen, closeOnEscape, close]);
|
|
80
|
+
// Render main button icon
|
|
81
|
+
const renderMainIcon = () => {
|
|
82
|
+
if (isOpen) {
|
|
83
|
+
if (closeIconElement)
|
|
84
|
+
return closeIconElement;
|
|
85
|
+
if (!rotateOnToggle) {
|
|
86
|
+
return (_jsx(IconWrapper, { "$size": size, children: _jsx(Icon, { nameIcon: closeIcon, propsIcon: { size: sizeConfig[size].iconSize, color: 'currentColor' } }) }));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (openIconElement)
|
|
90
|
+
return openIconElement;
|
|
91
|
+
// Use default plus/close icons for rotation effect
|
|
92
|
+
if (rotateOnToggle) {
|
|
93
|
+
return (_jsx(IconWrapper, { "$size": size, children: _jsx(PlusIcon, {}) }));
|
|
94
|
+
}
|
|
95
|
+
return (_jsx(IconWrapper, { "$size": size, children: _jsx(Icon, { nameIcon: openIcon, propsIcon: { size: sizeConfig[size].iconSize, color: 'currentColor' } }) }));
|
|
96
|
+
};
|
|
97
|
+
// Render action icon
|
|
98
|
+
const renderActionIcon = (action) => {
|
|
99
|
+
if (action.iconElement) {
|
|
100
|
+
return (_jsx(IconWrapper, { "$size": size, "$isAction": true, children: action.iconElement }));
|
|
101
|
+
}
|
|
102
|
+
return (_jsx(IconWrapper, { "$size": size, "$isAction": true, children: _jsx(Icon, { nameIcon: action.icon, propsIcon: {
|
|
103
|
+
size: sizeConfig[size].actionIconSize,
|
|
104
|
+
color: action.iconColor || 'currentColor',
|
|
105
|
+
} }) }));
|
|
106
|
+
};
|
|
107
|
+
// Render action button
|
|
108
|
+
const renderAction = (action, index) => {
|
|
109
|
+
const button = (_jsx(SpeedDialActionButton, { "$size": size, "$isOpen": isOpen, "$index": index, "$staggerDelay": staggerDelay, "$animationDuration": animationDuration, "$customBg": action.backgroundColor, "$customColor": action.iconColor, onClick: (e) => handleActionClick(action, e), disabled: action.disabled, "aria-label": action.ariaLabel || action.tooltip || action.label, className: classNames.action || action.className, style: { ...styles.action, ...action.style }, children: renderActionIcon(action) }, action.id));
|
|
110
|
+
if (showLabels && action.label) {
|
|
111
|
+
return (_jsxs(SpeedDialActionWrapper, { "$direction": direction, "$showLabels": showLabels, children: [(direction === 'left' || direction === 'up') && (_jsx(SpeedDialActionLabel, { "$size": size, "$direction": direction, "$isOpen": isOpen, "$index": index, "$staggerDelay": staggerDelay, className: classNames.actionLabel, style: styles.actionLabel, children: action.label })), button, (direction === 'right' || direction === 'down') && (_jsx(SpeedDialActionLabel, { "$size": size, "$direction": direction, "$isOpen": isOpen, "$index": index, "$staggerDelay": staggerDelay, className: classNames.actionLabel, style: styles.actionLabel, children: action.label }))] }, action.id));
|
|
112
|
+
}
|
|
113
|
+
if (showTooltips && action.tooltip) {
|
|
114
|
+
return (_jsx(Tooltip, { content: action.tooltip, position: direction === 'up' || direction === 'down' ? 'left' : 'top', delay: 100, children: button }, action.id));
|
|
115
|
+
}
|
|
116
|
+
return button;
|
|
117
|
+
};
|
|
118
|
+
return (_jsxs(_Fragment, { children: [showBackdrop && (_jsx(SpeedDialBackdrop, { "$isOpen": isOpen, "$opacity": backdropOpacity, "$zIndex": zIndex, className: classNames.backdrop, style: styles.backdrop, onClick: close })), _jsxs(SpeedDialRoot, { ref: (node) => {
|
|
119
|
+
rootRef.current = node;
|
|
120
|
+
if (typeof ref === 'function') {
|
|
121
|
+
ref(node);
|
|
122
|
+
}
|
|
123
|
+
else if (ref) {
|
|
124
|
+
ref.current = node;
|
|
125
|
+
}
|
|
126
|
+
}, "$zIndex": zIndex, "$hidden": hidden, className: className || classNames.root, style: { ...styles.root, ...style }, role: "menu", "aria-label": ariaLabel || 'Speed dial', "aria-expanded": isOpen, children: [_jsx(SpeedDialFab, { "$size": size, "$variant": variant, "$isOpen": isOpen, "$rotateOnToggle": rotateOnToggle, "$rotationDegrees": rotationDegrees, "$customBg": backgroundColor, "$customColor": iconColor, onClick: toggle, disabled: disabled, "aria-label": isOpen ? ariaLabelOpen : ariaLabelClosed, className: classNames.fab, style: styles.fab, children: renderMainIcon() }), _jsx(SpeedDialActions, { "$direction": direction, "$gap": gap, "$isOpen": isOpen, className: classNames.actions, style: styles.actions, role: "menu", children: actions.map((action, index) => renderAction(action, index)) })] })] }));
|
|
127
|
+
});
|
|
128
|
+
SpeedDial.displayName = 'SpeedDial';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SpeedDialDirection, SpeedDialSize, SpeedDialVariant } from './types';
|
|
3
|
+
export declare const sizeConfig: Record<SpeedDialSize, {
|
|
4
|
+
fabSize: number;
|
|
5
|
+
actionSize: number;
|
|
6
|
+
iconSize: number;
|
|
7
|
+
actionIconSize: number;
|
|
8
|
+
labelFontSize: string;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const SpeedDialRoot: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
11
|
+
$zIndex: number;
|
|
12
|
+
$hidden: boolean;
|
|
13
|
+
}>> & string;
|
|
14
|
+
export declare const SpeedDialBackdrop: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
15
|
+
$isOpen: boolean;
|
|
16
|
+
$opacity: number;
|
|
17
|
+
$zIndex: number;
|
|
18
|
+
}>> & string;
|
|
19
|
+
export declare const SpeedDialFab: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
|
|
20
|
+
$size: SpeedDialSize;
|
|
21
|
+
$variant: SpeedDialVariant;
|
|
22
|
+
$isOpen: boolean;
|
|
23
|
+
$rotateOnToggle: boolean;
|
|
24
|
+
$rotationDegrees: number;
|
|
25
|
+
$customBg?: string | undefined;
|
|
26
|
+
$customColor?: string | undefined;
|
|
27
|
+
}>> & string;
|
|
28
|
+
export declare const SpeedDialActions: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
29
|
+
$direction: SpeedDialDirection;
|
|
30
|
+
$gap: number;
|
|
31
|
+
$isOpen: boolean;
|
|
32
|
+
}>> & string;
|
|
33
|
+
export declare const SpeedDialActionWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
34
|
+
$direction: SpeedDialDirection;
|
|
35
|
+
$showLabels: boolean;
|
|
36
|
+
}>> & string;
|
|
37
|
+
export declare const SpeedDialActionButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
|
|
38
|
+
$size: SpeedDialSize;
|
|
39
|
+
$isOpen: boolean;
|
|
40
|
+
$index: number;
|
|
41
|
+
$staggerDelay: number;
|
|
42
|
+
$animationDuration: number;
|
|
43
|
+
$customBg?: string | undefined;
|
|
44
|
+
$customColor?: string | undefined;
|
|
45
|
+
}>> & string;
|
|
46
|
+
export declare const SpeedDialActionLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
47
|
+
$size: SpeedDialSize;
|
|
48
|
+
$direction: SpeedDialDirection;
|
|
49
|
+
$isOpen: boolean;
|
|
50
|
+
$index: number;
|
|
51
|
+
$staggerDelay: number;
|
|
52
|
+
}>> & string;
|
|
53
|
+
export declare const IconWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
54
|
+
$size: SpeedDialSize;
|
|
55
|
+
$isAction?: boolean | undefined;
|
|
56
|
+
}>> & string;
|
|
57
|
+
//# sourceMappingURL=elements.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elements.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/components/SpeedDial/elements.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAC,kBAAkB,EAAE,aAAa,EAAE,gBAAgB,EAAC,MAAM,SAAS,CAAC;AA+B5E,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,aAAa,EAAE;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;CACvB,CAsBA,CAAC;AAmFF,eAAO,MAAM,aAAa;aACf,MAAM;aACN,OAAO;YAKjB,CAAC;AAEF,eAAO,MAAM,iBAAiB;aACnB,OAAO;cACN,MAAM;aACP,MAAM;YAShB,CAAC;AAEF,eAAO,MAAM,YAAY;WAChB,aAAa;cACV,gBAAgB;aACjB,OAAO;qBACC,OAAO;sBACN,MAAM;;;YAkDzB,CAAC;AAEF,eAAO,MAAM,gBAAgB;gBACf,kBAAkB;UACxB,MAAM;aACH,OAAO;YASjB,CAAC;AAEF,eAAO,MAAM,sBAAsB;gBACrB,kBAAkB;iBACjB,OAAO;YAcrB,CAAC;AAEF,eAAO,MAAM,qBAAqB;WACzB,aAAa;aACX,OAAO;YACR,MAAM;mBACC,MAAM;wBACD,MAAM;;;YAsD3B,CAAC;AAEF,eAAO,MAAM,oBAAoB;WACxB,aAAa;gBACR,kBAAkB;aACrB,OAAO;YACR,MAAM;mBACC,MAAM;YA2BtB,CAAC;AAEF,eAAO,MAAM,WAAW;WACf,aAAa;;YAerB,CAAC"}
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { styled, css, keyframes } from 'styled-components';
|
|
2
|
+
import { tokens } from '../../utils/designTokens';
|
|
3
|
+
// Animations
|
|
4
|
+
const fadeIn = keyframes `
|
|
5
|
+
from {
|
|
6
|
+
opacity: 0;
|
|
7
|
+
transform: scale(0.3);
|
|
8
|
+
}
|
|
9
|
+
to {
|
|
10
|
+
opacity: 1;
|
|
11
|
+
transform: scale(1);
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
const fadeOut = keyframes `
|
|
15
|
+
from {
|
|
16
|
+
opacity: 1;
|
|
17
|
+
transform: scale(1);
|
|
18
|
+
}
|
|
19
|
+
to {
|
|
20
|
+
opacity: 0;
|
|
21
|
+
transform: scale(0.3);
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
const backdropFadeIn = keyframes `
|
|
25
|
+
from { opacity: 0; }
|
|
26
|
+
to { opacity: 1; }
|
|
27
|
+
`;
|
|
28
|
+
// Size configurations
|
|
29
|
+
export const sizeConfig = {
|
|
30
|
+
small: {
|
|
31
|
+
fabSize: 48,
|
|
32
|
+
actionSize: 40,
|
|
33
|
+
iconSize: 24,
|
|
34
|
+
actionIconSize: 20,
|
|
35
|
+
labelFontSize: '12px',
|
|
36
|
+
},
|
|
37
|
+
medium: {
|
|
38
|
+
fabSize: 56,
|
|
39
|
+
actionSize: 48,
|
|
40
|
+
iconSize: 28,
|
|
41
|
+
actionIconSize: 24,
|
|
42
|
+
labelFontSize: '13px',
|
|
43
|
+
},
|
|
44
|
+
large: {
|
|
45
|
+
fabSize: 64,
|
|
46
|
+
actionSize: 56,
|
|
47
|
+
iconSize: 32,
|
|
48
|
+
actionIconSize: 28,
|
|
49
|
+
labelFontSize: '14px',
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
// Variant styles for FAB
|
|
53
|
+
const fabVariantStyles = {
|
|
54
|
+
filled: css `
|
|
55
|
+
background: ${tokens.primary || '#3b82f6'};
|
|
56
|
+
color: white;
|
|
57
|
+
border: none;
|
|
58
|
+
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
|
|
59
|
+
|
|
60
|
+
&:hover:not(:disabled) {
|
|
61
|
+
background: #2563eb;
|
|
62
|
+
box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
|
|
63
|
+
}
|
|
64
|
+
`,
|
|
65
|
+
outlined: css `
|
|
66
|
+
background: white;
|
|
67
|
+
color: ${tokens.primary || '#3b82f6'};
|
|
68
|
+
border: 2px solid ${tokens.primary || '#3b82f6'};
|
|
69
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
70
|
+
|
|
71
|
+
&:hover:not(:disabled) {
|
|
72
|
+
background: ${tokens.primary || '#3b82f6'}10;
|
|
73
|
+
}
|
|
74
|
+
`,
|
|
75
|
+
soft: css `
|
|
76
|
+
background: ${tokens.primary || '#3b82f6'}15;
|
|
77
|
+
color: ${tokens.primary || '#3b82f6'};
|
|
78
|
+
border: none;
|
|
79
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
|
80
|
+
|
|
81
|
+
&:hover:not(:disabled) {
|
|
82
|
+
background: ${tokens.primary || '#3b82f6'}25;
|
|
83
|
+
}
|
|
84
|
+
`,
|
|
85
|
+
};
|
|
86
|
+
// Direction styles for actions container
|
|
87
|
+
const getDirectionStyles = (direction) => {
|
|
88
|
+
switch (direction) {
|
|
89
|
+
case 'up':
|
|
90
|
+
return css `
|
|
91
|
+
flex-direction: column-reverse;
|
|
92
|
+
bottom: 100%;
|
|
93
|
+
left: 50%;
|
|
94
|
+
transform: translateX(-50%);
|
|
95
|
+
padding-bottom: 16px;
|
|
96
|
+
`;
|
|
97
|
+
case 'down':
|
|
98
|
+
return css `
|
|
99
|
+
flex-direction: column;
|
|
100
|
+
top: 100%;
|
|
101
|
+
left: 50%;
|
|
102
|
+
transform: translateX(-50%);
|
|
103
|
+
padding-top: 16px;
|
|
104
|
+
`;
|
|
105
|
+
case 'left':
|
|
106
|
+
return css `
|
|
107
|
+
flex-direction: row-reverse;
|
|
108
|
+
right: 100%;
|
|
109
|
+
top: 50%;
|
|
110
|
+
transform: translateY(-50%);
|
|
111
|
+
padding-right: 16px;
|
|
112
|
+
`;
|
|
113
|
+
case 'right':
|
|
114
|
+
return css `
|
|
115
|
+
flex-direction: row;
|
|
116
|
+
left: 100%;
|
|
117
|
+
top: 50%;
|
|
118
|
+
transform: translateY(-50%);
|
|
119
|
+
padding-left: 16px;
|
|
120
|
+
`;
|
|
121
|
+
default:
|
|
122
|
+
return css `
|
|
123
|
+
flex-direction: column-reverse;
|
|
124
|
+
bottom: 100%;
|
|
125
|
+
left: 50%;
|
|
126
|
+
transform: translateX(-50%);
|
|
127
|
+
padding-bottom: 16px;
|
|
128
|
+
`;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
export const SpeedDialRoot = styled.div `
|
|
132
|
+
position: relative;
|
|
133
|
+
display: ${({ $hidden }) => ($hidden ? 'none' : 'inline-flex')};
|
|
134
|
+
z-index: ${({ $zIndex }) => $zIndex};
|
|
135
|
+
`;
|
|
136
|
+
export const SpeedDialBackdrop = styled.div `
|
|
137
|
+
position: fixed;
|
|
138
|
+
inset: 0;
|
|
139
|
+
background: rgba(0, 0, 0, ${({ $opacity }) => $opacity});
|
|
140
|
+
z-index: ${({ $zIndex }) => $zIndex - 1};
|
|
141
|
+
pointer-events: ${({ $isOpen }) => ($isOpen ? 'auto' : 'none')};
|
|
142
|
+
opacity: ${({ $isOpen }) => ($isOpen ? 1 : 0)};
|
|
143
|
+
transition: opacity 0.2s ease;
|
|
144
|
+
`;
|
|
145
|
+
export const SpeedDialFab = styled.button `
|
|
146
|
+
position: relative;
|
|
147
|
+
display: flex;
|
|
148
|
+
align-items: center;
|
|
149
|
+
justify-content: center;
|
|
150
|
+
width: ${({ $size }) => sizeConfig[$size].fabSize}px;
|
|
151
|
+
height: ${({ $size }) => sizeConfig[$size].fabSize}px;
|
|
152
|
+
border-radius: 50%;
|
|
153
|
+
cursor: pointer;
|
|
154
|
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
155
|
+
outline: none;
|
|
156
|
+
z-index: 2;
|
|
157
|
+
|
|
158
|
+
${({ $variant }) => fabVariantStyles[$variant]}
|
|
159
|
+
|
|
160
|
+
/* Custom colors override */
|
|
161
|
+
${({ $customBg }) => $customBg && css `background: ${$customBg};`}
|
|
162
|
+
${({ $customColor }) => $customColor && css `color: ${$customColor};`}
|
|
163
|
+
|
|
164
|
+
/* Icon rotation */
|
|
165
|
+
& > * {
|
|
166
|
+
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
167
|
+
${({ $isOpen, $rotateOnToggle, $rotationDegrees }) => $isOpen && $rotateOnToggle && css `
|
|
168
|
+
transform: rotate(${$rotationDegrees}deg);
|
|
169
|
+
`}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/* Focus ring */
|
|
173
|
+
&:focus-visible {
|
|
174
|
+
box-shadow: 0 0 0 3px ${tokens.primary || '#3b82f6'}40;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/* Disabled state */
|
|
178
|
+
&:disabled {
|
|
179
|
+
opacity: 0.5;
|
|
180
|
+
cursor: not-allowed;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/* Hover scale */
|
|
184
|
+
&:hover:not(:disabled) {
|
|
185
|
+
transform: scale(1.05);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
&:active:not(:disabled) {
|
|
189
|
+
transform: scale(0.95);
|
|
190
|
+
}
|
|
191
|
+
`;
|
|
192
|
+
export const SpeedDialActions = styled.div `
|
|
193
|
+
position: absolute;
|
|
194
|
+
display: flex;
|
|
195
|
+
align-items: center;
|
|
196
|
+
gap: ${({ $gap }) => $gap}px;
|
|
197
|
+
pointer-events: ${({ $isOpen }) => ($isOpen ? 'auto' : 'none')};
|
|
198
|
+
|
|
199
|
+
${({ $direction }) => getDirectionStyles($direction)}
|
|
200
|
+
`;
|
|
201
|
+
export const SpeedDialActionWrapper = styled.div `
|
|
202
|
+
display: flex;
|
|
203
|
+
align-items: center;
|
|
204
|
+
gap: 12px;
|
|
205
|
+
|
|
206
|
+
${({ $direction, $showLabels }) => {
|
|
207
|
+
if (!$showLabels)
|
|
208
|
+
return '';
|
|
209
|
+
if ($direction === 'up' || $direction === 'down') {
|
|
210
|
+
return css `flex-direction: row;`;
|
|
211
|
+
}
|
|
212
|
+
return css `flex-direction: column;`;
|
|
213
|
+
}}
|
|
214
|
+
`;
|
|
215
|
+
export const SpeedDialActionButton = styled.button `
|
|
216
|
+
display: flex;
|
|
217
|
+
align-items: center;
|
|
218
|
+
justify-content: center;
|
|
219
|
+
width: ${({ $size }) => sizeConfig[$size].actionSize}px;
|
|
220
|
+
height: ${({ $size }) => sizeConfig[$size].actionSize}px;
|
|
221
|
+
border-radius: 50%;
|
|
222
|
+
border: none;
|
|
223
|
+
background: ${({ $customBg }) => $customBg || 'white'};
|
|
224
|
+
color: ${({ $customColor }) => $customColor || '#374151'};
|
|
225
|
+
cursor: pointer;
|
|
226
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
227
|
+
transition: all 0.2s ease;
|
|
228
|
+
outline: none;
|
|
229
|
+
flex-shrink: 0;
|
|
230
|
+
|
|
231
|
+
/* Animation */
|
|
232
|
+
opacity: 0;
|
|
233
|
+
transform: scale(0.3);
|
|
234
|
+
|
|
235
|
+
${({ $isOpen, $index, $staggerDelay, $animationDuration }) => $isOpen
|
|
236
|
+
? css `
|
|
237
|
+
animation: ${fadeIn} ${$animationDuration}ms ease forwards;
|
|
238
|
+
animation-delay: ${$index * $staggerDelay}ms;
|
|
239
|
+
`
|
|
240
|
+
: css `
|
|
241
|
+
animation: ${fadeOut} ${$animationDuration * 0.5}ms ease forwards;
|
|
242
|
+
animation-delay: ${$index * ($staggerDelay * 0.3)}ms;
|
|
243
|
+
`}
|
|
244
|
+
|
|
245
|
+
/* Focus ring */
|
|
246
|
+
&:focus-visible {
|
|
247
|
+
box-shadow: 0 0 0 3px ${tokens.primary || '#3b82f6'}40;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/* Disabled state */
|
|
251
|
+
&:disabled {
|
|
252
|
+
opacity: 0.4;
|
|
253
|
+
cursor: not-allowed;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/* Hover */
|
|
257
|
+
&:hover:not(:disabled) {
|
|
258
|
+
transform: scale(1.1);
|
|
259
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
&:active:not(:disabled) {
|
|
263
|
+
transform: scale(0.95);
|
|
264
|
+
}
|
|
265
|
+
`;
|
|
266
|
+
export const SpeedDialActionLabel = styled.span `
|
|
267
|
+
font-size: ${({ $size }) => sizeConfig[$size].labelFontSize};
|
|
268
|
+
font-weight: 500;
|
|
269
|
+
color: #374151;
|
|
270
|
+
white-space: nowrap;
|
|
271
|
+
padding: 6px 12px;
|
|
272
|
+
background: white;
|
|
273
|
+
border-radius: 4px;
|
|
274
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
|
|
275
|
+
|
|
276
|
+
/* Animation */
|
|
277
|
+
opacity: 0;
|
|
278
|
+
transform: translateX(${({ $direction }) => $direction === 'left' ? '10px' :
|
|
279
|
+
$direction === 'right' ? '-10px' : '0'}) translateY(${({ $direction }) => $direction === 'up' ? '10px' :
|
|
280
|
+
$direction === 'down' ? '-10px' : '0'});
|
|
281
|
+
|
|
282
|
+
${({ $isOpen, $index, $staggerDelay }) => $isOpen &&
|
|
283
|
+
css `
|
|
284
|
+
animation: ${fadeIn} 150ms ease forwards;
|
|
285
|
+
animation-delay: ${$index * $staggerDelay + 50}ms;
|
|
286
|
+
`}
|
|
287
|
+
`;
|
|
288
|
+
export const IconWrapper = styled.span `
|
|
289
|
+
display: flex;
|
|
290
|
+
align-items: center;
|
|
291
|
+
justify-content: center;
|
|
292
|
+
width: ${({ $size, $isAction }) => $isAction ? sizeConfig[$size].actionIconSize : sizeConfig[$size].iconSize}px;
|
|
293
|
+
height: ${({ $size, $isAction }) => $isAction ? sizeConfig[$size].actionIconSize : sizeConfig[$size].iconSize}px;
|
|
294
|
+
|
|
295
|
+
svg {
|
|
296
|
+
width: 100%;
|
|
297
|
+
height: 100%;
|
|
298
|
+
}
|
|
299
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/components/SpeedDial/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
|
2
|
+
export declare const SPEED_DIAL_DIRECTIONS: readonly ["up", "down", "left", "right"];
|
|
3
|
+
export type SpeedDialDirection = (typeof SPEED_DIAL_DIRECTIONS)[number];
|
|
4
|
+
export declare const SPEED_DIAL_SIZES: readonly ["small", "medium", "large"];
|
|
5
|
+
export type SpeedDialSize = (typeof SPEED_DIAL_SIZES)[number];
|
|
6
|
+
export declare const SPEED_DIAL_VARIANTS: readonly ["filled", "outlined", "soft"];
|
|
7
|
+
export type SpeedDialVariant = (typeof SPEED_DIAL_VARIANTS)[number];
|
|
8
|
+
/** Individual action item */
|
|
9
|
+
export interface SpeedDialAction {
|
|
10
|
+
/** Unique identifier */
|
|
11
|
+
id: string;
|
|
12
|
+
/** Icon name (from react-icons, e.g., 'FaShare', 'MdPrint') */
|
|
13
|
+
icon: string;
|
|
14
|
+
/** Custom icon element (overrides icon name) */
|
|
15
|
+
iconElement?: React.ReactNode;
|
|
16
|
+
/** Tooltip text */
|
|
17
|
+
tooltip?: string;
|
|
18
|
+
/** Label text (shown next to icon if showLabels is true) */
|
|
19
|
+
label?: string;
|
|
20
|
+
/** Click handler */
|
|
21
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
22
|
+
/** Disabled state */
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
/** Custom background color */
|
|
25
|
+
backgroundColor?: string;
|
|
26
|
+
/** Custom icon color */
|
|
27
|
+
iconColor?: string;
|
|
28
|
+
/** Custom class name */
|
|
29
|
+
className?: string;
|
|
30
|
+
/** Custom style */
|
|
31
|
+
style?: CSSProperties;
|
|
32
|
+
/** ARIA label */
|
|
33
|
+
ariaLabel?: string;
|
|
34
|
+
}
|
|
35
|
+
/** UI Configuration */
|
|
36
|
+
export interface SpeedDialUIConfig {
|
|
37
|
+
/** Direction of expansion */
|
|
38
|
+
direction?: SpeedDialDirection;
|
|
39
|
+
/** Size preset */
|
|
40
|
+
size?: SpeedDialSize;
|
|
41
|
+
/** Visual variant */
|
|
42
|
+
variant?: SpeedDialVariant;
|
|
43
|
+
/** Gap between action buttons */
|
|
44
|
+
gap?: number;
|
|
45
|
+
/** Show labels next to actions */
|
|
46
|
+
showLabels?: boolean;
|
|
47
|
+
/** Show tooltips on hover */
|
|
48
|
+
showTooltips?: boolean;
|
|
49
|
+
/** Animation duration in ms */
|
|
50
|
+
animationDuration?: number;
|
|
51
|
+
/** Stagger delay between actions in ms */
|
|
52
|
+
staggerDelay?: number;
|
|
53
|
+
/** Backdrop when open */
|
|
54
|
+
showBackdrop?: boolean;
|
|
55
|
+
/** Backdrop opacity */
|
|
56
|
+
backdropOpacity?: number;
|
|
57
|
+
/** Z-index */
|
|
58
|
+
zIndex?: number;
|
|
59
|
+
}
|
|
60
|
+
/** Main button configuration */
|
|
61
|
+
export interface SpeedDialMainButtonConfig {
|
|
62
|
+
/** Open icon name (default: 'MdAdd') */
|
|
63
|
+
openIcon?: string;
|
|
64
|
+
/** Close icon name (default: 'MdClose') */
|
|
65
|
+
closeIcon?: string;
|
|
66
|
+
/** Custom open icon element */
|
|
67
|
+
openIconElement?: React.ReactNode;
|
|
68
|
+
/** Custom close icon element */
|
|
69
|
+
closeIconElement?: React.ReactNode;
|
|
70
|
+
/** Background color */
|
|
71
|
+
backgroundColor?: string;
|
|
72
|
+
/** Icon color */
|
|
73
|
+
iconColor?: string;
|
|
74
|
+
/** Rotate animation on toggle */
|
|
75
|
+
rotateOnToggle?: boolean;
|
|
76
|
+
/** Rotation degrees */
|
|
77
|
+
rotationDegrees?: number;
|
|
78
|
+
/** ARIA label when closed */
|
|
79
|
+
ariaLabelClosed?: string;
|
|
80
|
+
/** ARIA label when open */
|
|
81
|
+
ariaLabelOpen?: string;
|
|
82
|
+
}
|
|
83
|
+
/** Custom class names */
|
|
84
|
+
export interface SpeedDialClassNames {
|
|
85
|
+
/** Root container */
|
|
86
|
+
root?: string;
|
|
87
|
+
/** Main FAB button */
|
|
88
|
+
fab?: string;
|
|
89
|
+
/** Actions container */
|
|
90
|
+
actions?: string;
|
|
91
|
+
/** Individual action button */
|
|
92
|
+
action?: string;
|
|
93
|
+
/** Action label */
|
|
94
|
+
actionLabel?: string;
|
|
95
|
+
/** Backdrop */
|
|
96
|
+
backdrop?: string;
|
|
97
|
+
}
|
|
98
|
+
/** Custom styles */
|
|
99
|
+
export interface SpeedDialStyles {
|
|
100
|
+
/** Root container */
|
|
101
|
+
root?: CSSProperties;
|
|
102
|
+
/** Main FAB button */
|
|
103
|
+
fab?: CSSProperties;
|
|
104
|
+
/** Actions container */
|
|
105
|
+
actions?: CSSProperties;
|
|
106
|
+
/** Individual action button */
|
|
107
|
+
action?: CSSProperties;
|
|
108
|
+
/** Action label */
|
|
109
|
+
actionLabel?: CSSProperties;
|
|
110
|
+
/** Backdrop */
|
|
111
|
+
backdrop?: CSSProperties;
|
|
112
|
+
}
|
|
113
|
+
export interface SpeedDialProps {
|
|
114
|
+
/** Array of action items */
|
|
115
|
+
actions: SpeedDialAction[];
|
|
116
|
+
/** Controlled open state */
|
|
117
|
+
open?: boolean;
|
|
118
|
+
/** Default open state (uncontrolled) */
|
|
119
|
+
defaultOpen?: boolean;
|
|
120
|
+
/** Open state change handler */
|
|
121
|
+
onOpenChange?: (open: boolean) => void;
|
|
122
|
+
/** Called when an action is clicked */
|
|
123
|
+
onActionClick?: (action: SpeedDialAction, e: React.MouseEvent) => void;
|
|
124
|
+
/** UI configuration */
|
|
125
|
+
uiConfig?: SpeedDialUIConfig;
|
|
126
|
+
/** Main button configuration */
|
|
127
|
+
mainButtonConfig?: SpeedDialMainButtonConfig;
|
|
128
|
+
/** Custom class names */
|
|
129
|
+
classNames?: SpeedDialClassNames;
|
|
130
|
+
/** Custom styles */
|
|
131
|
+
styles?: SpeedDialStyles;
|
|
132
|
+
/** Disabled state */
|
|
133
|
+
disabled?: boolean;
|
|
134
|
+
/** Hidden state */
|
|
135
|
+
hidden?: boolean;
|
|
136
|
+
/** Close on action click */
|
|
137
|
+
closeOnActionClick?: boolean;
|
|
138
|
+
/** Close on outside click */
|
|
139
|
+
closeOnClickOutside?: boolean;
|
|
140
|
+
/** Close on escape key */
|
|
141
|
+
closeOnEscape?: boolean;
|
|
142
|
+
/** Additional class name */
|
|
143
|
+
className?: string;
|
|
144
|
+
/** Additional style */
|
|
145
|
+
style?: CSSProperties;
|
|
146
|
+
/** ARIA label */
|
|
147
|
+
ariaLabel?: string;
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/components/SpeedDial/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AAE3C,eAAO,MAAM,qBAAqB,0CAA2C,CAAC;AAC9E,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExE,eAAO,MAAM,gBAAgB,uCAAwC,CAAC;AACtE,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE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CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/components/Switch/Switch.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAWxC,OAAO,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AAgBpC,eAAO,MAAM,MAAM,sFA8FlB,CAAC"}
|