@robosystems/core 0.17.1 → 0.18.1

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.
Files changed (122) hide show
  1. package/README.md +4 -3
  2. package/auth-components/AppSwitcher.js +2 -3
  3. package/components/EntitySelector.js +1 -1
  4. package/components/RepositoryGuard.js +1 -1
  5. package/components/console/ConsoleContent.js +1 -1
  6. package/components/report-chat/ReportChat.d.ts +13 -0
  7. package/components/report-chat/ReportChat.js +1 -1
  8. package/components/repositories/ActiveSubscriptions.js +1 -1
  9. package/components/repositories/BrowseRepositories.js +1 -1
  10. package/components/search/SearchBar.js +1 -1
  11. package/components/search/SearchContent.js +1 -1
  12. package/components/search/SearchHitCard.js +1 -1
  13. package/components/search/SearchPagination.js +1 -1
  14. package/hooks/use-toast.d.ts +1 -1
  15. package/hooks/use-toast.js +2 -2
  16. package/index.d.ts +0 -1
  17. package/index.js +0 -1
  18. package/library/components/ElementBrowser.js +1 -1
  19. package/library/components/ElementDetail.js +1 -1
  20. package/library/components/LibraryHierarchy.js +1 -1
  21. package/library/components/TaxonomySidebar.js +1 -1
  22. package/package.json +2 -2
  23. package/styles/forms.css +478 -0
  24. package/styles/palette.css +265 -0
  25. package/ui/Alert.d.ts +66 -0
  26. package/ui/Alert.js +24 -0
  27. package/ui/Badge.d.ts +50 -0
  28. package/ui/Badge.js +21 -0
  29. package/ui/Breadcrumb.d.ts +10 -0
  30. package/ui/Breadcrumb.js +31 -0
  31. package/ui/Button.d.ts +76 -0
  32. package/ui/Button.js +26 -0
  33. package/ui/Card.d.ts +32 -0
  34. package/ui/Card.js +26 -0
  35. package/ui/Checkbox.d.ts +33 -0
  36. package/ui/Checkbox.js +21 -0
  37. package/ui/Dropdown.d.ts +67 -0
  38. package/ui/Dropdown.js +134 -0
  39. package/ui/FileInput.d.ts +23 -0
  40. package/ui/FileInput.js +21 -0
  41. package/ui/Floating.d.ts +96 -0
  42. package/ui/Floating.js +92 -0
  43. package/ui/HelperText.d.ts +19 -0
  44. package/ui/HelperText.js +21 -0
  45. package/ui/Label.d.ts +21 -0
  46. package/ui/Label.js +21 -0
  47. package/ui/Modal.d.ts +85 -0
  48. package/ui/Modal.js +73 -0
  49. package/ui/Navbar.d.ts +14 -0
  50. package/ui/Navbar.js +35 -0
  51. package/ui/Progress.d.ts +40 -0
  52. package/ui/Progress.js +26 -0
  53. package/ui/Radio.d.ts +31 -0
  54. package/ui/Radio.js +21 -0
  55. package/ui/Select.d.ts +49 -0
  56. package/ui/Select.js +21 -0
  57. package/ui/Sidebar.d.ts +114 -0
  58. package/ui/Sidebar.js +76 -0
  59. package/ui/Spinner.d.ts +60 -0
  60. package/ui/Spinner.js +22 -0
  61. package/ui/Table.d.ts +23 -0
  62. package/ui/Table.js +57 -0
  63. package/ui/Tabs.d.ts +78 -0
  64. package/ui/Tabs.js +64 -0
  65. package/ui/TextInput.d.ts +58 -0
  66. package/ui/TextInput.js +21 -0
  67. package/ui/Textarea.d.ts +22 -0
  68. package/ui/Textarea.js +21 -0
  69. package/ui/ThemeModeScript.d.ts +21 -0
  70. package/ui/ThemeModeScript.js +74 -0
  71. package/ui/Toast.d.ts +24 -0
  72. package/ui/Toast.js +58 -0
  73. package/ui/ToggleSwitch.d.ts +54 -0
  74. package/ui/ToggleSwitch.js +26 -0
  75. package/ui/Tooltip.d.ts +3 -0
  76. package/ui/Tooltip.js +19 -0
  77. package/ui/cn.d.ts +6 -0
  78. package/ui/cn.js +19 -0
  79. package/ui/icons.d.ts +8 -0
  80. package/ui/icons.js +22 -0
  81. package/ui/index.d.ts +37 -0
  82. package/ui/index.js +36 -0
  83. package/ui/merge-theme.d.ts +15 -0
  84. package/ui/merge-theme.js +26 -0
  85. package/ui/theme-defaults.d.ts +821 -0
  86. package/ui/theme-defaults.js +824 -0
  87. package/ui/theme-mode.d.ts +15 -0
  88. package/ui/theme-mode.js +92 -0
  89. package/ui/types.d.ts +6 -0
  90. package/ui/types.js +1 -0
  91. package/ui-components/ConfirmModal.js +1 -1
  92. package/ui-components/StatCard.js +1 -1
  93. package/ui-components/api-keys/ApiKeyDisplay.d.ts +0 -1
  94. package/ui-components/api-keys/ApiKeyDisplay.js +3 -3
  95. package/ui-components/api-keys/CreateApiKeyModal.d.ts +0 -1
  96. package/ui-components/api-keys/CreateApiKeyModal.js +4 -4
  97. package/ui-components/api-keys/SecureApiKeyField.js +1 -1
  98. package/ui-components/chat/ChatInputArea.js +1 -1
  99. package/ui-components/chat/ChatMessage.js +1 -1
  100. package/ui-components/chat/DeepResearchToggle.js +1 -1
  101. package/ui-components/forms/CategoryInput.js +1 -1
  102. package/ui-components/forms/SettingsCard.d.ts +0 -1
  103. package/ui-components/forms/SettingsCard.js +3 -3
  104. package/ui-components/forms/SettingsFormField.d.ts +0 -1
  105. package/ui-components/forms/SettingsFormField.js +3 -3
  106. package/ui-components/forms/StatusAlert.d.ts +0 -1
  107. package/ui-components/forms/StatusAlert.js +3 -3
  108. package/ui-components/forms/TagInput.d.ts +1 -1
  109. package/ui-components/forms/TagInput.js +1 -1
  110. package/ui-components/layout/CoreNavbar.js +7 -8
  111. package/ui-components/layout/CoreSidebar.js +12 -13
  112. package/ui-components/layout/ThemeToggle.js +1 -1
  113. package/ui-components/settings/GeneralInformationCard.d.ts +0 -1
  114. package/ui-components/settings/GeneralInformationCard.js +3 -3
  115. package/ui-components/settings/PasswordInformationCard.d.ts +0 -1
  116. package/ui-components/settings/PasswordInformationCard.js +4 -4
  117. package/ui-components/settings/SettingsPageHeader.js +1 -1
  118. package/ui-components/support/SupportModal.js +1 -1
  119. package/theme/flowbite-theme.d.ts +0 -758
  120. package/theme/flowbite-theme.js +0 -769
  121. package/theme/index.d.ts +0 -1
  122. package/theme/index.js +0 -1
