flikkui 0.2.0-beta.2 → 0.2.0-beta.5
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 +92 -0
- 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/Table/Table.animations.d.ts +5 -16
- package/dist/components/core/Table/Table.animations.js +46 -0
- package/dist/components/core/Table/Table.d.ts +0 -27
- package/dist/components/core/Table/Table.js +58 -156
- package/dist/components/core/Table/Table.theme.js +28 -19
- package/dist/components/core/Table/Table.types.d.ts +95 -8
- package/dist/components/core/Table/Table.utils.d.ts +7 -0
- package/dist/components/core/Table/Table.utils.js +11 -1
- package/dist/components/core/Table/{components/TableActions/TableActions.d.ts → TableActions.d.ts} +3 -3
- package/dist/components/core/Table/{components/TableActions/TableActions.js → TableActions.js} +14 -24
- package/dist/components/core/Table/{components/TableActions/TableActionsMenu.d.ts → TableActionsMenu.d.ts} +1 -1
- package/dist/components/core/Table/{components/TableActions/TableActionsMenu.js → TableActionsMenu.js} +4 -4
- package/dist/components/core/Table/{components/core/TableBody.d.ts → TableBody.d.ts} +1 -1
- package/dist/components/core/Table/{components/core/TableBody.js → TableBody.js} +14 -20
- package/dist/components/core/Table/{components/core/TableCell.d.ts → TableCell.d.ts} +1 -9
- package/dist/components/core/Table/{components/core/TableCell.js → TableCell.js} +5 -13
- package/dist/components/core/Table/TableColumnManager.d.ts +3 -0
- package/dist/components/core/Table/TableColumnManager.js +34 -0
- package/dist/components/core/Table/{components/DeclarativeComponents.d.ts → TableDeclarative.d.ts} +1 -1
- package/dist/components/core/Table/{components/DeclarativeComponents.js → TableDeclarative.js} +6 -56
- package/dist/components/core/Table/TableFilter.d.ts +3 -0
- package/dist/components/core/Table/TableFilter.js +122 -0
- package/dist/components/core/Table/{components/core/TableHeader.d.ts → TableHeader.d.ts} +1 -1
- package/dist/components/core/Table/{components/core/TableHeader.js → TableHeader.js} +15 -29
- package/dist/components/core/Table/TablePagination.d.ts +7 -0
- package/dist/components/core/Table/{components/TablePagination/TablePagination.js → TablePagination.js} +5 -16
- package/dist/components/core/Table/TableRow.d.ts +8 -0
- package/dist/components/core/Table/TableRow.js +45 -0
- package/dist/components/core/Table/TableSelectionHeader.d.ts +7 -0
- package/dist/components/core/Table/{components/TableSelectionHeader/TableSelectionHeader.js → TableSelectionHeader.js} +4 -5
- package/dist/components/core/Table/hooks/index.d.ts +10 -0
- package/dist/components/core/Table/hooks/useTableColumns.d.ts +16 -0
- package/dist/components/core/Table/hooks/useTableColumns.js +67 -0
- package/dist/components/core/Table/hooks/useTableExpansion.d.ts +8 -0
- package/dist/components/core/Table/hooks/useTableExpansion.js +15 -0
- package/dist/components/core/Table/hooks/useTableFilter.d.ts +12 -0
- package/dist/components/core/Table/hooks/useTableFilter.js +37 -0
- package/dist/components/core/Table/hooks/useTablePagination.d.ts +12 -0
- package/dist/components/core/Table/hooks/useTablePagination.js +13 -0
- package/dist/components/core/Table/hooks/useTableSelection.d.ts +17 -0
- package/dist/components/core/Table/hooks/useTableSelection.js +40 -0
- package/dist/components/core/Table/index.d.ts +9 -8
- package/dist/components/core/Table/index.js +7 -5
- 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 +12 -5
- 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 +21 -19
- 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/core/Table/components/TableActions/TableActions.types.d.ts +0 -40
- package/dist/components/core/Table/components/TableActions/index.d.ts +0 -3
- package/dist/components/core/Table/components/TableActionsMenu.d.ts +0 -6
- package/dist/components/core/Table/components/TablePagination/TablePagination.d.ts +0 -17
- package/dist/components/core/Table/components/TablePagination/TablePagination.types.d.ts +0 -21
- package/dist/components/core/Table/components/TablePagination/index.d.ts +0 -2
- package/dist/components/core/Table/components/TableSelectionHeader/TableSelectionHeader.d.ts +0 -15
- package/dist/components/core/Table/components/TableSelectionHeader/index.d.ts +0 -3
- package/dist/components/core/Table/components/core/TableRow.d.ts +0 -3
- package/dist/components/core/Table/components/core/TableRow.js +0 -44
- package/dist/components/core/Table/components/core/index.d.ts +0 -4
- 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
package/README.md
CHANGED
|
@@ -26,6 +26,98 @@ function App() {
|
|
|
26
26
|
}
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
+
## Customizing the Theme
|
|
30
|
+
|
|
31
|
+
Flikkui uses CSS variables for all theming. Override any variable in your own CSS to customize colors, spacing, border radius, and more.
|
|
32
|
+
|
|
33
|
+
### Colors
|
|
34
|
+
|
|
35
|
+
Override semantic color palettes by redefining the CSS variables after importing the library styles:
|
|
36
|
+
|
|
37
|
+
```css
|
|
38
|
+
:root {
|
|
39
|
+
/* Change the primary color to green */
|
|
40
|
+
--color-primary-50: oklch(0.982 0.018 155.826);
|
|
41
|
+
--color-primary-100: oklch(0.962 0.044 156.743);
|
|
42
|
+
--color-primary-200: oklch(0.925 0.084 155.995);
|
|
43
|
+
--color-primary-300: oklch(0.871 0.15 154.449);
|
|
44
|
+
--color-primary-400: oklch(0.792 0.209 151.711);
|
|
45
|
+
--color-primary-500: oklch(0.723 0.219 149.579);
|
|
46
|
+
--color-primary-600: oklch(0.627 0.194 149.214);
|
|
47
|
+
--color-primary-700: oklch(0.527 0.154 150.069);
|
|
48
|
+
--color-primary-800: oklch(0.448 0.119 151.328);
|
|
49
|
+
--color-primary-900: oklch(0.393 0.095 152.535);
|
|
50
|
+
--color-primary-950: oklch(0.266 0.065 152.934);
|
|
51
|
+
|
|
52
|
+
--color-primary: var(--color-primary-600);
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Available color palettes: `primary`, `danger`, `success`, `warning`. Each has shades from `50` to `950`.
|
|
57
|
+
|
|
58
|
+
### Backgrounds & Borders
|
|
59
|
+
|
|
60
|
+
```css
|
|
61
|
+
:root {
|
|
62
|
+
--color-background: oklch(98.5% 0.002 247.839);
|
|
63
|
+
--color-background-secondary: oklch(95% 0.002 247.839);
|
|
64
|
+
--color-background-tertiary: oklch(90% 0.002 247.839);
|
|
65
|
+
--color-border: oklch(92.2% 0 0);
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Form Elements
|
|
70
|
+
|
|
71
|
+
Control sizing, padding, and border radius for all form components:
|
|
72
|
+
|
|
73
|
+
```css
|
|
74
|
+
:root {
|
|
75
|
+
/* Border radius */
|
|
76
|
+
--form-rounded: 0.5rem;
|
|
77
|
+
|
|
78
|
+
/* Heights */
|
|
79
|
+
--form-min-h-sm: 2rem;
|
|
80
|
+
--form-min-h-md: 2.5rem;
|
|
81
|
+
--form-min-h-lg: 3rem;
|
|
82
|
+
|
|
83
|
+
/* Horizontal padding */
|
|
84
|
+
--form-px-sm: 0.75rem;
|
|
85
|
+
--form-px-md: 0.875rem;
|
|
86
|
+
--form-px-lg: 1rem;
|
|
87
|
+
|
|
88
|
+
/* Font sizes */
|
|
89
|
+
--form-text-sm: 0.75rem;
|
|
90
|
+
--form-text-md: 0.875rem;
|
|
91
|
+
--form-text-lg: 1rem;
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Button, badge, segmented, and other component variables inherit from these form defaults but can be overridden individually (e.g. `--button-rounded`, `--badge-rounded`).
|
|
96
|
+
|
|
97
|
+
### Dark Mode
|
|
98
|
+
|
|
99
|
+
Add the `dark` class to your `<html>` or any parent container. All components adapt automatically:
|
|
100
|
+
|
|
101
|
+
```html
|
|
102
|
+
<html class="dark">
|
|
103
|
+
<!-- dark mode active -->
|
|
104
|
+
</html>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
The library ships with sensible dark mode defaults. To customize dark mode colors, override variables inside `.dark`:
|
|
108
|
+
|
|
109
|
+
```css
|
|
110
|
+
.dark {
|
|
111
|
+
--color-background: oklch(14.5% 0 0);
|
|
112
|
+
--color-border: oklch(30% 0 0);
|
|
113
|
+
--color-primary: var(--color-primary-400);
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Full Variable Reference
|
|
118
|
+
|
|
119
|
+
See [`src/styles/theme.css`](src/styles/theme.css) for the complete list of available CSS variables.
|
|
120
|
+
|
|
29
121
|
## Documentation
|
|
30
122
|
|
|
31
123
|
This package is currently in beta. Full documentation coming soon.
|
|
@@ -13,21 +13,6 @@ import '../../forms/DatePicker/DatePicker.theme.js';
|
|
|
13
13
|
import '../../forms/FileUpload/FileUpload.js';
|
|
14
14
|
import '../../forms/TimePicker/TimePicker.js';
|
|
15
15
|
import 'react-dom';
|
|
16
|
-
import '../../forms/TimePicker/TimePicker.theme.js';
|
|
17
|
-
import '../../forms/Slider/Slider.js';
|
|
18
|
-
import '../../forms/Slider/Slider.theme.js';
|
|
19
|
-
import '../../forms/Signature/Signature.js';
|
|
20
|
-
import '../../forms/Signature/Signature.theme.js';
|
|
21
|
-
import '../../forms/RichTextEditor/RichTextEditor.js';
|
|
22
|
-
import '../../forms/RichTextEditor/RichTextEditor.theme.js';
|
|
23
|
-
import '../../forms/InputOTP/InputOTP.js';
|
|
24
|
-
import '../../forms/InputOTP/InputOTP.theme.js';
|
|
25
|
-
import '../../forms/InputCreditCard/InputCreditCard.theme.js';
|
|
26
|
-
import '../../forms/InputAddress/InputAddress.theme.js';
|
|
27
|
-
import '../../forms/InputDate/InputDate.js';
|
|
28
|
-
import '../../forms/InputCounter/InputCounter.js';
|
|
29
|
-
import '../../forms/StepperForm/StepperForm.js';
|
|
30
|
-
import '../../forms/StepperForm/StepperForm.types.js';
|
|
31
16
|
import '../../core/Accordion/Accordion.js';
|
|
32
17
|
import '../../core/AlertDialog/AlertDialog.js';
|
|
33
18
|
import '../../core/Avatar/Avatar.js';
|
|
@@ -59,6 +44,7 @@ import '../../core/Modal/Modal.js';
|
|
|
59
44
|
import '../../core/Pagination/Pagination.js';
|
|
60
45
|
import '../../core/Popover/Popover.js';
|
|
61
46
|
import '../../core/Popover/PopoverContext.js';
|
|
47
|
+
import '../../core/Progress/Progress.js';
|
|
62
48
|
import '../../core/ProgressiveBlur/ProgressiveBlur.js';
|
|
63
49
|
import '../../core/Segmented/Segmented.js';
|
|
64
50
|
import '../../core/Skeleton/Skeleton.js';
|
|
@@ -72,6 +58,7 @@ import '../../core/Tabs/TabsContext.js';
|
|
|
72
58
|
import '../../core/Tooltip/Tooltip.js';
|
|
73
59
|
import '../../core/Tooltip/Tooltip.animations.js';
|
|
74
60
|
import '../../core/Tree/Tree.js';
|
|
61
|
+
import '../../core/Tag/Tag.js';
|
|
75
62
|
import '../../core/Alert/Alert.js';
|
|
76
63
|
import '../../core/Toast/Toast.js';
|
|
77
64
|
import '../../core/Toast/ToastProvider.js';
|
|
@@ -92,6 +79,27 @@ import '../../core/Sidebar/SidebarNav.js';
|
|
|
92
79
|
import '../../core/Sidebar/SidebarNavGroup.js';
|
|
93
80
|
import '../../core/Sidebar/SidebarToggle.js';
|
|
94
81
|
import '../../core/Sidebar/SidebarContext.js';
|
|
82
|
+
import '../../forms/TimePicker/WheelColumn.js';
|
|
83
|
+
import '../../forms/TimePicker/TimePicker.theme.js';
|
|
84
|
+
import '../../forms/Slider/Slider.js';
|
|
85
|
+
import '../../forms/Slider/Slider.theme.js';
|
|
86
|
+
import '../../forms/Signature/Signature.js';
|
|
87
|
+
import '../../forms/Signature/Signature.theme.js';
|
|
88
|
+
import '../../forms/RichTextEditor/RichTextEditor.js';
|
|
89
|
+
import '../../forms/RichTextEditor/RichTextEditor.theme.js';
|
|
90
|
+
import '../../forms/InputOTP/InputOTP.js';
|
|
91
|
+
import '../../forms/InputOTP/InputOTP.theme.js';
|
|
92
|
+
import '../../forms/InputCreditCard/InputCreditCard.theme.js';
|
|
93
|
+
import '../../forms/InputAddress/InputAddress.theme.js';
|
|
94
|
+
import '../../forms/InputDate/InputDate.js';
|
|
95
|
+
import '../../forms/InputCounter/InputCounter.js';
|
|
96
|
+
import '../../forms/StepperForm/StepperForm.js';
|
|
97
|
+
import '../../forms/StepperForm/StepperForm.types.js';
|
|
98
|
+
import '../../forms/SelectExpand/SelectExpand.theme.js';
|
|
99
|
+
import '../../forms/InputTag/InputTag.js';
|
|
100
|
+
import '../../forms/InputTag/InputTag.theme.js';
|
|
101
|
+
import '../../forms/Combobox/Combobox.js';
|
|
102
|
+
import '../../forms/Combobox/Combobox.theme.js';
|
|
95
103
|
import { promptInputTheme } from './PromptInput.theme.js';
|
|
96
104
|
|
|
97
105
|
/**
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { PromptSuggestionProps } from "./PromptSuggestion.types";
|
|
3
|
+
/**
|
|
4
|
+
* PromptSuggestion - Individual clickable suggestion chip
|
|
5
|
+
*
|
|
6
|
+
* Simple, focused component for AI prompt interfaces.
|
|
7
|
+
* White background with border styling, fully customizable via className.
|
|
8
|
+
*
|
|
9
|
+
* @example Basic usage
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <div className="flex gap-2">
|
|
12
|
+
* <PromptSuggestion onSelect={handleSelect}>Write a poem</PromptSuggestion>
|
|
13
|
+
* <PromptSuggestion onSelect={handleSelect}>Summarize document</PromptSuggestion>
|
|
14
|
+
* </div>
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @example With icons
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <PromptSuggestion
|
|
20
|
+
* icon={<CodeBracketIcon className="size-4" />}
|
|
21
|
+
* onSelect={handleSelect}
|
|
22
|
+
* >
|
|
23
|
+
* Explain code
|
|
24
|
+
* </PromptSuggestion>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare const PromptSuggestion: React.ForwardRefExoticComponent<PromptSuggestionProps & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React__default, { useCallback } from 'react';
|
|
2
|
+
import { promptSuggestionTheme } from './PromptSuggestion.theme.js';
|
|
3
|
+
import { cn } from '../../../utils/cn.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* PromptSuggestion - Individual clickable suggestion chip
|
|
7
|
+
*
|
|
8
|
+
* Simple, focused component for AI prompt interfaces.
|
|
9
|
+
* White background with border styling, fully customizable via className.
|
|
10
|
+
*
|
|
11
|
+
* @example Basic usage
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <div className="flex gap-2">
|
|
14
|
+
* <PromptSuggestion onSelect={handleSelect}>Write a poem</PromptSuggestion>
|
|
15
|
+
* <PromptSuggestion onSelect={handleSelect}>Summarize document</PromptSuggestion>
|
|
16
|
+
* </div>
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @example With icons
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <PromptSuggestion
|
|
22
|
+
* icon={<CodeBracketIcon className="size-4" />}
|
|
23
|
+
* onSelect={handleSelect}
|
|
24
|
+
* >
|
|
25
|
+
* Explain code
|
|
26
|
+
* </PromptSuggestion>
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
const PromptSuggestion = React__default.forwardRef(({ children, onSelect, icon, className, onClick, ...props }, ref) => {
|
|
30
|
+
const theme = promptSuggestionTheme;
|
|
31
|
+
// Extract text content from children for onSelect callback
|
|
32
|
+
const getTextContent = useCallback(() => {
|
|
33
|
+
if (typeof children === "string") {
|
|
34
|
+
return children;
|
|
35
|
+
}
|
|
36
|
+
if (typeof children === "number") {
|
|
37
|
+
return String(children);
|
|
38
|
+
}
|
|
39
|
+
return "";
|
|
40
|
+
}, [children]);
|
|
41
|
+
// Handle click with onSelect callback
|
|
42
|
+
const handleClick = useCallback((event) => {
|
|
43
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
44
|
+
if (onSelect) {
|
|
45
|
+
const text = getTextContent();
|
|
46
|
+
if (text) {
|
|
47
|
+
onSelect(text);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}, [onClick, onSelect, getTextContent]);
|
|
51
|
+
return (React__default.createElement("span", { ref: ref, role: "button", tabIndex: 0, onClick: handleClick, onKeyDown: (e) => {
|
|
52
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
53
|
+
e.preventDefault();
|
|
54
|
+
handleClick(e);
|
|
55
|
+
}
|
|
56
|
+
}, className: cn(theme.baseStyle, className), "aria-label": typeof children === "string" ? `Use suggestion: ${children}` : undefined, ...props },
|
|
57
|
+
icon && React__default.createElement("span", { className: theme.iconStyle }, icon),
|
|
58
|
+
children));
|
|
59
|
+
});
|
|
60
|
+
PromptSuggestion.displayName = "PromptSuggestion";
|
|
61
|
+
|
|
62
|
+
export { PromptSuggestion };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PromptSuggestion theme configuration
|
|
3
|
+
*/
|
|
4
|
+
export interface PromptSuggestionTheme {
|
|
5
|
+
/** Base styles for the suggestion chip */
|
|
6
|
+
baseStyle: string;
|
|
7
|
+
/** Icon container styles */
|
|
8
|
+
iconStyle: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const promptSuggestionTheme: PromptSuggestionTheme;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const promptSuggestionTheme = {
|
|
2
|
+
baseStyle: "inline-flex items-center gap-2 py-2 px-3.5 rounded-full " +
|
|
3
|
+
"bg-white dark:bg-[var(--color-background)] " +
|
|
4
|
+
"border border-[var(--color-border)] " +
|
|
5
|
+
"text-sm font-medium text-[var(--color-text-primary)] " +
|
|
6
|
+
"cursor-pointer transition-all duration-300 " +
|
|
7
|
+
"hover:bg-[var(--color-background-secondary)] dark:hover:bg-[var(--color-background-secondary)] " +
|
|
8
|
+
"focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)]",
|
|
9
|
+
iconStyle: "size-4 flex-shrink-0",
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { promptSuggestionTheme };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* PromptSuggestion component props
|
|
4
|
+
*
|
|
5
|
+
* Individual clickable suggestion chip for AI prompt interfaces.
|
|
6
|
+
* Simple, focused component with white background and border styling.
|
|
7
|
+
*
|
|
8
|
+
* @example Basic usage
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <PromptSuggestion onSelect={handleSelect}>
|
|
11
|
+
* Write a poem
|
|
12
|
+
* </PromptSuggestion>
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @example With icon
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <PromptSuggestion
|
|
18
|
+
* icon={<CodeBracketIcon className="size-4" />}
|
|
19
|
+
* onSelect={handleSelect}
|
|
20
|
+
* >
|
|
21
|
+
* Explain this code
|
|
22
|
+
* </PromptSuggestion>
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @example Custom styling (shadcn approach)
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <PromptSuggestion
|
|
28
|
+
* className="bg-purple-100 border-purple-300"
|
|
29
|
+
* onSelect={handleSelect}
|
|
30
|
+
* >
|
|
31
|
+
* Custom styled
|
|
32
|
+
* </PromptSuggestion>
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export interface PromptSuggestionProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, "onSelect"> {
|
|
36
|
+
/**
|
|
37
|
+
* Suggestion text content
|
|
38
|
+
*/
|
|
39
|
+
children: React.ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* Callback when suggestion is clicked
|
|
42
|
+
* Receives the text content as a string
|
|
43
|
+
*/
|
|
44
|
+
onSelect?: (text: string) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Optional icon displayed before the text
|
|
47
|
+
*/
|
|
48
|
+
icon?: React.ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* Additional className for full customization (highest priority)
|
|
51
|
+
*/
|
|
52
|
+
className?: string;
|
|
53
|
+
}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export
|
|
1
|
+
export { PromptSuggestion } from "./PromptSuggestion";
|
|
2
|
+
export { promptSuggestionTheme } from "./PromptSuggestion.theme";
|
|
3
|
+
export type { PromptSuggestionProps } from "./PromptSuggestion.types";
|
|
4
|
+
export type { PromptSuggestionTheme } from "./PromptSuggestion.theme";
|
|
@@ -10,8 +10,8 @@ export { ThinkingIndicator, thinkingIndicatorTheme } from "./ThinkingIndicator";
|
|
|
10
10
|
export type { ThinkingIndicatorProps, ThinkingIndicatorSize, ThinkingIndicatorTheme, ThinkingIndicatorThemeOverrides, } from "./ThinkingIndicator";
|
|
11
11
|
export { TokenCounter, tokenCounterTheme, estimateTokens, calculateCost, formatCost, formatTokenCount, MODEL_CONFIGS, } from "./TokenCounter";
|
|
12
12
|
export type { TokenCounterProps, TokenCounterModel, TokenCounterSize, TokenCounterTheme, TokenCounterThemeOverrides, ModelConfig, } from "./TokenCounter";
|
|
13
|
-
export {
|
|
14
|
-
export type {
|
|
13
|
+
export { PromptSuggestion, promptSuggestionTheme } from "./PromptSuggestions";
|
|
14
|
+
export type { PromptSuggestionProps, PromptSuggestionTheme, } from "./PromptSuggestions";
|
|
15
15
|
export { StreamingResponse, ErrorDisplay, MarkdownRenderer, streamingResponseTheme, } from "./StreamingResponse";
|
|
16
16
|
export type { StreamingResponseProps, StreamingResponseTheme, MarkdownOptions, } from "./StreamingResponse";
|
|
17
17
|
export { CodeBlock, codeBlockTheme } from "./CodeBlock";
|
|
@@ -19,15 +19,5 @@ export type { CodeBlockProps, CodeBlockLanguage, CodeBlockTheme, CodeBlockThemeO
|
|
|
19
19
|
export { ApprovalCard } from "./ApprovalCard";
|
|
20
20
|
export type { ApprovalCardProps, ApprovalRiskLevel, ApprovalMode, } from "./ApprovalCard";
|
|
21
21
|
export { approvalCardTheme } from "./ApprovalCard/ApprovalCard.theme";
|
|
22
|
-
export { EditingIndicator, editingIndicatorTheme } from "./EditingIndicator";
|
|
23
|
-
export type { EditingIndicatorProps, EditingIndicatorTheme, } from "./EditingIndicator";
|
|
24
|
-
export { PresenceIndicator, presenceIndicatorTheme } from "./PresenceIndicator";
|
|
25
|
-
export type { PresenceIndicatorProps, PresenceIndicatorTheme, PresenceSort, } from "./PresenceIndicator";
|
|
26
|
-
export { PresenceProvider, usePresenceContext, PresenceContext, MockPresenceAdapter, } from "./PresenceProvider";
|
|
27
|
-
export type { PresenceProviderProps, PresenceUser, TypingUser, ConnectionStatus, PresenceEvent, PresenceAdapter, PresenceAdapterConfig, PresenceContextValue, PresenceProviderTheme, } from "./PresenceProvider";
|
|
28
22
|
export { ArtifactContainer, artifactContainerTheme, handleSizes, } from "./ArtifactContainer";
|
|
29
23
|
export type { ArtifactContainerProps, ArtifactContainerChatProps, ArtifactContainerCanvasProps, ArtifactContainerTheme, SplitDirection, } from "./ArtifactContainer";
|
|
30
|
-
export { GenerativeRenderer, generativeRendererTheme, } from "./GenerativeRenderer";
|
|
31
|
-
export type { GenerativeRendererProps, GenerativeRendererTheme, RendererType, } from "./GenerativeRenderer";
|
|
32
|
-
export { VersionSlider, versionSliderTheme } from "./VersionSlider";
|
|
33
|
-
export type { VersionSliderProps, VersionSliderTheme, Version, } from "./VersionSlider";
|
|
@@ -14,8 +14,8 @@ import { getSpringAnimation, CIRCULAR_CHART_ANIMATIONS, getStaggerDelay } from '
|
|
|
14
14
|
* Multiple concentric circular progress rings, inspired by Apple Activity.
|
|
15
15
|
* Features smooth animations, accessibility support, and production-ready CSS variables.
|
|
16
16
|
*/
|
|
17
|
-
const ActivityRings = ({ rings, centerLabel, centerSuffix, size = ACTIVITY_RINGS_DEFAULTS.size, strokeWidth: propStrokeWidth, gap: propGap, showAnimation = ACTIVITY_RINGS_DEFAULTS.showAnimation, theme: themeOverrides, className, title, description, showValidationWarnings = process.env.NODE_ENV === "development", ...props }) => {
|
|
18
|
-
var _a, _b, _c, _d, _e, _f
|
|
17
|
+
const ActivityRings = ({ rings, centerLabel, centerSuffix, size = ACTIVITY_RINGS_DEFAULTS.size, strokeWidth: propStrokeWidth, gap: propGap, showAnimation = ACTIVITY_RINGS_DEFAULTS.showAnimation, colors, theme: themeOverrides, className, title, description, darkMode = false, showValidationWarnings = process.env.NODE_ENV === "development", ...props }) => {
|
|
18
|
+
var _a, _b, _c, _d, _e, _f;
|
|
19
19
|
const theme = { ...activityRingsTheme, ...(themeOverrides || {}) };
|
|
20
20
|
const shouldReduceMotion = useReducedMotion();
|
|
21
21
|
const containerRef = useRef(null);
|
|
@@ -81,8 +81,25 @@ const ActivityRings = ({ rings, centerLabel, centerSuffix, size = ACTIVITY_RINGS
|
|
|
81
81
|
return maxRadius - index * (strokeWidth + gap);
|
|
82
82
|
});
|
|
83
83
|
}, [normalizedRings.length, strokeWidth, gap, center]);
|
|
84
|
-
// Get
|
|
85
|
-
|
|
84
|
+
// Get color for a ring by index
|
|
85
|
+
// Priority: ring.color > colors prop > theme colors > fallback
|
|
86
|
+
const getRingColor = (ring, index) => {
|
|
87
|
+
var _a;
|
|
88
|
+
// 1. Individual ring color override (highest priority)
|
|
89
|
+
if (ring.color)
|
|
90
|
+
return ring.color;
|
|
91
|
+
// 2. Component-level colors prop (overrides theme defaults)
|
|
92
|
+
if (colors && colors.length > 0) {
|
|
93
|
+
return colors[index % colors.length];
|
|
94
|
+
}
|
|
95
|
+
// 3. Theme colors
|
|
96
|
+
const themeColors = ((_a = theme.ringDefaults) === null || _a === void 0 ? void 0 : _a.colors) || [];
|
|
97
|
+
if (themeColors.length > 0) {
|
|
98
|
+
return themeColors[index % themeColors.length];
|
|
99
|
+
}
|
|
100
|
+
// 4. Fallback
|
|
101
|
+
return "var(--color-primary)";
|
|
102
|
+
};
|
|
86
103
|
// Container size
|
|
87
104
|
const containerSize = typeof size === "number" ? `${size}px` : size;
|
|
88
105
|
// Calculate average progress for ARIA
|
|
@@ -90,72 +107,67 @@ const ActivityRings = ({ rings, centerLabel, centerSuffix, size = ACTIVITY_RINGS
|
|
|
90
107
|
const sum = normalizedRings.reduce((acc, ring) => acc + ring.value, 0);
|
|
91
108
|
return Math.round(sum / normalizedRings.length);
|
|
92
109
|
}, [normalizedRings]);
|
|
93
|
-
return (React__default.createElement("div", { ref: containerRef, className: cn(theme.baseStyle, className), style: { width: containerSize, height: containerSize }, role: "progressbar", "aria-valuenow": averageProgress, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": title ||
|
|
110
|
+
return (React__default.createElement("div", { ref: containerRef, className: cn(theme.baseStyle, darkMode && "dark", className), style: { width: containerSize, height: containerSize }, role: "progressbar", "aria-valuenow": averageProgress, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": title ||
|
|
94
111
|
`Activity rings: ${normalizedRings
|
|
95
112
|
.map((r, i) => `${r.label || `Ring ${i + 1}`} ${r.value}%`)
|
|
96
113
|
.join(", ")}`, "aria-describedby": description ? "rings-description" : undefined, tabIndex: 0, ...props },
|
|
97
114
|
description && (React__default.createElement("span", { id: "rings-description", className: "sr-only" }, description)),
|
|
98
|
-
React__default.createElement("svg", { className: cn(theme.svgStyle), viewBox: `0 0 ${svgSize} ${svgSize}`, width: containerSize, height: containerSize, preserveAspectRatio: "xMidYMid meet", role: "presentation", "aria-hidden": "true" },
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
const animationDelay = getStaggerDelay(index, CIRCULAR_CHART_ANIMATIONS.activityRings.staggerDelay);
|
|
109
|
-
// Check if radius is valid (prevent negative or zero radius)
|
|
110
|
-
if (radius <= 0) {
|
|
111
|
-
if (process.env.NODE_ENV !== "production") {
|
|
112
|
-
console.warn(`[ActivityRings]: Ring ${index} has invalid radius (${radius}). Too many rings or strokeWidth/gap too large.`);
|
|
113
|
-
}
|
|
114
|
-
return null;
|
|
115
|
+
React__default.createElement("svg", { className: cn(theme.svgStyle), viewBox: `0 0 ${svgSize} ${svgSize}`, width: containerSize, height: containerSize, preserveAspectRatio: "xMidYMid meet", role: "presentation", "aria-hidden": "true" }, normalizedRings.map((ring, index) => {
|
|
116
|
+
const radius = ringRadii[index];
|
|
117
|
+
const circumference = 2 * Math.PI * radius;
|
|
118
|
+
const offset = circumference - (ring.value / 100) * circumference;
|
|
119
|
+
const ringColor = getRingColor(ring, index);
|
|
120
|
+
const animationDelay = getStaggerDelay(index, CIRCULAR_CHART_ANIMATIONS.activityRings.staggerDelay);
|
|
121
|
+
// Check if radius is valid (prevent negative or zero radius)
|
|
122
|
+
if (radius <= 0) {
|
|
123
|
+
if (process.env.NODE_ENV !== "production") {
|
|
124
|
+
console.warn(`[ActivityRings]: Ring ${index} has invalid radius (${radius}). Too many rings or strokeWidth/gap too large.`);
|
|
115
125
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
};
|
|
130
|
-
const svgCoordinates = {
|
|
131
|
-
x: center,
|
|
132
|
-
y: center - radius,
|
|
133
|
-
dimensions: {
|
|
134
|
-
width: svgSize,
|
|
135
|
-
height: svgSize,
|
|
136
|
-
left: 0,
|
|
137
|
-
top: 0,
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
// Create shared hover handlers
|
|
129
|
+
const createHoverHandlers = () => ({
|
|
130
|
+
onMouseEnter: (e) => {
|
|
131
|
+
const content = {
|
|
132
|
+
category: "", // Empty to avoid duplicate text in tooltip
|
|
133
|
+
series: [
|
|
134
|
+
{
|
|
135
|
+
key: `ring-${index}`,
|
|
136
|
+
label: ring.label || `Ring ${index + 1}`,
|
|
137
|
+
value: ring.value,
|
|
138
|
+
color: ringColor,
|
|
138
139
|
},
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
140
|
+
],
|
|
141
|
+
};
|
|
142
|
+
const svgCoordinates = {
|
|
143
|
+
x: center,
|
|
144
|
+
y: center - radius,
|
|
145
|
+
dimensions: {
|
|
146
|
+
width: svgSize,
|
|
147
|
+
height: svgSize,
|
|
148
|
+
left: 0,
|
|
149
|
+
top: 0,
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
handleMouseEnter(e, content, svgCoordinates);
|
|
153
|
+
},
|
|
154
|
+
onMouseMove: (e) => handleMouseMove(e),
|
|
155
|
+
onMouseLeave: () => handleMouseLeave(),
|
|
156
|
+
});
|
|
157
|
+
return (React__default.createElement("g", { key: index },
|
|
158
|
+
React__default.createElement("circle", { cx: center, cy: center, r: radius, fill: "none", stroke: "var(--color-chart-track)", strokeWidth: strokeWidth, strokeLinecap: "round", className: "cursor-pointer", transform: `rotate(-90 ${center} ${center})`, ...createHoverHandlers() }),
|
|
159
|
+
React__default.createElement(motion.circle, { cx: center, cy: center, r: radius, fill: "none", stroke: ringColor, strokeWidth: strokeWidth, strokeLinecap: "round", strokeDasharray: circumference, className: "cursor-pointer transition-opacity duration-200", initial: { strokeDashoffset: circumference }, animate: hasAnimated ? { strokeDashoffset: offset } : {}, transition: showAnimation && !shouldReduceMotion
|
|
160
|
+
? getSpringAnimation(CIRCULAR_CHART_ANIMATIONS.activityRings.preset, shouldReduceMotion, animationDelay)
|
|
161
|
+
: { duration: 0 }, transform: `rotate(-90 ${center} ${center})`, ...createHoverHandlers() })));
|
|
162
|
+
})),
|
|
151
163
|
(centerLabel || centerSuffix) && (React__default.createElement(motion.div, { className: "absolute inset-0 flex flex-col items-center justify-center pointer-events-none", initial: { opacity: 0, scale: 0.8 }, animate: hasAnimated ? { opacity: 1, scale: 1 } : {}, transition: showAnimation && !shouldReduceMotion
|
|
152
164
|
? {
|
|
153
165
|
delay: CIRCULAR_CHART_ANIMATIONS.activityRings.centerLabelDelay,
|
|
154
166
|
duration: 0.4,
|
|
155
167
|
}
|
|
156
|
-
: { duration: 0 } }, centerLabel && (React__default.createElement("div", { className: cn((
|
|
168
|
+
: { duration: 0 } }, centerLabel && (React__default.createElement("div", { className: cn((_e = theme.centerText) === null || _e === void 0 ? void 0 : _e.label, "flex flex-col items-center") },
|
|
157
169
|
React__default.createElement("span", null, centerLabel),
|
|
158
|
-
centerSuffix && (React__default.createElement("span", { className: (
|
|
170
|
+
centerSuffix && (React__default.createElement("span", { className: (_f = theme.centerText) === null || _f === void 0 ? void 0 : _f.suffix }, centerSuffix)))))),
|
|
159
171
|
React__default.createElement(ChartTooltip, { tooltipRef: tooltipRef, content: tooltipData === null || tooltipData === void 0 ? void 0 : tooltipData.content, active: !!tooltipData, position: tooltipData ? { x: tooltipData.x, y: tooltipData.y } : { x: 0, y: 0 } })));
|
|
160
172
|
};
|
|
161
173
|
ActivityRings.displayName = "ActivityRings";
|
|
@@ -22,6 +22,7 @@ export interface ActivityRingsThemeOverrides {
|
|
|
22
22
|
ringDefaults?: {
|
|
23
23
|
strokeWidth?: number;
|
|
24
24
|
gap?: number;
|
|
25
|
+
/** Default colors */
|
|
25
26
|
colors?: string[];
|
|
26
27
|
};
|
|
27
28
|
/** Center text styles */
|
|
@@ -48,8 +49,24 @@ export interface ActivityRingsProps extends Pick<BaseChartProps, 'className' | '
|
|
|
48
49
|
gap?: number;
|
|
49
50
|
/** Whether to show animations (default: true) */
|
|
50
51
|
showAnimation?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Custom color palette for rings. Colors are applied in order from outer to inner ring.
|
|
54
|
+
* If fewer colors than rings, colors will cycle. Individual ring.color takes precedence.
|
|
55
|
+
* When provided, overrides both light and dark theme defaults - choose colors appropriate
|
|
56
|
+
* for your background.
|
|
57
|
+
* @example ['#3b82f6', '#10b981', '#f59e0b']
|
|
58
|
+
* @example ['var(--color-primary)', 'var(--color-success)', 'var(--color-warning)']
|
|
59
|
+
*/
|
|
60
|
+
colors?: string[];
|
|
51
61
|
/** Theme overrides */
|
|
52
62
|
theme?: ActivityRingsThemeOverrides;
|
|
63
|
+
/**
|
|
64
|
+
* Force dark mode styling for the chart. Use when placing the chart on a dark background
|
|
65
|
+
* while the page is in light mode. This applies the 'dark' class to the chart container,
|
|
66
|
+
* making text, borders, and other elements use light colors for visibility.
|
|
67
|
+
* @default false
|
|
68
|
+
*/
|
|
69
|
+
darkMode?: boolean;
|
|
53
70
|
/** Development and debugging props */
|
|
54
71
|
showValidationWarnings?: boolean;
|
|
55
72
|
}
|
|
@@ -24,8 +24,10 @@ orientation = BAR_CHART_DEFAULTS.orientation,
|
|
|
24
24
|
showAnimation = BAR_CHART_DEFAULTS.showAnimation,
|
|
25
25
|
// Placeholder bar props
|
|
26
26
|
showPlaceholderBars = BAR_CHART_DEFAULTS.showPlaceholderBars, placeholderData,
|
|
27
|
+
// Color customization
|
|
28
|
+
colors,
|
|
27
29
|
// Base props
|
|
28
|
-
className, title, description, enableKeyboardNavigation = BAR_CHART_DEFAULTS.enableKeyboardNavigation, showValidationWarnings = process.env.NODE_ENV === "development", children, ...props }) => {
|
|
30
|
+
className, title, description, enableKeyboardNavigation = BAR_CHART_DEFAULTS.enableKeyboardNavigation, showValidationWarnings = process.env.NODE_ENV === "development", darkMode = false, children, ...props }) => {
|
|
29
31
|
var _a, _b;
|
|
30
32
|
// Resolve barRadius with backward compatibility
|
|
31
33
|
const resolvedBarRadius = (_a = barRadius !== null && barRadius !== void 0 ? barRadius : radius) !== null && _a !== void 0 ? _a : BAR_CHART_DEFAULTS.barRadius;
|
|
@@ -75,13 +77,15 @@ className, title, description, enableKeyboardNavigation = BAR_CHART_DEFAULTS.ena
|
|
|
75
77
|
}
|
|
76
78
|
// Simple color functions based on direct CSS variables (following guidelines)
|
|
77
79
|
const getSeriesFillColor = (index) => {
|
|
78
|
-
const
|
|
80
|
+
const defaultColors = [
|
|
79
81
|
"var(--color-primary)",
|
|
80
82
|
"var(--color-warning)",
|
|
81
83
|
"var(--color-success)",
|
|
82
84
|
"var(--color-danger)",
|
|
83
85
|
];
|
|
84
|
-
|
|
86
|
+
// Use custom colors if provided, otherwise fall back to defaults
|
|
87
|
+
const palette = colors && colors.length > 0 ? colors : defaultColors;
|
|
88
|
+
return palette[index % palette.length];
|
|
85
89
|
};
|
|
86
90
|
const containerRef = useRef(null);
|
|
87
91
|
const [dimensions, setDimensions] = useState({ width: 600, height: 400 });
|
|
@@ -408,7 +412,7 @@ className, title, description, enableKeyboardNavigation = BAR_CHART_DEFAULTS.ena
|
|
|
408
412
|
: undefined }));
|
|
409
413
|
};
|
|
410
414
|
return (React__default.createElement(ChartErrorBoundary, { className: className, showErrorDetails: process.env.NODE_ENV === "development" },
|
|
411
|
-
React__default.createElement("div", { ref: containerRef, className: cn("chart-container w-full h-full", className), ...chartAccessibilityProps, onMouseEnter: handleMouseInteraction, onMouseMove: handleMouseInteraction, ...props },
|
|
415
|
+
React__default.createElement("div", { ref: containerRef, className: cn("chart-container w-full h-full", darkMode && "dark", className), ...chartAccessibilityProps, onMouseEnter: handleMouseInteraction, onMouseMove: handleMouseInteraction, ...props },
|
|
412
416
|
descriptionProps && React__default.createElement("div", { ...descriptionProps }),
|
|
413
417
|
showValidationWarnings && hasWarnings && (React__default.createElement("div", { className: "absolute top-2 left-2 right-2 z-10 p-2 bg-[var(--color-warning-50)] border border-[var(--color-warning-200)] rounded text-xs text-[var(--color-warning)] shadow-sm" },
|
|
414
418
|
React__default.createElement("strong", null, "Chart Warnings:"),
|
|
@@ -4,10 +4,24 @@ export interface BarChartProps extends BaseChartProps, StandardChartDisplayProps
|
|
|
4
4
|
radius?: number;
|
|
5
5
|
gap?: number;
|
|
6
6
|
categoryGap?: number;
|
|
7
|
+
/**
|
|
8
|
+
* Custom color palette for bar series. Colors are applied in order to each data series.
|
|
9
|
+
* If fewer colors than series, colors will cycle. Supports any valid CSS color value
|
|
10
|
+
* including hex, rgb, hsl, and CSS variables like `var(--color-primary)`.
|
|
11
|
+
* @example ['#3b82f6', '#10b981', '#f59e0b']
|
|
12
|
+
* @example ['var(--color-primary)', 'var(--color-success)']
|
|
13
|
+
*/
|
|
14
|
+
colors?: string[];
|
|
7
15
|
showAnimation?: boolean;
|
|
8
16
|
showPlaceholderBars?: boolean;
|
|
9
17
|
placeholderData?: BaseChartProps["data"];
|
|
10
18
|
showValidationWarnings?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Force dark mode styling for the chart. Use when placing the chart on a dark background
|
|
21
|
+
* while the page is in light mode. This applies the 'dark' class to the chart container,
|
|
22
|
+
* making axis labels, grid lines, and text use light colors for visibility.
|
|
23
|
+
*/
|
|
24
|
+
darkMode?: boolean;
|
|
11
25
|
}
|
|
12
26
|
export declare const BAR_CHART_DEFAULTS: {
|
|
13
27
|
readonly barRadius: 32;
|