@splenddev/kreativ-ui 0.3.1 → 0.3.3
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/index.cjs +2110 -740
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +531 -92
- package/dist/index.d.ts +531 -92
- package/dist/index.js +2137 -775
- package/dist/index.js.map +1 -1
- package/dist/styles/index.css +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import * as React2 from 'react';
|
|
4
|
-
import { forwardRef, createContext, useMemo, useCallback, useId, useRef, useState, useEffect, useLayoutEffect, Children, isValidElement, Fragment as Fragment$1, useContext, useReducer } from 'react';
|
|
4
|
+
import { forwardRef, createContext, useMemo, useCallback, useId, useRef, useState, useEffect, useLayoutEffect, Children, isValidElement, Fragment as Fragment$1, useContext, useReducer, useImperativeHandle } from 'react';
|
|
5
5
|
import { clsx } from 'clsx';
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
7
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
|
-
import { useTheme, createComponent
|
|
9
|
-
export { ThemeContext, defineRecipe, defineSemanticToken, defineSemanticTokens, defineTheme, defineToken, defineTokens, defineTypography, resolveTypography } from '@splenddev/kreativ-core';
|
|
8
|
+
import { useTheme, createComponent, hasKuiMeta, composeRefs, defineToken, defineSemanticToken, defineTypography, defineSizes, defineRecipe, defineTheme, resolveStyle, warnOnFlatCompoundConflict, useValidateChildren, resolveTypography, defineTokens, defineSemanticTokens, ThemeContext, PersistMode, isMotionGated as isMotionGated$1, deepMerge } from '@splenddev/kreativ-core';
|
|
9
|
+
export { PersistMode, ThemeContext, defineRecipe, defineSemanticToken, defineSemanticTokens, defineTheme, defineToken, defineTokens, defineTypography, resolveTypography } from '@splenddev/kreativ-core';
|
|
10
10
|
import * as hooks_star from '@splenddev/kreativ-core/hooks';
|
|
11
11
|
import { useSizeToken, useTypography, useSizeStyle, useResponsiveStyles } from '@splenddev/kreativ-core/hooks';
|
|
12
12
|
import { motion } from 'framer-motion';
|
|
13
|
-
import { ChevronDown, X, Heading, Bold, Italic, ListOrdered, ClipboardList, Code, Link,
|
|
14
|
-
import { createComponent, resolveTokens, tokensToCssVars } from '@splenddev/kreativ-core/utils';
|
|
13
|
+
import { ChevronDown, X, Plus, Minus, Heading, Bold, Italic, Strikethrough, Quote, ListOrdered, ClipboardList, Code, Link, ChevronUp, Trash2, Check, Hash, Search, Link2, Phone, Mail, Sun, Moon, Monitor } from 'lucide-react';
|
|
14
|
+
import { createComponent as createComponent$1, resolveTokens, tokensToCssVars } from '@splenddev/kreativ-core/utils';
|
|
15
15
|
import { cva } from 'class-variance-authority';
|
|
16
16
|
|
|
17
|
-
console.log("BANNER TEST");
|
|
18
17
|
var __defProp = Object.defineProperty;
|
|
19
18
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
20
19
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
21
20
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
21
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
22
22
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
23
23
|
var __export = (target, all) => {
|
|
24
24
|
for (var name in all)
|
|
@@ -33,16 +33,19 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
33
33
|
return to;
|
|
34
34
|
};
|
|
35
35
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget);
|
|
36
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
36
37
|
|
|
37
38
|
// src/index.ts
|
|
38
39
|
var index_exports = {};
|
|
39
40
|
__export(index_exports, {
|
|
40
41
|
Adornment: () => Adornment,
|
|
42
|
+
Box: () => Box,
|
|
41
43
|
Button: () => Button,
|
|
42
44
|
ButtonGroup: () => ButtonGroup,
|
|
43
45
|
ButtonGroupContext: () => ButtonGroupContext,
|
|
44
46
|
ButtonGroupItemContext: () => ButtonGroupItemContext,
|
|
45
47
|
Card: () => Card,
|
|
48
|
+
CardOverlay: () => CardOverlay,
|
|
46
49
|
Checkbox: () => Checkbox,
|
|
47
50
|
Combobox: () => Combobox,
|
|
48
51
|
ComboboxContent: () => ComboboxContent,
|
|
@@ -67,8 +70,10 @@ __export(index_exports, {
|
|
|
67
70
|
MultiSelectContent: () => MultiSelectContent,
|
|
68
71
|
MultiSelectItem: () => MultiSelectItem,
|
|
69
72
|
MultiSelectTrigger: () => MultiSelectTrigger,
|
|
73
|
+
PersistMode: () => PersistMode,
|
|
70
74
|
Radio: () => Radio,
|
|
71
75
|
RadioGroup: () => RadioGroup,
|
|
76
|
+
ScrollArea: () => ScrollArea,
|
|
72
77
|
Select: () => Select,
|
|
73
78
|
SelectContent: () => SelectContent,
|
|
74
79
|
SelectGroup: () => SelectGroup,
|
|
@@ -82,7 +87,6 @@ __export(index_exports, {
|
|
|
82
87
|
Textarea: () => Textarea,
|
|
83
88
|
ThemeContext: () => ThemeContext,
|
|
84
89
|
ThemeToggler: () => ThemeToggler,
|
|
85
|
-
cardSkeleton: () => cardSkeleton,
|
|
86
90
|
cn: () => cn,
|
|
87
91
|
defineRecipe: () => defineRecipe,
|
|
88
92
|
defineSemanticToken: () => defineSemanticToken,
|
|
@@ -105,11 +109,13 @@ __export(index_exports, {
|
|
|
105
109
|
useButtonGroupContext: () => useButtonGroupContext,
|
|
106
110
|
useButtonGroupItemContext: () => useButtonGroupItemContext,
|
|
107
111
|
useClearableField: () => useClearableField,
|
|
112
|
+
useElementScrollProgress: () => useElementScrollProgress,
|
|
108
113
|
useFloatingSide: () => useFloatingSide,
|
|
109
114
|
useFormContext: () => useFormContext,
|
|
110
115
|
useKeyboardShortcuts: () => useKeyboardShortcuts,
|
|
111
116
|
useOptionalButtonGroupContext: () => useOptionalButtonGroupContext,
|
|
112
117
|
useOptionalButtonGroupItemContext: () => useOptionalButtonGroupItemContext,
|
|
118
|
+
useScrollProgress: () => useScrollProgress,
|
|
113
119
|
useStatusTransition: () => useStatusTransition
|
|
114
120
|
});
|
|
115
121
|
function cn(...inputs) {
|
|
@@ -157,6 +163,46 @@ function isMotionGated(props) {
|
|
|
157
163
|
return props["data-kui-motion-gated"] === true || props["data-kui-motion-gated"] === "true";
|
|
158
164
|
}
|
|
159
165
|
__name(isMotionGated, "isMotionGated");
|
|
166
|
+
|
|
167
|
+
// src/utils/resolveColor.ts
|
|
168
|
+
var RAW_COLOR = /^(#|rgb|hsl|hwb|lab|lch|oklab|oklch|color\(|var\()/i;
|
|
169
|
+
function isRawColor(value) {
|
|
170
|
+
return RAW_COLOR.test(value) || value === "transparent" || value === "currentColor";
|
|
171
|
+
}
|
|
172
|
+
__name(isRawColor, "isRawColor");
|
|
173
|
+
function resolveColor(value) {
|
|
174
|
+
if (typeof value === "string") {
|
|
175
|
+
return isRawColor(value) ? value : `var(--color-kui-${value})`;
|
|
176
|
+
}
|
|
177
|
+
const token = "color" in value ? value.color : value;
|
|
178
|
+
return typeof token === "string" && isRawColor(token) ? token : `var(--color-kui-${String(token)})`;
|
|
179
|
+
}
|
|
180
|
+
__name(resolveColor, "resolveColor");
|
|
181
|
+
|
|
182
|
+
// src/utils/resolveRadius.ts
|
|
183
|
+
var RAW_LENGTH = /px|rem|em|%|vw|vh|ch|var\(/i;
|
|
184
|
+
function resolveRadius(value) {
|
|
185
|
+
if (typeof value === "number") return `${value}px`;
|
|
186
|
+
if (value === "none" || value === "0") return "0";
|
|
187
|
+
if (value === "full") return "9999px";
|
|
188
|
+
if (RAW_LENGTH.test(value)) return value;
|
|
189
|
+
return `var(--kui-radii-${value})`;
|
|
190
|
+
}
|
|
191
|
+
__name(resolveRadius, "resolveRadius");
|
|
192
|
+
|
|
193
|
+
// src/utils/resolveSpace.ts
|
|
194
|
+
var LENGTH_RE = /^[+-]?[\d.]+(px|rem|em|%|vw|vh|vmin|vmax|ch|ex|dvh|svh|lvh)$/i;
|
|
195
|
+
var FN_RE = /^[a-z-]+\(/i;
|
|
196
|
+
var TOKEN_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/i;
|
|
197
|
+
function resolveSpace(value) {
|
|
198
|
+
if (value == null) return void 0;
|
|
199
|
+
if (typeof value === "number") return `${value}px`;
|
|
200
|
+
const s = String(value).trim();
|
|
201
|
+
if (LENGTH_RE.test(s) || FN_RE.test(s)) return s;
|
|
202
|
+
if (TOKEN_RE.test(s)) return `var(--kui-spacing-${s})`;
|
|
203
|
+
return s;
|
|
204
|
+
}
|
|
205
|
+
__name(resolveSpace, "resolveSpace");
|
|
160
206
|
var Adornment = forwardRef(
|
|
161
207
|
({ children, position, className, ...props }, ref) => {
|
|
162
208
|
return /* @__PURE__ */ jsx(
|
|
@@ -177,8 +223,6 @@ var Adornment = forwardRef(
|
|
|
177
223
|
}
|
|
178
224
|
);
|
|
179
225
|
Adornment.displayName = "Adornment";
|
|
180
|
-
|
|
181
|
-
// src/theme/recipes/resolveRecipe.ts
|
|
182
226
|
function matchesConditions(conditions, props) {
|
|
183
227
|
return Object.entries(conditions).every(
|
|
184
228
|
([key, expected]) => props[key] === expected
|
|
@@ -193,7 +237,7 @@ function resolveRecipe(recipe, props = {}) {
|
|
|
193
237
|
};
|
|
194
238
|
const classes = [];
|
|
195
239
|
if (recipe.base) {
|
|
196
|
-
classes.push(recipe.base);
|
|
240
|
+
classes.push(resolveStyle(recipe.base));
|
|
197
241
|
}
|
|
198
242
|
if (recipe.variants) {
|
|
199
243
|
for (const [variantName, variantValues] of Object.entries(
|
|
@@ -203,14 +247,14 @@ function resolveRecipe(recipe, props = {}) {
|
|
|
203
247
|
if (value === void 0) continue;
|
|
204
248
|
const variantClass = variantValues[String(value)];
|
|
205
249
|
if (variantClass) {
|
|
206
|
-
classes.push(variantClass);
|
|
250
|
+
classes.push(resolveStyle(variantClass));
|
|
207
251
|
}
|
|
208
252
|
}
|
|
209
253
|
}
|
|
210
254
|
if (recipe.compoundVariants) {
|
|
211
255
|
for (const compound of recipe.compoundVariants) {
|
|
212
256
|
if (matchesConditions(compound.conditions, resolvedProps)) {
|
|
213
|
-
classes.push(compound.className);
|
|
257
|
+
classes.push(resolveStyle(compound.className));
|
|
214
258
|
}
|
|
215
259
|
}
|
|
216
260
|
}
|
|
@@ -416,7 +460,7 @@ var Button = forwardRef(
|
|
|
416
460
|
const resolvedClassName = cn(
|
|
417
461
|
recipeClasses,
|
|
418
462
|
fullWidth && "w-full",
|
|
419
|
-
isLoading && "opacity-90 pointer-events-none",
|
|
463
|
+
isLoading && "opacity-90 pointer-events-none text-xs",
|
|
420
464
|
className
|
|
421
465
|
);
|
|
422
466
|
const resolvedStyle = {
|
|
@@ -778,104 +822,121 @@ var getModeIcons = /* @__PURE__ */ __name((allowSystem, labels, icons) => {
|
|
|
778
822
|
}
|
|
779
823
|
return modes;
|
|
780
824
|
}, "getModeIcons");
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
labels,
|
|
793
|
-
icons,
|
|
794
|
-
className,
|
|
795
|
-
buttonProps = {},
|
|
796
|
-
display = "buttons",
|
|
797
|
-
animated = false,
|
|
798
|
-
transition = defaultTransition
|
|
799
|
-
}) {
|
|
800
|
-
const { mode, setMode, resolvedMode, theme } = useTheme();
|
|
801
|
-
const resolvedSize = size;
|
|
802
|
-
const wrapperRadius = useSizeToken(resolvedSize, "radius");
|
|
803
|
-
const indicatorRadius = useSizeToken(resolvedSize, "radius", "4px");
|
|
804
|
-
const buttonWidth = useSizeToken(resolvedSize, "width");
|
|
805
|
-
const activeMode = allowSystem ? mode : resolvedMode;
|
|
806
|
-
const modes = getModeIcons(allowSystem, labels, icons);
|
|
807
|
-
const allowedModes = modes.map((item) => item.key);
|
|
808
|
-
const currentMode = modes.find(({ key }) => key === activeMode) ?? modes[0];
|
|
809
|
-
const indicatorClasses = resolveRecipe(theme.recipes.Button, {
|
|
810
|
-
variant: activeVariant,
|
|
811
|
-
color: activeColor
|
|
812
|
-
});
|
|
813
|
-
const effectiveRounded = rounded && !(orientation === "vertical" && !iconOnly && !unstyled);
|
|
814
|
-
useEffect(() => {
|
|
815
|
-
if (!rounded || effectiveRounded) return;
|
|
816
|
-
const reasons = [];
|
|
817
|
-
if (orientation === "vertical" && !iconOnly) {
|
|
818
|
-
reasons.push("orientation='vertical' with iconOnly={false}");
|
|
825
|
+
var ThemeToggler = createComponent({
|
|
826
|
+
displayName: "ThemeToggler",
|
|
827
|
+
__kui: {
|
|
828
|
+
role: "action",
|
|
829
|
+
skeleton: "preserve",
|
|
830
|
+
video: {
|
|
831
|
+
id: "theme-toggler",
|
|
832
|
+
safe: true,
|
|
833
|
+
acceptsChildren: false,
|
|
834
|
+
interactionStates: ["hover", "pressed"],
|
|
835
|
+
motionGated: true
|
|
819
836
|
}
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
837
|
+
},
|
|
838
|
+
render: /* @__PURE__ */ __name(({
|
|
839
|
+
variant = "ghost",
|
|
840
|
+
color = "neutral",
|
|
841
|
+
activeVariant = "solid",
|
|
842
|
+
activeColor = "brand",
|
|
843
|
+
size = "sm",
|
|
844
|
+
iconOnly = false,
|
|
845
|
+
allowSystem = false,
|
|
846
|
+
orientation = "horizontal",
|
|
847
|
+
rounded = false,
|
|
848
|
+
unstyled = false,
|
|
849
|
+
labels,
|
|
850
|
+
icons,
|
|
851
|
+
className,
|
|
852
|
+
buttonProps = {},
|
|
853
|
+
display = "buttons",
|
|
854
|
+
animated = false,
|
|
855
|
+
transition = defaultTransition,
|
|
856
|
+
...rest
|
|
857
|
+
}, _ref) => {
|
|
858
|
+
const { mode, setMode, resolvedMode, theme } = useTheme();
|
|
859
|
+
const motionGated = isMotionGated$1(rest);
|
|
860
|
+
const resolvedSize = size;
|
|
861
|
+
const wrapperRadius = useSizeToken(resolvedSize, "radius");
|
|
862
|
+
const indicatorRadius = useSizeToken(resolvedSize, "radius", "4px");
|
|
863
|
+
const buttonWidth = useSizeToken(resolvedSize, "width");
|
|
864
|
+
const activeMode = allowSystem ? mode : resolvedMode;
|
|
865
|
+
const modes = getModeIcons(allowSystem, labels, icons);
|
|
866
|
+
const allowedModes = modes.map((item) => item.key);
|
|
867
|
+
const currentMode = modes.find(({ key }) => key === activeMode) ?? modes[0];
|
|
868
|
+
const indicatorClasses = resolveRecipe(theme.recipes.Button, {
|
|
869
|
+
variant: activeVariant,
|
|
870
|
+
color: activeColor
|
|
871
|
+
});
|
|
872
|
+
const effectiveRounded = rounded && !(orientation === "vertical" && !iconOnly && !unstyled);
|
|
873
|
+
useEffect(() => {
|
|
874
|
+
if (!rounded || effectiveRounded) return;
|
|
875
|
+
const reasons = [];
|
|
876
|
+
if (orientation === "vertical" && !iconOnly) {
|
|
877
|
+
reasons.push("orientation is vertical with iconOnly false");
|
|
878
|
+
}
|
|
879
|
+
if (unstyled) reasons.push("unstyled is true");
|
|
880
|
+
if (reasons.length > 0) {
|
|
881
|
+
console.warn(
|
|
882
|
+
`[kreativ-ui/ThemeToggler]: rounded is ignored when ${reasons.join(" and ")}.`
|
|
883
|
+
);
|
|
884
|
+
}
|
|
885
|
+
}, [rounded, effectiveRounded, orientation, iconOnly, unstyled]);
|
|
886
|
+
const handleCycle = /* @__PURE__ */ __name(() => {
|
|
887
|
+
const index = allowedModes.indexOf(
|
|
888
|
+
activeMode
|
|
889
|
+
);
|
|
890
|
+
setMode(allowedModes[(index + 1) % allowedModes.length]);
|
|
891
|
+
}, "handleCycle");
|
|
892
|
+
const isActive = /* @__PURE__ */ __name((key) => key === "system" ? mode === "system" : activeMode === key, "isActive");
|
|
893
|
+
const containerStyle = {
|
|
894
|
+
...!effectiveRounded && {
|
|
895
|
+
"--kui-theme-toggler-radius": wrapperRadius
|
|
896
|
+
}
|
|
897
|
+
};
|
|
898
|
+
const indicatorTransition = animated && !motionGated ? { type: "spring", stiffness: 300, damping: 30, mass: 0.8 } : { duration: 0 };
|
|
899
|
+
if (display === "cycle") {
|
|
900
|
+
return /* @__PURE__ */ jsx(
|
|
901
|
+
CycleMode,
|
|
902
|
+
{
|
|
903
|
+
size: resolvedSize,
|
|
904
|
+
variant,
|
|
905
|
+
color,
|
|
906
|
+
iconOnly,
|
|
907
|
+
buttonProps,
|
|
908
|
+
animated: animated && !motionGated,
|
|
909
|
+
transition,
|
|
910
|
+
rounded: effectiveRounded,
|
|
911
|
+
currentMode,
|
|
912
|
+
onCycle: handleCycle
|
|
913
|
+
}
|
|
824
914
|
);
|
|
825
915
|
}
|
|
826
|
-
}, [rounded, effectiveRounded, orientation, iconOnly, unstyled]);
|
|
827
|
-
const handleCycle = /* @__PURE__ */ __name(() => {
|
|
828
|
-
const index = allowedModes.indexOf(activeMode);
|
|
829
|
-
setMode(allowedModes[(index + 1) % allowedModes.length]);
|
|
830
|
-
}, "handleCycle");
|
|
831
|
-
const isActive = /* @__PURE__ */ __name((key) => key === "system" ? mode === "system" : activeMode === key, "isActive");
|
|
832
|
-
const containerStyle = {
|
|
833
|
-
...!effectiveRounded && {
|
|
834
|
-
"--kui-theme-toggler-radius": wrapperRadius
|
|
835
|
-
}
|
|
836
|
-
};
|
|
837
|
-
const indicatorTransition = animated ? { type: "spring", stiffness: 300, damping: 30, mass: 0.8 } : { duration: 0 };
|
|
838
|
-
if (display === "cycle") {
|
|
839
916
|
return /* @__PURE__ */ jsx(
|
|
840
|
-
|
|
917
|
+
ButtonsMode,
|
|
841
918
|
{
|
|
842
919
|
size: resolvedSize,
|
|
843
|
-
variant,
|
|
844
920
|
color,
|
|
845
921
|
iconOnly,
|
|
846
922
|
buttonProps,
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
923
|
+
rounded,
|
|
924
|
+
unstyled,
|
|
925
|
+
className,
|
|
926
|
+
modes,
|
|
927
|
+
activeMode,
|
|
928
|
+
onSelect: setMode,
|
|
929
|
+
containerStyle,
|
|
930
|
+
isActive,
|
|
931
|
+
orientation,
|
|
932
|
+
indicatorClasses,
|
|
933
|
+
indicatorRadius,
|
|
934
|
+
buttonWidth,
|
|
935
|
+
indicatorTransition
|
|
852
936
|
}
|
|
853
937
|
);
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
ButtonsMode,
|
|
857
|
-
{
|
|
858
|
-
size: resolvedSize,
|
|
859
|
-
color,
|
|
860
|
-
iconOnly,
|
|
861
|
-
buttonProps,
|
|
862
|
-
rounded,
|
|
863
|
-
unstyled,
|
|
864
|
-
className,
|
|
865
|
-
modes,
|
|
866
|
-
activeMode,
|
|
867
|
-
onSelect: setMode,
|
|
868
|
-
containerStyle,
|
|
869
|
-
isActive,
|
|
870
|
-
orientation,
|
|
871
|
-
indicatorClasses,
|
|
872
|
-
indicatorRadius,
|
|
873
|
-
buttonWidth,
|
|
874
|
-
indicatorTransition
|
|
875
|
-
}
|
|
876
|
-
);
|
|
877
|
-
}
|
|
878
|
-
__name(ThemeToggler, "ThemeToggler");
|
|
938
|
+
}, "render")
|
|
939
|
+
});
|
|
879
940
|
|
|
880
941
|
// src/components/forms/Input/Input.constants.ts
|
|
881
942
|
var inputKindDefaults = {
|
|
@@ -1410,7 +1471,7 @@ function renderBaseInput({
|
|
|
1410
1471
|
);
|
|
1411
1472
|
}
|
|
1412
1473
|
__name(renderBaseInput, "renderBaseInput");
|
|
1413
|
-
var Input = createComponent({
|
|
1474
|
+
var Input = createComponent$1({
|
|
1414
1475
|
displayName: "Input",
|
|
1415
1476
|
__kui: {
|
|
1416
1477
|
role: "formControl",
|
|
@@ -1477,7 +1538,7 @@ var statusClasses = {
|
|
|
1477
1538
|
success: "text-kui-success",
|
|
1478
1539
|
warning: "text-kui-warning"
|
|
1479
1540
|
};
|
|
1480
|
-
var FormFieldMessage = createComponent
|
|
1541
|
+
var FormFieldMessage = createComponent({
|
|
1481
1542
|
displayName: "FormField.Message",
|
|
1482
1543
|
__kui: {
|
|
1483
1544
|
role: "display",
|
|
@@ -1551,7 +1612,7 @@ function useFormContext() {
|
|
|
1551
1612
|
return React2.useContext(FormContext);
|
|
1552
1613
|
}
|
|
1553
1614
|
__name(useFormContext, "useFormContext");
|
|
1554
|
-
var FormRoot = createComponent
|
|
1615
|
+
var FormRoot = createComponent({
|
|
1555
1616
|
displayName: "Form",
|
|
1556
1617
|
__kui: {
|
|
1557
1618
|
role: "formControl",
|
|
@@ -1757,7 +1818,6 @@ var FormSubmitButton = React2.forwardRef(/* @__PURE__ */ __name(function FormSub
|
|
|
1757
1818
|
"[kreativ-ui/Form.SubmitButton]: must be rendered inside <Form>."
|
|
1758
1819
|
);
|
|
1759
1820
|
}
|
|
1760
|
-
console.log(form.errors);
|
|
1761
1821
|
if (!React2.isValidElement(children)) {
|
|
1762
1822
|
throw new Error(
|
|
1763
1823
|
"[kreativ-ui/Form.SubmitButton]: requires exactly one React element child."
|
|
@@ -14410,21 +14470,21 @@ var allProcessors = {
|
|
|
14410
14470
|
};
|
|
14411
14471
|
function toJSONSchema(input, params) {
|
|
14412
14472
|
if ("_idmap" in input) {
|
|
14413
|
-
const
|
|
14473
|
+
const registry2 = input;
|
|
14414
14474
|
const ctx2 = initializeContext({ ...params, processors: allProcessors });
|
|
14415
14475
|
const defs = {};
|
|
14416
|
-
for (const entry of
|
|
14476
|
+
for (const entry of registry2._idmap.entries()) {
|
|
14417
14477
|
const [_, schema] = entry;
|
|
14418
14478
|
process2(schema, ctx2);
|
|
14419
14479
|
}
|
|
14420
14480
|
const schemas = {};
|
|
14421
14481
|
const external = {
|
|
14422
|
-
registry:
|
|
14482
|
+
registry: registry2,
|
|
14423
14483
|
uri: params?.uri,
|
|
14424
14484
|
defs
|
|
14425
14485
|
};
|
|
14426
14486
|
ctx2.external = external;
|
|
14427
|
-
for (const entry of
|
|
14487
|
+
for (const entry of registry2._idmap.entries()) {
|
|
14428
14488
|
const [key, schema] = entry;
|
|
14429
14489
|
extractDefs(ctx2, schema);
|
|
14430
14490
|
schemas[key] = finalize(ctx2, schema);
|
|
@@ -16866,7 +16926,7 @@ function useSelectContext(componentName) {
|
|
|
16866
16926
|
}
|
|
16867
16927
|
__name(useSelectContext, "useSelectContext");
|
|
16868
16928
|
var SelectGroupContext = createContext(null);
|
|
16869
|
-
var SelectRoot = createComponent
|
|
16929
|
+
var SelectRoot = createComponent({
|
|
16870
16930
|
displayName: "Select.Root",
|
|
16871
16931
|
__kui: {
|
|
16872
16932
|
role: "formControl",
|
|
@@ -17345,7 +17405,7 @@ function SelectLabel({ children, className }) {
|
|
|
17345
17405
|
return /* @__PURE__ */ jsx("div", { id, className: cn("px-2.5 py-1.5 font-mono text-[11px] text-kui-text-muted", className), children });
|
|
17346
17406
|
}
|
|
17347
17407
|
__name(SelectLabel, "SelectLabel");
|
|
17348
|
-
function SelectImpl({ options, children, ...rootProps }, ref) {
|
|
17408
|
+
function SelectImpl({ options, children, label, ...rootProps }, ref) {
|
|
17349
17409
|
const childArray = React2.Children.toArray(children);
|
|
17350
17410
|
const compound = childArray.length > 0;
|
|
17351
17411
|
if (isDev() && compound && options?.length) {
|
|
@@ -17354,6 +17414,7 @@ function SelectImpl({ options, children, ...rootProps }, ref) {
|
|
|
17354
17414
|
);
|
|
17355
17415
|
}
|
|
17356
17416
|
return /* @__PURE__ */ jsx(SelectRoot, { ...rootProps, ref, children: compound ? children : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
17417
|
+
label && /* @__PURE__ */ jsx(Select.Label, { children: label }),
|
|
17357
17418
|
/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
17358
17419
|
/* @__PURE__ */ jsx(SelectContent, { children: options?.map((option) => /* @__PURE__ */ jsx(
|
|
17359
17420
|
SelectItem,
|
|
@@ -17386,7 +17447,7 @@ var switchThumbConfig = {
|
|
|
17386
17447
|
md: { thumb: "h-4 w-4", translate: "translate-x-4" },
|
|
17387
17448
|
lg: { thumb: "h-5 w-5", translate: "translate-x-5" }
|
|
17388
17449
|
};
|
|
17389
|
-
var Switch = createComponent
|
|
17450
|
+
var Switch = createComponent({
|
|
17390
17451
|
displayName: "Switch",
|
|
17391
17452
|
__kui: {
|
|
17392
17453
|
role: "formControl",
|
|
@@ -17853,362 +17914,68 @@ var TextareaCore = forwardRef(
|
|
|
17853
17914
|
}
|
|
17854
17915
|
);
|
|
17855
17916
|
TextareaCore.displayName = "TextareaCore";
|
|
17856
|
-
|
|
17857
|
-
|
|
17858
|
-
|
|
17859
|
-
|
|
17860
|
-
|
|
17861
|
-
|
|
17862
|
-
|
|
17863
|
-
|
|
17864
|
-
|
|
17865
|
-
|
|
17866
|
-
|
|
17867
|
-
|
|
17868
|
-
|
|
17869
|
-
|
|
17870
|
-
|
|
17871
|
-
function toggleWrap(value, start, end, marker) {
|
|
17872
|
-
const before = value.slice(Math.max(0, start - marker.length), start);
|
|
17873
|
-
const after = value.slice(end, end + marker.length);
|
|
17874
|
-
if (before === marker && after === marker) {
|
|
17875
|
-
const next2 = value.slice(0, start - marker.length) + value.slice(start, end) + value.slice(end + marker.length);
|
|
17876
|
-
return {
|
|
17877
|
-
value: next2,
|
|
17878
|
-
selectionStart: start - marker.length,
|
|
17879
|
-
selectionEnd: end - marker.length
|
|
17880
|
-
};
|
|
17881
|
-
}
|
|
17882
|
-
const selected = value.slice(start, end);
|
|
17883
|
-
const next = value.slice(0, start) + marker + selected + marker + value.slice(end);
|
|
17884
|
-
return selected.length === 0 ? {
|
|
17885
|
-
value: next,
|
|
17886
|
-
selectionStart: start + marker.length,
|
|
17887
|
-
selectionEnd: start + marker.length
|
|
17888
|
-
} : {
|
|
17889
|
-
value: next,
|
|
17890
|
-
selectionStart: start,
|
|
17891
|
-
selectionEnd: end + marker.length * 2
|
|
17892
|
-
};
|
|
17893
|
-
}
|
|
17894
|
-
__name(toggleWrap, "toggleWrap");
|
|
17895
|
-
function toggleLinePrefix(value, start, end, prefix) {
|
|
17896
|
-
const { from, to } = selectedLineRange(value, start, end);
|
|
17897
|
-
const line = value.slice(from, to);
|
|
17898
|
-
const next = line.startsWith(prefix) ? value.slice(0, from) + line.slice(prefix.length) + value.slice(to) : value.slice(0, from) + prefix + line + value.slice(to);
|
|
17899
|
-
const delta = (line.startsWith(prefix) ? -1 : 1) * prefix.length;
|
|
17900
|
-
return {
|
|
17901
|
-
value: next,
|
|
17902
|
-
selectionStart: start + delta,
|
|
17903
|
-
selectionEnd: end + delta
|
|
17904
|
-
};
|
|
17905
|
-
}
|
|
17906
|
-
__name(toggleLinePrefix, "toggleLinePrefix");
|
|
17907
|
-
function toggleListPrefix(value, start, end, makePrefix) {
|
|
17908
|
-
const { from, to } = selectedLineRange(value, start, end);
|
|
17909
|
-
const block = value.slice(from, to);
|
|
17910
|
-
const lines = block.split("\n");
|
|
17911
|
-
const alreadyListed = lines.every(
|
|
17912
|
-
(l) => l.startsWith(makePrefix(0)) || /^\d+\.\s/.test(l)
|
|
17913
|
-
);
|
|
17914
|
-
const nextLines = lines.map(
|
|
17915
|
-
(l, i) => alreadyListed ? l.replace(/^(\d+\.\s|-\s\[ \]\s|-\s)/, "") : makePrefix(i) + l
|
|
17916
|
-
);
|
|
17917
|
-
const next = value.slice(0, from) + nextLines.join("\n") + value.slice(to);
|
|
17918
|
-
const delta = nextLines.join("\n").length - block.length;
|
|
17919
|
-
return { value: next, selectionStart: from, selectionEnd: to + delta };
|
|
17920
|
-
}
|
|
17921
|
-
__name(toggleListPrefix, "toggleListPrefix");
|
|
17922
|
-
function toggleCode(value, start, end) {
|
|
17923
|
-
const selected = value.slice(start, end);
|
|
17924
|
-
if (selected.includes("\n")) {
|
|
17925
|
-
const next = value.slice(0, start) + "```\n" + selected + "\n```" + value.slice(end);
|
|
17926
|
-
return { value: next, selectionStart: start + 4, selectionEnd: end + 4 };
|
|
17927
|
-
}
|
|
17928
|
-
return toggleWrap(value, start, end, "`");
|
|
17929
|
-
}
|
|
17930
|
-
__name(toggleCode, "toggleCode");
|
|
17931
|
-
function insertLink(value, start, end) {
|
|
17932
|
-
const selected = value.slice(start, end);
|
|
17933
|
-
const label = selected || "text";
|
|
17934
|
-
const snippet = `[${label}](url)`;
|
|
17935
|
-
const next = value.slice(0, start) + snippet + value.slice(end);
|
|
17936
|
-
const urlStart = start + label.length + 3;
|
|
17937
|
-
return { value: next, selectionStart: urlStart, selectionEnd: urlStart + 3 };
|
|
17938
|
-
}
|
|
17939
|
-
__name(insertLink, "insertLink");
|
|
17940
|
-
var TOOLBAR = [
|
|
17941
|
-
{
|
|
17942
|
-
label: "Heading",
|
|
17943
|
-
icon: Heading,
|
|
17944
|
-
action: /* @__PURE__ */ __name((v, s, e) => toggleLinePrefix(v, s, e, "### "), "action")
|
|
17945
|
-
},
|
|
17946
|
-
{
|
|
17947
|
-
label: "Bold",
|
|
17948
|
-
icon: Bold,
|
|
17949
|
-
action: /* @__PURE__ */ __name((v, s, e) => toggleWrap(v, s, e, "**"), "action")
|
|
17950
|
-
},
|
|
17951
|
-
{
|
|
17952
|
-
label: "Italic",
|
|
17953
|
-
icon: Italic,
|
|
17954
|
-
action: /* @__PURE__ */ __name((v, s, e) => toggleWrap(v, s, e, "_"), "action")
|
|
17955
|
-
},
|
|
17956
|
-
{
|
|
17957
|
-
label: "Ordered list",
|
|
17958
|
-
icon: ListOrdered,
|
|
17959
|
-
action: /* @__PURE__ */ __name((v, s, e) => toggleListPrefix(v, s, e, (i) => `${i + 1}. `), "action")
|
|
17917
|
+
var Textarea = createComponent({
|
|
17918
|
+
displayName: "Textarea",
|
|
17919
|
+
__kui: {
|
|
17920
|
+
role: "formControl",
|
|
17921
|
+
formControl: "single",
|
|
17922
|
+
supports: { disabled: true, invalid: true, required: true },
|
|
17923
|
+
skeleton: "input-shaped",
|
|
17924
|
+
video: {
|
|
17925
|
+
id: "textarea",
|
|
17926
|
+
safe: true,
|
|
17927
|
+
acceptsChildren: false,
|
|
17928
|
+
interactionStates: ["focus"],
|
|
17929
|
+
controlled: ["value", "disabled"],
|
|
17930
|
+
motionGated: true
|
|
17931
|
+
}
|
|
17960
17932
|
},
|
|
17961
|
-
{
|
|
17962
|
-
|
|
17963
|
-
|
|
17964
|
-
|
|
17933
|
+
render: /* @__PURE__ */ __name((props, ref) => {
|
|
17934
|
+
return /* @__PURE__ */ jsx(TextareaCore, { ref, ...props });
|
|
17935
|
+
}, "render")
|
|
17936
|
+
});
|
|
17937
|
+
var Checkbox = createComponent({
|
|
17938
|
+
displayName: "Checkbox",
|
|
17939
|
+
__kui: {
|
|
17940
|
+
role: "formControl",
|
|
17941
|
+
formControl: "single",
|
|
17942
|
+
supports: { disabled: true, invalid: true, required: true },
|
|
17943
|
+
skeleton: "input-shaped",
|
|
17944
|
+
video: {
|
|
17945
|
+
id: "checkbox",
|
|
17946
|
+
safe: true,
|
|
17947
|
+
acceptsChildren: false,
|
|
17948
|
+
interactionStates: ["focus"],
|
|
17949
|
+
controlled: ["checked", "disabled", "indeterminate"],
|
|
17950
|
+
motionGated: true
|
|
17951
|
+
}
|
|
17965
17952
|
},
|
|
17966
|
-
|
|
17967
|
-
{ label: "Link", icon: Link, action: insertLink }
|
|
17968
|
-
];
|
|
17969
|
-
var MarkdownEditor = forwardRef(
|
|
17970
|
-
({
|
|
17971
|
-
renderMarkdown,
|
|
17972
|
-
tab: tabProp,
|
|
17973
|
-
defaultTab = "write",
|
|
17974
|
-
onTabChange,
|
|
17975
|
-
hint = "Markdown is supported",
|
|
17976
|
-
value: valueProp,
|
|
17977
|
-
defaultValue,
|
|
17978
|
-
onValueChange,
|
|
17953
|
+
render: /* @__PURE__ */ __name(({
|
|
17979
17954
|
className,
|
|
17980
|
-
|
|
17981
|
-
|
|
17982
|
-
|
|
17955
|
+
checked: checkedProp,
|
|
17956
|
+
defaultChecked,
|
|
17957
|
+
onCheckedChange,
|
|
17958
|
+
indeterminate = false,
|
|
17959
|
+
size = "sm",
|
|
17983
17960
|
error: error51,
|
|
17984
|
-
|
|
17961
|
+
success: success2,
|
|
17962
|
+
status,
|
|
17985
17963
|
disabled,
|
|
17986
|
-
|
|
17987
|
-
|
|
17964
|
+
label,
|
|
17965
|
+
description,
|
|
17966
|
+
id: externalId,
|
|
17967
|
+
onChange: onChangeProp,
|
|
17968
|
+
required: required2,
|
|
17969
|
+
...props
|
|
17988
17970
|
}, ref) => {
|
|
17989
|
-
const
|
|
17990
|
-
const textareaRef = useRef(null);
|
|
17991
|
-
const [uncontrolledTab, setUncontrolledTab] = useState(
|
|
17992
|
-
defaultTab
|
|
17993
|
-
);
|
|
17994
|
-
const tab = tabProp ?? uncontrolledTab;
|
|
17995
|
-
const { theme } = useTheme();
|
|
17971
|
+
const autoId = useId();
|
|
17996
17972
|
const field = useOptionalFormField();
|
|
17997
|
-
const
|
|
17998
|
-
const
|
|
17999
|
-
const
|
|
18000
|
-
const
|
|
18001
|
-
const
|
|
18002
|
-
|
|
18003
|
-
resolveRecipe(theme.recipes.MarkdownEditor, {
|
|
18004
|
-
variant,
|
|
18005
|
-
state,
|
|
18006
|
-
fullWidth,
|
|
18007
|
-
disabled: !!disabled
|
|
18008
|
-
}),
|
|
18009
|
-
className
|
|
18010
|
-
);
|
|
18011
|
-
function setTab(next) {
|
|
18012
|
-
if (tabProp === void 0) setUncontrolledTab(next);
|
|
18013
|
-
onTabChange?.(next);
|
|
18014
|
-
}
|
|
18015
|
-
__name(setTab, "setTab");
|
|
18016
|
-
function commit(next) {
|
|
18017
|
-
setDraft(next);
|
|
18018
|
-
onValueChange?.(next);
|
|
18019
|
-
}
|
|
18020
|
-
__name(commit, "commit");
|
|
18021
|
-
function runAction(action) {
|
|
18022
|
-
if (disabled) return;
|
|
18023
|
-
const el = textareaRef.current;
|
|
18024
|
-
if (!el) return;
|
|
18025
|
-
const { selectionStart, selectionEnd } = el;
|
|
18026
|
-
const edit = action(
|
|
18027
|
-
value,
|
|
18028
|
-
selectionStart ?? value.length,
|
|
18029
|
-
selectionEnd ?? value.length
|
|
18030
|
-
);
|
|
18031
|
-
commit(edit.value);
|
|
18032
|
-
el.focus();
|
|
18033
|
-
requestAnimationFrame(() => {
|
|
18034
|
-
el.setSelectionRange(edit.selectionStart, edit.selectionEnd);
|
|
18035
|
-
});
|
|
18036
|
-
}
|
|
18037
|
-
__name(runAction, "runAction");
|
|
18038
|
-
const tablistId = `${baseId}-tablist`;
|
|
18039
|
-
const writePanelId = `${baseId}-write-panel`;
|
|
18040
|
-
const previewPanelId = `${baseId}-preview-panel`;
|
|
18041
|
-
const renderedPreview = useMemo(
|
|
18042
|
-
() => renderMarkdown ? renderMarkdown(value) : null,
|
|
18043
|
-
[renderMarkdown, value]
|
|
18044
|
-
);
|
|
18045
|
-
useEffect(() => {
|
|
18046
|
-
if (isDev() && !renderMarkdown) {
|
|
18047
|
-
console.warn(
|
|
18048
|
-
"[kreativ-ui/MarkdownEditor]: no `renderMarkdown` prop was provided, so the Preview tab is just showing plain text with no markdown formatting applied. Pass a `renderMarkdown={(value) => ReactNode}` function \u2014 e.g. using react-markdown \u2014 to enable a real preview:\n\n import ReactMarkdown from 'react-markdown';\n <Textarea allowMarkdown renderMarkdown={(v) => <ReactMarkdown>{v}</ReactMarkdown>} />"
|
|
18049
|
-
);
|
|
18050
|
-
}
|
|
18051
|
-
}, [renderMarkdown]);
|
|
18052
|
-
return /* @__PURE__ */ jsxs("div", { className: editorClasses, children: [
|
|
18053
|
-
/* @__PURE__ */ jsxs(
|
|
18054
|
-
"div",
|
|
18055
|
-
{
|
|
18056
|
-
role: "tablist",
|
|
18057
|
-
"aria-label": "Markdown editor mode",
|
|
18058
|
-
id: tablistId,
|
|
18059
|
-
className: "flex items-center gap-4 border-b border-kui-border px-3",
|
|
18060
|
-
children: [
|
|
18061
|
-
["write", "preview"].map((t) => /* @__PURE__ */ jsx(
|
|
18062
|
-
"button",
|
|
18063
|
-
{
|
|
18064
|
-
type: "button",
|
|
18065
|
-
role: "tab",
|
|
18066
|
-
id: `${baseId}-${t}-tab`,
|
|
18067
|
-
"aria-selected": tab === t,
|
|
18068
|
-
"aria-controls": t === "write" ? writePanelId : previewPanelId,
|
|
18069
|
-
onClick: () => setTab(t),
|
|
18070
|
-
disabled,
|
|
18071
|
-
className: cn(
|
|
18072
|
-
"border-b-2 py-2.5 text-sm capitalize transition-colors",
|
|
18073
|
-
"disabled:pointer-events-none disabled:cursor-not-allowed",
|
|
18074
|
-
tab === t ? "border-kui-brand text-kui-text" : "border-transparent text-kui-text-muted hover:text-kui-text"
|
|
18075
|
-
),
|
|
18076
|
-
children: t
|
|
18077
|
-
},
|
|
18078
|
-
t
|
|
18079
|
-
)),
|
|
18080
|
-
tab === "write" && /* @__PURE__ */ jsx("div", { className: "ml-auto flex items-center gap-1 py-1.5", children: TOOLBAR.map(({ label, icon: Icon, action }) => /* @__PURE__ */ jsx(
|
|
18081
|
-
"button",
|
|
18082
|
-
{
|
|
18083
|
-
type: "button",
|
|
18084
|
-
"aria-label": label,
|
|
18085
|
-
onClick: () => runAction(action),
|
|
18086
|
-
disabled,
|
|
18087
|
-
className: "rounded-(--kui-radii-sm) p-1.5 text-kui-text-muted transition-colors hover:bg-kui-surface-raised hover:text-kui-text disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
18088
|
-
children: /* @__PURE__ */ jsx(Icon, { size: 15 })
|
|
18089
|
-
},
|
|
18090
|
-
label
|
|
18091
|
-
)) })
|
|
18092
|
-
]
|
|
18093
|
-
}
|
|
18094
|
-
),
|
|
18095
|
-
/* @__PURE__ */ jsx(
|
|
18096
|
-
"div",
|
|
18097
|
-
{
|
|
18098
|
-
id: writePanelId,
|
|
18099
|
-
role: "tabpanel",
|
|
18100
|
-
"aria-labelledby": `${baseId}-write-tab`,
|
|
18101
|
-
hidden: tab !== "write",
|
|
18102
|
-
children: /* @__PURE__ */ jsx(
|
|
18103
|
-
TextareaCore,
|
|
18104
|
-
{
|
|
18105
|
-
ref: (node) => {
|
|
18106
|
-
textareaRef.current = node;
|
|
18107
|
-
if (typeof ref === "function") {
|
|
18108
|
-
ref(node);
|
|
18109
|
-
} else if (ref) {
|
|
18110
|
-
ref.current = node;
|
|
18111
|
-
}
|
|
18112
|
-
},
|
|
18113
|
-
value,
|
|
18114
|
-
onValueChange: commit,
|
|
18115
|
-
embedded: true,
|
|
18116
|
-
resize: "vertical",
|
|
18117
|
-
disabled,
|
|
18118
|
-
maxLength,
|
|
18119
|
-
...textareaProps
|
|
18120
|
-
}
|
|
18121
|
-
)
|
|
18122
|
-
}
|
|
18123
|
-
),
|
|
18124
|
-
/* @__PURE__ */ jsx(
|
|
18125
|
-
"div",
|
|
18126
|
-
{
|
|
18127
|
-
id: previewPanelId,
|
|
18128
|
-
role: "tabpanel",
|
|
18129
|
-
"aria-labelledby": `${baseId}-preview-tab`,
|
|
18130
|
-
hidden: tab !== "preview",
|
|
18131
|
-
className: "min-h-32 p-3 text-sm text-kui-text",
|
|
18132
|
-
children: renderMarkdown ? renderedPreview : /* @__PURE__ */ jsx("span", { className: "text-kui-text-muted", children: "No renderMarkdown provided \u2014 showing raw text." })
|
|
18133
|
-
}
|
|
18134
|
-
),
|
|
18135
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 border-t border-kui-border px-3 py-2 text-xs z-1", children: footerMessage })
|
|
18136
|
-
] });
|
|
18137
|
-
}
|
|
18138
|
-
);
|
|
18139
|
-
MarkdownEditor.displayName = "MarkdownEditor";
|
|
18140
|
-
var Textarea = createComponent$1({
|
|
18141
|
-
displayName: "Textarea",
|
|
18142
|
-
__kui: {
|
|
18143
|
-
role: "formControl",
|
|
18144
|
-
formControl: "single",
|
|
18145
|
-
supports: { disabled: true, invalid: true, required: true },
|
|
18146
|
-
skeleton: "input-shaped",
|
|
18147
|
-
video: {
|
|
18148
|
-
id: "textarea",
|
|
18149
|
-
safe: true,
|
|
18150
|
-
acceptsChildren: false,
|
|
18151
|
-
interactionStates: ["focus"],
|
|
18152
|
-
controlled: ["value", "disabled"],
|
|
18153
|
-
motionGated: true
|
|
18154
|
-
}
|
|
18155
|
-
},
|
|
18156
|
-
render: /* @__PURE__ */ __name(({ allowMarkdown, ...props }, ref) => {
|
|
18157
|
-
if (allowMarkdown) {
|
|
18158
|
-
return /* @__PURE__ */ jsx(
|
|
18159
|
-
MarkdownEditor,
|
|
18160
|
-
{
|
|
18161
|
-
ref,
|
|
18162
|
-
...props,
|
|
18163
|
-
embedded: true
|
|
18164
|
-
}
|
|
18165
|
-
);
|
|
18166
|
-
}
|
|
18167
|
-
return /* @__PURE__ */ jsx(TextareaCore, { ref, ...props });
|
|
18168
|
-
}, "render")
|
|
18169
|
-
});
|
|
18170
|
-
var Checkbox = createComponent$1({
|
|
18171
|
-
displayName: "Checkbox",
|
|
18172
|
-
__kui: {
|
|
18173
|
-
role: "formControl",
|
|
18174
|
-
formControl: "single",
|
|
18175
|
-
supports: { disabled: true, invalid: true, required: true },
|
|
18176
|
-
skeleton: "input-shaped",
|
|
18177
|
-
video: {
|
|
18178
|
-
id: "checkbox",
|
|
18179
|
-
safe: true,
|
|
18180
|
-
acceptsChildren: false,
|
|
18181
|
-
interactionStates: ["focus"],
|
|
18182
|
-
controlled: ["checked", "disabled", "indeterminate"],
|
|
18183
|
-
motionGated: true
|
|
18184
|
-
}
|
|
18185
|
-
},
|
|
18186
|
-
render: /* @__PURE__ */ __name(({
|
|
18187
|
-
className,
|
|
18188
|
-
checked: checkedProp,
|
|
18189
|
-
defaultChecked,
|
|
18190
|
-
onCheckedChange,
|
|
18191
|
-
indeterminate = false,
|
|
18192
|
-
size = "sm",
|
|
18193
|
-
error: error51,
|
|
18194
|
-
success: success2,
|
|
18195
|
-
status,
|
|
18196
|
-
disabled,
|
|
18197
|
-
label,
|
|
18198
|
-
description,
|
|
18199
|
-
id: externalId,
|
|
18200
|
-
onChange: onChangeProp,
|
|
18201
|
-
required: required2,
|
|
18202
|
-
...props
|
|
18203
|
-
}, ref) => {
|
|
18204
|
-
const autoId = useId();
|
|
18205
|
-
const field = useOptionalFormField();
|
|
18206
|
-
const { theme } = useTheme();
|
|
18207
|
-
const id = field?.id ?? externalId ?? autoId;
|
|
18208
|
-
const isDisabled = disabled || Boolean(field?.disabled);
|
|
18209
|
-
const inputRef = useRef(null);
|
|
18210
|
-
const [internalChecked, setInternalChecked] = useState(
|
|
18211
|
-
defaultChecked ?? false
|
|
17973
|
+
const { theme } = useTheme();
|
|
17974
|
+
const id = field?.id ?? externalId ?? autoId;
|
|
17975
|
+
const isDisabled = disabled || Boolean(field?.disabled);
|
|
17976
|
+
const inputRef = useRef(null);
|
|
17977
|
+
const [internalChecked, setInternalChecked] = useState(
|
|
17978
|
+
defaultChecked ?? false
|
|
18212
17979
|
);
|
|
18213
17980
|
const isControlled = checkedProp !== void 0;
|
|
18214
17981
|
const checked = isControlled ? checkedProp : internalChecked;
|
|
@@ -18389,7 +18156,7 @@ function formatValue(value, precision) {
|
|
|
18389
18156
|
return precision !== void 0 ? value.toFixed(precision) : String(value);
|
|
18390
18157
|
}
|
|
18391
18158
|
__name(formatValue, "formatValue");
|
|
18392
|
-
var NumberStepper = createComponent
|
|
18159
|
+
var NumberStepper = createComponent({
|
|
18393
18160
|
__kui: {
|
|
18394
18161
|
formControl: "single",
|
|
18395
18162
|
role: "formControl",
|
|
@@ -18465,7 +18232,6 @@ var NumberStepper = createComponent$1({
|
|
|
18465
18232
|
precision,
|
|
18466
18233
|
required: isRequired
|
|
18467
18234
|
});
|
|
18468
|
-
console.log("validate", { raw, min, max, step, precision, result });
|
|
18469
18235
|
onValidate?.(result);
|
|
18470
18236
|
reportToFormField(result);
|
|
18471
18237
|
return result;
|
|
@@ -18964,7 +18730,7 @@ function RepeaterRoot({
|
|
|
18964
18730
|
return /* @__PURE__ */ jsx(RepeaterRootContext.Provider, { value: contextValue, children });
|
|
18965
18731
|
}
|
|
18966
18732
|
__name(RepeaterRoot, "RepeaterRoot");
|
|
18967
|
-
var RepeaterItems = createComponent
|
|
18733
|
+
var RepeaterItems = createComponent({
|
|
18968
18734
|
displayName: "Repeater.Items",
|
|
18969
18735
|
__kui: {
|
|
18970
18736
|
role: "layout",
|
|
@@ -19025,7 +18791,7 @@ function useFlipAnimation(ref, deps) {
|
|
|
19025
18791
|
}, []);
|
|
19026
18792
|
}
|
|
19027
18793
|
__name(useFlipAnimation, "useFlipAnimation");
|
|
19028
|
-
var RepeaterItem = createComponent
|
|
18794
|
+
var RepeaterItem = createComponent({
|
|
19029
18795
|
displayName: "Repeater.Item",
|
|
19030
18796
|
__kui: {
|
|
19031
18797
|
role: "layout",
|
|
@@ -19053,7 +18819,7 @@ var RepeaterItem = createComponent$1({
|
|
|
19053
18819
|
return /* @__PURE__ */ jsx(RepeaterItemContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx("div", { ref: composedRef, className: classes, ...rest, children }) });
|
|
19054
18820
|
}, "RepeaterItem")
|
|
19055
18821
|
});
|
|
19056
|
-
var RepeaterRemove = createComponent
|
|
18822
|
+
var RepeaterRemove = createComponent({
|
|
19057
18823
|
displayName: "Repeater.Remove",
|
|
19058
18824
|
__kui: {
|
|
19059
18825
|
role: "action",
|
|
@@ -19090,7 +18856,7 @@ var RepeaterRemove = createComponent$1({
|
|
|
19090
18856
|
);
|
|
19091
18857
|
}, "RepeaterRemove")
|
|
19092
18858
|
});
|
|
19093
|
-
var RepeaterMoveUp = createComponent
|
|
18859
|
+
var RepeaterMoveUp = createComponent({
|
|
19094
18860
|
displayName: "Repeater.MoveUp",
|
|
19095
18861
|
__kui: {
|
|
19096
18862
|
role: "action",
|
|
@@ -19129,7 +18895,7 @@ var RepeaterMoveUp = createComponent$1({
|
|
|
19129
18895
|
);
|
|
19130
18896
|
}, "RepeaterMoveUp")
|
|
19131
18897
|
});
|
|
19132
|
-
var RepeaterMoveDown = createComponent
|
|
18898
|
+
var RepeaterMoveDown = createComponent({
|
|
19133
18899
|
displayName: "Repeater.MoveDown",
|
|
19134
18900
|
__kui: {
|
|
19135
18901
|
role: "action",
|
|
@@ -19168,7 +18934,7 @@ var RepeaterMoveDown = createComponent$1({
|
|
|
19168
18934
|
);
|
|
19169
18935
|
}, "RepeaterMoveDown")
|
|
19170
18936
|
});
|
|
19171
|
-
var RepeaterAdd = createComponent
|
|
18937
|
+
var RepeaterAdd = createComponent({
|
|
19172
18938
|
displayName: "Repeater.Add",
|
|
19173
18939
|
__kui: {
|
|
19174
18940
|
role: "action",
|
|
@@ -19665,7 +19431,7 @@ function countMessageComponents(children) {
|
|
|
19665
19431
|
return count;
|
|
19666
19432
|
}
|
|
19667
19433
|
__name(countMessageComponents, "countMessageComponents");
|
|
19668
|
-
var FormFieldRoot = createComponent
|
|
19434
|
+
var FormFieldRoot = createComponent({
|
|
19669
19435
|
displayName: "FormField.Root",
|
|
19670
19436
|
__kui: {
|
|
19671
19437
|
role: "formControl",
|
|
@@ -19790,7 +19556,7 @@ var FormFieldRoot = createComponent$1({
|
|
|
19790
19556
|
] }) });
|
|
19791
19557
|
}, "render")
|
|
19792
19558
|
});
|
|
19793
|
-
var FormFieldLabel = createComponent
|
|
19559
|
+
var FormFieldLabel = createComponent({
|
|
19794
19560
|
displayName: "FormField.Label",
|
|
19795
19561
|
__kui: {
|
|
19796
19562
|
role: "display",
|
|
@@ -19833,7 +19599,7 @@ var FormFieldLabel = createComponent$1({
|
|
|
19833
19599
|
);
|
|
19834
19600
|
}, "render")
|
|
19835
19601
|
});
|
|
19836
|
-
var FormFieldDescription = createComponent
|
|
19602
|
+
var FormFieldDescription = createComponent({
|
|
19837
19603
|
displayName: "FormField.Description",
|
|
19838
19604
|
__kui: {
|
|
19839
19605
|
role: "display",
|
|
@@ -19876,7 +19642,7 @@ function sameValidity(prev, next) {
|
|
|
19876
19642
|
return prev === null && next === null || prev?.invalid === next?.invalid && prev?.message === next?.message;
|
|
19877
19643
|
}
|
|
19878
19644
|
__name(sameValidity, "sameValidity");
|
|
19879
|
-
var FormFieldControl = createComponent
|
|
19645
|
+
var FormFieldControl = createComponent(
|
|
19880
19646
|
{
|
|
19881
19647
|
displayName: "FormField.Control",
|
|
19882
19648
|
__kui: {
|
|
@@ -20071,80 +19837,418 @@ var FormField = Object.assign(FormFieldForwardRef, {
|
|
|
20071
19837
|
Message: FormFieldMessage,
|
|
20072
19838
|
Control: FormFieldControl
|
|
20073
19839
|
});
|
|
20074
|
-
|
|
20075
|
-
|
|
20076
|
-
|
|
20077
|
-
|
|
20078
|
-
|
|
20079
|
-
|
|
20080
|
-
return
|
|
19840
|
+
|
|
19841
|
+
// src/components/forms/MarkdownEditor/markdownActions.ts
|
|
19842
|
+
function lineBounds(value, index) {
|
|
19843
|
+
const start = value.lastIndexOf("\n", index - 1) + 1;
|
|
19844
|
+
const nextBreak = value.indexOf("\n", index);
|
|
19845
|
+
const end = nextBreak === -1 ? value.length : nextBreak;
|
|
19846
|
+
return { start, end };
|
|
20081
19847
|
}
|
|
20082
|
-
__name(
|
|
20083
|
-
function
|
|
20084
|
-
value
|
|
20085
|
-
|
|
20086
|
-
|
|
20087
|
-
name: nameProp,
|
|
20088
|
-
disabled = false,
|
|
20089
|
-
required: required2 = false,
|
|
20090
|
-
orientation = "vertical",
|
|
20091
|
-
size = "md",
|
|
20092
|
-
error: error51,
|
|
20093
|
-
success: success2,
|
|
20094
|
-
className,
|
|
20095
|
-
children
|
|
20096
|
-
}) {
|
|
20097
|
-
const autoName = useId();
|
|
20098
|
-
const name = nameProp ?? autoName;
|
|
20099
|
-
const field = useOptionalFormField();
|
|
20100
|
-
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
20101
|
-
const value = valueProp !== void 0 ? valueProp : internalValue;
|
|
20102
|
-
const handleValueChange = useCallback(
|
|
20103
|
-
(next) => {
|
|
20104
|
-
if (valueProp === void 0) setInternalValue(next);
|
|
20105
|
-
onValueChange?.(next);
|
|
20106
|
-
},
|
|
20107
|
-
[valueProp, onValueChange]
|
|
20108
|
-
);
|
|
20109
|
-
const isInvalid = error51 ?? field?.invalid ?? false;
|
|
20110
|
-
const isSuccess = success2 ?? false;
|
|
20111
|
-
const state = isInvalid ? "error" : isSuccess ? "success" : "none";
|
|
20112
|
-
const groupRequired = required2 || !!field?.required;
|
|
20113
|
-
return /* @__PURE__ */ jsx(
|
|
20114
|
-
RadioGroupContext.Provider,
|
|
20115
|
-
{
|
|
20116
|
-
value: {
|
|
20117
|
-
name,
|
|
20118
|
-
value,
|
|
20119
|
-
onValueChange: handleValueChange,
|
|
20120
|
-
disabled,
|
|
20121
|
-
size,
|
|
20122
|
-
state,
|
|
20123
|
-
groupRequired
|
|
20124
|
-
},
|
|
20125
|
-
children: /* @__PURE__ */ jsx(
|
|
20126
|
-
"div",
|
|
20127
|
-
{
|
|
20128
|
-
role: "radiogroup",
|
|
20129
|
-
"aria-labelledby": field?.hasExternalLabel ? `${field.id}-label` : void 0,
|
|
20130
|
-
"aria-describedby": field?.describedBy,
|
|
20131
|
-
"aria-required": groupRequired || void 0,
|
|
20132
|
-
"aria-invalid": isInvalid || void 0,
|
|
20133
|
-
className: cn(
|
|
20134
|
-
"flex gap-3",
|
|
20135
|
-
orientation === "horizontal" ? "flex-row flex-wrap" : "flex-col",
|
|
20136
|
-
className
|
|
20137
|
-
),
|
|
20138
|
-
children
|
|
20139
|
-
}
|
|
20140
|
-
)
|
|
20141
|
-
}
|
|
20142
|
-
);
|
|
19848
|
+
__name(lineBounds, "lineBounds");
|
|
19849
|
+
function selectedLineRange(value, start, end) {
|
|
19850
|
+
const first = lineBounds(value, start);
|
|
19851
|
+
const last = lineBounds(value, Math.max(end - 1, start));
|
|
19852
|
+
return { from: first.start, to: last.end };
|
|
20143
19853
|
}
|
|
20144
|
-
__name(
|
|
20145
|
-
|
|
20146
|
-
|
|
20147
|
-
|
|
19854
|
+
__name(selectedLineRange, "selectedLineRange");
|
|
19855
|
+
function toggleWrap(value, start, end, marker) {
|
|
19856
|
+
const before = value.slice(Math.max(0, start - marker.length), start);
|
|
19857
|
+
const after = value.slice(end, end + marker.length);
|
|
19858
|
+
if (before === marker && after === marker) {
|
|
19859
|
+
const next2 = value.slice(0, start - marker.length) + value.slice(start, end) + value.slice(end + marker.length);
|
|
19860
|
+
return {
|
|
19861
|
+
value: next2,
|
|
19862
|
+
selectionStart: start - marker.length,
|
|
19863
|
+
selectionEnd: end - marker.length
|
|
19864
|
+
};
|
|
19865
|
+
}
|
|
19866
|
+
const selected = value.slice(start, end);
|
|
19867
|
+
const next = value.slice(0, start) + marker + selected + marker + value.slice(end);
|
|
19868
|
+
return selected.length === 0 ? {
|
|
19869
|
+
value: next,
|
|
19870
|
+
selectionStart: start + marker.length,
|
|
19871
|
+
selectionEnd: start + marker.length
|
|
19872
|
+
} : {
|
|
19873
|
+
value: next,
|
|
19874
|
+
selectionStart: start,
|
|
19875
|
+
selectionEnd: end + marker.length * 2
|
|
19876
|
+
};
|
|
19877
|
+
}
|
|
19878
|
+
__name(toggleWrap, "toggleWrap");
|
|
19879
|
+
function toggleLinePrefix(value, start, end, prefix) {
|
|
19880
|
+
const { from, to } = selectedLineRange(value, start, end);
|
|
19881
|
+
const line = value.slice(from, to);
|
|
19882
|
+
const next = line.startsWith(prefix) ? value.slice(0, from) + line.slice(prefix.length) + value.slice(to) : value.slice(0, from) + prefix + line + value.slice(to);
|
|
19883
|
+
const delta = (line.startsWith(prefix) ? -1 : 1) * prefix.length;
|
|
19884
|
+
return {
|
|
19885
|
+
value: next,
|
|
19886
|
+
selectionStart: start + delta,
|
|
19887
|
+
selectionEnd: end + delta
|
|
19888
|
+
};
|
|
19889
|
+
}
|
|
19890
|
+
__name(toggleLinePrefix, "toggleLinePrefix");
|
|
19891
|
+
function toggleListPrefix(value, start, end, makePrefix) {
|
|
19892
|
+
const { from, to } = selectedLineRange(value, start, end);
|
|
19893
|
+
const block = value.slice(from, to);
|
|
19894
|
+
const lines = block.split("\n");
|
|
19895
|
+
const alreadyListed = lines.every(
|
|
19896
|
+
(l) => l.startsWith(makePrefix(0)) || /^\d+\.\s/.test(l)
|
|
19897
|
+
);
|
|
19898
|
+
const nextLines = lines.map(
|
|
19899
|
+
(l, i) => alreadyListed ? l.replace(/^(\d+\.\s|-\s\[ \]\s|-\s)/, "") : makePrefix(i) + l
|
|
19900
|
+
);
|
|
19901
|
+
const next = value.slice(0, from) + nextLines.join("\n") + value.slice(to);
|
|
19902
|
+
const delta = nextLines.join("\n").length - block.length;
|
|
19903
|
+
return { value: next, selectionStart: from, selectionEnd: to + delta };
|
|
19904
|
+
}
|
|
19905
|
+
__name(toggleListPrefix, "toggleListPrefix");
|
|
19906
|
+
function toggleCode(value, start, end) {
|
|
19907
|
+
const selected = value.slice(start, end);
|
|
19908
|
+
if (selected.includes("\n")) {
|
|
19909
|
+
const next = value.slice(0, start) + "```\n" + selected + "\n```" + value.slice(end);
|
|
19910
|
+
return { value: next, selectionStart: start + 4, selectionEnd: end + 4 };
|
|
19911
|
+
}
|
|
19912
|
+
return toggleWrap(value, start, end, "`");
|
|
19913
|
+
}
|
|
19914
|
+
__name(toggleCode, "toggleCode");
|
|
19915
|
+
function insertLink(value, start, end) {
|
|
19916
|
+
const selected = value.slice(start, end);
|
|
19917
|
+
const label = selected || "text";
|
|
19918
|
+
const snippet = `[${label}](url)`;
|
|
19919
|
+
const next = value.slice(0, start) + snippet + value.slice(end);
|
|
19920
|
+
const urlStart = start + label.length + 3;
|
|
19921
|
+
return { value: next, selectionStart: urlStart, selectionEnd: urlStart + 3 };
|
|
19922
|
+
}
|
|
19923
|
+
__name(insertLink, "insertLink");
|
|
19924
|
+
var TOOLBAR = [
|
|
19925
|
+
{
|
|
19926
|
+
label: "Heading",
|
|
19927
|
+
icon: Heading,
|
|
19928
|
+
action: /* @__PURE__ */ __name((v, s, e) => toggleLinePrefix(v, s, e, "### "), "action")
|
|
19929
|
+
},
|
|
19930
|
+
{
|
|
19931
|
+
label: "Bold",
|
|
19932
|
+
icon: Bold,
|
|
19933
|
+
action: /* @__PURE__ */ __name((v, s, e) => toggleWrap(v, s, e, "**"), "action"),
|
|
19934
|
+
shortcutKey: "b"
|
|
19935
|
+
},
|
|
19936
|
+
{
|
|
19937
|
+
label: "Italic",
|
|
19938
|
+
icon: Italic,
|
|
19939
|
+
action: /* @__PURE__ */ __name((v, s, e) => toggleWrap(v, s, e, "_"), "action"),
|
|
19940
|
+
shortcutKey: "i"
|
|
19941
|
+
},
|
|
19942
|
+
{
|
|
19943
|
+
label: "Strikethrough",
|
|
19944
|
+
icon: Strikethrough,
|
|
19945
|
+
action: /* @__PURE__ */ __name((v, s, e) => toggleWrap(v, s, e, "~~"), "action")
|
|
19946
|
+
},
|
|
19947
|
+
{
|
|
19948
|
+
label: "Quote",
|
|
19949
|
+
icon: Quote,
|
|
19950
|
+
action: /* @__PURE__ */ __name((v, s, e) => toggleLinePrefix(v, s, e, "> "), "action")
|
|
19951
|
+
},
|
|
19952
|
+
{
|
|
19953
|
+
label: "Ordered list",
|
|
19954
|
+
icon: ListOrdered,
|
|
19955
|
+
action: /* @__PURE__ */ __name((v, s, e) => toggleListPrefix(v, s, e, (i) => `${i + 1}. `), "action")
|
|
19956
|
+
},
|
|
19957
|
+
{
|
|
19958
|
+
label: "Checklist",
|
|
19959
|
+
icon: ClipboardList,
|
|
19960
|
+
action: /* @__PURE__ */ __name((v, s, e) => toggleListPrefix(v, s, e, () => "- [ ] "), "action")
|
|
19961
|
+
},
|
|
19962
|
+
{ label: "Code", icon: Code, action: toggleCode },
|
|
19963
|
+
{ label: "Link", icon: Link, action: insertLink, shortcutKey: "k" }
|
|
19964
|
+
];
|
|
19965
|
+
var SHORTCUT_MAP = new Map(
|
|
19966
|
+
TOOLBAR.filter((item) => item.shortcutKey).map((item) => [
|
|
19967
|
+
item.shortcutKey,
|
|
19968
|
+
item
|
|
19969
|
+
])
|
|
19970
|
+
);
|
|
19971
|
+
var isMac = typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform);
|
|
19972
|
+
var modLabel = isMac ? "\u2318" : "Ctrl";
|
|
19973
|
+
function shortcutHint(item) {
|
|
19974
|
+
if (!item.shortcutKey) return item.label;
|
|
19975
|
+
return `${item.label} (${modLabel}+${item.shortcutKey.toUpperCase()})`;
|
|
19976
|
+
}
|
|
19977
|
+
__name(shortcutHint, "shortcutHint");
|
|
19978
|
+
var MarkdownEditor = createComponent({
|
|
19979
|
+
displayName: "MarkdownEditor",
|
|
19980
|
+
__kui: {
|
|
19981
|
+
role: "formControl",
|
|
19982
|
+
formControl: "single",
|
|
19983
|
+
supports: { disabled: true, invalid: true, required: true },
|
|
19984
|
+
skeleton: "input-shaped",
|
|
19985
|
+
video: {
|
|
19986
|
+
id: "markdown-editor",
|
|
19987
|
+
safe: true,
|
|
19988
|
+
acceptsChildren: false,
|
|
19989
|
+
interactionStates: ["focus"],
|
|
19990
|
+
controlled: ["value", "disabled"],
|
|
19991
|
+
motionGated: true
|
|
19992
|
+
}
|
|
19993
|
+
},
|
|
19994
|
+
render: /* @__PURE__ */ __name(({
|
|
19995
|
+
renderMarkdown,
|
|
19996
|
+
tab: tabProp,
|
|
19997
|
+
defaultTab = "write",
|
|
19998
|
+
onTabChange,
|
|
19999
|
+
hint = "Markdown is supported",
|
|
20000
|
+
value: valueProp,
|
|
20001
|
+
defaultValue,
|
|
20002
|
+
onValueChange,
|
|
20003
|
+
className,
|
|
20004
|
+
fullWidth,
|
|
20005
|
+
variant = "outline",
|
|
20006
|
+
success: success2,
|
|
20007
|
+
error: error51,
|
|
20008
|
+
warning,
|
|
20009
|
+
disabled,
|
|
20010
|
+
maxLength,
|
|
20011
|
+
...textareaProps
|
|
20012
|
+
}, ref) => {
|
|
20013
|
+
const baseId = useId();
|
|
20014
|
+
const textareaRef = useRef(null);
|
|
20015
|
+
const { theme } = useTheme();
|
|
20016
|
+
const field = useOptionalFormField();
|
|
20017
|
+
const motionGated = isMotionGated$1(textareaProps);
|
|
20018
|
+
const isDisabled = disabled || Boolean(field?.disabled);
|
|
20019
|
+
const [uncontrolledTab, setUncontrolledTab] = useState(
|
|
20020
|
+
defaultTab
|
|
20021
|
+
);
|
|
20022
|
+
const tab = tabProp ?? uncontrolledTab;
|
|
20023
|
+
const footerMessage = hint;
|
|
20024
|
+
const [draft, setDraft] = useState(() => valueProp ?? defaultValue ?? "");
|
|
20025
|
+
const value = valueProp ?? draft;
|
|
20026
|
+
const maxLengthReached = typeof maxLength === "number" && value.length >= maxLength;
|
|
20027
|
+
const state = error51 || maxLengthReached ? "error" : success2 ? "success" : warning ? "warning" : field?.status ?? "none";
|
|
20028
|
+
const editorClasses = cn(
|
|
20029
|
+
resolveRecipe(theme.recipes.MarkdownEditor, {
|
|
20030
|
+
variant,
|
|
20031
|
+
state,
|
|
20032
|
+
fullWidth,
|
|
20033
|
+
disabled: isDisabled
|
|
20034
|
+
}),
|
|
20035
|
+
className
|
|
20036
|
+
);
|
|
20037
|
+
function setTab(next) {
|
|
20038
|
+
if (tabProp === void 0) setUncontrolledTab(next);
|
|
20039
|
+
onTabChange?.(next);
|
|
20040
|
+
}
|
|
20041
|
+
__name(setTab, "setTab");
|
|
20042
|
+
function commit(next) {
|
|
20043
|
+
setDraft(next);
|
|
20044
|
+
onValueChange?.(next);
|
|
20045
|
+
}
|
|
20046
|
+
__name(commit, "commit");
|
|
20047
|
+
function runAction(action) {
|
|
20048
|
+
if (isDisabled) return;
|
|
20049
|
+
const el = textareaRef.current;
|
|
20050
|
+
if (!el) return;
|
|
20051
|
+
const { selectionStart, selectionEnd } = el;
|
|
20052
|
+
const edit = action(
|
|
20053
|
+
value,
|
|
20054
|
+
selectionStart ?? value.length,
|
|
20055
|
+
selectionEnd ?? value.length
|
|
20056
|
+
);
|
|
20057
|
+
commit(edit.value);
|
|
20058
|
+
el.focus();
|
|
20059
|
+
const place = /* @__PURE__ */ __name(() => {
|
|
20060
|
+
el.setSelectionRange(edit.selectionStart, edit.selectionEnd);
|
|
20061
|
+
}, "place");
|
|
20062
|
+
if (motionGated) place();
|
|
20063
|
+
else requestAnimationFrame(place);
|
|
20064
|
+
}
|
|
20065
|
+
__name(runAction, "runAction");
|
|
20066
|
+
function handleToolbarKeyDown(event) {
|
|
20067
|
+
if (isDisabled) return;
|
|
20068
|
+
if (event.nativeEvent.isComposing) return;
|
|
20069
|
+
const mod = isMac ? event.metaKey : event.ctrlKey;
|
|
20070
|
+
if (!mod || event.altKey) return;
|
|
20071
|
+
const key = event.key.toLowerCase();
|
|
20072
|
+
const item = SHORTCUT_MAP.get(key);
|
|
20073
|
+
if (!item) return;
|
|
20074
|
+
event.preventDefault();
|
|
20075
|
+
runAction(item.action);
|
|
20076
|
+
}
|
|
20077
|
+
__name(handleToolbarKeyDown, "handleToolbarKeyDown");
|
|
20078
|
+
const writePanelId = `${baseId}-write-panel`;
|
|
20079
|
+
const previewPanelId = `${baseId}-preview-panel`;
|
|
20080
|
+
const renderedPreview = useMemo(
|
|
20081
|
+
() => renderMarkdown ? renderMarkdown(value) : null,
|
|
20082
|
+
[renderMarkdown, value]
|
|
20083
|
+
);
|
|
20084
|
+
useEffect(() => {
|
|
20085
|
+
if (isDev() && !renderMarkdown) {
|
|
20086
|
+
console.warn(
|
|
20087
|
+
"[kreativ-ui/MarkdownEditor]: no renderMarkdown prop was provided, so the Preview tab is showing plain text. Pass renderMarkdown={(value) => ReactNode}."
|
|
20088
|
+
);
|
|
20089
|
+
}
|
|
20090
|
+
}, [renderMarkdown]);
|
|
20091
|
+
return /* @__PURE__ */ jsxs("div", { className: editorClasses, children: [
|
|
20092
|
+
/* @__PURE__ */ jsxs(
|
|
20093
|
+
"div",
|
|
20094
|
+
{
|
|
20095
|
+
role: "tablist",
|
|
20096
|
+
"aria-label": "Markdown editor mode",
|
|
20097
|
+
id: `${baseId}-tablist`,
|
|
20098
|
+
className: "flex items-center gap-4 border-b border-kui-border px-3",
|
|
20099
|
+
children: [
|
|
20100
|
+
["write", "preview"].map((t) => /* @__PURE__ */ jsx(
|
|
20101
|
+
"button",
|
|
20102
|
+
{
|
|
20103
|
+
type: "button",
|
|
20104
|
+
role: "tab",
|
|
20105
|
+
id: `${baseId}-${t}-tab`,
|
|
20106
|
+
"aria-selected": tab === t,
|
|
20107
|
+
"aria-controls": t === "write" ? writePanelId : previewPanelId,
|
|
20108
|
+
onClick: () => setTab(t),
|
|
20109
|
+
disabled: isDisabled,
|
|
20110
|
+
className: cn(
|
|
20111
|
+
"border-b-2 py-2.5 text-sm capitalize",
|
|
20112
|
+
!motionGated && "transition-colors",
|
|
20113
|
+
"disabled:pointer-events-none disabled:cursor-not-allowed",
|
|
20114
|
+
tab === t ? "border-kui-brand text-kui-text" : "border-transparent text-kui-text-muted hover:text-kui-text"
|
|
20115
|
+
),
|
|
20116
|
+
children: t
|
|
20117
|
+
},
|
|
20118
|
+
t
|
|
20119
|
+
)),
|
|
20120
|
+
tab === "write" && /* @__PURE__ */ jsx("div", { className: "ml-auto flex items-center gap-1 py-1.5 overflow-x-auto kui-scrollbar", children: TOOLBAR.map((item) => /* @__PURE__ */ jsx(
|
|
20121
|
+
"button",
|
|
20122
|
+
{
|
|
20123
|
+
type: "button",
|
|
20124
|
+
"aria-label": shortcutHint(item),
|
|
20125
|
+
title: shortcutHint(item),
|
|
20126
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
20127
|
+
onClick: () => runAction(item.action),
|
|
20128
|
+
disabled: isDisabled,
|
|
20129
|
+
className: cn(
|
|
20130
|
+
"rounded-(--kui-radii-sm) p-1.5 text-kui-text-muted hover:bg-kui-surface-raised hover:text-kui-text disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
20131
|
+
!motionGated && "transition-colors"
|
|
20132
|
+
),
|
|
20133
|
+
children: /* @__PURE__ */ jsx(item.icon, { size: 15 })
|
|
20134
|
+
},
|
|
20135
|
+
item.label
|
|
20136
|
+
)) })
|
|
20137
|
+
]
|
|
20138
|
+
}
|
|
20139
|
+
),
|
|
20140
|
+
/* @__PURE__ */ jsx(
|
|
20141
|
+
"div",
|
|
20142
|
+
{
|
|
20143
|
+
id: writePanelId,
|
|
20144
|
+
role: "tabpanel",
|
|
20145
|
+
"aria-labelledby": `${baseId}-write-tab`,
|
|
20146
|
+
hidden: tab !== "write",
|
|
20147
|
+
onKeyDown: handleToolbarKeyDown,
|
|
20148
|
+
children: /* @__PURE__ */ jsx(
|
|
20149
|
+
TextareaCore,
|
|
20150
|
+
{
|
|
20151
|
+
ref: composeRefs(textareaRef, ref),
|
|
20152
|
+
value,
|
|
20153
|
+
onValueChange: commit,
|
|
20154
|
+
embedded: true,
|
|
20155
|
+
resize: "vertical",
|
|
20156
|
+
disabled: isDisabled,
|
|
20157
|
+
maxLength,
|
|
20158
|
+
...textareaProps
|
|
20159
|
+
}
|
|
20160
|
+
)
|
|
20161
|
+
}
|
|
20162
|
+
),
|
|
20163
|
+
/* @__PURE__ */ jsx(
|
|
20164
|
+
"div",
|
|
20165
|
+
{
|
|
20166
|
+
id: previewPanelId,
|
|
20167
|
+
role: "tabpanel",
|
|
20168
|
+
"aria-labelledby": `${baseId}-preview-tab`,
|
|
20169
|
+
hidden: tab !== "preview",
|
|
20170
|
+
className: "min-h-32 p-3 text-sm text-kui-text",
|
|
20171
|
+
children: renderMarkdown ? renderedPreview : /* @__PURE__ */ jsx("span", { className: "text-kui-text-muted", children: "No renderMarkdown provided \u2014 showing raw text." })
|
|
20172
|
+
}
|
|
20173
|
+
),
|
|
20174
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 border-t border-kui-border px-3 py-2 text-xs z-1", children: footerMessage })
|
|
20175
|
+
] });
|
|
20176
|
+
}, "render")
|
|
20177
|
+
});
|
|
20178
|
+
var RadioGroupContext = createContext(null);
|
|
20179
|
+
function useRadioGroupContext() {
|
|
20180
|
+
const ctx = useContext(RadioGroupContext);
|
|
20181
|
+
if (!ctx) {
|
|
20182
|
+
throw new Error("<Radio /> must be rendered inside <RadioGroup>.");
|
|
20183
|
+
}
|
|
20184
|
+
return ctx;
|
|
20185
|
+
}
|
|
20186
|
+
__name(useRadioGroupContext, "useRadioGroupContext");
|
|
20187
|
+
function RadioGroup({
|
|
20188
|
+
value: valueProp,
|
|
20189
|
+
defaultValue,
|
|
20190
|
+
onValueChange,
|
|
20191
|
+
name: nameProp,
|
|
20192
|
+
disabled = false,
|
|
20193
|
+
required: required2 = false,
|
|
20194
|
+
orientation = "vertical",
|
|
20195
|
+
size = "md",
|
|
20196
|
+
error: error51,
|
|
20197
|
+
success: success2,
|
|
20198
|
+
className,
|
|
20199
|
+
children
|
|
20200
|
+
}) {
|
|
20201
|
+
const autoName = useId();
|
|
20202
|
+
const name = nameProp ?? autoName;
|
|
20203
|
+
const field = useOptionalFormField();
|
|
20204
|
+
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
20205
|
+
const value = valueProp !== void 0 ? valueProp : internalValue;
|
|
20206
|
+
const handleValueChange = useCallback(
|
|
20207
|
+
(next) => {
|
|
20208
|
+
if (valueProp === void 0) setInternalValue(next);
|
|
20209
|
+
onValueChange?.(next);
|
|
20210
|
+
},
|
|
20211
|
+
[valueProp, onValueChange]
|
|
20212
|
+
);
|
|
20213
|
+
const isInvalid = error51 ?? field?.invalid ?? false;
|
|
20214
|
+
const isSuccess = success2 ?? false;
|
|
20215
|
+
const state = isInvalid ? "error" : isSuccess ? "success" : "none";
|
|
20216
|
+
const groupRequired = required2 || !!field?.required;
|
|
20217
|
+
return /* @__PURE__ */ jsx(
|
|
20218
|
+
RadioGroupContext.Provider,
|
|
20219
|
+
{
|
|
20220
|
+
value: {
|
|
20221
|
+
name,
|
|
20222
|
+
value,
|
|
20223
|
+
onValueChange: handleValueChange,
|
|
20224
|
+
disabled,
|
|
20225
|
+
size,
|
|
20226
|
+
state,
|
|
20227
|
+
groupRequired
|
|
20228
|
+
},
|
|
20229
|
+
children: /* @__PURE__ */ jsx(
|
|
20230
|
+
"div",
|
|
20231
|
+
{
|
|
20232
|
+
role: "radiogroup",
|
|
20233
|
+
"aria-labelledby": field?.hasExternalLabel ? `${field.id}-label` : void 0,
|
|
20234
|
+
"aria-describedby": field?.describedBy,
|
|
20235
|
+
"aria-required": groupRequired || void 0,
|
|
20236
|
+
"aria-invalid": isInvalid || void 0,
|
|
20237
|
+
className: cn(
|
|
20238
|
+
"flex gap-3",
|
|
20239
|
+
orientation === "horizontal" ? "flex-row flex-wrap" : "flex-col",
|
|
20240
|
+
className
|
|
20241
|
+
),
|
|
20242
|
+
children
|
|
20243
|
+
}
|
|
20244
|
+
)
|
|
20245
|
+
}
|
|
20246
|
+
);
|
|
20247
|
+
}
|
|
20248
|
+
__name(RadioGroup, "RadioGroup");
|
|
20249
|
+
var radioBubbleVariants = cva(
|
|
20250
|
+
"flex shrink-0 items-center justify-center rounded-full border transition-colors duration-[var(--kui-duration-fast)]",
|
|
20251
|
+
{
|
|
20148
20252
|
variants: {
|
|
20149
20253
|
size: {
|
|
20150
20254
|
sm: "h-4 w-4",
|
|
@@ -21078,6 +21182,10 @@ MultiSelect.Content = MultiSelectContent;
|
|
|
21078
21182
|
MultiSelect.Item = MultiSelectItem;
|
|
21079
21183
|
|
|
21080
21184
|
// src/utils/responsive.ts
|
|
21185
|
+
function isResponsiveValue(value) {
|
|
21186
|
+
return typeof value === "object" && value !== null;
|
|
21187
|
+
}
|
|
21188
|
+
__name(isResponsiveValue, "isResponsiveValue");
|
|
21081
21189
|
function resolveResponsiveValue(value) {
|
|
21082
21190
|
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
21083
21191
|
return {
|
|
@@ -21108,18 +21216,232 @@ var Container = forwardRef(
|
|
|
21108
21216
|
...rest
|
|
21109
21217
|
}, ref) => {
|
|
21110
21218
|
const { theme } = useTheme();
|
|
21111
|
-
const recipeClassName = unstyled ? "" : resolveRecipe(theme.recipes.Container, { maxWidth });
|
|
21112
|
-
const responsiveStyles = {};
|
|
21113
|
-
if (padding !== void 0) {
|
|
21114
|
-
const { base, responsive } = resolveResponsiveValue(padding);
|
|
21115
|
-
if (base !== void 0) {
|
|
21116
|
-
responsiveStyles.base = { paddingInline: `var(--kui-spacing-${base})` };
|
|
21117
|
-
}
|
|
21118
|
-
for (const [bp, value] of Object.entries(responsive)) {
|
|
21119
|
-
responsiveStyles[bp] = { paddingInline: `var(--kui-spacing-${value})` };
|
|
21120
|
-
}
|
|
21219
|
+
const recipeClassName = unstyled ? "" : resolveRecipe(theme.recipes.Container, { maxWidth });
|
|
21220
|
+
const responsiveStyles = {};
|
|
21221
|
+
if (padding !== void 0) {
|
|
21222
|
+
const { base, responsive } = resolveResponsiveValue(padding);
|
|
21223
|
+
if (base !== void 0) {
|
|
21224
|
+
responsiveStyles.base = { paddingInline: `var(--kui-spacing-${base})` };
|
|
21225
|
+
}
|
|
21226
|
+
for (const [bp, value] of Object.entries(responsive)) {
|
|
21227
|
+
responsiveStyles[bp] = { paddingInline: `var(--kui-spacing-${value})` };
|
|
21228
|
+
}
|
|
21229
|
+
}
|
|
21230
|
+
const { attribute, style: responsiveCss } = (0, hooks_exports.useResponsiveStyles)(responsiveStyles);
|
|
21231
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
21232
|
+
/* @__PURE__ */ jsx(ResponsiveStyle, { css: responsiveCss }),
|
|
21233
|
+
/* @__PURE__ */ jsx(
|
|
21234
|
+
Tag,
|
|
21235
|
+
{
|
|
21236
|
+
ref,
|
|
21237
|
+
"data-kui-responsive": attribute,
|
|
21238
|
+
className: cn(recipeClassName, centered && "mx-auto", className),
|
|
21239
|
+
style,
|
|
21240
|
+
...rest,
|
|
21241
|
+
children
|
|
21242
|
+
}
|
|
21243
|
+
)
|
|
21244
|
+
] });
|
|
21245
|
+
}
|
|
21246
|
+
);
|
|
21247
|
+
Container.displayName = "Container";
|
|
21248
|
+
var Flex = createComponent({
|
|
21249
|
+
displayName: "Flex",
|
|
21250
|
+
__kui: {
|
|
21251
|
+
role: "layout",
|
|
21252
|
+
skeleton: "preserve",
|
|
21253
|
+
video: {
|
|
21254
|
+
id: "flex",
|
|
21255
|
+
safe: true,
|
|
21256
|
+
acceptsChildren: true,
|
|
21257
|
+
interactionStates: []
|
|
21258
|
+
}
|
|
21259
|
+
},
|
|
21260
|
+
render: /* @__PURE__ */ __name(({
|
|
21261
|
+
inline = false,
|
|
21262
|
+
direction = "row",
|
|
21263
|
+
wrap = "nowrap",
|
|
21264
|
+
align,
|
|
21265
|
+
justify,
|
|
21266
|
+
gap,
|
|
21267
|
+
gapX,
|
|
21268
|
+
gapY,
|
|
21269
|
+
grow,
|
|
21270
|
+
shrink,
|
|
21271
|
+
basis,
|
|
21272
|
+
fullWidth,
|
|
21273
|
+
fullHeight,
|
|
21274
|
+
as: Tag = "div",
|
|
21275
|
+
className,
|
|
21276
|
+
style,
|
|
21277
|
+
unstyled,
|
|
21278
|
+
children,
|
|
21279
|
+
...rest
|
|
21280
|
+
}, ref) => {
|
|
21281
|
+
const { theme } = useTheme();
|
|
21282
|
+
const responsiveStyles = (0, hooks_exports.useMergedResponsiveStyles)([
|
|
21283
|
+
[direction, (v) => ({ flexDirection: v })],
|
|
21284
|
+
[wrap, (v) => ({ flexWrap: v })],
|
|
21285
|
+
[align, (v) => ({ alignItems: v })],
|
|
21286
|
+
[justify, (v) => ({ justifyContent: v })],
|
|
21287
|
+
[gap, (v) => ({ gap: resolveSpace(v) })],
|
|
21288
|
+
[gapX, (v) => ({ columnGap: resolveSpace(v) })],
|
|
21289
|
+
[gapY, (v) => ({ rowGap: resolveSpace(v) })],
|
|
21290
|
+
[grow, (v) => ({ flexGrow: v === true ? 1 : v === false ? 0 : v })],
|
|
21291
|
+
[shrink, (v) => ({ flexShrink: v === true ? 1 : v === false ? 0 : v })],
|
|
21292
|
+
[basis, (v) => ({ flexBasis: v })]
|
|
21293
|
+
]);
|
|
21294
|
+
const { attribute, style: responsiveCss } = (0, hooks_exports.useResponsiveStyles)(responsiveStyles);
|
|
21295
|
+
const recipeClasses = resolveRecipe(theme.recipes.Flex, {
|
|
21296
|
+
inline,
|
|
21297
|
+
fullWidth: Boolean(fullWidth),
|
|
21298
|
+
fullHeight: Boolean(fullHeight)
|
|
21299
|
+
});
|
|
21300
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
21301
|
+
/* @__PURE__ */ jsx(ResponsiveStyle, { css: responsiveCss }),
|
|
21302
|
+
/* @__PURE__ */ jsx(
|
|
21303
|
+
Tag,
|
|
21304
|
+
{
|
|
21305
|
+
ref,
|
|
21306
|
+
"data-kui-responsive": attribute,
|
|
21307
|
+
className: cn(!unstyled && recipeClasses, className),
|
|
21308
|
+
style,
|
|
21309
|
+
...rest,
|
|
21310
|
+
children
|
|
21311
|
+
}
|
|
21312
|
+
)
|
|
21313
|
+
] });
|
|
21314
|
+
}, "render")
|
|
21315
|
+
});
|
|
21316
|
+
var Stack = forwardRef(
|
|
21317
|
+
({ orientation = "vertical", divider, children, ...rest }, ref) => {
|
|
21318
|
+
const direction = orientation === "horizontal" ? "row" : "column";
|
|
21319
|
+
if (!divider) {
|
|
21320
|
+
return /* @__PURE__ */ jsx(Flex, { ref, direction, ...rest, children });
|
|
21321
|
+
}
|
|
21322
|
+
const items = Children.toArray(children).filter(isValidElement);
|
|
21323
|
+
return /* @__PURE__ */ jsx(Flex, { ref, direction, ...rest, children: items.map((child, index) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
21324
|
+
child,
|
|
21325
|
+
index < items.length - 1 && divider
|
|
21326
|
+
] }, child.key ?? index)) });
|
|
21327
|
+
}
|
|
21328
|
+
);
|
|
21329
|
+
Stack.displayName = "Stack";
|
|
21330
|
+
function spanValue(value) {
|
|
21331
|
+
return value === "full" ? "1 / -1" : `span ${value}`;
|
|
21332
|
+
}
|
|
21333
|
+
__name(spanValue, "spanValue");
|
|
21334
|
+
var GridItem = createComponent({
|
|
21335
|
+
displayName: "Grid.Item",
|
|
21336
|
+
__kui: {
|
|
21337
|
+
role: "layout",
|
|
21338
|
+
skeleton: "preserve",
|
|
21339
|
+
groupSlot: "Grid",
|
|
21340
|
+
video: {
|
|
21341
|
+
id: "grid-item",
|
|
21342
|
+
safe: true,
|
|
21343
|
+
acceptsChildren: true,
|
|
21344
|
+
interactionStates: []
|
|
21345
|
+
}
|
|
21346
|
+
},
|
|
21347
|
+
render: /* @__PURE__ */ __name(({
|
|
21348
|
+
span,
|
|
21349
|
+
rowSpan,
|
|
21350
|
+
as: Tag = "div",
|
|
21351
|
+
className,
|
|
21352
|
+
style,
|
|
21353
|
+
unstyled,
|
|
21354
|
+
children,
|
|
21355
|
+
...rest
|
|
21356
|
+
}, ref) => {
|
|
21357
|
+
const responsiveStyles = (0, hooks_exports.useMergedResponsiveStyles)([
|
|
21358
|
+
[span, (v) => ({ gridColumn: spanValue(v) })],
|
|
21359
|
+
[rowSpan, (v) => ({ gridRow: spanValue(v) })]
|
|
21360
|
+
]);
|
|
21361
|
+
const { attribute, style: responsiveCss } = (0, hooks_exports.useResponsiveStyles)(responsiveStyles);
|
|
21362
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
21363
|
+
/* @__PURE__ */ jsx(ResponsiveStyle, { css: responsiveCss }),
|
|
21364
|
+
/* @__PURE__ */ jsx(
|
|
21365
|
+
Tag,
|
|
21366
|
+
{
|
|
21367
|
+
ref,
|
|
21368
|
+
"data-kui-responsive": attribute,
|
|
21369
|
+
className: cn(!unstyled && className),
|
|
21370
|
+
style,
|
|
21371
|
+
...rest,
|
|
21372
|
+
children
|
|
21373
|
+
}
|
|
21374
|
+
)
|
|
21375
|
+
] });
|
|
21376
|
+
}, "render")
|
|
21377
|
+
});
|
|
21378
|
+
var RAW_LENGTH2 = /px|rem|em|%|vw|vh|ch|var\(/i;
|
|
21379
|
+
function resolveTrackSize(value) {
|
|
21380
|
+
if (typeof value === "number") return `${value}px`;
|
|
21381
|
+
if (RAW_LENGTH2.test(value)) return value;
|
|
21382
|
+
return resolveSpace(value);
|
|
21383
|
+
}
|
|
21384
|
+
__name(resolveTrackSize, "resolveTrackSize");
|
|
21385
|
+
var GridRoot = createComponent({
|
|
21386
|
+
displayName: "Grid",
|
|
21387
|
+
__kui: {
|
|
21388
|
+
role: "layout",
|
|
21389
|
+
skeleton: "preserve",
|
|
21390
|
+
video: {
|
|
21391
|
+
id: "grid",
|
|
21392
|
+
safe: true,
|
|
21393
|
+
acceptsChildren: true,
|
|
21394
|
+
interactionStates: []
|
|
21395
|
+
}
|
|
21396
|
+
},
|
|
21397
|
+
render: /* @__PURE__ */ __name(({
|
|
21398
|
+
columns,
|
|
21399
|
+
minChildWidth,
|
|
21400
|
+
templateColumns,
|
|
21401
|
+
templateRows,
|
|
21402
|
+
templateAreas,
|
|
21403
|
+
autoFlow,
|
|
21404
|
+
gap,
|
|
21405
|
+
gapX,
|
|
21406
|
+
gapY,
|
|
21407
|
+
align,
|
|
21408
|
+
justifyItems,
|
|
21409
|
+
inline = false,
|
|
21410
|
+
as: Tag = "div",
|
|
21411
|
+
className,
|
|
21412
|
+
style,
|
|
21413
|
+
unstyled,
|
|
21414
|
+
children,
|
|
21415
|
+
...rest
|
|
21416
|
+
}, ref) => {
|
|
21417
|
+
const { theme } = useTheme();
|
|
21418
|
+
if (isDev() && [columns, minChildWidth, templateColumns].filter((v) => v != null).length > 1) {
|
|
21419
|
+
console.warn(
|
|
21420
|
+
"[kreativ-ui/Grid]: columns, minChildWidth, and templateColumns are mutually exclusive. templateColumns wins, then columns, then minChildWidth."
|
|
21421
|
+
);
|
|
21121
21422
|
}
|
|
21423
|
+
const responsiveStyles = (0, hooks_exports.useMergedResponsiveStyles)([
|
|
21424
|
+
[
|
|
21425
|
+
columns,
|
|
21426
|
+
(v) => ({ gridTemplateColumns: `repeat(${v}, minmax(0, 1fr))` })
|
|
21427
|
+
],
|
|
21428
|
+
[
|
|
21429
|
+
minChildWidth,
|
|
21430
|
+
(v) => ({
|
|
21431
|
+
gridTemplateColumns: `repeat(auto-fit, minmax(${resolveTrackSize(v)}, 1fr))`
|
|
21432
|
+
})
|
|
21433
|
+
],
|
|
21434
|
+
[templateColumns, (v) => ({ gridTemplateColumns: v })],
|
|
21435
|
+
[templateRows, (v) => ({ gridTemplateRows: v })],
|
|
21436
|
+
[autoFlow, (v) => ({ gridAutoFlow: v })],
|
|
21437
|
+
[gap, (v) => ({ gap: resolveSpace(v) })],
|
|
21438
|
+
[gapX, (v) => ({ columnGap: resolveSpace(v) })],
|
|
21439
|
+
[gapY, (v) => ({ rowGap: resolveSpace(v) })],
|
|
21440
|
+
[align, (v) => ({ alignItems: v })],
|
|
21441
|
+
[justifyItems, (v) => ({ justifyItems: v })]
|
|
21442
|
+
]);
|
|
21122
21443
|
const { attribute, style: responsiveCss } = (0, hooks_exports.useResponsiveStyles)(responsiveStyles);
|
|
21444
|
+
const recipeClasses = resolveRecipe(theme.recipes.Grid, { inline });
|
|
21123
21445
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
21124
21446
|
/* @__PURE__ */ jsx(ResponsiveStyle, { css: responsiveCss }),
|
|
21125
21447
|
/* @__PURE__ */ jsx(
|
|
@@ -21127,108 +21449,1098 @@ var Container = forwardRef(
|
|
|
21127
21449
|
{
|
|
21128
21450
|
ref,
|
|
21129
21451
|
"data-kui-responsive": attribute,
|
|
21130
|
-
className: cn(
|
|
21131
|
-
style,
|
|
21452
|
+
className: cn(!unstyled && recipeClasses, className),
|
|
21453
|
+
style: { ...style, gridTemplateAreas: templateAreas },
|
|
21132
21454
|
...rest,
|
|
21133
21455
|
children
|
|
21134
21456
|
}
|
|
21135
21457
|
)
|
|
21136
21458
|
] });
|
|
21459
|
+
}, "render")
|
|
21460
|
+
});
|
|
21461
|
+
var Grid = Object.assign(GridRoot, { Item: GridItem });
|
|
21462
|
+
function withAlpha(color, alpha) {
|
|
21463
|
+
return `color-mix(in srgb, ${color} ${Math.round(alpha * 100)}%, transparent)`;
|
|
21464
|
+
}
|
|
21465
|
+
__name(withAlpha, "withAlpha");
|
|
21466
|
+
function resolveOverlayBackground(color, opacity, gradient) {
|
|
21467
|
+
if (!color && opacity === void 0) return void 0;
|
|
21468
|
+
const resolvedColor = color ?? "currentColor";
|
|
21469
|
+
if (!gradient) {
|
|
21470
|
+
return resolvedColor;
|
|
21471
|
+
}
|
|
21472
|
+
const startOpacity = opacity ?? 1;
|
|
21473
|
+
const startColor = startOpacity === 1 ? resolvedColor : withAlpha(resolvedColor, startOpacity);
|
|
21474
|
+
if (typeof gradient === "object") {
|
|
21475
|
+
const position = gradient.position ?? "center";
|
|
21476
|
+
return `radial-gradient(circle at ${position}, ${startColor} 0%, transparent 100%)`;
|
|
21477
|
+
}
|
|
21478
|
+
const directionMap = {
|
|
21479
|
+
top: "to top",
|
|
21480
|
+
bottom: "to bottom",
|
|
21481
|
+
left: "to left",
|
|
21482
|
+
right: "to right"
|
|
21483
|
+
};
|
|
21484
|
+
return `linear-gradient(${directionMap[gradient]}, ${startColor} 0%, transparent 100%)`;
|
|
21485
|
+
}
|
|
21486
|
+
__name(resolveOverlayBackground, "resolveOverlayBackground");
|
|
21487
|
+
var CardOverlay = createComponent({
|
|
21488
|
+
__kui: {
|
|
21489
|
+
groupSlot: "Card"
|
|
21490
|
+
},
|
|
21491
|
+
displayName: "Card.Overlay",
|
|
21492
|
+
render: /* @__PURE__ */ __name(({ color, opacity, blur, gradient, className, style, children, ...props }, ref) => {
|
|
21493
|
+
const background = resolveOverlayBackground(color, opacity, gradient);
|
|
21494
|
+
const { theme } = useTheme();
|
|
21495
|
+
return /* @__PURE__ */ jsx(
|
|
21496
|
+
"div",
|
|
21497
|
+
{
|
|
21498
|
+
ref,
|
|
21499
|
+
className: cn(resolveRecipe(theme.recipes.CardOverlay), className),
|
|
21500
|
+
style: {
|
|
21501
|
+
...background !== void 0 ? gradient ? { backgroundImage: background } : { backgroundColor: background } : null,
|
|
21502
|
+
...!gradient && opacity !== void 0 ? { opacity } : null,
|
|
21503
|
+
...blur !== void 0 ? {
|
|
21504
|
+
backdropFilter: `blur(${typeof blur === "number" ? `${blur}px` : blur})`
|
|
21505
|
+
} : null,
|
|
21506
|
+
...style
|
|
21507
|
+
},
|
|
21508
|
+
...props,
|
|
21509
|
+
children
|
|
21510
|
+
}
|
|
21511
|
+
);
|
|
21512
|
+
}, "render")
|
|
21513
|
+
});
|
|
21514
|
+
var CardMedia = createComponent({
|
|
21515
|
+
__kui: {
|
|
21516
|
+
groupSlot: "Card"
|
|
21517
|
+
},
|
|
21518
|
+
displayName: "Card.Media",
|
|
21519
|
+
render: /* @__PURE__ */ __name(({
|
|
21520
|
+
src,
|
|
21521
|
+
alt,
|
|
21522
|
+
fit = "cover",
|
|
21523
|
+
blend = "normal",
|
|
21524
|
+
aspectRatio,
|
|
21525
|
+
className,
|
|
21526
|
+
style,
|
|
21527
|
+
children,
|
|
21528
|
+
...props
|
|
21529
|
+
}, ref) => {
|
|
21530
|
+
const { theme } = useTheme();
|
|
21531
|
+
return /* @__PURE__ */ jsxs(
|
|
21532
|
+
"div",
|
|
21533
|
+
{
|
|
21534
|
+
ref,
|
|
21535
|
+
className: cn(resolveRecipe(theme.recipes.CardMedia), className),
|
|
21536
|
+
style: {
|
|
21537
|
+
...aspectRatio !== void 0 ? { aspectRatio } : null,
|
|
21538
|
+
...style
|
|
21539
|
+
},
|
|
21540
|
+
...props,
|
|
21541
|
+
children: [
|
|
21542
|
+
/* @__PURE__ */ jsx(
|
|
21543
|
+
"img",
|
|
21544
|
+
{
|
|
21545
|
+
src,
|
|
21546
|
+
alt,
|
|
21547
|
+
className: resolveRecipe(theme.recipes.CardMediaImage, { fit, blend })
|
|
21548
|
+
}
|
|
21549
|
+
),
|
|
21550
|
+
children
|
|
21551
|
+
]
|
|
21552
|
+
}
|
|
21553
|
+
);
|
|
21554
|
+
}, "render")
|
|
21555
|
+
});
|
|
21556
|
+
var CardRoot = createComponent({
|
|
21557
|
+
__kui: {
|
|
21558
|
+
role: "display",
|
|
21559
|
+
skeleton: "preserve"
|
|
21560
|
+
},
|
|
21561
|
+
displayName: "Card",
|
|
21562
|
+
render: /* @__PURE__ */ __name(({
|
|
21563
|
+
variant = "outline",
|
|
21564
|
+
size = "md",
|
|
21565
|
+
fullWidth = false,
|
|
21566
|
+
className,
|
|
21567
|
+
style,
|
|
21568
|
+
children,
|
|
21569
|
+
...props
|
|
21570
|
+
}, ref) => {
|
|
21571
|
+
useValidateChildren("Card", children);
|
|
21572
|
+
const { theme } = useTheme();
|
|
21573
|
+
return /* @__PURE__ */ jsx(
|
|
21574
|
+
"div",
|
|
21575
|
+
{
|
|
21576
|
+
ref,
|
|
21577
|
+
className: cn(
|
|
21578
|
+
resolveRecipe(theme.recipes.Card, { variant, size, fullWidth }),
|
|
21579
|
+
className
|
|
21580
|
+
),
|
|
21581
|
+
...props,
|
|
21582
|
+
children
|
|
21583
|
+
}
|
|
21584
|
+
);
|
|
21585
|
+
}, "render")
|
|
21586
|
+
});
|
|
21587
|
+
var CardHeader = createComponent({
|
|
21588
|
+
__kui: {
|
|
21589
|
+
groupSlot: "Card"
|
|
21590
|
+
},
|
|
21591
|
+
displayName: "Card.Header",
|
|
21592
|
+
render: /* @__PURE__ */ __name(({ className, children, noPadding = false, size = "md", ...props }, ref) => {
|
|
21593
|
+
const { theme } = useTheme();
|
|
21594
|
+
return /* @__PURE__ */ jsx(
|
|
21595
|
+
"div",
|
|
21596
|
+
{
|
|
21597
|
+
ref,
|
|
21598
|
+
className: cn(
|
|
21599
|
+
resolveRecipe(theme.recipes.CardHeader, { size, noPadding }),
|
|
21600
|
+
className
|
|
21601
|
+
),
|
|
21602
|
+
...props,
|
|
21603
|
+
children
|
|
21604
|
+
}
|
|
21605
|
+
);
|
|
21606
|
+
}, "render")
|
|
21607
|
+
});
|
|
21608
|
+
var CardBody = createComponent({
|
|
21609
|
+
__kui: {
|
|
21610
|
+
groupSlot: "Card"
|
|
21611
|
+
},
|
|
21612
|
+
displayName: "Card.Body",
|
|
21613
|
+
render: /* @__PURE__ */ __name(({ size = "md", noPadding = false, className, children, ...props }, ref) => {
|
|
21614
|
+
const { theme } = useTheme();
|
|
21615
|
+
return /* @__PURE__ */ jsx(
|
|
21616
|
+
"div",
|
|
21617
|
+
{
|
|
21618
|
+
ref,
|
|
21619
|
+
className: cn(
|
|
21620
|
+
resolveRecipe(theme.recipes.CardBody, { size, noPadding }),
|
|
21621
|
+
className
|
|
21622
|
+
),
|
|
21623
|
+
...props,
|
|
21624
|
+
children
|
|
21625
|
+
}
|
|
21626
|
+
);
|
|
21627
|
+
}, "render")
|
|
21628
|
+
});
|
|
21629
|
+
var CardFooter = createComponent({
|
|
21630
|
+
__kui: {
|
|
21631
|
+
groupSlot: "Card"
|
|
21632
|
+
},
|
|
21633
|
+
displayName: "Card.Footer",
|
|
21634
|
+
render: /* @__PURE__ */ __name(({ size = "md", noPadding = false, className, children, ...props }, ref) => {
|
|
21635
|
+
const { theme } = useTheme();
|
|
21636
|
+
return /* @__PURE__ */ jsx(
|
|
21637
|
+
"div",
|
|
21638
|
+
{
|
|
21639
|
+
ref,
|
|
21640
|
+
className: cn(
|
|
21641
|
+
resolveRecipe(theme.recipes.CardFooter, { size, noPadding }),
|
|
21642
|
+
className
|
|
21643
|
+
),
|
|
21644
|
+
...props,
|
|
21645
|
+
children
|
|
21646
|
+
}
|
|
21647
|
+
);
|
|
21648
|
+
}, "render")
|
|
21649
|
+
});
|
|
21650
|
+
var Card = Object.assign(CardRoot, {
|
|
21651
|
+
Header: CardHeader,
|
|
21652
|
+
Body: CardBody,
|
|
21653
|
+
Footer: CardFooter,
|
|
21654
|
+
Media: CardMedia,
|
|
21655
|
+
Overlay: CardOverlay
|
|
21656
|
+
});
|
|
21657
|
+
var initialState = {
|
|
21658
|
+
hasVerticalOverflow: false,
|
|
21659
|
+
hasHorizontalOverflow: false,
|
|
21660
|
+
atTop: true,
|
|
21661
|
+
atBottom: false,
|
|
21662
|
+
atLeft: true,
|
|
21663
|
+
atRight: false
|
|
21664
|
+
};
|
|
21665
|
+
function statesEqual(a, b) {
|
|
21666
|
+
return a.hasVerticalOverflow === b.hasVerticalOverflow && a.hasHorizontalOverflow === b.hasHorizontalOverflow && a.atTop === b.atTop && a.atBottom === b.atBottom && a.atLeft === b.atLeft && a.atRight === b.atRight;
|
|
21667
|
+
}
|
|
21668
|
+
__name(statesEqual, "statesEqual");
|
|
21669
|
+
function useScrollPosition({ direction, threshold, onScrollEnd, onMeasure }) {
|
|
21670
|
+
const elRef = useRef(null);
|
|
21671
|
+
const [state, setState] = useState(initialState);
|
|
21672
|
+
const stateRef = useRef(state);
|
|
21673
|
+
const onMeasureRef = useRef(onMeasure);
|
|
21674
|
+
onMeasureRef.current = onMeasure;
|
|
21675
|
+
const inZone = useRef({
|
|
21676
|
+
top: false,
|
|
21677
|
+
bottom: false,
|
|
21678
|
+
left: false,
|
|
21679
|
+
right: false
|
|
21680
|
+
});
|
|
21681
|
+
const fireIfEntering = useCallback(
|
|
21682
|
+
(edge, isAtEdge) => {
|
|
21683
|
+
if (isAtEdge && !inZone.current[edge]) {
|
|
21684
|
+
inZone.current[edge] = true;
|
|
21685
|
+
onScrollEnd?.(edge);
|
|
21686
|
+
} else if (!isAtEdge && inZone.current[edge]) {
|
|
21687
|
+
inZone.current[edge] = false;
|
|
21688
|
+
}
|
|
21689
|
+
},
|
|
21690
|
+
[onScrollEnd]
|
|
21691
|
+
);
|
|
21692
|
+
const measure = useCallback(() => {
|
|
21693
|
+
const el = elRef.current;
|
|
21694
|
+
if (!el) return;
|
|
21695
|
+
const hasVerticalOverflow = el.scrollHeight > el.clientHeight;
|
|
21696
|
+
const hasHorizontalOverflow = el.scrollWidth > el.clientWidth;
|
|
21697
|
+
const wantsVertical = direction === "vertical" || direction === "both";
|
|
21698
|
+
const wantsHorizontal = direction === "horizontal" || direction === "both";
|
|
21699
|
+
let atTop = true, atBottom = false, atLeft = true, atRight = false;
|
|
21700
|
+
if (wantsVertical && hasVerticalOverflow) {
|
|
21701
|
+
const distTop = el.scrollTop;
|
|
21702
|
+
const distBottom = el.scrollHeight - el.clientHeight - el.scrollTop;
|
|
21703
|
+
atTop = distTop <= threshold;
|
|
21704
|
+
atBottom = distBottom <= threshold;
|
|
21705
|
+
fireIfEntering("top", atTop);
|
|
21706
|
+
fireIfEntering("bottom", atBottom);
|
|
21707
|
+
}
|
|
21708
|
+
if (wantsHorizontal && hasHorizontalOverflow) {
|
|
21709
|
+
const distLeft = el.scrollLeft;
|
|
21710
|
+
const distRight = el.scrollWidth - el.clientWidth - el.scrollLeft;
|
|
21711
|
+
atLeft = distLeft <= threshold;
|
|
21712
|
+
atRight = distRight <= threshold;
|
|
21713
|
+
fireIfEntering("left", atLeft);
|
|
21714
|
+
fireIfEntering("right", atRight);
|
|
21715
|
+
}
|
|
21716
|
+
const next = {
|
|
21717
|
+
hasVerticalOverflow,
|
|
21718
|
+
hasHorizontalOverflow,
|
|
21719
|
+
atTop: wantsVertical ? atTop : true,
|
|
21720
|
+
atBottom: wantsVertical ? atBottom : false,
|
|
21721
|
+
atLeft: wantsHorizontal ? atLeft : true,
|
|
21722
|
+
atRight: wantsHorizontal ? atRight : false
|
|
21723
|
+
};
|
|
21724
|
+
if (!statesEqual(stateRef.current, next)) {
|
|
21725
|
+
stateRef.current = next;
|
|
21726
|
+
setState(next);
|
|
21727
|
+
}
|
|
21728
|
+
onMeasureRef.current?.();
|
|
21729
|
+
}, [direction, threshold, fireIfEntering]);
|
|
21730
|
+
const handleScroll = useCallback(() => measure(), [measure]);
|
|
21731
|
+
useEffect(() => {
|
|
21732
|
+
const el = elRef.current;
|
|
21733
|
+
if (!el) return;
|
|
21734
|
+
measure();
|
|
21735
|
+
const resizeObserver = new ResizeObserver(() => measure());
|
|
21736
|
+
resizeObserver.observe(el);
|
|
21737
|
+
const mutationObserver = new MutationObserver(() => measure());
|
|
21738
|
+
mutationObserver.observe(el, { childList: true, subtree: true, characterData: true });
|
|
21739
|
+
return () => {
|
|
21740
|
+
resizeObserver.disconnect();
|
|
21741
|
+
mutationObserver.disconnect();
|
|
21742
|
+
};
|
|
21743
|
+
}, [measure]);
|
|
21744
|
+
return { elRef, state, handleScroll, measure };
|
|
21745
|
+
}
|
|
21746
|
+
__name(useScrollPosition, "useScrollPosition");
|
|
21747
|
+
var THRESHOLD = 5;
|
|
21748
|
+
var IGNORE = "input, textarea, select, [contenteditable=''], [contenteditable='true'], [data-no-drag]";
|
|
21749
|
+
function useDragScroll(elRef, { enabled, direction, onRelease }) {
|
|
21750
|
+
const releaseRef = useRef(onRelease);
|
|
21751
|
+
releaseRef.current = onRelease;
|
|
21752
|
+
useEffect(() => {
|
|
21753
|
+
const el = elRef.current;
|
|
21754
|
+
if (!el || !enabled) return;
|
|
21755
|
+
const allowX = direction !== "vertical";
|
|
21756
|
+
const allowY = direction !== "horizontal";
|
|
21757
|
+
let pointerId = null;
|
|
21758
|
+
let startX = 0, startY = 0, startLeft = 0, startTop = 0;
|
|
21759
|
+
let dragging = false;
|
|
21760
|
+
let suppressClick = false;
|
|
21761
|
+
const onDown = /* @__PURE__ */ __name((e) => {
|
|
21762
|
+
if (e.pointerType === "touch" || e.button !== 0) return;
|
|
21763
|
+
if (e.target.closest(IGNORE)) return;
|
|
21764
|
+
pointerId = e.pointerId;
|
|
21765
|
+
startX = e.clientX;
|
|
21766
|
+
startY = e.clientY;
|
|
21767
|
+
startLeft = el.scrollLeft;
|
|
21768
|
+
startTop = el.scrollTop;
|
|
21769
|
+
dragging = false;
|
|
21770
|
+
}, "onDown");
|
|
21771
|
+
const onMove = /* @__PURE__ */ __name((e) => {
|
|
21772
|
+
if (e.pointerId !== pointerId) return;
|
|
21773
|
+
const dx = e.clientX - startX;
|
|
21774
|
+
const dy = e.clientY - startY;
|
|
21775
|
+
if (!dragging) {
|
|
21776
|
+
if (Math.hypot(dx, dy) < THRESHOLD) return;
|
|
21777
|
+
dragging = true;
|
|
21778
|
+
try {
|
|
21779
|
+
el.setPointerCapture(e.pointerId);
|
|
21780
|
+
} catch {
|
|
21781
|
+
}
|
|
21782
|
+
el.setAttribute("data-dragging", "");
|
|
21783
|
+
window.getSelection()?.removeAllRanges();
|
|
21784
|
+
}
|
|
21785
|
+
if (allowX) el.scrollLeft = startLeft - dx;
|
|
21786
|
+
if (allowY) el.scrollTop = startTop - dy;
|
|
21787
|
+
}, "onMove");
|
|
21788
|
+
const onEnd = /* @__PURE__ */ __name((e) => {
|
|
21789
|
+
if (e.pointerId !== pointerId) return;
|
|
21790
|
+
pointerId = null;
|
|
21791
|
+
if (!dragging) return;
|
|
21792
|
+
dragging = false;
|
|
21793
|
+
suppressClick = true;
|
|
21794
|
+
setTimeout(() => {
|
|
21795
|
+
suppressClick = false;
|
|
21796
|
+
}, 0);
|
|
21797
|
+
el.removeAttribute("data-dragging");
|
|
21798
|
+
releaseRef.current?.(el);
|
|
21799
|
+
}, "onEnd");
|
|
21800
|
+
const onClickCapture = /* @__PURE__ */ __name((e) => {
|
|
21801
|
+
if (!suppressClick) return;
|
|
21802
|
+
e.preventDefault();
|
|
21803
|
+
e.stopPropagation();
|
|
21804
|
+
}, "onClickCapture");
|
|
21805
|
+
const onDragStart = /* @__PURE__ */ __name((e) => {
|
|
21806
|
+
if (!e.target.closest?.('[draggable="true"]')) e.preventDefault();
|
|
21807
|
+
}, "onDragStart");
|
|
21808
|
+
el.addEventListener("pointerdown", onDown);
|
|
21809
|
+
el.addEventListener("pointermove", onMove);
|
|
21810
|
+
el.addEventListener("pointerup", onEnd);
|
|
21811
|
+
el.addEventListener("pointercancel", onEnd);
|
|
21812
|
+
el.addEventListener("click", onClickCapture, true);
|
|
21813
|
+
el.addEventListener("dragstart", onDragStart);
|
|
21814
|
+
return () => {
|
|
21815
|
+
el.removeEventListener("pointerdown", onDown);
|
|
21816
|
+
el.removeEventListener("pointermove", onMove);
|
|
21817
|
+
el.removeEventListener("pointerup", onEnd);
|
|
21818
|
+
el.removeEventListener("pointercancel", onEnd);
|
|
21819
|
+
el.removeEventListener("click", onClickCapture, true);
|
|
21820
|
+
el.removeEventListener("dragstart", onDragStart);
|
|
21821
|
+
el.removeAttribute("data-dragging");
|
|
21822
|
+
};
|
|
21823
|
+
}, [elRef, enabled, direction]);
|
|
21824
|
+
}
|
|
21825
|
+
__name(useDragScroll, "useDragScroll");
|
|
21826
|
+
|
|
21827
|
+
// src/components/layout/ScrollArea/scrollProgress.ts
|
|
21828
|
+
var clamp01 = /* @__PURE__ */ __name((n) => Math.min(1, Math.max(0, n)), "clamp01");
|
|
21829
|
+
function containerProgress(el) {
|
|
21830
|
+
const maxY = el.scrollHeight - el.clientHeight;
|
|
21831
|
+
const maxX = el.scrollWidth - el.clientWidth;
|
|
21832
|
+
return {
|
|
21833
|
+
x: maxX > 0 ? clamp01(el.scrollLeft / maxX) : 0,
|
|
21834
|
+
y: maxY > 0 ? clamp01(el.scrollTop / maxY) : 0
|
|
21835
|
+
};
|
|
21836
|
+
}
|
|
21837
|
+
__name(containerProgress, "containerProgress");
|
|
21838
|
+
function sceneProgress(scene, container, axis, range) {
|
|
21839
|
+
const c = container.getBoundingClientRect();
|
|
21840
|
+
const s = scene.getBoundingClientRect();
|
|
21841
|
+
const vertical = axis === "y";
|
|
21842
|
+
const view = vertical ? container.clientHeight : container.clientWidth;
|
|
21843
|
+
const size = vertical ? s.height : s.width;
|
|
21844
|
+
const offset = vertical ? s.top - c.top - container.clientTop : s.left - c.left - container.clientLeft;
|
|
21845
|
+
if (range === "through") {
|
|
21846
|
+
const total = view + size;
|
|
21847
|
+
return total > 0 ? clamp01((view - offset) / total) : 0;
|
|
21848
|
+
}
|
|
21849
|
+
const travel = size - view;
|
|
21850
|
+
return travel > 0 ? clamp01(-offset / travel) : 0;
|
|
21851
|
+
}
|
|
21852
|
+
__name(sceneProgress, "sceneProgress");
|
|
21853
|
+
function createStore(initial, equals = Object.is) {
|
|
21854
|
+
let value = initial;
|
|
21855
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
21856
|
+
return {
|
|
21857
|
+
get: /* @__PURE__ */ __name(() => value, "get"),
|
|
21858
|
+
set(next) {
|
|
21859
|
+
if (equals(value, next)) return false;
|
|
21860
|
+
value = next;
|
|
21861
|
+
listeners.forEach((l) => l(next));
|
|
21862
|
+
return true;
|
|
21863
|
+
},
|
|
21864
|
+
subscribe(fn) {
|
|
21865
|
+
listeners.add(fn);
|
|
21866
|
+
return () => {
|
|
21867
|
+
listeners.delete(fn);
|
|
21868
|
+
};
|
|
21869
|
+
},
|
|
21870
|
+
get size() {
|
|
21871
|
+
return listeners.size;
|
|
21872
|
+
}
|
|
21873
|
+
};
|
|
21874
|
+
}
|
|
21875
|
+
__name(createStore, "createStore");
|
|
21876
|
+
|
|
21877
|
+
// src/components/layout/ScrollArea/ScrollEngine.ts
|
|
21878
|
+
var EPS = 1;
|
|
21879
|
+
var round = /* @__PURE__ */ __name((n) => Math.round(n * 1e4) / 1e4, "round");
|
|
21880
|
+
var progressEqual = /* @__PURE__ */ __name((a, b) => a.x === b.x && a.y === b.y, "progressEqual");
|
|
21881
|
+
var STICKY_EDGES = ["top", "bottom", "left", "right"];
|
|
21882
|
+
var _StickyHandle = class _StickyHandle {
|
|
21883
|
+
constructor() {
|
|
21884
|
+
__publicField(this, "el", null);
|
|
21885
|
+
__publicField(this, "edges", []);
|
|
21886
|
+
__publicField(this, "offsets", {});
|
|
21887
|
+
__publicField(this, "stuck", "");
|
|
21888
|
+
__publicField(this, "dirty", true);
|
|
21889
|
+
__publicField(this, "onStuckChange");
|
|
21890
|
+
}
|
|
21891
|
+
resolve() {
|
|
21892
|
+
if (!this.el) return;
|
|
21893
|
+
const cs = getComputedStyle(this.el);
|
|
21894
|
+
this.offsets = {};
|
|
21895
|
+
for (const edge of this.edges) {
|
|
21896
|
+
const px = parseFloat(cs[edge]);
|
|
21897
|
+
if (!Number.isNaN(px)) this.offsets[edge] = px;
|
|
21898
|
+
}
|
|
21899
|
+
this.dirty = false;
|
|
21900
|
+
}
|
|
21901
|
+
};
|
|
21902
|
+
__name(_StickyHandle, "StickyHandle");
|
|
21903
|
+
var StickyHandle = _StickyHandle;
|
|
21904
|
+
var _SceneHandle = class _SceneHandle {
|
|
21905
|
+
constructor(engine) {
|
|
21906
|
+
__publicField(this, "engine", engine);
|
|
21907
|
+
__publicField(this, "el", null);
|
|
21908
|
+
__publicField(this, "axis", "y");
|
|
21909
|
+
__publicField(this, "range", "through");
|
|
21910
|
+
__publicField(this, "store", createStore(0));
|
|
21911
|
+
__publicField(this, "get", /* @__PURE__ */ __name(() => {
|
|
21912
|
+
const container = this.engine.el;
|
|
21913
|
+
return this.el && container ? round(sceneProgress(this.el, container, this.axis, this.range)) : 0;
|
|
21914
|
+
}, "get"));
|
|
21915
|
+
__publicField(this, "subscribe", /* @__PURE__ */ __name((fn) => {
|
|
21916
|
+
const off = this.store.subscribe(fn);
|
|
21917
|
+
this.engine.schedule();
|
|
21918
|
+
return off;
|
|
21919
|
+
}, "subscribe"));
|
|
21920
|
+
}
|
|
21921
|
+
};
|
|
21922
|
+
__name(_SceneHandle, "SceneHandle");
|
|
21923
|
+
var SceneHandle = _SceneHandle;
|
|
21924
|
+
var _ScrollEngine = class _ScrollEngine {
|
|
21925
|
+
constructor() {
|
|
21926
|
+
__publicField(this, "el", null);
|
|
21927
|
+
__publicField(this, "trackVars", false);
|
|
21928
|
+
__publicField(this, "varsDirty", false);
|
|
21929
|
+
__publicField(this, "offsetsDirty", false);
|
|
21930
|
+
__publicField(this, "frame", 0);
|
|
21931
|
+
__publicField(this, "resizeObserver", null);
|
|
21932
|
+
__publicField(this, "scenes", /* @__PURE__ */ new Set());
|
|
21933
|
+
__publicField(this, "stickies", /* @__PURE__ */ new Set());
|
|
21934
|
+
__publicField(this, "viewport", { w: -1, h: -1 });
|
|
21935
|
+
__publicField(this, "containerStore", createStore(
|
|
21936
|
+
{ x: 0, y: 0 },
|
|
21937
|
+
progressEqual
|
|
21938
|
+
));
|
|
21939
|
+
__publicField(this, "progress", {
|
|
21940
|
+
get: /* @__PURE__ */ __name(() => this.el ? containerProgress(this.el) : { x: 0, y: 0 }, "get"),
|
|
21941
|
+
subscribe: /* @__PURE__ */ __name((fn) => {
|
|
21942
|
+
const off = this.containerStore.subscribe(fn);
|
|
21943
|
+
this.schedule();
|
|
21944
|
+
return off;
|
|
21945
|
+
}, "subscribe")
|
|
21946
|
+
});
|
|
21947
|
+
__publicField(this, "schedule", /* @__PURE__ */ __name(() => {
|
|
21948
|
+
if (this.frame || !this.el || !this.isActive()) return;
|
|
21949
|
+
this.frame = requestAnimationFrame(this.flush);
|
|
21950
|
+
}, "schedule"));
|
|
21951
|
+
__publicField(this, "flush", /* @__PURE__ */ __name(() => {
|
|
21952
|
+
this.frame = 0;
|
|
21953
|
+
const el = this.el;
|
|
21954
|
+
if (!el) return;
|
|
21955
|
+
const c = containerProgress(el);
|
|
21956
|
+
const rounded = { x: round(c.x), y: round(c.y) };
|
|
21957
|
+
const sceneValues = [];
|
|
21958
|
+
this.scenes.forEach((s) => {
|
|
21959
|
+
if (s.el)
|
|
21960
|
+
sceneValues.push([s, round(sceneProgress(s.el, el, s.axis, s.range))]);
|
|
21961
|
+
});
|
|
21962
|
+
const stickyStates = [];
|
|
21963
|
+
if (this.stickies.size > 0) {
|
|
21964
|
+
const cr = el.getBoundingClientRect();
|
|
21965
|
+
const portTop = cr.top + el.clientTop;
|
|
21966
|
+
const portLeft = cr.left + el.clientLeft;
|
|
21967
|
+
const portBottom = portTop + el.clientHeight;
|
|
21968
|
+
const portRight = portLeft + el.clientWidth;
|
|
21969
|
+
const maxY = el.scrollHeight - el.clientHeight;
|
|
21970
|
+
const maxX = el.scrollWidth - el.clientWidth;
|
|
21971
|
+
this.stickies.forEach((s) => {
|
|
21972
|
+
if (!s.el) return;
|
|
21973
|
+
if (s.dirty || this.offsetsDirty) s.resolve();
|
|
21974
|
+
const r = s.el.getBoundingClientRect();
|
|
21975
|
+
const o = s.offsets;
|
|
21976
|
+
const hit = [];
|
|
21977
|
+
if (o.top !== void 0 && Math.abs(r.top - (portTop + o.top)) <= EPS && el.scrollTop > EPS)
|
|
21978
|
+
hit.push("top");
|
|
21979
|
+
if (o.bottom !== void 0 && Math.abs(r.bottom - (portBottom - o.bottom)) <= EPS && el.scrollTop < maxY - EPS)
|
|
21980
|
+
hit.push("bottom");
|
|
21981
|
+
if (o.left !== void 0 && Math.abs(r.left - (portLeft + o.left)) <= EPS && el.scrollLeft > EPS)
|
|
21982
|
+
hit.push("left");
|
|
21983
|
+
if (o.right !== void 0 && Math.abs(r.right - (portRight - o.right)) <= EPS && el.scrollLeft < maxX - EPS)
|
|
21984
|
+
hit.push("right");
|
|
21985
|
+
stickyStates.push([s, hit.join(" ")]);
|
|
21986
|
+
});
|
|
21987
|
+
}
|
|
21988
|
+
this.offsetsDirty = false;
|
|
21989
|
+
const changed = this.containerStore.set(rounded);
|
|
21990
|
+
if (this.trackVars && (changed || this.varsDirty)) {
|
|
21991
|
+
el.style.setProperty("--kui-scroll-x", String(rounded.x));
|
|
21992
|
+
el.style.setProperty("--kui-scroll-y", String(rounded.y));
|
|
21993
|
+
this.varsDirty = false;
|
|
21994
|
+
}
|
|
21995
|
+
for (const [s, v] of sceneValues) {
|
|
21996
|
+
if (s.store.set(v) && s.el)
|
|
21997
|
+
s.el.style.setProperty("--kui-scene-progress", String(v));
|
|
21998
|
+
}
|
|
21999
|
+
for (const [s, stuck] of stickyStates) {
|
|
22000
|
+
if (!s.el || s.stuck === stuck) continue;
|
|
22001
|
+
const was = s.stuck !== "";
|
|
22002
|
+
s.stuck = stuck;
|
|
22003
|
+
if (stuck) s.el.setAttribute("data-stuck", stuck);
|
|
22004
|
+
else s.el.removeAttribute("data-stuck");
|
|
22005
|
+
if (was !== (stuck !== "")) s.onStuckChange?.(stuck !== "");
|
|
22006
|
+
}
|
|
22007
|
+
}, "flush"));
|
|
22008
|
+
}
|
|
22009
|
+
attach(el) {
|
|
22010
|
+
this.el = el;
|
|
22011
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
22012
|
+
this.offsetsDirty = true;
|
|
22013
|
+
this.syncViewport();
|
|
22014
|
+
this.schedule();
|
|
22015
|
+
});
|
|
22016
|
+
this.resizeObserver.observe(el);
|
|
22017
|
+
this.scenes.forEach((s) => s.el && this.resizeObserver.observe(s.el));
|
|
22018
|
+
this.syncViewport();
|
|
22019
|
+
this.schedule();
|
|
22020
|
+
}
|
|
22021
|
+
detach() {
|
|
22022
|
+
cancelAnimationFrame(this.frame);
|
|
22023
|
+
this.frame = 0;
|
|
22024
|
+
this.resizeObserver?.disconnect();
|
|
22025
|
+
this.resizeObserver = null;
|
|
22026
|
+
this.el = null;
|
|
22027
|
+
this.viewport = { w: -1, h: -1 };
|
|
22028
|
+
}
|
|
22029
|
+
setTrackProgress(on) {
|
|
22030
|
+
if (this.trackVars === on) return;
|
|
22031
|
+
this.trackVars = on;
|
|
22032
|
+
if (on) {
|
|
22033
|
+
this.varsDirty = true;
|
|
22034
|
+
} else {
|
|
22035
|
+
this.el?.style.removeProperty("--kui-scroll-x");
|
|
22036
|
+
this.el?.style.removeProperty("--kui-scroll-y");
|
|
22037
|
+
}
|
|
22038
|
+
this.schedule();
|
|
22039
|
+
}
|
|
22040
|
+
register(scene) {
|
|
22041
|
+
this.scenes.add(scene);
|
|
22042
|
+
if (scene.el) this.resizeObserver?.observe(scene.el);
|
|
22043
|
+
this.schedule();
|
|
22044
|
+
return () => {
|
|
22045
|
+
this.scenes.delete(scene);
|
|
22046
|
+
if (scene.el) this.resizeObserver?.unobserve(scene.el);
|
|
22047
|
+
};
|
|
22048
|
+
}
|
|
22049
|
+
registerSticky(s) {
|
|
22050
|
+
this.stickies.add(s);
|
|
22051
|
+
this.schedule();
|
|
22052
|
+
return () => {
|
|
22053
|
+
this.stickies.delete(s);
|
|
22054
|
+
};
|
|
22055
|
+
}
|
|
22056
|
+
isActive() {
|
|
22057
|
+
return this.trackVars || this.scenes.size > 0 || this.stickies.size > 0 || this.containerStore.size > 0;
|
|
22058
|
+
}
|
|
22059
|
+
syncViewport() {
|
|
22060
|
+
const el = this.el;
|
|
22061
|
+
if (!el) return;
|
|
22062
|
+
const w = el.clientWidth;
|
|
22063
|
+
const h = el.clientHeight;
|
|
22064
|
+
if (w === this.viewport.w && h === this.viewport.h) return;
|
|
22065
|
+
this.viewport = { w, h };
|
|
22066
|
+
el.style.setProperty("--kui-scroll-viewport-width", `${w}px`);
|
|
22067
|
+
el.style.setProperty("--kui-scroll-viewport-height", `${h}px`);
|
|
22068
|
+
}
|
|
22069
|
+
};
|
|
22070
|
+
__name(_ScrollEngine, "ScrollEngine");
|
|
22071
|
+
var ScrollEngine = _ScrollEngine;
|
|
22072
|
+
var ScrollEngineContext = createContext(null);
|
|
22073
|
+
var useIsoLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
|
22074
|
+
function useScrollEngine(hookName) {
|
|
22075
|
+
const engine = useContext(ScrollEngineContext);
|
|
22076
|
+
if (!engine) throw new Error(`${hookName} must be used inside <ScrollArea>`);
|
|
22077
|
+
return engine;
|
|
22078
|
+
}
|
|
22079
|
+
__name(useScrollEngine, "useScrollEngine");
|
|
22080
|
+
function useScrollProgress() {
|
|
22081
|
+
return useScrollEngine("useScrollProgress").progress;
|
|
22082
|
+
}
|
|
22083
|
+
__name(useScrollProgress, "useScrollProgress");
|
|
22084
|
+
function useElementScrollProgress(ref, { range = "through", axis = "y" } = {}) {
|
|
22085
|
+
const engine = useScrollEngine("useElementScrollProgress");
|
|
22086
|
+
const [handle] = useState(() => new SceneHandle(engine));
|
|
22087
|
+
useIsoLayoutEffect(() => {
|
|
22088
|
+
handle.el = ref.current;
|
|
22089
|
+
handle.axis = axis;
|
|
22090
|
+
handle.range = range;
|
|
22091
|
+
return engine.register(handle);
|
|
22092
|
+
}, [engine, handle, ref, axis, range]);
|
|
22093
|
+
return handle;
|
|
22094
|
+
}
|
|
22095
|
+
__name(useElementScrollProgress, "useElementScrollProgress");
|
|
22096
|
+
|
|
22097
|
+
// src/components/layout/ScrollArea/scrollTargets.ts
|
|
22098
|
+
var axesFor = /* @__PURE__ */ __name((d) => d === "both" ? ["x", "y"] : d === "horizontal" ? ["x"] : ["y"], "axesFor");
|
|
22099
|
+
var prefersReducedMotion = /* @__PURE__ */ __name(() => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, "prefersReducedMotion");
|
|
22100
|
+
var resolveBehavior = /* @__PURE__ */ __name((b) => b ?? (prefersReducedMotion() ? "auto" : "smooth"), "resolveBehavior");
|
|
22101
|
+
function childTarget(container, child, axis, align) {
|
|
22102
|
+
const h = axis === "x";
|
|
22103
|
+
const c = container.getBoundingClientRect();
|
|
22104
|
+
const r = child.getBoundingClientRect();
|
|
22105
|
+
const cs = getComputedStyle(container);
|
|
22106
|
+
const view = h ? container.clientWidth : container.clientHeight;
|
|
22107
|
+
const size = h ? r.width : r.height;
|
|
22108
|
+
const rel = h ? r.left - c.left - container.clientLeft : r.top - c.top - container.clientTop;
|
|
22109
|
+
const current = h ? container.scrollLeft : container.scrollTop;
|
|
22110
|
+
const max = h ? container.scrollWidth - view : container.scrollHeight - view;
|
|
22111
|
+
const padStart = parseFloat(h ? cs.scrollPaddingLeft : cs.scrollPaddingTop) || 0;
|
|
22112
|
+
const padEnd = parseFloat(h ? cs.scrollPaddingRight : cs.scrollPaddingBottom) || 0;
|
|
22113
|
+
let offsetInView;
|
|
22114
|
+
if (align === "start") offsetInView = padStart;
|
|
22115
|
+
else if (align === "end") offsetInView = view - padEnd - size;
|
|
22116
|
+
else offsetInView = padStart + (view - padStart - padEnd - size) / 2;
|
|
22117
|
+
return Math.min(Math.max(current + rel - offsetInView, 0), Math.max(max, 0));
|
|
22118
|
+
}
|
|
22119
|
+
__name(childTarget, "childTarget");
|
|
22120
|
+
var snapItems = /* @__PURE__ */ __name((el) => Array.from(el.children).filter(
|
|
22121
|
+
(c) => !getComputedStyle(c).scrollSnapAlign.startsWith("none")
|
|
22122
|
+
), "snapItems");
|
|
22123
|
+
function snapToNearest(el, direction, align) {
|
|
22124
|
+
const items = snapItems(el);
|
|
22125
|
+
if (!items.length) return;
|
|
22126
|
+
const opts = { behavior: resolveBehavior() };
|
|
22127
|
+
for (const axis of axesFor(direction)) {
|
|
22128
|
+
const cur = axis === "x" ? el.scrollLeft : el.scrollTop;
|
|
22129
|
+
let best = cur;
|
|
22130
|
+
let bestDist = Infinity;
|
|
22131
|
+
for (const item of items) {
|
|
22132
|
+
const t = childTarget(el, item, axis, align);
|
|
22133
|
+
const d = Math.abs(t - cur);
|
|
22134
|
+
if (d < bestDist) {
|
|
22135
|
+
bestDist = d;
|
|
22136
|
+
best = t;
|
|
22137
|
+
}
|
|
22138
|
+
}
|
|
22139
|
+
opts[axis === "x" ? "left" : "top"] = best;
|
|
22140
|
+
}
|
|
22141
|
+
el.scrollTo(opts);
|
|
22142
|
+
}
|
|
22143
|
+
__name(snapToNearest, "snapToNearest");
|
|
22144
|
+
var ScrollAreaScene = createComponent({
|
|
22145
|
+
displayName: "ScrollArea.Scene",
|
|
22146
|
+
__kui: {
|
|
22147
|
+
role: "layout",
|
|
22148
|
+
skeleton: "preserve",
|
|
22149
|
+
groupSlot: "ScrollArea",
|
|
22150
|
+
video: {
|
|
22151
|
+
id: "scroll-area-scene",
|
|
22152
|
+
safe: true,
|
|
22153
|
+
acceptsChildren: true,
|
|
22154
|
+
interactionStates: [],
|
|
22155
|
+
motionGated: true
|
|
22156
|
+
}
|
|
22157
|
+
},
|
|
22158
|
+
render: /* @__PURE__ */ __name(({ range, axis, as: Tag = "div", ...rest }, forwardedRef) => {
|
|
22159
|
+
const ref = useRef(null);
|
|
22160
|
+
void isMotionGated(rest);
|
|
22161
|
+
useElementScrollProgress(ref, { range, axis });
|
|
22162
|
+
return /* @__PURE__ */ jsx(Tag, { ref: composeRefs(ref, forwardedRef), "data-kui-scroll-scene": true, ...rest });
|
|
22163
|
+
}, "render")
|
|
22164
|
+
});
|
|
22165
|
+
function warnIfClipped(el, container) {
|
|
22166
|
+
for (let p = el.parentElement; p && p !== container; p = p.parentElement) {
|
|
22167
|
+
if (/hidden|auto|scroll/.test(getComputedStyle(p).overflow)) {
|
|
22168
|
+
console.warn(
|
|
22169
|
+
"[kreativ-ui/ScrollArea.Sticky]: will not stick: an ancestor has overflow other than visible/clip.",
|
|
22170
|
+
p
|
|
22171
|
+
);
|
|
22172
|
+
return;
|
|
22173
|
+
}
|
|
21137
22174
|
}
|
|
21138
|
-
);
|
|
21139
|
-
Container.displayName = "Container";
|
|
21140
|
-
function spaceVar(value) {
|
|
21141
|
-
return `var(--kui-spacing-${value})`;
|
|
21142
22175
|
}
|
|
21143
|
-
__name(
|
|
21144
|
-
var
|
|
21145
|
-
|
|
21146
|
-
|
|
21147
|
-
|
|
21148
|
-
|
|
21149
|
-
|
|
21150
|
-
|
|
22176
|
+
__name(warnIfClipped, "warnIfClipped");
|
|
22177
|
+
var ScrollAreaSticky = createComponent({
|
|
22178
|
+
displayName: "ScrollArea.Sticky",
|
|
22179
|
+
__kui: {
|
|
22180
|
+
role: "layout",
|
|
22181
|
+
skeleton: "preserve",
|
|
22182
|
+
groupSlot: "ScrollArea",
|
|
22183
|
+
video: {
|
|
22184
|
+
id: "scroll-area-sticky",
|
|
22185
|
+
safe: true,
|
|
22186
|
+
acceptsChildren: true,
|
|
22187
|
+
needsParentContext: true,
|
|
22188
|
+
interactionStates: []
|
|
22189
|
+
}
|
|
22190
|
+
},
|
|
22191
|
+
render: /* @__PURE__ */ __name(({
|
|
22192
|
+
top,
|
|
22193
|
+
bottom,
|
|
22194
|
+
left,
|
|
22195
|
+
right,
|
|
22196
|
+
zIndex = 1,
|
|
22197
|
+
onStuckChange,
|
|
22198
|
+
as: Tag = "div",
|
|
22199
|
+
style,
|
|
22200
|
+
...rest
|
|
22201
|
+
}, forwardedRef) => {
|
|
22202
|
+
const engine = useScrollEngine("ScrollArea.Sticky");
|
|
22203
|
+
const ref = useRef(null);
|
|
22204
|
+
const [handle] = useState(() => new StickyHandle());
|
|
22205
|
+
const none = top === void 0 && bottom === void 0 && left === void 0 && right === void 0;
|
|
22206
|
+
const offsets = {
|
|
22207
|
+
top: none ? 0 : top,
|
|
22208
|
+
bottom,
|
|
22209
|
+
left,
|
|
22210
|
+
right
|
|
22211
|
+
};
|
|
22212
|
+
useIsoLayoutEffect(() => {
|
|
22213
|
+
handle.onStuckChange = onStuckChange;
|
|
22214
|
+
});
|
|
22215
|
+
useIsoLayoutEffect(() => {
|
|
22216
|
+
const el = ref.current;
|
|
22217
|
+
if (!el) return;
|
|
22218
|
+
handle.el = el;
|
|
22219
|
+
handle.edges = STICKY_EDGES.filter((e) => offsets[e] !== void 0);
|
|
22220
|
+
handle.dirty = true;
|
|
22221
|
+
if (process.env.NODE_ENV !== "production") warnIfClipped(el, engine.el);
|
|
22222
|
+
return engine.registerSticky(handle);
|
|
22223
|
+
}, [
|
|
22224
|
+
engine,
|
|
22225
|
+
handle,
|
|
22226
|
+
offsets.top,
|
|
22227
|
+
offsets.bottom,
|
|
22228
|
+
offsets.left,
|
|
22229
|
+
offsets.right
|
|
22230
|
+
]);
|
|
22231
|
+
return /* @__PURE__ */ jsx(
|
|
22232
|
+
Tag,
|
|
22233
|
+
{
|
|
22234
|
+
ref: composeRefs(ref, forwardedRef),
|
|
22235
|
+
"data-kui-scroll-sticky": true,
|
|
22236
|
+
style: {
|
|
22237
|
+
position: "sticky",
|
|
22238
|
+
top: offsets.top,
|
|
22239
|
+
bottom: offsets.bottom,
|
|
22240
|
+
left: offsets.left,
|
|
22241
|
+
right: offsets.right,
|
|
22242
|
+
zIndex,
|
|
22243
|
+
...style
|
|
22244
|
+
},
|
|
22245
|
+
...rest
|
|
22246
|
+
}
|
|
22247
|
+
);
|
|
22248
|
+
}, "render")
|
|
22249
|
+
});
|
|
22250
|
+
function shouldFade(fadeEdges, edge) {
|
|
22251
|
+
if (fadeEdges === true) return true;
|
|
22252
|
+
if (!fadeEdges) return false;
|
|
22253
|
+
return !!fadeEdges[edge];
|
|
22254
|
+
}
|
|
22255
|
+
__name(shouldFade, "shouldFade");
|
|
22256
|
+
var ScrollAreaRoot = createComponent({
|
|
22257
|
+
displayName: "ScrollArea",
|
|
22258
|
+
__kui: {
|
|
22259
|
+
role: "layout",
|
|
22260
|
+
formControl: "compound",
|
|
22261
|
+
skeleton: "preserve",
|
|
22262
|
+
video: {
|
|
22263
|
+
id: "scroll-area",
|
|
22264
|
+
safe: true,
|
|
22265
|
+
acceptsChildren: true,
|
|
22266
|
+
interactionStates: [],
|
|
22267
|
+
motionGated: true
|
|
22268
|
+
}
|
|
22269
|
+
},
|
|
22270
|
+
render: /* @__PURE__ */ __name(({
|
|
22271
|
+
maxHeight,
|
|
22272
|
+
maxWidth,
|
|
22273
|
+
direction = "vertical",
|
|
22274
|
+
showScrollbar = "auto",
|
|
22275
|
+
scrollbarVariant = "thin",
|
|
22276
|
+
fadeEdges = false,
|
|
22277
|
+
fadeSize = "24px",
|
|
22278
|
+
overscrollBehavior = "contain",
|
|
22279
|
+
snap = "none",
|
|
22280
|
+
snapAlign = "start",
|
|
22281
|
+
dragToScroll = false,
|
|
22282
|
+
onScroll,
|
|
22283
|
+
onScrollEnd,
|
|
22284
|
+
endThreshold = 0,
|
|
22285
|
+
trackProgress = false,
|
|
22286
|
+
tabIndex,
|
|
21151
22287
|
as: Tag = "div",
|
|
21152
22288
|
className,
|
|
21153
22289
|
style,
|
|
21154
|
-
unstyled,
|
|
21155
22290
|
children,
|
|
21156
22291
|
...rest
|
|
21157
|
-
},
|
|
21158
|
-
const
|
|
21159
|
-
|
|
21160
|
-
|
|
21161
|
-
|
|
21162
|
-
|
|
21163
|
-
|
|
21164
|
-
|
|
21165
|
-
|
|
21166
|
-
|
|
22292
|
+
}, forwardedRef) => {
|
|
22293
|
+
const { theme } = useTheme();
|
|
22294
|
+
const [engine] = useState(() => new ScrollEngine());
|
|
22295
|
+
const motionGated = isMotionGated(rest);
|
|
22296
|
+
const snapActive = motionGated ? "none" : snap;
|
|
22297
|
+
const dragActive = motionGated ? false : dragToScroll;
|
|
22298
|
+
const { elRef, state, handleScroll, measure } = useScrollPosition({
|
|
22299
|
+
direction,
|
|
22300
|
+
threshold: endThreshold,
|
|
22301
|
+
onScrollEnd,
|
|
22302
|
+
onMeasure: engine.schedule
|
|
22303
|
+
});
|
|
22304
|
+
useIsoLayoutEffect(() => {
|
|
22305
|
+
const el = elRef.current;
|
|
22306
|
+
if (!el) return;
|
|
22307
|
+
engine.attach(el);
|
|
22308
|
+
return () => engine.detach();
|
|
22309
|
+
}, [engine, elRef]);
|
|
22310
|
+
useIsoLayoutEffect(() => {
|
|
22311
|
+
engine.setTrackProgress(trackProgress);
|
|
22312
|
+
}, [engine, trackProgress]);
|
|
22313
|
+
useDragScroll(elRef, {
|
|
22314
|
+
enabled: dragActive,
|
|
22315
|
+
direction,
|
|
22316
|
+
onRelease: snapActive === "mandatory" ? (el) => snapToNearest(el, direction, snapAlign) : void 0
|
|
22317
|
+
});
|
|
22318
|
+
useImperativeHandle(forwardedRef, () => {
|
|
22319
|
+
const getEl = /* @__PURE__ */ __name(() => elRef.current, "getEl");
|
|
22320
|
+
const defaultAxis = /* @__PURE__ */ __name(() => direction === "horizontal" ? "x" : "y", "defaultAxis");
|
|
22321
|
+
const stepScroll = /* @__PURE__ */ __name((dir, o) => {
|
|
22322
|
+
const el = getEl();
|
|
22323
|
+
if (!el) return;
|
|
22324
|
+
const axis = o?.axis ?? defaultAxis();
|
|
22325
|
+
const h = axis === "x";
|
|
22326
|
+
const cur = h ? el.scrollLeft : el.scrollTop;
|
|
22327
|
+
let target;
|
|
22328
|
+
if ((o?.step ?? "page") === "page") {
|
|
22329
|
+
target = cur + dir * (h ? el.clientWidth : el.clientHeight);
|
|
22330
|
+
} else {
|
|
22331
|
+
const targets = snapItems(el).map(
|
|
22332
|
+
(c) => childTarget(el, c, axis, snapAlign)
|
|
22333
|
+
);
|
|
22334
|
+
const found = dir === 1 ? targets.find((t) => t > cur + 1) : [...targets].reverse().find((t) => t < cur - 1);
|
|
22335
|
+
if (found === void 0) return;
|
|
22336
|
+
target = found;
|
|
22337
|
+
}
|
|
22338
|
+
el.scrollTo({
|
|
22339
|
+
[h ? "left" : "top"]: target,
|
|
22340
|
+
behavior: resolveBehavior(o?.behavior)
|
|
22341
|
+
});
|
|
22342
|
+
}, "stepScroll");
|
|
22343
|
+
return {
|
|
22344
|
+
getElement: getEl,
|
|
22345
|
+
measure,
|
|
22346
|
+
scrollTo: /* @__PURE__ */ __name((opts) => getEl()?.scrollTo(opts), "scrollTo"),
|
|
22347
|
+
scrollToTop: /* @__PURE__ */ __name((behavior) => getEl()?.scrollTo({ top: 0, behavior: resolveBehavior(behavior) }), "scrollToTop"),
|
|
22348
|
+
scrollToBottom: /* @__PURE__ */ __name((behavior) => {
|
|
22349
|
+
const el = getEl();
|
|
22350
|
+
if (el)
|
|
22351
|
+
el.scrollTo({
|
|
22352
|
+
top: el.scrollHeight,
|
|
22353
|
+
behavior: resolveBehavior(behavior)
|
|
22354
|
+
});
|
|
22355
|
+
}, "scrollToBottom"),
|
|
22356
|
+
scrollToEdge: /* @__PURE__ */ __name((edge, behavior) => {
|
|
22357
|
+
const el = getEl();
|
|
22358
|
+
if (!el) return;
|
|
22359
|
+
const opts = { behavior: resolveBehavior(behavior) };
|
|
22360
|
+
if (edge === "top") opts.top = 0;
|
|
22361
|
+
if (edge === "bottom") opts.top = el.scrollHeight;
|
|
22362
|
+
if (edge === "left") opts.left = 0;
|
|
22363
|
+
if (edge === "right") opts.left = el.scrollWidth;
|
|
22364
|
+
el.scrollTo(opts);
|
|
22365
|
+
}, "scrollToEdge"),
|
|
22366
|
+
scrollNext: /* @__PURE__ */ __name((o) => stepScroll(1, o), "scrollNext"),
|
|
22367
|
+
scrollPrev: /* @__PURE__ */ __name((o) => stepScroll(-1, o), "scrollPrev"),
|
|
22368
|
+
scrollToIndex: /* @__PURE__ */ __name((index, o) => {
|
|
22369
|
+
const el = getEl();
|
|
22370
|
+
const child = el?.children[index];
|
|
22371
|
+
if (!el || !child) return;
|
|
22372
|
+
const axis = o?.axis ?? defaultAxis();
|
|
22373
|
+
el.scrollTo({
|
|
22374
|
+
[axis === "x" ? "left" : "top"]: childTarget(
|
|
22375
|
+
el,
|
|
22376
|
+
child,
|
|
22377
|
+
axis,
|
|
22378
|
+
snapAlign
|
|
22379
|
+
),
|
|
22380
|
+
behavior: resolveBehavior(o?.behavior)
|
|
22381
|
+
});
|
|
22382
|
+
}, "scrollToIndex")
|
|
22383
|
+
};
|
|
22384
|
+
}, [elRef, measure, direction, snapAlign]);
|
|
22385
|
+
const handleScrollEvent = useCallback(
|
|
22386
|
+
(e) => {
|
|
22387
|
+
onScroll?.(e);
|
|
22388
|
+
handleScroll();
|
|
22389
|
+
},
|
|
22390
|
+
[onScroll, handleScroll]
|
|
22391
|
+
);
|
|
22392
|
+
const responsiveDims = useMemo(() => {
|
|
22393
|
+
const styles = {};
|
|
22394
|
+
const inlineStyle = {};
|
|
22395
|
+
if (isResponsiveValue(maxHeight)) {
|
|
22396
|
+
const { base, responsive } = resolveResponsiveValue(maxHeight);
|
|
22397
|
+
if (base !== void 0) inlineStyle.maxHeight = base;
|
|
22398
|
+
Object.entries(responsive).forEach(([bp, val]) => {
|
|
22399
|
+
styles[bp] = {
|
|
22400
|
+
...styles[bp] ?? {},
|
|
22401
|
+
maxHeight: val
|
|
22402
|
+
};
|
|
22403
|
+
});
|
|
22404
|
+
} else if (maxHeight !== void 0) {
|
|
22405
|
+
inlineStyle.maxHeight = maxHeight;
|
|
22406
|
+
}
|
|
22407
|
+
if (isResponsiveValue(maxWidth)) {
|
|
22408
|
+
const { base, responsive } = resolveResponsiveValue(maxWidth);
|
|
22409
|
+
if (base !== void 0) inlineStyle.maxWidth = base;
|
|
22410
|
+
Object.entries(responsive).forEach(([bp, val]) => {
|
|
22411
|
+
styles[bp] = {
|
|
22412
|
+
...styles[bp] ?? {},
|
|
22413
|
+
maxWidth: val
|
|
22414
|
+
};
|
|
22415
|
+
});
|
|
22416
|
+
} else if (maxWidth !== void 0) {
|
|
22417
|
+
inlineStyle.maxWidth = maxWidth;
|
|
22418
|
+
}
|
|
22419
|
+
return { inlineStyle, breakpointStyles: styles };
|
|
22420
|
+
}, [maxHeight, maxWidth]);
|
|
22421
|
+
const { attribute, style: responsiveCss } = (0, hooks_exports.useResponsiveStyles)(
|
|
22422
|
+
responsiveDims.breakpointStyles
|
|
22423
|
+
);
|
|
22424
|
+
const fadeTop = shouldFade(fadeEdges, "top") && state.hasVerticalOverflow && !state.atTop;
|
|
22425
|
+
const fadeBottom = shouldFade(fadeEdges, "bottom") && state.hasVerticalOverflow && !state.atBottom;
|
|
22426
|
+
const fadeLeft = shouldFade(fadeEdges, "left") && state.hasHorizontalOverflow && !state.atLeft;
|
|
22427
|
+
const fadeRight = shouldFade(fadeEdges, "right") && state.hasHorizontalOverflow && !state.atRight;
|
|
22428
|
+
const maskImage = useMemo(() => {
|
|
22429
|
+
if (direction !== "both") return void 0;
|
|
22430
|
+
if (!fadeTop && !fadeBottom && !fadeLeft && !fadeRight) return void 0;
|
|
22431
|
+
const v = `linear-gradient(to bottom, ${fadeTop ? "transparent 0, black var(--kui-scroll-fade-size)" : "black 0"}, ${fadeBottom ? "black calc(100% - var(--kui-scroll-fade-size)), transparent 100%" : "black 100%"})`;
|
|
22432
|
+
const h = `linear-gradient(to right, ${fadeLeft ? "transparent 0, black var(--kui-scroll-fade-size)" : "black 0"}, ${fadeRight ? "black calc(100% - var(--kui-scroll-fade-size)), transparent 100%" : "black 100%"})`;
|
|
22433
|
+
return `${v}, ${h}`;
|
|
22434
|
+
}, [direction, fadeTop, fadeBottom, fadeLeft, fadeRight]);
|
|
22435
|
+
const recipeClasses = resolveRecipe(theme.recipes.ScrollArea, {
|
|
22436
|
+
direction,
|
|
22437
|
+
showScrollbar,
|
|
22438
|
+
scrollbarVariant
|
|
22439
|
+
});
|
|
22440
|
+
const resolvedTabIndex = tabIndex ?? (state.hasVerticalOverflow || state.hasHorizontalOverflow ? 0 : void 0);
|
|
22441
|
+
const snapAxis = direction === "both" ? "both" : direction === "horizontal" ? "x" : "y";
|
|
22442
|
+
const fadeSizeValue = typeof fadeSize === "number" ? `${fadeSize}px` : fadeSize;
|
|
22443
|
+
return /* @__PURE__ */ jsxs(ScrollEngineContext.Provider, { value: engine, children: [
|
|
21167
22444
|
/* @__PURE__ */ jsx(ResponsiveStyle, { css: responsiveCss }),
|
|
21168
22445
|
/* @__PURE__ */ jsx(
|
|
21169
22446
|
Tag,
|
|
21170
22447
|
{
|
|
21171
|
-
ref,
|
|
22448
|
+
ref: elRef,
|
|
22449
|
+
"data-kui-scroll-area": true,
|
|
22450
|
+
"data-direction": direction,
|
|
22451
|
+
"data-fade-top": fadeTop || void 0,
|
|
22452
|
+
"data-fade-bottom": fadeBottom || void 0,
|
|
22453
|
+
"data-fade-left": fadeLeft || void 0,
|
|
22454
|
+
"data-fade-right": fadeRight || void 0,
|
|
22455
|
+
"data-snap-align": snapActive !== "none" ? snapAlign : void 0,
|
|
22456
|
+
"data-drag-scroll": dragActive || void 0,
|
|
21172
22457
|
"data-kui-responsive": attribute,
|
|
21173
|
-
|
|
21174
|
-
|
|
22458
|
+
onScroll: handleScrollEvent,
|
|
22459
|
+
tabIndex: resolvedTabIndex,
|
|
22460
|
+
className: cn(recipeClasses, className),
|
|
22461
|
+
style: {
|
|
22462
|
+
...responsiveDims.inlineStyle,
|
|
22463
|
+
overscrollBehavior,
|
|
22464
|
+
scrollSnapType: snapActive !== "none" ? `${snapAxis} ${snapActive}` : void 0,
|
|
22465
|
+
"--kui-scroll-fade-size": fadeSizeValue,
|
|
22466
|
+
...maskImage ? {
|
|
22467
|
+
maskImage,
|
|
22468
|
+
WebkitMaskImage: maskImage,
|
|
22469
|
+
maskComposite: "intersect",
|
|
22470
|
+
WebkitMaskComposite: "source-in"
|
|
22471
|
+
} : {},
|
|
22472
|
+
...style
|
|
22473
|
+
},
|
|
21175
22474
|
...rest,
|
|
21176
22475
|
children
|
|
21177
22476
|
}
|
|
21178
22477
|
)
|
|
21179
22478
|
] });
|
|
21180
|
-
}
|
|
21181
|
-
);
|
|
21182
|
-
|
|
21183
|
-
|
|
21184
|
-
|
|
21185
|
-
|
|
21186
|
-
|
|
21187
|
-
|
|
22479
|
+
}, "render")
|
|
22480
|
+
});
|
|
22481
|
+
var ScrollArea = Object.assign(ScrollAreaRoot, {
|
|
22482
|
+
Scene: ScrollAreaScene,
|
|
22483
|
+
Sticky: ScrollAreaSticky
|
|
22484
|
+
});
|
|
22485
|
+
function resolveSize(value) {
|
|
22486
|
+
if (value === "full") return "100%";
|
|
22487
|
+
if (value === "fit") return "fit-content";
|
|
22488
|
+
if (value === "auto") return "auto";
|
|
22489
|
+
return resolveSpace(value);
|
|
22490
|
+
}
|
|
22491
|
+
__name(resolveSize, "resolveSize");
|
|
22492
|
+
var Box = createComponent({
|
|
22493
|
+
displayName: "Box",
|
|
22494
|
+
__kui: {
|
|
22495
|
+
role: "layout",
|
|
22496
|
+
skeleton: "preserve",
|
|
22497
|
+
video: {
|
|
22498
|
+
id: "box",
|
|
22499
|
+
safe: true,
|
|
22500
|
+
acceptsChildren: true,
|
|
22501
|
+
interactionStates: []
|
|
21188
22502
|
}
|
|
21189
|
-
|
|
21190
|
-
|
|
21191
|
-
child,
|
|
21192
|
-
index < items.length - 1 && divider
|
|
21193
|
-
] }, child.key ?? index)) });
|
|
21194
|
-
}
|
|
21195
|
-
);
|
|
21196
|
-
Stack.displayName = "Stack";
|
|
21197
|
-
function spaceVar2(value) {
|
|
21198
|
-
return `var(--kui-spacing-${value})`;
|
|
21199
|
-
}
|
|
21200
|
-
__name(spaceVar2, "spaceVar");
|
|
21201
|
-
var Grid = forwardRef(
|
|
21202
|
-
({
|
|
21203
|
-
columns,
|
|
21204
|
-
templateColumns,
|
|
21205
|
-
templateRows,
|
|
21206
|
-
templateAreas,
|
|
21207
|
-
gap,
|
|
21208
|
-
columnGap,
|
|
21209
|
-
rowGap,
|
|
21210
|
-
align,
|
|
21211
|
-
justify,
|
|
22503
|
+
},
|
|
22504
|
+
render: /* @__PURE__ */ __name(({
|
|
21212
22505
|
as: Tag = "div",
|
|
22506
|
+
p,
|
|
22507
|
+
px,
|
|
22508
|
+
py,
|
|
22509
|
+
m,
|
|
22510
|
+
mx,
|
|
22511
|
+
my,
|
|
22512
|
+
bg,
|
|
22513
|
+
color,
|
|
22514
|
+
border = false,
|
|
22515
|
+
rounded,
|
|
22516
|
+
w,
|
|
22517
|
+
h,
|
|
21213
22518
|
className,
|
|
21214
22519
|
style,
|
|
21215
22520
|
unstyled,
|
|
21216
22521
|
children,
|
|
21217
22522
|
...rest
|
|
21218
22523
|
}, ref) => {
|
|
22524
|
+
const { theme } = useTheme();
|
|
22525
|
+
const borderColor = typeof border === "boolean" ? void 0 : border;
|
|
21219
22526
|
const responsiveStyles = (0, hooks_exports.useMergedResponsiveStyles)([
|
|
21220
|
-
[
|
|
21221
|
-
|
|
21222
|
-
|
|
21223
|
-
],
|
|
21224
|
-
[
|
|
21225
|
-
[
|
|
21226
|
-
[
|
|
21227
|
-
[
|
|
21228
|
-
[
|
|
21229
|
-
[
|
|
22527
|
+
[p, (v) => ({ padding: resolveSpace(v) })],
|
|
22528
|
+
[px, (v) => ({ paddingInline: resolveSpace(v) })],
|
|
22529
|
+
[py, (v) => ({ paddingBlock: resolveSpace(v) })],
|
|
22530
|
+
[m, (v) => ({ margin: v === "auto" ? "auto" : resolveSpace(v) })],
|
|
22531
|
+
[mx, (v) => ({ marginInline: v === "auto" ? "auto" : resolveSpace(v) })],
|
|
22532
|
+
[my, (v) => ({ marginBlock: v === "auto" ? "auto" : resolveSpace(v) })],
|
|
22533
|
+
[bg, (v) => ({ background: resolveColor(v) })],
|
|
22534
|
+
[color, (v) => ({ color: resolveColor(v) })],
|
|
22535
|
+
[borderColor, (v) => ({ borderColor: resolveColor(v) })],
|
|
22536
|
+
[rounded, (v) => ({ borderRadius: resolveRadius(v) })],
|
|
22537
|
+
[w, (v) => ({ width: resolveSize(v) })],
|
|
22538
|
+
[h, (v) => ({ height: resolveSize(v) })]
|
|
21230
22539
|
]);
|
|
21231
22540
|
const { attribute, style: responsiveCss } = (0, hooks_exports.useResponsiveStyles)(responsiveStyles);
|
|
22541
|
+
const recipeClasses = resolveRecipe(theme.recipes.Box, {
|
|
22542
|
+
border: Boolean(border)
|
|
22543
|
+
});
|
|
21232
22544
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
21233
22545
|
/* @__PURE__ */ jsx(ResponsiveStyle, { css: responsiveCss }),
|
|
21234
22546
|
/* @__PURE__ */ jsx(
|
|
@@ -21236,144 +22548,15 @@ var Grid = forwardRef(
|
|
|
21236
22548
|
{
|
|
21237
22549
|
ref,
|
|
21238
22550
|
"data-kui-responsive": attribute,
|
|
21239
|
-
className: cn(!unstyled &&
|
|
21240
|
-
style
|
|
22551
|
+
className: cn(!unstyled && recipeClasses, className),
|
|
22552
|
+
style,
|
|
21241
22553
|
...rest,
|
|
21242
22554
|
children
|
|
21243
22555
|
}
|
|
21244
22556
|
)
|
|
21245
22557
|
] });
|
|
21246
|
-
}
|
|
21247
|
-
);
|
|
21248
|
-
Grid.displayName = "Grid";
|
|
21249
|
-
var cardVariants = {
|
|
21250
|
-
solid: "bg-kui-surface",
|
|
21251
|
-
outline: "border border-kui-border bg-kui-surface",
|
|
21252
|
-
ghost: "bg-transparent",
|
|
21253
|
-
elevated: "bg-kui-surface shadow-md",
|
|
21254
|
-
compact: "bg-kui-surface"
|
|
21255
|
-
};
|
|
21256
|
-
var cardSizes = {
|
|
21257
|
-
sm: "p-3",
|
|
21258
|
-
md: "p-4",
|
|
21259
|
-
lg: "p-6"
|
|
21260
|
-
};
|
|
21261
|
-
var CardRoot = createComponent$1({
|
|
21262
|
-
__kui: {
|
|
21263
|
-
role: "display",
|
|
21264
|
-
skeleton: "preserve"
|
|
21265
|
-
},
|
|
21266
|
-
displayName: "Card",
|
|
21267
|
-
render: /* @__PURE__ */ __name(({
|
|
21268
|
-
variant = "outline",
|
|
21269
|
-
size = "md",
|
|
21270
|
-
hasImage = false,
|
|
21271
|
-
fullWidth = false,
|
|
21272
|
-
noPadding = false,
|
|
21273
|
-
className,
|
|
21274
|
-
children,
|
|
21275
|
-
...props
|
|
21276
|
-
}, ref) => {
|
|
21277
|
-
const basePadding = variant === "compact" ? "p-3" : hasImage ? "p-0" : cardSizes[size];
|
|
21278
|
-
return /* @__PURE__ */ jsx(
|
|
21279
|
-
"div",
|
|
21280
|
-
{
|
|
21281
|
-
ref,
|
|
21282
|
-
className: cn(
|
|
21283
|
-
"overflow-hidden rounded-(--kui-radii-lg)",
|
|
21284
|
-
cardVariants[variant],
|
|
21285
|
-
fullWidth && "w-full",
|
|
21286
|
-
className
|
|
21287
|
-
),
|
|
21288
|
-
...props,
|
|
21289
|
-
children: /* @__PURE__ */ jsx("div", { className: cn(!noPadding && basePadding), children })
|
|
21290
|
-
}
|
|
21291
|
-
);
|
|
21292
22558
|
}, "render")
|
|
21293
22559
|
});
|
|
21294
|
-
var CardHeader = createComponent$1({
|
|
21295
|
-
__kui: {
|
|
21296
|
-
groupSlot: "Card"
|
|
21297
|
-
},
|
|
21298
|
-
displayName: "Card.Header",
|
|
21299
|
-
render: /* @__PURE__ */ __name(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
21300
|
-
"div",
|
|
21301
|
-
{
|
|
21302
|
-
ref,
|
|
21303
|
-
className: cn(
|
|
21304
|
-
"flex items-center justify-between gap-(--kui-spacing-md)",
|
|
21305
|
-
className
|
|
21306
|
-
),
|
|
21307
|
-
...props,
|
|
21308
|
-
children
|
|
21309
|
-
}
|
|
21310
|
-
), "render")
|
|
21311
|
-
});
|
|
21312
|
-
var CardBody = createComponent$1({
|
|
21313
|
-
__kui: {
|
|
21314
|
-
groupSlot: "Card"
|
|
21315
|
-
},
|
|
21316
|
-
displayName: "Card.Body",
|
|
21317
|
-
render: /* @__PURE__ */ __name(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("min-w-0", className), ...props, children }), "render")
|
|
21318
|
-
});
|
|
21319
|
-
var CardFooter = createComponent$1({
|
|
21320
|
-
__kui: {
|
|
21321
|
-
groupSlot: "Card"
|
|
21322
|
-
},
|
|
21323
|
-
displayName: "Card.Footer",
|
|
21324
|
-
render: /* @__PURE__ */ __name(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
21325
|
-
"div",
|
|
21326
|
-
{
|
|
21327
|
-
ref,
|
|
21328
|
-
className: cn("flex items-center gap-(--kui-spacing-md)", className),
|
|
21329
|
-
...props,
|
|
21330
|
-
children
|
|
21331
|
-
}
|
|
21332
|
-
), "render")
|
|
21333
|
-
});
|
|
21334
|
-
var Card = Object.assign(CardRoot, {
|
|
21335
|
-
Header: CardHeader,
|
|
21336
|
-
Body: CardBody,
|
|
21337
|
-
Footer: CardFooter
|
|
21338
|
-
// Media: CardMedia,
|
|
21339
|
-
// Overlay: CardOverlay,
|
|
21340
|
-
});
|
|
21341
|
-
|
|
21342
|
-
// src/components/internal/loader/skeletonRegistry.ts
|
|
21343
|
-
var registry2 = /* @__PURE__ */ new WeakMap();
|
|
21344
|
-
function registerSkeleton(component, definition) {
|
|
21345
|
-
registry2.set(component, definition);
|
|
21346
|
-
}
|
|
21347
|
-
__name(registerSkeleton, "registerSkeleton");
|
|
21348
|
-
|
|
21349
|
-
// src/components/Loader/Loader.types.ts
|
|
21350
|
-
var KUI_COMPONENT_METADATA = /* @__PURE__ */ Symbol("kui.component.metadata");
|
|
21351
|
-
function tagKuiComponent(component, metadata) {
|
|
21352
|
-
component[KUI_COMPONENT_METADATA] = metadata;
|
|
21353
|
-
}
|
|
21354
|
-
__name(tagKuiComponent, "tagKuiComponent");
|
|
21355
|
-
|
|
21356
|
-
// src/components/Loader/defineSkeleton.ts
|
|
21357
|
-
function defineSkeleton(resolve, options) {
|
|
21358
|
-
return { resolve, defaults: options?.defaults };
|
|
21359
|
-
}
|
|
21360
|
-
__name(defineSkeleton, "defineSkeleton");
|
|
21361
|
-
|
|
21362
|
-
// src/components/layout/Card/Card.skeleton.tsx
|
|
21363
|
-
tagKuiComponent(Card, {
|
|
21364
|
-
name: "Card",
|
|
21365
|
-
usesSizeScale: true,
|
|
21366
|
-
slots: ["avatar", "text"]
|
|
21367
|
-
});
|
|
21368
|
-
var cardSkeleton = defineSkeleton(
|
|
21369
|
-
(props) => ({
|
|
21370
|
-
avatar: props.hasImage ? { size: "md", shape: "square" } : false,
|
|
21371
|
-
rows: props.variant === "compact" ? 1 : 3,
|
|
21372
|
-
width: props.fullWidth ? "100%" : props.size === "sm" ? 200 : 320
|
|
21373
|
-
}),
|
|
21374
|
-
{ defaults: { rows: 2, avatar: false, width: 280 } }
|
|
21375
|
-
);
|
|
21376
|
-
registerSkeleton(Card, cardSkeleton);
|
|
21377
22560
|
var InputField = forwardRef(
|
|
21378
22561
|
({
|
|
21379
22562
|
id,
|
|
@@ -21676,7 +22859,7 @@ var defaultTypography = defineTypography({
|
|
|
21676
22859
|
},
|
|
21677
22860
|
sizeMd: {
|
|
21678
22861
|
fontFamily: "{fonts.body}",
|
|
21679
|
-
fontSize: "{fontSizes.
|
|
22862
|
+
fontSize: "{fontSizes.md}",
|
|
21680
22863
|
fontWeight: "{fontWeights.normal}",
|
|
21681
22864
|
lineHeight: "{lineHeights.normal}"
|
|
21682
22865
|
},
|
|
@@ -21701,8 +22884,7 @@ var defaultSizes = defineSizes({
|
|
|
21701
22884
|
fontSize: "{typography.sizeXs}",
|
|
21702
22885
|
gap: "0.25rem",
|
|
21703
22886
|
iconSize: "0.75rem",
|
|
21704
|
-
radius: "0.65rem"
|
|
21705
|
-
separatorSize: "15px"
|
|
22887
|
+
radius: "0.65rem"
|
|
21706
22888
|
},
|
|
21707
22889
|
sm: {
|
|
21708
22890
|
height: "2rem",
|
|
@@ -21711,8 +22893,7 @@ var defaultSizes = defineSizes({
|
|
|
21711
22893
|
fontSize: "{typography.sizeSm}",
|
|
21712
22894
|
gap: "0.375rem",
|
|
21713
22895
|
iconSize: "0.875rem",
|
|
21714
|
-
radius: "0.8rem"
|
|
21715
|
-
separatorSize: "20px"
|
|
22896
|
+
radius: "0.8rem"
|
|
21716
22897
|
},
|
|
21717
22898
|
md: {
|
|
21718
22899
|
height: "2.5rem",
|
|
@@ -21721,8 +22902,7 @@ var defaultSizes = defineSizes({
|
|
|
21721
22902
|
fontSize: "{typography.sizeMd}",
|
|
21722
22903
|
gap: "0.5rem",
|
|
21723
22904
|
iconSize: "1rem",
|
|
21724
|
-
radius: "1rem"
|
|
21725
|
-
separatorSize: "25px"
|
|
22905
|
+
radius: "1rem"
|
|
21726
22906
|
},
|
|
21727
22907
|
lg: {
|
|
21728
22908
|
height: "3rem",
|
|
@@ -21731,8 +22911,7 @@ var defaultSizes = defineSizes({
|
|
|
21731
22911
|
fontSize: "{typography.sizeLg}",
|
|
21732
22912
|
gap: "0.625rem",
|
|
21733
22913
|
iconSize: "1.25rem",
|
|
21734
|
-
radius: "1.15rem"
|
|
21735
|
-
separatorSize: "30px"
|
|
22914
|
+
radius: "1.15rem"
|
|
21736
22915
|
},
|
|
21737
22916
|
xl: {
|
|
21738
22917
|
height: "3.5rem",
|
|
@@ -21741,8 +22920,7 @@ var defaultSizes = defineSizes({
|
|
|
21741
22920
|
fontSize: "{typography.sizeXl}",
|
|
21742
22921
|
gap: "0.875rem",
|
|
21743
22922
|
iconSize: "1.5rem",
|
|
21744
|
-
radius: "1.3rem"
|
|
21745
|
-
separatorSize: "35px"
|
|
22923
|
+
radius: "1.3rem"
|
|
21746
22924
|
}
|
|
21747
22925
|
});
|
|
21748
22926
|
var buttonBase = "inline-flex items-center justify-center rounded-[var(--kui-button-radius,var(--kui-radius))] font-medium transition-[background-color,border-color,color,transform,opacity] duration-200 will-change-transform focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-kui-brand focus-visible:ring-offset-2 focus-visible:ring-offset-surface disabled:opacity-60 disabled:pointer-events-none disabled:active:scale-100";
|
|
@@ -21796,6 +22974,13 @@ var buttonColors = {
|
|
|
21796
22974
|
soft: "bg-white/10 text-white hover:bg-white/20",
|
|
21797
22975
|
link: "text-white"
|
|
21798
22976
|
},
|
|
22977
|
+
black: {
|
|
22978
|
+
solid: "bg-black text-white hover:bg-neutral-900 active:bg-neutral-950 shadow-sm",
|
|
22979
|
+
outline: "border border-black/80 text-black bg-transparent hover:bg-black hover:text-white active:bg-black/90",
|
|
22980
|
+
ghost: "text-black bg-transparent hover:bg-black/10 active:bg-black/15",
|
|
22981
|
+
soft: "bg-black/10 text-black hover:bg-black/15 active:bg-black/20",
|
|
22982
|
+
link: "text-black underline-offset-4 hover:underline"
|
|
22983
|
+
},
|
|
21799
22984
|
neutral: {
|
|
21800
22985
|
solid: "bg-kui-surface-raised text-kui-text hover:bg-kui-surface-sunken",
|
|
21801
22986
|
outline: "border-kui-border text-kui-text hover:bg-kui-surface-raised",
|
|
@@ -21839,7 +23024,11 @@ var buttonRecipe = defineRecipe({
|
|
|
21839
23024
|
});
|
|
21840
23025
|
var formControlBase = "group relative inline-flex items-center rounded-[var(--kui-radii-md)] transition-[border-color,box-shadow] duration-[var(--kui-duration-fast)] focus-within:outline-none ";
|
|
21841
23026
|
var formControlVariants = {
|
|
21842
|
-
outline:
|
|
23027
|
+
outline: {
|
|
23028
|
+
border: "1px solid rgb(var(--kui-border))",
|
|
23029
|
+
backgroundColor: "transparent",
|
|
23030
|
+
color: "rgb(var(--kui-text))"
|
|
23031
|
+
},
|
|
21843
23032
|
filled: "border border-transparent bg-kui-surface-raised text-kui-text",
|
|
21844
23033
|
ghost: "border border-transparent bg-transparent text-kui-text"
|
|
21845
23034
|
};
|
|
@@ -22208,7 +23397,7 @@ var switchRecipe = defineRecipe({
|
|
|
22208
23397
|
disabled: false
|
|
22209
23398
|
}
|
|
22210
23399
|
});
|
|
22211
|
-
var
|
|
23400
|
+
var containerRecipe = defineRecipe({
|
|
22212
23401
|
base: "w-full",
|
|
22213
23402
|
variants: {
|
|
22214
23403
|
maxWidth: {
|
|
@@ -22221,6 +23410,7 @@ var containerReccipe = defineRecipe({
|
|
|
22221
23410
|
}
|
|
22222
23411
|
},
|
|
22223
23412
|
defaultVariants: {
|
|
23413
|
+
size: "lg",
|
|
22224
23414
|
maxWidth: "lg"
|
|
22225
23415
|
}
|
|
22226
23416
|
});
|
|
@@ -22344,18 +23534,179 @@ var numberStepperButtonsRecipe = defineRecipe({
|
|
|
22344
23534
|
var numberStepperButtonRecipe = defineRecipe({
|
|
22345
23535
|
base: "kui-number-stepper__button"
|
|
22346
23536
|
});
|
|
23537
|
+
var cardRecipe = defineRecipe({
|
|
23538
|
+
base: "overflow-hidden rounded-(--kui-radii-lg)",
|
|
23539
|
+
variants: {
|
|
23540
|
+
variant: {
|
|
23541
|
+
solid: "bg-kui-surface",
|
|
23542
|
+
outline: "border border-kui-border bg-kui-surface",
|
|
23543
|
+
ghost: "bg-transparent",
|
|
23544
|
+
elevated: "bg-kui-surface shadow-md",
|
|
23545
|
+
compact: "bg-kui-surface"
|
|
23546
|
+
},
|
|
23547
|
+
fullWidth: {
|
|
23548
|
+
true: "w-full"
|
|
23549
|
+
}
|
|
23550
|
+
},
|
|
23551
|
+
defaultVariants: {
|
|
23552
|
+
variant: "outline"
|
|
23553
|
+
}
|
|
23554
|
+
});
|
|
23555
|
+
var sectionPaddingVariants = {
|
|
23556
|
+
size: {
|
|
23557
|
+
sm: "p-3",
|
|
23558
|
+
md: "p-4",
|
|
23559
|
+
lg: "p-6"
|
|
23560
|
+
}
|
|
23561
|
+
};
|
|
23562
|
+
var sectionPaddingCompoundVariants = [
|
|
23563
|
+
{
|
|
23564
|
+
conditions: { variant: "compact" },
|
|
23565
|
+
className: "p-3"
|
|
23566
|
+
},
|
|
23567
|
+
{
|
|
23568
|
+
conditions: { noPadding: true },
|
|
23569
|
+
className: "p-0"
|
|
23570
|
+
}
|
|
23571
|
+
];
|
|
23572
|
+
var cardHeaderRecipe = defineRecipe({
|
|
23573
|
+
base: "relative flex items-center justify-between gap-(--kui-spacing-md)",
|
|
23574
|
+
variants: sectionPaddingVariants,
|
|
23575
|
+
defaultVariants: {
|
|
23576
|
+
size: "md"
|
|
23577
|
+
},
|
|
23578
|
+
compoundVariants: [...sectionPaddingCompoundVariants]
|
|
23579
|
+
});
|
|
23580
|
+
var cardBodyRecipe = defineRecipe({
|
|
23581
|
+
base: "relative min-w-0",
|
|
23582
|
+
variants: sectionPaddingVariants,
|
|
23583
|
+
defaultVariants: {
|
|
23584
|
+
size: "md"
|
|
23585
|
+
},
|
|
23586
|
+
compoundVariants: [...sectionPaddingCompoundVariants]
|
|
23587
|
+
});
|
|
23588
|
+
var cardFooterRecipe = defineRecipe({
|
|
23589
|
+
base: "relative flex items-center gap-(--kui-spacing-md)",
|
|
23590
|
+
variants: sectionPaddingVariants,
|
|
23591
|
+
defaultVariants: {
|
|
23592
|
+
size: "md"
|
|
23593
|
+
},
|
|
23594
|
+
compoundVariants: [...sectionPaddingCompoundVariants]
|
|
23595
|
+
});
|
|
23596
|
+
var cardMediaRecipe = defineRecipe({
|
|
23597
|
+
base: "relative overflow-hidden"
|
|
23598
|
+
});
|
|
23599
|
+
defineRecipe({
|
|
23600
|
+
base: "h-full w-full",
|
|
23601
|
+
variants: {
|
|
23602
|
+
fit: {
|
|
23603
|
+
cover: "object-cover",
|
|
23604
|
+
contain: "object-contain",
|
|
23605
|
+
fill: "object-fill",
|
|
23606
|
+
none: "object-none"
|
|
23607
|
+
},
|
|
23608
|
+
blend: {
|
|
23609
|
+
normal: "mix-blend-normal",
|
|
23610
|
+
multiply: "mix-blend-multiply",
|
|
23611
|
+
screen: "mix-blend-screen",
|
|
23612
|
+
overlay: "mix-blend-overlay",
|
|
23613
|
+
darken: "mix-blend-darken",
|
|
23614
|
+
lighten: "mix-blend-lighten"
|
|
23615
|
+
}
|
|
23616
|
+
},
|
|
23617
|
+
defaultVariants: {
|
|
23618
|
+
fit: "cover",
|
|
23619
|
+
blend: "normal"
|
|
23620
|
+
}
|
|
23621
|
+
});
|
|
23622
|
+
var cardOverlayRecipe = defineRecipe({
|
|
23623
|
+
base: "absolute inset-0"
|
|
23624
|
+
});
|
|
23625
|
+
var scrollAreaRecipe = defineRecipe({
|
|
23626
|
+
base: "kui-scroll-area",
|
|
23627
|
+
variants: {
|
|
23628
|
+
direction: {
|
|
23629
|
+
vertical: "overflow-y-auto overflow-x-hidden",
|
|
23630
|
+
horizontal: "overflow-x-auto overflow-y-hidden",
|
|
23631
|
+
both: "overflow-auto"
|
|
23632
|
+
},
|
|
23633
|
+
showScrollbar: {
|
|
23634
|
+
auto: "",
|
|
23635
|
+
always: "kui-scrollbar",
|
|
23636
|
+
hover: "kui-scrollbar kui-scrollbar-hover-only",
|
|
23637
|
+
never: "kui-scrollbar-hidden"
|
|
23638
|
+
},
|
|
23639
|
+
scrollbarVariant: {
|
|
23640
|
+
thin: "kui-scrollbar",
|
|
23641
|
+
default: "kui-scrollbar-default-width"
|
|
23642
|
+
}
|
|
23643
|
+
},
|
|
23644
|
+
defaultVariants: {
|
|
23645
|
+
direction: "vertical",
|
|
23646
|
+
showScrollbar: "auto",
|
|
23647
|
+
scrollbarVariant: "thin"
|
|
23648
|
+
}
|
|
23649
|
+
});
|
|
23650
|
+
var boxRecipe = defineRecipe({
|
|
23651
|
+
base: "box-border",
|
|
23652
|
+
variants: {
|
|
23653
|
+
border: {
|
|
23654
|
+
true: "border border-solid border-kui-border",
|
|
23655
|
+
false: ""
|
|
23656
|
+
}
|
|
23657
|
+
},
|
|
23658
|
+
defaultVariants: {
|
|
23659
|
+
border: "false"
|
|
23660
|
+
}
|
|
23661
|
+
});
|
|
23662
|
+
var flexRecipe = defineRecipe({
|
|
23663
|
+
base: "",
|
|
23664
|
+
variants: {
|
|
23665
|
+
inline: {
|
|
23666
|
+
true: "inline-flex",
|
|
23667
|
+
false: "flex"
|
|
23668
|
+
},
|
|
23669
|
+
fullWidth: {
|
|
23670
|
+
true: "w-full",
|
|
23671
|
+
false: ""
|
|
23672
|
+
},
|
|
23673
|
+
fullHeight: {
|
|
23674
|
+
true: "h-full",
|
|
23675
|
+
false: ""
|
|
23676
|
+
}
|
|
23677
|
+
},
|
|
23678
|
+
defaultVariants: {
|
|
23679
|
+
inline: "false",
|
|
23680
|
+
fullWidth: "false",
|
|
23681
|
+
fullHeight: "false"
|
|
23682
|
+
}
|
|
23683
|
+
});
|
|
23684
|
+
var gridRecipe = defineRecipe({
|
|
23685
|
+
base: "",
|
|
23686
|
+
variants: {
|
|
23687
|
+
inline: {
|
|
23688
|
+
true: "inline-grid",
|
|
23689
|
+
false: "grid"
|
|
23690
|
+
}
|
|
23691
|
+
},
|
|
23692
|
+
defaultVariants: {
|
|
23693
|
+
inline: "false"
|
|
23694
|
+
}
|
|
23695
|
+
});
|
|
22347
23696
|
|
|
22348
23697
|
// src/theme/defaults/theme.ts
|
|
22349
23698
|
var defaultRecipes = {
|
|
23699
|
+
Box: boxRecipe,
|
|
22350
23700
|
Button: buttonRecipe,
|
|
23701
|
+
ButtonGroup: buttonGroupRecipe,
|
|
23702
|
+
Checkbox: checkboxRecipe,
|
|
23703
|
+
Flex: flexRecipe,
|
|
22351
23704
|
FormControl: formControlRecipe,
|
|
22352
23705
|
Input: inputRecipe,
|
|
22353
23706
|
Textarea: textareaRecipe,
|
|
22354
23707
|
MarkdownEditor: markdownEditorRecipe,
|
|
22355
|
-
Checkbox: checkboxRecipe,
|
|
22356
|
-
ButtonGroup: buttonGroupRecipe,
|
|
22357
23708
|
Switch: switchRecipe,
|
|
22358
|
-
Container:
|
|
23709
|
+
Container: containerRecipe,
|
|
22359
23710
|
Link: linkRecipe,
|
|
22360
23711
|
RepeaterRemove: repeaterRemoveRecipe,
|
|
22361
23712
|
RepeaterMoveUp: repeaterMoveUpRecipe,
|
|
@@ -22365,7 +23716,15 @@ var defaultRecipes = {
|
|
|
22365
23716
|
RepeaterItems: repeaterItemsRecipe,
|
|
22366
23717
|
NumberStepper: numberStepperRecipe,
|
|
22367
23718
|
NumberStepperButton: numberStepperButtonRecipe,
|
|
22368
|
-
NumberStepperButtons: numberStepperButtonsRecipe
|
|
23719
|
+
NumberStepperButtons: numberStepperButtonsRecipe,
|
|
23720
|
+
CardBody: cardBodyRecipe,
|
|
23721
|
+
CardFooter: cardFooterRecipe,
|
|
23722
|
+
CardHeader: cardHeaderRecipe,
|
|
23723
|
+
CardMedia: cardMediaRecipe,
|
|
23724
|
+
CardOverlay: cardOverlayRecipe,
|
|
23725
|
+
Card: cardRecipe,
|
|
23726
|
+
ScrollArea: scrollAreaRecipe,
|
|
23727
|
+
Grid: gridRecipe
|
|
22369
23728
|
};
|
|
22370
23729
|
var defaultTheme = defineTheme({
|
|
22371
23730
|
tokens: defaultTokens,
|
|
@@ -22492,7 +23851,9 @@ function KreativUIProvider({
|
|
|
22492
23851
|
as = "div",
|
|
22493
23852
|
fallbackSize = "md",
|
|
22494
23853
|
textColor,
|
|
22495
|
-
background
|
|
23854
|
+
background,
|
|
23855
|
+
style,
|
|
23856
|
+
className
|
|
22496
23857
|
}) {
|
|
22497
23858
|
const [mode, setMode] = useState(defaultMode);
|
|
22498
23859
|
const systemPrefersDark = useSystemPrefersDark();
|
|
@@ -22529,11 +23890,12 @@ function KreativUIProvider({
|
|
|
22529
23890
|
Tag,
|
|
22530
23891
|
{
|
|
22531
23892
|
"data-kreativ-theme": resolvedMode,
|
|
22532
|
-
className: resolvedMode === "dark" ? "dark" : void 0,
|
|
23893
|
+
className: [resolvedMode === "dark" ? "dark" : void 0, className].filter(Boolean).join(" "),
|
|
22533
23894
|
style: {
|
|
22534
23895
|
...cssVars,
|
|
22535
23896
|
...background && { background },
|
|
22536
|
-
...textColor && { color: textColor }
|
|
23897
|
+
...textColor && { color: textColor },
|
|
23898
|
+
...style
|
|
22537
23899
|
},
|
|
22538
23900
|
children
|
|
22539
23901
|
}
|
|
@@ -22544,6 +23906,6 @@ __name(KreativUIProvider, "KreativUIProvider");
|
|
|
22544
23906
|
// src/index.ts
|
|
22545
23907
|
__reExport(index_exports, hooks_exports);
|
|
22546
23908
|
|
|
22547
|
-
export { Adornment, Button, ButtonGroup, ButtonGroupContext, ButtonGroupItemContext, Card, Checkbox, Combobox, ComboboxContent, ComboboxInput, ComboboxItem, Container, Flex, Form, FormField, FormFieldControl, FormFieldDescription, FormFieldLabel, FormFieldMessage, FormResetButton, FormSubmitButton, Grid, Input, InputField, KreativUIProvider, MarkdownEditor, MultiSelect, MultiSelectContent, MultiSelectItem, MultiSelectTrigger, Radio, RadioGroup, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectRoot, SelectTrigger, SelectValue, Stack, Switch, Textarea, ThemeToggler,
|
|
23909
|
+
export { Adornment, Box, Button, ButtonGroup, ButtonGroupContext, ButtonGroupItemContext, Card, CardOverlay, Checkbox, Combobox, ComboboxContent, ComboboxInput, ComboboxItem, Container, Flex, Form, FormField, FormFieldControl, FormFieldDescription, FormFieldLabel, FormFieldMessage, FormResetButton, FormSubmitButton, Grid, Input, InputField, KreativUIProvider, MarkdownEditor, MultiSelect, MultiSelectContent, MultiSelectItem, MultiSelectTrigger, Radio, RadioGroup, ScrollArea, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectRoot, SelectTrigger, SelectValue, Stack, Switch, Textarea, ThemeToggler, cn, defineUIField, extendRecipe, extendRecipes, extendSemanticTokens, extendTheme, extendTokens, extendTypography, getRecipeNames, hexToRgbString, rgbToHex, useButtonGroupContext, useButtonGroupItemContext, useClearableField, useElementScrollProgress, useFloatingSide, useFormContext, useKeyboardShortcuts, useOptionalButtonGroupContext, useOptionalButtonGroupItemContext, useScrollProgress, useStatusTransition };
|
|
22548
23910
|
//# sourceMappingURL=index.js.map
|
|
22549
23911
|
//# sourceMappingURL=index.js.map
|