@mks2508/mks-ui 0.5.7 → 0.6.0
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/index.js +2 -2
- package/dist/react-ui/primitives/waapi/Gooey/Gooey.types.d.ts +2 -0
- package/dist/react-ui/primitives/waapi/Gooey/Gooey.types.d.ts.map +1 -1
- package/dist/react-ui/primitives/waapi/Gooey/GooeyCanvas.d.ts +1 -1
- package/dist/react-ui/primitives/waapi/Gooey/GooeyCanvas.d.ts.map +1 -1
- package/dist/react-ui/primitives/waapi/Gooey/GooeyCanvas.js +173 -43
- package/dist/react-ui/ui/Dialog/Dialog.styles.d.ts.map +1 -1
- package/dist/react-ui/ui/Dialog/Dialog.styles.js +1 -0
- package/dist/react-ui/ui/Dialog/Dialog.types.d.ts +20 -1
- package/dist/react-ui/ui/Dialog/Dialog.types.d.ts.map +1 -1
- package/dist/react-ui/ui/Dialog/index.d.ts +28 -7
- package/dist/react-ui/ui/Dialog/index.d.ts.map +1 -1
- package/dist/react-ui/ui/Dialog/index.js +32 -5
- package/dist/react-ui/ui/DynamicToggle/{DynamicToggle-DOR3Ld-k.css → DynamicToggle-DJLwEkHr.css} +12 -19
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.css +12 -20
- 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 +7 -1
- package/dist/react-ui/ui/DynamicToggle/DynamicToggle.types.d.ts +55 -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 +47 -34
- package/dist/react-ui/ui/index.js +1 -1
- 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 -141
- package/src/react-ui/primitives/waapi/Gooey/GooeyCanvas.tsx +0 -217
- 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 -253
- 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 -376
- package/src/react-ui/ui/DynamicToggle/DynamicToggle.styles.ts +0 -85
- package/src/react-ui/ui/DynamicToggle/DynamicToggle.types.ts +0 -180
- package/src/react-ui/ui/DynamicToggle/index.tsx +0 -316
- package/src/react-ui/ui/DynamicToggle/prototype-v7-ios.html +0 -413
- package/src/react-ui/ui/DynamicToggle/prototype-v7.html +0 -615
- package/src/react-ui/ui/DynamicToggle/prototype-v8-gooey-safari.html +0 -560
- package/src/react-ui/ui/DynamicToggle/prototype-v8b-react-structure.html +0 -227
- 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,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Format options for number display using Intl.NumberFormat
|
|
3
|
-
*/
|
|
4
|
-
export interface IFormatOptions {
|
|
5
|
-
/** Number formatting style */
|
|
6
|
-
style?: 'decimal' | 'currency' | 'percent';
|
|
7
|
-
/** Currency code (required when style is 'currency') */
|
|
8
|
-
currency?: string;
|
|
9
|
-
/** Locale for formatting (e.g., 'en-US', 'es-ES') */
|
|
10
|
-
locale?: string;
|
|
11
|
-
/** Minimum fraction digits */
|
|
12
|
-
minimumFractionDigits?: number;
|
|
13
|
-
/** Maximum fraction digits */
|
|
14
|
-
maximumFractionDigits?: number;
|
|
15
|
-
/** Whether to use grouping separators */
|
|
16
|
-
useGrouping?: boolean;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Props for SlidingNumber component
|
|
21
|
-
*
|
|
22
|
-
* Animated number transitions with format preservation using WAAPI slot-machine-style animation.
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```tsx
|
|
26
|
-
* // Basic counter
|
|
27
|
-
* <SlidingNumber value={1234} duration={700} />
|
|
28
|
-
*
|
|
29
|
-
* // Currency
|
|
30
|
-
* <SlidingNumber
|
|
31
|
-
* value={99.99}
|
|
32
|
-
* format={{ style: 'currency', currency: 'USD' }}
|
|
33
|
-
* />
|
|
34
|
-
*
|
|
35
|
-
* // With motion blur
|
|
36
|
-
* <SlidingNumber value={500} motionBlur={true} digitHeight={60} />
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
export interface ISlidingNumberProps {
|
|
40
|
-
/** The numeric value to display */
|
|
41
|
-
value: number;
|
|
42
|
-
|
|
43
|
-
/** Animation duration in milliseconds */
|
|
44
|
-
duration?: number;
|
|
45
|
-
|
|
46
|
-
/** Font size for the number display */
|
|
47
|
-
fontSize?: string;
|
|
48
|
-
|
|
49
|
-
/** Font weight for the number display */
|
|
50
|
-
fontWeight?: string;
|
|
51
|
-
|
|
52
|
-
/** Text color */
|
|
53
|
-
color?: string;
|
|
54
|
-
|
|
55
|
-
/** Height of each digit row in pixels */
|
|
56
|
-
digitHeight?: number;
|
|
57
|
-
|
|
58
|
-
/** Delay between digit animations in milliseconds */
|
|
59
|
-
stagger?: number;
|
|
60
|
-
|
|
61
|
-
/** Enable motion blur effect during animation */
|
|
62
|
-
motionBlur?: boolean;
|
|
63
|
-
|
|
64
|
-
/** Number formatting options */
|
|
65
|
-
format?: IFormatOptions;
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Animation direction trend
|
|
69
|
-
* - 1: Always animate upward (increasing)
|
|
70
|
-
* - -1: Always animate downward (decreasing)
|
|
71
|
-
* - 0: Auto (shorter path)
|
|
72
|
-
*/
|
|
73
|
-
trend?: -1 | 0 | 1;
|
|
74
|
-
|
|
75
|
-
/** Physics-based animation configuration */
|
|
76
|
-
animationConfig?: {
|
|
77
|
-
/** Overshoot amount (higher = more bounce) */
|
|
78
|
-
overshoot?: number;
|
|
79
|
-
/** Mass of the animated object */
|
|
80
|
-
mass?: number;
|
|
81
|
-
/** Spring stiffness */
|
|
82
|
-
stiffness?: number;
|
|
83
|
-
};
|
|
84
|
-
}
|
|
@@ -1,474 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import React, { useEffect, useRef, useMemo, useLayoutEffect } from 'react';
|
|
4
|
-
import type { ISlidingNumberProps, IFormatOptions } from './SlidingNumber.types';
|
|
5
|
-
import { cn } from '@/react-ui/lib/utils';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* SlidingNumber - Animated number transitions with format preservation
|
|
9
|
-
*
|
|
10
|
-
* Uses WAAPI slot-machine-style animation with optional motion blur.
|
|
11
|
-
* Supports Intl.NumberFormat for currency, percentage, and decimal formatting.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```tsx
|
|
15
|
-
* // Basic counter
|
|
16
|
-
* <SlidingNumber value={1234} />
|
|
17
|
-
*
|
|
18
|
-
* // Currency with animation
|
|
19
|
-
* <SlidingNumber
|
|
20
|
-
* value={99.99}
|
|
21
|
-
* format={{ style: 'currency', currency: 'USD' }}
|
|
22
|
-
* duration={700}
|
|
23
|
-
* />
|
|
24
|
-
*
|
|
25
|
-
* // Percentage
|
|
26
|
-
* <SlidingNumber
|
|
27
|
-
* value={75.5}
|
|
28
|
-
* format={{ style: 'percent' }}
|
|
29
|
-
* />
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export const SlidingNumber = ({
|
|
33
|
-
value,
|
|
34
|
-
duration = 700,
|
|
35
|
-
fontSize = '3rem',
|
|
36
|
-
fontWeight = '700',
|
|
37
|
-
color = '#000',
|
|
38
|
-
digitHeight = 60,
|
|
39
|
-
stagger = 30,
|
|
40
|
-
motionBlur = true,
|
|
41
|
-
format,
|
|
42
|
-
trend = 0,
|
|
43
|
-
animationConfig,
|
|
44
|
-
}: ISlidingNumberProps): React.ReactElement => {
|
|
45
|
-
const computedEasing = useMemo(() => {
|
|
46
|
-
if (animationConfig) {
|
|
47
|
-
const { overshoot = 1, stiffness = 1, mass = 1 } = animationConfig;
|
|
48
|
-
const p1 = 0.34 * stiffness;
|
|
49
|
-
const p2 = 1 + 0.56 * overshoot;
|
|
50
|
-
const p3 = 0.64 / mass;
|
|
51
|
-
return `cubic-bezier(${Math.min(p1, 1).toFixed(2)}, ${Math.min(p2, 2).toFixed(2)}, ${Math.min(p3, 1).toFixed(2)}, 1)`;
|
|
52
|
-
}
|
|
53
|
-
return 'cubic-bezier(0.34, 1.56, 0.64, 1)';
|
|
54
|
-
}, [animationConfig]);
|
|
55
|
-
|
|
56
|
-
const currentChars = useMemo(() => parseNumberToChars(value, format), [value, format]);
|
|
57
|
-
const prevKeysRef = useRef<Set<string>>(new Set());
|
|
58
|
-
const isFirstRenderRef = useRef(true);
|
|
59
|
-
|
|
60
|
-
const enteringKeys = useMemo(() => {
|
|
61
|
-
if (isFirstRenderRef.current) return new Set<string>();
|
|
62
|
-
const entering = new Set<string>();
|
|
63
|
-
currentChars.forEach((c) => {
|
|
64
|
-
if (!prevKeysRef.current.has(c.key)) {
|
|
65
|
-
entering.add(c.key);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
return entering;
|
|
69
|
-
}, [currentChars]);
|
|
70
|
-
|
|
71
|
-
useEffect(() => {
|
|
72
|
-
isFirstRenderRef.current = false;
|
|
73
|
-
prevKeysRef.current = new Set(currentChars.map((c) => c.key));
|
|
74
|
-
}, [currentChars]);
|
|
75
|
-
|
|
76
|
-
const getDelay = (position: number) => {
|
|
77
|
-
const absPos = Math.abs(position);
|
|
78
|
-
return (absPos - 1) * stagger;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
return (
|
|
82
|
-
<div
|
|
83
|
-
className={cn('waapi-sliding-number')}
|
|
84
|
-
style={{
|
|
85
|
-
display: 'inline-flex',
|
|
86
|
-
alignItems: 'center',
|
|
87
|
-
fontSize,
|
|
88
|
-
fontWeight,
|
|
89
|
-
color,
|
|
90
|
-
fontVariantNumeric: 'tabular-nums',
|
|
91
|
-
fontFamily: 'system-ui, -apple-system, sans-serif',
|
|
92
|
-
overflow: 'hidden',
|
|
93
|
-
}}
|
|
94
|
-
>
|
|
95
|
-
{currentChars.map((item) => {
|
|
96
|
-
const isEntering = enteringKeys.has(item.key);
|
|
97
|
-
|
|
98
|
-
if (item.isDigit) {
|
|
99
|
-
return (
|
|
100
|
-
<Digit
|
|
101
|
-
key={item.key}
|
|
102
|
-
digit={Number.parseInt(item.char)}
|
|
103
|
-
duration={duration}
|
|
104
|
-
digitHeight={digitHeight}
|
|
105
|
-
delay={getDelay(item.position)}
|
|
106
|
-
motionBlur={motionBlur}
|
|
107
|
-
easing={computedEasing}
|
|
108
|
-
isEntering={isEntering}
|
|
109
|
-
trend={trend}
|
|
110
|
-
/>
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return (
|
|
115
|
-
<Symbol key={item.key} char={item.char} isEntering={isEntering} duration={duration} easing={computedEasing} />
|
|
116
|
-
);
|
|
117
|
-
})}
|
|
118
|
-
</div>
|
|
119
|
-
);
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
SlidingNumber.displayName = 'SlidingNumber';
|
|
123
|
-
|
|
124
|
-
// ============================================================================
|
|
125
|
-
// Types
|
|
126
|
-
// ============================================================================
|
|
127
|
-
|
|
128
|
-
interface ICharItem {
|
|
129
|
-
char: string;
|
|
130
|
-
key: string;
|
|
131
|
-
isDigit: boolean;
|
|
132
|
-
position: number;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
interface IDigitProps {
|
|
136
|
-
digit: number;
|
|
137
|
-
duration: number;
|
|
138
|
-
digitHeight: number;
|
|
139
|
-
delay: number;
|
|
140
|
-
motionBlur: boolean;
|
|
141
|
-
easing: string;
|
|
142
|
-
isEntering: boolean;
|
|
143
|
-
trend: -1 | 0 | 1;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
interface ISymbolProps {
|
|
147
|
-
char: string;
|
|
148
|
-
isEntering: boolean;
|
|
149
|
-
duration: number;
|
|
150
|
-
easing: string;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
// ============================================================================
|
|
154
|
-
// Utilities
|
|
155
|
-
// ============================================================================
|
|
156
|
-
|
|
157
|
-
function parseNumberToChars(value: number, format?: IFormatOptions): ICharItem[] {
|
|
158
|
-
const locale = format?.locale || 'en-US';
|
|
159
|
-
const options: Intl.NumberFormatOptions = {
|
|
160
|
-
style: format?.style || 'decimal',
|
|
161
|
-
minimumFractionDigits: format?.minimumFractionDigits,
|
|
162
|
-
maximumFractionDigits: format?.maximumFractionDigits,
|
|
163
|
-
useGrouping: format?.useGrouping ?? true,
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
if (format?.style === 'currency' && format?.currency) {
|
|
167
|
-
options.currency = format.currency;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
const formatter = new Intl.NumberFormat(locale, options);
|
|
171
|
-
const parts = formatter.formatToParts(value);
|
|
172
|
-
|
|
173
|
-
const result: ICharItem[] = [];
|
|
174
|
-
|
|
175
|
-
let integerDigitCount = 0;
|
|
176
|
-
parts.forEach((part) => {
|
|
177
|
-
if (part.type === 'integer') {
|
|
178
|
-
integerDigitCount += part.value.length;
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
let integerIndex = integerDigitCount;
|
|
183
|
-
let fractionIndex = 0;
|
|
184
|
-
let groupCount = 0;
|
|
185
|
-
|
|
186
|
-
parts.forEach((part, partIdx) => {
|
|
187
|
-
if (part.type === 'integer') {
|
|
188
|
-
for (const char of part.value) {
|
|
189
|
-
result.push({
|
|
190
|
-
char,
|
|
191
|
-
key: `int-${integerIndex}`,
|
|
192
|
-
isDigit: true,
|
|
193
|
-
position: integerIndex,
|
|
194
|
-
});
|
|
195
|
-
integerIndex--;
|
|
196
|
-
}
|
|
197
|
-
} else if (part.type === 'fraction') {
|
|
198
|
-
for (const char of part.value) {
|
|
199
|
-
fractionIndex++;
|
|
200
|
-
result.push({
|
|
201
|
-
char,
|
|
202
|
-
key: `frac-${fractionIndex}`,
|
|
203
|
-
isDigit: true,
|
|
204
|
-
position: -fractionIndex,
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
} else if (part.type === 'decimal') {
|
|
208
|
-
result.push({ char: part.value, key: 'decimal', isDigit: false, position: 0 });
|
|
209
|
-
} else if (part.type === 'group') {
|
|
210
|
-
groupCount++;
|
|
211
|
-
result.push({ char: part.value, key: `group-${groupCount}`, isDigit: false, position: 0 });
|
|
212
|
-
} else if (part.type === 'currency') {
|
|
213
|
-
result.push({ char: part.value, key: `currency-${partIdx}`, isDigit: false, position: 0 });
|
|
214
|
-
} else if (part.type === 'percentSign') {
|
|
215
|
-
result.push({ char: part.value, key: 'percent', isDigit: false, position: 0 });
|
|
216
|
-
} else {
|
|
217
|
-
result.push({ char: part.value, key: `symbol-${partIdx}`, isDigit: false, position: 0 });
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
return result;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// ============================================================================
|
|
225
|
-
// Symbol Component (non-digit characters)
|
|
226
|
-
// ============================================================================
|
|
227
|
-
|
|
228
|
-
function Symbol({ char, isEntering, duration, easing }: ISymbolProps) {
|
|
229
|
-
const ref = useRef<HTMLSpanElement>(null);
|
|
230
|
-
const hasAnimatedRef = useRef(false);
|
|
231
|
-
|
|
232
|
-
useLayoutEffect(() => {
|
|
233
|
-
if (!ref.current || !isEntering || hasAnimatedRef.current) return;
|
|
234
|
-
hasAnimatedRef.current = true;
|
|
235
|
-
|
|
236
|
-
ref.current.animate(
|
|
237
|
-
[
|
|
238
|
-
{ opacity: 0, transform: 'scale(0.8)' },
|
|
239
|
-
{ opacity: 1, transform: 'scale(1)' },
|
|
240
|
-
],
|
|
241
|
-
{
|
|
242
|
-
duration: duration * 0.3,
|
|
243
|
-
easing,
|
|
244
|
-
fill: 'forwards',
|
|
245
|
-
}
|
|
246
|
-
);
|
|
247
|
-
}, [isEntering, duration, easing]);
|
|
248
|
-
|
|
249
|
-
return (
|
|
250
|
-
<span
|
|
251
|
-
ref={ref}
|
|
252
|
-
style={{
|
|
253
|
-
display: 'inline-block',
|
|
254
|
-
whiteSpace: 'pre',
|
|
255
|
-
opacity: isEntering ? 0 : 1,
|
|
256
|
-
}}
|
|
257
|
-
>
|
|
258
|
-
{char}
|
|
259
|
-
</span>
|
|
260
|
-
);
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
// ============================================================================
|
|
264
|
-
// Digit Component (animated numbers)
|
|
265
|
-
// ============================================================================
|
|
266
|
-
|
|
267
|
-
function Digit({ digit, duration, digitHeight, delay, motionBlur, easing, isEntering, trend }: IDigitProps) {
|
|
268
|
-
const columnRef = useRef<HTMLDivElement>(null);
|
|
269
|
-
const containerRef = useRef<HTMLDivElement>(null);
|
|
270
|
-
const animationRef = useRef<Animation | null>(null);
|
|
271
|
-
const filterId = useRef(`blur-${Math.random().toString(36).slice(2, 9)}`).current;
|
|
272
|
-
|
|
273
|
-
const currentOffsetRef = useRef<number | null>(null);
|
|
274
|
-
const targetDigitRef = useRef(digit);
|
|
275
|
-
const hasInitializedRef = useRef(false);
|
|
276
|
-
|
|
277
|
-
const sequence = useMemo(() => {
|
|
278
|
-
const seq: number[] = [];
|
|
279
|
-
for (let cycle = -1; cycle <= 1; cycle++) {
|
|
280
|
-
for (let d = 0; d <= 9; d++) {
|
|
281
|
-
seq.push(d);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
return seq;
|
|
285
|
-
}, []);
|
|
286
|
-
|
|
287
|
-
useLayoutEffect(() => {
|
|
288
|
-
if (!hasInitializedRef.current) {
|
|
289
|
-
hasInitializedRef.current = true;
|
|
290
|
-
const offset = -(digit + 10) * digitHeight;
|
|
291
|
-
currentOffsetRef.current = offset;
|
|
292
|
-
targetDigitRef.current = digit;
|
|
293
|
-
|
|
294
|
-
if (columnRef.current) {
|
|
295
|
-
columnRef.current.style.transform = `translateY(${offset}px)`;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
}, [digit, digitHeight]);
|
|
299
|
-
|
|
300
|
-
useLayoutEffect(() => {
|
|
301
|
-
if (!containerRef.current || !isEntering) return;
|
|
302
|
-
|
|
303
|
-
containerRef.current.animate(
|
|
304
|
-
[
|
|
305
|
-
{ opacity: 0, transform: 'scale(0.5) translateY(-20px)' },
|
|
306
|
-
{ opacity: 1, transform: 'scale(1) translateY(0)' },
|
|
307
|
-
],
|
|
308
|
-
{
|
|
309
|
-
duration: duration * 0.4,
|
|
310
|
-
easing,
|
|
311
|
-
fill: 'forwards',
|
|
312
|
-
}
|
|
313
|
-
);
|
|
314
|
-
}, [isEntering, duration, easing]);
|
|
315
|
-
|
|
316
|
-
useEffect(() => {
|
|
317
|
-
targetDigitRef.current = digit;
|
|
318
|
-
|
|
319
|
-
if (!hasInitializedRef.current) return;
|
|
320
|
-
|
|
321
|
-
const currentDigit =
|
|
322
|
-
currentOffsetRef.current !== null
|
|
323
|
-
? (((Math.round(-currentOffsetRef.current / digitHeight) - 10) % 10) + 10) % 10
|
|
324
|
-
: digit;
|
|
325
|
-
|
|
326
|
-
if (digit === currentDigit && currentOffsetRef.current !== null) {
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
animateToDigit(digit);
|
|
331
|
-
}, [digit, digitHeight]);
|
|
332
|
-
|
|
333
|
-
const animateToDigit = (target: number) => {
|
|
334
|
-
if (!columnRef.current || !containerRef.current) return;
|
|
335
|
-
|
|
336
|
-
if (animationRef.current) {
|
|
337
|
-
const computedStyle = getComputedStyle(columnRef.current);
|
|
338
|
-
const matrix = new DOMMatrix(computedStyle.transform);
|
|
339
|
-
currentOffsetRef.current = matrix.m42;
|
|
340
|
-
animationRef.current.cancel();
|
|
341
|
-
animationRef.current = null;
|
|
342
|
-
columnRef.current.style.transform = `translateY(${currentOffsetRef.current}px)`;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
const rawIndex = currentOffsetRef.current !== null ? -currentOffsetRef.current / digitHeight : target + 10;
|
|
346
|
-
|
|
347
|
-
const currentDigitFromOffset = (((Math.round(rawIndex) - 10) % 10) + 10) % 10;
|
|
348
|
-
const from = currentDigitFromOffset;
|
|
349
|
-
|
|
350
|
-
if (target === from && currentOffsetRef.current !== null) {
|
|
351
|
-
const normalizedOffset = -(target + 10) * digitHeight;
|
|
352
|
-
if (columnRef.current) {
|
|
353
|
-
const currentAnim = animationRef.current as Animation | null;
|
|
354
|
-
if (currentAnim) {
|
|
355
|
-
currentAnim.cancel();
|
|
356
|
-
}
|
|
357
|
-
columnRef.current.style.transform = `translateY(${normalizedOffset}px)`;
|
|
358
|
-
}
|
|
359
|
-
currentOffsetRef.current = normalizedOffset;
|
|
360
|
-
return;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
let diff: number;
|
|
364
|
-
if (trend === 1) {
|
|
365
|
-
diff = target >= from ? target - from : 10 - from + target;
|
|
366
|
-
} else if (trend === -1) {
|
|
367
|
-
diff = target <= from ? target - from : target - from - 10;
|
|
368
|
-
} else {
|
|
369
|
-
diff = target - from;
|
|
370
|
-
if (diff > 5) diff -= 10;
|
|
371
|
-
else if (diff < -5) diff += 10;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
const startOffset = currentOffsetRef.current ?? -(from + 10) * digitHeight;
|
|
375
|
-
const endOffset = startOffset - diff * digitHeight;
|
|
376
|
-
|
|
377
|
-
const blurEl = document.getElementById(filterId)?.querySelector('feGaussianBlur');
|
|
378
|
-
if (motionBlur && blurEl) {
|
|
379
|
-
const intensity = Math.min(Math.abs(diff) * 1.2, 6);
|
|
380
|
-
blurEl.setAttribute('stdDeviation', `0,${intensity}`);
|
|
381
|
-
containerRef.current.style.filter = `url(#${filterId})`;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
const anim = columnRef.current.animate(
|
|
385
|
-
[{ transform: `translateY(${startOffset}px)` }, { transform: `translateY(${endOffset}px)` }],
|
|
386
|
-
{
|
|
387
|
-
duration,
|
|
388
|
-
delay,
|
|
389
|
-
easing,
|
|
390
|
-
fill: 'forwards',
|
|
391
|
-
}
|
|
392
|
-
);
|
|
393
|
-
|
|
394
|
-
animationRef.current = anim;
|
|
395
|
-
|
|
396
|
-
anim.onfinish = () => {
|
|
397
|
-
const normalizedOffset = -(target + 10) * digitHeight;
|
|
398
|
-
if (columnRef.current) {
|
|
399
|
-
anim.cancel();
|
|
400
|
-
columnRef.current.style.transform = `translateY(${normalizedOffset}px)`;
|
|
401
|
-
}
|
|
402
|
-
currentOffsetRef.current = normalizedOffset;
|
|
403
|
-
|
|
404
|
-
if (containerRef.current) {
|
|
405
|
-
containerRef.current.style.filter = 'none';
|
|
406
|
-
}
|
|
407
|
-
if (blurEl) {
|
|
408
|
-
blurEl.setAttribute('stdDeviation', '0,0');
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
animationRef.current = null;
|
|
412
|
-
|
|
413
|
-
if (targetDigitRef.current !== target) {
|
|
414
|
-
requestAnimationFrame(() => {
|
|
415
|
-
animateToDigit(targetDigitRef.current);
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
};
|
|
419
|
-
|
|
420
|
-
anim.oncancel = () => {
|
|
421
|
-
animationRef.current = null;
|
|
422
|
-
};
|
|
423
|
-
};
|
|
424
|
-
|
|
425
|
-
return (
|
|
426
|
-
<>
|
|
427
|
-
<svg style={{ position: 'absolute', width: 0, height: 0 }} aria-hidden="true">
|
|
428
|
-
<defs>
|
|
429
|
-
<filter id={filterId}>
|
|
430
|
-
<feGaussianBlur in="SourceGraphic" stdDeviation="0,0" />
|
|
431
|
-
</filter>
|
|
432
|
-
</defs>
|
|
433
|
-
</svg>
|
|
434
|
-
|
|
435
|
-
<div
|
|
436
|
-
ref={containerRef}
|
|
437
|
-
style={{
|
|
438
|
-
position: 'relative',
|
|
439
|
-
height: `${digitHeight}px`,
|
|
440
|
-
overflow: 'hidden',
|
|
441
|
-
width: '0.65em',
|
|
442
|
-
textAlign: 'center',
|
|
443
|
-
opacity: isEntering ? 0 : 1,
|
|
444
|
-
}}
|
|
445
|
-
>
|
|
446
|
-
<div
|
|
447
|
-
ref={columnRef}
|
|
448
|
-
style={{
|
|
449
|
-
position: 'absolute',
|
|
450
|
-
left: 0,
|
|
451
|
-
right: 0,
|
|
452
|
-
willChange: 'transform',
|
|
453
|
-
}}
|
|
454
|
-
>
|
|
455
|
-
{sequence.map((d, i) => (
|
|
456
|
-
<div
|
|
457
|
-
key={i}
|
|
458
|
-
style={{
|
|
459
|
-
height: `${digitHeight}px`,
|
|
460
|
-
display: 'flex',
|
|
461
|
-
alignItems: 'center',
|
|
462
|
-
justifyContent: 'center',
|
|
463
|
-
}}
|
|
464
|
-
>
|
|
465
|
-
{d}
|
|
466
|
-
</div>
|
|
467
|
-
))}
|
|
468
|
-
</div>
|
|
469
|
-
</div>
|
|
470
|
-
</>
|
|
471
|
-
);
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
export type { ISlidingNumberProps, IFormatOptions };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { StyleSlots } from '@/core/types';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Style slots for SlidingText component
|
|
5
|
-
*/
|
|
6
|
-
export type SlidingTextSlot = 'root' | 'content' | 'token';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Base styles for SlidingText component
|
|
10
|
-
*/
|
|
11
|
-
export const slidingTextBaseStyles: StyleSlots<SlidingTextSlot> = {
|
|
12
|
-
root: 'waapi-sliding-text-container',
|
|
13
|
-
content: 'waapi-sliding-text-content',
|
|
14
|
-
token: 'waapi-sliding-text-token',
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* CSS classes for animation states
|
|
19
|
-
*/
|
|
20
|
-
export const slidingTextAnimationClasses = {
|
|
21
|
-
enterFrom: 'enter-from',
|
|
22
|
-
enterTo: 'enter-to',
|
|
23
|
-
exitActive: 'exit-active',
|
|
24
|
-
} as const;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* CSS classes for direction variants
|
|
28
|
-
*/
|
|
29
|
-
export const slidingTextDirectionClasses = {
|
|
30
|
-
vertical: 'waapi-direction-vertical',
|
|
31
|
-
horizontal: 'waapi-direction-horizontal',
|
|
32
|
-
} as const;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Props for SlidingText component
|
|
3
|
-
*
|
|
4
|
-
* Character or word-by-word text animations with entrance/exit transitions and blur effects.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```tsx
|
|
8
|
-
* // Character animation (default)
|
|
9
|
-
* <SlidingText text="Hello World" mode="character" />
|
|
10
|
-
*
|
|
11
|
-
* // Word animation
|
|
12
|
-
* <SlidingText text="React Components" mode="word" />
|
|
13
|
-
*
|
|
14
|
-
* // Horizontal direction
|
|
15
|
-
* <SlidingText
|
|
16
|
-
* text="Slide In"
|
|
17
|
-
* direction="horizontal"
|
|
18
|
-
* blur={false}
|
|
19
|
-
* />
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export interface ISlidingTextProps {
|
|
23
|
-
/** The text content to animate */
|
|
24
|
-
text: string;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Animation mode
|
|
28
|
-
* - 'character': Each character animates individually
|
|
29
|
-
* - 'word': The text animates as a unit
|
|
30
|
-
* - 'none': No animation
|
|
31
|
-
*/
|
|
32
|
-
mode?: 'word' | 'character' | 'none';
|
|
33
|
-
|
|
34
|
-
/** Animation direction */
|
|
35
|
-
direction?: 'vertical' | 'horizontal';
|
|
36
|
-
|
|
37
|
-
/** Delay between each character/word in milliseconds */
|
|
38
|
-
staggerDelay?: number;
|
|
39
|
-
|
|
40
|
-
/** Animation duration in milliseconds */
|
|
41
|
-
duration?: number;
|
|
42
|
-
|
|
43
|
-
/** CSS easing function */
|
|
44
|
-
easing?: string;
|
|
45
|
-
|
|
46
|
-
/** Enable blur effect during animation */
|
|
47
|
-
blur?: boolean;
|
|
48
|
-
|
|
49
|
-
/** Animate width changes during animation */
|
|
50
|
-
widthAnimation?: boolean;
|
|
51
|
-
|
|
52
|
-
/** Initial animation state */
|
|
53
|
-
initial?: 'initial' | false;
|
|
54
|
-
|
|
55
|
-
/** Trigger animation state */
|
|
56
|
-
animate?: 'animate';
|
|
57
|
-
|
|
58
|
-
/** Exit animation state */
|
|
59
|
-
exit?: 'exit';
|
|
60
|
-
|
|
61
|
-
/** Callback when animation completes */
|
|
62
|
-
onAnimationComplete?: () => void;
|
|
63
|
-
|
|
64
|
-
/** Additional CSS class name */
|
|
65
|
-
className?: string;
|
|
66
|
-
|
|
67
|
-
/** Additional inline styles */
|
|
68
|
-
style?: React.CSSProperties;
|
|
69
|
-
}
|