@mks2508/mks-ui 0.5.7 → 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 +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/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/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,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* DynamicToggle type definitions.
|
|
2
|
+
* DynamicToggle type definitions (v2 API).
|
|
3
3
|
*
|
|
4
4
|
* CSS-animated toggle where one option expands into sub-options.
|
|
5
5
|
* Uses hidden radios + `:has(:checked)` for zero-JS animation.
|
|
@@ -11,14 +11,22 @@ import type { SlotOverrides, IBaseConfig } from '../../../core/types';
|
|
|
11
11
|
import type { DynamicToggleSlot, DynamicToggleVariantProps } from './DynamicToggle.styles';
|
|
12
12
|
/** How the group appears when collapsed (standalone option active). */
|
|
13
13
|
export type DynamicToggleCollapsedMode = 'title' | 'opts' | 'title-opts';
|
|
14
|
-
/** Morph technique for the pill↔groupLabel junction. */
|
|
15
|
-
export type DynamicToggleMorphMode = 'none' | 'filter' | 'path';
|
|
16
14
|
/**
|
|
17
|
-
*
|
|
15
|
+
* Bubble position relative to the pill.
|
|
16
|
+
* - `top` — bubble grows above the pill (default)
|
|
17
|
+
* - `bottom` — bubble grows below the pill
|
|
18
|
+
* - `none` — no bubble, no gooey canvas, label-only pill with indicator
|
|
19
|
+
*/
|
|
20
|
+
export type DynamicToggleBubblePosition = 'top' | 'bottom' | 'none';
|
|
21
|
+
/**
|
|
22
|
+
* Animation and behavior configuration for DynamicToggle.
|
|
23
|
+
*
|
|
24
|
+
* Controls timing, easing, and indicator behavior.
|
|
25
|
+
* The `morph` rendering mode is a root-level variant prop, NOT in config.
|
|
18
26
|
*
|
|
19
27
|
* @example
|
|
20
28
|
* ```tsx
|
|
21
|
-
* <DynamicToggle config={{
|
|
29
|
+
* <DynamicToggle config={{ duration: 0.3, indicatorDuration: 0.25 }}>
|
|
22
30
|
* ...
|
|
23
31
|
* </DynamicToggle>
|
|
24
32
|
* ```
|
|
@@ -26,10 +34,6 @@ export type DynamicToggleMorphMode = 'none' | 'filter' | 'path';
|
|
|
26
34
|
export interface IDynamicToggleConfig extends IBaseConfig {
|
|
27
35
|
/** CSS transition duration in seconds (default: 0.22) */
|
|
28
36
|
duration?: number;
|
|
29
|
-
/** Label animation style (default: 'morph') */
|
|
30
|
-
labelAnimation?: 'morph' | 'float' | 'none';
|
|
31
|
-
/** Gooey morph mode for the pill↔groupLabel junction (default: 'none') */
|
|
32
|
-
morphMode?: DynamicToggleMorphMode;
|
|
33
37
|
/** Indicator slide duration in seconds (default: 0.3) */
|
|
34
38
|
indicatorDuration?: number;
|
|
35
39
|
/** Indicator slide easing (default: material standard cubic-bezier) */
|
|
@@ -37,6 +41,14 @@ export interface IDynamicToggleConfig extends IBaseConfig {
|
|
|
37
41
|
/** Force translate-based indicator instead of CSS Anchor (debug/compat) */
|
|
38
42
|
forceTranslateIndicator?: boolean;
|
|
39
43
|
}
|
|
44
|
+
/** Structured payload for group registration via context. */
|
|
45
|
+
export type DynamicToggleGroupRegistration = {
|
|
46
|
+
label: string;
|
|
47
|
+
values: string[];
|
|
48
|
+
bubblePosition: DynamicToggleBubblePosition;
|
|
49
|
+
collapsedMode: DynamicToggleCollapsedMode;
|
|
50
|
+
bubble?: React.ReactNode;
|
|
51
|
+
};
|
|
40
52
|
/**
|
|
41
53
|
* Context shared between DynamicToggle root and its children.
|
|
42
54
|
*/
|
|
@@ -51,8 +63,10 @@ export type DynamicToggleContextType = {
|
|
|
51
63
|
groupActive: boolean;
|
|
52
64
|
/** Whether the toggle is disabled */
|
|
53
65
|
disabled: boolean;
|
|
66
|
+
/** Effective morph mode after variant resolution */
|
|
67
|
+
morph: 'none' | 'filter' | 'path';
|
|
54
68
|
/** Register group info (called by DynamicToggleGroup on mount) */
|
|
55
|
-
registerGroup: (
|
|
69
|
+
registerGroup: (info: DynamicToggleGroupRegistration) => void;
|
|
56
70
|
};
|
|
57
71
|
/**
|
|
58
72
|
* Props for the DynamicToggle root container.
|
|
@@ -64,17 +78,17 @@ export type DynamicToggleContextType = {
|
|
|
64
78
|
* ```tsx
|
|
65
79
|
* <DynamicToggle
|
|
66
80
|
* value="tree" onValueChange={setVal}
|
|
67
|
-
* size="sm"
|
|
81
|
+
* size="sm" morph="filter"
|
|
68
82
|
* >
|
|
69
|
-
* <
|
|
70
|
-
* <
|
|
71
|
-
* <
|
|
72
|
-
* <
|
|
73
|
-
* </
|
|
83
|
+
* <DynamicToggle.Option value="tree">Tree</DynamicToggle.Option>
|
|
84
|
+
* <DynamicToggle.Group label="Changes" bubblePosition="top" collapsedMode="title">
|
|
85
|
+
* <DynamicToggle.Option value="flat">Flat</DynamicToggle.Option>
|
|
86
|
+
* <DynamicToggle.Option value="grouped">Grouped</DynamicToggle.Option>
|
|
87
|
+
* </DynamicToggle.Group>
|
|
74
88
|
* </DynamicToggle>
|
|
75
89
|
* ```
|
|
76
90
|
*/
|
|
77
|
-
export interface IDynamicToggleProps extends DynamicToggleVariantProps {
|
|
91
|
+
export interface IDynamicToggleProps extends DynamicToggleVariantProps, Omit<React.HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'children'> {
|
|
78
92
|
/** Controlled value */
|
|
79
93
|
value?: string;
|
|
80
94
|
/** Uncontrolled default value */
|
|
@@ -87,10 +101,6 @@ export interface IDynamicToggleProps extends DynamicToggleVariantProps {
|
|
|
87
101
|
slots?: SlotOverrides<DynamicToggleSlot>;
|
|
88
102
|
/** Animation/behavior configuration */
|
|
89
103
|
config?: IDynamicToggleConfig;
|
|
90
|
-
/** Accessible label for the radio group */
|
|
91
|
-
'aria-label'?: string;
|
|
92
|
-
/** Additional class for the root */
|
|
93
|
-
className?: string;
|
|
94
104
|
/** DynamicToggleOption and DynamicToggleGroup children */
|
|
95
105
|
children: React.ReactNode;
|
|
96
106
|
}
|
|
@@ -113,30 +123,44 @@ export interface IDynamicToggleOptionProps {
|
|
|
113
123
|
/**
|
|
114
124
|
* Props for an expandable group of options.
|
|
115
125
|
*
|
|
126
|
+
* `bubblePosition` is the single prop that controls whether a bubble
|
|
127
|
+
* label appears and where it is positioned.
|
|
128
|
+
*
|
|
116
129
|
* When none of the group's options are active, shows collapsed content
|
|
117
130
|
* based on `collapsedMode`:
|
|
118
131
|
* - `'title'` — only the group label
|
|
119
132
|
* - `'opts'` — only the combined sub-option text ("Solo · Team")
|
|
120
133
|
* - `'title-opts'` — WIP: currently falls back to 'title' behavior
|
|
121
134
|
*
|
|
122
|
-
* When one is active, expands with a clip-path reveal animation.
|
|
123
|
-
*
|
|
124
135
|
* @example
|
|
125
136
|
* ```tsx
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
* <
|
|
129
|
-
* </
|
|
137
|
+
* // With bubble above
|
|
138
|
+
* <DynamicToggle.Group label="Premium" bubblePosition="top">
|
|
139
|
+
* <DynamicToggle.Option value="solo">Solo</DynamicToggle.Option>
|
|
140
|
+
* <DynamicToggle.Option value="team">Team</DynamicToggle.Option>
|
|
141
|
+
* </DynamicToggle.Group>
|
|
142
|
+
*
|
|
143
|
+
* // No bubble — simple pill toggle
|
|
144
|
+
* <DynamicToggle.Group label="Mode" bubblePosition="none" collapsedMode="title">
|
|
145
|
+
* <DynamicToggle.Option value="a">A</DynamicToggle.Option>
|
|
146
|
+
* <DynamicToggle.Option value="b">B</DynamicToggle.Option>
|
|
147
|
+
* </DynamicToggle.Group>
|
|
130
148
|
* ```
|
|
131
149
|
*/
|
|
132
150
|
export interface IDynamicToggleGroupProps {
|
|
133
|
-
/** Label shown as group title /
|
|
151
|
+
/** Label shown as group title / collapsed text */
|
|
134
152
|
label: string;
|
|
135
|
-
/**
|
|
136
|
-
|
|
153
|
+
/** Custom content for the bubble label (overrides label text when provided) */
|
|
154
|
+
bubble?: React.ReactNode;
|
|
155
|
+
/**
|
|
156
|
+
* Bubble position relative to the pill.
|
|
157
|
+
* `'none'` = no bubble, no gooey — label-only pill with indicator.
|
|
158
|
+
* @default 'top'
|
|
159
|
+
*/
|
|
160
|
+
bubblePosition?: DynamicToggleBubblePosition;
|
|
137
161
|
/** How the group appears when collapsed (default: 'title') */
|
|
138
162
|
collapsedMode?: DynamicToggleCollapsedMode;
|
|
139
|
-
/**
|
|
163
|
+
/** Sub-option children */
|
|
140
164
|
children: React.ReactNode;
|
|
141
165
|
/** Additional class */
|
|
142
166
|
className?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicToggle.types.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/ui/DynamicToggle/DynamicToggle.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAM3F,uEAAuE;AACvE,MAAM,MAAM,0BAA0B,GAAG,OAAO,GAAG,MAAM,GAAG,YAAY,CAAC;AAEzE
|
|
1
|
+
{"version":3,"file":"DynamicToggle.types.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/ui/DynamicToggle/DynamicToggle.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAM3F,uEAAuE;AACvE,MAAM,MAAM,0BAA0B,GAAG,OAAO,GAAG,MAAM,GAAG,YAAY,CAAC;AAEzE;;;;;GAKG;AACH,MAAM,MAAM,2BAA2B,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAMpE;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,oBAAqB,SAAQ,WAAW;IACvD,yDAAyD;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yDAAyD;IACzD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,uEAAuE;IACvE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,2EAA2E;IAC3E,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAMD,6DAA6D;AAC7D,MAAM,MAAM,8BAA8B,GAAG;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,cAAc,EAAE,2BAA2B,CAAC;IAC5C,aAAa,EAAE,0BAA0B,CAAC;IAC1C,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B,CAAC;AAMF;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,4BAA4B;IAC5B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,WAAW,EAAE,OAAO,CAAC;IACrB,qCAAqC;IACrC,QAAQ,EAAE,OAAO,CAAC;IAClB,oDAAoD;IACpD,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;IAClC,kEAAkE;IAClE,aAAa,EAAE,CAAC,IAAI,EAAE,8BAA8B,KAAK,IAAI,CAAC;CAC/D,CAAC;AAMF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,mBACf,SAAQ,yBAAyB,EAC/B,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC;IACzE,uBAAuB;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sBAAsB;IACtB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,gCAAgC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IACzC,uCAAuC;IACvC,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,0DAA0D;IAC1D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAMD;;;;;;;GAOG;AACH,MAAM,WAAW,yBAAyB;IACxC,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,oBAAoB;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,uBAAuB;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,WAAW,wBAAwB;IACvC,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,+EAA+E;IAC/E,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;;;OAIG;IACH,cAAc,CAAC,EAAE,2BAA2B,CAAC;IAC7C,8DAA8D;IAC9D,aAAa,CAAC,EAAE,0BAA0B,CAAC;IAC3C,0BAA0B;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,uBAAuB;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -5,7 +5,7 @@ declare const useDynamicToggle: () => DynamicToggleContextType;
|
|
|
5
5
|
/**
|
|
6
6
|
* Root container — pill-shaped toggle with expanding sub-options and group label.
|
|
7
7
|
*/
|
|
8
|
-
declare function DynamicToggle({ variant, size, shape, slots, config, disabled, className, children,
|
|
8
|
+
declare function DynamicToggle({ variant, size, shape, morph: morphProp, slots, config, disabled, className, children, value: valueProp, defaultValue, onValueChange, ...rest }: IDynamicToggleProps): import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
declare namespace DynamicToggle {
|
|
10
10
|
var displayName: string;
|
|
11
11
|
}
|
|
@@ -20,12 +20,18 @@ declare namespace DynamicToggleOption {
|
|
|
20
20
|
* Expandable group — registers with root on mount, renders sub-options.
|
|
21
21
|
* The group label is rendered by the root based on registered info.
|
|
22
22
|
*/
|
|
23
|
-
declare function DynamicToggleGroup({ label,
|
|
23
|
+
declare function DynamicToggleGroup({ label, bubble, bubblePosition, collapsedMode, children, className, }: IDynamicToggleGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
24
24
|
declare namespace DynamicToggleGroup {
|
|
25
25
|
var displayName: string;
|
|
26
26
|
}
|
|
27
|
+
/** DynamicToggle with compound sub-components attached. */
|
|
28
|
+
type DynamicToggleCompound = typeof DynamicToggle & {
|
|
29
|
+
Option: typeof DynamicToggleOption;
|
|
30
|
+
Group: typeof DynamicToggleGroup;
|
|
31
|
+
};
|
|
27
32
|
export { DynamicToggle, DynamicToggleOption, DynamicToggleGroup, useDynamicToggle, dynamicToggleVariants, };
|
|
28
|
-
export type {
|
|
33
|
+
export type { DynamicToggleCompound };
|
|
34
|
+
export type { IDynamicToggleProps, IDynamicToggleOptionProps, IDynamicToggleGroupProps, IDynamicToggleConfig, DynamicToggleContextType, DynamicToggleCollapsedMode, DynamicToggleBubblePosition, DynamicToggleGroupRegistration, } from './DynamicToggle.types';
|
|
29
35
|
export type { DynamicToggleSlot, DynamicToggleVariantProps } from './DynamicToggle.styles';
|
|
30
36
|
export { dynamicToggleStyles } from './DynamicToggle.styles';
|
|
31
37
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/ui/DynamicToggle/index.tsx"],"names":[],"mappings":"AA8BA,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAuB,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,KAAK,EACV,wBAAwB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/ui/DynamicToggle/index.tsx"],"names":[],"mappings":"AA8BA,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAuB,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,KAAK,EACV,wBAAwB,EAIxB,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,uBAAuB,CAAC;AAM/B,QAAA,MAA8B,gBAAgB,gCACsB,CAAC;AAmCrE;;GAEG;AACH,iBAAS,aAAa,CAAC,EACrB,OAAO,EACP,IAAI,EACJ,KAAK,EACL,KAAK,EAAE,SAAS,EAChB,KAAK,EACL,MAAM,EACN,QAAgB,EAChB,SAAS,EACT,QAAQ,EACR,KAAK,EAAE,SAAS,EAChB,YAAY,EACZ,aAAa,EACb,GAAG,IAAI,EACR,EAAE,mBAAmB,2CAuGrB;kBArHQ,aAAa;;;AA2HtB;;GAEG;AACH,iBAAS,mBAAmB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,yBAAyB,2CA2BrF;kBA3BQ,mBAAmB;;;AAiC5B;;;GAGG;AACH,iBAAS,kBAAkB,CAAC,EAC1B,KAAK,EACL,MAAM,EACN,cAAsB,EACtB,aAAuB,EACvB,QAAQ,EACR,SAAS,GACV,EAAE,wBAAwB,2CA0C1B;kBAjDQ,kBAAkB;;;AA4D3B,2DAA2D;AAC3D,KAAK,qBAAqB,GAAG,OAAO,aAAa,GAAG;IAClD,MAAM,EAAE,OAAO,mBAAmB,CAAC;IACnC,KAAK,EAAE,OAAO,kBAAkB,CAAC;CAClC,CAAC;AASF,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,GACtB,CAAC;AAEF,YAAY,EAAE,qBAAqB,EAAE,CAAC;AAEtC,YAAY,EACV,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,oBAAoB,EACpB,wBAAwB,EACxB,0BAA0B,EAC1B,2BAA2B,EAC3B,8BAA8B,GAC/B,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -11,11 +11,11 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
11
11
|
|
|
12
12
|
//#region src/react-ui/ui/DynamicToggle/index.tsx
|
|
13
13
|
/**
|
|
14
|
-
* DynamicToggle — CSS-animated toggle with expanding sub-options and group label.
|
|
14
|
+
* DynamicToggle v2 — CSS-animated toggle with expanding sub-options and group label.
|
|
15
15
|
*
|
|
16
16
|
* Pure CSS animation via `:has(:checked)` on hidden radio inputs.
|
|
17
|
-
* When the group is active, a group label grows out of the pill.
|
|
18
|
-
* Optional gooey morph via `
|
|
17
|
+
* When the group is active, a group label (bubble) grows out of the pill.
|
|
18
|
+
* Optional gooey morph via `morph` prop for organic junction.
|
|
19
19
|
*
|
|
20
20
|
* Supports exactly 1 `DynamicToggleOption` + 1 `DynamicToggleGroup` (with 2 sub-options).
|
|
21
21
|
*
|
|
@@ -23,12 +23,12 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
23
23
|
*
|
|
24
24
|
* @example
|
|
25
25
|
* ```tsx
|
|
26
|
-
* <DynamicToggle value="tree" onValueChange={setVal} size="sm"
|
|
27
|
-
* <
|
|
28
|
-
* <
|
|
29
|
-
* <
|
|
30
|
-
* <
|
|
31
|
-
* </
|
|
26
|
+
* <DynamicToggle value="tree" onValueChange={setVal} size="sm" morph="filter">
|
|
27
|
+
* <DynamicToggle.Option value="tree">Tree</DynamicToggle.Option>
|
|
28
|
+
* <DynamicToggle.Group label="Changes" bubblePosition="top" collapsedMode="title">
|
|
29
|
+
* <DynamicToggle.Option value="flat">Flat</DynamicToggle.Option>
|
|
30
|
+
* <DynamicToggle.Option value="grouped">Grouped</DynamicToggle.Option>
|
|
31
|
+
* </DynamicToggle.Group>
|
|
32
32
|
* </DynamicToggle>
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
@@ -52,28 +52,29 @@ const SHAPE_RADIUS = {
|
|
|
52
52
|
/**
|
|
53
53
|
* Root container — pill-shaped toggle with expanding sub-options and group label.
|
|
54
54
|
*/
|
|
55
|
-
function DynamicToggle({ variant, size, shape, slots, config, disabled = false, className, children,
|
|
55
|
+
function DynamicToggle({ variant, size, shape, morph: morphProp, slots, config, disabled = false, className, children, value: valueProp, defaultValue, onValueChange, ...rest }) {
|
|
56
56
|
const [value, setValue] = useControlledState({
|
|
57
|
-
value:
|
|
58
|
-
defaultValue:
|
|
59
|
-
onChange:
|
|
57
|
+
value: valueProp,
|
|
58
|
+
defaultValue: defaultValue ?? "",
|
|
59
|
+
onChange: onValueChange
|
|
60
60
|
});
|
|
61
61
|
const groupName = React$1.useId();
|
|
62
62
|
const [groupLabel, setGroupLabel] = React$1.useState("");
|
|
63
|
+
const [groupBubble, setGroupBubble] = React$1.useState(null);
|
|
63
64
|
const [groupValues, setGroupValues] = React$1.useState([]);
|
|
64
|
-
const [
|
|
65
|
+
const [groupBubblePosition, setGroupBubblePosition] = React$1.useState("top");
|
|
65
66
|
const [groupCollapsedMode, setGroupCollapsedMode] = React$1.useState("title");
|
|
66
|
-
const registerGroup = React$1.useCallback((
|
|
67
|
-
setGroupLabel(label);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
const registerGroup = React$1.useCallback((info) => {
|
|
68
|
+
setGroupLabel(info.label);
|
|
69
|
+
setGroupBubble(info.bubble ?? null);
|
|
70
|
+
setGroupValues(info.values);
|
|
71
|
+
setGroupBubblePosition(info.bubblePosition);
|
|
72
|
+
setGroupCollapsedMode(info.collapsedMode);
|
|
71
73
|
}, []);
|
|
72
74
|
const groupActive = groupValues.includes(value);
|
|
73
|
-
const morphMode = config?.morphMode ?? "none";
|
|
74
75
|
const resolvedVariant = variant ?? "default";
|
|
75
|
-
const
|
|
76
|
-
const
|
|
76
|
+
const effectiveMorph = resolvedVariant === "ghost" || resolvedVariant === "outline" ? "none" : morphProp ?? "none";
|
|
77
|
+
const showBubble = effectiveMorph !== "none" && groupBubblePosition !== "none" && groupLabel;
|
|
77
78
|
const heightPx = SIZE_HEIGHT_PX[size ?? "default"] ?? 32;
|
|
78
79
|
const style = {
|
|
79
80
|
...config?.duration && { "--dt-dur": `${config.duration}s` },
|
|
@@ -81,11 +82,11 @@ function DynamicToggle({ variant, size, shape, slots, config, disabled = false,
|
|
|
81
82
|
...config?.indicatorEasing && { "--dt-indicator-ease": config.indicatorEasing }
|
|
82
83
|
};
|
|
83
84
|
const hasStyle = Object.keys(style).length > 0;
|
|
84
|
-
const groupLabelElement =
|
|
85
|
+
const groupLabelElement = showBubble ? /* @__PURE__ */ jsx("div", {
|
|
85
86
|
"data-slot": "dt-group-label",
|
|
86
|
-
"data-position":
|
|
87
|
+
"data-bubble-position": groupBubblePosition,
|
|
87
88
|
className: cn(dynamicToggleStyles.groupLabel, slots?.groupLabel),
|
|
88
|
-
children: /* @__PURE__ */ jsx("span", { children: groupLabel || "\xA0" })
|
|
89
|
+
children: /* @__PURE__ */ jsx("span", { children: groupBubble || groupLabel || "\xA0" })
|
|
89
90
|
}) : null;
|
|
90
91
|
return /* @__PURE__ */ jsx(DynamicToggleProvider, {
|
|
91
92
|
value: {
|
|
@@ -94,30 +95,33 @@ function DynamicToggle({ variant, size, shape, slots, config, disabled = false,
|
|
|
94
95
|
groupName,
|
|
95
96
|
groupActive,
|
|
96
97
|
disabled,
|
|
98
|
+
morph: effectiveMorph,
|
|
97
99
|
registerGroup
|
|
98
100
|
},
|
|
99
101
|
children: /* @__PURE__ */ jsxs("div", {
|
|
102
|
+
...rest,
|
|
100
103
|
"data-slot": "dt-root",
|
|
101
|
-
"data-morph":
|
|
104
|
+
"data-morph": effectiveMorph !== "none" ? effectiveMorph : void 0,
|
|
102
105
|
"data-indicator": config?.forceTranslateIndicator ? "translate" : void 0,
|
|
103
106
|
"data-group-active": groupActive || void 0,
|
|
104
107
|
"data-disabled": disabled || void 0,
|
|
105
108
|
role: "radiogroup",
|
|
106
|
-
"aria-label": ariaLabel,
|
|
107
109
|
style: hasStyle ? style : void 0,
|
|
108
110
|
className: cn(dynamicToggleVariants({
|
|
109
111
|
variant,
|
|
110
112
|
size,
|
|
111
|
-
shape
|
|
113
|
+
shape,
|
|
114
|
+
morph: effectiveMorph
|
|
112
115
|
}), slots?.root, className),
|
|
113
116
|
children: [
|
|
114
|
-
|
|
117
|
+
effectiveMorph === "filter" && groupBubblePosition !== "none" && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(GooeyCanvas, {
|
|
115
118
|
height: heightPx,
|
|
116
119
|
width: SIZE_WIDTH_PX[size ?? "default"] ?? 260,
|
|
117
120
|
radius: SHAPE_RADIUS[shape ?? "pill"] ?? 9999,
|
|
118
|
-
expanded: groupActive
|
|
121
|
+
expanded: groupActive,
|
|
122
|
+
bubblePosition: groupBubblePosition
|
|
119
123
|
}), groupLabelElement] }),
|
|
120
|
-
|
|
124
|
+
effectiveMorph === "path" && groupLabelElement,
|
|
121
125
|
/* @__PURE__ */ jsxs("div", {
|
|
122
126
|
"data-slot": "dt-track",
|
|
123
127
|
className: cn(dynamicToggleStyles.track, slots?.track),
|
|
@@ -158,7 +162,7 @@ function DynamicToggleOption({ value, children, className }) {
|
|
|
158
162
|
* Expandable group — registers with root on mount, renders sub-options.
|
|
159
163
|
* The group label is rendered by the root based on registered info.
|
|
160
164
|
*/
|
|
161
|
-
function DynamicToggleGroup({ label,
|
|
165
|
+
function DynamicToggleGroup({ label, bubble, bubblePosition = "top", collapsedMode = "title", children, className }) {
|
|
162
166
|
const ctx = useDynamicToggle();
|
|
163
167
|
const optsText = React$1.useMemo(() => {
|
|
164
168
|
const labels = [];
|
|
@@ -178,11 +182,18 @@ function DynamicToggleGroup({ label, labelPosition = "top", collapsedMode = "tit
|
|
|
178
182
|
if (p.value) values.push(p.value);
|
|
179
183
|
}
|
|
180
184
|
});
|
|
181
|
-
ctx.registerGroup(
|
|
185
|
+
ctx.registerGroup({
|
|
186
|
+
label,
|
|
187
|
+
values,
|
|
188
|
+
bubblePosition,
|
|
189
|
+
collapsedMode,
|
|
190
|
+
bubble
|
|
191
|
+
});
|
|
182
192
|
}, [
|
|
183
193
|
label,
|
|
184
|
-
|
|
194
|
+
bubblePosition,
|
|
185
195
|
collapsedMode,
|
|
196
|
+
bubble,
|
|
186
197
|
children,
|
|
187
198
|
ctx.registerGroup
|
|
188
199
|
]);
|
|
@@ -201,6 +212,8 @@ function DynamicToggleGroup({ label, labelPosition = "top", collapsedMode = "tit
|
|
|
201
212
|
DynamicToggle.displayName = "DynamicToggle";
|
|
202
213
|
DynamicToggleOption.displayName = "DynamicToggleOption";
|
|
203
214
|
DynamicToggleGroup.displayName = "DynamicToggleGroup";
|
|
215
|
+
DynamicToggle.Option = DynamicToggleOption;
|
|
216
|
+
DynamicToggle.Group = DynamicToggleGroup;
|
|
204
217
|
|
|
205
218
|
//#endregion
|
|
206
219
|
export { DynamicToggle, DynamicToggleGroup, DynamicToggleOption, useDynamicToggle };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mks2508/mks-ui",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.8",
|
|
4
4
|
"description": "UI component library - Shadcn/Animate UI based with DevEnv components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -17,16 +17,56 @@
|
|
|
17
17
|
"import": "./dist/react-ui/index.js",
|
|
18
18
|
"default": "./dist/react-ui/index.js"
|
|
19
19
|
},
|
|
20
|
-
"./react/ui/*":
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"./react/
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
"./react/ui/*": {
|
|
21
|
+
"types": "./dist/react-ui/ui/*/index.d.ts",
|
|
22
|
+
"import": "./dist/react-ui/ui/*/index.js",
|
|
23
|
+
"default": "./dist/react-ui/ui/*/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./react/primitives/*": {
|
|
26
|
+
"types": "./dist/react-ui/primitives/*/index.d.ts",
|
|
27
|
+
"import": "./dist/react-ui/primitives/*/index.js",
|
|
28
|
+
"default": "./dist/react-ui/primitives/*/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./react/components/*": {
|
|
31
|
+
"types": "./dist/react-ui/components/*/index.d.ts",
|
|
32
|
+
"import": "./dist/react-ui/components/*/index.js",
|
|
33
|
+
"default": "./dist/react-ui/components/*/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./react/hooks/*": {
|
|
36
|
+
"types": "./dist/react-ui/hooks/*/index.d.ts",
|
|
37
|
+
"import": "./dist/react-ui/hooks/*/index.js",
|
|
38
|
+
"default": "./dist/react-ui/hooks/*/index.js"
|
|
39
|
+
},
|
|
40
|
+
"./react/hooks/Animation/*": {
|
|
41
|
+
"types": "./dist/react-ui/hooks/Animation/*.d.ts",
|
|
42
|
+
"import": "./dist/react-ui/hooks/Animation/*.js",
|
|
43
|
+
"default": "./dist/react-ui/hooks/Animation/*.js"
|
|
44
|
+
},
|
|
45
|
+
"./react/hooks/DOM/*": {
|
|
46
|
+
"types": "./dist/react-ui/hooks/DOM/*.d.ts",
|
|
47
|
+
"import": "./dist/react-ui/hooks/DOM/*.js",
|
|
48
|
+
"default": "./dist/react-ui/hooks/DOM/*.js"
|
|
49
|
+
},
|
|
50
|
+
"./react/hooks/State/*": {
|
|
51
|
+
"types": "./dist/react-ui/hooks/State/*.d.ts",
|
|
52
|
+
"import": "./dist/react-ui/hooks/State/*.js",
|
|
53
|
+
"default": "./dist/react-ui/hooks/State/*.js"
|
|
54
|
+
},
|
|
55
|
+
"./react/hooks/Formatting/*": {
|
|
56
|
+
"types": "./dist/react-ui/hooks/Formatting/*.d.ts",
|
|
57
|
+
"import": "./dist/react-ui/hooks/Formatting/*.js",
|
|
58
|
+
"default": "./dist/react-ui/hooks/Formatting/*.js"
|
|
59
|
+
},
|
|
60
|
+
"./react/icons/*": {
|
|
61
|
+
"types": "./dist/react-ui/icons/*.d.ts",
|
|
62
|
+
"import": "./dist/react-ui/icons/*.js",
|
|
63
|
+
"default": "./dist/react-ui/icons/*.js"
|
|
64
|
+
},
|
|
65
|
+
"./react/lib/*": {
|
|
66
|
+
"types": "./dist/react-ui/lib/*.d.ts",
|
|
67
|
+
"import": "./dist/react-ui/lib/*.js",
|
|
68
|
+
"default": "./dist/react-ui/lib/*.js"
|
|
69
|
+
},
|
|
30
70
|
"./react/blocks/Terminal": {
|
|
31
71
|
"types": "./dist/react-ui/blocks/Terminal/index.d.ts",
|
|
32
72
|
"import": "./dist/react-ui/blocks/Terminal/index.js",
|
|
@@ -44,8 +84,7 @@
|
|
|
44
84
|
}
|
|
45
85
|
},
|
|
46
86
|
"files": [
|
|
47
|
-
"dist"
|
|
48
|
-
"src"
|
|
87
|
+
"dist"
|
|
49
88
|
],
|
|
50
89
|
"scripts": {
|
|
51
90
|
"dev": "vite",
|
package/src/assets/react.svg
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
|
package/src/core/index.ts
DELETED
package/src/core/types.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Framework-agnostic core types for @mks2508/mks-ui.
|
|
3
|
-
*
|
|
4
|
-
* These types are shared across all framework implementations (React, Solid, etc.).
|
|
5
|
-
* React-specific types should go in src/react/.
|
|
6
|
-
*
|
|
7
|
-
* @module @mks2508/mks-ui/core/types
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Maps each slot name to its default Tailwind class string.
|
|
12
|
-
* Used to define base styling of each visual region of a component.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* type ButtonSlot = 'root' | 'icon' | 'label';
|
|
17
|
-
*
|
|
18
|
-
* const ButtonStyles: StyleSlots<ButtonSlot> = {
|
|
19
|
-
* root: 'inline-flex items-center justify-center',
|
|
20
|
-
* icon: 'size-4 shrink-0',
|
|
21
|
-
* label: 'truncate',
|
|
22
|
-
* };
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export type StyleSlots<S extends string> = Record<S, string>;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Partial override for slot classes. Consumers pass this via the `slots` prop
|
|
29
|
-
* to add or replace Tailwind classes on specific visual regions.
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```tsx
|
|
33
|
-
* <Accordion slots={{ trigger: 'text-cyan-400 font-bold', panel: 'bg-zinc-900/50' }} />
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
export type SlotOverrides<S extends string> = Partial<Record<S, string>>;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Base configuration interface for component behavior and animation.
|
|
40
|
-
* Components extend this with their specific config options.
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* ```typescript
|
|
44
|
-
* export interface IAccordionConfig extends IBaseConfig {
|
|
45
|
-
* collapseOnBlur?: boolean;
|
|
46
|
-
* }
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
export interface IBaseConfig {
|
|
50
|
-
/**
|
|
51
|
-
* Animation settings.
|
|
52
|
-
* Components define their own defaults.
|
|
53
|
-
*/
|
|
54
|
-
animation?: {
|
|
55
|
-
/** Duration in seconds. */
|
|
56
|
-
duration?: number;
|
|
57
|
-
/** CSS easing function or motion easing name. */
|
|
58
|
-
easing?: string;
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Motion props for advanced animation control.
|
|
64
|
-
* Passed directly to internal motion element.
|
|
65
|
-
* When provided, overrides config.animation completely.
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* ```tsx
|
|
69
|
-
* <Dialog
|
|
70
|
-
* motionProps={{
|
|
71
|
-
* initial: { opacity: 0, scale: 0.95 },
|
|
72
|
-
* animate: { opacity: 1, scale: 1 },
|
|
73
|
-
* transition: { type: 'spring', stiffness: 300 },
|
|
74
|
-
* }}
|
|
75
|
-
* />
|
|
76
|
-
* ```
|
|
77
|
-
*
|
|
78
|
-
* @remarks
|
|
79
|
-
* This is defined as an opaque type alias. The actual type is imported
|
|
80
|
-
* from motion/react in React-specific files to avoid core depending on motion.
|
|
81
|
-
*/
|
|
82
|
-
export type MotionOverride = Record<string, unknown>;
|