@mks2508/mks-ui 0.2.1 → 0.3.2
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/hooks/Animation/UseAutoHeight.js +7 -7
- package/dist/react-ui/hooks/DOM/UseIsInView.js +3 -3
- package/dist/react-ui/hooks/Formatting/UseListFormat.d.ts +49 -0
- package/dist/react-ui/hooks/Formatting/UseListFormat.d.ts.map +1 -0
- package/dist/react-ui/hooks/Formatting/UseListFormat.js +105 -0
- package/dist/react-ui/hooks/State/UseControlledState.js +4 -4
- package/dist/react-ui/hooks/State/UseDataState.js +5 -5
- package/dist/react-ui/hooks/index.d.ts +2 -0
- package/dist/react-ui/hooks/index.d.ts.map +1 -1
- package/dist/react-ui/hooks/index.js +1 -0
- package/dist/react-ui/index.js +22 -1
- package/dist/react-ui/lib/get-strict-context.js +3 -3
- package/dist/react-ui/primitives/CountingNumber/index.js +3 -3
- package/dist/react-ui/primitives/Highlight/index.js +26 -26
- package/dist/react-ui/primitives/Slot/index.js +3 -3
- package/dist/react-ui/primitives/index.d.ts +1 -0
- package/dist/react-ui/primitives/index.d.ts.map +1 -1
- package/dist/react-ui/primitives/index.js +18 -0
- package/dist/react-ui/primitives/waapi/Morph/Morph.types.d.ts +76 -0
- package/dist/react-ui/primitives/waapi/Morph/Morph.types.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/Morph/MorphContext.d.ts +11 -0
- package/dist/react-ui/primitives/waapi/Morph/MorphContext.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/Morph/MorphContext.js +19 -0
- package/dist/react-ui/primitives/waapi/Morph/index.d.ts +23 -0
- package/dist/react-ui/primitives/waapi/Morph/index.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/Morph/index.js +45 -0
- package/dist/react-ui/primitives/waapi/Morph/techniques/index.d.ts +12 -0
- package/dist/react-ui/primitives/waapi/Morph/techniques/index.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/Morph/techniques/useCSSGridMorph.d.ts +38 -0
- package/dist/react-ui/primitives/waapi/Morph/techniques/useCSSGridMorph.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/Morph/techniques/useCSSGridMorph.js +78 -0
- package/dist/react-ui/primitives/waapi/Morph/techniques/useFLIPClipPath.d.ts +23 -0
- package/dist/react-ui/primitives/waapi/Morph/techniques/useFLIPClipPath.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/Morph/techniques/useFLIPClipPath.js +140 -0
- package/dist/react-ui/primitives/waapi/Morph/techniques/useViewTransitions.d.ts +28 -0
- package/dist/react-ui/primitives/waapi/Morph/techniques/useViewTransitions.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/Morph/techniques/useViewTransitions.js +77 -0
- package/dist/react-ui/primitives/waapi/Morph/useMorph.d.ts +27 -0
- package/dist/react-ui/primitives/waapi/Morph/useMorph.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/Morph/useMorph.js +86 -0
- package/dist/react-ui/primitives/waapi/Reorder/Reorder.types.d.ts +168 -0
- package/dist/react-ui/primitives/waapi/Reorder/Reorder.types.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/Reorder/index.d.ts +25 -0
- package/dist/react-ui/primitives/waapi/Reorder/index.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/Reorder/index.js +186 -0
- package/dist/react-ui/primitives/waapi/Reorder/useReorder.d.ts +26 -0
- package/dist/react-ui/primitives/waapi/Reorder/useReorder.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/Reorder/useReorder.js +48 -0
- package/dist/react-ui/primitives/waapi/Reorder/useReorderPresence.d.ts +33 -0
- package/dist/react-ui/primitives/waapi/Reorder/useReorderPresence.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/Reorder/useReorderPresence.js +137 -0
- package/dist/react-ui/primitives/waapi/Reorder/utils/separatorCoordination.d.ts +47 -0
- package/dist/react-ui/primitives/waapi/Reorder/utils/separatorCoordination.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/Reorder/utils/separatorCoordination.js +72 -0
- package/dist/react-ui/primitives/waapi/SlidingNumber/SlidingNumber.styles.d.ts +10 -0
- package/dist/react-ui/primitives/waapi/SlidingNumber/SlidingNumber.styles.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/SlidingNumber/SlidingNumber.types.d.ts +74 -0
- package/dist/react-ui/primitives/waapi/SlidingNumber/SlidingNumber.types.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/SlidingNumber/index.d.ts +33 -0
- package/dist/react-ui/primitives/waapi/SlidingNumber/index.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/SlidingNumber/index.js +354 -0
- package/dist/react-ui/primitives/waapi/SlidingText/SlidingText.styles.d.ts +25 -0
- package/dist/react-ui/primitives/waapi/SlidingText/SlidingText.styles.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/SlidingText/SlidingText.types.d.ts +57 -0
- package/dist/react-ui/primitives/waapi/SlidingText/SlidingText.types.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/SlidingText/index.d.ts +26 -0
- package/dist/react-ui/primitives/waapi/SlidingText/index.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/SlidingText/index.js +105 -0
- package/dist/react-ui/primitives/waapi/core/animationConstants.d.ts +156 -0
- package/dist/react-ui/primitives/waapi/core/animationConstants.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/core/animationConstants.js +180 -0
- package/dist/react-ui/primitives/waapi/core/index.d.ts +16 -0
- package/dist/react-ui/primitives/waapi/core/index.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/core/index.js +5 -0
- package/dist/react-ui/primitives/waapi/core/types.d.ts +143 -0
- package/dist/react-ui/primitives/waapi/core/types.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/core/useAnimationOrchestrator.d.ts +32 -0
- package/dist/react-ui/primitives/waapi/core/useAnimationOrchestrator.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/core/useAnimationOrchestrator.js +322 -0
- package/dist/react-ui/primitives/waapi/core/useElementRegistry.d.ts +21 -0
- package/dist/react-ui/primitives/waapi/core/useElementRegistry.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/core/useElementRegistry.js +65 -0
- package/dist/react-ui/primitives/waapi/core/useFLIPAnimation.d.ts +20 -0
- package/dist/react-ui/primitives/waapi/core/useFLIPAnimation.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/core/useFLIPAnimation.js +99 -0
- package/dist/react-ui/primitives/waapi/core/usePositionCapture.d.ts +24 -0
- package/dist/react-ui/primitives/waapi/core/usePositionCapture.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/core/usePositionCapture.js +75 -0
- package/dist/react-ui/primitives/waapi/index.d.ts +33 -0
- package/dist/react-ui/primitives/waapi/index.d.ts.map +1 -0
- package/dist/react-ui/primitives/waapi/index.js +18 -0
- package/dist/react-ui/ui/Accordion/index.js +3 -3
- package/dist/react-ui/ui/Button/index.js +8 -8
- package/dist/react-ui/ui/Combobox/index.js +2 -2
- package/dist/react-ui/ui/DataCard/DataCard.styles.d.ts +35 -0
- package/dist/react-ui/ui/DataCard/DataCard.styles.d.ts.map +1 -0
- package/dist/react-ui/ui/DataCard/DataCard.styles.js +114 -0
- package/dist/react-ui/ui/DataCard/DataCard.types.d.ts +135 -0
- package/dist/react-ui/ui/DataCard/DataCard.types.d.ts.map +1 -0
- package/dist/react-ui/ui/DataCard/index.d.ts +129 -0
- package/dist/react-ui/ui/DataCard/index.d.ts.map +1 -0
- package/dist/react-ui/ui/DataCard/index.js +276 -0
- package/dist/react-ui/ui/Menu/index.js +2 -2
- package/dist/react-ui/ui/Switch/index.js +3 -3
- package/dist/react-ui/ui/Tabs/index.js +3 -3
- package/dist/react-ui/ui/TextFlow/TextFlow.styles.d.ts +16 -0
- package/dist/react-ui/ui/TextFlow/TextFlow.styles.d.ts.map +1 -0
- package/dist/react-ui/ui/TextFlow/TextFlow.types.d.ts +101 -0
- package/dist/react-ui/ui/TextFlow/TextFlow.types.d.ts.map +1 -0
- package/dist/react-ui/ui/TextFlow/index.d.ts +26 -0
- package/dist/react-ui/ui/TextFlow/index.d.ts.map +1 -0
- package/dist/react-ui/ui/TextFlow/index.js +187 -0
- package/dist/react-ui/ui/index.d.ts +2 -0
- package/dist/react-ui/ui/index.d.ts.map +1 -1
- package/dist/react-ui/ui/index.js +3 -0
- package/package.json +6 -2
- package/src/react-ui/hooks/Formatting/UseListFormat.ts +134 -0
- package/src/react-ui/hooks/index.ts +3 -0
- package/src/react-ui/primitives/index.ts +3 -0
- package/src/react-ui/primitives/waapi/Morph/Morph.types.ts +106 -0
- package/src/react-ui/primitives/waapi/Morph/MorphContext.tsx +21 -0
- package/src/react-ui/primitives/waapi/Morph/index.tsx +56 -0
- package/src/react-ui/primitives/waapi/Morph/techniques/index.ts +12 -0
- package/src/react-ui/primitives/waapi/Morph/techniques/useCSSGridMorph.ts +88 -0
- package/src/react-ui/primitives/waapi/Morph/techniques/useFLIPClipPath.ts +175 -0
- package/src/react-ui/primitives/waapi/Morph/techniques/useViewTransitions.ts +86 -0
- package/src/react-ui/primitives/waapi/Morph/useMorph.ts +100 -0
- package/src/react-ui/primitives/waapi/Reorder/Reorder.types.ts +177 -0
- package/src/react-ui/primitives/waapi/Reorder/index.tsx +260 -0
- package/src/react-ui/primitives/waapi/Reorder/useReorder.ts +46 -0
- package/src/react-ui/primitives/waapi/Reorder/useReorderPresence.ts +208 -0
- package/src/react-ui/primitives/waapi/Reorder/utils/separatorCoordination.ts +104 -0
- package/src/react-ui/primitives/waapi/SlidingNumber/SlidingNumber.styles.ts +14 -0
- package/src/react-ui/primitives/waapi/SlidingNumber/SlidingNumber.types.ts +84 -0
- package/src/react-ui/primitives/waapi/SlidingNumber/index.tsx +474 -0
- package/src/react-ui/primitives/waapi/SlidingText/SlidingText.styles.ts +32 -0
- package/src/react-ui/primitives/waapi/SlidingText/SlidingText.types.ts +69 -0
- package/src/react-ui/primitives/waapi/SlidingText/index.tsx +140 -0
- package/src/react-ui/primitives/waapi/core/animationConstants.ts +215 -0
- package/src/react-ui/primitives/waapi/core/index.ts +53 -0
- package/src/react-ui/primitives/waapi/core/types.ts +200 -0
- package/src/react-ui/primitives/waapi/core/useAnimationOrchestrator.ts +429 -0
- package/src/react-ui/primitives/waapi/core/useElementRegistry.ts +80 -0
- package/src/react-ui/primitives/waapi/core/useFLIPAnimation.ts +137 -0
- package/src/react-ui/primitives/waapi/core/usePositionCapture.ts +105 -0
- package/src/react-ui/primitives/waapi/index.ts +116 -0
- package/src/react-ui/styles/animations.css +369 -0
- package/src/react-ui/ui/DataCard/DataCard.styles.ts +150 -0
- package/src/react-ui/ui/DataCard/DataCard.types.ts +146 -0
- package/src/react-ui/ui/DataCard/index.tsx +406 -0
- package/src/react-ui/ui/TextFlow/TextFlow.styles.ts +36 -0
- package/src/react-ui/ui/TextFlow/TextFlow.types.ts +118 -0
- package/src/react-ui/ui/TextFlow/index.tsx +276 -0
- package/src/react-ui/ui/index.ts +4 -0
- /package/dist/react-ui/components/MorphingPopover/{morphing-popover.module-CgbYV_HS.css → morphing-popover.module-BycNI8nU.css} +0 -0
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
import { CountingNumber } from "../../primitives/CountingNumber/index.js";
|
|
5
|
+
import { getStrictContext } from "../../lib/get-strict-context.js";
|
|
6
|
+
import { Switch, SwitchThumb } from "../Switch/index.js";
|
|
7
|
+
import { CornerBracket } from "../CornerBracket/index.js";
|
|
8
|
+
import { dataCardStateStyles, dataCardStyles, dataCardVariants } from "./DataCard.styles.js";
|
|
9
|
+
import * as React$1 from "react";
|
|
10
|
+
import { motion } from "motion/react";
|
|
11
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
|
|
13
|
+
//#region src/react-ui/ui/DataCard/index.tsx
|
|
14
|
+
const [DataCardProvider, useDataCard] = getStrictContext("DataCardContext");
|
|
15
|
+
/**
|
|
16
|
+
* DataCard — comprehensive showcase component demonstrating mks-ui patterns.
|
|
17
|
+
*
|
|
18
|
+
* Features:
|
|
19
|
+
* - Slot overrides for customization
|
|
20
|
+
* - State-based styling (hover, pressed, disabled)
|
|
21
|
+
* - CVA variants (size, color variant)
|
|
22
|
+
* - asChild composition pattern
|
|
23
|
+
* - Motion/animation integration
|
|
24
|
+
* - Custom render functions
|
|
25
|
+
* - Form field integration
|
|
26
|
+
* - Icon composition
|
|
27
|
+
* - Glassmorphism effects
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <DataCard variant="accent" size="default">
|
|
32
|
+
* <DataCardValue number={1234} />
|
|
33
|
+
* <DataCardToggle />
|
|
34
|
+
* </DataCard>
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
function DataCard({ variant = "default", size = "default", disabled = false, glass = true, showBrackets = true, className, style, slots, config, children, ...props }) {
|
|
38
|
+
const [state, setState] = React$1.useState({
|
|
39
|
+
hovered: false,
|
|
40
|
+
pressed: false,
|
|
41
|
+
disabled: disabled ?? false
|
|
42
|
+
});
|
|
43
|
+
const contextValue = React$1.useMemo(() => ({
|
|
44
|
+
variant,
|
|
45
|
+
size,
|
|
46
|
+
disabled: disabled ?? false,
|
|
47
|
+
glass,
|
|
48
|
+
slots,
|
|
49
|
+
setState
|
|
50
|
+
}), [
|
|
51
|
+
variant,
|
|
52
|
+
size,
|
|
53
|
+
disabled,
|
|
54
|
+
glass,
|
|
55
|
+
slots
|
|
56
|
+
]);
|
|
57
|
+
const computedClassName = React$1.useMemo(() => {
|
|
58
|
+
if (typeof className === "function") return className(state);
|
|
59
|
+
return className;
|
|
60
|
+
}, [className, state]);
|
|
61
|
+
const computedStyle = React$1.useMemo(() => {
|
|
62
|
+
if (typeof style === "function") return style(state);
|
|
63
|
+
return style;
|
|
64
|
+
}, [style, state]);
|
|
65
|
+
return /* @__PURE__ */ jsx(DataCardProvider, {
|
|
66
|
+
value: contextValue,
|
|
67
|
+
children: /* @__PURE__ */ jsxs(motion.div, {
|
|
68
|
+
"data-slot": "data-card",
|
|
69
|
+
"data-variant": variant,
|
|
70
|
+
"data-size": size,
|
|
71
|
+
"data-disabled": disabled || void 0,
|
|
72
|
+
"aria-disabled": disabled || void 0,
|
|
73
|
+
className: cn(dataCardVariants({
|
|
74
|
+
variant,
|
|
75
|
+
size,
|
|
76
|
+
glass
|
|
77
|
+
}), slots?.root, computedClassName, state.hovered && dataCardStateStyles.hovered, state.pressed && dataCardStateStyles.pressed, disabled && dataCardStateStyles.disabled),
|
|
78
|
+
style: computedStyle,
|
|
79
|
+
onHoverStart: () => setState((prev) => ({
|
|
80
|
+
...prev,
|
|
81
|
+
hovered: true
|
|
82
|
+
})),
|
|
83
|
+
onHoverEnd: () => setState((prev) => ({
|
|
84
|
+
...prev,
|
|
85
|
+
hovered: false
|
|
86
|
+
})),
|
|
87
|
+
onTapStart: () => setState((prev) => ({
|
|
88
|
+
...prev,
|
|
89
|
+
pressed: true
|
|
90
|
+
})),
|
|
91
|
+
onTap: () => setState((prev) => ({
|
|
92
|
+
...prev,
|
|
93
|
+
pressed: false
|
|
94
|
+
})),
|
|
95
|
+
onTapCancel: () => setState((prev) => ({
|
|
96
|
+
...prev,
|
|
97
|
+
pressed: false
|
|
98
|
+
})),
|
|
99
|
+
...props,
|
|
100
|
+
children: [showBrackets && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
101
|
+
/* @__PURE__ */ jsx(DataCardBracket, {
|
|
102
|
+
position: "tl",
|
|
103
|
+
variant: variant === "accent" ? "accent" : "default"
|
|
104
|
+
}),
|
|
105
|
+
/* @__PURE__ */ jsx(DataCardBracket, {
|
|
106
|
+
position: "tr",
|
|
107
|
+
variant: variant === "accent" ? "accent" : "default"
|
|
108
|
+
}),
|
|
109
|
+
/* @__PURE__ */ jsx(DataCardBracket, {
|
|
110
|
+
position: "bl",
|
|
111
|
+
variant: variant === "accent" ? "accent" : "default"
|
|
112
|
+
}),
|
|
113
|
+
/* @__PURE__ */ jsx(DataCardBracket, {
|
|
114
|
+
position: "br",
|
|
115
|
+
variant: variant === "accent" ? "accent" : "default"
|
|
116
|
+
})
|
|
117
|
+
] }), children]
|
|
118
|
+
})
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* DataCardValue — displays animated number with CountingNumber.
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```tsx
|
|
126
|
+
* <DataCardValue
|
|
127
|
+
* number={1234}
|
|
128
|
+
* label="Active Users"
|
|
129
|
+
* unit="users"
|
|
130
|
+
* />
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
function DataCardValue({ number, label, unit, decimalPlaces = 0, padStart = false }) {
|
|
134
|
+
const { variant, size } = useDataCard();
|
|
135
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
136
|
+
"data-slot": "data-card-value",
|
|
137
|
+
className: cn(dataCardStyles.value),
|
|
138
|
+
children: [
|
|
139
|
+
label && /* @__PURE__ */ jsx("span", {
|
|
140
|
+
className: "text-muted-foreground text-xs uppercase tracking-wider font-mono",
|
|
141
|
+
children: label
|
|
142
|
+
}),
|
|
143
|
+
/* @__PURE__ */ jsx(CountingNumber, {
|
|
144
|
+
number,
|
|
145
|
+
decimalPlaces,
|
|
146
|
+
padStart,
|
|
147
|
+
transition: {
|
|
148
|
+
stiffness: variant === "accent" ? 150 : 90,
|
|
149
|
+
damping: variant === "accent" ? 20 : 10
|
|
150
|
+
},
|
|
151
|
+
className: size === "compact" ? "text-3xl font-bold" : size === "spacious" ? "text-5xl font-bold" : "text-4xl font-bold"
|
|
152
|
+
}),
|
|
153
|
+
unit && /* @__PURE__ */ jsx("span", {
|
|
154
|
+
className: "text-muted-foreground text-lg ml-1",
|
|
155
|
+
children: unit
|
|
156
|
+
})
|
|
157
|
+
]
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* DataCardLabel — displays title and description.
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```tsx
|
|
165
|
+
* <DataCardLabel
|
|
166
|
+
* title="Revenue"
|
|
167
|
+
* description="This month"
|
|
168
|
+
* />
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
function DataCardLabel({ title, description, className, ...props }) {
|
|
172
|
+
const { slots } = useDataCard();
|
|
173
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
174
|
+
"data-slot": "data-card-label",
|
|
175
|
+
className: cn(dataCardStyles.label, slots?.label, className),
|
|
176
|
+
...props,
|
|
177
|
+
children: [title && /* @__PURE__ */ jsx("h3", {
|
|
178
|
+
className: "text-foreground font-semibold",
|
|
179
|
+
children: title
|
|
180
|
+
}), description && /* @__PURE__ */ jsx("p", {
|
|
181
|
+
className: "text-muted-foreground text-sm",
|
|
182
|
+
children: description
|
|
183
|
+
})]
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* DataCardToggle — interactive switch element.
|
|
188
|
+
*
|
|
189
|
+
* Uses asChild pattern for composition with Switch component.
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* ```tsx
|
|
193
|
+
* <DataCardToggle
|
|
194
|
+
* checked={enabled}
|
|
195
|
+
* onCheckedChange={setEnabled}
|
|
196
|
+
* label="Enable notifications"
|
|
197
|
+
* checkedIcon={<BellIcon />}
|
|
198
|
+
* uncheckedIcon={<BellOffIcon />}
|
|
199
|
+
* />
|
|
200
|
+
* ```
|
|
201
|
+
*/
|
|
202
|
+
function DataCardToggle({ checked, onCheckedChange, checkedIcon, uncheckedIcon, label }) {
|
|
203
|
+
const { disabled, variant, size, glass, slots } = useDataCard();
|
|
204
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
205
|
+
"data-slot": "data-card-toggle",
|
|
206
|
+
className: cn(dataCardStyles.toggle, slots?.toggle),
|
|
207
|
+
children: [label && /* @__PURE__ */ jsx("span", {
|
|
208
|
+
className: "text-sm text-muted-foreground",
|
|
209
|
+
children: label
|
|
210
|
+
}), /* @__PURE__ */ jsxs(Switch, {
|
|
211
|
+
checked,
|
|
212
|
+
onCheckedChange,
|
|
213
|
+
disabled,
|
|
214
|
+
children: [
|
|
215
|
+
/* @__PURE__ */ jsx(SwitchThumb, {}),
|
|
216
|
+
checkedIcon && /* @__PURE__ */ jsx("div", {
|
|
217
|
+
className: "text-primary",
|
|
218
|
+
children: checkedIcon
|
|
219
|
+
}),
|
|
220
|
+
!checkedIcon && /* @__PURE__ */ jsx("div", {
|
|
221
|
+
className: "text-muted-foreground",
|
|
222
|
+
children: uncheckedIcon
|
|
223
|
+
})
|
|
224
|
+
]
|
|
225
|
+
})]
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* DataCardActions — container for action buttons.
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* ```tsx
|
|
233
|
+
* <DataCardActions align="end">
|
|
234
|
+
* <Button size="sm">Edit</Button>
|
|
235
|
+
* <Button size="sm" variant="ghost">Delete</Button>
|
|
236
|
+
* </DataCardActions>
|
|
237
|
+
* ```
|
|
238
|
+
*/
|
|
239
|
+
function DataCardActions({ align = "end", className, children, ...props }) {
|
|
240
|
+
const { variant, size, glass, slots } = useDataCard();
|
|
241
|
+
return /* @__PURE__ */ jsx("div", {
|
|
242
|
+
"data-slot": "data-card-actions",
|
|
243
|
+
"data-align": align,
|
|
244
|
+
className: cn(dataCardStyles.actions, align === "center" && "justify-center", align === "start" && "justify-start", align === "end" && "justify-end", slots?.actions, className),
|
|
245
|
+
...props,
|
|
246
|
+
children
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* DataCardBracket — decorative corner bracket.
|
|
251
|
+
*
|
|
252
|
+
* Wraps CornerBracket with motion animations.
|
|
253
|
+
*
|
|
254
|
+
* @example
|
|
255
|
+
* ```tsx
|
|
256
|
+
* <DataCardBracket position="tl" variant="accent" />
|
|
257
|
+
* ```
|
|
258
|
+
*/
|
|
259
|
+
function DataCardBracket({ position, variant = "default", className }) {
|
|
260
|
+
const { size, glass, slots } = useDataCard();
|
|
261
|
+
return /* @__PURE__ */ jsx("div", {
|
|
262
|
+
className: cn(dataCardStyles.bracket, slots?.bracket, className),
|
|
263
|
+
children: /* @__PURE__ */ jsx(CornerBracket, {
|
|
264
|
+
position,
|
|
265
|
+
variant,
|
|
266
|
+
size: {
|
|
267
|
+
compact: 16,
|
|
268
|
+
default: 20,
|
|
269
|
+
spacious: 24
|
|
270
|
+
}[size ?? "default"]
|
|
271
|
+
})
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
//#endregion
|
|
276
|
+
export { DataCard, DataCardActions, DataCardBracket, DataCardLabel, DataCardToggle, DataCardValue, useDataCard };
|
|
@@ -6,7 +6,7 @@ import { getStrictContext } from "../../lib/get-strict-context.js";
|
|
|
6
6
|
import { useControlledState } from "../../hooks/State/UseControlledState.js";
|
|
7
7
|
import { useDataState } from "../../hooks/State/UseDataState.js";
|
|
8
8
|
import { menuStyles } from "./Menu.styles.js";
|
|
9
|
-
import * as React from "react";
|
|
9
|
+
import * as React$1 from "react";
|
|
10
10
|
import { AnimatePresence, motion } from "motion/react";
|
|
11
11
|
import { jsx } from "react/jsx-runtime";
|
|
12
12
|
import { Menu } from "@base-ui/react/menu";
|
|
@@ -68,7 +68,7 @@ function Menu$1({ slots, config, ...props }) {
|
|
|
68
68
|
defaultValue: props?.defaultOpen,
|
|
69
69
|
onChange: props?.onOpenChange
|
|
70
70
|
});
|
|
71
|
-
const [highlightedValue, setHighlightedValue] = React.useState(null);
|
|
71
|
+
const [highlightedValue, setHighlightedValue] = React$1.useState(null);
|
|
72
72
|
return /* @__PURE__ */ jsx(MenuActiveValueProvider, {
|
|
73
73
|
value: {
|
|
74
74
|
highlightedValue,
|
|
@@ -4,7 +4,7 @@ import { cn } from "../../lib/utils.js";
|
|
|
4
4
|
import { getStrictContext } from "../../lib/get-strict-context.js";
|
|
5
5
|
import { useControlledState } from "../../hooks/State/UseControlledState.js";
|
|
6
6
|
import { switchStyles } from "./Switch.styles.js";
|
|
7
|
-
import * as React from "react";
|
|
7
|
+
import * as React$1 from "react";
|
|
8
8
|
import { motion } from "motion/react";
|
|
9
9
|
import { jsx } from "react/jsx-runtime";
|
|
10
10
|
import { Switch } from "@base-ui/react/switch";
|
|
@@ -67,7 +67,7 @@ const [SwitchProvider, useSwitch] = getStrictContext("SwitchContext");
|
|
|
67
67
|
* ```
|
|
68
68
|
*/
|
|
69
69
|
function Switch$1({ name, defaultChecked, checked, onCheckedChange, nativeButton, disabled, readOnly, required, inputRef, id, className, slots, config: _config, ...props }) {
|
|
70
|
-
const [isPressed, setIsPressed] = React.useState(false);
|
|
70
|
+
const [isPressed, setIsPressed] = React$1.useState(false);
|
|
71
71
|
const [isChecked, setIsChecked] = useControlledState({
|
|
72
72
|
value: checked,
|
|
73
73
|
defaultValue: defaultChecked,
|
|
@@ -174,7 +174,7 @@ function SwitchIcon({ position, transition = {
|
|
|
174
174
|
bounce: 0
|
|
175
175
|
}, className, slots, ...props }) {
|
|
176
176
|
const { isChecked } = useSwitch();
|
|
177
|
-
const isAnimated = React.useMemo(() => {
|
|
177
|
+
const isAnimated = React$1.useMemo(() => {
|
|
178
178
|
if (position === "right") return !isChecked;
|
|
179
179
|
if (position === "left") return isChecked;
|
|
180
180
|
if (position === "thumb") return true;
|
|
@@ -6,7 +6,7 @@ import { AutoHeight } from "../../primitives/AutoHeight/index.js";
|
|
|
6
6
|
import { getStrictContext } from "../../lib/get-strict-context.js";
|
|
7
7
|
import { useControlledState } from "../../hooks/State/UseControlledState.js";
|
|
8
8
|
import { tabsStyles } from "./Tabs.styles.js";
|
|
9
|
-
import * as React from "react";
|
|
9
|
+
import * as React$1 from "react";
|
|
10
10
|
import { AnimatePresence, motion } from "motion/react";
|
|
11
11
|
import { jsx } from "react/jsx-runtime";
|
|
12
12
|
import { Tabs } from "@base-ui/react/tabs";
|
|
@@ -285,7 +285,7 @@ function TabsPanels(props) {
|
|
|
285
285
|
transition,
|
|
286
286
|
className: cn(tabsStyles.panels, slots?.panels, className),
|
|
287
287
|
...autoProps,
|
|
288
|
-
children: /* @__PURE__ */ jsx(React.Fragment, { children }, value)
|
|
288
|
+
children: /* @__PURE__ */ jsx(React$1.Fragment, { children }, value)
|
|
289
289
|
});
|
|
290
290
|
}
|
|
291
291
|
const { children, style, transition = defaultPanelsTransition, slots, className, mode: _mode, ...layoutProps } = props;
|
|
@@ -300,7 +300,7 @@ function TabsPanels(props) {
|
|
|
300
300
|
},
|
|
301
301
|
className: cn(tabsStyles.panels, slots?.panels, className),
|
|
302
302
|
...layoutProps,
|
|
303
|
-
children: /* @__PURE__ */ jsx(React.Fragment, { children }, value)
|
|
303
|
+
children: /* @__PURE__ */ jsx(React$1.Fragment, { children }, value)
|
|
304
304
|
});
|
|
305
305
|
}
|
|
306
306
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
2
|
+
import type { StyleSlots } from '../../../core/types';
|
|
3
|
+
/**
|
|
4
|
+
* Style slots for TextFlow component
|
|
5
|
+
*/
|
|
6
|
+
export type TextFlowSlot = 'root' | 'token' | 'separator' | 'overflow' | 'placeholder';
|
|
7
|
+
/**
|
|
8
|
+
* Base styles for TextFlow component
|
|
9
|
+
*/
|
|
10
|
+
export declare const textFlowBaseStyles: StyleSlots<TextFlowSlot>;
|
|
11
|
+
/**
|
|
12
|
+
* CVA variants for TextFlow root container
|
|
13
|
+
*/
|
|
14
|
+
export declare const textFlowVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
15
|
+
export type TextFlowVariants = VariantProps<typeof textFlowVariants>;
|
|
16
|
+
//# sourceMappingURL=TextFlow.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextFlow.styles.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/ui/TextFlow/TextFlow.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,WAAW,GAAG,UAAU,GAAG,aAAa,CAAC;AAEvF;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,UAAU,CAAC,YAAY,CAMvD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,oFAW3B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token individual para TextFlow
|
|
3
|
+
*/
|
|
4
|
+
export interface IToken {
|
|
5
|
+
/** Identificador único del token */
|
|
6
|
+
id: string;
|
|
7
|
+
/** Texto a mostrar */
|
|
8
|
+
text: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Modo de transición para cambios de texto en separadores
|
|
12
|
+
*/
|
|
13
|
+
export type SeparatorTransitionMode = 'none' | 'fade' | 'slide';
|
|
14
|
+
/**
|
|
15
|
+
* Tipos de lista para Intl.ListFormat
|
|
16
|
+
*/
|
|
17
|
+
export type ListFormatType = 'conjunction' | 'disjunction' | 'unit';
|
|
18
|
+
/**
|
|
19
|
+
* Estilos de lista para Intl.ListFormat
|
|
20
|
+
*/
|
|
21
|
+
export type ListFormatStyle = 'long' | 'short' | 'narrow';
|
|
22
|
+
/**
|
|
23
|
+
* Configuración de separadores entre tokens
|
|
24
|
+
*/
|
|
25
|
+
export interface ISeparatorConfig {
|
|
26
|
+
/** Texto del separador. Si se omite, usa Intl.ListFormat */
|
|
27
|
+
value?: string;
|
|
28
|
+
/** Locale para Intl.ListFormat */
|
|
29
|
+
locale?: string;
|
|
30
|
+
/** Tipo de lista para Intl.ListFormat */
|
|
31
|
+
listType?: ListFormatType;
|
|
32
|
+
/** Estilo de lista para Intl.ListFormat */
|
|
33
|
+
listStyle?: ListFormatStyle;
|
|
34
|
+
/** Modo de transición cuando el texto del separador cambia */
|
|
35
|
+
transition?: SeparatorTransitionMode;
|
|
36
|
+
/** Duración de la transición en ms */
|
|
37
|
+
duration?: number;
|
|
38
|
+
/** Clase CSS adicional para separadores */
|
|
39
|
+
className?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Configuración del indicador de overflow (+N more)
|
|
43
|
+
*/
|
|
44
|
+
export interface IOverflowConfig {
|
|
45
|
+
/** Prefijo antes del número */
|
|
46
|
+
prefix?: string;
|
|
47
|
+
/** Texto después del número */
|
|
48
|
+
label?: string;
|
|
49
|
+
/** Separador mostrado antes del overflow */
|
|
50
|
+
separator?: string;
|
|
51
|
+
/** Mostrar separador antes del overflow */
|
|
52
|
+
showSeparator?: boolean;
|
|
53
|
+
/** Clase CSS adicional para el overflow */
|
|
54
|
+
className?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Configuración de animación de texto
|
|
58
|
+
*/
|
|
59
|
+
export interface ITextAnimationConfig {
|
|
60
|
+
/** Modo de animación del texto */
|
|
61
|
+
mode?: 'character' | 'word';
|
|
62
|
+
/** Dirección de entrada del texto */
|
|
63
|
+
direction?: 'vertical' | 'horizontal';
|
|
64
|
+
/** Delay entre caracteres/palabras en ms */
|
|
65
|
+
stagger?: number;
|
|
66
|
+
/** Duración de animación en ms */
|
|
67
|
+
duration?: number;
|
|
68
|
+
/** Habilitar efecto blur durante animación */
|
|
69
|
+
blur?: boolean;
|
|
70
|
+
/** Animar cambios de ancho del contenedor */
|
|
71
|
+
widthAnimation?: boolean;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Props for TextFlow component
|
|
75
|
+
*
|
|
76
|
+
* TextFlow renders an animated list of tokens with locale-aware separators,
|
|
77
|
+
* smooth FLIP animations, and overflow handling.
|
|
78
|
+
*/
|
|
79
|
+
export interface ITextFlowProps {
|
|
80
|
+
/** Array de tokens a mostrar */
|
|
81
|
+
tokens: IToken[];
|
|
82
|
+
/** Texto placeholder cuando no hay tokens */
|
|
83
|
+
placeholder?: string;
|
|
84
|
+
/** Máximo de tokens visibles. El resto se muestra como "+N" */
|
|
85
|
+
maxVisible?: number;
|
|
86
|
+
/** Configuración de separadores */
|
|
87
|
+
separator?: ISeparatorConfig;
|
|
88
|
+
/** Configuración del indicador de overflow */
|
|
89
|
+
overflow?: IOverflowConfig;
|
|
90
|
+
/** Configuración de animación de texto */
|
|
91
|
+
animation?: ITextAnimationConfig;
|
|
92
|
+
/** Modo inline para uso en botones/selects */
|
|
93
|
+
inline?: boolean;
|
|
94
|
+
/** Clase CSS para el contenedor principal */
|
|
95
|
+
className?: string;
|
|
96
|
+
/** Clase CSS para cada token */
|
|
97
|
+
tokenClassName?: string;
|
|
98
|
+
/** Clase CSS para el placeholder */
|
|
99
|
+
placeholderClassName?: string;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=TextFlow.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextFlow.types.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/ui/TextFlow/TextFlow.types.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,oCAAoC;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,aAAa,GAAG,MAAM,CAAC;AAEpE;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,2CAA2C;IAC3C,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,8DAA8D;IAC9D,UAAU,CAAC,EAAE,uBAAuB,CAAC;IACrC,sCAAsC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,+BAA+B;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,kCAAkC;IAClC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAC5B,qCAAqC;IACrC,SAAS,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;IACtC,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,6CAA6C;IAC7C,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,gCAAgC;IAChC,MAAM,EAAE,MAAM,EAAE,CAAC;IAEjB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,mCAAmC;IACnC,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAE7B,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,eAAe,CAAC;IAE3B,0CAA0C;IAC1C,SAAS,CAAC,EAAE,oBAAoB,CAAC;IAEjC,8CAA8C;IAC9C,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,gCAAgC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,oCAAoC;IACpC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ITextFlowProps, IToken, ISeparatorConfig, IOverflowConfig, ITextAnimationConfig, SeparatorTransitionMode } from './TextFlow.types';
|
|
3
|
+
/**
|
|
4
|
+
* TextFlow - Locale-aware animated token list component
|
|
5
|
+
*
|
|
6
|
+
* Built on the Reorder primitive, provides smooth FLIP animations for token lists
|
|
7
|
+
* with proper locale-aware separators using Intl.ListFormat.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* // Basic usage
|
|
12
|
+
* <TextFlow tokens={tokens} />
|
|
13
|
+
*
|
|
14
|
+
* // Spanish multiselect with transition
|
|
15
|
+
* <TextFlow
|
|
16
|
+
* tokens={tokens}
|
|
17
|
+
* maxVisible={2}
|
|
18
|
+
* inline
|
|
19
|
+
* separator={{ locale: 'es', transition: 'fade' }}
|
|
20
|
+
* overflow={{ prefix: '+', label: ' más' }}
|
|
21
|
+
* />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare const TextFlow: React.FC<ITextFlowProps>;
|
|
25
|
+
export type { ITextFlowProps, IToken, ISeparatorConfig, IOverflowConfig, ITextAnimationConfig, SeparatorTransitionMode, };
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/react-ui/ui/TextFlow/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAIpD,OAAO,KAAK,EACV,cAAc,EACd,MAAM,EACN,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,uBAAuB,EAGxB,MAAM,kBAAkB,CAAC;AA0B1B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CA0M7C,CAAC;AAIF,YAAY,EACV,cAAc,EACd,MAAM,EACN,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,uBAAuB,GACxB,CAAC"}
|