flikkui 0.2.0-beta.2 → 0.2.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/dist/components/ai/PromptInput/PromptInput.js +23 -15
- package/dist/components/ai/PromptSuggestions/PromptSuggestion.d.ts +27 -0
- package/dist/components/ai/PromptSuggestions/PromptSuggestion.js +62 -0
- package/dist/components/ai/PromptSuggestions/PromptSuggestion.theme.d.ts +10 -0
- package/dist/components/ai/PromptSuggestions/PromptSuggestion.theme.js +12 -0
- package/dist/components/ai/PromptSuggestions/PromptSuggestion.types.d.ts +53 -0
- package/dist/components/ai/PromptSuggestions/index.d.ts +4 -2
- package/dist/components/ai/index.d.ts +2 -12
- package/dist/components/charts/ActivityRings/ActivityRings.js +70 -58
- package/dist/components/charts/ActivityRings/ActivityRings.theme.js +0 -1
- package/dist/components/charts/ActivityRings/ActivityRings.types.d.ts +17 -0
- package/dist/components/charts/BarChart/BarChart.js +8 -4
- package/dist/components/charts/BarChart/BarChart.types.d.ts +14 -0
- package/dist/components/charts/DonutChart/DonutChart.js +11 -8
- package/dist/components/charts/DonutChart/DonutChart.theme.d.ts +3 -0
- package/dist/components/charts/DonutChart/DonutChart.theme.js +5 -4
- package/dist/components/charts/DonutChart/donut-utils.d.ts +5 -0
- package/dist/components/charts/DonutChart/donut-utils.js +26 -1
- package/dist/components/charts/Heatmap/Heatmap.theme.js +2 -2
- package/dist/components/charts/shared/ChartAxis/XAxis.d.ts +2 -2
- package/dist/components/charts/shared/ChartAxis/XAxis.js +4 -4
- package/dist/components/charts/shared/ChartAxis/YAxis.d.ts +2 -2
- package/dist/components/charts/shared/ChartAxis/YAxis.js +8 -7
- package/dist/components/charts/shared/ChartGrid/HorizontalGrid.d.ts +1 -1
- package/dist/components/charts/shared/ChartGrid/HorizontalGrid.js +2 -2
- package/dist/components/charts/theme/chart.theme.d.ts +1 -1
- package/dist/components/charts/theme/chart.theme.js +39 -39
- package/dist/components/core/Accordion/Accordion.d.ts +1 -1
- package/dist/components/core/Accordion/Accordion.js +2 -2
- package/dist/components/core/Accordion/Accordion.types.d.ts +8 -0
- package/dist/components/core/Badge/Badge.js +11 -15
- package/dist/components/core/Badge/Badge.theme.js +7 -21
- package/dist/components/core/Badge/Badge.types.d.ts +9 -1
- package/dist/components/core/Button/Button.js +2 -2
- package/dist/components/core/Button/Button.theme.js +1 -1
- package/dist/components/core/Button/Button.types.d.ts +8 -0
- package/dist/components/core/Card/Card.js +8 -2
- package/dist/components/core/Card/Card.theme.js +1 -1
- package/dist/components/core/Card/Card.types.d.ts +24 -1
- package/dist/components/core/Drawer/Drawer.d.ts +1 -1
- package/dist/components/core/Drawer/Drawer.js +10 -40
- package/dist/components/core/Drawer/Drawer.theme.js +2 -1
- package/dist/components/core/Drawer/Drawer.types.d.ts +8 -0
- package/dist/components/core/Dropdown/Dropdown.d.ts +1 -1
- package/dist/components/core/Dropdown/Dropdown.js +2 -2
- package/dist/components/core/Dropdown/Dropdown.types.d.ts +8 -0
- package/dist/components/core/Metric/Metric.d.ts +1 -1
- package/dist/components/core/Metric/Metric.js +9 -5
- package/dist/components/core/Metric/Metric.theme.d.ts +1 -1
- package/dist/components/core/Metric/Metric.theme.js +38 -28
- package/dist/components/core/Metric/Metric.types.d.ts +27 -8
- package/dist/components/core/Modal/Modal.d.ts +1 -1
- package/dist/components/core/Modal/Modal.js +17 -40
- package/dist/components/core/Modal/Modal.theme.js +8 -3
- package/dist/components/core/Modal/Modal.types.d.ts +18 -0
- package/dist/components/core/Modal/index.d.ts +1 -1
- package/dist/components/core/Notification/Notification.js +2 -0
- package/dist/components/core/Pill/Pill.d.ts +6 -11
- package/dist/components/core/Pill/Pill.theme.d.ts +2 -2
- package/dist/components/core/Pill/Pill.types.d.ts +9 -22
- package/dist/components/core/Pill/index.d.ts +1 -1
- package/dist/components/core/Popover/Popover.d.ts +1 -1
- package/dist/components/core/Popover/Popover.js +2 -2
- package/dist/components/core/Popover/Popover.types.d.ts +8 -0
- package/dist/components/core/Progress/Progress.d.ts +28 -0
- package/dist/components/core/Progress/Progress.js +114 -0
- package/dist/components/core/Progress/Progress.theme.d.ts +5 -0
- package/dist/components/core/Progress/Progress.theme.js +33 -0
- package/dist/components/core/Progress/Progress.types.d.ts +92 -0
- package/dist/components/core/Progress/index.d.ts +2 -0
- package/dist/components/core/Tabs/Tabs.js +2 -2
- package/dist/components/core/Tabs/Tabs.types.d.ts +8 -0
- package/dist/components/core/Tag/Tag.animations.d.ts +3 -0
- package/dist/components/core/Tag/Tag.animations.js +31 -0
- package/dist/components/core/Tag/Tag.d.ts +14 -0
- package/dist/components/core/Tag/Tag.js +45 -0
- package/dist/components/core/Tag/Tag.theme.d.ts +2 -0
- package/dist/components/core/Tag/Tag.theme.js +21 -0
- package/dist/components/core/Tag/Tag.types.d.ts +40 -0
- package/dist/components/core/Tag/index.d.ts +3 -0
- package/dist/components/core/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/core/Tooltip/Tooltip.js +3 -3
- package/dist/components/core/Tooltip/Tooltip.theme.js +1 -1
- package/dist/components/core/Tooltip/Tooltip.types.d.ts +17 -0
- package/dist/components/core/index.d.ts +2 -1
- package/dist/components/core/index.js +3 -2
- package/dist/components/effects/CustomCursor/CustomCursor.d.ts +0 -13
- package/dist/components/effects/CustomCursor/CustomCursor.js +26 -2
- package/dist/components/effects/CustomCursor/CustomCursor.theme.js +12 -1
- package/dist/components/effects/CustomCursor/CustomCursor.types.d.ts +14 -1
- package/dist/components/forms/Combobox/Combobox.d.ts +25 -0
- package/dist/components/forms/Combobox/Combobox.js +412 -0
- package/dist/components/forms/Combobox/Combobox.theme.d.ts +6 -0
- package/dist/components/forms/Combobox/Combobox.theme.js +60 -0
- package/dist/components/forms/Combobox/Combobox.types.d.ts +111 -0
- package/dist/components/forms/Combobox/index.d.ts +3 -0
- package/dist/components/forms/FileUpload/FileUpload.js +2 -0
- package/dist/components/forms/Input/Input.js +25 -28
- package/dist/components/forms/Input/inputMasks.d.ts +15 -0
- package/dist/components/forms/Input/inputMasks.js +72 -1
- package/dist/components/forms/InputTag/InputTag.d.ts +40 -0
- package/dist/components/forms/InputTag/InputTag.js +491 -0
- package/dist/components/forms/InputTag/InputTag.theme.d.ts +2 -0
- package/dist/components/forms/InputTag/InputTag.theme.js +16 -0
- package/dist/components/forms/InputTag/InputTag.types.d.ts +107 -0
- package/dist/components/forms/InputTag/index.d.ts +3 -0
- package/dist/components/forms/Select/Select.d.ts +101 -2
- package/dist/components/forms/Select/Select.js +128 -132
- package/dist/components/forms/Select/Select.theme.js +10 -14
- package/dist/components/forms/Select/Select.types.d.ts +6 -2
- package/dist/components/forms/Select/index.d.ts +7 -4
- package/dist/components/forms/Select/useSelectState.d.ts +66 -0
- package/dist/components/forms/Select/useSelectState.js +134 -0
- package/dist/components/forms/SelectExpand/SelectExpand.animations.d.ts +20 -0
- package/dist/components/forms/SelectExpand/SelectExpand.animations.js +74 -0
- package/dist/components/forms/SelectExpand/SelectExpand.d.ts +9 -0
- package/dist/components/forms/SelectExpand/SelectExpand.js +223 -0
- package/dist/components/forms/SelectExpand/SelectExpand.theme.d.ts +5 -0
- package/dist/components/forms/SelectExpand/SelectExpand.theme.js +74 -0
- package/dist/components/forms/SelectExpand/SelectExpand.types.d.ts +126 -0
- package/dist/components/forms/SelectExpand/index.d.ts +4 -0
- package/dist/components/forms/Switch/Switch.js +3 -3
- package/dist/components/forms/Switch/Switch.theme.d.ts +1 -1
- package/dist/components/forms/Switch/Switch.theme.js +2 -2
- package/dist/components/forms/TimePicker/TimePicker.animations.d.ts +0 -46
- package/dist/components/forms/TimePicker/TimePicker.d.ts +15 -6
- package/dist/components/forms/TimePicker/TimePicker.js +285 -124
- package/dist/components/forms/TimePicker/TimePicker.theme.d.ts +1 -1
- package/dist/components/forms/TimePicker/TimePicker.theme.js +39 -22
- package/dist/components/forms/TimePicker/TimePicker.types.d.ts +88 -34
- package/dist/components/forms/TimePicker/TimePickerContent.d.ts +7 -10
- package/dist/components/forms/TimePicker/TimePickerContent.js +149 -16
- package/dist/components/forms/TimePicker/TimePickerTrigger.d.ts +3 -3
- package/dist/components/forms/TimePicker/TimePickerTrigger.js +22 -19
- package/dist/components/forms/TimePicker/WheelColumn.d.ts +14 -0
- package/dist/components/forms/TimePicker/WheelColumn.js +90 -0
- package/dist/components/forms/TimePicker/index.d.ts +4 -1
- package/dist/components/forms/TimePicker/useWheelPicker.d.ts +37 -0
- package/dist/components/forms/TimePicker/useWheelPicker.js +138 -0
- package/dist/components/forms/forms.theme.d.ts +14 -0
- package/dist/components/forms/forms.theme.js +31 -0
- package/dist/components/forms/index.d.ts +9 -3
- package/dist/components/forms/index.js +73 -2
- package/dist/hooks/index.d.ts +0 -4
- package/dist/icons/Icon.d.ts +7 -0
- package/dist/icons/Icon.js +6 -2
- package/dist/index.js +12 -16
- package/dist/styles.css +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/optimisticErrors.js +1 -70
- package/package.json +1 -1
- package/dist/components/ai/EditingIndicator/EditingIndicator.animations.d.ts +0 -31
- package/dist/components/ai/EditingIndicator/EditingIndicator.animations.js +0 -115
- package/dist/components/ai/EditingIndicator/EditingIndicator.d.ts +0 -35
- package/dist/components/ai/EditingIndicator/EditingIndicator.js +0 -94
- package/dist/components/ai/EditingIndicator/EditingIndicator.theme.d.ts +0 -2
- package/dist/components/ai/EditingIndicator/EditingIndicator.theme.js +0 -13
- package/dist/components/ai/EditingIndicator/EditingIndicator.types.d.ts +0 -54
- package/dist/components/ai/EditingIndicator/index.d.ts +0 -9
- package/dist/components/ai/GenerativeRenderer/GenerativeRenderer.d.ts +0 -3
- package/dist/components/ai/GenerativeRenderer/GenerativeRenderer.js +0 -126
- package/dist/components/ai/GenerativeRenderer/GenerativeRenderer.theme.d.ts +0 -2
- package/dist/components/ai/GenerativeRenderer/GenerativeRenderer.theme.js +0 -8
- package/dist/components/ai/GenerativeRenderer/GenerativeRenderer.types.d.ts +0 -45
- package/dist/components/ai/GenerativeRenderer/index.d.ts +0 -3
- package/dist/components/ai/PresenceIndicator/PresenceIndicator.animations.d.ts +0 -17
- package/dist/components/ai/PresenceIndicator/PresenceIndicator.animations.js +0 -56
- package/dist/components/ai/PresenceIndicator/PresenceIndicator.d.ts +0 -38
- package/dist/components/ai/PresenceIndicator/PresenceIndicator.js +0 -110
- package/dist/components/ai/PresenceIndicator/PresenceIndicator.theme.d.ts +0 -2
- package/dist/components/ai/PresenceIndicator/PresenceIndicator.theme.js +0 -13
- package/dist/components/ai/PresenceIndicator/PresenceIndicator.types.d.ts +0 -53
- package/dist/components/ai/PresenceIndicator/index.d.ts +0 -8
- package/dist/components/ai/PresenceProvider/PresenceContext.d.ts +0 -24
- package/dist/components/ai/PresenceProvider/PresenceContext.js +0 -34
- package/dist/components/ai/PresenceProvider/PresenceProvider.d.ts +0 -32
- package/dist/components/ai/PresenceProvider/PresenceProvider.js +0 -321
- package/dist/components/ai/PresenceProvider/PresenceProvider.types.d.ts +0 -140
- package/dist/components/ai/PresenceProvider/adapters/MockAdapter.d.ts +0 -102
- package/dist/components/ai/PresenceProvider/adapters/MockAdapter.js +0 -331
- package/dist/components/ai/PresenceProvider/adapters/PresenceAdapter.d.ts +0 -93
- package/dist/components/ai/PresenceProvider/adapters/SupabaseAdapter.d.ts +0 -134
- package/dist/components/ai/PresenceProvider/adapters/WebSocketAdapter.d.ts +0 -149
- package/dist/components/ai/PresenceProvider/adapters/index.d.ts +0 -11
- package/dist/components/ai/PresenceProvider/index.d.ts +0 -10
- package/dist/components/ai/PromptSuggestions/PromptSuggestions.d.ts +0 -27
- package/dist/components/ai/PromptSuggestions/PromptSuggestions.js +0 -61
- package/dist/components/ai/PromptSuggestions/PromptSuggestions.types.d.ts +0 -65
- package/dist/components/ai/VersionSlider/VersionSlider.d.ts +0 -3
- package/dist/components/ai/VersionSlider/VersionSlider.js +0 -97
- package/dist/components/ai/VersionSlider/VersionSlider.theme.d.ts +0 -2
- package/dist/components/ai/VersionSlider/VersionSlider.theme.js +0 -18
- package/dist/components/ai/VersionSlider/VersionSlider.types.d.ts +0 -77
- package/dist/components/ai/VersionSlider/index.d.ts +0 -3
- package/dist/components/core/Pill/Pill.animations.js +0 -25
- package/dist/components/core/Pill/Pill.js +0 -145
- package/dist/components/core/Pill/Pill.theme.js +0 -65
- package/dist/components/core/RetryBoundary/RetryBoundary.d.ts +0 -35
- package/dist/components/core/RetryBoundary/RetryBoundary.js +0 -154
- package/dist/components/core/RetryBoundary/RetryBoundary.theme.d.ts +0 -2
- package/dist/components/core/RetryBoundary/RetryBoundary.theme.js +0 -7
- package/dist/components/core/RetryBoundary/RetryBoundary.types.d.ts +0 -51
- package/dist/components/core/RetryBoundary/index.d.ts +0 -3
- package/dist/components/forms/OptimisticForm/OptimisticForm.d.ts +0 -33
- package/dist/components/forms/OptimisticForm/OptimisticForm.js +0 -87
- package/dist/components/forms/OptimisticForm/OptimisticForm.theme.d.ts +0 -2
- package/dist/components/forms/OptimisticForm/OptimisticForm.theme.js +0 -8
- package/dist/components/forms/OptimisticForm/OptimisticForm.types.d.ts +0 -74
- package/dist/components/forms/OptimisticForm/index.d.ts +0 -3
- package/dist/hooks/useOptimisticMutation.d.ts +0 -109
- package/dist/hooks/useOptimisticMutation.js +0 -171
- package/dist/hooks/usePresence.d.ts +0 -88
- package/dist/utils/presenceUtils.d.ts +0 -66
- package/dist/utils/presenceUtils.js +0 -107
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Presence Adapters
|
|
3
|
-
*
|
|
4
|
-
* Backend implementations for real-time presence tracking.
|
|
5
|
-
*
|
|
6
|
-
* @module collaboration/adapters
|
|
7
|
-
*/
|
|
8
|
-
export type { PresenceAdapter, PresenceAdapterConfig, } from './PresenceAdapter';
|
|
9
|
-
export { MockPresenceAdapter } from './MockAdapter';
|
|
10
|
-
export { WebSocketPresenceAdapter, type WebSocketAdapterOptions, } from './WebSocketAdapter';
|
|
11
|
-
export { SupabasePresenceAdapter } from './SupabaseAdapter';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PresenceProvider - Real-time collaboration provider
|
|
3
|
-
*
|
|
4
|
-
* @module collaboration/PresenceProvider
|
|
5
|
-
*/
|
|
6
|
-
export { PresenceProvider } from './PresenceProvider';
|
|
7
|
-
export { PresenceContext, usePresenceContext } from './PresenceContext';
|
|
8
|
-
export type { PresenceUser, TypingUser, ConnectionStatus, PresenceEvent, PresenceContextValue, PresenceProviderProps, PresenceProviderTheme, } from './PresenceProvider.types';
|
|
9
|
-
export type { PresenceAdapter, PresenceAdapterConfig, } from './adapters/PresenceAdapter';
|
|
10
|
-
export { MockPresenceAdapter } from './adapters/MockAdapter';
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { PromptSuggestionsProps } from "./PromptSuggestions.types";
|
|
3
|
-
/**
|
|
4
|
-
* PromptSuggestions - Smart prompt starter chips
|
|
5
|
-
*
|
|
6
|
-
* Displays a list of clickable Pill components that users can select
|
|
7
|
-
* to quickly populate the prompt input.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```tsx
|
|
11
|
-
* <PromptSuggestions
|
|
12
|
-
* suggestions={["Summarize this document", "Write a poem"]}
|
|
13
|
-
* onSelect={(text) => setPrompt(text)}
|
|
14
|
-
* />
|
|
15
|
-
*
|
|
16
|
-
* <PromptSuggestions
|
|
17
|
-
* suggestions={[
|
|
18
|
-
* { text: "Help me write", icon: <PencilIcon className="size-4" /> },
|
|
19
|
-
* { text: "Explain this code", icon: <CodeIcon className="size-4" /> },
|
|
20
|
-
* ]}
|
|
21
|
-
* onSelect={handleSelect}
|
|
22
|
-
* layout="grid"
|
|
23
|
-
* color="primary"
|
|
24
|
-
* />
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export declare const PromptSuggestions: React.ForwardRefExoticComponent<PromptSuggestionsProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import React__default, { useMemo, useCallback } from 'react';
|
|
2
|
-
import { Pill } from '../../core/Pill/Pill.js';
|
|
3
|
-
import { cn } from '../../../utils/cn.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Layout styles for suggestion container
|
|
7
|
-
*/
|
|
8
|
-
const layoutStyles = {
|
|
9
|
-
horizontal: "flex flex-wrap gap-2",
|
|
10
|
-
vertical: "flex flex-col gap-2",
|
|
11
|
-
grid: "grid grid-cols-2 gap-2",
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* PromptSuggestions - Smart prompt starter chips
|
|
15
|
-
*
|
|
16
|
-
* Displays a list of clickable Pill components that users can select
|
|
17
|
-
* to quickly populate the prompt input.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```tsx
|
|
21
|
-
* <PromptSuggestions
|
|
22
|
-
* suggestions={["Summarize this document", "Write a poem"]}
|
|
23
|
-
* onSelect={(text) => setPrompt(text)}
|
|
24
|
-
* />
|
|
25
|
-
*
|
|
26
|
-
* <PromptSuggestions
|
|
27
|
-
* suggestions={[
|
|
28
|
-
* { text: "Help me write", icon: <PencilIcon className="size-4" /> },
|
|
29
|
-
* { text: "Explain this code", icon: <CodeIcon className="size-4" /> },
|
|
30
|
-
* ]}
|
|
31
|
-
* onSelect={handleSelect}
|
|
32
|
-
* layout="grid"
|
|
33
|
-
* color="primary"
|
|
34
|
-
* />
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
const PromptSuggestions = React__default.forwardRef(({ suggestions, onSelect, variant = "outline", color = "neutral", layout = "horizontal", maxVisible, disabled = false, className, pillClassName, ...props }, ref) => {
|
|
38
|
-
// Normalize suggestions to objects
|
|
39
|
-
const normalizedSuggestions = useMemo(() => {
|
|
40
|
-
const mapped = suggestions.map((s, index) => {
|
|
41
|
-
if (typeof s === "string") {
|
|
42
|
-
return { key: `suggestion-${index}`, text: s };
|
|
43
|
-
}
|
|
44
|
-
return { key: s.key || `suggestion-${index}`, ...s };
|
|
45
|
-
});
|
|
46
|
-
return maxVisible ? mapped.slice(0, maxVisible) : mapped;
|
|
47
|
-
}, [suggestions, maxVisible]);
|
|
48
|
-
// Handle suggestion click
|
|
49
|
-
const handleClick = useCallback((suggestion) => {
|
|
50
|
-
if (disabled)
|
|
51
|
-
return;
|
|
52
|
-
onSelect === null || onSelect === void 0 ? void 0 : onSelect(suggestion.text);
|
|
53
|
-
}, [disabled, onSelect]);
|
|
54
|
-
if (normalizedSuggestions.length === 0) {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
return (React__default.createElement("div", { ref: ref, className: cn(layoutStyles[layout], className), role: "group", "aria-label": "Prompt suggestions", ...props }, normalizedSuggestions.map((suggestion) => (React__default.createElement(Pill, { key: suggestion.key, variant: variant, color: color, size: "md", iconStart: suggestion.icon, onClick: () => handleClick(suggestion), readOnly: disabled, className: cn(`py-2 px-3.5 font-normal gap-2`, `${disabled ? "cursor-not-allowed opacity-70" : ""}`, pillClassName), "aria-label": `Use suggestion: ${suggestion.text}` }, suggestion.text)))));
|
|
58
|
-
});
|
|
59
|
-
PromptSuggestions.displayName = "PromptSuggestions";
|
|
60
|
-
|
|
61
|
-
export { PromptSuggestions };
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
import { PillVariant, PillColor } from "../../core/Pill/Pill.types";
|
|
3
|
-
/**
|
|
4
|
-
* Suggestion item
|
|
5
|
-
*/
|
|
6
|
-
export interface PromptSuggestion {
|
|
7
|
-
/**
|
|
8
|
-
* Unique key for the suggestion
|
|
9
|
-
*/
|
|
10
|
-
key?: string;
|
|
11
|
-
/**
|
|
12
|
-
* Display text for the suggestion
|
|
13
|
-
*/
|
|
14
|
-
text: string;
|
|
15
|
-
/**
|
|
16
|
-
* Optional icon
|
|
17
|
-
*/
|
|
18
|
-
icon?: ReactNode;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* PromptSuggestions component props
|
|
22
|
-
*/
|
|
23
|
-
export interface PromptSuggestionsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onSelect"> {
|
|
24
|
-
/**
|
|
25
|
-
* Array of suggestions to display
|
|
26
|
-
*/
|
|
27
|
-
suggestions: (string | PromptSuggestion)[];
|
|
28
|
-
/**
|
|
29
|
-
* Callback when a suggestion is clicked
|
|
30
|
-
*/
|
|
31
|
-
onSelect?: (suggestion: string) => void;
|
|
32
|
-
/**
|
|
33
|
-
* Pill variant
|
|
34
|
-
* @default "outline"
|
|
35
|
-
*/
|
|
36
|
-
variant?: PillVariant;
|
|
37
|
-
/**
|
|
38
|
-
* Pill color
|
|
39
|
-
* @default "neutral"
|
|
40
|
-
*/
|
|
41
|
-
color?: PillColor;
|
|
42
|
-
/**
|
|
43
|
-
* Layout variant
|
|
44
|
-
* @default "horizontal"
|
|
45
|
-
*/
|
|
46
|
-
layout?: "horizontal" | "vertical" | "grid";
|
|
47
|
-
/**
|
|
48
|
-
* Maximum number of suggestions to show
|
|
49
|
-
*/
|
|
50
|
-
maxVisible?: number;
|
|
51
|
-
/**
|
|
52
|
-
* Whether suggestions are disabled
|
|
53
|
-
* @default false
|
|
54
|
-
*/
|
|
55
|
-
disabled?: boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Additional className for container
|
|
58
|
-
*/
|
|
59
|
-
className?: string;
|
|
60
|
-
/**
|
|
61
|
-
* Additional className applied to each Pill
|
|
62
|
-
*/
|
|
63
|
-
pillClassName?: string;
|
|
64
|
-
}
|
|
65
|
-
export type { PillVariant, PillColor };
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import React__default, { useCallback, useMemo } from 'react';
|
|
2
|
-
import { ChevronLeftIcon, ChevronRightIcon } from '@heroicons/react/24/outline';
|
|
3
|
-
import { cn } from '../../../utils/cn.js';
|
|
4
|
-
import { versionSliderTheme } from './VersionSlider.theme.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Format a timestamp for display
|
|
8
|
-
*/
|
|
9
|
-
const formatTimestamp = (date) => {
|
|
10
|
-
const now = new Date();
|
|
11
|
-
const diff = now.getTime() - date.getTime();
|
|
12
|
-
const minutes = Math.floor(diff / 60000);
|
|
13
|
-
const hours = Math.floor(diff / 3600000);
|
|
14
|
-
const days = Math.floor(diff / 86400000);
|
|
15
|
-
if (minutes < 1)
|
|
16
|
-
return "Just now";
|
|
17
|
-
if (minutes < 60)
|
|
18
|
-
return `${minutes}m ago`;
|
|
19
|
-
if (hours < 24)
|
|
20
|
-
return `${hours}h ago`;
|
|
21
|
-
if (days < 7)
|
|
22
|
-
return `${days}d ago`;
|
|
23
|
-
return date.toLocaleDateString("en-US", {
|
|
24
|
-
month: "short",
|
|
25
|
-
day: "numeric",
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
const VersionSlider = ({ versions, currentIndex, onChange, showLabels = false, showTimestamps = true, size = "md", className, ...props }) => {
|
|
29
|
-
var _a, _b;
|
|
30
|
-
const theme = versionSliderTheme;
|
|
31
|
-
const sizeStyles = ((_a = theme.sizes) === null || _a === void 0 ? void 0 : _a[size]) || ((_b = theme.sizes) === null || _b === void 0 ? void 0 : _b.md);
|
|
32
|
-
// Navigation handlers
|
|
33
|
-
const handlePrevious = useCallback(() => {
|
|
34
|
-
if (currentIndex > 0) {
|
|
35
|
-
onChange(currentIndex - 1);
|
|
36
|
-
}
|
|
37
|
-
}, [currentIndex, onChange]);
|
|
38
|
-
const handleNext = useCallback(() => {
|
|
39
|
-
if (currentIndex < versions.length - 1) {
|
|
40
|
-
onChange(currentIndex + 1);
|
|
41
|
-
}
|
|
42
|
-
}, [currentIndex, versions.length, onChange]);
|
|
43
|
-
// Keyboard navigation
|
|
44
|
-
const handleKeyDown = useCallback((e) => {
|
|
45
|
-
switch (e.key) {
|
|
46
|
-
case "ArrowLeft":
|
|
47
|
-
case "ArrowUp":
|
|
48
|
-
e.preventDefault();
|
|
49
|
-
handlePrevious();
|
|
50
|
-
break;
|
|
51
|
-
case "ArrowRight":
|
|
52
|
-
case "ArrowDown":
|
|
53
|
-
e.preventDefault();
|
|
54
|
-
handleNext();
|
|
55
|
-
break;
|
|
56
|
-
case "Home":
|
|
57
|
-
e.preventDefault();
|
|
58
|
-
onChange(0);
|
|
59
|
-
break;
|
|
60
|
-
case "End":
|
|
61
|
-
e.preventDefault();
|
|
62
|
-
onChange(versions.length - 1);
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
}, [handlePrevious, handleNext, onChange, versions.length]);
|
|
66
|
-
// Progress bar width calculation
|
|
67
|
-
const progressWidth = useMemo(() => {
|
|
68
|
-
if (versions.length <= 1)
|
|
69
|
-
return 0;
|
|
70
|
-
return (currentIndex / (versions.length - 1)) * 100;
|
|
71
|
-
}, [currentIndex, versions.length]);
|
|
72
|
-
if (versions.length === 0) {
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
return (React__default.createElement("div", { className: cn(theme.containerStyle, className), onKeyDown: handleKeyDown, role: "slider", "aria-label": "Version history", "aria-valuenow": currentIndex + 1, "aria-valuemin": 1, "aria-valuemax": versions.length, tabIndex: 0, ...props },
|
|
76
|
-
React__default.createElement("button", { type: "button", onClick: handlePrevious, disabled: currentIndex === 0, className: cn(theme.buttonStyle, sizeStyles === null || sizeStyles === void 0 ? void 0 : sizeStyles.button), "aria-label": "Previous version" },
|
|
77
|
-
React__default.createElement(ChevronLeftIcon, { className: "size-4" })),
|
|
78
|
-
React__default.createElement("div", { className: theme.trackStyle },
|
|
79
|
-
React__default.createElement("div", { className: "absolute top-1/2 -translate-y-1/2 left-0 right-0 h-0.5 bg-[var(--color-border)] rounded-full", "aria-hidden": "true" }),
|
|
80
|
-
React__default.createElement("div", { className: theme.progressStyle, style: { width: `${progressWidth}%` }, "aria-hidden": "true" }),
|
|
81
|
-
React__default.createElement("div", { className: "relative flex items-center justify-between w-full" }, versions.map((version, index) => {
|
|
82
|
-
const isActive = index === currentIndex;
|
|
83
|
-
const isCompleted = index < currentIndex;
|
|
84
|
-
return (React__default.createElement("button", { key: version.id, type: "button", onClick: () => onChange(index), className: cn("group relative", theme.dotStyle, sizeStyles === null || sizeStyles === void 0 ? void 0 : sizeStyles.dot, isActive && theme.dotActiveStyle, isCompleted && !isActive && theme.dotCompletedStyle), "aria-label": `Version ${version.label || index + 1}${version.description ? `: ${version.description}` : ""}`, "aria-current": isActive ? "step" : undefined },
|
|
85
|
-
showTimestamps && version.timestamp && (React__default.createElement("span", { className: theme.timestampStyle }, formatTimestamp(version.timestamp))),
|
|
86
|
-
showLabels && version.label && (React__default.createElement("span", { className: theme.labelStyle }, version.label))));
|
|
87
|
-
}))),
|
|
88
|
-
React__default.createElement("button", { type: "button", onClick: handleNext, disabled: currentIndex === versions.length - 1, className: cn(theme.buttonStyle, sizeStyles === null || sizeStyles === void 0 ? void 0 : sizeStyles.button), "aria-label": "Next version" },
|
|
89
|
-
React__default.createElement(ChevronRightIcon, { className: "size-4" })),
|
|
90
|
-
React__default.createElement("span", { className: "text-sm text-[var(--color-text-muted)] tabular-nums min-w-[4ch] text-right" },
|
|
91
|
-
currentIndex + 1,
|
|
92
|
-
"/",
|
|
93
|
-
versions.length)));
|
|
94
|
-
};
|
|
95
|
-
VersionSlider.displayName = "VersionSlider";
|
|
96
|
-
|
|
97
|
-
export { VersionSlider };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const versionSliderTheme = {
|
|
2
|
-
containerStyle: "flex items-center gap-3 select-none",
|
|
3
|
-
trackStyle: "relative flex items-center gap-2 flex-1",
|
|
4
|
-
progressStyle: "absolute top-1/2 -translate-y-1/2 h-0.5 bg-[var(--color-primary)] transition-all duration-300 rounded-full",
|
|
5
|
-
dotStyle: "relative flex-shrink-0 rounded-full bg-[var(--color-border)] hover:bg-[var(--color-primary-300)] transition-colors cursor-pointer ring-2 ring-transparent hover:ring-[var(--color-primary-100)]",
|
|
6
|
-
dotActiveStyle: "bg-[var(--color-primary)] ring-[var(--color-primary-200)] shadow-md",
|
|
7
|
-
dotCompletedStyle: "bg-[var(--color-primary-400)]",
|
|
8
|
-
buttonStyle: "flex-shrink-0 p-1.5 rounded-md bg-[var(--color-background-secondary)] hover:bg-[var(--color-background-tertiary)] text-[var(--color-text-secondary)] hover:text-[var(--color-text-primary)] transition-colors disabled:opacity-40 disabled:cursor-not-allowed focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)]",
|
|
9
|
-
labelStyle: "absolute -bottom-5 left-1/2 -translate-x-1/2 text-xs text-[var(--color-text-muted)] whitespace-nowrap",
|
|
10
|
-
timestampStyle: "absolute -top-8 left-1/2 -translate-x-1/2 px-2 py-1 rounded bg-[var(--color-text-primary)] text-white text-xs whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",
|
|
11
|
-
sizes: {
|
|
12
|
-
sm: { dot: "size-2", button: "size-6" },
|
|
13
|
-
md: { dot: "size-3", button: "size-8" },
|
|
14
|
-
lg: { dot: "size-4", button: "size-10" },
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export { versionSliderTheme };
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export interface Version {
|
|
3
|
-
/**
|
|
4
|
-
* Unique identifier for the version
|
|
5
|
-
*/
|
|
6
|
-
id: string;
|
|
7
|
-
/**
|
|
8
|
-
* Display label for the version (e.g., "v1", "Draft 2")
|
|
9
|
-
*/
|
|
10
|
-
label?: string;
|
|
11
|
-
/**
|
|
12
|
-
* Timestamp when this version was created
|
|
13
|
-
*/
|
|
14
|
-
timestamp?: Date;
|
|
15
|
-
/**
|
|
16
|
-
* Optional description of changes
|
|
17
|
-
*/
|
|
18
|
-
description?: string;
|
|
19
|
-
}
|
|
20
|
-
export interface VersionSliderProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
21
|
-
/**
|
|
22
|
-
* Array of versions to display
|
|
23
|
-
*/
|
|
24
|
-
versions: Version[];
|
|
25
|
-
/**
|
|
26
|
-
* Current active version index
|
|
27
|
-
*/
|
|
28
|
-
currentIndex: number;
|
|
29
|
-
/**
|
|
30
|
-
* Callback when version changes
|
|
31
|
-
*/
|
|
32
|
-
onChange: (index: number) => void;
|
|
33
|
-
/**
|
|
34
|
-
* Show version labels below dots
|
|
35
|
-
* @default false
|
|
36
|
-
*/
|
|
37
|
-
showLabels?: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Show timestamps on hover
|
|
40
|
-
* @default true
|
|
41
|
-
*/
|
|
42
|
-
showTimestamps?: boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Additional className
|
|
45
|
-
*/
|
|
46
|
-
className?: string;
|
|
47
|
-
/**
|
|
48
|
-
* Size variant
|
|
49
|
-
* @default "md"
|
|
50
|
-
*/
|
|
51
|
-
size?: "sm" | "md" | "lg";
|
|
52
|
-
}
|
|
53
|
-
export interface VersionSliderTheme {
|
|
54
|
-
containerStyle?: string;
|
|
55
|
-
trackStyle?: string;
|
|
56
|
-
progressStyle?: string;
|
|
57
|
-
dotStyle?: string;
|
|
58
|
-
dotActiveStyle?: string;
|
|
59
|
-
dotCompletedStyle?: string;
|
|
60
|
-
buttonStyle?: string;
|
|
61
|
-
labelStyle?: string;
|
|
62
|
-
timestampStyle?: string;
|
|
63
|
-
sizes?: {
|
|
64
|
-
sm: {
|
|
65
|
-
dot: string;
|
|
66
|
-
button: string;
|
|
67
|
-
};
|
|
68
|
-
md: {
|
|
69
|
-
dot: string;
|
|
70
|
-
button: string;
|
|
71
|
-
};
|
|
72
|
-
lg: {
|
|
73
|
-
dot: string;
|
|
74
|
-
button: string;
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Animation variants for Pill component
|
|
3
|
-
*
|
|
4
|
-
* Reuses Badge's proven animation patterns with spring physics
|
|
5
|
-
* for natural, responsive interactions.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Main pill animation variants
|
|
9
|
-
* Uses spring physics for smooth, natural motion
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* Tap/click animation variant
|
|
13
|
-
* Subtle scale down on press for tactile feedback
|
|
14
|
-
*/
|
|
15
|
-
const pillTapVariant = {
|
|
16
|
-
scale: 0.98,
|
|
17
|
-
transition: {
|
|
18
|
-
duration: 0.1,
|
|
19
|
-
type: 'spring',
|
|
20
|
-
stiffness: 400,
|
|
21
|
-
damping: 10,
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export { pillTapVariant };
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import React__default, { useState, useEffect, useCallback } from 'react';
|
|
2
|
-
import { useReducedMotion, motion } from 'motion/react';
|
|
3
|
-
import { CheckIcon } from '@heroicons/react/16/solid';
|
|
4
|
-
import { pillTheme } from './Pill.theme.js';
|
|
5
|
-
import { pillTapVariant } from './Pill.animations.js';
|
|
6
|
-
import { cn } from '../../../utils/cn.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Pill component - Simplified selectable chip for filters and tags
|
|
10
|
-
*
|
|
11
|
-
* A focused alternative to Badge without icons, avatars, or dismissible functionality.
|
|
12
|
-
* Perfect for filter chips, tag selection, and simple category pills.
|
|
13
|
-
*
|
|
14
|
-
* @example Basic usage
|
|
15
|
-
* ```tsx
|
|
16
|
-
* <Pill variant="primary">Design</Pill>
|
|
17
|
-
* ```
|
|
18
|
-
*
|
|
19
|
-
* @example Selectable filter
|
|
20
|
-
* ```tsx
|
|
21
|
-
* const [selected, setSelected] = useState(false);
|
|
22
|
-
* <Pill
|
|
23
|
-
* variant="primary"
|
|
24
|
-
* selected={selected}
|
|
25
|
-
* onSelect={setSelected}
|
|
26
|
-
* >
|
|
27
|
-
* Frontend
|
|
28
|
-
* </Pill>
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
* @example Multi-select filters
|
|
32
|
-
* ```tsx
|
|
33
|
-
* const [filters, setFilters] = useState(['design']);
|
|
34
|
-
* <Pill
|
|
35
|
-
* variant="primary"
|
|
36
|
-
* selected={filters.includes('design')}
|
|
37
|
-
* onSelect={(selected) => {
|
|
38
|
-
* setFilters(selected
|
|
39
|
-
* ? [...filters, 'design']
|
|
40
|
-
* : filters.filter(f => f !== 'design')
|
|
41
|
-
* );
|
|
42
|
-
* }}
|
|
43
|
-
* >
|
|
44
|
-
* Design
|
|
45
|
-
* </Pill>
|
|
46
|
-
* ```
|
|
47
|
-
*/
|
|
48
|
-
const Pill = React__default.forwardRef(({ children, variant = 'filled', color = 'primary', size = 'md', iconStart, selected = false, onSelect, readOnly = false, className, theme = {}, onClick, ...props }, ref) => {
|
|
49
|
-
// ========== State Management ==========
|
|
50
|
-
var _a, _b, _c, _d;
|
|
51
|
-
// Internal selected state (synced with controlled prop)
|
|
52
|
-
const [isSelected, setIsSelected] = useState(selected);
|
|
53
|
-
// Sync internal state with controlled prop
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
setIsSelected(selected);
|
|
56
|
-
}, [selected]);
|
|
57
|
-
// Check for reduced motion preference
|
|
58
|
-
const shouldReduceMotion = useReducedMotion();
|
|
59
|
-
// ========== Derived State ==========
|
|
60
|
-
const isSelectable = Boolean(onSelect);
|
|
61
|
-
const isClickable = Boolean(onClick);
|
|
62
|
-
const isInteractive = (isSelectable || isClickable) && !readOnly;
|
|
63
|
-
// ========== Development Warnings ==========
|
|
64
|
-
useEffect(() => {
|
|
65
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
66
|
-
if (selected !== undefined && !onSelect) {
|
|
67
|
-
// eslint-disable-next-line no-console
|
|
68
|
-
console.warn('[Pill] Component has "selected" prop but missing "onSelect" handler. The pill will not be interactive.');
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}, [selected, onSelect]);
|
|
72
|
-
// ========== Event Handlers ==========
|
|
73
|
-
/**
|
|
74
|
-
* Handle pill click - toggles selection if selectable
|
|
75
|
-
*/
|
|
76
|
-
const handleClick = useCallback((e) => {
|
|
77
|
-
// Don't do anything if read-only
|
|
78
|
-
if (readOnly) {
|
|
79
|
-
e.preventDefault();
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
// Toggle selection if selectable
|
|
83
|
-
if (onSelect) {
|
|
84
|
-
const newSelected = !isSelected;
|
|
85
|
-
setIsSelected(newSelected);
|
|
86
|
-
onSelect(newSelected);
|
|
87
|
-
}
|
|
88
|
-
// Call user's onClick handler if provided
|
|
89
|
-
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
90
|
-
}, [readOnly, onSelect, isSelected, onClick]);
|
|
91
|
-
/**
|
|
92
|
-
* Handle keyboard interactions (Enter/Space to toggle)
|
|
93
|
-
*/
|
|
94
|
-
const handleKeyDown = useCallback((e) => {
|
|
95
|
-
if (readOnly || !isSelectable)
|
|
96
|
-
return;
|
|
97
|
-
// Toggle on Enter or Space
|
|
98
|
-
if (e.key === 'Enter' || e.key === ' ') {
|
|
99
|
-
e.preventDefault();
|
|
100
|
-
const newSelected = !isSelected;
|
|
101
|
-
setIsSelected(newSelected);
|
|
102
|
-
onSelect === null || onSelect === void 0 ? void 0 : onSelect(newSelected);
|
|
103
|
-
}
|
|
104
|
-
}, [readOnly, isSelectable, isSelected, onSelect]);
|
|
105
|
-
// ========== Theme Merging ==========
|
|
106
|
-
const mergedTheme = {
|
|
107
|
-
baseStyle: theme.baseStyle || pillTheme.baseStyle,
|
|
108
|
-
variantStyle: ((_a = theme.variants) === null || _a === void 0 ? void 0 : _a[variant]) || pillTheme.variants[variant],
|
|
109
|
-
colorStyle: ((_b = theme.colors) === null || _b === void 0 ? void 0 : _b[color]) || pillTheme.colors[color],
|
|
110
|
-
sizeStyle: ((_c = theme.sizes) === null || _c === void 0 ? void 0 : _c[size]) || pillTheme.sizes[size],
|
|
111
|
-
iconSizeStyle: ((_d = theme.iconSizes) === null || _d === void 0 ? void 0 : _d[size]) || pillTheme.iconSizes[size],
|
|
112
|
-
};
|
|
113
|
-
// ========== Icon Rendering ==========
|
|
114
|
-
/**
|
|
115
|
-
* Renders the start icon or check icon based on selection state
|
|
116
|
-
* - When selected: Shows CheckIcon (replaces iconStart)
|
|
117
|
-
* - When not selected: Shows iconStart if provided
|
|
118
|
-
* - Otherwise: null
|
|
119
|
-
*/
|
|
120
|
-
const renderStartIcon = useCallback(() => {
|
|
121
|
-
// Selected state: show check icon
|
|
122
|
-
if (isSelected && isSelectable) {
|
|
123
|
-
return (React__default.createElement(CheckIcon, { className: cn('flex-shrink-0 -ml-0.5', mergedTheme.iconSizeStyle), "aria-hidden": "true" }));
|
|
124
|
-
}
|
|
125
|
-
// Unselected state: show iconStart if provided
|
|
126
|
-
if (iconStart) {
|
|
127
|
-
return (React__default.createElement("span", { className: cn('flex-shrink-0', mergedTheme.iconSizeStyle), "aria-hidden": "true" }, iconStart));
|
|
128
|
-
}
|
|
129
|
-
return null;
|
|
130
|
-
}, [isSelected, isSelectable, iconStart, mergedTheme.iconSizeStyle]);
|
|
131
|
-
// ========== Render ==========
|
|
132
|
-
return (React__default.createElement(motion.span, { ref: ref, className: cn(mergedTheme.baseStyle, mergedTheme.variantStyle, mergedTheme.colorStyle, mergedTheme.sizeStyle,
|
|
133
|
-
// Conditional cursor styling - only show pointer for interactive pills
|
|
134
|
-
isInteractive ? 'cursor-pointer' : 'cursor-default', className // User overrides (highest priority)
|
|
135
|
-
), onClick: handleClick, onKeyDown: handleKeyDown, "data-variant": variant, "data-color": color, "data-size": size, "data-selected": isSelected ? 'true' : 'false', "data-readonly": !isInteractive ? 'true' : 'false', "data-selectable": isSelectable ? 'true' : 'false',
|
|
136
|
-
// Accessibility attributes
|
|
137
|
-
role: isSelectable && !readOnly ? 'button' : undefined, tabIndex: isInteractive ? 0 : undefined, "aria-pressed": isSelectable && !readOnly ? isSelected : undefined, "aria-readonly": readOnly || undefined,
|
|
138
|
-
// Animation
|
|
139
|
-
whileTap: isInteractive && !shouldReduceMotion ? pillTapVariant : undefined, ...props },
|
|
140
|
-
renderStartIcon(),
|
|
141
|
-
children));
|
|
142
|
-
});
|
|
143
|
-
Pill.displayName = 'Pill';
|
|
144
|
-
|
|
145
|
-
export { Pill };
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Default theme for Pill component
|
|
3
|
-
*
|
|
4
|
-
* Separates visual variants from semantic colors following new convention.
|
|
5
|
-
* All styles can be overridden via className prop (shadcn approach).
|
|
6
|
-
*/
|
|
7
|
-
const pillTheme = {
|
|
8
|
-
/**
|
|
9
|
-
* Base pill container style
|
|
10
|
-
* - Always rounded-full (pill shape)
|
|
11
|
-
* - Flexbox for centering content
|
|
12
|
-
* - Smooth transitions for interactions
|
|
13
|
-
* - Non-selectable text
|
|
14
|
-
* - Cursor styling is conditionally applied in component based on interactivity
|
|
15
|
-
*/
|
|
16
|
-
baseStyle: "inline-flex items-center justify-center font-medium rounded-full select-none whitespace-nowrap transition-all duration-300 focus:outline-none focus-visible:ring focus-visible:ring-[var(--color-primary)] focus-visible:ring-offset-2",
|
|
17
|
-
/**
|
|
18
|
-
* Visual style variants (appearance treatment)
|
|
19
|
-
*/
|
|
20
|
-
variants: {
|
|
21
|
-
filled: "ring-1",
|
|
22
|
-
outline: "bg-transparent ring-2",
|
|
23
|
-
soft: "ring-1 ring-transparent",
|
|
24
|
-
},
|
|
25
|
-
/**
|
|
26
|
-
* Semantic colors with selection states
|
|
27
|
-
* Uses data-attributes for state styling:
|
|
28
|
-
* - data-[selected=true]: Lighter fill background with check icon
|
|
29
|
-
* - data-[readonly=false]:hover: Hover state (only applies when not read-only)
|
|
30
|
-
*/
|
|
31
|
-
colors: {
|
|
32
|
-
neutral: "bg-[var(--color-background)] text-[var(--color-text-primary)] ring-[var(--color-border)] data-[readonly=false]:hover:bg-neutral-100 data-[selected=true]:bg-neutral-100 data-[selected=true]:ring-[var(--color-border)]",
|
|
33
|
-
primary: "bg-[var(--color-primary-50)] text-[var(--color-primary)] ring-[var(--color-primary)]/30 data-[readonly=false]:hover:bg-[var(--color-primary-100)] data-[selected=true]:bg-[var(--color-primary-300)] data-[selected=true]:ring-[var(--color-primary)]/30",
|
|
34
|
-
success: "bg-[var(--color-success-50)] text-[var(--color-success-700)] ring-[var(--color-success)]/20 data-[readonly=false]:hover:bg-[var(--color-success-100)] data-[selected=true]:bg-[var(--color-success-200)] data-[selected=true]:ring-[var(--color-success)]/30",
|
|
35
|
-
warning: "bg-[var(--color-warning-50)] text-[var(--color-warning-700)] ring-[var(--color-warning)]/20 data-[readonly=false]:hover:bg-[var(--color-warning-100)] data-[selected=true]:bg-[var(--color-warning-200)] data-[selected=true]:ring-[var(--color-warning)]/30",
|
|
36
|
-
danger: "bg-[var(--color-danger-50)] text-[var(--color-danger-700)] ring-[var(--color-danger)]/20 data-[readonly=false]:hover:bg-[var(--color-danger-100)] data-[selected=true]:bg-[var(--color-danger-200)] data-[selected=true]:ring-[var(--color-danger)]/30",
|
|
37
|
-
},
|
|
38
|
-
/**
|
|
39
|
-
* Size variants
|
|
40
|
-
* Defines padding, text size, and spacing for different pill sizes
|
|
41
|
-
* Matches Badge pill variant sizing for consistency
|
|
42
|
-
*/
|
|
43
|
-
sizes: {
|
|
44
|
-
/** Small pill - matches Badge sm with pill=true */
|
|
45
|
-
sm: "text-xs px-2 py-0.5 gap-0.5",
|
|
46
|
-
/** Medium pill (default) - matches Badge md with pill=true */
|
|
47
|
-
md: "text-sm px-2.5 py-0.5 gap-1",
|
|
48
|
-
/** Large pill - matches Badge lg with pill=true */
|
|
49
|
-
lg: "text-sm px-3 py-1 gap-1.5",
|
|
50
|
-
},
|
|
51
|
-
/**
|
|
52
|
-
* Icon sizes for iconStart and CheckIcon
|
|
53
|
-
* Matches Badge icon sizing pattern
|
|
54
|
-
*/
|
|
55
|
-
iconSizes: {
|
|
56
|
-
/** Small icon size */
|
|
57
|
-
sm: "size-3",
|
|
58
|
-
/** Medium icon size (default) */
|
|
59
|
-
md: "size-3.5",
|
|
60
|
-
/** Large icon size */
|
|
61
|
-
lg: "size-4",
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export { pillTheme };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RetryBoundary Component
|
|
3
|
-
* Error boundary with exponential backoff retry
|
|
4
|
-
*/
|
|
5
|
-
import React, { Component } from "react";
|
|
6
|
-
import type { RetryBoundaryProps } from "./RetryBoundary.types";
|
|
7
|
-
/**
|
|
8
|
-
* Error boundary state
|
|
9
|
-
*/
|
|
10
|
-
interface RetryBoundaryState {
|
|
11
|
-
error: Error | null;
|
|
12
|
-
attempt: number;
|
|
13
|
-
retryDelay: number;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* RetryBoundary - Error boundary with exponential backoff retry
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* <RetryBoundary
|
|
20
|
-
* retry={{ maxAttempts: 3, initialDelay: 1000 }}
|
|
21
|
-
* onMaxRetriesReached={(error) => logError(error)}
|
|
22
|
-
* >
|
|
23
|
-
* <AsyncComponent />
|
|
24
|
-
* </RetryBoundary>
|
|
25
|
-
*/
|
|
26
|
-
export declare class RetryBoundary extends Component<RetryBoundaryProps, RetryBoundaryState> {
|
|
27
|
-
private retryConfig;
|
|
28
|
-
constructor(props: RetryBoundaryProps);
|
|
29
|
-
static getDerivedStateFromError(error: Error): Partial<RetryBoundaryState>;
|
|
30
|
-
componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
|
|
31
|
-
handleRetry: () => void;
|
|
32
|
-
handleReset: () => void;
|
|
33
|
-
render(): React.ReactNode;
|
|
34
|
-
}
|
|
35
|
-
export {};
|