@flikk/ui 1.0.0-beta.31 → 1.0.0-beta.33
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/CHANGELOG.md +497 -22
- package/dist/components/ai/AgentRequest/AgentRequest.animations.d.ts +25 -0
- package/dist/components/ai/AgentRequest/AgentRequest.animations.js +81 -0
- package/dist/components/ai/AgentRequest/AgentRequest.d.ts +3 -0
- package/dist/components/ai/AgentRequest/AgentRequest.js +435 -0
- package/dist/components/ai/AgentRequest/AgentRequest.theme.d.ts +2 -0
- package/dist/components/ai/AgentRequest/AgentRequest.theme.js +106 -0
- package/dist/components/ai/AgentRequest/AgentRequest.types.d.ts +241 -0
- package/dist/components/ai/AgentRequest/index.d.ts +3 -0
- package/dist/components/ai/CodeBlock/CodeBlock.theme.js +1 -1
- package/dist/components/ai/PromptInput/PromptInput.js +2 -2
- package/dist/components/ai/PromptInput/PromptInput.theme.js +2 -2
- package/dist/components/ai/PromptSuggestion/PromptSuggestion.theme.js +2 -2
- package/dist/components/ai/Reasoning/Reasoning.js +27 -3
- package/dist/components/ai/Reasoning/Reasoning.theme.d.ts +6 -0
- package/dist/components/ai/Reasoning/Reasoning.theme.js +36 -0
- package/dist/components/ai/Reasoning/Reasoning.types.d.ts +58 -5
- package/dist/components/ai/Reasoning/ReasoningTrace.d.ts +11 -0
- package/dist/components/ai/Reasoning/ReasoningTrace.js +84 -0
- package/dist/components/ai/Reasoning/index.d.ts +2 -1
- package/dist/components/ai/StreamingResponse/AnimatedText.d.ts +7 -0
- package/dist/components/ai/StreamingResponse/AnimatedText.js +8 -7
- package/dist/components/ai/StreamingResponse/MarkdownRenderer.d.ts +5 -0
- package/dist/components/ai/StreamingResponse/MarkdownRenderer.js +4 -4
- package/dist/components/ai/StreamingResponse/StreamingCursor.d.ts +2 -2
- package/dist/components/ai/StreamingResponse/StreamingCursor.js +10 -7
- package/dist/components/ai/StreamingResponse/StreamingResponse.animations.d.ts +10 -0
- package/dist/components/ai/StreamingResponse/StreamingResponse.animations.js +59 -33
- package/dist/components/ai/StreamingResponse/StreamingResponse.js +13 -7
- package/dist/components/ai/StreamingResponse/StreamingResponse.types.d.ts +33 -2
- package/dist/components/ai/StreamingResponse/StreamingSurface.d.ts +13 -0
- package/dist/components/ai/StreamingResponse/StreamingSurface.js +38 -0
- package/dist/components/ai/StreamingResponse/WordAnimationContext.d.ts +5 -0
- package/dist/components/ai/StreamingResponse/WordAnimationContext.js +5 -4
- package/dist/components/ai/StreamingResponse/index.d.ts +4 -2
- package/dist/components/ai/TokenCounter/TokenCounter.theme.js +1 -1
- package/dist/components/ai/index.d.ts +3 -2
- package/dist/components/ai/index.js +4 -0
- package/dist/components/canvas/BaseNode.js +1 -1
- package/dist/components/canvas/CanvasToolbar.js +0 -1
- package/dist/components/canvas/Edge.js +2 -2
- package/dist/components/canvas/NodeControls.js +0 -1
- package/dist/components/canvas/NodeRenderer.js +2 -2
- package/dist/components/charts/ActivityRings/ActivityRings.js +2 -2
- package/dist/components/charts/ActivityRings/ActivityRings.theme.js +1 -1
- package/dist/components/charts/AreaChart/AreaChart.js +3 -3
- package/dist/components/charts/AreaChart/AreaChart.theme.js +3 -3
- package/dist/components/charts/BarChart/BarChart.js +4 -4
- package/dist/components/charts/ComboChart/BarRenderer.js +2 -2
- package/dist/components/charts/ComboChart/BarRenderer.types.d.ts +1 -1
- package/dist/components/charts/ComboChart/ComboChartCanvas.js +1 -1
- package/dist/components/charts/ComboChart/LineRenderer.js +1 -1
- package/dist/components/charts/ComboChart/LineRenderer.types.d.ts +1 -1
- package/dist/components/charts/DonutChart/DonutChart.theme.js +4 -4
- package/dist/components/charts/DonutChart/MultiSegmentDonutChart.theme.js +1 -1
- package/dist/components/charts/Heatmap/Heatmap.js +49 -42
- package/dist/components/charts/Heatmap/Heatmap.theme.d.ts +6 -2
- package/dist/components/charts/Heatmap/Heatmap.theme.js +20 -8
- package/dist/components/charts/Heatmap/Heatmap.types.d.ts +49 -82
- package/dist/components/charts/Heatmap/HeatmapCell.js +30 -81
- package/dist/components/charts/Heatmap/HeatmapLegend.d.ts +7 -6
- package/dist/components/charts/Heatmap/HeatmapLegend.js +6 -6
- package/dist/components/charts/Heatmap/index.d.ts +1 -1
- package/dist/components/charts/Heatmap/utils/heatmapUtils.d.ts +7 -12
- package/dist/components/charts/Heatmap/utils/heatmapUtils.js +16 -61
- package/dist/components/charts/Heatmap/utils/heatmapUtils.test.d.ts +1 -0
- package/dist/components/charts/HorizontalBarChart/HorizontalBarChart.js +1 -1
- package/dist/components/charts/LineChart/LineChart.js +2 -2
- package/dist/components/charts/LollipopChart/LollipopChart.js +1 -1
- package/dist/components/charts/RadarChart/RadarChart.js +1 -1
- package/dist/components/charts/StackedBarChart/StackedBarChart.js +3 -3
- package/dist/components/charts/hooks/useChartAccessibility.js +9 -6
- package/dist/components/charts/index.d.ts +4 -8
- package/dist/components/charts/index.js +2 -4
- package/dist/components/charts/shared/ChartText/ChartText.theme.js +1 -1
- package/dist/components/charts/shared/index.d.ts +1 -1
- package/dist/components/charts/theme/chart.theme.js +3 -3
- package/dist/components/charts/utils/animation-utils.d.ts +12 -7
- package/dist/components/charts/utils/animation-utils.js +19 -19
- package/dist/components/core/Accordion/Accordion.theme.js +1 -1
- package/dist/components/core/Alert/Alert.animations.d.ts +11 -4
- package/dist/components/core/Alert/Alert.animations.js +11 -4
- package/dist/components/core/Alert/Alert.js +16 -2
- package/dist/components/core/Alert/Alert.theme.js +1 -1
- package/dist/components/core/Alert/Alert.types.d.ts +4 -2
- package/dist/components/core/AlertDialog/AlertDialog.js +2 -2
- package/dist/components/core/Avatar/Avatar.theme.js +1 -1
- package/dist/components/core/Badge/Badge.animations.d.ts +0 -5
- package/dist/components/core/Badge/Badge.animations.js +5 -84
- package/dist/components/core/Badge/Badge.d.ts +7 -4
- package/dist/components/core/Badge/Badge.js +27 -64
- package/dist/components/core/Badge/Badge.theme.js +8 -12
- package/dist/components/core/Badge/Badge.types.d.ts +18 -34
- package/dist/components/core/Breadcrumbs/Breadcrumbs.theme.js +4 -4
- package/dist/components/core/Button/Button.js +7 -43
- package/dist/components/core/Button/Button.theme.js +5 -5
- package/dist/components/core/Button/Button.types.d.ts +8 -12
- package/dist/components/core/Button/index.d.ts +0 -2
- package/dist/components/core/Calendar/Calendar.theme.js +1 -1
- package/dist/components/core/Calendar/CalendarMini/CalendarMini.theme.js +2 -2
- package/dist/components/core/Card/Card.js +7 -2
- package/dist/components/core/Card/Card.theme.js +29 -1
- package/dist/components/core/Card/Card.types.d.ts +20 -0
- package/dist/components/core/Card/CardBody.js +9 -1
- package/dist/components/core/Card/CardContext.d.ts +13 -0
- package/dist/components/core/Card/CardContext.js +14 -0
- package/dist/components/core/Card/CardHeader.js +4 -1
- package/dist/components/core/ContextMenu/ContextMenu.theme.js +4 -3
- package/dist/components/core/ContextMenu/ContextMenu.types.d.ts +8 -1
- package/dist/components/core/ContextMenu/ContextMenuSub.d.ts +11 -1
- package/dist/components/core/ContextMenu/ContextMenuSub.js +35 -22
- package/dist/components/core/ContextMenu/ContextMenuSubBody.js +14 -3
- package/dist/components/core/ContextMenu/ContextMenuSubTrigger.js +21 -8
- package/dist/components/core/DragDrop/DragDrop.theme.js +2 -2
- package/dist/components/core/Drawer/Drawer.theme.js +1 -1
- package/dist/components/core/Drawer/DrawerHeader.js +0 -1
- package/dist/components/core/Dropdown/DropdownMenu.js +22 -7
- package/dist/components/core/Link/Link.js +1 -1
- package/dist/components/core/Masonry/Masonry.theme.js +1 -1
- package/dist/components/core/MenuItem/MenuItem.js +2 -1
- package/dist/components/core/MenuItem/MenuItem.theme.js +13 -1
- package/dist/components/core/Message/Message.js +2 -0
- package/dist/components/core/Message/Message.theme.js +3 -3
- package/dist/components/core/Modal/Modal.animations.d.ts +1 -1
- package/dist/components/core/Modal/Modal.animations.js +50 -11
- package/dist/components/core/Modal/Modal.js +5 -1
- package/dist/components/core/Modal/Modal.theme.js +1 -1
- package/dist/components/core/Modal/ModalHeader.js +0 -1
- package/dist/components/core/ModalStack/ModalStackModal.js +3 -1
- package/dist/components/core/NavItem/NavItem.js +3 -2
- package/dist/components/core/NavItem/NavItem.theme.js +1 -1
- package/dist/components/core/OfflineIndicator/OfflineIndicator.theme.js +4 -2
- package/dist/components/core/PageHeading/PageHeading.theme.js +1 -1
- package/dist/components/core/Pagination/Pagination.theme.js +2 -2
- package/dist/components/core/Pill/Pill.js +34 -18
- package/dist/components/core/Pill/Pill.theme.js +4 -2
- package/dist/components/core/Pill/Pill.types.d.ts +14 -1
- package/dist/components/core/Popover/PopoverBody.js +16 -5
- package/dist/components/core/Progress/Progress.d.ts +0 -25
- package/dist/components/core/Progress/Progress.js +79 -11
- package/dist/components/core/Progress/Progress.theme.js +17 -0
- package/dist/components/core/Progress/Progress.types.d.ts +47 -1
- package/dist/components/core/Rating/Rating.theme.js +1 -1
- package/dist/components/core/Rating/Rating.types.d.ts +3 -2
- package/dist/components/core/ScrollArea/ScrollArea.js +1 -1
- package/dist/components/core/ScrollArea/ScrollArea.theme.js +1 -1
- package/dist/components/core/Segmented/Segmented.theme.js +3 -3
- package/dist/components/core/Segmented/SegmentedContext.js +1 -0
- package/dist/components/core/Sidebar/Sidebar.js +5 -2
- package/dist/components/core/Sidebar/Sidebar.theme.js +2 -2
- package/dist/components/core/Sidebar/SidebarContent.js +1 -1
- package/dist/components/core/Sidebar/SidebarHeader.js +1 -1
- package/dist/components/core/Sidebar/SidebarSearch.js +2 -2
- package/dist/components/core/Sidebar/SidebarToggle.js +1 -1
- package/dist/components/core/Sidebar/SidebarUserProfile.js +1 -1
- package/dist/components/core/SlidingNumber/SlidingNumber.d.ts +8 -0
- package/dist/components/core/SlidingNumber/SlidingNumber.js +12 -3
- package/dist/components/core/Sortable/Sortable.theme.js +1 -1
- package/dist/components/core/Tabs/Tabs.theme.js +1 -1
- package/dist/components/core/Tag/Tag.theme.js +1 -1
- package/dist/components/core/Toast/ToastProvider.js +1 -1
- package/dist/components/core/Tree/Tree.theme.js +1 -1
- package/dist/components/core/index.d.ts +0 -2
- package/dist/components/core/index.js +0 -4
- package/dist/components/core/shared/ChartTooltip/ChartTooltip.animations.d.ts +4 -0
- package/dist/components/core/shared/ChartTooltip/ChartTooltip.animations.js +20 -0
- package/dist/components/{charts → core}/shared/ChartTooltip/ChartTooltip.js +1 -1
- package/dist/components/core/shared/Ripple.d.ts +16 -0
- package/dist/components/core/shared/Ripple.js +141 -0
- package/dist/components/data-display/GanttChart/GanttChart.theme.js +6 -6
- package/dist/components/data-display/GanttChart/GanttTaskBar.js +1 -1
- package/dist/components/data-display/GanttChart/GanttTimelineHeader.js +1 -1
- package/dist/components/data-display/GanttChart/GanttToolbar.js +0 -1
- package/dist/components/data-display/KPI/KPI.js +11 -20
- package/dist/components/data-display/KPI/KPI.theme.js +8 -4
- package/dist/components/data-display/Metric/Metric.theme.js +4 -4
- package/dist/components/data-display/Table/Table.theme.js +2 -2
- package/dist/components/data-display/Table/TableColumnManager.js +1 -2
- package/dist/components/data-display/Table/TableContext.js +1 -0
- package/dist/components/data-display/Table/TableFilter.js +9 -2
- package/dist/components/data-display/Table/TableSelectionHeader.js +1 -1
- package/dist/components/data-display/Timeline/Timeline.theme.js +1 -1
- package/dist/components/effects/CustomCursor/CustomCursor.d.ts +1 -1
- package/dist/components/effects/CustomCursor/CustomCursor.js +1 -1
- package/dist/components/effects/CustomCursor/CustomCursor.theme.js +4 -4
- package/dist/components/effects/Neumorphic/InsetCircleButton.js +1 -1
- package/dist/components/effects/Overlay/Overlay.js +7 -3
- package/dist/components/effects/index.d.ts +0 -32
- package/dist/components/effects/index.js +0 -16
- package/dist/components/effects/shared/ShaderCanvas/ShaderCanvas.d.ts +0 -2
- package/dist/components/effects/shared/ShaderCanvas/ShaderCanvas.js +1 -93
- package/dist/components/effects/shared/ShaderCanvas/ShaderCanvas.types.d.ts +0 -10
- package/dist/components/effects/shared/ShaderCanvas/index.d.ts +1 -1
- package/dist/components/effects/shared/index.d.ts +1 -3
- package/dist/components/effects/shared/shaderNoise.glsl.d.ts +1 -1
- package/dist/components/effects/shared/shaderNoise.glsl.js +2 -11
- package/dist/components/forms/Checkbox/Checkbox.theme.js +1 -1
- package/dist/components/forms/ColorPicker/ColorPicker.js +45 -3
- package/dist/components/forms/ColorPicker/ColorPickerBody.js +8 -4
- package/dist/components/forms/ColorPicker/ColorPickerHeader.js +1 -1
- package/dist/components/forms/ColorPicker/ColorPickerImage.js +1 -1
- package/dist/components/forms/Combobox/Combobox.js +10 -4
- package/dist/components/forms/Combobox/Combobox.theme.js +9 -0
- package/dist/components/forms/Combobox/Combobox.types.d.ts +13 -0
- package/dist/components/forms/DatePicker/DatePicker.js +19 -12
- package/dist/components/forms/DatePicker/DatePicker.theme.js +5 -0
- package/dist/components/forms/DatePicker/DatePicker.types.d.ts +8 -0
- package/dist/components/forms/DatePicker/DatePickerContext.d.ts +0 -1
- package/dist/components/forms/DatePicker/DatePickerTrigger.js +5 -3
- package/dist/components/forms/DateRangePicker/DateRangePicker.theme.js +6 -1
- package/dist/components/forms/DateRangePicker/DateRangePicker.types.d.ts +8 -0
- package/dist/components/forms/DateRangePicker/DateRangePickerContext.js +1 -0
- package/dist/components/forms/DateRangePicker/DateRangePickerTrigger.js +5 -3
- package/dist/components/forms/FileUpload/FileUpload.theme.js +2 -2
- package/dist/components/forms/FileUpload/FileUploadProgress.theme.js +1 -1
- package/dist/components/forms/Input/Input.js +17 -12
- package/dist/components/forms/Input/Input.theme.js +10 -0
- package/dist/components/forms/Input/Input.types.d.ts +14 -0
- package/dist/components/forms/InputAddress/InputAddress.js +5 -5
- package/dist/components/forms/InputAddress/InputAddress.types.d.ts +9 -2
- package/dist/components/forms/InputCounter/InputCounter.js +194 -17
- package/dist/components/forms/InputCounter/InputCounter.theme.d.ts +12 -0
- package/dist/components/forms/InputCounter/InputCounter.theme.js +92 -2
- package/dist/components/forms/InputCounter/InputCounter.types.d.ts +47 -4
- package/dist/components/forms/InputCreditCard/InputCreditCard.js +4 -4
- package/dist/components/forms/InputCreditCard/InputCreditCard.types.d.ts +7 -0
- package/dist/components/forms/Mention/Mention.js +13 -11
- package/dist/components/forms/Radio/Radio.theme.js +1 -1
- package/dist/components/forms/RichTextEditor/RichTextEditor.d.ts +12 -16
- package/dist/components/forms/RichTextEditor/RichTextEditor.js +174 -1680
- package/dist/components/forms/RichTextEditor/RichTextEditor.theme.d.ts +12 -56
- package/dist/components/forms/RichTextEditor/RichTextEditor.theme.js +60 -118
- package/dist/components/forms/RichTextEditor/RichTextEditor.types.d.ts +62 -126
- package/dist/components/forms/RichTextEditor/RichTextLinkField.d.ts +18 -0
- package/dist/components/forms/RichTextEditor/RichTextLinkField.js +46 -0
- package/dist/components/forms/RichTextEditor/RichTextToolbar.d.ts +15 -0
- package/dist/components/forms/RichTextEditor/RichTextToolbar.js +93 -0
- package/dist/components/forms/RichTextEditor/editorCommands.d.ts +50 -0
- package/dist/components/forms/RichTextEditor/editorCommands.js +58 -0
- package/dist/components/forms/RichTextEditor/editorState.d.ts +19 -0
- package/dist/components/forms/RichTextEditor/editorState.js +103 -0
- package/dist/components/forms/RichTextEditor/index.d.ts +5 -3
- package/dist/components/forms/RichTextEditor/sanitizeHtml.d.ts +38 -0
- package/dist/components/forms/RichTextEditor/sanitizeHtml.js +179 -0
- package/dist/components/forms/RichTextEditor/sanitizeHtml.test.d.ts +1 -0
- package/dist/components/forms/Select/Select.js +19 -12
- package/dist/components/forms/Select/Select.theme.js +9 -1
- package/dist/components/forms/Select/Select.types.d.ts +86 -8
- package/dist/components/forms/Select/useSelectState.d.ts +9 -3
- package/dist/components/forms/Select/useSelectState.js +4 -1
- package/dist/components/forms/SelectableCard/SelectableCard.js +2 -1
- package/dist/components/forms/SelectableCard/SelectableCard.theme.js +1 -1
- package/dist/components/forms/Switch/Switch.theme.js +2 -2
- package/dist/components/forms/Textarea/Textarea.js +14 -25
- package/dist/components/forms/TimePicker/TimePicker.theme.js +10 -1
- package/dist/components/forms/TimePicker/TimePicker.types.d.ts +11 -0
- package/dist/components/forms/TimePicker/TimePickerTrigger.js +7 -5
- package/dist/components/forms/forms.theme.d.ts +57 -0
- package/dist/components/forms/forms.theme.js +102 -13
- package/dist/components/forms/index.js +1 -0
- package/dist/components/generative/FormShell.d.ts +22 -0
- package/dist/components/generative/FormShell.js +102 -0
- package/dist/components/generative/GenerativeView.d.ts +52 -1
- package/dist/components/generative/GenerativeView.js +203 -11
- package/dist/components/generative/actions.d.ts +5 -0
- package/dist/components/generative/ai-sdk/index.d.ts +1 -0
- package/dist/components/generative/ai-sdk/index.js +1 -0
- package/dist/components/generative/ai-sdk/useGenerativeChat.d.ts +52 -0
- package/dist/components/generative/ai-sdk/useGenerativeChat.js +73 -0
- package/dist/components/generative/ai-sdk/useGenerativeChat.test.d.ts +1 -0
- package/dist/components/generative/fieldBinding.d.ts +31 -0
- package/dist/components/generative/fieldBinding.js +33 -0
- package/dist/components/generative/fieldBinding.test.d.ts +1 -0
- package/dist/components/generative/formScope.d.ts +71 -0
- package/dist/components/generative/formScope.js +135 -0
- package/dist/components/generative/index.d.ts +4 -0
- package/dist/components/generative/index.js +4 -0
- package/dist/components/generative/registry.d.ts +2 -0
- package/dist/components/generative/registry.js +11 -10
- package/dist/components/generative/schema.generated.js +199 -293
- package/dist/components/generative/toToolResult.d.ts +21 -0
- package/dist/components/generative/toToolResult.js +15 -0
- package/dist/components/generative/toToolResult.test.d.ts +1 -0
- package/dist/components/generative/validate.d.ts +10 -1
- package/dist/components/generative/validate.js +126 -11
- package/dist/components/layout/Grid/Grid.js +1 -0
- package/dist/components/layout/Section/Section.theme.js +1 -1
- package/dist/components/layout/Stack/Stack.js +1 -0
- package/dist/generative.schema.json +199 -293
- package/dist/index.js +1 -4
- package/dist/registry.json +2765 -2450
- package/dist/shadcn-compat.css +5 -5
- package/dist/styles/theme.test.d.ts +1 -0
- package/dist/styles.css +1 -1
- package/dist/test/render.d.ts +17 -0
- package/dist/themes/precision.css +232 -0
- package/dist/tools.json +200 -295
- package/dist/utils/composeEventHandlers.d.ts +19 -0
- package/dist/utils/composeEventHandlers.js +26 -0
- package/dist/utils/composeEventHandlers.test.d.ts +1 -0
- package/dist/utils/index.d.ts +1 -1
- package/package.json +31 -1
- package/src/global.scss +21 -28
- package/src/styles/theme.css +157 -50
- package/src/styles/theme.test.ts +119 -0
- package/tailwind.preset.cjs +30 -20
- package/dist/components/charts/FunnelChart/FunnelChart.animations.d.ts +0 -35
- package/dist/components/charts/FunnelChart/FunnelChart.animations.js +0 -59
- package/dist/components/charts/FunnelChart/FunnelChart.d.ts +0 -8
- package/dist/components/charts/FunnelChart/FunnelChart.js +0 -410
- package/dist/components/charts/FunnelChart/FunnelChart.theme.d.ts +0 -2
- package/dist/components/charts/FunnelChart/FunnelChart.theme.js +0 -12
- package/dist/components/charts/FunnelChart/FunnelChart.types.d.ts +0 -105
- package/dist/components/charts/FunnelChart/index.d.ts +0 -4
- package/dist/components/charts/ScatterPlot/ScatterPlot.d.ts +0 -9
- package/dist/components/charts/ScatterPlot/ScatterPlot.js +0 -208
- package/dist/components/charts/ScatterPlot/ScatterPlot.theme.d.ts +0 -18
- package/dist/components/charts/ScatterPlot/ScatterPlot.theme.js +0 -42
- package/dist/components/charts/ScatterPlot/ScatterPlot.types.d.ts +0 -60
- package/dist/components/charts/ScatterPlot/ScatterPlot.types.js +0 -19
- package/dist/components/charts/ScatterPlot/index.d.ts +0 -3
- package/dist/components/core/Button/Button.ripple.d.ts +0 -71
- package/dist/components/core/Button/Button.ripple.js +0 -236
- package/dist/components/core/Calendar/CalendarEvent/CalendarEvent.d.ts +0 -4
- package/dist/components/core/Calendar/CalendarEvent/CalendarEvent.theme.d.ts +0 -12
- package/dist/components/core/Calendar/CalendarEvent/CalendarEvent.types.d.ts +0 -23
- package/dist/components/core/Calendar/CalendarEvent/index.d.ts +0 -2
- package/dist/components/core/CardStack/CardStack.animations.d.ts +0 -47
- package/dist/components/core/CardStack/CardStack.d.ts +0 -3
- package/dist/components/core/CardStack/CardStack.js +0 -187
- package/dist/components/core/CardStack/CardStack.theme.d.ts +0 -6
- package/dist/components/core/CardStack/CardStack.theme.js +0 -33
- package/dist/components/core/CardStack/CardStack.types.d.ts +0 -139
- package/dist/components/core/CardStack/index.d.ts +0 -7
- package/dist/components/core/Carousel/Carousel.d.ts +0 -3
- package/dist/components/core/Carousel/Carousel.js +0 -83
- package/dist/components/core/Carousel/Carousel.theme.d.ts +0 -10
- package/dist/components/core/Carousel/Carousel.theme.js +0 -20
- package/dist/components/core/Carousel/Carousel.types.d.ts +0 -113
- package/dist/components/core/Carousel/CarouselBody.d.ts +0 -4
- package/dist/components/core/Carousel/CarouselBody.js +0 -59
- package/dist/components/core/Carousel/CarouselContext.d.ts +0 -3
- package/dist/components/core/Carousel/CarouselContext.js +0 -13
- package/dist/components/core/Carousel/CarouselItem.d.ts +0 -4
- package/dist/components/core/Carousel/CarouselItem.js +0 -11
- package/dist/components/core/Carousel/CarouselNext.d.ts +0 -4
- package/dist/components/core/Carousel/CarouselNext.js +0 -16
- package/dist/components/core/Carousel/CarouselPrevious.d.ts +0 -4
- package/dist/components/core/Carousel/CarouselPrevious.js +0 -16
- package/dist/components/core/Carousel/index.d.ts +0 -3
- package/dist/components/effects/ColorPanels/ColorPanels.d.ts +0 -8
- package/dist/components/effects/ColorPanels/ColorPanels.js +0 -66
- package/dist/components/effects/ColorPanels/ColorPanels.shaders.d.ts +0 -12
- package/dist/components/effects/ColorPanels/ColorPanels.shaders.js +0 -218
- package/dist/components/effects/ColorPanels/ColorPanels.types.d.ts +0 -29
- package/dist/components/effects/ColorPanels/ColorPanels.types.js +0 -3
- package/dist/components/effects/ColorPanels/index.d.ts +0 -2
- package/dist/components/effects/FlutedGlass/FlutedGlass.d.ts +0 -9
- package/dist/components/effects/FlutedGlass/FlutedGlass.js +0 -80
- package/dist/components/effects/FlutedGlass/FlutedGlass.shaders.d.ts +0 -12
- package/dist/components/effects/FlutedGlass/FlutedGlass.shaders.js +0 -335
- package/dist/components/effects/FlutedGlass/FlutedGlass.types.d.ts +0 -61
- package/dist/components/effects/FlutedGlass/FlutedGlass.types.js +0 -16
- package/dist/components/effects/FlutedGlass/index.d.ts +0 -3
- package/dist/components/effects/GlassEffect/GlassEffect.d.ts +0 -15
- package/dist/components/effects/GlassEffect/GlassEffect.js +0 -38
- package/dist/components/effects/GlassEffect/GlassEffect.types.d.ts +0 -19
- package/dist/components/effects/GlassEffect/index.d.ts +0 -2
- package/dist/components/effects/GlassSurface/GlassSurface.d.ts +0 -8
- package/dist/components/effects/GlassSurface/GlassSurface.js +0 -250
- package/dist/components/effects/GlassSurface/GlassSurface.types.d.ts +0 -66
- package/dist/components/effects/GlassSurface/index.d.ts +0 -2
- package/dist/components/effects/GodRays/GodRays.d.ts +0 -8
- package/dist/components/effects/GodRays/GodRays.js +0 -68
- package/dist/components/effects/GodRays/GodRays.shaders.d.ts +0 -10
- package/dist/components/effects/GodRays/GodRays.shaders.js +0 -128
- package/dist/components/effects/GodRays/GodRays.types.d.ts +0 -25
- package/dist/components/effects/GodRays/GodRays.types.js +0 -3
- package/dist/components/effects/GodRays/index.d.ts +0 -2
- package/dist/components/effects/GridPattern/GridPattern.d.ts +0 -18
- package/dist/components/effects/GridPattern/GridPattern.js +0 -65
- package/dist/components/effects/GridPattern/GridPattern.types.d.ts +0 -47
- package/dist/components/effects/GridPattern/index.d.ts +0 -2
- package/dist/components/effects/HalftoneCmyk/HalftoneCmyk.d.ts +0 -10
- package/dist/components/effects/HalftoneCmyk/HalftoneCmyk.js +0 -78
- package/dist/components/effects/HalftoneCmyk/HalftoneCmyk.shaders.d.ts +0 -22
- package/dist/components/effects/HalftoneCmyk/HalftoneCmyk.shaders.js +0 -239
- package/dist/components/effects/HalftoneCmyk/HalftoneCmyk.types.d.ts +0 -52
- package/dist/components/effects/HalftoneCmyk/index.d.ts +0 -2
- package/dist/components/effects/HalftoneDots/HalftoneDots.d.ts +0 -9
- package/dist/components/effects/HalftoneDots/HalftoneDots.js +0 -68
- package/dist/components/effects/HalftoneDots/HalftoneDots.shaders.d.ts +0 -13
- package/dist/components/effects/HalftoneDots/HalftoneDots.shaders.js +0 -296
- package/dist/components/effects/HalftoneDots/HalftoneDots.types.d.ts +0 -43
- package/dist/components/effects/HalftoneDots/HalftoneDots.types.js +0 -12
- package/dist/components/effects/HalftoneDots/index.d.ts +0 -3
- package/dist/components/effects/ImageDithering/ImageDithering.d.ts +0 -9
- package/dist/components/effects/ImageDithering/ImageDithering.js +0 -68
- package/dist/components/effects/ImageDithering/ImageDithering.shaders.d.ts +0 -12
- package/dist/components/effects/ImageDithering/ImageDithering.shaders.js +0 -117
- package/dist/components/effects/ImageDithering/ImageDithering.types.d.ts +0 -30
- package/dist/components/effects/ImageDithering/ImageDithering.types.js +0 -8
- package/dist/components/effects/ImageDithering/index.d.ts +0 -3
- package/dist/components/effects/MagneticElement/MagneticElement.d.ts +0 -30
- package/dist/components/effects/MagneticElement/MagneticElement.js +0 -111
- package/dist/components/effects/MagneticElement/MagneticElement.types.d.ts +0 -44
- package/dist/components/effects/MagneticElement/index.d.ts +0 -2
- package/dist/components/effects/Metaballs/Metaballs.d.ts +0 -8
- package/dist/components/effects/Metaballs/Metaballs.js +0 -59
- package/dist/components/effects/Metaballs/Metaballs.shaders.d.ts +0 -10
- package/dist/components/effects/Metaballs/Metaballs.shaders.js +0 -102
- package/dist/components/effects/Metaballs/Metaballs.types.d.ts +0 -16
- package/dist/components/effects/Metaballs/Metaballs.types.js +0 -3
- package/dist/components/effects/Metaballs/index.d.ts +0 -2
- package/dist/components/effects/PaperTexture/PaperTexture.d.ts +0 -9
- package/dist/components/effects/PaperTexture/PaperTexture.js +0 -61
- package/dist/components/effects/PaperTexture/PaperTexture.shaders.d.ts +0 -22
- package/dist/components/effects/PaperTexture/PaperTexture.shaders.js +0 -145
- package/dist/components/effects/PaperTexture/PaperTexture.types.d.ts +0 -19
- package/dist/components/effects/PaperTexture/index.d.ts +0 -2
- package/dist/components/effects/PulsingBorder/PulsingBorder.d.ts +0 -27
- package/dist/components/effects/PulsingBorder/PulsingBorder.js +0 -174
- package/dist/components/effects/PulsingBorder/PulsingBorder.shaders.d.ts +0 -14
- package/dist/components/effects/PulsingBorder/PulsingBorder.shaders.js +0 -258
- package/dist/components/effects/PulsingBorder/PulsingBorder.types.d.ts +0 -75
- package/dist/components/effects/PulsingBorder/PulsingBorder.types.js +0 -3
- package/dist/components/effects/PulsingBorder/index.d.ts +0 -2
- package/dist/components/effects/SmokeRing/SmokeRing.d.ts +0 -8
- package/dist/components/effects/SmokeRing/SmokeRing.js +0 -62
- package/dist/components/effects/SmokeRing/SmokeRing.shaders.d.ts +0 -14
- package/dist/components/effects/SmokeRing/SmokeRing.shaders.js +0 -130
- package/dist/components/effects/SmokeRing/SmokeRing.types.d.ts +0 -22
- package/dist/components/effects/SmokeRing/SmokeRing.types.js +0 -3
- package/dist/components/effects/SmokeRing/index.d.ts +0 -2
- package/dist/components/effects/StaticGradientMesh/StaticGradientMesh.d.ts +0 -9
- package/dist/components/effects/StaticGradientMesh/StaticGradientMesh.js +0 -59
- package/dist/components/effects/StaticGradientMesh/StaticGradientMesh.shaders.d.ts +0 -14
- package/dist/components/effects/StaticGradientMesh/StaticGradientMesh.shaders.js +0 -129
- package/dist/components/effects/StaticGradientMesh/StaticGradientMesh.types.d.ts +0 -23
- package/dist/components/effects/StaticGradientMesh/StaticGradientMesh.types.js +0 -3
- package/dist/components/effects/StaticGradientMesh/index.d.ts +0 -2
- package/dist/components/effects/Water/Water.d.ts +0 -9
- package/dist/components/effects/Water/Water.js +0 -65
- package/dist/components/effects/Water/Water.shaders.d.ts +0 -11
- package/dist/components/effects/Water/Water.shaders.js +0 -123
- package/dist/components/effects/Water/Water.types.d.ts +0 -25
- package/dist/components/effects/Water/index.d.ts +0 -2
- package/dist/components/effects/shared/bayerMatrices.glsl.d.ts +0 -10
- package/dist/components/effects/shared/bayerMatrices.glsl.js +0 -44
- package/dist/components/effects/shared/imageUV.glsl.d.ts +0 -12
- package/dist/components/effects/shared/imageUV.glsl.js +0 -26
- package/dist/components/forms/RichTextEditor/RichTextEditor.animations.d.ts +0 -7
- package/dist/components/forms/RichTextEditor/RichTextEditor.animations.js +0 -32
- package/dist/utils/calendarUtils.d.ts +0 -60
- /package/dist/components/{charts → core}/shared/ChartTooltip/ChartTooltip.d.ts +0 -0
- /package/dist/components/{charts → core}/shared/ChartTooltip/ChartTooltip.theme.d.ts +0 -0
- /package/dist/components/{charts → core}/shared/ChartTooltip/ChartTooltip.theme.js +0 -0
- /package/dist/components/{charts → core}/shared/ChartTooltip/ChartTooltip.types.d.ts +0 -0
- /package/dist/components/{charts → core}/shared/ChartTooltip/ChartTooltipContent.d.ts +0 -0
- /package/dist/components/{charts → core}/shared/ChartTooltip/index.d.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { useReducedMotion, AnimatePresence, motion } from 'motion/react';
|
|
4
|
-
import { useContext,
|
|
4
|
+
import { useContext, useEffect } from 'react';
|
|
5
5
|
import { createPortal } from 'react-dom';
|
|
6
6
|
import { useSelectPortal } from '../../../hooks/useSelectPortal.js';
|
|
7
7
|
import { cn } from '../../../utils/cn.js';
|
|
@@ -16,15 +16,19 @@ import { useIsClient } from '../../../hooks/useIsClient.js';
|
|
|
16
16
|
*/
|
|
17
17
|
const ColorPickerBody = ({ children, className, portal = true, animation = true, ...rest }) => {
|
|
18
18
|
const context = useContext(ColorPickerContext);
|
|
19
|
-
const contentRef = useRef(null);
|
|
20
19
|
const shouldReduceMotion = useReducedMotion();
|
|
21
20
|
const isClient = useIsClient();
|
|
22
21
|
if (!context) {
|
|
23
22
|
throw new Error('ColorPicker.Body must be used within a ColorPicker');
|
|
24
23
|
}
|
|
25
24
|
const { isOpen, setIsOpen, theme, triggerRef, placement, offset, dialogId } = context;
|
|
26
|
-
// Use positioning hook (same as Dropdown/Select)
|
|
27
|
-
|
|
25
|
+
// Use positioning hook (same as Dropdown/Select).
|
|
26
|
+
// 🔴 `contentRef` MUST come from the hook and be attached to the panel below:
|
|
27
|
+
// the hook measures the panel through it to clamp against the viewport. Body
|
|
28
|
+
// used to declare its own ref, leaving the hook's forever null — so
|
|
29
|
+
// `measureDropdownWidth` fell through to the TRIGGER's width, clamping fitted
|
|
30
|
+
// a ~32px box, and the ~320px panel ran straight off the right edge.
|
|
31
|
+
const { position, cssVariables, contentRef } = useSelectPortal({
|
|
28
32
|
triggerRef,
|
|
29
33
|
isOpen: isOpen || false,
|
|
30
34
|
placement,
|
|
@@ -25,7 +25,7 @@ const ColorPickerHeader = ({ modes = ['solid'], activeMode: activeModeFromProp,
|
|
|
25
25
|
};
|
|
26
26
|
return (jsxs("div", { className: cn('flex items-center justify-between border-b border-[var(--color-border)] -mx-4 -mt-4 px-4', className), ...props, children: [jsx("div", { className: "flex items-center gap-4", children: modes.map((mode) => (jsxs("button", { type: "button", onClick: () => handleModeChange(mode), className: cn('py-3 text-sm font-medium transition-colors relative cursor-pointer', activeMode === mode
|
|
27
27
|
? 'text-[var(--color-primary)]'
|
|
28
|
-
: 'text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)]'), "aria-selected": activeMode === mode, role: "tab", children: [modeLabels[mode], activeMode === mode && (jsx("div", { className: "absolute bottom-0 left-0 right-0 h-0.5 bg-[var(--color-primary)] rounded-full" }))] }, mode))) }), showClose && (jsx("button", { type: "button", onClick: () => setIsOpen(false), className: "p-1 text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] transition-colors rounded-md hover:bg-[var(--color-
|
|
28
|
+
: 'text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)]'), "aria-selected": activeMode === mode, role: "tab", children: [modeLabels[mode], activeMode === mode && (jsx("div", { className: "absolute bottom-0 left-0 right-0 h-0.5 bg-[var(--color-primary)] rounded-full" }))] }, mode))) }), showClose && (jsx("button", { type: "button", onClick: () => setIsOpen(false), className: "p-1 text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] transition-colors rounded-md hover:bg-[var(--color-surface)] cursor-pointer", "aria-label": "Close color picker", children: jsx(X, { className: "size-5" }) }))] }));
|
|
29
29
|
};
|
|
30
30
|
ColorPickerHeader.displayName = 'ColorPickerHeader';
|
|
31
31
|
|
|
@@ -141,7 +141,7 @@ const ColorPickerImage = ({ className, ...props }) => {
|
|
|
141
141
|
/* Upload dropzone */
|
|
142
142
|
jsxs("div", { onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, onClick: () => { var _a; return (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, className: cn('flex flex-col items-center justify-center gap-2 h-[200px] rounded-xl border-2 border-dashed cursor-pointer transition-colors', isDragOver
|
|
143
143
|
? 'border-[var(--color-primary)] bg-[var(--color-primary-50)]'
|
|
144
|
-
: 'border-[var(--color-border)] hover:border-[var(--color-primary)] hover:bg-[var(--color-
|
|
144
|
+
: 'border-[var(--color-border)] hover:border-[var(--color-primary)] hover:bg-[var(--color-surface)]'), children: [jsx(UploadSimple, { className: "size-8 text-[var(--color-text-muted)]" }), jsx("div", { className: "text-sm text-[var(--color-text-muted)]", children: "Click or drag an image" }), jsx("div", { className: "text-xs text-[var(--color-text-placeholder)]", children: "PNG, JPG, SVG, WebP" }), jsx("input", { ref: fileInputRef, type: "file", accept: "image/*", onChange: handleFileChange, className: "hidden", "aria-label": "Upload image" })] })) : (
|
|
145
145
|
/* Canvas with color picking */
|
|
146
146
|
jsxs("div", { className: "space-y-2", children: [jsxs("div", { className: "relative inline-block rounded-xl overflow-hidden ring-1 ring-inset ring-black/5", children: [jsx("canvas", { ref: canvasRef, onClick: handleCanvasClick, className: "cursor-crosshair block" }), cursorPos && (jsx("div", { className: "absolute w-5 h-5 border-2 border-white rounded-full pointer-events-none", style: {
|
|
147
147
|
left: `${cursorPos.x}%`,
|
|
@@ -134,7 +134,7 @@ const ComboboxOptions = ({ isOpen, onClose, triggerRef, portal, placement, offse
|
|
|
134
134
|
* ```
|
|
135
135
|
*/
|
|
136
136
|
const ComboboxInner = ({ options, value, onChange, placeholder = "Search...", label, helperText, size = "md", state = "default", clearable = true, iconStart, iconEnd, openOnFocus = true, filterFn = defaultFilterFn, emptyMessage = "No results found", creatable = false, onCreateOption, createLabel, required = false, name, className, wrapperClassName, inputClassName, dropdownClassName, theme: themeOverrides, portal = true, placement = "bottom-start", offset = 8, elevation, lift, id, ...props }, ref) => {
|
|
137
|
-
var _a;
|
|
137
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
138
138
|
// Merge theme
|
|
139
139
|
const theme = React__default.useMemo(() => ({ ...comboboxTheme, ...(themeOverrides || {}) }), [themeOverrides]);
|
|
140
140
|
// Generate unique ID
|
|
@@ -169,6 +169,8 @@ const ComboboxInner = ({ options, value, onChange, placeholder = "Search...", la
|
|
|
169
169
|
options: selectOptions,
|
|
170
170
|
value,
|
|
171
171
|
onChange: (newValue) => {
|
|
172
|
+
// useSelectState's payload is widened to `T | T[]` for Select's multi mode.
|
|
173
|
+
// Combobox has no `multiple` prop, so this is always the single value.
|
|
172
174
|
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
173
175
|
},
|
|
174
176
|
searchable: true, // Combobox is always searchable
|
|
@@ -403,8 +405,12 @@ const ComboboxInner = ({ options, value, onChange, placeholder = "Search...", la
|
|
|
403
405
|
// Icon padding
|
|
404
406
|
const hasLeftIcon = Boolean(iconStart);
|
|
405
407
|
const hasRightIcon = Boolean(iconEnd);
|
|
406
|
-
const iconStartPadding = hasLeftIcon
|
|
407
|
-
|
|
408
|
+
const iconStartPadding = hasLeftIcon
|
|
409
|
+
? ((_c = (_b = theme.iconPaddings) === null || _b === void 0 ? void 0 : _b.left) === null || _c === void 0 ? void 0 : _c[size]) || theme.iconPadding.left
|
|
410
|
+
: "";
|
|
411
|
+
const iconEndPadding = hasRightIcon
|
|
412
|
+
? ((_e = (_d = theme.iconPaddings) === null || _d === void 0 ? void 0 : _d.right) === null || _e === void 0 ? void 0 : _e[size]) || theme.iconPadding.right
|
|
413
|
+
: "";
|
|
408
414
|
// Create a modified selectState for the provider with our custom filtered options
|
|
409
415
|
const modifiedSelectState = React__default.useMemo(() => ({
|
|
410
416
|
...selectState,
|
|
@@ -414,7 +420,7 @@ const ComboboxInner = ({ options, value, onChange, placeholder = "Search...", la
|
|
|
414
420
|
return (jsx(SelectProvider, { selectState: modifiedSelectState, size: size, componentState: state, theme: theme, searchable: true, enableTypeahead: false, children: jsxs("div", { ref: ref, className: cn("relative", containerClasses, stateClass, wrapperClassName), ...props, children: [label && (typeof label === 'string' ? (jsx(FormLabel, { htmlFor: comboboxId, state: state, required: required, children: label })) : (label)), jsxs("div", { ref: wrapperRef, className: theme.wrapperStyle, children: [jsx("div", { className: cn(inputGroupClasses, stateClasses, className), children: jsxs("div", { className: "relative flex-1", children: [jsx("input", { ref: inputRef, id: comboboxId, type: "text", role: "combobox", "aria-expanded": isOpen, "aria-haspopup": "listbox", "aria-controls": listboxId, "aria-activedescendant": highlightedIndex >= 0 &&
|
|
415
421
|
customFilteredOptions[highlightedIndex]
|
|
416
422
|
? `${comboboxId}-option-${customFilteredOptions[highlightedIndex].id}`
|
|
417
|
-
: undefined, "aria-autocomplete": "list", "aria-invalid": isInvalid, "aria-describedby": helperText ? `${comboboxId}-helper` : undefined, autoComplete: "off", className: cn(inputClasses, sizeClasses, iconStartPadding, (hasRightIcon || showClearButton) && iconEndPadding, showClearButton && "pr-8", inputClassName), value: searchValue, onChange: handleInputChange, onFocus: handleInputFocus, onKeyDown: handleKeyDown, placeholder: placeholder, disabled: isDisabled, required: required }), hasLeftIcon && (jsx("div", { className: theme.iconStartStyle, children: iconStart })), showClearButton && (jsx("button", { type: "button", className: theme.clearButtonStyle, onClick: handleClear, "aria-label": "Clear selection", tabIndex: -1, children: jsx(X, { className: theme.clearIconStyle }) })), hasRightIcon && !showClearButton && (jsx("div", { className: theme.iconEndStyle, children: iconEnd }))] }) }), jsx(ComboboxOptions, { isOpen: isOpen, onClose: () => setIsOpen(false), triggerRef: wrapperRef, portal: portal, placement: placement, offset: offset, emptyMessage: emptyMessage, className: dropdownClassName, listboxId: listboxId, comboboxId: comboboxId, elevation: elevation, lift: lift })] }), helperText && (typeof helperText === 'string' ? (jsx("p", { id: `${comboboxId}-helper`, className: cn(helperTextClasses, helperTextStateClasses), children: helperText })) : (helperText)), name && (jsx("input", { type: "hidden", name: name, value: value !== undefined ? String(value) : "" }))] }) }));
|
|
423
|
+
: undefined, "aria-autocomplete": "list", "aria-invalid": isInvalid, "aria-describedby": helperText ? `${comboboxId}-helper` : undefined, autoComplete: "off", className: cn(inputClasses, sizeClasses, iconStartPadding, (hasRightIcon || showClearButton) && iconEndPadding, showClearButton && "pr-8", inputClassName), value: searchValue, onChange: handleInputChange, onFocus: handleInputFocus, onKeyDown: handleKeyDown, placeholder: placeholder, disabled: isDisabled, required: required }), hasLeftIcon && (jsx("div", { className: ((_f = theme.iconStartStyles) === null || _f === void 0 ? void 0 : _f[size]) || theme.iconStartStyle, children: iconStart })), showClearButton && (jsx("button", { type: "button", className: theme.clearButtonStyle, onClick: handleClear, "aria-label": "Clear selection", tabIndex: -1, children: jsx(X, { className: theme.clearIconStyle }) })), hasRightIcon && !showClearButton && (jsx("div", { className: ((_g = theme.iconEndStyles) === null || _g === void 0 ? void 0 : _g[size]) || theme.iconEndStyle, children: iconEnd }))] }) }), jsx(ComboboxOptions, { isOpen: isOpen, onClose: () => setIsOpen(false), triggerRef: wrapperRef, portal: portal, placement: placement, offset: offset, emptyMessage: emptyMessage, className: dropdownClassName, listboxId: listboxId, comboboxId: comboboxId, elevation: elevation, lift: lift })] }), helperText && (typeof helperText === 'string' ? (jsx("p", { id: `${comboboxId}-helper`, className: cn(helperTextClasses, helperTextStateClasses), children: helperText })) : (helperText)), name && (jsx("input", { type: "hidden", name: name, value: value !== undefined ? String(value) : "" }))] }) }));
|
|
418
424
|
};
|
|
419
425
|
const ComboboxForwarded = React__default.forwardRef(ComboboxInner);
|
|
420
426
|
ComboboxForwarded.displayName = "Combobox";
|
|
@@ -31,6 +31,15 @@ const comboboxTheme = {
|
|
|
31
31
|
iconEndStyle: "absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none text-[var(--color-text-muted)]",
|
|
32
32
|
// Icon padding configuration
|
|
33
33
|
iconPadding: formsBaseTheme.iconStyles.padding,
|
|
34
|
+
// Size-aware icon geometry: slot inset from --form-px-*, glyph from
|
|
35
|
+
// --form-icon-size-*. Flat keys above stay as the fallback.
|
|
36
|
+
iconStartStyles: formsBaseTheme.iconStyles.leftSizes,
|
|
37
|
+
iconEndStyles: formsBaseTheme.iconStyles.rightSizes,
|
|
38
|
+
iconSizes: formsBaseTheme.iconStyles.sizes,
|
|
39
|
+
iconPaddings: {
|
|
40
|
+
left: formsBaseTheme.iconStyles.paddingLeftSizes,
|
|
41
|
+
right: formsBaseTheme.iconStyles.paddingRightSizes,
|
|
42
|
+
},
|
|
34
43
|
// Clear button styles
|
|
35
44
|
clearButtonStyle: "absolute inset-y-0 right-0 flex items-center pr-2 cursor-pointer " +
|
|
36
45
|
"text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] transition-colors z-10",
|
|
@@ -97,8 +97,21 @@ export interface ComboboxTheme {
|
|
|
97
97
|
sizes: Record<ComboboxSize, string>;
|
|
98
98
|
states: Record<ComboboxState, string>;
|
|
99
99
|
focusStates: Record<ComboboxState, string>;
|
|
100
|
+
/** @deprecated size-blind; superseded by `iconStartStyles` */
|
|
100
101
|
iconStartStyle: string;
|
|
102
|
+
/** @deprecated size-blind; superseded by `iconEndStyles` */
|
|
101
103
|
iconEndStyle: string;
|
|
104
|
+
/** Per-size leading icon slot (position + inset) */
|
|
105
|
+
iconStartStyles?: Partial<Record<ComboboxSize, string>>;
|
|
106
|
+
/** Per-size trailing icon slot (position + inset) */
|
|
107
|
+
iconEndStyles?: Partial<Record<ComboboxSize, string>>;
|
|
108
|
+
/** Per-size sizing for built-in icons */
|
|
109
|
+
iconSizes?: Record<ComboboxSize, string>;
|
|
110
|
+
/** Per-size text runway reserved for each icon slot */
|
|
111
|
+
iconPaddings?: {
|
|
112
|
+
left?: Partial<Record<ComboboxSize, string>>;
|
|
113
|
+
right?: Partial<Record<ComboboxSize, string>>;
|
|
114
|
+
};
|
|
102
115
|
iconPadding: {
|
|
103
116
|
left: string;
|
|
104
117
|
right: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import React__default, { useState, useRef,
|
|
3
|
+
import React__default, { useState, useRef, useCallback, useMemo } from 'react';
|
|
4
4
|
import { datePickerTheme } from './DatePicker.theme.js';
|
|
5
5
|
import { FormLabel } from '../FormLabel/FormLabel.js';
|
|
6
6
|
import { DatePickerTrigger } from './DatePickerTrigger.js';
|
|
@@ -50,30 +50,38 @@ const DatePickerComponent = React__default.forwardRef(({ id, name, mode = "singl
|
|
|
50
50
|
const theme = { ...datePickerTheme };
|
|
51
51
|
// State
|
|
52
52
|
const [isOpen, setIsOpen] = useState(false);
|
|
53
|
-
|
|
53
|
+
// 🔴 §9: mode is DERIVED per render, never stored. `value` used to be mirrored
|
|
54
|
+
// into state and re-synced from an unconditional `useEffect(…, [value])` —
|
|
55
|
+
// which on mount fired with `value === undefined` and wiped the `defaultValue`
|
|
56
|
+
// seed, and in controlled mode let an ignored change stick because an
|
|
57
|
+
// unchanged prop never re-ran the effect.
|
|
58
|
+
const isControlled = value !== undefined;
|
|
59
|
+
const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
|
|
60
|
+
const selectedValue = isControlled ? value : uncontrolledValue;
|
|
54
61
|
// Refs
|
|
55
62
|
const triggerRef = useRef(null);
|
|
56
63
|
const contentRef = useRef(null);
|
|
57
|
-
// Update internal state when prop value changes
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
setSelectedValue(value);
|
|
60
|
-
}, [value]);
|
|
61
64
|
// Date selection handler (single mode)
|
|
62
65
|
const handleDateSelect = useCallback((newDate) => {
|
|
63
66
|
if (mode === "single") {
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
// Compared by time, not identity: every calendar click builds a NEW Date,
|
|
68
|
+
// so an identity check was always true and the guard never fired.
|
|
69
|
+
const isSameSelection = selectedValue instanceof Date && selectedValue.getTime() === newDate.getTime();
|
|
70
|
+
if (!isSameSelection) {
|
|
71
|
+
if (!isControlled)
|
|
72
|
+
setUncontrolledValue(newDate);
|
|
66
73
|
onChange === null || onChange === void 0 ? void 0 : onChange(newDate);
|
|
67
74
|
}
|
|
68
75
|
setIsOpen(false);
|
|
69
76
|
}
|
|
70
|
-
}, [mode, selectedValue, onChange]);
|
|
77
|
+
}, [mode, selectedValue, isControlled, onChange]);
|
|
71
78
|
// Range selection handler (range mode)
|
|
72
79
|
const handleRangeSelect = useCallback((newRange) => {
|
|
73
|
-
|
|
80
|
+
if (!isControlled)
|
|
81
|
+
setUncontrolledValue(newRange);
|
|
74
82
|
onChange === null || onChange === void 0 ? void 0 : onChange(newRange);
|
|
75
83
|
// Don't auto-close anymore - footer Apply button handles this
|
|
76
|
-
}, [onChange]);
|
|
84
|
+
}, [isControlled, onChange]);
|
|
77
85
|
// Button click handler
|
|
78
86
|
const handleButtonClick = useCallback(() => {
|
|
79
87
|
if (!disabled) {
|
|
@@ -105,7 +113,6 @@ const DatePickerComponent = React__default.forwardRef(({ id, name, mode = "singl
|
|
|
105
113
|
isOpen,
|
|
106
114
|
setIsOpen,
|
|
107
115
|
selectedValue,
|
|
108
|
-
setSelectedValue,
|
|
109
116
|
minDate,
|
|
110
117
|
maxDate,
|
|
111
118
|
isDateDisabled,
|
|
@@ -26,6 +26,11 @@ const datePickerTheme = {
|
|
|
26
26
|
triggerFocusStates: formsBaseTheme.focusStates,
|
|
27
27
|
iconEndStyle: formsBaseTheme.iconStyles.right,
|
|
28
28
|
iconEndPadding: formsBaseTheme.iconStyles.padding.right,
|
|
29
|
+
// Size-aware icon geometry: slot inset from --form-px-*, glyph from
|
|
30
|
+
// --form-icon-size-*. Flat keys above stay as the fallback.
|
|
31
|
+
iconEndStyles: formsBaseTheme.iconStyles.rightSizes,
|
|
32
|
+
iconEndPaddings: formsBaseTheme.iconStyles.paddingRightSizes,
|
|
33
|
+
iconSizes: formsBaseTheme.iconStyles.sizes,
|
|
29
34
|
// Dropdown body - surface painted by the relative-elevation engine (surfaceClasses)
|
|
30
35
|
bodyStyle: "min-w-fit max-w-none backdrop-blur-md border border-[var(--color-border)] rounded-[var(--popover-radius)] p-0 overflow-hidden z-[1000] fixed",
|
|
31
36
|
bodyWithPresetsStyle: "flex flex-col sm:flex-row w-fit max-w-[calc(100vw-2rem)] sm:max-w-none backdrop-blur-md border border-[var(--color-border)] rounded-[var(--popover-radius)] shadow-lg p-0 overflow-hidden z-[1000] fixed",
|
|
@@ -155,8 +155,16 @@ export interface DatePickerTheme {
|
|
|
155
155
|
triggerStates: Record<DatePickerState, string>;
|
|
156
156
|
triggerHoverStates: Record<DatePickerState, string>;
|
|
157
157
|
triggerFocusStates: Record<DatePickerState, string>;
|
|
158
|
+
/** @deprecated size-blind; superseded by `iconEndStyles` */
|
|
158
159
|
iconEndStyle: string;
|
|
160
|
+
/** @deprecated size-blind; superseded by `iconEndPaddings` */
|
|
159
161
|
iconEndPadding: string;
|
|
162
|
+
/** Per-size trailing icon slot (position + inset) */
|
|
163
|
+
iconEndStyles?: Partial<Record<DatePickerSize, string>>;
|
|
164
|
+
/** Per-size text runway reserved for the trailing icon */
|
|
165
|
+
iconEndPaddings?: Partial<Record<DatePickerSize, string>>;
|
|
166
|
+
/** Per-size sizing for the built-in calendar icon */
|
|
167
|
+
iconSizes?: Record<DatePickerSize, string>;
|
|
160
168
|
bodyStyle: string;
|
|
161
169
|
bodyWithPresetsStyle: string;
|
|
162
170
|
presetsContainerStyle: string;
|
|
@@ -5,7 +5,6 @@ export interface DatePickerContextType {
|
|
|
5
5
|
isOpen: boolean;
|
|
6
6
|
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
7
7
|
selectedValue: Date | DateRange | undefined;
|
|
8
|
-
setSelectedValue: React.Dispatch<React.SetStateAction<Date | DateRange | undefined>>;
|
|
9
8
|
minDate?: Date;
|
|
10
9
|
maxDate?: Date;
|
|
11
10
|
isDateDisabled?: (date: Date) => boolean;
|
|
@@ -10,7 +10,7 @@ import { DatePickerContext } from './DatePickerContext.js';
|
|
|
10
10
|
* Displays selected date or placeholder text
|
|
11
11
|
*/
|
|
12
12
|
const DatePickerTrigger = ({ id, disabled, isOpen, state = "default", size = "md", className, onClick, onFocus, onBlur, children, 'aria-invalid': ariaInvalid, 'aria-describedby': ariaDescribedby, }) => {
|
|
13
|
-
var _a, _b, _c, _d;
|
|
13
|
+
var _a, _b, _c, _d, _e, _f;
|
|
14
14
|
const context = useContext(DatePickerContext);
|
|
15
15
|
if (!context) {
|
|
16
16
|
throw new Error("DatePickerTrigger must be used within a DatePicker");
|
|
@@ -21,7 +21,9 @@ const DatePickerTrigger = ({ id, disabled, isOpen, state = "default", size = "md
|
|
|
21
21
|
const stateStyle = ((_b = theme.triggerStates) === null || _b === void 0 ? void 0 : _b[state]) || "";
|
|
22
22
|
const hoverStateStyle = ((_c = theme.triggerHoverStates) === null || _c === void 0 ? void 0 : _c[state]) || "";
|
|
23
23
|
const focusStateStyle = ((_d = theme.triggerFocusStates) === null || _d === void 0 ? void 0 : _d[state]) || "";
|
|
24
|
-
const iconEndStyle = theme.iconEndStyle || "";
|
|
24
|
+
const iconEndStyle = ((_e = theme.iconEndStyles) === null || _e === void 0 ? void 0 : _e[size]) || theme.iconEndStyle || "";
|
|
25
|
+
// Glyph ramps with the control (--form-icon-size-*), not a flat h-4 w-4.
|
|
26
|
+
const iconSizeStyle = ((_f = theme.iconSizes) === null || _f === void 0 ? void 0 : _f[size]) || "size-4";
|
|
25
27
|
const iconEndPadding = theme.iconEndPadding || ""; // Always apply right padding for built-in calendar icon
|
|
26
28
|
const triggerButtonStyle = theme.triggerButtonStyle || "";
|
|
27
29
|
// Apply focused styles when open - same pattern as SelectButton
|
|
@@ -29,7 +31,7 @@ const DatePickerTrigger = ({ id, disabled, isOpen, state = "default", size = "md
|
|
|
29
31
|
? focusStateStyle ||
|
|
30
32
|
"shadow-[inset_0_0_0_1px_var(--color-primary-600)] ring-4 ring-[var(--color-primary)]/10"
|
|
31
33
|
: "";
|
|
32
|
-
return (jsx("div", { className: "relative w-full", children: jsxs("button", { ref: triggerRef, id: id, type: "button", className: cn(baseStyle, sizeStyle, stateStyle, hoverStateStyle, activeFocusState, iconEndPadding, triggerButtonStyle, "text-left", className), onClick: onClick, onFocus: onFocus, onBlur: onBlur, disabled: disabled, "aria-expanded": isOpen, "aria-haspopup": "dialog", "aria-label": "Open calendar", "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedby, children: [children, jsx("span", { className: iconEndStyle, children: jsx(Calendar, { className:
|
|
34
|
+
return (jsx("div", { className: "relative w-full", children: jsxs("button", { ref: triggerRef, id: id, type: "button", className: cn(baseStyle, sizeStyle, stateStyle, hoverStateStyle, activeFocusState, iconEndPadding, triggerButtonStyle, "text-left", className), onClick: onClick, onFocus: onFocus, onBlur: onBlur, disabled: disabled, "aria-expanded": isOpen, "aria-haspopup": "dialog", "aria-label": "Open calendar", "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedby, children: [children, jsx("span", { className: iconEndStyle, children: jsx(Calendar, { className: iconSizeStyle }) })] }) }));
|
|
33
35
|
};
|
|
34
36
|
|
|
35
37
|
export { DatePickerTrigger };
|
|
@@ -19,6 +19,11 @@ const dateRangePickerTheme = {
|
|
|
19
19
|
triggerFocusStates: formsBaseTheme.focusStates,
|
|
20
20
|
iconEndStyle: formsBaseTheme.iconStyles.right,
|
|
21
21
|
iconEndPadding: formsBaseTheme.iconStyles.padding.right,
|
|
22
|
+
// Size-aware icon geometry: slot inset from --form-px-*, glyph from
|
|
23
|
+
// --form-icon-size-*. Flat keys above stay as the fallback.
|
|
24
|
+
iconEndStyles: formsBaseTheme.iconStyles.rightSizes,
|
|
25
|
+
iconEndPaddings: formsBaseTheme.iconStyles.paddingRightSizes,
|
|
26
|
+
iconSizes: formsBaseTheme.iconStyles.sizes,
|
|
22
27
|
bodyStyle: "flex flex-col sm:flex-row w-fit max-w-[calc(100vw-2rem)] sm:max-w-none backdrop-blur-md border border-[var(--color-border)] rounded-[var(--popover-radius)] shadow-lg p-0 overflow-hidden z-[1000] fixed",
|
|
23
28
|
presetsContainerStyle: "hidden sm:flex flex-col gap-1 p-3 sm:border-r border-[var(--color-border)] bg-[var(--color-surface-sunken)] sm:min-w-[180px]",
|
|
24
29
|
presetButtonStyle: "w-full text-left px-3 py-2 text-sm font-medium rounded-[calc(var(--radius-base)*0.75)] transition-colors cursor-pointer " +
|
|
@@ -29,7 +34,7 @@ const dateRangePickerTheme = {
|
|
|
29
34
|
presetCheckmarkStyle: "size-4 text-[var(--color-primary)] shrink-0",
|
|
30
35
|
mobilePresetsContainerStyle: "sm:hidden px-3 pt-3 pb-1",
|
|
31
36
|
mobilePresetButtonStyle: "whitespace-nowrap px-3 py-1.5 text-xs font-medium rounded-full transition-colors cursor-pointer shrink-0 " +
|
|
32
|
-
"bg-[var(--color-
|
|
37
|
+
"bg-[var(--color-surface)] text-[var(--color-text-secondary)] " +
|
|
33
38
|
"hover:bg-[var(--color-surface-hover)] hover:text-[var(--color-text-primary)] " +
|
|
34
39
|
"data-[active=true]:bg-[var(--color-primary-50)] data-[active=true]:text-[var(--color-primary)] " +
|
|
35
40
|
"dark:data-[active=true]:bg-[var(--color-primary-950)] dark:data-[active=true]:text-[var(--color-primary-300)]",
|
|
@@ -163,8 +163,16 @@ export interface DateRangePickerTheme {
|
|
|
163
163
|
triggerStates: Record<DateRangePickerState, string>;
|
|
164
164
|
triggerHoverStates: Record<DateRangePickerState, string>;
|
|
165
165
|
triggerFocusStates: Record<DateRangePickerState, string>;
|
|
166
|
+
/** @deprecated size-blind; superseded by `iconEndStyles` */
|
|
166
167
|
iconEndStyle: string;
|
|
168
|
+
/** @deprecated size-blind; superseded by `iconEndPaddings` */
|
|
167
169
|
iconEndPadding: string;
|
|
170
|
+
/** Per-size trailing icon slot (position + inset) */
|
|
171
|
+
iconEndStyles?: Partial<Record<DateRangePickerSize, string>>;
|
|
172
|
+
/** Per-size text runway reserved for the trailing icon */
|
|
173
|
+
iconEndPaddings?: Partial<Record<DateRangePickerSize, string>>;
|
|
174
|
+
/** Per-size sizing for the built-in calendar icon */
|
|
175
|
+
iconSizes?: Record<DateRangePickerSize, string>;
|
|
168
176
|
bodyStyle: string;
|
|
169
177
|
presetsContainerStyle: string;
|
|
170
178
|
presetButtonStyle: string;
|
|
@@ -9,7 +9,7 @@ import { DateRangePickerContext } from './DateRangePickerContext.js';
|
|
|
9
9
|
* DateRangePicker Trigger Component — styled like form input
|
|
10
10
|
*/
|
|
11
11
|
const DateRangePickerTrigger = ({ id, disabled, isOpen, state = "default", size = "md", className, onClick, onFocus, onBlur, children, 'aria-invalid': ariaInvalid, 'aria-describedby': ariaDescribedby, }) => {
|
|
12
|
-
var _a, _b, _c, _d;
|
|
12
|
+
var _a, _b, _c, _d, _e, _f;
|
|
13
13
|
const context = useContext(DateRangePickerContext);
|
|
14
14
|
if (!context) {
|
|
15
15
|
throw new Error("DateRangePickerTrigger must be used within a DateRangePicker");
|
|
@@ -20,14 +20,16 @@ const DateRangePickerTrigger = ({ id, disabled, isOpen, state = "default", size
|
|
|
20
20
|
const stateStyle = ((_b = theme.triggerStates) === null || _b === void 0 ? void 0 : _b[state]) || "";
|
|
21
21
|
const hoverStateStyle = ((_c = theme.triggerHoverStates) === null || _c === void 0 ? void 0 : _c[state]) || "";
|
|
22
22
|
const focusStateStyle = ((_d = theme.triggerFocusStates) === null || _d === void 0 ? void 0 : _d[state]) || "";
|
|
23
|
-
const iconEndStyle = theme.iconEndStyle || "";
|
|
23
|
+
const iconEndStyle = ((_e = theme.iconEndStyles) === null || _e === void 0 ? void 0 : _e[size]) || theme.iconEndStyle || "";
|
|
24
|
+
// Glyph ramps with the control (--form-icon-size-*), not a flat h-4 w-4.
|
|
25
|
+
const iconSizeStyle = ((_f = theme.iconSizes) === null || _f === void 0 ? void 0 : _f[size]) || "size-4";
|
|
24
26
|
const iconEndPadding = theme.iconEndPadding || "";
|
|
25
27
|
const triggerButtonStyle = theme.triggerButtonStyle || "";
|
|
26
28
|
const activeFocusState = isOpen
|
|
27
29
|
? focusStateStyle ||
|
|
28
30
|
"shadow-[inset_0_0_0_1px_var(--color-primary-600)] ring-4 ring-[var(--color-primary)]/10"
|
|
29
31
|
: "";
|
|
30
|
-
return (jsx("div", { className: "relative w-full", children: jsxs("button", { ref: triggerRef, id: id, type: "button", className: cn(baseStyle, sizeStyle, stateStyle, hoverStateStyle, activeFocusState, iconEndPadding, triggerButtonStyle, "text-left", className), onClick: onClick, onFocus: onFocus, onBlur: onBlur, disabled: disabled, "aria-expanded": isOpen, "aria-haspopup": "dialog", "aria-label": "Open date range picker", "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedby, children: [children, jsx("span", { className: iconEndStyle, children: jsx(Calendar, { className:
|
|
32
|
+
return (jsx("div", { className: "relative w-full", children: jsxs("button", { ref: triggerRef, id: id, type: "button", className: cn(baseStyle, sizeStyle, stateStyle, hoverStateStyle, activeFocusState, iconEndPadding, triggerButtonStyle, "text-left", className), onClick: onClick, onFocus: onFocus, onBlur: onBlur, disabled: disabled, "aria-expanded": isOpen, "aria-haspopup": "dialog", "aria-label": "Open date range picker", "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedby, children: [children, jsx("span", { className: iconEndStyle, children: jsx(Calendar, { className: iconSizeStyle }) })] }) }));
|
|
31
33
|
};
|
|
32
34
|
|
|
33
35
|
export { DateRangePickerTrigger };
|
|
@@ -2,7 +2,7 @@ const fileUploadTheme = {
|
|
|
2
2
|
// Root container
|
|
3
3
|
containerStyle: "w-full",
|
|
4
4
|
// Dropzone area (default state)
|
|
5
|
-
dropzoneStyle: "relative flex flex-col items-center justify-center w-full min-h-[160px] p-6 border border-dashed border-[var(--color-border)] rounded-[var(--form-radius)] bg-[var(--color-surface)] hover:border-[var(--color-border-hover)] transition-colors duration-
|
|
5
|
+
dropzoneStyle: "relative flex flex-col items-center justify-center w-full min-h-[160px] p-6 border border-dashed border-[var(--color-border)] rounded-[var(--form-radius)] bg-[var(--color-surface)] hover:border-[var(--color-border-hover)] transition-colors duration-[var(--motion-duration-slower)] cursor-pointer",
|
|
6
6
|
// Dragging over — translucent primary tint composites over the surface in both modes
|
|
7
7
|
dropzoneActiveStyle: "border-solid border-[var(--color-primary)] bg-[var(--color-primary)]/5",
|
|
8
8
|
// Disabled
|
|
@@ -20,7 +20,7 @@ const fileUploadTheme = {
|
|
|
20
20
|
// Non-image tile — centered document icon (filename surfaced via title tooltip)
|
|
21
21
|
previewFileStyle: "flex items-center justify-center size-full text-[var(--color-text-muted)]",
|
|
22
22
|
// Remove button (revealed on item hover)
|
|
23
|
-
removeButtonStyle: "absolute top-1 right-1 -translate-y-1 opacity-0 group-hover:opacity-100 transition-all duration-
|
|
23
|
+
removeButtonStyle: "absolute top-1 right-1 -translate-y-1 opacity-0 group-hover:opacity-100 transition-all duration-[var(--motion-duration-slower)] group-hover:-translate-y-0",
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
export { fileUploadTheme };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const fileUploadProgressTheme = {
|
|
2
2
|
containerStyle: "flex flex-col gap-3",
|
|
3
3
|
itemStyle: "w-full flex items-center gap-x-3",
|
|
4
|
-
iconContainerStyle: "flex items-center justify-center rounded-lg shrink-0 border border-[var(--color-border)] bg-[var(--color-
|
|
4
|
+
iconContainerStyle: "flex items-center justify-center rounded-lg shrink-0 border border-[var(--color-border)] bg-[var(--color-surface)]",
|
|
5
5
|
iconStyle: "shrink-0 size-5 text-[var(--color-text-muted)]",
|
|
6
6
|
fileInfoStyle: "flex-1 min-w-0",
|
|
7
7
|
fileNameStyle: "text-sm font-medium text-[var(--color-text-primary)] truncate",
|
|
@@ -20,16 +20,16 @@ const PasswordToggleButton = ({ showPassword, onToggle, passwordToggleClasses, }
|
|
|
20
20
|
}
|
|
21
21
|
}, children: showPassword ? (jsx(EyeSlash, { className: toggleIconActive, "aria-hidden": "true" })) : (jsx(Eye, { className: toggleIconInactive, "aria-hidden": "true" })) }));
|
|
22
22
|
};
|
|
23
|
-
const NumberButtons = ({ isDisabled, isAtMax, isAtMin, onIncrement, onDecrement, numberButtonsContainerClasses, numberButtonClasses, }) => {
|
|
23
|
+
const NumberButtons = ({ isDisabled, isAtMax, isAtMin, onIncrement, onDecrement, numberButtonsContainerClasses, numberButtonClasses, iconSizeClass, }) => {
|
|
24
24
|
const incrementIconStyle = inputTheme.typeStyles.number.incrementIconStyle;
|
|
25
25
|
const decrementIconStyle = inputTheme.typeStyles.number.decrementIconStyle;
|
|
26
26
|
return (jsxs("div", { className: numberButtonsContainerClasses, children: [jsx("button", { type: "button", className: `${numberButtonClasses}`, onClick: (e) => {
|
|
27
27
|
e.stopPropagation();
|
|
28
28
|
onDecrement();
|
|
29
|
-
}, disabled: isDisabled || isAtMin, "aria-label": "Decrease value", tabIndex: -1, children: jsx(Minus, { className: cn(
|
|
29
|
+
}, disabled: isDisabled || isAtMin, "aria-label": "Decrease value", tabIndex: -1, children: jsx(Minus, { className: cn(iconSizeClass, decrementIconStyle), "aria-hidden": "true" }) }), jsx("button", { type: "button", className: `${numberButtonClasses}`, onClick: (e) => {
|
|
30
30
|
e.stopPropagation();
|
|
31
31
|
onIncrement();
|
|
32
|
-
}, disabled: isDisabled || isAtMax, "aria-label": "Increase value", tabIndex: -1, children: jsx(Plus, { className: cn(
|
|
32
|
+
}, disabled: isDisabled || isAtMax, "aria-label": "Increase value", tabIndex: -1, children: jsx(Plus, { className: cn(iconSizeClass, incrementIconStyle), "aria-hidden": "true" }) })] }));
|
|
33
33
|
};
|
|
34
34
|
const getActiveDots = (strength) => {
|
|
35
35
|
switch (strength) {
|
|
@@ -68,6 +68,7 @@ const PasswordStrengthIndicator = ({ inline = false, passwordStrengthIndicator,
|
|
|
68
68
|
// Main Input Component
|
|
69
69
|
// ============================================================================
|
|
70
70
|
const Input = React__default.forwardRef(({ size = "md", state = "default", className = "", label, labelClassName = "", helperText, errorMessage, helperTextClassName = "", wrapperClassName = "", inputGroupClassName = "", iconStart, iconEnd, contentStart, contentEnd, keyboardShortcut, id, required, type = "text", passwordToggle = type === "password", passwordStrengthIndicator, showNumberControls = false, min, max, step = 1, onChange, onValueChange, onFocus, onBlur, value, currencyDecimalPlaces, darkMode = false, showTypeIcon = true, ...props }, ref) => {
|
|
71
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
71
72
|
const [isFocused, setIsFocused] = useState(false);
|
|
72
73
|
const [showPassword, setShowPassword] = useState(false);
|
|
73
74
|
const generatedId = React__default.useId();
|
|
@@ -81,9 +82,12 @@ const Input = React__default.forwardRef(({ size = "md", state = "default", class
|
|
|
81
82
|
: undefined);
|
|
82
83
|
const inputRef = useRef(null);
|
|
83
84
|
const cursorPositionRef = useRef(null);
|
|
84
|
-
// Default icons based on input type
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
// Default icons based on input type. Sized from the shared control-icon
|
|
86
|
+
// ramp (--form-icon-size-*) rather than a flat size-5, so they scale with
|
|
87
|
+
// the field and with a theme that retunes it.
|
|
88
|
+
const iconSizeClass = ((_a = inputTheme.iconSizes) === null || _a === void 0 ? void 0 : _a[size]) || "size-4";
|
|
89
|
+
const defaultPasswordIcon = showTypeIcon && type === "password" && !iconStart ? (jsx(Lock, { className: cn(iconSizeClass, "text-[var(--color-text-muted)]") })) : null;
|
|
90
|
+
const defaultSearchIcon = showTypeIcon && type === "search" && !iconStart ? (jsx(MagnifyingGlass, { className: cn(iconSizeClass, inputTheme.typeStyles.search.iconStyle) })) : null;
|
|
87
91
|
// Use the provided iconStart or the default icon based on input type
|
|
88
92
|
const finalLeftIcon = iconStart || defaultPasswordIcon || defaultSearchIcon;
|
|
89
93
|
// Derived state flags for internal use
|
|
@@ -253,11 +257,12 @@ const Input = React__default.forwardRef(({ size = "md", state = "default", class
|
|
|
253
257
|
const sizeClasses = inputTheme.sizes[size];
|
|
254
258
|
const stateClasses = inputTheme.states[state];
|
|
255
259
|
const helperTextClasses = inputTheme.helperText;
|
|
256
|
-
// Icon classes using design tokens
|
|
257
|
-
|
|
258
|
-
const
|
|
259
|
-
const
|
|
260
|
-
const
|
|
260
|
+
// Icon classes using design tokens — size-aware slot inset and text runway,
|
|
261
|
+
// falling back to the flat originals if a theme only overrode those.
|
|
262
|
+
const iconStartClasses = ((_b = inputTheme.iconStartStyles) === null || _b === void 0 ? void 0 : _b[size]) || inputTheme.iconStartStyle;
|
|
263
|
+
const iconEndClasses = ((_c = inputTheme.iconEndStyles) === null || _c === void 0 ? void 0 : _c[size]) || inputTheme.iconEndStyle;
|
|
264
|
+
const iconStartPadding = ((_e = (_d = inputTheme.iconPaddings) === null || _d === void 0 ? void 0 : _d.left) === null || _e === void 0 ? void 0 : _e[size]) || inputTheme.iconPadding.left;
|
|
265
|
+
const iconEndPadding = ((_g = (_f = inputTheme.iconPaddings) === null || _f === void 0 ? void 0 : _f.right) === null || _g === void 0 ? void 0 : _g[size]) || inputTheme.iconPadding.right;
|
|
261
266
|
// Content classes - size-aware
|
|
262
267
|
const contentStyleClasses = inputTheme.contentStyle[size];
|
|
263
268
|
const contentStartStyle = inputTheme.contentStartStyle;
|
|
@@ -282,7 +287,7 @@ const Input = React__default.forwardRef(({ size = "md", state = "default", class
|
|
|
282
287
|
}, onBlur: (e) => {
|
|
283
288
|
setIsFocused(false);
|
|
284
289
|
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 }), displayedMessage && (typeof displayedMessage === 'string' ? (jsx("div", { id: `${inputId}-helper`, className: cn(helperTextClasses, helperTextClassName), role: isInvalid ? "alert" : undefined, children: displayedMessage })) : (displayedMessage))] }));
|
|
290
|
+
}, 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, iconSizeClass: iconSizeClass })), 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 }), displayedMessage && (typeof displayedMessage === 'string' ? (jsx("div", { id: `${inputId}-helper`, className: cn(helperTextClasses, helperTextClassName), role: isInvalid ? "alert" : undefined, children: displayedMessage })) : (displayedMessage))] }));
|
|
286
291
|
});
|
|
287
292
|
Input.displayName = "Input";
|
|
288
293
|
|
|
@@ -45,6 +45,16 @@ const inputTheme = {
|
|
|
45
45
|
// Icon positioning styles
|
|
46
46
|
iconStartStyle: formsBaseTheme.iconStyles.left,
|
|
47
47
|
iconEndStyle: formsBaseTheme.iconStyles.right,
|
|
48
|
+
// Size-aware icon geometry: slot inset from --form-px-*, glyph from
|
|
49
|
+
// --form-icon-size-*. The flat keys above stay as the fallback for a theme
|
|
50
|
+
// that only overrode those.
|
|
51
|
+
iconStartStyles: formsBaseTheme.iconStyles.leftSizes,
|
|
52
|
+
iconEndStyles: formsBaseTheme.iconStyles.rightSizes,
|
|
53
|
+
iconSizes: formsBaseTheme.iconStyles.sizes,
|
|
54
|
+
iconPaddings: {
|
|
55
|
+
left: formsBaseTheme.iconStyles.paddingLeftSizes,
|
|
56
|
+
right: formsBaseTheme.iconStyles.paddingRightSizes,
|
|
57
|
+
},
|
|
48
58
|
// Icon padding configuration
|
|
49
59
|
iconPadding: formsBaseTheme.iconStyles.padding,
|
|
50
60
|
// Content styles - prefix/suffix content with size-aware font sizes
|
|
@@ -115,12 +115,26 @@ export interface InputTheme {
|
|
|
115
115
|
sizes: Record<InputSize, string>;
|
|
116
116
|
states: Record<InputState, string>;
|
|
117
117
|
helperText: string;
|
|
118
|
+
/** @deprecated size-blind; superseded by `iconStartStyles` */
|
|
118
119
|
iconStartStyle: string;
|
|
120
|
+
/** @deprecated size-blind; superseded by `iconEndStyles` */
|
|
119
121
|
iconEndStyle: string;
|
|
122
|
+
/** @deprecated size-blind; superseded by `iconPaddings` */
|
|
120
123
|
iconPadding: {
|
|
121
124
|
left: string;
|
|
122
125
|
right: string;
|
|
123
126
|
};
|
|
127
|
+
/** Per-size leading icon slot (position + inset) */
|
|
128
|
+
iconStartStyles?: Partial<Record<InputSize, string>>;
|
|
129
|
+
/** Per-size trailing icon slot (position + inset) */
|
|
130
|
+
iconEndStyles?: Partial<Record<InputSize, string>>;
|
|
131
|
+
/** Per-size text runway reserved for each icon slot */
|
|
132
|
+
iconPaddings?: {
|
|
133
|
+
left?: Partial<Record<InputSize, string>>;
|
|
134
|
+
right?: Partial<Record<InputSize, string>>;
|
|
135
|
+
};
|
|
136
|
+
/** Per-size sizing for the built-in type icons (lock, search) */
|
|
137
|
+
iconSizes?: Record<InputSize, string>;
|
|
124
138
|
contentStyle: Record<InputSize, string>;
|
|
125
139
|
contentStartStyle: string;
|
|
126
140
|
contentEndStyle: string;
|
|
@@ -75,7 +75,7 @@ const DEFAULT_COUNTRIES = [
|
|
|
75
75
|
* />
|
|
76
76
|
* ```
|
|
77
77
|
*/
|
|
78
|
-
const InputAddress = React__default.forwardRef(({ state = 'default', errorMessage, showCountrySelector = true, showPostalCode = true, availableCountries = [], defaultCountry = "United States", onCountryChange, onPostalCodeChange, countryLabel = "Country", postalCodeLabel = "ZIP / Postal code", legendText = "Billing address", streetInputProps = {}, stateInputProps = {}, countryInputProps = {}, postalCodeInputProps = {}, className = "", theme = {}, }, ref) => {
|
|
78
|
+
const InputAddress = React__default.forwardRef(({ state = 'default', size = 'md', errorMessage, showCountrySelector = true, showPostalCode = true, availableCountries = [], defaultCountry = "United States", onCountryChange, onPostalCodeChange, countryLabel = "Country", postalCodeLabel = "ZIP / Postal code", legendText = "Billing address", streetInputProps = {}, stateInputProps = {}, countryInputProps = {}, postalCodeInputProps = {}, className = "", theme = {}, }, ref) => {
|
|
79
79
|
var _a;
|
|
80
80
|
const isDisabled = state === 'disabled';
|
|
81
81
|
// Clear the error visually as soon as the user starts re-entering after an error.
|
|
@@ -140,10 +140,10 @@ const InputAddress = React__default.forwardRef(({ state = 'default', errorMessag
|
|
|
140
140
|
const isBottomRowSplit = showCountrySelector && showPostalCode;
|
|
141
141
|
// Merge group state into each field's props; strip per-field helperText so only the
|
|
142
142
|
// consolidated message shows at the bottom.
|
|
143
|
-
const { helperText: _st, onChange: _stOnChange, ...streetProps } = { state: fieldState, ...streetInputProps };
|
|
144
|
-
const { helperText: _sa, onChange: _saOnChange, ...stateProps } = { state: fieldState, ...stateInputProps };
|
|
145
|
-
const { helperText: _co, className: _coClass, ...countryProps } = { state: fieldState, ...countryInputProps };
|
|
146
|
-
const { helperText: _pc, ...postalProps } = { state: fieldState, ...postalCodeInputProps };
|
|
143
|
+
const { helperText: _st, onChange: _stOnChange, ...streetProps } = { state: fieldState, size, ...streetInputProps };
|
|
144
|
+
const { helperText: _sa, onChange: _saOnChange, ...stateProps } = { state: fieldState, size, ...stateInputProps };
|
|
145
|
+
const { helperText: _co, className: _coClass, ...countryProps } = { state: fieldState, size, ...countryInputProps };
|
|
146
|
+
const { helperText: _pc, ...postalProps } = { state: fieldState, size, ...postalCodeInputProps };
|
|
147
147
|
return (jsxs("fieldset", { ref: ref, className: `w-full border-0 m-0 p-0 ${isInvalid ? 'state-invalid' : ''} ${className}`, "data-testid": "input-address-fieldset", "aria-invalid": isInvalid || undefined, "aria-errormessage": isInvalid && errorMessage ? errorId : undefined, children: [jsx("legend", { className: `block text-sm/6 font-medium mb-2 text-[var(--color-text-primary)] ${(_a = mergedTheme.legendStyles) !== null && _a !== void 0 ? _a : ""}`, children: legendText }), jsxs("div", { className: `relative grid gap-0 ${mergedTheme.contentStyles}`, "data-testid": "input-address-content", children: [jsx("div", { className: "w-full relative focus-within:z-10 hover:z-10", "data-testid": "input-address-street", children: jsx(Input, { id: streetId, type: "text", placeholder: "Street address", "aria-label": "street address", inputGroupClassName: "rounded-b-none", ...streetProps, onChange: markDirty(_stOnChange) }) }), jsx("div", { className: "w-full -mt-[0.5px] relative focus-within:z-10 hover:z-10", "data-testid": "input-address-state", children: jsx(Input, { id: stateId, type: "text", placeholder: "State", "aria-label": "state", inputGroupClassName: showBottomRow ? "rounded-none" : "rounded-t-none", ...stateProps, onChange: markDirty(_saOnChange) }) }), showBottomRow && (jsxs("div", { className: cn("grid grid-cols-1 w-full -mt-px relative focus-within:z-10 hover:z-10", isBottomRowSplit && "sm:grid-cols-2"), children: [showCountrySelector && (jsx("div", { className: `${mergedTheme.countryWrapperStyles} w-full sm:pr-0 relative focus-within:z-10 hover:z-10`, "data-testid": "input-address-country", children: jsx(Select, { id: countryId, options: countryOptions, value: country, onChange: handleCountryChange, placeholder: countryLabel, searchable: true, searchPlaceholder: `Search ${countryLabel.toLowerCase()}`, disabled: isDisabled,
|
|
148
148
|
// className lands on the Select trigger button (which carries the same
|
|
149
149
|
// inputGroup border/radius as Input's inputGroupClassName target), so the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { InputProps, InputTheme } from '../Input/Input.types';
|
|
3
|
-
import {
|
|
3
|
+
import { SelectSingleProps } from '../Select/Select.types';
|
|
4
4
|
/**
|
|
5
5
|
* InputAddress component props
|
|
6
6
|
* @property {boolean} showCountrySelector - Whether to show the country selector
|
|
@@ -17,6 +17,13 @@ import { SelectProps } from '../Select/Select.types';
|
|
|
17
17
|
export interface InputAddressProps {
|
|
18
18
|
/** Visual/validation state of the entire address group */
|
|
19
19
|
state?: 'default' | 'disabled' | 'invalid';
|
|
20
|
+
/**
|
|
21
|
+
* Size of every field in the group, from the shared `--form-*` scale, so the
|
|
22
|
+
* address block lines up with the Inputs and Selects around it. A per-field
|
|
23
|
+
* `*InputProps.size` still wins.
|
|
24
|
+
* @default 'md'
|
|
25
|
+
*/
|
|
26
|
+
size?: InputProps['size'];
|
|
20
27
|
/** Consolidated error message shown below all fields when `state="invalid"` */
|
|
21
28
|
errorMessage?: React.ReactNode;
|
|
22
29
|
/** Whether to show the country selector */
|
|
@@ -42,7 +49,7 @@ export interface InputAddressProps {
|
|
|
42
49
|
/** Props passed to the state input */
|
|
43
50
|
stateInputProps?: Omit<InputProps, 'ref'>;
|
|
44
51
|
/** Props passed to the country Select (e.g. `searchable`, `placement`, `theme`) */
|
|
45
|
-
countryInputProps?: Partial<
|
|
52
|
+
countryInputProps?: Partial<SelectSingleProps<string>>;
|
|
46
53
|
/** Props passed to the postal code input */
|
|
47
54
|
postalCodeInputProps?: Omit<InputProps, 'ref'>;
|
|
48
55
|
/** Class name for the container */
|