@flikk/ui 1.0.0-beta.13 → 1.0.0-beta.15
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/CodeBlock/CodeBlock.theme.js +1 -1
- package/dist/components/ai/PromptInput/PromptInput.js +4 -2
- package/dist/components/ai/PromptInput/VoiceRecorder.js +1 -1
- package/dist/components/ai/PromptSuggestions/PromptSuggestion.theme.js +4 -4
- package/dist/components/ai/StreamingResponse/StreamingResponse.js +6 -0
- package/dist/components/ai/ThinkingIndicator/ThinkingIndicator.js +3 -14
- package/dist/components/ai/index.d.ts +0 -5
- package/dist/components/ai/index.js +8 -4
- package/dist/components/charts/DonutChart/DonutChart.js +1 -1
- package/dist/components/charts/DonutChart/MultiSegmentDonutChart.js +1 -1
- package/dist/components/charts/FunnelChart/FunnelChart.js +2 -2
- package/dist/components/charts/shared/ChartLegend/ChartLegend.types.d.ts +13 -1
- package/dist/components/charts/shared/ChartLegend/ChartLegendContent.js +1 -1
- package/dist/components/charts/shared/ChartTooltip/ChartTooltip.types.d.ts +13 -2
- package/dist/components/core/Accordion/AccordionItem.js +1 -1
- package/dist/components/core/Accordion/AccordionTrigger.js +1 -1
- package/dist/components/core/Alert/Alert.animations.d.ts +11 -0
- package/dist/components/core/Alert/Alert.animations.js +44 -0
- package/dist/components/core/Alert/Alert.js +16 -3
- package/dist/components/core/Avatar/Avatar.js +12 -7
- package/dist/components/core/Avatar/Avatar.theme.d.ts +4 -6
- package/dist/components/core/Avatar/Avatar.theme.js +22 -12
- package/dist/components/core/Avatar/Avatar.types.d.ts +9 -0
- package/dist/components/core/AvatarGroup/AvatarGroup.animations.js +2 -2
- package/dist/components/core/AvatarGroup/AvatarGroup.js +1 -2
- package/dist/components/core/AvatarGroup/AvatarGroup.theme.js +1 -1
- package/dist/components/core/Badge/Badge.animations.js +1 -1
- package/dist/components/core/Badge/Badge.js +26 -50
- package/dist/components/core/Badge/Badge.theme.js +49 -63
- package/dist/components/core/Badge/Badge.types.d.ts +6 -30
- package/dist/components/core/Button/Button.js +2 -2
- package/dist/components/core/Button/Button.ripple.js +1 -1
- package/dist/components/core/Button/Button.theme.d.ts +1 -1
- package/dist/components/core/Button/Button.theme.js +5 -5
- package/dist/components/core/Button/Button.types.d.ts +1 -1
- package/dist/components/core/ButtonGroup/ButtonGroup.theme.js +6 -6
- package/dist/components/core/ButtonGroup/ButtonGroupText.js +1 -3
- package/dist/components/core/Calendar/Calendar.js +29 -3
- package/dist/components/core/Calendar/Calendar.theme.js +11 -7
- package/dist/components/core/Calendar/Calendar.types.d.ts +3 -0
- package/dist/components/core/Calendar/CalendarMini/CalendarMini.js +2 -2
- package/dist/components/core/Carousel/CarouselBody.js +0 -1
- package/dist/components/core/CommandPalette/CommandItem.js +1 -1
- package/dist/components/core/CommandPalette/CommandPalette.js +6 -4
- package/dist/components/core/CommandPalette/CommandPalette.theme.js +1 -0
- package/dist/components/core/CommandPalette/CommandPalette.types.d.ts +6 -0
- package/dist/components/core/ContextMenu/ContextMenu.js +5 -4
- package/dist/components/core/ContextMenu/ContextMenuTrigger.js +5 -6
- package/dist/components/core/Drawer/Drawer.d.ts +1 -1
- package/dist/components/core/Drawer/Drawer.js +25 -2
- package/dist/components/core/Drawer/Drawer.theme.js +2 -2
- package/dist/components/core/Drawer/Drawer.types.d.ts +6 -0
- package/dist/components/core/Drawer/DrawerHeader.js +1 -1
- package/dist/components/core/Dropdown/Dropdown.d.ts +1 -1
- package/dist/components/core/Dropdown/Dropdown.js +5 -1
- package/dist/components/core/Dropdown/Dropdown.types.d.ts +1 -0
- package/dist/components/core/Dropdown/DropdownItem.js +1 -1
- package/dist/components/core/Dropdown/DropdownMenu.js +4 -4
- package/dist/components/core/Dropdown/DropdownSection.js +1 -1
- package/dist/components/core/Dropdown/DropdownSeparator.js +1 -1
- package/dist/components/core/Dropdown/DropdownTrigger.d.ts +6 -1
- package/dist/components/core/Dropdown/DropdownTrigger.js +10 -8
- package/dist/components/core/Kbd/Kbd.theme.js +3 -3
- package/dist/components/core/Link/Link.js +4 -2
- package/dist/components/core/Message/Message.d.ts +9 -0
- package/dist/components/core/Message/Message.js +44 -3
- package/dist/components/core/Message/Message.theme.js +22 -0
- package/dist/components/core/Message/Message.types.d.ts +115 -0
- package/dist/components/core/Message/MessageAudio.d.ts +8 -0
- package/dist/components/core/Message/MessageAudio.js +11 -0
- package/dist/components/core/Message/MessageContext.d.ts +3 -1
- package/dist/components/core/Message/MessageDateDivider.d.ts +6 -0
- package/dist/components/core/Message/MessageDateDivider.js +10 -0
- package/dist/components/core/Message/MessageFile.d.ts +9 -0
- package/dist/components/core/Message/MessageFile.js +15 -0
- package/dist/components/core/Message/MessageImage.d.ts +11 -0
- package/dist/components/core/Message/MessageImage.js +13 -0
- package/dist/components/core/Message/MessageLink.d.ts +10 -0
- package/dist/components/core/Message/MessageLink.js +15 -0
- package/dist/components/core/Message/MessageReactions.d.ts +8 -0
- package/dist/components/core/Message/MessageReactions.js +12 -0
- package/dist/components/core/Message/MessageReply.d.ts +8 -0
- package/dist/components/core/Message/MessageReply.js +10 -0
- package/dist/components/core/Message/MessageSenderName.d.ts +6 -0
- package/dist/components/core/Message/MessageSenderName.js +10 -0
- package/dist/components/core/Message/MessageStatusIndicator.d.ts +9 -0
- package/dist/components/core/Message/MessageStatusIndicator.js +45 -0
- package/dist/components/core/Message/index.d.ts +19 -1
- package/dist/components/core/Modal/Modal.animations.d.ts +1 -0
- package/dist/components/core/Modal/Modal.animations.js +14 -11
- package/dist/components/core/Modal/ModalHeader.js +1 -1
- package/dist/components/core/NavItem/NavItem.js +100 -52
- package/dist/components/core/NavItem/NavItem.theme.js +6 -3
- package/dist/components/core/NavItem/NavItem.types.d.ts +44 -30
- package/dist/components/core/NavItem/index.d.ts +1 -1
- package/dist/components/core/Pagination/Pagination.theme.js +1 -1
- package/dist/components/core/Pill/Pill.theme.js +1 -1
- package/dist/components/core/Popover/Popover.d.ts +1 -1
- package/dist/components/core/Popover/PopoverBody.js +2 -2
- package/dist/components/core/Popover/PopoverTrigger.d.ts +1 -1
- package/dist/components/core/Popover/PopoverTrigger.js +11 -11
- package/dist/components/core/Progress/Progress.d.ts +9 -8
- package/dist/components/core/Progress/Progress.js +16 -16
- package/dist/components/core/Progress/Progress.theme.js +5 -16
- package/dist/components/core/Progress/Progress.types.d.ts +2 -20
- package/dist/components/core/Progress/index.d.ts +1 -1
- package/dist/components/core/ScrollArea/ScrollArea.js +49 -7
- package/dist/components/core/ScrollArea/ScrollArea.types.d.ts +12 -3
- package/dist/components/core/ScrollArea/index.d.ts +1 -1
- package/dist/components/core/Segmented/SegmentedItem.js +1 -1
- package/dist/components/core/Sidebar/Sidebar.d.ts +11 -1
- package/dist/components/core/Sidebar/Sidebar.js +51 -17
- package/dist/components/core/Sidebar/Sidebar.theme.js +9 -7
- package/dist/components/core/Sidebar/Sidebar.types.d.ts +57 -0
- package/dist/components/core/Sidebar/SidebarContent.js +3 -1
- package/dist/components/core/Sidebar/SidebarContext.d.ts +14 -0
- package/dist/components/core/Sidebar/SidebarContext.js +63 -11
- package/dist/components/core/Sidebar/SidebarFooter.js +3 -1
- package/dist/components/core/Sidebar/SidebarHeader.js +6 -2
- package/dist/components/core/Sidebar/SidebarMobileTrigger.d.ts +3 -0
- package/dist/components/core/Sidebar/SidebarMobileTrigger.js +29 -0
- package/dist/components/core/Sidebar/SidebarNav.js +3 -2
- package/dist/components/core/Sidebar/SidebarNavGroup.js +4 -2
- package/dist/components/core/Sidebar/SidebarToggle.js +2 -1
- package/dist/components/core/Sidebar/SidebarUserProfile.d.ts +3 -0
- package/dist/components/core/Sidebar/SidebarUserProfile.js +35 -0
- package/dist/components/core/Sidebar/index.d.ts +3 -1
- package/dist/components/core/SocialIcon/SocialIcon.js +1 -1
- package/dist/components/core/Sortable/Sortable.js +2 -2
- package/dist/components/core/Sortable/Sortable.theme.js +1 -1
- package/dist/components/core/Sortable/Sortable.types.d.ts +7 -5
- package/dist/components/core/Tabs/Tabs.theme.d.ts +1 -1
- package/dist/components/core/Tabs/Tabs.theme.js +3 -3
- package/dist/components/core/Tabs/TabsBody.js +1 -1
- package/dist/components/core/Tabs/TabsTrigger.js +1 -1
- package/dist/components/core/Tag/Tag.js +2 -2
- package/dist/components/core/Toast/Toast.d.ts +2 -2
- package/dist/components/core/Toast/Toast.js +30 -21
- package/dist/components/core/Toast/Toast.theme.js +4 -9
- package/dist/components/core/Toast/Toast.types.d.ts +4 -21
- package/dist/components/core/Toast/index.d.ts +1 -1
- package/dist/components/core/Tooltip/Tooltip.js +1 -1
- package/dist/components/core/Tooltip/Tooltip.theme.js +1 -1
- package/dist/components/core/index.js +11 -0
- package/dist/components/data-display/GanttChart/GanttChart.types.d.ts +2 -2
- package/dist/components/data-display/GanttChart/GanttToolbar.js +1 -1
- package/dist/components/data-display/Table/Table.types.d.ts +8 -8
- package/dist/components/effects/CustomCursor/CustomCursor.js +2 -2
- package/dist/components/effects/GlassSurface/GlassSurface.d.ts +1 -1
- package/dist/components/effects/GlassSurface/GlassSurface.js +12 -4
- package/dist/components/effects/InteractiveCharacters/InteractiveCharacters.animations.d.ts +39 -0
- package/dist/components/effects/InteractiveCharacters/InteractiveCharacters.animations.js +98 -0
- package/dist/components/effects/InteractiveCharacters/InteractiveCharacters.d.ts +3 -0
- package/dist/components/effects/InteractiveCharacters/InteractiveCharacters.js +104 -0
- package/dist/components/effects/InteractiveCharacters/InteractiveCharacters.types.d.ts +30 -0
- package/dist/components/effects/InteractiveCharacters/characters/BlobCharacter.d.ts +3 -0
- package/dist/components/effects/InteractiveCharacters/characters/BlobCharacter.js +36 -0
- package/dist/components/effects/InteractiveCharacters/characters/SmallCharacter.d.ts +3 -0
- package/dist/components/effects/InteractiveCharacters/characters/SmallCharacter.js +36 -0
- package/dist/components/effects/InteractiveCharacters/characters/TallCharacter.d.ts +3 -0
- package/dist/components/effects/InteractiveCharacters/characters/TallCharacter.js +37 -0
- package/dist/components/effects/InteractiveCharacters/hooks/useBlink.d.ts +14 -0
- package/dist/components/effects/InteractiveCharacters/hooks/useBlink.js +41 -0
- package/dist/components/effects/InteractiveCharacters/hooks/useIdleAnimation.d.ts +25 -0
- package/dist/components/effects/InteractiveCharacters/hooks/useIdleAnimation.js +84 -0
- package/dist/components/effects/InteractiveCharacters/hooks/useMouseTracking.d.ts +18 -0
- package/dist/components/effects/InteractiveCharacters/hooks/useMouseTracking.js +35 -0
- package/dist/components/effects/InteractiveCharacters/index.d.ts +2 -0
- package/dist/components/effects/MorphingText/MorphingText.d.ts +1 -1
- package/dist/components/effects/MorphingText/MorphingText.js +6 -5
- package/dist/components/effects/Neumorphic/InsetCircleButton.d.ts +9 -0
- package/dist/components/effects/Neumorphic/InsetCircleButton.js +10 -0
- package/dist/components/effects/Neumorphic/InsetPill.d.ts +7 -0
- package/dist/components/effects/Neumorphic/InsetPill.js +7 -0
- package/dist/components/effects/Neumorphic/index.d.ts +4 -0
- package/dist/components/effects/NoiseOverlay/NoiseOverlay.d.ts +1 -1
- package/dist/components/effects/NoiseOverlay/NoiseOverlay.js +4 -4
- package/dist/components/effects/Overlay/Overlay.js +6 -4
- package/dist/components/effects/PageTransition/PageTransition.animations.d.ts +8 -0
- package/dist/components/effects/PageTransition/PageTransition.animations.js +53 -0
- package/dist/components/effects/PageTransition/PageTransition.d.ts +3 -0
- package/dist/components/effects/PageTransition/PageTransition.js +71 -0
- package/dist/components/effects/PageTransition/PageTransition.types.d.ts +15 -0
- package/dist/components/effects/PageTransition/index.d.ts +2 -0
- package/dist/components/effects/index.d.ts +6 -0
- package/dist/components/effects/index.js +4 -0
- package/dist/components/forms/Checkbox/Checkbox.animations.d.ts +14 -0
- package/dist/components/forms/Checkbox/Checkbox.animations.js +53 -0
- package/dist/components/forms/Checkbox/Checkbox.js +4 -2
- package/dist/components/forms/Checkbox/Checkbox.theme.js +3 -3
- package/dist/components/forms/ColorPicker/ColorPicker.types.d.ts +1 -1
- package/dist/components/forms/ColorPicker/ColorPickerBody.js +3 -3
- package/dist/components/forms/Combobox/Combobox.js +5 -3
- package/dist/components/forms/DatePicker/DatePickerBody.js +1 -1
- package/dist/components/forms/DateRangePicker/DateRangePicker.animations.d.ts +1 -0
- package/dist/components/forms/DateRangePicker/DateRangePicker.d.ts +37 -0
- package/dist/components/forms/DateRangePicker/DateRangePicker.js +110 -0
- package/dist/components/forms/DateRangePicker/DateRangePicker.theme.d.ts +5 -0
- package/dist/components/forms/DateRangePicker/DateRangePicker.theme.js +52 -0
- package/dist/components/forms/DateRangePicker/DateRangePicker.types.d.ts +154 -0
- package/dist/components/forms/DateRangePicker/DateRangePickerBody.d.ts +6 -0
- package/dist/components/forms/DateRangePicker/DateRangePickerBody.js +208 -0
- package/dist/components/forms/DateRangePicker/DateRangePickerPresets.d.ts +6 -0
- package/dist/components/forms/DateRangePicker/DateRangePickerPresets.js +41 -0
- package/dist/components/forms/DateRangePicker/DateRangePickerTrigger.d.ts +6 -0
- package/dist/components/forms/DateRangePicker/DateRangePickerTrigger.js +32 -0
- package/dist/components/forms/DateRangePicker/dateRangePresets.d.ts +5 -0
- package/dist/components/forms/DateRangePicker/dateRangePresets.js +59 -0
- package/dist/components/forms/DateRangePicker/index.d.ts +4 -0
- package/dist/components/forms/FileUpload/FileUploadProgress.animations.d.ts +36 -0
- package/dist/components/forms/FileUpload/FileUploadProgress.animations.js +22 -0
- package/dist/components/forms/FileUpload/FileUploadProgress.d.ts +3 -0
- package/dist/components/forms/FileUpload/FileUploadProgress.js +111 -0
- package/dist/components/forms/FileUpload/FileUploadProgress.theme.d.ts +19 -0
- package/dist/components/forms/FileUpload/FileUploadProgress.theme.js +27 -0
- package/dist/components/forms/FileUpload/FileUploadProgress.types.d.ts +33 -0
- package/dist/components/forms/FileUpload/index.d.ts +3 -0
- package/dist/components/forms/Input/Input.js +8 -13
- package/dist/components/forms/Input/Input.types.d.ts +6 -0
- package/dist/components/forms/InputAddress/InputAddress.theme.js +1 -1
- package/dist/components/forms/InputCounter/InputCounter.js +1 -1
- package/dist/components/forms/InputCreditCard/InputCreditCard.theme.js +1 -1
- package/dist/components/forms/InputOTP/InputOTP.theme.js +1 -1
- package/dist/components/forms/Radio/Radio.animations.d.ts +10 -0
- package/dist/components/forms/Radio/Radio.animations.js +33 -0
- package/dist/components/forms/Radio/Radio.js +11 -2
- package/dist/components/forms/Radio/Radio.theme.js +3 -3
- package/dist/components/forms/RichTextEditor/RichTextEditor.js +23 -14
- package/dist/components/forms/RichTextEditor/RichTextEditor.theme.js +2 -2
- package/dist/components/forms/RichTextEditor/RichTextEditor.types.d.ts +11 -0
- package/dist/components/forms/Select/Select.d.ts +1 -1
- package/dist/components/forms/Select/Select.js +7 -7
- package/dist/components/forms/Select/Select.types.d.ts +3 -3
- package/dist/components/forms/SelectableCard/SelectableCard.js +1 -1
- package/dist/components/forms/Slider/Slider.theme.js +1 -1
- package/dist/components/forms/Switch/Switch.theme.js +3 -3
- package/dist/components/forms/forms.theme.js +1 -1
- package/dist/components/forms/index.d.ts +6 -0
- package/dist/components/forms/index.js +8 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useMediaQuery.d.ts +5 -0
- package/dist/hooks/useMediaQuery.js +21 -0
- package/dist/index.js +23 -0
- package/dist/styles.css +1 -1
- package/dist/utils/dateUtils.js +56 -5
- package/dist/utils/formatUtils.d.ts +10 -0
- package/dist/utils/formatUtils.js +24 -0
- package/dist/utils/index.d.ts +1 -1
- package/package.json +12 -4
- package/src/global.scss +320 -39
- package/src/styles/theme.css +151 -62
- package/src/theme-plugin.css +13 -0
- package/dist/components/ai/ApprovalCard/ApprovalCard.d.ts +0 -3
- package/dist/components/ai/ApprovalCard/ApprovalCard.js +0 -16
- package/dist/components/ai/ApprovalCard/ApprovalCard.theme.d.ts +0 -13
- package/dist/components/ai/ApprovalCard/ApprovalCard.theme.js +0 -15
- package/dist/components/ai/ApprovalCard/ApprovalCard.types.d.ts +0 -43
- package/dist/components/ai/ApprovalCard/index.d.ts +0 -2
- package/dist/components/ai/MessageHistory/MessageHistory.d.ts +0 -18
- package/dist/components/ai/MessageHistory/MessageHistory.js +0 -98
- package/dist/components/ai/MessageHistory/MessageHistory.theme.d.ts +0 -2
- package/dist/components/ai/MessageHistory/MessageHistory.theme.js +0 -8
- package/dist/components/ai/MessageHistory/MessageHistory.types.d.ts +0 -94
- package/dist/components/ai/MessageHistory/index.d.ts +0 -3
- package/dist/icons/Icon.d.ts +0 -24
- package/dist/icons/Icon.js +0 -30
- package/dist/icons/Index.d.ts +0 -16
- package/dist/icons/core/ChevronUpDown.d.ts +0 -1
- package/dist/icons/core/ChevronUpDown.js +0 -7
- package/dist/icons/core/DollarIcon.d.ts +0 -1
- package/dist/icons/core/DollarIcon.js +0 -5
- package/dist/icons/core/LockIcon.d.ts +0 -1
- package/dist/icons/core/LockIcon.js +0 -5
- package/dist/icons/core/MinusIcon.d.ts +0 -1
- package/dist/icons/core/MinusIcon.js +0 -7
- package/dist/icons/core/PlusIcon.d.ts +0 -1
- package/dist/icons/core/PlusIcon.js +0 -7
- package/dist/icons/core/SearchIcon.d.ts +0 -1
- package/dist/icons/core/SearchIcon.js +0 -7
- package/dist/icons/core/TickIcon.d.ts +0 -1
- package/dist/icons/core/TickIcon.js +0 -5
- package/dist/icons/core/User.d.ts +0 -1
- package/dist/utils/useClickOutside.d.ts +0 -1
|
@@ -4,12 +4,7 @@ import { FormLabel } from '../FormLabel/FormLabel.js';
|
|
|
4
4
|
import { inputTheme } from './Input.theme.js';
|
|
5
5
|
import { cn } from '../../../utils/cn.js';
|
|
6
6
|
import { LockClosedIcon, EyeSlashIcon, EyeIcon } from '@heroicons/react/24/solid';
|
|
7
|
-
import { PlusIcon } from '
|
|
8
|
-
import { MinusIcon } from '../../../icons/core/MinusIcon.js';
|
|
9
|
-
import { SearchIcon } from '../../../icons/core/SearchIcon.js';
|
|
10
|
-
import '../../../icons/core/LockIcon.js';
|
|
11
|
-
import '../../../icons/core/DollarIcon.js';
|
|
12
|
-
import '../../../icons/core/TickIcon.js';
|
|
7
|
+
import { MagnifyingGlassIcon, MinusIcon, PlusIcon } from '@heroicons/react/24/outline';
|
|
13
8
|
import { validateMaskedInput, applyInputMask, getAdjustedCursorPosition } from './inputMasks.js';
|
|
14
9
|
|
|
15
10
|
const PasswordToggleButton = ({ showPassword, onToggle, passwordToggleClasses, }) => {
|
|
@@ -31,10 +26,10 @@ const NumberButtons = ({ isDisabled, isAtMax, isAtMin, onIncrement, onDecrement,
|
|
|
31
26
|
return (jsxs("div", { className: numberButtonsContainerClasses, children: [jsx("button", { type: "button", className: `${numberButtonClasses}`, onClick: (e) => {
|
|
32
27
|
e.stopPropagation();
|
|
33
28
|
onDecrement();
|
|
34
|
-
}, disabled: isDisabled || isAtMin, "aria-label": "Decrease value", tabIndex: -1, children: jsx(MinusIcon, {
|
|
29
|
+
}, disabled: isDisabled || isAtMin, "aria-label": "Decrease value", tabIndex: -1, children: jsx(MinusIcon, { className: cn("size-4", decrementIconStyle), "aria-hidden": "true" }) }), jsx("button", { type: "button", className: `${numberButtonClasses}`, onClick: (e) => {
|
|
35
30
|
e.stopPropagation();
|
|
36
31
|
onIncrement();
|
|
37
|
-
}, disabled: isDisabled || isAtMax, "aria-label": "Increase value", tabIndex: -1, children: jsx(PlusIcon, {
|
|
32
|
+
}, disabled: isDisabled || isAtMax, "aria-label": "Increase value", tabIndex: -1, children: jsx(PlusIcon, { className: cn("size-4", incrementIconStyle), "aria-hidden": "true" }) })] }));
|
|
38
33
|
};
|
|
39
34
|
const getActiveDots = (strength) => {
|
|
40
35
|
switch (strength) {
|
|
@@ -72,7 +67,7 @@ const PasswordStrengthIndicator = ({ inline = false, passwordStrengthIndicator,
|
|
|
72
67
|
// ============================================================================
|
|
73
68
|
// Main Input Component
|
|
74
69
|
// ============================================================================
|
|
75
|
-
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, onFocus, onBlur, value, currencyDecimalPlaces, ...props }, ref) => {
|
|
70
|
+
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, onFocus, onBlur, value, currencyDecimalPlaces, darkMode = false, ...props }, ref) => {
|
|
76
71
|
const [isFocused, setIsFocused] = useState(false);
|
|
77
72
|
const [showPassword, setShowPassword] = useState(false);
|
|
78
73
|
const generatedId = React__default.useId();
|
|
@@ -88,7 +83,7 @@ const Input = React__default.forwardRef(({ size = "md", state = "default", class
|
|
|
88
83
|
const cursorPositionRef = useRef(null);
|
|
89
84
|
// Default icons based on input type
|
|
90
85
|
const defaultPasswordIcon = type === "password" && !iconStart ? (jsx(LockClosedIcon, { className: "size-5 text-[var(--color-text-muted)]" })) : null;
|
|
91
|
-
const defaultSearchIcon = type === "search" && !iconStart ? (jsx(
|
|
86
|
+
const defaultSearchIcon = type === "search" && !iconStart ? (jsx(MagnifyingGlassIcon, { className: cn("size-5", inputTheme.typeStyles.search.iconStyle) })) : null;
|
|
92
87
|
// Use the provided iconStart or the default icon based on input type
|
|
93
88
|
const finalLeftIcon = iconStart || defaultPasswordIcon || defaultSearchIcon;
|
|
94
89
|
// Derived state flags for internal use
|
|
@@ -275,14 +270,14 @@ const Input = React__default.forwardRef(({ size = "md", state = "default", class
|
|
|
275
270
|
numberValue !== undefined &&
|
|
276
271
|
typeof min === "number" &&
|
|
277
272
|
numberValue <= min;
|
|
278
|
-
return (jsxs("div", { className: cn(wrapperClasses, stateClass, wrapperClassName), children: [label && (typeof label === 'string' ? (jsxs("div", { className: "flex justify-between items-center", children: [jsx(FormLabel, { htmlFor: inputId, className: labelClassName, state: state, required: required, children: label }), showStrengthWithLabel && (jsx(PasswordStrengthIndicator, { inline: true, passwordStrengthIndicator: passwordStrengthIndicator }))] })) : (jsxs("div", { className: "flex justify-between items-center", children: [label, showStrengthWithLabel && (jsx(PasswordStrengthIndicator, { inline: true, passwordStrengthIndicator: passwordStrengthIndicator }))] }))), jsx("div", { children: jsxs("div", { className: cn(inputGroupClasses, stateClasses, isFocused && (isInvalid ? inputTheme.inputGroupFocusInvalidStyle : inputTheme.inputGroupFocusStyle), inputGroupClassName), onClick: handleInputGroupClick, role: "presentation", children: [hasContentStart && (jsx("div", { "data-slot": "content-start", className: cn(contentStyleClasses, contentStartStyle), children: contentStart })), jsxs("div", { className: "relative flex-1", children: [jsx("input", { ref: setInputRef, id: inputId, type: actualInputType, className: cn(baseClasses, sizeClasses, hasLeftIcon && iconStartPadding, (hasRightIcon || isPasswordField || displayNumberControls) &&
|
|
279
|
-
iconEndPadding, className), disabled: isDisabled, "aria-invalid": isInvalid, required: required, min: min, max: max, step: step, value: value, onChange: handleInputChange, onFocus: (e) => {
|
|
273
|
+
return (jsxs("div", { className: cn(wrapperClasses, stateClass, darkMode && "dark", wrapperClassName), children: [label && (typeof label === 'string' ? (jsxs("div", { className: "flex justify-between items-center", children: [jsx(FormLabel, { htmlFor: inputId, className: labelClassName, state: state, required: required, children: label }), showStrengthWithLabel && (jsx(PasswordStrengthIndicator, { inline: true, passwordStrengthIndicator: passwordStrengthIndicator }))] })) : (jsxs("div", { className: "flex justify-between items-center", children: [label, showStrengthWithLabel && (jsx(PasswordStrengthIndicator, { inline: true, passwordStrengthIndicator: passwordStrengthIndicator }))] }))), jsx("div", { children: jsxs("div", { className: cn(inputGroupClasses, stateClasses, isFocused && (isInvalid ? inputTheme.inputGroupFocusInvalidStyle : inputTheme.inputGroupFocusStyle), inputGroupClassName), onClick: handleInputGroupClick, role: "presentation", children: [hasContentStart && (jsx("div", { "data-slot": "content-start", className: cn(contentStyleClasses, contentStartStyle), children: contentStart })), jsxs("div", { className: "relative flex-1", children: [jsx("input", { ref: setInputRef, id: inputId, type: actualInputType, className: cn(baseClasses, sizeClasses, hasLeftIcon && iconStartPadding, (hasRightIcon || isPasswordField || displayNumberControls) &&
|
|
274
|
+
iconEndPadding, className), disabled: isDisabled, "aria-invalid": isInvalid, "aria-describedby": helperText ? `${inputId}-helper` : undefined, required: required, min: min, max: max, step: step, value: value, onChange: handleInputChange, onFocus: (e) => {
|
|
280
275
|
setIsFocused(true);
|
|
281
276
|
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
|
|
282
277
|
}, onBlur: (e) => {
|
|
283
278
|
setIsFocused(false);
|
|
284
279
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
285
|
-
}, placeholder: props.placeholder, ...props }), hasLeftIcon && (jsx("div", { className: iconStartClasses, children: finalLeftIcon })), hasRightIcon && !isPasswordField && !displayNumberControls && (jsx("div", { className: iconEndClasses, children: iconEnd })), isPasswordField && (jsx(PasswordToggleButton, { showPassword: showPassword, onToggle: handleTogglePassword, passwordToggleClasses: passwordToggleClasses })), displayNumberControls && (jsx(NumberButtons, { isDisabled: isDisabled, isAtMax: isAtMax, isAtMin: isAtMin, onIncrement: handleIncrement, onDecrement: handleDecrement, numberButtonsContainerClasses: numberButtonsContainerClasses, numberButtonClasses: numberButtonClasses })), hasKeyboardShortcut && (jsx("div", { className: inputTheme.keyboardShortcutStyle, children: keyboardShortcut }))] }), hasContentEnd && (jsx("div", { "data-slot": "content-end", className: cn(contentStyleClasses, contentEndStyle), children: contentEnd }))] }) }), showStrengthBelow && jsx(PasswordStrengthIndicator, { inline: false, passwordStrengthIndicator: passwordStrengthIndicator }), helperText && (typeof helperText === 'string' ? (jsx("div", { className: cn(helperTextClasses, helperTextClassName), children: helperText })) : (helperText))] }));
|
|
280
|
+
}, placeholder: props.placeholder, ...props }), hasLeftIcon && (jsx("div", { className: iconStartClasses, children: finalLeftIcon })), hasRightIcon && !isPasswordField && !displayNumberControls && (jsx("div", { className: iconEndClasses, children: iconEnd })), isPasswordField && (jsx(PasswordToggleButton, { showPassword: showPassword, onToggle: handleTogglePassword, passwordToggleClasses: passwordToggleClasses })), displayNumberControls && (jsx(NumberButtons, { isDisabled: isDisabled, isAtMax: isAtMax, isAtMin: isAtMin, onIncrement: handleIncrement, onDecrement: handleDecrement, numberButtonsContainerClasses: numberButtonsContainerClasses, numberButtonClasses: numberButtonClasses })), hasKeyboardShortcut && (jsx("div", { className: inputTheme.keyboardShortcutStyle, children: keyboardShortcut }))] }), hasContentEnd && (jsx("div", { "data-slot": "content-end", className: cn(contentStyleClasses, contentEndStyle), children: contentEnd }))] }) }), showStrengthBelow && jsx(PasswordStrengthIndicator, { inline: false, passwordStrengthIndicator: passwordStrengthIndicator }), helperText && (typeof helperText === 'string' ? (jsx("div", { id: `${inputId}-helper`, className: cn(helperTextClasses, helperTextClassName), children: helperText })) : (helperText))] }));
|
|
286
281
|
});
|
|
287
282
|
Input.displayName = "Input";
|
|
288
283
|
|
|
@@ -61,6 +61,12 @@ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElem
|
|
|
61
61
|
passwordStrengthIndicator?: PasswordStrengthIndicator;
|
|
62
62
|
/** Number of decimal places for currency inputs (default: 2). Only applies when type="currency" */
|
|
63
63
|
currencyDecimalPlaces?: number;
|
|
64
|
+
/**
|
|
65
|
+
* Force dark mode styling for the component. Use when placing the component
|
|
66
|
+
* on a dark background while the page is in light mode.
|
|
67
|
+
* @default false
|
|
68
|
+
*/
|
|
69
|
+
darkMode?: boolean;
|
|
64
70
|
}
|
|
65
71
|
export type InputSize = 'sm' | 'md' | 'lg';
|
|
66
72
|
export type InputState = 'default' | 'disabled' | 'invalid';
|
|
@@ -23,7 +23,7 @@ const inputAddressTheme = {
|
|
|
23
23
|
postalCodeInput: {
|
|
24
24
|
...inputTheme,
|
|
25
25
|
},
|
|
26
|
-
chevronStyles: 'pointer-events-none col-start-1 row-start-1 mr-2 size-5 self-center justify-self-end text-
|
|
26
|
+
chevronStyles: 'pointer-events-none col-start-1 row-start-1 mr-2 size-5 self-center justify-self-end text-[var(--color-text-muted)] sm:size-4',
|
|
27
27
|
};
|
|
28
28
|
/**
|
|
29
29
|
* Styled theme matching the reference design
|
|
@@ -33,7 +33,7 @@ import { MinusIcon, PlusIcon } from '@heroicons/react/24/outline';
|
|
|
33
33
|
* );
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
|
-
const InputCounter = React__default.forwardRef(({ value, onChange, min, max, step = 1, disabled = false, decimalPlaces, formatNumber = (n) => n.toString(), className, buttonProps, theme, transition = { type: "spring", bounce: 0, stiffness: 300, damping: 30 }, "aria-label": ariaLabel = "Counter", ...props }, ref) => {
|
|
36
|
+
const InputCounter = React__default.forwardRef(({ value, onChange, min, max, step = 1, disabled = false, decimalPlaces, formatNumber = (n) => n.toString(), className, buttonProps, theme, transition = { type: "spring", bounce: 0, stiffness: 300, damping: 30 }, "aria-label": ariaLabel = "Counter", onAnimationStart, onAnimationEnd, onDrag, onDragStart, onDragEnd, ...props }, ref) => {
|
|
37
37
|
const shouldReduceMotion = useReducedMotion();
|
|
38
38
|
const shouldDisableAnimations = !!shouldReduceMotion;
|
|
39
39
|
// Auto-detect decimal places from step if not explicitly provided
|
|
@@ -26,7 +26,7 @@ const inputCreditCardTheme = {
|
|
|
26
26
|
cvcInput: {
|
|
27
27
|
...inputTheme,
|
|
28
28
|
},
|
|
29
|
-
chevronStyles: 'pointer-events-none col-start-1 row-start-1 mr-2 size-5 self-center justify-self-end text-
|
|
29
|
+
chevronStyles: 'pointer-events-none col-start-1 row-start-1 mr-2 size-5 self-center justify-self-end text-[var(--color-text-muted)] sm:size-4',
|
|
30
30
|
};
|
|
31
31
|
/**
|
|
32
32
|
* Styled theme matching the reference design
|
|
@@ -10,7 +10,7 @@ const inputOTPTheme = {
|
|
|
10
10
|
// OTP input container
|
|
11
11
|
containerStyle: 'flex items-center gap-3',
|
|
12
12
|
// Individual input field styles with design tokens
|
|
13
|
-
inputStyle: 'text-center text-xl text-[var(--color-text-primary)] h-full',
|
|
13
|
+
inputStyle: 'text-center text-xl text-[var(--color-text-primary)] h-full !p-0',
|
|
14
14
|
// Input group wrapper for grouped inputs (overrides default Input styling)
|
|
15
15
|
inputGroupStyle: 'w-10 min-w-10 h-10 min-h-10 sm:w-12 sm:min-w-12 sm:h-12 sm:min-h-12',
|
|
16
16
|
// Separator between input groups
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Variants } from "motion/react";
|
|
2
|
+
/**
|
|
3
|
+
* Radio dot spring animation
|
|
4
|
+
* Scales in with a subtle bounce on select, fades out smoothly on deselect
|
|
5
|
+
*/
|
|
6
|
+
export declare const radioDotVariants: Variants;
|
|
7
|
+
/**
|
|
8
|
+
* Reduced motion variants — instant opacity toggle, no scale
|
|
9
|
+
*/
|
|
10
|
+
export declare const reducedMotionDotVariants: Variants;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Radio dot spring animation
|
|
3
|
+
* Scales in with a subtle bounce on select, fades out smoothly on deselect
|
|
4
|
+
*/
|
|
5
|
+
const radioDotVariants = {
|
|
6
|
+
unchecked: {
|
|
7
|
+
scale: 0,
|
|
8
|
+
opacity: 0,
|
|
9
|
+
transition: {
|
|
10
|
+
duration: 0.15,
|
|
11
|
+
ease: "easeOut",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
checked: {
|
|
15
|
+
scale: 1,
|
|
16
|
+
opacity: 1,
|
|
17
|
+
transition: {
|
|
18
|
+
type: "spring",
|
|
19
|
+
stiffness: 400,
|
|
20
|
+
damping: 15,
|
|
21
|
+
mass: 0.5,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Reduced motion variants — instant opacity toggle, no scale
|
|
27
|
+
*/
|
|
28
|
+
const reducedMotionDotVariants = {
|
|
29
|
+
unchecked: { opacity: 0 },
|
|
30
|
+
checked: { opacity: 1 },
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { radioDotVariants, reducedMotionDotVariants };
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import React__default, { useId } from 'react';
|
|
2
|
+
import React__default, { useId, useState } from 'react';
|
|
3
|
+
import { useReducedMotion, motion } from 'motion/react';
|
|
3
4
|
import { radioTheme } from './Radio.theme.js';
|
|
4
5
|
import { formLabelTheme } from '../FormLabel/FormLabel.theme.js';
|
|
5
6
|
import { cn } from '../../../utils/cn.js';
|
|
6
7
|
import { useRadioGroupContext } from './RadioContext.js';
|
|
7
8
|
import { RadioGroup } from './RadioGroup.js';
|
|
9
|
+
import { reducedMotionDotVariants, radioDotVariants } from './Radio.animations.js';
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* Radio component for selecting one option from a group
|
|
@@ -12,6 +14,7 @@ import { RadioGroup } from './RadioGroup.js';
|
|
|
12
14
|
const RadioComponent = React__default.forwardRef(({ id: idProp, name: nameProp, value, checked: checkedProp, defaultChecked, onChange, label, description, state: stateProp = "default", size: sizeProp = "md", className, ...restProps }, ref) => {
|
|
13
15
|
var _a, _b, _c, _d;
|
|
14
16
|
const autoId = useId();
|
|
17
|
+
const shouldReduceMotion = useReducedMotion();
|
|
15
18
|
const groupContext = useRadioGroupContext();
|
|
16
19
|
// Resolve props from group context or individual props
|
|
17
20
|
const id = idProp !== null && idProp !== void 0 ? idProp : autoId;
|
|
@@ -23,9 +26,15 @@ const RadioComponent = React__default.forwardRef(({ id: idProp, name: nameProp,
|
|
|
23
26
|
const isInGroup = groupContext !== undefined;
|
|
24
27
|
const checked = isInGroup ? groupContext.value === value : checkedProp;
|
|
25
28
|
const isControlled = checked !== undefined;
|
|
29
|
+
// Track internal state for uncontrolled radios (defaultChecked)
|
|
30
|
+
const [internalChecked, setInternalChecked] = useState(defaultChecked !== null && defaultChecked !== void 0 ? defaultChecked : false);
|
|
31
|
+
const isChecked = isControlled ? !!checked : internalChecked;
|
|
26
32
|
const handleChange = (e) => {
|
|
27
33
|
if (isDisabled)
|
|
28
34
|
return;
|
|
35
|
+
if (!isControlled) {
|
|
36
|
+
setInternalChecked(e.target.checked);
|
|
37
|
+
}
|
|
29
38
|
if (isInGroup) {
|
|
30
39
|
groupContext.onChange(value);
|
|
31
40
|
}
|
|
@@ -34,7 +43,7 @@ const RadioComponent = React__default.forwardRef(({ id: idProp, name: nameProp,
|
|
|
34
43
|
const inputProps = isControlled
|
|
35
44
|
? { checked }
|
|
36
45
|
: { defaultChecked };
|
|
37
|
-
return (jsxs("div", { className: cn(radioTheme.baseStyle, className), ...restProps, children: [jsxs("div", { className: cn(radioTheme.inputContainerStyle, radioTheme.sizes[size]), children: [jsx("input", { ref: ref, type: "radio", id: id, name: name, value: value, ...inputProps, onChange: handleChange, disabled: isDisabled, "aria-describedby": description ? `${id}-description` : undefined, "data-state": isDisabled ? "disabled" : "default", className: cn("peer", radioTheme.inputStyle, radioTheme.sizes[size]) }), jsx(
|
|
46
|
+
return (jsxs("div", { className: cn(radioTheme.baseStyle, className), ...restProps, children: [jsxs("div", { className: cn(radioTheme.inputContainerStyle, radioTheme.sizes[size]), children: [jsx("input", { ref: ref, type: "radio", id: id, name: name, value: value, ...inputProps, onChange: handleChange, disabled: isDisabled, "aria-describedby": description ? `${id}-description` : undefined, "data-state": isDisabled ? "disabled" : "default", className: cn("peer", radioTheme.inputStyle, radioTheme.sizes[size]) }), jsx(motion.div, { className: cn(radioTheme.dotStyle, isDisabled && "saturate-0 opacity-80", size === "sm" ? "size-2.5" : "size-3"), initial: false, animate: isChecked ? "checked" : "unchecked", variants: shouldReduceMotion ? reducedMotionDotVariants : radioDotVariants })] }), (label || description) && (jsxs("label", { htmlFor: id, className: cn("cursor-pointer", isDisabled && "cursor-not-allowed"), children: [label && (typeof label === 'string' ? (jsx("span", { className: cn(formLabelTheme.baseStyle, formLabelTheme.stateStyles[state], "mb-0"), children: label })) : label), description && (typeof description === 'string' ? (jsx("div", { id: `${id}-description`, className: radioTheme.descriptionStyle, children: description })) : description)] }))] }));
|
|
38
47
|
});
|
|
39
48
|
RadioComponent.displayName = "Radio";
|
|
40
49
|
const Radio = Object.assign(RadioComponent, { Group: RadioGroup });
|
|
@@ -9,11 +9,11 @@ const radioTheme = {
|
|
|
9
9
|
// Default state - light
|
|
10
10
|
"border-[var(--color-border)] bg-[var(--color-surface)] " +
|
|
11
11
|
// Default state - dark
|
|
12
|
-
"dark:bg-[var(--color-background-
|
|
12
|
+
"dark:bg-[var(--color-background-tertiary)] " +
|
|
13
13
|
// Checked state - light
|
|
14
14
|
"checked:border-[var(--color-primary)] " +
|
|
15
15
|
// Checked state - dark
|
|
16
|
-
" " +
|
|
16
|
+
"checked:bg-[var(--color-neutral-200)] " +
|
|
17
17
|
// Checked outline - light
|
|
18
18
|
"checked:outline-2 checked:outline-[var(--color-primary-100)] checked:outline-offset-1 " +
|
|
19
19
|
// Checked outline - dark
|
|
@@ -28,7 +28,7 @@ const radioTheme = {
|
|
|
28
28
|
// Disabled state - dark
|
|
29
29
|
"dark:disabled:bg-[var(--color-neutral-700)] dark:disabled:border-[var(--color-neutral-600)] " +
|
|
30
30
|
"dark:data-[state=disabled]:bg-[var(--color-neutral-700)] dark:data-[state=disabled]:border-[var(--color-neutral-600)]",
|
|
31
|
-
dotStyle: "absolute inset-0 m-auto pointer-events-none rounded-full bg-[var(--color-primary)]
|
|
31
|
+
dotStyle: "absolute inset-0 m-auto pointer-events-none rounded-full bg-[var(--color-primary)]",
|
|
32
32
|
descriptionStyle: "text-base text-[var(--color-text-secondary)]/80 mt-0.5",
|
|
33
33
|
sizes: {
|
|
34
34
|
sm: "size-5 mt-0.25",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import React__default, { useState, useRef, useMemo,
|
|
2
|
+
import React__default, { useState, useCallback, useRef, useMemo, useEffect } from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
4
|
import { useReducedMotion, AnimatePresence, motion } from 'motion/react';
|
|
5
5
|
import { FormLabel } from '../FormLabel/FormLabel.js';
|
|
@@ -73,7 +73,7 @@ const DEFAULT_TOOLBAR = {
|
|
|
73
73
|
"redo",
|
|
74
74
|
],
|
|
75
75
|
};
|
|
76
|
-
const RichTextEditor = React__default.forwardRef(({ size = "md", state = "default", className = "", label, labelClassName = "", helperText, helperTextClassName = "", value = "", onChange, placeholder = "Start typing...", id, required, minHeight = 120, maxHeight, toolbar: toolbarProp = DEFAULT_TOOLBAR, theme = {}, ...props }, ref) => {
|
|
76
|
+
const RichTextEditor = React__default.forwardRef(({ size = "md", state = "default", className = "", label, labelClassName = "", helperText, helperTextClassName = "", value = "", onChange, placeholder = "Start typing...", id, required, minHeight = 120, maxHeight, toolbar: toolbarProp = DEFAULT_TOOLBAR, theme = {}, sanitize, ...props }, ref) => {
|
|
77
77
|
const [isFocused, setIsFocused] = useState(false);
|
|
78
78
|
const [showToolbar, setShowToolbar] = useState(false);
|
|
79
79
|
const [toolbarPosition, setToolbarPosition] = useState({ top: 0, left: 0 });
|
|
@@ -82,6 +82,15 @@ const RichTextEditor = React__default.forwardRef(({ size = "md", state = "defaul
|
|
|
82
82
|
const [showColorPicker, setShowColorPicker] = useState(false);
|
|
83
83
|
const shouldReduceMotion = useReducedMotion();
|
|
84
84
|
const isClient = useIsClient();
|
|
85
|
+
// Built-in basic sanitizer: strips <script> tags and on* event handlers
|
|
86
|
+
const sanitizeHtml = useCallback((html) => {
|
|
87
|
+
if (sanitize)
|
|
88
|
+
return sanitize(html);
|
|
89
|
+
// Basic sanitization — strips script tags and inline event handlers
|
|
90
|
+
return html
|
|
91
|
+
.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '')
|
|
92
|
+
.replace(/\bon\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, '');
|
|
93
|
+
}, [sanitize]);
|
|
85
94
|
const editorRef = useRef(null);
|
|
86
95
|
const toolbarRef = useRef(null);
|
|
87
96
|
const fontSizeTriggerRef = useRef(null);
|
|
@@ -512,10 +521,10 @@ const RichTextEditor = React__default.forwardRef(({ size = "md", state = "defaul
|
|
|
512
521
|
}, [toolbarConfig.position]);
|
|
513
522
|
useEffect(() => {
|
|
514
523
|
if (editorRef.current && value !== editorRef.current.innerHTML) {
|
|
515
|
-
editorRef.current.innerHTML = value;
|
|
524
|
+
editorRef.current.innerHTML = sanitizeHtml(value);
|
|
516
525
|
updateFormattingState();
|
|
517
526
|
}
|
|
518
|
-
}, [updateFormattingState, value]);
|
|
527
|
+
}, [updateFormattingState, value, sanitizeHtml]);
|
|
519
528
|
const renderToolbarTool = (tool, index) => {
|
|
520
529
|
var _a, _b;
|
|
521
530
|
const isActive = tool === "bold"
|
|
@@ -540,11 +549,11 @@ const RichTextEditor = React__default.forwardRef(({ size = "md", state = "defaul
|
|
|
540
549
|
};
|
|
541
550
|
switch (tool) {
|
|
542
551
|
case "bold":
|
|
543
|
-
return (jsx(Button, { size: "sm", color: "neutral", variant: "
|
|
552
|
+
return (jsx(Button, { size: "sm", color: "neutral", variant: "soft", iconOnly: true, className: cn(themeStyles.toolbarButtonStyle), "data-state": isActive ? "active" : "inactive", "data-pressed": isActive ? "true" : "false", onMouseDown: handleMouseDown, onClick: handleBold, disabled: isDisabled, "aria-label": "Bold", "aria-pressed": isActive ? "true" : "false", children: jsx(BoldIcon, { className: "w-4 h-4" }) }, index));
|
|
544
553
|
case "italic":
|
|
545
|
-
return (jsx(Button, { size: "sm", color: "neutral", variant: "
|
|
554
|
+
return (jsx(Button, { size: "sm", color: "neutral", variant: "soft", iconOnly: true, className: cn(themeStyles.toolbarButtonStyle), "data-state": isActive ? "active" : "inactive", "data-pressed": isActive ? "true" : "false", onMouseDown: handleMouseDown, onClick: handleItalic, disabled: isDisabled, "aria-label": "Italic", "aria-pressed": isActive ? "true" : "false", children: jsx(ItalicIcon, { className: "w-4 h-4" }) }, index));
|
|
546
555
|
case "underline":
|
|
547
|
-
return (jsx(Button, { size: "sm", color: "neutral", variant: "
|
|
556
|
+
return (jsx(Button, { size: "sm", color: "neutral", variant: "soft", iconOnly: true, className: cn(themeStyles.toolbarButtonStyle), "data-state": isActive ? "active" : "inactive", "data-pressed": isActive ? "true" : "false", onMouseDown: handleMouseDown, onClick: handleUnderline, disabled: isDisabled, "aria-label": "Underline", "aria-pressed": isActive ? "true" : "false", children: jsx(UnderlineIcon, { className: "w-4 h-4" }) }, index));
|
|
548
557
|
case "fontSize": {
|
|
549
558
|
const currentOption = getFontSizeOption(formattingState.fontSize);
|
|
550
559
|
const dropdownClassName = themeStyles.dropdownStyle;
|
|
@@ -584,7 +593,7 @@ const RichTextEditor = React__default.forwardRef(({ size = "md", state = "defaul
|
|
|
584
593
|
fontSizePortalContentRef.current = null;
|
|
585
594
|
}
|
|
586
595
|
}
|
|
587
|
-
return (jsxs("div", { className: "relative", "data-tool": "fontSize", children: [jsx(Button, { ref: fontSizeTriggerRef, size: "sm", color: "neutral", variant: "
|
|
596
|
+
return (jsxs("div", { className: "relative", "data-tool": "fontSize", children: [jsx(Button, { ref: fontSizeTriggerRef, size: "sm", color: "neutral", variant: "soft", className: cn(themeStyles.toolbarButtonStyle, "px-2 min-w-[3rem] gap-1"), "data-state": isActive ? "active" : "inactive", "data-pressed": isActive ? "true" : "false", onMouseDown: handleMouseDown, onClick: (event) => {
|
|
588
597
|
event.preventDefault();
|
|
589
598
|
event.stopPropagation();
|
|
590
599
|
focusEditor();
|
|
@@ -629,7 +638,7 @@ const RichTextEditor = React__default.forwardRef(({ size = "md", state = "defaul
|
|
|
629
638
|
colorPortalContentRef.current = null;
|
|
630
639
|
}
|
|
631
640
|
}
|
|
632
|
-
return (jsxs("div", { className: "relative", "data-tool": "textColor", children: [jsx(Button, { ref: colorTriggerRef, size: "sm", color: "neutral", variant: "
|
|
641
|
+
return (jsxs("div", { className: "relative", "data-tool": "textColor", children: [jsx(Button, { ref: colorTriggerRef, size: "sm", color: "neutral", variant: "soft", iconOnly: true, className: cn(themeStyles.toolbarButtonStyle), onMouseDown: handleMouseDown, onClick: (event) => {
|
|
633
642
|
event.preventDefault();
|
|
634
643
|
event.stopPropagation();
|
|
635
644
|
focusEditor();
|
|
@@ -638,27 +647,27 @@ const RichTextEditor = React__default.forwardRef(({ size = "md", state = "defaul
|
|
|
638
647
|
}, disabled: isDisabled, "aria-label": "Text Color", "aria-expanded": showColorPicker, children: jsx(PaintBrushIcon, { className: "w-4 h-4" }) }), isFloatingToolbar ? null : renderedColorDropdown, isFloatingToolbar ? renderedColorDropdown : null] }, index));
|
|
639
648
|
}
|
|
640
649
|
case "alignLeft":
|
|
641
|
-
return (jsx(Button, { size: "sm", color: "neutral", variant: "
|
|
650
|
+
return (jsx(Button, { size: "sm", color: "neutral", variant: "soft", iconOnly: true, className: cn(themeStyles.toolbarButtonStyle), "data-state": isActive ? "active" : "inactive", "data-pressed": isActive ? "true" : "false", onMouseDown: handleMouseDown, onClick: (event) => {
|
|
642
651
|
event.preventDefault();
|
|
643
652
|
event.stopPropagation();
|
|
644
653
|
handleAlign("left");
|
|
645
654
|
}, disabled: isDisabled, "aria-label": "Align Left", "aria-pressed": isActive ? "true" : "false", children: jsx(Bars3BottomLeftIcon, { className: "w-4 h-4" }) }, index));
|
|
646
655
|
case "alignCenter":
|
|
647
|
-
return (jsx(Button, { size: "sm", color: "neutral", variant: "
|
|
656
|
+
return (jsx(Button, { size: "sm", color: "neutral", variant: "soft", iconOnly: true, className: cn(themeStyles.toolbarButtonStyle), "data-state": isActive ? "active" : "inactive", "data-pressed": isActive ? "true" : "false", onMouseDown: handleMouseDown, onClick: (event) => {
|
|
648
657
|
event.preventDefault();
|
|
649
658
|
event.stopPropagation();
|
|
650
659
|
handleAlign("center");
|
|
651
660
|
}, disabled: isDisabled, "aria-label": "Align Center", "aria-pressed": isActive ? "true" : "false", children: jsx(Bars3Icon, { className: "w-4 h-4" }) }, index));
|
|
652
661
|
case "alignRight":
|
|
653
|
-
return (jsx(Button, { size: "sm", color: "neutral", variant: "
|
|
662
|
+
return (jsx(Button, { size: "sm", color: "neutral", variant: "soft", iconOnly: true, className: cn(themeStyles.toolbarButtonStyle), "data-state": isActive ? "active" : "inactive", "data-pressed": isActive ? "true" : "false", onMouseDown: handleMouseDown, onClick: (event) => {
|
|
654
663
|
event.preventDefault();
|
|
655
664
|
event.stopPropagation();
|
|
656
665
|
handleAlign("right");
|
|
657
666
|
}, disabled: isDisabled, "aria-label": "Align Right", "aria-pressed": isActive ? "true" : "false", children: jsx(Bars3BottomRightIcon, { className: "w-4 h-4" }) }, index));
|
|
658
667
|
case "undo":
|
|
659
|
-
return (jsx(Button, { size: "sm", color: "neutral", variant: "
|
|
668
|
+
return (jsx(Button, { size: "sm", color: "neutral", variant: "soft", iconOnly: true, className: cn(themeStyles.toolbarButtonStyle), onMouseDown: handleMouseDown, onClick: handleUndo, disabled: isDisabled, "aria-label": "Undo", children: jsx(ArrowUturnLeftIcon, { className: "w-4 h-4" }) }, index));
|
|
660
669
|
case "redo":
|
|
661
|
-
return (jsx(Button, { size: "sm", color: "neutral", variant: "
|
|
670
|
+
return (jsx(Button, { size: "sm", color: "neutral", variant: "soft", iconOnly: true, className: cn(themeStyles.toolbarButtonStyle), onMouseDown: handleMouseDown, onClick: handleRedo, disabled: isDisabled, "aria-label": "Redo", children: jsx(ArrowUturnRightIcon, { className: "w-4 h-4" }) }, index));
|
|
662
671
|
case "separator":
|
|
663
672
|
return jsx("div", { className: themeStyles.separatorStyle }, index);
|
|
664
673
|
default:
|
|
@@ -28,9 +28,9 @@ const richTextEditorTheme = {
|
|
|
28
28
|
// Toolbar styling (RTE-specific)
|
|
29
29
|
toolbarStyle: "flex items-center gap-1 p-2 border-b border-[var(--color-border)] bg-white dark:bg-[var(--color-background-secondary)]",
|
|
30
30
|
// Toolbar button styling
|
|
31
|
-
toolbarButtonStyle: "inline-flex items-center justify-center size-8 rounded-[calc(var(--radius-base)*0.75)] text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] hover:bg-white active:bg-
|
|
31
|
+
toolbarButtonStyle: "inline-flex items-center justify-center size-8 rounded-[calc(var(--radius-base)*0.75)] text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] hover:bg-white active:bg-[var(--color-background-tertiary)] transition-colors duration-300 disabled:opacity-50 disabled:cursor-not-allowed data-[state=active]:bg-[var(--color-background-tertiary)] data-[state=active]:text-[var(--color-text-primary)] data-[state=active]:hover:bg-[var(--color-primary-50)] border border-transparent data-[pressed=true]:bg-[var(--color-primary-50)] data-[pressed=true]:text-[var(--color-primary-900)] data-[pressed=true]:shadow-inner data-[pressed=true]:border-[var(--color-primary-200)]",
|
|
32
32
|
// Dropdown styling (font size, color picker)
|
|
33
|
-
dropdownStyle: "fixed z-[1000] min-w-[120px] py-1 bg-white/90 backdrop-blur-md rounded-[var(--form-radius)] shadow-xl ring-1 ring-
|
|
33
|
+
dropdownStyle: "fixed z-[1000] min-w-[120px] py-1 bg-white/90 backdrop-blur-md rounded-[var(--form-radius)] shadow-xl ring-1 ring-[var(--color-border)] focus:outline-none",
|
|
34
34
|
// Dropdown item styling
|
|
35
35
|
dropdownItemStyle: "block w-full px-3 py-2 text-left text-base text-[var(--color-text-primary)] hover:bg-[var(--color-background-tertiary)] transition-colors duration-150 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
36
36
|
// Separator between toolbar sections
|
|
@@ -48,6 +48,17 @@ export interface RichTextEditorProps extends Omit<React.HTMLAttributes<HTMLDivEl
|
|
|
48
48
|
toolbar?: ToolbarConfig;
|
|
49
49
|
/** Component-level theme overrides */
|
|
50
50
|
theme?: RichTextEditorThemeOverrides;
|
|
51
|
+
/**
|
|
52
|
+
* Optional HTML sanitizer function applied before setting innerHTML.
|
|
53
|
+
* Receives raw HTML string, must return sanitized HTML string.
|
|
54
|
+
* Recommended: pass DOMPurify.sanitize for robust XSS protection.
|
|
55
|
+
* If not provided, a basic built-in sanitizer strips script tags and on* event handlers.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* import DOMPurify from 'dompurify';
|
|
59
|
+
* <RichTextEditor sanitize={DOMPurify.sanitize} />
|
|
60
|
+
*/
|
|
61
|
+
sanitize?: (html: string) => string;
|
|
51
62
|
}
|
|
52
63
|
export type RichTextEditorSize = 'sm' | 'md' | 'lg';
|
|
53
64
|
export type RichTextEditorState = 'default' | 'disabled' | 'invalid';
|
|
@@ -88,6 +88,6 @@ export declare const SelectOptions: React.FC<SelectOptionsExtendedProps>;
|
|
|
88
88
|
* Select Option Component
|
|
89
89
|
*/
|
|
90
90
|
export declare const SelectOption: <T extends any>({ value, isSelected, disabled, className, onSelect, children, }: SelectOptionProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
91
|
-
export declare const Select: <T
|
|
91
|
+
export declare const Select: <T = unknown>(props: SelectProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
92
92
|
export { useSelectState };
|
|
93
93
|
export type { UseSelectStateProps, UseSelectStateReturn };
|
|
@@ -7,11 +7,10 @@ import { FormLabel } from '../FormLabel/FormLabel.js';
|
|
|
7
7
|
import { Input } from '../Input/Input.js';
|
|
8
8
|
import '../Input/Input.theme.js';
|
|
9
9
|
import { createDropdownAnimations } from './Select.animations.js';
|
|
10
|
-
import { ChevronUpDownIcon } from '
|
|
10
|
+
import { ChevronUpDownIcon, PlusIcon, CheckIcon, MagnifyingGlassIcon } from '@heroicons/react/24/outline';
|
|
11
11
|
import { useSelectPortal } from '../../../hooks/useSelectPortal.js';
|
|
12
12
|
import { cn } from '../../../utils/cn.js';
|
|
13
13
|
import { isValidTypeaheadChar, findNextMatchingOption, TYPEAHEAD_TIMEOUT_MS } from '../../../utils/typeaheadUtils.js';
|
|
14
|
-
import { PlusIcon, CheckIcon, MagnifyingGlassIcon } from '@heroicons/react/24/outline';
|
|
15
14
|
import { Tag } from '../../core/Tag/Tag.js';
|
|
16
15
|
import { useIsClient } from '../../../hooks/useIsClient.js';
|
|
17
16
|
import { useSelectState } from './useSelectState.js';
|
|
@@ -124,7 +123,7 @@ const SelectButton = ({ id, disabled, isOpen, state = "default", size = "md", ic
|
|
|
124
123
|
? focusStateStyle ||
|
|
125
124
|
"outline-2 outline-[var(--color-primary)] -outline-offset-1 ring-4 ring-[var(--color-primary)]/10"
|
|
126
125
|
: "";
|
|
127
|
-
return (jsx("div", { className: cn(buttonWrapperStyle), children: jsxs("button", { ref: buttonRef, id: id, type: "button", className: cn(baseStyle, sizeStyle, stateStyle, hoverStateStyle, activeFocusState, iconStartPadding, iconEndPadding, buttonStyle, className), onClick: onClick, onFocus: onFocus, onBlur: onBlur, disabled: disabled, "aria-expanded": isOpen, "aria-haspopup": "listbox", children: [iconStart && jsx("span", { className: iconStartStyle, children: iconStart }), children, iconEnd && jsx("span", { className: iconEndStyle, children: iconEnd })] }) }));
|
|
126
|
+
return (jsx("div", { className: cn(buttonWrapperStyle), children: jsxs("button", { ref: buttonRef, id: id, type: "button", className: cn(baseStyle, sizeStyle, stateStyle, hoverStateStyle, activeFocusState, iconStartPadding, iconEndPadding, buttonStyle, className), onClick: onClick, onFocus: onFocus, onBlur: onBlur, disabled: disabled, "aria-expanded": isOpen, "aria-haspopup": "listbox", "aria-controls": isOpen && id ? `${id}-listbox` : undefined, children: [iconStart && jsx("span", { className: iconStartStyle, children: iconStart }), children, iconEnd && jsx("span", { className: iconEndStyle, children: iconEnd })] }) }));
|
|
128
127
|
};
|
|
129
128
|
/**
|
|
130
129
|
* Select Options Component
|
|
@@ -316,7 +315,7 @@ const SelectOptions = ({ isOpen, maxHeight = "15rem", className = "", onClose, c
|
|
|
316
315
|
}),
|
|
317
316
|
}, role: "listbox", tabIndex: -1, variants: animations, initial: "initial", animate: "visible", exit: "exit", children: [searchable && (jsx("div", { className: `sticky top-0 py-1 bg-[var(--color-background)] z-[10000] border-b border-[var(--color-border)] ${searchInputStyle}`, style: {
|
|
318
317
|
"--form-radius": "0",
|
|
319
|
-
}, children: jsx(Input, { placeholder: "Search...", value: searchValue, onChange: handleSearchChange, type: "search", ref: searchInputRef, className: "w-full block bg-[var(--color-background)] border-none outline-none !min-h-8 py-2 ring-0 shadow-none [&:focus]:outline-none [&:focus]:ring-0 [&:focus]:border-none [&:focus-visible]:outline-none [&:focus-visible]:ring-0 [&:focus-visible]:border-none", iconStart: jsx(MagnifyingGlassIcon, { strokeWidth: 2, className: "size-4 text-[var(--color-text-muted)] group-focus-within:text-[var(--color-primary)]" }), wrapperClassName: "!border-none !outline-none !ring-0 !shadow-none", inputGroupClassName: "!border-none !outline-none !ring-0 !shadow-none flex items-center", style: {
|
|
318
|
+
}, children: jsx(Input, { placeholder: "Search...", "aria-label": "Search options", value: searchValue, onChange: handleSearchChange, type: "search", ref: searchInputRef, className: "w-full block bg-[var(--color-background)] border-none outline-none !min-h-8 py-2 ring-0 shadow-none [&:focus]:outline-none [&:focus]:ring-0 [&:focus]:border-none [&:focus-visible]:outline-none [&:focus-visible]:ring-0 [&:focus-visible]:border-none", iconStart: jsx(MagnifyingGlassIcon, { strokeWidth: 2, className: "size-4 text-[var(--color-text-muted)] group-focus-within:text-[var(--color-primary)]" }), wrapperClassName: "!border-none !outline-none !ring-0 !shadow-none", inputGroupClassName: "!border-none !outline-none !ring-0 !shadow-none flex items-center", style: {
|
|
320
319
|
border: "none",
|
|
321
320
|
outline: "none",
|
|
322
321
|
boxShadow: "none",
|
|
@@ -435,7 +434,7 @@ const SelectInner = ({ id, name, size = "md", state = "default", value, displayV
|
|
|
435
434
|
// Container style
|
|
436
435
|
const containerStyle = theme.containerStyle || "";
|
|
437
436
|
// Default chevron icon if no iconEnd provided
|
|
438
|
-
const defaultChevronIcon = jsx(ChevronUpDownIcon, {
|
|
437
|
+
const defaultChevronIcon = jsx(ChevronUpDownIcon, { className: "size-4" });
|
|
439
438
|
// Generate a unique ID if not provided
|
|
440
439
|
const generatedId = React__default.useId();
|
|
441
440
|
const selectId = id || generatedId;
|
|
@@ -452,7 +451,8 @@ const SelectInner = ({ id, name, size = "md", state = "default", value, displayV
|
|
|
452
451
|
return (jsx(SelectOption, { value: option.value, isSelected: isSelected, disabled: option.disabled || false, children: isCreateOption ? (jsxs("span", { className: "flex items-center gap-2", children: [jsx(PlusIcon, { className: "size-4 shrink-0" }), jsx("span", { className: "block truncate", children: option.label })] })) : multiple ? (jsxs(Fragment, { children: [jsx("span", { className: "block truncate", children: option.label }), isSelected && (jsx("span", { className: theme.checkIconStyle, children: jsx(CheckIcon, { className: "size-4", strokeWidth: 2 }) }))] })) : (jsx("span", { className: "block truncate", children: option.label })) }, option.id));
|
|
453
452
|
}) }), helperText && (typeof helperText === 'string' ? (jsx("p", { className: cn(helperTextStyle, helperTextStateStyle), children: helperText })) : (helperText)), name && (jsx("input", { type: "hidden", name: name, value: selectedValue !== undefined ? String(selectedValue) : "" }))] }) }));
|
|
454
453
|
};
|
|
455
|
-
const
|
|
456
|
-
|
|
454
|
+
const SelectForwarded = React__default.forwardRef(SelectInner);
|
|
455
|
+
SelectForwarded.displayName = "Select";
|
|
456
|
+
const Select = SelectForwarded;
|
|
457
457
|
|
|
458
458
|
export { Select, SelectButton, SelectContext, SelectOption, SelectOptions, SelectProvider, useSelectContext, useSelectState };
|
|
@@ -4,7 +4,7 @@ import type { SelectPlacement } from "../../../hooks/useSelectPortal";
|
|
|
4
4
|
* Select value option type
|
|
5
5
|
* @template T The type of the option value
|
|
6
6
|
*/
|
|
7
|
-
export interface SelectOption<T =
|
|
7
|
+
export interface SelectOption<T = unknown> {
|
|
8
8
|
/** Unique identifier for the option */
|
|
9
9
|
id: string | number;
|
|
10
10
|
/** Display label for the option */
|
|
@@ -25,7 +25,7 @@ export interface SelectBaseProps {
|
|
|
25
25
|
* Select component props
|
|
26
26
|
* @template T The type of the select value
|
|
27
27
|
*/
|
|
28
|
-
export interface SelectProps<T =
|
|
28
|
+
export interface SelectProps<T = unknown> extends SelectBaseProps {
|
|
29
29
|
/** ID for the select component */
|
|
30
30
|
id?: string;
|
|
31
31
|
/** Name for the select component */
|
|
@@ -138,7 +138,7 @@ export interface SelectOptionsProps extends SelectBaseProps {
|
|
|
138
138
|
/**
|
|
139
139
|
* Select option props
|
|
140
140
|
*/
|
|
141
|
-
export interface SelectOptionProps<T =
|
|
141
|
+
export interface SelectOptionProps<T = unknown> extends SelectBaseProps {
|
|
142
142
|
/** Option value */
|
|
143
143
|
value: T;
|
|
144
144
|
/** Whether the option is currently selected */
|
|
@@ -16,7 +16,7 @@ const CheckboxIndicator = ({ checked }) => (jsx("div", { className: cn("flex-shr
|
|
|
16
16
|
? "border-[var(--color-primary)] bg-[var(--color-primary)]"
|
|
17
17
|
: "border-[var(--color-border)] bg-[var(--color-background)]"), children: checked && jsx(CheckIcon, { className: "size-3.5 stroke-white", strokeWidth: 3 }) }));
|
|
18
18
|
// ─── SelectableCard ──────────────────────────────────────────────────────────
|
|
19
|
-
const SelectableCardRoot = React__default.forwardRef(({ value, disabled: cardDisabled, className, children, ...props }, ref) => {
|
|
19
|
+
const SelectableCardRoot = React__default.forwardRef(({ value, disabled: cardDisabled, className, children, onAnimationStart, onAnimationEnd, onDrag, onDragStart, onDragEnd, ...props }, ref) => {
|
|
20
20
|
const content = children;
|
|
21
21
|
const ctx = useSelectableCardContext();
|
|
22
22
|
const inputId = useId();
|
|
@@ -10,7 +10,7 @@ const sliderTheme = {
|
|
|
10
10
|
// Root container with layout
|
|
11
11
|
rootStyle: "relative flex items-center w-full touch-none select-none data-[orientation=vertical]:flex-col data-[orientation=vertical]:h-full",
|
|
12
12
|
// Track (background)
|
|
13
|
-
trackStyle: "relative w-full h-2 grow rounded-full bg-
|
|
13
|
+
trackStyle: "relative w-full h-2 grow rounded-full bg-[var(--color-background-tertiary)] overflow-hidden data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 data-[orientation=vertical]:w-2 data-[orientation=vertical]:h-full",
|
|
14
14
|
// Range (filled portion) - rounded to match track clipping
|
|
15
15
|
rangeStyle: "absolute h-full bg-gradient-to-r from-[var(--color-primary-500)] to-[var(--color-primary-700)] transition-all rounded-full data-[disabled]:bg-[var(--color-background-disabled)] data-[invalid]:bg-[var(--color-danger)]",
|
|
16
16
|
// Thumb (draggable handle)
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
*/
|
|
4
4
|
const switchTheme = {
|
|
5
5
|
container: "flex w-full justify-between items-center gap-4",
|
|
6
|
-
track: "w-12 h-6 rounded-full transition-colors cursor-pointer shadow-inner bg-[var(--color-
|
|
7
|
-
thumb: "w-7 h-5 rounded-full shadow-md
|
|
6
|
+
track: "w-12 h-6 rounded-full transition-colors cursor-pointer shadow-inner bg-[var(--color-background-tertiary)] data-[state=checked]:bg-[var(--color-primary)] data-[state=disabled]:bg-[var(--color-background-disabled)] data-[state=disabled]:cursor-not-allowed data-[state=invalid]:border-2 data-[state=invalid]:border-[var(--color-danger)] outline outline-[var(--color-border)]",
|
|
7
|
+
thumb: "w-7 h-5 rounded-full shadow-real-md bg-gradient-to-b from-neutral-100 via-neutral-200 to-neutral-50 border-t border-[var(--color-white)]/80 ",
|
|
8
8
|
description: "text-base text-[var(--color-text-muted)] -mt-1.5",
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
11
|
* Thumb position values for animation
|
|
12
12
|
*/
|
|
13
13
|
const thumbPositions = {
|
|
14
|
-
checked: { x:
|
|
14
|
+
checked: { x: 16, y: 2 },
|
|
15
15
|
unchecked: { x: 2, y: 2 },
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -72,7 +72,7 @@ const formsBaseTheme = {
|
|
|
72
72
|
invalid: "",
|
|
73
73
|
},
|
|
74
74
|
// Common helper text style with state variations
|
|
75
|
-
helperText: "text-sm text-
|
|
75
|
+
helperText: "text-sm text-[var(--color-text-muted)] mt-1.5 [.state-disabled_&]:text-[var(--color-text-disabled)] [.state-invalid_&]:text-[var(--color-danger-500)] " +
|
|
76
76
|
"dark:text-[var(--color-neutral-400)] dark:[.state-invalid_&]:text-[var(--color-danger-400)]",
|
|
77
77
|
// Common icon styles
|
|
78
78
|
iconStyles: {
|
|
@@ -22,9 +22,15 @@ export { switchTheme } from "./Switch";
|
|
|
22
22
|
export { DatePicker, DatePickerTrigger, DatePickerBody, DatePickerPresets, } from "./DatePicker";
|
|
23
23
|
export type { DatePickerProps, DatePickerTriggerProps, DatePickerBodyProps, DatePickerSize, DatePickerState, DatePickerPlacement, DatePickerMode, DatePickerTheme, DateRange, DateRangePreset, } from "./DatePicker";
|
|
24
24
|
export { datePickerTheme } from "./DatePicker";
|
|
25
|
+
export { DateRangePicker, DateRangePickerTrigger, DateRangePickerBody, DateRangePickerPresets, } from "./DateRangePicker";
|
|
26
|
+
export type { DateRangePickerProps, DateRangePickerTriggerProps, DateRangePickerBodyProps, DateRangePickerPresetsProps, DateRangePickerSize, DateRangePickerState, DateRangePickerPlacement, DateRangePickerTheme, } from "./DateRangePicker";
|
|
27
|
+
export { dateRangePickerTheme, DEFAULT_DATE_RANGE_PRESETS } from "./DateRangePicker";
|
|
25
28
|
export { FileUpload } from "./FileUpload";
|
|
26
29
|
export type { FileUploadProps, FileUploadThemeOverrides, UploadedFile, } from "./FileUpload";
|
|
27
30
|
export { fileUploadTheme } from "./FileUpload";
|
|
31
|
+
export { FileUploadProgress } from "./FileUpload";
|
|
32
|
+
export type { FileUploadProgressProps, FileUploadProgressItem, FileUploadProgressStatus, FileUploadProgressThemeOverrides, } from "./FileUpload";
|
|
33
|
+
export { fileUploadProgressTheme } from "./FileUpload";
|
|
28
34
|
export { TimePicker } from "./TimePicker";
|
|
29
35
|
export type { TimePickerProps, TimePickerSize, TimePickerState, TimePickerThemeOverrides, } from "./TimePicker";
|
|
30
36
|
export { timePickerTheme } from "./TimePicker";
|
|
@@ -14,8 +14,13 @@ export { Switch } from './Switch/Switch.js';
|
|
|
14
14
|
export { switchTheme } from './Switch/Switch.theme.js';
|
|
15
15
|
export { DatePicker } from './DatePicker/DatePicker.js';
|
|
16
16
|
export { datePickerTheme } from './DatePicker/DatePicker.theme.js';
|
|
17
|
+
export { DateRangePicker } from './DateRangePicker/DateRangePicker.js';
|
|
18
|
+
export { dateRangePickerTheme } from './DateRangePicker/DateRangePicker.theme.js';
|
|
19
|
+
export { DEFAULT_DATE_RANGE_PRESETS } from './DateRangePicker/dateRangePresets.js';
|
|
17
20
|
export { FileUpload } from './FileUpload/FileUpload.js';
|
|
18
21
|
export { fileUploadTheme } from './FileUpload/FileUpload.theme.js';
|
|
22
|
+
export { FileUploadProgress } from './FileUpload/FileUploadProgress.js';
|
|
23
|
+
export { fileUploadProgressTheme } from './FileUpload/FileUploadProgress.theme.js';
|
|
19
24
|
export { TimePicker } from './TimePicker/TimePicker.js';
|
|
20
25
|
import 'react/jsx-runtime';
|
|
21
26
|
import 'react';
|
|
@@ -70,3 +75,6 @@ export { CRON_PRESETS, cronToDescription, fieldsToCron, formatNextRun, getNextRu
|
|
|
70
75
|
export { DatePickerBody } from './DatePicker/DatePickerBody.js';
|
|
71
76
|
export { DatePickerPresets } from './DatePicker/DatePickerPresets.js';
|
|
72
77
|
export { DatePickerTrigger } from './DatePicker/DatePickerTrigger.js';
|
|
78
|
+
export { DateRangePickerBody } from './DateRangePicker/DateRangePickerBody.js';
|
|
79
|
+
export { DateRangePickerPresets } from './DateRangePicker/DateRangePickerPresets.js';
|
|
80
|
+
export { DateRangePickerTrigger } from './DateRangePicker/DateRangePickerTrigger.js';
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -13,3 +13,4 @@ export { useIsClient } from "./useIsClient";
|
|
|
13
13
|
export { useClickOutside } from "./useClickOutside";
|
|
14
14
|
export { useScaleBackground } from "./useScaleBackground";
|
|
15
15
|
export type { UseScaleBackgroundOptions } from "./useScaleBackground";
|
|
16
|
+
export { useMediaQuery } from "./useMediaQuery";
|