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
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { formsBaseTheme } from '../forms.theme.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Default theme for the Combobox component
|
|
5
|
+
* Extends the common forms base theme
|
|
6
|
+
*/
|
|
7
|
+
const comboboxTheme = {
|
|
8
|
+
// Container style for the entire combobox component
|
|
9
|
+
containerStyle: formsBaseTheme.wrapperStyle,
|
|
10
|
+
// Wrapper style
|
|
11
|
+
wrapperStyle: "relative w-full",
|
|
12
|
+
// Input group styles - extends the common input group style
|
|
13
|
+
inputGroupStyle: formsBaseTheme.inputGroupBaseStyle,
|
|
14
|
+
// Base input styles
|
|
15
|
+
inputStyle: `${formsBaseTheme.controlBaseStyle} py-2 px-3 pr-8 ` +
|
|
16
|
+
"cursor-text",
|
|
17
|
+
// Placeholder text style
|
|
18
|
+
inputPlaceholderStyle: formsBaseTheme.placeholderStyle,
|
|
19
|
+
// Size variants - composed from atomic tokens
|
|
20
|
+
sizes: {
|
|
21
|
+
sm: `${formsBaseTheme.sizes.sm.text} ${formsBaseTheme.sizes.sm.padding} ${formsBaseTheme.sizes.sm.height}`,
|
|
22
|
+
md: `${formsBaseTheme.sizes.md.text} ${formsBaseTheme.sizes.md.padding} ${formsBaseTheme.sizes.md.height}`,
|
|
23
|
+
lg: `${formsBaseTheme.sizes.lg.text} ${formsBaseTheme.sizes.lg.padding} ${formsBaseTheme.sizes.lg.height}`,
|
|
24
|
+
},
|
|
25
|
+
// State variants - inherited from common form theme
|
|
26
|
+
states: formsBaseTheme.states,
|
|
27
|
+
// Focus state variants - inherited from common form theme
|
|
28
|
+
focusStates: formsBaseTheme.focusStates,
|
|
29
|
+
// Icon positioning styles
|
|
30
|
+
iconStartStyle: formsBaseTheme.iconStyles.left,
|
|
31
|
+
iconEndStyle: "absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none text-[var(--color-text-muted)] " +
|
|
32
|
+
"dark:text-[var(--color-neutral-500)]",
|
|
33
|
+
// Icon padding configuration
|
|
34
|
+
iconPadding: formsBaseTheme.iconStyles.padding,
|
|
35
|
+
// Clear button styles
|
|
36
|
+
clearButtonStyle: "absolute inset-y-0 right-0 flex items-center pr-2 cursor-pointer " +
|
|
37
|
+
"text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] transition-colors z-10 " +
|
|
38
|
+
"dark:text-[var(--color-neutral-500)] dark:hover:text-[var(--color-neutral-200)]",
|
|
39
|
+
clearIconStyle: "size-4",
|
|
40
|
+
// Dropdown styles - matches Select component for consistency
|
|
41
|
+
dropdownStyle: formsBaseTheme.dropdownStyles.container + " py-1",
|
|
42
|
+
// Individual option style
|
|
43
|
+
optionStyle: formsBaseTheme.dropdownStyles.option,
|
|
44
|
+
// Selected option style
|
|
45
|
+
selectedOptionStyle: formsBaseTheme.dropdownStyles.optionSelected,
|
|
46
|
+
// Highlighted option style (keyboard navigation)
|
|
47
|
+
highlightedOptionStyle: formsBaseTheme.dropdownStyles.optionHighlighted,
|
|
48
|
+
// Disabled option style
|
|
49
|
+
disabledOptionStyle: formsBaseTheme.dropdownStyles.optionDisabled,
|
|
50
|
+
// Empty message style
|
|
51
|
+
emptyMessageStyle: formsBaseTheme.dropdownStyles.emptyMessage,
|
|
52
|
+
// Create option style
|
|
53
|
+
createOptionStyle: formsBaseTheme.dropdownStyles.optionCreate,
|
|
54
|
+
// Helper text style - inherited from common form theme
|
|
55
|
+
helperTextStyle: formsBaseTheme.helperText,
|
|
56
|
+
// Helper text state variants
|
|
57
|
+
helperTextStates: formsBaseTheme.helperTextStates,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export { comboboxTheme };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Individual option for Combobox
|
|
4
|
+
*/
|
|
5
|
+
export interface ComboboxOption<T = string> {
|
|
6
|
+
/** Unique identifier for the option */
|
|
7
|
+
id: string;
|
|
8
|
+
/** Display label shown in dropdown */
|
|
9
|
+
label: string;
|
|
10
|
+
/** Value stored when option is selected */
|
|
11
|
+
value: T;
|
|
12
|
+
/** Whether option is disabled */
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Size variants for Combobox
|
|
17
|
+
*/
|
|
18
|
+
export type ComboboxSize = "sm" | "md" | "lg";
|
|
19
|
+
/**
|
|
20
|
+
* State variants for Combobox
|
|
21
|
+
*/
|
|
22
|
+
export type ComboboxState = "default" | "disabled" | "invalid";
|
|
23
|
+
/**
|
|
24
|
+
* Props for the Combobox component
|
|
25
|
+
*/
|
|
26
|
+
export interface ComboboxProps<T = string> extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
27
|
+
/** Array of options to display */
|
|
28
|
+
options: ComboboxOption<T>[];
|
|
29
|
+
/** Currently selected value */
|
|
30
|
+
value?: T;
|
|
31
|
+
/** Callback when value changes */
|
|
32
|
+
onChange?: (value: T | undefined) => void;
|
|
33
|
+
/** Placeholder text when no value is selected */
|
|
34
|
+
placeholder?: string;
|
|
35
|
+
/** Label text displayed above the input */
|
|
36
|
+
label?: string;
|
|
37
|
+
/** Helper text displayed below the input */
|
|
38
|
+
helperText?: string;
|
|
39
|
+
/** Size variant */
|
|
40
|
+
size?: ComboboxSize;
|
|
41
|
+
/** State variant (controls styling) */
|
|
42
|
+
state?: ComboboxState;
|
|
43
|
+
/** Whether the clear button is shown (default: true) */
|
|
44
|
+
clearable?: boolean;
|
|
45
|
+
/** Icon displayed at the start of the input */
|
|
46
|
+
iconStart?: React.ReactNode;
|
|
47
|
+
/** Whether to open dropdown on focus (default: true) */
|
|
48
|
+
openOnFocus?: boolean;
|
|
49
|
+
/** Custom filter function */
|
|
50
|
+
filterFn?: (option: ComboboxOption<T>, inputValue: string) => boolean;
|
|
51
|
+
/** Message shown when no options match the filter */
|
|
52
|
+
emptyMessage?: string;
|
|
53
|
+
/** Whether to allow creating new options */
|
|
54
|
+
creatable?: boolean;
|
|
55
|
+
/** Callback when a new option is created */
|
|
56
|
+
onCreateOption?: (inputValue: string) => void;
|
|
57
|
+
/** Label for the create option - can be a string or function */
|
|
58
|
+
createLabel?: string | ((inputValue: string) => string);
|
|
59
|
+
/** Whether the input is required */
|
|
60
|
+
required?: boolean;
|
|
61
|
+
/** Form field name */
|
|
62
|
+
name?: string;
|
|
63
|
+
/** Additional className for the wrapper */
|
|
64
|
+
wrapperClassName?: string;
|
|
65
|
+
/** Additional className for the input */
|
|
66
|
+
inputClassName?: string;
|
|
67
|
+
/** Additional className for the dropdown */
|
|
68
|
+
dropdownClassName?: string;
|
|
69
|
+
/** Theme overrides */
|
|
70
|
+
theme?: ComboboxThemeOverrides;
|
|
71
|
+
/** Whether to use portal for dropdown positioning (default: true) */
|
|
72
|
+
portal?: boolean;
|
|
73
|
+
/** Dropdown placement */
|
|
74
|
+
placement?: "bottom-start" | "bottom-end" | "top-start" | "top-end";
|
|
75
|
+
/** Offset from trigger */
|
|
76
|
+
offset?: number;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Theme configuration for Combobox
|
|
80
|
+
*/
|
|
81
|
+
export interface ComboboxTheme {
|
|
82
|
+
containerStyle: string;
|
|
83
|
+
wrapperStyle: string;
|
|
84
|
+
inputGroupStyle: string;
|
|
85
|
+
inputStyle: string;
|
|
86
|
+
inputPlaceholderStyle: string;
|
|
87
|
+
sizes: Record<ComboboxSize, string>;
|
|
88
|
+
states: Record<ComboboxState, string>;
|
|
89
|
+
focusStates: Record<ComboboxState, string>;
|
|
90
|
+
iconStartStyle: string;
|
|
91
|
+
iconEndStyle: string;
|
|
92
|
+
iconPadding: {
|
|
93
|
+
left: string;
|
|
94
|
+
right: string;
|
|
95
|
+
};
|
|
96
|
+
clearButtonStyle: string;
|
|
97
|
+
clearIconStyle: string;
|
|
98
|
+
dropdownStyle: string;
|
|
99
|
+
optionStyle: string;
|
|
100
|
+
selectedOptionStyle: string;
|
|
101
|
+
highlightedOptionStyle: string;
|
|
102
|
+
disabledOptionStyle: string;
|
|
103
|
+
emptyMessageStyle: string;
|
|
104
|
+
createOptionStyle: string;
|
|
105
|
+
helperTextStyle: string;
|
|
106
|
+
helperTextStates: Partial<Record<ComboboxState, string>>;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Partial theme overrides for Combobox
|
|
110
|
+
*/
|
|
111
|
+
export type ComboboxThemeOverrides = Partial<ComboboxTheme>;
|
|
@@ -36,6 +36,7 @@ import '../../core/Modal/Modal.js';
|
|
|
36
36
|
import '../../core/Pagination/Pagination.js';
|
|
37
37
|
import '../../core/Popover/Popover.js';
|
|
38
38
|
import '../../core/Popover/PopoverContext.js';
|
|
39
|
+
import '../../core/Progress/Progress.js';
|
|
39
40
|
import '../../core/ProgressiveBlur/ProgressiveBlur.js';
|
|
40
41
|
import '../../core/Segmented/Segmented.js';
|
|
41
42
|
import '../../core/Skeleton/Skeleton.js';
|
|
@@ -49,6 +50,7 @@ import '../../core/Tabs/TabsContext.js';
|
|
|
49
50
|
import '../../core/Tooltip/Tooltip.js';
|
|
50
51
|
import '../../core/Tooltip/Tooltip.animations.js';
|
|
51
52
|
import '../../core/Tree/Tree.js';
|
|
53
|
+
import '../../core/Tag/Tag.js';
|
|
52
54
|
import '../../core/Alert/Alert.js';
|
|
53
55
|
import '../../core/Toast/Toast.js';
|
|
54
56
|
import '../../core/Toast/ToastProvider.js';
|
|
@@ -11,16 +11,7 @@ import '../../../icons/core/DollarIcon.js';
|
|
|
11
11
|
import '../../../icons/core/TickIcon.js';
|
|
12
12
|
import { validateMaskedInput, applyInputMask, getAdjustedCursorPosition } from './inputMasks.js';
|
|
13
13
|
|
|
14
|
-
const Input = React__default.forwardRef(({ size = "md", state = "default", className = "", label, labelClassName = "", helperText, helperTextClassName = "", wrapperClassName = "", inputGroupClassName = "", iconStart, iconEnd, contentStart, contentEnd,
|
|
15
|
-
// Deprecation warnings for old props
|
|
16
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
17
|
-
if (addonPrefix) {
|
|
18
|
-
console.warn('[Input]: `addonPrefix` is deprecated and will be removed in v0.2.0. Use `contentStart` instead.');
|
|
19
|
-
}
|
|
20
|
-
if (addonSuffix) {
|
|
21
|
-
console.warn('[Input]: `addonSuffix` is deprecated and will be removed in v0.2.0. Use `contentEnd` instead.');
|
|
22
|
-
}
|
|
23
|
-
}
|
|
14
|
+
const Input = React__default.forwardRef(({ size = "md", state = "default", className = "", label, labelClassName = "", helperText, helperTextClassName = "", wrapperClassName = "", inputGroupClassName = "", iconStart, iconEnd, contentStart, contentEnd, keyboardShortcut, id, required, type = "text", passwordToggle = type === "password", passwordStrengthIndicator, showNumberControls = false, min, max, step = 1, onChange, value, currencyDecimalPlaces, ...props }, ref) => {
|
|
24
15
|
const [isFocused, setIsFocused] = useState(false);
|
|
25
16
|
const [showPassword, setShowPassword] = useState(false);
|
|
26
17
|
const inputId = id || `input-${Math.random().toString(36).substring(2, 9)}`;
|
|
@@ -38,26 +29,29 @@ const Input = React__default.forwardRef(({ size = "md", state = "default", class
|
|
|
38
29
|
const defaultSearchIcon = type === "search" && !iconStart ? (React__default.createElement(SearchIcon, { size: "sm", className: inputTheme.typeStyles.search.iconStyle })) : null;
|
|
39
30
|
// Use the provided iconStart or the default icon based on input type
|
|
40
31
|
const finalLeftIcon = iconStart || defaultPasswordIcon || defaultSearchIcon;
|
|
41
|
-
// Support both old and new prop names (prefer new)
|
|
42
|
-
const finalContentStart = contentStart !== null && contentStart !== void 0 ? contentStart : addonPrefix;
|
|
43
|
-
const finalContentEnd = contentEnd !== null && contentEnd !== void 0 ? contentEnd : addonSuffix;
|
|
44
32
|
// Derived state flags for internal use
|
|
45
33
|
const hasLeftIcon = Boolean(finalLeftIcon);
|
|
46
34
|
const isDisabled = state === "disabled";
|
|
47
35
|
const isInvalid = state === "invalid";
|
|
48
36
|
const hasRightIcon = Boolean(iconEnd);
|
|
49
|
-
const hasContentStart = Boolean(
|
|
50
|
-
const hasContentEnd = Boolean(
|
|
37
|
+
const hasContentStart = Boolean(contentStart);
|
|
38
|
+
const hasContentEnd = Boolean(contentEnd);
|
|
51
39
|
const hasKeyboardShortcut = Boolean(keyboardShortcut);
|
|
52
40
|
const isPasswordField = type === "password" && passwordToggle;
|
|
53
41
|
const isNumberField = type === "number";
|
|
54
42
|
const displayNumberControls = isNumberField && showNumberControls;
|
|
55
|
-
const isMaskedInput = [
|
|
43
|
+
const isMaskedInput = [
|
|
44
|
+
"creditCard",
|
|
45
|
+
"expiryDate",
|
|
46
|
+
"phone",
|
|
47
|
+
"ssn",
|
|
48
|
+
"currency",
|
|
49
|
+
].includes(type);
|
|
56
50
|
// Password strength indicator flags
|
|
57
51
|
const hasPasswordStrength = type === "password" && (passwordStrengthIndicator === null || passwordStrengthIndicator === void 0 ? void 0 : passwordStrengthIndicator.show);
|
|
58
|
-
const strengthPosition = (passwordStrengthIndicator === null || passwordStrengthIndicator === void 0 ? void 0 : passwordStrengthIndicator.position) ||
|
|
59
|
-
const showStrengthWithLabel = hasPasswordStrength && strengthPosition ===
|
|
60
|
-
const showStrengthBelow = hasPasswordStrength && strengthPosition ===
|
|
52
|
+
const strengthPosition = (passwordStrengthIndicator === null || passwordStrengthIndicator === void 0 ? void 0 : passwordStrengthIndicator.position) || "right";
|
|
53
|
+
const showStrengthWithLabel = hasPasswordStrength && strengthPosition === "right";
|
|
54
|
+
const showStrengthBelow = hasPasswordStrength && strengthPosition === "below";
|
|
61
55
|
// State class for CSS selectors
|
|
62
56
|
const stateClass = isInvalid
|
|
63
57
|
? "state-invalid"
|
|
@@ -75,7 +69,7 @@ const Input = React__default.forwardRef(({ size = "md", state = "default", class
|
|
|
75
69
|
}
|
|
76
70
|
};
|
|
77
71
|
// Determine the actual input type to use
|
|
78
|
-
const actualInputType = isPasswordField && showPassword ? "text" :
|
|
72
|
+
const actualInputType = isPasswordField && showPassword ? "text" : isMaskedInput ? "text" : type;
|
|
79
73
|
// Validate masked inputs
|
|
80
74
|
useEffect(() => {
|
|
81
75
|
if (isMaskedInput && value) {
|
|
@@ -155,7 +149,9 @@ const Input = React__default.forwardRef(({ size = "md", state = "default", class
|
|
|
155
149
|
cursorPositionRef.current = e.target.selectionStart;
|
|
156
150
|
if (isMaskedInput) {
|
|
157
151
|
// Apply masking with options
|
|
158
|
-
const maskedValue = applyInputMask(originalValue, type, {
|
|
152
|
+
const maskedValue = applyInputMask(originalValue, type, {
|
|
153
|
+
currencyDecimalPlaces: currencyDecimalPlaces,
|
|
154
|
+
});
|
|
159
155
|
// Update the input value
|
|
160
156
|
e.target.value = maskedValue;
|
|
161
157
|
// Adjust cursor position
|
|
@@ -169,7 +165,7 @@ const Input = React__default.forwardRef(({ size = "md", state = "default", class
|
|
|
169
165
|
}, 0);
|
|
170
166
|
}
|
|
171
167
|
// For currency inputs, ensure we immediately validate
|
|
172
|
-
if (type ===
|
|
168
|
+
if (type === "currency" && isInvalid && onChange) {
|
|
173
169
|
const event = { ...e };
|
|
174
170
|
onChange(event);
|
|
175
171
|
}
|
|
@@ -261,7 +257,8 @@ const Input = React__default.forwardRef(({ size = "md", state = "default", class
|
|
|
261
257
|
const dotActiveStyle = inputTheme.passwordStrengthIndicator.dotActiveStyle;
|
|
262
258
|
const dotInactiveStyle = inputTheme.passwordStrengthIndicator.dotInactiveStyle;
|
|
263
259
|
// Get color and label based on strength using design tokens
|
|
264
|
-
const strengthConfig = inputTheme.passwordStrengthIndicator
|
|
260
|
+
const strengthConfig = inputTheme.passwordStrengthIndicator
|
|
261
|
+
.strengthStyles[strength] || {
|
|
265
262
|
label: "Password",
|
|
266
263
|
color: "text-[var(--color-text-muted)]",
|
|
267
264
|
};
|
|
@@ -293,10 +290,10 @@ const Input = React__default.forwardRef(({ size = "md", state = "default", class
|
|
|
293
290
|
showStrengthWithLabel && (React__default.createElement(PasswordStrengthIndicator, { inline: true })))),
|
|
294
291
|
React__default.createElement("div", null,
|
|
295
292
|
React__default.createElement("div", { className: cn(inputGroupClasses, stateClasses, inputGroupClassName), onClick: handleInputGroupClick, role: "presentation" },
|
|
296
|
-
hasContentStart && (React__default.createElement("div", { className: cn(contentStyleClasses, contentStartStyle) },
|
|
293
|
+
hasContentStart && (React__default.createElement("div", { className: cn(contentStyleClasses, contentStartStyle) }, contentStart)),
|
|
297
294
|
React__default.createElement("div", { className: "relative flex-1" },
|
|
298
|
-
React__default.createElement("input", { ref: setInputRef, id: inputId, type: actualInputType, className: cn(baseClasses, sizeClasses, hasLeftIcon && iconStartPadding, (hasRightIcon || isPasswordField || displayNumberControls) &&
|
|
299
|
-
|
|
295
|
+
React__default.createElement("input", { ref: setInputRef, id: inputId, type: actualInputType, className: cn(baseClasses, sizeClasses, hasLeftIcon && iconStartPadding, (hasRightIcon || isPasswordField || displayNumberControls) &&
|
|
296
|
+
iconEndPadding, className), disabled: isDisabled, "aria-invalid": isInvalid, required: required, min: min, max: max, step: step, value: value, onChange: handleInputChange, onFocus: (e) => {
|
|
300
297
|
var _a;
|
|
301
298
|
setIsFocused(true);
|
|
302
299
|
(_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
@@ -310,8 +307,8 @@ const Input = React__default.forwardRef(({ size = "md", state = "default", class
|
|
|
310
307
|
isPasswordField && React__default.createElement(PasswordToggleButton, null),
|
|
311
308
|
displayNumberControls && React__default.createElement(NumberButtons, null),
|
|
312
309
|
hasKeyboardShortcut && (React__default.createElement("div", { className: inputTheme.keyboardShortcutStyle }, keyboardShortcut))),
|
|
313
|
-
hasContentEnd && (React__default.createElement("div", { className: cn(contentStyleClasses, contentEndStyle) },
|
|
314
|
-
showStrengthBelow &&
|
|
310
|
+
hasContentEnd && (React__default.createElement("div", { className: cn(contentStyleClasses, contentEndStyle) }, contentEnd)))),
|
|
311
|
+
showStrengthBelow && React__default.createElement(PasswordStrengthIndicator, { inline: false }),
|
|
315
312
|
helperText && (React__default.createElement("div", { className: cn(helperTextClasses, helperTextClassName) }, helperText))));
|
|
316
313
|
});
|
|
317
314
|
Input.displayName = "Input";
|
|
@@ -71,6 +71,21 @@ export declare const applyInputMask: (value: string, type: string, options?: {
|
|
|
71
71
|
* @returns Whether the value is valid or not
|
|
72
72
|
*/
|
|
73
73
|
export declare const validateMaskedInput: (type: string, value: string) => boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Format time input as HH:MM with real-time validation
|
|
76
|
+
* Prevents invalid hour/minute values as user types
|
|
77
|
+
* @param value The raw input value
|
|
78
|
+
* @param format The time format ('12h' or '24h')
|
|
79
|
+
* @returns The formatted time string (only valid digits are kept)
|
|
80
|
+
*/
|
|
81
|
+
export declare const formatTimeInput: (value: string, format?: "12h" | "24h") => string;
|
|
82
|
+
/**
|
|
83
|
+
* Validate if a formatted time string is a complete, valid time
|
|
84
|
+
* @param value The formatted time string (HH:MM)
|
|
85
|
+
* @param format The time format ('12h' or '24h')
|
|
86
|
+
* @returns Whether the time is valid and complete
|
|
87
|
+
*/
|
|
88
|
+
export declare const isValidTimeInput: (value: string, format?: "12h" | "24h") => boolean;
|
|
74
89
|
/**
|
|
75
90
|
* Get cursor position after applying a mask
|
|
76
91
|
* This helps maintain the cursor position when formatting
|
|
@@ -299,6 +299,77 @@ const validateMaskedInput = (type, value) => {
|
|
|
299
299
|
return true;
|
|
300
300
|
}
|
|
301
301
|
};
|
|
302
|
+
/**
|
|
303
|
+
* Format time input as HH:MM with real-time validation
|
|
304
|
+
* Prevents invalid hour/minute values as user types
|
|
305
|
+
* @param value The raw input value
|
|
306
|
+
* @param format The time format ('12h' or '24h')
|
|
307
|
+
* @returns The formatted time string (only valid digits are kept)
|
|
308
|
+
*/
|
|
309
|
+
const formatTimeInput = (value, format = '24h') => {
|
|
310
|
+
const digitsOnly = value.replace(/\D/g, '');
|
|
311
|
+
if (digitsOnly.length === 0)
|
|
312
|
+
return '';
|
|
313
|
+
const maxHourFirstDigit = format === '24h' ? 2 : 1;
|
|
314
|
+
const maxHour = format === '24h' ? 23 : 12;
|
|
315
|
+
const minHour = format === '12h' ? 1 : 0;
|
|
316
|
+
// First digit of hour
|
|
317
|
+
if (digitsOnly.length === 1) {
|
|
318
|
+
const d = parseInt(digitsOnly[0], 10);
|
|
319
|
+
if (d > maxHourFirstDigit)
|
|
320
|
+
return ''; // reject
|
|
321
|
+
return digitsOnly;
|
|
322
|
+
}
|
|
323
|
+
// Second digit of hour
|
|
324
|
+
if (digitsOnly.length === 2) {
|
|
325
|
+
const hour = parseInt(digitsOnly.slice(0, 2), 10);
|
|
326
|
+
if (hour > maxHour || (format === '12h' && hour < minHour)) {
|
|
327
|
+
return digitsOnly.slice(0, 1); // reject second digit
|
|
328
|
+
}
|
|
329
|
+
return `${digitsOnly}:`;
|
|
330
|
+
}
|
|
331
|
+
// First digit of minute
|
|
332
|
+
if (digitsOnly.length === 3) {
|
|
333
|
+
parseInt(digitsOnly.slice(0, 2), 10);
|
|
334
|
+
const minTens = parseInt(digitsOnly[2], 10);
|
|
335
|
+
if (minTens > 5)
|
|
336
|
+
return `${digitsOnly.slice(0, 2)}:`; // reject — minute tens max is 5
|
|
337
|
+
return `${digitsOnly.slice(0, 2)}:${digitsOnly.slice(2)}`;
|
|
338
|
+
}
|
|
339
|
+
// Second digit of minute (complete time)
|
|
340
|
+
if (digitsOnly.length >= 4) {
|
|
341
|
+
parseInt(digitsOnly.slice(0, 2), 10);
|
|
342
|
+
const minute = parseInt(digitsOnly.slice(2, 4), 10);
|
|
343
|
+
if (minute > 59) {
|
|
344
|
+
return `${digitsOnly.slice(0, 2)}:${digitsOnly.slice(2, 3)}`; // reject fourth digit
|
|
345
|
+
}
|
|
346
|
+
return `${digitsOnly.slice(0, 2)}:${digitsOnly.slice(2, 4)}`;
|
|
347
|
+
}
|
|
348
|
+
return digitsOnly;
|
|
349
|
+
};
|
|
350
|
+
/**
|
|
351
|
+
* Validate if a formatted time string is a complete, valid time
|
|
352
|
+
* @param value The formatted time string (HH:MM)
|
|
353
|
+
* @param format The time format ('12h' or '24h')
|
|
354
|
+
* @returns Whether the time is valid and complete
|
|
355
|
+
*/
|
|
356
|
+
const isValidTimeInput = (value, format = '24h') => {
|
|
357
|
+
if (value.length !== 5)
|
|
358
|
+
return false;
|
|
359
|
+
const match = value.match(/^(\d{2}):(\d{2})$/);
|
|
360
|
+
if (!match)
|
|
361
|
+
return false;
|
|
362
|
+
const hour = parseInt(match[1], 10);
|
|
363
|
+
const minute = parseInt(match[2], 10);
|
|
364
|
+
if (minute < 0 || minute > 59)
|
|
365
|
+
return false;
|
|
366
|
+
if (format === '24h') {
|
|
367
|
+
return hour >= 0 && hour <= 23;
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
return hour >= 1 && hour <= 12;
|
|
371
|
+
}
|
|
372
|
+
};
|
|
302
373
|
/**
|
|
303
374
|
* Get cursor position after applying a mask
|
|
304
375
|
* This helps maintain the cursor position when formatting
|
|
@@ -357,4 +428,4 @@ const getAdjustedCursorPosition = (previousValue, currentValue, previousPosition
|
|
|
357
428
|
return previousPosition;
|
|
358
429
|
};
|
|
359
430
|
|
|
360
|
-
export { applyInputMask, formatCreditCard, formatCurrency, formatDateInput, formatExpiryDate, formatPhoneNumber, formatSSN, getAdjustedCursorPosition, isValidDateInput, isValidMonth, validateMaskedInput };
|
|
431
|
+
export { applyInputMask, formatCreditCard, formatCurrency, formatDateInput, formatExpiryDate, formatPhoneNumber, formatSSN, formatTimeInput, getAdjustedCursorPosition, isValidDateInput, isValidMonth, isValidTimeInput, validateMaskedInput };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { InputTagProps } from "./InputTag.types";
|
|
3
|
+
/**
|
|
4
|
+
* InputTag component for entering multiple tags/keywords.
|
|
5
|
+
*
|
|
6
|
+
* Supports:
|
|
7
|
+
* - Enter key to add tag
|
|
8
|
+
* - Comma to add tag
|
|
9
|
+
* - Paste multiple comma-separated values
|
|
10
|
+
* - Backspace to remove last tag (when input is empty)
|
|
11
|
+
* - Click X to remove individual tags
|
|
12
|
+
* - Optional dropdown suggestions with filtering
|
|
13
|
+
*
|
|
14
|
+
* @component
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* // Basic free-form tags (uncontrolled)
|
|
18
|
+
* <InputTag
|
|
19
|
+
* defaultValue={['JavaScript', 'React']}
|
|
20
|
+
* onChange={(tags) => console.log(tags)}
|
|
21
|
+
* />
|
|
22
|
+
*
|
|
23
|
+
* // Controlled with max tags
|
|
24
|
+
* <InputTag
|
|
25
|
+
* value={tags}
|
|
26
|
+
* onChange={setTags}
|
|
27
|
+
* maxTags={5}
|
|
28
|
+
* />
|
|
29
|
+
*
|
|
30
|
+
* // With suggestions dropdown
|
|
31
|
+
* <InputTag
|
|
32
|
+
* suggestions={[
|
|
33
|
+
* { id: '1', label: 'React', value: 'react' },
|
|
34
|
+
* { id: '2', label: 'Vue', value: 'vue' },
|
|
35
|
+
* ]}
|
|
36
|
+
* creatable={true}
|
|
37
|
+
* />
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare const InputTag: React.ForwardRefExoticComponent<InputTagProps & React.RefAttributes<HTMLDivElement>>;
|