@mks2508/mks-ui 0.5.4 → 0.5.8
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/react-ui/primitives/waapi/Gooey/Gooey.types.d.ts +23 -4
- package/dist/react-ui/primitives/waapi/Gooey/Gooey.types.d.ts.map +1 -1
- package/dist/react-ui/primitives/waapi/Gooey/GooeyCanvas.d.ts +2 -2
- package/dist/react-ui/primitives/waapi/Gooey/GooeyCanvas.d.ts.map +1 -1
- package/dist/react-ui/primitives/waapi/Gooey/GooeyCanvas.js +292 -31
- package/dist/react-ui/primitives/waapi/Gooey/gooey-utils.d.ts +7 -0
- package/dist/react-ui/primitives/waapi/Gooey/gooey-utils.d.ts.map +1 -1
- package/dist/react-ui/primitives/waapi/Gooey/gooey-utils.js +6 -1
- package/dist/react-ui/ui/DynamicToggle/{DynamicToggle-Cm6-VceQ.css → DynamicToggle-DJLwEkHr.css} +116 -51
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.css +116 -51
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.styles.d.ts +1 -0
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.styles.d.ts.map +1 -1
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.styles.js +9 -3
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.types.d.ts +61 -31
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.types.d.ts.map +1 -1
- package/dist/react-ui/ui/DynamicToggle/index.d.ts +9 -3
- package/dist/react-ui/ui/DynamicToggle/index.d.ts.map +1 -1
- package/dist/react-ui/ui/DynamicToggle/index.js +68 -37
- package/package.json +52 -13
- package/src/assets/react.svg +0 -1
- package/src/core/index.ts +0 -7
- package/src/core/types.ts +0 -82
- package/src/css.d.ts +0 -7
- package/src/index.css +0 -129
- package/src/index.ts +0 -29
- package/src/react-ui/blocks/Terminal/ResttyAdapter.ts +0 -278
- package/src/react-ui/blocks/Terminal/Terminal.adapter.ts +0 -97
- package/src/react-ui/blocks/Terminal/Terminal.theme.restty.ts +0 -155
- package/src/react-ui/blocks/Terminal/Terminal.theme.ts +0 -80
- package/src/react-ui/blocks/Terminal/Terminal.types.ts +0 -438
- package/src/react-ui/blocks/Terminal/TerminalDisplay.styles.ts +0 -38
- package/src/react-ui/blocks/Terminal/TerminalDisplay.tsx +0 -254
- package/src/react-ui/blocks/Terminal/TerminalDisplay.types.ts +0 -73
- package/src/react-ui/blocks/Terminal/TerminalPanel.tsx +0 -269
- package/src/react-ui/blocks/Terminal/TerminalRestty.tsx +0 -326
- package/src/react-ui/blocks/Terminal/TerminalXterm.tsx +0 -230
- package/src/react-ui/blocks/Terminal/XTermAdapter.ts +0 -163
- package/src/react-ui/blocks/Terminal/chrome.ts +0 -25
- package/src/react-ui/blocks/Terminal/components/LogLineBadges.tsx +0 -316
- package/src/react-ui/blocks/Terminal/components/SpecializedSyntaxHighlighter.tsx +0 -218
- package/src/react-ui/blocks/Terminal/components/SyntaxHighlight.tsx +0 -386
- package/src/react-ui/blocks/Terminal/components/TerminalLogBadge.tsx +0 -67
- package/src/react-ui/blocks/Terminal/components/index.ts +0 -10
- package/src/react-ui/blocks/Terminal/display.ts +0 -46
- package/src/react-ui/blocks/Terminal/hooks/index.ts +0 -22
- package/src/react-ui/blocks/Terminal/hooks/useTerminalSettings.ts +0 -229
- package/src/react-ui/blocks/Terminal/hooks/useTerminalWebSocket.ts +0 -292
- package/src/react-ui/blocks/Terminal/index.ts +0 -111
- package/src/react-ui/blocks/Terminal/panel/LogLinesViewer.tsx +0 -330
- package/src/react-ui/blocks/Terminal/panel/TerminalDebugPanel.tsx +0 -242
- package/src/react-ui/blocks/Terminal/panel/TerminalFilterDropdown.tsx +0 -202
- package/src/react-ui/blocks/Terminal/panel/TerminalFilterTabs.tsx +0 -140
- package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanel.tsx +0 -68
- package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanel.types.ts +0 -85
- package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanelRestty.tsx +0 -383
- package/src/react-ui/blocks/Terminal/panel/TerminalInteractivePanelXterm.tsx +0 -439
- package/src/react-ui/blocks/Terminal/panel/TerminalLogsPanel.tsx +0 -550
- package/src/react-ui/blocks/Terminal/panel/TerminalLogsPanel.types.ts +0 -259
- package/src/react-ui/blocks/Terminal/panel/TerminalPanelChrome.styles.ts +0 -75
- package/src/react-ui/blocks/Terminal/panel/TerminalPanelChrome.tsx +0 -266
- package/src/react-ui/blocks/Terminal/panel/TerminalPanelChrome.types.ts +0 -82
- package/src/react-ui/blocks/Terminal/panel/TerminalPanelFooter.tsx +0 -112
- package/src/react-ui/blocks/Terminal/panel/TerminalPanelHeader.tsx +0 -178
- package/src/react-ui/blocks/Terminal/panel/TerminalPanelToolbar.tsx +0 -203
- package/src/react-ui/blocks/Terminal/panel/TerminalSessionControl.tsx +0 -252
- package/src/react-ui/blocks/Terminal/panel/TerminalSessionTabs.tsx +0 -334
- package/src/react-ui/blocks/Terminal/panel/TerminalSettingsPopover.tsx +0 -261
- package/src/react-ui/blocks/Terminal/panel/TerminalThemeSelector.tsx +0 -248
- package/src/react-ui/blocks/Terminal/panel/index.ts +0 -72
- package/src/react-ui/blocks/Terminal/panel/terminal-filter-dropdown.module.css +0 -59
- package/src/react-ui/blocks/Terminal/panel/terminal-session-tabs.module.css +0 -59
- package/src/react-ui/blocks/Terminal/parsing/BadgeFormatter.ts +0 -180
- package/src/react-ui/blocks/Terminal/parsing/HttpLogParser.ts +0 -248
- package/src/react-ui/blocks/Terminal/parsing/LogParser.types.ts +0 -283
- package/src/react-ui/blocks/Terminal/parsing/LogParserService.ts +0 -686
- package/src/react-ui/blocks/Terminal/parsing/MultilineAggregator.ts +0 -466
- package/src/react-ui/blocks/Terminal/parsing/PersistentLogBuffer.ts +0 -343
- package/src/react-ui/blocks/Terminal/parsing/SyntaxHighlighter.ts +0 -167
- package/src/react-ui/blocks/Terminal/parsing/TableParser.ts +0 -348
- package/src/react-ui/blocks/Terminal/parsing/ansi/AnsiColorMapper.ts +0 -251
- package/src/react-ui/blocks/Terminal/parsing/ansi/AnsiParser.ts +0 -390
- package/src/react-ui/blocks/Terminal/parsing/ansi/ansi.constants.ts +0 -320
- package/src/react-ui/blocks/Terminal/parsing/ansi/index.ts +0 -20
- package/src/react-ui/blocks/Terminal/parsing/index.ts +0 -69
- package/src/react-ui/blocks/Terminal/parsing/levels/LogLevel.types.ts +0 -68
- package/src/react-ui/blocks/Terminal/parsing/levels/LogLevelDetector.ts +0 -436
- package/src/react-ui/blocks/Terminal/parsing/levels/index.ts +0 -14
- package/src/react-ui/blocks/index.ts +0 -11
- package/src/react-ui/components/MorphingPopover/MorphingPopover.types.ts +0 -49
- package/src/react-ui/components/MorphingPopover/index.tsx +0 -186
- package/src/react-ui/components/MorphingPopover/morphing-popover.module.css +0 -153
- package/src/react-ui/components/index.ts +0 -9
- package/src/react-ui/hooks/Animation/UseAutoHeight.tsx +0 -123
- package/src/react-ui/hooks/DOM/UseIsInView.tsx +0 -44
- package/src/react-ui/hooks/Formatting/UseListFormat.ts +0 -134
- package/src/react-ui/hooks/State/UseControlledState.tsx +0 -57
- package/src/react-ui/hooks/State/UseDataState.tsx +0 -76
- package/src/react-ui/hooks/index.ts +0 -20
- package/src/react-ui/icons/index.ts +0 -12
- package/src/react-ui/icons/lucide-animated/activity.tsx +0 -109
- package/src/react-ui/icons/lucide-animated/arrow-down-to-line.tsx +0 -51
- package/src/react-ui/icons/lucide-animated/arrow-up.tsx +0 -50
- package/src/react-ui/icons/lucide-animated/bell-electric.tsx +0 -124
- package/src/react-ui/icons/lucide-animated/bell.tsx +0 -93
- package/src/react-ui/icons/lucide-animated/bot.tsx +0 -122
- package/src/react-ui/icons/lucide-animated/box.tsx +0 -117
- package/src/react-ui/icons/lucide-animated/check.tsx +0 -21
- package/src/react-ui/icons/lucide-animated/circle-check.tsx +0 -107
- package/src/react-ui/icons/lucide-animated/delete.tsx +0 -133
- package/src/react-ui/icons/lucide-animated/download.tsx +0 -99
- package/src/react-ui/icons/lucide-animated/edit-2.tsx +0 -21
- package/src/react-ui/icons/lucide-animated/globe.tsx +0 -23
- package/src/react-ui/icons/lucide-animated/home.tsx +0 -103
- package/src/react-ui/icons/lucide-animated/index.ts +0 -38
- package/src/react-ui/icons/lucide-animated/layers.tsx +0 -23
- package/src/react-ui/icons/lucide-animated/layout-panel-top.tsx +0 -143
- package/src/react-ui/icons/lucide-animated/list.tsx +0 -54
- package/src/react-ui/icons/lucide-animated/package.tsx +0 -24
- package/src/react-ui/icons/lucide-animated/palette.tsx +0 -25
- package/src/react-ui/icons/lucide-animated/plus.tsx +0 -92
- package/src/react-ui/icons/lucide-animated/refresh-cw.tsx +0 -24
- package/src/react-ui/icons/lucide-animated/rocket.tsx +0 -24
- package/src/react-ui/icons/lucide-animated/save.tsx +0 -23
- package/src/react-ui/icons/lucide-animated/search.tsx +0 -94
- package/src/react-ui/icons/lucide-animated/settings.tsx +0 -92
- package/src/react-ui/icons/lucide-animated/terminal.tsx +0 -46
- package/src/react-ui/icons/lucide-animated/trash-2.tsx +0 -25
- package/src/react-ui/icons/lucide-animated/trending-down.tsx +0 -151
- package/src/react-ui/icons/lucide-animated/trending-up.tsx +0 -150
- package/src/react-ui/icons/lucide-animated/type.tsx +0 -23
- package/src/react-ui/icons/lucide-animated/upload.tsx +0 -23
- package/src/react-ui/icons/lucide-animated/x.tsx +0 -102
- package/src/react-ui/index.ts +0 -30
- package/src/react-ui/lib/get-strict-context.tsx +0 -56
- package/src/react-ui/lib/icon-wrapper.tsx +0 -70
- package/src/react-ui/lib/index.ts +0 -9
- package/src/react-ui/lib/utils.ts +0 -24
- package/src/react-ui/primitives/AutoHeight/index.tsx +0 -74
- package/src/react-ui/primitives/CountingNumber/index.tsx +0 -147
- package/src/react-ui/primitives/Highlight/Highlight.types.ts +0 -136
- package/src/react-ui/primitives/Highlight/index.tsx +0 -577
- package/src/react-ui/primitives/Slot/index.tsx +0 -128
- package/src/react-ui/primitives/index.ts +0 -16
- package/src/react-ui/primitives/waapi/Gooey/Gooey.types.ts +0 -123
- package/src/react-ui/primitives/waapi/Gooey/GooeyCanvas.tsx +0 -80
- package/src/react-ui/primitives/waapi/Gooey/GooeyFilter.tsx +0 -77
- package/src/react-ui/primitives/waapi/Gooey/MorphPath.tsx +0 -58
- package/src/react-ui/primitives/waapi/Gooey/gooey-utils.ts +0 -244
- package/src/react-ui/primitives/waapi/Gooey/index.ts +0 -50
- package/src/react-ui/primitives/waapi/Gooey/useMorphPath.ts +0 -48
- package/src/react-ui/primitives/waapi/Morph/Morph.types.ts +0 -106
- package/src/react-ui/primitives/waapi/Morph/MorphContext.tsx +0 -21
- package/src/react-ui/primitives/waapi/Morph/index.tsx +0 -56
- package/src/react-ui/primitives/waapi/Morph/techniques/index.ts +0 -12
- package/src/react-ui/primitives/waapi/Morph/techniques/useCSSGridMorph.ts +0 -89
- package/src/react-ui/primitives/waapi/Morph/techniques/useFLIPClipPath.ts +0 -176
- package/src/react-ui/primitives/waapi/Morph/techniques/useViewTransitions.ts +0 -87
- package/src/react-ui/primitives/waapi/Morph/useMorph.ts +0 -101
- package/src/react-ui/primitives/waapi/Reorder/Reorder.types.ts +0 -177
- package/src/react-ui/primitives/waapi/Reorder/index.tsx +0 -260
- package/src/react-ui/primitives/waapi/Reorder/useReorder.ts +0 -47
- package/src/react-ui/primitives/waapi/Reorder/useReorderPresence.ts +0 -209
- package/src/react-ui/primitives/waapi/Reorder/utils/separatorCoordination.ts +0 -104
- package/src/react-ui/primitives/waapi/SlidingNumber/SlidingNumber.styles.ts +0 -14
- package/src/react-ui/primitives/waapi/SlidingNumber/SlidingNumber.types.ts +0 -84
- package/src/react-ui/primitives/waapi/SlidingNumber/index.tsx +0 -474
- package/src/react-ui/primitives/waapi/SlidingText/SlidingText.styles.ts +0 -32
- package/src/react-ui/primitives/waapi/SlidingText/SlidingText.types.ts +0 -69
- package/src/react-ui/primitives/waapi/SlidingText/index.tsx +0 -140
- package/src/react-ui/primitives/waapi/core/animationConstants.ts +0 -215
- package/src/react-ui/primitives/waapi/core/index.ts +0 -53
- package/src/react-ui/primitives/waapi/core/types.ts +0 -200
- package/src/react-ui/primitives/waapi/core/useAnimationOrchestrator.ts +0 -430
- package/src/react-ui/primitives/waapi/core/useElementRegistry.ts +0 -81
- package/src/react-ui/primitives/waapi/core/useFLIPAnimation.ts +0 -138
- package/src/react-ui/primitives/waapi/core/usePositionCapture.ts +0 -106
- package/src/react-ui/primitives/waapi/index.ts +0 -139
- package/src/react-ui/styles/animations.css +0 -369
- package/src/react-ui/ui/Accordion/Accordion.styles.ts +0 -72
- package/src/react-ui/ui/Accordion/Accordion.types.ts +0 -199
- package/src/react-ui/ui/Accordion/index.tsx +0 -362
- package/src/react-ui/ui/AlertDialog/AlertDialog.styles.ts +0 -38
- package/src/react-ui/ui/AlertDialog/AlertDialog.types.ts +0 -296
- package/src/react-ui/ui/AlertDialog/index.tsx +0 -540
- package/src/react-ui/ui/Badge/Badge.styles.ts +0 -43
- package/src/react-ui/ui/Badge/Badge.types.ts +0 -26
- package/src/react-ui/ui/Badge/index.tsx +0 -34
- package/src/react-ui/ui/Button/Button.styles.ts +0 -57
- package/src/react-ui/ui/Button/Button.types.ts +0 -63
- package/src/react-ui/ui/Button/index.tsx +0 -155
- package/src/react-ui/ui/Card/Card.styles.ts +0 -32
- package/src/react-ui/ui/Card/Card.types.ts +0 -39
- package/src/react-ui/ui/Card/index.tsx +0 -130
- package/src/react-ui/ui/Checkbox/Checkbox.styles.ts +0 -40
- package/src/react-ui/ui/Checkbox/Checkbox.types.ts +0 -98
- package/src/react-ui/ui/Checkbox/index.tsx +0 -233
- package/src/react-ui/ui/Combobox/Combobox.styles.ts +0 -34
- package/src/react-ui/ui/Combobox/Combobox.types.ts +0 -89
- package/src/react-ui/ui/Combobox/index.tsx +0 -331
- package/src/react-ui/ui/CornerBracket/CornerBracket.styles.ts +0 -38
- package/src/react-ui/ui/CornerBracket/CornerBracket.types.ts +0 -15
- package/src/react-ui/ui/CornerBracket/index.tsx +0 -49
- package/src/react-ui/ui/DataCard/DataCard.styles.ts +0 -94
- package/src/react-ui/ui/DataCard/DataCard.types.ts +0 -125
- package/src/react-ui/ui/DataCard/index.tsx +0 -340
- package/src/react-ui/ui/Dialog/Dialog.styles.ts +0 -59
- package/src/react-ui/ui/Dialog/Dialog.types.ts +0 -284
- package/src/react-ui/ui/Dialog/index.tsx +0 -452
- package/src/react-ui/ui/DropdownMenu/DropdownMenu.styles.ts +0 -35
- package/src/react-ui/ui/DropdownMenu/DropdownMenu.types.ts +0 -81
- package/src/react-ui/ui/DropdownMenu/index.tsx +0 -300
- package/src/react-ui/ui/DynamicToggle/DynamicToggle.css +0 -303
- package/src/react-ui/ui/DynamicToggle/DynamicToggle.styles.ts +0 -85
- package/src/react-ui/ui/DynamicToggle/DynamicToggle.types.ts +0 -174
- package/src/react-ui/ui/DynamicToggle/index.tsx +0 -294
- package/src/react-ui/ui/DynamicToggle/prototype-v7.html +0 -615
- package/src/react-ui/ui/DynamicToggle/prototype.html +0 -419
- package/src/react-ui/ui/Field/Field.styles.ts +0 -47
- package/src/react-ui/ui/Field/Field.types.ts +0 -60
- package/src/react-ui/ui/Field/index.tsx +0 -254
- package/src/react-ui/ui/Input/Input.styles.ts +0 -11
- package/src/react-ui/ui/Input/Input.types.ts +0 -10
- package/src/react-ui/ui/Input/index.tsx +0 -32
- package/src/react-ui/ui/InputGroup/InputGroup.styles.ts +0 -53
- package/src/react-ui/ui/InputGroup/InputGroup.types.ts +0 -44
- package/src/react-ui/ui/InputGroup/index.tsx +0 -149
- package/src/react-ui/ui/Label/Label.styles.ts +0 -10
- package/src/react-ui/ui/Label/Label.types.ts +0 -9
- package/src/react-ui/ui/Label/index.tsx +0 -27
- package/src/react-ui/ui/Menu/Menu.styles.ts +0 -71
- package/src/react-ui/ui/Menu/Menu.types.ts +0 -425
- package/src/react-ui/ui/Menu/index.tsx +0 -900
- package/src/react-ui/ui/Popover/Popover.styles.ts +0 -55
- package/src/react-ui/ui/Popover/Popover.types.ts +0 -261
- package/src/react-ui/ui/Popover/index.tsx +0 -422
- package/src/react-ui/ui/Progress/Progress.styles.ts +0 -36
- package/src/react-ui/ui/Progress/Progress.types.ts +0 -162
- package/src/react-ui/ui/Progress/index.tsx +0 -254
- package/src/react-ui/ui/Select/Select.styles.ts +0 -30
- package/src/react-ui/ui/Select/Select.types.ts +0 -51
- package/src/react-ui/ui/Select/index.tsx +0 -225
- package/src/react-ui/ui/Separator/Separator.styles.ts +0 -10
- package/src/react-ui/ui/Separator/Separator.types.ts +0 -10
- package/src/react-ui/ui/Separator/index.tsx +0 -37
- package/src/react-ui/ui/Switch/Switch.styles.ts +0 -50
- package/src/react-ui/ui/Switch/Switch.types.ts +0 -155
- package/src/react-ui/ui/Switch/index.tsx +0 -253
- package/src/react-ui/ui/Tabs/Tabs.css +0 -39
- package/src/react-ui/ui/Tabs/Tabs.styles.ts +0 -148
- package/src/react-ui/ui/Tabs/Tabs.types.ts +0 -255
- package/src/react-ui/ui/Tabs/index.tsx +0 -529
- package/src/react-ui/ui/TextFlow/TextFlow.styles.ts +0 -36
- package/src/react-ui/ui/TextFlow/TextFlow.types.ts +0 -118
- package/src/react-ui/ui/TextFlow/index.tsx +0 -276
- package/src/react-ui/ui/Textarea/Textarea.styles.ts +0 -10
- package/src/react-ui/ui/Textarea/Textarea.types.ts +0 -9
- package/src/react-ui/ui/Textarea/index.tsx +0 -27
- package/src/react-ui/ui/Tooltip/Tooltip.styles.ts +0 -43
- package/src/react-ui/ui/Tooltip/Tooltip.types.ts +0 -253
- package/src/react-ui/ui/Tooltip/index.tsx +0 -394
- package/src/react-ui/ui/index.ts +0 -41
- package/src/types/css-modules.d.ts +0 -18
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Checkbox component with animated SVG indicator.
|
|
5
|
-
*
|
|
6
|
-
* Built on Base UI Checkbox primitives with Motion animations for
|
|
7
|
-
* tap/hover interactions and an animated checkmark/indeterminate indicator.
|
|
8
|
-
*
|
|
9
|
-
* @module @mks2508/mks-ui/react/ui/Checkbox
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```tsx
|
|
13
|
-
* import { Checkbox, CheckboxIndicator } from '@mks2508/mks-ui';
|
|
14
|
-
*
|
|
15
|
-
* function MyCheckbox() {
|
|
16
|
-
* const [checked, setChecked] = useState(false);
|
|
17
|
-
* return (
|
|
18
|
-
* <Checkbox checked={checked} onCheckedChange={setChecked}>
|
|
19
|
-
* <CheckboxIndicator />
|
|
20
|
-
* </Checkbox>
|
|
21
|
-
* );
|
|
22
|
-
* }
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
import * as React from 'react';
|
|
27
|
-
import { Checkbox as CheckboxPrimitive } from '@base-ui/react/checkbox';
|
|
28
|
-
import { motion } from 'motion/react';
|
|
29
|
-
|
|
30
|
-
import { cn } from '@/react-ui/lib/utils';
|
|
31
|
-
import { getStrictContext } from '@/react-ui/lib/get-strict-context';
|
|
32
|
-
import { useControlledState } from '@/react-ui/hooks/State/UseControlledState';
|
|
33
|
-
|
|
34
|
-
import { checkboxStyles } from './Checkbox.styles';
|
|
35
|
-
import type {
|
|
36
|
-
CheckboxContextType,
|
|
37
|
-
ICheckboxProps,
|
|
38
|
-
ICheckboxIndicatorProps,
|
|
39
|
-
} from './Checkbox.types';
|
|
40
|
-
|
|
41
|
-
const [CheckboxProvider, useCheckbox] =
|
|
42
|
-
getStrictContext<CheckboxContextType>('CheckboxContext');
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Checkbox root component with animated tap and hover interactions.
|
|
46
|
-
*
|
|
47
|
-
* Wraps Base UI `Checkbox.Root` with a `motion.button` render element,
|
|
48
|
-
* providing spring-based press and hover scale animations. Supports both
|
|
49
|
-
* controlled and uncontrolled checked state via `useControlledState`.
|
|
50
|
-
*
|
|
51
|
-
* @param props - Checkbox props including Base UI root props, motion props, slots, and config
|
|
52
|
-
* @returns A checkbox button element with animation support
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* ```tsx
|
|
56
|
-
* <Checkbox
|
|
57
|
-
* checked={isChecked}
|
|
58
|
-
* onCheckedChange={setIsChecked}
|
|
59
|
-
* slots={{ root: 'border-2 border-cyan-500 rounded-md' }}
|
|
60
|
-
* >
|
|
61
|
-
* <CheckboxIndicator />
|
|
62
|
-
* </Checkbox>
|
|
63
|
-
* ```
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* ```tsx
|
|
67
|
-
* // Indeterminate state
|
|
68
|
-
* <Checkbox indeterminate>
|
|
69
|
-
* <CheckboxIndicator />
|
|
70
|
-
* </Checkbox>
|
|
71
|
-
* ```
|
|
72
|
-
*/
|
|
73
|
-
function Checkbox({
|
|
74
|
-
name,
|
|
75
|
-
checked,
|
|
76
|
-
defaultChecked,
|
|
77
|
-
onCheckedChange,
|
|
78
|
-
indeterminate,
|
|
79
|
-
value,
|
|
80
|
-
nativeButton,
|
|
81
|
-
parent,
|
|
82
|
-
disabled,
|
|
83
|
-
readOnly,
|
|
84
|
-
required,
|
|
85
|
-
inputRef,
|
|
86
|
-
id,
|
|
87
|
-
className,
|
|
88
|
-
slots,
|
|
89
|
-
config,
|
|
90
|
-
...props
|
|
91
|
-
}: ICheckboxProps) {
|
|
92
|
-
const [isChecked, setIsChecked] = useControlledState({
|
|
93
|
-
value: checked,
|
|
94
|
-
defaultValue: defaultChecked,
|
|
95
|
-
onChange: onCheckedChange,
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
const tapScale = config?.tapScale ?? 0.95;
|
|
99
|
-
const hoverScale = config?.hoverScale ?? 1.05;
|
|
100
|
-
|
|
101
|
-
return (
|
|
102
|
-
<CheckboxProvider
|
|
103
|
-
value={{ isChecked, setIsChecked, isIndeterminate: indeterminate }}
|
|
104
|
-
>
|
|
105
|
-
<CheckboxPrimitive.Root
|
|
106
|
-
name={name}
|
|
107
|
-
defaultChecked={defaultChecked}
|
|
108
|
-
checked={checked}
|
|
109
|
-
onCheckedChange={setIsChecked}
|
|
110
|
-
indeterminate={indeterminate}
|
|
111
|
-
value={value}
|
|
112
|
-
nativeButton={nativeButton}
|
|
113
|
-
parent={parent}
|
|
114
|
-
disabled={disabled}
|
|
115
|
-
readOnly={readOnly}
|
|
116
|
-
required={required}
|
|
117
|
-
inputRef={inputRef}
|
|
118
|
-
id={id}
|
|
119
|
-
render={
|
|
120
|
-
<motion.button
|
|
121
|
-
data-slot="checkbox"
|
|
122
|
-
whileTap={{ scale: tapScale }}
|
|
123
|
-
whileHover={{ scale: hoverScale }}
|
|
124
|
-
className={cn(checkboxStyles.root, slots?.root, className)}
|
|
125
|
-
{...props}
|
|
126
|
-
/>
|
|
127
|
-
}
|
|
128
|
-
/>
|
|
129
|
-
</CheckboxProvider>
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* CheckboxIndicator renders an animated SVG checkmark or indeterminate line.
|
|
135
|
-
*
|
|
136
|
-
* Uses Motion `pathLength` and `opacity` variants for smooth check/uncheck
|
|
137
|
-
* transitions. Remains mounted (`keepMounted`) to enable exit animations.
|
|
138
|
-
*
|
|
139
|
-
* @param props - SVG motion props plus optional slot overrides
|
|
140
|
-
* @returns An animated SVG indicator element
|
|
141
|
-
*
|
|
142
|
-
* @example
|
|
143
|
-
* ```tsx
|
|
144
|
-
* <Checkbox checked={isChecked} onCheckedChange={setIsChecked}>
|
|
145
|
-
* <CheckboxIndicator className="size-4 text-white" />
|
|
146
|
-
* </Checkbox>
|
|
147
|
-
* ```
|
|
148
|
-
*
|
|
149
|
-
* @example
|
|
150
|
-
* ```tsx
|
|
151
|
-
* // With slot overrides
|
|
152
|
-
* <CheckboxIndicator slots={{ indicator: 'size-3.5' }} />
|
|
153
|
-
* ```
|
|
154
|
-
*/
|
|
155
|
-
function CheckboxIndicator({ className, slots, ...props }: ICheckboxIndicatorProps) {
|
|
156
|
-
const { isChecked, isIndeterminate } = useCheckbox();
|
|
157
|
-
|
|
158
|
-
return (
|
|
159
|
-
<CheckboxPrimitive.Indicator
|
|
160
|
-
keepMounted
|
|
161
|
-
render={
|
|
162
|
-
<motion.svg
|
|
163
|
-
data-slot="checkbox-indicator"
|
|
164
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
165
|
-
fill="none"
|
|
166
|
-
viewBox="0 0 24 24"
|
|
167
|
-
strokeWidth="3.5"
|
|
168
|
-
stroke="currentColor"
|
|
169
|
-
initial="unchecked"
|
|
170
|
-
animate={isChecked ? 'checked' : 'unchecked'}
|
|
171
|
-
className={cn(checkboxStyles.indicator, slots?.indicator, className)}
|
|
172
|
-
{...props}
|
|
173
|
-
>
|
|
174
|
-
{isIndeterminate ? (
|
|
175
|
-
<motion.line
|
|
176
|
-
x1="5"
|
|
177
|
-
y1="12"
|
|
178
|
-
x2="19"
|
|
179
|
-
y2="12"
|
|
180
|
-
strokeLinecap="round"
|
|
181
|
-
initial={{ pathLength: 0, opacity: 0 }}
|
|
182
|
-
animate={{
|
|
183
|
-
pathLength: 1,
|
|
184
|
-
opacity: 1,
|
|
185
|
-
transition: { duration: 0.2 },
|
|
186
|
-
}}
|
|
187
|
-
/>
|
|
188
|
-
) : (
|
|
189
|
-
<motion.path
|
|
190
|
-
strokeLinecap="round"
|
|
191
|
-
strokeLinejoin="round"
|
|
192
|
-
d="M4.5 12.75l6 6 9-13.5"
|
|
193
|
-
variants={{
|
|
194
|
-
checked: {
|
|
195
|
-
pathLength: 1,
|
|
196
|
-
opacity: 1,
|
|
197
|
-
transition: {
|
|
198
|
-
duration: 0.2,
|
|
199
|
-
delay: 0.2,
|
|
200
|
-
},
|
|
201
|
-
},
|
|
202
|
-
unchecked: {
|
|
203
|
-
pathLength: 0,
|
|
204
|
-
opacity: 0,
|
|
205
|
-
transition: {
|
|
206
|
-
duration: 0.2,
|
|
207
|
-
},
|
|
208
|
-
},
|
|
209
|
-
}}
|
|
210
|
-
/>
|
|
211
|
-
)}
|
|
212
|
-
</motion.svg>
|
|
213
|
-
}
|
|
214
|
-
/>
|
|
215
|
-
);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
export {
|
|
219
|
-
Checkbox,
|
|
220
|
-
CheckboxIndicator,
|
|
221
|
-
useCheckbox,
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
// Re-exports
|
|
225
|
-
export type {
|
|
226
|
-
ICheckboxProps,
|
|
227
|
-
ICheckboxIndicatorProps,
|
|
228
|
-
ICheckboxConfig,
|
|
229
|
-
CheckboxContextType,
|
|
230
|
-
CheckboxSlot,
|
|
231
|
-
} from './Checkbox.types';
|
|
232
|
-
|
|
233
|
-
export { checkboxStyles } from './Checkbox.styles';
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { StyleSlots } from '@/core/types';
|
|
2
|
-
|
|
3
|
-
/** Visual regions for the Combobox component family. */
|
|
4
|
-
type ComboboxSlot =
|
|
5
|
-
| 'root'
|
|
6
|
-
| 'trigger'
|
|
7
|
-
| 'content'
|
|
8
|
-
| 'list'
|
|
9
|
-
| 'item'
|
|
10
|
-
| 'label'
|
|
11
|
-
| 'separator'
|
|
12
|
-
| 'empty'
|
|
13
|
-
| 'chips'
|
|
14
|
-
| 'chip'
|
|
15
|
-
| 'chipInput';
|
|
16
|
-
|
|
17
|
-
const comboboxStyles: StyleSlots<ComboboxSlot> = {
|
|
18
|
-
root: '',
|
|
19
|
-
trigger: '[&_svg:not([class*=\'size-\'])]:size-4',
|
|
20
|
-
content:
|
|
21
|
-
'bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:border-input/30 overflow-hidden rounded-lg shadow-md ring-1 duration-100 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:shadow-none data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) data-[chips=true]:min-w-(--anchor-width)',
|
|
22
|
-
list: 'no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 p-1 data-empty:p-0 overflow-y-auto overscroll-contain',
|
|
23
|
-
item: 'data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground gap-2 rounded-md py-1 pr-8 pl-1.5 text-sm [&_svg:not([class*=\'size-\'])]:size-4 relative flex w-full cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0',
|
|
24
|
-
label: 'text-muted-foreground px-2 py-1.5 text-xs',
|
|
25
|
-
separator: 'bg-border -mx-1 my-1 h-px',
|
|
26
|
-
empty: 'text-muted-foreground hidden w-full justify-center py-2 text-center text-sm group-data-empty/combobox-content:flex',
|
|
27
|
-
chips:
|
|
28
|
-
'dark:bg-input/30 border-input focus-within:border-ring focus-within:ring-ring/50 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40 has-aria-invalid:border-destructive dark:has-aria-invalid:border-destructive/50 flex min-h-8 flex-wrap items-center gap-1 rounded-lg border bg-transparent bg-clip-padding px-2.5 py-1 text-sm transition-colors focus-within:ring-3 has-aria-invalid:ring-3 has-data-[slot=combobox-chip]:px-1',
|
|
29
|
-
chip: 'bg-muted text-foreground flex h-[calc(--spacing(5.25))] w-fit items-center justify-center gap-1 rounded-sm px-1.5 text-xs font-medium whitespace-nowrap has-data-[slot=combobox-chip-remove]:pr-0 has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50',
|
|
30
|
-
chipInput: 'min-w-16 flex-1 outline-none',
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export { comboboxStyles };
|
|
34
|
-
export type { ComboboxSlot };
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import type { Combobox as ComboboxPrimitive } from '@base-ui/react';
|
|
2
|
-
import type { SlotOverrides } from '@/core/types';
|
|
3
|
-
import type { ComboboxSlot } from './Combobox.styles';
|
|
4
|
-
|
|
5
|
-
/** Props for the Combobox root. */
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
|
-
type IComboboxProps = ComboboxPrimitive.Root.Props<any, any>;
|
|
8
|
-
|
|
9
|
-
/** Props for ComboboxValue. */
|
|
10
|
-
type IComboboxValueProps = ComboboxPrimitive.Value.Props;
|
|
11
|
-
|
|
12
|
-
/** Props for ComboboxTrigger. */
|
|
13
|
-
type IComboboxTriggerProps = ComboboxPrimitive.Trigger.Props;
|
|
14
|
-
|
|
15
|
-
/** Props for ComboboxClear. */
|
|
16
|
-
type IComboboxClearProps = ComboboxPrimitive.Clear.Props;
|
|
17
|
-
|
|
18
|
-
/** Props for ComboboxInput. */
|
|
19
|
-
interface IComboboxInputProps extends ComboboxPrimitive.Input.Props {
|
|
20
|
-
/** Show the trigger arrow button. */
|
|
21
|
-
showTrigger?: boolean;
|
|
22
|
-
/** Show the clear button. */
|
|
23
|
-
showClear?: boolean;
|
|
24
|
-
/** Override classes for combobox visual regions. */
|
|
25
|
-
slots?: SlotOverrides<ComboboxSlot>;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** Props for ComboboxContent. */
|
|
29
|
-
interface IComboboxContentProps
|
|
30
|
-
extends ComboboxPrimitive.Popup.Props,
|
|
31
|
-
Pick<
|
|
32
|
-
ComboboxPrimitive.Positioner.Props,
|
|
33
|
-
'side' | 'align' | 'sideOffset' | 'alignOffset' | 'anchor'
|
|
34
|
-
> {
|
|
35
|
-
slots?: SlotOverrides<ComboboxSlot>;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/** Props for ComboboxList. */
|
|
39
|
-
type IComboboxListProps = ComboboxPrimitive.List.Props;
|
|
40
|
-
|
|
41
|
-
/** Props for ComboboxItem. */
|
|
42
|
-
type IComboboxItemProps = ComboboxPrimitive.Item.Props;
|
|
43
|
-
|
|
44
|
-
/** Props for ComboboxGroup. */
|
|
45
|
-
type IComboboxGroupProps = ComboboxPrimitive.Group.Props;
|
|
46
|
-
|
|
47
|
-
/** Props for ComboboxLabel. */
|
|
48
|
-
type IComboboxLabelProps = ComboboxPrimitive.GroupLabel.Props;
|
|
49
|
-
|
|
50
|
-
/** Props for ComboboxCollection. */
|
|
51
|
-
type IComboboxCollectionProps = ComboboxPrimitive.Collection.Props;
|
|
52
|
-
|
|
53
|
-
/** Props for ComboboxEmpty. */
|
|
54
|
-
type IComboboxEmptyProps = ComboboxPrimitive.Empty.Props;
|
|
55
|
-
|
|
56
|
-
/** Props for ComboboxSeparator. */
|
|
57
|
-
type IComboboxSeparatorProps = ComboboxPrimitive.Separator.Props;
|
|
58
|
-
|
|
59
|
-
/** Props for ComboboxChips. */
|
|
60
|
-
type IComboboxChipsProps = React.ComponentPropsWithRef<typeof ComboboxPrimitive.Chips> &
|
|
61
|
-
ComboboxPrimitive.Chips.Props;
|
|
62
|
-
|
|
63
|
-
/** Props for ComboboxChip. */
|
|
64
|
-
interface IComboboxChipProps extends ComboboxPrimitive.Chip.Props {
|
|
65
|
-
/** Show the remove button on the chip. */
|
|
66
|
-
showRemove?: boolean;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/** Props for ComboboxChipsInput. */
|
|
70
|
-
type IComboboxChipsInputProps = ComboboxPrimitive.Input.Props;
|
|
71
|
-
|
|
72
|
-
export type {
|
|
73
|
-
IComboboxProps,
|
|
74
|
-
IComboboxValueProps,
|
|
75
|
-
IComboboxTriggerProps,
|
|
76
|
-
IComboboxClearProps,
|
|
77
|
-
IComboboxInputProps,
|
|
78
|
-
IComboboxContentProps,
|
|
79
|
-
IComboboxListProps,
|
|
80
|
-
IComboboxItemProps,
|
|
81
|
-
IComboboxGroupProps,
|
|
82
|
-
IComboboxLabelProps,
|
|
83
|
-
IComboboxCollectionProps,
|
|
84
|
-
IComboboxEmptyProps,
|
|
85
|
-
IComboboxSeparatorProps,
|
|
86
|
-
IComboboxChipsProps,
|
|
87
|
-
IComboboxChipProps,
|
|
88
|
-
IComboboxChipsInputProps,
|
|
89
|
-
};
|
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { Combobox as ComboboxPrimitive } from '@base-ui/react';
|
|
3
|
-
|
|
4
|
-
import { cn } from '@/react-ui/lib/utils';
|
|
5
|
-
import { Button } from '@/react-ui/ui/Button';
|
|
6
|
-
import {
|
|
7
|
-
InputGroup,
|
|
8
|
-
InputGroupAddon,
|
|
9
|
-
InputGroupButton,
|
|
10
|
-
InputGroupInput,
|
|
11
|
-
} from '@/react-ui/ui/InputGroup';
|
|
12
|
-
import { HugeiconsIcon } from '@hugeicons/react';
|
|
13
|
-
import { ArrowDown01Icon, Cancel01Icon, Tick02Icon } from '@hugeicons/core-free-icons';
|
|
14
|
-
import { comboboxStyles } from './Combobox.styles';
|
|
15
|
-
import type {
|
|
16
|
-
IComboboxTriggerProps,
|
|
17
|
-
IComboboxClearProps,
|
|
18
|
-
IComboboxInputProps,
|
|
19
|
-
IComboboxContentProps,
|
|
20
|
-
IComboboxListProps,
|
|
21
|
-
IComboboxItemProps,
|
|
22
|
-
IComboboxGroupProps,
|
|
23
|
-
IComboboxLabelProps,
|
|
24
|
-
IComboboxCollectionProps,
|
|
25
|
-
IComboboxEmptyProps,
|
|
26
|
-
IComboboxSeparatorProps,
|
|
27
|
-
IComboboxChipsProps,
|
|
28
|
-
IComboboxChipProps,
|
|
29
|
-
IComboboxChipsInputProps,
|
|
30
|
-
IComboboxValueProps,
|
|
31
|
-
} from './Combobox.types';
|
|
32
|
-
|
|
33
|
-
/** Combobox — root component wrapping Base UI Combobox. */
|
|
34
|
-
const Combobox = ComboboxPrimitive.Root;
|
|
35
|
-
|
|
36
|
-
/** ComboboxValue — displays the selected value. */
|
|
37
|
-
function ComboboxValue({ ...props }: IComboboxValueProps) {
|
|
38
|
-
return <ComboboxPrimitive.Value data-slot="combobox-value" {...props} />;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/** ComboboxTrigger — trigger button with arrow icon. */
|
|
42
|
-
function ComboboxTrigger({ className, children, ...props }: IComboboxTriggerProps) {
|
|
43
|
-
return (
|
|
44
|
-
<ComboboxPrimitive.Trigger
|
|
45
|
-
data-slot="combobox-trigger"
|
|
46
|
-
className={cn(comboboxStyles.trigger, className)}
|
|
47
|
-
{...props}
|
|
48
|
-
>
|
|
49
|
-
{children}
|
|
50
|
-
<HugeiconsIcon
|
|
51
|
-
icon={ArrowDown01Icon}
|
|
52
|
-
strokeWidth={2}
|
|
53
|
-
className="text-muted-foreground size-4 pointer-events-none"
|
|
54
|
-
/>
|
|
55
|
-
</ComboboxPrimitive.Trigger>
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/** ComboboxClear — clears the combobox selection. */
|
|
60
|
-
function ComboboxClear({ className, ...props }: IComboboxClearProps) {
|
|
61
|
-
return (
|
|
62
|
-
<ComboboxPrimitive.Clear
|
|
63
|
-
data-slot="combobox-clear"
|
|
64
|
-
render={<InputGroupButton size="icon-xs" />}
|
|
65
|
-
className={cn(className)}
|
|
66
|
-
{...props}
|
|
67
|
-
>
|
|
68
|
-
<HugeiconsIcon icon={Cancel01Icon} strokeWidth={2} className="pointer-events-none" />
|
|
69
|
-
</ComboboxPrimitive.Clear>
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* ComboboxInput — text input with optional trigger and clear buttons.
|
|
75
|
-
*
|
|
76
|
-
* @param showTrigger - Show dropdown arrow button
|
|
77
|
-
* @param showClear - Show clear button
|
|
78
|
-
*
|
|
79
|
-
* @example
|
|
80
|
-
* ```tsx
|
|
81
|
-
* <Combobox>
|
|
82
|
-
* <ComboboxInput showClear placeholder="Search..." />
|
|
83
|
-
* <ComboboxContent>
|
|
84
|
-
* <ComboboxList>
|
|
85
|
-
* <ComboboxItem>Option 1</ComboboxItem>
|
|
86
|
-
* </ComboboxList>
|
|
87
|
-
* </ComboboxContent>
|
|
88
|
-
* </Combobox>
|
|
89
|
-
* ```
|
|
90
|
-
*/
|
|
91
|
-
function ComboboxInput({
|
|
92
|
-
className,
|
|
93
|
-
children,
|
|
94
|
-
disabled = false,
|
|
95
|
-
showTrigger = true,
|
|
96
|
-
showClear = false,
|
|
97
|
-
...props
|
|
98
|
-
}: IComboboxInputProps) {
|
|
99
|
-
return (
|
|
100
|
-
<InputGroup className={cn('w-auto', className)}>
|
|
101
|
-
<ComboboxPrimitive.Input
|
|
102
|
-
render={<InputGroupInput disabled={disabled} />}
|
|
103
|
-
{...props}
|
|
104
|
-
/>
|
|
105
|
-
<InputGroupAddon align="inline-end">
|
|
106
|
-
{showTrigger && (
|
|
107
|
-
<InputGroupButton
|
|
108
|
-
size="icon-xs"
|
|
109
|
-
data-slot="input-group-button"
|
|
110
|
-
className="group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent"
|
|
111
|
-
disabled={disabled}
|
|
112
|
-
>
|
|
113
|
-
<ComboboxTrigger />
|
|
114
|
-
</InputGroupButton>
|
|
115
|
-
)}
|
|
116
|
-
{showClear && <ComboboxClear disabled={disabled} />}
|
|
117
|
-
</InputGroupAddon>
|
|
118
|
-
{children}
|
|
119
|
-
</InputGroup>
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/** ComboboxContent — popup content area for the combobox. */
|
|
124
|
-
function ComboboxContent({
|
|
125
|
-
className,
|
|
126
|
-
side = 'bottom',
|
|
127
|
-
sideOffset = 6,
|
|
128
|
-
align = 'start',
|
|
129
|
-
alignOffset = 0,
|
|
130
|
-
anchor,
|
|
131
|
-
slots,
|
|
132
|
-
...props
|
|
133
|
-
}: IComboboxContentProps) {
|
|
134
|
-
return (
|
|
135
|
-
<ComboboxPrimitive.Portal>
|
|
136
|
-
<ComboboxPrimitive.Positioner
|
|
137
|
-
side={side}
|
|
138
|
-
sideOffset={sideOffset}
|
|
139
|
-
align={align}
|
|
140
|
-
alignOffset={alignOffset}
|
|
141
|
-
anchor={anchor}
|
|
142
|
-
className="isolate z-50"
|
|
143
|
-
>
|
|
144
|
-
<ComboboxPrimitive.Popup
|
|
145
|
-
data-slot="combobox-content"
|
|
146
|
-
data-chips={!!anchor}
|
|
147
|
-
className={cn(comboboxStyles.content, slots?.content, className)}
|
|
148
|
-
{...props}
|
|
149
|
-
/>
|
|
150
|
-
</ComboboxPrimitive.Positioner>
|
|
151
|
-
</ComboboxPrimitive.Portal>
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/** ComboboxList — scrollable list of combobox items. */
|
|
156
|
-
function ComboboxList({ className, ...props }: IComboboxListProps) {
|
|
157
|
-
return (
|
|
158
|
-
<ComboboxPrimitive.List
|
|
159
|
-
data-slot="combobox-list"
|
|
160
|
-
className={cn(comboboxStyles.list, className)}
|
|
161
|
-
{...props}
|
|
162
|
-
/>
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/** ComboboxItem — a single selectable item with check indicator. */
|
|
167
|
-
function ComboboxItem({ className, children, ...props }: IComboboxItemProps) {
|
|
168
|
-
return (
|
|
169
|
-
<ComboboxPrimitive.Item
|
|
170
|
-
data-slot="combobox-item"
|
|
171
|
-
className={cn(comboboxStyles.item, className)}
|
|
172
|
-
{...props}
|
|
173
|
-
>
|
|
174
|
-
{children}
|
|
175
|
-
<ComboboxPrimitive.ItemIndicator
|
|
176
|
-
render={
|
|
177
|
-
<span className="pointer-events-none absolute right-2 flex size-4 items-center justify-center" />
|
|
178
|
-
}
|
|
179
|
-
>
|
|
180
|
-
<HugeiconsIcon icon={Tick02Icon} strokeWidth={2} className="pointer-events-none" />
|
|
181
|
-
</ComboboxPrimitive.ItemIndicator>
|
|
182
|
-
</ComboboxPrimitive.Item>
|
|
183
|
-
);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
/** ComboboxGroup — groups related combobox items. */
|
|
187
|
-
function ComboboxGroup({ className, ...props }: IComboboxGroupProps) {
|
|
188
|
-
return (
|
|
189
|
-
<ComboboxPrimitive.Group
|
|
190
|
-
data-slot="combobox-group"
|
|
191
|
-
className={cn(className)}
|
|
192
|
-
{...props}
|
|
193
|
-
/>
|
|
194
|
-
);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/** ComboboxLabel — label for a group of combobox items. */
|
|
198
|
-
function ComboboxLabel({ className, ...props }: IComboboxLabelProps) {
|
|
199
|
-
return (
|
|
200
|
-
<ComboboxPrimitive.GroupLabel
|
|
201
|
-
data-slot="combobox-label"
|
|
202
|
-
className={cn(comboboxStyles.label, className)}
|
|
203
|
-
{...props}
|
|
204
|
-
/>
|
|
205
|
-
);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/** ComboboxCollection — collection for combobox items. */
|
|
209
|
-
function ComboboxCollection({ ...props }: IComboboxCollectionProps) {
|
|
210
|
-
return <ComboboxPrimitive.Collection data-slot="combobox-collection" {...props} />;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/** ComboboxEmpty — displayed when no items match the query. */
|
|
214
|
-
function ComboboxEmpty({ className, ...props }: IComboboxEmptyProps) {
|
|
215
|
-
return (
|
|
216
|
-
<ComboboxPrimitive.Empty
|
|
217
|
-
data-slot="combobox-empty"
|
|
218
|
-
className={cn(comboboxStyles.empty, className)}
|
|
219
|
-
{...props}
|
|
220
|
-
/>
|
|
221
|
-
);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/** ComboboxSeparator — visual divider between combobox items. */
|
|
225
|
-
function ComboboxSeparator({ className, ...props }: IComboboxSeparatorProps) {
|
|
226
|
-
return (
|
|
227
|
-
<ComboboxPrimitive.Separator
|
|
228
|
-
data-slot="combobox-separator"
|
|
229
|
-
className={cn(comboboxStyles.separator, className)}
|
|
230
|
-
{...props}
|
|
231
|
-
/>
|
|
232
|
-
);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
/** ComboboxChips — container for multi-select chips. */
|
|
236
|
-
function ComboboxChips({ className, ...props }: IComboboxChipsProps) {
|
|
237
|
-
return (
|
|
238
|
-
<ComboboxPrimitive.Chips
|
|
239
|
-
data-slot="combobox-chips"
|
|
240
|
-
className={cn(comboboxStyles.chips, className)}
|
|
241
|
-
{...props}
|
|
242
|
-
/>
|
|
243
|
-
);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/** ComboboxChip — individual chip with optional remove button. */
|
|
247
|
-
function ComboboxChip({
|
|
248
|
-
className,
|
|
249
|
-
children,
|
|
250
|
-
showRemove = true,
|
|
251
|
-
...props
|
|
252
|
-
}: IComboboxChipProps) {
|
|
253
|
-
return (
|
|
254
|
-
<ComboboxPrimitive.Chip
|
|
255
|
-
data-slot="combobox-chip"
|
|
256
|
-
className={cn(comboboxStyles.chip, className)}
|
|
257
|
-
{...props}
|
|
258
|
-
>
|
|
259
|
-
{children}
|
|
260
|
-
{showRemove && (
|
|
261
|
-
<ComboboxPrimitive.ChipRemove
|
|
262
|
-
render={<Button variant="ghost" size="sm" className="h-5 w-5 p-0" />}
|
|
263
|
-
className="-ml-1 opacity-50 hover:opacity-100"
|
|
264
|
-
data-slot="combobox-chip-remove"
|
|
265
|
-
>
|
|
266
|
-
<HugeiconsIcon icon={Cancel01Icon} strokeWidth={2} className="pointer-events-none" />
|
|
267
|
-
</ComboboxPrimitive.ChipRemove>
|
|
268
|
-
)}
|
|
269
|
-
</ComboboxPrimitive.Chip>
|
|
270
|
-
);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
/** ComboboxChipsInput — input within the chips container for multi-select. */
|
|
274
|
-
function ComboboxChipsInput({ className, ...props }: IComboboxChipsInputProps) {
|
|
275
|
-
return (
|
|
276
|
-
<ComboboxPrimitive.Input
|
|
277
|
-
data-slot="combobox-chip-input"
|
|
278
|
-
className={cn(comboboxStyles.chipInput, className)}
|
|
279
|
-
{...props}
|
|
280
|
-
/>
|
|
281
|
-
);
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Hook to create an anchor ref for the combobox chips.
|
|
286
|
-
*
|
|
287
|
-
* @returns A ref to be used as the anchor for ComboboxContent
|
|
288
|
-
*/
|
|
289
|
-
function useComboboxAnchor() {
|
|
290
|
-
return React.useRef<HTMLDivElement | null>(null);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
export {
|
|
294
|
-
Combobox,
|
|
295
|
-
ComboboxInput,
|
|
296
|
-
ComboboxContent,
|
|
297
|
-
ComboboxList,
|
|
298
|
-
ComboboxItem,
|
|
299
|
-
ComboboxGroup,
|
|
300
|
-
ComboboxLabel,
|
|
301
|
-
ComboboxCollection,
|
|
302
|
-
ComboboxEmpty,
|
|
303
|
-
ComboboxSeparator,
|
|
304
|
-
ComboboxChips,
|
|
305
|
-
ComboboxChip,
|
|
306
|
-
ComboboxChipsInput,
|
|
307
|
-
ComboboxTrigger,
|
|
308
|
-
ComboboxValue,
|
|
309
|
-
useComboboxAnchor,
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
export type {
|
|
313
|
-
IComboboxProps,
|
|
314
|
-
IComboboxValueProps,
|
|
315
|
-
IComboboxTriggerProps,
|
|
316
|
-
IComboboxClearProps,
|
|
317
|
-
IComboboxInputProps,
|
|
318
|
-
IComboboxContentProps,
|
|
319
|
-
IComboboxListProps,
|
|
320
|
-
IComboboxItemProps,
|
|
321
|
-
IComboboxGroupProps,
|
|
322
|
-
IComboboxLabelProps,
|
|
323
|
-
IComboboxCollectionProps,
|
|
324
|
-
IComboboxEmptyProps,
|
|
325
|
-
IComboboxSeparatorProps,
|
|
326
|
-
IComboboxChipsProps,
|
|
327
|
-
IComboboxChipProps,
|
|
328
|
-
IComboboxChipsInputProps,
|
|
329
|
-
} from './Combobox.types';
|
|
330
|
-
|
|
331
|
-
export type { ComboboxSlot } from './Combobox.styles';
|