@splenddev/kreativ-ui 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2111 -738
- 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 +2138 -773
- 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",
|
|
@@ -14410,21 +14471,21 @@ var allProcessors = {
|
|
|
14410
14471
|
};
|
|
14411
14472
|
function toJSONSchema(input, params) {
|
|
14412
14473
|
if ("_idmap" in input) {
|
|
14413
|
-
const
|
|
14474
|
+
const registry2 = input;
|
|
14414
14475
|
const ctx2 = initializeContext({ ...params, processors: allProcessors });
|
|
14415
14476
|
const defs = {};
|
|
14416
|
-
for (const entry of
|
|
14477
|
+
for (const entry of registry2._idmap.entries()) {
|
|
14417
14478
|
const [_, schema] = entry;
|
|
14418
14479
|
process2(schema, ctx2);
|
|
14419
14480
|
}
|
|
14420
14481
|
const schemas = {};
|
|
14421
14482
|
const external = {
|
|
14422
|
-
registry:
|
|
14483
|
+
registry: registry2,
|
|
14423
14484
|
uri: params?.uri,
|
|
14424
14485
|
defs
|
|
14425
14486
|
};
|
|
14426
14487
|
ctx2.external = external;
|
|
14427
|
-
for (const entry of
|
|
14488
|
+
for (const entry of registry2._idmap.entries()) {
|
|
14428
14489
|
const [key, schema] = entry;
|
|
14429
14490
|
extractDefs(ctx2, schema);
|
|
14430
14491
|
schemas[key] = finalize(ctx2, schema);
|
|
@@ -16866,7 +16927,7 @@ function useSelectContext(componentName) {
|
|
|
16866
16927
|
}
|
|
16867
16928
|
__name(useSelectContext, "useSelectContext");
|
|
16868
16929
|
var SelectGroupContext = createContext(null);
|
|
16869
|
-
var SelectRoot = createComponent
|
|
16930
|
+
var SelectRoot = createComponent({
|
|
16870
16931
|
displayName: "Select.Root",
|
|
16871
16932
|
__kui: {
|
|
16872
16933
|
role: "formControl",
|
|
@@ -17345,7 +17406,7 @@ function SelectLabel({ children, className }) {
|
|
|
17345
17406
|
return /* @__PURE__ */ jsx("div", { id, className: cn("px-2.5 py-1.5 font-mono text-[11px] text-kui-text-muted", className), children });
|
|
17346
17407
|
}
|
|
17347
17408
|
__name(SelectLabel, "SelectLabel");
|
|
17348
|
-
function SelectImpl({ options, children, ...rootProps }, ref) {
|
|
17409
|
+
function SelectImpl({ options, children, label, ...rootProps }, ref) {
|
|
17349
17410
|
const childArray = React2.Children.toArray(children);
|
|
17350
17411
|
const compound = childArray.length > 0;
|
|
17351
17412
|
if (isDev() && compound && options?.length) {
|
|
@@ -17354,6 +17415,7 @@ function SelectImpl({ options, children, ...rootProps }, ref) {
|
|
|
17354
17415
|
);
|
|
17355
17416
|
}
|
|
17356
17417
|
return /* @__PURE__ */ jsx(SelectRoot, { ...rootProps, ref, children: compound ? children : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
17418
|
+
label && /* @__PURE__ */ jsx(Select.Label, { children: label }),
|
|
17357
17419
|
/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
17358
17420
|
/* @__PURE__ */ jsx(SelectContent, { children: options?.map((option) => /* @__PURE__ */ jsx(
|
|
17359
17421
|
SelectItem,
|
|
@@ -17386,7 +17448,7 @@ var switchThumbConfig = {
|
|
|
17386
17448
|
md: { thumb: "h-4 w-4", translate: "translate-x-4" },
|
|
17387
17449
|
lg: { thumb: "h-5 w-5", translate: "translate-x-5" }
|
|
17388
17450
|
};
|
|
17389
|
-
var Switch = createComponent
|
|
17451
|
+
var Switch = createComponent({
|
|
17390
17452
|
displayName: "Switch",
|
|
17391
17453
|
__kui: {
|
|
17392
17454
|
role: "formControl",
|
|
@@ -17853,362 +17915,68 @@ var TextareaCore = forwardRef(
|
|
|
17853
17915
|
}
|
|
17854
17916
|
);
|
|
17855
17917
|
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")
|
|
17918
|
+
var Textarea = createComponent({
|
|
17919
|
+
displayName: "Textarea",
|
|
17920
|
+
__kui: {
|
|
17921
|
+
role: "formControl",
|
|
17922
|
+
formControl: "single",
|
|
17923
|
+
supports: { disabled: true, invalid: true, required: true },
|
|
17924
|
+
skeleton: "input-shaped",
|
|
17925
|
+
video: {
|
|
17926
|
+
id: "textarea",
|
|
17927
|
+
safe: true,
|
|
17928
|
+
acceptsChildren: false,
|
|
17929
|
+
interactionStates: ["focus"],
|
|
17930
|
+
controlled: ["value", "disabled"],
|
|
17931
|
+
motionGated: true
|
|
17932
|
+
}
|
|
17960
17933
|
},
|
|
17961
|
-
{
|
|
17962
|
-
|
|
17963
|
-
|
|
17964
|
-
|
|
17934
|
+
render: /* @__PURE__ */ __name((props, ref) => {
|
|
17935
|
+
return /* @__PURE__ */ jsx(TextareaCore, { ref, ...props });
|
|
17936
|
+
}, "render")
|
|
17937
|
+
});
|
|
17938
|
+
var Checkbox = createComponent({
|
|
17939
|
+
displayName: "Checkbox",
|
|
17940
|
+
__kui: {
|
|
17941
|
+
role: "formControl",
|
|
17942
|
+
formControl: "single",
|
|
17943
|
+
supports: { disabled: true, invalid: true, required: true },
|
|
17944
|
+
skeleton: "input-shaped",
|
|
17945
|
+
video: {
|
|
17946
|
+
id: "checkbox",
|
|
17947
|
+
safe: true,
|
|
17948
|
+
acceptsChildren: false,
|
|
17949
|
+
interactionStates: ["focus"],
|
|
17950
|
+
controlled: ["checked", "disabled", "indeterminate"],
|
|
17951
|
+
motionGated: true
|
|
17952
|
+
}
|
|
17965
17953
|
},
|
|
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,
|
|
17954
|
+
render: /* @__PURE__ */ __name(({
|
|
17979
17955
|
className,
|
|
17980
|
-
|
|
17981
|
-
|
|
17982
|
-
|
|
17956
|
+
checked: checkedProp,
|
|
17957
|
+
defaultChecked,
|
|
17958
|
+
onCheckedChange,
|
|
17959
|
+
indeterminate = false,
|
|
17960
|
+
size = "sm",
|
|
17983
17961
|
error: error51,
|
|
17984
|
-
|
|
17962
|
+
success: success2,
|
|
17963
|
+
status,
|
|
17985
17964
|
disabled,
|
|
17986
|
-
|
|
17987
|
-
|
|
17965
|
+
label,
|
|
17966
|
+
description,
|
|
17967
|
+
id: externalId,
|
|
17968
|
+
onChange: onChangeProp,
|
|
17969
|
+
required: required2,
|
|
17970
|
+
...props
|
|
17988
17971
|
}, 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();
|
|
17972
|
+
const autoId = useId();
|
|
17996
17973
|
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
|
|
17974
|
+
const { theme } = useTheme();
|
|
17975
|
+
const id = field?.id ?? externalId ?? autoId;
|
|
17976
|
+
const isDisabled = disabled || Boolean(field?.disabled);
|
|
17977
|
+
const inputRef = useRef(null);
|
|
17978
|
+
const [internalChecked, setInternalChecked] = useState(
|
|
17979
|
+
defaultChecked ?? false
|
|
18212
17980
|
);
|
|
18213
17981
|
const isControlled = checkedProp !== void 0;
|
|
18214
17982
|
const checked = isControlled ? checkedProp : internalChecked;
|
|
@@ -18389,7 +18157,7 @@ function formatValue(value, precision) {
|
|
|
18389
18157
|
return precision !== void 0 ? value.toFixed(precision) : String(value);
|
|
18390
18158
|
}
|
|
18391
18159
|
__name(formatValue, "formatValue");
|
|
18392
|
-
var NumberStepper = createComponent
|
|
18160
|
+
var NumberStepper = createComponent({
|
|
18393
18161
|
__kui: {
|
|
18394
18162
|
formControl: "single",
|
|
18395
18163
|
role: "formControl",
|
|
@@ -18964,7 +18732,7 @@ function RepeaterRoot({
|
|
|
18964
18732
|
return /* @__PURE__ */ jsx(RepeaterRootContext.Provider, { value: contextValue, children });
|
|
18965
18733
|
}
|
|
18966
18734
|
__name(RepeaterRoot, "RepeaterRoot");
|
|
18967
|
-
var RepeaterItems = createComponent
|
|
18735
|
+
var RepeaterItems = createComponent({
|
|
18968
18736
|
displayName: "Repeater.Items",
|
|
18969
18737
|
__kui: {
|
|
18970
18738
|
role: "layout",
|
|
@@ -19025,7 +18793,7 @@ function useFlipAnimation(ref, deps) {
|
|
|
19025
18793
|
}, []);
|
|
19026
18794
|
}
|
|
19027
18795
|
__name(useFlipAnimation, "useFlipAnimation");
|
|
19028
|
-
var RepeaterItem = createComponent
|
|
18796
|
+
var RepeaterItem = createComponent({
|
|
19029
18797
|
displayName: "Repeater.Item",
|
|
19030
18798
|
__kui: {
|
|
19031
18799
|
role: "layout",
|
|
@@ -19053,7 +18821,7 @@ var RepeaterItem = createComponent$1({
|
|
|
19053
18821
|
return /* @__PURE__ */ jsx(RepeaterItemContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx("div", { ref: composedRef, className: classes, ...rest, children }) });
|
|
19054
18822
|
}, "RepeaterItem")
|
|
19055
18823
|
});
|
|
19056
|
-
var RepeaterRemove = createComponent
|
|
18824
|
+
var RepeaterRemove = createComponent({
|
|
19057
18825
|
displayName: "Repeater.Remove",
|
|
19058
18826
|
__kui: {
|
|
19059
18827
|
role: "action",
|
|
@@ -19090,7 +18858,7 @@ var RepeaterRemove = createComponent$1({
|
|
|
19090
18858
|
);
|
|
19091
18859
|
}, "RepeaterRemove")
|
|
19092
18860
|
});
|
|
19093
|
-
var RepeaterMoveUp = createComponent
|
|
18861
|
+
var RepeaterMoveUp = createComponent({
|
|
19094
18862
|
displayName: "Repeater.MoveUp",
|
|
19095
18863
|
__kui: {
|
|
19096
18864
|
role: "action",
|
|
@@ -19129,7 +18897,7 @@ var RepeaterMoveUp = createComponent$1({
|
|
|
19129
18897
|
);
|
|
19130
18898
|
}, "RepeaterMoveUp")
|
|
19131
18899
|
});
|
|
19132
|
-
var RepeaterMoveDown = createComponent
|
|
18900
|
+
var RepeaterMoveDown = createComponent({
|
|
19133
18901
|
displayName: "Repeater.MoveDown",
|
|
19134
18902
|
__kui: {
|
|
19135
18903
|
role: "action",
|
|
@@ -19168,7 +18936,7 @@ var RepeaterMoveDown = createComponent$1({
|
|
|
19168
18936
|
);
|
|
19169
18937
|
}, "RepeaterMoveDown")
|
|
19170
18938
|
});
|
|
19171
|
-
var RepeaterAdd = createComponent
|
|
18939
|
+
var RepeaterAdd = createComponent({
|
|
19172
18940
|
displayName: "Repeater.Add",
|
|
19173
18941
|
__kui: {
|
|
19174
18942
|
role: "action",
|
|
@@ -19665,7 +19433,7 @@ function countMessageComponents(children) {
|
|
|
19665
19433
|
return count;
|
|
19666
19434
|
}
|
|
19667
19435
|
__name(countMessageComponents, "countMessageComponents");
|
|
19668
|
-
var FormFieldRoot = createComponent
|
|
19436
|
+
var FormFieldRoot = createComponent({
|
|
19669
19437
|
displayName: "FormField.Root",
|
|
19670
19438
|
__kui: {
|
|
19671
19439
|
role: "formControl",
|
|
@@ -19790,7 +19558,7 @@ var FormFieldRoot = createComponent$1({
|
|
|
19790
19558
|
] }) });
|
|
19791
19559
|
}, "render")
|
|
19792
19560
|
});
|
|
19793
|
-
var FormFieldLabel = createComponent
|
|
19561
|
+
var FormFieldLabel = createComponent({
|
|
19794
19562
|
displayName: "FormField.Label",
|
|
19795
19563
|
__kui: {
|
|
19796
19564
|
role: "display",
|
|
@@ -19833,7 +19601,7 @@ var FormFieldLabel = createComponent$1({
|
|
|
19833
19601
|
);
|
|
19834
19602
|
}, "render")
|
|
19835
19603
|
});
|
|
19836
|
-
var FormFieldDescription = createComponent
|
|
19604
|
+
var FormFieldDescription = createComponent({
|
|
19837
19605
|
displayName: "FormField.Description",
|
|
19838
19606
|
__kui: {
|
|
19839
19607
|
role: "display",
|
|
@@ -19876,7 +19644,7 @@ function sameValidity(prev, next) {
|
|
|
19876
19644
|
return prev === null && next === null || prev?.invalid === next?.invalid && prev?.message === next?.message;
|
|
19877
19645
|
}
|
|
19878
19646
|
__name(sameValidity, "sameValidity");
|
|
19879
|
-
var FormFieldControl = createComponent
|
|
19647
|
+
var FormFieldControl = createComponent(
|
|
19880
19648
|
{
|
|
19881
19649
|
displayName: "FormField.Control",
|
|
19882
19650
|
__kui: {
|
|
@@ -20071,80 +19839,418 @@ var FormField = Object.assign(FormFieldForwardRef, {
|
|
|
20071
19839
|
Message: FormFieldMessage,
|
|
20072
19840
|
Control: FormFieldControl
|
|
20073
19841
|
});
|
|
20074
|
-
|
|
20075
|
-
|
|
20076
|
-
|
|
20077
|
-
|
|
20078
|
-
|
|
20079
|
-
|
|
20080
|
-
return
|
|
19842
|
+
|
|
19843
|
+
// src/components/forms/MarkdownEditor/markdownActions.ts
|
|
19844
|
+
function lineBounds(value, index) {
|
|
19845
|
+
const start = value.lastIndexOf("\n", index - 1) + 1;
|
|
19846
|
+
const nextBreak = value.indexOf("\n", index);
|
|
19847
|
+
const end = nextBreak === -1 ? value.length : nextBreak;
|
|
19848
|
+
return { start, end };
|
|
20081
19849
|
}
|
|
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
|
-
);
|
|
19850
|
+
__name(lineBounds, "lineBounds");
|
|
19851
|
+
function selectedLineRange(value, start, end) {
|
|
19852
|
+
const first = lineBounds(value, start);
|
|
19853
|
+
const last = lineBounds(value, Math.max(end - 1, start));
|
|
19854
|
+
return { from: first.start, to: last.end };
|
|
20143
19855
|
}
|
|
20144
|
-
__name(
|
|
20145
|
-
|
|
20146
|
-
|
|
20147
|
-
|
|
19856
|
+
__name(selectedLineRange, "selectedLineRange");
|
|
19857
|
+
function toggleWrap(value, start, end, marker) {
|
|
19858
|
+
const before = value.slice(Math.max(0, start - marker.length), start);
|
|
19859
|
+
const after = value.slice(end, end + marker.length);
|
|
19860
|
+
if (before === marker && after === marker) {
|
|
19861
|
+
const next2 = value.slice(0, start - marker.length) + value.slice(start, end) + value.slice(end + marker.length);
|
|
19862
|
+
return {
|
|
19863
|
+
value: next2,
|
|
19864
|
+
selectionStart: start - marker.length,
|
|
19865
|
+
selectionEnd: end - marker.length
|
|
19866
|
+
};
|
|
19867
|
+
}
|
|
19868
|
+
const selected = value.slice(start, end);
|
|
19869
|
+
const next = value.slice(0, start) + marker + selected + marker + value.slice(end);
|
|
19870
|
+
return selected.length === 0 ? {
|
|
19871
|
+
value: next,
|
|
19872
|
+
selectionStart: start + marker.length,
|
|
19873
|
+
selectionEnd: start + marker.length
|
|
19874
|
+
} : {
|
|
19875
|
+
value: next,
|
|
19876
|
+
selectionStart: start,
|
|
19877
|
+
selectionEnd: end + marker.length * 2
|
|
19878
|
+
};
|
|
19879
|
+
}
|
|
19880
|
+
__name(toggleWrap, "toggleWrap");
|
|
19881
|
+
function toggleLinePrefix(value, start, end, prefix) {
|
|
19882
|
+
const { from, to } = selectedLineRange(value, start, end);
|
|
19883
|
+
const line = value.slice(from, to);
|
|
19884
|
+
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);
|
|
19885
|
+
const delta = (line.startsWith(prefix) ? -1 : 1) * prefix.length;
|
|
19886
|
+
return {
|
|
19887
|
+
value: next,
|
|
19888
|
+
selectionStart: start + delta,
|
|
19889
|
+
selectionEnd: end + delta
|
|
19890
|
+
};
|
|
19891
|
+
}
|
|
19892
|
+
__name(toggleLinePrefix, "toggleLinePrefix");
|
|
19893
|
+
function toggleListPrefix(value, start, end, makePrefix) {
|
|
19894
|
+
const { from, to } = selectedLineRange(value, start, end);
|
|
19895
|
+
const block = value.slice(from, to);
|
|
19896
|
+
const lines = block.split("\n");
|
|
19897
|
+
const alreadyListed = lines.every(
|
|
19898
|
+
(l) => l.startsWith(makePrefix(0)) || /^\d+\.\s/.test(l)
|
|
19899
|
+
);
|
|
19900
|
+
const nextLines = lines.map(
|
|
19901
|
+
(l, i) => alreadyListed ? l.replace(/^(\d+\.\s|-\s\[ \]\s|-\s)/, "") : makePrefix(i) + l
|
|
19902
|
+
);
|
|
19903
|
+
const next = value.slice(0, from) + nextLines.join("\n") + value.slice(to);
|
|
19904
|
+
const delta = nextLines.join("\n").length - block.length;
|
|
19905
|
+
return { value: next, selectionStart: from, selectionEnd: to + delta };
|
|
19906
|
+
}
|
|
19907
|
+
__name(toggleListPrefix, "toggleListPrefix");
|
|
19908
|
+
function toggleCode(value, start, end) {
|
|
19909
|
+
const selected = value.slice(start, end);
|
|
19910
|
+
if (selected.includes("\n")) {
|
|
19911
|
+
const next = value.slice(0, start) + "```\n" + selected + "\n```" + value.slice(end);
|
|
19912
|
+
return { value: next, selectionStart: start + 4, selectionEnd: end + 4 };
|
|
19913
|
+
}
|
|
19914
|
+
return toggleWrap(value, start, end, "`");
|
|
19915
|
+
}
|
|
19916
|
+
__name(toggleCode, "toggleCode");
|
|
19917
|
+
function insertLink(value, start, end) {
|
|
19918
|
+
const selected = value.slice(start, end);
|
|
19919
|
+
const label = selected || "text";
|
|
19920
|
+
const snippet = `[${label}](url)`;
|
|
19921
|
+
const next = value.slice(0, start) + snippet + value.slice(end);
|
|
19922
|
+
const urlStart = start + label.length + 3;
|
|
19923
|
+
return { value: next, selectionStart: urlStart, selectionEnd: urlStart + 3 };
|
|
19924
|
+
}
|
|
19925
|
+
__name(insertLink, "insertLink");
|
|
19926
|
+
var TOOLBAR = [
|
|
19927
|
+
{
|
|
19928
|
+
label: "Heading",
|
|
19929
|
+
icon: Heading,
|
|
19930
|
+
action: /* @__PURE__ */ __name((v, s, e) => toggleLinePrefix(v, s, e, "### "), "action")
|
|
19931
|
+
},
|
|
19932
|
+
{
|
|
19933
|
+
label: "Bold",
|
|
19934
|
+
icon: Bold,
|
|
19935
|
+
action: /* @__PURE__ */ __name((v, s, e) => toggleWrap(v, s, e, "**"), "action"),
|
|
19936
|
+
shortcutKey: "b"
|
|
19937
|
+
},
|
|
19938
|
+
{
|
|
19939
|
+
label: "Italic",
|
|
19940
|
+
icon: Italic,
|
|
19941
|
+
action: /* @__PURE__ */ __name((v, s, e) => toggleWrap(v, s, e, "_"), "action"),
|
|
19942
|
+
shortcutKey: "i"
|
|
19943
|
+
},
|
|
19944
|
+
{
|
|
19945
|
+
label: "Strikethrough",
|
|
19946
|
+
icon: Strikethrough,
|
|
19947
|
+
action: /* @__PURE__ */ __name((v, s, e) => toggleWrap(v, s, e, "~~"), "action")
|
|
19948
|
+
},
|
|
19949
|
+
{
|
|
19950
|
+
label: "Quote",
|
|
19951
|
+
icon: Quote,
|
|
19952
|
+
action: /* @__PURE__ */ __name((v, s, e) => toggleLinePrefix(v, s, e, "> "), "action")
|
|
19953
|
+
},
|
|
19954
|
+
{
|
|
19955
|
+
label: "Ordered list",
|
|
19956
|
+
icon: ListOrdered,
|
|
19957
|
+
action: /* @__PURE__ */ __name((v, s, e) => toggleListPrefix(v, s, e, (i) => `${i + 1}. `), "action")
|
|
19958
|
+
},
|
|
19959
|
+
{
|
|
19960
|
+
label: "Checklist",
|
|
19961
|
+
icon: ClipboardList,
|
|
19962
|
+
action: /* @__PURE__ */ __name((v, s, e) => toggleListPrefix(v, s, e, () => "- [ ] "), "action")
|
|
19963
|
+
},
|
|
19964
|
+
{ label: "Code", icon: Code, action: toggleCode },
|
|
19965
|
+
{ label: "Link", icon: Link, action: insertLink, shortcutKey: "k" }
|
|
19966
|
+
];
|
|
19967
|
+
var SHORTCUT_MAP = new Map(
|
|
19968
|
+
TOOLBAR.filter((item) => item.shortcutKey).map((item) => [
|
|
19969
|
+
item.shortcutKey,
|
|
19970
|
+
item
|
|
19971
|
+
])
|
|
19972
|
+
);
|
|
19973
|
+
var isMac = typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform);
|
|
19974
|
+
var modLabel = isMac ? "\u2318" : "Ctrl";
|
|
19975
|
+
function shortcutHint(item) {
|
|
19976
|
+
if (!item.shortcutKey) return item.label;
|
|
19977
|
+
return `${item.label} (${modLabel}+${item.shortcutKey.toUpperCase()})`;
|
|
19978
|
+
}
|
|
19979
|
+
__name(shortcutHint, "shortcutHint");
|
|
19980
|
+
var MarkdownEditor = createComponent({
|
|
19981
|
+
displayName: "MarkdownEditor",
|
|
19982
|
+
__kui: {
|
|
19983
|
+
role: "formControl",
|
|
19984
|
+
formControl: "single",
|
|
19985
|
+
supports: { disabled: true, invalid: true, required: true },
|
|
19986
|
+
skeleton: "input-shaped",
|
|
19987
|
+
video: {
|
|
19988
|
+
id: "markdown-editor",
|
|
19989
|
+
safe: true,
|
|
19990
|
+
acceptsChildren: false,
|
|
19991
|
+
interactionStates: ["focus"],
|
|
19992
|
+
controlled: ["value", "disabled"],
|
|
19993
|
+
motionGated: true
|
|
19994
|
+
}
|
|
19995
|
+
},
|
|
19996
|
+
render: /* @__PURE__ */ __name(({
|
|
19997
|
+
renderMarkdown,
|
|
19998
|
+
tab: tabProp,
|
|
19999
|
+
defaultTab = "write",
|
|
20000
|
+
onTabChange,
|
|
20001
|
+
hint = "Markdown is supported",
|
|
20002
|
+
value: valueProp,
|
|
20003
|
+
defaultValue,
|
|
20004
|
+
onValueChange,
|
|
20005
|
+
className,
|
|
20006
|
+
fullWidth,
|
|
20007
|
+
variant = "outline",
|
|
20008
|
+
success: success2,
|
|
20009
|
+
error: error51,
|
|
20010
|
+
warning,
|
|
20011
|
+
disabled,
|
|
20012
|
+
maxLength,
|
|
20013
|
+
...textareaProps
|
|
20014
|
+
}, ref) => {
|
|
20015
|
+
const baseId = useId();
|
|
20016
|
+
const textareaRef = useRef(null);
|
|
20017
|
+
const { theme } = useTheme();
|
|
20018
|
+
const field = useOptionalFormField();
|
|
20019
|
+
const motionGated = isMotionGated$1(textareaProps);
|
|
20020
|
+
const isDisabled = disabled || Boolean(field?.disabled);
|
|
20021
|
+
const [uncontrolledTab, setUncontrolledTab] = useState(
|
|
20022
|
+
defaultTab
|
|
20023
|
+
);
|
|
20024
|
+
const tab = tabProp ?? uncontrolledTab;
|
|
20025
|
+
const footerMessage = hint;
|
|
20026
|
+
const [draft, setDraft] = useState(() => valueProp ?? defaultValue ?? "");
|
|
20027
|
+
const value = valueProp ?? draft;
|
|
20028
|
+
const maxLengthReached = typeof maxLength === "number" && value.length >= maxLength;
|
|
20029
|
+
const state = error51 || maxLengthReached ? "error" : success2 ? "success" : warning ? "warning" : field?.status ?? "none";
|
|
20030
|
+
const editorClasses = cn(
|
|
20031
|
+
resolveRecipe(theme.recipes.MarkdownEditor, {
|
|
20032
|
+
variant,
|
|
20033
|
+
state,
|
|
20034
|
+
fullWidth,
|
|
20035
|
+
disabled: isDisabled
|
|
20036
|
+
}),
|
|
20037
|
+
className
|
|
20038
|
+
);
|
|
20039
|
+
function setTab(next) {
|
|
20040
|
+
if (tabProp === void 0) setUncontrolledTab(next);
|
|
20041
|
+
onTabChange?.(next);
|
|
20042
|
+
}
|
|
20043
|
+
__name(setTab, "setTab");
|
|
20044
|
+
function commit(next) {
|
|
20045
|
+
setDraft(next);
|
|
20046
|
+
onValueChange?.(next);
|
|
20047
|
+
}
|
|
20048
|
+
__name(commit, "commit");
|
|
20049
|
+
function runAction(action) {
|
|
20050
|
+
if (isDisabled) return;
|
|
20051
|
+
const el = textareaRef.current;
|
|
20052
|
+
if (!el) return;
|
|
20053
|
+
const { selectionStart, selectionEnd } = el;
|
|
20054
|
+
const edit = action(
|
|
20055
|
+
value,
|
|
20056
|
+
selectionStart ?? value.length,
|
|
20057
|
+
selectionEnd ?? value.length
|
|
20058
|
+
);
|
|
20059
|
+
commit(edit.value);
|
|
20060
|
+
el.focus();
|
|
20061
|
+
const place = /* @__PURE__ */ __name(() => {
|
|
20062
|
+
el.setSelectionRange(edit.selectionStart, edit.selectionEnd);
|
|
20063
|
+
}, "place");
|
|
20064
|
+
if (motionGated) place();
|
|
20065
|
+
else requestAnimationFrame(place);
|
|
20066
|
+
}
|
|
20067
|
+
__name(runAction, "runAction");
|
|
20068
|
+
function handleToolbarKeyDown(event) {
|
|
20069
|
+
if (isDisabled) return;
|
|
20070
|
+
if (event.nativeEvent.isComposing) return;
|
|
20071
|
+
const mod = isMac ? event.metaKey : event.ctrlKey;
|
|
20072
|
+
if (!mod || event.altKey) return;
|
|
20073
|
+
const key = event.key.toLowerCase();
|
|
20074
|
+
const item = SHORTCUT_MAP.get(key);
|
|
20075
|
+
if (!item) return;
|
|
20076
|
+
event.preventDefault();
|
|
20077
|
+
runAction(item.action);
|
|
20078
|
+
}
|
|
20079
|
+
__name(handleToolbarKeyDown, "handleToolbarKeyDown");
|
|
20080
|
+
const writePanelId = `${baseId}-write-panel`;
|
|
20081
|
+
const previewPanelId = `${baseId}-preview-panel`;
|
|
20082
|
+
const renderedPreview = useMemo(
|
|
20083
|
+
() => renderMarkdown ? renderMarkdown(value) : null,
|
|
20084
|
+
[renderMarkdown, value]
|
|
20085
|
+
);
|
|
20086
|
+
useEffect(() => {
|
|
20087
|
+
if (isDev() && !renderMarkdown) {
|
|
20088
|
+
console.warn(
|
|
20089
|
+
"[kreativ-ui/MarkdownEditor]: no renderMarkdown prop was provided, so the Preview tab is showing plain text. Pass renderMarkdown={(value) => ReactNode}."
|
|
20090
|
+
);
|
|
20091
|
+
}
|
|
20092
|
+
}, [renderMarkdown]);
|
|
20093
|
+
return /* @__PURE__ */ jsxs("div", { className: editorClasses, children: [
|
|
20094
|
+
/* @__PURE__ */ jsxs(
|
|
20095
|
+
"div",
|
|
20096
|
+
{
|
|
20097
|
+
role: "tablist",
|
|
20098
|
+
"aria-label": "Markdown editor mode",
|
|
20099
|
+
id: `${baseId}-tablist`,
|
|
20100
|
+
className: "flex items-center gap-4 border-b border-kui-border px-3",
|
|
20101
|
+
children: [
|
|
20102
|
+
["write", "preview"].map((t) => /* @__PURE__ */ jsx(
|
|
20103
|
+
"button",
|
|
20104
|
+
{
|
|
20105
|
+
type: "button",
|
|
20106
|
+
role: "tab",
|
|
20107
|
+
id: `${baseId}-${t}-tab`,
|
|
20108
|
+
"aria-selected": tab === t,
|
|
20109
|
+
"aria-controls": t === "write" ? writePanelId : previewPanelId,
|
|
20110
|
+
onClick: () => setTab(t),
|
|
20111
|
+
disabled: isDisabled,
|
|
20112
|
+
className: cn(
|
|
20113
|
+
"border-b-2 py-2.5 text-sm capitalize",
|
|
20114
|
+
!motionGated && "transition-colors",
|
|
20115
|
+
"disabled:pointer-events-none disabled:cursor-not-allowed",
|
|
20116
|
+
tab === t ? "border-kui-brand text-kui-text" : "border-transparent text-kui-text-muted hover:text-kui-text"
|
|
20117
|
+
),
|
|
20118
|
+
children: t
|
|
20119
|
+
},
|
|
20120
|
+
t
|
|
20121
|
+
)),
|
|
20122
|
+
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(
|
|
20123
|
+
"button",
|
|
20124
|
+
{
|
|
20125
|
+
type: "button",
|
|
20126
|
+
"aria-label": shortcutHint(item),
|
|
20127
|
+
title: shortcutHint(item),
|
|
20128
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
20129
|
+
onClick: () => runAction(item.action),
|
|
20130
|
+
disabled: isDisabled,
|
|
20131
|
+
className: cn(
|
|
20132
|
+
"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",
|
|
20133
|
+
!motionGated && "transition-colors"
|
|
20134
|
+
),
|
|
20135
|
+
children: /* @__PURE__ */ jsx(item.icon, { size: 15 })
|
|
20136
|
+
},
|
|
20137
|
+
item.label
|
|
20138
|
+
)) })
|
|
20139
|
+
]
|
|
20140
|
+
}
|
|
20141
|
+
),
|
|
20142
|
+
/* @__PURE__ */ jsx(
|
|
20143
|
+
"div",
|
|
20144
|
+
{
|
|
20145
|
+
id: writePanelId,
|
|
20146
|
+
role: "tabpanel",
|
|
20147
|
+
"aria-labelledby": `${baseId}-write-tab`,
|
|
20148
|
+
hidden: tab !== "write",
|
|
20149
|
+
onKeyDown: handleToolbarKeyDown,
|
|
20150
|
+
children: /* @__PURE__ */ jsx(
|
|
20151
|
+
TextareaCore,
|
|
20152
|
+
{
|
|
20153
|
+
ref: composeRefs(textareaRef, ref),
|
|
20154
|
+
value,
|
|
20155
|
+
onValueChange: commit,
|
|
20156
|
+
embedded: true,
|
|
20157
|
+
resize: "vertical",
|
|
20158
|
+
disabled: isDisabled,
|
|
20159
|
+
maxLength,
|
|
20160
|
+
...textareaProps
|
|
20161
|
+
}
|
|
20162
|
+
)
|
|
20163
|
+
}
|
|
20164
|
+
),
|
|
20165
|
+
/* @__PURE__ */ jsx(
|
|
20166
|
+
"div",
|
|
20167
|
+
{
|
|
20168
|
+
id: previewPanelId,
|
|
20169
|
+
role: "tabpanel",
|
|
20170
|
+
"aria-labelledby": `${baseId}-preview-tab`,
|
|
20171
|
+
hidden: tab !== "preview",
|
|
20172
|
+
className: "min-h-32 p-3 text-sm text-kui-text",
|
|
20173
|
+
children: renderMarkdown ? renderedPreview : /* @__PURE__ */ jsx("span", { className: "text-kui-text-muted", children: "No renderMarkdown provided \u2014 showing raw text." })
|
|
20174
|
+
}
|
|
20175
|
+
),
|
|
20176
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 border-t border-kui-border px-3 py-2 text-xs z-1", children: footerMessage })
|
|
20177
|
+
] });
|
|
20178
|
+
}, "render")
|
|
20179
|
+
});
|
|
20180
|
+
var RadioGroupContext = createContext(null);
|
|
20181
|
+
function useRadioGroupContext() {
|
|
20182
|
+
const ctx = useContext(RadioGroupContext);
|
|
20183
|
+
if (!ctx) {
|
|
20184
|
+
throw new Error("<Radio /> must be rendered inside <RadioGroup>.");
|
|
20185
|
+
}
|
|
20186
|
+
return ctx;
|
|
20187
|
+
}
|
|
20188
|
+
__name(useRadioGroupContext, "useRadioGroupContext");
|
|
20189
|
+
function RadioGroup({
|
|
20190
|
+
value: valueProp,
|
|
20191
|
+
defaultValue,
|
|
20192
|
+
onValueChange,
|
|
20193
|
+
name: nameProp,
|
|
20194
|
+
disabled = false,
|
|
20195
|
+
required: required2 = false,
|
|
20196
|
+
orientation = "vertical",
|
|
20197
|
+
size = "md",
|
|
20198
|
+
error: error51,
|
|
20199
|
+
success: success2,
|
|
20200
|
+
className,
|
|
20201
|
+
children
|
|
20202
|
+
}) {
|
|
20203
|
+
const autoName = useId();
|
|
20204
|
+
const name = nameProp ?? autoName;
|
|
20205
|
+
const field = useOptionalFormField();
|
|
20206
|
+
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
20207
|
+
const value = valueProp !== void 0 ? valueProp : internalValue;
|
|
20208
|
+
const handleValueChange = useCallback(
|
|
20209
|
+
(next) => {
|
|
20210
|
+
if (valueProp === void 0) setInternalValue(next);
|
|
20211
|
+
onValueChange?.(next);
|
|
20212
|
+
},
|
|
20213
|
+
[valueProp, onValueChange]
|
|
20214
|
+
);
|
|
20215
|
+
const isInvalid = error51 ?? field?.invalid ?? false;
|
|
20216
|
+
const isSuccess = success2 ?? false;
|
|
20217
|
+
const state = isInvalid ? "error" : isSuccess ? "success" : "none";
|
|
20218
|
+
const groupRequired = required2 || !!field?.required;
|
|
20219
|
+
return /* @__PURE__ */ jsx(
|
|
20220
|
+
RadioGroupContext.Provider,
|
|
20221
|
+
{
|
|
20222
|
+
value: {
|
|
20223
|
+
name,
|
|
20224
|
+
value,
|
|
20225
|
+
onValueChange: handleValueChange,
|
|
20226
|
+
disabled,
|
|
20227
|
+
size,
|
|
20228
|
+
state,
|
|
20229
|
+
groupRequired
|
|
20230
|
+
},
|
|
20231
|
+
children: /* @__PURE__ */ jsx(
|
|
20232
|
+
"div",
|
|
20233
|
+
{
|
|
20234
|
+
role: "radiogroup",
|
|
20235
|
+
"aria-labelledby": field?.hasExternalLabel ? `${field.id}-label` : void 0,
|
|
20236
|
+
"aria-describedby": field?.describedBy,
|
|
20237
|
+
"aria-required": groupRequired || void 0,
|
|
20238
|
+
"aria-invalid": isInvalid || void 0,
|
|
20239
|
+
className: cn(
|
|
20240
|
+
"flex gap-3",
|
|
20241
|
+
orientation === "horizontal" ? "flex-row flex-wrap" : "flex-col",
|
|
20242
|
+
className
|
|
20243
|
+
),
|
|
20244
|
+
children
|
|
20245
|
+
}
|
|
20246
|
+
)
|
|
20247
|
+
}
|
|
20248
|
+
);
|
|
20249
|
+
}
|
|
20250
|
+
__name(RadioGroup, "RadioGroup");
|
|
20251
|
+
var radioBubbleVariants = cva(
|
|
20252
|
+
"flex shrink-0 items-center justify-center rounded-full border transition-colors duration-[var(--kui-duration-fast)]",
|
|
20253
|
+
{
|
|
20148
20254
|
variants: {
|
|
20149
20255
|
size: {
|
|
20150
20256
|
sm: "h-4 w-4",
|
|
@@ -21078,6 +21184,10 @@ MultiSelect.Content = MultiSelectContent;
|
|
|
21078
21184
|
MultiSelect.Item = MultiSelectItem;
|
|
21079
21185
|
|
|
21080
21186
|
// src/utils/responsive.ts
|
|
21187
|
+
function isResponsiveValue(value) {
|
|
21188
|
+
return typeof value === "object" && value !== null;
|
|
21189
|
+
}
|
|
21190
|
+
__name(isResponsiveValue, "isResponsiveValue");
|
|
21081
21191
|
function resolveResponsiveValue(value) {
|
|
21082
21192
|
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
21083
21193
|
return {
|
|
@@ -21108,18 +21218,232 @@ var Container = forwardRef(
|
|
|
21108
21218
|
...rest
|
|
21109
21219
|
}, ref) => {
|
|
21110
21220
|
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
|
-
}
|
|
21221
|
+
const recipeClassName = unstyled ? "" : resolveRecipe(theme.recipes.Container, { maxWidth });
|
|
21222
|
+
const responsiveStyles = {};
|
|
21223
|
+
if (padding !== void 0) {
|
|
21224
|
+
const { base, responsive } = resolveResponsiveValue(padding);
|
|
21225
|
+
if (base !== void 0) {
|
|
21226
|
+
responsiveStyles.base = { paddingInline: `var(--kui-spacing-${base})` };
|
|
21227
|
+
}
|
|
21228
|
+
for (const [bp, value] of Object.entries(responsive)) {
|
|
21229
|
+
responsiveStyles[bp] = { paddingInline: `var(--kui-spacing-${value})` };
|
|
21230
|
+
}
|
|
21231
|
+
}
|
|
21232
|
+
const { attribute, style: responsiveCss } = (0, hooks_exports.useResponsiveStyles)(responsiveStyles);
|
|
21233
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
21234
|
+
/* @__PURE__ */ jsx(ResponsiveStyle, { css: responsiveCss }),
|
|
21235
|
+
/* @__PURE__ */ jsx(
|
|
21236
|
+
Tag,
|
|
21237
|
+
{
|
|
21238
|
+
ref,
|
|
21239
|
+
"data-kui-responsive": attribute,
|
|
21240
|
+
className: cn(recipeClassName, centered && "mx-auto", className),
|
|
21241
|
+
style,
|
|
21242
|
+
...rest,
|
|
21243
|
+
children
|
|
21244
|
+
}
|
|
21245
|
+
)
|
|
21246
|
+
] });
|
|
21247
|
+
}
|
|
21248
|
+
);
|
|
21249
|
+
Container.displayName = "Container";
|
|
21250
|
+
var Flex = createComponent({
|
|
21251
|
+
displayName: "Flex",
|
|
21252
|
+
__kui: {
|
|
21253
|
+
role: "layout",
|
|
21254
|
+
skeleton: "preserve",
|
|
21255
|
+
video: {
|
|
21256
|
+
id: "flex",
|
|
21257
|
+
safe: true,
|
|
21258
|
+
acceptsChildren: true,
|
|
21259
|
+
interactionStates: []
|
|
21260
|
+
}
|
|
21261
|
+
},
|
|
21262
|
+
render: /* @__PURE__ */ __name(({
|
|
21263
|
+
inline = false,
|
|
21264
|
+
direction = "row",
|
|
21265
|
+
wrap = "nowrap",
|
|
21266
|
+
align,
|
|
21267
|
+
justify,
|
|
21268
|
+
gap,
|
|
21269
|
+
gapX,
|
|
21270
|
+
gapY,
|
|
21271
|
+
grow,
|
|
21272
|
+
shrink,
|
|
21273
|
+
basis,
|
|
21274
|
+
fullWidth,
|
|
21275
|
+
fullHeight,
|
|
21276
|
+
as: Tag = "div",
|
|
21277
|
+
className,
|
|
21278
|
+
style,
|
|
21279
|
+
unstyled,
|
|
21280
|
+
children,
|
|
21281
|
+
...rest
|
|
21282
|
+
}, ref) => {
|
|
21283
|
+
const { theme } = useTheme();
|
|
21284
|
+
const responsiveStyles = (0, hooks_exports.useMergedResponsiveStyles)([
|
|
21285
|
+
[direction, (v) => ({ flexDirection: v })],
|
|
21286
|
+
[wrap, (v) => ({ flexWrap: v })],
|
|
21287
|
+
[align, (v) => ({ alignItems: v })],
|
|
21288
|
+
[justify, (v) => ({ justifyContent: v })],
|
|
21289
|
+
[gap, (v) => ({ gap: resolveSpace(v) })],
|
|
21290
|
+
[gapX, (v) => ({ columnGap: resolveSpace(v) })],
|
|
21291
|
+
[gapY, (v) => ({ rowGap: resolveSpace(v) })],
|
|
21292
|
+
[grow, (v) => ({ flexGrow: v === true ? 1 : v === false ? 0 : v })],
|
|
21293
|
+
[shrink, (v) => ({ flexShrink: v === true ? 1 : v === false ? 0 : v })],
|
|
21294
|
+
[basis, (v) => ({ flexBasis: v })]
|
|
21295
|
+
]);
|
|
21296
|
+
const { attribute, style: responsiveCss } = (0, hooks_exports.useResponsiveStyles)(responsiveStyles);
|
|
21297
|
+
const recipeClasses = resolveRecipe(theme.recipes.Flex, {
|
|
21298
|
+
inline,
|
|
21299
|
+
fullWidth: Boolean(fullWidth),
|
|
21300
|
+
fullHeight: Boolean(fullHeight)
|
|
21301
|
+
});
|
|
21302
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
21303
|
+
/* @__PURE__ */ jsx(ResponsiveStyle, { css: responsiveCss }),
|
|
21304
|
+
/* @__PURE__ */ jsx(
|
|
21305
|
+
Tag,
|
|
21306
|
+
{
|
|
21307
|
+
ref,
|
|
21308
|
+
"data-kui-responsive": attribute,
|
|
21309
|
+
className: cn(!unstyled && recipeClasses, className),
|
|
21310
|
+
style,
|
|
21311
|
+
...rest,
|
|
21312
|
+
children
|
|
21313
|
+
}
|
|
21314
|
+
)
|
|
21315
|
+
] });
|
|
21316
|
+
}, "render")
|
|
21317
|
+
});
|
|
21318
|
+
var Stack = forwardRef(
|
|
21319
|
+
({ orientation = "vertical", divider, children, ...rest }, ref) => {
|
|
21320
|
+
const direction = orientation === "horizontal" ? "row" : "column";
|
|
21321
|
+
if (!divider) {
|
|
21322
|
+
return /* @__PURE__ */ jsx(Flex, { ref, direction, ...rest, children });
|
|
21323
|
+
}
|
|
21324
|
+
const items = Children.toArray(children).filter(isValidElement);
|
|
21325
|
+
return /* @__PURE__ */ jsx(Flex, { ref, direction, ...rest, children: items.map((child, index) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
21326
|
+
child,
|
|
21327
|
+
index < items.length - 1 && divider
|
|
21328
|
+
] }, child.key ?? index)) });
|
|
21329
|
+
}
|
|
21330
|
+
);
|
|
21331
|
+
Stack.displayName = "Stack";
|
|
21332
|
+
function spanValue(value) {
|
|
21333
|
+
return value === "full" ? "1 / -1" : `span ${value}`;
|
|
21334
|
+
}
|
|
21335
|
+
__name(spanValue, "spanValue");
|
|
21336
|
+
var GridItem = createComponent({
|
|
21337
|
+
displayName: "Grid.Item",
|
|
21338
|
+
__kui: {
|
|
21339
|
+
role: "layout",
|
|
21340
|
+
skeleton: "preserve",
|
|
21341
|
+
groupSlot: "Grid",
|
|
21342
|
+
video: {
|
|
21343
|
+
id: "grid-item",
|
|
21344
|
+
safe: true,
|
|
21345
|
+
acceptsChildren: true,
|
|
21346
|
+
interactionStates: []
|
|
21347
|
+
}
|
|
21348
|
+
},
|
|
21349
|
+
render: /* @__PURE__ */ __name(({
|
|
21350
|
+
span,
|
|
21351
|
+
rowSpan,
|
|
21352
|
+
as: Tag = "div",
|
|
21353
|
+
className,
|
|
21354
|
+
style,
|
|
21355
|
+
unstyled,
|
|
21356
|
+
children,
|
|
21357
|
+
...rest
|
|
21358
|
+
}, ref) => {
|
|
21359
|
+
const responsiveStyles = (0, hooks_exports.useMergedResponsiveStyles)([
|
|
21360
|
+
[span, (v) => ({ gridColumn: spanValue(v) })],
|
|
21361
|
+
[rowSpan, (v) => ({ gridRow: spanValue(v) })]
|
|
21362
|
+
]);
|
|
21363
|
+
const { attribute, style: responsiveCss } = (0, hooks_exports.useResponsiveStyles)(responsiveStyles);
|
|
21364
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
21365
|
+
/* @__PURE__ */ jsx(ResponsiveStyle, { css: responsiveCss }),
|
|
21366
|
+
/* @__PURE__ */ jsx(
|
|
21367
|
+
Tag,
|
|
21368
|
+
{
|
|
21369
|
+
ref,
|
|
21370
|
+
"data-kui-responsive": attribute,
|
|
21371
|
+
className: cn(!unstyled && className),
|
|
21372
|
+
style,
|
|
21373
|
+
...rest,
|
|
21374
|
+
children
|
|
21375
|
+
}
|
|
21376
|
+
)
|
|
21377
|
+
] });
|
|
21378
|
+
}, "render")
|
|
21379
|
+
});
|
|
21380
|
+
var RAW_LENGTH2 = /px|rem|em|%|vw|vh|ch|var\(/i;
|
|
21381
|
+
function resolveTrackSize(value) {
|
|
21382
|
+
if (typeof value === "number") return `${value}px`;
|
|
21383
|
+
if (RAW_LENGTH2.test(value)) return value;
|
|
21384
|
+
return resolveSpace(value);
|
|
21385
|
+
}
|
|
21386
|
+
__name(resolveTrackSize, "resolveTrackSize");
|
|
21387
|
+
var GridRoot = createComponent({
|
|
21388
|
+
displayName: "Grid",
|
|
21389
|
+
__kui: {
|
|
21390
|
+
role: "layout",
|
|
21391
|
+
skeleton: "preserve",
|
|
21392
|
+
video: {
|
|
21393
|
+
id: "grid",
|
|
21394
|
+
safe: true,
|
|
21395
|
+
acceptsChildren: true,
|
|
21396
|
+
interactionStates: []
|
|
21397
|
+
}
|
|
21398
|
+
},
|
|
21399
|
+
render: /* @__PURE__ */ __name(({
|
|
21400
|
+
columns,
|
|
21401
|
+
minChildWidth,
|
|
21402
|
+
templateColumns,
|
|
21403
|
+
templateRows,
|
|
21404
|
+
templateAreas,
|
|
21405
|
+
autoFlow,
|
|
21406
|
+
gap,
|
|
21407
|
+
gapX,
|
|
21408
|
+
gapY,
|
|
21409
|
+
align,
|
|
21410
|
+
justifyItems,
|
|
21411
|
+
inline = false,
|
|
21412
|
+
as: Tag = "div",
|
|
21413
|
+
className,
|
|
21414
|
+
style,
|
|
21415
|
+
unstyled,
|
|
21416
|
+
children,
|
|
21417
|
+
...rest
|
|
21418
|
+
}, ref) => {
|
|
21419
|
+
const { theme } = useTheme();
|
|
21420
|
+
if (isDev() && [columns, minChildWidth, templateColumns].filter((v) => v != null).length > 1) {
|
|
21421
|
+
console.warn(
|
|
21422
|
+
"[kreativ-ui/Grid]: columns, minChildWidth, and templateColumns are mutually exclusive. templateColumns wins, then columns, then minChildWidth."
|
|
21423
|
+
);
|
|
21121
21424
|
}
|
|
21425
|
+
const responsiveStyles = (0, hooks_exports.useMergedResponsiveStyles)([
|
|
21426
|
+
[
|
|
21427
|
+
columns,
|
|
21428
|
+
(v) => ({ gridTemplateColumns: `repeat(${v}, minmax(0, 1fr))` })
|
|
21429
|
+
],
|
|
21430
|
+
[
|
|
21431
|
+
minChildWidth,
|
|
21432
|
+
(v) => ({
|
|
21433
|
+
gridTemplateColumns: `repeat(auto-fit, minmax(${resolveTrackSize(v)}, 1fr))`
|
|
21434
|
+
})
|
|
21435
|
+
],
|
|
21436
|
+
[templateColumns, (v) => ({ gridTemplateColumns: v })],
|
|
21437
|
+
[templateRows, (v) => ({ gridTemplateRows: v })],
|
|
21438
|
+
[autoFlow, (v) => ({ gridAutoFlow: v })],
|
|
21439
|
+
[gap, (v) => ({ gap: resolveSpace(v) })],
|
|
21440
|
+
[gapX, (v) => ({ columnGap: resolveSpace(v) })],
|
|
21441
|
+
[gapY, (v) => ({ rowGap: resolveSpace(v) })],
|
|
21442
|
+
[align, (v) => ({ alignItems: v })],
|
|
21443
|
+
[justifyItems, (v) => ({ justifyItems: v })]
|
|
21444
|
+
]);
|
|
21122
21445
|
const { attribute, style: responsiveCss } = (0, hooks_exports.useResponsiveStyles)(responsiveStyles);
|
|
21446
|
+
const recipeClasses = resolveRecipe(theme.recipes.Grid, { inline });
|
|
21123
21447
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
21124
21448
|
/* @__PURE__ */ jsx(ResponsiveStyle, { css: responsiveCss }),
|
|
21125
21449
|
/* @__PURE__ */ jsx(
|
|
@@ -21127,108 +21451,1098 @@ var Container = forwardRef(
|
|
|
21127
21451
|
{
|
|
21128
21452
|
ref,
|
|
21129
21453
|
"data-kui-responsive": attribute,
|
|
21130
|
-
className: cn(
|
|
21131
|
-
style,
|
|
21454
|
+
className: cn(!unstyled && recipeClasses, className),
|
|
21455
|
+
style: { ...style, gridTemplateAreas: templateAreas },
|
|
21132
21456
|
...rest,
|
|
21133
21457
|
children
|
|
21134
21458
|
}
|
|
21135
21459
|
)
|
|
21136
21460
|
] });
|
|
21461
|
+
}, "render")
|
|
21462
|
+
});
|
|
21463
|
+
var Grid = Object.assign(GridRoot, { Item: GridItem });
|
|
21464
|
+
function withAlpha(color, alpha) {
|
|
21465
|
+
return `color-mix(in srgb, ${color} ${Math.round(alpha * 100)}%, transparent)`;
|
|
21466
|
+
}
|
|
21467
|
+
__name(withAlpha, "withAlpha");
|
|
21468
|
+
function resolveOverlayBackground(color, opacity, gradient) {
|
|
21469
|
+
if (!color && opacity === void 0) return void 0;
|
|
21470
|
+
const resolvedColor = color ?? "currentColor";
|
|
21471
|
+
if (!gradient) {
|
|
21472
|
+
return resolvedColor;
|
|
21473
|
+
}
|
|
21474
|
+
const startOpacity = opacity ?? 1;
|
|
21475
|
+
const startColor = startOpacity === 1 ? resolvedColor : withAlpha(resolvedColor, startOpacity);
|
|
21476
|
+
if (typeof gradient === "object") {
|
|
21477
|
+
const position = gradient.position ?? "center";
|
|
21478
|
+
return `radial-gradient(circle at ${position}, ${startColor} 0%, transparent 100%)`;
|
|
21479
|
+
}
|
|
21480
|
+
const directionMap = {
|
|
21481
|
+
top: "to top",
|
|
21482
|
+
bottom: "to bottom",
|
|
21483
|
+
left: "to left",
|
|
21484
|
+
right: "to right"
|
|
21485
|
+
};
|
|
21486
|
+
return `linear-gradient(${directionMap[gradient]}, ${startColor} 0%, transparent 100%)`;
|
|
21487
|
+
}
|
|
21488
|
+
__name(resolveOverlayBackground, "resolveOverlayBackground");
|
|
21489
|
+
var CardOverlay = createComponent({
|
|
21490
|
+
__kui: {
|
|
21491
|
+
groupSlot: "Card"
|
|
21492
|
+
},
|
|
21493
|
+
displayName: "Card.Overlay",
|
|
21494
|
+
render: /* @__PURE__ */ __name(({ color, opacity, blur, gradient, className, style, children, ...props }, ref) => {
|
|
21495
|
+
const background = resolveOverlayBackground(color, opacity, gradient);
|
|
21496
|
+
const { theme } = useTheme();
|
|
21497
|
+
return /* @__PURE__ */ jsx(
|
|
21498
|
+
"div",
|
|
21499
|
+
{
|
|
21500
|
+
ref,
|
|
21501
|
+
className: cn(resolveRecipe(theme.recipes.CardOverlay), className),
|
|
21502
|
+
style: {
|
|
21503
|
+
...background !== void 0 ? gradient ? { backgroundImage: background } : { backgroundColor: background } : null,
|
|
21504
|
+
...!gradient && opacity !== void 0 ? { opacity } : null,
|
|
21505
|
+
...blur !== void 0 ? {
|
|
21506
|
+
backdropFilter: `blur(${typeof blur === "number" ? `${blur}px` : blur})`
|
|
21507
|
+
} : null,
|
|
21508
|
+
...style
|
|
21509
|
+
},
|
|
21510
|
+
...props,
|
|
21511
|
+
children
|
|
21512
|
+
}
|
|
21513
|
+
);
|
|
21514
|
+
}, "render")
|
|
21515
|
+
});
|
|
21516
|
+
var CardMedia = createComponent({
|
|
21517
|
+
__kui: {
|
|
21518
|
+
groupSlot: "Card"
|
|
21519
|
+
},
|
|
21520
|
+
displayName: "Card.Media",
|
|
21521
|
+
render: /* @__PURE__ */ __name(({
|
|
21522
|
+
src,
|
|
21523
|
+
alt,
|
|
21524
|
+
fit = "cover",
|
|
21525
|
+
blend = "normal",
|
|
21526
|
+
aspectRatio,
|
|
21527
|
+
className,
|
|
21528
|
+
style,
|
|
21529
|
+
children,
|
|
21530
|
+
...props
|
|
21531
|
+
}, ref) => {
|
|
21532
|
+
const { theme } = useTheme();
|
|
21533
|
+
return /* @__PURE__ */ jsxs(
|
|
21534
|
+
"div",
|
|
21535
|
+
{
|
|
21536
|
+
ref,
|
|
21537
|
+
className: cn(resolveRecipe(theme.recipes.CardMedia), className),
|
|
21538
|
+
style: {
|
|
21539
|
+
...aspectRatio !== void 0 ? { aspectRatio } : null,
|
|
21540
|
+
...style
|
|
21541
|
+
},
|
|
21542
|
+
...props,
|
|
21543
|
+
children: [
|
|
21544
|
+
/* @__PURE__ */ jsx(
|
|
21545
|
+
"img",
|
|
21546
|
+
{
|
|
21547
|
+
src,
|
|
21548
|
+
alt,
|
|
21549
|
+
className: resolveRecipe(theme.recipes.CardMediaImage, { fit, blend })
|
|
21550
|
+
}
|
|
21551
|
+
),
|
|
21552
|
+
children
|
|
21553
|
+
]
|
|
21554
|
+
}
|
|
21555
|
+
);
|
|
21556
|
+
}, "render")
|
|
21557
|
+
});
|
|
21558
|
+
var CardRoot = createComponent({
|
|
21559
|
+
__kui: {
|
|
21560
|
+
role: "display",
|
|
21561
|
+
skeleton: "preserve"
|
|
21562
|
+
},
|
|
21563
|
+
displayName: "Card",
|
|
21564
|
+
render: /* @__PURE__ */ __name(({
|
|
21565
|
+
variant = "outline",
|
|
21566
|
+
size = "md",
|
|
21567
|
+
fullWidth = false,
|
|
21568
|
+
className,
|
|
21569
|
+
style,
|
|
21570
|
+
children,
|
|
21571
|
+
...props
|
|
21572
|
+
}, ref) => {
|
|
21573
|
+
useValidateChildren("Card", children);
|
|
21574
|
+
const { theme } = useTheme();
|
|
21575
|
+
return /* @__PURE__ */ jsx(
|
|
21576
|
+
"div",
|
|
21577
|
+
{
|
|
21578
|
+
ref,
|
|
21579
|
+
className: cn(
|
|
21580
|
+
resolveRecipe(theme.recipes.Card, { variant, size, fullWidth }),
|
|
21581
|
+
className
|
|
21582
|
+
),
|
|
21583
|
+
...props,
|
|
21584
|
+
children
|
|
21585
|
+
}
|
|
21586
|
+
);
|
|
21587
|
+
}, "render")
|
|
21588
|
+
});
|
|
21589
|
+
var CardHeader = createComponent({
|
|
21590
|
+
__kui: {
|
|
21591
|
+
groupSlot: "Card"
|
|
21592
|
+
},
|
|
21593
|
+
displayName: "Card.Header",
|
|
21594
|
+
render: /* @__PURE__ */ __name(({ className, children, noPadding = false, size = "md", ...props }, ref) => {
|
|
21595
|
+
const { theme } = useTheme();
|
|
21596
|
+
return /* @__PURE__ */ jsx(
|
|
21597
|
+
"div",
|
|
21598
|
+
{
|
|
21599
|
+
ref,
|
|
21600
|
+
className: cn(
|
|
21601
|
+
resolveRecipe(theme.recipes.CardHeader, { size, noPadding }),
|
|
21602
|
+
className
|
|
21603
|
+
),
|
|
21604
|
+
...props,
|
|
21605
|
+
children
|
|
21606
|
+
}
|
|
21607
|
+
);
|
|
21608
|
+
}, "render")
|
|
21609
|
+
});
|
|
21610
|
+
var CardBody = createComponent({
|
|
21611
|
+
__kui: {
|
|
21612
|
+
groupSlot: "Card"
|
|
21613
|
+
},
|
|
21614
|
+
displayName: "Card.Body",
|
|
21615
|
+
render: /* @__PURE__ */ __name(({ size = "md", noPadding = false, className, children, ...props }, ref) => {
|
|
21616
|
+
const { theme } = useTheme();
|
|
21617
|
+
return /* @__PURE__ */ jsx(
|
|
21618
|
+
"div",
|
|
21619
|
+
{
|
|
21620
|
+
ref,
|
|
21621
|
+
className: cn(
|
|
21622
|
+
resolveRecipe(theme.recipes.CardBody, { size, noPadding }),
|
|
21623
|
+
className
|
|
21624
|
+
),
|
|
21625
|
+
...props,
|
|
21626
|
+
children
|
|
21627
|
+
}
|
|
21628
|
+
);
|
|
21629
|
+
}, "render")
|
|
21630
|
+
});
|
|
21631
|
+
var CardFooter = createComponent({
|
|
21632
|
+
__kui: {
|
|
21633
|
+
groupSlot: "Card"
|
|
21634
|
+
},
|
|
21635
|
+
displayName: "Card.Footer",
|
|
21636
|
+
render: /* @__PURE__ */ __name(({ size = "md", noPadding = false, className, children, ...props }, ref) => {
|
|
21637
|
+
const { theme } = useTheme();
|
|
21638
|
+
return /* @__PURE__ */ jsx(
|
|
21639
|
+
"div",
|
|
21640
|
+
{
|
|
21641
|
+
ref,
|
|
21642
|
+
className: cn(
|
|
21643
|
+
resolveRecipe(theme.recipes.CardFooter, { size, noPadding }),
|
|
21644
|
+
className
|
|
21645
|
+
),
|
|
21646
|
+
...props,
|
|
21647
|
+
children
|
|
21648
|
+
}
|
|
21649
|
+
);
|
|
21650
|
+
}, "render")
|
|
21651
|
+
});
|
|
21652
|
+
var Card = Object.assign(CardRoot, {
|
|
21653
|
+
Header: CardHeader,
|
|
21654
|
+
Body: CardBody,
|
|
21655
|
+
Footer: CardFooter,
|
|
21656
|
+
Media: CardMedia,
|
|
21657
|
+
Overlay: CardOverlay
|
|
21658
|
+
});
|
|
21659
|
+
var initialState = {
|
|
21660
|
+
hasVerticalOverflow: false,
|
|
21661
|
+
hasHorizontalOverflow: false,
|
|
21662
|
+
atTop: true,
|
|
21663
|
+
atBottom: false,
|
|
21664
|
+
atLeft: true,
|
|
21665
|
+
atRight: false
|
|
21666
|
+
};
|
|
21667
|
+
function statesEqual(a, b) {
|
|
21668
|
+
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;
|
|
21669
|
+
}
|
|
21670
|
+
__name(statesEqual, "statesEqual");
|
|
21671
|
+
function useScrollPosition({ direction, threshold, onScrollEnd, onMeasure }) {
|
|
21672
|
+
const elRef = useRef(null);
|
|
21673
|
+
const [state, setState] = useState(initialState);
|
|
21674
|
+
const stateRef = useRef(state);
|
|
21675
|
+
const onMeasureRef = useRef(onMeasure);
|
|
21676
|
+
onMeasureRef.current = onMeasure;
|
|
21677
|
+
const inZone = useRef({
|
|
21678
|
+
top: false,
|
|
21679
|
+
bottom: false,
|
|
21680
|
+
left: false,
|
|
21681
|
+
right: false
|
|
21682
|
+
});
|
|
21683
|
+
const fireIfEntering = useCallback(
|
|
21684
|
+
(edge, isAtEdge) => {
|
|
21685
|
+
if (isAtEdge && !inZone.current[edge]) {
|
|
21686
|
+
inZone.current[edge] = true;
|
|
21687
|
+
onScrollEnd?.(edge);
|
|
21688
|
+
} else if (!isAtEdge && inZone.current[edge]) {
|
|
21689
|
+
inZone.current[edge] = false;
|
|
21690
|
+
}
|
|
21691
|
+
},
|
|
21692
|
+
[onScrollEnd]
|
|
21693
|
+
);
|
|
21694
|
+
const measure = useCallback(() => {
|
|
21695
|
+
const el = elRef.current;
|
|
21696
|
+
if (!el) return;
|
|
21697
|
+
const hasVerticalOverflow = el.scrollHeight > el.clientHeight;
|
|
21698
|
+
const hasHorizontalOverflow = el.scrollWidth > el.clientWidth;
|
|
21699
|
+
const wantsVertical = direction === "vertical" || direction === "both";
|
|
21700
|
+
const wantsHorizontal = direction === "horizontal" || direction === "both";
|
|
21701
|
+
let atTop = true, atBottom = false, atLeft = true, atRight = false;
|
|
21702
|
+
if (wantsVertical && hasVerticalOverflow) {
|
|
21703
|
+
const distTop = el.scrollTop;
|
|
21704
|
+
const distBottom = el.scrollHeight - el.clientHeight - el.scrollTop;
|
|
21705
|
+
atTop = distTop <= threshold;
|
|
21706
|
+
atBottom = distBottom <= threshold;
|
|
21707
|
+
fireIfEntering("top", atTop);
|
|
21708
|
+
fireIfEntering("bottom", atBottom);
|
|
21709
|
+
}
|
|
21710
|
+
if (wantsHorizontal && hasHorizontalOverflow) {
|
|
21711
|
+
const distLeft = el.scrollLeft;
|
|
21712
|
+
const distRight = el.scrollWidth - el.clientWidth - el.scrollLeft;
|
|
21713
|
+
atLeft = distLeft <= threshold;
|
|
21714
|
+
atRight = distRight <= threshold;
|
|
21715
|
+
fireIfEntering("left", atLeft);
|
|
21716
|
+
fireIfEntering("right", atRight);
|
|
21717
|
+
}
|
|
21718
|
+
const next = {
|
|
21719
|
+
hasVerticalOverflow,
|
|
21720
|
+
hasHorizontalOverflow,
|
|
21721
|
+
atTop: wantsVertical ? atTop : true,
|
|
21722
|
+
atBottom: wantsVertical ? atBottom : false,
|
|
21723
|
+
atLeft: wantsHorizontal ? atLeft : true,
|
|
21724
|
+
atRight: wantsHorizontal ? atRight : false
|
|
21725
|
+
};
|
|
21726
|
+
if (!statesEqual(stateRef.current, next)) {
|
|
21727
|
+
stateRef.current = next;
|
|
21728
|
+
setState(next);
|
|
21729
|
+
}
|
|
21730
|
+
onMeasureRef.current?.();
|
|
21731
|
+
}, [direction, threshold, fireIfEntering]);
|
|
21732
|
+
const handleScroll = useCallback(() => measure(), [measure]);
|
|
21733
|
+
useEffect(() => {
|
|
21734
|
+
const el = elRef.current;
|
|
21735
|
+
if (!el) return;
|
|
21736
|
+
measure();
|
|
21737
|
+
const resizeObserver = new ResizeObserver(() => measure());
|
|
21738
|
+
resizeObserver.observe(el);
|
|
21739
|
+
const mutationObserver = new MutationObserver(() => measure());
|
|
21740
|
+
mutationObserver.observe(el, { childList: true, subtree: true, characterData: true });
|
|
21741
|
+
return () => {
|
|
21742
|
+
resizeObserver.disconnect();
|
|
21743
|
+
mutationObserver.disconnect();
|
|
21744
|
+
};
|
|
21745
|
+
}, [measure]);
|
|
21746
|
+
return { elRef, state, handleScroll, measure };
|
|
21747
|
+
}
|
|
21748
|
+
__name(useScrollPosition, "useScrollPosition");
|
|
21749
|
+
var THRESHOLD = 5;
|
|
21750
|
+
var IGNORE = "input, textarea, select, [contenteditable=''], [contenteditable='true'], [data-no-drag]";
|
|
21751
|
+
function useDragScroll(elRef, { enabled, direction, onRelease }) {
|
|
21752
|
+
const releaseRef = useRef(onRelease);
|
|
21753
|
+
releaseRef.current = onRelease;
|
|
21754
|
+
useEffect(() => {
|
|
21755
|
+
const el = elRef.current;
|
|
21756
|
+
if (!el || !enabled) return;
|
|
21757
|
+
const allowX = direction !== "vertical";
|
|
21758
|
+
const allowY = direction !== "horizontal";
|
|
21759
|
+
let pointerId = null;
|
|
21760
|
+
let startX = 0, startY = 0, startLeft = 0, startTop = 0;
|
|
21761
|
+
let dragging = false;
|
|
21762
|
+
let suppressClick = false;
|
|
21763
|
+
const onDown = /* @__PURE__ */ __name((e) => {
|
|
21764
|
+
if (e.pointerType === "touch" || e.button !== 0) return;
|
|
21765
|
+
if (e.target.closest(IGNORE)) return;
|
|
21766
|
+
pointerId = e.pointerId;
|
|
21767
|
+
startX = e.clientX;
|
|
21768
|
+
startY = e.clientY;
|
|
21769
|
+
startLeft = el.scrollLeft;
|
|
21770
|
+
startTop = el.scrollTop;
|
|
21771
|
+
dragging = false;
|
|
21772
|
+
}, "onDown");
|
|
21773
|
+
const onMove = /* @__PURE__ */ __name((e) => {
|
|
21774
|
+
if (e.pointerId !== pointerId) return;
|
|
21775
|
+
const dx = e.clientX - startX;
|
|
21776
|
+
const dy = e.clientY - startY;
|
|
21777
|
+
if (!dragging) {
|
|
21778
|
+
if (Math.hypot(dx, dy) < THRESHOLD) return;
|
|
21779
|
+
dragging = true;
|
|
21780
|
+
try {
|
|
21781
|
+
el.setPointerCapture(e.pointerId);
|
|
21782
|
+
} catch {
|
|
21783
|
+
}
|
|
21784
|
+
el.setAttribute("data-dragging", "");
|
|
21785
|
+
window.getSelection()?.removeAllRanges();
|
|
21786
|
+
}
|
|
21787
|
+
if (allowX) el.scrollLeft = startLeft - dx;
|
|
21788
|
+
if (allowY) el.scrollTop = startTop - dy;
|
|
21789
|
+
}, "onMove");
|
|
21790
|
+
const onEnd = /* @__PURE__ */ __name((e) => {
|
|
21791
|
+
if (e.pointerId !== pointerId) return;
|
|
21792
|
+
pointerId = null;
|
|
21793
|
+
if (!dragging) return;
|
|
21794
|
+
dragging = false;
|
|
21795
|
+
suppressClick = true;
|
|
21796
|
+
setTimeout(() => {
|
|
21797
|
+
suppressClick = false;
|
|
21798
|
+
}, 0);
|
|
21799
|
+
el.removeAttribute("data-dragging");
|
|
21800
|
+
releaseRef.current?.(el);
|
|
21801
|
+
}, "onEnd");
|
|
21802
|
+
const onClickCapture = /* @__PURE__ */ __name((e) => {
|
|
21803
|
+
if (!suppressClick) return;
|
|
21804
|
+
e.preventDefault();
|
|
21805
|
+
e.stopPropagation();
|
|
21806
|
+
}, "onClickCapture");
|
|
21807
|
+
const onDragStart = /* @__PURE__ */ __name((e) => {
|
|
21808
|
+
if (!e.target.closest?.('[draggable="true"]')) e.preventDefault();
|
|
21809
|
+
}, "onDragStart");
|
|
21810
|
+
el.addEventListener("pointerdown", onDown);
|
|
21811
|
+
el.addEventListener("pointermove", onMove);
|
|
21812
|
+
el.addEventListener("pointerup", onEnd);
|
|
21813
|
+
el.addEventListener("pointercancel", onEnd);
|
|
21814
|
+
el.addEventListener("click", onClickCapture, true);
|
|
21815
|
+
el.addEventListener("dragstart", onDragStart);
|
|
21816
|
+
return () => {
|
|
21817
|
+
el.removeEventListener("pointerdown", onDown);
|
|
21818
|
+
el.removeEventListener("pointermove", onMove);
|
|
21819
|
+
el.removeEventListener("pointerup", onEnd);
|
|
21820
|
+
el.removeEventListener("pointercancel", onEnd);
|
|
21821
|
+
el.removeEventListener("click", onClickCapture, true);
|
|
21822
|
+
el.removeEventListener("dragstart", onDragStart);
|
|
21823
|
+
el.removeAttribute("data-dragging");
|
|
21824
|
+
};
|
|
21825
|
+
}, [elRef, enabled, direction]);
|
|
21826
|
+
}
|
|
21827
|
+
__name(useDragScroll, "useDragScroll");
|
|
21828
|
+
|
|
21829
|
+
// src/components/layout/ScrollArea/scrollProgress.ts
|
|
21830
|
+
var clamp01 = /* @__PURE__ */ __name((n) => Math.min(1, Math.max(0, n)), "clamp01");
|
|
21831
|
+
function containerProgress(el) {
|
|
21832
|
+
const maxY = el.scrollHeight - el.clientHeight;
|
|
21833
|
+
const maxX = el.scrollWidth - el.clientWidth;
|
|
21834
|
+
return {
|
|
21835
|
+
x: maxX > 0 ? clamp01(el.scrollLeft / maxX) : 0,
|
|
21836
|
+
y: maxY > 0 ? clamp01(el.scrollTop / maxY) : 0
|
|
21837
|
+
};
|
|
21838
|
+
}
|
|
21839
|
+
__name(containerProgress, "containerProgress");
|
|
21840
|
+
function sceneProgress(scene, container, axis, range) {
|
|
21841
|
+
const c = container.getBoundingClientRect();
|
|
21842
|
+
const s = scene.getBoundingClientRect();
|
|
21843
|
+
const vertical = axis === "y";
|
|
21844
|
+
const view = vertical ? container.clientHeight : container.clientWidth;
|
|
21845
|
+
const size = vertical ? s.height : s.width;
|
|
21846
|
+
const offset = vertical ? s.top - c.top - container.clientTop : s.left - c.left - container.clientLeft;
|
|
21847
|
+
if (range === "through") {
|
|
21848
|
+
const total = view + size;
|
|
21849
|
+
return total > 0 ? clamp01((view - offset) / total) : 0;
|
|
21850
|
+
}
|
|
21851
|
+
const travel = size - view;
|
|
21852
|
+
return travel > 0 ? clamp01(-offset / travel) : 0;
|
|
21853
|
+
}
|
|
21854
|
+
__name(sceneProgress, "sceneProgress");
|
|
21855
|
+
function createStore(initial, equals = Object.is) {
|
|
21856
|
+
let value = initial;
|
|
21857
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
21858
|
+
return {
|
|
21859
|
+
get: /* @__PURE__ */ __name(() => value, "get"),
|
|
21860
|
+
set(next) {
|
|
21861
|
+
if (equals(value, next)) return false;
|
|
21862
|
+
value = next;
|
|
21863
|
+
listeners.forEach((l) => l(next));
|
|
21864
|
+
return true;
|
|
21865
|
+
},
|
|
21866
|
+
subscribe(fn) {
|
|
21867
|
+
listeners.add(fn);
|
|
21868
|
+
return () => {
|
|
21869
|
+
listeners.delete(fn);
|
|
21870
|
+
};
|
|
21871
|
+
},
|
|
21872
|
+
get size() {
|
|
21873
|
+
return listeners.size;
|
|
21874
|
+
}
|
|
21875
|
+
};
|
|
21876
|
+
}
|
|
21877
|
+
__name(createStore, "createStore");
|
|
21878
|
+
|
|
21879
|
+
// src/components/layout/ScrollArea/ScrollEngine.ts
|
|
21880
|
+
var EPS = 1;
|
|
21881
|
+
var round = /* @__PURE__ */ __name((n) => Math.round(n * 1e4) / 1e4, "round");
|
|
21882
|
+
var progressEqual = /* @__PURE__ */ __name((a, b) => a.x === b.x && a.y === b.y, "progressEqual");
|
|
21883
|
+
var STICKY_EDGES = ["top", "bottom", "left", "right"];
|
|
21884
|
+
var _StickyHandle = class _StickyHandle {
|
|
21885
|
+
constructor() {
|
|
21886
|
+
__publicField(this, "el", null);
|
|
21887
|
+
__publicField(this, "edges", []);
|
|
21888
|
+
__publicField(this, "offsets", {});
|
|
21889
|
+
__publicField(this, "stuck", "");
|
|
21890
|
+
__publicField(this, "dirty", true);
|
|
21891
|
+
__publicField(this, "onStuckChange");
|
|
21892
|
+
}
|
|
21893
|
+
resolve() {
|
|
21894
|
+
if (!this.el) return;
|
|
21895
|
+
const cs = getComputedStyle(this.el);
|
|
21896
|
+
this.offsets = {};
|
|
21897
|
+
for (const edge of this.edges) {
|
|
21898
|
+
const px = parseFloat(cs[edge]);
|
|
21899
|
+
if (!Number.isNaN(px)) this.offsets[edge] = px;
|
|
21900
|
+
}
|
|
21901
|
+
this.dirty = false;
|
|
21902
|
+
}
|
|
21903
|
+
};
|
|
21904
|
+
__name(_StickyHandle, "StickyHandle");
|
|
21905
|
+
var StickyHandle = _StickyHandle;
|
|
21906
|
+
var _SceneHandle = class _SceneHandle {
|
|
21907
|
+
constructor(engine) {
|
|
21908
|
+
__publicField(this, "engine", engine);
|
|
21909
|
+
__publicField(this, "el", null);
|
|
21910
|
+
__publicField(this, "axis", "y");
|
|
21911
|
+
__publicField(this, "range", "through");
|
|
21912
|
+
__publicField(this, "store", createStore(0));
|
|
21913
|
+
__publicField(this, "get", /* @__PURE__ */ __name(() => {
|
|
21914
|
+
const container = this.engine.el;
|
|
21915
|
+
return this.el && container ? round(sceneProgress(this.el, container, this.axis, this.range)) : 0;
|
|
21916
|
+
}, "get"));
|
|
21917
|
+
__publicField(this, "subscribe", /* @__PURE__ */ __name((fn) => {
|
|
21918
|
+
const off = this.store.subscribe(fn);
|
|
21919
|
+
this.engine.schedule();
|
|
21920
|
+
return off;
|
|
21921
|
+
}, "subscribe"));
|
|
21922
|
+
}
|
|
21923
|
+
};
|
|
21924
|
+
__name(_SceneHandle, "SceneHandle");
|
|
21925
|
+
var SceneHandle = _SceneHandle;
|
|
21926
|
+
var _ScrollEngine = class _ScrollEngine {
|
|
21927
|
+
constructor() {
|
|
21928
|
+
__publicField(this, "el", null);
|
|
21929
|
+
__publicField(this, "trackVars", false);
|
|
21930
|
+
__publicField(this, "varsDirty", false);
|
|
21931
|
+
__publicField(this, "offsetsDirty", false);
|
|
21932
|
+
__publicField(this, "frame", 0);
|
|
21933
|
+
__publicField(this, "resizeObserver", null);
|
|
21934
|
+
__publicField(this, "scenes", /* @__PURE__ */ new Set());
|
|
21935
|
+
__publicField(this, "stickies", /* @__PURE__ */ new Set());
|
|
21936
|
+
__publicField(this, "viewport", { w: -1, h: -1 });
|
|
21937
|
+
__publicField(this, "containerStore", createStore(
|
|
21938
|
+
{ x: 0, y: 0 },
|
|
21939
|
+
progressEqual
|
|
21940
|
+
));
|
|
21941
|
+
__publicField(this, "progress", {
|
|
21942
|
+
get: /* @__PURE__ */ __name(() => this.el ? containerProgress(this.el) : { x: 0, y: 0 }, "get"),
|
|
21943
|
+
subscribe: /* @__PURE__ */ __name((fn) => {
|
|
21944
|
+
const off = this.containerStore.subscribe(fn);
|
|
21945
|
+
this.schedule();
|
|
21946
|
+
return off;
|
|
21947
|
+
}, "subscribe")
|
|
21948
|
+
});
|
|
21949
|
+
__publicField(this, "schedule", /* @__PURE__ */ __name(() => {
|
|
21950
|
+
if (this.frame || !this.el || !this.isActive()) return;
|
|
21951
|
+
this.frame = requestAnimationFrame(this.flush);
|
|
21952
|
+
}, "schedule"));
|
|
21953
|
+
__publicField(this, "flush", /* @__PURE__ */ __name(() => {
|
|
21954
|
+
this.frame = 0;
|
|
21955
|
+
const el = this.el;
|
|
21956
|
+
if (!el) return;
|
|
21957
|
+
const c = containerProgress(el);
|
|
21958
|
+
const rounded = { x: round(c.x), y: round(c.y) };
|
|
21959
|
+
const sceneValues = [];
|
|
21960
|
+
this.scenes.forEach((s) => {
|
|
21961
|
+
if (s.el)
|
|
21962
|
+
sceneValues.push([s, round(sceneProgress(s.el, el, s.axis, s.range))]);
|
|
21963
|
+
});
|
|
21964
|
+
const stickyStates = [];
|
|
21965
|
+
if (this.stickies.size > 0) {
|
|
21966
|
+
const cr = el.getBoundingClientRect();
|
|
21967
|
+
const portTop = cr.top + el.clientTop;
|
|
21968
|
+
const portLeft = cr.left + el.clientLeft;
|
|
21969
|
+
const portBottom = portTop + el.clientHeight;
|
|
21970
|
+
const portRight = portLeft + el.clientWidth;
|
|
21971
|
+
const maxY = el.scrollHeight - el.clientHeight;
|
|
21972
|
+
const maxX = el.scrollWidth - el.clientWidth;
|
|
21973
|
+
this.stickies.forEach((s) => {
|
|
21974
|
+
if (!s.el) return;
|
|
21975
|
+
if (s.dirty || this.offsetsDirty) s.resolve();
|
|
21976
|
+
const r = s.el.getBoundingClientRect();
|
|
21977
|
+
const o = s.offsets;
|
|
21978
|
+
const hit = [];
|
|
21979
|
+
if (o.top !== void 0 && Math.abs(r.top - (portTop + o.top)) <= EPS && el.scrollTop > EPS)
|
|
21980
|
+
hit.push("top");
|
|
21981
|
+
if (o.bottom !== void 0 && Math.abs(r.bottom - (portBottom - o.bottom)) <= EPS && el.scrollTop < maxY - EPS)
|
|
21982
|
+
hit.push("bottom");
|
|
21983
|
+
if (o.left !== void 0 && Math.abs(r.left - (portLeft + o.left)) <= EPS && el.scrollLeft > EPS)
|
|
21984
|
+
hit.push("left");
|
|
21985
|
+
if (o.right !== void 0 && Math.abs(r.right - (portRight - o.right)) <= EPS && el.scrollLeft < maxX - EPS)
|
|
21986
|
+
hit.push("right");
|
|
21987
|
+
stickyStates.push([s, hit.join(" ")]);
|
|
21988
|
+
});
|
|
21989
|
+
}
|
|
21990
|
+
this.offsetsDirty = false;
|
|
21991
|
+
const changed = this.containerStore.set(rounded);
|
|
21992
|
+
if (this.trackVars && (changed || this.varsDirty)) {
|
|
21993
|
+
el.style.setProperty("--kui-scroll-x", String(rounded.x));
|
|
21994
|
+
el.style.setProperty("--kui-scroll-y", String(rounded.y));
|
|
21995
|
+
this.varsDirty = false;
|
|
21996
|
+
}
|
|
21997
|
+
for (const [s, v] of sceneValues) {
|
|
21998
|
+
if (s.store.set(v) && s.el)
|
|
21999
|
+
s.el.style.setProperty("--kui-scene-progress", String(v));
|
|
22000
|
+
}
|
|
22001
|
+
for (const [s, stuck] of stickyStates) {
|
|
22002
|
+
if (!s.el || s.stuck === stuck) continue;
|
|
22003
|
+
const was = s.stuck !== "";
|
|
22004
|
+
s.stuck = stuck;
|
|
22005
|
+
if (stuck) s.el.setAttribute("data-stuck", stuck);
|
|
22006
|
+
else s.el.removeAttribute("data-stuck");
|
|
22007
|
+
if (was !== (stuck !== "")) s.onStuckChange?.(stuck !== "");
|
|
22008
|
+
}
|
|
22009
|
+
}, "flush"));
|
|
22010
|
+
}
|
|
22011
|
+
attach(el) {
|
|
22012
|
+
this.el = el;
|
|
22013
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
22014
|
+
this.offsetsDirty = true;
|
|
22015
|
+
this.syncViewport();
|
|
22016
|
+
this.schedule();
|
|
22017
|
+
});
|
|
22018
|
+
this.resizeObserver.observe(el);
|
|
22019
|
+
this.scenes.forEach((s) => s.el && this.resizeObserver.observe(s.el));
|
|
22020
|
+
this.syncViewport();
|
|
22021
|
+
this.schedule();
|
|
22022
|
+
}
|
|
22023
|
+
detach() {
|
|
22024
|
+
cancelAnimationFrame(this.frame);
|
|
22025
|
+
this.frame = 0;
|
|
22026
|
+
this.resizeObserver?.disconnect();
|
|
22027
|
+
this.resizeObserver = null;
|
|
22028
|
+
this.el = null;
|
|
22029
|
+
this.viewport = { w: -1, h: -1 };
|
|
22030
|
+
}
|
|
22031
|
+
setTrackProgress(on) {
|
|
22032
|
+
if (this.trackVars === on) return;
|
|
22033
|
+
this.trackVars = on;
|
|
22034
|
+
if (on) {
|
|
22035
|
+
this.varsDirty = true;
|
|
22036
|
+
} else {
|
|
22037
|
+
this.el?.style.removeProperty("--kui-scroll-x");
|
|
22038
|
+
this.el?.style.removeProperty("--kui-scroll-y");
|
|
22039
|
+
}
|
|
22040
|
+
this.schedule();
|
|
22041
|
+
}
|
|
22042
|
+
register(scene) {
|
|
22043
|
+
this.scenes.add(scene);
|
|
22044
|
+
if (scene.el) this.resizeObserver?.observe(scene.el);
|
|
22045
|
+
this.schedule();
|
|
22046
|
+
return () => {
|
|
22047
|
+
this.scenes.delete(scene);
|
|
22048
|
+
if (scene.el) this.resizeObserver?.unobserve(scene.el);
|
|
22049
|
+
};
|
|
22050
|
+
}
|
|
22051
|
+
registerSticky(s) {
|
|
22052
|
+
this.stickies.add(s);
|
|
22053
|
+
this.schedule();
|
|
22054
|
+
return () => {
|
|
22055
|
+
this.stickies.delete(s);
|
|
22056
|
+
};
|
|
22057
|
+
}
|
|
22058
|
+
isActive() {
|
|
22059
|
+
return this.trackVars || this.scenes.size > 0 || this.stickies.size > 0 || this.containerStore.size > 0;
|
|
22060
|
+
}
|
|
22061
|
+
syncViewport() {
|
|
22062
|
+
const el = this.el;
|
|
22063
|
+
if (!el) return;
|
|
22064
|
+
const w = el.clientWidth;
|
|
22065
|
+
const h = el.clientHeight;
|
|
22066
|
+
if (w === this.viewport.w && h === this.viewport.h) return;
|
|
22067
|
+
this.viewport = { w, h };
|
|
22068
|
+
el.style.setProperty("--kui-scroll-viewport-width", `${w}px`);
|
|
22069
|
+
el.style.setProperty("--kui-scroll-viewport-height", `${h}px`);
|
|
22070
|
+
}
|
|
22071
|
+
};
|
|
22072
|
+
__name(_ScrollEngine, "ScrollEngine");
|
|
22073
|
+
var ScrollEngine = _ScrollEngine;
|
|
22074
|
+
var ScrollEngineContext = createContext(null);
|
|
22075
|
+
var useIsoLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
|
22076
|
+
function useScrollEngine(hookName) {
|
|
22077
|
+
const engine = useContext(ScrollEngineContext);
|
|
22078
|
+
if (!engine) throw new Error(`${hookName} must be used inside <ScrollArea>`);
|
|
22079
|
+
return engine;
|
|
22080
|
+
}
|
|
22081
|
+
__name(useScrollEngine, "useScrollEngine");
|
|
22082
|
+
function useScrollProgress() {
|
|
22083
|
+
return useScrollEngine("useScrollProgress").progress;
|
|
22084
|
+
}
|
|
22085
|
+
__name(useScrollProgress, "useScrollProgress");
|
|
22086
|
+
function useElementScrollProgress(ref, { range = "through", axis = "y" } = {}) {
|
|
22087
|
+
const engine = useScrollEngine("useElementScrollProgress");
|
|
22088
|
+
const [handle] = useState(() => new SceneHandle(engine));
|
|
22089
|
+
useIsoLayoutEffect(() => {
|
|
22090
|
+
handle.el = ref.current;
|
|
22091
|
+
handle.axis = axis;
|
|
22092
|
+
handle.range = range;
|
|
22093
|
+
return engine.register(handle);
|
|
22094
|
+
}, [engine, handle, ref, axis, range]);
|
|
22095
|
+
return handle;
|
|
22096
|
+
}
|
|
22097
|
+
__name(useElementScrollProgress, "useElementScrollProgress");
|
|
22098
|
+
|
|
22099
|
+
// src/components/layout/ScrollArea/scrollTargets.ts
|
|
22100
|
+
var axesFor = /* @__PURE__ */ __name((d) => d === "both" ? ["x", "y"] : d === "horizontal" ? ["x"] : ["y"], "axesFor");
|
|
22101
|
+
var prefersReducedMotion = /* @__PURE__ */ __name(() => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, "prefersReducedMotion");
|
|
22102
|
+
var resolveBehavior = /* @__PURE__ */ __name((b) => b ?? (prefersReducedMotion() ? "auto" : "smooth"), "resolveBehavior");
|
|
22103
|
+
function childTarget(container, child, axis, align) {
|
|
22104
|
+
const h = axis === "x";
|
|
22105
|
+
const c = container.getBoundingClientRect();
|
|
22106
|
+
const r = child.getBoundingClientRect();
|
|
22107
|
+
const cs = getComputedStyle(container);
|
|
22108
|
+
const view = h ? container.clientWidth : container.clientHeight;
|
|
22109
|
+
const size = h ? r.width : r.height;
|
|
22110
|
+
const rel = h ? r.left - c.left - container.clientLeft : r.top - c.top - container.clientTop;
|
|
22111
|
+
const current = h ? container.scrollLeft : container.scrollTop;
|
|
22112
|
+
const max = h ? container.scrollWidth - view : container.scrollHeight - view;
|
|
22113
|
+
const padStart = parseFloat(h ? cs.scrollPaddingLeft : cs.scrollPaddingTop) || 0;
|
|
22114
|
+
const padEnd = parseFloat(h ? cs.scrollPaddingRight : cs.scrollPaddingBottom) || 0;
|
|
22115
|
+
let offsetInView;
|
|
22116
|
+
if (align === "start") offsetInView = padStart;
|
|
22117
|
+
else if (align === "end") offsetInView = view - padEnd - size;
|
|
22118
|
+
else offsetInView = padStart + (view - padStart - padEnd - size) / 2;
|
|
22119
|
+
return Math.min(Math.max(current + rel - offsetInView, 0), Math.max(max, 0));
|
|
22120
|
+
}
|
|
22121
|
+
__name(childTarget, "childTarget");
|
|
22122
|
+
var snapItems = /* @__PURE__ */ __name((el) => Array.from(el.children).filter(
|
|
22123
|
+
(c) => !getComputedStyle(c).scrollSnapAlign.startsWith("none")
|
|
22124
|
+
), "snapItems");
|
|
22125
|
+
function snapToNearest(el, direction, align) {
|
|
22126
|
+
const items = snapItems(el);
|
|
22127
|
+
if (!items.length) return;
|
|
22128
|
+
const opts = { behavior: resolveBehavior() };
|
|
22129
|
+
for (const axis of axesFor(direction)) {
|
|
22130
|
+
const cur = axis === "x" ? el.scrollLeft : el.scrollTop;
|
|
22131
|
+
let best = cur;
|
|
22132
|
+
let bestDist = Infinity;
|
|
22133
|
+
for (const item of items) {
|
|
22134
|
+
const t = childTarget(el, item, axis, align);
|
|
22135
|
+
const d = Math.abs(t - cur);
|
|
22136
|
+
if (d < bestDist) {
|
|
22137
|
+
bestDist = d;
|
|
22138
|
+
best = t;
|
|
22139
|
+
}
|
|
22140
|
+
}
|
|
22141
|
+
opts[axis === "x" ? "left" : "top"] = best;
|
|
22142
|
+
}
|
|
22143
|
+
el.scrollTo(opts);
|
|
22144
|
+
}
|
|
22145
|
+
__name(snapToNearest, "snapToNearest");
|
|
22146
|
+
var ScrollAreaScene = createComponent({
|
|
22147
|
+
displayName: "ScrollArea.Scene",
|
|
22148
|
+
__kui: {
|
|
22149
|
+
role: "layout",
|
|
22150
|
+
skeleton: "preserve",
|
|
22151
|
+
groupSlot: "ScrollArea",
|
|
22152
|
+
video: {
|
|
22153
|
+
id: "scroll-area-scene",
|
|
22154
|
+
safe: true,
|
|
22155
|
+
acceptsChildren: true,
|
|
22156
|
+
interactionStates: [],
|
|
22157
|
+
motionGated: true
|
|
22158
|
+
}
|
|
22159
|
+
},
|
|
22160
|
+
render: /* @__PURE__ */ __name(({ range, axis, as: Tag = "div", ...rest }, forwardedRef) => {
|
|
22161
|
+
const ref = useRef(null);
|
|
22162
|
+
void isMotionGated(rest);
|
|
22163
|
+
useElementScrollProgress(ref, { range, axis });
|
|
22164
|
+
return /* @__PURE__ */ jsx(Tag, { ref: composeRefs(ref, forwardedRef), "data-kui-scroll-scene": true, ...rest });
|
|
22165
|
+
}, "render")
|
|
22166
|
+
});
|
|
22167
|
+
function warnIfClipped(el, container) {
|
|
22168
|
+
for (let p = el.parentElement; p && p !== container; p = p.parentElement) {
|
|
22169
|
+
if (/hidden|auto|scroll/.test(getComputedStyle(p).overflow)) {
|
|
22170
|
+
console.warn(
|
|
22171
|
+
"[kreativ-ui/ScrollArea.Sticky]: will not stick: an ancestor has overflow other than visible/clip.",
|
|
22172
|
+
p
|
|
22173
|
+
);
|
|
22174
|
+
return;
|
|
22175
|
+
}
|
|
21137
22176
|
}
|
|
21138
|
-
);
|
|
21139
|
-
Container.displayName = "Container";
|
|
21140
|
-
function spaceVar(value) {
|
|
21141
|
-
return `var(--kui-spacing-${value})`;
|
|
21142
22177
|
}
|
|
21143
|
-
__name(
|
|
21144
|
-
var
|
|
21145
|
-
|
|
21146
|
-
|
|
21147
|
-
|
|
21148
|
-
|
|
21149
|
-
|
|
21150
|
-
|
|
22178
|
+
__name(warnIfClipped, "warnIfClipped");
|
|
22179
|
+
var ScrollAreaSticky = createComponent({
|
|
22180
|
+
displayName: "ScrollArea.Sticky",
|
|
22181
|
+
__kui: {
|
|
22182
|
+
role: "layout",
|
|
22183
|
+
skeleton: "preserve",
|
|
22184
|
+
groupSlot: "ScrollArea",
|
|
22185
|
+
video: {
|
|
22186
|
+
id: "scroll-area-sticky",
|
|
22187
|
+
safe: true,
|
|
22188
|
+
acceptsChildren: true,
|
|
22189
|
+
needsParentContext: true,
|
|
22190
|
+
interactionStates: []
|
|
22191
|
+
}
|
|
22192
|
+
},
|
|
22193
|
+
render: /* @__PURE__ */ __name(({
|
|
22194
|
+
top,
|
|
22195
|
+
bottom,
|
|
22196
|
+
left,
|
|
22197
|
+
right,
|
|
22198
|
+
zIndex = 1,
|
|
22199
|
+
onStuckChange,
|
|
22200
|
+
as: Tag = "div",
|
|
22201
|
+
style,
|
|
22202
|
+
...rest
|
|
22203
|
+
}, forwardedRef) => {
|
|
22204
|
+
const engine = useScrollEngine("ScrollArea.Sticky");
|
|
22205
|
+
const ref = useRef(null);
|
|
22206
|
+
const [handle] = useState(() => new StickyHandle());
|
|
22207
|
+
const none = top === void 0 && bottom === void 0 && left === void 0 && right === void 0;
|
|
22208
|
+
const offsets = {
|
|
22209
|
+
top: none ? 0 : top,
|
|
22210
|
+
bottom,
|
|
22211
|
+
left,
|
|
22212
|
+
right
|
|
22213
|
+
};
|
|
22214
|
+
useIsoLayoutEffect(() => {
|
|
22215
|
+
handle.onStuckChange = onStuckChange;
|
|
22216
|
+
});
|
|
22217
|
+
useIsoLayoutEffect(() => {
|
|
22218
|
+
const el = ref.current;
|
|
22219
|
+
if (!el) return;
|
|
22220
|
+
handle.el = el;
|
|
22221
|
+
handle.edges = STICKY_EDGES.filter((e) => offsets[e] !== void 0);
|
|
22222
|
+
handle.dirty = true;
|
|
22223
|
+
if (process.env.NODE_ENV !== "production") warnIfClipped(el, engine.el);
|
|
22224
|
+
return engine.registerSticky(handle);
|
|
22225
|
+
}, [
|
|
22226
|
+
engine,
|
|
22227
|
+
handle,
|
|
22228
|
+
offsets.top,
|
|
22229
|
+
offsets.bottom,
|
|
22230
|
+
offsets.left,
|
|
22231
|
+
offsets.right
|
|
22232
|
+
]);
|
|
22233
|
+
return /* @__PURE__ */ jsx(
|
|
22234
|
+
Tag,
|
|
22235
|
+
{
|
|
22236
|
+
ref: composeRefs(ref, forwardedRef),
|
|
22237
|
+
"data-kui-scroll-sticky": true,
|
|
22238
|
+
style: {
|
|
22239
|
+
position: "sticky",
|
|
22240
|
+
top: offsets.top,
|
|
22241
|
+
bottom: offsets.bottom,
|
|
22242
|
+
left: offsets.left,
|
|
22243
|
+
right: offsets.right,
|
|
22244
|
+
zIndex,
|
|
22245
|
+
...style
|
|
22246
|
+
},
|
|
22247
|
+
...rest
|
|
22248
|
+
}
|
|
22249
|
+
);
|
|
22250
|
+
}, "render")
|
|
22251
|
+
});
|
|
22252
|
+
function shouldFade(fadeEdges, edge) {
|
|
22253
|
+
if (fadeEdges === true) return true;
|
|
22254
|
+
if (!fadeEdges) return false;
|
|
22255
|
+
return !!fadeEdges[edge];
|
|
22256
|
+
}
|
|
22257
|
+
__name(shouldFade, "shouldFade");
|
|
22258
|
+
var ScrollAreaRoot = createComponent({
|
|
22259
|
+
displayName: "ScrollArea",
|
|
22260
|
+
__kui: {
|
|
22261
|
+
role: "layout",
|
|
22262
|
+
formControl: "compound",
|
|
22263
|
+
skeleton: "preserve",
|
|
22264
|
+
video: {
|
|
22265
|
+
id: "scroll-area",
|
|
22266
|
+
safe: true,
|
|
22267
|
+
acceptsChildren: true,
|
|
22268
|
+
interactionStates: [],
|
|
22269
|
+
motionGated: true
|
|
22270
|
+
}
|
|
22271
|
+
},
|
|
22272
|
+
render: /* @__PURE__ */ __name(({
|
|
22273
|
+
maxHeight,
|
|
22274
|
+
maxWidth,
|
|
22275
|
+
direction = "vertical",
|
|
22276
|
+
showScrollbar = "auto",
|
|
22277
|
+
scrollbarVariant = "thin",
|
|
22278
|
+
fadeEdges = false,
|
|
22279
|
+
fadeSize = "24px",
|
|
22280
|
+
overscrollBehavior = "contain",
|
|
22281
|
+
snap = "none",
|
|
22282
|
+
snapAlign = "start",
|
|
22283
|
+
dragToScroll = false,
|
|
22284
|
+
onScroll,
|
|
22285
|
+
onScrollEnd,
|
|
22286
|
+
endThreshold = 0,
|
|
22287
|
+
trackProgress = false,
|
|
22288
|
+
tabIndex,
|
|
21151
22289
|
as: Tag = "div",
|
|
21152
22290
|
className,
|
|
21153
22291
|
style,
|
|
21154
|
-
unstyled,
|
|
21155
22292
|
children,
|
|
21156
22293
|
...rest
|
|
21157
|
-
},
|
|
21158
|
-
const
|
|
21159
|
-
|
|
21160
|
-
|
|
21161
|
-
|
|
21162
|
-
|
|
21163
|
-
|
|
21164
|
-
|
|
21165
|
-
|
|
21166
|
-
|
|
22294
|
+
}, forwardedRef) => {
|
|
22295
|
+
const { theme } = useTheme();
|
|
22296
|
+
const [engine] = useState(() => new ScrollEngine());
|
|
22297
|
+
const motionGated = isMotionGated(rest);
|
|
22298
|
+
const snapActive = motionGated ? "none" : snap;
|
|
22299
|
+
const dragActive = motionGated ? false : dragToScroll;
|
|
22300
|
+
const { elRef, state, handleScroll, measure } = useScrollPosition({
|
|
22301
|
+
direction,
|
|
22302
|
+
threshold: endThreshold,
|
|
22303
|
+
onScrollEnd,
|
|
22304
|
+
onMeasure: engine.schedule
|
|
22305
|
+
});
|
|
22306
|
+
useIsoLayoutEffect(() => {
|
|
22307
|
+
const el = elRef.current;
|
|
22308
|
+
if (!el) return;
|
|
22309
|
+
engine.attach(el);
|
|
22310
|
+
return () => engine.detach();
|
|
22311
|
+
}, [engine, elRef]);
|
|
22312
|
+
useIsoLayoutEffect(() => {
|
|
22313
|
+
engine.setTrackProgress(trackProgress);
|
|
22314
|
+
}, [engine, trackProgress]);
|
|
22315
|
+
useDragScroll(elRef, {
|
|
22316
|
+
enabled: dragActive,
|
|
22317
|
+
direction,
|
|
22318
|
+
onRelease: snapActive === "mandatory" ? (el) => snapToNearest(el, direction, snapAlign) : void 0
|
|
22319
|
+
});
|
|
22320
|
+
useImperativeHandle(forwardedRef, () => {
|
|
22321
|
+
const getEl = /* @__PURE__ */ __name(() => elRef.current, "getEl");
|
|
22322
|
+
const defaultAxis = /* @__PURE__ */ __name(() => direction === "horizontal" ? "x" : "y", "defaultAxis");
|
|
22323
|
+
const stepScroll = /* @__PURE__ */ __name((dir, o) => {
|
|
22324
|
+
const el = getEl();
|
|
22325
|
+
if (!el) return;
|
|
22326
|
+
const axis = o?.axis ?? defaultAxis();
|
|
22327
|
+
const h = axis === "x";
|
|
22328
|
+
const cur = h ? el.scrollLeft : el.scrollTop;
|
|
22329
|
+
let target;
|
|
22330
|
+
if ((o?.step ?? "page") === "page") {
|
|
22331
|
+
target = cur + dir * (h ? el.clientWidth : el.clientHeight);
|
|
22332
|
+
} else {
|
|
22333
|
+
const targets = snapItems(el).map(
|
|
22334
|
+
(c) => childTarget(el, c, axis, snapAlign)
|
|
22335
|
+
);
|
|
22336
|
+
const found = dir === 1 ? targets.find((t) => t > cur + 1) : [...targets].reverse().find((t) => t < cur - 1);
|
|
22337
|
+
if (found === void 0) return;
|
|
22338
|
+
target = found;
|
|
22339
|
+
}
|
|
22340
|
+
el.scrollTo({
|
|
22341
|
+
[h ? "left" : "top"]: target,
|
|
22342
|
+
behavior: resolveBehavior(o?.behavior)
|
|
22343
|
+
});
|
|
22344
|
+
}, "stepScroll");
|
|
22345
|
+
return {
|
|
22346
|
+
getElement: getEl,
|
|
22347
|
+
measure,
|
|
22348
|
+
scrollTo: /* @__PURE__ */ __name((opts) => getEl()?.scrollTo(opts), "scrollTo"),
|
|
22349
|
+
scrollToTop: /* @__PURE__ */ __name((behavior) => getEl()?.scrollTo({ top: 0, behavior: resolveBehavior(behavior) }), "scrollToTop"),
|
|
22350
|
+
scrollToBottom: /* @__PURE__ */ __name((behavior) => {
|
|
22351
|
+
const el = getEl();
|
|
22352
|
+
if (el)
|
|
22353
|
+
el.scrollTo({
|
|
22354
|
+
top: el.scrollHeight,
|
|
22355
|
+
behavior: resolveBehavior(behavior)
|
|
22356
|
+
});
|
|
22357
|
+
}, "scrollToBottom"),
|
|
22358
|
+
scrollToEdge: /* @__PURE__ */ __name((edge, behavior) => {
|
|
22359
|
+
const el = getEl();
|
|
22360
|
+
if (!el) return;
|
|
22361
|
+
const opts = { behavior: resolveBehavior(behavior) };
|
|
22362
|
+
if (edge === "top") opts.top = 0;
|
|
22363
|
+
if (edge === "bottom") opts.top = el.scrollHeight;
|
|
22364
|
+
if (edge === "left") opts.left = 0;
|
|
22365
|
+
if (edge === "right") opts.left = el.scrollWidth;
|
|
22366
|
+
el.scrollTo(opts);
|
|
22367
|
+
}, "scrollToEdge"),
|
|
22368
|
+
scrollNext: /* @__PURE__ */ __name((o) => stepScroll(1, o), "scrollNext"),
|
|
22369
|
+
scrollPrev: /* @__PURE__ */ __name((o) => stepScroll(-1, o), "scrollPrev"),
|
|
22370
|
+
scrollToIndex: /* @__PURE__ */ __name((index, o) => {
|
|
22371
|
+
const el = getEl();
|
|
22372
|
+
const child = el?.children[index];
|
|
22373
|
+
if (!el || !child) return;
|
|
22374
|
+
const axis = o?.axis ?? defaultAxis();
|
|
22375
|
+
el.scrollTo({
|
|
22376
|
+
[axis === "x" ? "left" : "top"]: childTarget(
|
|
22377
|
+
el,
|
|
22378
|
+
child,
|
|
22379
|
+
axis,
|
|
22380
|
+
snapAlign
|
|
22381
|
+
),
|
|
22382
|
+
behavior: resolveBehavior(o?.behavior)
|
|
22383
|
+
});
|
|
22384
|
+
}, "scrollToIndex")
|
|
22385
|
+
};
|
|
22386
|
+
}, [elRef, measure, direction, snapAlign]);
|
|
22387
|
+
const handleScrollEvent = useCallback(
|
|
22388
|
+
(e) => {
|
|
22389
|
+
onScroll?.(e);
|
|
22390
|
+
handleScroll();
|
|
22391
|
+
},
|
|
22392
|
+
[onScroll, handleScroll]
|
|
22393
|
+
);
|
|
22394
|
+
const responsiveDims = useMemo(() => {
|
|
22395
|
+
const styles = {};
|
|
22396
|
+
const inlineStyle = {};
|
|
22397
|
+
if (isResponsiveValue(maxHeight)) {
|
|
22398
|
+
const { base, responsive } = resolveResponsiveValue(maxHeight);
|
|
22399
|
+
if (base !== void 0) inlineStyle.maxHeight = base;
|
|
22400
|
+
Object.entries(responsive).forEach(([bp, val]) => {
|
|
22401
|
+
styles[bp] = {
|
|
22402
|
+
...styles[bp] ?? {},
|
|
22403
|
+
maxHeight: val
|
|
22404
|
+
};
|
|
22405
|
+
});
|
|
22406
|
+
} else if (maxHeight !== void 0) {
|
|
22407
|
+
inlineStyle.maxHeight = maxHeight;
|
|
22408
|
+
}
|
|
22409
|
+
if (isResponsiveValue(maxWidth)) {
|
|
22410
|
+
const { base, responsive } = resolveResponsiveValue(maxWidth);
|
|
22411
|
+
if (base !== void 0) inlineStyle.maxWidth = base;
|
|
22412
|
+
Object.entries(responsive).forEach(([bp, val]) => {
|
|
22413
|
+
styles[bp] = {
|
|
22414
|
+
...styles[bp] ?? {},
|
|
22415
|
+
maxWidth: val
|
|
22416
|
+
};
|
|
22417
|
+
});
|
|
22418
|
+
} else if (maxWidth !== void 0) {
|
|
22419
|
+
inlineStyle.maxWidth = maxWidth;
|
|
22420
|
+
}
|
|
22421
|
+
return { inlineStyle, breakpointStyles: styles };
|
|
22422
|
+
}, [maxHeight, maxWidth]);
|
|
22423
|
+
const { attribute, style: responsiveCss } = (0, hooks_exports.useResponsiveStyles)(
|
|
22424
|
+
responsiveDims.breakpointStyles
|
|
22425
|
+
);
|
|
22426
|
+
const fadeTop = shouldFade(fadeEdges, "top") && state.hasVerticalOverflow && !state.atTop;
|
|
22427
|
+
const fadeBottom = shouldFade(fadeEdges, "bottom") && state.hasVerticalOverflow && !state.atBottom;
|
|
22428
|
+
const fadeLeft = shouldFade(fadeEdges, "left") && state.hasHorizontalOverflow && !state.atLeft;
|
|
22429
|
+
const fadeRight = shouldFade(fadeEdges, "right") && state.hasHorizontalOverflow && !state.atRight;
|
|
22430
|
+
const maskImage = useMemo(() => {
|
|
22431
|
+
if (direction !== "both") return void 0;
|
|
22432
|
+
if (!fadeTop && !fadeBottom && !fadeLeft && !fadeRight) return void 0;
|
|
22433
|
+
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%"})`;
|
|
22434
|
+
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%"})`;
|
|
22435
|
+
return `${v}, ${h}`;
|
|
22436
|
+
}, [direction, fadeTop, fadeBottom, fadeLeft, fadeRight]);
|
|
22437
|
+
const recipeClasses = resolveRecipe(theme.recipes.ScrollArea, {
|
|
22438
|
+
direction,
|
|
22439
|
+
showScrollbar,
|
|
22440
|
+
scrollbarVariant
|
|
22441
|
+
});
|
|
22442
|
+
const resolvedTabIndex = tabIndex ?? (state.hasVerticalOverflow || state.hasHorizontalOverflow ? 0 : void 0);
|
|
22443
|
+
const snapAxis = direction === "both" ? "both" : direction === "horizontal" ? "x" : "y";
|
|
22444
|
+
const fadeSizeValue = typeof fadeSize === "number" ? `${fadeSize}px` : fadeSize;
|
|
22445
|
+
return /* @__PURE__ */ jsxs(ScrollEngineContext.Provider, { value: engine, children: [
|
|
21167
22446
|
/* @__PURE__ */ jsx(ResponsiveStyle, { css: responsiveCss }),
|
|
21168
22447
|
/* @__PURE__ */ jsx(
|
|
21169
22448
|
Tag,
|
|
21170
22449
|
{
|
|
21171
|
-
ref,
|
|
22450
|
+
ref: elRef,
|
|
22451
|
+
"data-kui-scroll-area": true,
|
|
22452
|
+
"data-direction": direction,
|
|
22453
|
+
"data-fade-top": fadeTop || void 0,
|
|
22454
|
+
"data-fade-bottom": fadeBottom || void 0,
|
|
22455
|
+
"data-fade-left": fadeLeft || void 0,
|
|
22456
|
+
"data-fade-right": fadeRight || void 0,
|
|
22457
|
+
"data-snap-align": snapActive !== "none" ? snapAlign : void 0,
|
|
22458
|
+
"data-drag-scroll": dragActive || void 0,
|
|
21172
22459
|
"data-kui-responsive": attribute,
|
|
21173
|
-
|
|
21174
|
-
|
|
22460
|
+
onScroll: handleScrollEvent,
|
|
22461
|
+
tabIndex: resolvedTabIndex,
|
|
22462
|
+
className: cn(recipeClasses, className),
|
|
22463
|
+
style: {
|
|
22464
|
+
...responsiveDims.inlineStyle,
|
|
22465
|
+
overscrollBehavior,
|
|
22466
|
+
scrollSnapType: snapActive !== "none" ? `${snapAxis} ${snapActive}` : void 0,
|
|
22467
|
+
"--kui-scroll-fade-size": fadeSizeValue,
|
|
22468
|
+
...maskImage ? {
|
|
22469
|
+
maskImage,
|
|
22470
|
+
WebkitMaskImage: maskImage,
|
|
22471
|
+
maskComposite: "intersect",
|
|
22472
|
+
WebkitMaskComposite: "source-in"
|
|
22473
|
+
} : {},
|
|
22474
|
+
...style
|
|
22475
|
+
},
|
|
21175
22476
|
...rest,
|
|
21176
22477
|
children
|
|
21177
22478
|
}
|
|
21178
22479
|
)
|
|
21179
22480
|
] });
|
|
21180
|
-
}
|
|
21181
|
-
);
|
|
21182
|
-
|
|
21183
|
-
|
|
21184
|
-
|
|
21185
|
-
|
|
21186
|
-
|
|
21187
|
-
|
|
22481
|
+
}, "render")
|
|
22482
|
+
});
|
|
22483
|
+
var ScrollArea = Object.assign(ScrollAreaRoot, {
|
|
22484
|
+
Scene: ScrollAreaScene,
|
|
22485
|
+
Sticky: ScrollAreaSticky
|
|
22486
|
+
});
|
|
22487
|
+
function resolveSize(value) {
|
|
22488
|
+
if (value === "full") return "100%";
|
|
22489
|
+
if (value === "fit") return "fit-content";
|
|
22490
|
+
if (value === "auto") return "auto";
|
|
22491
|
+
return resolveSpace(value);
|
|
22492
|
+
}
|
|
22493
|
+
__name(resolveSize, "resolveSize");
|
|
22494
|
+
var Box = createComponent({
|
|
22495
|
+
displayName: "Box",
|
|
22496
|
+
__kui: {
|
|
22497
|
+
role: "layout",
|
|
22498
|
+
skeleton: "preserve",
|
|
22499
|
+
video: {
|
|
22500
|
+
id: "box",
|
|
22501
|
+
safe: true,
|
|
22502
|
+
acceptsChildren: true,
|
|
22503
|
+
interactionStates: []
|
|
21188
22504
|
}
|
|
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,
|
|
22505
|
+
},
|
|
22506
|
+
render: /* @__PURE__ */ __name(({
|
|
21212
22507
|
as: Tag = "div",
|
|
22508
|
+
p,
|
|
22509
|
+
px,
|
|
22510
|
+
py,
|
|
22511
|
+
m,
|
|
22512
|
+
mx,
|
|
22513
|
+
my,
|
|
22514
|
+
bg,
|
|
22515
|
+
color,
|
|
22516
|
+
border = false,
|
|
22517
|
+
rounded,
|
|
22518
|
+
w,
|
|
22519
|
+
h,
|
|
21213
22520
|
className,
|
|
21214
22521
|
style,
|
|
21215
22522
|
unstyled,
|
|
21216
22523
|
children,
|
|
21217
22524
|
...rest
|
|
21218
22525
|
}, ref) => {
|
|
22526
|
+
const { theme } = useTheme();
|
|
22527
|
+
const borderColor = typeof border === "boolean" ? void 0 : border;
|
|
21219
22528
|
const responsiveStyles = (0, hooks_exports.useMergedResponsiveStyles)([
|
|
21220
|
-
[
|
|
21221
|
-
|
|
21222
|
-
|
|
21223
|
-
],
|
|
21224
|
-
[
|
|
21225
|
-
[
|
|
21226
|
-
[
|
|
21227
|
-
[
|
|
21228
|
-
[
|
|
21229
|
-
[
|
|
22529
|
+
[p, (v) => ({ padding: resolveSpace(v) })],
|
|
22530
|
+
[px, (v) => ({ paddingInline: resolveSpace(v) })],
|
|
22531
|
+
[py, (v) => ({ paddingBlock: resolveSpace(v) })],
|
|
22532
|
+
[m, (v) => ({ margin: v === "auto" ? "auto" : resolveSpace(v) })],
|
|
22533
|
+
[mx, (v) => ({ marginInline: v === "auto" ? "auto" : resolveSpace(v) })],
|
|
22534
|
+
[my, (v) => ({ marginBlock: v === "auto" ? "auto" : resolveSpace(v) })],
|
|
22535
|
+
[bg, (v) => ({ background: resolveColor(v) })],
|
|
22536
|
+
[color, (v) => ({ color: resolveColor(v) })],
|
|
22537
|
+
[borderColor, (v) => ({ borderColor: resolveColor(v) })],
|
|
22538
|
+
[rounded, (v) => ({ borderRadius: resolveRadius(v) })],
|
|
22539
|
+
[w, (v) => ({ width: resolveSize(v) })],
|
|
22540
|
+
[h, (v) => ({ height: resolveSize(v) })]
|
|
21230
22541
|
]);
|
|
21231
22542
|
const { attribute, style: responsiveCss } = (0, hooks_exports.useResponsiveStyles)(responsiveStyles);
|
|
22543
|
+
const recipeClasses = resolveRecipe(theme.recipes.Box, {
|
|
22544
|
+
border: Boolean(border)
|
|
22545
|
+
});
|
|
21232
22546
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
21233
22547
|
/* @__PURE__ */ jsx(ResponsiveStyle, { css: responsiveCss }),
|
|
21234
22548
|
/* @__PURE__ */ jsx(
|
|
@@ -21236,144 +22550,15 @@ var Grid = forwardRef(
|
|
|
21236
22550
|
{
|
|
21237
22551
|
ref,
|
|
21238
22552
|
"data-kui-responsive": attribute,
|
|
21239
|
-
className: cn(!unstyled &&
|
|
21240
|
-
style
|
|
22553
|
+
className: cn(!unstyled && recipeClasses, className),
|
|
22554
|
+
style,
|
|
21241
22555
|
...rest,
|
|
21242
22556
|
children
|
|
21243
22557
|
}
|
|
21244
22558
|
)
|
|
21245
22559
|
] });
|
|
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
22560
|
}, "render")
|
|
21293
22561
|
});
|
|
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
22562
|
var InputField = forwardRef(
|
|
21378
22563
|
({
|
|
21379
22564
|
id,
|
|
@@ -21676,7 +22861,7 @@ var defaultTypography = defineTypography({
|
|
|
21676
22861
|
},
|
|
21677
22862
|
sizeMd: {
|
|
21678
22863
|
fontFamily: "{fonts.body}",
|
|
21679
|
-
fontSize: "{fontSizes.
|
|
22864
|
+
fontSize: "{fontSizes.md}",
|
|
21680
22865
|
fontWeight: "{fontWeights.normal}",
|
|
21681
22866
|
lineHeight: "{lineHeights.normal}"
|
|
21682
22867
|
},
|
|
@@ -21701,8 +22886,7 @@ var defaultSizes = defineSizes({
|
|
|
21701
22886
|
fontSize: "{typography.sizeXs}",
|
|
21702
22887
|
gap: "0.25rem",
|
|
21703
22888
|
iconSize: "0.75rem",
|
|
21704
|
-
radius: "0.65rem"
|
|
21705
|
-
separatorSize: "15px"
|
|
22889
|
+
radius: "0.65rem"
|
|
21706
22890
|
},
|
|
21707
22891
|
sm: {
|
|
21708
22892
|
height: "2rem",
|
|
@@ -21711,8 +22895,7 @@ var defaultSizes = defineSizes({
|
|
|
21711
22895
|
fontSize: "{typography.sizeSm}",
|
|
21712
22896
|
gap: "0.375rem",
|
|
21713
22897
|
iconSize: "0.875rem",
|
|
21714
|
-
radius: "0.8rem"
|
|
21715
|
-
separatorSize: "20px"
|
|
22898
|
+
radius: "0.8rem"
|
|
21716
22899
|
},
|
|
21717
22900
|
md: {
|
|
21718
22901
|
height: "2.5rem",
|
|
@@ -21721,8 +22904,7 @@ var defaultSizes = defineSizes({
|
|
|
21721
22904
|
fontSize: "{typography.sizeMd}",
|
|
21722
22905
|
gap: "0.5rem",
|
|
21723
22906
|
iconSize: "1rem",
|
|
21724
|
-
radius: "1rem"
|
|
21725
|
-
separatorSize: "25px"
|
|
22907
|
+
radius: "1rem"
|
|
21726
22908
|
},
|
|
21727
22909
|
lg: {
|
|
21728
22910
|
height: "3rem",
|
|
@@ -21731,8 +22913,7 @@ var defaultSizes = defineSizes({
|
|
|
21731
22913
|
fontSize: "{typography.sizeLg}",
|
|
21732
22914
|
gap: "0.625rem",
|
|
21733
22915
|
iconSize: "1.25rem",
|
|
21734
|
-
radius: "1.15rem"
|
|
21735
|
-
separatorSize: "30px"
|
|
22916
|
+
radius: "1.15rem"
|
|
21736
22917
|
},
|
|
21737
22918
|
xl: {
|
|
21738
22919
|
height: "3.5rem",
|
|
@@ -21741,8 +22922,7 @@ var defaultSizes = defineSizes({
|
|
|
21741
22922
|
fontSize: "{typography.sizeXl}",
|
|
21742
22923
|
gap: "0.875rem",
|
|
21743
22924
|
iconSize: "1.5rem",
|
|
21744
|
-
radius: "1.3rem"
|
|
21745
|
-
separatorSize: "35px"
|
|
22925
|
+
radius: "1.3rem"
|
|
21746
22926
|
}
|
|
21747
22927
|
});
|
|
21748
22928
|
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 +22976,13 @@ var buttonColors = {
|
|
|
21796
22976
|
soft: "bg-white/10 text-white hover:bg-white/20",
|
|
21797
22977
|
link: "text-white"
|
|
21798
22978
|
},
|
|
22979
|
+
black: {
|
|
22980
|
+
solid: "bg-black text-white hover:bg-neutral-900 active:bg-neutral-950 shadow-sm",
|
|
22981
|
+
outline: "border border-black/80 text-black bg-transparent hover:bg-black hover:text-white active:bg-black/90",
|
|
22982
|
+
ghost: "text-black bg-transparent hover:bg-black/10 active:bg-black/15",
|
|
22983
|
+
soft: "bg-black/10 text-black hover:bg-black/15 active:bg-black/20",
|
|
22984
|
+
link: "text-black underline-offset-4 hover:underline"
|
|
22985
|
+
},
|
|
21799
22986
|
neutral: {
|
|
21800
22987
|
solid: "bg-kui-surface-raised text-kui-text hover:bg-kui-surface-sunken",
|
|
21801
22988
|
outline: "border-kui-border text-kui-text hover:bg-kui-surface-raised",
|
|
@@ -21839,7 +23026,11 @@ var buttonRecipe = defineRecipe({
|
|
|
21839
23026
|
});
|
|
21840
23027
|
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
23028
|
var formControlVariants = {
|
|
21842
|
-
outline:
|
|
23029
|
+
outline: {
|
|
23030
|
+
border: "1px solid rgb(var(--kui-border))",
|
|
23031
|
+
backgroundColor: "transparent",
|
|
23032
|
+
color: "rgb(var(--kui-text))"
|
|
23033
|
+
},
|
|
21843
23034
|
filled: "border border-transparent bg-kui-surface-raised text-kui-text",
|
|
21844
23035
|
ghost: "border border-transparent bg-transparent text-kui-text"
|
|
21845
23036
|
};
|
|
@@ -22208,7 +23399,7 @@ var switchRecipe = defineRecipe({
|
|
|
22208
23399
|
disabled: false
|
|
22209
23400
|
}
|
|
22210
23401
|
});
|
|
22211
|
-
var
|
|
23402
|
+
var containerRecipe = defineRecipe({
|
|
22212
23403
|
base: "w-full",
|
|
22213
23404
|
variants: {
|
|
22214
23405
|
maxWidth: {
|
|
@@ -22221,6 +23412,7 @@ var containerReccipe = defineRecipe({
|
|
|
22221
23412
|
}
|
|
22222
23413
|
},
|
|
22223
23414
|
defaultVariants: {
|
|
23415
|
+
size: "lg",
|
|
22224
23416
|
maxWidth: "lg"
|
|
22225
23417
|
}
|
|
22226
23418
|
});
|
|
@@ -22344,18 +23536,179 @@ var numberStepperButtonsRecipe = defineRecipe({
|
|
|
22344
23536
|
var numberStepperButtonRecipe = defineRecipe({
|
|
22345
23537
|
base: "kui-number-stepper__button"
|
|
22346
23538
|
});
|
|
23539
|
+
var cardRecipe = defineRecipe({
|
|
23540
|
+
base: "overflow-hidden rounded-(--kui-radii-lg)",
|
|
23541
|
+
variants: {
|
|
23542
|
+
variant: {
|
|
23543
|
+
solid: "bg-kui-surface",
|
|
23544
|
+
outline: "border border-kui-border bg-kui-surface",
|
|
23545
|
+
ghost: "bg-transparent",
|
|
23546
|
+
elevated: "bg-kui-surface shadow-md",
|
|
23547
|
+
compact: "bg-kui-surface"
|
|
23548
|
+
},
|
|
23549
|
+
fullWidth: {
|
|
23550
|
+
true: "w-full"
|
|
23551
|
+
}
|
|
23552
|
+
},
|
|
23553
|
+
defaultVariants: {
|
|
23554
|
+
variant: "outline"
|
|
23555
|
+
}
|
|
23556
|
+
});
|
|
23557
|
+
var sectionPaddingVariants = {
|
|
23558
|
+
size: {
|
|
23559
|
+
sm: "p-3",
|
|
23560
|
+
md: "p-4",
|
|
23561
|
+
lg: "p-6"
|
|
23562
|
+
}
|
|
23563
|
+
};
|
|
23564
|
+
var sectionPaddingCompoundVariants = [
|
|
23565
|
+
{
|
|
23566
|
+
conditions: { variant: "compact" },
|
|
23567
|
+
className: "p-3"
|
|
23568
|
+
},
|
|
23569
|
+
{
|
|
23570
|
+
conditions: { noPadding: true },
|
|
23571
|
+
className: "p-0"
|
|
23572
|
+
}
|
|
23573
|
+
];
|
|
23574
|
+
var cardHeaderRecipe = defineRecipe({
|
|
23575
|
+
base: "relative flex items-center justify-between gap-(--kui-spacing-md)",
|
|
23576
|
+
variants: sectionPaddingVariants,
|
|
23577
|
+
defaultVariants: {
|
|
23578
|
+
size: "md"
|
|
23579
|
+
},
|
|
23580
|
+
compoundVariants: [...sectionPaddingCompoundVariants]
|
|
23581
|
+
});
|
|
23582
|
+
var cardBodyRecipe = defineRecipe({
|
|
23583
|
+
base: "relative min-w-0",
|
|
23584
|
+
variants: sectionPaddingVariants,
|
|
23585
|
+
defaultVariants: {
|
|
23586
|
+
size: "md"
|
|
23587
|
+
},
|
|
23588
|
+
compoundVariants: [...sectionPaddingCompoundVariants]
|
|
23589
|
+
});
|
|
23590
|
+
var cardFooterRecipe = defineRecipe({
|
|
23591
|
+
base: "relative flex items-center gap-(--kui-spacing-md)",
|
|
23592
|
+
variants: sectionPaddingVariants,
|
|
23593
|
+
defaultVariants: {
|
|
23594
|
+
size: "md"
|
|
23595
|
+
},
|
|
23596
|
+
compoundVariants: [...sectionPaddingCompoundVariants]
|
|
23597
|
+
});
|
|
23598
|
+
var cardMediaRecipe = defineRecipe({
|
|
23599
|
+
base: "relative overflow-hidden"
|
|
23600
|
+
});
|
|
23601
|
+
defineRecipe({
|
|
23602
|
+
base: "h-full w-full",
|
|
23603
|
+
variants: {
|
|
23604
|
+
fit: {
|
|
23605
|
+
cover: "object-cover",
|
|
23606
|
+
contain: "object-contain",
|
|
23607
|
+
fill: "object-fill",
|
|
23608
|
+
none: "object-none"
|
|
23609
|
+
},
|
|
23610
|
+
blend: {
|
|
23611
|
+
normal: "mix-blend-normal",
|
|
23612
|
+
multiply: "mix-blend-multiply",
|
|
23613
|
+
screen: "mix-blend-screen",
|
|
23614
|
+
overlay: "mix-blend-overlay",
|
|
23615
|
+
darken: "mix-blend-darken",
|
|
23616
|
+
lighten: "mix-blend-lighten"
|
|
23617
|
+
}
|
|
23618
|
+
},
|
|
23619
|
+
defaultVariants: {
|
|
23620
|
+
fit: "cover",
|
|
23621
|
+
blend: "normal"
|
|
23622
|
+
}
|
|
23623
|
+
});
|
|
23624
|
+
var cardOverlayRecipe = defineRecipe({
|
|
23625
|
+
base: "absolute inset-0"
|
|
23626
|
+
});
|
|
23627
|
+
var scrollAreaRecipe = defineRecipe({
|
|
23628
|
+
base: "kui-scroll-area",
|
|
23629
|
+
variants: {
|
|
23630
|
+
direction: {
|
|
23631
|
+
vertical: "overflow-y-auto overflow-x-hidden",
|
|
23632
|
+
horizontal: "overflow-x-auto overflow-y-hidden",
|
|
23633
|
+
both: "overflow-auto"
|
|
23634
|
+
},
|
|
23635
|
+
showScrollbar: {
|
|
23636
|
+
auto: "",
|
|
23637
|
+
always: "kui-scrollbar",
|
|
23638
|
+
hover: "kui-scrollbar kui-scrollbar-hover-only",
|
|
23639
|
+
never: "kui-scrollbar-hidden"
|
|
23640
|
+
},
|
|
23641
|
+
scrollbarVariant: {
|
|
23642
|
+
thin: "kui-scrollbar",
|
|
23643
|
+
default: "kui-scrollbar-default-width"
|
|
23644
|
+
}
|
|
23645
|
+
},
|
|
23646
|
+
defaultVariants: {
|
|
23647
|
+
direction: "vertical",
|
|
23648
|
+
showScrollbar: "auto",
|
|
23649
|
+
scrollbarVariant: "thin"
|
|
23650
|
+
}
|
|
23651
|
+
});
|
|
23652
|
+
var boxRecipe = defineRecipe({
|
|
23653
|
+
base: "box-border",
|
|
23654
|
+
variants: {
|
|
23655
|
+
border: {
|
|
23656
|
+
true: "border border-solid border-kui-border",
|
|
23657
|
+
false: ""
|
|
23658
|
+
}
|
|
23659
|
+
},
|
|
23660
|
+
defaultVariants: {
|
|
23661
|
+
border: "false"
|
|
23662
|
+
}
|
|
23663
|
+
});
|
|
23664
|
+
var flexRecipe = defineRecipe({
|
|
23665
|
+
base: "",
|
|
23666
|
+
variants: {
|
|
23667
|
+
inline: {
|
|
23668
|
+
true: "inline-flex",
|
|
23669
|
+
false: "flex"
|
|
23670
|
+
},
|
|
23671
|
+
fullWidth: {
|
|
23672
|
+
true: "w-full",
|
|
23673
|
+
false: ""
|
|
23674
|
+
},
|
|
23675
|
+
fullHeight: {
|
|
23676
|
+
true: "h-full",
|
|
23677
|
+
false: ""
|
|
23678
|
+
}
|
|
23679
|
+
},
|
|
23680
|
+
defaultVariants: {
|
|
23681
|
+
inline: "false",
|
|
23682
|
+
fullWidth: "false",
|
|
23683
|
+
fullHeight: "false"
|
|
23684
|
+
}
|
|
23685
|
+
});
|
|
23686
|
+
var gridRecipe = defineRecipe({
|
|
23687
|
+
base: "",
|
|
23688
|
+
variants: {
|
|
23689
|
+
inline: {
|
|
23690
|
+
true: "inline-grid",
|
|
23691
|
+
false: "grid"
|
|
23692
|
+
}
|
|
23693
|
+
},
|
|
23694
|
+
defaultVariants: {
|
|
23695
|
+
inline: "false"
|
|
23696
|
+
}
|
|
23697
|
+
});
|
|
22347
23698
|
|
|
22348
23699
|
// src/theme/defaults/theme.ts
|
|
22349
23700
|
var defaultRecipes = {
|
|
23701
|
+
Box: boxRecipe,
|
|
22350
23702
|
Button: buttonRecipe,
|
|
23703
|
+
ButtonGroup: buttonGroupRecipe,
|
|
23704
|
+
Checkbox: checkboxRecipe,
|
|
23705
|
+
Flex: flexRecipe,
|
|
22351
23706
|
FormControl: formControlRecipe,
|
|
22352
23707
|
Input: inputRecipe,
|
|
22353
23708
|
Textarea: textareaRecipe,
|
|
22354
23709
|
MarkdownEditor: markdownEditorRecipe,
|
|
22355
|
-
Checkbox: checkboxRecipe,
|
|
22356
|
-
ButtonGroup: buttonGroupRecipe,
|
|
22357
23710
|
Switch: switchRecipe,
|
|
22358
|
-
Container:
|
|
23711
|
+
Container: containerRecipe,
|
|
22359
23712
|
Link: linkRecipe,
|
|
22360
23713
|
RepeaterRemove: repeaterRemoveRecipe,
|
|
22361
23714
|
RepeaterMoveUp: repeaterMoveUpRecipe,
|
|
@@ -22365,7 +23718,15 @@ var defaultRecipes = {
|
|
|
22365
23718
|
RepeaterItems: repeaterItemsRecipe,
|
|
22366
23719
|
NumberStepper: numberStepperRecipe,
|
|
22367
23720
|
NumberStepperButton: numberStepperButtonRecipe,
|
|
22368
|
-
NumberStepperButtons: numberStepperButtonsRecipe
|
|
23721
|
+
NumberStepperButtons: numberStepperButtonsRecipe,
|
|
23722
|
+
CardBody: cardBodyRecipe,
|
|
23723
|
+
CardFooter: cardFooterRecipe,
|
|
23724
|
+
CardHeader: cardHeaderRecipe,
|
|
23725
|
+
CardMedia: cardMediaRecipe,
|
|
23726
|
+
CardOverlay: cardOverlayRecipe,
|
|
23727
|
+
Card: cardRecipe,
|
|
23728
|
+
ScrollArea: scrollAreaRecipe,
|
|
23729
|
+
Grid: gridRecipe
|
|
22369
23730
|
};
|
|
22370
23731
|
var defaultTheme = defineTheme({
|
|
22371
23732
|
tokens: defaultTokens,
|
|
@@ -22459,6 +23820,7 @@ __name(extendSizes, "extendSizes");
|
|
|
22459
23820
|
|
|
22460
23821
|
// src/theme/extendTheme.ts
|
|
22461
23822
|
function extendTheme(override) {
|
|
23823
|
+
console.log(override?.semanticTokens?.colors);
|
|
22462
23824
|
if (!override) {
|
|
22463
23825
|
return defaultTheme;
|
|
22464
23826
|
}
|
|
@@ -22492,7 +23854,9 @@ function KreativUIProvider({
|
|
|
22492
23854
|
as = "div",
|
|
22493
23855
|
fallbackSize = "md",
|
|
22494
23856
|
textColor,
|
|
22495
|
-
background
|
|
23857
|
+
background,
|
|
23858
|
+
style,
|
|
23859
|
+
className
|
|
22496
23860
|
}) {
|
|
22497
23861
|
const [mode, setMode] = useState(defaultMode);
|
|
22498
23862
|
const systemPrefersDark = useSystemPrefersDark();
|
|
@@ -22529,11 +23893,12 @@ function KreativUIProvider({
|
|
|
22529
23893
|
Tag,
|
|
22530
23894
|
{
|
|
22531
23895
|
"data-kreativ-theme": resolvedMode,
|
|
22532
|
-
className: resolvedMode === "dark" ? "dark" : void 0,
|
|
23896
|
+
className: [resolvedMode === "dark" ? "dark" : void 0, className].filter(Boolean).join(" "),
|
|
22533
23897
|
style: {
|
|
22534
23898
|
...cssVars,
|
|
22535
23899
|
...background && { background },
|
|
22536
|
-
...textColor && { color: textColor }
|
|
23900
|
+
...textColor && { color: textColor },
|
|
23901
|
+
...style
|
|
22537
23902
|
},
|
|
22538
23903
|
children
|
|
22539
23904
|
}
|
|
@@ -22544,6 +23909,6 @@ __name(KreativUIProvider, "KreativUIProvider");
|
|
|
22544
23909
|
// src/index.ts
|
|
22545
23910
|
__reExport(index_exports, hooks_exports);
|
|
22546
23911
|
|
|
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,
|
|
23912
|
+
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
23913
|
//# sourceMappingURL=index.js.map
|
|
22549
23914
|
//# sourceMappingURL=index.js.map
|