@@ -0,0 +1,33 @@
1
+ import { type ComponentPropsWithoutRef } from 'react';
2
+ import type { DynamicStringEnumKeysOf } from './types';
3
+ declare const t: {
4
+ readonly base: "h-4 w-4 appearance-none rounded-sm border border-gray-300 bg-[length:0.55em_0.55em] bg-center bg-no-repeat checked:border-transparent checked:bg-current checked:bg-check-icon focus:outline-none focus:ring-2 focus:ring-offset-2 dark:border-gray-600 dark:checked:border-transparent dark:checked:bg-current focus:ring-primary-500 dark:focus:ring-primary-600 bg-zinc-100 dark:bg-zinc-700 dark:ring-offset-gray-800";
5
+ readonly color: {
6
+ readonly default: "text-primary-600 focus:ring-primary-600 dark:ring-offset-gray-800 dark:focus:ring-primary-600";
7
+ readonly dark: "focus:ring-gray-800 dark:ring-offset-gray-800 dark:focus:ring-gray-800 text-gray-600";
8
+ readonly failure: "focus:ring-red-900 dark:ring-offset-red-900 dark:focus:ring-red-900 text-red-600";
9
+ readonly gray: "focus:ring-gray-900 dark:ring-offset-gray-900 dark:focus:ring-gray-900 text-gray-600";
10
+ readonly info: "focus:ring-cyan-800 dark:ring-offset-gray-800 dark:focus:ring-cyan-800 text-blue-600";
11
+ readonly light: "focus:ring-gray-900 dark:ring-offset-gray-900 dark:focus:ring-gray-900 text-gray-600";
12
+ readonly purple: "text-purple-600 focus:ring-purple-600 dark:ring-offset-purple-600 dark:focus:ring-purple-600";
13
+ readonly success: "focus:ring-green-800 dark:ring-offset-green-800 dark:focus:ring-green-800 text-green-600";
14
+ readonly warning: "focus:ring-yellow-400 dark:ring-offset-yellow-400 dark:focus:ring-yellow-400 text-amber-600";
15
+ readonly blue: "focus:ring-blue-600 dark:ring-offset-blue-700 dark:focus:ring-blue-700 text-blue-600";
16
+ readonly cyan: "text-cyan-600 focus:ring-cyan-600 dark:ring-offset-cyan-600 dark:focus:ring-cyan-600";
17
+ readonly green: "text-green-600 focus:ring-green-600 dark:ring-offset-green-600 dark:focus:ring-green-600";
18
+ readonly indigo: "focus:ring-indigo-700 dark:ring-offset-indigo-700 dark:focus:ring-indigo-700 text-indigo-600";
19
+ readonly lime: "focus:ring-lime-700 dark:ring-offset-lime-700 dark:focus:ring-lime-700 text-lime-600";
20
+ readonly pink: "text-pink-600 focus:ring-pink-600 dark:ring-offset-pink-600 dark:focus:ring-pink-600";
21
+ readonly red: "text-red-600 focus:ring-red-600 dark:ring-offset-red-600 dark:focus:ring-red-600";
22
+ readonly teal: "text-teal-600 focus:ring-teal-600 dark:ring-offset-teal-600 dark:focus:ring-teal-600";
23
+ readonly yellow: "focus:ring-yellow-400 dark:ring-offset-yellow-400 dark:focus:ring-yellow-400 text-yellow-600";
24
+ };
25
+ readonly indeterminate: "border-transparent bg-current bg-dash-icon dark:border-transparent dark:bg-current";
26
+ };
27
+ export type CheckboxColor = DynamicStringEnumKeysOf<typeof t.color>;
28
+ export interface CheckboxProps extends Omit<ComponentPropsWithoutRef<'input'>, 'type' | 'color'> {
29
+ color?: CheckboxColor;
30
+ indeterminate?: boolean;
31
+ }
32
+ export declare const Checkbox: import("react").ForwardRefExoticComponent<CheckboxProps & import("react").RefAttributes<HTMLInputElement>>;
33
+ export {};
package/ui/Checkbox.js ADDED
@@ -0,0 +1,21 @@
1
+ 'use client';
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { forwardRef } from 'react';
15
+ import { cn } from './cn';
16
+ import { themeDefaults } from './theme-defaults';
17
+ const t = themeDefaults.checkbox;
18
+ export const Checkbox = forwardRef(function Checkbox(_a, ref) {
19
+ var { className, color = 'default', indeterminate } = _a, rest = __rest(_a, ["className", "color", "indeterminate"]);
20
+ return (_jsx("input", Object.assign({ ref: ref, type: "checkbox", className: cn(t.base, t.color[color], indeterminate && t.indeterminate, className) }, rest)));
21
+ });
@@ -0,0 +1,67 @@
1
+ import { type ComponentPropsWithoutRef, type ElementType, type FC, type ReactElement, type ReactNode } from 'react';
2
+ import { type ButtonProps } from './Button';
3
+ import { type FloatingPlacement, type FloatingTrigger } from './Floating';
4
+ declare const t: {
5
+ readonly arrowIcon: "ml-2 h-4 w-4";
6
+ readonly content: "py-1 focus:outline-none";
7
+ readonly floating: {
8
+ readonly animation: "transition-opacity";
9
+ readonly arrow: {
10
+ readonly base: "absolute z-10 h-2 w-2 rotate-45";
11
+ readonly style: {
12
+ readonly dark: "bg-zinc-900 dark:bg-zinc-700";
13
+ readonly light: "bg-white";
14
+ readonly auto: "bg-white dark:bg-zinc-700";
15
+ };
16
+ readonly placement: "-4px -m-1";
17
+ };
18
+ readonly base: "z-10 w-fit divide-y divide-gray-100 rounded-xl shadow-lg focus:outline-hidden";
19
+ readonly content: "py-1 text-sm text-gray-700 dark:text-gray-200";
20
+ readonly divider: "my-1 h-px bg-zinc-100 dark:bg-zinc-600";
21
+ readonly header: "block px-4 py-2 text-sm text-gray-700 dark:text-gray-200";
22
+ readonly hidden: "invisible opacity-0";
23
+ readonly item: {
24
+ readonly container: "";
25
+ readonly base: "flex w-full cursor-pointer items-center justify-start px-4 py-2 text-sm text-gray-700 focus:bg-gray-100 focus:outline-none dark:text-gray-200 dark:hover:text-white dark:focus:bg-gray-600 dark:focus:text-white hover:bg-zinc-100 dark:hover:bg-zinc-600";
26
+ readonly icon: "mr-2 h-4 w-4";
27
+ };
28
+ readonly style: {
29
+ readonly dark: "text-white bg-zinc-900 dark:bg-zinc-700";
30
+ readonly light: "border border-gray-200 bg-white text-gray-900";
31
+ readonly auto: "border border-gray-200 bg-white text-gray-900 dark:border-none dark:text-white dark:bg-zinc-700";
32
+ };
33
+ readonly target: "w-fit";
34
+ };
35
+ readonly inlineWrapper: "flex items-center";
36
+ };
37
+ export interface DropdownProps extends Omit<ButtonProps, 'children' | 'label'> {
38
+ arrowIcon?: boolean;
39
+ dismissOnClick?: boolean;
40
+ enableTypeAhead?: boolean;
41
+ inline?: boolean;
42
+ label: ReactNode;
43
+ placement?: FloatingPlacement;
44
+ trigger?: FloatingTrigger;
45
+ renderTrigger?: (theme: typeof t) => ReactElement<Record<string, unknown>>;
46
+ 'data-testid'?: string;
47
+ children?: ReactNode;
48
+ }
49
+ export interface DropdownItemProps extends Omit<ComponentPropsWithoutRef<'button'>, 'onClick'> {
50
+ as?: ElementType;
51
+ href?: string;
52
+ target?: string;
53
+ rel?: string;
54
+ icon?: FC<ComponentPropsWithoutRef<'svg'>>;
55
+ onClick?: () => void;
56
+ }
57
+ export declare const DropdownItem: import("react").ForwardRefExoticComponent<DropdownItemProps & import("react").RefAttributes<HTMLButtonElement>>;
58
+ export type DropdownHeaderProps = ComponentPropsWithoutRef<'div'>;
59
+ export declare const DropdownHeader: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
60
+ export type DropdownDividerProps = ComponentPropsWithoutRef<'div'>;
61
+ export declare const DropdownDivider: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
62
+ export declare const Dropdown: (({ children, className, dismissOnClick, enableTypeAhead, renderTrigger, inline, placement, trigger, label, arrowIcon, ...buttonProps }: DropdownProps) => import("react").JSX.Element) & {
63
+ Item: import("react").ForwardRefExoticComponent<DropdownItemProps & import("react").RefAttributes<HTMLButtonElement>>;
64
+ Header: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
65
+ Divider: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
66
+ };
67
+ export {};
package/ui/Dropdown.js ADDED
@@ -0,0 +1,134 @@
1
+ 'use client';
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ import { FloatingFocusManager, FloatingList, useListItem, useListNavigation, useMergeRefs, useTypeahead, } from '@floating-ui/react';
15
+ import { cloneElement, createContext, createElement, forwardRef, useCallback, useContext, useEffect, useMemo, useRef, useState, } from 'react';
16
+ import { Button } from './Button';
17
+ import { cn } from './cn';
18
+ import { useBaseFloating, useFloatingInteractions, } from './Floating';
19
+ import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, } from './icons';
20
+ import { themeDefaults } from './theme-defaults';
21
+ const t = themeDefaults.dropdown;
22
+ const DropdownContext = createContext(undefined);
23
+ function useDropdownContext() {
24
+ const context = useContext(DropdownContext);
25
+ if (!context)
26
+ throw new Error('useDropdownContext should be used within the DropdownContext provider!');
27
+ return context;
28
+ }
29
+ const icons = {
30
+ top: ChevronUpIcon,
31
+ right: ChevronRightIcon,
32
+ bottom: ChevronDownIcon,
33
+ left: ChevronLeftIcon,
34
+ };
35
+ function Trigger(_a) {
36
+ var { refs, children, inline, disabled, setButtonWidth, getReferenceProps, renderTrigger } = _a, buttonProps = __rest(_a, ["refs", "children", "inline", "disabled", "setButtonWidth", "getReferenceProps", "renderTrigger"]);
37
+ const ref = refs.reference;
38
+ const a11yProps = getReferenceProps();
39
+ useEffect(() => {
40
+ if (ref.current)
41
+ setButtonWidth(ref.current.clientWidth);
42
+ }, [ref, setButtonWidth]);
43
+ if (renderTrigger) {
44
+ const triggerElement = renderTrigger(t);
45
+ return cloneElement(triggerElement, Object.assign(Object.assign({ ref: refs.setReference, disabled }, a11yProps), triggerElement.props));
46
+ }
47
+ return inline ? (_jsx("button", Object.assign({ type: "button", ref: refs.setReference, className: t.inlineWrapper, disabled: disabled }, a11yProps, { children: children }))) : (_jsx(Button, Object.assign({}, buttonProps, { disabled: disabled, type: "button", ref: refs.setReference }, a11yProps, { children: children })));
48
+ }
49
+ const DropdownRoot = function Dropdown(_a) {
50
+ var { children, className, dismissOnClick = true, enableTypeAhead = true, renderTrigger, inline, placement = inline ? 'bottom-start' : 'bottom', trigger = 'click', label, arrowIcon = true } = _a, buttonProps = __rest(_a, ["children", "className", "dismissOnClick", "enableTypeAhead", "renderTrigger", "inline", "placement", "trigger", "label", "arrowIcon"]);
51
+ const [open, setOpen] = useState(false);
52
+ const [activeIndex, setActiveIndex] = useState(null);
53
+ const [selectedIndex, setSelectedIndex] = useState(null);
54
+ const [buttonWidth, setButtonWidth] = useState(undefined);
55
+ const elementsRef = useRef([]);
56
+ const labelsRef = useRef([]);
57
+ const dataTestId = buttonProps['data-testid'] || 'flowbite-dropdown-target';
58
+ const handleSelect = useCallback((index) => {
59
+ setSelectedIndex(index);
60
+ setOpen(false);
61
+ }, []);
62
+ const handleTypeaheadMatch = useCallback((index) => {
63
+ if (open)
64
+ setActiveIndex(index);
65
+ else
66
+ handleSelect(index);
67
+ }, [open, handleSelect]);
68
+ const { context, floatingStyles, refs } = useBaseFloating({
69
+ open,
70
+ setOpen,
71
+ placement,
72
+ });
73
+ const listNav = useListNavigation(context, {
74
+ listRef: elementsRef,
75
+ activeIndex,
76
+ selectedIndex,
77
+ onNavigate: setActiveIndex,
78
+ });
79
+ const typeahead = useTypeahead(context, {
80
+ listRef: labelsRef,
81
+ activeIndex,
82
+ selectedIndex,
83
+ onMatch: handleTypeaheadMatch,
84
+ enabled: enableTypeAhead,
85
+ });
86
+ const { getReferenceProps, getFloatingProps, getItemProps } = useFloatingInteractions({
87
+ context,
88
+ role: 'menu',
89
+ trigger,
90
+ interactions: [listNav, typeahead],
91
+ });
92
+ const Icon = useMemo(() => {
93
+ var _a;
94
+ const [p] = placement.split('-');
95
+ return (_a = icons[p]) !== null && _a !== void 0 ? _a : ChevronDownIcon;
96
+ }, [placement]);
97
+ return (_jsxs(DropdownContext.Provider, { value: { activeIndex, dismissOnClick, getItemProps, handleSelect }, children: [_jsxs(Trigger, Object.assign({}, buttonProps, { refs: refs, inline: inline, "data-testid": dataTestId, className: cn(t.floating.target, className), setButtonWidth: setButtonWidth, getReferenceProps: getReferenceProps, renderTrigger: renderTrigger, children: [label, arrowIcon && _jsx(Icon, { className: t.arrowIcon })] })), open && (_jsx(FloatingFocusManager, { context: context, modal: false, children: _jsx("div", Object.assign({ ref: refs.setFloating, style: Object.assign(Object.assign({}, floatingStyles), { minWidth: buttonWidth }), "data-testid": "flowbite-dropdown", "aria-expanded": open }, getFloatingProps({
98
+ className: cn(t.floating.base, t.floating.animation, 'duration-100', !open && t.floating.hidden, t.floating.style.auto, className),
99
+ }), { children: _jsx(FloatingList, { elementsRef: elementsRef, labelsRef: labelsRef, children: _jsx("ul", { className: t.content, tabIndex: -1, children: children }) }) })) }))] }));
100
+ };
101
+ export const DropdownItem = forwardRef(function DropdownItem(_a, forwardedRef) {
102
+ var { children, className, icon: Icon, onClick, as: Component, href, type = 'button' } = _a, rest = __rest(_a, ["children", "className", "icon", "onClick", "as", "href", "type"]);
103
+ const { activeIndex, dismissOnClick, getItemProps, handleSelect } = useDropdownContext();
104
+ const { ref: listItemRef, index } = useListItem({
105
+ label: typeof children === 'string' ? children : undefined,
106
+ });
107
+ const ref = useMergeRefs([forwardedRef, listItemRef]);
108
+ const isActive = activeIndex === index;
109
+ const Base = Component !== null && Component !== void 0 ? Component : (href ? 'a' : 'button');
110
+ return (_jsx("li", { role: "menuitem", className: t.floating.item.container, children: createElement(Base, Object.assign(Object.assign(Object.assign({ ref,
111
+ href,
112
+ type, className: cn(t.floating.item.base, className) }, rest), getItemProps({
113
+ onClick: () => {
114
+ onClick === null || onClick === void 0 ? void 0 : onClick();
115
+ if (dismissOnClick)
116
+ handleSelect(null);
117
+ },
118
+ })), { tabIndex: isActive ? 0 : -1 }), Icon && _jsx(Icon, { className: t.floating.item.icon }), children) }));
119
+ });
120
+ export const DropdownHeader = forwardRef(function DropdownHeader(_a, ref) {
121
+ var { className } = _a, rest = __rest(_a, ["className"]);
122
+ useDropdownContext();
123
+ return (_jsx("div", Object.assign({ ref: ref, className: cn(t.floating.header, className) }, rest)));
124
+ });
125
+ export const DropdownDivider = forwardRef(function DropdownDivider(_a, ref) {
126
+ var { className } = _a, rest = __rest(_a, ["className"]);
127
+ useDropdownContext();
128
+ return (_jsx("div", Object.assign({ ref: ref, className: cn(t.floating.divider, className) }, rest)));
129
+ });
130
+ export const Dropdown = Object.assign(DropdownRoot, {
131
+ Item: DropdownItem,
132
+ Header: DropdownHeader,
133
+ Divider: DropdownDivider,
134
+ });
@@ -0,0 +1,23 @@
1
+ import { type ComponentPropsWithoutRef } from 'react';
2
+ import type { DynamicStringEnumKeysOf } from './types';
3
+ declare const t: {
4
+ readonly base: "block w-full cursor-pointer rounded-lg border file:-ms-4 file:me-4 file:cursor-pointer file:border-none file:bg-gray-800 file:py-2.5 file:pe-4 file:ps-8 file:text-sm file:font-medium file:leading-[inherit] file:text-white hover:file:bg-gray-700 focus:outline-none focus:ring-1 dark:file:bg-gray-600 dark:hover:file:bg-gray-500";
5
+ readonly sizes: {
6
+ readonly sm: "text-xs";
7
+ readonly md: "text-sm";
8
+ readonly lg: "text-lg";
9
+ };
10
+ readonly colors: {
11
+ readonly gray: "border-gray-300 bg-gray-50 text-gray-900 focus:border-primary-500 focus:ring-primary-500 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-400 dark:placeholder-gray-400 dark:focus:border-primary-500 dark:focus:ring-primary-500";
12
+ readonly info: "border-cyan-500 bg-cyan-50 text-cyan-900 placeholder-cyan-700 focus:border-cyan-500 focus:ring-cyan-500 dark:border-cyan-400 dark:bg-cyan-100 dark:focus:border-cyan-500 dark:focus:ring-cyan-500";
13
+ readonly failure: "border-red-500 bg-red-50 text-red-900 placeholder-red-700 focus:border-red-500 focus:ring-red-500 dark:border-red-400 dark:bg-red-100 dark:focus:border-red-500 dark:focus:ring-red-500";
14
+ readonly warning: "border-yellow-500 bg-yellow-50 text-yellow-900 placeholder-yellow-700 focus:border-yellow-500 focus:ring-yellow-500 dark:border-yellow-400 dark:bg-yellow-100 dark:focus:border-yellow-500 dark:focus:ring-yellow-500";
15
+ readonly success: "border-green-500 bg-green-50 text-green-900 placeholder-green-700 focus:border-green-500 focus:ring-green-500 dark:border-green-400 dark:bg-green-100 dark:focus:border-green-500 dark:focus:ring-green-500";
16
+ };
17
+ };
18
+ export interface FileInputProps extends Omit<ComponentPropsWithoutRef<'input'>, 'type' | 'color'> {
19
+ color?: DynamicStringEnumKeysOf<typeof t.colors>;
20
+ sizing?: DynamicStringEnumKeysOf<typeof t.sizes>;
21
+ }
22
+ export declare const FileInput: import("react").ForwardRefExoticComponent<FileInputProps & import("react").RefAttributes<HTMLInputElement>>;
23
+ export {};
@@ -0,0 +1,21 @@
1
+ 'use client';
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { forwardRef } from 'react';
15
+ import { cn } from './cn';
16
+ import { themeDefaults } from './theme-defaults';
17
+ const t = themeDefaults.fileInput;
18
+ export const FileInput = forwardRef(function FileInput(_a, ref) {
19
+ var { className, color = 'gray', sizing = 'md' } = _a, rest = __rest(_a, ["className", "color", "sizing"]);
20
+ return (_jsx("input", Object.assign({ ref: ref, type: "file", className: cn(t.base, t.colors[color], t.sizes[sizing], className) }, rest)));
21
+ });
@@ -0,0 +1,96 @@
1
+ import { useInteractions, type FloatingContext, type Placement } from '@floating-ui/react';
2
+ import { type ComponentPropsWithoutRef, type ReactNode, type RefObject } from 'react';
3
+ export type FloatingPlacement = 'auto' | Placement;
4
+ export type FloatingTrigger = 'hover' | 'click';
5
+ export type FloatingStyle = 'dark' | 'light' | 'auto';
6
+ /** The theme shape Tooltip and Dropdown's floating layer share. */
7
+ export interface FloatingTheme {
8
+ target: string;
9
+ base: string;
10
+ animation: string;
11
+ hidden: string;
12
+ style: {
13
+ dark: string;
14
+ light: string;
15
+ auto: string;
16
+ };
17
+ content: string;
18
+ arrow: {
19
+ base: string;
20
+ style: {
21
+ dark: string;
22
+ light: string;
23
+ auto: string;
24
+ };
25
+ placement: string;
26
+ };
27
+ }
28
+ export declare function getMiddleware({ arrowRef, placement, }: {
29
+ arrowRef?: RefObject<HTMLDivElement | null>;
30
+ placement: FloatingPlacement;
31
+ }): {
32
+ name: string;
33
+ options?: any;
34
+ fn: (state: import("@floating-ui/dom").MiddlewareState) => import("@floating-ui/dom").MiddlewareReturn | Promise<import("@floating-ui/dom").MiddlewareReturn>;
35
+ }[];
36
+ export declare function useBaseFloating({ open, arrowRef, placement, setOpen, }: {
37
+ open: boolean;
38
+ arrowRef?: RefObject<HTMLDivElement | null>;
39
+ placement?: FloatingPlacement;
40
+ setOpen: (open: boolean) => void;
41
+ }): {
42
+ placement: Placement;
43
+ strategy: import("@floating-ui/utils").Strategy;
44
+ middlewareData: import("@floating-ui/dom").MiddlewareData;
45
+ x: number;
46
+ y: number;
47
+ isPositioned: boolean;
48
+ update: () => void;
49
+ floatingStyles: React.CSSProperties;
50
+ refs: {
51
+ reference: import("react").MutableRefObject<import("@floating-ui/react-dom").ReferenceType>;
52
+ floating: React.MutableRefObject<HTMLElement | null>;
53
+ setReference: (node: import("@floating-ui/react-dom").ReferenceType) => void;
54
+ setFloating: (node: HTMLElement | null) => void;
55
+ } & import("@floating-ui/react").ExtendedRefs<import("@floating-ui/react").ReferenceType>;
56
+ elements: {
57
+ reference: import("@floating-ui/react-dom").ReferenceType;
58
+ floating: HTMLElement | null;
59
+ } & import("@floating-ui/react").ExtendedElements<import("@floating-ui/react").ReferenceType>;
60
+ context: {
61
+ strategy: import("@floating-ui/utils").Strategy;
62
+ x: number;
63
+ y: number;
64
+ placement: Placement;
65
+ middlewareData: import("@floating-ui/dom").MiddlewareData;
66
+ isPositioned: boolean;
67
+ update: () => void;
68
+ floatingStyles: React.CSSProperties;
69
+ open: boolean;
70
+ onOpenChange: (open: boolean, event?: Event, reason?: import("@floating-ui/react").OpenChangeReason) => void;
71
+ events: import("@floating-ui/react").FloatingEvents;
72
+ dataRef: React.MutableRefObject<import("@floating-ui/react").ContextData>;
73
+ nodeId: string | undefined;
74
+ floatingId: string | undefined;
75
+ refs: import("@floating-ui/react").ExtendedRefs<import("@floating-ui/react").ReferenceType>;
76
+ elements: import("@floating-ui/react").ExtendedElements<import("@floating-ui/react").ReferenceType>;
77
+ };
78
+ };
79
+ export declare function useFloatingInteractions({ context, trigger, role, interactions, }: {
80
+ context: FloatingContext;
81
+ trigger: FloatingTrigger;
82
+ role?: 'tooltip' | 'menu';
83
+ interactions?: Parameters<typeof useInteractions>[0];
84
+ }): import("@floating-ui/react").UseInteractionsReturn;
85
+ export declare function getArrowPlacement(placement: Placement): "right" | "bottom" | "left" | "top";
86
+ export interface FloatingProps extends Omit<ComponentPropsWithoutRef<'div'>, 'content' | 'style'> {
87
+ animation?: false | `duration-${number}`;
88
+ arrow?: boolean;
89
+ content: ReactNode;
90
+ placement?: FloatingPlacement;
91
+ style?: FloatingStyle;
92
+ theme: FloatingTheme;
93
+ trigger?: FloatingTrigger;
94
+ minWidth?: number;
95
+ }
96
+ export declare function Floating({ animation, arrow, children, className, content, placement, style, theme, trigger, minWidth, ...props }: FloatingProps): import("react").JSX.Element;
package/ui/Floating.js ADDED
@@ -0,0 +1,92 @@
1
+ 'use client';
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
14
+ import { arrow, autoPlacement, autoUpdate, flip, offset, safePolygon, shift, useClick, useDismiss, useFloating, useFocus, useHover, useInteractions, useRole, } from '@floating-ui/react';
15
+ import { useEffect, useRef, useState, } from 'react';
16
+ import { cn } from './cn';
17
+ export function getMiddleware({ arrowRef, placement, }) {
18
+ const middleware = [
19
+ offset(8),
20
+ placement === 'auto' ? autoPlacement() : flip(),
21
+ shift({ padding: 8 }),
22
+ ];
23
+ if (arrowRef === null || arrowRef === void 0 ? void 0 : arrowRef.current)
24
+ middleware.push(arrow({ element: arrowRef.current }));
25
+ return middleware;
26
+ }
27
+ export function useBaseFloating({ open, arrowRef, placement = 'top', setOpen, }) {
28
+ return useFloating({
29
+ placement: placement === 'auto' ? undefined : placement,
30
+ open,
31
+ onOpenChange: setOpen,
32
+ whileElementsMounted: autoUpdate,
33
+ middleware: getMiddleware({ placement, arrowRef }),
34
+ });
35
+ }
36
+ export function useFloatingInteractions({ context, trigger, role = 'tooltip', interactions = [], }) {
37
+ return useInteractions([
38
+ useClick(context, { enabled: trigger === 'click' }),
39
+ useHover(context, {
40
+ enabled: trigger === 'hover',
41
+ handleClose: safePolygon(),
42
+ }),
43
+ useDismiss(context),
44
+ useRole(context, { role }),
45
+ ...interactions,
46
+ ]);
47
+ }
48
+ const arrowSide = {
49
+ top: 'bottom',
50
+ right: 'left',
51
+ bottom: 'top',
52
+ left: 'right',
53
+ };
54
+ export function getArrowPlacement(placement) {
55
+ return arrowSide[placement.split('-')[0]];
56
+ }
57
+ export function Floating(_a) {
58
+ var { animation = 'duration-300', arrow = true, children, className, content, placement = 'top', style = 'dark', theme, trigger = 'hover', minWidth } = _a, props = __rest(_a, ["animation", "arrow", "children", "className", "content", "placement", "style", "theme", "trigger", "minWidth"]);
59
+ const arrowRef = useRef(null);
60
+ const [open, setOpen] = useState(false);
61
+ const floatingProperties = useBaseFloating({
62
+ open,
63
+ placement,
64
+ arrowRef,
65
+ setOpen,
66
+ });
67
+ const { context, middlewareData: { arrow: { x: arrowX, y: arrowY } = {} }, refs, strategy, update, x, y, } = floatingProperties;
68
+ const focus = useFocus(context);
69
+ const { getFloatingProps, getReferenceProps } = useFloatingInteractions({
70
+ context,
71
+ role: 'tooltip',
72
+ trigger,
73
+ interactions: [focus],
74
+ });
75
+ useEffect(() => {
76
+ if (refs.reference.current && refs.floating.current && open) {
77
+ return autoUpdate(refs.reference.current, refs.floating.current, update);
78
+ }
79
+ }, [open, refs.floating, refs.reference, update]);
80
+ return (_jsxs(_Fragment, { children: [_jsx("div", Object.assign({ ref: refs.setReference, className: theme.target, "data-testid": "flowbite-tooltip-target" }, getReferenceProps(), { children: children })), _jsxs("div", Object.assign({ ref: refs.setFloating, "data-testid": "flowbite-tooltip" }, getFloatingProps(Object.assign({ className: cn(theme.base, animation && `${theme.animation} ${animation}`, !open && theme.hidden, theme.style[style], className), style: {
81
+ position: strategy,
82
+ top: y !== null && y !== void 0 ? y : ' ',
83
+ left: x !== null && x !== void 0 ? x : ' ',
84
+ minWidth,
85
+ } }, props)), { children: [_jsx("div", { className: theme.content, children: content }), arrow && (_jsx("div", { className: cn(theme.arrow.base, style === 'dark' && theme.arrow.style.dark, style === 'light' && theme.arrow.style.light, style === 'auto' && theme.arrow.style.auto), "data-testid": "flowbite-tooltip-arrow", ref: arrowRef, style: {
86
+ top: arrowY !== null && arrowY !== void 0 ? arrowY : ' ',
87
+ left: arrowX !== null && arrowX !== void 0 ? arrowX : ' ',
88
+ right: ' ',
89
+ bottom: ' ',
90
+ [getArrowPlacement(floatingProperties.placement)]: theme.arrow.placement,
91
+ }, children: "\u00A0" }))] }))] }));
92
+ }
@@ -0,0 +1,19 @@
1
+ import { type ComponentPropsWithoutRef } from 'react';
2
+ import type { DynamicStringEnumKeysOf } from './types';
3
+ declare const t: {
4
+ readonly root: {
5
+ readonly base: "mt-2 text-sm";
6
+ readonly colors: {
7
+ readonly gray: "text-gray-500 dark:text-gray-300";
8
+ readonly info: "text-cyan-700 dark:text-cyan-800";
9
+ readonly success: "text-green-600 dark:text-green-500";
10
+ readonly failure: "text-red-600 dark:text-red-500";
11
+ readonly warning: "text-yellow-500 dark:text-yellow-600";
12
+ };
13
+ };
14
+ };
15
+ export interface HelperTextProps extends Omit<ComponentPropsWithoutRef<'p'>, 'color'> {
16
+ color?: DynamicStringEnumKeysOf<typeof t.root.colors>;
17
+ }
18
+ export declare const HelperText: import("react").ForwardRefExoticComponent<HelperTextProps & import("react").RefAttributes<HTMLParagraphElement>>;
19
+ export {};
@@ -0,0 +1,21 @@
1
+ 'use client';
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { forwardRef } from 'react';
15
+ import { cn } from './cn';
16
+ import { themeDefaults } from './theme-defaults';
17
+ const t = themeDefaults.helperText;
18
+ export const HelperText = forwardRef(function HelperText(_a, ref) {
19
+ var { className, color = 'gray' } = _a, rest = __rest(_a, ["className", "color"]);
20
+ return (_jsx("p", Object.assign({ ref: ref, className: cn(t.root.base, t.root.colors[color], className) }, rest)));
21
+ });
package/ui/Label.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ import { type ComponentPropsWithoutRef } from 'react';
2
+ import type { DynamicStringEnumKeysOf } from './types';
3
+ declare const t: {
4
+ readonly root: {
5
+ readonly base: "text-sm font-medium";
6
+ readonly disabled: "opacity-50";
7
+ readonly colors: {
8
+ readonly default: "text-gray-900 dark:text-white";
9
+ readonly info: "text-primary-500 dark:text-primary-400";
10
+ readonly failure: "text-red-700 dark:text-red-500";
11
+ readonly warning: "text-amber-500 dark:text-amber-400";
12
+ readonly success: "text-green-600 dark:text-green-400";
13
+ };
14
+ };
15
+ };
16
+ export interface LabelProps extends Omit<ComponentPropsWithoutRef<'label'>, 'color'> {
17
+ color?: DynamicStringEnumKeysOf<typeof t.root.colors>;
18
+ disabled?: boolean;
19
+ }
20
+ export declare const Label: import("react").ForwardRefExoticComponent<LabelProps & import("react").RefAttributes<HTMLLabelElement>>;
21
+ export {};
package/ui/Label.js ADDED
@@ -0,0 +1,21 @@
1
+ 'use client';
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { forwardRef } from 'react';
15
+ import { cn } from './cn';
16
+ import { themeDefaults } from './theme-defaults';
17
+ const t = themeDefaults.label;
18
+ export const Label = forwardRef(function Label(_a, ref) {
19
+ var { className, color = 'default', disabled = false } = _a, rest = __rest(_a, ["className", "color", "disabled"]);
20
+ return (_jsx("label", Object.assign({ ref: ref, className: cn(t.root.base, t.root.colors[color], disabled && t.root.disabled, className), "data-testid": "flowbite-label" }, rest)));
21
+ });