flikkui 0.1.0-beta.2 → 0.1.0-beta.4
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 +155 -0
- package/dist/components/charts/index.d.ts +2 -0
- package/dist/components/charts/shared/ChartLegend/ChartLegend.d.ts +7 -0
- package/dist/components/charts/shared/ChartLegend/ChartLegendContent.d.ts +7 -0
- package/dist/components/charts/shared/ChartLegend/index.d.ts +2 -0
- package/dist/components/core/AvatarGroup/AvatarGroup.animations.d.ts +1 -1
- package/dist/components/core/AvatarGroup/AvatarGroup.theme.d.ts +1 -0
- package/dist/components/core/Breadcrumbs/Breadcrumbs.js +8 -7
- package/dist/components/core/Button/Button.animations.d.ts +0 -12
- package/dist/components/core/Button/Button.animations.js +4 -19
- package/dist/components/core/Button/Button.js +40 -37
- package/dist/components/core/Button/Button.theme.d.ts +0 -4
- package/dist/components/core/Button/Button.theme.js +14 -9
- package/dist/components/core/Button/Button.types.d.ts +1 -1
- package/dist/components/core/Divider/Divider.types.d.ts +8 -2
- package/dist/components/core/Drawer/Drawer.types.d.ts +1 -1
- package/dist/components/core/Modal/Modal.types.d.ts +1 -1
- package/dist/components/core/Pagination/Pagination.types.d.ts +25 -13
- package/dist/components/core/Popover/Popover.animations.d.ts +34 -3
- package/dist/components/core/Popover/Popover.animations.js +19 -0
- package/dist/components/core/Popover/Popover.theme.js +2 -2
- package/dist/components/core/Popover/PopoverContent.js +5 -14
- package/dist/components/core/Segmented/Segmented.types.d.ts +17 -0
- package/dist/components/core/Tabs/Tabs.js +2 -8
- package/dist/components/core/Tabs/Tabs.theme.d.ts +8 -45
- package/dist/components/core/Tabs/Tabs.theme.js +14 -64
- package/dist/components/core/Tabs/Tabs.types.d.ts +4 -36
- package/dist/components/core/Tabs/TabsContent.js +3 -8
- package/dist/components/core/Tabs/TabsList.js +3 -10
- package/dist/components/core/Tabs/TabsTrigger.js +3 -15
- package/dist/components/core/Tabs/index.d.ts +1 -1
- package/dist/components/core/Tooltip/Tooltip.animations.d.ts +1 -1
- package/dist/components/core/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/core/Tooltip/Tooltip.theme.d.ts +0 -1
- package/dist/components/core/Tooltip/Tooltip.types.d.ts +15 -15
- package/dist/components/core/Tooltip/useTooltipPositioning.d.ts +12 -0
- package/dist/components/core/Tree/Tree.types.d.ts +8 -45
- package/dist/components/core/Tree/index.d.ts +1 -3
- package/dist/components/data-display/Table/Table.animations.d.ts +21 -0
- package/dist/components/data-display/Table/Table.types.d.ts +56 -13
- package/dist/components/data-display/Table/components/TableActionsMenu.d.ts +1 -1
- package/dist/components/data-display/Table/components/TableColumnManager/TableColumnManager.theme.d.ts +16 -0
- package/dist/components/data-display/Table/components/TablePagination/TablePagination.d.ts +17 -0
- package/dist/components/data-display/Table/components/TablePagination/TablePagination.types.d.ts +21 -0
- package/dist/components/data-display/Table/components/TablePagination/index.d.ts +2 -0
- package/dist/components/data-display/Table/index.d.ts +6 -3
- package/dist/components/feedback/Alert/Alert.types.d.ts +4 -0
- package/dist/components/feedback/ChatMessage/ChatMessage.types.d.ts +20 -14
- package/dist/components/feedback/Empty/Empty.theme.d.ts +4 -14
- package/dist/components/feedback/Empty/Empty.types.d.ts +8 -20
- package/dist/components/feedback/Empty/index.d.ts +2 -2
- package/dist/components/feedback/Notification/Notification.theme.d.ts +16 -1
- package/dist/components/feedback/Notification/Notification.types.d.ts +18 -40
- package/dist/components/feedback/Notification/index.d.ts +2 -2
- package/dist/components/feedback/Toast/Toast.animations.d.ts +31 -0
- package/dist/components/feedback/Toast/Toast.types.d.ts +1 -1
- package/dist/components/feedback/index.d.ts +3 -3
- package/dist/components/forms/Checkbox/Checkbox.js +10 -16
- package/dist/components/forms/Checkbox/Checkbox.theme.js +8 -6
- package/dist/components/forms/Checkbox/Checkbox.types.d.ts +13 -30
- package/dist/components/forms/FormLabel/FormLabel.d.ts +1 -2
- package/dist/components/forms/FormLabel/FormLabel.js +7 -14
- package/dist/components/forms/FormLabel/FormLabel.theme.d.ts +3 -4
- package/dist/components/forms/FormLabel/FormLabel.theme.js +6 -6
- package/dist/components/forms/FormLabel/FormLabel.types.d.ts +10 -18
- package/dist/components/forms/FormLabel/index.d.ts +3 -3
- package/dist/components/forms/Input/Input.d.ts +0 -1
- package/dist/components/forms/Input/Input.js +51 -85
- package/dist/components/forms/Input/Input.theme.d.ts +4 -4
- package/dist/components/forms/Input/Input.theme.js +26 -26
- package/dist/components/forms/Input/Input.types.d.ts +41 -64
- package/dist/components/forms/Input/index.d.ts +1 -1
- package/dist/components/forms/InputAddress/InputAddress.theme.d.ts +2 -2
- package/dist/components/forms/InputAddress/InputAddress.types.d.ts +3 -3
- package/dist/components/forms/InputCreditCard/InputCreditCard.theme.d.ts +3 -3
- package/dist/components/forms/InputCreditCard/InputCreditCard.types.d.ts +4 -4
- package/dist/components/forms/Radio/Radio.js +12 -18
- package/dist/components/forms/Radio/Radio.theme.d.ts +2 -18
- package/dist/components/forms/Radio/Radio.theme.js +10 -19
- package/dist/components/forms/Radio/Radio.types.d.ts +16 -32
- package/dist/components/forms/Select/Select.js +1 -9
- package/dist/components/forms/Signature/Signature.js +5 -4
- package/dist/components/forms/Signature/Signature.theme.js +1 -3
- package/dist/components/forms/Signature/Signature.types.d.ts +0 -4
- package/dist/components/layout/DragDrop/DragDrop.js +62 -0
- package/dist/components/layout/DragDrop/DragDrop.theme.js +8 -0
- package/dist/components/layout/Sortable/Sortable.animations.js +81 -0
- package/dist/components/layout/Sortable/Sortable.js +165 -0
- package/dist/components/layout/Sortable/Sortable.theme.js +7 -0
- package/dist/components/navigation/index.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/node_modules/@heroicons/react/24/outline/esm/Bars3Icon.js +28 -0
- package/dist/node_modules/@heroicons/react/24/outline/esm/LockClosedIcon.js +28 -0
- package/dist/styles.css +1 -1
- package/dist/utils/debounce.d.ts +9 -0
- package/dist/utils/index.d.ts +1 -0
- package/package.json +4 -4
- package/dist/components/core/Popover/test-popover.d.ts +0 -3
- package/dist/components/core/Tabs/test-tabs.d.ts +0 -3
- package/dist/components/core/Tree/TreeIcon.d.ts +0 -3
- package/dist/components/core/Tree/TreeNode.d.ts +0 -6
- package/dist/components/forms/Input/Input.AdvancedStories.d.ts +0 -13
- package/dist/node_modules/framer-motion/dist/es/animation/hooks/animation-controls.js +0 -80
- package/dist/node_modules/framer-motion/dist/es/animation/hooks/use-animation.js +0 -41
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Animation variants for Popover component
|
|
3
|
+
*/
|
|
4
|
+
var popoverContentVariants = {
|
|
5
|
+
hidden: { opacity: 0, scale: 0.95 },
|
|
6
|
+
visible: { opacity: 1, scale: 1 },
|
|
7
|
+
exit: { opacity: 0, scale: 0.95 }
|
|
8
|
+
};
|
|
9
|
+
var popoverBackdropVariants = {
|
|
10
|
+
hidden: { opacity: 0 },
|
|
11
|
+
visible: { opacity: 1 },
|
|
12
|
+
exit: { opacity: 0 }
|
|
13
|
+
};
|
|
14
|
+
var popoverTransitions = {
|
|
15
|
+
content: { duration: 0.2 },
|
|
16
|
+
backdrop: { duration: 0.15 }
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { popoverBackdropVariants, popoverContentVariants, popoverTransitions };
|
|
@@ -5,9 +5,9 @@ var popoverTheme = {
|
|
|
5
5
|
// Base styles for the popover
|
|
6
6
|
baseStyle: "z-50 outline-none",
|
|
7
7
|
// Content styles
|
|
8
|
-
contentStyle: "bg-white border border-
|
|
8
|
+
contentStyle: "bg-white border border-border rounded-[var(--popover-rounded)] shadow-[var(--popover-shadow)] p-[var(--popover-padding-md)] max-w-[var(--popover-max-width-md)]",
|
|
9
9
|
// Backdrop styles
|
|
10
|
-
backdropStyle: "fixed inset-0 bg-black/
|
|
10
|
+
backdropStyle: "fixed inset-0 bg-black/50",
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
export { popoverTheme };
|
|
@@ -4,6 +4,8 @@ import { createPortal } from 'react-dom';
|
|
|
4
4
|
import { cn } from '../../../utils/cn.js';
|
|
5
5
|
import { usePopoverContext } from './PopoverContext.js';
|
|
6
6
|
import { useClickOutside } from '../../../utils/useClickOutside.js';
|
|
7
|
+
import { popoverTransitions, popoverBackdropVariants, popoverContentVariants } from './Popover.animations.js';
|
|
8
|
+
import { useReducedMotion } from '../../../node_modules/framer-motion/dist/es/utils/reduced-motion/use-reduced-motion.js';
|
|
7
9
|
import { motion } from '../../../node_modules/framer-motion/dist/es/render/components/motion/proxy.js';
|
|
8
10
|
import { AnimatePresence } from '../../../node_modules/framer-motion/dist/es/components/AnimatePresence/index.js';
|
|
9
11
|
|
|
@@ -13,6 +15,7 @@ import { AnimatePresence } from '../../../node_modules/framer-motion/dist/es/com
|
|
|
13
15
|
var PopoverContent = React__default.forwardRef(function (_a, ref) {
|
|
14
16
|
var children = _a.children, className = _a.className; _a.animation; var _c = _a.portal, portal = _c === void 0 ? false : _c, props = __rest(_a, ["children", "className", "animation", "portal"]);
|
|
15
17
|
var _d = usePopoverContext(), isOpen = _d.isOpen, onOpenChange = _d.onOpenChange, triggerRef = _d.triggerRef, contentRef = _d.contentRef, placement = _d.placement, offset = _d.offset, triggerType = _d.triggerType, closeOnClickOutside = _d.closeOnClickOutside, closeOnEsc = _d.closeOnEsc, preventClose = _d.preventClose, hasBackdrop = _d.hasBackdrop, theme = _d.theme;
|
|
18
|
+
var shouldReduceMotion = useReducedMotion();
|
|
16
19
|
var localRef = useRef(null);
|
|
17
20
|
var _e = useState({
|
|
18
21
|
top: 0,
|
|
@@ -151,24 +154,12 @@ var PopoverContent = React__default.forwardRef(function (_a, ref) {
|
|
|
151
154
|
contentRef.current = el;
|
|
152
155
|
}
|
|
153
156
|
}, [ref, contentRef]);
|
|
154
|
-
// Animation variants
|
|
155
|
-
var contentVariants = {
|
|
156
|
-
hidden: { opacity: 0, scale: 0.95 },
|
|
157
|
-
visible: { opacity: 1, scale: 1 },
|
|
158
|
-
exit: { opacity: 0, scale: 0.95 }
|
|
159
|
-
};
|
|
160
|
-
// Backdrop variants
|
|
161
|
-
var backdropVariants = {
|
|
162
|
-
hidden: { opacity: 0 },
|
|
163
|
-
visible: { opacity: 1 },
|
|
164
|
-
exit: { opacity: 0 }
|
|
165
|
-
};
|
|
166
157
|
// Extract DOM props to avoid type conflicts
|
|
167
158
|
// HTML event props that conflict with Framer Motion
|
|
168
159
|
props.onDrag; props.onDragStart; props.onDragEnd; props.onAnimationStart; props.onAnimationEnd; var domProps = __rest(props, ["onDrag", "onDragStart", "onDragEnd", "onAnimationStart", "onAnimationEnd"]);
|
|
169
160
|
// Create a backdrop portal
|
|
170
161
|
var renderBackdrop = hasBackdrop && isOpen && typeof document !== 'undefined';
|
|
171
|
-
var backdrop = renderBackdrop ? (createPortal(React__default.createElement(motion.div, { key: "backdrop", variants:
|
|
162
|
+
var backdrop = renderBackdrop ? (createPortal(React__default.createElement(motion.div, { key: "backdrop", variants: shouldReduceMotion ? {} : popoverBackdropVariants, initial: shouldReduceMotion ? undefined : "hidden", animate: shouldReduceMotion ? undefined : "visible", exit: shouldReduceMotion ? undefined : "exit", transition: shouldReduceMotion ? { duration: 0 } : popoverTransitions.backdrop, className: cn("fixed inset-0 z-[9998]", theme.backdropStyle), onClick: function (e) {
|
|
172
163
|
e.stopPropagation();
|
|
173
164
|
if (!preventClose) {
|
|
174
165
|
onOpenChange(false);
|
|
@@ -179,7 +170,7 @@ var PopoverContent = React__default.forwardRef(function (_a, ref) {
|
|
|
179
170
|
React__default.createElement(motion.div, __assign({ ref: handleRef, className: cn("fixed z-50", theme.baseStyle, theme.contentStyle, "popover-content", className), style: {
|
|
180
171
|
top: "".concat(position.top, "px"),
|
|
181
172
|
left: "".concat(position.left, "px"),
|
|
182
|
-
}, role: "dialog", "aria-modal": "true", variants:
|
|
173
|
+
}, role: "dialog", "aria-modal": "true", variants: shouldReduceMotion ? {} : popoverContentVariants, initial: shouldReduceMotion ? undefined : "hidden", animate: shouldReduceMotion ? undefined : "visible", exit: shouldReduceMotion ? undefined : "exit", transition: shouldReduceMotion ? { duration: 0 } : popoverTransitions.content, "data-state": isOpen ? "open" : "closed", "data-placement": placement, "data-trigger": triggerType, "data-backdrop": hasBackdrop ? "true" : "false", onClick: function (e) { return e.stopPropagation(); } }, domProps), children)))));
|
|
183
174
|
// Use portal if specified
|
|
184
175
|
return portal && typeof document !== 'undefined'
|
|
185
176
|
? createPortal(popoverContent, document.body)
|
|
@@ -3,6 +3,21 @@ import React from "react";
|
|
|
3
3
|
* Size options for the Segmented component
|
|
4
4
|
*/
|
|
5
5
|
export type SegmentedSize = "sm" | "md" | "lg";
|
|
6
|
+
/**
|
|
7
|
+
* Theme overrides for Segmented component
|
|
8
|
+
*/
|
|
9
|
+
export interface SegmentedThemeOverrides {
|
|
10
|
+
/** Base styles for the container */
|
|
11
|
+
baseStyle?: string;
|
|
12
|
+
/** Size-specific styles */
|
|
13
|
+
sizes?: Partial<Record<SegmentedSize, string>>;
|
|
14
|
+
/** Block/full-width styles */
|
|
15
|
+
blockStyle?: string;
|
|
16
|
+
/** Disabled state styles */
|
|
17
|
+
disabledStyle?: string;
|
|
18
|
+
/** Sliding background styles */
|
|
19
|
+
slidingBackgroundStyle?: string;
|
|
20
|
+
}
|
|
6
21
|
/**
|
|
7
22
|
* Segmented component props
|
|
8
23
|
*/
|
|
@@ -21,6 +36,8 @@ export interface SegmentedProps extends Omit<React.HTMLAttributes<HTMLDivElement
|
|
|
21
36
|
children?: React.ReactNode;
|
|
22
37
|
/** Custom className for the sliding background */
|
|
23
38
|
slidingBackgroundClassName?: string;
|
|
39
|
+
/** Theme overrides for advanced customization */
|
|
40
|
+
theme?: SegmentedThemeOverrides;
|
|
24
41
|
}
|
|
25
42
|
/**
|
|
26
43
|
* SegmentedItem component props
|
|
@@ -12,7 +12,7 @@ import { TabsContent } from './TabsContent.js';
|
|
|
12
12
|
* Uses compound component pattern with Tabs.List, Tabs.Trigger, and Tabs.Content
|
|
13
13
|
*/
|
|
14
14
|
var TabsComponent = React__default.forwardRef(function (_a, ref) {
|
|
15
|
-
var value = _a.value, defaultValue = _a.defaultValue, onValueChange = _a.onValueChange, _b = _a.orientation, orientation = _b === void 0 ? "horizontal" : _b, _c = _a.size, size = _c === void 0 ? "md" : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, children = _a.children, className = _a.className,
|
|
15
|
+
var value = _a.value, defaultValue = _a.defaultValue, onValueChange = _a.onValueChange, _b = _a.orientation, orientation = _b === void 0 ? "horizontal" : _b, _c = _a.size, size = _c === void 0 ? "md" : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, children = _a.children, className = _a.className, props = __rest(_a, ["value", "defaultValue", "onValueChange", "orientation", "size", "disabled", "children", "className"]);
|
|
16
16
|
var _e = useState(value || defaultValue || ""), currentValue = _e[0], setCurrentValue = _e[1];
|
|
17
17
|
// Handle controlled vs uncontrolled
|
|
18
18
|
var isControlled = value !== undefined;
|
|
@@ -30,14 +30,8 @@ var TabsComponent = React__default.forwardRef(function (_a, ref) {
|
|
|
30
30
|
size: size,
|
|
31
31
|
disabled: disabled,
|
|
32
32
|
};
|
|
33
|
-
// Merge theme overrides
|
|
34
|
-
var mergedTheme = {
|
|
35
|
-
baseStyle: (theme === null || theme === void 0 ? void 0 : theme.baseStyle) || tabsTheme.baseStyle,
|
|
36
|
-
orientations: __assign(__assign({}, tabsTheme.orientations), theme === null || theme === void 0 ? void 0 : theme.orientations),
|
|
37
|
-
disabledStyle: (theme === null || theme === void 0 ? void 0 : theme.disabledStyle) || tabsTheme.disabledStyle,
|
|
38
|
-
};
|
|
39
33
|
return (React__default.createElement(TabsContext.Provider, { value: contextValue },
|
|
40
|
-
React__default.createElement("div", __assign({ ref: ref, className: cn(
|
|
34
|
+
React__default.createElement("div", __assign({ ref: ref, className: cn(tabsTheme.baseStyle, disabled && "opacity-50 cursor-not-allowed pointer-events-none", className // User overrides take precedence
|
|
41
35
|
), "data-orientation": orientation, "data-size": size, "data-disabled": disabled }, props), children)));
|
|
42
36
|
});
|
|
43
37
|
// Set display name for dev tools and Storybook
|
|
@@ -1,52 +1,15 @@
|
|
|
1
|
-
import { TabsSize
|
|
1
|
+
import { TabsSize } from './Tabs.types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Clean theme structure for Tabs components
|
|
4
4
|
*/
|
|
5
|
-
interface TabsTheme {
|
|
5
|
+
export interface TabsTheme {
|
|
6
6
|
baseStyle: string;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
listStyle: string;
|
|
8
|
+
triggerStyle: string;
|
|
9
|
+
triggerSizes: Record<TabsSize, string>;
|
|
10
|
+
contentStyle: string;
|
|
9
11
|
}
|
|
10
12
|
/**
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
interface TabsListTheme {
|
|
14
|
-
baseStyle: string;
|
|
15
|
-
orientations: Record<TabsOrientation, string>;
|
|
16
|
-
sizes: Record<TabsSize, string>;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Internal theme structure for the TabsTrigger component
|
|
20
|
-
*/
|
|
21
|
-
interface TabsTriggerTheme {
|
|
22
|
-
baseStyle: string;
|
|
23
|
-
orientations: Record<TabsOrientation, string>;
|
|
24
|
-
sizes: Record<TabsSize, string>;
|
|
25
|
-
selectedStyle: string;
|
|
26
|
-
unselectedStyle: string;
|
|
27
|
-
disabledStyle: string;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Internal theme structure for the TabsContent component
|
|
31
|
-
*/
|
|
32
|
-
interface TabsContentTheme {
|
|
33
|
-
baseStyle: string;
|
|
34
|
-
orientations: Record<TabsOrientation, string>;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Default theme for the Tabs component
|
|
13
|
+
* Default theme for Tabs components - simplified and organized
|
|
38
14
|
*/
|
|
39
15
|
export declare const tabsTheme: TabsTheme;
|
|
40
|
-
/**
|
|
41
|
-
* Default theme for the TabsList component
|
|
42
|
-
*/
|
|
43
|
-
export declare const tabsListTheme: TabsListTheme;
|
|
44
|
-
/**
|
|
45
|
-
* Default theme for the TabsTrigger component
|
|
46
|
-
*/
|
|
47
|
-
export declare const tabsTriggerTheme: TabsTriggerTheme;
|
|
48
|
-
/**
|
|
49
|
-
* Default theme for the TabsContent component
|
|
50
|
-
*/
|
|
51
|
-
export declare const tabsContentTheme: TabsContentTheme;
|
|
52
|
-
export {};
|
|
@@ -1,70 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Default theme for
|
|
2
|
+
* Default theme for Tabs components - simplified and organized
|
|
3
3
|
*/
|
|
4
4
|
var tabsTheme = {
|
|
5
|
-
//
|
|
6
|
-
baseStyle: "flex",
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Default theme for the TabsList component
|
|
17
|
-
*/
|
|
18
|
-
var tabsListTheme = {
|
|
19
|
-
// Base styles for the tabs list
|
|
20
|
-
baseStyle: "relative inline-flex items-center justify-center",
|
|
21
|
-
// Orientation variants
|
|
22
|
-
orientations: {
|
|
23
|
-
horizontal: "flex-row border-b border-neutral-200",
|
|
24
|
-
vertical: "flex-col border-r border-neutral-200 justify-start items-end",
|
|
25
|
-
},
|
|
26
|
-
// Size variants using CSS variables
|
|
27
|
-
sizes: {
|
|
28
|
-
sm: "gap-1",
|
|
29
|
-
md: "gap-2",
|
|
30
|
-
lg: "gap-3",
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Default theme for the TabsTrigger component
|
|
35
|
-
*/
|
|
36
|
-
var tabsTriggerTheme = {
|
|
37
|
-
// Base styles for the tab trigger
|
|
38
|
-
baseStyle: "relative inline-flex items-center justify-center whitespace-nowrap font-semibold transition-all duration-200 cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
39
|
-
// Orientation variants
|
|
40
|
-
orientations: {
|
|
41
|
-
horizontal: "border-b-2 border-transparent hover:border-neutral-300 data-[state=active]:border-primary-600 data-[state=active]:text-primary-600",
|
|
42
|
-
vertical: "border-r-2 border-transparent hover:border-neutral-300 data-[state=active]:border-primary-600 data-[state=active]:text-primary-600",
|
|
43
|
-
},
|
|
44
|
-
// Size variants
|
|
45
|
-
sizes: {
|
|
46
|
-
sm: "px-2 py-1.5 text-sm",
|
|
47
|
-
md: "px-2 py-2 text-sm",
|
|
48
|
-
lg: "px-2 py-3 text-base",
|
|
49
|
-
},
|
|
50
|
-
// Selected state
|
|
51
|
-
selectedStyle: "text-primary-600",
|
|
52
|
-
// Unselected state
|
|
53
|
-
unselectedStyle: "text-neutral-500 hover:text-neutral-900",
|
|
54
|
-
// Disabled state
|
|
55
|
-
disabledStyle: "opacity-50 cursor-not-allowed pointer-events-none",
|
|
56
|
-
};
|
|
57
|
-
/**
|
|
58
|
-
* Default theme for the TabsContent component
|
|
59
|
-
*/
|
|
60
|
-
var tabsContentTheme = {
|
|
61
|
-
// Base styles for the tab content
|
|
62
|
-
baseStyle: "focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2",
|
|
63
|
-
// Orientation variants
|
|
64
|
-
orientations: {
|
|
65
|
-
horizontal: "mt-4",
|
|
66
|
-
vertical: "ml-4",
|
|
5
|
+
// Container styles
|
|
6
|
+
baseStyle: "flex flex-col",
|
|
7
|
+
// TabsList styles
|
|
8
|
+
listStyle: "relative inline-flex items-center flex-row border-b border-border gap-2",
|
|
9
|
+
// TabsTrigger base styles with data-attribute state handling
|
|
10
|
+
triggerStyle: "relative inline-flex items-center justify-center whitespace-nowrap font-medium transition-all duration-300 cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-base focus-visible:ring-offset-2 border-b-2 border-transparent hover:border-neutral-300 disabled:cursor-not-allowed disabled:opacity-50 text-text-muted hover:text-text-primary data-[state=active]:border-primary-base data-[state=active]:text-primary-base",
|
|
11
|
+
// TabsTrigger size variants
|
|
12
|
+
triggerSizes: {
|
|
13
|
+
sm: "px-2 py-1.5 text-sm gap-1",
|
|
14
|
+
md: "px-2 py-2 text-sm gap-2",
|
|
67
15
|
},
|
|
16
|
+
// TabsContent styles
|
|
17
|
+
contentStyle: "focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-base focus-visible:ring-offset-2",
|
|
68
18
|
};
|
|
69
19
|
|
|
70
|
-
export {
|
|
20
|
+
export { tabsTheme };
|
|
@@ -2,36 +2,12 @@ import React from "react";
|
|
|
2
2
|
/**
|
|
3
3
|
* Size options for the Tabs component
|
|
4
4
|
*/
|
|
5
|
-
export type TabsSize = "sm" | "md"
|
|
5
|
+
export type TabsSize = "sm" | "md";
|
|
6
6
|
/**
|
|
7
7
|
* Orientation options for the Tabs component
|
|
8
|
+
* Note: Only horizontal orientation is supported
|
|
8
9
|
*/
|
|
9
|
-
export type TabsOrientation = "horizontal"
|
|
10
|
-
/**
|
|
11
|
-
* Theme overrides for Tabs components
|
|
12
|
-
*/
|
|
13
|
-
export interface TabsThemeOverrides {
|
|
14
|
-
baseStyle?: string;
|
|
15
|
-
orientations?: Partial<Record<TabsOrientation, string>>;
|
|
16
|
-
disabledStyle?: string;
|
|
17
|
-
}
|
|
18
|
-
export interface TabsListThemeOverrides {
|
|
19
|
-
baseStyle?: string;
|
|
20
|
-
orientations?: Partial<Record<TabsOrientation, string>>;
|
|
21
|
-
sizes?: Partial<Record<TabsSize, string>>;
|
|
22
|
-
}
|
|
23
|
-
export interface TabsTriggerThemeOverrides {
|
|
24
|
-
baseStyle?: string;
|
|
25
|
-
orientations?: Partial<Record<TabsOrientation, string>>;
|
|
26
|
-
sizes?: Partial<Record<TabsSize, string>>;
|
|
27
|
-
selectedStyle?: string;
|
|
28
|
-
unselectedStyle?: string;
|
|
29
|
-
disabledStyle?: string;
|
|
30
|
-
}
|
|
31
|
-
export interface TabsContentThemeOverrides {
|
|
32
|
-
baseStyle?: string;
|
|
33
|
-
orientations?: Partial<Record<TabsOrientation, string>>;
|
|
34
|
-
}
|
|
10
|
+
export type TabsOrientation = "horizontal";
|
|
35
11
|
/**
|
|
36
12
|
* Tabs component props
|
|
37
13
|
*/
|
|
@@ -42,7 +18,7 @@ export interface TabsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'o
|
|
|
42
18
|
defaultValue?: string;
|
|
43
19
|
/** Function called when selection changes */
|
|
44
20
|
onValueChange?: (value: string) => void;
|
|
45
|
-
/** Orientation of the tabs */
|
|
21
|
+
/** Orientation of the tabs (always horizontal) */
|
|
46
22
|
orientation?: TabsOrientation;
|
|
47
23
|
/** Size of the tabs */
|
|
48
24
|
size?: TabsSize;
|
|
@@ -50,8 +26,6 @@ export interface TabsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'o
|
|
|
50
26
|
disabled?: boolean;
|
|
51
27
|
/** Children components (TabsList, TabsContent) */
|
|
52
28
|
children?: React.ReactNode;
|
|
53
|
-
/** Theme overrides */
|
|
54
|
-
theme?: TabsThemeOverrides;
|
|
55
29
|
}
|
|
56
30
|
/**
|
|
57
31
|
* TabsList component props
|
|
@@ -59,8 +33,6 @@ export interface TabsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'o
|
|
|
59
33
|
export interface TabsListProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
60
34
|
/** Children TabsTrigger components */
|
|
61
35
|
children?: React.ReactNode;
|
|
62
|
-
/** Theme overrides */
|
|
63
|
-
theme?: TabsListThemeOverrides;
|
|
64
36
|
}
|
|
65
37
|
/**
|
|
66
38
|
* TabsTrigger component props
|
|
@@ -72,8 +44,6 @@ export interface TabsTriggerProps extends React.HTMLAttributes<HTMLButtonElement
|
|
|
72
44
|
disabled?: boolean;
|
|
73
45
|
/** Children content */
|
|
74
46
|
children?: React.ReactNode;
|
|
75
|
-
/** Theme overrides */
|
|
76
|
-
theme?: TabsTriggerThemeOverrides;
|
|
77
47
|
}
|
|
78
48
|
/**
|
|
79
49
|
* TabsContent component props
|
|
@@ -85,8 +55,6 @@ export interface TabsContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
85
55
|
forceMount?: boolean;
|
|
86
56
|
/** Children content */
|
|
87
57
|
children?: React.ReactNode;
|
|
88
|
-
/** Theme overrides */
|
|
89
|
-
theme?: TabsContentThemeOverrides;
|
|
90
58
|
}
|
|
91
59
|
/**
|
|
92
60
|
* Context value for Tabs compound components
|
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
import { __rest, __assign } from '../../../node_modules/tslib/tslib.es6.js';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { cn } from '../../../utils/cn.js';
|
|
4
|
-
import {
|
|
4
|
+
import { tabsTheme } from './Tabs.theme.js';
|
|
5
5
|
import { useTabsContext } from './TabsContext.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* TabsContent component displays content panels for tabs
|
|
9
9
|
*/
|
|
10
10
|
var TabsContent = React__default.forwardRef(function (_a, ref) {
|
|
11
|
-
var value = _a.value, _b = _a.forceMount, forceMount = _b === void 0 ? false : _b, children = _a.children, className = _a.className,
|
|
11
|
+
var value = _a.value, _b = _a.forceMount, forceMount = _b === void 0 ? false : _b, children = _a.children, className = _a.className, props = __rest(_a, ["value", "forceMount", "children", "className"]);
|
|
12
12
|
var _c = useTabsContext(), selectedValue = _c.value, orientation = _c.orientation;
|
|
13
13
|
var isSelected = value === selectedValue;
|
|
14
14
|
var shouldRender = forceMount || isSelected;
|
|
15
|
-
// Merge theme overrides
|
|
16
|
-
var mergedTheme = {
|
|
17
|
-
baseStyle: (theme === null || theme === void 0 ? void 0 : theme.baseStyle) || tabsContentTheme.baseStyle,
|
|
18
|
-
orientations: __assign(__assign({}, tabsContentTheme.orientations), theme === null || theme === void 0 ? void 0 : theme.orientations),
|
|
19
|
-
};
|
|
20
15
|
if (!shouldRender) {
|
|
21
16
|
return null;
|
|
22
17
|
}
|
|
23
|
-
return (React__default.createElement("div", __assign({ ref: ref, role: "tabpanel", "aria-labelledby": "".concat(value, "-tab"), id: "".concat(value, "-content"), tabIndex: 0, hidden: !isSelected && !forceMount, className: cn(
|
|
18
|
+
return (React__default.createElement("div", __assign({ ref: ref, role: "tabpanel", "aria-labelledby": "".concat(value, "-tab"), id: "".concat(value, "-content"), tabIndex: 0, hidden: !isSelected && !forceMount, className: cn(tabsTheme.contentStyle, !isSelected && forceMount && "hidden", // Hide when not selected but force mounted
|
|
24
19
|
className // User overrides take precedence
|
|
25
20
|
), "data-state": isSelected ? "active" : "inactive", "data-orientation": orientation }, props), children));
|
|
26
21
|
});
|
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
import { __rest, __assign } from '../../../node_modules/tslib/tslib.es6.js';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { cn } from '../../../utils/cn.js';
|
|
4
|
-
import {
|
|
4
|
+
import { tabsTheme } from './Tabs.theme.js';
|
|
5
5
|
import { useTabsContext } from './TabsContext.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* TabsList component displays the tab headers container
|
|
9
9
|
*/
|
|
10
10
|
var TabsList = React__default.forwardRef(function (_a, ref) {
|
|
11
|
-
var children = _a.children, className = _a.className,
|
|
11
|
+
var children = _a.children, className = _a.className, props = __rest(_a, ["children", "className"]);
|
|
12
12
|
var _b = useTabsContext(), orientation = _b.orientation, size = _b.size;
|
|
13
|
-
|
|
14
|
-
var mergedTheme = {
|
|
15
|
-
baseStyle: (theme === null || theme === void 0 ? void 0 : theme.baseStyle) || tabsListTheme.baseStyle,
|
|
16
|
-
orientations: __assign(__assign({}, tabsListTheme.orientations), theme === null || theme === void 0 ? void 0 : theme.orientations),
|
|
17
|
-
sizes: __assign(__assign({}, tabsListTheme.sizes), theme === null || theme === void 0 ? void 0 : theme.sizes),
|
|
18
|
-
};
|
|
19
|
-
return (React__default.createElement("div", __assign({ ref: ref, role: "tablist", "aria-orientation": orientation, className: cn(mergedTheme.baseStyle, mergedTheme.orientations[orientation], mergedTheme.sizes[size], className // User overrides take precedence
|
|
20
|
-
), "data-orientation": orientation, "data-size": size }, props), children));
|
|
13
|
+
return (React__default.createElement("div", __assign({ ref: ref, role: "tablist", "aria-orientation": orientation, className: cn(tabsTheme.listStyle, className), "data-orientation": orientation, "data-size": size }, props), children));
|
|
21
14
|
});
|
|
22
15
|
TabsList.displayName = "TabsList";
|
|
23
16
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { __rest, __assign } from '../../../node_modules/tslib/tslib.es6.js';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { cn } from '../../../utils/cn.js';
|
|
4
|
-
import {
|
|
4
|
+
import { tabsTheme } from './Tabs.theme.js';
|
|
5
5
|
import { useTabsContext } from './TabsContext.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* TabsTrigger component displays individual tab headers
|
|
9
9
|
*/
|
|
10
10
|
var TabsTrigger = React__default.forwardRef(function (_a, ref) {
|
|
11
|
-
var value = _a.value, _b = _a.disabled, disabled = _b === void 0 ? false : _b, children = _a.children, className = _a.className,
|
|
11
|
+
var value = _a.value, _b = _a.disabled, disabled = _b === void 0 ? false : _b, children = _a.children, className = _a.className, onClick = _a.onClick, onKeyDown = _a.onKeyDown, props = __rest(_a, ["value", "disabled", "children", "className", "onClick", "onKeyDown"]);
|
|
12
12
|
var _c = useTabsContext(), selectedValue = _c.value, onValueChange = _c.onValueChange, orientation = _c.orientation, size = _c.size, contextDisabled = _c.disabled;
|
|
13
13
|
var isSelected = value === selectedValue;
|
|
14
14
|
var isDisabled = disabled || contextDisabled;
|
|
@@ -65,19 +65,7 @@ var TabsTrigger = React__default.forwardRef(function (_a, ref) {
|
|
|
65
65
|
}
|
|
66
66
|
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
67
67
|
};
|
|
68
|
-
|
|
69
|
-
var mergedTheme = {
|
|
70
|
-
baseStyle: (theme === null || theme === void 0 ? void 0 : theme.baseStyle) || tabsTriggerTheme.baseStyle,
|
|
71
|
-
orientations: __assign(__assign({}, tabsTriggerTheme.orientations), theme === null || theme === void 0 ? void 0 : theme.orientations),
|
|
72
|
-
sizes: __assign(__assign({}, tabsTriggerTheme.sizes), theme === null || theme === void 0 ? void 0 : theme.sizes),
|
|
73
|
-
selectedStyle: (theme === null || theme === void 0 ? void 0 : theme.selectedStyle) || tabsTriggerTheme.selectedStyle,
|
|
74
|
-
unselectedStyle: (theme === null || theme === void 0 ? void 0 : theme.unselectedStyle) || tabsTriggerTheme.unselectedStyle,
|
|
75
|
-
disabledStyle: (theme === null || theme === void 0 ? void 0 : theme.disabledStyle) || tabsTriggerTheme.disabledStyle,
|
|
76
|
-
};
|
|
77
|
-
return (React__default.createElement("button", __assign({ ref: ref, type: "button", role: "tab", "aria-selected": isSelected, "aria-controls": "".concat(value, "-content"), id: "".concat(value, "-tab"), tabIndex: isSelected ? 0 : -1, disabled: isDisabled, className: cn(mergedTheme.baseStyle, mergedTheme.orientations[orientation], mergedTheme.sizes[size], isSelected
|
|
78
|
-
? mergedTheme.selectedStyle
|
|
79
|
-
: mergedTheme.unselectedStyle, isDisabled && mergedTheme.disabledStyle, className // User overrides take precedence
|
|
80
|
-
), onClick: handleClick, onKeyDown: handleKeyDown, "data-value": value, "data-state": isSelected ? "active" : "inactive", "data-disabled": isDisabled, "data-orientation": orientation }, props), children));
|
|
68
|
+
return (React__default.createElement("button", __assign({ ref: ref, type: "button", role: "tab", "aria-selected": isSelected, "aria-controls": "".concat(value, "-content"), id: "".concat(value, "-tab"), tabIndex: isSelected ? 0 : -1, disabled: isDisabled, className: cn(tabsTheme.triggerStyle, tabsTheme.triggerSizes[size], className), onClick: handleClick, onKeyDown: handleKeyDown, "data-value": value, "data-state": isSelected ? "active" : "inactive", "data-disabled": isDisabled, "data-orientation": orientation }, props), children));
|
|
81
69
|
});
|
|
82
70
|
TabsTrigger.displayName = "TabsTrigger";
|
|
83
71
|
|
|
@@ -5,5 +5,5 @@ export { TabsList } from './TabsList';
|
|
|
5
5
|
export { TabsTrigger } from './TabsTrigger';
|
|
6
6
|
export { TabsContent } from './TabsContent';
|
|
7
7
|
export { TabsContext, useTabsContext };
|
|
8
|
-
export type { TabsProps, TabsListProps, TabsTriggerProps, TabsContentProps, TabsSize, TabsOrientation, TabsContextValue
|
|
8
|
+
export type { TabsProps, TabsListProps, TabsTriggerProps, TabsContentProps, TabsSize, TabsOrientation, TabsContextValue } from './Tabs.types';
|
|
9
9
|
export default Tabs;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Variants } from 'motion/react';
|
|
2
2
|
import { TooltipPlacement } from './Tooltip.types';
|
|
3
3
|
/**
|
|
4
|
-
* Base animation variants for the tooltip
|
|
4
|
+
* Base animation variants for the tooltip - optimized for smooth positioning
|
|
5
5
|
*/
|
|
6
6
|
export declare const baseTooltipVariants: Variants;
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { TooltipProps } from "./Tooltip.types";
|
|
3
3
|
declare const Tooltip: {
|
|
4
|
-
({ content, children, placement, delay, disabled, className, maxWidth, minWidth,
|
|
4
|
+
({ content, children, placement, delay, disabled, className, maxWidth, minWidth, showOnFocus, wrapText, id, theme: themeOverrides, "aria-label": ariaLabel, role, }: TooltipProps): React.JSX.Element;
|
|
5
5
|
displayName: string;
|
|
6
6
|
};
|
|
7
7
|
export default Tooltip;
|
|
@@ -5,10 +5,6 @@ export interface TooltipThemeOverrides {
|
|
|
5
5
|
* Base style for the tooltip container
|
|
6
6
|
*/
|
|
7
7
|
baseStyle?: string;
|
|
8
|
-
/**
|
|
9
|
-
* Style for the tooltip arrow
|
|
10
|
-
*/
|
|
11
|
-
arrow?: string;
|
|
12
8
|
/**
|
|
13
9
|
* Placement styles
|
|
14
10
|
*/
|
|
@@ -47,21 +43,16 @@ export interface TooltipProps {
|
|
|
47
43
|
className?: string;
|
|
48
44
|
/**
|
|
49
45
|
* Max width for the tooltip content
|
|
50
|
-
* @default "
|
|
46
|
+
* @default "360px"
|
|
51
47
|
*/
|
|
52
48
|
maxWidth?: string;
|
|
53
49
|
/**
|
|
54
50
|
* Min width for the tooltip content
|
|
55
|
-
* @default "
|
|
56
|
-
*/
|
|
57
|
-
minWidth?: string;
|
|
58
|
-
/**
|
|
59
|
-
* Whether to show an arrow pointing to the trigger element
|
|
60
|
-
* @default true
|
|
51
|
+
* @default "fit-content"
|
|
61
52
|
*/
|
|
62
|
-
|
|
53
|
+
minWidth?: string | 'fit-content';
|
|
63
54
|
/**
|
|
64
|
-
* Whether the tooltip should be shown on focus
|
|
55
|
+
* Whether the tooltip should be shown on focus (improves keyboard accessibility)
|
|
65
56
|
* @default true
|
|
66
57
|
*/
|
|
67
58
|
showOnFocus?: boolean;
|
|
@@ -71,11 +62,20 @@ export interface TooltipProps {
|
|
|
71
62
|
*/
|
|
72
63
|
wrapText?: boolean;
|
|
73
64
|
/**
|
|
74
|
-
* ID to be applied to the tooltip element
|
|
65
|
+
* ID to be applied to the tooltip element (important for ARIA)
|
|
75
66
|
*/
|
|
76
67
|
id?: string;
|
|
77
68
|
/**
|
|
78
|
-
* Theme overrides
|
|
69
|
+
* Theme overrides following shadcn patterns
|
|
79
70
|
*/
|
|
80
71
|
theme?: TooltipThemeOverrides;
|
|
72
|
+
/**
|
|
73
|
+
* Custom ARIA label for the tooltip (enhances screen reader support)
|
|
74
|
+
*/
|
|
75
|
+
'aria-label'?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Role override for specific accessibility contexts
|
|
78
|
+
* @default "tooltip"
|
|
79
|
+
*/
|
|
80
|
+
role?: 'tooltip' | 'dialog' | 'region';
|
|
81
81
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type Placement = 'top' | 'right' | 'bottom' | 'left';
|
|
2
|
+
interface UseTooltipPositioningProps {
|
|
3
|
+
tooltipRef: React.RefObject<HTMLDivElement | null>;
|
|
4
|
+
triggerRef: React.RefObject<HTMLDivElement | null>;
|
|
5
|
+
placement: Placement;
|
|
6
|
+
isVisible: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const useTooltipPositioning: ({ tooltipRef, triggerRef, placement, isVisible, }: UseTooltipPositioningProps) => {
|
|
9
|
+
positionTooltip: () => void;
|
|
10
|
+
debouncedPositioning: () => void;
|
|
11
|
+
};
|
|
12
|
+
export {};
|